@mwillbanks/ast-mcp 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ast-mcp.js CHANGED
@@ -1,54 +1,166 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var hU=Object.create;var{getPrototypeOf:uU,defineProperty:QY,getOwnPropertyNames:lU}=Object;var mU=Object.prototype.hasOwnProperty;function cU(W){return this[W]}var pU,dU,iU=(W,Q,X)=>{var Y=W!=null&&typeof W==="object";if(Y){var G=Q?pU??=new WeakMap:dU??=new WeakMap,B=G.get(W);if(B)return B}X=W!=null?hU(uU(W)):{};let F=Q||!W||!W.__esModule?QY(X,"default",{value:W,enumerable:!0}):X;for(let L of lU(W))if(!mU.call(F,L))QY(F,L,{get:cU.bind(W,L),enumerable:!0});if(Y)G.set(W,F);return F};var d1=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports);var nU=(W)=>W;function rU(W,Q){this[W]=nU.bind(null,Q)}var F4=(W,Q)=>{for(var X in Q)QY(W,X,{get:Q[X],enumerable:!0,configurable:!0,set:rU.bind(Q,X)})};var $0=(W,Q)=>()=>(W&&(Q=W(W=0)),Q);var oU=(W)=>Promise.all(W),w5=import.meta.require;var kB={};F4(kB,{runCli:()=>aU});async function aU(W,Q){let[X,...Y]=W;if(X==="mcp"){await Q.mcp();return}if(X==="hook")return Q.hook();if(["install","update","uninstall"].includes(X??"")){await Q.installer([X,...Y]);return}throw Error("Usage: ast-mcp <install|update|uninstall|hook|mcp> [options]")}var yB={};F4(yB,{runHook:()=>XA,evaluateHook:()=>vB,decisionPayload:()=>XY});function vB(W){let Q=String(W.tool_name??W.toolName??W.name??"");if(sU.test(Q))return{denied:!0,reason:"Direct file editing is blocked. Use ast-mcp."};if(!eU.test(Q))return{denied:!1};let X=W.tool_input??W.toolInput??W.toolArgs??W.input??W.args,Y=X&&typeof X==="object"?X:{},G=typeof X==="string"?X:String(Y.cmd??Y.command??Y.script??Y.source??Y.code??"");return G&&(tU.test(G)||WA.test(G)||QA.test(G))?{denied:!0,reason:"Direct file mutation is blocked. Use ast-mcp."}:{denied:!1}}function XY(W){if(!W.denied)return{};return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:W.reason},permissionDecision:"deny",permissionDecisionReason:W.reason}}async function XA(W=Bun.stdin.json()){try{return process.stdout.write(`${JSON.stringify(XY(vB(await W)))}
4
- `),0}catch(Q){return process.stdout.write(`${JSON.stringify(XY({denied:!0,reason:`Invalid hook input: ${String(Q)}`}))}
5
- `),2}}var sU,tU,eU,WA,QA;var _B=$0(async()=>{sU=/^(?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)$/,tU=/tools(?:\.(?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)|\s*\[\s*["'](?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)["']\s*\])\s*\(/,eU=/^(?:bash|shell|terminal|exec|functions\.exec|mcp__functions__exec|codex\.exec|exec_command|functions\.exec_command|Bash|powershell|PowerShell)$/,WA=/(?:^|[;&|]\s*|["'`]\s*|:\s*["'`]\s*)(?:(?:env(?:\s+(?:--?[^\s"'`]+|[A-Za-z_][A-Za-z0-9_]*=[^\s"'`]+))*|command|sudo(?:\s+--?[^\s"'`]+)*|nice(?:\s+--?[^\s"'`]+)*|nohup|busybox)\s+)*(?:(?:\/[^\s/"'`]+)*\/)?(?:apply_patch|patch|tee|truncate|touch|rm|mv|cp|install|dd|ed|awk|mkdir|rmdir|chmod|chown|python\d*|node|ruby|perl|php|sed|ast-grep)(?=\s|["'`]|$)|(?:^|[;&|]\s*|["'`]\s*|:\s*["'`]\s*)(?:find\b[^\n]*\s-delete\b|xargs\s+(?:[^\n]*\s)?rm\b|git(?:\s+(?:-[A-Za-z]\s+[^\s"'`]+|--?[^\s"'`]+))*\s+(?:apply|checkout|restore|reset|clean)|dprint\s+fmt|bun\s+(?:-e|--eval)|(?:Set|Add)-Content|Out-File|Remove-Item|Move-Item|Copy-Item|New-Item)(?=\s|["'`]|$)|(?:^|[^<\d>])>{1,2}(?!=)|<<[-~]?\s*\w/i,QA=/(?:bash|sh|zsh|dash|ksh|fish|pwsh|powershell|node|python\d*|ruby|perl|php)(?:["']|\s)+(?:--?[A-Za-z][A-Za-z0-9-]*(?:=[^\s"']+)?(?:["']|\s)+)*(?:-c|--command|-Command|-e|--eval)(?=\s|["']|$)/i});function $Q(W,Q,X){if(!W||typeof W!=="object")return!1;let Y=W;if(Q==="preToolUse")return Y.command===X&&Y.type==="command";return Array.isArray(Y.hooks)&&Y.hooks.some((G)=>G&&typeof G==="object"&&G.command===X&&G.type==="command")}var gB=()=>{};var iB={};F4(iB,{update:()=>pB,uninstall:()=>dB,runInstallerCli:()=>HA,install:()=>cB});import{cp as UQ,lstat as YA,mkdir as wQ,readdir as GA,readFile as y5,rm as l6,writeFile as KY}from"fs/promises";import fB from"os";import W0 from"path";async function z4(W){try{return JSON.parse(await y5(W,"utf8"))}catch(Q){if(Q.code==="ENOENT")return{};throw Q}}async function MQ(W,Q){await wQ(W0.dirname(W),{recursive:!0}),await KY(W,`${JSON.stringify(Q,null,2)}
6
- `)}function JY(W){return{args:[DQ,"mcp"],command:"bun",env:W?{AST_MCP_ALLOW_EXTERNAL_ROOTS:"1",AST_MCP_ROOTS:W}:{}}}async function FA(W,Q){let Y=(await y5(W,"utf8").catch(()=>"")).replace(/# ast-mcp:begin[\s\S]*?# ast-mcp:end\n?/g,"").trimEnd(),G=Q?`env = { AST_MCP_ALLOW_EXTERNAL_ROOTS = "1", AST_MCP_ROOTS = ${JSON.stringify(Q)} }
3
+ var tU=Object.create;var{getPrototypeOf:eU,defineProperty:LY,getOwnPropertyNames:WA}=Object;var XA=Object.prototype.hasOwnProperty;function QA(W){return this[W]}var YA,GA,BA=(W,X,Q)=>{var Y=W!=null&&typeof W==="object";if(Y){var G=X?YA??=new WeakMap:GA??=new WeakMap,B=G.get(W);if(B)return B}Q=W!=null?tU(eU(W)):{};let F=X||!W||!W.__esModule?LY(Q,"default",{value:W,enumerable:!0}):Q;for(let L of WA(W))if(!XA.call(F,L))LY(F,L,{get:QA.bind(W,L),enumerable:!0});if(Y)G.set(W,F);return F};var i1=(W,X)=>()=>(X||W((X={exports:{}}).exports,X),X.exports);var FA=(W)=>W;function LA(W,X){this[W]=FA.bind(null,X)}var L4=(W,X)=>{for(var Q in X)LY(W,Q,{get:X[Q],enumerable:!0,configurable:!0,set:LA.bind(X,Q)})};var H0=(W,X)=>()=>(W&&(X=W(W=0)),X);var zA=(W)=>Promise.all(W),w5=import.meta.require;var mB={};L4(mB,{runCli:()=>JA,getCliHelp:()=>YW});function YW(W){return W&&Object.hasOwn(DX,W)?DX[W]:W?void 0:`ast-mcp - AST-aware Model Context Protocol server
4
+
5
+ Usage:
6
+ ast-mcp <command> [options]
7
+
8
+ Commands:
9
+ install Configure ast-mcp for one or more supported hosts
10
+ update Refresh an existing ast-mcp configuration
11
+ uninstall Remove ast-mcp-managed configuration
12
+ mcp Start the stdio MCP server
13
+ hook Run the pre-tool-use filesystem guard
14
+ help Display help for a command
15
+
16
+ Options:
17
+ -h, --help Display help
18
+
19
+ Run "ast-mcp help <command>" for command-specific help.
20
+ `}function zY(W,X){let Q=X===void 0?YW():YW(X)??`ast-mcp - AST-aware Model Context Protocol server
21
+
22
+ Usage:
23
+ ast-mcp <command> [options]
24
+
25
+ Commands:
26
+ install Configure ast-mcp for one or more supported hosts
27
+ update Refresh an existing ast-mcp configuration
28
+ uninstall Remove ast-mcp-managed configuration
29
+ mcp Start the stdio MCP server
30
+ hook Run the pre-tool-use filesystem guard
31
+ help Display help for a command
32
+
33
+ Options:
34
+ -h, --help Display help
35
+
36
+ Run "ast-mcp help <command>" for command-specific help.
37
+ `;if(W.stdout)W.stdout(Q);else process.stdout.write(Q)}function x4(W,X,Q){let Y=Q===void 0?YW():YW(Q)??`ast-mcp - AST-aware Model Context Protocol server
38
+
39
+ Usage:
40
+ ast-mcp <command> [options]
41
+
42
+ Commands:
43
+ install Configure ast-mcp for one or more supported hosts
44
+ update Refresh an existing ast-mcp configuration
45
+ uninstall Remove ast-mcp-managed configuration
46
+ mcp Start the stdio MCP server
47
+ hook Run the pre-tool-use filesystem guard
48
+ help Display help for a command
49
+
50
+ Options:
51
+ -h, --help Display help
52
+
53
+ Run "ast-mcp help <command>" for command-specific help.
54
+ `,G=`ast-mcp: ${X}
55
+
56
+ ${Y}`;if(W.stderr)W.stderr(G);else process.stderr.write(G);return 1}async function JA(W,X){let[Q,...Y]=W;if(!Q||Q==="--help"||Q==="-h")return zY(X),0;if(Q==="help"){let[G,...B]=Y;if(B.length>0)return x4(X,`Unexpected argument: ${B[0]}`);if(G&&!Object.hasOwn(DX,G))return x4(X,`Unknown command: ${G}`);return zY(X,G),0}if(!Object.hasOwn(DX,Q))return x4(X,`Unknown command: ${Q}`);if(Y.includes("--help")||Y.includes("-h"))return zY(X,Q),0;if(Q==="mcp"){if(Y.length>0)return x4(X,`Unexpected argument for mcp: ${Y[0]}`,Q);await X.mcp();return}if(Q==="hook"){if(Y.length>0)return x4(X,`Unexpected argument for hook: ${Y[0]}`,Q);return X.hook()}try{await X.installer([Q,...Y]);return}catch(G){if(G instanceof Error&&G.name==="InstallerUsageError")return x4(X,G.message,Q);throw G}}var DX;var cB=H0(()=>{DX={hook:`Usage:
57
+ ast-mcp hook
58
+
59
+ Run the pre-tool-use filesystem guard. Hook input is read from stdin.
60
+
61
+ Options:
62
+ -h, --help Display help
63
+ `,install:`Usage:
64
+ ast-mcp install [options]
65
+
66
+ Configure ast-mcp for supported hosts.
67
+
68
+ Options:
69
+ -s, --scope <scope> Installation scope: local or global (default: local)
70
+ -t, --target <target> Host: codex, claude, copilot, or all (default: all)
71
+ -r, --root <path> Project root for local scope (default: current directory)
72
+ -h, --help Display help
73
+ `,mcp:`Usage:
74
+ ast-mcp mcp
75
+
76
+ Start the stdio MCP server. Protocol messages are read from stdin and written to stdout.
77
+
78
+ Options:
79
+ -h, --help Display help
80
+ `,uninstall:`Usage:
81
+ ast-mcp uninstall [options]
82
+
83
+ Remove ast-mcp-managed configuration while preserving shared host files.
84
+
85
+ Options:
86
+ -s, --scope <scope> Installation scope: local or global (default: local)
87
+ -t, --target <target> Host: codex, claude, copilot, or all (default: all)
88
+ -r, --root <path> Project root for local scope (default: current directory)
89
+ -h, --help Display help
90
+ `,update:`Usage:
91
+ ast-mcp update [options]
92
+
93
+ Refresh managed configuration and installed skill content.
94
+
95
+ Options:
96
+ -s, --scope <scope> Installation scope: local or global (default: local)
97
+ -t, --target <target> Host: codex, claude, copilot, or all (default: all)
98
+ -r, --root <path> Project root for local scope (default: current directory)
99
+ -h, --help Display help
100
+ `}});var dB={};L4(dB,{runHook:()=>AA,evaluateHook:()=>pB,decisionPayload:()=>JY});function pB(W){let X=String(W.tool_name??W.toolName??W.name??"");if(KA.test(X))return{denied:!0,reason:"Direct file editing is blocked. Use ast-mcp."};if(!$A.test(X))return{denied:!1};let Q=W.tool_input??W.toolInput??W.toolArgs??W.input??W.args,Y=Q&&typeof Q==="object"?Q:{},G=typeof Q==="string"?Q:String(Y.cmd??Y.command??Y.script??Y.source??Y.code??"");return G&&(ZA.test(G)||HA.test(G)||UA.test(G))?{denied:!0,reason:"Direct file mutation is blocked. Use ast-mcp."}:{denied:!1}}function JY(W){if(!W.denied)return{};return{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:W.reason},permissionDecision:"deny",permissionDecisionReason:W.reason}}async function AA(W=Bun.stdin.json()){try{return process.stdout.write(`${JSON.stringify(JY(pB(await W)))}
101
+ `),0}catch(X){return process.stdout.write(`${JSON.stringify(JY({denied:!0,reason:`Invalid hook input: ${String(X)}`}))}
102
+ `),2}}var KA,ZA,$A,HA,UA;var iB=H0(async()=>{KA=/^(?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)$/,ZA=/tools(?:\.(?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)|\s*\[\s*["'](?:apply_patch|edit|editFiles|create|createFile|write|writeFile|replace|str_replace|MultiEdit|Edit|Write|NotebookEdit)["']\s*\])\s*\(/,$A=/^(?:bash|shell|terminal|exec|functions\.exec|mcp__functions__exec|codex\.exec|exec_command|functions\.exec_command|Bash|powershell|PowerShell)$/,HA=/(?:^|[;&|]\s*|["'`]\s*|:\s*["'`]\s*)(?:(?:env(?:\s+(?:--?[^\s"'`]+|[A-Za-z_][A-Za-z0-9_]*=[^\s"'`]+))*|command|sudo(?:\s+--?[^\s"'`]+)*|nice(?:\s+--?[^\s"'`]+)*|nohup|busybox)\s+)*(?:(?:\/[^\s/"'`]+)*\/)?(?:apply_patch|patch|tee|truncate|touch|rm|mv|cp|install|dd|ed|awk|mkdir|rmdir|chmod|chown|python\d*|node|ruby|perl|php|sed|ast-grep)(?=\s|["'`]|$)|(?:^|[;&|]\s*|["'`]\s*|:\s*["'`]\s*)(?:find\b[^\n]*\s-delete\b|xargs\s+(?:[^\n]*\s)?rm\b|git(?:\s+(?:-[A-Za-z]\s+[^\s"'`]+|--?[^\s"'`]+))*\s+(?:apply|checkout|restore|reset|clean)|dprint\s+fmt|bun\s+(?:-e|--eval)|(?:Set|Add)-Content|Out-File|Remove-Item|Move-Item|Copy-Item|New-Item)(?=\s|["'`]|$)|(?:^|[^<\d>])>{1,2}(?!=)|<<[-~]?\s*\w/i,UA=/(?:bash|sh|zsh|dash|ksh|fish|pwsh|powershell|node|python\d*|ruby|perl|php)(?:["']|\s)+(?:--?[A-Za-z][A-Za-z0-9-]*(?:=[^\s"']+)?(?:["']|\s)+)*(?:-c|--command|-Command|-e|--eval)(?=\s|["']|$)/i});function MX(W,X,Q){if(!W||typeof W!=="object")return!1;let Y=W;if(X==="preToolUse")return Y.command===Q&&Y.type==="command";return Array.isArray(Y.hooks)&&Y.hooks.some((G)=>G&&typeof G==="object"&&G.command===Q&&G.type==="command")}var nB=()=>{};var aB={};L4(aB,{resolveDependencyBinary:()=>$Y,assertAstBroAvailable:()=>HY,PACKAGE_ROOT:()=>oB,DPRINT_BINARY:()=>EA,AST_BRO_VERSION:()=>FW,AST_BRO_BINARY:()=>z4});import{accessSync as NA,constants as KY,readFileSync as VA}from"fs";import{createRequire as wA}from"module";import rB from"os";import N1 from"path";function MA(W,X){if(X!=="win32")return[W];let Q=(process.env.PATHEXT??".EXE;.CMD;.BAT;.COM").split(";").filter(Boolean);return[W,...Q.map((Y)=>`${W}${Y}`)]}function ZY(W,X){try{return NA(W,X==="win32"?KY.F_OK:KY.F_OK|KY.X_OK),!0}catch{return!1}}function OA(W,X){try{let Q=DA.resolve(`${W}/package.json`),Y=JSON.parse(VA(Q,"utf8")),G=typeof Y.bin==="string"?Y.bin:Y.bin?.[X];return G?N1.resolve(N1.dirname(Q),G):void 0}catch{return}}function BW(W,X){try{let Q=Bun.spawnSync([W,...X],{stderr:"ignore",stdout:"pipe"});return Q.exitCode===0?Q.stdout.toString().trim():""}catch{return""}}function jA(W,X){let Q=new Set,Y=(F)=>{if(F)Q.add(N1.resolve(F))},G=BW("yarn",["bin",W]);if(G)Y(N1.dirname(G));Y(process.env.BUN_INSTALL&&N1.join(process.env.BUN_INSTALL,"bin")),Y(process.env.PNPM_HOME),Y(process.env.npm_config_prefix&&(X==="win32"?process.env.npm_config_prefix:N1.join(process.env.npm_config_prefix,"bin"))),Y(N1.join(rB.homedir(),".bun/bin")),Y(N1.join(rB.homedir(),".bun/install/global/node_modules/.bin")),Y(BW("bun",["pm","bin","-g"])),Y(BW("pnpm",["bin","-g"])),Y(BW("yarn",["global","bin"]));let B=BW("npm",["prefix","-g"]);return Y(B&&(X==="win32"?B:N1.join(B,"bin"))),[...Q]}function $Y(W,X=W,Q={}){let Y=Q.platform??process.platform,G=Q.packageRoot??oB,B=MA(W,Y),F=[];for(let Z=G;N1.dirname(Z)!==Z;Z=N1.dirname(Z))for(let D of B)F.push(N1.join(Z,"node_modules/.bin",D));let L=Q.packageBinary??OA(X,W);if(L)F.push(L);let z=F.find((Z)=>ZY(Z,Y));if(z)return z;let J=Q.globalBinDirectories??jA(W,Y);F.length=0;for(let Z of J)for(let D of B)F.push(N1.join(Z,D));let K=F.find((Z)=>ZY(Z,Y));if(K)return K;F.length=0;for(let Z of(Q.pathValue??process.env.PATH??"").split(N1.delimiter))if(Z)for(let D of B)F.push(N1.join(Z,D));return F.find((Z)=>ZY(Z,Y))}function HY(W=z4,X=process.platform,Q=process.arch){let Y="",G="binary not found";try{let L=Bun.spawnSync([W,"--version"],{stderr:"pipe",stdout:"pipe"});if(Y=L.stdout.toString().trim(),L.exitCode===0&&Y===`ast-bro ${FW}`)return;G=L.stderr.toString().trim()||Y||G}catch(L){G=L instanceof Error?L.message:String(L)}let B=X==="win32"?`$env:AST_BRO_BINARY = "$HOME\\.cargo\\bin\\ast-bro.exe"
103
+ [Environment]::SetEnvironmentVariable("AST_BRO_BINARY", "$HOME\\.cargo\\bin\\ast-bro.exe", "User")`:`export AST_BRO_BINARY="$HOME/.cargo/bin/ast-bro"
104
+ printf '%s\\n' 'export AST_BRO_BINARY="$HOME/.cargo/bin/ast-bro"' >> "$HOME/.profile"
105
+ # For zsh login shells, persist the same line in "$HOME/.zprofile" instead.`,F=X==="darwin"&&Q==="arm64"?`The npm package includes a macOS Apple Silicon binary. If Bun blocked its installer, run:
106
+ bun pm trust @ast-bro/cli
107
+ Then rerun ast-mcp install.`:`No precompiled ast-bro ${FW} binary is published for ${X}-${Q}. Install Rust from https://rustup.rs, then run:`;throw Error(`ast-bro ${FW} is required before ast-mcp can configure a host.
108
+ Resolved binary: ${W}
109
+ Failure: ${G}
110
+
111
+ ${F}
112
+ cargo install ast-bro --version ${FW} --locked
113
+
114
+ Set AST_BRO_BINARY before rerunning the installer and persist it for the host process:
115
+ ${B}
116
+
117
+ Restart the host after installation so it receives the environment variable. GUI-launched hosts must be started from that configured environment or receive AST_BRO_BINARY through their launcher.`)}var oB,DA,FW="3.0.0",z4,EA;var LW=H0(()=>{oB=N1.resolve(import.meta.dir,N1.basename(import.meta.dir)==="dist"?"..":"../.."),DA=wA(import.meta.url);z4=process.env.AST_BRO_BINARY??$Y("ast-bro","@ast-bro/cli")??"ast-bro";EA=process.env.DPRINT_BINARY??$Y("dprint","dprint")??"dprint"});var FF={};L4(FF,{update:()=>GF,uninstall:()=>BF,runInstallerCli:()=>vA,install:()=>YF});import{cp as OX,lstat as IA,mkdir as RX,readdir as RA,readFile as _5,rm as y5,writeFile as OY}from"fs/promises";import sB from"os";import W0 from"path";async function J4(W){try{return JSON.parse(await _5(W,"utf8"))}catch(X){if(X.code==="ENOENT")return{};throw X}}async function PX(W,X){await RX(W0.dirname(W),{recursive:!0}),await OY(W,`${JSON.stringify(X,null,2)}
118
+ `)}function MY(W){return{args:[TX,"mcp"],command:"bun",env:W?{AST_MCP_ALLOW_EXTERNAL_ROOTS:"1",AST_MCP_ROOTS:W}:{}}}async function PA(W,X){let Y=(await _5(W,"utf8").catch(()=>"")).replace(/# ast-mcp:begin[\s\S]*?# ast-mcp:end\n?/g,"").trimEnd(),G=X?`env = { AST_MCP_ALLOW_EXTERNAL_ROOTS = "1", AST_MCP_ROOTS = ${JSON.stringify(X)} }
7
119
  `:"",B=`# ast-mcp:begin
8
120
  [mcp_servers.ast-mcp]
9
121
  command = "bun"
10
- args = [${JSON.stringify(DQ)}, "mcp"]
11
- ${G}# ast-mcp:end`;await wQ(W0.dirname(W),{recursive:!0}),await KY(W,`${Y?`${Y}
122
+ args = [${JSON.stringify(TX)}, "mcp"]
123
+ ${G}# ast-mcp:end`;await RX(W0.dirname(W),{recursive:!0}),await OY(W,`${Y?`${Y}
12
124
 
13
125
  `:""}${B}
14
- `)}async function GY(W,Q,X=!1){let Y=await z4(W);Y.mcpServers={...Y.mcpServers??{},"ast-mcp":X?{type:"local",...JY(Q),tools:["*"]}:JY(Q)},await MQ(W,Y)}async function LA(W,Q){let X=await z4(W);X.servers={...X.servers??{},"ast-mcp":{type:"stdio",...JY(Q)}},await MQ(W,X)}async function BY(W,Q,X,Y){await l6(X,{force:!0});let G=await z4(W);if(Q==="preToolUse")G.version??=1;G.hooks??={};let B=Array.isArray(G.hooks[Q])?G.hooks[Q]:[],F=`bun ${JSON.stringify(DQ)} hook`,L=B.filter((J)=>!$Q(J,Q,F)),z=Q==="preToolUse"?{command:F,matcher:"bash|powershell|edit|create",timeoutSec:10,type:"command"}:{hooks:[{command:F,statusMessage:"Enforcing ast-mcp writes",timeout:10,type:"command"}],matcher:".*"};G.hooks[Q]=[...L,z],await MQ(W,G)}async function FY(W){let Q=W0.join(W,"ast-mcp");await l6(Q,{force:!0,recursive:!0}),await wQ(W,{recursive:!0}),await UQ(W0.join(YW,"templates/skills","ast-mcp"),Q,{filter:(X)=>W0.basename(X)!==".ast-bro",force:!0,recursive:!0}),await UQ(W0.join(YW,"templates/AGENTS.md"),W0.join(Q,"references/agents-guidance.md"),{force:!0}),await UQ(BA,W0.join(Q,"references/hook.ts"),{force:!0}),await UQ(W0.join(Q,"SKILL.md"),W0.join(Q,"references/skill-template.md"),{force:!0})}async function ZY(W,Q){let X=Q.trimEnd();if(!X){await l6(W,{force:!0});return}await wQ(W0.dirname(W),{recursive:!0}),await KY(W,`${X}
15
- `)}async function LY(W){let Q=(await y5(W0.join(YW,"templates/AGENTS.md"),"utf8")).trim(),Y=(await y5(W,"utf8").catch(()=>"")).replace(xB,"").trimEnd();await ZY(W,`${Y?`${Y}
126
+ `)}async function AY(W,X,Q=!1){let Y=await J4(W);Y.mcpServers={...Y.mcpServers??{},"ast-mcp":Q?{type:"local",...MY(X),tools:["*"]}:MY(X)},await PX(W,Y)}async function SA(W,X){let Q=await J4(W);Q.servers={...Q.servers??{},"ast-mcp":{type:"stdio",...MY(X)}},await PX(W,Q)}async function NY(W,X,Q,Y){await y5(Q,{force:!0});let G=await J4(W);if(X==="preToolUse")G.version??=1;G.hooks??={};let B=Array.isArray(G.hooks[X])?G.hooks[X]:[],F=`bun ${JSON.stringify(TX)} hook`,L=B.filter((J)=>!MX(J,X,F)),z=X==="preToolUse"?{command:F,matcher:"bash|powershell|edit|create",timeoutSec:10,type:"command"}:{hooks:[{command:F,statusMessage:"Enforcing ast-mcp writes",timeout:10,type:"command"}],matcher:".*"};G.hooks[X]=[...L,z],await PX(W,G)}async function VY(W){let X=W0.join(W,"ast-mcp");await y5(X,{force:!0,recursive:!0}),await RX(W,{recursive:!0}),await OX(W0.join(JW,"templates/skills","ast-mcp"),X,{filter:(Q)=>W0.basename(Q)!==".ast-bro",force:!0,recursive:!0}),await OX(W0.join(JW,"templates/AGENTS.md"),W0.join(X,"references/agents-guidance.md"),{force:!0}),await OX(TA,W0.join(X,"references/hook.ts"),{force:!0}),await OX(W0.join(X,"SKILL.md"),W0.join(X,"references/skill-template.md"),{force:!0})}async function jY(W,X){let Q=X.trimEnd();await RX(W0.dirname(W),{recursive:!0}),await OY(W,Q?`${Q}
127
+ `:"")}async function wY(W){let X=(await _5(W0.join(JW,"templates/AGENTS.md"),"utf8")).trim(),Y=(await _5(W,"utf8").catch(()=>"")).replace(tB,"").trimEnd();await jY(W,`${Y?`${Y}
16
128
 
17
- `:""}${zA}
129
+ `:""}${bA}
18
130
 
19
- ${Q}
131
+ ${X}
20
132
 
21
- ${JA}`)}async function AQ(W){let Q=await y5(W,"utf8").catch(()=>"");await ZY(W,Q.replace(xB,""))}async function hB(W,Q){if(Object.keys(Q).length===0){await l6(W,{force:!0});return}await MQ(W,Q)}async function NQ(W,Q="mcpServers"){let X=await z4(W),Y=X[Q];if(!Y||typeof Y!=="object"||!("ast-mcp"in Y))return;if(delete Y["ast-mcp"],Object.keys(Y).length===0)delete X[Q];await hB(W,X)}async function KA(W){let Q=await y5(W,"utf8").catch(()=>"");await ZY(W,Q.replace(/# ast-mcp:begin[\s\S]*?# ast-mcp:end\n?/g,""))}async function zY(W,Q,X){let Y=await z4(W),G=Y.hooks;if(!G||!Array.isArray(G[Q]))return;let B=[`bun ${JSON.stringify(X)}`,`bun ${JSON.stringify(DQ)} hook`];if(G[Q]=G[Q].filter((F)=>!B.some((L)=>$Q(F,Q,L))),G[Q].length===0)delete G[Q];if(Object.keys(G).length===0)delete Y.hooks;await hB(W,Y)}async function ZA(W){let Q=await y5(W0.join(W,".codex/config.toml"),"utf8").catch(()=>""),X=await z4(W0.join(W,".mcp.json")),Y=await z4(W0.join(W,".github/mcp.json"));return Boolean(Q.includes("# ast-mcp:begin")||X.mcpServers?.["ast-mcp"]||Y.mcpServers?.["ast-mcp"])}function uB(W,Q,X,Y){if(W==="codex"){let B=Q?W0.join(Y,".codex"):W0.join(X,".codex");return[W0.join(B,"config.toml"),W0.join(B,"hooks.json"),W0.join(B,"hooks/ast-mcp.ts"),W0.join(B,"skills/ast-mcp"),Q?W0.join(B,"AGENTS.md"):W0.join(X,"AGENTS.md")]}if(W==="claude"){let B=Q?W0.join(Y,".claude"):W0.join(X,".claude");return[Q?W0.join(Y,".claude.json"):W0.join(X,".mcp.json"),W0.join(B,"settings.json"),W0.join(B,"hooks/ast-mcp.ts"),W0.join(B,"skills/ast-mcp"),Q?W0.join(B,"CLAUDE.md"):W0.join(X,"AGENTS.md")]}let G=Q?W0.join(Y,".copilot"):W0.join(X,".github");return[Q?W0.join(G,"mcp-config.json"):W0.join(X,".github/mcp.json"),...Q?[]:[W0.join(X,".vscode/mcp.json")],W0.join(G,"hooks/ast-mcp.json"),W0.join(G,"hooks/ast-mcp.ts"),W0.join(G,"skills/ast-mcp"),Q?W0.join(G,"copilot-instructions.md"):W0.join(X,"AGENTS.md")]}async function VQ(W){let Q=new Map,X=async(Y)=>{if(W0.basename(Y)===".ast-bro")return;let G=await YA(Y).catch(()=>{return});if(!G)return;if(G.isDirectory()){for(let B of await GA(Y))await X(W0.join(Y,B));return}if(G.isFile())Q.set(Y,(await y5(Y)).toString("base64"))};return await Promise.all(W.map(X)),Q}function lB(W,Q){return[...new Set([...W.keys(),...Q.keys()])].filter((X)=>W.get(X)!==Q.get(X)).sort()}async function mB(W){let Q=W0.resolve(W.root),X=W.home??fB.homedir(),Y=W.scope==="global",G=W.targets.flatMap((F)=>uB(F,Y,Q,X)),B=await VQ(G);for(let F of W.targets)if(F==="codex"){let L=Y?W0.join(X,".codex"):W0.join(Q,".codex");await FA(W0.join(L,"config.toml"),Y?void 0:Q),await BY(W0.join(L,"hooks.json"),"PreToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):".codex/hooks/ast-mcp.ts"),await FY(W0.join(L,"skills")),await LY(Y?W0.join(L,"AGENTS.md"):W0.join(Q,"AGENTS.md"))}else if(F==="claude"){let L=Y?W0.join(X,".claude"):W0.join(Q,".claude");await GY(Y?W0.join(X,".claude.json"):W0.join(Q,".mcp.json"),Y?void 0:Q),await BY(W0.join(L,"settings.json"),"PreToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):"${CLAUDE_PROJECT_DIR}/.claude/hooks/ast-mcp.ts"),await FY(W0.join(L,"skills")),await LY(Y?W0.join(L,"CLAUDE.md"):W0.join(Q,"AGENTS.md"))}else{let L=Y?W0.join(X,".copilot"):W0.join(Q,".github");if(Y)await GY(W0.join(L,"mcp-config.json"),void 0,!0);else await GY(W0.join(Q,".github/mcp.json"),Q,!0),await LA(W0.join(Q,".vscode/mcp.json"),Q);await BY(W0.join(L,"hooks/ast-mcp.json"),"preToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):".github/hooks/ast-mcp.ts"),await FY(W0.join(L,"skills")),await LY(Y?W0.join(L,"copilot-instructions.md"):W0.join(Q,"AGENTS.md"))}return lB(B,await VQ(G))}async function cB(W){return mB(W)}async function pB(W){return mB(W)}async function dB(W){let Q=W0.resolve(W.root),X=W.home??fB.homedir(),Y=W.scope==="global",G=W.targets.flatMap((F)=>uB(F,Y,Q,X)),B=await VQ(G);for(let F of W.targets)if(F==="codex"){let L=Y?W0.join(X,".codex"):W0.join(Q,".codex");if(await KA(W0.join(L,"config.toml")),await zY(W0.join(L,"hooks.json"),"PreToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):".codex/hooks/ast-mcp.ts"),await l6(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await l6(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await AQ(W0.join(L,"AGENTS.md"))}else if(F==="claude"){let L=Y?W0.join(X,".claude"):W0.join(Q,".claude");if(await NQ(Y?W0.join(X,".claude.json"):W0.join(Q,".mcp.json")),await zY(W0.join(L,"settings.json"),"PreToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):"${CLAUDE_PROJECT_DIR}/.claude/hooks/ast-mcp.ts"),await l6(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await l6(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await AQ(W0.join(L,"CLAUDE.md"))}else{let L=Y?W0.join(X,".copilot"):W0.join(Q,".github");if(Y)await NQ(W0.join(L,"mcp-config.json"));else await NQ(W0.join(Q,".github/mcp.json")),await NQ(W0.join(Q,".vscode/mcp.json"),"servers");if(await zY(W0.join(L,"hooks/ast-mcp.json"),"preToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):".github/hooks/ast-mcp.ts"),await l6(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await l6(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await AQ(W0.join(L,"copilot-instructions.md"))}if(W.scope==="local"&&!await ZA(Q))await AQ(W0.join(Q,"AGENTS.md"));return lB(B,await VQ(G))}async function HA(W=process.argv.slice(2)){let Q=[...W],X="install";if(["install","update","uninstall"].includes(Q[0]??""))X=Q.shift();let Y="local",G=process.cwd(),B=[...YY];for(let J=0;J<Q.length;J+=1)if(Q[J]==="--scope")Y=Q[++J];else if(Q[J]==="--root")G=Q[++J];else if(Q[J]==="--target"){let K=Q[++J];B=K==="all"?[...YY]:[K]}else throw Error(`Unknown argument: ${Q[J]}`);if(!["local","global"].includes(Y)||B.some((J)=>!YY.includes(J)))throw Error("Invalid install scope or target");let F={root:G,scope:Y,targets:B},L=X==="install"?await cB(F):X==="update"?await pB(F):await dB(F),z=X==="install"?"Installed":X==="update"?"Updated":"Uninstalled";process.stdout.write(`${JSON.stringify({changed:L,operation:X})}
22
- `)}var YW,DQ,BA,YY,zA="<!-- ast-mcp:begin -->",JA="<!-- ast-mcp:end -->",xB;var nB=$0(async()=>{gB();YW=W0.resolve(import.meta.dir,".."),DQ=W0.join(YW,"dist/ast-mcp.js"),BA=W0.join(YW,"src/hook.ts"),YY=["codex","claude","copilot"];xB=/<!-- ast-mcp:begin -->[\s\S]*?<!-- ast-mcp:end -->\n?/g});function rB(W,Q=process){let X=!1,Y=new Map;for(let G of $A){let B=()=>{if(X){Q.exit(1);return}X=!0,Promise.resolve().then(()=>W(G)).then(()=>Q.exit(0),(F)=>{let L=F instanceof Error?F.message:String(F);Q.stderr.write(`ast-mcp shutdown failed after ${G}: ${L}
23
- `),Q.exit(1)})};Y.set(G,B),Q.on(G,B)}return()=>{for(let[G,B]of Y)Q.off(G,B)}}var $A;var oB=$0(()=>{$A=["SIGTERM","SIGINT","SIGHUP"]});var UA,jQ,AA,NA,VA,wA,X0=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports),aB=(W,Q)=>{let X={};for(var Y in W)jQ(X,Y,{get:W[Y],enumerable:!0});if(Q)jQ(X,Symbol.toStringTag,{value:"Module"});return X},DA=(W,Q,X,Y)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(var G=NA(Q),B=0,F=G.length,L;B<F;B++)if(L=G[B],!wA.call(W,L)&&L!==X)jQ(W,L,{get:((z)=>Q[z]).bind(null,L),enumerable:!(Y=AA(Q,L))||Y.enumerable})}return W},OQ=(W,Q,X)=>(X=W!=null?UA(VA(W)):{},DA(Q||!W||!W.__esModule?jQ(X,"default",{value:W,enumerable:!0}):X,W));var HY=$0(()=>{UA=Object.create,jQ=Object.defineProperty,AA=Object.getOwnPropertyDescriptor,NA=Object.getOwnPropertyNames,VA=Object.getPrototypeOf,wA=Object.prototype.hasOwnProperty});function i(W,Q,X){function Y(L,z){if(!L._zod)Object.defineProperty(L,"_zod",{value:{def:z,constr:F,traits:new Set},enumerable:!1});if(L._zod.traits.has(W))return;L._zod.traits.add(W),Q(L,z);let J=F.prototype,K=Object.keys(J);for(let H=0;H<K.length;H++){let D=K[H];if(!(D in L))L[D]=J[D].bind(L)}}let G=X?.Parent??Object;class B extends G{}Object.defineProperty(B,"name",{value:W});function F(L){var z;let J=X?.Parent?new B:this;Y(J,L),(z=J._zod).deferred??(z.deferred=[]);for(let K of J._zod.deferred)K();return J}return Object.defineProperty(F,"init",{value:Y}),Object.defineProperty(F,Symbol.hasInstance,{value:(L)=>{if(X?.Parent&&L instanceof X.Parent)return!0;return L?._zod?.traits?.has(W)}}),Object.defineProperty(F,"name",{value:W}),F}function C1(W){if(W)Object.assign(f4,W);return f4}var sB,$Y,MA,D5,GW,f4;var J4=$0(()=>{$Y=Object.freeze({status:"aborted"});MA=Symbol("zod_brand");D5=class D5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};GW=class GW extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}};(sB=globalThis).__zod_globalConfig??(sB.__zod_globalConfig={});f4=globalThis.__zod_globalConfig});var _0={};F4(_0,{unwrapMessage:()=>BW,uint8ArrayToHex:()=>dA,uint8ArrayToBase64url:()=>cA,uint8ArrayToBase64:()=>GF,stringifyPrimitive:()=>TQ,slugify:()=>NY,shallowClone:()=>eB,safeExtend:()=>fA,required:()=>uA,randomString:()=>qA,propertyKeyTypes:()=>wY,promiseAllObject:()=>bA,primitiveTypes:()=>WF,prefixIssues:()=>P6,pick:()=>yA,partial:()=>hA,parsedType:()=>OY,optionalKeys:()=>DY,omit:()=>_A,objectClone:()=>TA,numKeys:()=>CA,nullish:()=>LW,normalizeParams:()=>N0,mergeDefs:()=>M5,merge:()=>xA,jsonStringifyReplacer:()=>x4,joinValues:()=>EQ,issue:()=>u4,isPlainObject:()=>g5,isObject:()=>K4,hexToUint8Array:()=>pA,getSizableOrigin:()=>XF,getParsedType:()=>kA,getLengthableOrigin:()=>JW,getEnumValues:()=>FW,getElementAtPath:()=>SA,floatSafeRemainder:()=>AY,finalizeIssue:()=>t1,extend:()=>gA,explicitlyAborted:()=>jY,escapeRegex:()=>j5,esc:()=>IQ,defineLazy:()=>g0,createTransparentProxy:()=>vA,cloneDef:()=>PA,clone:()=>s1,cleanRegex:()=>zW,cleanEnum:()=>lA,captureStackTrace:()=>RQ,cached:()=>h4,base64urlToUint8Array:()=>mA,base64ToUint8Array:()=>YF,assignProp:()=>_5,assertNotEqual:()=>OA,assertNever:()=>IA,assertIs:()=>EA,assertEqual:()=>jA,assert:()=>RA,allowsEval:()=>VY,aborted:()=>f5,NUMBER_FORMAT_RANGES:()=>MY,Class:()=>BF,BIGINT_FORMAT_RANGES:()=>QF});function jA(W){return W}function OA(W){return W}function EA(W){}function IA(W){throw Error("Unexpected value in exhaustive check")}function RA(W){}function FW(W){let Q=Object.values(W).filter((Y)=>typeof Y==="number");return Object.entries(W).filter(([Y,G])=>Q.indexOf(+Y)===-1).map(([Y,G])=>G)}function EQ(W,Q="|"){return W.map((X)=>TQ(X)).join(Q)}function x4(W,Q){if(typeof Q==="bigint")return Q.toString();return Q}function h4(W){return{get value(){{let X=W();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function LW(W){return W===null||W===void 0}function zW(W){let Q=W.startsWith("^")?1:0,X=W.endsWith("$")?W.length-1:W.length;return W.slice(Q,X)}function AY(W,Q){let X=W/Q,Y=Math.round(X),G=Number.EPSILON*Math.max(Math.abs(X),1);if(Math.abs(X-Y)<G)return 0;return X-Y}function g0(W,Q,X){let Y=void 0;Object.defineProperty(W,Q,{get(){if(Y===tB)return;if(Y===void 0)Y=tB,Y=X();return Y},set(G){Object.defineProperty(W,Q,{value:G})},configurable:!0})}function TA(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function _5(W,Q,X){Object.defineProperty(W,Q,{value:X,writable:!0,enumerable:!0,configurable:!0})}function M5(...W){let Q={};for(let X of W){let Y=Object.getOwnPropertyDescriptors(X);Object.assign(Q,Y)}return Object.defineProperties({},Q)}function PA(W){return M5(W._zod.def)}function SA(W,Q){if(!Q)return W;return Q.reduce((X,Y)=>X?.[Y],W)}function bA(W){let Q=Object.keys(W),X=Q.map((Y)=>W[Y]);return Promise.all(X).then((Y)=>{let G={};for(let B=0;B<Q.length;B++)G[Q[B]]=Y[B];return G})}function qA(W=10){let X="";for(let Y=0;Y<W;Y++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function IQ(W){return JSON.stringify(W)}function NY(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function K4(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function g5(W){if(K4(W)===!1)return!1;let Q=W.constructor;if(Q===void 0)return!0;if(typeof Q!=="function")return!0;let X=Q.prototype;if(K4(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function eB(W){if(g5(W))return{...W};if(Array.isArray(W))return[...W];if(W instanceof Map)return new Map(W);if(W instanceof Set)return new Set(W);return W}function CA(W){let Q=0;for(let X in W)if(Object.prototype.hasOwnProperty.call(W,X))Q++;return Q}function j5(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s1(W,Q,X){let Y=new W._zod.constr(Q??W._zod.def);if(!Q||X?.parent)Y._zod.parent=W;return Y}function N0(W){let Q=W;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function vA(W){let Q;return new Proxy({},{get(X,Y,G){return Q??(Q=W()),Reflect.get(Q,Y,G)},set(X,Y,G,B){return Q??(Q=W()),Reflect.set(Q,Y,G,B)},has(X,Y){return Q??(Q=W()),Reflect.has(Q,Y)},deleteProperty(X,Y){return Q??(Q=W()),Reflect.deleteProperty(Q,Y)},ownKeys(X){return Q??(Q=W()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(X,Y){return Q??(Q=W()),Reflect.getOwnPropertyDescriptor(Q,Y)},defineProperty(X,Y,G){return Q??(Q=W()),Reflect.defineProperty(Q,Y,G)}})}function TQ(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function DY(W){return Object.keys(W).filter((Q)=>{return W[Q]._zod.optin==="optional"&&W[Q]._zod.optout==="optional"})}function yA(W,Q){let X=W._zod.def,Y=X.checks;if(Y&&Y.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let B=M5(W._zod.def,{get shape(){let F={};for(let L in Q){if(!(L in X.shape))throw Error(`Unrecognized key: "${L}"`);if(!Q[L])continue;F[L]=X.shape[L]}return _5(this,"shape",F),F},checks:[]});return s1(W,B)}function _A(W,Q){let X=W._zod.def,Y=X.checks;if(Y&&Y.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let B=M5(W._zod.def,{get shape(){let F={...W._zod.def.shape};for(let L in Q){if(!(L in X.shape))throw Error(`Unrecognized key: "${L}"`);if(!Q[L])continue;delete F[L]}return _5(this,"shape",F),F},checks:[]});return s1(W,B)}function gA(W,Q){if(!g5(Q))throw Error("Invalid input to extend: expected a plain object");let X=W._zod.def.checks;if(X&&X.length>0){let B=W._zod.def.shape;for(let F in Q)if(Object.getOwnPropertyDescriptor(B,F)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=M5(W._zod.def,{get shape(){let B={...W._zod.def.shape,...Q};return _5(this,"shape",B),B}});return s1(W,G)}function fA(W,Q){if(!g5(Q))throw Error("Invalid input to safeExtend: expected a plain object");let X=M5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...Q};return _5(this,"shape",Y),Y}});return s1(W,X)}function xA(W,Q){if(W._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let X=M5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...Q._zod.def.shape};return _5(this,"shape",Y),Y},get catchall(){return Q._zod.def.catchall},checks:Q._zod.def.checks??[]});return s1(W,X)}function hA(W,Q,X){let G=Q._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let F=M5(Q._zod.def,{get shape(){let L=Q._zod.def.shape,z={...L};if(X)for(let J in X){if(!(J in L))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;z[J]=W?new W({type:"optional",innerType:L[J]}):L[J]}else for(let J in L)z[J]=W?new W({type:"optional",innerType:L[J]}):L[J];return _5(this,"shape",z),z},checks:[]});return s1(Q,F)}function uA(W,Q,X){let Y=M5(Q._zod.def,{get shape(){let G=Q._zod.def.shape,B={...G};if(X)for(let F in X){if(!(F in B))throw Error(`Unrecognized key: "${F}"`);if(!X[F])continue;B[F]=new W({type:"nonoptional",innerType:G[F]})}else for(let F in G)B[F]=new W({type:"nonoptional",innerType:G[F]});return _5(this,"shape",B),B}});return s1(Q,Y)}function f5(W,Q=0){if(W.aborted===!0)return!0;for(let X=Q;X<W.issues.length;X++)if(W.issues[X]?.continue!==!0)return!0;return!1}function jY(W,Q=0){if(W.aborted===!0)return!0;for(let X=Q;X<W.issues.length;X++)if(W.issues[X]?.continue===!1)return!0;return!1}function P6(W,Q){return Q.map((X)=>{var Y;return(Y=X).path??(Y.path=[]),X.path.unshift(W),X})}function BW(W){return typeof W==="string"?W:W?.message}function t1(W,Q,X){let Y=W.message?W.message:BW(W.inst?._zod.def?.error?.(W))??BW(Q?.error?.(W))??BW(X.customError?.(W))??BW(X.localeError?.(W))??"Invalid input",{inst:G,continue:B,input:F,...L}=W;if(L.path??(L.path=[]),L.message=Y,Q?.reportInput)L.input=F;return L}function XF(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function JW(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function OY(W){let Q=typeof W;switch(Q){case"number":return Number.isNaN(W)?"nan":"number";case"object":{if(W===null)return"null";if(Array.isArray(W))return"array";let X=W;if(X&&Object.getPrototypeOf(X)!==Object.prototype&&"constructor"in X&&X.constructor)return X.constructor.name}}return Q}function u4(...W){let[Q,X,Y]=W;if(typeof Q==="string")return{message:Q,code:"custom",input:X,inst:Y};return{...Q}}function lA(W){return Object.entries(W).filter(([Q,X])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}function YF(W){let Q=atob(W),X=new Uint8Array(Q.length);for(let Y=0;Y<Q.length;Y++)X[Y]=Q.charCodeAt(Y);return X}function GF(W){let Q="";for(let X=0;X<W.length;X++)Q+=String.fromCharCode(W[X]);return btoa(Q)}function mA(W){let Q=W.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Q.length%4)%4);return YF(Q+X)}function cA(W){return GF(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pA(W){let Q=W.replace(/^0x/,"");if(Q.length%2!==0)throw Error("Invalid hex string length");let X=new Uint8Array(Q.length/2);for(let Y=0;Y<Q.length;Y+=2)X[Y/2]=Number.parseInt(Q.slice(Y,Y+2),16);return X}function dA(W){return Array.from(W).map((Q)=>Q.toString(16).padStart(2,"0")).join("")}class BF{constructor(...W){}}var tB,RQ,VY,kA=(W)=>{let Q=typeof W;switch(Q){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(W)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(W))return"array";if(W===null)return"null";if(W.then&&typeof W.then==="function"&&W.catch&&typeof W.catch==="function")return"promise";if(typeof Map<"u"&&W instanceof Map)return"map";if(typeof Set<"u"&&W instanceof Set)return"set";if(typeof Date<"u"&&W instanceof Date)return"date";if(typeof File<"u"&&W instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${Q}`)}},wY,WF,MY,QF;var S6=$0(()=>{J4();tB=Symbol("evaluating");RQ="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};VY=h4(()=>{if(f4.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});wY=new Set(["string","number","symbol"]),WF=new Set(["string","number","bigint","boolean","symbol","undefined"]);MY={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},QF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function IY(W,Q=(X)=>X.message){let X={},Y=[];for(let G of W.issues)if(G.path.length>0)X[G.path[0]]=X[G.path[0]]||[],X[G.path[0]].push(Q(G));else Y.push(Q(G));return{formErrors:Y,fieldErrors:X}}function RY(W,Q=(X)=>X.message){let X={_errors:[]},Y=(G,B=[])=>{for(let F of G.issues)if(F.code==="invalid_union"&&F.errors.length)F.errors.map((L)=>Y({issues:L},[...B,...F.path]));else if(F.code==="invalid_key")Y({issues:F.issues},[...B,...F.path]);else if(F.code==="invalid_element")Y({issues:F.issues},[...B,...F.path]);else{let L=[...B,...F.path];if(L.length===0)X._errors.push(Q(F));else{let z=X,J=0;while(J<L.length){let K=L[J];if(J!==L.length-1)z[K]=z[K]||{_errors:[]};else z[K]=z[K]||{_errors:[]},z[K]._errors.push(Q(F));z=z[K],J++}}}};return Y(W),X}var FF=(W,Q)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:Q,enumerable:!1}),W.message=JSON.stringify(Q,x4,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},PQ,EY;var TY=$0(()=>{J4();S6();PQ=i("$ZodError",FF),EY=i("$ZodError",FF,{Parent:Error})});var SQ=(W)=>(Q,X,Y,G)=>{let B=Y?{...Y,async:!1}:{async:!1},F=Q._zod.run({value:X,issues:[]},B);if(F instanceof Promise)throw new D5;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((z)=>t1(z,B,C1())));throw RQ(L,G?.callee),L}return F.value},bQ=(W)=>async(Q,X,Y,G)=>{let B=Y?{...Y,async:!0}:{async:!0},F=Q._zod.run({value:X,issues:[]},B);if(F instanceof Promise)F=await F;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((z)=>t1(z,B,C1())));throw RQ(L,G?.callee),L}return F.value},KW=(W)=>(Q,X,Y)=>{let G=Y?{...Y,async:!1}:{async:!1},B=Q._zod.run({value:X,issues:[]},G);if(B instanceof Promise)throw new D5;return B.issues.length?{success:!1,error:new(W??PQ)(B.issues.map((F)=>t1(F,G,C1())))}:{success:!0,data:B.value}},LF,ZW=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,async:!0}:{async:!0},B=Q._zod.run({value:X,issues:[]},G);if(B instanceof Promise)B=await B;return B.issues.length?{success:!1,error:new W(B.issues.map((F)=>t1(F,G,C1())))}:{success:!0,data:B.value}},zF,JF=(W)=>(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return SQ(W)(Q,X,G)},KF=(W)=>(Q,X,Y)=>{return SQ(W)(Q,X,Y)},ZF=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return bQ(W)(Q,X,G)},HF=(W)=>async(Q,X,Y)=>{return bQ(W)(Q,X,Y)},$F=(W)=>(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return KW(W)(Q,X,G)},UF=(W)=>(Q,X,Y)=>{return KW(W)(Q,X,Y)},AF=(W)=>async(Q,X,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return ZW(W)(Q,X,G)},NF=(W)=>async(Q,X,Y)=>{return ZW(W)(Q,X,Y)};var PY=$0(()=>{J4();TY();S6();LF=KW(EY),zF=ZW(EY)});function TF(){return new RegExp(nA,"u")}function gF(W){return typeof W.precision==="number"?W.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":W.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${W.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function fF(W){return new RegExp(`^${gF(W)}$`)}function xF(W){let Q=gF({precision:W.precision}),X=["Z"];if(W.local)X.push("");if(W.offset)X.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${Q}(?:${X.join("|")})`;return new RegExp(`^${yF}T(?:${Y})$`)}var VF,wF,DF,MF,jF,OF,EF,IF,SY=(W)=>{if(!W)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${W}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},RF,nA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",PF,SF,bF,qF,CF,bY,kF,vF,yF="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",_F,hF=(W)=>{let Q=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)},uF,lF,qQ,mF,cF,pF,dF;var CQ=$0(()=>{VF=/^[cC][0-9a-z]{6,}$/,wF=/^[0-9a-z]+$/,DF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,MF=/^[0-9a-vA-V]{20}$/,jF=/^[A-Za-z0-9]{27}$/,OF=/^[a-zA-Z0-9_-]{21}$/,EF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,IF=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,RF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;PF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,SF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,bF=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,qF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,CF=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bY=/^[A-Za-z0-9_-]*$/,kF=/^https?$/,vF=/^\+[1-9]\d{6,14}$/,_F=new RegExp(`^${yF}$`);uF=/^-?\d+n?$/,lF=/^-?\d+$/,qQ=/^-?\d+(?:\.\d+)?$/,mF=/^(?:true|false)$/i,cF=/^null$/i,pF=/^[^A-Z]*$/,dF=/^[^a-z]*$/});var N1,iF,qY,CY,nF,rF,oF,aF,sF,$W,tF,eF,WL,QL,XL,YL,GL;var kQ=$0(()=>{J4();CQ();S6();N1=i("$ZodCheck",(W,Q)=>{var X;W._zod??(W._zod={}),W._zod.def=Q,(X=W._zod).onattach??(X.onattach=[])}),iF={number:"number",bigint:"bigint",object:"date"},qY=i("$ZodCheckLessThan",(W,Q)=>{N1.init(W,Q);let X=iF[typeof Q.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(Q.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<B)if(Q.inclusive)G.maximum=Q.value;else G.exclusiveMaximum=Q.value}),W._zod.check=(Y)=>{if(Q.inclusive?Y.value<=Q.value:Y.value<Q.value)return;Y.issues.push({origin:X,code:"too_big",maximum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:Y.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),CY=i("$ZodCheckGreaterThan",(W,Q)=>{N1.init(W,Q);let X=iF[typeof Q.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(Q.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>B)if(Q.inclusive)G.minimum=Q.value;else G.exclusiveMinimum=Q.value}),W._zod.check=(Y)=>{if(Q.inclusive?Y.value>=Q.value:Y.value>Q.value)return;Y.issues.push({origin:X,code:"too_small",minimum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:Y.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),nF=i("$ZodCheckMultipleOf",(W,Q)=>{N1.init(W,Q),W._zod.onattach.push((X)=>{var Y;(Y=X._zod.bag).multipleOf??(Y.multipleOf=Q.value)}),W._zod.check=(X)=>{if(typeof X.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof X.value==="bigint"?X.value%Q.value===BigInt(0):AY(X.value,Q.value)===0)return;X.issues.push({origin:typeof X.value,code:"not_multiple_of",divisor:Q.value,input:X.value,inst:W,continue:!Q.abort})}}),rF=i("$ZodCheckNumberFormat",(W,Q)=>{N1.init(W,Q),Q.format=Q.format||"float64";let X=Q.format?.includes("int"),Y=X?"int":"number",[G,B]=MY[Q.format];W._zod.onattach.push((F)=>{let L=F._zod.bag;if(L.format=Q.format,L.minimum=G,L.maximum=B,X)L.pattern=lF}),W._zod.check=(F)=>{let L=F.value;if(X){if(!Number.isInteger(L)){F.issues.push({expected:Y,format:Q.format,code:"invalid_type",continue:!1,input:L,inst:W});return}if(!Number.isSafeInteger(L)){if(L>0)F.issues.push({input:L,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!Q.abort});else F.issues.push({input:L,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!Q.abort});return}}if(L<G)F.issues.push({origin:"number",input:L,code:"too_small",minimum:G,inclusive:!0,inst:W,continue:!Q.abort});if(L>B)F.issues.push({origin:"number",input:L,code:"too_big",maximum:B,inclusive:!0,inst:W,continue:!Q.abort})}}),oF=i("$ZodCheckMaxLength",(W,Q)=>{var X;N1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!LW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<G)Y._zod.bag.maximum=Q.maximum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length<=Q.maximum)return;let F=JW(G);Y.issues.push({origin:F,code:"too_big",maximum:Q.maximum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),aF=i("$ZodCheckMinLength",(W,Q)=>{var X;N1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!LW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>G)Y._zod.bag.minimum=Q.minimum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length>=Q.minimum)return;let F=JW(G);Y.issues.push({origin:F,code:"too_small",minimum:Q.minimum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),sF=i("$ZodCheckLengthEquals",(W,Q)=>{var X;N1.init(W,Q),(X=W._zod.def).when??(X.when=(Y)=>{let G=Y.value;return!LW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.minimum=Q.length,G.maximum=Q.length,G.length=Q.length}),W._zod.check=(Y)=>{let G=Y.value,B=G.length;if(B===Q.length)return;let F=JW(G),L=B>Q.length;Y.issues.push({origin:F,...L?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:Y.value,inst:W,continue:!Q.abort})}}),$W=i("$ZodCheckStringFormat",(W,Q)=>{var X,Y;if(N1.init(W,Q),W._zod.onattach.push((G)=>{let B=G._zod.bag;if(B.format=Q.format,Q.pattern)B.patterns??(B.patterns=new Set),B.patterns.add(Q.pattern)}),Q.pattern)(X=W._zod).check??(X.check=(G)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:G.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:W,continue:!Q.abort})});else(Y=W._zod).check??(Y.check=()=>{})}),tF=i("$ZodCheckRegex",(W,Q)=>{$W.init(W,Q),W._zod.check=(X)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:"regex",input:X.value,pattern:Q.pattern.toString(),inst:W,continue:!Q.abort})}}),eF=i("$ZodCheckLowerCase",(W,Q)=>{Q.pattern??(Q.pattern=pF),$W.init(W,Q)}),WL=i("$ZodCheckUpperCase",(W,Q)=>{Q.pattern??(Q.pattern=dF),$W.init(W,Q)}),QL=i("$ZodCheckIncludes",(W,Q)=>{N1.init(W,Q);let X=j5(Q.includes),Y=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${X}`:X);Q.pattern=Y,W._zod.onattach.push((G)=>{let B=G._zod.bag;B.patterns??(B.patterns=new Set),B.patterns.add(Y)}),W._zod.check=(G)=>{if(G.value.includes(Q.includes,Q.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:G.value,inst:W,continue:!Q.abort})}}),XL=i("$ZodCheckStartsWith",(W,Q)=>{N1.init(W,Q);let X=new RegExp(`^${j5(Q.prefix)}.*`);Q.pattern??(Q.pattern=X),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),W._zod.check=(Y)=>{if(Y.value.startsWith(Q.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:Y.value,inst:W,continue:!Q.abort})}}),YL=i("$ZodCheckEndsWith",(W,Q)=>{N1.init(W,Q);let X=new RegExp(`.*${j5(Q.suffix)}$`);Q.pattern??(Q.pattern=X),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),W._zod.check=(Y)=>{if(Y.value.endsWith(Q.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:Y.value,inst:W,continue:!Q.abort})}}),GL=i("$ZodCheckOverwrite",(W,Q)=>{N1.init(W,Q),W._zod.check=(X)=>{X.value=Q.tx(X.value)}})});class kY{constructor(W=[]){if(this.content=[],this.indent=0,this)this.args=W}indented(W){this.indent+=1,W(this),this.indent-=1}write(W){if(typeof W==="function"){W(this,{execution:"sync"}),W(this,{execution:"async"});return}let X=W.split(`
24
- `).filter((B)=>B),Y=Math.min(...X.map((B)=>B.length-B.trimStart().length)),G=X.map((B)=>B.slice(Y)).map((B)=>" ".repeat(this.indent*2)+B);for(let B of G)this.content.push(B)}compile(){let W=Function,Q=this?.args,Y=[...(this?.content??[""]).map((G)=>` ${G}`)];return new W(...Q,Y.join(`
25
- `))}}var FL;var vY=$0(()=>{FL={major:4,minor:4,patch:3}});function fL(W){if(W==="")return!0;if(/\s/.test(W))return!1;if(W.length%4!==0)return!1;try{return atob(W),!0}catch{return!1}}function rA(W){if(!bY.test(W))return!1;let Q=W.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),X=Q.padEnd(Math.ceil(Q.length/4)*4,"=");return fL(X)}function oA(W,Q=null){try{let X=W.split(".");if(X.length!==3)return!1;let[Y]=X;if(!Y)return!1;let G=JSON.parse(atob(Y));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Q&&(!("alg"in G)||G.alg!==Q))return!1;return!0}catch{return!1}}function LL(W,Q,X){if(W.issues.length)Q.issues.push(...P6(X,W.issues));Q.value[X]=W.value}function yQ(W,Q,X,Y,G,B){let F=X in Y;if(W.issues.length){if(G&&B&&!F)return;Q.issues.push(...P6(X,W.issues))}if(!F&&!G){if(!W.issues.length)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[X]});return}if(W.value===void 0){if(F)Q.value[X]=void 0}else Q.value[X]=W.value}function sL(W){let Q=Object.keys(W.shape);for(let Y of Q)if(!W.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let X=DY(W.shape);return{...W,keys:Q,keySet:new Set(Q),numKeys:Q.length,optionalKeys:new Set(X)}}function tL(W,Q,X,Y,G,B){let F=[],L=G.keySet,z=G.catchall._zod,J=z.def.type,K=z.optin==="optional",H=z.optout==="optional";for(let D in Q){if(D==="__proto__")continue;if(L.has(D))continue;if(J==="never"){F.push(D);continue}let I=z.run({value:Q[D],issues:[]},Y);if(I instanceof Promise)W.push(I.then((A)=>yQ(A,X,D,Q,K,H)));else yQ(I,X,D,Q,K,H)}if(F.length)X.issues.push({code:"unrecognized_keys",keys:F,input:Q,inst:B});if(!W.length)return X;return Promise.all(W).then(()=>{return X})}function zL(W,Q,X,Y){for(let B of W)if(B.issues.length===0)return Q.value=B.value,Q;let G=W.filter((B)=>!f5(B));if(G.length===1)return Q.value=G[0].value,G[0];return Q.issues.push({code:"invalid_union",input:Q.value,inst:X,errors:W.map((B)=>B.issues.map((F)=>t1(F,Y,C1())))}),Q}function yY(W,Q){if(W===Q)return{valid:!0,data:W};if(W instanceof Date&&Q instanceof Date&&+W===+Q)return{valid:!0,data:W};if(g5(W)&&g5(Q)){let X=Object.keys(Q),Y=Object.keys(W).filter((B)=>X.indexOf(B)!==-1),G={...W,...Q};for(let B of Y){let F=yY(W[B],Q[B]);if(!F.valid)return{valid:!1,mergeErrorPath:[B,...F.mergeErrorPath]};G[B]=F.data}return{valid:!0,data:G}}if(Array.isArray(W)&&Array.isArray(Q)){if(W.length!==Q.length)return{valid:!1,mergeErrorPath:[]};let X=[];for(let Y=0;Y<W.length;Y++){let G=W[Y],B=Q[Y],F=yY(G,B);if(!F.valid)return{valid:!1,mergeErrorPath:[Y,...F.mergeErrorPath]};X.push(F.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function JL(W,Q,X){let Y=new Map,G;for(let L of Q.issues)if(L.code==="unrecognized_keys"){G??(G=L);for(let z of L.keys){if(!Y.has(z))Y.set(z,{});Y.get(z).l=!0}}else W.issues.push(L);for(let L of X.issues)if(L.code==="unrecognized_keys")for(let z of L.keys){if(!Y.has(z))Y.set(z,{});Y.get(z).r=!0}else W.issues.push(L);let B=[...Y].filter(([,L])=>L.l&&L.r).map(([L])=>L);if(B.length&&G)W.issues.push({...G,keys:B});if(f5(W))return W;let F=yY(Q.value,X.value);if(!F.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(F.mergeErrorPath)}`);return W.value=F.data,W}function KL(W,Q){for(let X=W.length-1;X>=0;X--)if(W[X]._zod[Q]!=="optional")return X+1;return 0}function ZL(W,Q,X){if(W.issues.length)Q.issues.push(...P6(X,W.issues));Q.value[X]=W.value}function HL(W,Q,X,Y,G){for(let B=0;B<X.length;B++){let F=W[B],L=B<Y.length;if(F.issues.length){if(!L&&B>=G){Q.value.length=B;break}Q.issues.push(...P6(B,F.issues))}Q.value[B]=F.value}for(let B=Q.value.length-1;B>=Y.length;B--)if(X[B]._zod.optout==="optional"&&Q.value[B]===void 0)Q.value.length=B;else break;return Q}function $L(W,Q){if(Q===void 0&&(W.issues.length||W.fallback))return{issues:[],value:void 0};return W}function UL(W,Q){if(W.value===void 0)W.value=Q.defaultValue;return W}function AL(W,Q){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:Q});return W}function vQ(W,Q,X){if(W.issues.length)return W.aborted=!0,W;return Q._zod.run({value:W.value,issues:W.issues,fallback:W.fallback},X)}function NL(W){return W.value=Object.freeze(W.value),W}function VL(W,Q,X,Y){if(!W){let G={code:"custom",input:X,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)G.params=Y._zod.def.params;Q.issues.push(u4(G))}}var l0,_Q,s0,wL,DL,ML,jL,OL,EL,IL,RL,TL,PL,SL,bL,qL,CL,kL,vL,yL,_L,gL,xL,hL,uL,lL,_Y,mL,cL,pL,dL,iL,nL,rL,oL,aL,aA,eL,gY,Wz,Qz,Xz,Yz,Gz,Bz,Fz,fY,Lz,zz,Jz,Kz,Zz,Hz,xY,$z,Uz,Az,Nz;var Vz=$0(()=>{kQ();J4();PY();CQ();S6();vY();S6();l0=i("$ZodType",(W,Q)=>{var X;W??(W={}),W._zod.def=Q,W._zod.bag=W._zod.bag||{},W._zod.version=FL;let Y=[...W._zod.def.checks??[]];if(W._zod.traits.has("$ZodCheck"))Y.unshift(W);for(let G of Y)for(let B of G._zod.onattach)B(W);if(Y.length===0)(X=W._zod).deferred??(X.deferred=[]),W._zod.deferred?.push(()=>{W._zod.run=W._zod.parse});else{let G=(F,L,z)=>{let J=f5(F),K;for(let H of L){if(H._zod.def.when){if(jY(F))continue;if(!H._zod.def.when(F))continue}else if(J)continue;let D=F.issues.length,I=H._zod.check(F);if(I instanceof Promise&&z?.async===!1)throw new D5;if(K||I instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await I,F.issues.length===D)return;if(!J)J=f5(F,D)});else{if(F.issues.length===D)continue;if(!J)J=f5(F,D)}}if(K)return K.then(()=>{return F});return F},B=(F,L,z)=>{if(f5(F))return F.aborted=!0,F;let J=G(L,Y,z);if(J instanceof Promise){if(z.async===!1)throw new D5;return J.then((K)=>W._zod.parse(K,z))}return W._zod.parse(J,z)};W._zod.run=(F,L)=>{if(L.skipChecks)return W._zod.parse(F,L);if(L.direction==="backward"){let J=W._zod.parse({value:F.value,issues:[]},{...L,skipChecks:!0});if(J instanceof Promise)return J.then((K)=>{return B(K,F,L)});return B(J,F,L)}let z=W._zod.parse(F,L);if(z instanceof Promise){if(L.async===!1)throw new D5;return z.then((J)=>G(J,Y,L))}return G(z,Y,L)}}g0(W,"~standard",()=>({validate:(G)=>{try{let B=LF(W,G);return B.success?{value:B.data}:{issues:B.error?.issues}}catch(B){return zF(W,G).then((F)=>F.success?{value:F.data}:{issues:F.error?.issues})}},vendor:"zod",version:1}))}),_Q=i("$ZodString",(W,Q)=>{l0.init(W,Q),W._zod.pattern=[...W?._zod.bag?.patterns??[]].pop()??hF(W._zod.bag),W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=String(X.value)}catch(G){}if(typeof X.value==="string")return X;return X.issues.push({expected:"string",code:"invalid_type",input:X.value,inst:W}),X}}),s0=i("$ZodStringFormat",(W,Q)=>{$W.init(W,Q),_Q.init(W,Q)}),wL=i("$ZodGUID",(W,Q)=>{Q.pattern??(Q.pattern=IF),s0.init(W,Q)}),DL=i("$ZodUUID",(W,Q)=>{if(Q.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Q.version];if(Y===void 0)throw Error(`Invalid UUID version: "${Q.version}"`);Q.pattern??(Q.pattern=SY(Y))}else Q.pattern??(Q.pattern=SY());s0.init(W,Q)}),ML=i("$ZodEmail",(W,Q)=>{Q.pattern??(Q.pattern=RF),s0.init(W,Q)}),jL=i("$ZodURL",(W,Q)=>{s0.init(W,Q),W._zod.check=(X)=>{try{let Y=X.value.trim();if(!Q.normalize&&Q.protocol?.source===kF.source){if(!/^https?:\/\//i.test(Y)){X.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:X.value,inst:W,continue:!Q.abort});return}}let G=new URL(Y);if(Q.hostname){if(Q.hostname.lastIndex=0,!Q.hostname.test(G.hostname))X.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Q.hostname.source,input:X.value,inst:W,continue:!Q.abort})}if(Q.protocol){if(Q.protocol.lastIndex=0,!Q.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))X.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Q.protocol.source,input:X.value,inst:W,continue:!Q.abort})}if(Q.normalize)X.value=G.href;else X.value=Y;return}catch(Y){X.issues.push({code:"invalid_format",format:"url",input:X.value,inst:W,continue:!Q.abort})}}}),OL=i("$ZodEmoji",(W,Q)=>{Q.pattern??(Q.pattern=TF()),s0.init(W,Q)}),EL=i("$ZodNanoID",(W,Q)=>{Q.pattern??(Q.pattern=OF),s0.init(W,Q)}),IL=i("$ZodCUID",(W,Q)=>{Q.pattern??(Q.pattern=VF),s0.init(W,Q)}),RL=i("$ZodCUID2",(W,Q)=>{Q.pattern??(Q.pattern=wF),s0.init(W,Q)}),TL=i("$ZodULID",(W,Q)=>{Q.pattern??(Q.pattern=DF),s0.init(W,Q)}),PL=i("$ZodXID",(W,Q)=>{Q.pattern??(Q.pattern=MF),s0.init(W,Q)}),SL=i("$ZodKSUID",(W,Q)=>{Q.pattern??(Q.pattern=jF),s0.init(W,Q)}),bL=i("$ZodISODateTime",(W,Q)=>{Q.pattern??(Q.pattern=xF(Q)),s0.init(W,Q)}),qL=i("$ZodISODate",(W,Q)=>{Q.pattern??(Q.pattern=_F),s0.init(W,Q)}),CL=i("$ZodISOTime",(W,Q)=>{Q.pattern??(Q.pattern=fF(Q)),s0.init(W,Q)}),kL=i("$ZodISODuration",(W,Q)=>{Q.pattern??(Q.pattern=EF),s0.init(W,Q)}),vL=i("$ZodIPv4",(W,Q)=>{Q.pattern??(Q.pattern=PF),s0.init(W,Q),W._zod.bag.format="ipv4"}),yL=i("$ZodIPv6",(W,Q)=>{Q.pattern??(Q.pattern=SF),s0.init(W,Q),W._zod.bag.format="ipv6",W._zod.check=(X)=>{try{new URL(`http://[${X.value}]`)}catch{X.issues.push({code:"invalid_format",format:"ipv6",input:X.value,inst:W,continue:!Q.abort})}}}),_L=i("$ZodCIDRv4",(W,Q)=>{Q.pattern??(Q.pattern=bF),s0.init(W,Q)}),gL=i("$ZodCIDRv6",(W,Q)=>{Q.pattern??(Q.pattern=qF),s0.init(W,Q),W._zod.check=(X)=>{let Y=X.value.split("/");try{if(Y.length!==2)throw Error();let[G,B]=Y;if(!B)throw Error();let F=Number(B);if(`${F}`!==B)throw Error();if(F<0||F>128)throw Error();new URL(`http://[${G}]`)}catch{X.issues.push({code:"invalid_format",format:"cidrv6",input:X.value,inst:W,continue:!Q.abort})}}});xL=i("$ZodBase64",(W,Q)=>{Q.pattern??(Q.pattern=CF),s0.init(W,Q),W._zod.bag.contentEncoding="base64",W._zod.check=(X)=>{if(fL(X.value))return;X.issues.push({code:"invalid_format",format:"base64",input:X.value,inst:W,continue:!Q.abort})}});hL=i("$ZodBase64URL",(W,Q)=>{Q.pattern??(Q.pattern=bY),s0.init(W,Q),W._zod.bag.contentEncoding="base64url",W._zod.check=(X)=>{if(rA(X.value))return;X.issues.push({code:"invalid_format",format:"base64url",input:X.value,inst:W,continue:!Q.abort})}}),uL=i("$ZodE164",(W,Q)=>{Q.pattern??(Q.pattern=vF),s0.init(W,Q)});lL=i("$ZodJWT",(W,Q)=>{s0.init(W,Q),W._zod.check=(X)=>{if(oA(X.value,Q.alg))return;X.issues.push({code:"invalid_format",format:"jwt",input:X.value,inst:W,continue:!Q.abort})}}),_Y=i("$ZodNumber",(W,Q)=>{l0.init(W,Q),W._zod.pattern=W._zod.bag.pattern??qQ,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=Number(X.value)}catch(F){}let G=X.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return X;let B=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return X.issues.push({expected:"number",code:"invalid_type",input:G,inst:W,...B?{received:B}:{}}),X}}),mL=i("$ZodNumberFormat",(W,Q)=>{rF.init(W,Q),_Y.init(W,Q)}),cL=i("$ZodBoolean",(W,Q)=>{l0.init(W,Q),W._zod.pattern=mF,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=Boolean(X.value)}catch(B){}let G=X.value;if(typeof G==="boolean")return X;return X.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:W}),X}}),pL=i("$ZodBigInt",(W,Q)=>{l0.init(W,Q),W._zod.pattern=uF,W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=BigInt(X.value)}catch(G){}if(typeof X.value==="bigint")return X;return X.issues.push({expected:"bigint",code:"invalid_type",input:X.value,inst:W}),X}}),dL=i("$ZodNull",(W,Q)=>{l0.init(W,Q),W._zod.pattern=cF,W._zod.values=new Set([null]),W._zod.parse=(X,Y)=>{let G=X.value;if(G===null)return X;return X.issues.push({expected:"null",code:"invalid_type",input:G,inst:W}),X}}),iL=i("$ZodAny",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X)=>X}),nL=i("$ZodUnknown",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X)=>X}),rL=i("$ZodNever",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X,Y)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:W}),X}}),oL=i("$ZodDate",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X,Y)=>{if(Q.coerce)try{X.value=new Date(X.value)}catch(L){}let G=X.value,B=G instanceof Date;if(B&&!Number.isNaN(G.getTime()))return X;return X.issues.push({expected:"date",code:"invalid_type",input:G,...B?{received:"Invalid Date"}:{},inst:W}),X}});aL=i("$ZodArray",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value;if(!Array.isArray(G))return X.issues.push({expected:"array",code:"invalid_type",input:G,inst:W}),X;X.value=Array(G.length);let B=[];for(let F=0;F<G.length;F++){let L=G[F],z=Q.element._zod.run({value:L,issues:[]},Y);if(z instanceof Promise)B.push(z.then((J)=>LL(J,X,F)));else LL(z,X,F)}if(B.length)return Promise.all(B).then(()=>X);return X}});aA=i("$ZodObject",(W,Q)=>{if(l0.init(W,Q),!Object.getOwnPropertyDescriptor(Q,"shape")?.get){let L=Q.shape;Object.defineProperty(Q,"shape",{get:()=>{let z={...L};return Object.defineProperty(Q,"shape",{value:z}),z}})}let Y=h4(()=>sL(Q));g0(W._zod,"propValues",()=>{let L=Q.shape,z={};for(let J in L){let K=L[J]._zod;if(K.values){z[J]??(z[J]=new Set);for(let H of K.values)z[J].add(H)}}return z});let G=K4,B=Q.catchall,F;W._zod.parse=(L,z)=>{F??(F=Y.value);let J=L.value;if(!G(J))return L.issues.push({expected:"object",code:"invalid_type",input:J,inst:W}),L;L.value={};let K=[],H=F.shape;for(let D of F.keys){let I=H[D],A=I._zod.optin==="optional",M=I._zod.optout==="optional",N=I._zod.run({value:J[D],issues:[]},z);if(N instanceof Promise)K.push(N.then((Z)=>yQ(Z,L,D,J,A,M)));else yQ(N,L,D,J,A,M)}if(!B)return K.length?Promise.all(K).then(()=>L):L;return tL(K,J,L,z,Y.value,W)}}),eL=i("$ZodObjectJIT",(W,Q)=>{aA.init(W,Q);let X=W._zod.parse,Y=h4(()=>sL(Q)),G=(D)=>{let I=new kY(["shape","payload","ctx"]),A=Y.value,M=(U)=>{let j=IQ(U);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};I.write("const input = payload.value;");let N=Object.create(null),Z=0;for(let U of A.keys)N[U]=`key_${Z++}`;I.write("const newResult = {};");for(let U of A.keys){let j=N[U],R=IQ(U),O=D[U],w=O?._zod?.optin==="optional",T=O?._zod?.optout==="optional";if(I.write(`const ${j} = ${M(U)};`),w&&T)I.write(`
26
- if (${j}.issues.length) {
133
+ ${qA}`)}async function jX(W){let X=await _5(W,"utf8").catch((Q)=>{if(Q.code==="ENOENT")return;throw Q});if(X===void 0)return;await jY(W,X.replace(tB,""))}async function eB(W,X){await PX(W,X)}async function EX(W,X="mcpServers"){let Q=await J4(W),Y=Q[X];if(!Y||typeof Y!=="object"||!("ast-mcp"in Y))return;if(delete Y["ast-mcp"],Object.keys(Y).length===0)delete Q[X];await eB(W,Q)}async function CA(W){let X=await _5(W,"utf8").catch((Q)=>{if(Q.code==="ENOENT")return;throw Q});if(X===void 0)return;await jY(W,X.replace(/# ast-mcp:begin[\s\S]*?# ast-mcp:end\n?/g,""))}async function DY(W,X,Q){let Y=await J4(W),G=Y.hooks;if(!G||!Array.isArray(G[X]))return;let B=[`bun ${JSON.stringify(Q)}`,`bun ${JSON.stringify(TX)} hook`];if(G[X]=G[X].filter((F)=>!B.some((L)=>MX(F,X,L))),G[X].length===0)delete G[X];if(Object.keys(G).length===0)delete Y.hooks;await eB(W,Y)}async function kA(W){let X=await _5(W0.join(W,".codex/config.toml"),"utf8").catch(()=>""),Q=await J4(W0.join(W,".mcp.json")),Y=await J4(W0.join(W,".github/mcp.json"));return Boolean(X.includes("# ast-mcp:begin")||Q.mcpServers?.["ast-mcp"]||Y.mcpServers?.["ast-mcp"])}function WF(W,X,Q,Y){if(W==="codex"){let B=X?W0.join(Y,".codex"):W0.join(Q,".codex");return[W0.join(B,"config.toml"),W0.join(B,"hooks.json"),W0.join(B,"hooks/ast-mcp.ts"),W0.join(B,"skills/ast-mcp"),X?W0.join(B,"AGENTS.md"):W0.join(Q,"AGENTS.md")]}if(W==="claude"){let B=X?W0.join(Y,".claude"):W0.join(Q,".claude");return[X?W0.join(Y,".claude.json"):W0.join(Q,".mcp.json"),W0.join(B,"settings.json"),W0.join(B,"hooks/ast-mcp.ts"),W0.join(B,"skills/ast-mcp"),X?W0.join(B,"CLAUDE.md"):W0.join(Q,"AGENTS.md")]}let G=X?W0.join(Y,".copilot"):W0.join(Q,".github");return[X?W0.join(G,"mcp-config.json"):W0.join(Q,".github/mcp.json"),...X?[]:[W0.join(Q,".vscode/mcp.json")],W0.join(G,"hooks/ast-mcp.json"),W0.join(G,"hooks/ast-mcp.ts"),W0.join(G,"skills/ast-mcp"),X?W0.join(G,"copilot-instructions.md"):W0.join(Q,"AGENTS.md")]}async function IX(W){let X=new Map,Q=async(Y)=>{if(W0.basename(Y)===".ast-bro")return;let G=await IA(Y).catch(()=>{return});if(!G)return;if(G.isDirectory()){for(let B of await RA(Y))await Q(W0.join(Y,B));return}if(G.isFile())X.set(Y,(await _5(Y)).toString("base64"))};return await Promise.all(W.map(Q)),X}function XF(W,X){return[...new Set([...W.keys(),...X.keys()])].filter((Q)=>W.get(Q)!==X.get(Q)).sort()}async function QF(W){HY(W.astBroBinary);let X=W0.resolve(W.root),Q=W.home??sB.homedir(),Y=W.scope==="global",G=W.targets.flatMap((F)=>WF(F,Y,X,Q)),B=await IX(G);for(let F of W.targets)if(F==="codex"){let L=Y?W0.join(Q,".codex"):W0.join(X,".codex");await PA(W0.join(L,"config.toml"),Y?void 0:X),await NY(W0.join(L,"hooks.json"),"PreToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):".codex/hooks/ast-mcp.ts"),await VY(W0.join(L,"skills")),await wY(Y?W0.join(L,"AGENTS.md"):W0.join(X,"AGENTS.md"))}else if(F==="claude"){let L=Y?W0.join(Q,".claude"):W0.join(X,".claude");await AY(Y?W0.join(Q,".claude.json"):W0.join(X,".mcp.json"),Y?void 0:X),await NY(W0.join(L,"settings.json"),"PreToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):"${CLAUDE_PROJECT_DIR}/.claude/hooks/ast-mcp.ts"),await VY(W0.join(L,"skills")),await wY(Y?W0.join(L,"CLAUDE.md"):W0.join(X,"AGENTS.md"))}else{let L=Y?W0.join(Q,".copilot"):W0.join(X,".github");if(Y)await AY(W0.join(L,"mcp-config.json"),void 0,!0);else await AY(W0.join(X,".github/mcp.json"),X,!0),await SA(W0.join(X,".vscode/mcp.json"),X);await NY(W0.join(L,"hooks/ast-mcp.json"),"preToolUse",W0.join(L,"hooks/ast-mcp.ts"),Y?W0.join(L,"hooks/ast-mcp.ts"):".github/hooks/ast-mcp.ts"),await VY(W0.join(L,"skills")),await wY(Y?W0.join(L,"copilot-instructions.md"):W0.join(X,"AGENTS.md"))}return XF(B,await IX(G))}async function YF(W){return QF(W)}async function GF(W){return QF(W)}async function BF(W){let X=W0.resolve(W.root),Q=W.home??sB.homedir(),Y=W.scope==="global",G=W.targets.flatMap((F)=>WF(F,Y,X,Q)),B=await IX(G);for(let F of W.targets)if(F==="codex"){let L=Y?W0.join(Q,".codex"):W0.join(X,".codex");if(await CA(W0.join(L,"config.toml")),await DY(W0.join(L,"hooks.json"),"PreToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):".codex/hooks/ast-mcp.ts"),await y5(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await y5(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await jX(W0.join(L,"AGENTS.md"))}else if(F==="claude"){let L=Y?W0.join(Q,".claude"):W0.join(X,".claude");if(await EX(Y?W0.join(Q,".claude.json"):W0.join(X,".mcp.json")),await DY(W0.join(L,"settings.json"),"PreToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):"${CLAUDE_PROJECT_DIR}/.claude/hooks/ast-mcp.ts"),await y5(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await y5(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await jX(W0.join(L,"CLAUDE.md"))}else{let L=Y?W0.join(Q,".copilot"):W0.join(X,".github");if(Y)await EX(W0.join(L,"mcp-config.json"));else await EX(W0.join(X,".github/mcp.json")),await EX(W0.join(X,".vscode/mcp.json"),"servers");if(await DY(W0.join(L,"hooks/ast-mcp.json"),"preToolUse",Y?W0.join(L,"hooks/ast-mcp.ts"):".github/hooks/ast-mcp.ts"),await y5(W0.join(L,"hooks/ast-mcp.ts"),{force:!0}),await y5(W0.join(L,"skills/ast-mcp"),{force:!0,recursive:!0}),Y)await jX(W0.join(L,"copilot-instructions.md"))}if(W.scope==="local"&&!await kA(X))await jX(W0.join(X,"AGENTS.md"));return XF(B,await IX(G))}async function vA(W=process.argv.slice(2)){let X=W.flatMap((Z)=>{let D=/^(--(?:scope|root|target))=(.*)$/.exec(Z);return D?[D[1],D[2]]:[Z]}),Q="install";if(["install","update","uninstall"].includes(X[0]??""))Q=X.shift();let Y="local",G=process.cwd(),B=[...UY],F=(Z)=>{let D=X[Z+1];if(!D||D.startsWith("-"))throw new zW(`Missing value for ${X[Z]??"option"}`);return D};for(let Z=0;Z<X.length;Z+=1)if(["--scope","-s"].includes(X[Z]??""))Y=F(Z),Z+=1;else if(["--root","-r"].includes(X[Z]??""))G=F(Z),Z+=1;else if(["--target","-t"].includes(X[Z]??"")){let D=F(Z);B=D==="all"?[...UY]:[D],Z+=1}else throw new zW(`Unknown option: ${X[Z]}`);if(!["local","global"].includes(Y))throw new zW(`Invalid scope "${Y}"; expected local or global`);let L=B.find((Z)=>!UY.includes(Z));if(L)throw new zW(`Invalid target "${L}"; expected codex, claude, copilot, or all`);let z={root:G,scope:Y,targets:B},J=Q==="install"?await YF(z):Q==="update"?await GF(z):await BF(z),K=Q==="install"?"Installed":Q==="update"?"Updated":"Uninstalled";process.stdout.write(`${JSON.stringify({changed:J,operation:Q})}
134
+ `)}var JW,TX,TA,UY,bA="<!-- ast-mcp:begin -->",qA="<!-- ast-mcp:end -->",tB,zW;var LF=H0(async()=>{nB();LW();JW=W0.resolve(import.meta.dir,".."),TX=W0.join(JW,"dist/ast-mcp.js"),TA=W0.join(JW,"src/hook.ts"),UY=["codex","claude","copilot"];tB=/<!-- ast-mcp:begin -->[\s\S]*?<!-- ast-mcp:end -->\n?/g;zW=class zW extends Error{name="InstallerUsageError"}});function zF(W,X=process){let Q=!1,Y=new Map;for(let G of yA){let B=()=>{if(Q){X.exit(1);return}Q=!0,Promise.resolve().then(()=>W(G)).then(()=>X.exit(0),(F)=>{let L=F instanceof Error?F.message:String(F);X.stderr.write(`ast-mcp shutdown failed after ${G}: ${L}
135
+ `),X.exit(1)})};Y.set(G,B),X.on(G,B)}return()=>{for(let[G,B]of Y)X.off(G,B)}}var yA;var JF=H0(()=>{yA=["SIGTERM","SIGINT","SIGHUP"]});var _A,SX,gA,fA,xA,hA,Q0=(W,X)=>()=>(X||W((X={exports:{}}).exports,X),X.exports),KF=(W,X)=>{let Q={};for(var Y in W)SX(Q,Y,{get:W[Y],enumerable:!0});if(X)SX(Q,Symbol.toStringTag,{value:"Module"});return Q},uA=(W,X,Q,Y)=>{if(X&&typeof X==="object"||typeof X==="function"){for(var G=fA(X),B=0,F=G.length,L;B<F;B++)if(L=G[B],!hA.call(W,L)&&L!==Q)SX(W,L,{get:((z)=>X[z]).bind(null,L),enumerable:!(Y=gA(X,L))||Y.enumerable})}return W},bX=(W,X,Q)=>(Q=W!=null?_A(xA(W)):{},uA(X||!W||!W.__esModule?SX(Q,"default",{value:W,enumerable:!0}):Q,W));var EY=H0(()=>{_A=Object.create,SX=Object.defineProperty,gA=Object.getOwnPropertyDescriptor,fA=Object.getOwnPropertyNames,xA=Object.getPrototypeOf,hA=Object.prototype.hasOwnProperty});function i(W,X,Q){function Y(L,z){if(!L._zod)Object.defineProperty(L,"_zod",{value:{def:z,constr:F,traits:new Set},enumerable:!1});if(L._zod.traits.has(W))return;L._zod.traits.add(W),X(L,z);let J=F.prototype,K=Object.keys(J);for(let Z=0;Z<K.length;Z++){let D=K[Z];if(!(D in L))L[D]=J[D].bind(L)}}let G=Q?.Parent??Object;class B extends G{}Object.defineProperty(B,"name",{value:W});function F(L){var z;let J=Q?.Parent?new B:this;Y(J,L),(z=J._zod).deferred??(z.deferred=[]);for(let K of J._zod.deferred)K();return J}return Object.defineProperty(F,"init",{value:Y}),Object.defineProperty(F,Symbol.hasInstance,{value:(L)=>{if(Q?.Parent&&L instanceof Q.Parent)return!0;return L?._zod?.traits?.has(W)}}),Object.defineProperty(F,"name",{value:W}),F}function k1(W){if(W)Object.assign(h4,W);return h4}var ZF,IY,lA,D5,KW,h4;var K4=H0(()=>{IY=Object.freeze({status:"aborted"});lA=Symbol("zod_brand");D5=class D5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};KW=class KW extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}};(ZF=globalThis).__zod_globalConfig??(ZF.__zod_globalConfig={});h4=globalThis.__zod_globalConfig});var _0={};L4(_0,{unwrapMessage:()=>ZW,uint8ArrayToHex:()=>$N,uint8ArrayToBase64url:()=>KN,uint8ArrayToBase64:()=>wF,stringifyPrimitive:()=>vX,slugify:()=>PY,shallowClone:()=>HF,safeExtend:()=>GN,required:()=>LN,randomString:()=>sA,propertyKeyTypes:()=>bY,promiseAllObject:()=>aA,primitiveTypes:()=>UF,prefixIssues:()=>S6,pick:()=>XN,partial:()=>FN,parsedType:()=>vY,optionalKeys:()=>qY,omit:()=>QN,objectClone:()=>nA,numKeys:()=>tA,nullish:()=>HW,normalizeParams:()=>N0,mergeDefs:()=>M5,merge:()=>BN,jsonStringifyReplacer:()=>u4,joinValues:()=>qX,issue:()=>m4,isPlainObject:()=>f5,isObject:()=>Z4,hexToUint8Array:()=>ZN,getSizableOrigin:()=>NF,getParsedType:()=>eA,getLengthableOrigin:()=>AW,getEnumValues:()=>$W,getElementAtPath:()=>oA,floatSafeRemainder:()=>TY,finalizeIssue:()=>e1,extend:()=>YN,explicitlyAborted:()=>kY,escapeRegex:()=>O5,esc:()=>CX,defineLazy:()=>g0,createTransparentProxy:()=>WN,cloneDef:()=>rA,clone:()=>t1,cleanRegex:()=>UW,cleanEnum:()=>zN,captureStackTrace:()=>kX,cached:()=>l4,base64urlToUint8Array:()=>JN,base64ToUint8Array:()=>VF,assignProp:()=>g5,assertNotEqual:()=>cA,assertNever:()=>dA,assertIs:()=>pA,assertEqual:()=>mA,assert:()=>iA,allowsEval:()=>SY,aborted:()=>x5,NUMBER_FORMAT_RANGES:()=>CY,Class:()=>DF,BIGINT_FORMAT_RANGES:()=>AF});function mA(W){return W}function cA(W){return W}function pA(W){}function dA(W){throw Error("Unexpected value in exhaustive check")}function iA(W){}function $W(W){let X=Object.values(W).filter((Y)=>typeof Y==="number");return Object.entries(W).filter(([Y,G])=>X.indexOf(+Y)===-1).map(([Y,G])=>G)}function qX(W,X="|"){return W.map((Q)=>vX(Q)).join(X)}function u4(W,X){if(typeof X==="bigint")return X.toString();return X}function l4(W){return{get value(){{let Q=W();return Object.defineProperty(this,"value",{value:Q}),Q}throw Error("cached value already set")}}}function HW(W){return W===null||W===void 0}function UW(W){let X=W.startsWith("^")?1:0,Q=W.endsWith("$")?W.length-1:W.length;return W.slice(X,Q)}function TY(W,X){let Q=W/X,Y=Math.round(Q),G=Number.EPSILON*Math.max(Math.abs(Q),1);if(Math.abs(Q-Y)<G)return 0;return Q-Y}function g0(W,X,Q){let Y=void 0;Object.defineProperty(W,X,{get(){if(Y===$F)return;if(Y===void 0)Y=$F,Y=Q();return Y},set(G){Object.defineProperty(W,X,{value:G})},configurable:!0})}function nA(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function g5(W,X,Q){Object.defineProperty(W,X,{value:Q,writable:!0,enumerable:!0,configurable:!0})}function M5(...W){let X={};for(let Q of W){let Y=Object.getOwnPropertyDescriptors(Q);Object.assign(X,Y)}return Object.defineProperties({},X)}function rA(W){return M5(W._zod.def)}function oA(W,X){if(!X)return W;return X.reduce((Q,Y)=>Q?.[Y],W)}function aA(W){let X=Object.keys(W),Q=X.map((Y)=>W[Y]);return Promise.all(Q).then((Y)=>{let G={};for(let B=0;B<X.length;B++)G[X[B]]=Y[B];return G})}function sA(W=10){let Q="";for(let Y=0;Y<W;Y++)Q+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Q}function CX(W){return JSON.stringify(W)}function PY(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Z4(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function f5(W){if(Z4(W)===!1)return!1;let X=W.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let Q=X.prototype;if(Z4(Q)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Q,"isPrototypeOf")===!1)return!1;return!0}function HF(W){if(f5(W))return{...W};if(Array.isArray(W))return[...W];if(W instanceof Map)return new Map(W);if(W instanceof Set)return new Set(W);return W}function tA(W){let X=0;for(let Q in W)if(Object.prototype.hasOwnProperty.call(W,Q))X++;return X}function O5(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function t1(W,X,Q){let Y=new W._zod.constr(X??W._zod.def);if(!X||Q?.parent)Y._zod.parent=W;return Y}function N0(W){let X=W;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function WN(W){let X;return new Proxy({},{get(Q,Y,G){return X??(X=W()),Reflect.get(X,Y,G)},set(Q,Y,G,B){return X??(X=W()),Reflect.set(X,Y,G,B)},has(Q,Y){return X??(X=W()),Reflect.has(X,Y)},deleteProperty(Q,Y){return X??(X=W()),Reflect.deleteProperty(X,Y)},ownKeys(Q){return X??(X=W()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Q,Y){return X??(X=W()),Reflect.getOwnPropertyDescriptor(X,Y)},defineProperty(Q,Y,G){return X??(X=W()),Reflect.defineProperty(X,Y,G)}})}function vX(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function qY(W){return Object.keys(W).filter((X)=>{return W[X]._zod.optin==="optional"&&W[X]._zod.optout==="optional"})}function XN(W,X){let Q=W._zod.def,Y=Q.checks;if(Y&&Y.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let B=M5(W._zod.def,{get shape(){let F={};for(let L in X){if(!(L in Q.shape))throw Error(`Unrecognized key: "${L}"`);if(!X[L])continue;F[L]=Q.shape[L]}return g5(this,"shape",F),F},checks:[]});return t1(W,B)}function QN(W,X){let Q=W._zod.def,Y=Q.checks;if(Y&&Y.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let B=M5(W._zod.def,{get shape(){let F={...W._zod.def.shape};for(let L in X){if(!(L in Q.shape))throw Error(`Unrecognized key: "${L}"`);if(!X[L])continue;delete F[L]}return g5(this,"shape",F),F},checks:[]});return t1(W,B)}function YN(W,X){if(!f5(X))throw Error("Invalid input to extend: expected a plain object");let Q=W._zod.def.checks;if(Q&&Q.length>0){let B=W._zod.def.shape;for(let F in X)if(Object.getOwnPropertyDescriptor(B,F)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=M5(W._zod.def,{get shape(){let B={...W._zod.def.shape,...X};return g5(this,"shape",B),B}});return t1(W,G)}function GN(W,X){if(!f5(X))throw Error("Invalid input to safeExtend: expected a plain object");let Q=M5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...X};return g5(this,"shape",Y),Y}});return t1(W,Q)}function BN(W,X){if(W._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Q=M5(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...X._zod.def.shape};return g5(this,"shape",Y),Y},get catchall(){return X._zod.def.catchall},checks:X._zod.def.checks??[]});return t1(W,Q)}function FN(W,X,Q){let G=X._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let F=M5(X._zod.def,{get shape(){let L=X._zod.def.shape,z={...L};if(Q)for(let J in Q){if(!(J in L))throw Error(`Unrecognized key: "${J}"`);if(!Q[J])continue;z[J]=W?new W({type:"optional",innerType:L[J]}):L[J]}else for(let J in L)z[J]=W?new W({type:"optional",innerType:L[J]}):L[J];return g5(this,"shape",z),z},checks:[]});return t1(X,F)}function LN(W,X,Q){let Y=M5(X._zod.def,{get shape(){let G=X._zod.def.shape,B={...G};if(Q)for(let F in Q){if(!(F in B))throw Error(`Unrecognized key: "${F}"`);if(!Q[F])continue;B[F]=new W({type:"nonoptional",innerType:G[F]})}else for(let F in G)B[F]=new W({type:"nonoptional",innerType:G[F]});return g5(this,"shape",B),B}});return t1(X,Y)}function x5(W,X=0){if(W.aborted===!0)return!0;for(let Q=X;Q<W.issues.length;Q++)if(W.issues[Q]?.continue!==!0)return!0;return!1}function kY(W,X=0){if(W.aborted===!0)return!0;for(let Q=X;Q<W.issues.length;Q++)if(W.issues[Q]?.continue===!1)return!0;return!1}function S6(W,X){return X.map((Q)=>{var Y;return(Y=Q).path??(Y.path=[]),Q.path.unshift(W),Q})}function ZW(W){return typeof W==="string"?W:W?.message}function e1(W,X,Q){let Y=W.message?W.message:ZW(W.inst?._zod.def?.error?.(W))??ZW(X?.error?.(W))??ZW(Q.customError?.(W))??ZW(Q.localeError?.(W))??"Invalid input",{inst:G,continue:B,input:F,...L}=W;if(L.path??(L.path=[]),L.message=Y,X?.reportInput)L.input=F;return L}function NF(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function AW(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function vY(W){let X=typeof W;switch(X){case"number":return Number.isNaN(W)?"nan":"number";case"object":{if(W===null)return"null";if(Array.isArray(W))return"array";let Q=W;if(Q&&Object.getPrototypeOf(Q)!==Object.prototype&&"constructor"in Q&&Q.constructor)return Q.constructor.name}}return X}function m4(...W){let[X,Q,Y]=W;if(typeof X==="string")return{message:X,code:"custom",input:Q,inst:Y};return{...X}}function zN(W){return Object.entries(W).filter(([X,Q])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function VF(W){let X=atob(W),Q=new Uint8Array(X.length);for(let Y=0;Y<X.length;Y++)Q[Y]=X.charCodeAt(Y);return Q}function wF(W){let X="";for(let Q=0;Q<W.length;Q++)X+=String.fromCharCode(W[Q]);return btoa(X)}function JN(W){let X=W.replace(/-/g,"+").replace(/_/g,"/"),Q="=".repeat((4-X.length%4)%4);return VF(X+Q)}function KN(W){return wF(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ZN(W){let X=W.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let Q=new Uint8Array(X.length/2);for(let Y=0;Y<X.length;Y+=2)Q[Y/2]=Number.parseInt(X.slice(Y,Y+2),16);return Q}function $N(W){return Array.from(W).map((X)=>X.toString(16).padStart(2,"0")).join("")}class DF{constructor(...W){}}var $F,kX,SY,eA=(W)=>{let X=typeof W;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(W)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(W))return"array";if(W===null)return"null";if(W.then&&typeof W.then==="function"&&W.catch&&typeof W.catch==="function")return"promise";if(typeof Map<"u"&&W instanceof Map)return"map";if(typeof Set<"u"&&W instanceof Set)return"set";if(typeof Date<"u"&&W instanceof Date)return"date";if(typeof File<"u"&&W instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},bY,UF,CY,AF;var b6=H0(()=>{K4();$F=Symbol("evaluating");kX="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};SY=l4(()=>{if(h4.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});bY=new Set(["string","number","symbol"]),UF=new Set(["string","number","bigint","boolean","symbol","undefined"]);CY={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},AF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]}});function _Y(W,X=(Q)=>Q.message){let Q={},Y=[];for(let G of W.issues)if(G.path.length>0)Q[G.path[0]]=Q[G.path[0]]||[],Q[G.path[0]].push(X(G));else Y.push(X(G));return{formErrors:Y,fieldErrors:Q}}function gY(W,X=(Q)=>Q.message){let Q={_errors:[]},Y=(G,B=[])=>{for(let F of G.issues)if(F.code==="invalid_union"&&F.errors.length)F.errors.map((L)=>Y({issues:L},[...B,...F.path]));else if(F.code==="invalid_key")Y({issues:F.issues},[...B,...F.path]);else if(F.code==="invalid_element")Y({issues:F.issues},[...B,...F.path]);else{let L=[...B,...F.path];if(L.length===0)Q._errors.push(X(F));else{let z=Q,J=0;while(J<L.length){let K=L[J];if(J!==L.length-1)z[K]=z[K]||{_errors:[]};else z[K]=z[K]||{_errors:[]},z[K]._errors.push(X(F));z=z[K],J++}}}};return Y(W),Q}var MF=(W,X)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:X,enumerable:!1}),W.message=JSON.stringify(X,u4,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},yX,yY;var fY=H0(()=>{K4();b6();yX=i("$ZodError",MF),yY=i("$ZodError",MF,{Parent:Error})});var _X=(W)=>(X,Q,Y,G)=>{let B=Y?{...Y,async:!1}:{async:!1},F=X._zod.run({value:Q,issues:[]},B);if(F instanceof Promise)throw new D5;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((z)=>e1(z,B,k1())));throw kX(L,G?.callee),L}return F.value},gX=(W)=>async(X,Q,Y,G)=>{let B=Y?{...Y,async:!0}:{async:!0},F=X._zod.run({value:Q,issues:[]},B);if(F instanceof Promise)F=await F;if(F.issues.length){let L=new(G?.Err??W)(F.issues.map((z)=>e1(z,B,k1())));throw kX(L,G?.callee),L}return F.value},NW=(W)=>(X,Q,Y)=>{let G=Y?{...Y,async:!1}:{async:!1},B=X._zod.run({value:Q,issues:[]},G);if(B instanceof Promise)throw new D5;return B.issues.length?{success:!1,error:new(W??yX)(B.issues.map((F)=>e1(F,G,k1())))}:{success:!0,data:B.value}},OF,VW=(W)=>async(X,Q,Y)=>{let G=Y?{...Y,async:!0}:{async:!0},B=X._zod.run({value:Q,issues:[]},G);if(B instanceof Promise)B=await B;return B.issues.length?{success:!1,error:new W(B.issues.map((F)=>e1(F,G,k1())))}:{success:!0,data:B.value}},jF,EF=(W)=>(X,Q,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return _X(W)(X,Q,G)},IF=(W)=>(X,Q,Y)=>{return _X(W)(X,Q,Y)},RF=(W)=>async(X,Q,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return gX(W)(X,Q,G)},TF=(W)=>async(X,Q,Y)=>{return gX(W)(X,Q,Y)},PF=(W)=>(X,Q,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return NW(W)(X,Q,G)},SF=(W)=>(X,Q,Y)=>{return NW(W)(X,Q,Y)},bF=(W)=>async(X,Q,Y)=>{let G=Y?{...Y,direction:"backward"}:{direction:"backward"};return VW(W)(X,Q,G)},qF=(W)=>async(X,Q,Y)=>{return VW(W)(X,Q,Y)};var xY=H0(()=>{K4();fY();b6();OF=NW(yY),jF=VW(yY)});function uF(){return new RegExp(UN,"u")}function aF(W){return typeof W.precision==="number"?W.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":W.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${W.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function sF(W){return new RegExp(`^${aF(W)}$`)}function tF(W){let X=aF({precision:W.precision}),Q=["Z"];if(W.local)Q.push("");if(W.offset)Q.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${X}(?:${Q.join("|")})`;return new RegExp(`^${rF}T(?:${Y})$`)}var CF,kF,vF,yF,_F,gF,fF,xF,hY=(W)=>{if(!W)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${W}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},hF,UN="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lF,mF,cF,pF,dF,uY,iF,nF,rF="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",oF,eF=(W)=>{let X=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)},WL,XL,fX,QL,YL,GL,BL;var xX=H0(()=>{CF=/^[cC][0-9a-z]{6,}$/,kF=/^[0-9a-z]+$/,vF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yF=/^[0-9a-vA-V]{20}$/,_F=/^[A-Za-z0-9]{27}$/,gF=/^[a-zA-Z0-9_-]{21}$/,fF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xF=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;lF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,mF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,cF=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,dF=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,uY=/^[A-Za-z0-9_-]*$/,iF=/^https?$/,nF=/^\+[1-9]\d{6,14}$/,oF=new RegExp(`^${rF}$`);WL=/^-?\d+n?$/,XL=/^-?\d+$/,fX=/^-?\d+(?:\.\d+)?$/,QL=/^(?:true|false)$/i,YL=/^null$/i,GL=/^[^A-Z]*$/,BL=/^[^a-z]*$/});var V1,FL,lY,mY,LL,zL,JL,KL,ZL,DW,$L,HL,UL,AL,NL,VL,wL;var hX=H0(()=>{K4();xX();b6();V1=i("$ZodCheck",(W,X)=>{var Q;W._zod??(W._zod={}),W._zod.def=X,(Q=W._zod).onattach??(Q.onattach=[])}),FL={number:"number",bigint:"bigint",object:"date"},lY=i("$ZodCheckLessThan",(W,X)=>{V1.init(W,X);let Q=FL[typeof X.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<B)if(X.inclusive)G.maximum=X.value;else G.exclusiveMaximum=X.value}),W._zod.check=(Y)=>{if(X.inclusive?Y.value<=X.value:Y.value<X.value)return;Y.issues.push({origin:Q,code:"too_big",maximum:typeof X.value==="object"?X.value.getTime():X.value,input:Y.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),mY=i("$ZodCheckGreaterThan",(W,X)=>{V1.init(W,X);let Q=FL[typeof X.value];W._zod.onattach.push((Y)=>{let G=Y._zod.bag,B=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>B)if(X.inclusive)G.minimum=X.value;else G.exclusiveMinimum=X.value}),W._zod.check=(Y)=>{if(X.inclusive?Y.value>=X.value:Y.value>X.value)return;Y.issues.push({origin:Q,code:"too_small",minimum:typeof X.value==="object"?X.value.getTime():X.value,input:Y.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),LL=i("$ZodCheckMultipleOf",(W,X)=>{V1.init(W,X),W._zod.onattach.push((Q)=>{var Y;(Y=Q._zod.bag).multipleOf??(Y.multipleOf=X.value)}),W._zod.check=(Q)=>{if(typeof Q.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Q.value==="bigint"?Q.value%X.value===BigInt(0):TY(Q.value,X.value)===0)return;Q.issues.push({origin:typeof Q.value,code:"not_multiple_of",divisor:X.value,input:Q.value,inst:W,continue:!X.abort})}}),zL=i("$ZodCheckNumberFormat",(W,X)=>{V1.init(W,X),X.format=X.format||"float64";let Q=X.format?.includes("int"),Y=Q?"int":"number",[G,B]=CY[X.format];W._zod.onattach.push((F)=>{let L=F._zod.bag;if(L.format=X.format,L.minimum=G,L.maximum=B,Q)L.pattern=XL}),W._zod.check=(F)=>{let L=F.value;if(Q){if(!Number.isInteger(L)){F.issues.push({expected:Y,format:X.format,code:"invalid_type",continue:!1,input:L,inst:W});return}if(!Number.isSafeInteger(L)){if(L>0)F.issues.push({input:L,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!X.abort});else F.issues.push({input:L,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!X.abort});return}}if(L<G)F.issues.push({origin:"number",input:L,code:"too_small",minimum:G,inclusive:!0,inst:W,continue:!X.abort});if(L>B)F.issues.push({origin:"number",input:L,code:"too_big",maximum:B,inclusive:!0,inst:W,continue:!X.abort})}}),JL=i("$ZodCheckMaxLength",(W,X)=>{var Q;V1.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let G=Y.value;return!HW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)Y._zod.bag.maximum=X.maximum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length<=X.maximum)return;let F=AW(G);Y.issues.push({origin:F,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:W,continue:!X.abort})}}),KL=i("$ZodCheckMinLength",(W,X)=>{var Q;V1.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let G=Y.value;return!HW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)Y._zod.bag.minimum=X.minimum}),W._zod.check=(Y)=>{let G=Y.value;if(G.length>=X.minimum)return;let F=AW(G);Y.issues.push({origin:F,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:W,continue:!X.abort})}}),ZL=i("$ZodCheckLengthEquals",(W,X)=>{var Q;V1.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let G=Y.value;return!HW(G)&&G.length!==void 0}),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),W._zod.check=(Y)=>{let G=Y.value,B=G.length;if(B===X.length)return;let F=AW(G),L=B>X.length;Y.issues.push({origin:F,...L?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Y.value,inst:W,continue:!X.abort})}}),DW=i("$ZodCheckStringFormat",(W,X)=>{var Q,Y;if(V1.init(W,X),W._zod.onattach.push((G)=>{let B=G._zod.bag;if(B.format=X.format,X.pattern)B.patterns??(B.patterns=new Set),B.patterns.add(X.pattern)}),X.pattern)(Q=W._zod).check??(Q.check=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:W,continue:!X.abort})});else(Y=W._zod).check??(Y.check=()=>{})}),$L=i("$ZodCheckRegex",(W,X)=>{DW.init(W,X),W._zod.check=(Q)=>{if(X.pattern.lastIndex=0,X.pattern.test(Q.value))return;Q.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Q.value,pattern:X.pattern.toString(),inst:W,continue:!X.abort})}}),HL=i("$ZodCheckLowerCase",(W,X)=>{X.pattern??(X.pattern=GL),DW.init(W,X)}),UL=i("$ZodCheckUpperCase",(W,X)=>{X.pattern??(X.pattern=BL),DW.init(W,X)}),AL=i("$ZodCheckIncludes",(W,X)=>{V1.init(W,X);let Q=O5(X.includes),Y=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Q}`:Q);X.pattern=Y,W._zod.onattach.push((G)=>{let B=G._zod.bag;B.patterns??(B.patterns=new Set),B.patterns.add(Y)}),W._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:W,continue:!X.abort})}}),NL=i("$ZodCheckStartsWith",(W,X)=>{V1.init(W,X);let Q=new RegExp(`^${O5(X.prefix)}.*`);X.pattern??(X.pattern=Q),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Q)}),W._zod.check=(Y)=>{if(Y.value.startsWith(X.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Y.value,inst:W,continue:!X.abort})}}),VL=i("$ZodCheckEndsWith",(W,X)=>{V1.init(W,X);let Q=new RegExp(`.*${O5(X.suffix)}$`);X.pattern??(X.pattern=Q),W._zod.onattach.push((Y)=>{let G=Y._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Q)}),W._zod.check=(Y)=>{if(Y.value.endsWith(X.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Y.value,inst:W,continue:!X.abort})}}),wL=i("$ZodCheckOverwrite",(W,X)=>{V1.init(W,X),W._zod.check=(Q)=>{Q.value=X.tx(Q.value)}})});class cY{constructor(W=[]){if(this.content=[],this.indent=0,this)this.args=W}indented(W){this.indent+=1,W(this),this.indent-=1}write(W){if(typeof W==="function"){W(this,{execution:"sync"}),W(this,{execution:"async"});return}let Q=W.split(`
136
+ `).filter((B)=>B),Y=Math.min(...Q.map((B)=>B.length-B.trimStart().length)),G=Q.map((B)=>B.slice(Y)).map((B)=>" ".repeat(this.indent*2)+B);for(let B of G)this.content.push(B)}compile(){let W=Function,X=this?.args,Y=[...(this?.content??[""]).map((G)=>` ${G}`)];return new W(...X,Y.join(`
137
+ `))}}var ML;var pY=H0(()=>{ML={major:4,minor:4,patch:3}});function sL(W){if(W==="")return!0;if(/\s/.test(W))return!1;if(W.length%4!==0)return!1;try{return atob(W),!0}catch{return!1}}function AN(W){if(!uY.test(W))return!1;let X=W.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),Q=X.padEnd(Math.ceil(X.length/4)*4,"=");return sL(Q)}function NN(W,X=null){try{let Q=W.split(".");if(Q.length!==3)return!1;let[Y]=Q;if(!Y)return!1;let G=JSON.parse(atob(Y));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}function OL(W,X,Q){if(W.issues.length)X.issues.push(...S6(Q,W.issues));X.value[Q]=W.value}function lX(W,X,Q,Y,G,B){let F=Q in Y;if(W.issues.length){if(G&&B&&!F)return;X.issues.push(...S6(Q,W.issues))}if(!F&&!G){if(!W.issues.length)X.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Q]});return}if(W.value===void 0){if(F)X.value[Q]=void 0}else X.value[Q]=W.value}function Zz(W){let X=Object.keys(W.shape);for(let Y of X)if(!W.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let Q=qY(W.shape);return{...W,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Q)}}function $z(W,X,Q,Y,G,B){let F=[],L=G.keySet,z=G.catchall._zod,J=z.def.type,K=z.optin==="optional",Z=z.optout==="optional";for(let D in X){if(D==="__proto__")continue;if(L.has(D))continue;if(J==="never"){F.push(D);continue}let I=z.run({value:X[D],issues:[]},Y);if(I instanceof Promise)W.push(I.then((A)=>lX(A,Q,D,X,K,Z)));else lX(I,Q,D,X,K,Z)}if(F.length)Q.issues.push({code:"unrecognized_keys",keys:F,input:X,inst:B});if(!W.length)return Q;return Promise.all(W).then(()=>{return Q})}function jL(W,X,Q,Y){for(let B of W)if(B.issues.length===0)return X.value=B.value,X;let G=W.filter((B)=>!x5(B));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Q,errors:W.map((B)=>B.issues.map((F)=>e1(F,Y,k1())))}),X}function dY(W,X){if(W===X)return{valid:!0,data:W};if(W instanceof Date&&X instanceof Date&&+W===+X)return{valid:!0,data:W};if(f5(W)&&f5(X)){let Q=Object.keys(X),Y=Object.keys(W).filter((B)=>Q.indexOf(B)!==-1),G={...W,...X};for(let B of Y){let F=dY(W[B],X[B]);if(!F.valid)return{valid:!1,mergeErrorPath:[B,...F.mergeErrorPath]};G[B]=F.data}return{valid:!0,data:G}}if(Array.isArray(W)&&Array.isArray(X)){if(W.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Q=[];for(let Y=0;Y<W.length;Y++){let G=W[Y],B=X[Y],F=dY(G,B);if(!F.valid)return{valid:!1,mergeErrorPath:[Y,...F.mergeErrorPath]};Q.push(F.data)}return{valid:!0,data:Q}}return{valid:!1,mergeErrorPath:[]}}function EL(W,X,Q){let Y=new Map,G;for(let L of X.issues)if(L.code==="unrecognized_keys"){G??(G=L);for(let z of L.keys){if(!Y.has(z))Y.set(z,{});Y.get(z).l=!0}}else W.issues.push(L);for(let L of Q.issues)if(L.code==="unrecognized_keys")for(let z of L.keys){if(!Y.has(z))Y.set(z,{});Y.get(z).r=!0}else W.issues.push(L);let B=[...Y].filter(([,L])=>L.l&&L.r).map(([L])=>L);if(B.length&&G)W.issues.push({...G,keys:B});if(x5(W))return W;let F=dY(X.value,Q.value);if(!F.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(F.mergeErrorPath)}`);return W.value=F.data,W}function IL(W,X){for(let Q=W.length-1;Q>=0;Q--)if(W[Q]._zod[X]!=="optional")return Q+1;return 0}function RL(W,X,Q){if(W.issues.length)X.issues.push(...S6(Q,W.issues));X.value[Q]=W.value}function TL(W,X,Q,Y,G){for(let B=0;B<Q.length;B++){let F=W[B],L=B<Y.length;if(F.issues.length){if(!L&&B>=G){X.value.length=B;break}X.issues.push(...S6(B,F.issues))}X.value[B]=F.value}for(let B=X.value.length-1;B>=Y.length;B--)if(Q[B]._zod.optout==="optional"&&X.value[B]===void 0)X.value.length=B;else break;return X}function PL(W,X){if(X===void 0&&(W.issues.length||W.fallback))return{issues:[],value:void 0};return W}function SL(W,X){if(W.value===void 0)W.value=X.defaultValue;return W}function bL(W,X){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:X});return W}function uX(W,X,Q){if(W.issues.length)return W.aborted=!0,W;return X._zod.run({value:W.value,issues:W.issues,fallback:W.fallback},Q)}function qL(W){return W.value=Object.freeze(W.value),W}function CL(W,X,Q,Y){if(!W){let G={code:"custom",input:Q,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)G.params=Y._zod.def.params;X.issues.push(m4(G))}}var l0,mX,s0,kL,vL,yL,_L,gL,fL,xL,hL,uL,lL,mL,cL,pL,dL,iL,nL,rL,oL,aL,tL,eL,Wz,Xz,iY,Qz,Yz,Gz,Bz,Fz,Lz,zz,Jz,Kz,VN,Hz,nY,Uz,Az,Nz,Vz,wz,Dz,Mz,rY,Oz,jz,Ez,Iz,Rz,Tz,oY,Pz,Sz,bz,qz;var Cz=H0(()=>{hX();K4();xY();xX();b6();pY();b6();l0=i("$ZodType",(W,X)=>{var Q;W??(W={}),W._zod.def=X,W._zod.bag=W._zod.bag||{},W._zod.version=ML;let Y=[...W._zod.def.checks??[]];if(W._zod.traits.has("$ZodCheck"))Y.unshift(W);for(let G of Y)for(let B of G._zod.onattach)B(W);if(Y.length===0)(Q=W._zod).deferred??(Q.deferred=[]),W._zod.deferred?.push(()=>{W._zod.run=W._zod.parse});else{let G=(F,L,z)=>{let J=x5(F),K;for(let Z of L){if(Z._zod.def.when){if(kY(F))continue;if(!Z._zod.def.when(F))continue}else if(J)continue;let D=F.issues.length,I=Z._zod.check(F);if(I instanceof Promise&&z?.async===!1)throw new D5;if(K||I instanceof Promise)K=(K??Promise.resolve()).then(async()=>{if(await I,F.issues.length===D)return;if(!J)J=x5(F,D)});else{if(F.issues.length===D)continue;if(!J)J=x5(F,D)}}if(K)return K.then(()=>{return F});return F},B=(F,L,z)=>{if(x5(F))return F.aborted=!0,F;let J=G(L,Y,z);if(J instanceof Promise){if(z.async===!1)throw new D5;return J.then((K)=>W._zod.parse(K,z))}return W._zod.parse(J,z)};W._zod.run=(F,L)=>{if(L.skipChecks)return W._zod.parse(F,L);if(L.direction==="backward"){let J=W._zod.parse({value:F.value,issues:[]},{...L,skipChecks:!0});if(J instanceof Promise)return J.then((K)=>{return B(K,F,L)});return B(J,F,L)}let z=W._zod.parse(F,L);if(z instanceof Promise){if(L.async===!1)throw new D5;return z.then((J)=>G(J,Y,L))}return G(z,Y,L)}}g0(W,"~standard",()=>({validate:(G)=>{try{let B=OF(W,G);return B.success?{value:B.data}:{issues:B.error?.issues}}catch(B){return jF(W,G).then((F)=>F.success?{value:F.data}:{issues:F.error?.issues})}},vendor:"zod",version:1}))}),mX=i("$ZodString",(W,X)=>{l0.init(W,X),W._zod.pattern=[...W?._zod.bag?.patterns??[]].pop()??eF(W._zod.bag),W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=String(Q.value)}catch(G){}if(typeof Q.value==="string")return Q;return Q.issues.push({expected:"string",code:"invalid_type",input:Q.value,inst:W}),Q}}),s0=i("$ZodStringFormat",(W,X)=>{DW.init(W,X),mX.init(W,X)}),kL=i("$ZodGUID",(W,X)=>{X.pattern??(X.pattern=xF),s0.init(W,X)}),vL=i("$ZodUUID",(W,X)=>{if(X.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Y===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=hY(Y))}else X.pattern??(X.pattern=hY());s0.init(W,X)}),yL=i("$ZodEmail",(W,X)=>{X.pattern??(X.pattern=hF),s0.init(W,X)}),_L=i("$ZodURL",(W,X)=>{s0.init(W,X),W._zod.check=(Q)=>{try{let Y=Q.value.trim();if(!X.normalize&&X.protocol?.source===iF.source){if(!/^https?:\/\//i.test(Y)){Q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Q.value,inst:W,continue:!X.abort});return}}let G=new URL(Y);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:Q.value,inst:W,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Q.value,inst:W,continue:!X.abort})}if(X.normalize)Q.value=G.href;else Q.value=Y;return}catch(Y){Q.issues.push({code:"invalid_format",format:"url",input:Q.value,inst:W,continue:!X.abort})}}}),gL=i("$ZodEmoji",(W,X)=>{X.pattern??(X.pattern=uF()),s0.init(W,X)}),fL=i("$ZodNanoID",(W,X)=>{X.pattern??(X.pattern=gF),s0.init(W,X)}),xL=i("$ZodCUID",(W,X)=>{X.pattern??(X.pattern=CF),s0.init(W,X)}),hL=i("$ZodCUID2",(W,X)=>{X.pattern??(X.pattern=kF),s0.init(W,X)}),uL=i("$ZodULID",(W,X)=>{X.pattern??(X.pattern=vF),s0.init(W,X)}),lL=i("$ZodXID",(W,X)=>{X.pattern??(X.pattern=yF),s0.init(W,X)}),mL=i("$ZodKSUID",(W,X)=>{X.pattern??(X.pattern=_F),s0.init(W,X)}),cL=i("$ZodISODateTime",(W,X)=>{X.pattern??(X.pattern=tF(X)),s0.init(W,X)}),pL=i("$ZodISODate",(W,X)=>{X.pattern??(X.pattern=oF),s0.init(W,X)}),dL=i("$ZodISOTime",(W,X)=>{X.pattern??(X.pattern=sF(X)),s0.init(W,X)}),iL=i("$ZodISODuration",(W,X)=>{X.pattern??(X.pattern=fF),s0.init(W,X)}),nL=i("$ZodIPv4",(W,X)=>{X.pattern??(X.pattern=lF),s0.init(W,X),W._zod.bag.format="ipv4"}),rL=i("$ZodIPv6",(W,X)=>{X.pattern??(X.pattern=mF),s0.init(W,X),W._zod.bag.format="ipv6",W._zod.check=(Q)=>{try{new URL(`http://[${Q.value}]`)}catch{Q.issues.push({code:"invalid_format",format:"ipv6",input:Q.value,inst:W,continue:!X.abort})}}}),oL=i("$ZodCIDRv4",(W,X)=>{X.pattern??(X.pattern=cF),s0.init(W,X)}),aL=i("$ZodCIDRv6",(W,X)=>{X.pattern??(X.pattern=pF),s0.init(W,X),W._zod.check=(Q)=>{let Y=Q.value.split("/");try{if(Y.length!==2)throw Error();let[G,B]=Y;if(!B)throw Error();let F=Number(B);if(`${F}`!==B)throw Error();if(F<0||F>128)throw Error();new URL(`http://[${G}]`)}catch{Q.issues.push({code:"invalid_format",format:"cidrv6",input:Q.value,inst:W,continue:!X.abort})}}});tL=i("$ZodBase64",(W,X)=>{X.pattern??(X.pattern=dF),s0.init(W,X),W._zod.bag.contentEncoding="base64",W._zod.check=(Q)=>{if(sL(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64",input:Q.value,inst:W,continue:!X.abort})}});eL=i("$ZodBase64URL",(W,X)=>{X.pattern??(X.pattern=uY),s0.init(W,X),W._zod.bag.contentEncoding="base64url",W._zod.check=(Q)=>{if(AN(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64url",input:Q.value,inst:W,continue:!X.abort})}}),Wz=i("$ZodE164",(W,X)=>{X.pattern??(X.pattern=nF),s0.init(W,X)});Xz=i("$ZodJWT",(W,X)=>{s0.init(W,X),W._zod.check=(Q)=>{if(NN(Q.value,X.alg))return;Q.issues.push({code:"invalid_format",format:"jwt",input:Q.value,inst:W,continue:!X.abort})}}),iY=i("$ZodNumber",(W,X)=>{l0.init(W,X),W._zod.pattern=W._zod.bag.pattern??fX,W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=Number(Q.value)}catch(F){}let G=Q.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Q;let B=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Q.issues.push({expected:"number",code:"invalid_type",input:G,inst:W,...B?{received:B}:{}}),Q}}),Qz=i("$ZodNumberFormat",(W,X)=>{zL.init(W,X),iY.init(W,X)}),Yz=i("$ZodBoolean",(W,X)=>{l0.init(W,X),W._zod.pattern=QL,W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=Boolean(Q.value)}catch(B){}let G=Q.value;if(typeof G==="boolean")return Q;return Q.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:W}),Q}}),Gz=i("$ZodBigInt",(W,X)=>{l0.init(W,X),W._zod.pattern=WL,W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=BigInt(Q.value)}catch(G){}if(typeof Q.value==="bigint")return Q;return Q.issues.push({expected:"bigint",code:"invalid_type",input:Q.value,inst:W}),Q}}),Bz=i("$ZodNull",(W,X)=>{l0.init(W,X),W._zod.pattern=YL,W._zod.values=new Set([null]),W._zod.parse=(Q,Y)=>{let G=Q.value;if(G===null)return Q;return Q.issues.push({expected:"null",code:"invalid_type",input:G,inst:W}),Q}}),Fz=i("$ZodAny",(W,X)=>{l0.init(W,X),W._zod.parse=(Q)=>Q}),Lz=i("$ZodUnknown",(W,X)=>{l0.init(W,X),W._zod.parse=(Q)=>Q}),zz=i("$ZodNever",(W,X)=>{l0.init(W,X),W._zod.parse=(Q,Y)=>{return Q.issues.push({expected:"never",code:"invalid_type",input:Q.value,inst:W}),Q}}),Jz=i("$ZodDate",(W,X)=>{l0.init(W,X),W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=new Date(Q.value)}catch(L){}let G=Q.value,B=G instanceof Date;if(B&&!Number.isNaN(G.getTime()))return Q;return Q.issues.push({expected:"date",code:"invalid_type",input:G,...B?{received:"Invalid Date"}:{},inst:W}),Q}});Kz=i("$ZodArray",(W,X)=>{l0.init(W,X),W._zod.parse=(Q,Y)=>{let G=Q.value;if(!Array.isArray(G))return Q.issues.push({expected:"array",code:"invalid_type",input:G,inst:W}),Q;Q.value=Array(G.length);let B=[];for(let F=0;F<G.length;F++){let L=G[F],z=X.element._zod.run({value:L,issues:[]},Y);if(z instanceof Promise)B.push(z.then((J)=>OL(J,Q,F)));else OL(z,Q,F)}if(B.length)return Promise.all(B).then(()=>Q);return Q}});VN=i("$ZodObject",(W,X)=>{if(l0.init(W,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let L=X.shape;Object.defineProperty(X,"shape",{get:()=>{let z={...L};return Object.defineProperty(X,"shape",{value:z}),z}})}let Y=l4(()=>Zz(X));g0(W._zod,"propValues",()=>{let L=X.shape,z={};for(let J in L){let K=L[J]._zod;if(K.values){z[J]??(z[J]=new Set);for(let Z of K.values)z[J].add(Z)}}return z});let G=Z4,B=X.catchall,F;W._zod.parse=(L,z)=>{F??(F=Y.value);let J=L.value;if(!G(J))return L.issues.push({expected:"object",code:"invalid_type",input:J,inst:W}),L;L.value={};let K=[],Z=F.shape;for(let D of F.keys){let I=Z[D],A=I._zod.optin==="optional",M=I._zod.optout==="optional",N=I._zod.run({value:J[D],issues:[]},z);if(N instanceof Promise)K.push(N.then(($)=>lX($,L,D,J,A,M)));else lX(N,L,D,J,A,M)}if(!B)return K.length?Promise.all(K).then(()=>L):L;return $z(K,J,L,z,Y.value,W)}}),Hz=i("$ZodObjectJIT",(W,X)=>{VN.init(W,X);let Q=W._zod.parse,Y=l4(()=>Zz(X)),G=(D)=>{let I=new cY(["shape","payload","ctx"]),A=Y.value,M=(U)=>{let O=CX(U);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`};I.write("const input = payload.value;");let N=Object.create(null),$=0;for(let U of A.keys)N[U]=`key_${$++}`;I.write("const newResult = {};");for(let U of A.keys){let O=N[U],R=CX(U),j=D[U],w=j?._zod?.optin==="optional",T=j?._zod?.optout==="optional";if(I.write(`const ${O} = ${M(U)};`),w&&T)I.write(`
138
+ if (${O}.issues.length) {
27
139
  if (${R} in input) {
28
- payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
140
+ payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
29
141
  ...iss,
30
142
  path: iss.path ? [${R}, ...iss.path] : [${R}]
31
143
  })));
32
144
  }
33
145
  }
34
146
 
35
- if (${j}.value === undefined) {
147
+ if (${O}.value === undefined) {
36
148
  if (${R} in input) {
37
149
  newResult[${R}] = undefined;
38
150
  }
39
151
  } else {
40
- newResult[${R}] = ${j}.value;
152
+ newResult[${R}] = ${O}.value;
41
153
  }
42
154
 
43
155
  `);else if(!w)I.write(`
44
- const ${j}_present = ${R} in input;
45
- if (${j}.issues.length) {
46
- payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
156
+ const ${O}_present = ${R} in input;
157
+ if (${O}.issues.length) {
158
+ payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
47
159
  ...iss,
48
160
  path: iss.path ? [${R}, ...iss.path] : [${R}]
49
161
  })));
50
162
  }
51
- if (!${j}_present && !${j}.issues.length) {
163
+ if (!${O}_present && !${O}.issues.length) {
52
164
  payload.issues.push({
53
165
  code: "invalid_type",
54
166
  expected: "nonoptional",
@@ -57,78 +169,79 @@ ${JA}`)}async function AQ(W){let Q=await y5(W,"utf8").catch(()=>"");await ZY(W,Q
57
169
  });
58
170
  }
59
171
 
60
- if (${j}_present) {
61
- if (${j}.value === undefined) {
172
+ if (${O}_present) {
173
+ if (${O}.value === undefined) {
62
174
  newResult[${R}] = undefined;
63
175
  } else {
64
- newResult[${R}] = ${j}.value;
176
+ newResult[${R}] = ${O}.value;
65
177
  }
66
178
  }
67
179
 
68
180
  `);else I.write(`
69
- if (${j}.issues.length) {
70
- payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
181
+ if (${O}.issues.length) {
182
+ payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
71
183
  ...iss,
72
184
  path: iss.path ? [${R}, ...iss.path] : [${R}]
73
185
  })));
74
186
  }
75
187
 
76
- if (${j}.value === undefined) {
188
+ if (${O}.value === undefined) {
77
189
  if (${R} in input) {
78
190
  newResult[${R}] = undefined;
79
191
  }
80
192
  } else {
81
- newResult[${R}] = ${j}.value;
193
+ newResult[${R}] = ${O}.value;
82
194
  }
83
195
 
84
- `)}I.write("payload.value = newResult;"),I.write("return payload;");let V=I.compile();return(U,j)=>V(D,U,j)},B,F=K4,L=!f4.jitless,J=L&&VY.value,K=Q.catchall,H;W._zod.parse=(D,I)=>{H??(H=Y.value);let A=D.value;if(!F(A))return D.issues.push({expected:"object",code:"invalid_type",input:A,inst:W}),D;if(L&&J&&I?.async===!1&&I.jitless!==!0){if(!B)B=G(Q.shape);if(D=B(D,I),!K)return D;return tL([],A,D,I,H,W)}return X(D,I)}});gY=i("$ZodUnion",(W,Q)=>{l0.init(W,Q),g0(W._zod,"optin",()=>Q.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),g0(W._zod,"optout",()=>Q.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),g0(W._zod,"values",()=>{if(Q.options.every((Y)=>Y._zod.values))return new Set(Q.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),g0(W._zod,"pattern",()=>{if(Q.options.every((Y)=>Y._zod.pattern)){let Y=Q.options.map((G)=>G._zod.pattern);return new RegExp(`^(${Y.map((G)=>zW(G.source)).join("|")})$`)}return});let X=Q.options.length===1?Q.options[0]._zod.run:null;W._zod.parse=(Y,G)=>{if(X)return X(Y,G);let B=!1,F=[];for(let L of Q.options){let z=L._zod.run({value:Y.value,issues:[]},G);if(z instanceof Promise)F.push(z),B=!0;else{if(z.issues.length===0)return z;F.push(z)}}if(!B)return zL(F,Y,W,G);return Promise.all(F).then((L)=>{return zL(L,Y,W,G)})}}),Wz=i("$ZodDiscriminatedUnion",(W,Q)=>{Q.inclusive=!1,gY.init(W,Q);let X=W._zod.parse;g0(W._zod,"propValues",()=>{let G={};for(let B of Q.options){let F=B._zod.propValues;if(!F||Object.keys(F).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(B)}"`);for(let[L,z]of Object.entries(F)){if(!G[L])G[L]=new Set;for(let J of z)G[L].add(J)}}return G});let Y=h4(()=>{let G=Q.options,B=new Map;for(let F of G){let L=F._zod.propValues?.[Q.discriminator];if(!L||L.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(F)}"`);for(let z of L){if(B.has(z))throw Error(`Duplicate discriminator value "${String(z)}"`);B.set(z,F)}}return B});W._zod.parse=(G,B)=>{let F=G.value;if(!K4(F))return G.issues.push({code:"invalid_type",expected:"object",input:F,inst:W}),G;let L=Y.value.get(F?.[Q.discriminator]);if(L)return L._zod.run(G,B);if(Q.unionFallback||B.direction==="backward")return X(G,B);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Q.discriminator,options:Array.from(Y.value.keys()),input:F,path:[Q.discriminator],inst:W}),G}}),Qz=i("$ZodIntersection",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value,B=Q.left._zod.run({value:G,issues:[]},Y),F=Q.right._zod.run({value:G,issues:[]},Y);if(B instanceof Promise||F instanceof Promise)return Promise.all([B,F]).then(([z,J])=>{return JL(X,z,J)});return JL(X,B,F)}});Xz=i("$ZodTuple",(W,Q)=>{l0.init(W,Q);let X=Q.items;W._zod.parse=(Y,G)=>{let B=Y.value;if(!Array.isArray(B))return Y.issues.push({input:B,inst:W,expected:"tuple",code:"invalid_type"}),Y;Y.value=[];let F=[],L=KL(X,"optin"),z=KL(X,"optout");if(!Q.rest){if(B.length<L)return Y.issues.push({code:"too_small",minimum:L,inclusive:!0,input:B,inst:W,origin:"array"}),Y;if(B.length>X.length)Y.issues.push({code:"too_big",maximum:X.length,inclusive:!0,input:B,inst:W,origin:"array"})}let J=Array(X.length);for(let K=0;K<X.length;K++){let H=X[K]._zod.run({value:B[K],issues:[]},G);if(H instanceof Promise)F.push(H.then((D)=>{J[K]=D}));else J[K]=H}if(Q.rest){let K=X.length-1,H=B.slice(X.length);for(let D of H){K++;let I=Q.rest._zod.run({value:D,issues:[]},G);if(I instanceof Promise)F.push(I.then((A)=>ZL(A,Y,K)));else ZL(I,Y,K)}}if(F.length)return Promise.all(F).then(()=>HL(J,Y,X,B,z));return HL(J,Y,X,B,z)}});Yz=i("$ZodRecord",(W,Q)=>{l0.init(W,Q),W._zod.parse=(X,Y)=>{let G=X.value;if(!g5(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:W}),X;let B=[],F=Q.keyType._zod.values;if(F){X.value={};let L=new Set;for(let J of F)if(typeof J==="string"||typeof J==="number"||typeof J==="symbol"){L.add(typeof J==="number"?J.toString():J);let K=Q.keyType._zod.run({value:J,issues:[]},Y);if(K instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(K.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:K.issues.map((I)=>t1(I,Y,C1())),input:J,path:[J],inst:W});continue}let H=K.value,D=Q.valueType._zod.run({value:G[J],issues:[]},Y);if(D instanceof Promise)B.push(D.then((I)=>{if(I.issues.length)X.issues.push(...P6(J,I.issues));X.value[H]=I.value}));else{if(D.issues.length)X.issues.push(...P6(J,D.issues));X.value[H]=D.value}}let z;for(let J in G)if(!L.has(J))z=z??[],z.push(J);if(z&&z.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:W,keys:z})}else{X.value={};for(let L of Reflect.ownKeys(G)){if(L==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(G,L))continue;let z=Q.keyType._zod.run({value:L,issues:[]},Y);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof L==="string"&&qQ.test(L)&&z.issues.length){let H=Q.keyType._zod.run({value:Number(L),issues:[]},Y);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length===0)z=H}if(z.issues.length){if(Q.mode==="loose")X.value[L]=G[L];else X.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((H)=>t1(H,Y,C1())),input:L,path:[L],inst:W});continue}let K=Q.valueType._zod.run({value:G[L],issues:[]},Y);if(K instanceof Promise)B.push(K.then((H)=>{if(H.issues.length)X.issues.push(...P6(L,H.issues));X.value[z.value]=H.value}));else{if(K.issues.length)X.issues.push(...P6(L,K.issues));X.value[z.value]=K.value}}}if(B.length)return Promise.all(B).then(()=>X);return X}}),Gz=i("$ZodEnum",(W,Q)=>{l0.init(W,Q);let X=FW(Q.entries),Y=new Set(X);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${X.filter((G)=>wY.has(typeof G)).map((G)=>typeof G==="string"?j5(G):G.toString()).join("|")})$`),W._zod.parse=(G,B)=>{let F=G.value;if(Y.has(F))return G;return G.issues.push({code:"invalid_value",values:X,input:F,inst:W}),G}}),Bz=i("$ZodLiteral",(W,Q)=>{if(l0.init(W,Q),Q.values.length===0)throw Error("Cannot create literal schema with no valid values");let X=new Set(Q.values);W._zod.values=X,W._zod.pattern=new RegExp(`^(${Q.values.map((Y)=>typeof Y==="string"?j5(Y):Y?j5(Y.toString()):String(Y)).join("|")})$`),W._zod.parse=(Y,G)=>{let B=Y.value;if(X.has(B))return Y;return Y.issues.push({code:"invalid_value",values:Q.values,input:B,inst:W}),Y}}),Fz=i("$ZodTransform",(W,Q)=>{l0.init(W,Q),W._zod.optin="optional",W._zod.parse=(X,Y)=>{if(Y.direction==="backward")throw new GW(W.constructor.name);let G=Q.transform(X.value,X);if(Y.async)return(G instanceof Promise?G:Promise.resolve(G)).then((F)=>{return X.value=F,X.fallback=!0,X});if(G instanceof Promise)throw new D5;return X.value=G,X.fallback=!0,X}});fY=i("$ZodOptional",(W,Q)=>{l0.init(W,Q),W._zod.optin="optional",W._zod.optout="optional",g0(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),g0(W._zod,"pattern",()=>{let X=Q.innerType._zod.pattern;return X?new RegExp(`^(${zW(X.source)})?$`):void 0}),W._zod.parse=(X,Y)=>{if(Q.innerType._zod.optin==="optional"){let G=X.value,B=Q.innerType._zod.run(X,Y);if(B instanceof Promise)return B.then((F)=>$L(F,G));return $L(B,G)}if(X.value===void 0)return X;return Q.innerType._zod.run(X,Y)}}),Lz=i("$ZodExactOptional",(W,Q)=>{fY.init(W,Q),g0(W._zod,"values",()=>Q.innerType._zod.values),g0(W._zod,"pattern",()=>Q.innerType._zod.pattern),W._zod.parse=(X,Y)=>{return Q.innerType._zod.run(X,Y)}}),zz=i("$ZodNullable",(W,Q)=>{l0.init(W,Q),g0(W._zod,"optin",()=>Q.innerType._zod.optin),g0(W._zod,"optout",()=>Q.innerType._zod.optout),g0(W._zod,"pattern",()=>{let X=Q.innerType._zod.pattern;return X?new RegExp(`^(${zW(X.source)}|null)$`):void 0}),g0(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),W._zod.parse=(X,Y)=>{if(X.value===null)return X;return Q.innerType._zod.run(X,Y)}}),Jz=i("$ZodDefault",(W,Q)=>{l0.init(W,Q),W._zod.optin="optional",g0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);if(X.value===void 0)return X.value=Q.defaultValue,X;let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>UL(B,Q));return UL(G,Q)}});Kz=i("$ZodPrefault",(W,Q)=>{l0.init(W,Q),W._zod.optin="optional",g0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);if(X.value===void 0)X.value=Q.defaultValue;return Q.innerType._zod.run(X,Y)}}),Zz=i("$ZodNonOptional",(W,Q)=>{l0.init(W,Q),g0(W._zod,"values",()=>{let X=Q.innerType._zod.values;return X?new Set([...X].filter((Y)=>Y!==void 0)):void 0}),W._zod.parse=(X,Y)=>{let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>AL(B,W));return AL(G,W)}});Hz=i("$ZodCatch",(W,Q)=>{l0.init(W,Q),W._zod.optin="optional",g0(W._zod,"optout",()=>Q.innerType._zod.optout),g0(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>{if(X.value=B.value,B.issues.length)X.value=Q.catchValue({...X,error:{issues:B.issues.map((F)=>t1(F,Y,C1()))},input:X.value}),X.issues=[],X.fallback=!0;return X});if(X.value=G.value,G.issues.length)X.value=Q.catchValue({...X,error:{issues:G.issues.map((B)=>t1(B,Y,C1()))},input:X.value}),X.issues=[],X.fallback=!0;return X}}),xY=i("$ZodPipe",(W,Q)=>{l0.init(W,Q),g0(W._zod,"values",()=>Q.in._zod.values),g0(W._zod,"optin",()=>Q.in._zod.optin),g0(W._zod,"optout",()=>Q.out._zod.optout),g0(W._zod,"propValues",()=>Q.in._zod.propValues),W._zod.parse=(X,Y)=>{if(Y.direction==="backward"){let B=Q.out._zod.run(X,Y);if(B instanceof Promise)return B.then((F)=>vQ(F,Q.in,Y));return vQ(B,Q.in,Y)}let G=Q.in._zod.run(X,Y);if(G instanceof Promise)return G.then((B)=>vQ(B,Q.out,Y));return vQ(G,Q.out,Y)}});$z=i("$ZodPreprocess",(W,Q)=>{xY.init(W,Q)}),Uz=i("$ZodReadonly",(W,Q)=>{l0.init(W,Q),g0(W._zod,"propValues",()=>Q.innerType._zod.propValues),g0(W._zod,"values",()=>Q.innerType._zod.values),g0(W._zod,"optin",()=>Q.innerType?._zod?.optin),g0(W._zod,"optout",()=>Q.innerType?._zod?.optout),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")return Q.innerType._zod.run(X,Y);let G=Q.innerType._zod.run(X,Y);if(G instanceof Promise)return G.then(NL);return NL(G)}});Az=i("$ZodLazy",(W,Q)=>{l0.init(W,Q),g0(W._zod,"innerType",()=>{let X=Q;if(!X._cachedInner)X._cachedInner=Q.getter();return X._cachedInner}),g0(W._zod,"pattern",()=>W._zod.innerType?._zod?.pattern),g0(W._zod,"propValues",()=>W._zod.innerType?._zod?.propValues),g0(W._zod,"optin",()=>W._zod.innerType?._zod?.optin??void 0),g0(W._zod,"optout",()=>W._zod.innerType?._zod?.optout??void 0),W._zod.parse=(X,Y)=>{return W._zod.innerType._zod.run(X,Y)}}),Nz=i("$ZodCustom",(W,Q)=>{N1.init(W,Q),l0.init(W,Q),W._zod.parse=(X,Y)=>{return X},W._zod.check=(X)=>{let Y=X.value,G=Q.fn(Y);if(G instanceof Promise)return G.then((B)=>VL(B,X,Y,W));VL(G,X,Y,W);return}})});function hY(){return{localeError:sA()}}var sA=()=>{let W={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function Q(G){return W[G]??null}let X={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"},Y={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let B=Y[G.expected]??G.expected,F=OY(G.input),L=Y[F]??F;return`Invalid input: expected ${B}, received ${L}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${TQ(G.values[0])}`;return`Invalid option: expected one of ${EQ(G.values,"|")}`;case"too_big":{let B=G.inclusive?"<=":"<",F=Q(G.origin);if(F)return`Too big: expected ${G.origin??"value"} to have ${B}${G.maximum.toString()} ${F.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${B}${G.maximum.toString()}`}case"too_small":{let B=G.inclusive?">=":">",F=Q(G.origin);if(F)return`Too small: expected ${G.origin} to have ${B}${G.minimum.toString()} ${F.unit}`;return`Too small: expected ${G.origin} to be ${B}${G.minimum.toString()}`}case"invalid_format":{let B=G;if(B.format==="starts_with")return`Invalid string: must start with "${B.prefix}"`;if(B.format==="ends_with")return`Invalid string: must end with "${B.suffix}"`;if(B.format==="includes")return`Invalid string: must include "${B.includes}"`;if(B.format==="regex")return`Invalid string: must match pattern ${B.pattern}`;return`Invalid ${X[B.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${EQ(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":if(G.options&&Array.isArray(G.options)&&G.options.length>0)return`Invalid discriminator value. Expected ${G.options.map((F)=>`'${F}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};var wz=$0(()=>{S6()});var uY=()=>{};class jz{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...Q){let X=Q[0];if(this._map.set(W,X),X&&typeof X==="object"&&"id"in X)this._idmap.set(X.id,W);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(W){let Q=this._map.get(W);if(Q&&typeof Q==="object"&&"id"in Q)this._idmap.delete(Q.id);return this._map.delete(W),this}get(W){let Q=W._zod.parent;if(Q){let X={...this.get(Q)??{}};delete X.id;let Y={...X,...this._map.get(W)};return Object.keys(Y).length?Y:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function Oz(){return new jz}var Mz,tA,eA,x5;var lY=$0(()=>{tA=Symbol("ZodOutput"),eA=Symbol("ZodInput");(Mz=globalThis).__zod_globalRegistry??(Mz.__zod_globalRegistry=Oz());x5=globalThis.__zod_globalRegistry});function Ez(W,Q){return new W({type:"string",...N0(Q)})}function Iz(W,Q){return new W({type:"string",coerce:!0,...N0(Q)})}function mY(W,Q){return new W({type:"string",format:"email",check:"string_format",abort:!1,...N0(Q)})}function cY(W,Q){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...N0(Q)})}function Rz(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...N0(Q)})}function Tz(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N0(Q)})}function Pz(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N0(Q)})}function Sz(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N0(Q)})}function pY(W,Q){return new W({type:"string",format:"url",check:"string_format",abort:!1,...N0(Q)})}function bz(W,Q){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...N0(Q)})}function qz(W,Q){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...N0(Q)})}function Cz(W,Q){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...N0(Q)})}function kz(W,Q){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...N0(Q)})}function vz(W,Q){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...N0(Q)})}function yz(W,Q){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...N0(Q)})}function _z(W,Q){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...N0(Q)})}function gz(W,Q){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...N0(Q)})}function fz(W,Q){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...N0(Q)})}function xz(W,Q){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N0(Q)})}function hz(W,Q){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N0(Q)})}function uz(W,Q){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...N0(Q)})}function lz(W,Q){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...N0(Q)})}function mz(W,Q){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...N0(Q)})}function cz(W,Q){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...N0(Q)})}function pz(W,Q){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N0(Q)})}function dz(W,Q){return new W({type:"string",format:"date",check:"string_format",...N0(Q)})}function iz(W,Q){return new W({type:"string",format:"time",check:"string_format",precision:null,...N0(Q)})}function nz(W,Q){return new W({type:"string",format:"duration",check:"string_format",...N0(Q)})}function rz(W,Q){return new W({type:"number",checks:[],...N0(Q)})}function oz(W,Q){return new W({type:"number",coerce:!0,checks:[],...N0(Q)})}function az(W,Q){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...N0(Q)})}function sz(W,Q){return new W({type:"boolean",...N0(Q)})}function tz(W,Q){return new W({type:"boolean",coerce:!0,...N0(Q)})}function ez(W,Q){return new W({type:"bigint",coerce:!0,...N0(Q)})}function WJ(W,Q){return new W({type:"null",...N0(Q)})}function QJ(W){return new W({type:"any"})}function XJ(W){return new W({type:"unknown"})}function YJ(W,Q){return new W({type:"never",...N0(Q)})}function GJ(W,Q){return new W({type:"date",coerce:!0,...N0(Q)})}function l4(W,Q){return new qY({check:"less_than",...N0(Q),value:W,inclusive:!1})}function O5(W,Q){return new qY({check:"less_than",...N0(Q),value:W,inclusive:!0})}function m4(W,Q){return new CY({check:"greater_than",...N0(Q),value:W,inclusive:!1})}function b6(W,Q){return new CY({check:"greater_than",...N0(Q),value:W,inclusive:!0})}function UW(W,Q){return new nF({check:"multiple_of",...N0(Q),value:W})}function gQ(W,Q){return new oF({check:"max_length",...N0(Q),maximum:W})}function c4(W,Q){return new aF({check:"min_length",...N0(Q),minimum:W})}function fQ(W,Q){return new sF({check:"length_equals",...N0(Q),length:W})}function dY(W,Q){return new tF({check:"string_format",format:"regex",...N0(Q),pattern:W})}function iY(W){return new eF({check:"string_format",format:"lowercase",...N0(W)})}function nY(W){return new WL({check:"string_format",format:"uppercase",...N0(W)})}function rY(W,Q){return new QL({check:"string_format",format:"includes",...N0(Q),includes:W})}function oY(W,Q){return new XL({check:"string_format",format:"starts_with",...N0(Q),prefix:W})}function aY(W,Q){return new YL({check:"string_format",format:"ends_with",...N0(Q),suffix:W})}function h5(W){return new GL({check:"overwrite",tx:W})}function sY(W){return h5((Q)=>Q.normalize(W))}function tY(){return h5((W)=>W.trim())}function eY(){return h5((W)=>W.toLowerCase())}function WG(){return h5((W)=>W.toUpperCase())}function QG(){return h5((W)=>NY(W))}function BJ(W,Q,X){return new W({type:"array",element:Q,...N0(X)})}function FJ(W,Q,X){return new W({type:"custom",check:"custom",fn:Q,...N0(X)})}function LJ(W,Q){let X=WN((Y)=>{return Y.addIssue=(G)=>{if(typeof G==="string")Y.issues.push(u4(G,Y.value,X._zod.def));else{let B=G;if(B.fatal)B.continue=!1;B.code??(B.code="custom"),B.input??(B.input=Y.value),B.inst??(B.inst=X),B.continue??(B.continue=!X._zod.def.abort),Y.issues.push(u4(B))}},W(Y.value,Y)},Q);return X}function WN(W,Q){let X=new N1({check:"custom",...N0(Q)});return X._zod.check=W,X}var zJ=$0(()=>{kQ();S6()});function NW(W){let Q=W?.target??"draft-2020-12";if(Q==="draft-4")Q="draft-04";if(Q==="draft-7")Q="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??x5,target:Q,unrepresentable:W?.unrepresentable??"throw",override:W?.override??(()=>{}),io:W?.io??"output",counter:0,seen:new Map,cycles:W?.cycles??"ref",reused:W?.reused??"inline",external:W?.external??void 0}}function r0(W,Q,X={path:[],schemaPath:[]}){var Y;let G=W._zod.def,B=Q.seen.get(W);if(B){if(B.count++,X.schemaPath.includes(W))B.cycle=X.path;return B.schema}let F={schema:{},count:1,cycle:void 0,path:X.path};Q.seen.set(W,F);let L=W._zod.toJSONSchema?.();if(L)F.schema=L;else{let K={...X,schemaPath:[...X.schemaPath,W],path:X.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(Q,F.schema,K);else{let D=F.schema,I=Q.processors[G.type];if(!I)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);I(W,Q,D,K)}let H=W._zod.parent;if(H){if(!F.ref)F.ref=H;r0(H,Q,K),Q.seen.get(H).isParent=!0}}let z=Q.metadataRegistry.get(W);if(z)Object.assign(F.schema,z);if(Q.io==="input"&&S1(W))delete F.schema.examples,delete F.schema.default;if(Q.io==="input"&&"_prefault"in F.schema)(Y=F.schema).default??(Y.default=F.schema._prefault);return delete F.schema._prefault,Q.seen.get(W).schema}function VW(W,Q){let X=W.seen.get(Q);if(!X)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=new Map;for(let F of W.seen.entries()){let L=W.metadataRegistry.get(F[0])?.id;if(L){let z=Y.get(L);if(z&&z!==F[0])throw Error(`Duplicate schema id "${L}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Y.set(L,F[0])}}let G=(F)=>{let L=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let H=W.external.registry.get(F[0])?.id,D=W.external.uri??((A)=>A);if(H)return{ref:D(H)};let I=F[1].defId??F[1].schema.id??`schema${W.counter++}`;return F[1].defId=I,{defId:I,ref:`${D("__shared")}#/${L}/${I}`}}if(F[1]===X)return{ref:"#"};let J=`${"#"}/${L}/`,K=F[1].schema.id??`__schema${W.counter++}`;return{defId:K,ref:J+K}},B=(F)=>{if(F[1].schema.$ref)return;let L=F[1],{ref:z,defId:J}=G(F);if(L.def={...L.schema},J)L.defId=J;let K=L.schema;for(let H in K)delete K[H];K.$ref=z};if(W.cycles==="throw")for(let F of W.seen.entries()){let L=F[1];if(L.cycle)throw Error(`Cycle detected: #/${L.cycle?.join("/")}/<root>
196
+ `)}I.write("payload.value = newResult;"),I.write("return payload;");let V=I.compile();return(U,O)=>V(D,U,O)},B,F=Z4,L=!h4.jitless,J=L&&SY.value,K=X.catchall,Z;W._zod.parse=(D,I)=>{Z??(Z=Y.value);let A=D.value;if(!F(A))return D.issues.push({expected:"object",code:"invalid_type",input:A,inst:W}),D;if(L&&J&&I?.async===!1&&I.jitless!==!0){if(!B)B=G(X.shape);if(D=B(D,I),!K)return D;return $z([],A,D,I,Z,W)}return Q(D,I)}});nY=i("$ZodUnion",(W,X)=>{l0.init(W,X),g0(W._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),g0(W._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),g0(W._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),g0(W._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((G)=>G._zod.pattern);return new RegExp(`^(${Y.map((G)=>UW(G.source)).join("|")})$`)}return});let Q=X.options.length===1?X.options[0]._zod.run:null;W._zod.parse=(Y,G)=>{if(Q)return Q(Y,G);let B=!1,F=[];for(let L of X.options){let z=L._zod.run({value:Y.value,issues:[]},G);if(z instanceof Promise)F.push(z),B=!0;else{if(z.issues.length===0)return z;F.push(z)}}if(!B)return jL(F,Y,W,G);return Promise.all(F).then((L)=>{return jL(L,Y,W,G)})}}),Uz=i("$ZodDiscriminatedUnion",(W,X)=>{X.inclusive=!1,nY.init(W,X);let Q=W._zod.parse;g0(W._zod,"propValues",()=>{let G={};for(let B of X.options){let F=B._zod.propValues;if(!F||Object.keys(F).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(B)}"`);for(let[L,z]of Object.entries(F)){if(!G[L])G[L]=new Set;for(let J of z)G[L].add(J)}}return G});let Y=l4(()=>{let G=X.options,B=new Map;for(let F of G){let L=F._zod.propValues?.[X.discriminator];if(!L||L.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(F)}"`);for(let z of L){if(B.has(z))throw Error(`Duplicate discriminator value "${String(z)}"`);B.set(z,F)}}return B});W._zod.parse=(G,B)=>{let F=G.value;if(!Z4(F))return G.issues.push({code:"invalid_type",expected:"object",input:F,inst:W}),G;let L=Y.value.get(F?.[X.discriminator]);if(L)return L._zod.run(G,B);if(X.unionFallback||B.direction==="backward")return Q(G,B);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,options:Array.from(Y.value.keys()),input:F,path:[X.discriminator],inst:W}),G}}),Az=i("$ZodIntersection",(W,X)=>{l0.init(W,X),W._zod.parse=(Q,Y)=>{let G=Q.value,B=X.left._zod.run({value:G,issues:[]},Y),F=X.right._zod.run({value:G,issues:[]},Y);if(B instanceof Promise||F instanceof Promise)return Promise.all([B,F]).then(([z,J])=>{return EL(Q,z,J)});return EL(Q,B,F)}});Nz=i("$ZodTuple",(W,X)=>{l0.init(W,X);let Q=X.items;W._zod.parse=(Y,G)=>{let B=Y.value;if(!Array.isArray(B))return Y.issues.push({input:B,inst:W,expected:"tuple",code:"invalid_type"}),Y;Y.value=[];let F=[],L=IL(Q,"optin"),z=IL(Q,"optout");if(!X.rest){if(B.length<L)return Y.issues.push({code:"too_small",minimum:L,inclusive:!0,input:B,inst:W,origin:"array"}),Y;if(B.length>Q.length)Y.issues.push({code:"too_big",maximum:Q.length,inclusive:!0,input:B,inst:W,origin:"array"})}let J=Array(Q.length);for(let K=0;K<Q.length;K++){let Z=Q[K]._zod.run({value:B[K],issues:[]},G);if(Z instanceof Promise)F.push(Z.then((D)=>{J[K]=D}));else J[K]=Z}if(X.rest){let K=Q.length-1,Z=B.slice(Q.length);for(let D of Z){K++;let I=X.rest._zod.run({value:D,issues:[]},G);if(I instanceof Promise)F.push(I.then((A)=>RL(A,Y,K)));else RL(I,Y,K)}}if(F.length)return Promise.all(F).then(()=>TL(J,Y,Q,B,z));return TL(J,Y,Q,B,z)}});Vz=i("$ZodRecord",(W,X)=>{l0.init(W,X),W._zod.parse=(Q,Y)=>{let G=Q.value;if(!f5(G))return Q.issues.push({expected:"record",code:"invalid_type",input:G,inst:W}),Q;let B=[],F=X.keyType._zod.values;if(F){Q.value={};let L=new Set;for(let J of F)if(typeof J==="string"||typeof J==="number"||typeof J==="symbol"){L.add(typeof J==="number"?J.toString():J);let K=X.keyType._zod.run({value:J,issues:[]},Y);if(K instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(K.issues.length){Q.issues.push({code:"invalid_key",origin:"record",issues:K.issues.map((I)=>e1(I,Y,k1())),input:J,path:[J],inst:W});continue}let Z=K.value,D=X.valueType._zod.run({value:G[J],issues:[]},Y);if(D instanceof Promise)B.push(D.then((I)=>{if(I.issues.length)Q.issues.push(...S6(J,I.issues));Q.value[Z]=I.value}));else{if(D.issues.length)Q.issues.push(...S6(J,D.issues));Q.value[Z]=D.value}}let z;for(let J in G)if(!L.has(J))z=z??[],z.push(J);if(z&&z.length>0)Q.issues.push({code:"unrecognized_keys",input:G,inst:W,keys:z})}else{Q.value={};for(let L of Reflect.ownKeys(G)){if(L==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(G,L))continue;let z=X.keyType._zod.run({value:L,issues:[]},Y);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof L==="string"&&fX.test(L)&&z.issues.length){let Z=X.keyType._zod.run({value:Number(L),issues:[]},Y);if(Z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(Z.issues.length===0)z=Z}if(z.issues.length){if(X.mode==="loose")Q.value[L]=G[L];else Q.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((Z)=>e1(Z,Y,k1())),input:L,path:[L],inst:W});continue}let K=X.valueType._zod.run({value:G[L],issues:[]},Y);if(K instanceof Promise)B.push(K.then((Z)=>{if(Z.issues.length)Q.issues.push(...S6(L,Z.issues));Q.value[z.value]=Z.value}));else{if(K.issues.length)Q.issues.push(...S6(L,K.issues));Q.value[z.value]=K.value}}}if(B.length)return Promise.all(B).then(()=>Q);return Q}}),wz=i("$ZodEnum",(W,X)=>{l0.init(W,X);let Q=$W(X.entries),Y=new Set(Q);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${Q.filter((G)=>bY.has(typeof G)).map((G)=>typeof G==="string"?O5(G):G.toString()).join("|")})$`),W._zod.parse=(G,B)=>{let F=G.value;if(Y.has(F))return G;return G.issues.push({code:"invalid_value",values:Q,input:F,inst:W}),G}}),Dz=i("$ZodLiteral",(W,X)=>{if(l0.init(W,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let Q=new Set(X.values);W._zod.values=Q,W._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?O5(Y):Y?O5(Y.toString()):String(Y)).join("|")})$`),W._zod.parse=(Y,G)=>{let B=Y.value;if(Q.has(B))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:B,inst:W}),Y}}),Mz=i("$ZodTransform",(W,X)=>{l0.init(W,X),W._zod.optin="optional",W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")throw new KW(W.constructor.name);let G=X.transform(Q.value,Q);if(Y.async)return(G instanceof Promise?G:Promise.resolve(G)).then((F)=>{return Q.value=F,Q.fallback=!0,Q});if(G instanceof Promise)throw new D5;return Q.value=G,Q.fallback=!0,Q}});rY=i("$ZodOptional",(W,X)=>{l0.init(W,X),W._zod.optin="optional",W._zod.optout="optional",g0(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),g0(W._zod,"pattern",()=>{let Q=X.innerType._zod.pattern;return Q?new RegExp(`^(${UW(Q.source)})?$`):void 0}),W._zod.parse=(Q,Y)=>{if(X.innerType._zod.optin==="optional"){let G=Q.value,B=X.innerType._zod.run(Q,Y);if(B instanceof Promise)return B.then((F)=>PL(F,G));return PL(B,G)}if(Q.value===void 0)return Q;return X.innerType._zod.run(Q,Y)}}),Oz=i("$ZodExactOptional",(W,X)=>{rY.init(W,X),g0(W._zod,"values",()=>X.innerType._zod.values),g0(W._zod,"pattern",()=>X.innerType._zod.pattern),W._zod.parse=(Q,Y)=>{return X.innerType._zod.run(Q,Y)}}),jz=i("$ZodNullable",(W,X)=>{l0.init(W,X),g0(W._zod,"optin",()=>X.innerType._zod.optin),g0(W._zod,"optout",()=>X.innerType._zod.optout),g0(W._zod,"pattern",()=>{let Q=X.innerType._zod.pattern;return Q?new RegExp(`^(${UW(Q.source)}|null)$`):void 0}),g0(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),W._zod.parse=(Q,Y)=>{if(Q.value===null)return Q;return X.innerType._zod.run(Q,Y)}}),Ez=i("$ZodDefault",(W,X)=>{l0.init(W,X),W._zod.optin="optional",g0(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);if(Q.value===void 0)return Q.value=X.defaultValue,Q;let G=X.innerType._zod.run(Q,Y);if(G instanceof Promise)return G.then((B)=>SL(B,X));return SL(G,X)}});Iz=i("$ZodPrefault",(W,X)=>{l0.init(W,X),W._zod.optin="optional",g0(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);if(Q.value===void 0)Q.value=X.defaultValue;return X.innerType._zod.run(Q,Y)}}),Rz=i("$ZodNonOptional",(W,X)=>{l0.init(W,X),g0(W._zod,"values",()=>{let Q=X.innerType._zod.values;return Q?new Set([...Q].filter((Y)=>Y!==void 0)):void 0}),W._zod.parse=(Q,Y)=>{let G=X.innerType._zod.run(Q,Y);if(G instanceof Promise)return G.then((B)=>bL(B,W));return bL(G,W)}});Tz=i("$ZodCatch",(W,X)=>{l0.init(W,X),W._zod.optin="optional",g0(W._zod,"optout",()=>X.innerType._zod.optout),g0(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);let G=X.innerType._zod.run(Q,Y);if(G instanceof Promise)return G.then((B)=>{if(Q.value=B.value,B.issues.length)Q.value=X.catchValue({...Q,error:{issues:B.issues.map((F)=>e1(F,Y,k1()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q});if(Q.value=G.value,G.issues.length)Q.value=X.catchValue({...Q,error:{issues:G.issues.map((B)=>e1(B,Y,k1()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q}}),oY=i("$ZodPipe",(W,X)=>{l0.init(W,X),g0(W._zod,"values",()=>X.in._zod.values),g0(W._zod,"optin",()=>X.in._zod.optin),g0(W._zod,"optout",()=>X.out._zod.optout),g0(W._zod,"propValues",()=>X.in._zod.propValues),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward"){let B=X.out._zod.run(Q,Y);if(B instanceof Promise)return B.then((F)=>uX(F,X.in,Y));return uX(B,X.in,Y)}let G=X.in._zod.run(Q,Y);if(G instanceof Promise)return G.then((B)=>uX(B,X.out,Y));return uX(G,X.out,Y)}});Pz=i("$ZodPreprocess",(W,X)=>{oY.init(W,X)}),Sz=i("$ZodReadonly",(W,X)=>{l0.init(W,X),g0(W._zod,"propValues",()=>X.innerType._zod.propValues),g0(W._zod,"values",()=>X.innerType._zod.values),g0(W._zod,"optin",()=>X.innerType?._zod?.optin),g0(W._zod,"optout",()=>X.innerType?._zod?.optout),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);let G=X.innerType._zod.run(Q,Y);if(G instanceof Promise)return G.then(qL);return qL(G)}});bz=i("$ZodLazy",(W,X)=>{l0.init(W,X),g0(W._zod,"innerType",()=>{let Q=X;if(!Q._cachedInner)Q._cachedInner=X.getter();return Q._cachedInner}),g0(W._zod,"pattern",()=>W._zod.innerType?._zod?.pattern),g0(W._zod,"propValues",()=>W._zod.innerType?._zod?.propValues),g0(W._zod,"optin",()=>W._zod.innerType?._zod?.optin??void 0),g0(W._zod,"optout",()=>W._zod.innerType?._zod?.optout??void 0),W._zod.parse=(Q,Y)=>{return W._zod.innerType._zod.run(Q,Y)}}),qz=i("$ZodCustom",(W,X)=>{V1.init(W,X),l0.init(W,X),W._zod.parse=(Q,Y)=>{return Q},W._zod.check=(Q)=>{let Y=Q.value,G=X.fn(Y);if(G instanceof Promise)return G.then((B)=>CL(B,Q,Y,W));CL(G,Q,Y,W);return}})});function aY(){return{localeError:wN()}}var wN=()=>{let W={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function X(G){return W[G]??null}let Q={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"},Y={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let B=Y[G.expected]??G.expected,F=vY(G.input),L=Y[F]??F;return`Invalid input: expected ${B}, received ${L}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${vX(G.values[0])}`;return`Invalid option: expected one of ${qX(G.values,"|")}`;case"too_big":{let B=G.inclusive?"<=":"<",F=X(G.origin);if(F)return`Too big: expected ${G.origin??"value"} to have ${B}${G.maximum.toString()} ${F.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${B}${G.maximum.toString()}`}case"too_small":{let B=G.inclusive?">=":">",F=X(G.origin);if(F)return`Too small: expected ${G.origin} to have ${B}${G.minimum.toString()} ${F.unit}`;return`Too small: expected ${G.origin} to be ${B}${G.minimum.toString()}`}case"invalid_format":{let B=G;if(B.format==="starts_with")return`Invalid string: must start with "${B.prefix}"`;if(B.format==="ends_with")return`Invalid string: must end with "${B.suffix}"`;if(B.format==="includes")return`Invalid string: must include "${B.includes}"`;if(B.format==="regex")return`Invalid string: must match pattern ${B.pattern}`;return`Invalid ${Q[B.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${qX(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":if(G.options&&Array.isArray(G.options)&&G.options.length>0)return`Invalid discriminator value. Expected ${G.options.map((F)=>`'${F}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};var kz=H0(()=>{b6()});var sY=()=>{};class _z{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...X){let Q=X[0];if(this._map.set(W,Q),Q&&typeof Q==="object"&&"id"in Q)this._idmap.set(Q.id,W);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(W){let X=this._map.get(W);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(W),this}get(W){let X=W._zod.parent;if(X){let Q={...this.get(X)??{}};delete Q.id;let Y={...Q,...this._map.get(W)};return Object.keys(Y).length?Y:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function gz(){return new _z}var yz,DN,MN,h5;var tY=H0(()=>{DN=Symbol("ZodOutput"),MN=Symbol("ZodInput");(yz=globalThis).__zod_globalRegistry??(yz.__zod_globalRegistry=gz());h5=globalThis.__zod_globalRegistry});function fz(W,X){return new W({type:"string",...N0(X)})}function xz(W,X){return new W({type:"string",coerce:!0,...N0(X)})}function eY(W,X){return new W({type:"string",format:"email",check:"string_format",abort:!1,...N0(X)})}function WG(W,X){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...N0(X)})}function hz(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...N0(X)})}function uz(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N0(X)})}function lz(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N0(X)})}function mz(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N0(X)})}function XG(W,X){return new W({type:"string",format:"url",check:"string_format",abort:!1,...N0(X)})}function cz(W,X){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...N0(X)})}function pz(W,X){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...N0(X)})}function dz(W,X){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...N0(X)})}function iz(W,X){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...N0(X)})}function nz(W,X){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...N0(X)})}function rz(W,X){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...N0(X)})}function oz(W,X){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...N0(X)})}function az(W,X){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...N0(X)})}function sz(W,X){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...N0(X)})}function tz(W,X){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N0(X)})}function ez(W,X){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N0(X)})}function WJ(W,X){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...N0(X)})}function XJ(W,X){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...N0(X)})}function QJ(W,X){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...N0(X)})}function YJ(W,X){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...N0(X)})}function GJ(W,X){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N0(X)})}function BJ(W,X){return new W({type:"string",format:"date",check:"string_format",...N0(X)})}function FJ(W,X){return new W({type:"string",format:"time",check:"string_format",precision:null,...N0(X)})}function LJ(W,X){return new W({type:"string",format:"duration",check:"string_format",...N0(X)})}function zJ(W,X){return new W({type:"number",checks:[],...N0(X)})}function JJ(W,X){return new W({type:"number",coerce:!0,checks:[],...N0(X)})}function KJ(W,X){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...N0(X)})}function ZJ(W,X){return new W({type:"boolean",...N0(X)})}function $J(W,X){return new W({type:"boolean",coerce:!0,...N0(X)})}function HJ(W,X){return new W({type:"bigint",coerce:!0,...N0(X)})}function UJ(W,X){return new W({type:"null",...N0(X)})}function AJ(W){return new W({type:"any"})}function NJ(W){return new W({type:"unknown"})}function VJ(W,X){return new W({type:"never",...N0(X)})}function wJ(W,X){return new W({type:"date",coerce:!0,...N0(X)})}function c4(W,X){return new lY({check:"less_than",...N0(X),value:W,inclusive:!1})}function j5(W,X){return new lY({check:"less_than",...N0(X),value:W,inclusive:!0})}function p4(W,X){return new mY({check:"greater_than",...N0(X),value:W,inclusive:!1})}function q6(W,X){return new mY({check:"greater_than",...N0(X),value:W,inclusive:!0})}function MW(W,X){return new LL({check:"multiple_of",...N0(X),value:W})}function cX(W,X){return new JL({check:"max_length",...N0(X),maximum:W})}function d4(W,X){return new KL({check:"min_length",...N0(X),minimum:W})}function pX(W,X){return new ZL({check:"length_equals",...N0(X),length:W})}function QG(W,X){return new $L({check:"string_format",format:"regex",...N0(X),pattern:W})}function YG(W){return new HL({check:"string_format",format:"lowercase",...N0(W)})}function GG(W){return new UL({check:"string_format",format:"uppercase",...N0(W)})}function BG(W,X){return new AL({check:"string_format",format:"includes",...N0(X),includes:W})}function FG(W,X){return new NL({check:"string_format",format:"starts_with",...N0(X),prefix:W})}function LG(W,X){return new VL({check:"string_format",format:"ends_with",...N0(X),suffix:W})}function u5(W){return new wL({check:"overwrite",tx:W})}function zG(W){return u5((X)=>X.normalize(W))}function JG(){return u5((W)=>W.trim())}function KG(){return u5((W)=>W.toLowerCase())}function ZG(){return u5((W)=>W.toUpperCase())}function $G(){return u5((W)=>PY(W))}function DJ(W,X,Q){return new W({type:"array",element:X,...N0(Q)})}function MJ(W,X,Q){return new W({type:"custom",check:"custom",fn:X,...N0(Q)})}function OJ(W,X){let Q=ON((Y)=>{return Y.addIssue=(G)=>{if(typeof G==="string")Y.issues.push(m4(G,Y.value,Q._zod.def));else{let B=G;if(B.fatal)B.continue=!1;B.code??(B.code="custom"),B.input??(B.input=Y.value),B.inst??(B.inst=Q),B.continue??(B.continue=!Q._zod.def.abort),Y.issues.push(m4(B))}},W(Y.value,Y)},X);return Q}function ON(W,X){let Q=new V1({check:"custom",...N0(X)});return Q._zod.check=W,Q}var jJ=H0(()=>{hX();b6()});function jW(W){let X=W?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??h5,target:X,unrepresentable:W?.unrepresentable??"throw",override:W?.override??(()=>{}),io:W?.io??"output",counter:0,seen:new Map,cycles:W?.cycles??"ref",reused:W?.reused??"inline",external:W?.external??void 0}}function r0(W,X,Q={path:[],schemaPath:[]}){var Y;let G=W._zod.def,B=X.seen.get(W);if(B){if(B.count++,Q.schemaPath.includes(W))B.cycle=Q.path;return B.schema}let F={schema:{},count:1,cycle:void 0,path:Q.path};X.seen.set(W,F);let L=W._zod.toJSONSchema?.();if(L)F.schema=L;else{let K={...Q,schemaPath:[...Q.schemaPath,W],path:Q.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(X,F.schema,K);else{let D=F.schema,I=X.processors[G.type];if(!I)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);I(W,X,D,K)}let Z=W._zod.parent;if(Z){if(!F.ref)F.ref=Z;r0(Z,X,K),X.seen.get(Z).isParent=!0}}let z=X.metadataRegistry.get(W);if(z)Object.assign(F.schema,z);if(X.io==="input"&&b1(W))delete F.schema.examples,delete F.schema.default;if(X.io==="input"&&"_prefault"in F.schema)(Y=F.schema).default??(Y.default=F.schema._prefault);return delete F.schema._prefault,X.seen.get(W).schema}function EW(W,X){let Q=W.seen.get(X);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=new Map;for(let F of W.seen.entries()){let L=W.metadataRegistry.get(F[0])?.id;if(L){let z=Y.get(L);if(z&&z!==F[0])throw Error(`Duplicate schema id "${L}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Y.set(L,F[0])}}let G=(F)=>{let L=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let Z=W.external.registry.get(F[0])?.id,D=W.external.uri??((A)=>A);if(Z)return{ref:D(Z)};let I=F[1].defId??F[1].schema.id??`schema${W.counter++}`;return F[1].defId=I,{defId:I,ref:`${D("__shared")}#/${L}/${I}`}}if(F[1]===Q)return{ref:"#"};let J=`${"#"}/${L}/`,K=F[1].schema.id??`__schema${W.counter++}`;return{defId:K,ref:J+K}},B=(F)=>{if(F[1].schema.$ref)return;let L=F[1],{ref:z,defId:J}=G(F);if(L.def={...L.schema},J)L.defId=J;let K=L.schema;for(let Z in K)delete K[Z];K.$ref=z};if(W.cycles==="throw")for(let F of W.seen.entries()){let L=F[1];if(L.cycle)throw Error(`Cycle detected: #/${L.cycle?.join("/")}/<root>
85
197
 
86
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let F of W.seen.entries()){let L=F[1];if(Q===F[0]){B(F);continue}if(W.external){let J=W.external.registry.get(F[0])?.id;if(Q!==F[0]&&J){B(F);continue}}if(W.metadataRegistry.get(F[0])?.id){B(F);continue}if(L.cycle){B(F);continue}if(L.count>1){if(W.reused==="ref"){B(F);continue}}}}function wW(W,Q){let X=W.seen.get(Q);if(!X)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(L)=>{let z=W.seen.get(L);if(z.ref===null)return;let J=z.def??z.schema,K={...J},H=z.ref;if(z.ref=null,H){Y(H);let I=W.seen.get(H),A=I.schema;if(A.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))J.allOf=J.allOf??[],J.allOf.push(A);else Object.assign(J,A);if(Object.assign(J,K),L._zod.parent===H)for(let N in J){if(N==="$ref"||N==="allOf")continue;if(!(N in K))delete J[N]}if(A.$ref&&I.def)for(let N in J){if(N==="$ref"||N==="allOf")continue;if(N in I.def&&JSON.stringify(J[N])===JSON.stringify(I.def[N]))delete J[N]}}let D=L._zod.parent;if(D&&D!==H){Y(D);let I=W.seen.get(D);if(I?.schema.$ref){if(J.$ref=I.schema.$ref,I.def)for(let A in J){if(A==="$ref"||A==="allOf")continue;if(A in I.def&&JSON.stringify(J[A])===JSON.stringify(I.def[A]))delete J[A]}}}W.override({zodSchema:L,jsonSchema:J,path:z.path??[]})};for(let L of[...W.seen.entries()].reverse())Y(L[0]);let G={};if(W.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let L=W.external.registry.get(Q)?.id;if(!L)throw Error("Schema is missing an `id` property");G.$id=W.external.uri(L)}Object.assign(G,X.def??X.schema);let B=W.metadataRegistry.get(Q)?.id;if(B!==void 0&&G.id===B)delete G.id;let F=W.external?.defs??{};for(let L of W.seen.entries()){let z=L[1];if(z.def&&z.defId){if(z.def.id===z.defId)delete z.def.id;F[z.defId]=z.def}}if(W.external);else if(Object.keys(F).length>0)if(W.target==="draft-2020-12")G.$defs=F;else G.definitions=F;try{let L=JSON.parse(JSON.stringify(G));return Object.defineProperty(L,"~standard",{value:{...Q["~standard"],jsonSchema:{input:AW(Q,"input",W.processors),output:AW(Q,"output",W.processors)}},enumerable:!1,writable:!1}),L}catch(L){throw Error("Error converting schema to JSON.")}}function S1(W,Q){let X=Q??{seen:new Set};if(X.seen.has(W))return!1;X.seen.add(W);let Y=W._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return S1(Y.element,X);if(Y.type==="set")return S1(Y.valueType,X);if(Y.type==="lazy")return S1(Y.getter(),X);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return S1(Y.innerType,X);if(Y.type==="intersection")return S1(Y.left,X)||S1(Y.right,X);if(Y.type==="record"||Y.type==="map")return S1(Y.keyType,X)||S1(Y.valueType,X);if(Y.type==="pipe"){if(W._zod.traits.has("$ZodCodec"))return!0;return S1(Y.in,X)||S1(Y.out,X)}if(Y.type==="object"){for(let G in Y.shape)if(S1(Y.shape[G],X))return!0;return!1}if(Y.type==="union"){for(let G of Y.options)if(S1(G,X))return!0;return!1}if(Y.type==="tuple"){for(let G of Y.items)if(S1(G,X))return!0;if(Y.rest&&S1(Y.rest,X))return!0;return!1}return!1}var JJ=(W,Q={})=>(X)=>{let Y=NW({...X,processors:Q});return r0(W,Y),VW(Y,W),wW(Y,W)},AW=(W,Q,X={})=>(Y)=>{let{libraryOptions:G,target:B}=Y??{},F=NW({...G??{},target:B,io:Q,processors:X});return r0(W,F),VW(F,W),wW(F,W)};var xQ=$0(()=>{lY()});function Z4(W,Q){if("_idmap"in W){let Y=W,G=NW({...Q,processors:KJ}),B={};for(let z of Y._idmap.entries()){let[J,K]=z;r0(K,G)}let F={},L={registry:Y,uri:Q?.uri,defs:B};G.external=L;for(let z of Y._idmap.entries()){let[J,K]=z;VW(G,K),F[J]=wW(G,K)}if(Object.keys(B).length>0){let z=G.target==="draft-2020-12"?"$defs":"definitions";F.__shared={[z]:B}}return{schemas:F}}let X=NW({...Q,processors:KJ});return r0(W,X),VW(X,W),wW(X,W)}var QN,XG=(W,Q,X,Y)=>{let G=X;G.type="string";let{minimum:B,maximum:F,format:L,patterns:z,contentEncoding:J}=W._zod.bag;if(typeof B==="number")G.minLength=B;if(typeof F==="number")G.maxLength=F;if(L){if(G.format=QN[L]??L,G.format==="")delete G.format;if(L==="time")delete G.format}if(J)G.contentEncoding=J;if(z&&z.size>0){let K=[...z];if(K.length===1)G.pattern=K[0].source;else if(K.length>1)G.allOf=[...K.map((H)=>({...Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"?{type:"string"}:{},pattern:H.source}))]}},YG=(W,Q,X,Y)=>{let G=X,{minimum:B,maximum:F,format:L,multipleOf:z,exclusiveMaximum:J,exclusiveMinimum:K}=W._zod.bag;if(typeof L==="string"&&L.includes("int"))G.type="integer";else G.type="number";let H=typeof K==="number"&&K>=(B??Number.NEGATIVE_INFINITY),D=typeof J==="number"&&J<=(F??Number.POSITIVE_INFINITY),I=Q.target==="draft-04"||Q.target==="openapi-3.0";if(H)if(I)G.minimum=K,G.exclusiveMinimum=!0;else G.exclusiveMinimum=K;else if(typeof B==="number")G.minimum=B;if(D)if(I)G.maximum=J,G.exclusiveMaximum=!0;else G.exclusiveMaximum=J;else if(typeof F==="number")G.maximum=F;if(typeof z==="number")G.multipleOf=z},GG=(W,Q,X,Y)=>{X.type="boolean"},BG=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},ZJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},FG=(W,Q,X,Y)=>{if(Q.target==="openapi-3.0")X.type="string",X.nullable=!0,X.enum=[null];else X.type="null"},HJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},$J=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},LG=(W,Q,X,Y)=>{X.not={}},zG=(W,Q,X,Y)=>{},JG=(W,Q,X,Y)=>{},KG=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},ZG=(W,Q,X,Y)=>{let G=W._zod.def,B=FW(G.entries);if(B.every((F)=>typeof F==="number"))X.type="number";if(B.every((F)=>typeof F==="string"))X.type="string";X.enum=B},HG=(W,Q,X,Y)=>{let G=W._zod.def,B=[];for(let F of G.values)if(F===void 0){if(Q.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(Q.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else B.push(Number(F));else B.push(F);if(B.length===0);else if(B.length===1){let F=B[0];if(X.type=F===null?"null":typeof F,Q.target==="draft-04"||Q.target==="openapi-3.0")X.enum=[F];else X.const=F}else{if(B.every((F)=>typeof F==="number"))X.type="number";if(B.every((F)=>typeof F==="string"))X.type="string";if(B.every((F)=>typeof F==="boolean"))X.type="boolean";if(B.every((F)=>F===null))X.type="null";X.enum=B}},UJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},AJ=(W,Q,X,Y)=>{let G=X,B=W._zod.pattern;if(!B)throw Error("Pattern not found in template literal");G.type="string",G.pattern=B.source},NJ=(W,Q,X,Y)=>{let G=X,B={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:L,mime:z}=W._zod.bag;if(F!==void 0)B.minLength=F;if(L!==void 0)B.maxLength=L;if(z)if(z.length===1)B.contentMediaType=z[0],Object.assign(G,B);else Object.assign(G,B),G.anyOf=z.map((J)=>({contentMediaType:J}));else Object.assign(G,B)},VJ=(W,Q,X,Y)=>{X.type="boolean"},$G=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},wJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},UG=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},DJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},MJ=(W,Q,X,Y)=>{if(Q.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},AG=(W,Q,X,Y)=>{let G=X,B=W._zod.def,{minimum:F,maximum:L}=W._zod.bag;if(typeof F==="number")G.minItems=F;if(typeof L==="number")G.maxItems=L;G.type="array",G.items=r0(B.element,Q,{...Y,path:[...Y.path,"items"]})},NG=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="object",G.properties={};let F=B.shape;for(let J in F)G.properties[J]=r0(F[J],Q,{...Y,path:[...Y.path,"properties",J]});let L=new Set(Object.keys(F)),z=new Set([...L].filter((J)=>{let K=B.shape[J]._zod;if(Q.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(z.size>0)G.required=Array.from(z);if(B.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!B.catchall){if(Q.io==="output")G.additionalProperties=!1}else if(B.catchall)G.additionalProperties=r0(B.catchall,Q,{...Y,path:[...Y.path,"additionalProperties"]})},VG=(W,Q,X,Y)=>{let G=W._zod.def,B=G.inclusive===!1,F=G.options.map((L,z)=>r0(L,Q,{...Y,path:[...Y.path,B?"oneOf":"anyOf",z]}));if(B)X.oneOf=F;else X.anyOf=F},wG=(W,Q,X,Y)=>{let G=W._zod.def,B=r0(G.left,Q,{...Y,path:[...Y.path,"allOf",0]}),F=r0(G.right,Q,{...Y,path:[...Y.path,"allOf",1]}),L=(J)=>("allOf"in J)&&Object.keys(J).length===1,z=[...L(B)?B.allOf:[B],...L(F)?F.allOf:[F]];X.allOf=z},DG=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="array";let F=Q.target==="draft-2020-12"?"prefixItems":"items",L=Q.target==="draft-2020-12"?"items":Q.target==="openapi-3.0"?"items":"additionalItems",z=B.items.map((D,I)=>r0(D,Q,{...Y,path:[...Y.path,F,I]})),J=B.rest?r0(B.rest,Q,{...Y,path:[...Y.path,L,...Q.target==="openapi-3.0"?[B.items.length]:[]]}):null;if(Q.target==="draft-2020-12"){if(G.prefixItems=z,J)G.items=J}else if(Q.target==="openapi-3.0"){if(G.items={anyOf:z},J)G.items.anyOf.push(J);if(G.minItems=z.length,!J)G.maxItems=z.length}else if(G.items=z,J)G.additionalItems=J;let{minimum:K,maximum:H}=W._zod.bag;if(typeof K==="number")G.minItems=K;if(typeof H==="number")G.maxItems=H},MG=(W,Q,X,Y)=>{let G=X,B=W._zod.def;G.type="object";let F=B.keyType,z=F._zod.bag?.patterns;if(B.mode==="loose"&&z&&z.size>0){let K=r0(B.valueType,Q,{...Y,path:[...Y.path,"patternProperties","*"]});G.patternProperties={};for(let H of z)G.patternProperties[H.source]=K}else{if(Q.target==="draft-07"||Q.target==="draft-2020-12")G.propertyNames=r0(B.keyType,Q,{...Y,path:[...Y.path,"propertyNames"]});G.additionalProperties=r0(B.valueType,Q,{...Y,path:[...Y.path,"additionalProperties"]})}let J=F._zod.values;if(J){let K=[...J].filter((H)=>typeof H==="string"||typeof H==="number");if(K.length>0)G.required=K}},jG=(W,Q,X,Y)=>{let G=W._zod.def,B=r0(G.innerType,Q,Y),F=Q.seen.get(W);if(Q.target==="openapi-3.0")F.ref=G.innerType,X.nullable=!0;else X.anyOf=[B,{type:"null"}]},OG=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},EG=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType,X.default=JSON.parse(JSON.stringify(G.defaultValue))},IG=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);if(B.ref=G.innerType,Q.io==="input")X._prefault=JSON.parse(JSON.stringify(G.defaultValue))},RG=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType;let F;try{F=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}X.default=F},TG=(W,Q,X,Y)=>{let G=W._zod.def,B=G.in._zod.traits.has("$ZodTransform"),F=Q.io==="input"?B?G.out:G.in:G.out;r0(F,Q,Y);let L=Q.seen.get(W);L.ref=F},PG=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType,X.readOnly=!0},jJ=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},hQ=(W,Q,X,Y)=>{let G=W._zod.def;r0(G.innerType,Q,Y);let B=Q.seen.get(W);B.ref=G.innerType},SG=(W,Q,X,Y)=>{let G=W._zod.innerType;r0(G,Q,Y);let B=Q.seen.get(W);B.ref=G},KJ;var bG=$0(()=>{xQ();S6();QN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},KJ={string:XG,number:YG,boolean:GG,bigint:BG,symbol:ZJ,null:FG,undefined:HJ,void:$J,never:LG,any:zG,unknown:JG,date:KG,enum:ZG,literal:HG,nan:UJ,template_literal:AJ,file:NJ,success:VJ,custom:$G,function:wJ,transform:UG,map:DJ,set:MJ,array:AG,object:NG,union:VG,intersection:wG,tuple:DG,record:MG,nullable:jG,nonoptional:OG,default:EG,prefault:IG,catch:RG,pipe:TG,readonly:PG,promise:jJ,optional:hQ,lazy:SG}});var OJ=()=>{};var e1=$0(()=>{S6();CQ();uY();OJ();J4();PY();TY();Vz();kQ();vY();lY();zJ();xQ()});var qG=$0(()=>{e1()});var b1={};F4(b1,{time:()=>vG,duration:()=>yG,datetime:()=>CG,date:()=>kG,ZodISOTime:()=>RJ,ZodISODuration:()=>TJ,ZodISODateTime:()=>EJ,ZodISODate:()=>IJ});function CG(W){return pz(EJ,W)}function kG(W){return dz(IJ,W)}function vG(W){return iz(RJ,W)}function yG(W){return nz(TJ,W)}var EJ,IJ,RJ,TJ;var _G=$0(()=>{e1();uQ();EJ=i("ZodISODateTime",(W,Q)=>{bL.init(W,Q),t0.init(W,Q)});IJ=i("ZodISODate",(W,Q)=>{qL.init(W,Q),t0.init(W,Q)});RJ=i("ZodISOTime",(W,Q)=>{CL.init(W,Q),t0.init(W,Q)});TJ=i("ZodISODuration",(W,Q)=>{kL.init(W,Q),t0.init(W,Q)})});var zN=(W,Q)=>{PQ.init(W,Q),W.name="ZodError",Object.defineProperties(W,{format:{value:(X)=>RY(W,X)},flatten:{value:(X)=>IY(W,X)},addIssue:{value:(X)=>{W.issues.push(X),W.message=JSON.stringify(W.issues,x4,2)}},addIssues:{value:(X)=>{W.issues.push(...X),W.message=JSON.stringify(W.issues,x4,2)}},isEmpty:{get(){return W.issues.length===0}}})},i1;var gG=$0(()=>{e1();e1();S6();i1=i("ZodError",zN,{Parent:Error})});var SJ,bJ,d4,qJ,CJ,kJ,vJ,yJ,_J,gJ,fJ,xJ;var fG=$0(()=>{e1();gG();SJ=SQ(i1),bJ=bQ(i1),d4=KW(i1),qJ=ZW(i1),CJ=JF(i1),kJ=KF(i1),vJ=ZF(i1),yJ=HF(i1),_J=$F(i1),gJ=UF(i1),fJ=AF(i1),xJ=NF(i1)});function DW(W,Q,X){let Y=Object.getPrototypeOf(W),G=hJ.get(Y);if(!G)G=new Set,hJ.set(Y,G);if(G.has(Q))return;G.add(Q);for(let B in X){let F=X[B];Object.defineProperty(Y,B,{configurable:!0,enumerable:!1,get(){let L=F.bind(this);return Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L}),L},set(L){Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L})}})}}function $(W){return Ez(hG,W)}function mQ(W){return mY(iJ,W)}function i4(W){return pY(nJ,W)}function m(W){return rz(cQ,W)}function lJ(W){return az(RN,W)}function o(W){return sz(uG,W)}function q6(W){return WJ(TN,W)}function oJ(){return QJ(PN)}function Y0(){return XJ(SN)}function qN(W){return YJ(bN,W)}function f(W,Q){return BJ(CN,W,Q)}function q(W,Q){let X={type:"object",shape:W??{},..._0.normalizeParams(Q)};return new sJ(X)}function F0(W,Q){return new sJ({type:"object",shape:W,catchall:Y0(),..._0.normalizeParams(Q)})}function a(W,Q){return new tJ({type:"union",options:W,..._0.normalizeParams(Q)})}function E5(W,Q,X){return new kN({type:"union",options:Q,discriminator:W,..._0.normalizeParams(X)})}function k1(W,Q){return new vN({type:"intersection",left:W,right:Q})}function eJ(W,Q,X){let Y=Q instanceof l0,G=Y?X:Q;return new yN({type:"tuple",items:W,rest:Y?Q:null,..._0.normalizeParams(G)})}function n(W,Q,X){if(!Q||!Q._zod)return new mJ({type:"record",keyType:$(),valueType:W,..._0.normalizeParams(Q)});return new mJ({type:"record",keyType:W,valueType:Q,..._0.normalizeParams(X)})}function J0(W,Q){let X=Array.isArray(W)?Object.fromEntries(W.map((Y)=>[Y,Y])):W;return new xG({type:"enum",entries:X,..._0.normalizeParams(Q)})}function g(W,Q){return new _N({type:"literal",values:Array.isArray(W)?W:[W],..._0.normalizeParams(Q)})}function WK(W){return new gN({type:"transform",transform:W})}function Q0(W){return new QK({type:"optional",innerType:W})}function xN(W){return new fN({type:"optional",innerType:W})}function cJ(W){return new hN({type:"nullable",innerType:W})}function lN(W,Q){return new uN({type:"default",innerType:W,get defaultValue(){return typeof Q==="function"?Q():_0.shallowClone(Q)}})}function cN(W,Q){return new mN({type:"prefault",innerType:W,get defaultValue(){return typeof Q==="function"?Q():_0.shallowClone(Q)}})}function pN(W,Q){return new XK({type:"nonoptional",innerType:W,..._0.normalizeParams(Q)})}function iN(W,Q){return new dN({type:"catch",innerType:W,catchValue:typeof Q==="function"?Q:()=>Q})}function pJ(W,Q){return new YK({type:"pipe",in:W,out:Q})}function oN(W){return new rN({type:"readonly",innerType:W})}function u5(W){return new aN({type:"lazy",getter:W})}function tN(W,Q={}){return FJ(sN,W,Q)}function eN(W,Q){return LJ(W,Q)}function C6(W,Q){return new nN({type:"pipe",in:WK(W),out:Q})}var hJ,d0,dJ,hG,t0,iJ,uJ,lQ,nJ,KN,ZN,HN,$N,UN,AN,NN,VN,wN,DN,MN,jN,ON,EN,IN,cQ,RN,uG,rJ,TN,PN,SN,bN,aJ,CN,sJ,tJ,kN,vN,yN,mJ,xG,_N,gN,QK,fN,hN,uN,mN,XK,dN,YK,nN,rN,aN,sN;var uQ=$0(()=>{e1();e1();bG();xQ();qG();_G();fG();hJ=new WeakMap;d0=i("ZodType",(W,Q)=>{return l0.init(W,Q),Object.assign(W["~standard"],{jsonSchema:{input:AW(W,"input"),output:AW(W,"output")}}),W.toJSONSchema=JJ(W,{}),W.def=Q,W.type=Q.type,Object.defineProperty(W,"_def",{value:Q}),W.parse=(X,Y)=>SJ(W,X,Y,{callee:W.parse}),W.safeParse=(X,Y)=>d4(W,X,Y),W.parseAsync=async(X,Y)=>bJ(W,X,Y,{callee:W.parseAsync}),W.safeParseAsync=async(X,Y)=>qJ(W,X,Y),W.spa=W.safeParseAsync,W.encode=(X,Y)=>CJ(W,X,Y),W.decode=(X,Y)=>kJ(W,X,Y),W.encodeAsync=async(X,Y)=>vJ(W,X,Y),W.decodeAsync=async(X,Y)=>yJ(W,X,Y),W.safeEncode=(X,Y)=>_J(W,X,Y),W.safeDecode=(X,Y)=>gJ(W,X,Y),W.safeEncodeAsync=async(X,Y)=>fJ(W,X,Y),W.safeDecodeAsync=async(X,Y)=>xJ(W,X,Y),DW(W,"ZodType",{check(...X){let Y=this.def;return this.clone(_0.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},with(...X){return this.check(...X)},clone(X,Y){return s1(this,X,Y)},brand(){return this},register(X,Y){return X.add(this,Y),this},refine(X,Y){return this.check(tN(X,Y))},superRefine(X,Y){return this.check(eN(X,Y))},overwrite(X){return this.check(h5(X))},optional(){return Q0(this)},exactOptional(){return xN(this)},nullable(){return cJ(this)},nullish(){return Q0(cJ(this))},nonoptional(X){return pN(this,X)},array(){return f(this)},or(X){return a([this,X])},and(X){return k1(this,X)},transform(X){return pJ(this,WK(X))},default(X){return lN(this,X)},prefault(X){return cN(this,X)},catch(X){return iN(this,X)},pipe(X){return pJ(this,X)},readonly(){return oN(this)},describe(X){let Y=this.clone();return x5.add(Y,{description:X}),Y},meta(...X){if(X.length===0)return x5.get(this);let Y=this.clone();return x5.add(Y,X[0]),Y},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(X){return X(this)}}),Object.defineProperty(W,"description",{get(){return x5.get(W)?.description},configurable:!0}),W}),dJ=i("_ZodString",(W,Q)=>{_Q.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>XG(W,Y,G,B);let X=W._zod.bag;W.format=X.format??null,W.minLength=X.minimum??null,W.maxLength=X.maximum??null,DW(W,"_ZodString",{regex(...Y){return this.check(dY(...Y))},includes(...Y){return this.check(rY(...Y))},startsWith(...Y){return this.check(oY(...Y))},endsWith(...Y){return this.check(aY(...Y))},min(...Y){return this.check(c4(...Y))},max(...Y){return this.check(gQ(...Y))},length(...Y){return this.check(fQ(...Y))},nonempty(...Y){return this.check(c4(1,...Y))},lowercase(Y){return this.check(iY(Y))},uppercase(Y){return this.check(nY(Y))},trim(){return this.check(tY())},normalize(...Y){return this.check(sY(...Y))},toLowerCase(){return this.check(eY())},toUpperCase(){return this.check(WG())},slugify(){return this.check(QG())}})}),hG=i("ZodString",(W,Q)=>{_Q.init(W,Q),dJ.init(W,Q),W.email=(X)=>W.check(mY(iJ,X)),W.url=(X)=>W.check(pY(nJ,X)),W.jwt=(X)=>W.check(cz(IN,X)),W.emoji=(X)=>W.check(bz(KN,X)),W.guid=(X)=>W.check(cY(uJ,X)),W.uuid=(X)=>W.check(Rz(lQ,X)),W.uuidv4=(X)=>W.check(Tz(lQ,X)),W.uuidv6=(X)=>W.check(Pz(lQ,X)),W.uuidv7=(X)=>W.check(Sz(lQ,X)),W.nanoid=(X)=>W.check(qz(ZN,X)),W.guid=(X)=>W.check(cY(uJ,X)),W.cuid=(X)=>W.check(Cz(HN,X)),W.cuid2=(X)=>W.check(kz($N,X)),W.ulid=(X)=>W.check(vz(UN,X)),W.base64=(X)=>W.check(uz(jN,X)),W.base64url=(X)=>W.check(lz(ON,X)),W.xid=(X)=>W.check(yz(AN,X)),W.ksuid=(X)=>W.check(_z(NN,X)),W.ipv4=(X)=>W.check(gz(VN,X)),W.ipv6=(X)=>W.check(fz(wN,X)),W.cidrv4=(X)=>W.check(xz(DN,X)),W.cidrv6=(X)=>W.check(hz(MN,X)),W.e164=(X)=>W.check(mz(EN,X)),W.datetime=(X)=>W.check(CG(X)),W.date=(X)=>W.check(kG(X)),W.time=(X)=>W.check(vG(X)),W.duration=(X)=>W.check(yG(X))});t0=i("ZodStringFormat",(W,Q)=>{s0.init(W,Q),dJ.init(W,Q)}),iJ=i("ZodEmail",(W,Q)=>{ML.init(W,Q),t0.init(W,Q)});uJ=i("ZodGUID",(W,Q)=>{wL.init(W,Q),t0.init(W,Q)}),lQ=i("ZodUUID",(W,Q)=>{DL.init(W,Q),t0.init(W,Q)}),nJ=i("ZodURL",(W,Q)=>{jL.init(W,Q),t0.init(W,Q)});KN=i("ZodEmoji",(W,Q)=>{OL.init(W,Q),t0.init(W,Q)}),ZN=i("ZodNanoID",(W,Q)=>{EL.init(W,Q),t0.init(W,Q)}),HN=i("ZodCUID",(W,Q)=>{IL.init(W,Q),t0.init(W,Q)}),$N=i("ZodCUID2",(W,Q)=>{RL.init(W,Q),t0.init(W,Q)}),UN=i("ZodULID",(W,Q)=>{TL.init(W,Q),t0.init(W,Q)}),AN=i("ZodXID",(W,Q)=>{PL.init(W,Q),t0.init(W,Q)}),NN=i("ZodKSUID",(W,Q)=>{SL.init(W,Q),t0.init(W,Q)}),VN=i("ZodIPv4",(W,Q)=>{vL.init(W,Q),t0.init(W,Q)}),wN=i("ZodIPv6",(W,Q)=>{yL.init(W,Q),t0.init(W,Q)}),DN=i("ZodCIDRv4",(W,Q)=>{_L.init(W,Q),t0.init(W,Q)}),MN=i("ZodCIDRv6",(W,Q)=>{gL.init(W,Q),t0.init(W,Q)}),jN=i("ZodBase64",(W,Q)=>{xL.init(W,Q),t0.init(W,Q)}),ON=i("ZodBase64URL",(W,Q)=>{hL.init(W,Q),t0.init(W,Q)}),EN=i("ZodE164",(W,Q)=>{uL.init(W,Q),t0.init(W,Q)}),IN=i("ZodJWT",(W,Q)=>{lL.init(W,Q),t0.init(W,Q)}),cQ=i("ZodNumber",(W,Q)=>{_Y.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>YG(W,Y,G,B),DW(W,"ZodNumber",{gt(Y,G){return this.check(m4(Y,G))},gte(Y,G){return this.check(b6(Y,G))},min(Y,G){return this.check(b6(Y,G))},lt(Y,G){return this.check(l4(Y,G))},lte(Y,G){return this.check(O5(Y,G))},max(Y,G){return this.check(O5(Y,G))},int(Y){return this.check(lJ(Y))},safe(Y){return this.check(lJ(Y))},positive(Y){return this.check(m4(0,Y))},nonnegative(Y){return this.check(b6(0,Y))},negative(Y){return this.check(l4(0,Y))},nonpositive(Y){return this.check(O5(0,Y))},multipleOf(Y,G){return this.check(UW(Y,G))},step(Y,G){return this.check(UW(Y,G))},finite(){return this}});let X=W._zod.bag;W.minValue=Math.max(X.minimum??Number.NEGATIVE_INFINITY,X.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,W.maxValue=Math.min(X.maximum??Number.POSITIVE_INFINITY,X.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,W.isInt=(X.format??"").includes("int")||Number.isSafeInteger(X.multipleOf??0.5),W.isFinite=!0,W.format=X.format??null});RN=i("ZodNumberFormat",(W,Q)=>{mL.init(W,Q),cQ.init(W,Q)});uG=i("ZodBoolean",(W,Q)=>{cL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>GG(W,X,Y,G)});rJ=i("ZodBigInt",(W,Q)=>{pL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>BG(W,Y,G,B),W.gte=(Y,G)=>W.check(b6(Y,G)),W.min=(Y,G)=>W.check(b6(Y,G)),W.gt=(Y,G)=>W.check(m4(Y,G)),W.gte=(Y,G)=>W.check(b6(Y,G)),W.min=(Y,G)=>W.check(b6(Y,G)),W.lt=(Y,G)=>W.check(l4(Y,G)),W.lte=(Y,G)=>W.check(O5(Y,G)),W.max=(Y,G)=>W.check(O5(Y,G)),W.positive=(Y)=>W.check(m4(BigInt(0),Y)),W.negative=(Y)=>W.check(l4(BigInt(0),Y)),W.nonpositive=(Y)=>W.check(O5(BigInt(0),Y)),W.nonnegative=(Y)=>W.check(b6(BigInt(0),Y)),W.multipleOf=(Y,G)=>W.check(UW(Y,G));let X=W._zod.bag;W.minValue=X.minimum??null,W.maxValue=X.maximum??null,W.format=X.format??null}),TN=i("ZodNull",(W,Q)=>{dL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>FG(W,X,Y,G)});PN=i("ZodAny",(W,Q)=>{iL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>zG(W,X,Y,G)});SN=i("ZodUnknown",(W,Q)=>{nL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>JG(W,X,Y,G)});bN=i("ZodNever",(W,Q)=>{rL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>LG(W,X,Y,G)});aJ=i("ZodDate",(W,Q)=>{oL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>KG(W,Y,G,B),W.min=(Y,G)=>W.check(b6(Y,G)),W.max=(Y,G)=>W.check(O5(Y,G));let X=W._zod.bag;W.minDate=X.minimum?new Date(X.minimum):null,W.maxDate=X.maximum?new Date(X.maximum):null}),CN=i("ZodArray",(W,Q)=>{aL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>AG(W,X,Y,G),W.element=Q.element,DW(W,"ZodArray",{min(X,Y){return this.check(c4(X,Y))},nonempty(X){return this.check(c4(1,X))},max(X,Y){return this.check(gQ(X,Y))},length(X,Y){return this.check(fQ(X,Y))},unwrap(){return this.element}})});sJ=i("ZodObject",(W,Q)=>{eL.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>NG(W,X,Y,G),_0.defineLazy(W,"shape",()=>{return Q.shape}),DW(W,"ZodObject",{keyof(){return J0(Object.keys(this._zod.def.shape))},catchall(X){return this.clone({...this._zod.def,catchall:X})},passthrough(){return this.clone({...this._zod.def,catchall:Y0()})},loose(){return this.clone({...this._zod.def,catchall:Y0()})},strict(){return this.clone({...this._zod.def,catchall:qN()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(X){return _0.extend(this,X)},safeExtend(X){return _0.safeExtend(this,X)},merge(X){return _0.merge(this,X)},pick(X){return _0.pick(this,X)},omit(X){return _0.omit(this,X)},partial(...X){return _0.partial(QK,this,X[0])},required(...X){return _0.required(XK,this,X[0])}})});tJ=i("ZodUnion",(W,Q)=>{gY.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>VG(W,X,Y,G),W.options=Q.options});kN=i("ZodDiscriminatedUnion",(W,Q)=>{tJ.init(W,Q),Wz.init(W,Q)});vN=i("ZodIntersection",(W,Q)=>{Qz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>wG(W,X,Y,G)});yN=i("ZodTuple",(W,Q)=>{Xz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>DG(W,X,Y,G),W.rest=(X)=>W.clone({...W._zod.def,rest:X})});mJ=i("ZodRecord",(W,Q)=>{Yz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>MG(W,X,Y,G),W.keyType=Q.keyType,W.valueType=Q.valueType});xG=i("ZodEnum",(W,Q)=>{Gz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(Y,G,B)=>ZG(W,Y,G,B),W.enum=Q.entries,W.options=Object.values(Q.entries);let X=new Set(Object.keys(Q.entries));W.extract=(Y,G)=>{let B={};for(let F of Y)if(X.has(F))B[F]=Q.entries[F];else throw Error(`Key ${F} not found in enum`);return new xG({...Q,checks:[],..._0.normalizeParams(G),entries:B})},W.exclude=(Y,G)=>{let B={...Q.entries};for(let F of Y)if(X.has(F))delete B[F];else throw Error(`Key ${F} not found in enum`);return new xG({...Q,checks:[],..._0.normalizeParams(G),entries:B})}});_N=i("ZodLiteral",(W,Q)=>{Bz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>HG(W,X,Y,G),W.values=new Set(Q.values),Object.defineProperty(W,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});gN=i("ZodTransform",(W,Q)=>{Fz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>UG(W,X,Y,G),W._zod.parse=(X,Y)=>{if(Y.direction==="backward")throw new GW(W.constructor.name);X.addIssue=(B)=>{if(typeof B==="string")X.issues.push(_0.issue(B,X.value,Q));else{let F=B;if(F.fatal)F.continue=!1;F.code??(F.code="custom"),F.input??(F.input=X.value),F.inst??(F.inst=W),X.issues.push(_0.issue(F))}};let G=Q.transform(X.value,X);if(G instanceof Promise)return G.then((B)=>{return X.value=B,X.fallback=!0,X});return X.value=G,X.fallback=!0,X}});QK=i("ZodOptional",(W,Q)=>{fY.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>hQ(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});fN=i("ZodExactOptional",(W,Q)=>{Lz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>hQ(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});hN=i("ZodNullable",(W,Q)=>{zz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>jG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});uN=i("ZodDefault",(W,Q)=>{Jz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>EG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});mN=i("ZodPrefault",(W,Q)=>{Kz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>IG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});XK=i("ZodNonOptional",(W,Q)=>{Zz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>OG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});dN=i("ZodCatch",(W,Q)=>{Hz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>RG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});YK=i("ZodPipe",(W,Q)=>{xY.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>TG(W,X,Y,G),W.in=Q.in,W.out=Q.out});nN=i("ZodPreprocess",(W,Q)=>{YK.init(W,Q),$z.init(W,Q)}),rN=i("ZodReadonly",(W,Q)=>{Uz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>PG(W,X,Y,G),W.unwrap=()=>W._zod.def.innerType});aN=i("ZodLazy",(W,Q)=>{Az.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>SG(W,X,Y,G),W.unwrap=()=>W._zod.def.getter()});sN=i("ZodCustom",(W,Q)=>{Nz.init(W,Q),d0.init(W,Q),W._zod.processJSONSchema=(X,Y,G)=>$G(W,X,Y,G)})});var BK,GK;var FK=$0(()=>{BK={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"};(function(W){})(GK||(GK={}))});var pQ={};F4(pQ,{string:()=>WV,number:()=>QV,date:()=>GV,boolean:()=>XV,bigint:()=>YV});function WV(W){return Iz(hG,W)}function QV(W){return oz(cQ,W)}function XV(W){return tz(uG,W)}function YV(W){return ez(rJ,W)}function GV(W){return GJ(aJ,W)}var LK=$0(()=>{e1();uQ()});var zK=$0(()=>{e1();e1();wz();e1();bG();uY();_G();LK();uQ();qG();gG();fG();FK();C1(hY())});var JK=$0(()=>{zK()});var n4=$0(()=>{JK()});var R5="2025-11-25",H4,r4="io.modelcontextprotocol/related-task",n1="io.modelcontextprotocol/protocolVersion",v6="io.modelcontextprotocol/clientInfo",V1="io.modelcontextprotocol/serverInfo",q1="io.modelcontextprotocol/clientCapabilities",l5="io.modelcontextprotocol/subscriptionId",r1="io.modelcontextprotocol/logLevel",T5="2.0",m6,e0,jW,$4,U4,o4,a4,A4,G1,P5,W1,J1,K1,N4,Q1,c6,m5,c5,S5,b5,q5,OW,V4,s4,w4,t4,p6,k6,p5,BV,FV,e4,W8,Q8,X8,Y8,D4,G8,B8,F8,C5,M4,L8,z8,j4,J8,d6,i6,O4,E4,mG,I4,n6,y6,R4,K8,Z8,H8,$8,U8,d5,A8,N8,V8,w8,D8,M8,j8,O8,T4,E8,I8,R8,T8,P8,S8,b8,q8,C8,k8,v8,y8,_8,g8,i5,n5,r5,f8,x8,h8,o5,u8,l8,m8,c8,p8,P4,d8,i8,S4,EW,n8,r8,o8,b4,r6,a8,s8,t8,e8,W9,Q9,X9,Y9,G9,I5,B9,F9,L9,z9,J9,a5,o6,a6,s5,t5,e5,K9,W4,Q4,Z9,H9,X4,s6,$9,U9,A9,N9,V9,w9,D9,M9,j9,O9,E9,I9,R9,T9,P9,IW,S9,t6,RW,b9,TW,PW,SW,bW,qW,CW,kW,vW,yW,_W,gW,fW,xW,hW,uW,z1,q9,q4,C9,k9,v9,y9,_9,lG,g9,f9,x9,lW,mW;var KK=$0(()=>{n4();H4=[R5,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],m6=u5(()=>a([$(),m(),o(),q6(),n($(),m6),f(m6)])),e0=n($(),m6),jW=f(m6),$4=a([$(),m().int()]),U4=$(),o4=q({ttl:m().optional()}),a4=q({taskId:$()}),A4=F0({progressToken:$4.optional(),[r4]:a4.optional()}),G1=q({_meta:A4.optional()}),P5=G1.extend({task:o4.optional()}),W1=q({method:$(),params:G1.loose().optional()}),J1=q({_meta:A4.optional()}),K1=q({method:$(),params:J1.loose().optional()}),N4=F0({get[V1](){return p5.optional().catch(void 0)}}),Q1=F0({_meta:N4.optional()}),c6=a([$(),m().int()]),m5=q({jsonrpc:g(T5),id:c6,...W1.shape}).strict(),c5=q({jsonrpc:g(T5),...K1.shape}).strict(),S5=q({jsonrpc:g(T5),id:c6,result:Q1}).strict(),b5=q({jsonrpc:g(T5),id:c6.optional(),error:q({code:m().int(),message:$(),data:Y0().optional()})}).strict(),q5=a([m5,c5,S5,b5]),OW=a([S5,b5]),V4=Q1.strict(),s4=J1.extend({requestId:c6.optional(),reason:$().optional()}),w4=K1.extend({method:g("notifications/cancelled"),params:s4}),t4=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),p6=q({icons:f(t4).optional()}),k6=q({name:$(),title:$().optional()}),p5=k6.extend({...k6.shape,...p6.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),BV=k1(q({applyDefaults:o().optional()}),e0),FV=C6((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},k1(q({form:BV.optional(),url:e0.optional()}),e0.optional())),e4=F0({list:e0.optional(),cancel:e0.optional(),requests:F0({sampling:F0({createMessage:e0.optional()}).optional(),elicitation:F0({create:e0.optional()}).optional()}).optional()}),W8=F0({list:e0.optional(),cancel:e0.optional(),requests:F0({tools:F0({call:e0.optional()}).optional()}).optional()}),Q8=q({experimental:n($(),e0).optional(),sampling:q({context:e0.optional(),tools:e0.optional()}).optional(),elicitation:FV.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:e4.optional(),extensions:n($(),e0).optional()}),X8=G1.extend({protocolVersion:$(),capabilities:Q8,clientInfo:p5}),Y8=W1.extend({method:g("initialize"),params:X8}),D4=q({experimental:n($(),e0).optional(),logging:e0.optional(),completions:e0.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:W8.optional(),extensions:n($(),e0).optional()}),G8=Q1.extend({protocolVersion:$(),capabilities:D4,serverInfo:p5,instructions:$().optional()}),B8=K1.extend({method:g("notifications/initialized"),params:J1.optional()}),F8=W1.extend({method:g("server/discover"),params:G1.optional()}),C5=Q1.extend({supportedVersions:f($()),capabilities:D4,instructions:$().optional()}),M4=W1.extend({method:g("ping"),params:G1.optional()}),L8=q({progress:m(),total:Q0(m()),message:Q0($())}),z8=q({...J1.shape,...L8.shape,progressToken:$4}),j4=K1.extend({method:g("notifications/progress"),params:z8}),J8=G1.extend({cursor:U4.optional()}),d6=W1.extend({params:J8.optional()}),i6=Q1.extend({nextCursor:U4.optional()}),O4=q({uri:$(),mimeType:Q0($()),_meta:n($(),Y0()).optional()}),E4=O4.extend({text:$()}),mG=$().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),I4=O4.extend({blob:mG}),n6=J0(["user","assistant"]),y6=q({audience:f(n6).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),R4=q({...k6.shape,...p6.shape,uri:$(),description:Q0($()),mimeType:Q0($()),size:Q0(m()),annotations:y6.optional(),_meta:Q0(F0({}))}),K8=q({...k6.shape,...p6.shape,uriTemplate:$(),description:Q0($()),mimeType:Q0($()),annotations:y6.optional(),_meta:Q0(F0({}))}),Z8=d6.extend({method:g("resources/list")}),H8=i6.extend({resources:f(R4)}),$8=d6.extend({method:g("resources/templates/list")}),U8=i6.extend({resourceTemplates:f(K8)}),d5=G1.extend({uri:$()}),A8=d5,N8=W1.extend({method:g("resources/read"),params:A8}),V8=Q1.extend({contents:f(a([E4,I4]))}),w8=K1.extend({method:g("notifications/resources/list_changed"),params:J1.optional()}),D8=d5,M8=W1.extend({method:g("resources/subscribe"),params:D8}),j8=d5,O8=W1.extend({method:g("resources/unsubscribe"),params:j8}),T4=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),E8=G1.extend({notifications:T4}),I8=W1.extend({method:g("subscriptions/listen"),params:E8}),R8=J1.extend({notifications:T4}),T8=K1.extend({method:g("notifications/subscriptions/acknowledged"),params:R8}),P8=N4.extend({[l5]:c6}),S8=Q1.extend({_meta:P8}),b8=J1.extend({uri:$()}),q8=K1.extend({method:g("notifications/resources/updated"),params:b8}),C8=q({name:$(),description:Q0($()),required:Q0(o())}),k8=q({...k6.shape,...p6.shape,description:Q0($()),arguments:Q0(f(C8)),_meta:Q0(F0({}))}),v8=d6.extend({method:g("prompts/list")}),y8=i6.extend({prompts:f(k8)}),_8=G1.extend({name:$(),arguments:n($(),$()).optional()}),g8=W1.extend({method:g("prompts/get"),params:_8}),i5=q({type:g("text"),text:$(),annotations:y6.optional(),_meta:n($(),Y0()).optional()}),n5=q({type:g("image"),data:mG,mimeType:$(),annotations:y6.optional(),_meta:n($(),Y0()).optional()}),r5=q({type:g("audio"),data:mG,mimeType:$(),annotations:y6.optional(),_meta:n($(),Y0()).optional()}),f8=q({type:g("tool_use"),name:$(),id:$(),input:n($(),Y0()),_meta:n($(),Y0()).optional()}),x8=q({type:g("resource"),resource:a([E4,I4]),annotations:y6.optional(),_meta:n($(),Y0()).optional()}),h8=R4.extend({type:g("resource_link")}),o5=a([i5,n5,r5,h8,x8]),u8=q({role:n6,content:o5}),l8=Q1.extend({description:$().optional(),messages:f(u8)}),m8=K1.extend({method:g("notifications/prompts/list_changed"),params:J1.optional()}),c8=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),p8=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),P4=q({...k6.shape,...p6.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),m6).optional(),required:f($()).optional()}).catchall(Y0()),outputSchema:F0({$schema:$().optional()}).optional(),annotations:c8.optional(),execution:p8.optional(),_meta:n($(),Y0()).optional()}),d8=d6.extend({method:g("tools/list")}),i8=i6.extend({tools:f(P4)}),S4=Q1.extend({content:f(o5).default([]),structuredContent:Y0().optional(),isError:o().optional()}),EW=S4.or(Q1.extend({toolResult:Y0()})),n8=P5.extend({name:$(),arguments:n($(),Y0()).optional()}),r8=W1.extend({method:g("tools/call"),params:n8}),o8=K1.extend({method:g("notifications/tools/list_changed"),params:J1.optional()}),b4=q({autoRefresh:o().default(!0),debounceMs:m().int().nonnegative().default(300)}),r6=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),a8=G1.extend({level:r6}),s8=W1.extend({method:g("logging/setLevel"),params:a8}),t8=J1.extend({level:r6,logger:$().optional(),data:Y0()}),e8=K1.extend({method:g("notifications/message"),params:t8}),W9=q({name:$().optional()}),Q9=q({hints:f(W9).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),X9=q({mode:J0(["auto","required","none"]).optional()}),Y9=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(o5),structuredContent:Y0().optional(),isError:o().optional(),_meta:n($(),Y0()).optional()}),G9=E5("type",[i5,n5,r5]),I5=E5("type",[i5,n5,r5,f8,Y9]),B9=q({role:n6,content:a([I5,f(I5)]),_meta:n($(),Y0()).optional()}),F9=P5.extend({messages:f(B9),modelPreferences:Q9.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:e0.optional(),tools:f(P4).optional(),toolChoice:X9.optional()}),L9=W1.extend({method:g("sampling/createMessage"),params:F9}),z9=Q1.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:n6,content:G9}),J9=Q1.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:n6,content:a([I5,f(I5)])}),a5=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),o6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),a6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),s5=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),t5=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),e5=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),K9=a([s5,t5]),W4=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),Q4=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Z9=a([W4,Q4]),H9=a([e5,K9,Z9]),X4=a([H9,a5,o6,a6]),s6=P5.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),X4),required:f($()).optional()}).catchall(Y0())}),$9=P5.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),U9=a([s6,$9]),A9=W1.extend({method:g("elicitation/create"),params:U9}),N9=J1.extend({elicitationId:$()}),V9=K1.extend({method:g("notifications/elicitation/complete"),params:N9}),w9=Q1.extend({action:J0(["accept","decline","cancel"]),content:C6((W)=>W===null?void 0:W,n($(),a([$(),m(),o(),f($())])).optional())}),D9=q({type:g("ref/resource"),uri:$()}),M9=q({type:g("ref/prompt"),name:$()}),j9=G1.extend({ref:a([M9,D9]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),O9=W1.extend({method:g("completion/complete"),params:j9}),E9=Q1.extend({completion:F0({values:f($()).max(100),total:Q0(m().int()),hasMore:Q0(o())})}),I9=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),Y0()).optional()}),R9=W1.extend({method:g("roots/list"),params:G1.optional()}),T9=Q1.extend({roots:f(I9)}),P9=K1.extend({method:g("notifications/roots/list_changed"),params:J1.optional()}),IW=F0({ttl:m().optional(),pollInterval:m().optional()}),S9=J0(["working","input_required","completed","failed","cancelled"]),t6=q({taskId:$(),status:S9,ttl:a([m(),q6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:Q0(m()),statusMessage:Q0($())}),RW=Q1.extend({task:t6}),b9=J1.merge(t6),TW=K1.extend({method:g("notifications/tasks/status"),params:b9}),PW=W1.extend({method:g("tasks/get"),params:G1.extend({taskId:$()})}),SW=Q1.merge(t6),bW=W1.extend({method:g("tasks/result"),params:G1.extend({taskId:$()})}),qW=Q1.loose(),CW=d6.extend({method:g("tasks/list")}),kW=i6.extend({tasks:f(t6)}),vW=W1.extend({method:g("tasks/cancel"),params:G1.extend({taskId:$()})}),yW=Q1.merge(t6),_W=a([M4,Y8,F8,O9,s8,g8,v8,Z8,$8,N8,M8,O8,I8,r8,d8]),gW=a([w4,j4,B8,P9]),fW=a([V4,z9,J9,w9,T9]),xW=a([M4,L9,A9,R9]),hW=a([w4,j4,e8,q8,w8,o8,m8,T8,V9]),uW=a([V4,G8,C5,E9,l8,y8,H8,U8,V8,S4,i8,S8]),z1=i4().superRefine((W,Q)=>{if(!URL.canParse(W))return Q.addIssue({code:BK.custom,message:"URL must be parseable",fatal:!0}),$Y}).refine((W)=>{let Q=new URL(W);return Q.protocol!=="javascript:"&&Q.protocol!=="data:"&&Q.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),q9=F0({resource:$().url(),authorization_servers:f(z1).optional(),jwks_uri:$().url().optional(),scopes_supported:f($()).optional(),bearer_methods_supported:f($()).optional(),resource_signing_alg_values_supported:f($()).optional(),resource_name:$().optional(),resource_documentation:$().optional(),resource_policy_uri:$().url().optional(),resource_tos_uri:$().url().optional(),tls_client_certificate_bound_access_tokens:o().optional(),authorization_details_types_supported:f($()).optional(),dpop_signing_alg_values_supported:f($()).optional(),dpop_bound_access_tokens_required:o().optional()}),q4=F0({issuer:$(),authorization_endpoint:z1,token_endpoint:z1,registration_endpoint:z1.optional(),scopes_supported:f($()).optional(),response_types_supported:f($()),response_modes_supported:f($()).optional(),grant_types_supported:f($()).optional(),token_endpoint_auth_methods_supported:f($()).optional(),token_endpoint_auth_signing_alg_values_supported:f($()).optional(),service_documentation:z1.optional(),revocation_endpoint:z1.optional(),revocation_endpoint_auth_methods_supported:f($()).optional(),revocation_endpoint_auth_signing_alg_values_supported:f($()).optional(),introspection_endpoint:$().optional(),introspection_endpoint_auth_methods_supported:f($()).optional(),introspection_endpoint_auth_signing_alg_values_supported:f($()).optional(),code_challenge_methods_supported:f($()).optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),C9=F0({issuer:$(),authorization_endpoint:z1,token_endpoint:z1,userinfo_endpoint:z1.optional(),jwks_uri:z1,registration_endpoint:z1.optional(),scopes_supported:f($()).optional(),response_types_supported:f($()),response_modes_supported:f($()).optional(),grant_types_supported:f($()).optional(),acr_values_supported:f($()).optional(),subject_types_supported:f($()),id_token_signing_alg_values_supported:f($()),id_token_encryption_alg_values_supported:f($()).optional(),id_token_encryption_enc_values_supported:f($()).optional(),userinfo_signing_alg_values_supported:f($()).optional(),userinfo_encryption_alg_values_supported:f($()).optional(),userinfo_encryption_enc_values_supported:f($()).optional(),request_object_signing_alg_values_supported:f($()).optional(),request_object_encryption_alg_values_supported:f($()).optional(),request_object_encryption_enc_values_supported:f($()).optional(),token_endpoint_auth_methods_supported:f($()).optional(),token_endpoint_auth_signing_alg_values_supported:f($()).optional(),display_values_supported:f($()).optional(),claim_types_supported:f($()).optional(),claims_supported:f($()).optional(),service_documentation:$().optional(),claims_locales_supported:f($()).optional(),ui_locales_supported:f($()).optional(),claims_parameter_supported:o().optional(),request_parameter_supported:o().optional(),request_uri_parameter_supported:o().optional(),require_request_uri_registration:o().optional(),op_policy_uri:z1.optional(),op_tos_uri:z1.optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),k9=q({...C9.shape,...q4.pick({code_challenge_methods_supported:!0}).shape}),v9=q({access_token:$(),id_token:$().optional(),token_type:$(),expires_in:pQ.number().optional(),scope:$().optional(),refresh_token:$().optional()}).strip(),y9=q({issued_token_type:g("urn:ietf:params:oauth:token-type:id-jag"),access_token:$(),token_type:$().optional(),expires_in:m().optional(),scope:$().optional()}).strip(),_9=q({error:$(),error_description:$().optional(),error_uri:$().optional()}),lG=z1.optional().or(g("").transform(()=>{return})),g9=q({redirect_uris:f(z1),token_endpoint_auth_method:$().optional(),grant_types:f($()).optional(),response_types:f($()).optional(),application_type:$().optional(),client_name:$().optional(),client_uri:z1.optional(),logo_uri:lG,scope:$().optional(),contacts:f($()).optional(),tos_uri:lG,policy_uri:$().optional(),jwks_uri:z1.optional(),jwks:oJ().optional(),software_id:$().optional(),software_version:$().optional(),software_statement:$().optional()}).strip(),f9=q({client_id:$(),client_secret:$().optional(),client_id_issued_at:m().optional(),client_secret_expires_at:m().optional()}).strip(),x9=g9.merge(f9),lW=q({error:$(),error_description:$().optional()}).strip(),mW=q({token:$(),token_type_hint:$().optional()}).strip()});var cG=$0(()=>{KK()});function tG(W,Q){let X=new Set,Y=Q;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")X.add(G);Y=Object.getPrototypeOf(Y)}if(X.size===0)return;Object.defineProperty(W,nG,{value:X,enumerable:!1,configurable:!0})}function u9(W,Q){try{if(typeof Q==="object"&&Q!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(Q,nG)){let X=Q[nG];if(X&&typeof X.has==="function"&&X.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,Q)}function ZK(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function JV(W,Q,X){return W==="elicitation"&&Q==="form"&&X.form===void 0&&X.url===void 0}function OK(W){switch(W.method){case"elicitation/create":if(W.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let Q=W.params;if(Q!==void 0&&(Q.tools!==void 0||Q.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function FX(W,Q){let X={};for(let[Y,G]of Object.entries(W)){if(G===void 0)continue;let B=Q===void 0?void 0:Q[Y];if(B===void 0){X[Y]=G;continue}if(ZK(G)&&ZK(B)){let F={};for(let[L,z]of Object.entries(G))if(z!==void 0&&B[L]===void 0&&!JV(Y,L,B))F[L]=z;if(Object.keys(F).length>0)X[Y]=F}}return Object.keys(X).length>0?X:void 0}function rW(W){return W>=KV}function EK(W){return W.filter((Q)=>!rW(Q))}function eG(W){return W.filter((Q)=>rW(Q))}function IK(W){let Q=W.structuredContent;if(Q===void 0)return W;if(!(typeof Q!=="object"||Q===null||Array.isArray(Q)))return W;if(W.content?.some((X)=>X.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(Q)}]}}function W7(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||RK.some((Q)=>(Q in W)))return W;return{...W,content:[]}}function ZV(){let W=u5(()=>a([$(),m(),o(),q6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=q({ttl:m().optional()}),B=q({taskId:$()}),F=F0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),z=L.extend({task:G.optional()}),J=q({method:$(),params:L.loose().optional()}),K=q({_meta:F.optional()}),H=q({method:$(),params:K.loose().optional()}),D=F0({_meta:F.optional()}),I=a([$(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:$().optional()}),N=H.extend({method:g("notifications/cancelled"),params:M}),Z=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f(Z).optional()}),U=q({name:$(),title:$().optional()}),j=U.extend({...U.shape,...V.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),R=k1(q({applyDefaults:o().optional()}),Q),O=C6((h0)=>{if(h0&&typeof h0==="object"&&!Array.isArray(h0)&&Object.keys(h0).length===0)return{form:{}};return h0},k1(q({form:R.optional(),url:Q.optional()}),Q.optional())),w=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({sampling:F0({createMessage:Q.optional()}).optional(),elicitation:F0({create:Q.optional()}).optional()}).optional()}),T=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({tools:F0({call:Q.optional()}).optional()}).optional()}),k=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n($(),Q).optional()}),l=L.extend({protocolVersion:$(),capabilities:k,clientInfo:j}),_=J.extend({method:g("initialize"),params:l}),h=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n($(),Q).optional()}),d=D.extend({protocolVersion:$(),capabilities:h,serverInfo:j,instructions:$().optional()}),p=H.extend({method:g("notifications/initialized"),params:K.optional()}),K0=J.extend({method:g("ping"),params:L.optional()}),j0=q({progress:m(),total:Q0(m()),message:Q0($())}),w0=q({...K.shape,...j0.shape,progressToken:X}),S0=H.extend({method:g("notifications/progress"),params:w0}),H0=L.extend({cursor:Y.optional()}),b=J.extend({params:H0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:$(),mimeType:Q0($()),_meta:n($(),Y0()).optional()}),E=u.extend({text:$()}),S=$().refine((h0)=>{try{return atob(h0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:S}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),z0=q({...U.shape,...V.shape,uri:$(),description:Q0($()),mimeType:Q0($()),size:Q0(m()),annotations:r.optional(),_meta:Q0(F0({}))}),e=q({...U.shape,...V.shape,uriTemplate:$(),description:Q0($()),mimeType:Q0($()),annotations:r.optional(),_meta:Q0(F0({}))}),D0=b.extend({method:g("resources/list")}),u0=v.extend({resources:f(z0)}),P=b.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:$()}),s=x,t=J.extend({method:g("resources/read"),params:s}),L0=D.extend({contents:f(a([E,C]))}),T0=H.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),C0=x,f0=J.extend({method:g("resources/subscribe"),params:C0}),b0=x,O0=J.extend({method:g("resources/unsubscribe"),params:b0}),o0=K.extend({uri:$()}),k0=H.extend({method:g("notifications/resources/updated"),params:o0}),B1=q({name:$(),description:Q0($()),required:Q0(o())}),X1=q({...U.shape,...V.shape,description:Q0($()),arguments:Q0(f(B1)),_meta:Q0(F0({}))}),F1=b.extend({method:g("prompts/list")}),Z1=v.extend({prompts:f(X1)}),H1=L.extend({name:$(),arguments:n($(),$()).optional()}),w1=J.extend({method:g("prompts/get"),params:H1}),D1=q({type:g("text"),text:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),M1=q({type:g("image"),data:S,mimeType:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),j1=q({type:g("audio"),data:S,mimeType:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),W6=q({type:g("tool_use"),name:$(),id:$(),input:n($(),Y0()),_meta:n($(),Y0()).optional()}),$1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n($(),Y0()).optional()}),Q6=z0.extend({type:g("resource_link")}),a0=a([D1,M1,j1,Q6,$1]),y1=q({role:c,content:a0}),_1=D.extend({description:$().optional(),messages:f(y1)}),O1=H.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),X6=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),g1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),E1=q({...U.shape,...V.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(Y0()),outputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(Y0()).optional(),annotations:X6.optional(),execution:g1.optional(),_meta:n($(),Y0()).optional()}),f1=b.extend({method:g("tools/list")}),x1=v.extend({tools:f(E1)}),h1=D.extend({content:f(a0),structuredContent:n($(),Y0()).optional(),isError:o().optional()}),x0=z.extend({name:$(),arguments:n($(),Y0()).optional()}),Y6=J.extend({method:g("tools/call"),params:x0}),Q5=H.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),u1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),G6=L.extend({level:u1}),B6=J.extend({method:g("logging/setLevel"),params:G6}),F6=K.extend({level:u1,logger:$().optional(),data:Y0()}),L6=H.extend({method:g("notifications/message"),params:F6}),z6=q({name:$().optional()}),J6=q({hints:f(z6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),K6=q({mode:J0(["auto","required","none"]).optional()}),X5=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(a0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n($(),Y0()).optional()}),Z6=E5("type",[D1,M1,j1]),U1=E5("type",[D1,M1,j1,W6,X5]),H6=q({role:c,content:a([U1,f(U1)]),_meta:n($(),Y0()).optional()}),$6=z.extend({messages:f(H6),modelPreferences:J6.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(E1).optional(),toolChoice:K6.optional()}),U6=J.extend({method:g("sampling/createMessage"),params:$6}),A6=D.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:c,content:Z6}),N6=D.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:c,content:a([U1,f(U1)])}),V6=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),w6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),D6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),M6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),j6=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),O6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),E6=a([M6,j6]),I1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),R1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Y5=a([I1,R1]),G5=a([O6,E6,Y5]),i0=a([G5,V6,w6,D6]),n0=z.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),i0),required:f($()).optional()}).catchall(Y0())}),I6=z.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),Y1=a([n0,I6]),B5=J.extend({method:g("elicitation/create"),params:Y1}),F5=K.extend({elicitationId:$()}),L5=H.extend({method:g("notifications/elicitation/complete"),params:F5}),z5=D.extend({action:J0(["accept","decline","cancel"]),content:C6((h0)=>h0===null?void 0:h0,n($(),a([$(),m(),o(),f($())])).optional())}),J5=q({type:g("ref/resource"),uri:$()}),K5=q({type:g("ref/prompt"),name:$()}),Z5=L.extend({ref:a([K5,J5]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),R6=J.extend({method:g("completion/complete"),params:Z5}),H5=D.extend({completion:F0({values:f($()).max(100),total:Q0(m().int()),hasMore:Q0(o())})}),$5=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),Y0()).optional()}),l1=J.extend({method:g("roots/list"),params:L.optional()}),T6=D.extend({roots:f($5)}),U5=H.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),A5=F0({ttl:m().optional(),pollInterval:m().optional()}),N5=J0(["working","input_required","completed","failed","cancelled"]),A1=q({taskId:$(),status:N5,ttl:a([m(),q6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:Q0(m()),statusMessage:Q0($())}),c0=D.extend({task:A1}),V5=K.merge(A1),T1=H.extend({method:g("notifications/tasks/status"),params:V5}),m1=J.extend({method:g("tasks/get"),params:L.extend({taskId:$()})}),c1=D.merge(A1),p1=J.extend({method:g("tasks/result"),params:L.extend({taskId:$()})}),B4=D.loose(),p0=b.extend({method:g("tasks/list")}),P0=v.extend({tasks:f(A1)}),P1=J.extend({method:g("tasks/cancel"),params:L.extend({taskId:$()})});return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:z,RequestSchema:J,NotificationsParamsSchema:K,NotificationSchema:H,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:Z,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:K0,ProgressSchema:j0,ProgressNotificationParamsSchema:w0,ProgressNotificationSchema:S0,PaginatedRequestParamsSchema:H0,PaginatedRequestSchema:b,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:z0,ResourceTemplateSchema:e,ListResourcesRequestSchema:D0,ListResourcesResultSchema:u0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:L0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:C0,SubscribeRequestSchema:f0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:O0,ResourceUpdatedNotificationParamsSchema:o0,ResourceUpdatedNotificationSchema:k0,PromptArgumentSchema:B1,PromptSchema:X1,ListPromptsRequestSchema:F1,ListPromptsResultSchema:Z1,GetPromptRequestParamsSchema:H1,GetPromptRequestSchema:w1,TextContentSchema:D1,ImageContentSchema:M1,AudioContentSchema:j1,ToolUseContentSchema:W6,EmbeddedResourceSchema:$1,ResourceLinkSchema:Q6,ContentBlockSchema:a0,PromptMessageSchema:y1,GetPromptResultSchema:_1,PromptListChangedNotificationSchema:O1,ToolAnnotationsSchema:X6,ToolExecutionSchema:g1,ToolSchema:E1,ListToolsRequestSchema:f1,ListToolsResultSchema:x1,CallToolResultSchema:h1,CallToolRequestParamsSchema:x0,CallToolRequestSchema:Y6,ToolListChangedNotificationSchema:Q5,LoggingLevelSchema:u1,SetLevelRequestParamsSchema:G6,SetLevelRequestSchema:B6,LoggingMessageNotificationParamsSchema:F6,LoggingMessageNotificationSchema:L6,ModelHintSchema:z6,ModelPreferencesSchema:J6,ToolChoiceSchema:K6,ToolResultContentSchema:X5,SamplingContentSchema:Z6,SamplingMessageContentBlockSchema:U1,SamplingMessageSchema:H6,CreateMessageRequestParamsSchema:$6,CreateMessageRequestSchema:U6,CreateMessageResultSchema:A6,CreateMessageResultWithToolsSchema:N6,BooleanSchemaSchema:V6,StringSchemaSchema:w6,NumberSchemaSchema:D6,UntitledSingleSelectEnumSchemaSchema:M6,TitledSingleSelectEnumSchemaSchema:j6,LegacyTitledEnumSchemaSchema:O6,SingleSelectEnumSchemaSchema:E6,UntitledMultiSelectEnumSchemaSchema:I1,TitledMultiSelectEnumSchemaSchema:R1,MultiSelectEnumSchemaSchema:Y5,EnumSchemaSchema:G5,PrimitiveSchemaDefinitionSchema:i0,ElicitRequestFormParamsSchema:n0,ElicitRequestURLParamsSchema:I6,ElicitRequestParamsSchema:Y1,ElicitRequestSchema:B5,ElicitationCompleteNotificationParamsSchema:F5,ElicitationCompleteNotificationSchema:L5,ElicitResultSchema:z5,ResourceTemplateReferenceSchema:J5,PromptReferenceSchema:K5,CompleteRequestParamsSchema:Z5,CompleteRequestSchema:R6,CompleteResultSchema:H5,RootSchema:$5,ListRootsRequestSchema:l1,ListRootsResultSchema:T6,RootsListChangedNotificationSchema:U5,TaskCreationParamsSchema:A5,TaskStatusSchema:N5,TaskSchema:A1,CreateTaskResultSchema:c0,TaskStatusNotificationParamsSchema:V5,TaskStatusNotificationSchema:T1,GetTaskRequestSchema:m1,GetTaskResultSchema:c1,GetTaskPayloadRequestSchema:p1,GetTaskPayloadResultSchema:B4,ListTasksRequestSchema:p0,ListTasksResultSchema:P0,CancelTaskRequestSchema:P1,CancelTaskResultSchema:D.merge(A1),ClientRequestSchema:a([K0,_,R6,B6,w1,F1,D0,P,t,f0,O0,Y6,f1,m1,p1,p0,P1]),ClientNotificationSchema:a([N,S0,p,U5,T1]),ClientResultSchema:a([A,A6,N6,z5,T6,c1,P0,c0]),ServerRequestSchema:a([K0,U6,B5,l1,m1,p1,p0,P1]),ServerNotificationSchema:a([N,S0,L6,k0,T0,Q5,O1,T1,L5]),ServerResultSchema:a([A,d,H5,_1,Z1,u0,y,L0,h1,x1,c1,P0,c0]),CallToolResultWireSchema:Y0().superRefine((h0,WY)=>{if(typeof h0!=="object"||h0===null||Array.isArray(h0)||h0.content!==void 0)return;for(let XW of RK)if(XW in h0){WY.addIssue({code:"custom",message:`content is required when the body carries '${XW}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(W7).pipe(h1)}}function TK(){return HV??=ZV()}function PK(W){return W.type!=="object"}function AV(W){let Q=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:W},required:["result"]};let X=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>X(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=X(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if($V.has(F))B[F]=L;else if(UV.has(F))B[F]=X(L,!0);else B[F]=X(L,!1);return B};return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:X(W,!1)},required:["result"]}}function Q7(){if(WX)return WX;let W=TK();return WX={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},WX}function qK(W){return Object.prototype.hasOwnProperty.call(SK,W)}function CK(W){return Object.prototype.hasOwnProperty.call(bK,W)}function VV(W){return Object.prototype.hasOwnProperty.call(NV,W)}function wV(W){return VV(W)?Q7().resultSchemas[W]:void 0}function DV(W){return qK(W)?Q7().requestSchemas[W]:void 0}function MV(W){return CK(W)?Q7().notificationSchemas[W]:void 0}function rG(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function QX(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function $K(W){return rG(W)&&rG(W.outputSchema)&&PK(W.outputSchema)}function UK(W){return W}function jV(){let W=u5(()=>a([$(),m(),o(),q6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=a([$(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=$().refine((P0)=>{try{return atob(P0),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=q({ttl:m().optional()}),J=q({taskId:$()}),K=F0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":J.optional()}),H=q({_meta:K.optional()}),D=H.extend({task:z.optional()}),I=q({_meta:K.optional()}),A=q({method:$(),params:I.loose().optional()}),M=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),Z=q({name:$(),title:$().optional()}),V=Z.extend({...Z.shape,...N.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),U=k1(q({applyDefaults:o().optional()}),Q),j=C6((P0)=>{if(P0&&typeof P0==="object"&&!Array.isArray(P0)&&Object.keys(P0).length===0)return{form:{}};return P0},k1(q({form:U.optional(),url:Q.optional()}),Q.optional())),R=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({sampling:F0({createMessage:Q.optional()}).optional(),elicitation:F0({create:Q.optional()}).optional()}).optional()}),O=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({tools:F0({call:Q.optional()}).optional()}).optional()}),w=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n($(),Q).optional()}),T=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:O.optional(),extensions:n($(),Q).optional()}),k=q({progress:m(),total:Q0(m()),message:Q0($())}),l=q({...I.shape,...k.shape,progressToken:X}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:$().optional(),data:Y0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:$(),mimeType:Q0($()),_meta:n($(),Y0()).optional()}),K0=p.extend({text:$()}),j0=p.extend({blob:L}),w0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),S0=q({...Z.shape,...N.shape,uri:$(),description:Q0($()),mimeType:Q0($()),size:Q0(m()),annotations:w0.optional(),_meta:Q0(F0({}))}),H0=q({...Z.shape,...N.shape,uriTemplate:$(),description:Q0($()),mimeType:Q0($()),annotations:w0.optional(),_meta:Q0(F0({}))}),b=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:$()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:$(),description:Q0($()),required:Q0(o())}),S=q({...Z.shape,...N.shape,description:Q0($()),arguments:Q0(f(E)),_meta:Q0(F0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),r=q({type:g("image"),data:L,mimeType:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),z0=q({type:g("audio"),data:L,mimeType:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),e=q({type:g("tool_use"),name:$(),id:$(),input:n($(),Y0()),_meta:n($(),Y0()).optional()}),D0=q({type:g("resource"),resource:a([K0,j0]),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),u0=S0.extend({type:g("resource_link")}),P=a([c,r,z0,u0,D0]),y=q({role:B,content:P}),x=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:$().optional()}),L0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),C0=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),f0=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),b0=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),O0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),o0=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),k0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),B1=a([O0,o0]),X1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),F1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Z1=a([X1,F1]),H1=a([k0,B1,Z1]),w1=a([H1,C0,f0,b0]),D1=D.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),w1),required:f($()).optional()}).catchall(Y0())}),M1=q({type:g("ref/resource"),uri:$()}),j1=q({type:g("ref/prompt"),name:$()}),W6=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),Y0()).optional()}),$1=w.shape,Q6=q({experimental:$1.experimental,sampling:$1.sampling,elicitation:$1.elicitation,roots:$1.roots,extensions:$1.extensions}),a0=T.shape,y1=q({experimental:a0.experimental,logging:a0.logging,completions:a0.completions,prompts:a0.prompts,resources:a0.resources,tools:a0.tools,extensions:a0.extensions}),_1=F0({progressToken:X.optional(),[n1]:$(),[v6]:V.optional(),[q1]:Q6,[r1]:F.optional()}),O1=q({...Z.shape,...N.shape,description:$().optional(),inputSchema:F0({$schema:$().optional(),type:g("object")}),outputSchema:F0({$schema:$().optional()}).optional(),annotations:x.optional(),_meta:n($(),Y0()).optional()}),X6=q({type:g("tool_result"),toolUseId:$(),content:f(P),structuredContent:Y0().optional(),isError:o().optional(),_meta:n($(),Y0()).optional()}),g1=a([c,r,z0,e,X6]),E1=q({role:B,content:a([g1,f(g1)]),_meta:n($(),Y0()).optional()}),f1=$(),x1=F0({[V1]:V.optional().catch(void 0)}),h1=x1.optional();function x0(P0){return F0({_meta:h1,resultType:f1.default("complete"),...P0})}let Y6=x0({}),Q5=x0({nextCursor:Y.optional()}),u1=x0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),G6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(O1),nextCursor:Y.optional()}),B6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),F6=x0({description:$().optional(),messages:f(y)}),L6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),z6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(H0),nextCursor:Y.optional()}),J6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,j0]))}),K6=x0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),X5=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),Z6=x0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:y1,instructions:$().optional()}),U1=q({messages:f(E1),modelPreferences:L0.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(O1).optional(),toolChoice:T0.optional()}),H6=q({method:g("sampling/createMessage"),params:U1}),$6=q({method:g("roots/list"),params:q({_meta:n($(),Y0()).optional()}).optional()}),U6=q({...E1.shape,model:$(),stopReason:$().optional()}),A6=q({roots:f(W6)}),N6=q({action:J0(["accept","decline","cancel"]),content:n($(),a([$(),m(),o(),f($())])).optional()}),V6=q({mode:g("url"),message:$(),url:$().url()}),w6=a([D1,V6]),D6=q({method:g("elicitation/create"),params:w6}),M6=a([H6,$6,D6]),j6=a([U6,A6,N6]),O6=n($(),M6),E6=n($(),j6),I1=x0({inputRequests:O6.optional(),requestState:$().optional()}),R1={inputResponses:E6.optional(),requestState:$().optional()},Y5=q({_meta:_1,...R1}),G5=F0({progressToken:X.optional()});function i0(P0,P1){return q({method:g(P0),params:q({_meta:_1,...P1})})}function n0(P0,P1){return q({method:g(P0),params:q({_meta:G5.optional(),...P1}).optional()})}let I6={name:$(),arguments:n($(),Y0()).optional(),...R1},Y1={cursor:Y.optional()},B5=i0("tools/call",I6),F5=i0("tools/list",Y1),L5=i0("prompts/list",Y1),z5=i0("prompts/get",{name:$(),arguments:n($(),$()).optional(),...R1}),J5=i0("resources/list",Y1),K5=i0("resources/templates/list",Y1),Z5=i0("resources/read",{uri:$(),...R1}),R6={ref:a([j1,M1]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()},H5=i0("completion/complete",R6),$5=i0("server/discover",{}),l1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),T6={notifications:l1},U5=i0("subscriptions/listen",T6),A5=x1.extend({"io.modelcontextprotocol/subscriptionId":G}),N5=F0({_meta:A5,resultType:f1.default("complete")}),A1={"tools/call":n0("tools/call",I6),"tools/list":n0("tools/list",Y1),"prompts/get":n0("prompts/get",{name:$(),arguments:n($(),$()).optional()}),"prompts/list":n0("prompts/list",Y1),"resources/list":n0("resources/list",Y1),"resources/templates/list":n0("resources/templates/list",Y1),"resources/read":n0("resources/read",{uri:$()}),"completion/complete":n0("completion/complete",R6),"server/discover":n0("server/discover",{}),"subscriptions/listen":n0("subscriptions/listen",T6)};function c0(P0){return F0({_meta:h1,...P0})}let V5={"tools/call":c0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),"tools/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(O1),nextCursor:Y.optional()}),"prompts/get":c0({description:$().optional(),messages:f(y)}),"prompts/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),"resources/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),"resources/templates/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(H0),nextCursor:Y.optional()}),"resources/read":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,j0]))}),"completion/complete":c0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":c0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:y1,instructions:$().optional()}),"subscriptions/listen":c0({})},T1=F0({"io.modelcontextprotocol/subscriptionId":G.optional()}),m1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:T1.optional(),notifications:l1})}),c1=q({_meta:T1.optional(),requestId:G,reason:$().optional()}),p1=q({method:g("notifications/cancelled"),params:c1}),B4={"notifications/cancelled":p1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":b,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":m1},p0=(P0)=>q({jsonrpc:g("2.0"),id:a([$(),m().int()]),result:P0}).strict();return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:z,RelatedTaskMetadataSchema:J,RequestMetaSchema:K,BaseRequestParamsSchema:H,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:Z,ImplementationSchema:V,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:O,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:T,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:K0,BlobResourceContentsSchema:j0,AnnotationsSchema:w0,ResourceSchema:S0,ResourceTemplateSchema:H0,ResourceListChangedNotificationSchema:b,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:S,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:z0,ToolUseContentSchema:e,EmbeddedResourceSchema:D0,ResourceLinkSchema:u0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:L0,ToolChoiceSchema:T0,BooleanSchemaSchema:C0,StringSchemaSchema:f0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:O0,TitledSingleSelectEnumSchemaSchema:o0,LegacyTitledEnumSchemaSchema:k0,SingleSelectEnumSchemaSchema:B1,UntitledMultiSelectEnumSchemaSchema:X1,TitledMultiSelectEnumSchemaSchema:F1,MultiSelectEnumSchemaSchema:Z1,EnumSchemaSchema:H1,PrimitiveSchemaDefinitionSchema:w1,ElicitRequestFormParamsSchema:D1,ResourceTemplateReferenceSchema:M1,PromptReferenceSchema:j1,RootSchema:W6,ClientCapabilities2026Schema:Q6,ServerCapabilities2026Schema:y1,RequestMetaEnvelopeSchema:_1,ToolSchema:O1,ToolResultContentSchema:X6,SamplingMessageContentBlockSchema:g1,SamplingMessageSchema:E1,ResultTypeSchema:f1,ResultMetaSchema:x1,ResultSchema:Y6,PaginatedResultSchema:Q5,CallToolResultSchema:u1,ListToolsResultSchema:G6,ListPromptsResultSchema:B6,GetPromptResultSchema:F6,ListResourcesResultSchema:L6,ListResourceTemplatesResultSchema:z6,ReadResourceResultSchema:J6,CompleteResultSchema:K6,CacheableResultSchema:X5,DiscoverResultSchema:Z6,CreateMessageRequestParamsSchema:U1,CreateMessageRequestSchema:H6,ListRootsRequestSchema:$6,CreateMessageResultSchema:U6,ListRootsResultSchema:A6,ElicitResultSchema:N6,ElicitRequestURLParamsSchema:V6,ElicitRequestParamsSchema:w6,ElicitRequestSchema:D6,InputRequestSchema:M6,InputResponseSchema:j6,InputRequestsSchema:O6,InputResponsesSchema:E6,InputRequiredResultSchema:I1,InputResponseRequestParamsSchema:Y5,CallToolRequestSchema:B5,ListToolsRequestSchema:F5,ListPromptsRequestSchema:L5,GetPromptRequestSchema:z5,ListResourcesRequestSchema:J5,ListResourceTemplatesRequestSchema:K5,ReadResourceRequestSchema:Z5,CompleteRequestSchema:H5,DiscoverRequestSchema:$5,SubscriptionFilterSchema:l1,SubscriptionsListenRequestSchema:U5,SubscriptionsListenResultMetaSchema:A5,SubscriptionsListenResultSchema:N5,dispatchRequestSchemas:A1,dispatchResultSchemas:V5,NotificationMetaSchema:T1,SubscriptionsAcknowledgedNotificationSchema:m1,CancelledNotificationParamsSchema:c1,CancelledNotificationSchema:p1,notificationSchemas2026:B4,JSONRPCResultResponseSchema:p0(Y6),CallToolResultResponseSchema:p0(a([u1,I1])),ListToolsResultResponseSchema:p0(G6),ListPromptsResultResponseSchema:p0(B6),GetPromptResultResponseSchema:p0(a([F6,I1])),ListResourcesResultResponseSchema:p0(L6),ListResourceTemplatesResultResponseSchema:p0(z6),ReadResourceResultResponseSchema:p0(a([J6,I1])),CompleteResultResponseSchema:p0(K6),DiscoverResultResponseSchema:p0(Z6)}}function k4(){return OV??=jV()}function IV(W){return EV.includes(W)}function LX(W,Q){if(Q===void 0)return W;let X=W[h9];if(X===void 0)return{...W,[h9]:Q};let Y={},G=X.ttlMs??Q.ttlMs;if(G!==void 0)Y.ttlMs=G;let B=X.cacheScope??Q.cacheScope;if(B!==void 0)Y.cacheScope=B;return{...W,[h9]:Y}}function RV(W){return W[h9]}function Y7(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function G7(W){return W==="public"||W==="private"}function B7(W,Q){if(W.ttlMs!==void 0&&!Y7(W.ttlMs))throw RangeError(`Invalid cache hint for ${Q}: ttlMs must be a non-negative safe integer (got ${String(W.ttlMs)})`);if(W.cacheScope!==void 0&&!G7(W.cacheScope))throw RangeError(`Invalid cache hint for ${Q}: cacheScope must be 'public' or 'private' (got ${String(W.cacheScope)})`)}function bV(W,Q){let X=Q.resultType;if(X===void 0)return{...Q,resultType:"complete"};if(X==="complete")return Q;if(SV.includes(W))return Q;throw new V0(Z0.InternalError,`Handler for ${W} returned resultType '${String(X)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function qV(W,Q){let X=RV(Q);if(Q.resultType!=="complete"||!IV(W))return X===void 0?Q:_V(Q);let Y=Q,G=Y7(Y.ttlMs)?Y.ttlMs:vV(X),B=G7(Y.cacheScope)?Y.cacheScope:yV(X),F={...Y,ttlMs:G,cacheScope:B};return delete F[h9],F}function CV(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function kV(W,Q){if(Q===void 0)return W;let X=W._meta;if(X===void 0)return{...W,_meta:{[V1]:Q}};if(!CV(X))return W;if(X[V1]!==void 0)return W;return{...W,_meta:{...X,[V1]:Q}}}function vV(W){return W!==void 0&&Y7(W.ttlMs)?W.ttlMs:TV}function yV(W){return W!==void 0&&G7(W.cacheScope)?W.cacheScope:PV}function _V(W){let Q={...W};return delete Q[h9],Q}function yK(){if(XX)return XX;let W=k4();return XX={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:F0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},XX}function _K(W){return gV.includes(W)}function pG(W){return _K(W)?yK().request[W]:void 0}function fV(W){return _K(W)?yK().response[W]:void 0}function fK(W){return Object.prototype.hasOwnProperty.call(F7,W)}function xK(W){return Object.prototype.hasOwnProperty.call(gK,W)}function xV(W){return Object.prototype.hasOwnProperty.call(F7,W)}function hV(W){return fK(W)?k4().dispatchRequestSchemas[W]:void 0}function uV(W){return xV(W)?k4().dispatchResultSchemas[W]:void 0}function lV(W){return xK(W)?k4().notificationSchemas2026[W]:void 0}function dW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function cW(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function pV(W,Q){let X=Q,Y=!1,G=()=>{if(!Y)X={...X},Y=!0;return X},B=Q.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>dW(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!dW(L)||!("execution"in L))return L;let z={...L};return delete z.execution,z});let F=Q.capabilities;if(dW(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return X}function dV(){if(YX)return YX;let W=k4();return YX={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},YX}function l9(W){return W!==void 0&&rW(W)?L7:X7}function AK(W){if(W.revision!==void 0)return l9(W.revision).era;return W.era==="modern"?L7.era:X7.era}function dG(W){return hK.some((Q)=>Q.hasRequestMethod(W))}function iG(W){return hK.some((Q)=>Q.hasNotificationMethod(W))}function J7(W){if(W.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${W.params.ref.type}`)}function K7(W){if(W.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${W.params.ref.type}`)}function Z7(W){let Q=[],X=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let z=B;if(NK in z){if(!L||F.length===0)return`${GX(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=z[NK];if(typeof K!=="string"||K.length===0)return`${GX(F)}: x-mcp-header MUST be a non-empty string`;if(!nV.test(K))return`${GX(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let H=typeof z.type==="string"?z.type:void 0;if(H===void 0||!rV.has(H))return`${GX(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${H??"<none>"}`;let D=K.toLowerCase(),I=X.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;X.set(D,K),Q.push({path:F,headerName:K,type:H})}let J=z.properties;if(J!==null&&typeof J==="object")for(let[K,H]of Object.entries(J)){let D=Y(H,[...F,K],L);if(D!==void 0)return D}for(let K of oV){let H=z[K];if(H===void 0)continue;let D=Array.isArray(H)?H:H!==null&&typeof H==="object"&&aV.has(K)?Object.values(H):[H];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:Q}:{valid:!1,reason:G}}function GX(W){return W.length===0?"<root>":W.join(".")}function KX(W,Q){return d4(W,Q)}function pW(W){return new Set(W.flatMap((Q)=>Object.keys(Q.shape)))}function m9(W){if(W==null)return!1;let Q=typeof W;if(Q!=="object"&&Q!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function Y4(W,Q="input"){let X=W["~standard"],Y;if(X.jsonSchema)Y=X.jsonSchema[Q]({target:aG});else if(X.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!VK)VK=!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.");Y=Z4(W,{target:aG,io:Q})}else throw Error(`Schema library "${X.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(Q==="output"){if(Y.type!==void 0)return Y;return cK(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function cK(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let Q of["oneOf","anyOf","allOf"]){let X=W[Q];if(Array.isArray(X)&&X.length>0)return X.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||cK(Y)))}return!1}function tV(W){if(!W.path?.length)return W.message;return`${W.path.map((Q)=>String(typeof Q==="object"?Q.key:Q)).join(".")}: ${W.message}`}async function C4(W,Q){let X=await W["~standard"].validate(Q);if(X.issues&&X.issues.length>0)return{success:!1,error:X.issues.map((Y)=>tV(Y)).join(", ")};return{success:!0,data:X.value}}function eV(W){let Q=Z4(W,{target:aG,io:"input"});return typeof Q.pattern==="string"?Q.pattern:void 0}function Qw(W){let Q=Ww.exec(W),X=[void 0,-1,0];if(Q)X.push(Number(Q[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>X.map((B)=>b1.datetime({local:Y,offset:G,precision:B}))))}function Xw(W,Q){let X;switch(W){case"email":X=[mQ()];break;case"uri":X=[i4()];break;case"date":X=[b1.date()];break;case"date-time":X=Qw(Q);break}return new Set(X.map((Y)=>eV(Y)).filter((Y)=>Y!==void 0))}function Yw(W,Q,X){if(X!=="zod")return!0;return Xw(W,Q).has(Q)}function pK(W){let Q=Y4(W,"input"),X=Q.properties||{},Y=Q.required||[];return Object.entries(X).map(([G,B])=>({name:G,description:B?.description,required:Y.includes(G)}))}function nW(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function Gw(W){try{return Y4(W,"input")}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw new V0(Z0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${X}`)}}function H7(W){return Bw.has(W)||W.startsWith("x-")}function zw(W,Q,X,Y){if(!nW(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(wK,W.type)?wK[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||H7(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!Lw.has(W.format))B[F]=L;else if(typeof L!=="string"||!Yw(W.format,L,X))Y.push(`${Q}.${F}`)}else Y.push(`${Q}.${F}`);return B}function Jw(W,Q){let X={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&nW(B))X[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,zw(L,`properties.${F}`,Q,Y)]));else if(Fw.has(G))X[G]=B;else if(!H7(G))Y.push(G);if(Y.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return X}function Kw(W,Q){if(!nW(W.properties))return Q;let X=Object.entries(W.properties).filter(([,Y])=>!KX(X4,Y).success).map(([Y])=>`properties.${Y}`);return X.length>0?X.join(", "):Q}function sG(W,Q,X=""){if(Array.isArray(W)&&Array.isArray(Q))return W.flatMap((Y,G)=>sG(Y,Q[G],`${X}[${G}]`));if(!nW(W)||!nW(Q))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=X?`${X}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(Q,Y))return H7(Y)?[]:[B];return sG(G,Q[Y],B)})}function Zw(W){if(!m9(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let Q=W.requestedSchema["~standard"].vendor,X=Jw(Gw(W.requestedSchema),Q),Y=KX(s6.shape.requestedSchema,X);if(!Y.success)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Kw(X,Y.error.message)}`);let G=sG(X,Y.data);if(G.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function Hw(W){let Q=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,X=typeof W.requestState==="string";if(!Q&&!X)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function iK(W,Q){return`Multi-round-trip request '${W}' still required input after ${Q} rounds (inputRequired.maxRounds)`}function nK(W,Q){return new Promise((X,Y)=>{if(Q?.aborted){Y(Q.reason instanceof E0?Q.reason:new E0(q0.RequestTimeout,String(Q.reason)));return}let G=setTimeout(()=>{Q?.removeEventListener("abort",B),X()},W),B=()=>{clearTimeout(G),Y(Q?.reason instanceof E0?Q.reason:new E0(q0.RequestTimeout,String(Q?.reason)))};Q?.addEventListener("abort",B,{once:!0})})}function rK(W){let Q=new AbortController,X=()=>Q.abort(W?.reason);if(W?.addEventListener("abort",X,{once:!0}),W?.aborted)Q.abort(W.reason);return{signal:Q.signal,abort:(Y)=>Q.abort(Y),dispose:()=>W?.removeEventListener("abort",X)}}function sK(W,Q){let X=W.slice(0,-6);oK[X]=Q,aK[X]=(Y)=>Q.safeParse(Y).success}function ww(W){switch(W){case"initialize":case"notifications/initialized":return l9(void 0);case"server/discover":return l9(z7);default:return}}function DK(W,Q){let X=W.params;if(!iW(X))return{message:W,lifted:{}};let Y=X._meta,G=iW(Y)?Dw.filter((z)=>(z in Y)):[],B=Q==="request"?Mw.filter((z)=>(z in X)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...X};if(G.length>0&&iW(Y)){let z={},J={...Y};for(let K of G)z[K]=Y[K],delete J[K];if(F.envelope=z,Object.keys(J).length>0)L._meta=J;else delete L._meta}for(let z of B){if(z==="inputResponses")F.inputResponses=L[z];if(z==="requestState")F.requestState=L[z];delete L[z]}return{message:{...W,params:L},lifted:F}}function MK(W,Q){let X=W.validateResult(Q,void 0);if(!X.ok&&X.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(Q,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${Q}`}]}}}}}function oW(W){return()=>W}function $7(W,Q){return{...W,mcpReq:{...W.mcpReq,requestState:oW(Q)}}}function iW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function A7(W,Q){let X={...W};for(let Y in Q){let G=Y,B=Q[G];if(B===void 0)continue;let F=X[G];X[G]=iW(F)&&iW(B)?{...F,...B}:B}return X}function jK(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function Ew(W){let Q={},X=[];if(!jK(W))return{accepted:Q,droppedKeys:X};for(let[Y,G]of Object.entries(W)){if(!jK(G)||"method"in G||"result"in G){X.push(Y);continue}Q[Y]=G}return{accepted:Q,droppedKeys:X}}function Iw(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function N7(W){return q5.parse(JSON.parse(W))}function V7(W){return JSON.stringify(W)+`
87
- `}function Pw(W){let Q=[];if(W.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(W.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${W.length})`]};if(W.includes(" "))Q.push("Tool name contains spaces, which may cause parsing issues");if(W.includes(","))Q.push("Tool name contains commas, which may cause parsing issues");if(W.startsWith("-")||W.endsWith("-"))Q.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(W.startsWith(".")||W.endsWith("."))Q.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Tw.test(W)){let X=[...W].filter((Y)=>!/[A-Za-z0-9._-]/.test(Y)).filter((Y,G,B)=>B.indexOf(Y)===G);return Q.push(`Tool name contains invalid characters: ${X.map((Y)=>`"${Y}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Q}}return{isValid:!0,warnings:Q}}function Sw(W,Q){if(Q.length>0){console.warn(`Tool name validation warning for "${W}":`);for(let X of Q)console.warn(` - ${X}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function w7(W){let Q=Pw(W);return Sw(W,Q.warnings),Q.isValid}function bw(W){return typeof W==="object"&&W!==null&&"_zod"in W}function qw(W){return typeof W==="object"&&W!==null&&!("_zod"in W)&&"_def"in W&&typeof W._def?.typeName==="string"}function Cw(W){if(typeof W!=="object"||W===null)return!1;if(m9(W))return!1;let Q=Object.getPrototypeOf(W);if(Q!==Object.prototype&&Q!==null)return!1;return Object.values(W).every((X)=>bw(X))}function ZX(W){if(W===void 0)return;if(Cw(W))return q(W);if(typeof W==="object"&&W!==null&&!m9(W)&&Object.values(W).some((Q)=>qw(Q)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!m9(W))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return W}var nG,LV,q0,E0,zV,KV="2026-07-28",RK,HV,$V,UV,SK,bK,NV,WX,ST,bT,HK,X7,OV,EV,h9,Z0,V0,zX,kK,vK,JX,TV=0,PV="private",SV,gV,XX,F7,gK,qT,CT,mV,cV,L7,YX,z7="2026-07-28",hK,iV,uK=(W)=>m5.safeParse(W).success,lK=(W)=>c5.safeParse(W).success,oG=(W)=>S5.safeParse(W).success,mK=(W)=>b5.safeParse(W).success,k5=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",NK="x-mcp-header",nV,rV,oV,aV,BX=-32020,kT,sV,VK=!1,aG="draft-2020-12",Ww,Bw,Fw,wK,Lw,$w,dK=250,Uw,Aw,oK,aK,Nw,Vw,tK=60000,Dw,Mw,jw,Ow,U7,Rw,vT,Tw;var D7=$0(()=>{HY();cG();n4();nG=Symbol.for("mcp.sdk.errorBrands");LV=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Q){return u9(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return u9(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.errorUri=Y,this.name="OAuthError",tG(this,new.target)}toResponseObject(){let Q={error:this.code,error_description:this.message};if(this.errorUri)Q.error_uri=this.errorUri;return Q}static fromResponse(Q){return new W(Q.error,Q.error_description??Q.error,Q.error_uri)}},q0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),E0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return u9(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return u9(this,W)}constructor(W,Q,X){super(Q);this.code=W,this.data=X,this.name="SdkError",tG(this,new.target)}},zV=class extends E0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,Q,X){super(W,Q,X);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};RK=["task","inputRequests","requestState"];$V=new Set(["const","enum","default","examples"]),UV=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);SK={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},bK={"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},NV={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};ST=Object.keys(SK),bT=Object.keys(bK);HK={ok:!1,reason:"not-in-era"};X7={era:"2025-11-25",hasRequestMethod:qK,hasNotificationMethod:CK,validateRequest:(W,Q)=>QX(DV(W),Q),validateResult:(W,Q)=>QX(wV(W),Q),validateNotification:(W,Q)=>QX(MV(W),Q),hasInputRequestMethod:()=>!1,validateInputRequest:()=>HK,validateInputResponse:()=>HK,samplingResultVariant:(W,Q)=>{let X=TK();return QX(W?X.CreateMessageResultWithToolsSchema:X.CreateMessageResultSchema,Q)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,Q){let X=IK(W),Y=X.structuredContent;if(Y===void 0)return X;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=Q!==void 0&&PK(Q);if(!G&&!B)return X;return{...X,structuredContent:{result:Y}}},decodeResult(W,Q){if(rG(Q)&&"resultType"in Q){let X={...Q};return delete X.resultType,{kind:"complete",result:UK(X)}}return{kind:"complete",result:UK(Q)}},encodeResult(W,Q){if(W!=="tools/list")return Q;let X=Q.tools;if(!Array.isArray(X)||!X.some((Y)=>$K(Y)))return Q;return{...Q,tools:X.map((Y)=>$K(Y)?{...Y,outputSchema:AV(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};EV=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];h9=Symbol("modelcontextprotocol.resultCacheHintFallback");Z0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),V0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](Q){return u9(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return u9(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.data=Y,this.name="ProtocolError",tG(this,new.target)}static fromError(Q,X,Y){if(Q===Z0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new kK(G.elicitations,X)}if(Q===Z0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new vK({supported:G.supported,requested:G.requested},X)}if(Q===Z0.InvalidParams||Q===Z0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(Q===Z0.ResourceNotFound||Object.keys(G).length===1))return new zX(G.uri,X)}if(Q===Z0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new JX({requiredCapabilities:G.requiredCapabilities},X)}return new W(Q,X,Y)}},zX=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,Q=`Resource not found: ${W}`){super(Z0.InvalidParams,Q,{uri:W})}get uri(){return this.data.uri}},kK=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,Q=`URL elicitation${W.length>1?"s":""} required`){super(Z0.UrlElicitationRequired,Q,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},vK=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,Q=`Unsupported protocol version: ${W.requested}`){super(Z0.UnsupportedProtocolVersion,Q,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},JX=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,Q=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(Z0.MissingRequiredClientCapability,Q,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},SV=["tools/call","prompts/get","resources/read"];gV=["elicitation/create","sampling/createMessage","roots/list"];F7={"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},gK={"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};qT=Object.keys(F7),CT=Object.keys(gK);mV={ok:!1,reason:"not-in-era"},cV=[n1,q1];L7={era:"2026-07-28",hasRequestMethod:fK,hasNotificationMethod:xK,hasInputRequestMethod:(W)=>pG(W)!==void 0,validateRequest:(W,Q)=>cW(hV(W),Q),validateResult:(W,Q)=>cW(uV(W),Q),validateNotification:(W,Q)=>cW(lV(W),Q),validateInputRequest:(W,Q)=>cW(pG(W),Q),validateInputResponse:(W,Q)=>cW(fV(W),Q),samplingResultVariant:()=>mV,outboundEnvelope(W){return{[n1]:W.protocolVersion,[v6]:W.clientInfo,[q1]:W.clientCapabilities,...W.logLevel!==void 0&&{[r1]:W.logLevel}}},validateEnvelopeMeta(W){let Q=[];for(let Y of cV)if(!(Y in W))Q.push({key:Y,problem:"missing"});let X=k4().RequestMetaEnvelopeSchema.safeParse(W);if(!X.success)for(let Y of X.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&Q.some((F)=>F.key===B&&F.problem==="missing"))continue;Q.push({key:B,problem:Y.message})}return Q},projectCallToolResult:(W)=>IK(W),inputRequestSchema:pG,decodeResult(W,Q){if(!dW(Q))return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let X=Q.resultType;if(X===void 0)return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: 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:W,violation:"missing-resultType"})};if(typeof X!=="string")return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:X})};if(X==="input_required"){let F=Q.inputRequests,L=dW(F)?F:{},z=Q.requestState;if(Object.keys(L).length===0&&typeof z!=="string")return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof z==="string"&&{requestState:z}}}if(X!=="complete")return{kind:"invalid",error:new E0(q0.UnsupportedResultType,`Unsupported result type '${X}' for ${W}`,{resultType:X,method:W})};let Y=dV(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(Q);if(!F.success)return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...Q};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,Q,X){return kV(qV(W,bV(W,pV(W,Q))),X)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let Q=k4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!Q.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${Q.error.issues.map((X)=>X.message).join("; ")}`}};hK=[X7,L7],iV=aB({AnnotationsSchema:()=>y6,AudioContentSchema:()=>r5,BaseMetadataSchema:()=>k6,BaseRequestParamsSchema:()=>G1,BlobResourceContentsSchema:()=>I4,BooleanSchemaSchema:()=>a5,CallToolRequestParamsSchema:()=>n8,CallToolRequestSchema:()=>r8,CallToolResultSchema:()=>S4,CancelTaskRequestSchema:()=>vW,CancelTaskResultSchema:()=>yW,CancelledNotificationParamsSchema:()=>s4,CancelledNotificationSchema:()=>w4,ClientCapabilitiesSchema:()=>Q8,ClientNotificationSchema:()=>gW,ClientRequestSchema:()=>_W,ClientResultSchema:()=>fW,ClientTasksCapabilitySchema:()=>e4,CompatibilityCallToolResultSchema:()=>EW,CompleteRequestParamsSchema:()=>j9,CompleteRequestSchema:()=>O9,CompleteResultSchema:()=>E9,ContentBlockSchema:()=>o5,CreateMessageRequestParamsSchema:()=>F9,CreateMessageRequestSchema:()=>L9,CreateMessageResultSchema:()=>z9,CreateMessageResultWithToolsSchema:()=>J9,CreateTaskResultSchema:()=>RW,CursorSchema:()=>U4,DiscoverRequestSchema:()=>F8,DiscoverResultSchema:()=>C5,ElicitRequestFormParamsSchema:()=>s6,ElicitRequestParamsSchema:()=>U9,ElicitRequestSchema:()=>A9,ElicitRequestURLParamsSchema:()=>$9,ElicitResultSchema:()=>w9,ElicitationCompleteNotificationParamsSchema:()=>N9,ElicitationCompleteNotificationSchema:()=>V9,EmbeddedResourceSchema:()=>x8,EmptyResultSchema:()=>V4,EnumSchemaSchema:()=>H9,GetPromptRequestParamsSchema:()=>_8,GetPromptRequestSchema:()=>g8,GetPromptResultSchema:()=>l8,GetTaskPayloadRequestSchema:()=>bW,GetTaskPayloadResultSchema:()=>qW,GetTaskRequestSchema:()=>PW,GetTaskResultSchema:()=>SW,IconSchema:()=>t4,IconsSchema:()=>p6,ImageContentSchema:()=>n5,ImplementationSchema:()=>p5,InitializeRequestParamsSchema:()=>X8,InitializeRequestSchema:()=>Y8,InitializeResultSchema:()=>G8,InitializedNotificationSchema:()=>B8,JSONArraySchema:()=>jW,JSONObjectSchema:()=>e0,JSONRPCErrorResponseSchema:()=>b5,JSONRPCMessageSchema:()=>q5,JSONRPCNotificationSchema:()=>c5,JSONRPCRequestSchema:()=>m5,JSONRPCResponseSchema:()=>OW,JSONRPCResultResponseSchema:()=>S5,JSONValueSchema:()=>m6,LegacyTitledEnumSchemaSchema:()=>e5,ListChangedOptionsBaseSchema:()=>b4,ListPromptsRequestSchema:()=>v8,ListPromptsResultSchema:()=>y8,ListResourceTemplatesRequestSchema:()=>$8,ListResourceTemplatesResultSchema:()=>U8,ListResourcesRequestSchema:()=>Z8,ListResourcesResultSchema:()=>H8,ListRootsRequestSchema:()=>R9,ListRootsResultSchema:()=>T9,ListTasksRequestSchema:()=>CW,ListTasksResultSchema:()=>kW,ListToolsRequestSchema:()=>d8,ListToolsResultSchema:()=>i8,LoggingLevelSchema:()=>r6,LoggingMessageNotificationParamsSchema:()=>t8,LoggingMessageNotificationSchema:()=>e8,ModelHintSchema:()=>W9,ModelPreferencesSchema:()=>Q9,MultiSelectEnumSchemaSchema:()=>Z9,NotificationSchema:()=>K1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>a6,PaginatedRequestParamsSchema:()=>J8,PaginatedRequestSchema:()=>d6,PaginatedResultSchema:()=>i6,PingRequestSchema:()=>M4,PrimitiveSchemaDefinitionSchema:()=>X4,ProgressNotificationParamsSchema:()=>z8,ProgressNotificationSchema:()=>j4,ProgressSchema:()=>L8,ProgressTokenSchema:()=>$4,PromptArgumentSchema:()=>C8,PromptListChangedNotificationSchema:()=>m8,PromptMessageSchema:()=>u8,PromptReferenceSchema:()=>M9,PromptSchema:()=>k8,ReadResourceRequestParamsSchema:()=>A8,ReadResourceRequestSchema:()=>N8,ReadResourceResultSchema:()=>V8,RelatedTaskMetadataSchema:()=>a4,RequestIdSchema:()=>c6,RequestMetaSchema:()=>A4,RequestSchema:()=>W1,ResourceContentsSchema:()=>O4,ResourceLinkSchema:()=>h8,ResourceListChangedNotificationSchema:()=>w8,ResourceRequestParamsSchema:()=>d5,ResourceSchema:()=>R4,ResourceTemplateReferenceSchema:()=>D9,ResourceTemplateSchema:()=>K8,ResourceUpdatedNotificationParamsSchema:()=>b8,ResourceUpdatedNotificationSchema:()=>q8,ResultMetaObjectSchema:()=>N4,ResultSchema:()=>Q1,RoleSchema:()=>n6,RootSchema:()=>I9,RootsListChangedNotificationSchema:()=>P9,SamplingContentSchema:()=>G9,SamplingMessageContentBlockSchema:()=>I5,SamplingMessageSchema:()=>B9,ServerCapabilitiesSchema:()=>D4,ServerNotificationSchema:()=>hW,ServerRequestSchema:()=>xW,ServerResultSchema:()=>uW,ServerTasksCapabilitySchema:()=>W8,SetLevelRequestParamsSchema:()=>a8,SetLevelRequestSchema:()=>s8,SingleSelectEnumSchemaSchema:()=>K9,StringSchemaSchema:()=>o6,SubscribeRequestParamsSchema:()=>D8,SubscribeRequestSchema:()=>M8,SubscriptionFilterSchema:()=>T4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>R8,SubscriptionsAcknowledgedNotificationSchema:()=>T8,SubscriptionsListenRequestParamsSchema:()=>E8,SubscriptionsListenRequestSchema:()=>I8,SubscriptionsListenResultMetaSchema:()=>P8,SubscriptionsListenResultSchema:()=>S8,TaskAugmentedRequestParamsSchema:()=>P5,TaskCreationParamsSchema:()=>IW,TaskMetadataSchema:()=>o4,TaskSchema:()=>t6,TaskStatusNotificationParamsSchema:()=>b9,TaskStatusNotificationSchema:()=>TW,TaskStatusSchema:()=>S9,TextContentSchema:()=>i5,TextResourceContentsSchema:()=>E4,TitledMultiSelectEnumSchemaSchema:()=>Q4,TitledSingleSelectEnumSchemaSchema:()=>t5,ToolAnnotationsSchema:()=>c8,ToolChoiceSchema:()=>X9,ToolExecutionSchema:()=>p8,ToolListChangedNotificationSchema:()=>o8,ToolResultContentSchema:()=>Y9,ToolSchema:()=>P4,ToolUseContentSchema:()=>f8,UnsubscribeRequestParamsSchema:()=>j8,UnsubscribeRequestSchema:()=>O8,UntitledMultiSelectEnumSchemaSchema:()=>W4,UntitledSingleSelectEnumSchemaSchema:()=>s5});nV=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,rV=new Set(["string","integer","boolean","number"]);oV=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],aV=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);kT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],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:[Z0.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:[BX,Z0.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:[Z0.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:[Z0.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:[Z0.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:[BX],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:[Z0.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:[BX],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."}],sV={[Z0.ParseError]:400,[Z0.InvalidRequest]:400,[Z0.MethodNotFound]:404,[Z0.UnsupportedProtocolVersion]:400,[Z0.MissingRequiredClientCapability]:400,[BX]:400};Ww=/\\\.\\d\{(\d+)\}/;Bw=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);Fw=new Set(["$schema",...Object.keys(s6.shape.requestedSchema.shape)]),wK={string:pW([o6,s5,t5,e5]),number:pW([a6]),integer:pW([a6]),boolean:pW([a5]),array:pW([W4,Q4])},Lw=new Set(o6.shape.format.unwrap().options);$w=Object.assign(Hw,{elicit(W){try{return{method:"elicitation/create",params:Zw(W)}}catch(Q){throw Q instanceof V0?TypeError(Q.message,{cause:Q}):Q}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});Uw=["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"],Aw={IdJagTokenExchangeResponseSchema:y9,OAuthClientInformationFullSchema:x9,OAuthClientInformationSchema:f9,OAuthClientMetadataSchema:g9,OAuthClientRegistrationErrorSchema:lW,OAuthErrorResponseSchema:_9,OAuthMetadataSchema:q4,OAuthProtectedResourceMetadataSchema:q9,OAuthTokenRevocationRequestSchema:mW,OAuthTokensSchema:v9,OpenIdProviderDiscoveryMetadataSchema:k9,OpenIdProviderMetadataSchema:C9},oK={},aK={};for(let W of Uw)sK(W,iV[W]);for(let[W,Q]of Object.entries(Aw))sK(W,Q);Nw=Object.freeze(oK),Vw=Object.freeze(aK);Dw=[n1,v6,q1,r1],Mw=["inputResponses","requestState"];jw=oW(void 0);U7=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{Ow=(W,Q)=>{W._negotiatedProtocolVersion=Q}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??H4,this.setNotificationHandler("notifications/cancelled",(Q)=>{this._oncancel(Q)}),this.setNotificationHandler("notifications/progress",(Q)=>{this._onprogress(Q)}),this.setRequestHandler("ping",(Q)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let Q=this._outboundMetaEnvelope();if(Q===void 0)return W;let X=W.params??{};return{...W,params:{...X,_meta:{...Q,...X._meta}}}}_resolveNonCompleteResult(W,Q){return Promise.reject(new E0(q0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${Q.request.method}`,{resultType:W.kind,method:Q.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,Q,X,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let Q=this._timeoutInfo.get(W);if(!Q)return!1;let X=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&X>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(W),new E0(q0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:X});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(W){let Q=this._timeoutInfo.get(W);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let Q=this.transport?.onclose;this._transport.onclose=()=>{try{Q?.()}finally{this._onclose()}};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),oG(G)||mK(G))this._onresponse(G);else if(uK(G))this._onrequest(G,B);else if(lK(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let Q=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let X=new E0(q0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(X);for(let Y of Q.values())Y.abort(X)}}_onerror(W){this.onerror?.(W)}_onnotification(W,Q){let{message:X}=DK(W,"notification"),Y=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(Q?.classification!==void 0){let F=AK(Q.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${X.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(iG(X.method)&&!Y.hasNotificationMethod(X.method))return;let G=this._notificationHandlers.get(X.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(X):G(X,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,Q){let{message:X,lifted:Y}=DK(W,"request"),G=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,Z)=>{let V={jsonrpc:"2.0",id:X.id,error:{code:M,message:N,...Z!==void 0&&{data:Z}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(Q?.classification!==void 0){let M=AK(Q.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${X.method}': classified as ${M} but this instance serves ${G.era}`));let N=Q.classification.revision??M;F(Z0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(dG(X.method)&&!G.hasRequestMethod(X.method)){F(Z0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(X.method)??this.fallbackRequestHandler;if(L===void 0){F(Z0.MethodNotFound,"Method not found");return}let z=G.checkInboundEnvelope(Y);if(z!==void 0){F(Z0.InvalidParams,z);return}let J=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:X.id}),K=(M,N,Z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...Z,relatedRequestId:X.id}),H=new AbortController;this._requestHandlerAbortControllers.set(X.id,H);let D=Y.inputResponses===void 0?void 0:Ew(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:X.id,method:X.method,_meta:X.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?jw:oW(Y.requestState),signal:H.signal,send:(M,N,Z)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),m9(N))return K(M,N,Z);let U=MK(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:J},http:Q?.authInfo?{authInfo:Q.authInfo}:void 0},A=this.buildContext(I,Q);Promise.resolve().then(()=>L(X,A)).then(async(M)=>{if(H.signal.aborted)return;let N;try{N=G.encodeResult(X.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${X.method}: ${V}`)),F(Z0.InternalError,"Internal error");return}let Z={result:N,jsonrpc:"2.0",id:X.id};await B?.send(Z)},async(M)=>{if(H.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:Z0.InternalError,Z={jsonrpc:"2.0",id:X.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send(Z)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(X.id)===H)this._requestHandlerAbortControllers.delete(X.id)})}_onprogress(W){let{progressToken:Q,...X}=W.params,Y=Number(Q),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(X)}_onresponse(W){let Q=Number(W.id),X=this._responseHandlers.get(Q);if(X===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(Q),this._cleanupTimeout(Q),this._progressHandlers.delete(Q),oG(W))X(W);else X(V0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,Q,X){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),m9(Q))return this._requestWithSchemaViaCodec(Y,W,Q,X);let G=MK(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,Q)}_negotiatedWireCodec(){return l9(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let Q=ww(W);if(Q)return Q}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,Q){if(dG(Q)&&!W.hasRequestMethod(Q))throw new E0(q0.MethodNotSupportedByProtocolVersion,`Method '${Q}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q,era:W.era})}_requestWithSchema(W,Q,X){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,Q,X)}_requestWithSchemaViaCodec(W,Q,X,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},z=Date.now(),J,K;return new Promise((H,D)=>{let I=(O)=>{D(O)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(Q.method)}catch(O){I(O);return}if(Y?.signal?.aborted){let O=Y.signal.reason;throw O instanceof E0?O:new E0(q0.RequestTimeout,String(O))}let A=W.era===z7&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...Q,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...Q.params,_meta:{...Q.params?._meta,progressToken:M}};let Z=this._envelopeOutbound(N),V=!1,U=(O)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(O instanceof E0?O:new E0(q0.RequestTimeout,String(O)))};this._responseHandlers.set(M,(O)=>{if(Y?.signal?.aborted)return;if(V=!0,O instanceof Error)return D(O);let w;try{w=W.decodeResult(Q.method,O.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return H(Iw(w));let k={codec:W,request:Q,resultSchema:X,options:Y,flowStartedAt:z,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:Q.method}:{method:Q.method,params:l},X,_)};return H(this._resolveNonCompleteResult(w,k))}let T=w.result;C4(X,T).then((k)=>{if(k.success)H(k.data);else D(new E0(q0.InvalidResult,`Invalid result for ${Q.method}: ${k.error}`))},D)}),J=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",J,{once:!0});let j=Y?.timeout??tK,R=()=>U(new E0(q0.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout(M,j,Y?.maxTotalTimeout,R,Y?.resetTimeoutOnProgress??!1),this._transport.send(Z,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((O)=>{this._progressHandlers.delete(M),D(O)})}).finally(()=>{if(J)Y?.signal?.removeEventListener("abort",J);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,Q){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,Q)}async _notificationViaCodec(W,Q,X){if(!this._transport)throw new E0(q0.NotConnected,"Not connected");if(iG(Q.method)&&!W.hasNotificationMethod(Q.method))throw new E0(q0.MethodNotSupportedByProtocolVersion,`Notification '${Q.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q.method,era:W.era});this.assertNotificationCapability(Q.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...Q});if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;this._transport?.send(Y,X).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,X)}setRequestHandler(W,Q,X){this.assertRequestHandlerCapability(W);let Y;if(typeof Q==="function"){if(!dG(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new V0(Z0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(Q(L.value,B))}}else if(X)Y=async(G,B)=>{let F=await C4(Q.params,{...G.params});if(!F.success)throw new V0(Z0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return X(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,Q){return Q}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,Q,X){if(typeof Q==="function"){if(!iG(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new V0(Z0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(Q(B.value))});return}if(!X)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await C4(Q.params,{...Y.params});if(!G.success)throw new V0(Z0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await X(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
198
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let F of W.seen.entries()){let L=F[1];if(X===F[0]){B(F);continue}if(W.external){let J=W.external.registry.get(F[0])?.id;if(X!==F[0]&&J){B(F);continue}}if(W.metadataRegistry.get(F[0])?.id){B(F);continue}if(L.cycle){B(F);continue}if(L.count>1){if(W.reused==="ref"){B(F);continue}}}}function IW(W,X){let Q=W.seen.get(X);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(L)=>{let z=W.seen.get(L);if(z.ref===null)return;let J=z.def??z.schema,K={...J},Z=z.ref;if(z.ref=null,Z){Y(Z);let I=W.seen.get(Z),A=I.schema;if(A.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))J.allOf=J.allOf??[],J.allOf.push(A);else Object.assign(J,A);if(Object.assign(J,K),L._zod.parent===Z)for(let N in J){if(N==="$ref"||N==="allOf")continue;if(!(N in K))delete J[N]}if(A.$ref&&I.def)for(let N in J){if(N==="$ref"||N==="allOf")continue;if(N in I.def&&JSON.stringify(J[N])===JSON.stringify(I.def[N]))delete J[N]}}let D=L._zod.parent;if(D&&D!==Z){Y(D);let I=W.seen.get(D);if(I?.schema.$ref){if(J.$ref=I.schema.$ref,I.def)for(let A in J){if(A==="$ref"||A==="allOf")continue;if(A in I.def&&JSON.stringify(J[A])===JSON.stringify(I.def[A]))delete J[A]}}}W.override({zodSchema:L,jsonSchema:J,path:z.path??[]})};for(let L of[...W.seen.entries()].reverse())Y(L[0]);let G={};if(W.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let L=W.external.registry.get(X)?.id;if(!L)throw Error("Schema is missing an `id` property");G.$id=W.external.uri(L)}Object.assign(G,Q.def??Q.schema);let B=W.metadataRegistry.get(X)?.id;if(B!==void 0&&G.id===B)delete G.id;let F=W.external?.defs??{};for(let L of W.seen.entries()){let z=L[1];if(z.def&&z.defId){if(z.def.id===z.defId)delete z.def.id;F[z.defId]=z.def}}if(W.external);else if(Object.keys(F).length>0)if(W.target==="draft-2020-12")G.$defs=F;else G.definitions=F;try{let L=JSON.parse(JSON.stringify(G));return Object.defineProperty(L,"~standard",{value:{...X["~standard"],jsonSchema:{input:OW(X,"input",W.processors),output:OW(X,"output",W.processors)}},enumerable:!1,writable:!1}),L}catch(L){throw Error("Error converting schema to JSON.")}}function b1(W,X){let Q=X??{seen:new Set};if(Q.seen.has(W))return!1;Q.seen.add(W);let Y=W._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return b1(Y.element,Q);if(Y.type==="set")return b1(Y.valueType,Q);if(Y.type==="lazy")return b1(Y.getter(),Q);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return b1(Y.innerType,Q);if(Y.type==="intersection")return b1(Y.left,Q)||b1(Y.right,Q);if(Y.type==="record"||Y.type==="map")return b1(Y.keyType,Q)||b1(Y.valueType,Q);if(Y.type==="pipe"){if(W._zod.traits.has("$ZodCodec"))return!0;return b1(Y.in,Q)||b1(Y.out,Q)}if(Y.type==="object"){for(let G in Y.shape)if(b1(Y.shape[G],Q))return!0;return!1}if(Y.type==="union"){for(let G of Y.options)if(b1(G,Q))return!0;return!1}if(Y.type==="tuple"){for(let G of Y.items)if(b1(G,Q))return!0;if(Y.rest&&b1(Y.rest,Q))return!0;return!1}return!1}var EJ=(W,X={})=>(Q)=>{let Y=jW({...Q,processors:X});return r0(W,Y),EW(Y,W),IW(Y,W)},OW=(W,X,Q={})=>(Y)=>{let{libraryOptions:G,target:B}=Y??{},F=jW({...G??{},target:B,io:X,processors:Q});return r0(W,F),EW(F,W),IW(F,W)};var dX=H0(()=>{tY()});function $4(W,X){if("_idmap"in W){let Y=W,G=jW({...X,processors:IJ}),B={};for(let z of Y._idmap.entries()){let[J,K]=z;r0(K,G)}let F={},L={registry:Y,uri:X?.uri,defs:B};G.external=L;for(let z of Y._idmap.entries()){let[J,K]=z;EW(G,K),F[J]=IW(G,K)}if(Object.keys(B).length>0){let z=G.target==="draft-2020-12"?"$defs":"definitions";F.__shared={[z]:B}}return{schemas:F}}let Q=jW({...X,processors:IJ});return r0(W,Q),EW(Q,W),IW(Q,W)}var jN,HG=(W,X,Q,Y)=>{let G=Q;G.type="string";let{minimum:B,maximum:F,format:L,patterns:z,contentEncoding:J}=W._zod.bag;if(typeof B==="number")G.minLength=B;if(typeof F==="number")G.maxLength=F;if(L){if(G.format=jN[L]??L,G.format==="")delete G.format;if(L==="time")delete G.format}if(J)G.contentEncoding=J;if(z&&z.size>0){let K=[...z];if(K.length===1)G.pattern=K[0].source;else if(K.length>1)G.allOf=[...K.map((Z)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:Z.source}))]}},UG=(W,X,Q,Y)=>{let G=Q,{minimum:B,maximum:F,format:L,multipleOf:z,exclusiveMaximum:J,exclusiveMinimum:K}=W._zod.bag;if(typeof L==="string"&&L.includes("int"))G.type="integer";else G.type="number";let Z=typeof K==="number"&&K>=(B??Number.NEGATIVE_INFINITY),D=typeof J==="number"&&J<=(F??Number.POSITIVE_INFINITY),I=X.target==="draft-04"||X.target==="openapi-3.0";if(Z)if(I)G.minimum=K,G.exclusiveMinimum=!0;else G.exclusiveMinimum=K;else if(typeof B==="number")G.minimum=B;if(D)if(I)G.maximum=J,G.exclusiveMaximum=!0;else G.exclusiveMaximum=J;else if(typeof F==="number")G.maximum=F;if(typeof z==="number")G.multipleOf=z},AG=(W,X,Q,Y)=>{Q.type="boolean"},NG=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},RJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},VG=(W,X,Q,Y)=>{if(X.target==="openapi-3.0")Q.type="string",Q.nullable=!0,Q.enum=[null];else Q.type="null"},TJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},PJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},wG=(W,X,Q,Y)=>{Q.not={}},DG=(W,X,Q,Y)=>{},MG=(W,X,Q,Y)=>{},OG=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},jG=(W,X,Q,Y)=>{let G=W._zod.def,B=$W(G.entries);if(B.every((F)=>typeof F==="number"))Q.type="number";if(B.every((F)=>typeof F==="string"))Q.type="string";Q.enum=B},EG=(W,X,Q,Y)=>{let G=W._zod.def,B=[];for(let F of G.values)if(F===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else B.push(Number(F));else B.push(F);if(B.length===0);else if(B.length===1){let F=B[0];if(Q.type=F===null?"null":typeof F,X.target==="draft-04"||X.target==="openapi-3.0")Q.enum=[F];else Q.const=F}else{if(B.every((F)=>typeof F==="number"))Q.type="number";if(B.every((F)=>typeof F==="string"))Q.type="string";if(B.every((F)=>typeof F==="boolean"))Q.type="boolean";if(B.every((F)=>F===null))Q.type="null";Q.enum=B}},SJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},bJ=(W,X,Q,Y)=>{let G=Q,B=W._zod.pattern;if(!B)throw Error("Pattern not found in template literal");G.type="string",G.pattern=B.source},qJ=(W,X,Q,Y)=>{let G=Q,B={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:L,mime:z}=W._zod.bag;if(F!==void 0)B.minLength=F;if(L!==void 0)B.maxLength=L;if(z)if(z.length===1)B.contentMediaType=z[0],Object.assign(G,B);else Object.assign(G,B),G.anyOf=z.map((J)=>({contentMediaType:J}));else Object.assign(G,B)},CJ=(W,X,Q,Y)=>{Q.type="boolean"},IG=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},kJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},RG=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},vJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},yJ=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},TG=(W,X,Q,Y)=>{let G=Q,B=W._zod.def,{minimum:F,maximum:L}=W._zod.bag;if(typeof F==="number")G.minItems=F;if(typeof L==="number")G.maxItems=L;G.type="array",G.items=r0(B.element,X,{...Y,path:[...Y.path,"items"]})},PG=(W,X,Q,Y)=>{let G=Q,B=W._zod.def;G.type="object",G.properties={};let F=B.shape;for(let J in F)G.properties[J]=r0(F[J],X,{...Y,path:[...Y.path,"properties",J]});let L=new Set(Object.keys(F)),z=new Set([...L].filter((J)=>{let K=B.shape[J]._zod;if(X.io==="input")return K.optin===void 0;else return K.optout===void 0}));if(z.size>0)G.required=Array.from(z);if(B.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!B.catchall){if(X.io==="output")G.additionalProperties=!1}else if(B.catchall)G.additionalProperties=r0(B.catchall,X,{...Y,path:[...Y.path,"additionalProperties"]})},SG=(W,X,Q,Y)=>{let G=W._zod.def,B=G.inclusive===!1,F=G.options.map((L,z)=>r0(L,X,{...Y,path:[...Y.path,B?"oneOf":"anyOf",z]}));if(B)Q.oneOf=F;else Q.anyOf=F},bG=(W,X,Q,Y)=>{let G=W._zod.def,B=r0(G.left,X,{...Y,path:[...Y.path,"allOf",0]}),F=r0(G.right,X,{...Y,path:[...Y.path,"allOf",1]}),L=(J)=>("allOf"in J)&&Object.keys(J).length===1,z=[...L(B)?B.allOf:[B],...L(F)?F.allOf:[F]];Q.allOf=z},qG=(W,X,Q,Y)=>{let G=Q,B=W._zod.def;G.type="array";let F=X.target==="draft-2020-12"?"prefixItems":"items",L=X.target==="draft-2020-12"?"items":X.target==="openapi-3.0"?"items":"additionalItems",z=B.items.map((D,I)=>r0(D,X,{...Y,path:[...Y.path,F,I]})),J=B.rest?r0(B.rest,X,{...Y,path:[...Y.path,L,...X.target==="openapi-3.0"?[B.items.length]:[]]}):null;if(X.target==="draft-2020-12"){if(G.prefixItems=z,J)G.items=J}else if(X.target==="openapi-3.0"){if(G.items={anyOf:z},J)G.items.anyOf.push(J);if(G.minItems=z.length,!J)G.maxItems=z.length}else if(G.items=z,J)G.additionalItems=J;let{minimum:K,maximum:Z}=W._zod.bag;if(typeof K==="number")G.minItems=K;if(typeof Z==="number")G.maxItems=Z},CG=(W,X,Q,Y)=>{let G=Q,B=W._zod.def;G.type="object";let F=B.keyType,z=F._zod.bag?.patterns;if(B.mode==="loose"&&z&&z.size>0){let K=r0(B.valueType,X,{...Y,path:[...Y.path,"patternProperties","*"]});G.patternProperties={};for(let Z of z)G.patternProperties[Z.source]=K}else{if(X.target==="draft-07"||X.target==="draft-2020-12")G.propertyNames=r0(B.keyType,X,{...Y,path:[...Y.path,"propertyNames"]});G.additionalProperties=r0(B.valueType,X,{...Y,path:[...Y.path,"additionalProperties"]})}let J=F._zod.values;if(J){let K=[...J].filter((Z)=>typeof Z==="string"||typeof Z==="number");if(K.length>0)G.required=K}},kG=(W,X,Q,Y)=>{let G=W._zod.def,B=r0(G.innerType,X,Y),F=X.seen.get(W);if(X.target==="openapi-3.0")F.ref=G.innerType,Q.nullable=!0;else Q.anyOf=[B,{type:"null"}]},vG=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType},yG=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType,Q.default=JSON.parse(JSON.stringify(G.defaultValue))},_G=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);if(B.ref=G.innerType,X.io==="input")Q._prefault=JSON.parse(JSON.stringify(G.defaultValue))},gG=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType;let F;try{F=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Q.default=F},fG=(W,X,Q,Y)=>{let G=W._zod.def,B=G.in._zod.traits.has("$ZodTransform"),F=X.io==="input"?B?G.out:G.in:G.out;r0(F,X,Y);let L=X.seen.get(W);L.ref=F},xG=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType,Q.readOnly=!0},_J=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType},iX=(W,X,Q,Y)=>{let G=W._zod.def;r0(G.innerType,X,Y);let B=X.seen.get(W);B.ref=G.innerType},hG=(W,X,Q,Y)=>{let G=W._zod.innerType;r0(G,X,Y);let B=X.seen.get(W);B.ref=G},IJ;var uG=H0(()=>{dX();b6();jN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},IJ={string:HG,number:UG,boolean:AG,bigint:NG,symbol:RJ,null:VG,undefined:TJ,void:PJ,never:wG,any:DG,unknown:MG,date:OG,enum:jG,literal:EG,nan:SJ,template_literal:bJ,file:qJ,success:CJ,custom:IG,function:kJ,transform:RG,map:vJ,set:yJ,array:TG,object:PG,union:SG,intersection:bG,tuple:qG,record:CG,nullable:kG,nonoptional:vG,default:yG,prefault:_G,catch:gG,pipe:fG,readonly:xG,promise:_J,optional:iX,lazy:hG}});var gJ=()=>{};var W6=H0(()=>{b6();xX();sY();gJ();K4();xY();fY();Cz();hX();pY();tY();jJ();dX()});var lG=H0(()=>{W6()});var q1={};L4(q1,{time:()=>pG,duration:()=>dG,datetime:()=>mG,date:()=>cG,ZodISOTime:()=>hJ,ZodISODuration:()=>uJ,ZodISODateTime:()=>fJ,ZodISODate:()=>xJ});function mG(W){return GJ(fJ,W)}function cG(W){return BJ(xJ,W)}function pG(W){return FJ(hJ,W)}function dG(W){return LJ(uJ,W)}var fJ,xJ,hJ,uJ;var iG=H0(()=>{W6();nX();fJ=i("ZodISODateTime",(W,X)=>{cL.init(W,X),t0.init(W,X)});xJ=i("ZodISODate",(W,X)=>{pL.init(W,X),t0.init(W,X)});hJ=i("ZodISOTime",(W,X)=>{dL.init(W,X),t0.init(W,X)});uJ=i("ZodISODuration",(W,X)=>{iL.init(W,X),t0.init(W,X)})});var bN=(W,X)=>{yX.init(W,X),W.name="ZodError",Object.defineProperties(W,{format:{value:(Q)=>gY(W,Q)},flatten:{value:(Q)=>_Y(W,Q)},addIssue:{value:(Q)=>{W.issues.push(Q),W.message=JSON.stringify(W.issues,u4,2)}},addIssues:{value:(Q)=>{W.issues.push(...Q),W.message=JSON.stringify(W.issues,u4,2)}},isEmpty:{get(){return W.issues.length===0}}})},n1;var nG=H0(()=>{W6();W6();b6();n1=i("ZodError",bN,{Parent:Error})});var mJ,cJ,n4,pJ,dJ,iJ,nJ,rJ,oJ,aJ,sJ,tJ;var rG=H0(()=>{W6();nG();mJ=_X(n1),cJ=gX(n1),n4=NW(n1),pJ=VW(n1),dJ=EF(n1),iJ=IF(n1),nJ=RF(n1),rJ=TF(n1),oJ=PF(n1),aJ=SF(n1),sJ=bF(n1),tJ=qF(n1)});function RW(W,X,Q){let Y=Object.getPrototypeOf(W),G=eJ.get(Y);if(!G)G=new Set,eJ.set(Y,G);if(G.has(X))return;G.add(X);for(let B in Q){let F=Q[B];Object.defineProperty(Y,B,{configurable:!0,enumerable:!1,get(){let L=F.bind(this);return Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L}),L},set(L){Object.defineProperty(this,B,{configurable:!0,writable:!0,enumerable:!0,value:L})}})}}function H(W){return fz(aG,W)}function oX(W){return eY(FK,W)}function r4(W){return XG(LK,W)}function m(W){return zJ(aX,W)}function XK(W){return KJ(iN,W)}function o(W){return ZJ(sG,W)}function C6(W){return UJ(nN,W)}function JK(){return AJ(rN)}function Y0(){return NJ(oN)}function sN(W){return VJ(aN,W)}function f(W,X){return DJ(tN,W,X)}function q(W,X){let Q={type:"object",shape:W??{},..._0.normalizeParams(X)};return new ZK(Q)}function F0(W,X){return new ZK({type:"object",shape:W,catchall:Y0(),..._0.normalizeParams(X)})}function a(W,X){return new $K({type:"union",options:W,..._0.normalizeParams(X)})}function E5(W,X,Q){return new eN({type:"union",options:X,discriminator:W,..._0.normalizeParams(Q)})}function v1(W,X){return new WV({type:"intersection",left:W,right:X})}function HK(W,X,Q){let Y=X instanceof l0,G=Y?Q:X;return new XV({type:"tuple",items:W,rest:Y?X:null,..._0.normalizeParams(G)})}function n(W,X,Q){if(!X||!X._zod)return new QK({type:"record",keyType:H(),valueType:W,..._0.normalizeParams(X)});return new QK({type:"record",keyType:W,valueType:X,..._0.normalizeParams(Q)})}function J0(W,X){let Q=Array.isArray(W)?Object.fromEntries(W.map((Y)=>[Y,Y])):W;return new oG({type:"enum",entries:Q,..._0.normalizeParams(X)})}function g(W,X){return new QV({type:"literal",values:Array.isArray(W)?W:[W],..._0.normalizeParams(X)})}function UK(W){return new YV({type:"transform",transform:W})}function X0(W){return new AK({type:"optional",innerType:W})}function BV(W){return new GV({type:"optional",innerType:W})}function YK(W){return new FV({type:"nullable",innerType:W})}function zV(W,X){return new LV({type:"default",innerType:W,get defaultValue(){return typeof X==="function"?X():_0.shallowClone(X)}})}function KV(W,X){return new JV({type:"prefault",innerType:W,get defaultValue(){return typeof X==="function"?X():_0.shallowClone(X)}})}function ZV(W,X){return new NK({type:"nonoptional",innerType:W,..._0.normalizeParams(X)})}function HV(W,X){return new $V({type:"catch",innerType:W,catchValue:typeof X==="function"?X:()=>X})}function GK(W,X){return new VK({type:"pipe",in:W,out:X})}function NV(W){return new AV({type:"readonly",innerType:W})}function l5(W){return new VV({type:"lazy",getter:W})}function DV(W,X={}){return MJ(wV,W,X)}function MV(W,X){return OJ(W,X)}function k6(W,X){return new UV({type:"pipe",in:UK(W),out:X})}var eJ,d0,BK,aG,t0,FK,WK,rX,LK,CN,kN,vN,yN,_N,gN,fN,xN,hN,uN,lN,mN,cN,pN,dN,aX,iN,sG,zK,nN,rN,oN,aN,KK,tN,ZK,$K,eN,WV,XV,QK,oG,QV,YV,AK,GV,FV,LV,JV,NK,$V,VK,UV,AV,VV,wV;var nX=H0(()=>{W6();W6();uG();dX();lG();iG();rG();eJ=new WeakMap;d0=i("ZodType",(W,X)=>{return l0.init(W,X),Object.assign(W["~standard"],{jsonSchema:{input:OW(W,"input"),output:OW(W,"output")}}),W.toJSONSchema=EJ(W,{}),W.def=X,W.type=X.type,Object.defineProperty(W,"_def",{value:X}),W.parse=(Q,Y)=>mJ(W,Q,Y,{callee:W.parse}),W.safeParse=(Q,Y)=>n4(W,Q,Y),W.parseAsync=async(Q,Y)=>cJ(W,Q,Y,{callee:W.parseAsync}),W.safeParseAsync=async(Q,Y)=>pJ(W,Q,Y),W.spa=W.safeParseAsync,W.encode=(Q,Y)=>dJ(W,Q,Y),W.decode=(Q,Y)=>iJ(W,Q,Y),W.encodeAsync=async(Q,Y)=>nJ(W,Q,Y),W.decodeAsync=async(Q,Y)=>rJ(W,Q,Y),W.safeEncode=(Q,Y)=>oJ(W,Q,Y),W.safeDecode=(Q,Y)=>aJ(W,Q,Y),W.safeEncodeAsync=async(Q,Y)=>sJ(W,Q,Y),W.safeDecodeAsync=async(Q,Y)=>tJ(W,Q,Y),RW(W,"ZodType",{check(...Q){let Y=this.def;return this.clone(_0.mergeDefs(Y,{checks:[...Y.checks??[],...Q.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},with(...Q){return this.check(...Q)},clone(Q,Y){return t1(this,Q,Y)},brand(){return this},register(Q,Y){return Q.add(this,Y),this},refine(Q,Y){return this.check(DV(Q,Y))},superRefine(Q,Y){return this.check(MV(Q,Y))},overwrite(Q){return this.check(u5(Q))},optional(){return X0(this)},exactOptional(){return BV(this)},nullable(){return YK(this)},nullish(){return X0(YK(this))},nonoptional(Q){return ZV(this,Q)},array(){return f(this)},or(Q){return a([this,Q])},and(Q){return v1(this,Q)},transform(Q){return GK(this,UK(Q))},default(Q){return zV(this,Q)},prefault(Q){return KV(this,Q)},catch(Q){return HV(this,Q)},pipe(Q){return GK(this,Q)},readonly(){return NV(this)},describe(Q){let Y=this.clone();return h5.add(Y,{description:Q}),Y},meta(...Q){if(Q.length===0)return h5.get(this);let Y=this.clone();return h5.add(Y,Q[0]),Y},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Q){return Q(this)}}),Object.defineProperty(W,"description",{get(){return h5.get(W)?.description},configurable:!0}),W}),BK=i("_ZodString",(W,X)=>{mX.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Y,G,B)=>HG(W,Y,G,B);let Q=W._zod.bag;W.format=Q.format??null,W.minLength=Q.minimum??null,W.maxLength=Q.maximum??null,RW(W,"_ZodString",{regex(...Y){return this.check(QG(...Y))},includes(...Y){return this.check(BG(...Y))},startsWith(...Y){return this.check(FG(...Y))},endsWith(...Y){return this.check(LG(...Y))},min(...Y){return this.check(d4(...Y))},max(...Y){return this.check(cX(...Y))},length(...Y){return this.check(pX(...Y))},nonempty(...Y){return this.check(d4(1,...Y))},lowercase(Y){return this.check(YG(Y))},uppercase(Y){return this.check(GG(Y))},trim(){return this.check(JG())},normalize(...Y){return this.check(zG(...Y))},toLowerCase(){return this.check(KG())},toUpperCase(){return this.check(ZG())},slugify(){return this.check($G())}})}),aG=i("ZodString",(W,X)=>{mX.init(W,X),BK.init(W,X),W.email=(Q)=>W.check(eY(FK,Q)),W.url=(Q)=>W.check(XG(LK,Q)),W.jwt=(Q)=>W.check(YJ(dN,Q)),W.emoji=(Q)=>W.check(cz(CN,Q)),W.guid=(Q)=>W.check(WG(WK,Q)),W.uuid=(Q)=>W.check(hz(rX,Q)),W.uuidv4=(Q)=>W.check(uz(rX,Q)),W.uuidv6=(Q)=>W.check(lz(rX,Q)),W.uuidv7=(Q)=>W.check(mz(rX,Q)),W.nanoid=(Q)=>W.check(pz(kN,Q)),W.guid=(Q)=>W.check(WG(WK,Q)),W.cuid=(Q)=>W.check(dz(vN,Q)),W.cuid2=(Q)=>W.check(iz(yN,Q)),W.ulid=(Q)=>W.check(nz(_N,Q)),W.base64=(Q)=>W.check(WJ(mN,Q)),W.base64url=(Q)=>W.check(XJ(cN,Q)),W.xid=(Q)=>W.check(rz(gN,Q)),W.ksuid=(Q)=>W.check(oz(fN,Q)),W.ipv4=(Q)=>W.check(az(xN,Q)),W.ipv6=(Q)=>W.check(sz(hN,Q)),W.cidrv4=(Q)=>W.check(tz(uN,Q)),W.cidrv6=(Q)=>W.check(ez(lN,Q)),W.e164=(Q)=>W.check(QJ(pN,Q)),W.datetime=(Q)=>W.check(mG(Q)),W.date=(Q)=>W.check(cG(Q)),W.time=(Q)=>W.check(pG(Q)),W.duration=(Q)=>W.check(dG(Q))});t0=i("ZodStringFormat",(W,X)=>{s0.init(W,X),BK.init(W,X)}),FK=i("ZodEmail",(W,X)=>{yL.init(W,X),t0.init(W,X)});WK=i("ZodGUID",(W,X)=>{kL.init(W,X),t0.init(W,X)}),rX=i("ZodUUID",(W,X)=>{vL.init(W,X),t0.init(W,X)}),LK=i("ZodURL",(W,X)=>{_L.init(W,X),t0.init(W,X)});CN=i("ZodEmoji",(W,X)=>{gL.init(W,X),t0.init(W,X)}),kN=i("ZodNanoID",(W,X)=>{fL.init(W,X),t0.init(W,X)}),vN=i("ZodCUID",(W,X)=>{xL.init(W,X),t0.init(W,X)}),yN=i("ZodCUID2",(W,X)=>{hL.init(W,X),t0.init(W,X)}),_N=i("ZodULID",(W,X)=>{uL.init(W,X),t0.init(W,X)}),gN=i("ZodXID",(W,X)=>{lL.init(W,X),t0.init(W,X)}),fN=i("ZodKSUID",(W,X)=>{mL.init(W,X),t0.init(W,X)}),xN=i("ZodIPv4",(W,X)=>{nL.init(W,X),t0.init(W,X)}),hN=i("ZodIPv6",(W,X)=>{rL.init(W,X),t0.init(W,X)}),uN=i("ZodCIDRv4",(W,X)=>{oL.init(W,X),t0.init(W,X)}),lN=i("ZodCIDRv6",(W,X)=>{aL.init(W,X),t0.init(W,X)}),mN=i("ZodBase64",(W,X)=>{tL.init(W,X),t0.init(W,X)}),cN=i("ZodBase64URL",(W,X)=>{eL.init(W,X),t0.init(W,X)}),pN=i("ZodE164",(W,X)=>{Wz.init(W,X),t0.init(W,X)}),dN=i("ZodJWT",(W,X)=>{Xz.init(W,X),t0.init(W,X)}),aX=i("ZodNumber",(W,X)=>{iY.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Y,G,B)=>UG(W,Y,G,B),RW(W,"ZodNumber",{gt(Y,G){return this.check(p4(Y,G))},gte(Y,G){return this.check(q6(Y,G))},min(Y,G){return this.check(q6(Y,G))},lt(Y,G){return this.check(c4(Y,G))},lte(Y,G){return this.check(j5(Y,G))},max(Y,G){return this.check(j5(Y,G))},int(Y){return this.check(XK(Y))},safe(Y){return this.check(XK(Y))},positive(Y){return this.check(p4(0,Y))},nonnegative(Y){return this.check(q6(0,Y))},negative(Y){return this.check(c4(0,Y))},nonpositive(Y){return this.check(j5(0,Y))},multipleOf(Y,G){return this.check(MW(Y,G))},step(Y,G){return this.check(MW(Y,G))},finite(){return this}});let Q=W._zod.bag;W.minValue=Math.max(Q.minimum??Number.NEGATIVE_INFINITY,Q.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,W.maxValue=Math.min(Q.maximum??Number.POSITIVE_INFINITY,Q.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,W.isInt=(Q.format??"").includes("int")||Number.isSafeInteger(Q.multipleOf??0.5),W.isFinite=!0,W.format=Q.format??null});iN=i("ZodNumberFormat",(W,X)=>{Qz.init(W,X),aX.init(W,X)});sG=i("ZodBoolean",(W,X)=>{Yz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>AG(W,Q,Y,G)});zK=i("ZodBigInt",(W,X)=>{Gz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Y,G,B)=>NG(W,Y,G,B),W.gte=(Y,G)=>W.check(q6(Y,G)),W.min=(Y,G)=>W.check(q6(Y,G)),W.gt=(Y,G)=>W.check(p4(Y,G)),W.gte=(Y,G)=>W.check(q6(Y,G)),W.min=(Y,G)=>W.check(q6(Y,G)),W.lt=(Y,G)=>W.check(c4(Y,G)),W.lte=(Y,G)=>W.check(j5(Y,G)),W.max=(Y,G)=>W.check(j5(Y,G)),W.positive=(Y)=>W.check(p4(BigInt(0),Y)),W.negative=(Y)=>W.check(c4(BigInt(0),Y)),W.nonpositive=(Y)=>W.check(j5(BigInt(0),Y)),W.nonnegative=(Y)=>W.check(q6(BigInt(0),Y)),W.multipleOf=(Y,G)=>W.check(MW(Y,G));let Q=W._zod.bag;W.minValue=Q.minimum??null,W.maxValue=Q.maximum??null,W.format=Q.format??null}),nN=i("ZodNull",(W,X)=>{Bz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>VG(W,Q,Y,G)});rN=i("ZodAny",(W,X)=>{Fz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>DG(W,Q,Y,G)});oN=i("ZodUnknown",(W,X)=>{Lz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>MG(W,Q,Y,G)});aN=i("ZodNever",(W,X)=>{zz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>wG(W,Q,Y,G)});KK=i("ZodDate",(W,X)=>{Jz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Y,G,B)=>OG(W,Y,G,B),W.min=(Y,G)=>W.check(q6(Y,G)),W.max=(Y,G)=>W.check(j5(Y,G));let Q=W._zod.bag;W.minDate=Q.minimum?new Date(Q.minimum):null,W.maxDate=Q.maximum?new Date(Q.maximum):null}),tN=i("ZodArray",(W,X)=>{Kz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>TG(W,Q,Y,G),W.element=X.element,RW(W,"ZodArray",{min(Q,Y){return this.check(d4(Q,Y))},nonempty(Q){return this.check(d4(1,Q))},max(Q,Y){return this.check(cX(Q,Y))},length(Q,Y){return this.check(pX(Q,Y))},unwrap(){return this.element}})});ZK=i("ZodObject",(W,X)=>{Hz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>PG(W,Q,Y,G),_0.defineLazy(W,"shape",()=>{return X.shape}),RW(W,"ZodObject",{keyof(){return J0(Object.keys(this._zod.def.shape))},catchall(Q){return this.clone({...this._zod.def,catchall:Q})},passthrough(){return this.clone({...this._zod.def,catchall:Y0()})},loose(){return this.clone({...this._zod.def,catchall:Y0()})},strict(){return this.clone({...this._zod.def,catchall:sN()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Q){return _0.extend(this,Q)},safeExtend(Q){return _0.safeExtend(this,Q)},merge(Q){return _0.merge(this,Q)},pick(Q){return _0.pick(this,Q)},omit(Q){return _0.omit(this,Q)},partial(...Q){return _0.partial(AK,this,Q[0])},required(...Q){return _0.required(NK,this,Q[0])}})});$K=i("ZodUnion",(W,X)=>{nY.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>SG(W,Q,Y,G),W.options=X.options});eN=i("ZodDiscriminatedUnion",(W,X)=>{$K.init(W,X),Uz.init(W,X)});WV=i("ZodIntersection",(W,X)=>{Az.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>bG(W,Q,Y,G)});XV=i("ZodTuple",(W,X)=>{Nz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>qG(W,Q,Y,G),W.rest=(Q)=>W.clone({...W._zod.def,rest:Q})});QK=i("ZodRecord",(W,X)=>{Vz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>CG(W,Q,Y,G),W.keyType=X.keyType,W.valueType=X.valueType});oG=i("ZodEnum",(W,X)=>{wz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Y,G,B)=>jG(W,Y,G,B),W.enum=X.entries,W.options=Object.values(X.entries);let Q=new Set(Object.keys(X.entries));W.extract=(Y,G)=>{let B={};for(let F of Y)if(Q.has(F))B[F]=X.entries[F];else throw Error(`Key ${F} not found in enum`);return new oG({...X,checks:[],..._0.normalizeParams(G),entries:B})},W.exclude=(Y,G)=>{let B={...X.entries};for(let F of Y)if(Q.has(F))delete B[F];else throw Error(`Key ${F} not found in enum`);return new oG({...X,checks:[],..._0.normalizeParams(G),entries:B})}});QV=i("ZodLiteral",(W,X)=>{Dz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>EG(W,Q,Y,G),W.values=new Set(X.values),Object.defineProperty(W,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});YV=i("ZodTransform",(W,X)=>{Mz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>RG(W,Q,Y,G),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")throw new KW(W.constructor.name);Q.addIssue=(B)=>{if(typeof B==="string")Q.issues.push(_0.issue(B,Q.value,X));else{let F=B;if(F.fatal)F.continue=!1;F.code??(F.code="custom"),F.input??(F.input=Q.value),F.inst??(F.inst=W),Q.issues.push(_0.issue(F))}};let G=X.transform(Q.value,Q);if(G instanceof Promise)return G.then((B)=>{return Q.value=B,Q.fallback=!0,Q});return Q.value=G,Q.fallback=!0,Q}});AK=i("ZodOptional",(W,X)=>{rY.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>iX(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});GV=i("ZodExactOptional",(W,X)=>{Oz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>iX(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});FV=i("ZodNullable",(W,X)=>{jz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>kG(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});LV=i("ZodDefault",(W,X)=>{Ez.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>yG(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});JV=i("ZodPrefault",(W,X)=>{Iz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>_G(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});NK=i("ZodNonOptional",(W,X)=>{Rz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>vG(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});$V=i("ZodCatch",(W,X)=>{Tz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>gG(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});VK=i("ZodPipe",(W,X)=>{oY.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>fG(W,Q,Y,G),W.in=X.in,W.out=X.out});UV=i("ZodPreprocess",(W,X)=>{VK.init(W,X),Pz.init(W,X)}),AV=i("ZodReadonly",(W,X)=>{Sz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>xG(W,Q,Y,G),W.unwrap=()=>W._zod.def.innerType});VV=i("ZodLazy",(W,X)=>{bz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>hG(W,Q,Y,G),W.unwrap=()=>W._zod.def.getter()});wV=i("ZodCustom",(W,X)=>{qz.init(W,X),d0.init(W,X),W._zod.processJSONSchema=(Q,Y,G)=>IG(W,Q,Y,G)})});var DK,wK;var MK=H0(()=>{DK={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"};(function(W){})(wK||(wK={}))});var sX={};L4(sX,{string:()=>OV,number:()=>jV,date:()=>RV,boolean:()=>EV,bigint:()=>IV});function OV(W){return xz(aG,W)}function jV(W){return JJ(aX,W)}function EV(W){return $J(sG,W)}function IV(W){return HJ(zK,W)}function RV(W){return wJ(KK,W)}var OK=H0(()=>{W6();nX()});var jK=H0(()=>{W6();W6();kz();W6();uG();sY();iG();OK();nX();lG();nG();rG();MK();k1(aY())});var EK=H0(()=>{jK()});var o4=H0(()=>{EK()});var R5="2025-11-25",H4,a4="io.modelcontextprotocol/related-task",r1="io.modelcontextprotocol/protocolVersion",y6="io.modelcontextprotocol/clientInfo",w1="io.modelcontextprotocol/serverInfo",C1="io.modelcontextprotocol/clientCapabilities",m5="io.modelcontextprotocol/subscriptionId",o1="io.modelcontextprotocol/logLevel",T5="2.0",m6,e0,PW,U4,A4,s4,t4,N4,G1,P5,W1,J1,K1,V4,X1,c6,c5,p5,S5,b5,q5,SW,w4,e4,D4,W8,p6,v6,d5,TV,PV,X8,Q8,Y8,G8,B8,M4,F8,L8,z8,C5,O4,J8,K8,j4,Z8,d6,i6,E4,I4,eG,R4,n6,_6,T4,$8,H8,U8,A8,N8,i5,V8,w8,D8,M8,O8,j8,E8,I8,P4,R8,T8,P8,S8,b8,q8,C8,k8,v8,y8,_8,g8,f8,x8,n5,r5,o5,h8,u8,l8,a5,m8,c8,p8,d8,i8,S4,n8,r8,b4,bW,o8,a8,s8,q4,r6,t8,e8,W9,X9,Q9,Y9,G9,B9,F9,I5,L9,z9,J9,K9,Z9,s5,o6,a6,t5,e5,W4,$9,X4,Q4,H9,U9,Y4,s6,A9,N9,V9,w9,D9,M9,O9,j9,E9,I9,R9,T9,P9,S9,b9,qW,q9,t6,CW,C9,kW,vW,yW,_W,gW,fW,xW,hW,uW,lW,mW,cW,pW,dW,iW,z1,k9,C4,v9,y9,_9,g9,f9,tG,x9,h9,u9,nW,rW;var IK=H0(()=>{o4();H4=[R5,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],m6=l5(()=>a([H(),m(),o(),C6(),n(H(),m6),f(m6)])),e0=n(H(),m6),PW=f(m6),U4=a([H(),m().int()]),A4=H(),s4=q({ttl:m().optional()}),t4=q({taskId:H()}),N4=F0({progressToken:U4.optional(),[a4]:t4.optional()}),G1=q({_meta:N4.optional()}),P5=G1.extend({task:s4.optional()}),W1=q({method:H(),params:G1.loose().optional()}),J1=q({_meta:N4.optional()}),K1=q({method:H(),params:J1.loose().optional()}),V4=F0({get[w1](){return d5.optional().catch(void 0)}}),X1=F0({_meta:V4.optional()}),c6=a([H(),m().int()]),c5=q({jsonrpc:g(T5),id:c6,...W1.shape}).strict(),p5=q({jsonrpc:g(T5),...K1.shape}).strict(),S5=q({jsonrpc:g(T5),id:c6,result:X1}).strict(),b5=q({jsonrpc:g(T5),id:c6.optional(),error:q({code:m().int(),message:H(),data:Y0().optional()})}).strict(),q5=a([c5,p5,S5,b5]),SW=a([S5,b5]),w4=X1.strict(),e4=J1.extend({requestId:c6.optional(),reason:H().optional()}),D4=K1.extend({method:g("notifications/cancelled"),params:e4}),W8=q({src:H(),mimeType:H().optional(),sizes:f(H()).optional(),theme:J0(["light","dark"]).optional()}),p6=q({icons:f(W8).optional()}),v6=q({name:H(),title:H().optional()}),d5=v6.extend({...v6.shape,...p6.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),TV=v1(q({applyDefaults:o().optional()}),e0),PV=k6((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},v1(q({form:TV.optional(),url:e0.optional()}),e0.optional())),X8=F0({list:e0.optional(),cancel:e0.optional(),requests:F0({sampling:F0({createMessage:e0.optional()}).optional(),elicitation:F0({create:e0.optional()}).optional()}).optional()}),Q8=F0({list:e0.optional(),cancel:e0.optional(),requests:F0({tools:F0({call:e0.optional()}).optional()}).optional()}),Y8=q({experimental:n(H(),e0).optional(),sampling:q({context:e0.optional(),tools:e0.optional()}).optional(),elicitation:PV.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:X8.optional(),extensions:n(H(),e0).optional()}),G8=G1.extend({protocolVersion:H(),capabilities:Y8,clientInfo:d5}),B8=W1.extend({method:g("initialize"),params:G8}),M4=q({experimental:n(H(),e0).optional(),logging:e0.optional(),completions:e0.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:Q8.optional(),extensions:n(H(),e0).optional()}),F8=X1.extend({protocolVersion:H(),capabilities:M4,serverInfo:d5,instructions:H().optional()}),L8=K1.extend({method:g("notifications/initialized"),params:J1.optional()}),z8=W1.extend({method:g("server/discover"),params:G1.optional()}),C5=X1.extend({supportedVersions:f(H()),capabilities:M4,instructions:H().optional()}),O4=W1.extend({method:g("ping"),params:G1.optional()}),J8=q({progress:m(),total:X0(m()),message:X0(H())}),K8=q({...J1.shape,...J8.shape,progressToken:U4}),j4=K1.extend({method:g("notifications/progress"),params:K8}),Z8=G1.extend({cursor:A4.optional()}),d6=W1.extend({params:Z8.optional()}),i6=X1.extend({nextCursor:A4.optional()}),E4=q({uri:H(),mimeType:X0(H()),_meta:n(H(),Y0()).optional()}),I4=E4.extend({text:H()}),eG=H().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),R4=E4.extend({blob:eG}),n6=J0(["user","assistant"]),_6=q({audience:f(n6).optional(),priority:m().min(0).max(1).optional(),lastModified:q1.datetime({offset:!0}).optional()}),T4=q({...v6.shape,...p6.shape,uri:H(),description:X0(H()),mimeType:X0(H()),size:X0(m()),annotations:_6.optional(),_meta:X0(F0({}))}),$8=q({...v6.shape,...p6.shape,uriTemplate:H(),description:X0(H()),mimeType:X0(H()),annotations:_6.optional(),_meta:X0(F0({}))}),H8=d6.extend({method:g("resources/list")}),U8=i6.extend({resources:f(T4)}),A8=d6.extend({method:g("resources/templates/list")}),N8=i6.extend({resourceTemplates:f($8)}),i5=G1.extend({uri:H()}),V8=i5,w8=W1.extend({method:g("resources/read"),params:V8}),D8=X1.extend({contents:f(a([I4,R4]))}),M8=K1.extend({method:g("notifications/resources/list_changed"),params:J1.optional()}),O8=i5,j8=W1.extend({method:g("resources/subscribe"),params:O8}),E8=i5,I8=W1.extend({method:g("resources/unsubscribe"),params:E8}),P4=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f(H()).optional()}),R8=G1.extend({notifications:P4}),T8=W1.extend({method:g("subscriptions/listen"),params:R8}),P8=J1.extend({notifications:P4}),S8=K1.extend({method:g("notifications/subscriptions/acknowledged"),params:P8}),b8=V4.extend({[m5]:c6}),q8=X1.extend({_meta:b8}),C8=J1.extend({uri:H()}),k8=K1.extend({method:g("notifications/resources/updated"),params:C8}),v8=q({name:H(),description:X0(H()),required:X0(o())}),y8=q({...v6.shape,...p6.shape,description:X0(H()),arguments:X0(f(v8)),_meta:X0(F0({}))}),_8=d6.extend({method:g("prompts/list")}),g8=i6.extend({prompts:f(y8)}),f8=G1.extend({name:H(),arguments:n(H(),H()).optional()}),x8=W1.extend({method:g("prompts/get"),params:f8}),n5=q({type:g("text"),text:H(),annotations:_6.optional(),_meta:n(H(),Y0()).optional()}),r5=q({type:g("image"),data:eG,mimeType:H(),annotations:_6.optional(),_meta:n(H(),Y0()).optional()}),o5=q({type:g("audio"),data:eG,mimeType:H(),annotations:_6.optional(),_meta:n(H(),Y0()).optional()}),h8=q({type:g("tool_use"),name:H(),id:H(),input:n(H(),Y0()),_meta:n(H(),Y0()).optional()}),u8=q({type:g("resource"),resource:a([I4,R4]),annotations:_6.optional(),_meta:n(H(),Y0()).optional()}),l8=T4.extend({type:g("resource_link")}),a5=a([n5,r5,o5,l8,u8]),m8=q({role:n6,content:a5}),c8=X1.extend({description:H().optional(),messages:f(m8)}),p8=K1.extend({method:g("notifications/prompts/list_changed"),params:J1.optional()}),d8=q({title:H().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),i8=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),S4=q({...v6.shape,...p6.shape,description:H().optional(),inputSchema:q({type:g("object"),properties:n(H(),m6).optional(),required:f(H()).optional()}).catchall(Y0()),outputSchema:F0({$schema:H().optional()}).optional(),annotations:d8.optional(),execution:i8.optional(),_meta:n(H(),Y0()).optional()}),n8=d6.extend({method:g("tools/list")}),r8=i6.extend({tools:f(S4)}),b4=X1.extend({content:f(a5).default([]),structuredContent:Y0().optional(),isError:o().optional()}),bW=b4.or(X1.extend({toolResult:Y0()})),o8=P5.extend({name:H(),arguments:n(H(),Y0()).optional()}),a8=W1.extend({method:g("tools/call"),params:o8}),s8=K1.extend({method:g("notifications/tools/list_changed"),params:J1.optional()}),q4=q({autoRefresh:o().default(!0),debounceMs:m().int().nonnegative().default(300)}),r6=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),t8=G1.extend({level:r6}),e8=W1.extend({method:g("logging/setLevel"),params:t8}),W9=J1.extend({level:r6,logger:H().optional(),data:Y0()}),X9=K1.extend({method:g("notifications/message"),params:W9}),Q9=q({name:H().optional()}),Y9=q({hints:f(Q9).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),G9=q({mode:J0(["auto","required","none"]).optional()}),B9=q({type:g("tool_result"),toolUseId:H().describe("The unique identifier for the corresponding tool call."),content:f(a5),structuredContent:Y0().optional(),isError:o().optional(),_meta:n(H(),Y0()).optional()}),F9=E5("type",[n5,r5,o5]),I5=E5("type",[n5,r5,o5,h8,B9]),L9=q({role:n6,content:a([I5,f(I5)]),_meta:n(H(),Y0()).optional()}),z9=P5.extend({messages:f(L9),modelPreferences:Y9.optional(),systemPrompt:H().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f(H()).optional(),metadata:e0.optional(),tools:f(S4).optional(),toolChoice:G9.optional()}),J9=W1.extend({method:g("sampling/createMessage"),params:z9}),K9=X1.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens"]).or(H())),role:n6,content:F9}),Z9=X1.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or(H())),role:n6,content:a([I5,f(I5)])}),s5=q({type:g("boolean"),title:H().optional(),description:H().optional(),default:o().optional()}),o6=q({type:g("string"),title:H().optional(),description:H().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:H().optional()}),a6=q({type:J0(["number","integer"]),title:H().optional(),description:H().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),t5=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),default:H().optional()}),e5=q({type:g("string"),title:H().optional(),description:H().optional(),oneOf:f(q({const:H(),title:H()})),default:H().optional()}),W4=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),enumNames:f(H()).optional(),default:H().optional()}),$9=a([t5,e5]),X4=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f(H())}),default:f(H()).optional()}),Q4=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:H(),title:H()}))}),default:f(H()).optional()}),H9=a([X4,Q4]),U9=a([W4,$9,H9]),Y4=a([U9,s5,o6,a6]),s6=P5.extend({mode:g("form").optional(),message:H(),requestedSchema:q({type:g("object"),properties:n(H(),Y4),required:f(H()).optional()}).catchall(Y0())}),A9=P5.extend({mode:g("url"),message:H(),elicitationId:H(),url:H().url()}),N9=a([s6,A9]),V9=W1.extend({method:g("elicitation/create"),params:N9}),w9=J1.extend({elicitationId:H()}),D9=K1.extend({method:g("notifications/elicitation/complete"),params:w9}),M9=X1.extend({action:J0(["accept","decline","cancel"]),content:k6((W)=>W===null?void 0:W,n(H(),a([H(),m(),o(),f(H())])).optional())}),O9=q({type:g("ref/resource"),uri:H()}),j9=q({type:g("ref/prompt"),name:H()}),E9=G1.extend({ref:a([j9,O9]),argument:q({name:H(),value:H()}),context:q({arguments:n(H(),H()).optional()}).optional()}),I9=W1.extend({method:g("completion/complete"),params:E9}),R9=X1.extend({completion:F0({values:f(H()).max(100),total:X0(m().int()),hasMore:X0(o())})}),T9=q({uri:H().startsWith("file://"),name:H().optional(),_meta:n(H(),Y0()).optional()}),P9=W1.extend({method:g("roots/list"),params:G1.optional()}),S9=X1.extend({roots:f(T9)}),b9=K1.extend({method:g("notifications/roots/list_changed"),params:J1.optional()}),qW=F0({ttl:m().optional(),pollInterval:m().optional()}),q9=J0(["working","input_required","completed","failed","cancelled"]),t6=q({taskId:H(),status:q9,ttl:a([m(),C6()]),createdAt:H(),lastUpdatedAt:H(),pollInterval:X0(m()),statusMessage:X0(H())}),CW=X1.extend({task:t6}),C9=J1.merge(t6),kW=K1.extend({method:g("notifications/tasks/status"),params:C9}),vW=W1.extend({method:g("tasks/get"),params:G1.extend({taskId:H()})}),yW=X1.merge(t6),_W=W1.extend({method:g("tasks/result"),params:G1.extend({taskId:H()})}),gW=X1.loose(),fW=d6.extend({method:g("tasks/list")}),xW=i6.extend({tasks:f(t6)}),hW=W1.extend({method:g("tasks/cancel"),params:G1.extend({taskId:H()})}),uW=X1.merge(t6),lW=a([O4,B8,z8,I9,e8,x8,_8,H8,A8,w8,j8,I8,T8,a8,n8]),mW=a([D4,j4,L8,b9]),cW=a([w4,K9,Z9,M9,S9]),pW=a([O4,J9,V9,P9]),dW=a([D4,j4,X9,k8,M8,s8,p8,S8,D9]),iW=a([w4,F8,C5,R9,c8,g8,U8,N8,D8,b4,r8,q8]),z1=r4().superRefine((W,X)=>{if(!URL.canParse(W))return X.addIssue({code:DK.custom,message:"URL must be parseable",fatal:!0}),IY}).refine((W)=>{let X=new URL(W);return X.protocol!=="javascript:"&&X.protocol!=="data:"&&X.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),k9=F0({resource:H().url(),authorization_servers:f(z1).optional(),jwks_uri:H().url().optional(),scopes_supported:f(H()).optional(),bearer_methods_supported:f(H()).optional(),resource_signing_alg_values_supported:f(H()).optional(),resource_name:H().optional(),resource_documentation:H().optional(),resource_policy_uri:H().url().optional(),resource_tos_uri:H().url().optional(),tls_client_certificate_bound_access_tokens:o().optional(),authorization_details_types_supported:f(H()).optional(),dpop_signing_alg_values_supported:f(H()).optional(),dpop_bound_access_tokens_required:o().optional()}),C4=F0({issuer:H(),authorization_endpoint:z1,token_endpoint:z1,registration_endpoint:z1.optional(),scopes_supported:f(H()).optional(),response_types_supported:f(H()),response_modes_supported:f(H()).optional(),grant_types_supported:f(H()).optional(),token_endpoint_auth_methods_supported:f(H()).optional(),token_endpoint_auth_signing_alg_values_supported:f(H()).optional(),service_documentation:z1.optional(),revocation_endpoint:z1.optional(),revocation_endpoint_auth_methods_supported:f(H()).optional(),revocation_endpoint_auth_signing_alg_values_supported:f(H()).optional(),introspection_endpoint:H().optional(),introspection_endpoint_auth_methods_supported:f(H()).optional(),introspection_endpoint_auth_signing_alg_values_supported:f(H()).optional(),code_challenge_methods_supported:f(H()).optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),v9=F0({issuer:H(),authorization_endpoint:z1,token_endpoint:z1,userinfo_endpoint:z1.optional(),jwks_uri:z1,registration_endpoint:z1.optional(),scopes_supported:f(H()).optional(),response_types_supported:f(H()),response_modes_supported:f(H()).optional(),grant_types_supported:f(H()).optional(),acr_values_supported:f(H()).optional(),subject_types_supported:f(H()),id_token_signing_alg_values_supported:f(H()),id_token_encryption_alg_values_supported:f(H()).optional(),id_token_encryption_enc_values_supported:f(H()).optional(),userinfo_signing_alg_values_supported:f(H()).optional(),userinfo_encryption_alg_values_supported:f(H()).optional(),userinfo_encryption_enc_values_supported:f(H()).optional(),request_object_signing_alg_values_supported:f(H()).optional(),request_object_encryption_alg_values_supported:f(H()).optional(),request_object_encryption_enc_values_supported:f(H()).optional(),token_endpoint_auth_methods_supported:f(H()).optional(),token_endpoint_auth_signing_alg_values_supported:f(H()).optional(),display_values_supported:f(H()).optional(),claim_types_supported:f(H()).optional(),claims_supported:f(H()).optional(),service_documentation:H().optional(),claims_locales_supported:f(H()).optional(),ui_locales_supported:f(H()).optional(),claims_parameter_supported:o().optional(),request_parameter_supported:o().optional(),request_uri_parameter_supported:o().optional(),require_request_uri_registration:o().optional(),op_policy_uri:z1.optional(),op_tos_uri:z1.optional(),client_id_metadata_document_supported:o().optional(),authorization_response_iss_parameter_supported:o().optional().catch(void 0)}),y9=q({...v9.shape,...C4.pick({code_challenge_methods_supported:!0}).shape}),_9=q({access_token:H(),id_token:H().optional(),token_type:H(),expires_in:sX.number().optional(),scope:H().optional(),refresh_token:H().optional()}).strip(),g9=q({issued_token_type:g("urn:ietf:params:oauth:token-type:id-jag"),access_token:H(),token_type:H().optional(),expires_in:m().optional(),scope:H().optional()}).strip(),f9=q({error:H(),error_description:H().optional(),error_uri:H().optional()}),tG=z1.optional().or(g("").transform(()=>{return})),x9=q({redirect_uris:f(z1),token_endpoint_auth_method:H().optional(),grant_types:f(H()).optional(),response_types:f(H()).optional(),application_type:H().optional(),client_name:H().optional(),client_uri:z1.optional(),logo_uri:tG,scope:H().optional(),contacts:f(H()).optional(),tos_uri:tG,policy_uri:H().optional(),jwks_uri:z1.optional(),jwks:JK().optional(),software_id:H().optional(),software_version:H().optional(),software_statement:H().optional()}).strip(),h9=q({client_id:H(),client_secret:H().optional(),client_id_issued_at:m().optional(),client_secret_expires_at:m().optional()}).strip(),u9=x9.merge(h9),nW=q({error:H(),error_description:H().optional()}).strip(),rW=q({token:H(),token_type_hint:H().optional()}).strip()});var W7=H0(()=>{IK()});function J7(W,X){let Q=new Set,Y=X;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")Q.add(G);Y=Object.getPrototypeOf(Y)}if(Q.size===0)return;Object.defineProperty(W,G7,{value:Q,enumerable:!1,configurable:!0})}function m9(W,X){try{if(typeof X==="object"&&X!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(X,G7)){let Q=X[G7];if(Q&&typeof Q.has==="function"&&Q.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,X)}function RK(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function qV(W,X,Q){return W==="elicitation"&&X==="form"&&Q.form===void 0&&Q.url===void 0}function gK(W){switch(W.method){case"elicitation/create":if(W.params?.mode==="url")return{elicitation:{url:{}}};return{elicitation:{form:{}}};case"sampling/createMessage":{let X=W.params;if(X!==void 0&&(X.tools!==void 0||X.toolChoice!==void 0))return{sampling:{tools:{}}};return{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function HQ(W,X){let Q={};for(let[Y,G]of Object.entries(W)){if(G===void 0)continue;let B=X===void 0?void 0:X[Y];if(B===void 0){Q[Y]=G;continue}if(RK(G)&&RK(B)){let F={};for(let[L,z]of Object.entries(G))if(z!==void 0&&B[L]===void 0&&!qV(Y,L,B))F[L]=z;if(Object.keys(F).length>0)Q[Y]=F}}return Object.keys(Q).length>0?Q:void 0}function WX(W){return W>=CV}function fK(W){return W.filter((X)=>!WX(X))}function K7(W){return W.filter((X)=>WX(X))}function xK(W){let X=W.structuredContent;if(X===void 0)return W;if(!(typeof X!=="object"||X===null||Array.isArray(X)))return W;if(W.content?.some((Q)=>Q.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(X)}]}}function Z7(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||hK.some((X)=>(X in W)))return W;return{...W,content:[]}}function kV(){let W=l5(()=>a([H(),m(),o(),C6(),n(H(),W),f(W)])),X=n(H(),W),Q=a([H(),m().int()]),Y=H(),G=q({ttl:m().optional()}),B=q({taskId:H()}),F=F0({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),z=L.extend({task:G.optional()}),J=q({method:H(),params:L.loose().optional()}),K=q({_meta:F.optional()}),Z=q({method:H(),params:K.loose().optional()}),D=F0({_meta:F.optional()}),I=a([H(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:H().optional()}),N=Z.extend({method:g("notifications/cancelled"),params:M}),$=q({src:H(),mimeType:H().optional(),sizes:f(H()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f($).optional()}),U=q({name:H(),title:H().optional()}),O=U.extend({...U.shape,...V.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),R=v1(q({applyDefaults:o().optional()}),X),j=k6((h0)=>{if(h0&&typeof h0==="object"&&!Array.isArray(h0)&&Object.keys(h0).length===0)return{form:{}};return h0},v1(q({form:R.optional(),url:X.optional()}),X.optional())),w=F0({list:X.optional(),cancel:X.optional(),requests:F0({sampling:F0({createMessage:X.optional()}).optional(),elicitation:F0({create:X.optional()}).optional()}).optional()}),T=F0({list:X.optional(),cancel:X.optional(),requests:F0({tools:F0({call:X.optional()}).optional()}).optional()}),k=q({experimental:n(H(),X).optional(),sampling:q({context:X.optional(),tools:X.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n(H(),X).optional()}),l=L.extend({protocolVersion:H(),capabilities:k,clientInfo:O}),_=J.extend({method:g("initialize"),params:l}),h=q({experimental:n(H(),X).optional(),logging:X.optional(),completions:X.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n(H(),X).optional()}),d=D.extend({protocolVersion:H(),capabilities:h,serverInfo:O,instructions:H().optional()}),p=Z.extend({method:g("notifications/initialized"),params:K.optional()}),K0=J.extend({method:g("ping"),params:L.optional()}),O0=q({progress:m(),total:X0(m()),message:X0(H())}),w0=q({...K.shape,...O0.shape,progressToken:Q}),S0=Z.extend({method:g("notifications/progress"),params:w0}),$0=L.extend({cursor:Y.optional()}),b=J.extend({params:$0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:H(),mimeType:X0(H()),_meta:n(H(),Y0()).optional()}),E=u.extend({text:H()}),S=H().refine((h0)=>{try{return atob(h0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:S}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:q1.datetime({offset:!0}).optional()}),z0=q({...U.shape,...V.shape,uri:H(),description:X0(H()),mimeType:X0(H()),size:X0(m()),annotations:r.optional(),_meta:X0(F0({}))}),e=q({...U.shape,...V.shape,uriTemplate:H(),description:X0(H()),mimeType:X0(H()),annotations:r.optional(),_meta:X0(F0({}))}),D0=b.extend({method:g("resources/list")}),u0=v.extend({resources:f(z0)}),P=b.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:H()}),s=x,t=J.extend({method:g("resources/read"),params:s}),L0=D.extend({contents:f(a([E,C]))}),T0=Z.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),C0=x,f0=J.extend({method:g("resources/subscribe"),params:C0}),b0=x,j0=J.extend({method:g("resources/unsubscribe"),params:b0}),o0=K.extend({uri:H()}),k0=Z.extend({method:g("notifications/resources/updated"),params:o0}),B1=q({name:H(),description:X0(H()),required:X0(o())}),Q1=q({...U.shape,...V.shape,description:X0(H()),arguments:X0(f(B1)),_meta:X0(F0({}))}),F1=b.extend({method:g("prompts/list")}),Z1=v.extend({prompts:f(Q1)}),$1=L.extend({name:H(),arguments:n(H(),H()).optional()}),D1=J.extend({method:g("prompts/get"),params:$1}),M1=q({type:g("text"),text:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),O1=q({type:g("image"),data:S,mimeType:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),j1=q({type:g("audio"),data:S,mimeType:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),X6=q({type:g("tool_use"),name:H(),id:H(),input:n(H(),Y0()),_meta:n(H(),Y0()).optional()}),H1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),Q6=z0.extend({type:g("resource_link")}),a0=a([M1,O1,j1,Q6,H1]),_1=q({role:c,content:a0}),g1=D.extend({description:H().optional(),messages:f(_1)}),E1=Z.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),Y6=q({title:H().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),f1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),I1=q({...U.shape,...V.shape,description:H().optional(),inputSchema:q({type:g("object"),properties:n(H(),W).optional(),required:f(H()).optional()}).catchall(Y0()),outputSchema:q({type:g("object"),properties:n(H(),W).optional(),required:f(H()).optional()}).catchall(Y0()).optional(),annotations:Y6.optional(),execution:f1.optional(),_meta:n(H(),Y0()).optional()}),x1=b.extend({method:g("tools/list")}),h1=v.extend({tools:f(I1)}),u1=D.extend({content:f(a0),structuredContent:n(H(),Y0()).optional(),isError:o().optional()}),x0=z.extend({name:H(),arguments:n(H(),Y0()).optional()}),G6=J.extend({method:g("tools/call"),params:x0}),X5=Z.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),l1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),B6=L.extend({level:l1}),F6=J.extend({method:g("logging/setLevel"),params:B6}),L6=K.extend({level:l1,logger:H().optional(),data:Y0()}),z6=Z.extend({method:g("notifications/message"),params:L6}),J6=q({name:H().optional()}),K6=q({hints:f(J6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),Z6=q({mode:J0(["auto","required","none"]).optional()}),Q5=q({type:g("tool_result"),toolUseId:H().describe("The unique identifier for the corresponding tool call."),content:f(a0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n(H(),Y0()).optional()}),$6=E5("type",[M1,O1,j1]),U1=E5("type",[M1,O1,j1,X6,Q5]),H6=q({role:c,content:a([U1,f(U1)]),_meta:n(H(),Y0()).optional()}),U6=z.extend({messages:f(H6),modelPreferences:K6.optional(),systemPrompt:H().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f(H()).optional(),metadata:X.optional(),tools:f(I1).optional(),toolChoice:Z6.optional()}),A6=J.extend({method:g("sampling/createMessage"),params:U6}),N6=D.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens"]).or(H())),role:c,content:$6}),V6=D.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or(H())),role:c,content:a([U1,f(U1)])}),w6=q({type:g("boolean"),title:H().optional(),description:H().optional(),default:o().optional()}),D6=q({type:g("string"),title:H().optional(),description:H().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:H().optional()}),M6=q({type:J0(["number","integer"]),title:H().optional(),description:H().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),O6=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),default:H().optional()}),j6=q({type:g("string"),title:H().optional(),description:H().optional(),oneOf:f(q({const:H(),title:H()})),default:H().optional()}),E6=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),enumNames:f(H()).optional(),default:H().optional()}),I6=a([O6,j6]),R1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f(H())}),default:f(H()).optional()}),T1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:H(),title:H()}))}),default:f(H()).optional()}),Y5=a([R1,T1]),G5=a([E6,I6,Y5]),i0=a([G5,w6,D6,M6]),n0=z.extend({mode:g("form").optional(),message:H(),requestedSchema:q({type:g("object"),properties:n(H(),i0),required:f(H()).optional()}).catchall(Y0())}),R6=z.extend({mode:g("url"),message:H(),elicitationId:H(),url:H().url()}),Y1=a([n0,R6]),B5=J.extend({method:g("elicitation/create"),params:Y1}),F5=K.extend({elicitationId:H()}),L5=Z.extend({method:g("notifications/elicitation/complete"),params:F5}),z5=D.extend({action:J0(["accept","decline","cancel"]),content:k6((h0)=>h0===null?void 0:h0,n(H(),a([H(),m(),o(),f(H())])).optional())}),J5=q({type:g("ref/resource"),uri:H()}),K5=q({type:g("ref/prompt"),name:H()}),Z5=L.extend({ref:a([K5,J5]),argument:q({name:H(),value:H()}),context:q({arguments:n(H(),H()).optional()}).optional()}),T6=J.extend({method:g("completion/complete"),params:Z5}),$5=D.extend({completion:F0({values:f(H()).max(100),total:X0(m().int()),hasMore:X0(o())})}),H5=q({uri:H().startsWith("file://"),name:H().optional(),_meta:n(H(),Y0()).optional()}),m1=J.extend({method:g("roots/list"),params:L.optional()}),P6=D.extend({roots:f(H5)}),U5=Z.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),A5=F0({ttl:m().optional(),pollInterval:m().optional()}),N5=J0(["working","input_required","completed","failed","cancelled"]),A1=q({taskId:H(),status:N5,ttl:a([m(),C6()]),createdAt:H(),lastUpdatedAt:H(),pollInterval:X0(m()),statusMessage:X0(H())}),c0=D.extend({task:A1}),V5=K.merge(A1),P1=Z.extend({method:g("notifications/tasks/status"),params:V5}),c1=J.extend({method:g("tasks/get"),params:L.extend({taskId:H()})}),p1=D.merge(A1),d1=J.extend({method:g("tasks/result"),params:L.extend({taskId:H()})}),F4=D.loose(),p0=b.extend({method:g("tasks/list")}),P0=v.extend({tasks:f(A1)}),S1=J.extend({method:g("tasks/cancel"),params:L.extend({taskId:H()})});return{JSONValueSchema:W,JSONObjectSchema:X,ProgressTokenSchema:Q,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:z,RequestSchema:J,NotificationsParamsSchema:K,NotificationSchema:Z,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:$,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:O,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:K0,ProgressSchema:O0,ProgressNotificationParamsSchema:w0,ProgressNotificationSchema:S0,PaginatedRequestParamsSchema:$0,PaginatedRequestSchema:b,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:z0,ResourceTemplateSchema:e,ListResourcesRequestSchema:D0,ListResourcesResultSchema:u0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:L0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:C0,SubscribeRequestSchema:f0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:j0,ResourceUpdatedNotificationParamsSchema:o0,ResourceUpdatedNotificationSchema:k0,PromptArgumentSchema:B1,PromptSchema:Q1,ListPromptsRequestSchema:F1,ListPromptsResultSchema:Z1,GetPromptRequestParamsSchema:$1,GetPromptRequestSchema:D1,TextContentSchema:M1,ImageContentSchema:O1,AudioContentSchema:j1,ToolUseContentSchema:X6,EmbeddedResourceSchema:H1,ResourceLinkSchema:Q6,ContentBlockSchema:a0,PromptMessageSchema:_1,GetPromptResultSchema:g1,PromptListChangedNotificationSchema:E1,ToolAnnotationsSchema:Y6,ToolExecutionSchema:f1,ToolSchema:I1,ListToolsRequestSchema:x1,ListToolsResultSchema:h1,CallToolResultSchema:u1,CallToolRequestParamsSchema:x0,CallToolRequestSchema:G6,ToolListChangedNotificationSchema:X5,LoggingLevelSchema:l1,SetLevelRequestParamsSchema:B6,SetLevelRequestSchema:F6,LoggingMessageNotificationParamsSchema:L6,LoggingMessageNotificationSchema:z6,ModelHintSchema:J6,ModelPreferencesSchema:K6,ToolChoiceSchema:Z6,ToolResultContentSchema:Q5,SamplingContentSchema:$6,SamplingMessageContentBlockSchema:U1,SamplingMessageSchema:H6,CreateMessageRequestParamsSchema:U6,CreateMessageRequestSchema:A6,CreateMessageResultSchema:N6,CreateMessageResultWithToolsSchema:V6,BooleanSchemaSchema:w6,StringSchemaSchema:D6,NumberSchemaSchema:M6,UntitledSingleSelectEnumSchemaSchema:O6,TitledSingleSelectEnumSchemaSchema:j6,LegacyTitledEnumSchemaSchema:E6,SingleSelectEnumSchemaSchema:I6,UntitledMultiSelectEnumSchemaSchema:R1,TitledMultiSelectEnumSchemaSchema:T1,MultiSelectEnumSchemaSchema:Y5,EnumSchemaSchema:G5,PrimitiveSchemaDefinitionSchema:i0,ElicitRequestFormParamsSchema:n0,ElicitRequestURLParamsSchema:R6,ElicitRequestParamsSchema:Y1,ElicitRequestSchema:B5,ElicitationCompleteNotificationParamsSchema:F5,ElicitationCompleteNotificationSchema:L5,ElicitResultSchema:z5,ResourceTemplateReferenceSchema:J5,PromptReferenceSchema:K5,CompleteRequestParamsSchema:Z5,CompleteRequestSchema:T6,CompleteResultSchema:$5,RootSchema:H5,ListRootsRequestSchema:m1,ListRootsResultSchema:P6,RootsListChangedNotificationSchema:U5,TaskCreationParamsSchema:A5,TaskStatusSchema:N5,TaskSchema:A1,CreateTaskResultSchema:c0,TaskStatusNotificationParamsSchema:V5,TaskStatusNotificationSchema:P1,GetTaskRequestSchema:c1,GetTaskResultSchema:p1,GetTaskPayloadRequestSchema:d1,GetTaskPayloadResultSchema:F4,ListTasksRequestSchema:p0,ListTasksResultSchema:P0,CancelTaskRequestSchema:S1,CancelTaskResultSchema:D.merge(A1),ClientRequestSchema:a([K0,_,T6,F6,D1,F1,D0,P,t,f0,j0,G6,x1,c1,d1,p0,S1]),ClientNotificationSchema:a([N,S0,p,U5,P1]),ClientResultSchema:a([A,N6,V6,z5,P6,p1,P0,c0]),ServerRequestSchema:a([K0,A6,B5,m1,c1,d1,p0,S1]),ServerNotificationSchema:a([N,S0,z6,k0,T0,X5,E1,P1,L5]),ServerResultSchema:a([A,d,$5,g1,Z1,u0,y,L0,u1,h1,p1,P0,c0]),CallToolResultWireSchema:Y0().superRefine((h0,FY)=>{if(typeof h0!=="object"||h0===null||Array.isArray(h0)||h0.content!==void 0)return;for(let QW of hK)if(QW in h0){FY.addIssue({code:"custom",message:`content is required when the body carries '${QW}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(Z7).pipe(u1)}}function uK(){return vV??=kV()}function lK(W){return W.type!=="object"}function gV(W){let X=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...X!==void 0&&{$schema:X},type:"object",properties:{result:W},required:["result"]};let Q=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>Q(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=Q(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if(yV.has(F))B[F]=L;else if(_V.has(F))B[F]=Q(L,!0);else B[F]=Q(L,!1);return B};return{...X!==void 0&&{$schema:X},type:"object",properties:{result:Q(W,!1)},required:["result"]}}function $7(){if(LQ)return LQ;let W=uK();return LQ={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},LQ}function pK(W){return Object.prototype.hasOwnProperty.call(mK,W)}function dK(W){return Object.prototype.hasOwnProperty.call(cK,W)}function xV(W){return Object.prototype.hasOwnProperty.call(fV,W)}function hV(W){return xV(W)?$7().resultSchemas[W]:void 0}function uV(W){return pK(W)?$7().requestSchemas[W]:void 0}function lV(W){return dK(W)?$7().notificationSchemas[W]:void 0}function B7(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function zQ(W,X){if(W===void 0)return{ok:!1,reason:"not-in-era"};let Q=W.safeParse(X);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}function PK(W){return B7(W)&&B7(W.outputSchema)&&lK(W.outputSchema)}function SK(W){return W}function mV(){let W=l5(()=>a([H(),m(),o(),C6(),n(H(),W),f(W)])),X=n(H(),W),Q=a([H(),m().int()]),Y=H(),G=a([H(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=H().refine((P0)=>{try{return atob(P0),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=q({ttl:m().optional()}),J=q({taskId:H()}),K=F0({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":J.optional()}),Z=q({_meta:K.optional()}),D=Z.extend({task:z.optional()}),I=q({_meta:K.optional()}),A=q({method:H(),params:I.loose().optional()}),M=q({src:H(),mimeType:H().optional(),sizes:f(H()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),$=q({name:H(),title:H().optional()}),V=$.extend({...$.shape,...N.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),U=v1(q({applyDefaults:o().optional()}),X),O=k6((P0)=>{if(P0&&typeof P0==="object"&&!Array.isArray(P0)&&Object.keys(P0).length===0)return{form:{}};return P0},v1(q({form:U.optional(),url:X.optional()}),X.optional())),R=F0({list:X.optional(),cancel:X.optional(),requests:F0({sampling:F0({createMessage:X.optional()}).optional(),elicitation:F0({create:X.optional()}).optional()}).optional()}),j=F0({list:X.optional(),cancel:X.optional(),requests:F0({tools:F0({call:X.optional()}).optional()}).optional()}),w=q({experimental:n(H(),X).optional(),sampling:q({context:X.optional(),tools:X.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n(H(),X).optional()}),T=q({experimental:n(H(),X).optional(),logging:X.optional(),completions:X.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:j.optional(),extensions:n(H(),X).optional()}),k=q({progress:m(),total:X0(m()),message:X0(H())}),l=q({...I.shape,...k.shape,progressToken:Q}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:H().optional(),data:Y0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:H(),mimeType:X0(H()),_meta:n(H(),Y0()).optional()}),K0=p.extend({text:H()}),O0=p.extend({blob:L}),w0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:q1.datetime({offset:!0}).optional()}),S0=q({...$.shape,...N.shape,uri:H(),description:X0(H()),mimeType:X0(H()),size:X0(m()),annotations:w0.optional(),_meta:X0(F0({}))}),$0=q({...$.shape,...N.shape,uriTemplate:H(),description:X0(H()),mimeType:X0(H()),annotations:w0.optional(),_meta:X0(F0({}))}),b=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:H()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:H(),description:X0(H()),required:X0(o())}),S=q({...$.shape,...N.shape,description:X0(H()),arguments:X0(f(E)),_meta:X0(F0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),r=q({type:g("image"),data:L,mimeType:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),z0=q({type:g("audio"),data:L,mimeType:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),e=q({type:g("tool_use"),name:H(),id:H(),input:n(H(),Y0()),_meta:n(H(),Y0()).optional()}),D0=q({type:g("resource"),resource:a([K0,O0]),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),u0=S0.extend({type:g("resource_link")}),P=a([c,r,z0,u0,D0]),y=q({role:B,content:P}),x=q({title:H().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:H().optional()}),L0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),C0=q({type:g("boolean"),title:H().optional(),description:H().optional(),default:o().optional()}),f0=q({type:g("string"),title:H().optional(),description:H().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:H().optional()}),b0=q({type:J0(["number","integer"]),title:H().optional(),description:H().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j0=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),default:H().optional()}),o0=q({type:g("string"),title:H().optional(),description:H().optional(),oneOf:f(q({const:H(),title:H()})),default:H().optional()}),k0=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),enumNames:f(H()).optional(),default:H().optional()}),B1=a([j0,o0]),Q1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f(H())}),default:f(H()).optional()}),F1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:H(),title:H()}))}),default:f(H()).optional()}),Z1=a([Q1,F1]),$1=a([k0,B1,Z1]),D1=a([$1,C0,f0,b0]),M1=D.extend({mode:g("form").optional(),message:H(),requestedSchema:q({type:g("object"),properties:n(H(),D1),required:f(H()).optional()}).catchall(Y0())}),O1=q({type:g("ref/resource"),uri:H()}),j1=q({type:g("ref/prompt"),name:H()}),X6=q({uri:H().startsWith("file://"),name:H().optional(),_meta:n(H(),Y0()).optional()}),H1=w.shape,Q6=q({experimental:H1.experimental,sampling:H1.sampling,elicitation:H1.elicitation,roots:H1.roots,extensions:H1.extensions}),a0=T.shape,_1=q({experimental:a0.experimental,logging:a0.logging,completions:a0.completions,prompts:a0.prompts,resources:a0.resources,tools:a0.tools,extensions:a0.extensions}),g1=F0({progressToken:Q.optional(),[r1]:H(),[y6]:V.optional(),[C1]:Q6,[o1]:F.optional()}),E1=q({...$.shape,...N.shape,description:H().optional(),inputSchema:F0({$schema:H().optional(),type:g("object")}),outputSchema:F0({$schema:H().optional()}).optional(),annotations:x.optional(),_meta:n(H(),Y0()).optional()}),Y6=q({type:g("tool_result"),toolUseId:H(),content:f(P),structuredContent:Y0().optional(),isError:o().optional(),_meta:n(H(),Y0()).optional()}),f1=a([c,r,z0,e,Y6]),I1=q({role:B,content:a([f1,f(f1)]),_meta:n(H(),Y0()).optional()}),x1=H(),h1=F0({[w1]:V.optional().catch(void 0)}),u1=h1.optional();function x0(P0){return F0({_meta:u1,resultType:x1.default("complete"),...P0})}let G6=x0({}),X5=x0({nextCursor:Y.optional()}),l1=x0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),B6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(E1),nextCursor:Y.optional()}),F6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),L6=x0({description:H().optional(),messages:f(y)}),z6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),J6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f($0),nextCursor:Y.optional()}),K6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,O0]))}),Z6=x0({completion:q({values:f(H()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),Q5=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),$6=x0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f(H()),capabilities:_1,instructions:H().optional()}),U1=q({messages:f(I1),modelPreferences:L0.optional(),systemPrompt:H().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f(H()).optional(),metadata:X.optional(),tools:f(E1).optional(),toolChoice:T0.optional()}),H6=q({method:g("sampling/createMessage"),params:U1}),U6=q({method:g("roots/list"),params:q({_meta:n(H(),Y0()).optional()}).optional()}),A6=q({...I1.shape,model:H(),stopReason:H().optional()}),N6=q({roots:f(X6)}),V6=q({action:J0(["accept","decline","cancel"]),content:n(H(),a([H(),m(),o(),f(H())])).optional()}),w6=q({mode:g("url"),message:H(),url:H().url()}),D6=a([M1,w6]),M6=q({method:g("elicitation/create"),params:D6}),O6=a([H6,U6,M6]),j6=a([A6,N6,V6]),E6=n(H(),O6),I6=n(H(),j6),R1=x0({inputRequests:E6.optional(),requestState:H().optional()}),T1={inputResponses:I6.optional(),requestState:H().optional()},Y5=q({_meta:g1,...T1}),G5=F0({progressToken:Q.optional()});function i0(P0,S1){return q({method:g(P0),params:q({_meta:g1,...S1})})}function n0(P0,S1){return q({method:g(P0),params:q({_meta:G5.optional(),...S1}).optional()})}let R6={name:H(),arguments:n(H(),Y0()).optional(),...T1},Y1={cursor:Y.optional()},B5=i0("tools/call",R6),F5=i0("tools/list",Y1),L5=i0("prompts/list",Y1),z5=i0("prompts/get",{name:H(),arguments:n(H(),H()).optional(),...T1}),J5=i0("resources/list",Y1),K5=i0("resources/templates/list",Y1),Z5=i0("resources/read",{uri:H(),...T1}),T6={ref:a([j1,O1]),argument:q({name:H(),value:H()}),context:q({arguments:n(H(),H()).optional()}).optional()},$5=i0("completion/complete",T6),H5=i0("server/discover",{}),m1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f(H()).optional()}),P6={notifications:m1},U5=i0("subscriptions/listen",P6),A5=h1.extend({"io.modelcontextprotocol/subscriptionId":G}),N5=F0({_meta:A5,resultType:x1.default("complete")}),A1={"tools/call":n0("tools/call",R6),"tools/list":n0("tools/list",Y1),"prompts/get":n0("prompts/get",{name:H(),arguments:n(H(),H()).optional()}),"prompts/list":n0("prompts/list",Y1),"resources/list":n0("resources/list",Y1),"resources/templates/list":n0("resources/templates/list",Y1),"resources/read":n0("resources/read",{uri:H()}),"completion/complete":n0("completion/complete",T6),"server/discover":n0("server/discover",{}),"subscriptions/listen":n0("subscriptions/listen",P6)};function c0(P0){return F0({_meta:u1,...P0})}let V5={"tools/call":c0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),"tools/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(E1),nextCursor:Y.optional()}),"prompts/get":c0({description:H().optional(),messages:f(y)}),"prompts/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),"resources/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),"resources/templates/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f($0),nextCursor:Y.optional()}),"resources/read":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,O0]))}),"completion/complete":c0({completion:q({values:f(H()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":c0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f(H()),capabilities:_1,instructions:H().optional()}),"subscriptions/listen":c0({})},P1=F0({"io.modelcontextprotocol/subscriptionId":G.optional()}),c1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:P1.optional(),notifications:m1})}),p1=q({_meta:P1.optional(),requestId:G,reason:H().optional()}),d1=q({method:g("notifications/cancelled"),params:p1}),F4={"notifications/cancelled":d1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":b,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":c1},p0=(P0)=>q({jsonrpc:g("2.0"),id:a([H(),m().int()]),result:P0}).strict();return{JSONValueSchema:W,JSONObjectSchema:X,ProgressTokenSchema:Q,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:z,RelatedTaskMetadataSchema:J,RequestMetaSchema:K,BaseRequestParamsSchema:Z,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:$,ImplementationSchema:V,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:j,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:T,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:K0,BlobResourceContentsSchema:O0,AnnotationsSchema:w0,ResourceSchema:S0,ResourceTemplateSchema:$0,ResourceListChangedNotificationSchema:b,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:S,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:z0,ToolUseContentSchema:e,EmbeddedResourceSchema:D0,ResourceLinkSchema:u0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:L0,ToolChoiceSchema:T0,BooleanSchemaSchema:C0,StringSchemaSchema:f0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:j0,TitledSingleSelectEnumSchemaSchema:o0,LegacyTitledEnumSchemaSchema:k0,SingleSelectEnumSchemaSchema:B1,UntitledMultiSelectEnumSchemaSchema:Q1,TitledMultiSelectEnumSchemaSchema:F1,MultiSelectEnumSchemaSchema:Z1,EnumSchemaSchema:$1,PrimitiveSchemaDefinitionSchema:D1,ElicitRequestFormParamsSchema:M1,ResourceTemplateReferenceSchema:O1,PromptReferenceSchema:j1,RootSchema:X6,ClientCapabilities2026Schema:Q6,ServerCapabilities2026Schema:_1,RequestMetaEnvelopeSchema:g1,ToolSchema:E1,ToolResultContentSchema:Y6,SamplingMessageContentBlockSchema:f1,SamplingMessageSchema:I1,ResultTypeSchema:x1,ResultMetaSchema:h1,ResultSchema:G6,PaginatedResultSchema:X5,CallToolResultSchema:l1,ListToolsResultSchema:B6,ListPromptsResultSchema:F6,GetPromptResultSchema:L6,ListResourcesResultSchema:z6,ListResourceTemplatesResultSchema:J6,ReadResourceResultSchema:K6,CompleteResultSchema:Z6,CacheableResultSchema:Q5,DiscoverResultSchema:$6,CreateMessageRequestParamsSchema:U1,CreateMessageRequestSchema:H6,ListRootsRequestSchema:U6,CreateMessageResultSchema:A6,ListRootsResultSchema:N6,ElicitResultSchema:V6,ElicitRequestURLParamsSchema:w6,ElicitRequestParamsSchema:D6,ElicitRequestSchema:M6,InputRequestSchema:O6,InputResponseSchema:j6,InputRequestsSchema:E6,InputResponsesSchema:I6,InputRequiredResultSchema:R1,InputResponseRequestParamsSchema:Y5,CallToolRequestSchema:B5,ListToolsRequestSchema:F5,ListPromptsRequestSchema:L5,GetPromptRequestSchema:z5,ListResourcesRequestSchema:J5,ListResourceTemplatesRequestSchema:K5,ReadResourceRequestSchema:Z5,CompleteRequestSchema:$5,DiscoverRequestSchema:H5,SubscriptionFilterSchema:m1,SubscriptionsListenRequestSchema:U5,SubscriptionsListenResultMetaSchema:A5,SubscriptionsListenResultSchema:N5,dispatchRequestSchemas:A1,dispatchResultSchemas:V5,NotificationMetaSchema:P1,SubscriptionsAcknowledgedNotificationSchema:c1,CancelledNotificationParamsSchema:p1,CancelledNotificationSchema:d1,notificationSchemas2026:F4,JSONRPCResultResponseSchema:p0(G6),CallToolResultResponseSchema:p0(a([l1,R1])),ListToolsResultResponseSchema:p0(B6),ListPromptsResultResponseSchema:p0(F6),GetPromptResultResponseSchema:p0(a([L6,R1])),ListResourcesResultResponseSchema:p0(z6),ListResourceTemplatesResultResponseSchema:p0(J6),ReadResourceResultResponseSchema:p0(a([K6,R1])),CompleteResultResponseSchema:p0(Z6),DiscoverResultResponseSchema:p0($6)}}function v4(){return cV??=mV()}function dV(W){return pV.includes(W)}function UQ(W,X){if(X===void 0)return W;let Q=W[l9];if(Q===void 0)return{...W,[l9]:X};let Y={},G=Q.ttlMs??X.ttlMs;if(G!==void 0)Y.ttlMs=G;let B=Q.cacheScope??X.cacheScope;if(B!==void 0)Y.cacheScope=B;return{...W,[l9]:Y}}function iV(W){return W[l9]}function U7(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function A7(W){return W==="public"||W==="private"}function N7(W,X){if(W.ttlMs!==void 0&&!U7(W.ttlMs))throw RangeError(`Invalid cache hint for ${X}: ttlMs must be a non-negative safe integer (got ${String(W.ttlMs)})`);if(W.cacheScope!==void 0&&!A7(W.cacheScope))throw RangeError(`Invalid cache hint for ${X}: cacheScope must be 'public' or 'private' (got ${String(W.cacheScope)})`)}function aV(W,X){let Q=X.resultType;if(Q===void 0)return{...X,resultType:"complete"};if(Q==="complete")return X;if(oV.includes(W))return X;throw new V0(Z0.InternalError,`Handler for ${W} returned resultType '${String(Q)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function sV(W,X){let Q=iV(X);if(X.resultType!=="complete"||!dV(W))return Q===void 0?X:Qw(X);let Y=X,G=U7(Y.ttlMs)?Y.ttlMs:Ww(Q),B=A7(Y.cacheScope)?Y.cacheScope:Xw(Q),F={...Y,ttlMs:G,cacheScope:B};return delete F[l9],F}function tV(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function eV(W,X){if(X===void 0)return W;let Q=W._meta;if(Q===void 0)return{...W,_meta:{[w1]:X}};if(!tV(Q))return W;if(Q[w1]!==void 0)return W;return{...W,_meta:{...Q,[w1]:X}}}function Ww(W){return W!==void 0&&U7(W.ttlMs)?W.ttlMs:nV}function Xw(W){return W!==void 0&&A7(W.cacheScope)?W.cacheScope:rV}function Qw(W){let X={...W};return delete X[l9],X}function rK(){if(JQ)return JQ;let W=v4();return JQ={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:F0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},JQ}function oK(W){return Yw.includes(W)}function X7(W){return oK(W)?rK().request[W]:void 0}function Gw(W){return oK(W)?rK().response[W]:void 0}function sK(W){return Object.prototype.hasOwnProperty.call(V7,W)}function tK(W){return Object.prototype.hasOwnProperty.call(aK,W)}function Bw(W){return Object.prototype.hasOwnProperty.call(V7,W)}function Fw(W){return sK(W)?v4().dispatchRequestSchemas[W]:void 0}function Lw(W){return Bw(W)?v4().dispatchResultSchemas[W]:void 0}function zw(W){return tK(W)?v4().notificationSchemas2026[W]:void 0}function sW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function oW(W,X){if(W===void 0)return{ok:!1,reason:"not-in-era"};let Q=W.safeParse(X);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}function Zw(W,X){let Q=X,Y=!1,G=()=>{if(!Y)Q={...Q},Y=!0;return Q},B=X.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>sW(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!sW(L)||!("execution"in L))return L;let z={...L};return delete z.execution,z});let F=X.capabilities;if(sW(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return Q}function $w(){if(KQ)return KQ;let W=v4();return KQ={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},KQ}function c9(W){return W!==void 0&&WX(W)?w7:H7}function bK(W){if(W.revision!==void 0)return c9(W.revision).era;return W.era==="modern"?w7.era:H7.era}function Q7(W){return eK.some((X)=>X.hasRequestMethod(W))}function Y7(W){return eK.some((X)=>X.hasNotificationMethod(W))}function M7(W){if(W.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${W.params.ref.type}`)}function O7(W){if(W.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${W.params.ref.type}`)}function j7(W){let X=[],Q=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let z=B;if(qK in z){if(!L||F.length===0)return`${ZQ(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=z[qK];if(typeof K!=="string"||K.length===0)return`${ZQ(F)}: x-mcp-header MUST be a non-empty string`;if(!Uw.test(K))return`${ZQ(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let Z=typeof z.type==="string"?z.type:void 0;if(Z===void 0||!Aw.has(Z))return`${ZQ(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${Z??"<none>"}`;let D=K.toLowerCase(),I=Q.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;Q.set(D,K),X.push({path:F,headerName:K,type:Z})}let J=z.properties;if(J!==null&&typeof J==="object")for(let[K,Z]of Object.entries(J)){let D=Y(Z,[...F,K],L);if(D!==void 0)return D}for(let K of Nw){let Z=z[K];if(Z===void 0)continue;let D=Array.isArray(Z)?Z:Z!==null&&typeof Z==="object"&&Vw.has(K)?Object.values(Z):[Z];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:X}:{valid:!1,reason:G}}function ZQ(W){return W.length===0?"<root>":W.join(".")}function VQ(W,X){return n4(W,X)}function aW(W){return new Set(W.flatMap((X)=>Object.keys(X.shape)))}function p9(W){if(W==null)return!1;let X=typeof W;if(X!=="object"&&X!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function G4(W,X="input"){let Q=W["~standard"],Y;if(Q.jsonSchema)Y=Q.jsonSchema[X]({target:L7});else if(Q.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!CK)CK=!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.");Y=$4(W,{target:L7,io:X})}else throw Error(`Schema library "${Q.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(X==="output"){if(Y.type!==void 0)return Y;return YZ(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function YZ(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let X of["oneOf","anyOf","allOf"]){let Q=W[X];if(Array.isArray(Q)&&Q.length>0)return Q.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||YZ(Y)))}return!1}function Dw(W){if(!W.path?.length)return W.message;return`${W.path.map((X)=>String(typeof X==="object"?X.key:X)).join(".")}: ${W.message}`}async function k4(W,X){let Q=await W["~standard"].validate(X);if(Q.issues&&Q.issues.length>0)return{success:!1,error:Q.issues.map((Y)=>Dw(Y)).join(", ")};return{success:!0,data:Q.value}}function Mw(W){let X=$4(W,{target:L7,io:"input"});return typeof X.pattern==="string"?X.pattern:void 0}function jw(W){let X=Ow.exec(W),Q=[void 0,-1,0];if(X)Q.push(Number(X[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>Q.map((B)=>q1.datetime({local:Y,offset:G,precision:B}))))}function Ew(W,X){let Q;switch(W){case"email":Q=[oX()];break;case"uri":Q=[r4()];break;case"date":Q=[q1.date()];break;case"date-time":Q=jw(X);break}return new Set(Q.map((Y)=>Mw(Y)).filter((Y)=>Y!==void 0))}function Iw(W,X,Q){if(Q!=="zod")return!0;return Ew(W,X).has(X)}function GZ(W){let X=G4(W,"input"),Q=X.properties||{},Y=X.required||[];return Object.entries(Q).map(([G,B])=>({name:G,description:B?.description,required:Y.includes(G)}))}function eW(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function Rw(W){try{return G4(W,"input")}catch(X){let Q=X instanceof Error?X.message:String(X);throw new V0(Z0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${Q}`)}}function E7(W){return Tw.has(W)||W.startsWith("x-")}function bw(W,X,Q,Y){if(!eW(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(kK,W.type)?kK[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||E7(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!Sw.has(W.format))B[F]=L;else if(typeof L!=="string"||!Iw(W.format,L,Q))Y.push(`${X}.${F}`)}else Y.push(`${X}.${F}`);return B}function qw(W,X){let Q={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&eW(B))Q[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,bw(L,`properties.${F}`,X,Y)]));else if(Pw.has(G))Q[G]=B;else if(!E7(G))Y.push(G);if(Y.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return Q}function Cw(W,X){if(!eW(W.properties))return X;let Q=Object.entries(W.properties).filter(([,Y])=>!VQ(Y4,Y).success).map(([Y])=>`properties.${Y}`);return Q.length>0?Q.join(", "):X}function z7(W,X,Q=""){if(Array.isArray(W)&&Array.isArray(X))return W.flatMap((Y,G)=>z7(Y,X[G],`${Q}[${G}]`));if(!eW(W)||!eW(X))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=Q?`${Q}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(X,Y))return E7(Y)?[]:[B];return z7(G,X[Y],B)})}function kw(W){if(!p9(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let X=W.requestedSchema["~standard"].vendor,Q=qw(Rw(W.requestedSchema),X),Y=VQ(s6.shape.requestedSchema,Q);if(!Y.success)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Cw(Q,Y.error.message)}`);let G=z7(Q,Y.data);if(G.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new V0(Z0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function vw(W){let X=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,Q=typeof W.requestState==="string";if(!X&&!Q)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function FZ(W,X){return`Multi-round-trip request '${W}' still required input after ${X} rounds (inputRequired.maxRounds)`}function LZ(W,X){return new Promise((Q,Y)=>{if(X?.aborted){Y(X.reason instanceof E0?X.reason:new E0(q0.RequestTimeout,String(X.reason)));return}let G=setTimeout(()=>{X?.removeEventListener("abort",B),Q()},W),B=()=>{clearTimeout(G),Y(X?.reason instanceof E0?X.reason:new E0(q0.RequestTimeout,String(X?.reason)))};X?.addEventListener("abort",B,{once:!0})})}function zZ(W){let X=new AbortController,Q=()=>X.abort(W?.reason);if(W?.addEventListener("abort",Q,{once:!0}),W?.aborted)X.abort(W.reason);return{signal:X.signal,abort:(Y)=>X.abort(Y),dispose:()=>W?.removeEventListener("abort",Q)}}function ZZ(W,X){let Q=W.slice(0,-6);JZ[Q]=X,KZ[Q]=(Y)=>X.safeParse(Y).success}function hw(W){switch(W){case"initialize":case"notifications/initialized":return c9(void 0);case"server/discover":return c9(D7);default:return}}function vK(W,X){let Q=W.params;if(!tW(Q))return{message:W,lifted:{}};let Y=Q._meta,G=tW(Y)?uw.filter((z)=>(z in Y)):[],B=X==="request"?lw.filter((z)=>(z in Q)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...Q};if(G.length>0&&tW(Y)){let z={},J={...Y};for(let K of G)z[K]=Y[K],delete J[K];if(F.envelope=z,Object.keys(J).length>0)L._meta=J;else delete L._meta}for(let z of B){if(z==="inputResponses")F.inputResponses=L[z];if(z==="requestState")F.requestState=L[z];delete L[z]}return{message:{...W,params:L},lifted:F}}function yK(W,X){let Q=W.validateResult(X,void 0);if(!Q.ok&&Q.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(X,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${X}`}]}}}}}function XX(W){return()=>W}function I7(W,X){return{...W,mcpReq:{...W.mcpReq,requestState:XX(X)}}}function tW(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function T7(W,X){let Q={...W};for(let Y in X){let G=Y,B=X[G];if(B===void 0)continue;let F=Q[G];Q[G]=tW(F)&&tW(B)?{...F,...B}:B}return Q}function _K(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function pw(W){let X={},Q=[];if(!_K(W))return{accepted:X,droppedKeys:Q};for(let[Y,G]of Object.entries(W)){if(!_K(G)||"method"in G||"result"in G){Q.push(Y);continue}X[Y]=G}return{accepted:X,droppedKeys:Q}}function dw(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function P7(W){return q5.parse(JSON.parse(W))}function S7(W){return JSON.stringify(W)+`
199
+ `}function rw(W){let X=[];if(W.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(W.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${W.length})`]};if(W.includes(" "))X.push("Tool name contains spaces, which may cause parsing issues");if(W.includes(","))X.push("Tool name contains commas, which may cause parsing issues");if(W.startsWith("-")||W.endsWith("-"))X.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(W.startsWith(".")||W.endsWith("."))X.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!nw.test(W)){let Q=[...W].filter((Y)=>!/[A-Za-z0-9._-]/.test(Y)).filter((Y,G,B)=>B.indexOf(Y)===G);return X.push(`Tool name contains invalid characters: ${Q.map((Y)=>`"${Y}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:X}}return{isValid:!0,warnings:X}}function ow(W,X){if(X.length>0){console.warn(`Tool name validation warning for "${W}":`);for(let Q of X)console.warn(` - ${Q}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function b7(W){let X=rw(W);return ow(W,X.warnings),X.isValid}function aw(W){return typeof W==="object"&&W!==null&&"_zod"in W}function sw(W){return typeof W==="object"&&W!==null&&!("_zod"in W)&&"_def"in W&&typeof W._def?.typeName==="string"}function tw(W){if(typeof W!=="object"||W===null)return!1;if(p9(W))return!1;let X=Object.getPrototypeOf(W);if(X!==Object.prototype&&X!==null)return!1;return Object.values(W).every((Q)=>aw(Q))}function wQ(W){if(W===void 0)return;if(tw(W))return q(W);if(typeof W==="object"&&W!==null&&!p9(W)&&Object.values(W).some((X)=>sw(X)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!p9(W))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return W}var G7,SV,q0,E0,bV,CV="2026-07-28",hK,vV,yV,_V,mK,cK,fV,LQ,oT,aT,TK,H7,cV,pV,l9,Z0,V0,AQ,iK,nK,NQ,nV=0,rV="private",oV,Yw,JQ,V7,aK,sT,tT,Jw,Kw,w7,KQ,D7="2026-07-28",eK,Hw,WZ=(W)=>c5.safeParse(W).success,XZ=(W)=>p5.safeParse(W).success,F7=(W)=>S5.safeParse(W).success,QZ=(W)=>b5.safeParse(W).success,k5=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",qK="x-mcp-header",Uw,Aw,Nw,Vw,$Q=-32020,eT,ww,CK=!1,L7="draft-2020-12",Ow,Tw,Pw,kK,Sw,yw,BZ=250,_w,gw,JZ,KZ,fw,xw,$Z=60000,uw,lw,mw,cw,R7,iw,WP,nw;var q7=H0(()=>{EY();W7();o4();G7=Symbol.for("mcp.sdk.errorBrands");SV=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](X){return m9(this,X)}static isInstance(X){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return m9(this,X)}constructor(X,Q,Y){super(Q);this.code=X,this.errorUri=Y,this.name="OAuthError",J7(this,new.target)}toResponseObject(){let X={error:this.code,error_description:this.message};if(this.errorUri)X.error_uri=this.errorUri;return X}static fromResponse(X){return new W(X.error,X.error_description??X.error,X.error_uri)}},q0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),E0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return m9(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return m9(this,W)}constructor(W,X,Q){super(X);this.code=W,this.data=Q,this.name="SdkError",J7(this,new.target)}},bV=class extends E0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,X,Q){super(W,X,Q);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};hK=["task","inputRequests","requestState"];yV=new Set(["const","enum","default","examples"]),_V=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);mK={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},cK={"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},fV={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};oT=Object.keys(mK),aT=Object.keys(cK);TK={ok:!1,reason:"not-in-era"};H7={era:"2025-11-25",hasRequestMethod:pK,hasNotificationMethod:dK,validateRequest:(W,X)=>zQ(uV(W),X),validateResult:(W,X)=>zQ(hV(W),X),validateNotification:(W,X)=>zQ(lV(W),X),hasInputRequestMethod:()=>!1,validateInputRequest:()=>TK,validateInputResponse:()=>TK,samplingResultVariant:(W,X)=>{let Q=uK();return zQ(W?Q.CreateMessageResultWithToolsSchema:Q.CreateMessageResultSchema,X)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,X){let Q=xK(W),Y=Q.structuredContent;if(Y===void 0)return Q;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=X!==void 0&&lK(X);if(!G&&!B)return Q;return{...Q,structuredContent:{result:Y}}},decodeResult(W,X){if(B7(X)&&"resultType"in X){let Q={...X};return delete Q.resultType,{kind:"complete",result:SK(Q)}}return{kind:"complete",result:SK(X)}},encodeResult(W,X){if(W!=="tools/list")return X;let Q=X.tools;if(!Array.isArray(Q)||!Q.some((Y)=>PK(Y)))return X;return{...X,tools:Q.map((Y)=>PK(Y)?{...Y,outputSchema:gV(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};pV=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];l9=Symbol("modelcontextprotocol.resultCacheHintFallback");Z0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),V0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](X){return m9(this,X)}static isInstance(X){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return m9(this,X)}constructor(X,Q,Y){super(Q);this.code=X,this.data=Y,this.name="ProtocolError",J7(this,new.target)}static fromError(X,Q,Y){if(X===Z0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new iK(G.elicitations,Q)}if(X===Z0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new nK({supported:G.supported,requested:G.requested},Q)}if(X===Z0.InvalidParams||X===Z0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(X===Z0.ResourceNotFound||Object.keys(G).length===1))return new AQ(G.uri,Q)}if(X===Z0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new NQ({requiredCapabilities:G.requiredCapabilities},Q)}return new W(X,Q,Y)}},AQ=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,X=`Resource not found: ${W}`){super(Z0.InvalidParams,X,{uri:W})}get uri(){return this.data.uri}},iK=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,X=`URL elicitation${W.length>1?"s":""} required`){super(Z0.UrlElicitationRequired,X,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},nK=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,X=`Unsupported protocol version: ${W.requested}`){super(Z0.UnsupportedProtocolVersion,X,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},NQ=class extends V0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,X=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(Z0.MissingRequiredClientCapability,X,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},oV=["tools/call","prompts/get","resources/read"];Yw=["elicitation/create","sampling/createMessage","roots/list"];V7={"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},aK={"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};sT=Object.keys(V7),tT=Object.keys(aK);Jw={ok:!1,reason:"not-in-era"},Kw=[r1,C1];w7={era:"2026-07-28",hasRequestMethod:sK,hasNotificationMethod:tK,hasInputRequestMethod:(W)=>X7(W)!==void 0,validateRequest:(W,X)=>oW(Fw(W),X),validateResult:(W,X)=>oW(Lw(W),X),validateNotification:(W,X)=>oW(zw(W),X),validateInputRequest:(W,X)=>oW(X7(W),X),validateInputResponse:(W,X)=>oW(Gw(W),X),samplingResultVariant:()=>Jw,outboundEnvelope(W){return{[r1]:W.protocolVersion,[y6]:W.clientInfo,[C1]:W.clientCapabilities,...W.logLevel!==void 0&&{[o1]:W.logLevel}}},validateEnvelopeMeta(W){let X=[];for(let Y of Kw)if(!(Y in W))X.push({key:Y,problem:"missing"});let Q=v4().RequestMetaEnvelopeSchema.safeParse(W);if(!Q.success)for(let Y of Q.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&X.some((F)=>F.key===B&&F.problem==="missing"))continue;X.push({key:B,problem:Y.message})}return X},projectCallToolResult:(W)=>xK(W),inputRequestSchema:X7,decodeResult(W,X){if(!sW(X))return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let Q=X.resultType;if(Q===void 0)return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: 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:W,violation:"missing-resultType"})};if(typeof Q!=="string")return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:Q})};if(Q==="input_required"){let F=X.inputRequests,L=sW(F)?F:{},z=X.requestState;if(Object.keys(L).length===0&&typeof z!=="string")return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof z==="string"&&{requestState:z}}}if(Q!=="complete")return{kind:"invalid",error:new E0(q0.UnsupportedResultType,`Unsupported result type '${Q}' for ${W}`,{resultType:Q,method:W})};let Y=$w(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(X);if(!F.success)return{kind:"invalid",error:new E0(q0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...X};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,X,Q){return eV(sV(W,aV(W,Zw(W,X))),Q)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let X=v4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!X.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${X.error.issues.map((Q)=>Q.message).join("; ")}`}};eK=[H7,w7],Hw=KF({AnnotationsSchema:()=>_6,AudioContentSchema:()=>o5,BaseMetadataSchema:()=>v6,BaseRequestParamsSchema:()=>G1,BlobResourceContentsSchema:()=>R4,BooleanSchemaSchema:()=>s5,CallToolRequestParamsSchema:()=>o8,CallToolRequestSchema:()=>a8,CallToolResultSchema:()=>b4,CancelTaskRequestSchema:()=>hW,CancelTaskResultSchema:()=>uW,CancelledNotificationParamsSchema:()=>e4,CancelledNotificationSchema:()=>D4,ClientCapabilitiesSchema:()=>Y8,ClientNotificationSchema:()=>mW,ClientRequestSchema:()=>lW,ClientResultSchema:()=>cW,ClientTasksCapabilitySchema:()=>X8,CompatibilityCallToolResultSchema:()=>bW,CompleteRequestParamsSchema:()=>E9,CompleteRequestSchema:()=>I9,CompleteResultSchema:()=>R9,ContentBlockSchema:()=>a5,CreateMessageRequestParamsSchema:()=>z9,CreateMessageRequestSchema:()=>J9,CreateMessageResultSchema:()=>K9,CreateMessageResultWithToolsSchema:()=>Z9,CreateTaskResultSchema:()=>CW,CursorSchema:()=>A4,DiscoverRequestSchema:()=>z8,DiscoverResultSchema:()=>C5,ElicitRequestFormParamsSchema:()=>s6,ElicitRequestParamsSchema:()=>N9,ElicitRequestSchema:()=>V9,ElicitRequestURLParamsSchema:()=>A9,ElicitResultSchema:()=>M9,ElicitationCompleteNotificationParamsSchema:()=>w9,ElicitationCompleteNotificationSchema:()=>D9,EmbeddedResourceSchema:()=>u8,EmptyResultSchema:()=>w4,EnumSchemaSchema:()=>U9,GetPromptRequestParamsSchema:()=>f8,GetPromptRequestSchema:()=>x8,GetPromptResultSchema:()=>c8,GetTaskPayloadRequestSchema:()=>_W,GetTaskPayloadResultSchema:()=>gW,GetTaskRequestSchema:()=>vW,GetTaskResultSchema:()=>yW,IconSchema:()=>W8,IconsSchema:()=>p6,ImageContentSchema:()=>r5,ImplementationSchema:()=>d5,InitializeRequestParamsSchema:()=>G8,InitializeRequestSchema:()=>B8,InitializeResultSchema:()=>F8,InitializedNotificationSchema:()=>L8,JSONArraySchema:()=>PW,JSONObjectSchema:()=>e0,JSONRPCErrorResponseSchema:()=>b5,JSONRPCMessageSchema:()=>q5,JSONRPCNotificationSchema:()=>p5,JSONRPCRequestSchema:()=>c5,JSONRPCResponseSchema:()=>SW,JSONRPCResultResponseSchema:()=>S5,JSONValueSchema:()=>m6,LegacyTitledEnumSchemaSchema:()=>W4,ListChangedOptionsBaseSchema:()=>q4,ListPromptsRequestSchema:()=>_8,ListPromptsResultSchema:()=>g8,ListResourceTemplatesRequestSchema:()=>A8,ListResourceTemplatesResultSchema:()=>N8,ListResourcesRequestSchema:()=>H8,ListResourcesResultSchema:()=>U8,ListRootsRequestSchema:()=>P9,ListRootsResultSchema:()=>S9,ListTasksRequestSchema:()=>fW,ListTasksResultSchema:()=>xW,ListToolsRequestSchema:()=>n8,ListToolsResultSchema:()=>r8,LoggingLevelSchema:()=>r6,LoggingMessageNotificationParamsSchema:()=>W9,LoggingMessageNotificationSchema:()=>X9,ModelHintSchema:()=>Q9,ModelPreferencesSchema:()=>Y9,MultiSelectEnumSchemaSchema:()=>H9,NotificationSchema:()=>K1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>a6,PaginatedRequestParamsSchema:()=>Z8,PaginatedRequestSchema:()=>d6,PaginatedResultSchema:()=>i6,PingRequestSchema:()=>O4,PrimitiveSchemaDefinitionSchema:()=>Y4,ProgressNotificationParamsSchema:()=>K8,ProgressNotificationSchema:()=>j4,ProgressSchema:()=>J8,ProgressTokenSchema:()=>U4,PromptArgumentSchema:()=>v8,PromptListChangedNotificationSchema:()=>p8,PromptMessageSchema:()=>m8,PromptReferenceSchema:()=>j9,PromptSchema:()=>y8,ReadResourceRequestParamsSchema:()=>V8,ReadResourceRequestSchema:()=>w8,ReadResourceResultSchema:()=>D8,RelatedTaskMetadataSchema:()=>t4,RequestIdSchema:()=>c6,RequestMetaSchema:()=>N4,RequestSchema:()=>W1,ResourceContentsSchema:()=>E4,ResourceLinkSchema:()=>l8,ResourceListChangedNotificationSchema:()=>M8,ResourceRequestParamsSchema:()=>i5,ResourceSchema:()=>T4,ResourceTemplateReferenceSchema:()=>O9,ResourceTemplateSchema:()=>$8,ResourceUpdatedNotificationParamsSchema:()=>C8,ResourceUpdatedNotificationSchema:()=>k8,ResultMetaObjectSchema:()=>V4,ResultSchema:()=>X1,RoleSchema:()=>n6,RootSchema:()=>T9,RootsListChangedNotificationSchema:()=>b9,SamplingContentSchema:()=>F9,SamplingMessageContentBlockSchema:()=>I5,SamplingMessageSchema:()=>L9,ServerCapabilitiesSchema:()=>M4,ServerNotificationSchema:()=>dW,ServerRequestSchema:()=>pW,ServerResultSchema:()=>iW,ServerTasksCapabilitySchema:()=>Q8,SetLevelRequestParamsSchema:()=>t8,SetLevelRequestSchema:()=>e8,SingleSelectEnumSchemaSchema:()=>$9,StringSchemaSchema:()=>o6,SubscribeRequestParamsSchema:()=>O8,SubscribeRequestSchema:()=>j8,SubscriptionFilterSchema:()=>P4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>P8,SubscriptionsAcknowledgedNotificationSchema:()=>S8,SubscriptionsListenRequestParamsSchema:()=>R8,SubscriptionsListenRequestSchema:()=>T8,SubscriptionsListenResultMetaSchema:()=>b8,SubscriptionsListenResultSchema:()=>q8,TaskAugmentedRequestParamsSchema:()=>P5,TaskCreationParamsSchema:()=>qW,TaskMetadataSchema:()=>s4,TaskSchema:()=>t6,TaskStatusNotificationParamsSchema:()=>C9,TaskStatusNotificationSchema:()=>kW,TaskStatusSchema:()=>q9,TextContentSchema:()=>n5,TextResourceContentsSchema:()=>I4,TitledMultiSelectEnumSchemaSchema:()=>Q4,TitledSingleSelectEnumSchemaSchema:()=>e5,ToolAnnotationsSchema:()=>d8,ToolChoiceSchema:()=>G9,ToolExecutionSchema:()=>i8,ToolListChangedNotificationSchema:()=>s8,ToolResultContentSchema:()=>B9,ToolSchema:()=>S4,ToolUseContentSchema:()=>h8,UnsubscribeRequestParamsSchema:()=>E8,UnsubscribeRequestSchema:()=>I8,UntitledMultiSelectEnumSchemaSchema:()=>X4,UntitledSingleSelectEnumSchemaSchema:()=>t5});Uw=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Aw=new Set(["string","integer","boolean","number"]);Nw=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],Vw=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);eT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],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:[Z0.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:[$Q,Z0.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:[Z0.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:[Z0.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:[Z0.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:[$Q],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:[Z0.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:[$Q],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."}],ww={[Z0.ParseError]:400,[Z0.InvalidRequest]:400,[Z0.MethodNotFound]:404,[Z0.UnsupportedProtocolVersion]:400,[Z0.MissingRequiredClientCapability]:400,[$Q]:400};Ow=/\\\.\\d\{(\d+)\}/;Tw=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);Pw=new Set(["$schema",...Object.keys(s6.shape.requestedSchema.shape)]),kK={string:aW([o6,t5,e5,W4]),number:aW([a6]),integer:aW([a6]),boolean:aW([s5]),array:aW([X4,Q4])},Sw=new Set(o6.shape.format.unwrap().options);yw=Object.assign(vw,{elicit(W){try{return{method:"elicitation/create",params:kw(W)}}catch(X){throw X instanceof V0?TypeError(X.message,{cause:X}):X}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});_w=["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"],gw={IdJagTokenExchangeResponseSchema:g9,OAuthClientInformationFullSchema:u9,OAuthClientInformationSchema:h9,OAuthClientMetadataSchema:x9,OAuthClientRegistrationErrorSchema:nW,OAuthErrorResponseSchema:f9,OAuthMetadataSchema:C4,OAuthProtectedResourceMetadataSchema:k9,OAuthTokenRevocationRequestSchema:rW,OAuthTokensSchema:_9,OpenIdProviderDiscoveryMetadataSchema:y9,OpenIdProviderMetadataSchema:v9},JZ={},KZ={};for(let W of _w)ZZ(W,Hw[W]);for(let[W,X]of Object.entries(gw))ZZ(W,X);fw=Object.freeze(JZ),xw=Object.freeze(KZ);uw=[r1,y6,C1,o1],lw=["inputResponses","requestState"];mw=XX(void 0);R7=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{cw=(W,X)=>{W._negotiatedProtocolVersion=X}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??H4,this.setNotificationHandler("notifications/cancelled",(X)=>{this._oncancel(X)}),this.setNotificationHandler("notifications/progress",(X)=>{this._onprogress(X)}),this.setRequestHandler("ping",(X)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let X=this._outboundMetaEnvelope();if(X===void 0)return W;let Q=W.params??{};return{...W,params:{...Q,_meta:{...X,...Q._meta}}}}_resolveNonCompleteResult(W,X){return Promise.reject(new E0(q0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${X.request.method}`,{resultType:W.kind,method:X.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,X,Q,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let X=this._timeoutInfo.get(W);if(!X)return!1;let Q=Date.now()-X.startTime;if(X.maxTotalTimeout&&Q>=X.maxTotalTimeout)throw this._timeoutInfo.delete(W),new E0(q0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Q});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(W){let X=this._timeoutInfo.get(W);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let X=this.transport?.onclose;this._transport.onclose=()=>{try{X?.()}finally{this._onclose()}};let Q=this.transport?.onerror;this._transport.onerror=(G)=>{Q?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),F7(G)||QZ(G))this._onresponse(G);else if(WZ(G))this._onrequest(G,B);else if(XZ(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let X=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let Q=new E0(q0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(Q);for(let Y of X.values())Y.abort(Q)}}_onerror(W){this.onerror?.(W)}_onnotification(W,X){let{message:Q}=vK(W,"notification"),Y=this._negotiatedWireCodec();if(X?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(X?.classification!==void 0){let F=bK(X.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${Q.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(Y7(Q.method)&&!Y.hasNotificationMethod(Q.method))return;let G=this._notificationHandlers.get(Q.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(Q):G(Q,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,X){let{message:Q,lifted:Y}=vK(W,"request"),G=this._negotiatedWireCodec();if(X?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,$)=>{let V={jsonrpc:"2.0",id:Q.id,error:{code:M,message:N,...$!==void 0&&{data:$}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(X?.classification!==void 0){let M=bK(X.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${Q.method}': classified as ${M} but this instance serves ${G.era}`));let N=X.classification.revision??M;F(Z0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(Q7(Q.method)&&!G.hasRequestMethod(Q.method)){F(Z0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler;if(L===void 0){F(Z0.MethodNotFound,"Method not found");return}let z=G.checkInboundEnvelope(Y);if(z!==void 0){F(Z0.InvalidParams,z);return}let J=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:Q.id}),K=(M,N,$)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...$,relatedRequestId:Q.id}),Z=new AbortController;this._requestHandlerAbortControllers.set(Q.id,Z);let D=Y.inputResponses===void 0?void 0:pw(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:Q.id,method:Q.method,_meta:Q.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?mw:XX(Y.requestState),signal:Z.signal,send:(M,N,$)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),p9(N))return K(M,N,$);let U=yK(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:J},http:X?.authInfo?{authInfo:X.authInfo}:void 0},A=this.buildContext(I,X);Promise.resolve().then(()=>L(Q,A)).then(async(M)=>{if(Z.signal.aborted)return;let N;try{N=G.encodeResult(Q.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${Q.method}: ${V}`)),F(Z0.InternalError,"Internal error");return}let $={result:N,jsonrpc:"2.0",id:Q.id};await B?.send($)},async(M)=>{if(Z.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:Z0.InternalError,$={jsonrpc:"2.0",id:Q.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send($)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===Z)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(W){let{progressToken:X,...Q}=W.params,Y=Number(X),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(Q)}_onresponse(W){let X=Number(W.id),Q=this._responseHandlers.get(X);if(Q===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(X),this._cleanupTimeout(X),this._progressHandlers.delete(X),F7(W))Q(W);else Q(V0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,X,Q){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),p9(X))return this._requestWithSchemaViaCodec(Y,W,X,Q);let G=yK(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,X)}_negotiatedWireCodec(){return c9(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let X=hw(W);if(X)return X}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,X){if(Q7(X)&&!W.hasRequestMethod(X))throw new E0(q0.MethodNotSupportedByProtocolVersion,`Method '${X}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:X,era:W.era})}_requestWithSchema(W,X,Q){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,X,Q)}_requestWithSchemaViaCodec(W,X,Q,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},z=Date.now(),J,K;return new Promise((Z,D)=>{let I=(j)=>{D(j)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(X.method)}catch(j){I(j);return}if(Y?.signal?.aborted){let j=Y.signal.reason;throw j instanceof E0?j:new E0(q0.RequestTimeout,String(j))}let A=W.era===D7&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...X,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...X.params,_meta:{...X.params?._meta,progressToken:M}};let $=this._envelopeOutbound(N),V=!1,U=(j)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(j)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(j instanceof E0?j:new E0(q0.RequestTimeout,String(j)))};this._responseHandlers.set(M,(j)=>{if(Y?.signal?.aborted)return;if(V=!0,j instanceof Error)return D(j);let w;try{w=W.decodeResult(X.method,j.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return Z(dw(w));let k={codec:W,request:X,resultSchema:Q,options:Y,flowStartedAt:z,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:X.method}:{method:X.method,params:l},Q,_)};return Z(this._resolveNonCompleteResult(w,k))}let T=w.result;k4(Q,T).then((k)=>{if(k.success)Z(k.data);else D(new E0(q0.InvalidResult,`Invalid result for ${X.method}: ${k.error}`))},D)}),J=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",J,{once:!0});let O=Y?.timeout??$Z,R=()=>U(new E0(q0.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(M,O,Y?.maxTotalTimeout,R,Y?.resetTimeoutOnProgress??!1),this._transport.send($,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((j)=>{this._progressHandlers.delete(M),D(j)})}).finally(()=>{if(J)Y?.signal?.removeEventListener("abort",J);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,X){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,X)}async _notificationViaCodec(W,X,Q){if(!this._transport)throw new E0(q0.NotConnected,"Not connected");if(Y7(X.method)&&!W.hasNotificationMethod(X.method))throw new E0(q0.MethodNotSupportedByProtocolVersion,`Notification '${X.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:X.method,era:W.era});this.assertNotificationCapability(X.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...X});if((this._options?.debouncedNotificationMethods??[]).includes(X.method)&&!X.params&&!Q?.relatedRequestId){if(this._pendingDebouncedNotifications.has(X.method))return;this._pendingDebouncedNotifications.add(X.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(X.method),!this._transport)return;this._transport?.send(Y,Q).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,Q)}setRequestHandler(W,X,Q){this.assertRequestHandlerCapability(W);let Y;if(typeof X==="function"){if(!Q7(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new V0(Z0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(X(L.value,B))}}else if(Q)Y=async(G,B)=>{let F=await k4(X.params,{...G.params});if(!F.success)throw new V0(Z0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return Q(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,X){return X}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,X,Q){if(typeof X==="function"){if(!Y7(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new V0(Z0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(X(B.value))});return}if(!Q)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await k4(X.params,{...Y.params});if(!G.success)throw new V0(Z0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await Q(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
88
200
  * content-type
89
201
  * Copyright(c) 2015 Douglas Christopher Wilson
90
202
  * MIT Licensed
91
- */Rw=X0((W)=>{var Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,X=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var z=typeof L==="object"?B(L):L;if(typeof z!=="string")throw TypeError("argument string is required to be a string");var J=z.indexOf(";"),K=J!==-1?z.slice(0,J).trim():z.trim();if(!Y.test(K))throw TypeError("invalid media type");var H=new F(K.toLowerCase());if(J!==-1){var D,I,A;Q.lastIndex=J;while(I=Q.exec(z)){if(I.index!==J)throw TypeError("invalid parameter format");if(J+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(X,"$1")}H.parameters[D]=A}if(J!==z.length)throw TypeError("invalid parameter format")}return H}function B(L){var z;if(typeof L.getHeader==="function")z=L.getHeader("content-type");else if(typeof L.headers==="object")z=L.headers&&L.headers["content-type"];if(typeof z!=="string")throw TypeError("content-type header is missing from object");return z}function F(L){this.parameters=Object.create(null),this.type=L}}),vT=OQ(Rw(),1);Tw=/^[A-Za-z0-9._-]{1,128}$/});function p3(){let W=new u3.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return c3(W),W}var HX,eK,I0,v0,_6,UX,kw,WZ,QZ,$X,vw,g6,yw,_w,XZ,gw,AX,aW,NX,sW,VX,fw,YZ,xw,hw,uw,GZ,lw,M7,BZ,mw,cw,pw,dw,iw,nw,rw,ow,j7,aw,sw,tw,FZ,LZ,zZ,ew,W3,Q3,O7,X3,JZ,Y3,G3,B3,F3,L3,z3,J3,K3,KZ,Z3,ZZ,HZ,H3,$3,$Z,U3,UZ,AZ,NZ,A3,N3,V3,w3,D3,M3,j3,O3,E3,I3,R3,T3,P3,S3,b3,q3,C3,k3,v3,y3,_3,g3,f3,x3,h3,u3,l3,m3,c3,wX=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=p3()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!m3.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let Q=this.ajv,X="$id"in W&&typeof W.$id==="string"?Q.getSchema(W.$id)??Q.compile(W):Q.compile(W);return(Y)=>{return X(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Q.errorsText(X.errors)}}}},cT;var VZ=$0(()=>{HY();HX=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var Q=class{};W._CodeOrName=Q,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var X=class extends Q{constructor(Z){super();if(!W.IDENTIFIER.test(Z))throw Error("CodeGen: name must be a valid identifier");this.str=Z}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=X;var Y=class extends Q{constructor(Z){super();this._items=typeof Z==="string"?[Z]:Z}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Z=this._items[0];return Z===""||Z==='""'}get str(){var Z;return(Z=this._str)!==null&&Z!==void 0?Z:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var Z;return(Z=this._names)!==null&&Z!==void 0?Z:this._names=this._items.reduce((V,U)=>{if(U instanceof X)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G(Z,...V){let U=[Z[0]],j=0;while(j<V.length)L(U,V[j]),U.push(Z[++j]);return new Y(U)}W._=G;let B=new Y("+");function F(Z,...V){let U=[I(Z[0])],j=0;while(j<V.length)U.push(B),L(U,V[j]),U.push(B,I(Z[++j]));return z(U),new Y(U)}W.str=F;function L(Z,V){if(V instanceof Y)Z.push(...V._items);else if(V instanceof X)Z.push(V);else Z.push(H(V))}W.addCodeArg=L;function z(Z){let V=1;while(V<Z.length-1){if(Z[V]===B){let U=J(Z[V-1],Z[V+1]);if(U!==void 0){Z.splice(V-1,3,U);continue}Z[V++]="+"}V++}}function J(Z,V){if(V==='""')return Z;if(Z==='""')return V;if(typeof Z=="string"){if(V instanceof X||Z[Z.length-1]!=='"')return;if(typeof V!="string")return`${Z.slice(0,-1)}${V}"`;if(V[0]==='"')return Z.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!(Z instanceof X))return`"${Z}${V.slice(1)}`}function K(Z,V){return V.emptyStr()?Z:Z.emptyStr()?V:F`${Z}${V}`}W.strConcat=K;function H(Z){return typeof Z=="number"||typeof Z=="boolean"||Z===null?Z:I(Array.isArray(Z)?Z.join(","):Z)}function D(Z){return new Y(I(Z))}W.stringify=D;function I(Z){return JSON.stringify(Z).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A(Z){return typeof Z=="string"&&W.IDENTIFIER.test(Z)?new Y(`.${Z}`):G`[${Z}]`}W.getProperty=A;function M(Z){if(typeof Z=="string"&&W.IDENTIFIER.test(Z))return new Y(`${Z}`);throw Error(`CodeGen: invalid export name: ${Z}, use explicit $id name mapping`)}W.getEsmExportName=M;function N(Z){return new Y(Z.toString())}W.regexpCode=N}),eK=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let Q=HX();var X=class extends Error{constructor(z){super(`CodeGen: "code" for ${z} not defined`);this.value=z.value}},Y;(function(z){z[z.Started=0]="Started",z[z.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new Q.Name("const"),let:new Q.Name("let"),var:new Q.Name("var")};var G=class{constructor({prefixes:z,parent:J}={}){this._names={},this._prefixes=z,this._parent=J}toName(z){return z instanceof Q.Name?z:this.name(z)}name(z){return new Q.Name(this._newName(z))}_newName(z){let J=this._names[z]||this._nameGroup(z);return`${z}${J.index++}`}_nameGroup(z){var J,K;if(((K=(J=this._parent)===null||J===void 0?void 0:J._prefixes)===null||K===void 0?void 0:K.has(z))||this._prefixes&&!this._prefixes.has(z))throw Error(`CodeGen: prefix "${z}" is not allowed in this scope`);return this._names[z]={prefix:z,index:0}}};W.Scope=G;var B=class extends Q.Name{constructor(z,J){super(J);this.prefix=z}setValue(z,{property:J,itemIndex:K}){this.value=z,this.scopePath=Q._`.${new Q.Name(J)}[${K}]`}};W.ValueScopeName=B;let F=Q._`\n`;var L=class extends G{constructor(z){super(z);this._values={},this._scope=z.scope,this.opts={...z,_n:z.lines?F:Q.nil}}get(){return this._scope}name(z){return new B(z,this._newName(z))}value(z,J){var K;if(J.ref===void 0)throw Error("CodeGen: ref must be passed in value");let H=this.toName(z),{prefix:D}=H,I=(K=J.key)!==null&&K!==void 0?K:J.ref,A=this._values[D];if(A){let Z=A.get(I);if(Z)return Z}else A=this._values[D]=new Map;A.set(I,H);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=J.ref,H.setValue(J,{property:D,itemIndex:N}),H}getValue(z,J){let K=this._values[z];if(!K)return;return K.get(J)}scopeRefs(z,J=this._values){return this._reduceValues(J,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return Q._`${z}${K.scopePath}`})}scopeCode(z=this._values,J,K){return this._reduceValues(z,(H)=>{if(H.value===void 0)throw Error(`CodeGen: name "${H}" has no value`);return H.value.code},J,K)}_reduceValues(z,J,K={},H){let D=Q.nil;for(let I in z){let A=z[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let Z=J(N);if(Z){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=Q._`${D}${V} ${N} = ${Z};${this.opts._n}`}else if(Z=H===null||H===void 0?void 0:H(N))D=Q._`${D}${Z}${this.opts._n}`;else throw new X(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),I0=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let Q=HX(),X=eK();var Y=HX();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=eK();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,S){return this}},F=class extends B{constructor(E,S,C){super();this.varKind=E,this.name=S,this.rhs=C}render({es5:E,_n:S}){let C=E?X.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+S}optimizeNames(E,S){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,S);return this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,S,C){super();this.lhs=E,this.rhs=S,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,S){if(this.lhs instanceof Q.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,S),this}get names(){return d(this.lhs instanceof Q.Name?{}:{...this.lhs.names},this.rhs)}},z=class extends L{constructor(E,S,C,c){super(E,C,c);this.op=S}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},J=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},H=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,S){return this.code=p(this.code,E,S),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((S,C)=>S+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,S=E.length;while(S--){let C=E[S].optimizeNodes();if(Array.isArray(C))E.splice(S,1,...C);else if(C)E[S]=C;else E.splice(S,1)}return E.length>0?this:void 0}optimizeNames(E,S){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,S))continue;K0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,S)=>h(E,S.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var Z=class E extends A{constructor(S,C){super(C);this.condition=S}render(S){let C=`if(${this.condition})`+super.render(S);if(this.else)C+="else "+this.else.render(S);return C}optimizeNodes(){super.optimizeNodes();let S=this.condition;if(S===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(S===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(j0(S),C instanceof E?[C]:C.nodes)}if(S===!1||!this.nodes.length)return;return this}optimizeNames(S,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(S,C),!(super.optimizeNames(S,C)||this.else))return;return this.condition=p(this.condition,S,C),this}get names(){let S=super.names;if(d(S,this.condition),this.else)h(S,this.else.names);return S}};Z.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iteration=p(this.iteration,E,S),this}get names(){return h(super.names,this.iteration.names)}},j=class extends V{constructor(E,S,C,c){super();this.varKind=E,this.name=S,this.from=C,this.to=c}render(E){let S=E.es5?X.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${S} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},R=class extends V{constructor(E,S,C,c){super();this.loop=E,this.varKind=S,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iterable=p(this.iterable,E,S),this}get names(){return h(super.names,this.iterable.names)}},O=class extends A{constructor(E,S,C){super();this.name=E,this.args=S,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};O.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var T=class extends A{render(E){let S="try"+super.render(E);if(this.catch)S+=this.catch.render(E);if(this.finally)S+=this.finally.render(E);return S}optimizeNodes(){var E,S;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(S=this.finally)===null||S===void 0||S.optimizeNodes(),this}optimizeNames(E,S){var C,c;return super.optimizeNames(E,S),(C=this.catch)===null||C===void 0||C.optimizeNames(E,S),(c=this.finally)===null||c===void 0||c.optimizeNames(E,S),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,S={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...S,_n:S.lines?`
92
- `:""},this._extScope=E,this._scope=new X.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,S){let C=this._extScope.value(E,S);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,S){return this._extScope.getValue(E,S)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,S,C,c){let r=this._scope.toName(S);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,S,C){return this._def(X.varKinds.const,E,S,C)}let(E,S,C){return this._def(X.varKinds.let,E,S,C)}var(E,S,C){return this._def(X.varKinds.var,E,S,C)}assign(E,S,C){return this._leafNode(new L(E,S,C))}add(E,S){return this._leafNode(new z(E,W.operators.ADD,S))}code(E){if(typeof E=="function")E();else if(E!==Q.nil)this._leafNode(new D(E));return this}object(...E){let S=["{"];for(let[C,c]of E){if(S.length>1)S.push(",");if(S.push(C),C!==c||this.opts.es5)S.push(":"),(0,Q.addCodeArg)(S,c)}return S.push("}"),new Q._Code(S)}if(E,S,C){if(this._blockNode(new Z(E)),S&&C)this.code(S).else().code(C).endIf();else if(S)this.code(S).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new Z(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode(Z,N)}_for(E,S){if(this._blockNode(E),S)this.code(S).endFor();return this}for(E,S){return this._for(new U(E),S)}forRange(E,S,C,c,r=this.opts.es5?X.varKinds.var:X.varKinds.let){let z0=this._scope.toName(E);return this._for(new j(r,z0,S,C),()=>c(z0))}forOf(E,S,C,c=X.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let z0=S instanceof Q.Name?S:this.var("_arr",S);return this.forRange("_i",0,Q._`${z0}.length`,(e)=>{this.var(r,Q._`${z0}[${e}]`),C(r)})}return this._for(new R("of",c,r,S),()=>C(r))}forIn(E,S,C,c=this.opts.es5?X.varKinds.var:X.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,Q._`Object.keys(${S})`,C);let r=this._scope.toName(E);return this._for(new R("in",c,r,S),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new J(E))}break(E){return this._leafNode(new K(E))}return(E){let S=new w;if(this._blockNode(S),this.code(E),S.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,S,C){if(!S&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new T;if(this._blockNode(c),this.code(E),S){let r=this.name("e");this._currNode=c.catch=new k(r),S(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new H(E))}block(E,S){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(S);return this}endBlock(E){let S=this._blockStarts.pop();if(S===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-S;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=S,this}func(E,S=Q.nil,C,c){if(this._blockNode(new O(E,S,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(O)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,S){let C=this._currNode;if(C instanceof E||S&&C instanceof S)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${S?`${E.kind}/${S.kind}`:E.kind}"`)}_elseNode(E){let S=this._currNode;if(!(S instanceof Z))throw Error('CodeGen: "else" without "if"');return this._currNode=S.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let S=this._nodes;S[S.length-1]=E}};W.CodeGen=_;function h(E,S){for(let C in S)E[C]=(E[C]||0)+(S[C]||0);return E}function d(E,S){return S instanceof Q._CodeOrName?h(E,S.names):E}function p(E,S,C){if(E instanceof Q.Name)return c(E);if(!r(E))return E;return new Q._Code(E._items.reduce((z0,e)=>{if(e instanceof Q.Name)e=c(e);if(e instanceof Q._Code)z0.push(...e._items);else z0.push(e);return z0},[]));function c(z0){let e=C[z0.str];if(e===void 0||S[z0.str]!==1)return z0;return delete S[z0.str],e}function r(z0){return z0 instanceof Q._Code&&z0._items.some((e)=>e instanceof Q.Name&&S[e.str]===1&&C[e.str]!==void 0)}}function K0(E,S){for(let C in S)E[C]=(E[C]||0)-(S[C]||0)}function j0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:Q._`!${u(E)}`}W.not=j0;let w0=v(W.operators.AND);function S0(...E){return E.reduce(w0)}W.and=S0;let H0=v(W.operators.OR);function b(...E){return E.reduce(H0)}W.or=b;function v(E){return(S,C)=>S===Q.nil?C:C===Q.nil?S:Q._`${u(S)} ${E} ${u(C)}`}function u(E){return E instanceof Q.Name?E:Q._`(${E})`}}),v0=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let Q=I0(),X=HX();function Y(O){let w={};for(let T of O)w[T]=!0;return w}W.toHash=Y;function G(O,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(O,w),!F(w,O.self.RULES.all)}W.alwaysValidSchema=G;function B(O,w=O.schema){let{opts:T,self:k}=O;if(!T.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])R(O,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(O,w){if(typeof O=="boolean")return!O;for(let T in O)if(w[T])return!0;return!1}W.schemaHasRules=F;function L(O,w){if(typeof O=="boolean")return!O;for(let T in O)if(T!=="$ref"&&w.all[T])return!0;return!1}W.schemaHasRulesButRef=L;function z({topSchemaRef:O,schemaPath:w},T,k,l){if(!l){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return Q._`${T}`}return Q._`${O}${w}${(0,Q.getProperty)(k)}`}W.schemaRefOrVal=z;function J(O){return D(decodeURIComponent(O))}W.unescapeFragment=J;function K(O){return encodeURIComponent(H(O))}W.escapeFragment=K;function H(O){if(typeof O=="number")return`${O}`;return O.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=H;function D(O){return O.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(O,w){if(Array.isArray(O))for(let T of O)w(T);else w(O)}W.eachItem=I;function A({mergeNames:O,mergeToName:w,mergeValues:T,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof Q.Name?(_ instanceof Q.Name?O(l,_,h):w(l,_,h),h):_ instanceof Q.Name?(w(l,h,_),_):T(_,h);return d===Q.Name&&!(p instanceof Q.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(O,w,T)=>O.if(Q._`${T} !== true && ${w} !== undefined`,()=>{O.if(Q._`${w} === true`,()=>O.assign(T,!0),()=>O.assign(T,Q._`${T} || {}`).code(Q._`Object.assign(${T}, ${w})`))}),mergeToName:(O,w,T)=>O.if(Q._`${T} !== true`,()=>{if(w===!0)O.assign(T,!0);else O.assign(T,Q._`${T} || {}`),N(O,T,w)}),mergeValues:(O,w)=>O===!0?!0:{...O,...w},resultToName:M}),items:A({mergeNames:(O,w,T)=>O.if(Q._`${T} !== true && ${w} !== undefined`,()=>O.assign(T,Q._`${w} === true ? true : ${T} > ${w} ? ${T} : ${w}`)),mergeToName:(O,w,T)=>O.if(Q._`${T} !== true`,()=>O.assign(T,w===!0?!0:Q._`${T} > ${w} ? ${T} : ${w}`)),mergeValues:(O,w)=>O===!0?!0:Math.max(O,w),resultToName:(O,w)=>O.var("items",w)})};function M(O,w){if(w===!0)return O.var("props",!0);let T=O.var("props",Q._`{}`);if(w!==void 0)N(O,T,w);return T}W.evaluatedPropsToName=M;function N(O,w,T){Object.keys(T).forEach((k)=>O.assign(Q._`${w}${(0,Q.getProperty)(k)}`,!0))}W.setEvaluated=N;let Z={};function V(O,w){return O.scopeValue("func",{ref:w,code:Z[w.code]||(Z[w.code]=new X._Code(w.code))})}W.useFunc=V;var U;(function(O){O[O.Num=0]="Num",O[O.Str=1]="Str"})(U||(W.Type=U={}));function j(O,w,T){if(O instanceof Q.Name){let k=w===U.Num;return T?k?Q._`"[" + ${O} + "]"`:Q._`"['" + ${O} + "']"`:k?Q._`"/" + ${O}`:Q._`"/" + ${O}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,Q.getProperty)(O).toString():"/"+H(O)}W.getErrorPath=j;function R(O,w,T=O.opts.strictSchema){if(!T)return;if(w=`strict mode: ${w}`,T===!0)throw Error(w);O.self.logger.warn(w)}W.checkStrictMode=R}),_6=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={data:new Q.Name("data"),valCxt:new Q.Name("valCxt"),instancePath:new Q.Name("instancePath"),parentData:new Q.Name("parentData"),parentDataProperty:new Q.Name("parentDataProperty"),rootData:new Q.Name("rootData"),dynamicAnchors:new Q.Name("dynamicAnchors"),vErrors:new Q.Name("vErrors"),errors:new Q.Name("errors"),this:new Q.Name("this"),self:new Q.Name("self"),scope:new Q.Name("scope"),json:new Q.Name("json"),jsonPos:new Q.Name("jsonPos"),jsonLen:new Q.Name("jsonLen"),jsonPart:new Q.Name("jsonPart")};W.default=X}),UX=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let Q=I0(),X=v0(),Y=_6();W.keywordError={message:({keyword:N})=>Q.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:Z})=>Z?Q.str`"${N}" keyword must be ${Z} ($data)`:Q.str`"${N}" keyword is invalid ($data)`};function G(N,Z=W.keywordError,V,U){let{it:j}=N,{gen:R,compositeRule:O,allErrors:w}=j,T=H(N,Z,V);if(U!==null&&U!==void 0?U:O||w)z(R,T);else J(j,Q._`[${T}]`)}W.reportError=G;function B(N,Z=W.keywordError,V){let{it:U}=N,{gen:j,compositeRule:R,allErrors:O}=U;if(z(j,H(N,Z,V)),!(R||O))J(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,Z){N.assign(Y.default.errors,Z),N.if(Q._`${Y.default.vErrors} !== null`,()=>N.if(Z,()=>N.assign(Q._`${Y.default.vErrors}.length`,Z),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:Z,schemaValue:V,data:U,errsCount:j,it:R}){if(j===void 0)throw Error("ajv implementation error");let O=N.name("err");N.forRange("i",j,Y.default.errors,(w)=>{if(N.const(O,Q._`${Y.default.vErrors}[${w}]`),N.if(Q._`${O}.instancePath === undefined`,()=>N.assign(Q._`${O}.instancePath`,(0,Q.strConcat)(Y.default.instancePath,R.errorPath))),N.assign(Q._`${O}.schemaPath`,Q.str`${R.errSchemaPath}/${Z}`),R.opts.verbose)N.assign(Q._`${O}.schema`,V),N.assign(Q._`${O}.data`,U)})}W.extendErrors=L;function z(N,Z){let V=N.const("err",Z);N.if(Q._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,Q._`[${V}]`),Q._`${Y.default.vErrors}.push(${V})`),N.code(Q._`${Y.default.errors}++`)}function J(N,Z){let{gen:V,validateName:U,schemaEnv:j}=N;if(j.$async)V.throw(Q._`new ${N.ValidationError}(${Z})`);else V.assign(Q._`${U}.errors`,Z),V.return(!1)}let K={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function H(N,Z,V){let{createErrors:U}=N.it;if(U===!1)return Q._`{}`;return D(N,Z,V)}function D(N,Z,V={}){let{gen:U,it:j}=N,R=[I(j,V),A(N,V)];return M(N,Z,R),U.object(...R)}function I({errorPath:N},{instancePath:Z}){let V=Z?Q.str`${N}${(0,X.getErrorPath)(Z,X.Type.Str)}`:N;return[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:Z}},{schemaPath:V,parentSchema:U}){let j=U?Z:Q.str`${Z}/${N}`;if(V)j=Q.str`${j}${(0,X.getErrorPath)(V,X.Type.Str)}`;return[K.schemaPath,j]}function M(N,{params:Z,message:V},U){let{keyword:j,data:R,schemaValue:O,it:w}=N,{opts:T,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,j],[K.params,typeof Z=="function"?Z(N):Z||Q._`{}`]),T.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(T.verbose)U.push([K.schema,O],[K.parentSchema,Q._`${l}${_}`],[Y.default.data,R]);if(k)U.push([K.propertyName,k])}}),kw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let Q=UX(),X=I0(),Y=_6(),G={message:"boolean schema is false"};function B(z){let{gen:J,schema:K,validateName:H}=z;if(K===!1)L(z,!1);else if(typeof K=="object"&&K.$async===!0)J.return(Y.default.data);else J.assign(X._`${H}.errors`,null),J.return(!0)}W.topBoolOrEmptySchema=B;function F(z,J){let{gen:K,schema:H}=z;if(H===!1)K.var(J,!1),L(z);else K.var(J,!0)}W.boolOrEmptySchema=F;function L(z,J){let{gen:K,data:H}=z,D={gen:K,keyword:"false schema",data:H,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:z};(0,Q.reportError)(D,G,void 0,J)}}),WZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let Q=new Set(["string","number","integer","boolean","null","object","array"]);function X(G){return typeof G=="string"&&Q.has(G)}W.isJSONType=X;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),QZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function Q({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&X(G,L)}W.schemaHasRulesForType=Q;function X(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=X;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),$X=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let Q=WZ(),X=QZ(),Y=UX(),G=I0(),B=v0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let j=z(U.type);if(j.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!j.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)j.push("null")}return j}W.getSchemaTypes=L;function z(U){let j=Array.isArray(U)?U:U?[U]:[];if(j.every(Q.isJSONType))return j;throw Error("type must be JSONType or JSONType[]: "+j.join(","))}W.getJSONTypes=z;function J(U,j){let{gen:R,data:O,opts:w}=U,T=H(j,w.coerceTypes),k=j.length>0&&!(T.length===0&&j.length===1&&(0,X.schemaHasRulesForType)(U,j[0]));if(k){let l=M(j,O,w.strictNumbers,F.Wrong);R.if(l,()=>{if(T.length)D(U,j,T);else Z(U)})}return k}W.coerceAndCheckDataType=J;let K=new Set(["string","number","integer","boolean","null"]);function H(U,j){return j?U.filter((R)=>K.has(R)||j==="array"&&R==="array"):[]}function D(U,j,R){let{gen:O,data:w,opts:T}=U,k=O.let("dataType",G._`typeof ${w}`),l=O.let("coerced",G._`undefined`);if(T.coerceTypes==="array")O.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>O.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(j,w,T.strictNumbers),()=>O.assign(l,w)));O.if(G._`${l} !== undefined`);for(let h of R)if(K.has(h)||h==="array"&&T.coerceTypes==="array")_(h);O.else(),Z(U),O.endIf(),O.if(G._`${l} !== undefined`,()=>{O.assign(w,l),I(U,l)});function _(h){switch(h){case"string":O.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":O.elseIf(G._`${k} == "boolean" || ${w} === null
93
- || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":O.elseIf(G._`${k} === "boolean" || ${w} === null
94
- || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":O.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":O.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),O.assign(l,null);return;case"array":O.elseIf(G._`${k} === "string" || ${k} === "number"
95
- || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:j,parentDataProperty:R},O){U.if(G._`${j} !== undefined`,()=>U.assign(G._`${j}[${R}]`,O))}function A(U,j,R,O=F.Correct){let w=O===F.Correct?G.operators.EQ:G.operators.NEQ,T;switch(U){case"null":return G._`${j} ${w} null`;case"array":T=G._`Array.isArray(${j})`;break;case"object":T=G._`${j} && typeof ${j} == "object" && !Array.isArray(${j})`;break;case"integer":T=k(G._`!(${j} % 1) && !isNaN(${j})`);break;case"number":T=k();break;default:return G._`typeof ${j} ${w} ${U}`}return O===F.Correct?T:(0,G.not)(T);function k(l=G.nil){return(0,G.and)(G._`typeof ${j} == "number"`,l,R?G._`isFinite(${j})`:G.nil)}}W.checkDataType=A;function M(U,j,R,O){if(U.length===1)return A(U[0],j,R,O);let w,T=(0,B.toHash)(U);if(T.array&&T.object){let k=G._`typeof ${j} != "object"`;w=T.null?k:G._`!${j} || ${k}`,delete T.null,delete T.array,delete T.object}else w=G.nil;if(T.number)delete T.integer;for(let k in T)w=(0,G.and)(w,A(k,j,R,O));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:j})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${j}}`};function Z(U){let j=V(U);(0,Y.reportError)(j,N)}W.reportTypeError=Z;function V(U){let{gen:j,data:R,schema:O}=U,w=(0,B.schemaRefOrVal)(U,O,"type");return{gen:j,keyword:"type",data:R,schema:O.type,schemaCode:w,schemaValue:w,parentSchema:O,params:{},it:U}}}),vw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let Q=I0(),X=v0();function Y(B,F){let{properties:L,items:z}=B.schema;if(F==="object"&&L)for(let J in L)G(B,J,L[J].default);else if(F==="array"&&Array.isArray(z))z.forEach((J,K)=>G(B,K,J.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:z,compositeRule:J,data:K,opts:H}=B;if(L===void 0)return;let D=Q._`${K}${(0,Q.getProperty)(F)}`;if(J){(0,X.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=Q._`${D} === undefined`;if(H.useDefaults==="empty")I=Q._`${I} || ${D} === null || ${D} === ""`;z.if(I,Q._`${D} = ${(0,Q.stringify)(L)}`)}}),g6=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let Q=I0(),X=v0(),Y=_6(),G=v0();function B(U,j){let{gen:R,data:O,it:w}=U;R.if(H(R,O,j,w.opts.ownProperties),()=>{U.setParams({missingProperty:Q._`${j}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:j,it:{opts:R}},O,w){return(0,Q.or)(...O.map((T)=>(0,Q.and)(H(U,j,T,R.ownProperties),Q._`${w} = ${T}`)))}W.checkMissingProp=F;function L(U,j){U.setParams({missingProperty:j},!0),U.error()}W.reportMissingProp=L;function z(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Q._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=z;function J(U,j,R){return Q._`${z(U)}.call(${j}, ${R})`}W.isOwnProperty=J;function K(U,j,R,O){let w=Q._`${j}${(0,Q.getProperty)(R)} !== undefined`;return O?Q._`${w} && ${J(U,j,R)}`:w}W.propertyInData=K;function H(U,j,R,O){let w=Q._`${j}${(0,Q.getProperty)(R)} === undefined`;return O?(0,Q.or)(w,(0,Q.not)(J(U,j,R))):w}W.noPropertyInData=H;function D(U){return U?Object.keys(U).filter((j)=>j!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,j){return D(j).filter((R)=>!(0,X.alwaysValidSchema)(U,j[R]))}W.schemaProperties=I;function A({schemaCode:U,data:j,it:{gen:R,topSchemaRef:O,schemaPath:w,errorPath:T},it:k},l,_,h){let d=h?Q._`${U}, ${j}, ${O}${w}`:j,p=[[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,T)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let K0=Q._`${d}, ${R.object(...p)}`;return _!==Q.nil?Q._`${l}.call(${_}, ${K0})`:Q._`${l}(${K0})`}W.callValidateCode=A;let M=Q._`new RegExp`;function N({gen:U,it:{opts:j}},R){let O=j.unicodeRegExp?"u":"",{regExp:w}=j.code,T=w(R,O);return U.scopeValue("pattern",{key:T.toString(),ref:T,code:Q._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${R}, ${O})`})}W.usePattern=N;function Z(U){let{gen:j,data:R,keyword:O,it:w}=U,T=j.name("valid");if(w.allErrors){let l=j.let("valid",!0);return k(()=>j.assign(l,!1)),l}return j.var(T,!0),k(()=>j.break()),T;function k(l){let _=j.const("len",Q._`${R}.length`);j.forRange("i",0,_,(h)=>{U.subschema({keyword:O,dataProp:h,dataPropType:X.Type.Num},T),j.if((0,Q.not)(T),l)})}}W.validateArray=Z;function V(U){let{gen:j,schema:R,keyword:O,it:w}=U;if(!Array.isArray(R))throw Error("ajv implementation error");if(R.some((l)=>(0,X.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let T=j.let("valid",!1),k=j.name("_valid");j.block(()=>R.forEach((l,_)=>{let h=U.subschema({keyword:O,schemaProp:_,compositeRule:!0},k);if(j.assign(T,Q._`${T} || ${k}`),!U.mergeValidEvaluated(h,k))j.if((0,Q.not)(T))})),U.result(T,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),yw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let Q=I0(),X=_6(),Y=g6(),G=UX();function B(I,A){let{gen:M,keyword:N,schema:Z,parentSchema:V,it:U}=I,j=A.macro.call(U.self,Z,V,U),R=K(M,N,j);if(U.opts.validateSchema!==!1)U.self.validateSchema(j,!0);let O=M.name("valid");I.subschema({schema:j,schemaPath:Q.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:R,compositeRule:!0},O),I.pass(O,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:Z,schema:V,parentSchema:U,$data:j,it:R}=I;J(R,A);let O=K(N,Z,!j&&A.compile?A.compile.call(R.self,V,U,R):A.validate),w=N.let("valid");I.block$data(w,T),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function T(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>z(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(Q._`await `),(p)=>N.assign(w,!1).if(Q._`${p} instanceof ${R.ValidationError}`,()=>N.assign(d,Q._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=Q._`${O}.errors`;return N.assign(d,null),_(Q.nil),d}function _(d=A.async?Q._`await `:Q.nil){let p=R.opts.passContext?X.default.this:X.default.self,K0=!(("compile"in A)&&!j||A.schema===!1);N.assign(w,Q._`${d}${(0,Y.callValidateCode)(I,O,p,K0)}`,A.modifying)}function h(d){var p;N.if((0,Q.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,Q._`${N.parentData}[${N.parentDataProperty}]`))}function z(I,A){let{gen:M}=I;M.if(Q._`Array.isArray(${A})`,()=>{M.assign(X.default.vErrors,Q._`${X.default.vErrors} === null ? ${A} : ${X.default.vErrors}.concat(${A})`).assign(X.default.errors,Q._`${X.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function J({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,Q.stringify)(M)})}function H(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=H;function D({schema:I,opts:A,self:M,errSchemaPath:N},Z,V){if(Array.isArray(Z.keyword)?!Z.keyword.includes(V):Z.keyword!==V)throw Error("ajv implementation error");let U=Z.dependencies;if(U===null||U===void 0?void 0:U.some((j)=>!Object.prototype.hasOwnProperty.call(I,j)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if(Z.validateSchema){if(!Z.validateSchema(I[V])){let j=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText(Z.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(j);else throw Error(j)}}}W.validateKeywordUsage=D}),_w=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let Q=I0(),X=v0();function Y(F,{keyword:L,schemaProp:z,schema:J,schemaPath:K,errSchemaPath:H,topSchemaRef:D}){if(L!==void 0&&J!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return z===void 0?{schema:I,schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[z],schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}${(0,Q.getProperty)(z)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,X.escapeFragment)(z)}`}}if(J!==void 0){if(K===void 0||H===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:J,schemaPath:K,topSchemaRef:D,errSchemaPath:H}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:z,dataPropType:J,data:K,dataTypes:H,propertyName:D}){if(K!==void 0&&z!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(z!==void 0){let{errorPath:M,dataPathArr:N,opts:Z}=L;A(I.let("data",Q._`${L.data}${(0,Q.getProperty)(z)}`,!0)),F.errorPath=Q.str`${M}${(0,X.getErrorPath)(z,J,Z.jsPropertySyntax)}`,F.parentDataProperty=Q._`${z}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof Q.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(H)F.dataTypes=H;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:z,compositeRule:J,createErrors:K,allErrors:H}){if(J!==void 0)F.compositeRule=J;if(K!==void 0)F.createErrors=K;if(H!==void 0)F.allErrors=H;F.jtdDiscriminator=L,F.jtdMetadata=z}W.extendSubschemaMode=B}),XZ=X0((W,Q)=>{Q.exports=function X(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!X(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var z=L[F];if(!X(Y[z],G[z]))return!1}return!0}return Y!==Y&&G!==G}}),gw=X0((W,Q)=>{var X=Q.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var z=typeof L=="function"?L:L.pre||function(){},J=L.post||function(){};Y(F,z,J,B,"",B)};X.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},X.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},X.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},X.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 Y(B,F,L,z,J,K,H,D,I,A){if(z&&typeof z=="object"&&!Array.isArray(z)){F(z,J,K,H,D,I,A);for(var M in z){var N=z[M];if(Array.isArray(N)){if(M in X.arrayKeywords)for(var Z=0;Z<N.length;Z++)Y(B,F,L,N[Z],J+"/"+M+"/"+Z,K,J,M,z,Z)}else if(M in X.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],J+"/"+M+"/"+G(V),K,J,M,z,V)}else if(M in X.keywords||B.allKeys&&!(M in X.skipKeywords))Y(B,F,L,N,J+"/"+M,K,J,M,z)}L(z,J,K,H,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),AX=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let Q=v0(),X=XZ(),Y=gw(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,Z=!0){if(typeof N=="boolean")return!0;if(Z===!0)return!L(N);if(!Z)return!1;return z(N)<=Z}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let Z in N){if(F.has(Z))return!0;let V=N[Z];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function z(N){let Z=0;for(let V in N){if(V==="$ref")return 1/0;if(Z++,G.has(V))continue;if(typeof N[V]=="object")(0,Q.eachItem)(N[V],(U)=>Z+=z(U));if(Z===1/0)return 1/0}return Z}function J(N,Z="",V){if(V!==!1)Z=D(Z);return K(N,N.parse(Z))}W.getFullPath=J;function K(N,Z){return N.serialize(Z).split("#")[0]+"#"}W._getFullPath=K;let H=/#\/?$/;function D(N){return N?N.replace(H,""):""}W.normalizeId=D;function I(N,Z,V){return V=D(V),N.resolve(Z,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,Z){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,j=D(N[V]||Z),R={"":j},O=J(U,j,!1),w={},T=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let K0=O+h,j0=R[p];if(typeof _[V]=="string")j0=w0.call(this,_[V]);S0.call(this,_.$anchor),S0.call(this,_.$dynamicAnchor),R[h]=j0;function w0(H0){let b=this.opts.uriResolver.resolve;if(H0=D(j0?b(j0,H0):H0),T.has(H0))throw l(H0);T.add(H0);let v=this.refs[H0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,H0);else if(H0!==D(K0))if(H0[0]==="#")k(_,w[H0],H0),w[H0]=_;else this.refs[H0]=K0;return H0}function S0(H0){if(typeof H0=="string"){if(!A.test(H0))throw Error(`invalid anchor "${H0}"`);w0.call(this,`#${H0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!X(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),aW=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let Q=kw(),X=$X(),Y=QZ(),G=$X(),B=vw(),F=yw(),L=_w(),z=I0(),J=_6(),K=AX(),H=v0(),D=UX();function I(P){if(O(P)){if(T(P),R(P)){Z(P);return}}A(P,()=>(0,Q.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},L0){if(t.code.es5)P.func(y,z._`${J.default.data}, ${J.default.valCxt}`,s.$async,()=>{P.code(z._`"use strict"; ${U(x,t)}`),N(P,t),P.code(L0)});else P.func(y,z._`${J.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(L0))}function M(P){return z._`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${P.dynamicRef?z._`, ${J.default.dynamicAnchors}={}`:z.nil}}={}`}function N(P,y){P.if(J.default.valCxt,()=>{if(P.var(J.default.instancePath,z._`${J.default.valCxt}.${J.default.instancePath}`),P.var(J.default.parentData,z._`${J.default.valCxt}.${J.default.parentData}`),P.var(J.default.parentDataProperty,z._`${J.default.valCxt}.${J.default.parentDataProperty}`),P.var(J.default.rootData,z._`${J.default.valCxt}.${J.default.rootData}`),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{if(P.var(J.default.instancePath,z._`""`),P.var(J.default.parentData,z._`undefined`),P.var(J.default.parentDataProperty,z._`undefined`),P.var(J.default.rootData,J.default.data),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`{}`)})}function Z(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(J.default.vErrors,null),s.let(J.default.errors,0),x.unevaluated)V(P);k(P),K0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",z._`${x}.evaluated`),y.if(z._`${P.evaluated}.dynamicProps`,()=>y.assign(z._`${P.evaluated}.props`,z._`undefined`)),y.if(z._`${P.evaluated}.dynamicItems`,()=>y.assign(z._`${P.evaluated}.items`,z._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?z._`/*# sourceURL=${x} */`:z.nil}function j(P,y){if(O(P)){if(T(P),R(P)){w(P,y);return}}(0,Q.boolOrEmptySchema)(P,y)}function R({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function O(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let L0=s.const("_errs",J.default.errors);k(P,L0),s.var(y,z._`${L0} === ${J.default.errors}`)}function T(P){(0,H.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return w0(P,[],!1,y);let x=(0,X.getSchemaTypes)(P.schema);w0(P,x,!(0,X.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,H.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,H.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let L0=x.$comment;if(t.$comment===!0)P.code(z._`${J.default.self}.logger.log(${L0})`);else if(typeof t.$comment=="function"){let T0=z.str`${s}/$comment`,C0=P.scopeValue("root",{ref:y.root});P.code(z._`${J.default.self}.opts.$comment(${L0}, ${T0}, ${C0}.schema)`)}}function K0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:L0}=P;if(x.$async)y.if(z._`${J.default.errors} === 0`,()=>y.return(J.default.data),()=>y.throw(z._`new ${t}(${J.default.vErrors})`));else{if(y.assign(z._`${s}.errors`,J.default.vErrors),L0.unevaluated)j0(P);y.return(z._`${J.default.errors} === 0`)}}function j0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof z.Name)P.assign(z._`${y}.props`,x);if(s instanceof z.Name)P.assign(z._`${y}.items`,s)}function w0(P,y,x,s){let{gen:t,schema:L0,data:T0,allErrors:C0,opts:f0,self:b0}=P,{RULES:O0}=b0;if(L0.$ref&&(f0.ignoreKeywordsWithRef||!(0,H.schemaHasRulesButRef)(L0,O0))){t.block(()=>z0(P,"$ref",O0.all.$ref.definition));return}if(!f0.jtd)H0(P,y);t.block(()=>{for(let k0 of O0.rules)o0(k0);o0(O0.post)});function o0(k0){if(!(0,Y.shouldUseGroup)(L0,k0))return;if(k0.type){if(t.if((0,G.checkDataType)(k0.type,T0,f0.strictNumbers)),S0(P,k0),y.length===1&&y[0]===k0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else S0(P,k0);if(!C0)t.if(z._`${J.default.errors} === ${s||0}`)}}function S0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let L0 of y.rules)if((0,Y.shouldUseRule)(s,L0))z0(P,L0.keyword,L0.definition,y.type)})}function H0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(b(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function b(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!S(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:L0}=t.definition;if(L0.length&&!L0.some((T0)=>E(y,T0)))c(P,`missing type "${L0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function S(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(S(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,H.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,H.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",u0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",J.default.errors)}result(P,y,x){this.failResult((0,z.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,z.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(z._`${y} !== undefined && (${(0,z.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=z.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=z.nil,y=z.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:L0}=this;if(x.if((0,z.or)(z._`${s} === undefined`,y)),P!==z.nil)x.assign(P,!0);if(t.length||L0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==z.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,z.or)(L0(),T0());function L0(){if(x.length){if(!(y instanceof z.Name))throw Error("ajv implementation error");let C0=Array.isArray(x)?x:[x];return z._`${(0,G.checkDataTypes)(C0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return z.nil}function T0(){if(s.validateSchema){let C0=P.scopeValue("validate$data",{ref:s.validateSchema});return z._`!${C0}(${y})`}return z.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return j(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=H.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=H.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,z.Name)),!0}};W.KeywordCxt=r;function z0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,D0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function u0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,L0;if(P==="")return J.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,L0=J.default.rootData}else{let b0=D0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let O0=+b0[1];if(t=b0[2],t==="#"){if(O0>=y)throw Error(f0("property/index",O0));return s[y-O0]}if(O0>y)throw Error(f0("data",O0));if(L0=x[y-O0],!t)return L0}let T0=L0,C0=t.split("/");for(let b0 of C0)if(b0)L0=z._`${L0}${(0,z.getProperty)((0,H.unescapeJsonPointer)(b0))}`,T0=z._`${T0} && ${L0}`;return T0;function f0(b0,O0){return`Cannot access ${b0} ${O0} levels up, current level is ${y}`}}W.getData=u0}),NX=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var Q=class extends Error{constructor(X){super("validation failed");this.errors=X,this.ajv=this.validation=!0}};W.default=Q}),sW=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=AX();var X=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,Q.resolveUrl)(Y,G,B),this.missingSchema=(0,Q.normalizeId)((0,Q.getFullPath)(Y,this.missingRef))}};W.default=X}),VX=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let Q=I0(),X=NX(),Y=_6(),G=AX(),B=v0(),F=aW();var L=class{constructor(Z){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof Z.schema=="object")U=Z.schema;this.schema=Z.schema,this.schemaId=Z.schemaId,this.root=Z.root||this,this.baseId=(V=Z.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[Z.schemaId||"$id"]),this.schemaPath=Z.schemaPath,this.localRefs=Z.localRefs,this.meta=Z.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function z(Z){let V=H.call(this,Z);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,Z.root.baseId),{es5:j,lines:R}=this.opts.code,{ownProperties:O}=this.opts,w=new Q.CodeGen(this.scope,{es5:j,lines:R,ownProperties:O}),T;if(Z.$async)T=w.scopeValue("Error",{ref:X.default,code:Q._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");Z.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[Q.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:Z.schema,code:(0,Q.stringify)(Z.schema)}:{ref:Z.schema}),validateName:k,ValidationError:T,schema:Z.schema,schemaEnv:Z,rootId:U,baseId:Z.baseId||U,schemaPath:Q.nil,errSchemaPath:Z.schemaPath||(this.opts.jtd?"":"#"),errorPath:Q._`""`,opts:this.opts,self:this},_;try{this._compilations.add(Z),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,Z);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=Z.schema,d.schemaEnv=Z,Z.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:K0}=l;if(d.evaluated={props:p instanceof Q.Name?void 0:p,items:K0 instanceof Q.Name?void 0:K0,dynamicProps:p instanceof Q.Name,dynamicItems:K0 instanceof Q.Name},d.source)d.source.evaluated=(0,Q.stringify)(d.evaluated)}return Z.validate=d,Z}catch(h){if(delete Z.validate,delete Z.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete(Z)}}W.compileSchema=z;function J(Z,V,U){var j;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let R=Z.refs[U];if(R)return R;let O=I.call(this,Z,U);if(O===void 0){let w=(j=Z.localRefs)===null||j===void 0?void 0:j[U],{schemaId:T}=this.opts;if(w)O=new L({schema:w,schemaId:T,root:Z,baseId:V})}if(O===void 0)return;return Z.refs[U]=K.call(this,O)}W.resolveRef=J;function K(Z){if((0,G.inlineRef)(Z.schema,this.opts.inlineRefs))return Z.schema;return Z.validate?Z:z.call(this,Z)}function H(Z){for(let V of this._compilations)if(D(V,Z))return V}W.getCompilingSchema=H;function D(Z,V){return Z.schema===V.schema&&Z.root===V.root&&Z.baseId===V.baseId}function I(Z,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,Z,V)}function A(Z,V){let U=this.opts.uriResolver.parse(V),j=(0,G._getFullPath)(this.opts.uriResolver,U),R=(0,G.getFullPath)(this.opts.uriResolver,Z.baseId,void 0);if(Object.keys(Z.schema).length>0&&j===R)return N.call(this,U,Z);let O=(0,G.normalizeId)(j),w=this.refs[O]||this.schemas[O];if(typeof w=="string"){let T=A.call(this,Z,w);if(typeof(T===null||T===void 0?void 0:T.schema)!=="object")return;return N.call(this,U,T)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)z.call(this,w);if(O===(0,G.normalizeId)(V)){let{schema:T}=w,{schemaId:k}=this.opts,l=T[k];if(l)R=(0,G.resolveUrl)(this.opts.uriResolver,R,l);return new L({schema:T,schemaId:k,root:Z,baseId:R})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N(Z,{baseId:V,schema:U,root:j}){var R;if(((R=Z.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let T of Z.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(T)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(T)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let O;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let T=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);O=A.call(this,j,T)}let{schemaId:w}=this.opts;if(O=O||new L({schema:U,schemaId:w,root:j,baseId:V}),O.schema!==O.root.schema)return O}}),fw=X0((W,Q)=>{Q.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}}),YZ=X0((W,Q)=>{let X=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=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 G(A){let M="",N=0,Z=0;for(Z=0;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z];break}for(Z+=1;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let Z=G(A);if(Z!=="")M.push(Z);else return N.error=!0,!1;A.length=0}return!0}function z(A){let M=0,N={error:!1,address:"",zone:""},Z=[],V=[],U=!1,j=!1,R=L;for(let O=0;O<A.length;O++){let w=A[O];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)j=!0;if(!R(V,Z,N))break;if(++M>7){N.error=!0;break}if(O>0&&A[O-1]===":")U=!0;Z.push(":");continue}else if(w==="%"){if(!R(V,Z,N))break;R=F}else{V.push(w);continue}}if(V.length)if(R===F)N.zone=V.join("");else if(j)Z.push(V.join(""));else Z.push(G(V));return N.address=Z.join(""),N}function J(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=z(A);if(!M.error){let{address:N,address:Z}=M;if(M.zone)N+="%"+M.zone,Z+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:Z}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let Z=0;Z<A.length;Z++)if(A[Z]===M)N++;return N}function H(A){let M=A,N=[],Z=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if((Z=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,Z)),M=M.slice(Z)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let Z=J(N);if(Z.isIPV6===!0)N=`[${Z.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}Q.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:H,isIPv4:Y,isUUID:X,normalizeIPv6:J,stringArrayToHexStripped:G}}),xw=X0((W,Q)=>{let{isUUID:X}=YZ(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function z(w){let T=String(w.scheme).toLowerCase()==="https";if(w.port===(T?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function J(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[T,k]=w.resourceName.split("?");w.path=T&&T!=="/"?T:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function H(w,T){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=T.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=O(`${l}:${T.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,T)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,T){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=T.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=O(`${k}:${T.nid||l}`);if(_)w=_.serialize(w,T);let h=w,d=w.nss;return h.path=`${l||T.nid}:${d}`,T.skipEscape=!0,h}function I(w,T){let k=w;if(k.uuid=k.nss,k.nss=void 0,!T.tolerant&&(!k.uuid||!X(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let T=w;return T.nss=(w.uuid||"").toLowerCase(),T}let M={scheme:"http",domainHost:!0,parse:L,serialize:z},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:z},Z={scheme:"ws",domainHost:!0,parse:J,serialize:K},V={scheme:"wss",domainHost:Z.domainHost,parse:Z.parse,serialize:Z.serialize},R={http:M,https:N,ws:Z,wss:V,urn:{scheme:"urn",parse:H,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(R,null);function O(w){return w&&(R[w]||R[w.toLowerCase()])||void 0}Q.exports={wsIsSecure:F,SCHEMES:R,isValidSchemeName:B,getSchemeHandler:O}}),hw=X0((W,Q)=>{let{normalizeIPv6:X,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=YZ(),{SCHEMES:z,getSchemeHandler:J}=xw();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function H(V,U,j){let R=j?Object.assign({scheme:"null"},j):{scheme:"null"},O=D(N(V,R),N(U,R),R,!0);return R.skipEscape=!0,A(O,R)}function D(V,U,j,R){let O={};if(!R)V=N(A(V,j),j),U=N(A(U,j),j);if(j=j||{},!j.tolerant&&U.scheme)O.scheme=U.scheme,O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(!U.path)if(O.path=V.path,U.query!==void 0)O.query=U.query;else O.query=V.query;else{if(U.path[0]==="/")O.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)O.path="/"+U.path;else if(!V.path)O.path=U.path;else O.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;O.path=Y(O.path)}O.query=U.query}O.userinfo=V.userinfo,O.host=V.host,O.port=V.port}O.scheme=V.scheme}return O.fragment=U.fragment,O}function I(V,U,j){if(typeof V==="string")V=unescape(V),V=A(B(N(V,j),!0),{...j,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...j,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,j),!0),{...j,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...j,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let j={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},R=Object.assign({},U),O=[],w=J(R.scheme||j.scheme);if(w&&w.serialize)w.serialize(j,R);if(j.path!==void 0)if(!R.skipEscape){if(j.path=escape(j.path),j.scheme!==void 0)j.path=j.path.split("%3A").join(":")}else j.path=unescape(j.path);if(R.reference!=="suffix"&&j.scheme)O.push(j.scheme,":");let T=G(j);if(T!==void 0){if(R.reference!=="suffix")O.push("//");if(O.push(T),j.path&&j.path[0]!=="/")O.push("/")}if(j.path!==void 0){let k=j.path;if(!R.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(T===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);O.push(k)}if(j.query!==void 0)O.push("?",j.query);if(j.fragment!==void 0)O.push("#",j.fragment);return O.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let j=Object.assign({},U),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},O=!1;if(j.reference==="suffix")if(j.scheme)V=j.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(R.scheme=w[1],R.userinfo=w[3],R.host=w[4],R.port=parseInt(w[5],10),R.path=w[6]||"",R.query=w[7],R.fragment=w[8],isNaN(R.port))R.port=w[5];if(R.host)if(F(R.host)===!1){let k=X(R.host);R.host=k.host.toLowerCase(),O=k.isIPV6}else O=!0;if(R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path)R.reference="same-document";else if(R.scheme===void 0)R.reference="relative";else if(R.fragment===void 0)R.reference="absolute";else R.reference="uri";if(j.reference&&j.reference!=="suffix"&&j.reference!==R.reference)R.error=R.error||"URI is not a "+j.reference+" reference.";let T=J(j.scheme||R.scheme);if(!j.unicodeSupport&&(!T||!T.unicodeSupport)){if(R.host&&(j.domainHost||T&&T.domainHost)&&O===!1&&L(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(k){R.error=R.error||"Host's domain name can not be converted to ASCII: "+k}}if(!T||T&&!T.skipNormalize){if(V.indexOf("%")!==-1){if(R.scheme!==void 0)R.scheme=unescape(R.scheme);if(R.host!==void 0)R.host=unescape(R.host)}if(R.path)R.path=escape(unescape(R.path));if(R.fragment)R.fragment=encodeURI(decodeURIComponent(R.fragment))}if(T&&T.parse)T.parse(R,j)}else R.error=R.error||"URI can not be parsed.";return R}let Z={SCHEMES:z,normalize:K,resolve:H,resolveComponent:D,equal:I,serialize:A,parse:N};Q.exports=Z,Q.exports.default=Z,Q.exports.fastUri=Z}),uw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=hw();Q.code='require("ajv/dist/runtime/uri").default',W.default=Q}),GZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var Q=aW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return Q.KeywordCxt}});var X=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return X._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return X.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return X.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return X.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return X.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return X.CodeGen}});let Y=NX(),G=sW(),B=WZ(),F=VX(),L=I0(),z=AX(),J=$X(),K=v0(),H=fw(),D=uw(),I=(b,v)=>new RegExp(b,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={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."},Z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(b){var v,u,E,S,C,c,r,z0,e,D0,u0,P,y,x,s,t,L0,T0,C0,f0,b0,O0,o0,k0,B1;let X1=b.strict,F1=(v=b.code)===null||v===void 0?void 0:v.optimize,Z1=F1===!0||F1===void 0?1:F1||0,H1=(E=(u=b.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,w1=(S=b.uriResolver)!==null&&S!==void 0?S:D.default;return{strictSchema:(c=(C=b.strictSchema)!==null&&C!==void 0?C:X1)!==null&&c!==void 0?c:!0,strictNumbers:(z0=(r=b.strictNumbers)!==null&&r!==void 0?r:X1)!==null&&z0!==void 0?z0:!0,strictTypes:(D0=(e=b.strictTypes)!==null&&e!==void 0?e:X1)!==null&&D0!==void 0?D0:"log",strictTuples:(P=(u0=b.strictTuples)!==null&&u0!==void 0?u0:X1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=b.strictRequired)!==null&&y!==void 0?y:X1)!==null&&x!==void 0?x:!1,code:b.code?{...b.code,optimize:Z1,regExp:H1}:{optimize:Z1,regExp:H1},loopRequired:(s=b.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=b.loopEnum)!==null&&t!==void 0?t:V,meta:(L0=b.meta)!==null&&L0!==void 0?L0:!0,messages:(T0=b.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(C0=b.inlineRefs)!==null&&C0!==void 0?C0:!0,schemaId:(f0=b.schemaId)!==null&&f0!==void 0?f0:"$id",addUsedSchema:(b0=b.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(O0=b.validateSchema)!==null&&O0!==void 0?O0:!0,validateFormats:(o0=b.validateFormats)!==null&&o0!==void 0?o0:!0,unicodeRegExp:(k0=b.unicodeRegExp)!==null&&k0!==void 0?k0:!0,int32range:(B1=b.int32range)!==null&&B1!==void 0?B1:!0,uriResolver:w1}}var j=class{constructor(b={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,b=this.opts={...b,...U(b)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(b.logger);let E=b.validateFormats;if(b.validateFormats=!1,this.RULES=(0,B.getRules)(),R.call(this,N,b,"NOT SUPPORTED"),R.call(this,Z,b,"DEPRECATED","warn"),this._metaOpts=l.call(this),b.formats)T.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),b.keywords)k.call(this,b.keywords);if(typeof b.meta=="object")this.addMetaSchema(b.meta);w.call(this),b.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:b,meta:v,schemaId:u}=this.opts,E=H;if(u==="id")E={...H},E.id=E.$id,delete E.$id;if(v&&b)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:b,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof b=="object"?b[v]||b:void 0}validate(b,v){let u;if(typeof b=="string"){if(u=this.getSchema(b),!u)throw Error(`no schema with key or ref "${b}"`)}else u=this.compile(b);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(b,v){let u=this._addSchema(b,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(b,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,b,v);async function E(e,D0){await S.call(this,e.$schema);let u0=this._addSchema(e,D0);return u0.validate||C.call(this,u0)}async function S(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(D0){if(!(D0 instanceof G.default))throw D0;return c.call(this,D0),await r.call(this,D0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:D0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${D0} cannot be resolved`)}async function r(e){let D0=await z0.call(this,e);if(!this.refs[e])await S.call(this,D0.$schema);if(!this.refs[e])this.addSchema(D0,e,v)}async function z0(e){let D0=this._loading[e];if(D0)return D0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(b,v,u,E=this.opts.validateSchema){if(Array.isArray(b)){for(let C of b)this.addSchema(C,void 0,u,E);return this}let S;if(typeof b==="object"){let{schemaId:C}=this.opts;if(S=b[C],S!==void 0&&typeof S!="string")throw Error(`schema ${C} must be string`)}return v=(0,z.normalizeId)(v||S),this._checkUnique(v),this.schemas[v]=this._addSchema(b,u,v,E,!0),this}addMetaSchema(b,v,u=this.opts.validateSchema){return this.addSchema(b,v,!0,u),this}validateSchema(b,v){if(typeof b=="boolean")return!0;let u;if(u=b.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,b);if(!E&&v){let S="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(S);else throw Error(S)}return E}getSchema(b){let v;while(typeof(v=O.call(this,b))=="string")b=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,b),!v)return;this.refs[b]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(b){if(b instanceof RegExp)return this._removeAllSchemas(this.schemas,b),this._removeAllSchemas(this.refs,b),this;switch(typeof b){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=O.call(this,b);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[b],delete this.refs[b],this}case"object":{let v=b;this._cache.delete(v);let u=b[this.opts.schemaId];if(u)u=(0,z.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(b){for(let v of b)this.addKeyword(v);return this}addKeyword(b,v){let u;if(typeof b=="string"){if(u=b,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof b=="object"&&v===void 0){if(v=b,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(S)=>K0.call(this,S)),this;w0.call(this,v);let E={...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(S)=>K0.call(this,S,E):(S)=>E.type.forEach((C)=>K0.call(this,S,E,C))),this}getKeyword(b){let v=this.RULES.all[b];return typeof v=="object"?v.definition:!!v}removeKeyword(b){let{RULES:v}=this;delete v.keywords[b],delete v.all[b];for(let u of v.rules){let E=u.rules.findIndex((S)=>S.keyword===b);if(E>=0)u.rules.splice(E,1)}return this}addFormat(b,v){if(typeof v=="string")v=new RegExp(v);return this.formats[b]=v,this}errorsText(b=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!b||b.length===0)return"No errors";return b.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,S)=>E+v+S)}$dataMetaSchema(b,v){let u=this.RULES.all;b=JSON.parse(JSON.stringify(b));for(let E of v){let S=E.split("/").slice(1),C=b;for(let c of S)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:z0}=r.definition,e=C[c];if(z0&&e)C[c]=H0(e)}}return b}_removeAllSchemas(b,v){for(let u in b){let E=b[u];if(!v||v.test(u)){if(typeof E=="string")delete b[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete b[u]}}}_addSchema(b,v,u,E=this.opts.validateSchema,S=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof b=="object")C=b[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof b!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(b);if(r!==void 0)return r;u=(0,z.normalizeId)(C||u);let z0=z.getSchemaRefs.call(this,b,u);if(r=new F.SchemaEnv({schema:b,schemaId:c,meta:v,baseId:u,localRefs:z0}),this._cache.set(r.schema,r),S&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(b,!0);return r}_checkUnique(b){if(this.schemas[b]||this.refs[b])throw Error(`schema with key or id "${b}" already exists`)}_compileSchemaEnv(b){if(b.meta)this._compileMetaSchema(b);else F.compileSchema.call(this,b);if(!b.validate)throw Error("ajv implementation error");return b.validate}_compileMetaSchema(b){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,b)}finally{this.opts=v}}};j.ValidationError=Y.default,j.MissingRefError=G.default,W.default=j;function R(b,v,u,E="error"){for(let S in b){let C=S;if(C in v)this.logger[E](`${u}: option ${S}. ${b[C]}`)}}function O(b){return b=(0,z.normalizeId)(b),this.schemas[b]||this.refs[b]}function w(){let b=this.opts.schemas;if(!b)return;if(Array.isArray(b))this.addSchema(b);else for(let v in b)this.addSchema(b[v],v)}function T(){for(let b in this.opts.formats){let v=this.opts.formats[b];if(v)this.addFormat(b,v)}}function k(b){if(Array.isArray(b)){this.addVocabulary(b);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in b){let u=b[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let b={...this.opts};for(let v of A)delete b[v];return b}let _={log(){},warn(){},error(){}};function h(b){if(b===!1)return _;if(b===void 0)return console;if(b.log&&b.warn&&b.error)return b;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(b,v){let{RULES:u}=this;if((0,K.eachItem)(b,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function K0(b,v,u){var E;let S=v===null||v===void 0?void 0:v.post;if(u&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=S?C.post:C.rules.find(({type:z0})=>z0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[b]=!0,!v)return;let r={keyword:b,definition:{...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)}};if(v.before)j0.call(this,c,r,v.before);else c.rules.push(r);C.all[b]=r,(E=v.implements)===null||E===void 0||E.forEach((z0)=>this.addKeyword(z0))}function j0(b,v,u){let E=b.rules.findIndex((S)=>S.keyword===u);if(E>=0)b.rules.splice(E,0,v);else b.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function w0(b){let{metaSchema:v}=b;if(v===void 0)return;if(b.$data&&this.opts.$data)v=H0(v);b.validateSchema=this.compile(v,!0)}let S0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H0(b){return{anyOf:[b,S0]}}}),lw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=Q}),M7=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let Q=sW(),X=g6(),Y=I0(),G=_6(),B=VX(),F=v0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:H,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:Z,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return R();let j=B.resolveRef.call(V,U,A,D);if(j===void 0)throw new Q.default(I.opts.uriResolver,A,D);if(j instanceof B.SchemaEnv)return O(j);return w(j);function R(){if(M===U)return J(K,N,M,M.$async);let T=H.scopeValue("root",{ref:U});return J(K,Y._`${T}.validate`,U,U.$async)}function O(T){J(K,z(K,T),T,T.$async)}function w(T){let k=H.scopeValue("schema",Z.code.source===!0?{ref:T,code:(0,Y.stringify)(T)}:{ref:T}),l=H.name("valid"),_=K.subschema({schema:T,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function z(K,H){let{gen:D}=K;return H.validate?D.scopeValue("validate",{ref:H.validate}):Y._`${D.scopeValue("wrapper",{ref:H})}.validate`}W.getValidate=z;function J(K,H,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:Z,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)j();else R();function j(){if(!Z.$async)throw Error("async schema referenced by sync schema");let T=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,X.callValidateCode)(K,H,U)}`),w(H),!N)A.assign(T,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),O(k),!N)A.assign(T,!1)}),K.ok(T)}function R(){K.result((0,X.callValidateCode)(K,H,U),()=>w(H),()=>O(H))}function O(T){let k=Y._`${T}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(T){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${T}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${T}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=J,W.default=L}),BZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lw(),X=M7(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q.default,X.default];W.default=Y}),mw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=Q.operators,Y={maximum:{okStr:"<=",ok:X.LTE,fail:X.GT},minimum:{okStr:">=",ok:X.GTE,fail:X.LT},exclusiveMaximum:{okStr:"<",ok:X.LT,fail:X.GTE},exclusiveMinimum:{okStr:">",ok:X.GT,fail:X.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>Q.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>Q._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:z}=B;B.fail$data(Q._`${L} ${Y[F].fail} ${z} || isNaN(${L})`)}};W.default=G}),cw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>Q._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,z=L.opts.multipleOfPrecision,J=G.let("res"),K=z?Q._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:Q._`${J} !== parseInt(${J})`;Y.fail$data(Q._`(${F} === 0 || (${J} = ${B}/${F}, ${K}))`)}};W.default=X}),pw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function Q(X){let Y=X.length,G=0,B=0,F;while(B<Y)if(G++,F=X.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=X.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=Q,Q.code='require("ajv/dist/runtime/ucs2length").default'}),dw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=pw(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return Q.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>Q._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:z,it:J}=B,K=F==="maxLength"?Q.operators.GT:Q.operators.LT,H=J.opts.unicode===!1?Q._`${L}.length`:Q._`${(0,X.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(Q._`${H} ${K} ${z}`)}};W.default=G}),iw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=g6(),X=v0(),Y=I0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:H}=B,D=H.opts.unicodeRegExp?"u":"";if(z){let{regExp:I}=H.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,X.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,Q.usePattern)(B,J);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),nw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`Object.keys(${B}).length ${L} ${F}`)}};W.default=X}),rw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=g6(),X=I0(),Y=v0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>X.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>X._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:z,data:J,$data:K,it:H}=B,{opts:D}=H;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(H.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let j of L)if((V===null||V===void 0?void 0:V[j])===void 0&&!U.has(j)){let R=`required property "${j}" is not defined at "${H.schemaEnv.baseId+H.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(H,R,H.opts.strictRequired)}}function A(){if(I||K)B.block$data(X.nil,N);else for(let V of L)(0,Q.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>Z(V,U)),B.ok(U)}else F.if((0,Q.checkMissingProp)(B,L,V)),(0,Q.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",z,(V)=>{B.setParams({missingProperty:V}),F.if((0,Q.noPropertyInData)(F,J,V,D.ownProperties),()=>B.error())})}function Z(V,U){B.setParams({missingProperty:V}),F.forOf(V,z,()=>{F.assign(U,(0,Q.propertyInData)(F,J,V,D.ownProperties)),F.if((0,X.not)(U),()=>{B.error(),F.break()})},X.nil)}}};W.default=G}),ow=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`${B}.length ${L} ${F}`)}};W.default=X}),j7=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=XZ();Q.code='require("ajv/dist/runtime/equal").default',W.default=Q}),aw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=$X(),X=I0(),Y=v0(),G=j7(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>X.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>X._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:z,$data:J,schema:K,parentSchema:H,schemaCode:D,it:I}=F;if(!J&&!K)return;let A=L.let("valid"),M=H.items?(0,Q.getSchemaTypes)(H.items):[];F.block$data(A,N,X._`${D} === false`),F.ok(A);function N(){let j=L.let("i",X._`${z}.length`),R=L.let("j");F.setParams({i:j,j:R}),L.assign(A,!0),L.if(X._`${j} > 1`,()=>(Z()?V:U)(j,R))}function Z(){return M.length>0&&!M.some((j)=>j==="object"||j==="array")}function V(j,R){let O=L.name("item"),w=(0,Q.checkDataTypes)(M,O,I.opts.strictNumbers,Q.DataType.Wrong),T=L.const("indices",X._`{}`);L.for(X._`;${j}--;`,()=>{if(L.let(O,X._`${z}[${j}]`),L.if(w,X._`continue`),M.length>1)L.if(X._`typeof ${O} == "string"`,X._`${O} += "_"`);L.if(X._`typeof ${T}[${O}] == "number"`,()=>{L.assign(R,X._`${T}[${O}]`),F.error(),L.assign(A,!1).break()}).code(X._`${T}[${O}] = ${j}`)})}function U(j,R){let O=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(X._`;${j}--;`,()=>L.for(X._`${R} = ${j}; ${R}--;`,()=>L.if(X._`${O}(${z}[${j}], ${z}[${R}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),sw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=j7(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>Q._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:z,schemaCode:J,schema:K}=B;if(z||K&&typeof K=="object")B.fail$data(Q._`!${(0,X.useFunc)(F,Y.default)}(${L}, ${J})`);else B.fail(Q._`${K} !== ${L}`)}};W.default=G}),tw=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=j7(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>Q._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:H}=B;if(!z&&J.length===0)throw Error("enum must have non-empty array");let D=J.length>=H.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,X.useFunc)(F,Y.default),M;if(D||z)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(J))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,Q.or)(...J.map((U,j)=>Z(V,j)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(Q._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function Z(V,U){let j=J[U];return typeof j==="object"&&j!==null?Q._`${A()}(${L}, ${V}[${U}])`:Q._`${L} === ${j}`}}};W.default=G}),FZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=mw(),X=cw(),Y=dw(),G=iw(),B=nw(),F=rw(),L=ow(),z=aw(),J=sw(),K=tw(),H=[Q.default,X.default,Y.default,G.default,B.default,F.default,L.default,z.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},J.default,K.default];W.default=H}),LZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let Q=I0(),X=v0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>Q.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>Q._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:z}=F;if(!Array.isArray(z)){(0,X.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,z)}};function G(B,F){let{gen:L,schema:z,data:J,keyword:K,it:H}=B;H.items=!0;let D=L.const("len",Q._`${J}.length`);if(z===!1)B.setParams({len:F.length}),B.pass(Q._`${D} <= ${F.length}`);else if(typeof z=="object"&&!(0,X.alwaysValidSchema)(H,z)){let A=L.var("valid",Q._`${D} <= ${F.length}`);L.if((0,Q.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:X.Type.Num},A),!H.allErrors)L.if((0,Q.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),zZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let Q=I0(),X=v0(),Y=g6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:z}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(z.items=!0,(0,X.alwaysValidSchema)(z,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,z=F.schema){let{gen:J,parentSchema:K,data:H,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&z.length&&I.items!==!0)I.items=X.mergeEvaluated.items(J,z.length,I.items);let A=J.name("valid"),M=J.const("len",Q._`${H}.length`);z.forEach((Z,V)=>{if((0,X.alwaysValidSchema)(I,Z))return;J.if(Q._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N(Z){let{opts:V,errSchemaPath:U}=I,j=z.length,R=j===Z.minItems&&(j===Z.maxItems||Z[L]===!1);if(V.strictTuples&&!R){let O=`"${D}" is ${j}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,X.checkStrictMode)(I,O,V.strictTuples)}}}W.validateTuple=B,W.default=G}),ew=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=zZ(),X={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,Q.validateTuple)(Y,"items")};W.default=X}),W3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=g6(),G=LZ(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>Q.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>Q._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:z,it:J}=F,{prefixItems:K}=z;if(J.items=!0,(0,X.alwaysValidSchema)(J,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),Q3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?Q.str`must contain at least ${G} valid item(s)`:Q.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?Q._`{minContains: ${G}}`:Q._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:z,it:J}=G,K,H,{minContains:D,maxContains:I}=L;if(J.opts.next)K=D===void 0?1:D,H=I;else K=1;let A=B.const("len",Q._`${z}.length`);if(G.setParams({min:K,max:H}),H===void 0&&K===0){(0,X.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&K>H){(0,X.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,X.alwaysValidSchema)(J,F)){let U=Q._`${A} >= ${K}`;if(H!==void 0)U=Q._`${U} && ${A} <= ${H}`;G.pass(U);return}J.items=!0;let M=B.name("valid");if(H===void 0&&K===1)Z(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),H!==void 0)B.if(Q._`${z}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),j=B.let("count",0);Z(U,()=>B.if(U,()=>V(j)))}function Z(U,j){B.forRange("i",0,A,(R)=>{G.subschema({keyword:"contains",dataProp:R,dataPropType:X.Type.Num,compositeRule:!0},U),j()})}function V(U){if(B.code(Q._`${U}++`),H===void 0)B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(Q._`${U} > ${H}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),O7=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let Q=I0(),X=v0(),Y=g6();W.error={message:({params:{property:z,depsCount:J,deps:K}})=>{let H=J===1?"property":"properties";return Q.str`must have ${H} ${K} when property ${z} is present`},params:({params:{property:z,depsCount:J,deps:K,missingProperty:H}})=>Q._`{property: ${z},
96
- missingProperty: ${H},
203
+ */iw=Q0((W)=>{var X=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var z=typeof L==="object"?B(L):L;if(typeof z!=="string")throw TypeError("argument string is required to be a string");var J=z.indexOf(";"),K=J!==-1?z.slice(0,J).trim():z.trim();if(!Y.test(K))throw TypeError("invalid media type");var Z=new F(K.toLowerCase());if(J!==-1){var D,I,A;X.lastIndex=J;while(I=X.exec(z)){if(I.index!==J)throw TypeError("invalid parameter format");if(J+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(Q,"$1")}Z.parameters[D]=A}if(J!==z.length)throw TypeError("invalid parameter format")}return Z}function B(L){var z;if(typeof L.getHeader==="function")z=L.getHeader("content-type");else if(typeof L.headers==="object")z=L.headers&&L.headers["content-type"];if(typeof z!=="string")throw TypeError("content-type header is missing from object");return z}function F(L){this.parameters=Object.create(null),this.type=L}}),WP=bX(iw(),1);nw=/^[A-Za-z0-9._-]{1,128}$/});function ZD(){let W=new LD.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return KD(W),W}var DQ,HZ,I0,v0,g6,OQ,ew,UZ,AZ,MQ,W3,f6,X3,Q3,NZ,Y3,jQ,QX,EQ,YX,IQ,G3,VZ,B3,F3,L3,wZ,z3,C7,DZ,J3,K3,Z3,$3,H3,U3,A3,N3,k7,V3,w3,D3,MZ,OZ,jZ,M3,O3,j3,v7,E3,EZ,I3,R3,T3,P3,S3,b3,q3,C3,IZ,k3,RZ,TZ,v3,y3,PZ,_3,SZ,bZ,qZ,g3,f3,x3,h3,u3,l3,m3,c3,p3,d3,i3,n3,r3,o3,a3,s3,t3,e3,WD,XD,QD,YD,GD,BD,FD,LD,zD,JD,KD,RQ=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=ZD()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!JD.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let X=this.ajv,Q="$id"in W&&typeof W.$id==="string"?X.getSchema(W.$id)??X.compile(W):X.compile(W);return(Y)=>{return Q(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:X.errorsText(Q.errors)}}}},KP;var CZ=H0(()=>{EY();DQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var X=class{};W._CodeOrName=X,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Q=class extends X{constructor($){super();if(!W.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=Q;var Y=class extends X{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((V,U)=>{if(U instanceof Q)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G($,...V){let U=[$[0]],O=0;while(O<V.length)L(U,V[O]),U.push($[++O]);return new Y(U)}W._=G;let B=new Y("+");function F($,...V){let U=[I($[0])],O=0;while(O<V.length)U.push(B),L(U,V[O]),U.push(B,I($[++O]));return z(U),new Y(U)}W.str=F;function L($,V){if(V instanceof Y)$.push(...V._items);else if(V instanceof Q)$.push(V);else $.push(Z(V))}W.addCodeArg=L;function z($){let V=1;while(V<$.length-1){if($[V]===B){let U=J($[V-1],$[V+1]);if(U!==void 0){$.splice(V-1,3,U);continue}$[V++]="+"}V++}}function J($,V){if(V==='""')return $;if($==='""')return V;if(typeof $=="string"){if(V instanceof Q||$[$.length-1]!=='"')return;if(typeof V!="string")return`${$.slice(0,-1)}${V}"`;if(V[0]==='"')return $.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!($ instanceof Q))return`"${$}${V.slice(1)}`}function K($,V){return V.emptyStr()?$:$.emptyStr()?V:F`${$}${V}`}W.strConcat=K;function Z($){return typeof $=="number"||typeof $=="boolean"||$===null?$:I(Array.isArray($)?$.join(","):$)}function D($){return new Y(I($))}W.stringify=D;function I($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A($){return typeof $=="string"&&W.IDENTIFIER.test($)?new Y(`.${$}`):G`[${$}]`}W.getProperty=A;function M($){if(typeof $=="string"&&W.IDENTIFIER.test($))return new Y(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}W.getEsmExportName=M;function N($){return new Y($.toString())}W.regexpCode=N}),HZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let X=DQ();var Q=class extends Error{constructor(z){super(`CodeGen: "code" for ${z} not defined`);this.value=z.value}},Y;(function(z){z[z.Started=0]="Started",z[z.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new X.Name("const"),let:new X.Name("let"),var:new X.Name("var")};var G=class{constructor({prefixes:z,parent:J}={}){this._names={},this._prefixes=z,this._parent=J}toName(z){return z instanceof X.Name?z:this.name(z)}name(z){return new X.Name(this._newName(z))}_newName(z){let J=this._names[z]||this._nameGroup(z);return`${z}${J.index++}`}_nameGroup(z){var J,K;if(((K=(J=this._parent)===null||J===void 0?void 0:J._prefixes)===null||K===void 0?void 0:K.has(z))||this._prefixes&&!this._prefixes.has(z))throw Error(`CodeGen: prefix "${z}" is not allowed in this scope`);return this._names[z]={prefix:z,index:0}}};W.Scope=G;var B=class extends X.Name{constructor(z,J){super(J);this.prefix=z}setValue(z,{property:J,itemIndex:K}){this.value=z,this.scopePath=X._`.${new X.Name(J)}[${K}]`}};W.ValueScopeName=B;let F=X._`\n`;var L=class extends G{constructor(z){super(z);this._values={},this._scope=z.scope,this.opts={...z,_n:z.lines?F:X.nil}}get(){return this._scope}name(z){return new B(z,this._newName(z))}value(z,J){var K;if(J.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Z=this.toName(z),{prefix:D}=Z,I=(K=J.key)!==null&&K!==void 0?K:J.ref,A=this._values[D];if(A){let $=A.get(I);if($)return $}else A=this._values[D]=new Map;A.set(I,Z);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=J.ref,Z.setValue(J,{property:D,itemIndex:N}),Z}getValue(z,J){let K=this._values[z];if(!K)return;return K.get(J)}scopeRefs(z,J=this._values){return this._reduceValues(J,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return X._`${z}${K.scopePath}`})}scopeCode(z=this._values,J,K){return this._reduceValues(z,(Z)=>{if(Z.value===void 0)throw Error(`CodeGen: name "${Z}" has no value`);return Z.value.code},J,K)}_reduceValues(z,J,K={},Z){let D=X.nil;for(let I in z){let A=z[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let $=J(N);if($){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=X._`${D}${V} ${N} = ${$};${this.opts._n}`}else if($=Z===null||Z===void 0?void 0:Z(N))D=X._`${D}${$}${this.opts._n}`;else throw new Q(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),I0=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let X=DQ(),Q=HZ();var Y=DQ();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=HZ();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,S){return this}},F=class extends B{constructor(E,S,C){super();this.varKind=E,this.name=S,this.rhs=C}render({es5:E,_n:S}){let C=E?Q.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+S}optimizeNames(E,S){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,S);return this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,S,C){super();this.lhs=E,this.rhs=S,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,S){if(this.lhs instanceof X.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,S),this}get names(){return d(this.lhs instanceof X.Name?{}:{...this.lhs.names},this.rhs)}},z=class extends L{constructor(E,S,C,c){super(E,C,c);this.op=S}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},J=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},Z=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,S){return this.code=p(this.code,E,S),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((S,C)=>S+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,S=E.length;while(S--){let C=E[S].optimizeNodes();if(Array.isArray(C))E.splice(S,1,...C);else if(C)E[S]=C;else E.splice(S,1)}return E.length>0?this:void 0}optimizeNames(E,S){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,S))continue;K0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,S)=>h(E,S.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var $=class E extends A{constructor(S,C){super(C);this.condition=S}render(S){let C=`if(${this.condition})`+super.render(S);if(this.else)C+="else "+this.else.render(S);return C}optimizeNodes(){super.optimizeNodes();let S=this.condition;if(S===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(S===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(O0(S),C instanceof E?[C]:C.nodes)}if(S===!1||!this.nodes.length)return;return this}optimizeNames(S,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(S,C),!(super.optimizeNames(S,C)||this.else))return;return this.condition=p(this.condition,S,C),this}get names(){let S=super.names;if(d(S,this.condition),this.else)h(S,this.else.names);return S}};$.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iteration=p(this.iteration,E,S),this}get names(){return h(super.names,this.iteration.names)}},O=class extends V{constructor(E,S,C,c){super();this.varKind=E,this.name=S,this.from=C,this.to=c}render(E){let S=E.es5?Q.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${S} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},R=class extends V{constructor(E,S,C,c){super();this.loop=E,this.varKind=S,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iterable=p(this.iterable,E,S),this}get names(){return h(super.names,this.iterable.names)}},j=class extends A{constructor(E,S,C){super();this.name=E,this.args=S,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};j.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var T=class extends A{render(E){let S="try"+super.render(E);if(this.catch)S+=this.catch.render(E);if(this.finally)S+=this.finally.render(E);return S}optimizeNodes(){var E,S;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(S=this.finally)===null||S===void 0||S.optimizeNodes(),this}optimizeNames(E,S){var C,c;return super.optimizeNames(E,S),(C=this.catch)===null||C===void 0||C.optimizeNames(E,S),(c=this.finally)===null||c===void 0||c.optimizeNames(E,S),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,S={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...S,_n:S.lines?`
204
+ `:""},this._extScope=E,this._scope=new Q.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,S){let C=this._extScope.value(E,S);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,S){return this._extScope.getValue(E,S)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,S,C,c){let r=this._scope.toName(S);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,S,C){return this._def(Q.varKinds.const,E,S,C)}let(E,S,C){return this._def(Q.varKinds.let,E,S,C)}var(E,S,C){return this._def(Q.varKinds.var,E,S,C)}assign(E,S,C){return this._leafNode(new L(E,S,C))}add(E,S){return this._leafNode(new z(E,W.operators.ADD,S))}code(E){if(typeof E=="function")E();else if(E!==X.nil)this._leafNode(new D(E));return this}object(...E){let S=["{"];for(let[C,c]of E){if(S.length>1)S.push(",");if(S.push(C),C!==c||this.opts.es5)S.push(":"),(0,X.addCodeArg)(S,c)}return S.push("}"),new X._Code(S)}if(E,S,C){if(this._blockNode(new $(E)),S&&C)this.code(S).else().code(C).endIf();else if(S)this.code(S).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new $(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode($,N)}_for(E,S){if(this._blockNode(E),S)this.code(S).endFor();return this}for(E,S){return this._for(new U(E),S)}forRange(E,S,C,c,r=this.opts.es5?Q.varKinds.var:Q.varKinds.let){let z0=this._scope.toName(E);return this._for(new O(r,z0,S,C),()=>c(z0))}forOf(E,S,C,c=Q.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let z0=S instanceof X.Name?S:this.var("_arr",S);return this.forRange("_i",0,X._`${z0}.length`,(e)=>{this.var(r,X._`${z0}[${e}]`),C(r)})}return this._for(new R("of",c,r,S),()=>C(r))}forIn(E,S,C,c=this.opts.es5?Q.varKinds.var:Q.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,X._`Object.keys(${S})`,C);let r=this._scope.toName(E);return this._for(new R("in",c,r,S),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new J(E))}break(E){return this._leafNode(new K(E))}return(E){let S=new w;if(this._blockNode(S),this.code(E),S.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,S,C){if(!S&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new T;if(this._blockNode(c),this.code(E),S){let r=this.name("e");this._currNode=c.catch=new k(r),S(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new Z(E))}block(E,S){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(S);return this}endBlock(E){let S=this._blockStarts.pop();if(S===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-S;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=S,this}func(E,S=X.nil,C,c){if(this._blockNode(new j(E,S,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(j)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,S){let C=this._currNode;if(C instanceof E||S&&C instanceof S)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${S?`${E.kind}/${S.kind}`:E.kind}"`)}_elseNode(E){let S=this._currNode;if(!(S instanceof $))throw Error('CodeGen: "else" without "if"');return this._currNode=S.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let S=this._nodes;S[S.length-1]=E}};W.CodeGen=_;function h(E,S){for(let C in S)E[C]=(E[C]||0)+(S[C]||0);return E}function d(E,S){return S instanceof X._CodeOrName?h(E,S.names):E}function p(E,S,C){if(E instanceof X.Name)return c(E);if(!r(E))return E;return new X._Code(E._items.reduce((z0,e)=>{if(e instanceof X.Name)e=c(e);if(e instanceof X._Code)z0.push(...e._items);else z0.push(e);return z0},[]));function c(z0){let e=C[z0.str];if(e===void 0||S[z0.str]!==1)return z0;return delete S[z0.str],e}function r(z0){return z0 instanceof X._Code&&z0._items.some((e)=>e instanceof X.Name&&S[e.str]===1&&C[e.str]!==void 0)}}function K0(E,S){for(let C in S)E[C]=(E[C]||0)-(S[C]||0)}function O0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:X._`!${u(E)}`}W.not=O0;let w0=v(W.operators.AND);function S0(...E){return E.reduce(w0)}W.and=S0;let $0=v(W.operators.OR);function b(...E){return E.reduce($0)}W.or=b;function v(E){return(S,C)=>S===X.nil?C:C===X.nil?S:X._`${u(S)} ${E} ${u(C)}`}function u(E){return E instanceof X.Name?E:X._`(${E})`}}),v0=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let X=I0(),Q=DQ();function Y(j){let w={};for(let T of j)w[T]=!0;return w}W.toHash=Y;function G(j,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(j,w),!F(w,j.self.RULES.all)}W.alwaysValidSchema=G;function B(j,w=j.schema){let{opts:T,self:k}=j;if(!T.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])R(j,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(j,w){if(typeof j=="boolean")return!j;for(let T in j)if(w[T])return!0;return!1}W.schemaHasRules=F;function L(j,w){if(typeof j=="boolean")return!j;for(let T in j)if(T!=="$ref"&&w.all[T])return!0;return!1}W.schemaHasRulesButRef=L;function z({topSchemaRef:j,schemaPath:w},T,k,l){if(!l){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return X._`${T}`}return X._`${j}${w}${(0,X.getProperty)(k)}`}W.schemaRefOrVal=z;function J(j){return D(decodeURIComponent(j))}W.unescapeFragment=J;function K(j){return encodeURIComponent(Z(j))}W.escapeFragment=K;function Z(j){if(typeof j=="number")return`${j}`;return j.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=Z;function D(j){return j.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(j,w){if(Array.isArray(j))for(let T of j)w(T);else w(j)}W.eachItem=I;function A({mergeNames:j,mergeToName:w,mergeValues:T,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof X.Name?(_ instanceof X.Name?j(l,_,h):w(l,_,h),h):_ instanceof X.Name?(w(l,h,_),_):T(_,h);return d===X.Name&&!(p instanceof X.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(j,w,T)=>j.if(X._`${T} !== true && ${w} !== undefined`,()=>{j.if(X._`${w} === true`,()=>j.assign(T,!0),()=>j.assign(T,X._`${T} || {}`).code(X._`Object.assign(${T}, ${w})`))}),mergeToName:(j,w,T)=>j.if(X._`${T} !== true`,()=>{if(w===!0)j.assign(T,!0);else j.assign(T,X._`${T} || {}`),N(j,T,w)}),mergeValues:(j,w)=>j===!0?!0:{...j,...w},resultToName:M}),items:A({mergeNames:(j,w,T)=>j.if(X._`${T} !== true && ${w} !== undefined`,()=>j.assign(T,X._`${w} === true ? true : ${T} > ${w} ? ${T} : ${w}`)),mergeToName:(j,w,T)=>j.if(X._`${T} !== true`,()=>j.assign(T,w===!0?!0:X._`${T} > ${w} ? ${T} : ${w}`)),mergeValues:(j,w)=>j===!0?!0:Math.max(j,w),resultToName:(j,w)=>j.var("items",w)})};function M(j,w){if(w===!0)return j.var("props",!0);let T=j.var("props",X._`{}`);if(w!==void 0)N(j,T,w);return T}W.evaluatedPropsToName=M;function N(j,w,T){Object.keys(T).forEach((k)=>j.assign(X._`${w}${(0,X.getProperty)(k)}`,!0))}W.setEvaluated=N;let $={};function V(j,w){return j.scopeValue("func",{ref:w,code:$[w.code]||($[w.code]=new Q._Code(w.code))})}W.useFunc=V;var U;(function(j){j[j.Num=0]="Num",j[j.Str=1]="Str"})(U||(W.Type=U={}));function O(j,w,T){if(j instanceof X.Name){let k=w===U.Num;return T?k?X._`"[" + ${j} + "]"`:X._`"['" + ${j} + "']"`:k?X._`"/" + ${j}`:X._`"/" + ${j}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,X.getProperty)(j).toString():"/"+Z(j)}W.getErrorPath=O;function R(j,w,T=j.opts.strictSchema){if(!T)return;if(w=`strict mode: ${w}`,T===!0)throw Error(w);j.self.logger.warn(w)}W.checkStrictMode=R}),g6=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q={data:new X.Name("data"),valCxt:new X.Name("valCxt"),instancePath:new X.Name("instancePath"),parentData:new X.Name("parentData"),parentDataProperty:new X.Name("parentDataProperty"),rootData:new X.Name("rootData"),dynamicAnchors:new X.Name("dynamicAnchors"),vErrors:new X.Name("vErrors"),errors:new X.Name("errors"),this:new X.Name("this"),self:new X.Name("self"),scope:new X.Name("scope"),json:new X.Name("json"),jsonPos:new X.Name("jsonPos"),jsonLen:new X.Name("jsonLen"),jsonPart:new X.Name("jsonPart")};W.default=Q}),OQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let X=I0(),Q=v0(),Y=g6();W.keywordError={message:({keyword:N})=>X.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:$})=>$?X.str`"${N}" keyword must be ${$} ($data)`:X.str`"${N}" keyword is invalid ($data)`};function G(N,$=W.keywordError,V,U){let{it:O}=N,{gen:R,compositeRule:j,allErrors:w}=O,T=Z(N,$,V);if(U!==null&&U!==void 0?U:j||w)z(R,T);else J(O,X._`[${T}]`)}W.reportError=G;function B(N,$=W.keywordError,V){let{it:U}=N,{gen:O,compositeRule:R,allErrors:j}=U;if(z(O,Z(N,$,V)),!(R||j))J(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,$){N.assign(Y.default.errors,$),N.if(X._`${Y.default.vErrors} !== null`,()=>N.if($,()=>N.assign(X._`${Y.default.vErrors}.length`,$),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:$,schemaValue:V,data:U,errsCount:O,it:R}){if(O===void 0)throw Error("ajv implementation error");let j=N.name("err");N.forRange("i",O,Y.default.errors,(w)=>{if(N.const(j,X._`${Y.default.vErrors}[${w}]`),N.if(X._`${j}.instancePath === undefined`,()=>N.assign(X._`${j}.instancePath`,(0,X.strConcat)(Y.default.instancePath,R.errorPath))),N.assign(X._`${j}.schemaPath`,X.str`${R.errSchemaPath}/${$}`),R.opts.verbose)N.assign(X._`${j}.schema`,V),N.assign(X._`${j}.data`,U)})}W.extendErrors=L;function z(N,$){let V=N.const("err",$);N.if(X._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,X._`[${V}]`),X._`${Y.default.vErrors}.push(${V})`),N.code(X._`${Y.default.errors}++`)}function J(N,$){let{gen:V,validateName:U,schemaEnv:O}=N;if(O.$async)V.throw(X._`new ${N.ValidationError}(${$})`);else V.assign(X._`${U}.errors`,$),V.return(!1)}let K={keyword:new X.Name("keyword"),schemaPath:new X.Name("schemaPath"),params:new X.Name("params"),propertyName:new X.Name("propertyName"),message:new X.Name("message"),schema:new X.Name("schema"),parentSchema:new X.Name("parentSchema")};function Z(N,$,V){let{createErrors:U}=N.it;if(U===!1)return X._`{}`;return D(N,$,V)}function D(N,$,V={}){let{gen:U,it:O}=N,R=[I(O,V),A(N,V)];return M(N,$,R),U.object(...R)}function I({errorPath:N},{instancePath:$}){let V=$?X.str`${N}${(0,Q.getErrorPath)($,Q.Type.Str)}`:N;return[Y.default.instancePath,(0,X.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:$}},{schemaPath:V,parentSchema:U}){let O=U?$:X.str`${$}/${N}`;if(V)O=X.str`${O}${(0,Q.getErrorPath)(V,Q.Type.Str)}`;return[K.schemaPath,O]}function M(N,{params:$,message:V},U){let{keyword:O,data:R,schemaValue:j,it:w}=N,{opts:T,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,O],[K.params,typeof $=="function"?$(N):$||X._`{}`]),T.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(T.verbose)U.push([K.schema,j],[K.parentSchema,X._`${l}${_}`],[Y.default.data,R]);if(k)U.push([K.propertyName,k])}}),ew=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let X=OQ(),Q=I0(),Y=g6(),G={message:"boolean schema is false"};function B(z){let{gen:J,schema:K,validateName:Z}=z;if(K===!1)L(z,!1);else if(typeof K=="object"&&K.$async===!0)J.return(Y.default.data);else J.assign(Q._`${Z}.errors`,null),J.return(!0)}W.topBoolOrEmptySchema=B;function F(z,J){let{gen:K,schema:Z}=z;if(Z===!1)K.var(J,!1),L(z);else K.var(J,!0)}W.boolOrEmptySchema=F;function L(z,J){let{gen:K,data:Z}=z,D={gen:K,keyword:"false schema",data:Z,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:z};(0,X.reportError)(D,G,void 0,J)}}),UZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let X=new Set(["string","number","integer","boolean","null","object","array"]);function Q(G){return typeof G=="string"&&X.has(G)}W.isJSONType=Q;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),AZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function X({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&Q(G,L)}W.schemaHasRulesForType=X;function Q(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=Q;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),MQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let X=UZ(),Q=AZ(),Y=OQ(),G=I0(),B=v0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let O=z(U.type);if(O.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!O.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)O.push("null")}return O}W.getSchemaTypes=L;function z(U){let O=Array.isArray(U)?U:U?[U]:[];if(O.every(X.isJSONType))return O;throw Error("type must be JSONType or JSONType[]: "+O.join(","))}W.getJSONTypes=z;function J(U,O){let{gen:R,data:j,opts:w}=U,T=Z(O,w.coerceTypes),k=O.length>0&&!(T.length===0&&O.length===1&&(0,Q.schemaHasRulesForType)(U,O[0]));if(k){let l=M(O,j,w.strictNumbers,F.Wrong);R.if(l,()=>{if(T.length)D(U,O,T);else $(U)})}return k}W.coerceAndCheckDataType=J;let K=new Set(["string","number","integer","boolean","null"]);function Z(U,O){return O?U.filter((R)=>K.has(R)||O==="array"&&R==="array"):[]}function D(U,O,R){let{gen:j,data:w,opts:T}=U,k=j.let("dataType",G._`typeof ${w}`),l=j.let("coerced",G._`undefined`);if(T.coerceTypes==="array")j.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>j.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(O,w,T.strictNumbers),()=>j.assign(l,w)));j.if(G._`${l} !== undefined`);for(let h of R)if(K.has(h)||h==="array"&&T.coerceTypes==="array")_(h);j.else(),$(U),j.endIf(),j.if(G._`${l} !== undefined`,()=>{j.assign(w,l),I(U,l)});function _(h){switch(h){case"string":j.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":j.elseIf(G._`${k} == "boolean" || ${w} === null
205
+ || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":j.elseIf(G._`${k} === "boolean" || ${w} === null
206
+ || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":j.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":j.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),j.assign(l,null);return;case"array":j.elseIf(G._`${k} === "string" || ${k} === "number"
207
+ || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:O,parentDataProperty:R},j){U.if(G._`${O} !== undefined`,()=>U.assign(G._`${O}[${R}]`,j))}function A(U,O,R,j=F.Correct){let w=j===F.Correct?G.operators.EQ:G.operators.NEQ,T;switch(U){case"null":return G._`${O} ${w} null`;case"array":T=G._`Array.isArray(${O})`;break;case"object":T=G._`${O} && typeof ${O} == "object" && !Array.isArray(${O})`;break;case"integer":T=k(G._`!(${O} % 1) && !isNaN(${O})`);break;case"number":T=k();break;default:return G._`typeof ${O} ${w} ${U}`}return j===F.Correct?T:(0,G.not)(T);function k(l=G.nil){return(0,G.and)(G._`typeof ${O} == "number"`,l,R?G._`isFinite(${O})`:G.nil)}}W.checkDataType=A;function M(U,O,R,j){if(U.length===1)return A(U[0],O,R,j);let w,T=(0,B.toHash)(U);if(T.array&&T.object){let k=G._`typeof ${O} != "object"`;w=T.null?k:G._`!${O} || ${k}`,delete T.null,delete T.array,delete T.object}else w=G.nil;if(T.number)delete T.integer;for(let k in T)w=(0,G.and)(w,A(k,O,R,j));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:O})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${O}}`};function $(U){let O=V(U);(0,Y.reportError)(O,N)}W.reportTypeError=$;function V(U){let{gen:O,data:R,schema:j}=U,w=(0,B.schemaRefOrVal)(U,j,"type");return{gen:O,keyword:"type",data:R,schema:j.type,schemaCode:w,schemaValue:w,parentSchema:j,params:{},it:U}}}),W3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let X=I0(),Q=v0();function Y(B,F){let{properties:L,items:z}=B.schema;if(F==="object"&&L)for(let J in L)G(B,J,L[J].default);else if(F==="array"&&Array.isArray(z))z.forEach((J,K)=>G(B,K,J.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:z,compositeRule:J,data:K,opts:Z}=B;if(L===void 0)return;let D=X._`${K}${(0,X.getProperty)(F)}`;if(J){(0,Q.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=X._`${D} === undefined`;if(Z.useDefaults==="empty")I=X._`${I} || ${D} === null || ${D} === ""`;z.if(I,X._`${D} = ${(0,X.stringify)(L)}`)}}),f6=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let X=I0(),Q=v0(),Y=g6(),G=v0();function B(U,O){let{gen:R,data:j,it:w}=U;R.if(Z(R,j,O,w.opts.ownProperties),()=>{U.setParams({missingProperty:X._`${O}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:O,it:{opts:R}},j,w){return(0,X.or)(...j.map((T)=>(0,X.and)(Z(U,O,T,R.ownProperties),X._`${w} = ${T}`)))}W.checkMissingProp=F;function L(U,O){U.setParams({missingProperty:O},!0),U.error()}W.reportMissingProp=L;function z(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:X._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=z;function J(U,O,R){return X._`${z(U)}.call(${O}, ${R})`}W.isOwnProperty=J;function K(U,O,R,j){let w=X._`${O}${(0,X.getProperty)(R)} !== undefined`;return j?X._`${w} && ${J(U,O,R)}`:w}W.propertyInData=K;function Z(U,O,R,j){let w=X._`${O}${(0,X.getProperty)(R)} === undefined`;return j?(0,X.or)(w,(0,X.not)(J(U,O,R))):w}W.noPropertyInData=Z;function D(U){return U?Object.keys(U).filter((O)=>O!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,O){return D(O).filter((R)=>!(0,Q.alwaysValidSchema)(U,O[R]))}W.schemaProperties=I;function A({schemaCode:U,data:O,it:{gen:R,topSchemaRef:j,schemaPath:w,errorPath:T},it:k},l,_,h){let d=h?X._`${U}, ${O}, ${j}${w}`:O,p=[[Y.default.instancePath,(0,X.strConcat)(Y.default.instancePath,T)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let K0=X._`${d}, ${R.object(...p)}`;return _!==X.nil?X._`${l}.call(${_}, ${K0})`:X._`${l}(${K0})`}W.callValidateCode=A;let M=X._`new RegExp`;function N({gen:U,it:{opts:O}},R){let j=O.unicodeRegExp?"u":"",{regExp:w}=O.code,T=w(R,j);return U.scopeValue("pattern",{key:T.toString(),ref:T,code:X._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${R}, ${j})`})}W.usePattern=N;function $(U){let{gen:O,data:R,keyword:j,it:w}=U,T=O.name("valid");if(w.allErrors){let l=O.let("valid",!0);return k(()=>O.assign(l,!1)),l}return O.var(T,!0),k(()=>O.break()),T;function k(l){let _=O.const("len",X._`${R}.length`);O.forRange("i",0,_,(h)=>{U.subschema({keyword:j,dataProp:h,dataPropType:Q.Type.Num},T),O.if((0,X.not)(T),l)})}}W.validateArray=$;function V(U){let{gen:O,schema:R,keyword:j,it:w}=U;if(!Array.isArray(R))throw Error("ajv implementation error");if(R.some((l)=>(0,Q.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let T=O.let("valid",!1),k=O.name("_valid");O.block(()=>R.forEach((l,_)=>{let h=U.subschema({keyword:j,schemaProp:_,compositeRule:!0},k);if(O.assign(T,X._`${T} || ${k}`),!U.mergeValidEvaluated(h,k))O.if((0,X.not)(T))})),U.result(T,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),X3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let X=I0(),Q=g6(),Y=f6(),G=OQ();function B(I,A){let{gen:M,keyword:N,schema:$,parentSchema:V,it:U}=I,O=A.macro.call(U.self,$,V,U),R=K(M,N,O);if(U.opts.validateSchema!==!1)U.self.validateSchema(O,!0);let j=M.name("valid");I.subschema({schema:O,schemaPath:X.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:R,compositeRule:!0},j),I.pass(j,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:$,schema:V,parentSchema:U,$data:O,it:R}=I;J(R,A);let j=K(N,$,!O&&A.compile?A.compile.call(R.self,V,U,R):A.validate),w=N.let("valid");I.block$data(w,T),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function T(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>z(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(X._`await `),(p)=>N.assign(w,!1).if(X._`${p} instanceof ${R.ValidationError}`,()=>N.assign(d,X._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=X._`${j}.errors`;return N.assign(d,null),_(X.nil),d}function _(d=A.async?X._`await `:X.nil){let p=R.opts.passContext?Q.default.this:Q.default.self,K0=!(("compile"in A)&&!O||A.schema===!1);N.assign(w,X._`${d}${(0,Y.callValidateCode)(I,j,p,K0)}`,A.modifying)}function h(d){var p;N.if((0,X.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,X._`${N.parentData}[${N.parentDataProperty}]`))}function z(I,A){let{gen:M}=I;M.if(X._`Array.isArray(${A})`,()=>{M.assign(Q.default.vErrors,X._`${Q.default.vErrors} === null ? ${A} : ${Q.default.vErrors}.concat(${A})`).assign(Q.default.errors,X._`${Q.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function J({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,X.stringify)(M)})}function Z(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=Z;function D({schema:I,opts:A,self:M,errSchemaPath:N},$,V){if(Array.isArray($.keyword)?!$.keyword.includes(V):$.keyword!==V)throw Error("ajv implementation error");let U=$.dependencies;if(U===null||U===void 0?void 0:U.some((O)=>!Object.prototype.hasOwnProperty.call(I,O)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if($.validateSchema){if(!$.validateSchema(I[V])){let O=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText($.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(O);else throw Error(O)}}}W.validateKeywordUsage=D}),Q3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let X=I0(),Q=v0();function Y(F,{keyword:L,schemaProp:z,schema:J,schemaPath:K,errSchemaPath:Z,topSchemaRef:D}){if(L!==void 0&&J!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return z===void 0?{schema:I,schemaPath:X._`${F.schemaPath}${(0,X.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[z],schemaPath:X._`${F.schemaPath}${(0,X.getProperty)(L)}${(0,X.getProperty)(z)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,Q.escapeFragment)(z)}`}}if(J!==void 0){if(K===void 0||Z===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:J,schemaPath:K,topSchemaRef:D,errSchemaPath:Z}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:z,dataPropType:J,data:K,dataTypes:Z,propertyName:D}){if(K!==void 0&&z!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(z!==void 0){let{errorPath:M,dataPathArr:N,opts:$}=L;A(I.let("data",X._`${L.data}${(0,X.getProperty)(z)}`,!0)),F.errorPath=X.str`${M}${(0,Q.getErrorPath)(z,J,$.jsPropertySyntax)}`,F.parentDataProperty=X._`${z}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof X.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(Z)F.dataTypes=Z;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:z,compositeRule:J,createErrors:K,allErrors:Z}){if(J!==void 0)F.compositeRule=J;if(K!==void 0)F.createErrors=K;if(Z!==void 0)F.allErrors=Z;F.jtdDiscriminator=L,F.jtdMetadata=z}W.extendSubschemaMode=B}),NZ=Q0((W,X)=>{X.exports=function Q(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!Q(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var z=L[F];if(!Q(Y[z],G[z]))return!1}return!0}return Y!==Y&&G!==G}}),Y3=Q0((W,X)=>{var Q=X.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var z=typeof L=="function"?L:L.pre||function(){},J=L.post||function(){};Y(F,z,J,B,"",B)};Q.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Q.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Q.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Q.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 Y(B,F,L,z,J,K,Z,D,I,A){if(z&&typeof z=="object"&&!Array.isArray(z)){F(z,J,K,Z,D,I,A);for(var M in z){var N=z[M];if(Array.isArray(N)){if(M in Q.arrayKeywords)for(var $=0;$<N.length;$++)Y(B,F,L,N[$],J+"/"+M+"/"+$,K,J,M,z,$)}else if(M in Q.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],J+"/"+M+"/"+G(V),K,J,M,z,V)}else if(M in Q.keywords||B.allKeys&&!(M in Q.skipKeywords))Y(B,F,L,N,J+"/"+M,K,J,M,z)}L(z,J,K,Z,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),jQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let X=v0(),Q=NZ(),Y=Y3(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,$=!0){if(typeof N=="boolean")return!0;if($===!0)return!L(N);if(!$)return!1;return z(N)<=$}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let $ in N){if(F.has($))return!0;let V=N[$];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function z(N){let $=0;for(let V in N){if(V==="$ref")return 1/0;if($++,G.has(V))continue;if(typeof N[V]=="object")(0,X.eachItem)(N[V],(U)=>$+=z(U));if($===1/0)return 1/0}return $}function J(N,$="",V){if(V!==!1)$=D($);return K(N,N.parse($))}W.getFullPath=J;function K(N,$){return N.serialize($).split("#")[0]+"#"}W._getFullPath=K;let Z=/#\/?$/;function D(N){return N?N.replace(Z,""):""}W.normalizeId=D;function I(N,$,V){return V=D(V),N.resolve($,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,$){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,O=D(N[V]||$),R={"":O},j=J(U,O,!1),w={},T=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let K0=j+h,O0=R[p];if(typeof _[V]=="string")O0=w0.call(this,_[V]);S0.call(this,_.$anchor),S0.call(this,_.$dynamicAnchor),R[h]=O0;function w0($0){let b=this.opts.uriResolver.resolve;if($0=D(O0?b(O0,$0):$0),T.has($0))throw l($0);T.add($0);let v=this.refs[$0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,$0);else if($0!==D(K0))if($0[0]==="#")k(_,w[$0],$0),w[$0]=_;else this.refs[$0]=K0;return $0}function S0($0){if(typeof $0=="string"){if(!A.test($0))throw Error(`invalid anchor "${$0}"`);w0.call(this,`#${$0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!Q(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),QX=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let X=ew(),Q=MQ(),Y=AZ(),G=MQ(),B=W3(),F=X3(),L=Q3(),z=I0(),J=g6(),K=jQ(),Z=v0(),D=OQ();function I(P){if(j(P)){if(T(P),R(P)){$(P);return}}A(P,()=>(0,X.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},L0){if(t.code.es5)P.func(y,z._`${J.default.data}, ${J.default.valCxt}`,s.$async,()=>{P.code(z._`"use strict"; ${U(x,t)}`),N(P,t),P.code(L0)});else P.func(y,z._`${J.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(L0))}function M(P){return z._`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${P.dynamicRef?z._`, ${J.default.dynamicAnchors}={}`:z.nil}}={}`}function N(P,y){P.if(J.default.valCxt,()=>{if(P.var(J.default.instancePath,z._`${J.default.valCxt}.${J.default.instancePath}`),P.var(J.default.parentData,z._`${J.default.valCxt}.${J.default.parentData}`),P.var(J.default.parentDataProperty,z._`${J.default.valCxt}.${J.default.parentDataProperty}`),P.var(J.default.rootData,z._`${J.default.valCxt}.${J.default.rootData}`),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{if(P.var(J.default.instancePath,z._`""`),P.var(J.default.parentData,z._`undefined`),P.var(J.default.parentDataProperty,z._`undefined`),P.var(J.default.rootData,J.default.data),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`{}`)})}function $(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(J.default.vErrors,null),s.let(J.default.errors,0),x.unevaluated)V(P);k(P),K0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",z._`${x}.evaluated`),y.if(z._`${P.evaluated}.dynamicProps`,()=>y.assign(z._`${P.evaluated}.props`,z._`undefined`)),y.if(z._`${P.evaluated}.dynamicItems`,()=>y.assign(z._`${P.evaluated}.items`,z._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?z._`/*# sourceURL=${x} */`:z.nil}function O(P,y){if(j(P)){if(T(P),R(P)){w(P,y);return}}(0,X.boolOrEmptySchema)(P,y)}function R({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function j(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let L0=s.const("_errs",J.default.errors);k(P,L0),s.var(y,z._`${L0} === ${J.default.errors}`)}function T(P){(0,Z.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return w0(P,[],!1,y);let x=(0,Q.getSchemaTypes)(P.schema);w0(P,x,!(0,Q.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,Z.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,Z.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let L0=x.$comment;if(t.$comment===!0)P.code(z._`${J.default.self}.logger.log(${L0})`);else if(typeof t.$comment=="function"){let T0=z.str`${s}/$comment`,C0=P.scopeValue("root",{ref:y.root});P.code(z._`${J.default.self}.opts.$comment(${L0}, ${T0}, ${C0}.schema)`)}}function K0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:L0}=P;if(x.$async)y.if(z._`${J.default.errors} === 0`,()=>y.return(J.default.data),()=>y.throw(z._`new ${t}(${J.default.vErrors})`));else{if(y.assign(z._`${s}.errors`,J.default.vErrors),L0.unevaluated)O0(P);y.return(z._`${J.default.errors} === 0`)}}function O0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof z.Name)P.assign(z._`${y}.props`,x);if(s instanceof z.Name)P.assign(z._`${y}.items`,s)}function w0(P,y,x,s){let{gen:t,schema:L0,data:T0,allErrors:C0,opts:f0,self:b0}=P,{RULES:j0}=b0;if(L0.$ref&&(f0.ignoreKeywordsWithRef||!(0,Z.schemaHasRulesButRef)(L0,j0))){t.block(()=>z0(P,"$ref",j0.all.$ref.definition));return}if(!f0.jtd)$0(P,y);t.block(()=>{for(let k0 of j0.rules)o0(k0);o0(j0.post)});function o0(k0){if(!(0,Y.shouldUseGroup)(L0,k0))return;if(k0.type){if(t.if((0,G.checkDataType)(k0.type,T0,f0.strictNumbers)),S0(P,k0),y.length===1&&y[0]===k0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else S0(P,k0);if(!C0)t.if(z._`${J.default.errors} === ${s||0}`)}}function S0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let L0 of y.rules)if((0,Y.shouldUseRule)(s,L0))z0(P,L0.keyword,L0.definition,y.type)})}function $0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(b(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function b(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!S(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:L0}=t.definition;if(L0.length&&!L0.some((T0)=>E(y,T0)))c(P,`missing type "${L0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function S(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(S(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,Z.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Z.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",u0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",J.default.errors)}result(P,y,x){this.failResult((0,z.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,z.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(z._`${y} !== undefined && (${(0,z.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=z.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=z.nil,y=z.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:L0}=this;if(x.if((0,z.or)(z._`${s} === undefined`,y)),P!==z.nil)x.assign(P,!0);if(t.length||L0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==z.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,z.or)(L0(),T0());function L0(){if(x.length){if(!(y instanceof z.Name))throw Error("ajv implementation error");let C0=Array.isArray(x)?x:[x];return z._`${(0,G.checkDataTypes)(C0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return z.nil}function T0(){if(s.validateSchema){let C0=P.scopeValue("validate$data",{ref:s.validateSchema});return z._`!${C0}(${y})`}return z.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return O(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=Z.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=Z.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,z.Name)),!0}};W.KeywordCxt=r;function z0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,D0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function u0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,L0;if(P==="")return J.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,L0=J.default.rootData}else{let b0=D0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let j0=+b0[1];if(t=b0[2],t==="#"){if(j0>=y)throw Error(f0("property/index",j0));return s[y-j0]}if(j0>y)throw Error(f0("data",j0));if(L0=x[y-j0],!t)return L0}let T0=L0,C0=t.split("/");for(let b0 of C0)if(b0)L0=z._`${L0}${(0,z.getProperty)((0,Z.unescapeJsonPointer)(b0))}`,T0=z._`${T0} && ${L0}`;return T0;function f0(b0,j0){return`Cannot access ${b0} ${j0} levels up, current level is ${y}`}}W.getData=u0}),EQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var X=class extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}};W.default=X}),YX=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=jQ();var Q=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,X.resolveUrl)(Y,G,B),this.missingSchema=(0,X.normalizeId)((0,X.getFullPath)(Y,this.missingRef))}};W.default=Q}),IQ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let X=I0(),Q=EQ(),Y=g6(),G=jQ(),B=v0(),F=QX();var L=class{constructor($){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof $.schema=="object")U=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(V=$.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function z($){let V=Z.call(this,$);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:O,lines:R}=this.opts.code,{ownProperties:j}=this.opts,w=new X.CodeGen(this.scope,{es5:O,lines:R,ownProperties:j}),T;if($.$async)T=w.scopeValue("Error",{ref:Q.default,code:X._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");$.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[X.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,X.stringify)($.schema)}:{ref:$.schema}),validateName:k,ValidationError:T,schema:$.schema,schemaEnv:$,rootId:U,baseId:$.baseId||U,schemaPath:X.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:X._`""`,opts:this.opts,self:this},_;try{this._compilations.add($),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,$);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=$.schema,d.schemaEnv=$,$.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:K0}=l;if(d.evaluated={props:p instanceof X.Name?void 0:p,items:K0 instanceof X.Name?void 0:K0,dynamicProps:p instanceof X.Name,dynamicItems:K0 instanceof X.Name},d.source)d.source.evaluated=(0,X.stringify)(d.evaluated)}return $.validate=d,$}catch(h){if(delete $.validate,delete $.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete($)}}W.compileSchema=z;function J($,V,U){var O;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let R=$.refs[U];if(R)return R;let j=I.call(this,$,U);if(j===void 0){let w=(O=$.localRefs)===null||O===void 0?void 0:O[U],{schemaId:T}=this.opts;if(w)j=new L({schema:w,schemaId:T,root:$,baseId:V})}if(j===void 0)return;return $.refs[U]=K.call(this,j)}W.resolveRef=J;function K($){if((0,G.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:z.call(this,$)}function Z($){for(let V of this._compilations)if(D(V,$))return V}W.getCompilingSchema=Z;function D($,V){return $.schema===V.schema&&$.root===V.root&&$.baseId===V.baseId}function I($,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,$,V)}function A($,V){let U=this.opts.uriResolver.parse(V),O=(0,G._getFullPath)(this.opts.uriResolver,U),R=(0,G.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&O===R)return N.call(this,U,$);let j=(0,G.normalizeId)(O),w=this.refs[j]||this.schemas[j];if(typeof w=="string"){let T=A.call(this,$,w);if(typeof(T===null||T===void 0?void 0:T.schema)!=="object")return;return N.call(this,U,T)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)z.call(this,w);if(j===(0,G.normalizeId)(V)){let{schema:T}=w,{schemaId:k}=this.opts,l=T[k];if(l)R=(0,G.resolveUrl)(this.opts.uriResolver,R,l);return new L({schema:T,schemaId:k,root:$,baseId:R})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N($,{baseId:V,schema:U,root:O}){var R;if(((R=$.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let T of $.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(T)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(T)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let j;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let T=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);j=A.call(this,O,T)}let{schemaId:w}=this.opts;if(j=j||new L({schema:U,schemaId:w,root:O,baseId:V}),j.schema!==j.root.schema)return j}}),G3=Q0((W,X)=>{X.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}}),VZ=Q0((W,X)=>{let Q=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=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 G(A){let M="",N=0,$=0;for($=0;$<A.length;$++){if(N=A[$].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[$];break}for($+=1;$<A.length;$++){if(N=A[$].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[$]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let $=G(A);if($!=="")M.push($);else return N.error=!0,!1;A.length=0}return!0}function z(A){let M=0,N={error:!1,address:"",zone:""},$=[],V=[],U=!1,O=!1,R=L;for(let j=0;j<A.length;j++){let w=A[j];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)O=!0;if(!R(V,$,N))break;if(++M>7){N.error=!0;break}if(j>0&&A[j-1]===":")U=!0;$.push(":");continue}else if(w==="%"){if(!R(V,$,N))break;R=F}else{V.push(w);continue}}if(V.length)if(R===F)N.zone=V.join("");else if(O)$.push(V.join(""));else $.push(G(V));return N.address=$.join(""),N}function J(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=z(A);if(!M.error){let{address:N,address:$}=M;if(M.zone)N+="%"+M.zone,$+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:$}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let $=0;$<A.length;$++)if(A[$]===M)N++;return N}function Z(A){let M=A,N=[],$=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if(($=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,$)),M=M.slice($)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let $=J(N);if($.isIPV6===!0)N=`[${$.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}X.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:Z,isIPv4:Y,isUUID:Q,normalizeIPv6:J,stringArrayToHexStripped:G}}),B3=Q0((W,X)=>{let{isUUID:Q}=VZ(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function z(w){let T=String(w.scheme).toLowerCase()==="https";if(w.port===(T?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function J(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[T,k]=w.resourceName.split("?");w.path=T&&T!=="/"?T:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function Z(w,T){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=T.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=j(`${l}:${T.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,T)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,T){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=T.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=j(`${k}:${T.nid||l}`);if(_)w=_.serialize(w,T);let h=w,d=w.nss;return h.path=`${l||T.nid}:${d}`,T.skipEscape=!0,h}function I(w,T){let k=w;if(k.uuid=k.nss,k.nss=void 0,!T.tolerant&&(!k.uuid||!Q(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let T=w;return T.nss=(w.uuid||"").toLowerCase(),T}let M={scheme:"http",domainHost:!0,parse:L,serialize:z},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:z},$={scheme:"ws",domainHost:!0,parse:J,serialize:K},V={scheme:"wss",domainHost:$.domainHost,parse:$.parse,serialize:$.serialize},R={http:M,https:N,ws:$,wss:V,urn:{scheme:"urn",parse:Z,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(R,null);function j(w){return w&&(R[w]||R[w.toLowerCase()])||void 0}X.exports={wsIsSecure:F,SCHEMES:R,isValidSchemeName:B,getSchemeHandler:j}}),F3=Q0((W,X)=>{let{normalizeIPv6:Q,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=VZ(),{SCHEMES:z,getSchemeHandler:J}=B3();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function Z(V,U,O){let R=O?Object.assign({scheme:"null"},O):{scheme:"null"},j=D(N(V,R),N(U,R),R,!0);return R.skipEscape=!0,A(j,R)}function D(V,U,O,R){let j={};if(!R)V=N(A(V,O),O),U=N(A(U,O),O);if(O=O||{},!O.tolerant&&U.scheme)j.scheme=U.scheme,j.userinfo=U.userinfo,j.host=U.host,j.port=U.port,j.path=Y(U.path||""),j.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)j.userinfo=U.userinfo,j.host=U.host,j.port=U.port,j.path=Y(U.path||""),j.query=U.query;else{if(!U.path)if(j.path=V.path,U.query!==void 0)j.query=U.query;else j.query=V.query;else{if(U.path[0]==="/")j.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)j.path="/"+U.path;else if(!V.path)j.path=U.path;else j.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;j.path=Y(j.path)}j.query=U.query}j.userinfo=V.userinfo,j.host=V.host,j.port=V.port}j.scheme=V.scheme}return j.fragment=U.fragment,j}function I(V,U,O){if(typeof V==="string")V=unescape(V),V=A(B(N(V,O),!0),{...O,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...O,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,O),!0),{...O,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...O,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let O={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},R=Object.assign({},U),j=[],w=J(R.scheme||O.scheme);if(w&&w.serialize)w.serialize(O,R);if(O.path!==void 0)if(!R.skipEscape){if(O.path=escape(O.path),O.scheme!==void 0)O.path=O.path.split("%3A").join(":")}else O.path=unescape(O.path);if(R.reference!=="suffix"&&O.scheme)j.push(O.scheme,":");let T=G(O);if(T!==void 0){if(R.reference!=="suffix")j.push("//");if(j.push(T),O.path&&O.path[0]!=="/")j.push("/")}if(O.path!==void 0){let k=O.path;if(!R.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(T===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);j.push(k)}if(O.query!==void 0)j.push("?",O.query);if(O.fragment!==void 0)j.push("#",O.fragment);return j.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let O=Object.assign({},U),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},j=!1;if(O.reference==="suffix")if(O.scheme)V=O.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(R.scheme=w[1],R.userinfo=w[3],R.host=w[4],R.port=parseInt(w[5],10),R.path=w[6]||"",R.query=w[7],R.fragment=w[8],isNaN(R.port))R.port=w[5];if(R.host)if(F(R.host)===!1){let k=Q(R.host);R.host=k.host.toLowerCase(),j=k.isIPV6}else j=!0;if(R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path)R.reference="same-document";else if(R.scheme===void 0)R.reference="relative";else if(R.fragment===void 0)R.reference="absolute";else R.reference="uri";if(O.reference&&O.reference!=="suffix"&&O.reference!==R.reference)R.error=R.error||"URI is not a "+O.reference+" reference.";let T=J(O.scheme||R.scheme);if(!O.unicodeSupport&&(!T||!T.unicodeSupport)){if(R.host&&(O.domainHost||T&&T.domainHost)&&j===!1&&L(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(k){R.error=R.error||"Host's domain name can not be converted to ASCII: "+k}}if(!T||T&&!T.skipNormalize){if(V.indexOf("%")!==-1){if(R.scheme!==void 0)R.scheme=unescape(R.scheme);if(R.host!==void 0)R.host=unescape(R.host)}if(R.path)R.path=escape(unescape(R.path));if(R.fragment)R.fragment=encodeURI(decodeURIComponent(R.fragment))}if(T&&T.parse)T.parse(R,O)}else R.error=R.error||"URI can not be parsed.";return R}let $={SCHEMES:z,normalize:K,resolve:Z,resolveComponent:D,equal:I,serialize:A,parse:N};X.exports=$,X.exports.default=$,X.exports.fastUri=$}),L3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=F3();X.code='require("ajv/dist/runtime/uri").default',W.default=X}),wZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var X=QX();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return X.KeywordCxt}});var Q=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Q._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Q.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Q.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Q.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Q.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return Q.CodeGen}});let Y=EQ(),G=YX(),B=UZ(),F=IQ(),L=I0(),z=jQ(),J=MQ(),K=v0(),Z=G3(),D=L3(),I=(b,v)=>new RegExp(b,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={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."},$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(b){var v,u,E,S,C,c,r,z0,e,D0,u0,P,y,x,s,t,L0,T0,C0,f0,b0,j0,o0,k0,B1;let Q1=b.strict,F1=(v=b.code)===null||v===void 0?void 0:v.optimize,Z1=F1===!0||F1===void 0?1:F1||0,$1=(E=(u=b.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,D1=(S=b.uriResolver)!==null&&S!==void 0?S:D.default;return{strictSchema:(c=(C=b.strictSchema)!==null&&C!==void 0?C:Q1)!==null&&c!==void 0?c:!0,strictNumbers:(z0=(r=b.strictNumbers)!==null&&r!==void 0?r:Q1)!==null&&z0!==void 0?z0:!0,strictTypes:(D0=(e=b.strictTypes)!==null&&e!==void 0?e:Q1)!==null&&D0!==void 0?D0:"log",strictTuples:(P=(u0=b.strictTuples)!==null&&u0!==void 0?u0:Q1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=b.strictRequired)!==null&&y!==void 0?y:Q1)!==null&&x!==void 0?x:!1,code:b.code?{...b.code,optimize:Z1,regExp:$1}:{optimize:Z1,regExp:$1},loopRequired:(s=b.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=b.loopEnum)!==null&&t!==void 0?t:V,meta:(L0=b.meta)!==null&&L0!==void 0?L0:!0,messages:(T0=b.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(C0=b.inlineRefs)!==null&&C0!==void 0?C0:!0,schemaId:(f0=b.schemaId)!==null&&f0!==void 0?f0:"$id",addUsedSchema:(b0=b.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(j0=b.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(o0=b.validateFormats)!==null&&o0!==void 0?o0:!0,unicodeRegExp:(k0=b.unicodeRegExp)!==null&&k0!==void 0?k0:!0,int32range:(B1=b.int32range)!==null&&B1!==void 0?B1:!0,uriResolver:D1}}var O=class{constructor(b={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,b=this.opts={...b,...U(b)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(b.logger);let E=b.validateFormats;if(b.validateFormats=!1,this.RULES=(0,B.getRules)(),R.call(this,N,b,"NOT SUPPORTED"),R.call(this,$,b,"DEPRECATED","warn"),this._metaOpts=l.call(this),b.formats)T.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),b.keywords)k.call(this,b.keywords);if(typeof b.meta=="object")this.addMetaSchema(b.meta);w.call(this),b.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:b,meta:v,schemaId:u}=this.opts,E=Z;if(u==="id")E={...Z},E.id=E.$id,delete E.$id;if(v&&b)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:b,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof b=="object"?b[v]||b:void 0}validate(b,v){let u;if(typeof b=="string"){if(u=this.getSchema(b),!u)throw Error(`no schema with key or ref "${b}"`)}else u=this.compile(b);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(b,v){let u=this._addSchema(b,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(b,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,b,v);async function E(e,D0){await S.call(this,e.$schema);let u0=this._addSchema(e,D0);return u0.validate||C.call(this,u0)}async function S(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(D0){if(!(D0 instanceof G.default))throw D0;return c.call(this,D0),await r.call(this,D0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:D0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${D0} cannot be resolved`)}async function r(e){let D0=await z0.call(this,e);if(!this.refs[e])await S.call(this,D0.$schema);if(!this.refs[e])this.addSchema(D0,e,v)}async function z0(e){let D0=this._loading[e];if(D0)return D0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(b,v,u,E=this.opts.validateSchema){if(Array.isArray(b)){for(let C of b)this.addSchema(C,void 0,u,E);return this}let S;if(typeof b==="object"){let{schemaId:C}=this.opts;if(S=b[C],S!==void 0&&typeof S!="string")throw Error(`schema ${C} must be string`)}return v=(0,z.normalizeId)(v||S),this._checkUnique(v),this.schemas[v]=this._addSchema(b,u,v,E,!0),this}addMetaSchema(b,v,u=this.opts.validateSchema){return this.addSchema(b,v,!0,u),this}validateSchema(b,v){if(typeof b=="boolean")return!0;let u;if(u=b.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,b);if(!E&&v){let S="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(S);else throw Error(S)}return E}getSchema(b){let v;while(typeof(v=j.call(this,b))=="string")b=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,b),!v)return;this.refs[b]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(b){if(b instanceof RegExp)return this._removeAllSchemas(this.schemas,b),this._removeAllSchemas(this.refs,b),this;switch(typeof b){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=j.call(this,b);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[b],delete this.refs[b],this}case"object":{let v=b;this._cache.delete(v);let u=b[this.opts.schemaId];if(u)u=(0,z.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(b){for(let v of b)this.addKeyword(v);return this}addKeyword(b,v){let u;if(typeof b=="string"){if(u=b,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof b=="object"&&v===void 0){if(v=b,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(S)=>K0.call(this,S)),this;w0.call(this,v);let E={...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(S)=>K0.call(this,S,E):(S)=>E.type.forEach((C)=>K0.call(this,S,E,C))),this}getKeyword(b){let v=this.RULES.all[b];return typeof v=="object"?v.definition:!!v}removeKeyword(b){let{RULES:v}=this;delete v.keywords[b],delete v.all[b];for(let u of v.rules){let E=u.rules.findIndex((S)=>S.keyword===b);if(E>=0)u.rules.splice(E,1)}return this}addFormat(b,v){if(typeof v=="string")v=new RegExp(v);return this.formats[b]=v,this}errorsText(b=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!b||b.length===0)return"No errors";return b.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,S)=>E+v+S)}$dataMetaSchema(b,v){let u=this.RULES.all;b=JSON.parse(JSON.stringify(b));for(let E of v){let S=E.split("/").slice(1),C=b;for(let c of S)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:z0}=r.definition,e=C[c];if(z0&&e)C[c]=$0(e)}}return b}_removeAllSchemas(b,v){for(let u in b){let E=b[u];if(!v||v.test(u)){if(typeof E=="string")delete b[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete b[u]}}}_addSchema(b,v,u,E=this.opts.validateSchema,S=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof b=="object")C=b[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof b!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(b);if(r!==void 0)return r;u=(0,z.normalizeId)(C||u);let z0=z.getSchemaRefs.call(this,b,u);if(r=new F.SchemaEnv({schema:b,schemaId:c,meta:v,baseId:u,localRefs:z0}),this._cache.set(r.schema,r),S&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(b,!0);return r}_checkUnique(b){if(this.schemas[b]||this.refs[b])throw Error(`schema with key or id "${b}" already exists`)}_compileSchemaEnv(b){if(b.meta)this._compileMetaSchema(b);else F.compileSchema.call(this,b);if(!b.validate)throw Error("ajv implementation error");return b.validate}_compileMetaSchema(b){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,b)}finally{this.opts=v}}};O.ValidationError=Y.default,O.MissingRefError=G.default,W.default=O;function R(b,v,u,E="error"){for(let S in b){let C=S;if(C in v)this.logger[E](`${u}: option ${S}. ${b[C]}`)}}function j(b){return b=(0,z.normalizeId)(b),this.schemas[b]||this.refs[b]}function w(){let b=this.opts.schemas;if(!b)return;if(Array.isArray(b))this.addSchema(b);else for(let v in b)this.addSchema(b[v],v)}function T(){for(let b in this.opts.formats){let v=this.opts.formats[b];if(v)this.addFormat(b,v)}}function k(b){if(Array.isArray(b)){this.addVocabulary(b);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in b){let u=b[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let b={...this.opts};for(let v of A)delete b[v];return b}let _={log(){},warn(){},error(){}};function h(b){if(b===!1)return _;if(b===void 0)return console;if(b.log&&b.warn&&b.error)return b;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(b,v){let{RULES:u}=this;if((0,K.eachItem)(b,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function K0(b,v,u){var E;let S=v===null||v===void 0?void 0:v.post;if(u&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=S?C.post:C.rules.find(({type:z0})=>z0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[b]=!0,!v)return;let r={keyword:b,definition:{...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)}};if(v.before)O0.call(this,c,r,v.before);else c.rules.push(r);C.all[b]=r,(E=v.implements)===null||E===void 0||E.forEach((z0)=>this.addKeyword(z0))}function O0(b,v,u){let E=b.rules.findIndex((S)=>S.keyword===u);if(E>=0)b.rules.splice(E,0,v);else b.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function w0(b){let{metaSchema:v}=b;if(v===void 0)return;if(b.$data&&this.opts.$data)v=$0(v);b.validateSchema=this.compile(v,!0)}let S0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function $0(b){return{anyOf:[b,S0]}}}),z3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=X}),C7=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let X=YX(),Q=f6(),Y=I0(),G=g6(),B=IQ(),F=v0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:Z,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:$,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return R();let O=B.resolveRef.call(V,U,A,D);if(O===void 0)throw new X.default(I.opts.uriResolver,A,D);if(O instanceof B.SchemaEnv)return j(O);return w(O);function R(){if(M===U)return J(K,N,M,M.$async);let T=Z.scopeValue("root",{ref:U});return J(K,Y._`${T}.validate`,U,U.$async)}function j(T){J(K,z(K,T),T,T.$async)}function w(T){let k=Z.scopeValue("schema",$.code.source===!0?{ref:T,code:(0,Y.stringify)(T)}:{ref:T}),l=Z.name("valid"),_=K.subschema({schema:T,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function z(K,Z){let{gen:D}=K;return Z.validate?D.scopeValue("validate",{ref:Z.validate}):Y._`${D.scopeValue("wrapper",{ref:Z})}.validate`}W.getValidate=z;function J(K,Z,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:$,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)O();else R();function O(){if(!$.$async)throw Error("async schema referenced by sync schema");let T=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,Q.callValidateCode)(K,Z,U)}`),w(Z),!N)A.assign(T,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),j(k),!N)A.assign(T,!1)}),K.ok(T)}function R(){K.result((0,Q.callValidateCode)(K,Z,U),()=>w(Z),()=>j(Z))}function j(T){let k=Y._`${T}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(T){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${T}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${T}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=J,W.default=L}),DZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=z3(),Q=C7(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",X.default,Q.default];W.default=Y}),J3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=X.operators,Y={maximum:{okStr:"<=",ok:Q.LTE,fail:Q.GT},minimum:{okStr:">=",ok:Q.GTE,fail:Q.LT},exclusiveMaximum:{okStr:"<",ok:Q.LT,fail:Q.GTE},exclusiveMinimum:{okStr:">",ok:Q.GT,fail:Q.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>X.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>X._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:z}=B;B.fail$data(X._`${L} ${Y[F].fail} ${z} || isNaN(${L})`)}};W.default=G}),K3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>X.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>X._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,z=L.opts.multipleOfPrecision,J=G.let("res"),K=z?X._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:X._`${J} !== parseInt(${J})`;Y.fail$data(X._`(${F} === 0 || (${J} = ${B}/${F}, ${K}))`)}};W.default=Q}),Z3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function X(Q){let Y=Q.length,G=0,B=0,F;while(B<Y)if(G++,F=Q.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=Q.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=X,X.code='require("ajv/dist/runtime/ucs2length").default'}),$3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y=Z3(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return X.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>X._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:z,it:J}=B,K=F==="maxLength"?X.operators.GT:X.operators.LT,Z=J.opts.unicode===!1?X._`${L}.length`:X._`${(0,Q.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(X._`${Z} ${K} ${z}`)}};W.default=G}),H3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=f6(),Q=v0(),Y=I0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:Z}=B,D=Z.opts.unicodeRegExp?"u":"";if(z){let{regExp:I}=Z.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,Q.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,X.usePattern)(B,J);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),U3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return X.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>X._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?X.operators.GT:X.operators.LT;Y.fail$data(X._`Object.keys(${B}).length ${L} ${F}`)}};W.default=Q}),A3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=f6(),Q=I0(),Y=v0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>Q.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>Q._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:z,data:J,$data:K,it:Z}=B,{opts:D}=Z;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(Z.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let O of L)if((V===null||V===void 0?void 0:V[O])===void 0&&!U.has(O)){let R=`required property "${O}" is not defined at "${Z.schemaEnv.baseId+Z.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(Z,R,Z.opts.strictRequired)}}function A(){if(I||K)B.block$data(Q.nil,N);else for(let V of L)(0,X.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>$(V,U)),B.ok(U)}else F.if((0,X.checkMissingProp)(B,L,V)),(0,X.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",z,(V)=>{B.setParams({missingProperty:V}),F.if((0,X.noPropertyInData)(F,J,V,D.ownProperties),()=>B.error())})}function $(V,U){B.setParams({missingProperty:V}),F.forOf(V,z,()=>{F.assign(U,(0,X.propertyInData)(F,J,V,D.ownProperties)),F.if((0,Q.not)(U),()=>{B.error(),F.break()})},Q.nil)}}};W.default=G}),N3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return X.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>X._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?X.operators.GT:X.operators.LT;Y.fail$data(X._`${B}.length ${L} ${F}`)}};W.default=Q}),k7=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=NZ();X.code='require("ajv/dist/runtime/equal").default',W.default=X}),V3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=MQ(),Q=I0(),Y=v0(),G=k7(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>Q.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>Q._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:z,$data:J,schema:K,parentSchema:Z,schemaCode:D,it:I}=F;if(!J&&!K)return;let A=L.let("valid"),M=Z.items?(0,X.getSchemaTypes)(Z.items):[];F.block$data(A,N,Q._`${D} === false`),F.ok(A);function N(){let O=L.let("i",Q._`${z}.length`),R=L.let("j");F.setParams({i:O,j:R}),L.assign(A,!0),L.if(Q._`${O} > 1`,()=>($()?V:U)(O,R))}function $(){return M.length>0&&!M.some((O)=>O==="object"||O==="array")}function V(O,R){let j=L.name("item"),w=(0,X.checkDataTypes)(M,j,I.opts.strictNumbers,X.DataType.Wrong),T=L.const("indices",Q._`{}`);L.for(Q._`;${O}--;`,()=>{if(L.let(j,Q._`${z}[${O}]`),L.if(w,Q._`continue`),M.length>1)L.if(Q._`typeof ${j} == "string"`,Q._`${j} += "_"`);L.if(Q._`typeof ${T}[${j}] == "number"`,()=>{L.assign(R,Q._`${T}[${j}]`),F.error(),L.assign(A,!1).break()}).code(Q._`${T}[${j}] = ${O}`)})}function U(O,R){let j=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(Q._`;${O}--;`,()=>L.for(Q._`${R} = ${O}; ${R}--;`,()=>L.if(Q._`${j}(${z}[${O}], ${z}[${R}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),w3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y=k7(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>X._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:z,schemaCode:J,schema:K}=B;if(z||K&&typeof K=="object")B.fail$data(X._`!${(0,Q.useFunc)(F,Y.default)}(${L}, ${J})`);else B.fail(X._`${K} !== ${L}`)}};W.default=G}),D3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y=k7(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>X._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:Z}=B;if(!z&&J.length===0)throw Error("enum must have non-empty array");let D=J.length>=Z.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,Q.useFunc)(F,Y.default),M;if(D||z)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(J))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,X.or)(...J.map((U,O)=>$(V,O)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(X._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function $(V,U){let O=J[U];return typeof O==="object"&&O!==null?X._`${A()}(${L}, ${V}[${U}])`:X._`${L} === ${O}`}}};W.default=G}),MZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=J3(),Q=K3(),Y=$3(),G=H3(),B=U3(),F=A3(),L=N3(),z=V3(),J=w3(),K=D3(),Z=[X.default,Q.default,Y.default,G.default,B.default,F.default,L.default,z.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},J.default,K.default];W.default=Z}),OZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let X=I0(),Q=v0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>X.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>X._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:z}=F;if(!Array.isArray(z)){(0,Q.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,z)}};function G(B,F){let{gen:L,schema:z,data:J,keyword:K,it:Z}=B;Z.items=!0;let D=L.const("len",X._`${J}.length`);if(z===!1)B.setParams({len:F.length}),B.pass(X._`${D} <= ${F.length}`);else if(typeof z=="object"&&!(0,Q.alwaysValidSchema)(Z,z)){let A=L.var("valid",X._`${D} <= ${F.length}`);L.if((0,X.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:Q.Type.Num},A),!Z.allErrors)L.if((0,X.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),jZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let X=I0(),Q=v0(),Y=f6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:z}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(z.items=!0,(0,Q.alwaysValidSchema)(z,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,z=F.schema){let{gen:J,parentSchema:K,data:Z,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&z.length&&I.items!==!0)I.items=Q.mergeEvaluated.items(J,z.length,I.items);let A=J.name("valid"),M=J.const("len",X._`${Z}.length`);z.forEach(($,V)=>{if((0,Q.alwaysValidSchema)(I,$))return;J.if(X._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N($){let{opts:V,errSchemaPath:U}=I,O=z.length,R=O===$.minItems&&(O===$.maxItems||$[L]===!1);if(V.strictTuples&&!R){let j=`"${D}" is ${O}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,Q.checkStrictMode)(I,j,V.strictTuples)}}}W.validateTuple=B,W.default=G}),M3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=jZ(),Q={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,X.validateTuple)(Y,"items")};W.default=Q}),O3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y=f6(),G=OZ(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>X.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>X._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:z,it:J}=F,{prefixItems:K}=z;if(J.items=!0,(0,Q.alwaysValidSchema)(J,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),j3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?X.str`must contain at least ${G} valid item(s)`:X.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?X._`{minContains: ${G}}`:X._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:z,it:J}=G,K,Z,{minContains:D,maxContains:I}=L;if(J.opts.next)K=D===void 0?1:D,Z=I;else K=1;let A=B.const("len",X._`${z}.length`);if(G.setParams({min:K,max:Z}),Z===void 0&&K===0){(0,Q.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(Z!==void 0&&K>Z){(0,Q.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,Q.alwaysValidSchema)(J,F)){let U=X._`${A} >= ${K}`;if(Z!==void 0)U=X._`${U} && ${A} <= ${Z}`;G.pass(U);return}J.items=!0;let M=B.name("valid");if(Z===void 0&&K===1)$(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),Z!==void 0)B.if(X._`${z}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),O=B.let("count",0);$(U,()=>B.if(U,()=>V(O)))}function $(U,O){B.forRange("i",0,A,(R)=>{G.subschema({keyword:"contains",dataProp:R,dataPropType:Q.Type.Num,compositeRule:!0},U),O()})}function V(U){if(B.code(X._`${U}++`),Z===void 0)B.if(X._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(X._`${U} > ${Z}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(X._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),v7=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let X=I0(),Q=v0(),Y=f6();W.error={message:({params:{property:z,depsCount:J,deps:K}})=>{let Z=J===1?"property":"properties";return X.str`must have ${Z} ${K} when property ${z} is present`},params:({params:{property:z,depsCount:J,deps:K,missingProperty:Z}})=>X._`{property: ${z},
208
+ missingProperty: ${Z},
97
209
  depsCount: ${J},
98
- deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(z){let[J,K]=B(z);F(z,J),L(z,K)}};function B({schema:z}){let J={},K={};for(let H in z){if(H==="__proto__")continue;let D=Array.isArray(z[H])?J:K;D[H]=z[H]}return[J,K]}function F(z,J=z.schema){let{gen:K,data:H,it:D}=z;if(Object.keys(J).length===0)return;let I=K.let("missing");for(let A in J){let M=J[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,H,A,D.opts.ownProperties);if(z.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let Z of M)(0,Y.checkReportMissingProp)(z,Z)});else K.if(Q._`${N} && (${(0,Y.checkMissingProp)(z,M,I)})`),(0,Y.reportMissingProp)(z,I),K.else()}}W.validatePropertyDeps=F;function L(z,J=z.schema){let{gen:K,data:H,keyword:D,it:I}=z,A=K.name("valid");for(let M in J){if((0,X.alwaysValidSchema)(I,J[M]))continue;K.if((0,Y.propertyInData)(K,H,M,I.opts.ownProperties),()=>{let N=z.subschema({keyword:D,schemaProp:M},A);z.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),z.ok(A)}}W.validateSchemaDeps=L,W.default=G}),X3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>Q._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G;if((0,X.alwaysValidSchema)(z,F))return;let J=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},J),B.if((0,Q.not)(J),()=>{if(G.error(!0),!z.allErrors)B.break()})}),G.ok(J)}};W.default=Y}),JZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=g6(),X=I0(),Y=_6(),G=v0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>X._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:z,parentSchema:J,data:K,errsCount:H,it:D}=F;if(!H)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,z))return;let M=(0,Q.allSchemaProperties)(J.properties),N=(0,Q.allSchemaProperties)(J.patternProperties);Z(),F.ok(X._`${H} === ${Y.default.errors}`);function Z(){L.forIn("key",K,(O)=>{if(!M.length&&!N.length)j(O);else L.if(V(O),()=>j(O))})}function V(O){let w;if(M.length>8){let T=(0,G.schemaRefOrVal)(D,J.properties,"properties");w=(0,Q.isOwnProperty)(L,T,O)}else if(M.length)w=(0,X.or)(...M.map((T)=>X._`${O} === ${T}`));else w=X.nil;if(N.length)w=(0,X.or)(w,...N.map((T)=>X._`${(0,Q.usePattern)(F,T)}.test(${O})`));return(0,X.not)(w)}function U(O){L.code(X._`delete ${K}[${O}]`)}function j(O){if(A.removeAdditional==="all"||A.removeAdditional&&z===!1){U(O);return}if(z===!1){if(F.setParams({additionalProperty:O}),F.error(),!I)L.break();return}if(typeof z=="object"&&!(0,G.alwaysValidSchema)(D,z)){let w=L.name("valid");if(A.removeAdditional==="failing")R(O,w,!1),L.if((0,X.not)(w),()=>{F.reset(),U(O)});else if(R(O,w),!I)L.if((0,X.not)(w),()=>L.break())}}function R(O,w,T){let k={keyword:"additionalProperties",dataProp:O,dataPropType:G.Type.Str};if(T===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),Y3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=aW(),X=g6(),Y=v0(),G=JZ(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,parentSchema:J,data:K,it:H}=F;if(H.opts.removeAdditional==="all"&&J.additionalProperties===void 0)G.default.code(new Q.KeywordCxt(H,G.default,"additionalProperties"));let D=(0,X.allSchemaProperties)(z);for(let Z of D)H.definedProperties.add(Z);if(H.opts.unevaluated&&D.length&&H.props!==!0)H.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),H.props);let I=D.filter((Z)=>!(0,Y.alwaysValidSchema)(H,z[Z]));if(I.length===0)return;let A=L.name("valid");for(let Z of I){if(M(Z))N(Z);else{if(L.if((0,X.propertyInData)(L,K,Z,H.opts.ownProperties)),N(Z),!H.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add(Z),F.ok(A)}function M(Z){return H.opts.useDefaults&&!H.compositeRule&&z[Z].default!==void 0}function N(Z){F.subschema({keyword:"properties",schemaProp:Z,dataProp:Z},A)}}};W.default=B}),G3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=g6(),X=I0(),Y=v0(),G=v0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,data:J,parentSchema:K,it:H}=F,{opts:D}=H,I=(0,Q.allSchemaProperties)(z),A=I.filter((R)=>(0,Y.alwaysValidSchema)(H,z[R]));if(I.length===0||A.length===I.length&&(!H.opts.unevaluated||H.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(H.props!==!0&&!(H.props instanceof X.Name))H.props=(0,G.evaluatedPropsToName)(L,H.props);let{props:Z}=H;V();function V(){for(let R of I){if(M)U(R);if(H.allErrors)j(R);else L.var(N,!0),j(R),L.if(N)}}function U(R){for(let O in M)if(new RegExp(R).test(O))(0,Y.checkStrictMode)(H,`property ${O} matches pattern ${R} (use allowMatchingProperties)`)}function j(R){L.forIn("key",J,(O)=>{L.if(X._`${(0,Q.usePattern)(F,R)}.test(${O})`,()=>{let w=A.includes(R);if(!w)F.subschema({keyword:"patternProperties",schemaProp:R,dataProp:O,dataPropType:G.Type.Str},N);if(H.opts.unevaluated&&Z!==!0)L.assign(X._`${Z}[${O}]`,!0);else if(!w&&!H.allErrors)L.if((0,X.not)(N),()=>L.break())})})}}};W.default=B}),B3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,Q.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=X}),F3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:g6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=Q}),L3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>Q._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:z}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(z.opts.discriminator&&L.discriminator)return;let J=F,K=B.let("valid",!1),H=B.let("passing",null),D=B.name("_valid");G.setParams({passing:H}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){J.forEach((A,M)=>{let N;if((0,X.alwaysValidSchema)(z,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(Q._`${D} && ${K}`).assign(K,!1).assign(H,Q._`[${H}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(H,M),N)G.mergeEvaluated(N,Q.Name)})})}}};W.default=Y}),z3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((z,J)=>{if((0,Q.alwaysValidSchema)(F,z))return;let K=Y.subschema({keyword:"allOf",schemaProp:J},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=X}),J3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>Q.str`must match "${B.ifClause}" schema`,params:({params:B})=>Q._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:z}=B;if(L.then===void 0&&L.else===void 0)(0,X.checkStrictMode)(z,'"if" without "then" and "else" is ignored');let J=G(z,"then"),K=G(z,"else");if(!J&&!K)return;let H=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),J&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(J)F.if(D,A("then"));else F.if((0,Q.not)(D),A("else"));B.pass(H,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let Z=B.subschema({keyword:M},D);if(F.assign(H,D),B.mergeValidEvaluated(Z,H),N)F.assign(N,Q._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,X.alwaysValidSchema)(B,L)}W.default=Y}),K3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=X}),KZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=LZ(),X=ew(),Y=zZ(),G=W3(),B=Q3(),F=O7(),L=X3(),z=JZ(),J=Y3(),K=G3(),H=B3(),D=F3(),I=L3(),A=z3(),M=J3(),N=K3();function Z(V=!1){let U=[H.default,D.default,I.default,A.default,M.default,N.default,L.default,z.default,F.default,J.default,K.default];if(V)U.push(X.default,G.default);else U.push(Q.default,Y.default);return U.push(B.default),U}W.default=Z}),Z3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must match format "${Y}"`,params:({schemaCode:Y})=>Q._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:z,schemaCode:J,it:K}=Y,{opts:H,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!H.validateFormats)return;if(L)M();else N();function M(){let Z=B.scopeValue("formats",{ref:A.formats,code:H.code.formats}),V=B.const("fDef",Q._`${Z}[${J}]`),U=B.let("fType"),j=B.let("format");B.if(Q._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,Q._`${V}.type || "string"`).assign(j,Q._`${V}.validate`),()=>B.assign(U,Q._`"string"`).assign(j,V)),Y.fail$data((0,Q.or)(R(),O()));function R(){if(H.strictSchema===!1)return Q.nil;return Q._`${J} && !${j}`}function O(){let w=I.$async?Q._`(${V}.async ? await ${j}(${F}) : ${j}(${F}))`:Q._`${j}(${F})`,T=Q._`(typeof ${j} == "function" ? ${w} : ${j}.test(${F}))`;return Q._`${j} && ${j} !== true && ${U} === ${G} && !${T}`}}function N(){let Z=A.formats[z];if(!Z){R();return}if(Z===!0)return;let[V,U,j]=O(Z);if(V===G)Y.pass(w());function R(){if(H.strictSchema===!1){A.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${D}"`}}function O(T){let k=T instanceof RegExp?(0,Q.regexpCode)(T):H.code.formats?Q._`${H.code.formats}${(0,Q.getProperty)(z)}`:void 0,l=B.scopeValue("formats",{key:z,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,Q._`${l}.validate`];return["string",T,l]}function w(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!I.$async)throw Error("async format in sync schema");return Q._`await ${j}(${F})`}return typeof U=="function"?Q._`${j}(${F})`:Q._`${j}.test(${F})`}}}};W.default=X}),ZZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=[Z3().default];W.default=Q}),HZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),H3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=BZ(),X=FZ(),Y=KZ(),G=ZZ(),B=HZ(),F=[Q.default,X.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),$3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var Q;(function(X){X.Tag="tag",X.Mapping="mapping"})(Q||(W.DiscrError=Q={}))}),$Z=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=$3(),Y=VX(),G=sW(),B=v0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:z}})=>L===X.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:L,tag:z,tagName:J}})=>Q._`{error: ${L}, tag: ${J}, tagValue: ${z}}`},code(L){let{gen:z,data:J,schema:K,parentSchema:H,it:D}=L,{oneOf:I}=H;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=z.let("valid",!1),N=z.const("tag",Q._`${J}${(0,Q.getProperty)(A)}`);z.if(Q._`typeof ${N} == "string"`,()=>Z(),()=>L.error(!1,{discrError:X.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function Z(){let j=U();z.if(!1);for(let R in j)z.elseIf(Q._`${N} === ${R}`),z.assign(M,V(j[R]));z.else(),L.error(!1,{discrError:X.DiscrError.Mapping,tag:N,tagName:A}),z.endIf()}function V(j){let R=z.name("valid"),O=L.subschema({keyword:"oneOf",schemaProp:j},R);return L.mergeEvaluated(O,Q.Name),R}function U(){var j;let R={},O=T(H),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(j=h===null||h===void 0?void 0:h.properties)===null||j===void 0?void 0:j[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(O||T(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return R;function T({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in R)throw Error(`discriminator: "${A}" values must be unique strings`);R[_]=h}}}};W.default=F}),U3=X0((W,Q)=>{Q.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}}),UZ=X0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let X=GZ(),Y=H3(),G=$Z(),B=U3(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var z=class extends X.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=z,Q.exports=W=z,Q.exports.Ajv=z,Object.defineProperty(W,"__esModule",{value:!0}),W.default=z;var J=aW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var K=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var H=NX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return H.default}});var D=sW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),AZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let Q=I0(),X=_6(),Y=VX(),G=M7(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(z)=>F(z,z.schema)};function F(z,J){let{gen:K,it:H}=z;H.schemaEnv.root.dynamicAnchors[J]=!0;let D=Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(J)}`,I=H.errSchemaPath==="#"?H.validateName:L(z);K.if(Q._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(z){let{schemaEnv:J,schema:K,self:H}=z.it,{root:D,baseId:I,localRefs:A,meta:M}=J.root,{schemaId:N}=H.opts,Z=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(H,Z),(0,G.getValidate)(z,Z)}W.default=B}),NZ=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let Q=I0(),X=_6(),Y=M7(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:z,keyword:J,it:K}=F;if(L[0]!=="#")throw Error(`"${J}" only supports hash fragment reference`);let H=L.slice(1);if(K.allErrors)D();else{let A=z.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[H]){let M=z.let("_v",Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(H)}`);z.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>z.block(()=>{(0,Y.callRef)(F,A),z.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),A3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=AZ(),X=v0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,Q.dynamicAnchor)(G,"");else(0,X.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),N3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=NZ(),X={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,Q.dynamicRef)(Y,Y.schema)};W.default=X}),V3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=AZ(),X=NZ(),Y=A3(),G=N3(),B=[Q.default,X.default,Y.default,G.default];W.default=B}),w3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=O7(),X={keyword:"dependentRequired",type:"object",schemaType:"object",error:Q.error,code:(Y)=>(0,Q.validatePropertyDeps)(Y)};W.default=X}),D3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=O7(),X={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,Q.validateSchemaDeps)(Y)};W.default=X}),M3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=v0(),X={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=X}),j3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=w3(),X=D3(),Y=M3(),G=[Q.default,X.default,Y.default];W.default=G}),O3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y=_6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>Q._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:z,errsCount:J,it:K}=B;if(!J)throw Error("ajv implementation error");let{allErrors:H,props:D}=K;if(D instanceof Q.Name)F.if(Q._`${D} !== true`,()=>F.forIn("key",z,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",z,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(Q._`${J} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!H)F.break();return}if(!(0,X.alwaysValidSchema)(K,L)){let Z=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:X.Type.Str},Z),!H)F.if((0,Q.not)(Z),()=>F.break())}}function A(N,Z){return Q._`!${N} || !${N}[${Z}]`}function M(N,Z){let V=[];for(let U in N)if(N[U]===!0)V.push(Q._`${Z} !== ${U}`);return(0,Q.and)(...V)}}};W.default=G}),E3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=I0(),X=v0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>Q.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>Q._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G,J=z.items||0;if(J===!0)return;let K=B.const("len",Q._`${L}.length`);if(F===!1)G.setParams({len:J}),G.fail(Q._`${K} > ${J}`);else if(typeof F=="object"&&!(0,X.alwaysValidSchema)(z,F)){let D=B.var("valid",Q._`${K} <= ${J}`);B.if((0,Q.not)(D),()=>H(D,J)),G.ok(D)}z.items=!0;function H(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:X.Type.Num},D),!z.allErrors)B.if((0,Q.not)(D),()=>B.break())})}}};W.default=Y}),I3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=O3(),X=E3(),Y=[Q.default,X.default];W.default=Y}),R3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=BZ(),X=FZ(),Y=KZ(),G=V3(),B=j3(),F=I3(),L=ZZ(),z=HZ(),J=[G.default,Q.default,X.default,(0,Y.default)(!0),L.default,z.metadataVocabulary,z.contentVocabulary,B.default,F.default];W.default=J}),T3=X0((W,Q)=>{Q.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}}}}),P3=X0((W,Q)=>{Q.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"}}}}}),S3=X0((W,Q)=>{Q.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"}}}}),b3=X0((W,Q)=>{Q.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"}}}}),q3=X0((W,Q)=>{Q.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"}}}}),C3=X0((W,Q)=>{Q.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"}}}}),k3=X0((W,Q)=>{Q.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}}}}),v3=X0((W,Q)=>{Q.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:[]}}}}),y3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=T3(),X=P3(),Y=S3(),G=b3(),B=q3(),F=C3(),L=k3(),z=v3(),J=["/properties"];function K(H){return[Q,X,Y,G,B,D(this,F),L,D(this,z)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return H?I.$dataMetaSchema(A,J):A}}W.default=K}),_3=X0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let X=GZ(),Y=R3(),G=$Z(),B=y3(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends X.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,Q.exports=W=L,Q.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var z=aW();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var J=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return J._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return J.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return J.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return J.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return J.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return J.CodeGen}});var K=NX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var H=sW();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return H.default}})}),g3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function Q(_,h){return{validate:_,compare:h}}W.fullFormats={date:Q(B,F),time:Q(z(!0),J),"date-time":Q(D(!0),I),"iso-time":Q(z(),K),"iso-date-time":Q(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Z,"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:l,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:U,int32:{type:"number",validate:O},int64:{type:"number",validate:w},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:Q(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,J),"date-time":Q(/^\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,I),"iso-time":Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":Q(/^\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,A),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},W.formatNames=Object.keys(W.fullFormats);function X(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],K0=+h[3];return p>=1&&p<=12&&K0>=1&&K0<=(p===2&&X(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function z(_){return function(d){let p=L.exec(d);if(!p)return!1;let K0=+p[1],j0=+p[2],w0=+p[3],S0=p[4],H0=p[5]==="-"?-1:1,b=+(p[6]||0),v=+(p[7]||0);if(b>23||v>59||_&&!S0)return!1;if(K0<=23&&j0<=59&&w0<60)return!0;let u=j0-v*H0,E=K0-b*H0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&w0<61}}function J(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let H=/t|\s/i;function D(_){let h=z(_);return function(p){let K0=p.split(H);return K0.length===2&&B(K0[0])&&h(K0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(H),[K0,j0]=h.split(H),w0=F(d,K0);if(w0===void 0)return;return w0||J(p,j0)}let M=/\/|:/,N=/^(?:[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;function Z(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let j=-2147483648,R=2147483647;function O(_){return Number.isInteger(_)&&_<=R&&_>=j}function w(_){return Number.isInteger(_)}function T(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),f3=X0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let Q=UZ(),X=I0(),Y=X.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:z})=>X.str`should be ${G[L].okStr} ${z}`,params:({keyword:L,schemaCode:z})=>X._`{comparison: ${G[L].okStr}, limit: ${z}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:z,data:J,schemaCode:K,keyword:H,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new Q.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else Z();function N(){let U=z.scopeValue("formats",{ref:A.formats,code:I.code.formats}),j=z.const("fmt",X._`${U}[${M.schemaCode}]`);L.fail$data((0,X.or)(X._`typeof ${j} != "object"`,X._`${j} instanceof RegExp`,X._`typeof ${j}.compare != "function"`,V(j)))}function Z(){let U=M.schema,j=A.formats[U];if(!j||j===!0)return;if(typeof j!="object"||j instanceof RegExp||typeof j.compare!="function")throw Error(`"${H}": format "${U}" does not define "compare" function`);let R=z.scopeValue("formats",{key:U,ref:j,code:I.code.formats?X._`${I.code.formats}${(0,X.getProperty)(U)}`:void 0});L.fail$data(V(R))}function V(U){return X._`${U}.compare(${J}, ${K}) ${G[H].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),x3=X0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=g3(),Y=f3(),G=I0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(J,K={keywords:!0})=>{if(Array.isArray(K))return z(J,K,X.fullFormats,B),J;let[H,D]=K.mode==="fast"?[X.fastFormats,F]:[X.fullFormats,B];if(z(J,K.formats||X.formatNames,H,D),K.keywords)(0,Y.default)(J);return J};L.get=(J,K="full")=>{let H=(K==="fast"?X.fastFormats:X.fullFormats)[J];if(!H)throw Error(`Unknown format "${J}"`);return H};function z(J,K,H,D){var I,A;(I=(A=J.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)J.addFormat(M,H[M])}Q.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),h3=UZ(),u3=_3(),l3=OQ(x3(),1),m3=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),c3=l3.default;cT=h3.Ajv});var E7=$0(()=>{VZ()});function R7(W){return!!W&&typeof W==="object"&&RZ in W}function i3(W){return W[RZ]?.complete}function o3(W){if(W?.maxRounds!==void 0&&(!Number.isInteger(W.maxRounds)||W.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${W.maxRounds})`);if(W?.roundTimeoutMs!==void 0&&(!Number.isFinite(W.roundTimeoutMs)||W.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${W.roundTimeoutMs})`);return{maxRounds:W?.maxRounds??n3,roundTimeoutMs:W?.roundTimeoutMs??r3,legacyShim:W?.legacyShim??!0}}function TZ(W,Q,X){if(X===null||typeof X!=="object"||typeof X.method!=="string")throw new V0(Z0.InternalError,`Handler for ${W} returned an invalid input request '${Q}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let Y=X,G=OK(Y);if(G===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input request '${Q}' of kind '${Y.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:Y,required:G}}function a3(){let W=globalThis.crypto;if(W?.randomUUID!==void 0)return W.randomUUID();let Q=new Uint8Array(16);W.getRandomValues(Q),Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128;let X=[...Q].map((Y)=>Y.toString(16).padStart(2,"0")).join("");return`${X.slice(0,8)}-${X.slice(8,12)}-${X.slice(12,16)}-${X.slice(16,20)}-${X.slice(20)}`}function I7(W,Q){if(W==="tools/call")return{content:[{type:"text",text:Q}],isError:!0};throw new V0(Z0.InternalError,Q)}function XD(W){return{...W}}function wZ(W,Q){if(W){let Y=Q;return async(G,B)=>Y(G,B)}let X=Q;return async(Y,G)=>X(G)}function MZ(W){if(W===void 0)return;try{return Y4(W,"output")}catch{return}}function jZ(W,Q,X){if(Q){let Y=X;return async(G,B)=>{let F=await C4(Q,G);if(!F.success)throw new V0(Z0.InvalidParams,`Invalid arguments for prompt ${W}: ${F.error}`);return Y(F.data,B)}}else{let Y=X;return async(G,B)=>{return Y(B)}}}function OZ(W){return{completion:{values:W.map(String).slice(0,100),total:W.length,hasMore:W.length>100}}}function EZ(W){let Q=W;if(Q.shape&&typeof Q.shape==="object")return Q.shape}function YD(W){return W?.type==="optional"}function IZ(W){if(!YD(W))return W;return W.def?.innerType??W}var RZ,n3=8,r3=600000,s3=class{constructor(W){this._host=W}async fulfill(W,Q,X,Y,G){let{maxRounds:B,roundTimeoutMs:F}=this._host,L=Y.mcpReq.signal,z=G,J=0;while(!0){if(J+=1,J>B)return I7(W,iK(W,B));let K=z.inputRequests,H=K!=null&&Object.keys(K).length>0,D=typeof z.requestState==="string"?z.requestState:void 0;if(!H&&D===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let I;if(H){let N=this._host.resolvedClientCapabilities(Y),Z=[];for(let[U,j]of Object.entries(K)){let{embedded:R,required:O}=TZ(W,U,j);if(R.method!=="roots/list"&&R.params===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input request '${U}' of kind '${R.method}' without params`);if(FX(O,N)!==void 0)return I7(W,`Cannot request input '${U}' (${R.method}): the client on this 2025-era connection did not declare the required capability${N===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);Z.push([U,R])}let V=rK(L);try{let U={relatedRequestId:Y.mcpReq.id,timeout:F,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:V.signal},j=await Promise.all(Z.map(async([R,O])=>{try{return[R,await this._dispatchLeg(O,U)]}catch(w){throw V.abort(w),w}}));I=Object.fromEntries(j)}catch(U){if(L.aborted)throw U;return I7(W,`Fulfilling input required by '${W}' failed: ${U instanceof Error?U.message:String(U)}`)}finally{V.dispose()}}else await nK(dK,L);let A={...Y,mcpReq:{...Y.mcpReq,inputResponses:I,droppedInputResponseKeys:void 0,requestState:oW(D)}};if(D!==void 0){let N=await this._host.verifyRequestState(D,A,W);if(N!==void 0)A=$7(A,N)}let M=await Q(X,A);if(!k5(M))return M;z=M}}async _dispatchLeg(W,Q){switch(W.method){case"elicitation/create":{let X=W.params;if(X.mode==="url"&&X.elicitationId===void 0)X={...X,elicitationId:a3()};return await this._host.sendElicitation(X,Q)}case"sampling/createMessage":return await this._host.sendSampling(W.params,Q);case"roots/list":return await this._host.listRoots(W.params,Q)}}},t3,e3,WD,QD,PZ,T7=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(W){let Q=this._registeredTools[W];if(Q===void 0||!Q.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,W))return this._toolInputSchemaJson[W];if(Q.inputSchema===void 0)return DZ;try{let X=Y4(Q.inputSchema,"input");return this._toolInputSchemaJson[W]=X,X}catch{return}}constructor(W,Q){if(this.server=new PZ(W,Q),Q?.capabilities?.tools)this.setToolRequestHandlers();if(Q?.capabilities?.resources)this.setResourceRequestHandlers();if(Q?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(W){return await this.server.connect(W)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,W])=>W.enabled).map(([W,Q])=>{let X={name:W,title:Q.title,description:Q.description,inputSchema:Q.inputSchema?Y4(Q.inputSchema,"input"):DZ,annotations:Q.annotations,icons:Q.icons,execution:Q.execution,_meta:Q._meta};if(Q.outputSchema)X.outputSchema=Y4(Q.outputSchema,"output");return X})})),this.server.setRequestHandler("tools/call",async(W,Q)=>{let X=this._registeredTools[W.params.name];if(!X)throw new V0(Z0.InvalidParams,`Tool ${W.params.name} not found`);if(!X.enabled)throw new V0(Z0.InvalidParams,`Tool ${W.params.name} disabled`);try{let Y=await this.validateToolInput(X,W.params.arguments,W.params.name),G=await this.executeToolHandler(X,Y,Q);if(await this.validateToolOutput(X,G,W.params.name),k5(G))return G;return this.server.projectCallToolResult(G,X.outputSchemaJson)}catch(Y){if(Y instanceof V0&&Y.code===Z0.UrlElicitationRequired)throw Y;return this.createToolError(Y instanceof Error?Y.message:String(Y))}}),this._toolHandlersInitialized=!0}createToolError(W){return{content:[{type:"text",text:W}],isError:!0}}async validateToolInput(W,Q,X){if(!W.inputSchema)return;let Y=await C4(W.inputSchema,Q??{});if(!Y.success)throw new V0(Z0.InvalidParams,`Input validation error: Invalid arguments for tool ${X}: ${Y.error}`);return Y.data}async validateToolOutput(W,Q,X){if(!W.outputSchema)return;if(k5(Q))return;if(Q.isError)return;if(Q.structuredContent===void 0)throw new V0(Z0.InvalidParams,`Output validation error: Tool ${X} has an output schema but no structured content was provided`);let Y=await C4(W.outputSchema,Q.structuredContent);if(!Y.success)throw new V0(Z0.InvalidParams,`Output validation error: Invalid structured content for tool ${X}: ${Y.error}`)}async executeToolHandler(W,Q,X){return W.executor(Q,X)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(W)=>{switch(W.params.ref.type){case"ref/prompt":return J7(W),this.handlePromptCompletion(W,W.params.ref);case"ref/resource":return K7(W),this.handleResourceCompletion(W,W.params.ref);default:throw new V0(Z0.InvalidParams,`Invalid completion reference: ${W.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(W,Q){let X=this._registeredPrompts[Q.name];if(!X)throw new V0(Z0.InvalidParams,`Prompt ${Q.name} not found`);if(!X.enabled)throw new V0(Z0.InvalidParams,`Prompt ${Q.name} disabled`);if(!X.argsSchema)return tW;let Y=IZ(EZ(X.argsSchema)?.[W.params.argument.name]);if(!R7(Y))return tW;let G=i3(Y);if(!G)return tW;return OZ(await G(W.params.argument.value,W.params.context))}async handleResourceCompletion(W,Q){let X=Object.values(this._registeredResourceTemplates).find((G)=>G.resourceTemplate.uriTemplate.toString()===Q.uri);if(!X){if(this._registeredResources[Q.uri])return tW;throw new V0(Z0.InvalidParams,`Resource template ${W.params.ref.uri} not found`)}let Y=X.resourceTemplate.completeCallback(W.params.argument.name);if(!Y)return tW;return OZ(await Y(W.params.argument.value,W.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(W,Q)=>{let X=Object.entries(this._registeredResources).filter(([G,B])=>B.enabled).map(([G,B])=>({uri:G,name:B.name,...B.metadata})),Y=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let B=await G.resourceTemplate.listCallback(Q);for(let F of B.resources)Y.push({...G.metadata,...F})}return{resources:[...X,...Y]}}),this.server.setRequestHandler("resources/templates/list",async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([W,Q])=>({name:W,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler("resources/read",async(W,Q)=>{let X;try{X=new URL(W.params.uri)}catch{throw new V0(Z0.InvalidParams,`Resource URI ${W.params.uri} is invalid`,{uri:W.params.uri,reason:"invalid_uri"})}let Y=this._registeredResources[X.toString()];if(Y){if(!Y.enabled)throw new V0(Z0.InvalidParams,`Resource ${X} disabled`);return LX(await Y.readCallback(X,Q),Y.cacheHint)}for(let G of Object.values(this._registeredResourceTemplates)){let B=G.resourceTemplate.uriTemplate.match(X.toString());if(B)return LX(await G.readCallback(X,B,Q),G.cacheHint)}throw new zX(W.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,W])=>W.enabled).map(([W,Q])=>{return{name:W,title:Q.title,description:Q.description,arguments:Q.argsSchema?pK(Q.argsSchema):void 0,icons:Q.icons,_meta:Q._meta}})})),this.server.setRequestHandler("prompts/get",async(W,Q)=>{let X=this._registeredPrompts[W.params.name];if(!X)throw new V0(Z0.InvalidParams,`Prompt ${W.params.name} not found`);if(!X.enabled)throw new V0(Z0.InvalidParams,`Prompt ${W.params.name} disabled`);return X.handler(W.params.arguments,Q)}),this._promptHandlersInitialized=!0}registerResource(W,Q,X,Y){let G=X.cacheHint,B=X;if(G!==void 0){B7(G,`resource ${W}`);let F={...X};delete F.cacheHint,B=F}if(typeof Q==="string"){if(this._registeredResources[Q])throw Error(`Resource ${Q} is already registered`);let F=this._createRegisteredResource(W,X.title,Q,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}else{if(this._registeredResourceTemplates[W])throw Error(`Resource template ${W} is already registered`);let F=this._createRegisteredResourceTemplate(W,X.title,Q,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}}_createRegisteredResource(W,Q,X,Y,G){let B={name:W,title:Q,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({uri:null}),update:(F)=>{if(F.uri!==void 0&&F.uri!==X){if(delete this._registeredResources[X],F.uri)this._registeredResources[F.uri]=B}if(F.name!==void 0)B.name=F.name;if(F.title!==void 0)B.title=F.title;if(F.metadata!==void 0)B.metadata=F.metadata;if(F.callback!==void 0)B.readCallback=F.callback;if(F.enabled!==void 0)B.enabled=F.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=B,B}_createRegisteredResourceTemplate(W,Q,X,Y,G){let B={resourceTemplate:X,title:Q,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(L)=>{if(L.name!==void 0&&L.name!==W){if(delete this._registeredResourceTemplates[W],L.name)this._registeredResourceTemplates[L.name]=B}if(L.title!==void 0)B.title=L.title;if(L.template!==void 0)B.resourceTemplate=L.template;if(L.metadata!==void 0)B.metadata=L.metadata;if(L.callback!==void 0)B.readCallback=L.callback;if(L.enabled!==void 0)B.enabled=L.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[W]=B;let F=X.uriTemplate.variableNames;if(Array.isArray(F)&&F.some((L)=>!!X.completeCallback(L)))this.setCompletionRequestHandler();return B}_createRegisteredPrompt(W,Q,X,Y,G,B,F){let L=Y,z=G,J={title:Q,description:X,argsSchema:Y,icons:B,_meta:F,handler:jZ(W,Y,G),enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(K)=>{if(K.name!==void 0&&K.name!==W){if(delete this._registeredPrompts[W],K.name)this._registeredPrompts[K.name]=J}if(K.title!==void 0)J.title=K.title;if(K.description!==void 0)J.description=K.description;if(K.icons!==void 0)J.icons=K.icons;if(K._meta!==void 0)J._meta=K._meta;let H=!1;if(K.argsSchema!==void 0)J.argsSchema=K.argsSchema,L=K.argsSchema,H=!0;if(K.callback!==void 0)z=K.callback,H=!0;if(H)J.handler=jZ(W,L,z);if(K.enabled!==void 0)J.enabled=K.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[W]=J,Y){let K=EZ(Y);if(K){if(Object.values(K).some((H)=>{return R7(IZ(H))}))this.setCompletionRequestHandler()}}return J}_createRegisteredTool(W,Q,X,Y,G,B,F,L,z,J){if(w7(W),Y!==void 0)try{let D=Y4(Y,"input");this._toolInputSchemaJson[W]=D;let I=Z7(D);if(!I.valid)console.warn(`[mcp-sdk] tool '${W}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${I.reason}`)}catch{}let K=J,H={title:Q,description:X,inputSchema:Y,outputSchema:G,outputSchemaJson:MZ(G),annotations:B,icons:F,execution:L,_meta:z,handler:J,executor:wZ(Y,J),enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(D)=>{if(D.name!==void 0&&D.name!==W){if(typeof D.name==="string")w7(D.name);if(delete this._registeredTools[W],delete this._toolInputSchemaJson[W],D.name)delete this._toolInputSchemaJson[D.name],this._registeredTools[D.name]=H,W=D.name}if(D.title!==void 0)H.title=D.title;if(D.description!==void 0)H.description=D.description;let I=!1;if(D.paramsSchema!==void 0)H.inputSchema=D.paramsSchema,delete this._toolInputSchemaJson[W],I=!0;if(D.callback!==void 0)H.handler=D.callback,K=D.callback,I=!0;if(I)H.executor=wZ(H.inputSchema,K);if(D.outputSchema!==void 0)H.outputSchema=D.outputSchema,H.outputSchemaJson=MZ(D.outputSchema);if(D.annotations!==void 0)H.annotations=D.annotations;if(D.icons!==void 0)H.icons=D.icons;if(D._meta!==void 0)H._meta=D._meta;if(D.enabled!==void 0)H.enabled=D.enabled;this.sendToolListChanged()}};return this._registeredTools[W]=H,this.setToolRequestHandlers(),this.sendToolListChanged(),H}registerTool(W,Q,X){if(this._registeredTools[W])throw Error(`Tool ${W} is already registered`);let{title:Y,description:G,inputSchema:B,outputSchema:F,annotations:L,icons:z,_meta:J}=Q;return this._createRegisteredTool(W,Y,G,ZX(B),ZX(F),L,z,void 0,J,X)}registerPrompt(W,Q,X){if(this._registeredPrompts[W])throw Error(`Prompt ${W} is already registered`);let{title:Y,description:G,argsSchema:B,icons:F,_meta:L}=Q,z=this._createRegisteredPrompt(W,Y,G,ZX(B),X,F,L);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),z}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(W,Q){return this.server.sendLoggingMessage(W,Q)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}},DZ,tW;var SZ=$0(()=>{D7();E7();RZ=Symbol.for("mcp.completable");t3=new Set(["tools/call","prompts/get","resources/read"]),PZ=class extends U7{_clientCapabilities;_clientVersion;static{e3=(W,Q)=>{if(Q.clientCapabilities!==void 0)W._clientCapabilities=Q.clientCapabilities;if(Q.clientInfo!==void 0)W._clientVersion=Q.clientInfo},WD=(W,Q)=>{let X=Q.filter((Y)=>!W._supportedProtocolVersions.includes(Y));if(X.length>0)W._supportedProtocolVersions=[...W._supportedProtocolVersions,...X];W.setRequestHandler("server/discover",()=>W._ondiscover())},QD=(W)=>W._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new s3({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(W)=>this._inputRequestCapabilityView(W),verifyRequestState:(W,Q,X)=>this._verifyRequestState(W,Q,X),sendElicitation:(W,Q)=>this._sendElicitationLeg(W,Q,{validateAcceptedContent:!1}),sendSampling:(W,Q)=>this.createMessage(W,Q),listRoots:(W,Q)=>this.listRoots(W,Q)})}oninitialized;constructor(W,Q){super(Q);if(this._serverInfo=W,this._capabilities=Q?.capabilities?{...Q.capabilities}:{},this._instructions=Q?.instructions,this._jsonSchemaValidator=Q?.jsonSchemaValidator??new wX,this._requestStateVerify=Q?.requestState?.verify,this._inputRequiredServing=o3(Q?.inputRequired),Q?.cacheHints!==void 0){for(let[X,Y]of Object.entries(Q.cacheHints))if(Y!==void 0)B7(Y,`cacheHints['${X}']`);this._cacheHints=Q.cacheHints}if(this.setRequestHandler("initialize",(X)=>this._oninitialize(X)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),eG(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(W,Q)=>{let X=Q.sessionId||Q.http?.req?.headers.get("mcp-session-id")||void 0,{level:Y}=W.params,G=KX(r6,Y);if(G.success)this._loggingLevels.set(X,G.data);return{}})}buildContext(W,Q){let X=W.http||Q?.request||Q?.closeSSEStream||Q?.closeStandaloneSSEStream;return{...W,mcpReq:{...W.mcpReq,log:(Y,G,B)=>{if(!this._capabilities.logging)return Promise.resolve();let F;if(this._servedModernEra()){if(F=W.mcpReq.envelope?.[r1],F===void 0)return Promise.resolve()}else F=this._loggingLevels.get(W.sessionId)??this._loggingLevels.get(void 0);if(F!==void 0&&this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(F))return Promise.resolve();return W.mcpReq.notify({method:"notifications/message",params:{level:Y,data:G,logger:B}})},elicitInput:(Y,G)=>this.elicitInput(Y,G),requestSampling:(Y,G)=>this.createMessage(Y,G)},http:X?{...W.http,req:Q?.request,closeSSE:Q?.closeSSEStream,closeStandaloneSSE:Q?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(r6.options.map((W,Q)=>[W,Q]));isMessageIgnored=(W,Q)=>{let X=this._loggingLevels.get(Q);return X?this.LOG_LEVEL_SEVERITY.get(W)<this.LOG_LEVEL_SEVERITY.get(X):!1};registerCapabilities(W){if(this.transport)throw new E0(q0.AlreadyConnected,"Cannot register capabilities after connecting to transport");let Q=!!this._capabilities.logging;if(this._capabilities=A7(this._capabilities,W),!Q&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(W,Q){if(W!=="tools/call"){let X=this._cacheHints?.[W],Y=t3.has(W);if(X===void 0&&!Y)return async(G,B)=>{let F=await Q(G,B);if(k5(F))throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F};return async(G,B)=>{let F=Y?await this._invokeInputRequiredCapableHandler(W,Q,G,B):await Q(G,B);if(k5(F)){if(!Y)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F}return X===void 0?F:LX(F,X)}}return async(X,Y)=>{let G=l9(this._negotiatedProtocolVersion),B=G.validateRequest("tools/call",X);if(!B.ok)throw new V0(B.reason==="not-in-era"?Z0.InternalError:Z0.InvalidParams,B.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${B.message}`);let F=await this._invokeInputRequiredCapableHandler("tools/call",Q,X,Y);if(k5(F))return F;let L=W7(F),z=G.validateResult("tools/call",L);if(!z.ok)throw new V0(z.reason==="not-in-era"?Z0.InternalError:Z0.InvalidParams,z.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${z.message}`);return z.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&rW(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(W,Q,X,Y){let G=this._servedModernEra(),B=Y.mcpReq.requestState();if(B!==void 0&&typeof B!=="string")throw new V0(Z0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let F=Y;if(typeof B==="string"){let H=await this._verifyRequestState(B,Y,W);if(H!==void 0)F=$7(Y,H)}let L;try{L=await Q(X,F)}catch(H){if(H instanceof V0&&H.code===Z0.UrlElicitationRequired){if(!G)throw H;throw new V0(Z0.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.`)}throw H}if(!k5(L))return L;if(!G){if(!this._inputRequiredServing.legacyShim)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??R5}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(W,Q,X,F,L)}let z=L.inputRequests,J=z!=null&&Object.keys(z).length>0,K=typeof L.requestState==="string";if(!J&&!K)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(J){let H=this._inputRequestCapabilityView(Y);for(let[D,I]of Object.entries(z)){let{embedded:A,required:M}=TZ(W,D,I),N=FX(M,H);if(N!==void 0)throw new JX({requiredCapabilities:N},`Cannot request input '${D}' (${A.method}): the request's client capabilities do not declare the required capability`)}}return L}async _verifyRequestState(W,Q,X){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(W,Q)}catch(Y){throw this.onerror?.(Error(`requestState verification rejected ${X}: ${Y instanceof Error?Y.message:String(Y)}`)),new V0(Z0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(W){return this._servedModernEra()?W.mcpReq.envelope?.[q1]:this._clientCapabilities}_assertPushApiInServedEra(W){if(this._servedModernEra())throw new E0(q0.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${W}' 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:W,era:"2026-07-28"})}assertCapabilityForMethod(W){switch(W){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new E0(q0.CapabilityNotSupported,`Client does not support sampling (required for ${W})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new E0(q0.CapabilityNotSupported,`Client does not support elicitation (required for ${W})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new E0(q0.CapabilityNotSupported,`Client does not support listing roots (required for ${W})`);break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/message":if(!this._capabilities.logging)throw new E0(q0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying about resources (required for ${W})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${W})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${W})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,`Client does not support URL elicitation (required for ${W})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"completion/complete":if(!this._capabilities.completions)throw new E0(q0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new E0(q0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new E0(q0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new E0(q0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new E0(q0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"ping":case"initialize":break}}async _oninitialize(W){let Q=W.params.protocolVersion;this._clientCapabilities=W.params.capabilities,this._clientVersion=W.params.clientInfo;let X=EK(this._supportedProtocolVersions),Y=X.includes(Q)?Q:X[0]??R5;return this._negotiatedProtocolVersion=Y,this.transport?.setProtocolVersion?.(Y),{protocolVersion:Y,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:eG(this._supportedProtocolVersions),capabilities:XD(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(W,Q){return this._wireCodec().projectCallToolResult(W,Q)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(W,Q){if(this._assertPushApiInServedEra("sampling/createMessage"),(W.tools||W.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new E0(q0.CapabilityNotSupported,"Client does not support sampling tools capability.");if(W.messages.length>0){let B=W.messages.at(-1),F=Array.isArray(B.content)?B.content:[B.content],L=F.some((H)=>H.type==="tool_result"),z=W.messages.length>1?W.messages.at(-2):void 0,J=z?Array.isArray(z.content)?z.content:[z.content]:[],K=J.some((H)=>H.type==="tool_use");if(L){if(F.some((H)=>H.type!=="tool_result"))throw new V0(Z0.InvalidParams,"The last message must contain only tool_result content if any is present");if(!K)throw new V0(Z0.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(K){let H=new Set(J.filter((I)=>I.type==="tool_use").map((I)=>I.id)),D=new Set(F.filter((I)=>I.type==="tool_result").map((I)=>I.toolUseId));if(H.size!==D.size||![...H].every((I)=>D.has(I)))throw new V0(Z0.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let X=Boolean(W.tools||W.toolChoice),Y=await this.request({method:"sampling/createMessage",params:W},Q),G=this._wireCodec().samplingResultVariant(X,Y);if(!G.ok)throw new E0(q0.InvalidResult,`Invalid sampling/createMessage result: ${G.reason==="invalid"?G.message:G.reason}`);return G.value}async elicitInput(W,Q){switch(this._assertPushApiInServedEra("elicitation/create"),W.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new E0(q0.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(W,Q)}async _sendElicitationLeg(W,Q,X){let Y=W.mode??"form",G=X?.validateAcceptedContent??!0;switch(Y){case"url":{let B=W;return this.request({method:"elicitation/create",params:B},Q)}case"form":{let B=W.mode==="form"?W:{...W,mode:"form"},F=await this.request({method:"elicitation/create",params:B},Q);if(G&&F.action==="accept"&&F.content&&B.requestedSchema)try{let L=this._jsonSchemaValidator.getValidator(B.requestedSchema)(F.content);if(!L.valid)throw new V0(Z0.InvalidParams,`Elicitation response content does not match requested schema: ${L.errorMessage}`)}catch(L){if(L instanceof V0)throw L;throw new V0(Z0.InternalError,`Error validating elicitation response: ${L instanceof Error?L.message:String(L)}`)}return F}}}createElicitationCompletionNotifier(W,Q){if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:W}},Q)}async listRoots(W,Q){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:W},Q)}async sendLoggingMessage(W,Q){if(this._capabilities.logging&&!this.isMessageIgnored(W.level,Q))return this.notification({method:"notifications/message",params:W})}async sendResourceUpdated(W){return this.notification({method:"notifications/resources/updated",params:W})}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"})}};DZ={type:"object",properties:{}};tW={completion:{values:[],hasMore:!1}}});var P7=$0(()=>{SZ();D7();E7()});var GD,DX,BD,FD,LD,zD,G0=(W,Q)=>()=>(Q||W((Q={exports:{}}).exports,Q),Q.exports),bZ=(W,Q)=>{let X={};for(var Y in W)DX(X,Y,{get:W[Y],enumerable:!0});if(Q)DX(X,Symbol.toStringTag,{value:"Module"});return X},JD=(W,Q,X,Y)=>{if(Q&&typeof Q==="object"||typeof Q==="function"){for(var G=FD(Q),B=0,F=G.length,L;B<F;B++)if(L=G[B],!zD.call(W,L)&&L!==X)DX(W,L,{get:((z)=>Q[z]).bind(null,L),enumerable:!(Y=BD(Q,L))||Y.enumerable})}return W},MX=(W,Q,X)=>(X=W!=null?GD(LD(W)):{},JD(Q||!W||!W.__esModule?DX(X,"default",{value:W,enumerable:!0}):X,W));var S7=$0(()=>{GD=Object.create,DX=Object.defineProperty,BD=Object.getOwnPropertyDescriptor,FD=Object.getOwnPropertyNames,LD=Object.getPrototypeOf,zD=Object.prototype.hasOwnProperty});function y4(W,Q){let X=new Set,Y=Q;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")X.add(G);Y=Object.getPrototypeOf(Y)}if(X.size===0)return;Object.defineProperty(W,v7,{value:X,enumerable:!1,configurable:!0})}function o1(W,Q){try{if(typeof Q==="object"&&Q!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(Q,v7)){let X=Q[v7];if(X&&typeof X.has==="function"&&X.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,Q)}function G4(W){return W>=lZ}function h7(W){return W.filter((Q)=>!G4(Q))}function BQ(W){return W.filter((Q)=>G4(Q))}function mZ(W){let Q=W.structuredContent;if(Q===void 0)return W;if(!(typeof Q!=="object"||Q===null||Array.isArray(Q)))return W;if(W.content?.some((X)=>X.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(Q)}]}}function ZD(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||cZ.some((Q)=>(Q in W)))return W;return{...W,content:[]}}function HD(){let W=u5(()=>a([$(),m(),o(),q6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=q({ttl:m().optional()}),B=q({taskId:$()}),F=F0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),z=L.extend({task:G.optional()}),J=q({method:$(),params:L.loose().optional()}),K=q({_meta:F.optional()}),H=q({method:$(),params:K.loose().optional()}),D=F0({_meta:F.optional()}),I=a([$(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:$().optional()}),N=H.extend({method:g("notifications/cancelled"),params:M}),Z=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f(Z).optional()}),U=q({name:$(),title:$().optional()}),j=U.extend({...U.shape,...V.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),R=k1(q({applyDefaults:o().optional()}),Q),O=C6((h0)=>{if(h0&&typeof h0==="object"&&!Array.isArray(h0)&&Object.keys(h0).length===0)return{form:{}};return h0},k1(q({form:R.optional(),url:Q.optional()}),Q.optional())),w=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({sampling:F0({createMessage:Q.optional()}).optional(),elicitation:F0({create:Q.optional()}).optional()}).optional()}),T=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({tools:F0({call:Q.optional()}).optional()}).optional()}),k=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n($(),Q).optional()}),l=L.extend({protocolVersion:$(),capabilities:k,clientInfo:j}),_=J.extend({method:g("initialize"),params:l}),h=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n($(),Q).optional()}),d=D.extend({protocolVersion:$(),capabilities:h,serverInfo:j,instructions:$().optional()}),p=H.extend({method:g("notifications/initialized"),params:K.optional()}),K0=J.extend({method:g("ping"),params:L.optional()}),j0=q({progress:m(),total:Q0(m()),message:Q0($())}),w0=q({...K.shape,...j0.shape,progressToken:X}),S0=H.extend({method:g("notifications/progress"),params:w0}),H0=L.extend({cursor:Y.optional()}),b=J.extend({params:H0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:$(),mimeType:Q0($()),_meta:n($(),Y0()).optional()}),E=u.extend({text:$()}),S=$().refine((h0)=>{try{return atob(h0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:S}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),z0=q({...U.shape,...V.shape,uri:$(),description:Q0($()),mimeType:Q0($()),size:Q0(m()),annotations:r.optional(),_meta:Q0(F0({}))}),e=q({...U.shape,...V.shape,uriTemplate:$(),description:Q0($()),mimeType:Q0($()),annotations:r.optional(),_meta:Q0(F0({}))}),D0=b.extend({method:g("resources/list")}),u0=v.extend({resources:f(z0)}),P=b.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:$()}),s=x,t=J.extend({method:g("resources/read"),params:s}),L0=D.extend({contents:f(a([E,C]))}),T0=H.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),C0=x,f0=J.extend({method:g("resources/subscribe"),params:C0}),b0=x,O0=J.extend({method:g("resources/unsubscribe"),params:b0}),o0=K.extend({uri:$()}),k0=H.extend({method:g("notifications/resources/updated"),params:o0}),B1=q({name:$(),description:Q0($()),required:Q0(o())}),X1=q({...U.shape,...V.shape,description:Q0($()),arguments:Q0(f(B1)),_meta:Q0(F0({}))}),F1=b.extend({method:g("prompts/list")}),Z1=v.extend({prompts:f(X1)}),H1=L.extend({name:$(),arguments:n($(),$()).optional()}),w1=J.extend({method:g("prompts/get"),params:H1}),D1=q({type:g("text"),text:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),M1=q({type:g("image"),data:S,mimeType:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),j1=q({type:g("audio"),data:S,mimeType:$(),annotations:r.optional(),_meta:n($(),Y0()).optional()}),W6=q({type:g("tool_use"),name:$(),id:$(),input:n($(),Y0()),_meta:n($(),Y0()).optional()}),$1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n($(),Y0()).optional()}),Q6=z0.extend({type:g("resource_link")}),a0=a([D1,M1,j1,Q6,$1]),y1=q({role:c,content:a0}),_1=D.extend({description:$().optional(),messages:f(y1)}),O1=H.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),X6=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),g1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),E1=q({...U.shape,...V.shape,description:$().optional(),inputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(Y0()),outputSchema:q({type:g("object"),properties:n($(),W).optional(),required:f($()).optional()}).catchall(Y0()).optional(),annotations:X6.optional(),execution:g1.optional(),_meta:n($(),Y0()).optional()}),f1=b.extend({method:g("tools/list")}),x1=v.extend({tools:f(E1)}),h1=D.extend({content:f(a0),structuredContent:n($(),Y0()).optional(),isError:o().optional()}),x0=z.extend({name:$(),arguments:n($(),Y0()).optional()}),Y6=J.extend({method:g("tools/call"),params:x0}),Q5=H.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),u1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),G6=L.extend({level:u1}),B6=J.extend({method:g("logging/setLevel"),params:G6}),F6=K.extend({level:u1,logger:$().optional(),data:Y0()}),L6=H.extend({method:g("notifications/message"),params:F6}),z6=q({name:$().optional()}),J6=q({hints:f(z6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),K6=q({mode:J0(["auto","required","none"]).optional()}),X5=q({type:g("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:f(a0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n($(),Y0()).optional()}),Z6=E5("type",[D1,M1,j1]),U1=E5("type",[D1,M1,j1,W6,X5]),H6=q({role:c,content:a([U1,f(U1)]),_meta:n($(),Y0()).optional()}),$6=z.extend({messages:f(H6),modelPreferences:J6.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(E1).optional(),toolChoice:K6.optional()}),U6=J.extend({method:g("sampling/createMessage"),params:$6}),A6=D.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens"]).or($())),role:c,content:Z6}),N6=D.extend({model:$(),stopReason:Q0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:c,content:a([U1,f(U1)])}),V6=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),w6=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),D6=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),M6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),j6=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),O6=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),E6=a([M6,j6]),I1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),R1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Y5=a([I1,R1]),G5=a([O6,E6,Y5]),i0=a([G5,V6,w6,D6]),n0=z.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),i0),required:f($()).optional()}).catchall(Y0())}),I6=z.extend({mode:g("url"),message:$(),elicitationId:$(),url:$().url()}),Y1=a([n0,I6]),B5=J.extend({method:g("elicitation/create"),params:Y1}),F5=K.extend({elicitationId:$()}),L5=H.extend({method:g("notifications/elicitation/complete"),params:F5}),z5=D.extend({action:J0(["accept","decline","cancel"]),content:C6((h0)=>h0===null?void 0:h0,n($(),a([$(),m(),o(),f($())])).optional())}),J5=q({type:g("ref/resource"),uri:$()}),K5=q({type:g("ref/prompt"),name:$()}),Z5=L.extend({ref:a([K5,J5]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()}),R6=J.extend({method:g("completion/complete"),params:Z5}),H5=D.extend({completion:F0({values:f($()).max(100),total:Q0(m().int()),hasMore:Q0(o())})}),$5=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),Y0()).optional()}),l1=J.extend({method:g("roots/list"),params:L.optional()}),T6=D.extend({roots:f($5)}),U5=H.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),A5=F0({ttl:m().optional(),pollInterval:m().optional()}),N5=J0(["working","input_required","completed","failed","cancelled"]),A1=q({taskId:$(),status:N5,ttl:a([m(),q6()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:Q0(m()),statusMessage:Q0($())}),c0=D.extend({task:A1}),V5=K.merge(A1),T1=H.extend({method:g("notifications/tasks/status"),params:V5}),m1=J.extend({method:g("tasks/get"),params:L.extend({taskId:$()})}),c1=D.merge(A1),p1=J.extend({method:g("tasks/result"),params:L.extend({taskId:$()})}),B4=D.loose(),p0=b.extend({method:g("tasks/list")}),P0=v.extend({tasks:f(A1)}),P1=J.extend({method:g("tasks/cancel"),params:L.extend({taskId:$()})});return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:z,RequestSchema:J,NotificationsParamsSchema:K,NotificationSchema:H,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:Z,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:K0,ProgressSchema:j0,ProgressNotificationParamsSchema:w0,ProgressNotificationSchema:S0,PaginatedRequestParamsSchema:H0,PaginatedRequestSchema:b,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:z0,ResourceTemplateSchema:e,ListResourcesRequestSchema:D0,ListResourcesResultSchema:u0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:L0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:C0,SubscribeRequestSchema:f0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:O0,ResourceUpdatedNotificationParamsSchema:o0,ResourceUpdatedNotificationSchema:k0,PromptArgumentSchema:B1,PromptSchema:X1,ListPromptsRequestSchema:F1,ListPromptsResultSchema:Z1,GetPromptRequestParamsSchema:H1,GetPromptRequestSchema:w1,TextContentSchema:D1,ImageContentSchema:M1,AudioContentSchema:j1,ToolUseContentSchema:W6,EmbeddedResourceSchema:$1,ResourceLinkSchema:Q6,ContentBlockSchema:a0,PromptMessageSchema:y1,GetPromptResultSchema:_1,PromptListChangedNotificationSchema:O1,ToolAnnotationsSchema:X6,ToolExecutionSchema:g1,ToolSchema:E1,ListToolsRequestSchema:f1,ListToolsResultSchema:x1,CallToolResultSchema:h1,CallToolRequestParamsSchema:x0,CallToolRequestSchema:Y6,ToolListChangedNotificationSchema:Q5,LoggingLevelSchema:u1,SetLevelRequestParamsSchema:G6,SetLevelRequestSchema:B6,LoggingMessageNotificationParamsSchema:F6,LoggingMessageNotificationSchema:L6,ModelHintSchema:z6,ModelPreferencesSchema:J6,ToolChoiceSchema:K6,ToolResultContentSchema:X5,SamplingContentSchema:Z6,SamplingMessageContentBlockSchema:U1,SamplingMessageSchema:H6,CreateMessageRequestParamsSchema:$6,CreateMessageRequestSchema:U6,CreateMessageResultSchema:A6,CreateMessageResultWithToolsSchema:N6,BooleanSchemaSchema:V6,StringSchemaSchema:w6,NumberSchemaSchema:D6,UntitledSingleSelectEnumSchemaSchema:M6,TitledSingleSelectEnumSchemaSchema:j6,LegacyTitledEnumSchemaSchema:O6,SingleSelectEnumSchemaSchema:E6,UntitledMultiSelectEnumSchemaSchema:I1,TitledMultiSelectEnumSchemaSchema:R1,MultiSelectEnumSchemaSchema:Y5,EnumSchemaSchema:G5,PrimitiveSchemaDefinitionSchema:i0,ElicitRequestFormParamsSchema:n0,ElicitRequestURLParamsSchema:I6,ElicitRequestParamsSchema:Y1,ElicitRequestSchema:B5,ElicitationCompleteNotificationParamsSchema:F5,ElicitationCompleteNotificationSchema:L5,ElicitResultSchema:z5,ResourceTemplateReferenceSchema:J5,PromptReferenceSchema:K5,CompleteRequestParamsSchema:Z5,CompleteRequestSchema:R6,CompleteResultSchema:H5,RootSchema:$5,ListRootsRequestSchema:l1,ListRootsResultSchema:T6,RootsListChangedNotificationSchema:U5,TaskCreationParamsSchema:A5,TaskStatusSchema:N5,TaskSchema:A1,CreateTaskResultSchema:c0,TaskStatusNotificationParamsSchema:V5,TaskStatusNotificationSchema:T1,GetTaskRequestSchema:m1,GetTaskResultSchema:c1,GetTaskPayloadRequestSchema:p1,GetTaskPayloadResultSchema:B4,ListTasksRequestSchema:p0,ListTasksResultSchema:P0,CancelTaskRequestSchema:P1,CancelTaskResultSchema:D.merge(A1),ClientRequestSchema:a([K0,_,R6,B6,w1,F1,D0,P,t,f0,O0,Y6,f1,m1,p1,p0,P1]),ClientNotificationSchema:a([N,S0,p,U5,T1]),ClientResultSchema:a([A,A6,N6,z5,T6,c1,P0,c0]),ServerRequestSchema:a([K0,U6,B5,l1,m1,p1,p0,P1]),ServerNotificationSchema:a([N,S0,L6,k0,T0,Q5,O1,T1,L5]),ServerResultSchema:a([A,d,H5,_1,Z1,u0,y,L0,h1,x1,c1,P0,c0]),CallToolResultWireSchema:Y0().superRefine((h0,WY)=>{if(typeof h0!=="object"||h0===null||Array.isArray(h0)||h0.content!==void 0)return;for(let XW of cZ)if(XW in h0){WY.addIssue({code:"custom",message:`content is required when the body carries '${XW}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(ZD).pipe(h1)}}function pZ(){return $D??=HD()}function dZ(W){return W.type!=="object"}function ND(W){let Q=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:W},required:["result"]};let X=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>X(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=X(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if(UD.has(F))B[F]=L;else if(AD.has(F))B[F]=X(L,!0);else B[F]=X(L,!1);return B};return{...Q!==void 0&&{$schema:Q},type:"object",properties:{result:X(W,!1)},required:["result"]}}function u7(){if(jX)return jX;let W=pZ();return jX={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},jX}function rZ(W){return Object.prototype.hasOwnProperty.call(iZ,W)}function oZ(W){return Object.prototype.hasOwnProperty.call(nZ,W)}function wD(W){return Object.prototype.hasOwnProperty.call(VD,W)}function DD(W){return wD(W)?u7().resultSchemas[W]:void 0}function MD(W){return rZ(W)?u7().requestSchemas[W]:void 0}function jD(W){return oZ(W)?u7().notificationSchemas[W]:void 0}function y7(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function OX(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function CZ(W){return y7(W)&&y7(W.outputSchema)&&dZ(W.outputSchema)}function kZ(W){return W}function OD(){let W=u5(()=>a([$(),m(),o(),q6(),n($(),W),f(W)])),Q=n($(),W),X=a([$(),m().int()]),Y=$(),G=a([$(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=$().refine((P0)=>{try{return atob(P0),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=q({ttl:m().optional()}),J=q({taskId:$()}),K=F0({progressToken:X.optional(),"io.modelcontextprotocol/related-task":J.optional()}),H=q({_meta:K.optional()}),D=H.extend({task:z.optional()}),I=q({_meta:K.optional()}),A=q({method:$(),params:I.loose().optional()}),M=q({src:$(),mimeType:$().optional(),sizes:f($()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),Z=q({name:$(),title:$().optional()}),V=Z.extend({...Z.shape,...N.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),U=k1(q({applyDefaults:o().optional()}),Q),j=C6((P0)=>{if(P0&&typeof P0==="object"&&!Array.isArray(P0)&&Object.keys(P0).length===0)return{form:{}};return P0},k1(q({form:U.optional(),url:Q.optional()}),Q.optional())),R=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({sampling:F0({createMessage:Q.optional()}).optional(),elicitation:F0({create:Q.optional()}).optional()}).optional()}),O=F0({list:Q.optional(),cancel:Q.optional(),requests:F0({tools:F0({call:Q.optional()}).optional()}).optional()}),w=q({experimental:n($(),Q).optional(),sampling:q({context:Q.optional(),tools:Q.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n($(),Q).optional()}),T=q({experimental:n($(),Q).optional(),logging:Q.optional(),completions:Q.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:O.optional(),extensions:n($(),Q).optional()}),k=q({progress:m(),total:Q0(m()),message:Q0($())}),l=q({...I.shape,...k.shape,progressToken:X}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:$().optional(),data:Y0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:$(),mimeType:Q0($()),_meta:n($(),Y0()).optional()}),K0=p.extend({text:$()}),j0=p.extend({blob:L}),w0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:b1.datetime({offset:!0}).optional()}),S0=q({...Z.shape,...N.shape,uri:$(),description:Q0($()),mimeType:Q0($()),size:Q0(m()),annotations:w0.optional(),_meta:Q0(F0({}))}),H0=q({...Z.shape,...N.shape,uriTemplate:$(),description:Q0($()),mimeType:Q0($()),annotations:w0.optional(),_meta:Q0(F0({}))}),b=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:$()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:$(),description:Q0($()),required:Q0(o())}),S=q({...Z.shape,...N.shape,description:Q0($()),arguments:Q0(f(E)),_meta:Q0(F0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),r=q({type:g("image"),data:L,mimeType:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),z0=q({type:g("audio"),data:L,mimeType:$(),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),e=q({type:g("tool_use"),name:$(),id:$(),input:n($(),Y0()),_meta:n($(),Y0()).optional()}),D0=q({type:g("resource"),resource:a([K0,j0]),annotations:w0.optional(),_meta:n($(),Y0()).optional()}),u0=S0.extend({type:g("resource_link")}),P=a([c,r,z0,u0,D0]),y=q({role:B,content:P}),x=q({title:$().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:$().optional()}),L0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),C0=q({type:g("boolean"),title:$().optional(),description:$().optional(),default:o().optional()}),f0=q({type:g("string"),title:$().optional(),description:$().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:$().optional()}),b0=q({type:J0(["number","integer"]),title:$().optional(),description:$().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),O0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),default:$().optional()}),o0=q({type:g("string"),title:$().optional(),description:$().optional(),oneOf:f(q({const:$(),title:$()})),default:$().optional()}),k0=q({type:g("string"),title:$().optional(),description:$().optional(),enum:f($()),enumNames:f($()).optional(),default:$().optional()}),B1=a([O0,o0]),X1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f($())}),default:f($()).optional()}),F1=q({type:g("array"),title:$().optional(),description:$().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:$(),title:$()}))}),default:f($()).optional()}),Z1=a([X1,F1]),H1=a([k0,B1,Z1]),w1=a([H1,C0,f0,b0]),D1=D.extend({mode:g("form").optional(),message:$(),requestedSchema:q({type:g("object"),properties:n($(),w1),required:f($()).optional()}).catchall(Y0())}),M1=q({type:g("ref/resource"),uri:$()}),j1=q({type:g("ref/prompt"),name:$()}),W6=q({uri:$().startsWith("file://"),name:$().optional(),_meta:n($(),Y0()).optional()}),$1=w.shape,Q6=q({experimental:$1.experimental,sampling:$1.sampling,elicitation:$1.elicitation,roots:$1.roots,extensions:$1.extensions}),a0=T.shape,y1=q({experimental:a0.experimental,logging:a0.logging,completions:a0.completions,prompts:a0.prompts,resources:a0.resources,tools:a0.tools,extensions:a0.extensions}),_1=F0({progressToken:X.optional(),[n1]:$(),[v6]:V.optional(),[q1]:Q6,[r1]:F.optional()}),O1=q({...Z.shape,...N.shape,description:$().optional(),inputSchema:F0({$schema:$().optional(),type:g("object")}),outputSchema:F0({$schema:$().optional()}).optional(),annotations:x.optional(),_meta:n($(),Y0()).optional()}),X6=q({type:g("tool_result"),toolUseId:$(),content:f(P),structuredContent:Y0().optional(),isError:o().optional(),_meta:n($(),Y0()).optional()}),g1=a([c,r,z0,e,X6]),E1=q({role:B,content:a([g1,f(g1)]),_meta:n($(),Y0()).optional()}),f1=$(),x1=F0({[V1]:V.optional().catch(void 0)}),h1=x1.optional();function x0(P0){return F0({_meta:h1,resultType:f1.default("complete"),...P0})}let Y6=x0({}),Q5=x0({nextCursor:Y.optional()}),u1=x0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),G6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(O1),nextCursor:Y.optional()}),B6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),F6=x0({description:$().optional(),messages:f(y)}),L6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),z6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(H0),nextCursor:Y.optional()}),J6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,j0]))}),K6=x0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),X5=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),Z6=x0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:y1,instructions:$().optional()}),U1=q({messages:f(E1),modelPreferences:L0.optional(),systemPrompt:$().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f($()).optional(),metadata:Q.optional(),tools:f(O1).optional(),toolChoice:T0.optional()}),H6=q({method:g("sampling/createMessage"),params:U1}),$6=q({method:g("roots/list"),params:q({_meta:n($(),Y0()).optional()}).optional()}),U6=q({...E1.shape,model:$(),stopReason:$().optional()}),A6=q({roots:f(W6)}),N6=q({action:J0(["accept","decline","cancel"]),content:n($(),a([$(),m(),o(),f($())])).optional()}),V6=q({mode:g("url"),message:$(),url:$().url()}),w6=a([D1,V6]),D6=q({method:g("elicitation/create"),params:w6}),M6=a([H6,$6,D6]),j6=a([U6,A6,N6]),O6=n($(),M6),E6=n($(),j6),I1=x0({inputRequests:O6.optional(),requestState:$().optional()}),R1={inputResponses:E6.optional(),requestState:$().optional()},Y5=q({_meta:_1,...R1}),G5=F0({progressToken:X.optional()});function i0(P0,P1){return q({method:g(P0),params:q({_meta:_1,...P1})})}function n0(P0,P1){return q({method:g(P0),params:q({_meta:G5.optional(),...P1}).optional()})}let I6={name:$(),arguments:n($(),Y0()).optional(),...R1},Y1={cursor:Y.optional()},B5=i0("tools/call",I6),F5=i0("tools/list",Y1),L5=i0("prompts/list",Y1),z5=i0("prompts/get",{name:$(),arguments:n($(),$()).optional(),...R1}),J5=i0("resources/list",Y1),K5=i0("resources/templates/list",Y1),Z5=i0("resources/read",{uri:$(),...R1}),R6={ref:a([j1,M1]),argument:q({name:$(),value:$()}),context:q({arguments:n($(),$()).optional()}).optional()},H5=i0("completion/complete",R6),$5=i0("server/discover",{}),l1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f($()).optional()}),T6={notifications:l1},U5=i0("subscriptions/listen",T6),A5=x1.extend({"io.modelcontextprotocol/subscriptionId":G}),N5=F0({_meta:A5,resultType:f1.default("complete")}),A1={"tools/call":n0("tools/call",I6),"tools/list":n0("tools/list",Y1),"prompts/get":n0("prompts/get",{name:$(),arguments:n($(),$()).optional()}),"prompts/list":n0("prompts/list",Y1),"resources/list":n0("resources/list",Y1),"resources/templates/list":n0("resources/templates/list",Y1),"resources/read":n0("resources/read",{uri:$()}),"completion/complete":n0("completion/complete",R6),"server/discover":n0("server/discover",{}),"subscriptions/listen":n0("subscriptions/listen",T6)};function c0(P0){return F0({_meta:h1,...P0})}let V5={"tools/call":c0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),"tools/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(O1),nextCursor:Y.optional()}),"prompts/get":c0({description:$().optional(),messages:f(y)}),"prompts/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),"resources/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),"resources/templates/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f(H0),nextCursor:Y.optional()}),"resources/read":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,j0]))}),"completion/complete":c0({completion:q({values:f($()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":c0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f($()),capabilities:y1,instructions:$().optional()}),"subscriptions/listen":c0({})},T1=F0({"io.modelcontextprotocol/subscriptionId":G.optional()}),m1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:T1.optional(),notifications:l1})}),c1=q({_meta:T1.optional(),requestId:G,reason:$().optional()}),p1=q({method:g("notifications/cancelled"),params:c1}),B4={"notifications/cancelled":p1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":b,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":m1},p0=(P0)=>q({jsonrpc:g("2.0"),id:a([$(),m().int()]),result:P0}).strict();return{JSONValueSchema:W,JSONObjectSchema:Q,ProgressTokenSchema:X,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:z,RelatedTaskMetadataSchema:J,RequestMetaSchema:K,BaseRequestParamsSchema:H,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:Z,ImplementationSchema:V,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:O,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:T,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:K0,BlobResourceContentsSchema:j0,AnnotationsSchema:w0,ResourceSchema:S0,ResourceTemplateSchema:H0,ResourceListChangedNotificationSchema:b,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:S,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:z0,ToolUseContentSchema:e,EmbeddedResourceSchema:D0,ResourceLinkSchema:u0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:L0,ToolChoiceSchema:T0,BooleanSchemaSchema:C0,StringSchemaSchema:f0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:O0,TitledSingleSelectEnumSchemaSchema:o0,LegacyTitledEnumSchemaSchema:k0,SingleSelectEnumSchemaSchema:B1,UntitledMultiSelectEnumSchemaSchema:X1,TitledMultiSelectEnumSchemaSchema:F1,MultiSelectEnumSchemaSchema:Z1,EnumSchemaSchema:H1,PrimitiveSchemaDefinitionSchema:w1,ElicitRequestFormParamsSchema:D1,ResourceTemplateReferenceSchema:M1,PromptReferenceSchema:j1,RootSchema:W6,ClientCapabilities2026Schema:Q6,ServerCapabilities2026Schema:y1,RequestMetaEnvelopeSchema:_1,ToolSchema:O1,ToolResultContentSchema:X6,SamplingMessageContentBlockSchema:g1,SamplingMessageSchema:E1,ResultTypeSchema:f1,ResultMetaSchema:x1,ResultSchema:Y6,PaginatedResultSchema:Q5,CallToolResultSchema:u1,ListToolsResultSchema:G6,ListPromptsResultSchema:B6,GetPromptResultSchema:F6,ListResourcesResultSchema:L6,ListResourceTemplatesResultSchema:z6,ReadResourceResultSchema:J6,CompleteResultSchema:K6,CacheableResultSchema:X5,DiscoverResultSchema:Z6,CreateMessageRequestParamsSchema:U1,CreateMessageRequestSchema:H6,ListRootsRequestSchema:$6,CreateMessageResultSchema:U6,ListRootsResultSchema:A6,ElicitResultSchema:N6,ElicitRequestURLParamsSchema:V6,ElicitRequestParamsSchema:w6,ElicitRequestSchema:D6,InputRequestSchema:M6,InputResponseSchema:j6,InputRequestsSchema:O6,InputResponsesSchema:E6,InputRequiredResultSchema:I1,InputResponseRequestParamsSchema:Y5,CallToolRequestSchema:B5,ListToolsRequestSchema:F5,ListPromptsRequestSchema:L5,GetPromptRequestSchema:z5,ListResourcesRequestSchema:J5,ListResourceTemplatesRequestSchema:K5,ReadResourceRequestSchema:Z5,CompleteRequestSchema:H5,DiscoverRequestSchema:$5,SubscriptionFilterSchema:l1,SubscriptionsListenRequestSchema:U5,SubscriptionsListenResultMetaSchema:A5,SubscriptionsListenResultSchema:N5,dispatchRequestSchemas:A1,dispatchResultSchemas:V5,NotificationMetaSchema:T1,SubscriptionsAcknowledgedNotificationSchema:m1,CancelledNotificationParamsSchema:c1,CancelledNotificationSchema:p1,notificationSchemas2026:B4,JSONRPCResultResponseSchema:p0(Y6),CallToolResultResponseSchema:p0(a([u1,I1])),ListToolsResultResponseSchema:p0(G6),ListPromptsResultResponseSchema:p0(B6),GetPromptResultResponseSchema:p0(a([F6,I1])),ListResourcesResultResponseSchema:p0(L6),ListResourceTemplatesResultResponseSchema:p0(z6),ReadResourceResultResponseSchema:p0(a([J6,I1])),CompleteResultResponseSchema:p0(K6),DiscoverResultResponseSchema:p0(Z6)}}function v4(){return ED??=OD()}function RD(W){return ID.includes(W)}function TD(W){return W[m7]}function aZ(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function sZ(W){return W==="public"||W==="private"}function qD(W,Q){let X=Q.resultType;if(X===void 0)return{...Q,resultType:"complete"};if(X==="complete")return Q;if(bD.includes(W))return Q;throw new m0(M0.InternalError,`Handler for ${W} returned resultType '${String(X)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function CD(W,Q){let X=TD(Q);if(Q.resultType!=="complete"||!RD(W))return X===void 0?Q:gD(Q);let Y=Q,G=aZ(Y.ttlMs)?Y.ttlMs:yD(X),B=sZ(Y.cacheScope)?Y.cacheScope:_D(X),F={...Y,ttlMs:G,cacheScope:B};return delete F[m7],F}function kD(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function vD(W,Q){if(Q===void 0)return W;let X=W._meta;if(X===void 0)return{...W,_meta:{[V1]:Q}};if(!kD(X))return W;if(X[V1]!==void 0)return W;return{...W,_meta:{...X,[V1]:Q}}}function yD(W){return W!==void 0&&aZ(W.ttlMs)?W.ttlMs:PD}function _D(W){return W!==void 0&&sZ(W.cacheScope)?W.cacheScope:SD}function gD(W){let Q={...W};return delete Q[m7],Q}function QH(){if(EX)return EX;let W=v4();return EX={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:F0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},EX}function XH(W){return fD.includes(W)}function b7(W){return XH(W)?QH().request[W]:void 0}function xD(W){return XH(W)?QH().response[W]:void 0}function GH(W){return Object.prototype.hasOwnProperty.call(c7,W)}function BH(W){return Object.prototype.hasOwnProperty.call(YH,W)}function hD(W){return Object.prototype.hasOwnProperty.call(c7,W)}function uD(W){return GH(W)?v4().dispatchRequestSchemas[W]:void 0}function lD(W){return hD(W)?v4().dispatchResultSchemas[W]:void 0}function mD(W){return BH(W)?v4().notificationSchemas2026[W]:void 0}function QQ(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function eW(W,Q){if(W===void 0)return{ok:!1,reason:"not-in-era"};let X=W.safeParse(Q);return X.success?{ok:!0,value:X.data}:{ok:!1,reason:"invalid",message:String(X.error)}}function dD(W,Q){let X=Q,Y=!1,G=()=>{if(!Y)X={...X},Y=!0;return X},B=Q.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>QQ(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!QQ(L)||!("execution"in L))return L;let z={...L};return delete z.execution,z});let F=Q.capabilities;if(QQ(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return X}function iD(){if(IX)return IX;let W=v4();return IX={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},IX}function v5(W){return W!==void 0&&G4(W)?p7:l7}function vZ(W){if(W.revision!==void 0)return v5(W.revision).era;return W.era==="modern"?p7.era:l7.era}function q7(W){return FH.some((Q)=>Q.hasRequestMethod(W))}function C7(W){return FH.some((Q)=>Q.hasNotificationMethod(W))}function i7(W){let Q=[],X=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let z=B;if(yZ in z){if(!L||F.length===0)return`${RX(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=z[yZ];if(typeof K!=="string"||K.length===0)return`${RX(F)}: x-mcp-header MUST be a non-empty string`;if(!oD.test(K))return`${RX(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let H=typeof z.type==="string"?z.type:void 0;if(H===void 0||!aD.has(H))return`${RX(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${H??"<none>"}`;let D=K.toLowerCase(),I=X.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;X.set(D,K),Q.push({path:F,headerName:K,type:H})}let J=z.properties;if(J!==null&&typeof J==="object")for(let[K,H]of Object.entries(J)){let D=Y(H,[...F,K],L);if(D!==void 0)return D}for(let K of sD){let H=z[K];if(H===void 0)continue;let D=Array.isArray(H)?H:H!==null&&typeof H==="object"&&tD.has(K)?Object.values(H):[H];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:Q}:{valid:!1,reason:G}}function RX(W){return W.length===0?"<root>":W.join(".")}function eD(W){if(typeof W==="string")return W;if(typeof W==="boolean")return W?"true":"false";if(typeof W==="number"){if(!Number.isFinite(W))return;if(Number.isInteger(W)&&!Number.isSafeInteger(W))return;return String(W)}}function WM(W){if(W.length===0)return!0;if(W.startsWith(JH)&&W.endsWith(KH))return!0;if(W!==W.trim())return!0;for(let Q=0;Q<W.length;Q++){let X=W.codePointAt(Q);if(X===9||X>=32&&X<=126)continue;return!0}return!1}function QM(W){let Q=new TextEncoder().encode(W),X="";for(let Y of Q)X+=String.fromCodePoint(Y);return btoa(X)}function ZH(W){return WM(W)?`${JH}${QM(W)}${KH}`:W}function XM(W,Q){let X=W;for(let Y of Q){if(X===null||typeof X!=="object")return;X=X[Y]}return X}function HH(W,Q){let X={};for(let Y of W){let G=XM(Q,Y.path);if(G===void 0||G===null)continue;let B=eD(G);if(B===void 0)continue;X[`${rD}${Y.headerName}`]=ZH(B)}return X}function qX(W,Q){return d4(W,Q)}function WQ(W){return new Set(W.flatMap((Q)=>Object.keys(Q.shape)))}function _7(W){if(W==null)return!1;let Q=typeof W;if(Q!=="object"&&Q!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function YM(W,Q="input"){let X=W["~standard"],Y;if(X.jsonSchema)Y=X.jsonSchema[Q]({target:g7});else if(X.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!_Z)_Z=!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.");Y=Z4(W,{target:g7,io:Q})}else throw Error(`Schema library "${X.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(Q==="output"){if(Y.type!==void 0)return Y;return $H(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function $H(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let Q of["oneOf","anyOf","allOf"]){let X=W[Q];if(Array.isArray(X)&&X.length>0)return X.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||$H(Y)))}return!1}function GM(W){if(!W.path?.length)return W.message;return`${W.path.map((Q)=>String(typeof Q==="object"?Q.key:Q)).join(".")}: ${W.message}`}async function k7(W,Q){let X=await W["~standard"].validate(Q);if(X.issues&&X.issues.length>0)return{success:!1,error:X.issues.map((Y)=>GM(Y)).join(", ")};return{success:!0,data:X.value}}function BM(W){let Q=Z4(W,{target:g7,io:"input"});return typeof Q.pattern==="string"?Q.pattern:void 0}function LM(W){let Q=FM.exec(W),X=[void 0,-1,0];if(Q)X.push(Number(Q[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>X.map((B)=>b1.datetime({local:Y,offset:G,precision:B}))))}function zM(W,Q){let X;switch(W){case"email":X=[mQ()];break;case"uri":X=[i4()];break;case"date":X=[b1.date()];break;case"date-time":X=LM(Q);break}return new Set(X.map((Y)=>BM(Y)).filter((Y)=>Y!==void 0))}function JM(W,Q,X){if(X!=="zod")return!0;return zM(W,Q).has(Q)}function GQ(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function KM(W){try{return YM(W,"input")}catch(Q){let X=Q instanceof Error?Q.message:String(Q);throw new m0(M0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${X}`)}}function n7(W){return ZM.has(W)||W.startsWith("x-")}function UM(W,Q,X,Y){if(!GQ(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(gZ,W.type)?gZ[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||n7(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!$M.has(W.format))B[F]=L;else if(typeof L!=="string"||!JM(W.format,L,X))Y.push(`${Q}.${F}`)}else Y.push(`${Q}.${F}`);return B}function AM(W,Q){let X={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&GQ(B))X[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,UM(L,`properties.${F}`,Q,Y)]));else if(HM.has(G))X[G]=B;else if(!n7(G))Y.push(G);if(Y.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return X}function NM(W,Q){if(!GQ(W.properties))return Q;let X=Object.entries(W.properties).filter(([,Y])=>!qX(X4,Y).success).map(([Y])=>`properties.${Y}`);return X.length>0?X.join(", "):Q}function f7(W,Q,X=""){if(Array.isArray(W)&&Array.isArray(Q))return W.flatMap((Y,G)=>f7(Y,Q[G],`${X}[${G}]`));if(!GQ(W)||!GQ(Q))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=X?`${X}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(Q,Y))return n7(Y)?[]:[B];return f7(G,Q[Y],B)})}function VM(W){if(!_7(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let Q=W.requestedSchema["~standard"].vendor,X=AM(KM(W.requestedSchema),Q),Y=qX(s6.shape.requestedSchema,X);if(!Y.success)throw new m0(M0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${NM(X,Y.error.message)}`);let G=f7(X,Y.data);if(G.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function wM(W){let Q=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,X=typeof W.requestState==="string";if(!Q&&!X)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function UH(W){return{autoFulfill:W?.autoFulfill??DM,maxRounds:W?.maxRounds??MM}}function OM(W,Q,X){let Y=Q!==void 0&&Object.keys(Q).length>0;if(!Y&&X===void 0)return W;return{...W,...Y&&{inputResponses:Q},...X!==void 0&&{requestState:X}}}function EM(W,Q){return`Multi-round-trip request '${W}' still required input after ${Q} rounds (inputRequired.maxRounds)`}function IM(W,Q){return new Promise((X,Y)=>{if(Q?.aborted){Y(Q.reason instanceof U0?Q.reason:new U0(A0.RequestTimeout,String(Q.reason)));return}let G=setTimeout(()=>{Q?.removeEventListener("abort",B),X()},W),B=()=>{clearTimeout(G),Y(Q?.reason instanceof U0?Q.reason:new U0(A0.RequestTimeout,String(Q?.reason)))};Q?.addEventListener("abort",B,{once:!0})})}function RM(W){let Q=new AbortController,X=()=>Q.abort(W?.reason);if(W?.addEventListener("abort",X,{once:!0}),W?.aborted)Q.abort(W.reason);return{signal:Q.signal,abort:(Y)=>Q.abort(Y),dispose:()=>W?.removeEventListener("abort",X)}}async function TM(W){let{config:Q,method:X,originalParams:Y,requestOptions:G,hooks:B,signal:F}=W,L=W.flowStartedAt??Date.now(),z=W.firstPayload,J=0;while(!0){if(J+=1,J>Q.maxRounds)throw new U0(A0.InputRequiredRoundsExceeded,EM(X,Q.maxRounds),{rounds:Q.maxRounds,lastResult:{inputRequests:z.inputRequests,...z.requestState!==void 0&&{requestState:z.requestState}}});G.onprogress?.({progress:J,message:`Fulfilling input required by '${X}' (round ${J})`});let K=Object.entries(z.inputRequests??{}),H;if(K.length>0){let A=RM(F);try{let M=await Promise.all(K.map(async([N,Z])=>{try{return[N,await B.dispatchInputRequest(N,Z,A.signal)]}catch(V){throw A.abort(V),V}}));H=Object.fromEntries(M)}finally{A.dispose()}}else await IM(jM,F);let D={...G.timeout!==void 0&&{timeout:G.timeout}};if(G.maxTotalTimeout!==void 0){let A=Date.now()-L,M=G.maxTotalTimeout-A;if(M<=0)throw new U0(A0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:G.maxTotalTimeout,totalElapsed:A});D.maxTotalTimeout=M}let I=await B.retry(OM(Y,H,z.requestState),D);if(zH(I)){z={inputRequests:I.inputRequests??{},...I.requestState!==void 0&&{requestState:I.requestState}};continue}return I}}function VH(W,Q){let X=W.slice(0,-6);AH[X]=Q,NH[X]=(Y)=>Q.safeParse(Y).success}function qM(W){switch(W){case"initialize":case"notifications/initialized":return v5(void 0);case"server/discover":return v5(SX);default:return}}function fZ(W,Q){let X=W.params;if(!XQ(X))return{message:W,lifted:{}};let Y=X._meta,G=XQ(Y)?CM.filter((z)=>(z in Y)):[],B=Q==="request"?kM.filter((z)=>(z in X)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...X};if(G.length>0&&XQ(Y)){let z={},J={...Y};for(let K of G)z[K]=Y[K],delete J[K];if(F.envelope=z,Object.keys(J).length>0)L._meta=J;else delete L._meta}for(let z of B){if(z==="inputResponses")F.inputResponses=L[z];if(z==="requestState")F.requestState=L[z];delete L[z]}return{message:{...W,params:L},lifted:F}}function xZ(W,Q){let X=W.validateResult(Q,void 0);if(!X.ok&&X.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(Q,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${Q}`}]}}}}}function r7(W){return()=>W}function XQ(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function MH(W,Q){let X={...W};for(let Y in Q){let G=Y,B=Q[G];if(B===void 0)continue;let F=X[G];X[G]=XQ(F)&&XQ(B)?{...F,...B}:B}return X}function TX(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function _M(W){let Q={},X=[];if(!TX(W))return{accepted:Q,droppedKeys:X};for(let[Y,G]of Object.entries(W)){if(!TX(G)||"method"in G||"result"in G){X.push(Y);continue}Q[Y]=G}return{accepted:Q,droppedKeys:X}}function hZ(W){throw new U0(A0.SendFailed,`ctx.mcpReq.${W} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function gM(W,Q,X,Y,G){return{sessionId:G,mcpReq:{id:W,method:Q,_meta:X?._meta,requestState:r7(void 0),signal:Y,send:()=>hZ("send"),notify:()=>hZ("notify")}}}async function fM(W,Q,X,Y,G){if(!TX(Y)||typeof Y.method!=="string")throw new U0(A0.InvalidResult,`Invalid input request '${X}': each inputRequests entry must be an embedded request object with a method`,{key:X});let B=Y.method;if(!Q.hasInputRequestMethod(B))throw new U0(A0.InvalidResult,`Invalid input request '${X}': '${B}' is not an embedded request the ${Q.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:X,method:B});let F=W.getRequestHandler(B);if(F===void 0)throw new U0(A0.CapabilityNotSupported,`Cannot fulfil input request '${X}': no handler is registered for '${B}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:X,method:B});let L=TX(Y.params)?Y.params:void 0;return await F({jsonrpc:"2.0",id:X,method:B,...L!==void 0&&{params:L}},W.buildContext(gM(X,B,L,G,W.sessionId)))}function xM(W,Q){return{...W?.signal!==void 0&&{signal:W.signal},...W?.onprogress!==void 0&&{onprogress:W.onprogress},...W?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:W.resetTimeoutOnProgress},...W?.headers!==void 0&&{headers:W.headers},...Q.timeout!==void 0&&{timeout:Q.timeout},...Q.maxTotalTimeout!==void 0&&{maxTotalTimeout:Q.maxTotalTimeout},allowInputRequired:!0}}function jH(W,Q,X,Y){let{codec:G,request:B,options:F,flowStartedAt:L}=Y,z={inputRequests:X.inputRequests,...X.requestState!==void 0&&{requestState:X.requestState}},J={dispatchInputRequest:(K,H,D)=>fM(W,G,K,H,D),retry:(K,H)=>Y.retry(K,xM(F,H))};return TM({config:Q,method:B.method,originalParams:B.params,firstPayload:z,flowStartedAt:L,signal:F?.signal,requestOptions:{...F?.timeout!==void 0&&{timeout:F.timeout},...F?.maxTotalTimeout!==void 0&&{maxTotalTimeout:F.maxTotalTimeout},...F?.onprogress!==void 0&&{onprogress:F.onprogress}},hooks:J})}function hM(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function EH(W){return q5.parse(JSON.parse(W))}function a7(W){return JSON.stringify(W)+`
99
- `}var v7,KD,A0,U0,uZ,lZ="2026-07-28",x7,cZ,$D,UD,AD,iZ,nZ,VD,jX,SS,bS,qZ,l7,ED,ID,m7,M0,m0,tZ,eZ,PX,WH,PD=0,SD="private",bD,fD,EX,c7,YH,qS,CS,cD,pD,p7,IX,SX="2026-07-28",FH,nD,d7=(W)=>m5.safeParse(W).success,LH=(W)=>c5.safeParse(W).success,YQ=(W)=>S5.safeParse(W).success,bX=(W)=>b5.safeParse(W).success,zH=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",rD="Mcp-Param-",yZ="x-mcp-header",oD,aD,sD,tD,JH="=?base64?",KH="?=",c9=-32020,kS,vS,_Z=!1,g7="draft-2020-12",FM,ZM,HM,gZ,$M,yS,DM=!0,MM=10,jM=250,PM,SM,AH,NH,bM,wH,CX=60000,CM,kM,vM,yM,DH,uM,_S,OH=10485760,o7=class{_buffer;_maxBufferSize;constructor(W){this._maxBufferSize=W?.maxBufferSize??OH}append(W){if((this._buffer?.length??0)+W.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){while(this._buffer){let W=this._buffer.indexOf(`
100
- `);if(W===-1)return null;let Q=this._buffer.toString("utf8",0,W).replace(/\r$/,"");this._buffer=this._buffer.subarray(W+1);try{return EH(Q)}catch(X){if(X instanceof SyntaxError)continue;throw X}}return null}clear(){this._buffer=void 0}};var s7=$0(()=>{S7();cG();n4();v7=Symbol.for("mcp.sdk.errorBrands");KD=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Q){return o1(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.errorUri=Y,this.name="OAuthError",y4(this,new.target)}toResponseObject(){let Q={error:this.code,error_description:this.message};if(this.errorUri)Q.error_uri=this.errorUri;return Q}static fromResponse(Q){return new W(Q.error,Q.error_description??Q.error,Q.error_uri)}},A0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),U0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return o1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,W)}constructor(W,Q,X){super(Q);this.code=W,this.data=X,this.name="SdkError",y4(this,new.target)}},uZ=class extends U0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,Q,X){super(W,Q,X);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}},x7=[lZ];cZ=["task","inputRequests","requestState"];UD=new Set(["const","enum","default","examples"]),AD=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);iZ={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},nZ={"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},VD={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};SS=Object.keys(iZ),bS=Object.keys(nZ);qZ={ok:!1,reason:"not-in-era"};l7={era:"2025-11-25",hasRequestMethod:rZ,hasNotificationMethod:oZ,validateRequest:(W,Q)=>OX(MD(W),Q),validateResult:(W,Q)=>OX(DD(W),Q),validateNotification:(W,Q)=>OX(jD(W),Q),hasInputRequestMethod:()=>!1,validateInputRequest:()=>qZ,validateInputResponse:()=>qZ,samplingResultVariant:(W,Q)=>{let X=pZ();return OX(W?X.CreateMessageResultWithToolsSchema:X.CreateMessageResultSchema,Q)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,Q){let X=mZ(W),Y=X.structuredContent;if(Y===void 0)return X;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=Q!==void 0&&dZ(Q);if(!G&&!B)return X;return{...X,structuredContent:{result:Y}}},decodeResult(W,Q){if(y7(Q)&&"resultType"in Q){let X={...Q};return delete X.resultType,{kind:"complete",result:kZ(X)}}return{kind:"complete",result:kZ(Q)}},encodeResult(W,Q){if(W!=="tools/list")return Q;let X=Q.tools;if(!Array.isArray(X)||!X.some((Y)=>CZ(Y)))return Q;return{...Q,tools:X.map((Y)=>CZ(Y)?{...Y,outputSchema:ND(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};ID=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];m7=Symbol("modelcontextprotocol.resultCacheHintFallback");M0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),m0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](Q){return o1(this,Q)}static isInstance(Q){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,Q)}constructor(Q,X,Y){super(X);this.code=Q,this.data=Y,this.name="ProtocolError",y4(this,new.target)}static fromError(Q,X,Y){if(Q===M0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new eZ(G.elicitations,X)}if(Q===M0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new PX({supported:G.supported,requested:G.requested},X)}if(Q===M0.InvalidParams||Q===M0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(Q===M0.ResourceNotFound||Object.keys(G).length===1))return new tZ(G.uri,X)}if(Q===M0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new WH({requiredCapabilities:G.requiredCapabilities},X)}return new W(Q,X,Y)}},tZ=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,Q=`Resource not found: ${W}`){super(M0.InvalidParams,Q,{uri:W})}get uri(){return this.data.uri}},eZ=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,Q=`URL elicitation${W.length>1?"s":""} required`){super(M0.UrlElicitationRequired,Q,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},PX=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,Q=`Unsupported protocol version: ${W.requested}`){super(M0.UnsupportedProtocolVersion,Q,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},WH=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,Q=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(M0.MissingRequiredClientCapability,Q,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},bD=["tools/call","prompts/get","resources/read"];fD=["elicitation/create","sampling/createMessage","roots/list"];c7={"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},YH={"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};qS=Object.keys(c7),CS=Object.keys(YH);cD={ok:!1,reason:"not-in-era"},pD=[n1,q1];p7={era:"2026-07-28",hasRequestMethod:GH,hasNotificationMethod:BH,hasInputRequestMethod:(W)=>b7(W)!==void 0,validateRequest:(W,Q)=>eW(uD(W),Q),validateResult:(W,Q)=>eW(lD(W),Q),validateNotification:(W,Q)=>eW(mD(W),Q),validateInputRequest:(W,Q)=>eW(b7(W),Q),validateInputResponse:(W,Q)=>eW(xD(W),Q),samplingResultVariant:()=>cD,outboundEnvelope(W){return{[n1]:W.protocolVersion,[v6]:W.clientInfo,[q1]:W.clientCapabilities,...W.logLevel!==void 0&&{[r1]:W.logLevel}}},validateEnvelopeMeta(W){let Q=[];for(let Y of pD)if(!(Y in W))Q.push({key:Y,problem:"missing"});let X=v4().RequestMetaEnvelopeSchema.safeParse(W);if(!X.success)for(let Y of X.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&Q.some((F)=>F.key===B&&F.problem==="missing"))continue;Q.push({key:B,problem:Y.message})}return Q},projectCallToolResult:(W)=>mZ(W),inputRequestSchema:b7,decodeResult(W,Q){if(!QQ(Q))return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let X=Q.resultType;if(X===void 0)return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: 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:W,violation:"missing-resultType"})};if(typeof X!=="string")return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:X})};if(X==="input_required"){let F=Q.inputRequests,L=QQ(F)?F:{},z=Q.requestState;if(Object.keys(L).length===0&&typeof z!=="string")return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof z==="string"&&{requestState:z}}}if(X!=="complete")return{kind:"invalid",error:new U0(A0.UnsupportedResultType,`Unsupported result type '${X}' for ${W}`,{resultType:X,method:W})};let Y=iD(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(Q);if(!F.success)return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...Q};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,Q,X){return vD(CD(W,qD(W,dD(W,Q))),X)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let Q=v4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!Q.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${Q.error.issues.map((X)=>X.message).join("; ")}`}};FH=[l7,p7],nD=bZ({AnnotationsSchema:()=>y6,AudioContentSchema:()=>r5,BaseMetadataSchema:()=>k6,BaseRequestParamsSchema:()=>G1,BlobResourceContentsSchema:()=>I4,BooleanSchemaSchema:()=>a5,CallToolRequestParamsSchema:()=>n8,CallToolRequestSchema:()=>r8,CallToolResultSchema:()=>S4,CancelTaskRequestSchema:()=>vW,CancelTaskResultSchema:()=>yW,CancelledNotificationParamsSchema:()=>s4,CancelledNotificationSchema:()=>w4,ClientCapabilitiesSchema:()=>Q8,ClientNotificationSchema:()=>gW,ClientRequestSchema:()=>_W,ClientResultSchema:()=>fW,ClientTasksCapabilitySchema:()=>e4,CompatibilityCallToolResultSchema:()=>EW,CompleteRequestParamsSchema:()=>j9,CompleteRequestSchema:()=>O9,CompleteResultSchema:()=>E9,ContentBlockSchema:()=>o5,CreateMessageRequestParamsSchema:()=>F9,CreateMessageRequestSchema:()=>L9,CreateMessageResultSchema:()=>z9,CreateMessageResultWithToolsSchema:()=>J9,CreateTaskResultSchema:()=>RW,CursorSchema:()=>U4,DiscoverRequestSchema:()=>F8,DiscoverResultSchema:()=>C5,ElicitRequestFormParamsSchema:()=>s6,ElicitRequestParamsSchema:()=>U9,ElicitRequestSchema:()=>A9,ElicitRequestURLParamsSchema:()=>$9,ElicitResultSchema:()=>w9,ElicitationCompleteNotificationParamsSchema:()=>N9,ElicitationCompleteNotificationSchema:()=>V9,EmbeddedResourceSchema:()=>x8,EmptyResultSchema:()=>V4,EnumSchemaSchema:()=>H9,GetPromptRequestParamsSchema:()=>_8,GetPromptRequestSchema:()=>g8,GetPromptResultSchema:()=>l8,GetTaskPayloadRequestSchema:()=>bW,GetTaskPayloadResultSchema:()=>qW,GetTaskRequestSchema:()=>PW,GetTaskResultSchema:()=>SW,IconSchema:()=>t4,IconsSchema:()=>p6,ImageContentSchema:()=>n5,ImplementationSchema:()=>p5,InitializeRequestParamsSchema:()=>X8,InitializeRequestSchema:()=>Y8,InitializeResultSchema:()=>G8,InitializedNotificationSchema:()=>B8,JSONArraySchema:()=>jW,JSONObjectSchema:()=>e0,JSONRPCErrorResponseSchema:()=>b5,JSONRPCMessageSchema:()=>q5,JSONRPCNotificationSchema:()=>c5,JSONRPCRequestSchema:()=>m5,JSONRPCResponseSchema:()=>OW,JSONRPCResultResponseSchema:()=>S5,JSONValueSchema:()=>m6,LegacyTitledEnumSchemaSchema:()=>e5,ListChangedOptionsBaseSchema:()=>b4,ListPromptsRequestSchema:()=>v8,ListPromptsResultSchema:()=>y8,ListResourceTemplatesRequestSchema:()=>$8,ListResourceTemplatesResultSchema:()=>U8,ListResourcesRequestSchema:()=>Z8,ListResourcesResultSchema:()=>H8,ListRootsRequestSchema:()=>R9,ListRootsResultSchema:()=>T9,ListTasksRequestSchema:()=>CW,ListTasksResultSchema:()=>kW,ListToolsRequestSchema:()=>d8,ListToolsResultSchema:()=>i8,LoggingLevelSchema:()=>r6,LoggingMessageNotificationParamsSchema:()=>t8,LoggingMessageNotificationSchema:()=>e8,ModelHintSchema:()=>W9,ModelPreferencesSchema:()=>Q9,MultiSelectEnumSchemaSchema:()=>Z9,NotificationSchema:()=>K1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>a6,PaginatedRequestParamsSchema:()=>J8,PaginatedRequestSchema:()=>d6,PaginatedResultSchema:()=>i6,PingRequestSchema:()=>M4,PrimitiveSchemaDefinitionSchema:()=>X4,ProgressNotificationParamsSchema:()=>z8,ProgressNotificationSchema:()=>j4,ProgressSchema:()=>L8,ProgressTokenSchema:()=>$4,PromptArgumentSchema:()=>C8,PromptListChangedNotificationSchema:()=>m8,PromptMessageSchema:()=>u8,PromptReferenceSchema:()=>M9,PromptSchema:()=>k8,ReadResourceRequestParamsSchema:()=>A8,ReadResourceRequestSchema:()=>N8,ReadResourceResultSchema:()=>V8,RelatedTaskMetadataSchema:()=>a4,RequestIdSchema:()=>c6,RequestMetaSchema:()=>A4,RequestSchema:()=>W1,ResourceContentsSchema:()=>O4,ResourceLinkSchema:()=>h8,ResourceListChangedNotificationSchema:()=>w8,ResourceRequestParamsSchema:()=>d5,ResourceSchema:()=>R4,ResourceTemplateReferenceSchema:()=>D9,ResourceTemplateSchema:()=>K8,ResourceUpdatedNotificationParamsSchema:()=>b8,ResourceUpdatedNotificationSchema:()=>q8,ResultMetaObjectSchema:()=>N4,ResultSchema:()=>Q1,RoleSchema:()=>n6,RootSchema:()=>I9,RootsListChangedNotificationSchema:()=>P9,SamplingContentSchema:()=>G9,SamplingMessageContentBlockSchema:()=>I5,SamplingMessageSchema:()=>B9,ServerCapabilitiesSchema:()=>D4,ServerNotificationSchema:()=>hW,ServerRequestSchema:()=>xW,ServerResultSchema:()=>uW,ServerTasksCapabilitySchema:()=>W8,SetLevelRequestParamsSchema:()=>a8,SetLevelRequestSchema:()=>s8,SingleSelectEnumSchemaSchema:()=>K9,StringSchemaSchema:()=>o6,SubscribeRequestParamsSchema:()=>D8,SubscribeRequestSchema:()=>M8,SubscriptionFilterSchema:()=>T4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>R8,SubscriptionsAcknowledgedNotificationSchema:()=>T8,SubscriptionsListenRequestParamsSchema:()=>E8,SubscriptionsListenRequestSchema:()=>I8,SubscriptionsListenResultMetaSchema:()=>P8,SubscriptionsListenResultSchema:()=>S8,TaskAugmentedRequestParamsSchema:()=>P5,TaskCreationParamsSchema:()=>IW,TaskMetadataSchema:()=>o4,TaskSchema:()=>t6,TaskStatusNotificationParamsSchema:()=>b9,TaskStatusNotificationSchema:()=>TW,TaskStatusSchema:()=>S9,TextContentSchema:()=>i5,TextResourceContentsSchema:()=>E4,TitledMultiSelectEnumSchemaSchema:()=>Q4,TitledSingleSelectEnumSchemaSchema:()=>t5,ToolAnnotationsSchema:()=>c8,ToolChoiceSchema:()=>X9,ToolExecutionSchema:()=>p8,ToolListChangedNotificationSchema:()=>o8,ToolResultContentSchema:()=>Y9,ToolSchema:()=>P4,ToolUseContentSchema:()=>f8,UnsubscribeRequestParamsSchema:()=>j8,UnsubscribeRequestSchema:()=>O8,UntitledMultiSelectEnumSchemaSchema:()=>W4,UntitledSingleSelectEnumSchemaSchema:()=>s5}),oD=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,aD=new Set(["string","integer","boolean","number"]);sD=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],tD=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);kS=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],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:[M0.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:[c9,M0.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:[M0.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:[M0.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:[M0.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:[c9],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:[M0.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:[c9],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."}],vS={[M0.ParseError]:400,[M0.InvalidRequest]:400,[M0.MethodNotFound]:404,[M0.UnsupportedProtocolVersion]:400,[M0.MissingRequiredClientCapability]:400,[c9]:400};FM=/\\\.\\d\{(\d+)\}/;ZM=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);HM=new Set(["$schema",...Object.keys(s6.shape.requestedSchema.shape)]),gZ={string:WQ([o6,s5,t5,e5]),number:WQ([a6]),integer:WQ([a6]),boolean:WQ([a5]),array:WQ([W4,Q4])},$M=new Set(o6.shape.format.unwrap().options);yS=Object.assign(wM,{elicit(W){try{return{method:"elicitation/create",params:VM(W)}}catch(Q){throw Q instanceof m0?TypeError(Q.message,{cause:Q}):Q}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});PM=["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"],SM={IdJagTokenExchangeResponseSchema:y9,OAuthClientInformationFullSchema:x9,OAuthClientInformationSchema:f9,OAuthClientMetadataSchema:g9,OAuthClientRegistrationErrorSchema:lW,OAuthErrorResponseSchema:_9,OAuthMetadataSchema:q4,OAuthProtectedResourceMetadataSchema:q9,OAuthTokenRevocationRequestSchema:mW,OAuthTokensSchema:v9,OpenIdProviderDiscoveryMetadataSchema:k9,OpenIdProviderMetadataSchema:C9},AH={},NH={};for(let W of PM)VH(W,nD[W]);for(let[W,Q]of Object.entries(SM))VH(W,Q);bM=Object.freeze(AH),wH=Object.freeze(NH);CM=[n1,v6,q1,r1],kM=["inputResponses","requestState"];vM=r7(void 0),DH=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{yM=(W,Q)=>{W._negotiatedProtocolVersion=Q}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??H4,this.setNotificationHandler("notifications/cancelled",(Q)=>{this._oncancel(Q)}),this.setNotificationHandler("notifications/progress",(Q)=>{this._onprogress(Q)}),this.setRequestHandler("ping",(Q)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let Q=this._outboundMetaEnvelope();if(Q===void 0)return W;let X=W.params??{};return{...W,params:{...X,_meta:{...Q,...X._meta}}}}_resolveNonCompleteResult(W,Q){return Promise.reject(new U0(A0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${Q.request.method}`,{resultType:W.kind,method:Q.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,Q,X,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let Q=this._timeoutInfo.get(W);if(!Q)return!1;let X=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&X>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(W),new U0(A0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:X});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(W){let Q=this._timeoutInfo.get(W);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let Q=this.transport?.onclose;this._transport.onclose=()=>{try{Q?.()}finally{this._onclose()}};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),YQ(G)||bX(G))this._onresponse(G);else if(d7(G))this._onrequest(G,B);else if(LH(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let Q=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let X=new U0(A0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(X);for(let Y of Q.values())Y.abort(X)}}_onerror(W){this.onerror?.(W)}_onnotification(W,Q){let{message:X}=fZ(W,"notification"),Y=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(Q?.classification!==void 0){let F=vZ(Q.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${X.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(C7(X.method)&&!Y.hasNotificationMethod(X.method))return;let G=this._notificationHandlers.get(X.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(X):G(X,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,Q){let{message:X,lifted:Y}=fZ(W,"request"),G=this._negotiatedWireCodec();if(Q?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,Z)=>{let V={jsonrpc:"2.0",id:X.id,error:{code:M,message:N,...Z!==void 0&&{data:Z}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(Q?.classification!==void 0){let M=vZ(Q.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${X.method}': classified as ${M} but this instance serves ${G.era}`));let N=Q.classification.revision??M;F(M0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(q7(X.method)&&!G.hasRequestMethod(X.method)){F(M0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(X.method)??this.fallbackRequestHandler;if(L===void 0){F(M0.MethodNotFound,"Method not found");return}let z=G.checkInboundEnvelope(Y);if(z!==void 0){F(M0.InvalidParams,z);return}let J=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:X.id}),K=(M,N,Z)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...Z,relatedRequestId:X.id}),H=new AbortController;this._requestHandlerAbortControllers.set(X.id,H);let D=Y.inputResponses===void 0?void 0:_M(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:X.id,method:X.method,_meta:X.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?vM:r7(Y.requestState),signal:H.signal,send:(M,N,Z)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),_7(N))return K(M,N,Z);let U=xZ(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:J},http:Q?.authInfo?{authInfo:Q.authInfo}:void 0},A=this.buildContext(I,Q);Promise.resolve().then(()=>L(X,A)).then(async(M)=>{if(H.signal.aborted)return;let N;try{N=G.encodeResult(X.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${X.method}: ${V}`)),F(M0.InternalError,"Internal error");return}let Z={result:N,jsonrpc:"2.0",id:X.id};await B?.send(Z)},async(M)=>{if(H.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:M0.InternalError,Z={jsonrpc:"2.0",id:X.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send(Z)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(X.id)===H)this._requestHandlerAbortControllers.delete(X.id)})}_onprogress(W){let{progressToken:Q,...X}=W.params,Y=Number(Q),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(X)}_onresponse(W){let Q=Number(W.id),X=this._responseHandlers.get(Q);if(X===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(Q),this._cleanupTimeout(Q),this._progressHandlers.delete(Q),YQ(W))X(W);else X(m0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,Q,X){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),_7(Q))return this._requestWithSchemaViaCodec(Y,W,Q,X);let G=xZ(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,Q)}_negotiatedWireCodec(){return v5(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let Q=qM(W);if(Q)return Q}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,Q){if(q7(Q)&&!W.hasRequestMethod(Q))throw new U0(A0.MethodNotSupportedByProtocolVersion,`Method '${Q}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q,era:W.era})}_requestWithSchema(W,Q,X){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,Q,X)}_requestWithSchemaViaCodec(W,Q,X,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},z=Date.now(),J,K;return new Promise((H,D)=>{let I=(O)=>{D(O)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(Q.method)}catch(O){I(O);return}if(Y?.signal?.aborted){let O=Y.signal.reason;throw O instanceof U0?O:new U0(A0.RequestTimeout,String(O))}let A=W.era===SX&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...Q,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...Q.params,_meta:{...Q.params?._meta,progressToken:M}};let Z=this._envelopeOutbound(N),V=!1,U=(O)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(O)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(O instanceof U0?O:new U0(A0.RequestTimeout,String(O)))};this._responseHandlers.set(M,(O)=>{if(Y?.signal?.aborted)return;if(V=!0,O instanceof Error)return D(O);let w;try{w=W.decodeResult(Q.method,O.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return H(hM(w));let k={codec:W,request:Q,resultSchema:X,options:Y,flowStartedAt:z,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:Q.method}:{method:Q.method,params:l},X,_)};return H(this._resolveNonCompleteResult(w,k))}let T=w.result;k7(X,T).then((k)=>{if(k.success)H(k.data);else D(new U0(A0.InvalidResult,`Invalid result for ${Q.method}: ${k.error}`))},D)}),J=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",J,{once:!0});let j=Y?.timeout??CX,R=()=>U(new U0(A0.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout(M,j,Y?.maxTotalTimeout,R,Y?.resetTimeoutOnProgress??!1),this._transport.send(Z,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((O)=>{this._progressHandlers.delete(M),D(O)})}).finally(()=>{if(J)Y?.signal?.removeEventListener("abort",J);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,Q){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,Q)}async _notificationViaCodec(W,Q,X){if(!this._transport)throw new U0(A0.NotConnected,"Not connected");if(C7(Q.method)&&!W.hasNotificationMethod(Q.method))throw new U0(A0.MethodNotSupportedByProtocolVersion,`Notification '${Q.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:Q.method,era:W.era});this.assertNotificationCapability(Q.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...Q});if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;this._transport?.send(Y,X).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,X)}setRequestHandler(W,Q,X){this.assertRequestHandlerCapability(W);let Y;if(typeof Q==="function"){if(!q7(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new m0(M0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(Q(L.value,B))}}else if(X)Y=async(G,B)=>{let F=await k7(Q.params,{...G.params});if(!F.success)throw new m0(M0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return X(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,Q){return Q}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,Q,X){if(typeof Q==="function"){if(!C7(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new m0(M0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(Q(B.value))});return}if(!X)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await k7(Q.params,{...Y.params});if(!G.success)throw new m0(M0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await X(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
210
+ deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(z){let[J,K]=B(z);F(z,J),L(z,K)}};function B({schema:z}){let J={},K={};for(let Z in z){if(Z==="__proto__")continue;let D=Array.isArray(z[Z])?J:K;D[Z]=z[Z]}return[J,K]}function F(z,J=z.schema){let{gen:K,data:Z,it:D}=z;if(Object.keys(J).length===0)return;let I=K.let("missing");for(let A in J){let M=J[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,Z,A,D.opts.ownProperties);if(z.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let $ of M)(0,Y.checkReportMissingProp)(z,$)});else K.if(X._`${N} && (${(0,Y.checkMissingProp)(z,M,I)})`),(0,Y.reportMissingProp)(z,I),K.else()}}W.validatePropertyDeps=F;function L(z,J=z.schema){let{gen:K,data:Z,keyword:D,it:I}=z,A=K.name("valid");for(let M in J){if((0,Q.alwaysValidSchema)(I,J[M]))continue;K.if((0,Y.propertyInData)(K,Z,M,I.opts.ownProperties),()=>{let N=z.subschema({keyword:D,schemaProp:M},A);z.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),z.ok(A)}}W.validateSchemaDeps=L,W.default=G}),E3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>X._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G;if((0,Q.alwaysValidSchema)(z,F))return;let J=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},J),B.if((0,X.not)(J),()=>{if(G.error(!0),!z.allErrors)B.break()})}),G.ok(J)}};W.default=Y}),EZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=f6(),Q=I0(),Y=g6(),G=v0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>Q._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:z,parentSchema:J,data:K,errsCount:Z,it:D}=F;if(!Z)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,z))return;let M=(0,X.allSchemaProperties)(J.properties),N=(0,X.allSchemaProperties)(J.patternProperties);$(),F.ok(Q._`${Z} === ${Y.default.errors}`);function $(){L.forIn("key",K,(j)=>{if(!M.length&&!N.length)O(j);else L.if(V(j),()=>O(j))})}function V(j){let w;if(M.length>8){let T=(0,G.schemaRefOrVal)(D,J.properties,"properties");w=(0,X.isOwnProperty)(L,T,j)}else if(M.length)w=(0,Q.or)(...M.map((T)=>Q._`${j} === ${T}`));else w=Q.nil;if(N.length)w=(0,Q.or)(w,...N.map((T)=>Q._`${(0,X.usePattern)(F,T)}.test(${j})`));return(0,Q.not)(w)}function U(j){L.code(Q._`delete ${K}[${j}]`)}function O(j){if(A.removeAdditional==="all"||A.removeAdditional&&z===!1){U(j);return}if(z===!1){if(F.setParams({additionalProperty:j}),F.error(),!I)L.break();return}if(typeof z=="object"&&!(0,G.alwaysValidSchema)(D,z)){let w=L.name("valid");if(A.removeAdditional==="failing")R(j,w,!1),L.if((0,Q.not)(w),()=>{F.reset(),U(j)});else if(R(j,w),!I)L.if((0,Q.not)(w),()=>L.break())}}function R(j,w,T){let k={keyword:"additionalProperties",dataProp:j,dataPropType:G.Type.Str};if(T===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),I3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=QX(),Q=f6(),Y=v0(),G=EZ(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,parentSchema:J,data:K,it:Z}=F;if(Z.opts.removeAdditional==="all"&&J.additionalProperties===void 0)G.default.code(new X.KeywordCxt(Z,G.default,"additionalProperties"));let D=(0,Q.allSchemaProperties)(z);for(let $ of D)Z.definedProperties.add($);if(Z.opts.unevaluated&&D.length&&Z.props!==!0)Z.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),Z.props);let I=D.filter(($)=>!(0,Y.alwaysValidSchema)(Z,z[$]));if(I.length===0)return;let A=L.name("valid");for(let $ of I){if(M($))N($);else{if(L.if((0,Q.propertyInData)(L,K,$,Z.opts.ownProperties)),N($),!Z.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add($),F.ok(A)}function M($){return Z.opts.useDefaults&&!Z.compositeRule&&z[$].default!==void 0}function N($){F.subschema({keyword:"properties",schemaProp:$,dataProp:$},A)}}};W.default=B}),R3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=f6(),Q=I0(),Y=v0(),G=v0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,data:J,parentSchema:K,it:Z}=F,{opts:D}=Z,I=(0,X.allSchemaProperties)(z),A=I.filter((R)=>(0,Y.alwaysValidSchema)(Z,z[R]));if(I.length===0||A.length===I.length&&(!Z.opts.unevaluated||Z.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(Z.props!==!0&&!(Z.props instanceof Q.Name))Z.props=(0,G.evaluatedPropsToName)(L,Z.props);let{props:$}=Z;V();function V(){for(let R of I){if(M)U(R);if(Z.allErrors)O(R);else L.var(N,!0),O(R),L.if(N)}}function U(R){for(let j in M)if(new RegExp(R).test(j))(0,Y.checkStrictMode)(Z,`property ${j} matches pattern ${R} (use allowMatchingProperties)`)}function O(R){L.forIn("key",J,(j)=>{L.if(Q._`${(0,X.usePattern)(F,R)}.test(${j})`,()=>{let w=A.includes(R);if(!w)F.subschema({keyword:"patternProperties",schemaProp:R,dataProp:j,dataPropType:G.Type.Str},N);if(Z.opts.unevaluated&&$!==!0)L.assign(Q._`${$}[${j}]`,!0);else if(!w&&!Z.allErrors)L.if((0,Q.not)(N),()=>L.break())})})}}};W.default=B}),T3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v0(),Q={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,X.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=Q}),P3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:f6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=X}),S3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>X._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:z}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(z.opts.discriminator&&L.discriminator)return;let J=F,K=B.let("valid",!1),Z=B.let("passing",null),D=B.name("_valid");G.setParams({passing:Z}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){J.forEach((A,M)=>{let N;if((0,Q.alwaysValidSchema)(z,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(X._`${D} && ${K}`).assign(K,!1).assign(Z,X._`[${Z}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(Z,M),N)G.mergeEvaluated(N,X.Name)})})}}};W.default=Y}),b3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v0(),Q={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((z,J)=>{if((0,X.alwaysValidSchema)(F,z))return;let K=Y.subschema({keyword:"allOf",schemaProp:J},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=Q}),q3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>X.str`must match "${B.ifClause}" schema`,params:({params:B})=>X._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:z}=B;if(L.then===void 0&&L.else===void 0)(0,Q.checkStrictMode)(z,'"if" without "then" and "else" is ignored');let J=G(z,"then"),K=G(z,"else");if(!J&&!K)return;let Z=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),J&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(J)F.if(D,A("then"));else F.if((0,X.not)(D),A("else"));B.pass(Z,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let $=B.subschema({keyword:M},D);if(F.assign(Z,D),B.mergeValidEvaluated($,Z),N)F.assign(N,X._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,Q.alwaysValidSchema)(B,L)}W.default=Y}),C3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v0(),Q={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,X.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=Q}),IZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=OZ(),Q=M3(),Y=jZ(),G=O3(),B=j3(),F=v7(),L=E3(),z=EZ(),J=I3(),K=R3(),Z=T3(),D=P3(),I=S3(),A=b3(),M=q3(),N=C3();function $(V=!1){let U=[Z.default,D.default,I.default,A.default,M.default,N.default,L.default,z.default,F.default,J.default,K.default];if(V)U.push(Q.default,G.default);else U.push(X.default,Y.default);return U.push(B.default),U}W.default=$}),k3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>X.str`must match format "${Y}"`,params:({schemaCode:Y})=>X._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:z,schemaCode:J,it:K}=Y,{opts:Z,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!Z.validateFormats)return;if(L)M();else N();function M(){let $=B.scopeValue("formats",{ref:A.formats,code:Z.code.formats}),V=B.const("fDef",X._`${$}[${J}]`),U=B.let("fType"),O=B.let("format");B.if(X._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,X._`${V}.type || "string"`).assign(O,X._`${V}.validate`),()=>B.assign(U,X._`"string"`).assign(O,V)),Y.fail$data((0,X.or)(R(),j()));function R(){if(Z.strictSchema===!1)return X.nil;return X._`${J} && !${O}`}function j(){let w=I.$async?X._`(${V}.async ? await ${O}(${F}) : ${O}(${F}))`:X._`${O}(${F})`,T=X._`(typeof ${O} == "function" ? ${w} : ${O}.test(${F}))`;return X._`${O} && ${O} !== true && ${U} === ${G} && !${T}`}}function N(){let $=A.formats[z];if(!$){R();return}if($===!0)return;let[V,U,O]=j($);if(V===G)Y.pass(w());function R(){if(Z.strictSchema===!1){A.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${D}"`}}function j(T){let k=T instanceof RegExp?(0,X.regexpCode)(T):Z.code.formats?X._`${Z.code.formats}${(0,X.getProperty)(z)}`:void 0,l=B.scopeValue("formats",{key:z,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,X._`${l}.validate`];return["string",T,l]}function w(){if(typeof $=="object"&&!($ instanceof RegExp)&&$.async){if(!I.$async)throw Error("async format in sync schema");return X._`await ${O}(${F})`}return typeof U=="function"?X._`${O}(${F})`:X._`${O}.test(${F})`}}}};W.default=Q}),RZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=[k3().default];W.default=X}),TZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),v3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=DZ(),Q=MZ(),Y=IZ(),G=RZ(),B=TZ(),F=[X.default,Q.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),y3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var X;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(X||(W.DiscrError=X={}))}),PZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=y3(),Y=IQ(),G=YX(),B=v0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:z}})=>L===Q.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:L,tag:z,tagName:J}})=>X._`{error: ${L}, tag: ${J}, tagValue: ${z}}`},code(L){let{gen:z,data:J,schema:K,parentSchema:Z,it:D}=L,{oneOf:I}=Z;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=z.let("valid",!1),N=z.const("tag",X._`${J}${(0,X.getProperty)(A)}`);z.if(X._`typeof ${N} == "string"`,()=>$(),()=>L.error(!1,{discrError:Q.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function $(){let O=U();z.if(!1);for(let R in O)z.elseIf(X._`${N} === ${R}`),z.assign(M,V(O[R]));z.else(),L.error(!1,{discrError:Q.DiscrError.Mapping,tag:N,tagName:A}),z.endIf()}function V(O){let R=z.name("valid"),j=L.subschema({keyword:"oneOf",schemaProp:O},R);return L.mergeEvaluated(j,X.Name),R}function U(){var O;let R={},j=T(Z),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(O=h===null||h===void 0?void 0:h.properties)===null||O===void 0?void 0:O[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(j||T(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return R;function T({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in R)throw Error(`discriminator: "${A}" values must be unique strings`);R[_]=h}}}};W.default=F}),_3=Q0((W,X)=>{X.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}}),SZ=Q0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let Q=wZ(),Y=v3(),G=PZ(),B=_3(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var z=class extends Q.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=z,X.exports=W=z,X.exports.Ajv=z,Object.defineProperty(W,"__esModule",{value:!0}),W.default=z;var J=QX();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var K=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var Z=EQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return Z.default}});var D=YX();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),bZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let X=I0(),Q=g6(),Y=IQ(),G=C7(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(z)=>F(z,z.schema)};function F(z,J){let{gen:K,it:Z}=z;Z.schemaEnv.root.dynamicAnchors[J]=!0;let D=X._`${Q.default.dynamicAnchors}${(0,X.getProperty)(J)}`,I=Z.errSchemaPath==="#"?Z.validateName:L(z);K.if(X._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(z){let{schemaEnv:J,schema:K,self:Z}=z.it,{root:D,baseId:I,localRefs:A,meta:M}=J.root,{schemaId:N}=Z.opts,$=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(Z,$),(0,G.getValidate)(z,$)}W.default=B}),qZ=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let X=I0(),Q=g6(),Y=C7(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:z,keyword:J,it:K}=F;if(L[0]!=="#")throw Error(`"${J}" only supports hash fragment reference`);let Z=L.slice(1);if(K.allErrors)D();else{let A=z.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[Z]){let M=z.let("_v",X._`${Q.default.dynamicAnchors}${(0,X.getProperty)(Z)}`);z.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>z.block(()=>{(0,Y.callRef)(F,A),z.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),g3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=bZ(),Q=v0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,X.dynamicAnchor)(G,"");else(0,Q.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),f3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=qZ(),Q={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,X.dynamicRef)(Y,Y.schema)};W.default=Q}),x3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=bZ(),Q=qZ(),Y=g3(),G=f3(),B=[X.default,Q.default,Y.default,G.default];W.default=B}),h3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v7(),Q={keyword:"dependentRequired",type:"object",schemaType:"object",error:X.error,code:(Y)=>(0,X.validatePropertyDeps)(Y)};W.default=Q}),u3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v7(),Q={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,X.validateSchemaDeps)(Y)};W.default=Q}),l3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=v0(),Q={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,X.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=Q}),m3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=h3(),Q=u3(),Y=l3(),G=[X.default,Q.default,Y.default];W.default=G}),c3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y=g6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>X._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:z,errsCount:J,it:K}=B;if(!J)throw Error("ajv implementation error");let{allErrors:Z,props:D}=K;if(D instanceof X.Name)F.if(X._`${D} !== true`,()=>F.forIn("key",z,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",z,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(X._`${J} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!Z)F.break();return}if(!(0,Q.alwaysValidSchema)(K,L)){let $=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:Q.Type.Str},$),!Z)F.if((0,X.not)($),()=>F.break())}}function A(N,$){return X._`!${N} || !${N}[${$}]`}function M(N,$){let V=[];for(let U in N)if(N[U]===!0)V.push(X._`${$} !== ${U}`);return(0,X.and)(...V)}}};W.default=G}),p3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=I0(),Q=v0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>X.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>X._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G,J=z.items||0;if(J===!0)return;let K=B.const("len",X._`${L}.length`);if(F===!1)G.setParams({len:J}),G.fail(X._`${K} > ${J}`);else if(typeof F=="object"&&!(0,Q.alwaysValidSchema)(z,F)){let D=B.var("valid",X._`${K} <= ${J}`);B.if((0,X.not)(D),()=>Z(D,J)),G.ok(D)}z.items=!0;function Z(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:Q.Type.Num},D),!z.allErrors)B.if((0,X.not)(D),()=>B.break())})}}};W.default=Y}),d3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=c3(),Q=p3(),Y=[X.default,Q.default];W.default=Y}),i3=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=DZ(),Q=MZ(),Y=IZ(),G=x3(),B=m3(),F=d3(),L=RZ(),z=TZ(),J=[G.default,X.default,Q.default,(0,Y.default)(!0),L.default,z.metadataVocabulary,z.contentVocabulary,B.default,F.default];W.default=J}),n3=Q0((W,X)=>{X.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}}}}),r3=Q0((W,X)=>{X.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"}}}}}),o3=Q0((W,X)=>{X.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"}}}}),a3=Q0((W,X)=>{X.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"}}}}),s3=Q0((W,X)=>{X.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"}}}}),t3=Q0((W,X)=>{X.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"}}}}),e3=Q0((W,X)=>{X.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}}}}),WD=Q0((W,X)=>{X.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:[]}}}}),XD=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=n3(),Q=r3(),Y=o3(),G=a3(),B=s3(),F=t3(),L=e3(),z=WD(),J=["/properties"];function K(Z){return[X,Q,Y,G,B,D(this,F),L,D(this,z)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return Z?I.$dataMetaSchema(A,J):A}}W.default=K}),QD=Q0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let Q=wZ(),Y=i3(),G=PZ(),B=XD(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends Q.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,X.exports=W=L,X.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var z=QX();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var J=I0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return J._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return J.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return J.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return J.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return J.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return J.CodeGen}});var K=EQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var Z=YX();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return Z.default}})}),YD=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function X(_,h){return{validate:_,compare:h}}W.fullFormats={date:X(B,F),time:X(z(!0),J),"date-time":X(D(!0),I),"iso-time":X(z(),K),"iso-date-time":X(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:$,"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:l,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:U,int32:{type:"number",validate:j},int64:{type:"number",validate:w},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:X(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:X(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,J),"date-time":X(/^\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,I),"iso-time":X(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":X(/^\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,A),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},W.formatNames=Object.keys(W.fullFormats);function Q(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],K0=+h[3];return p>=1&&p<=12&&K0>=1&&K0<=(p===2&&Q(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function z(_){return function(d){let p=L.exec(d);if(!p)return!1;let K0=+p[1],O0=+p[2],w0=+p[3],S0=p[4],$0=p[5]==="-"?-1:1,b=+(p[6]||0),v=+(p[7]||0);if(b>23||v>59||_&&!S0)return!1;if(K0<=23&&O0<=59&&w0<60)return!0;let u=O0-v*$0,E=K0-b*$0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&w0<61}}function J(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let Z=/t|\s/i;function D(_){let h=z(_);return function(p){let K0=p.split(Z);return K0.length===2&&B(K0[0])&&h(K0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(Z),[K0,O0]=h.split(Z),w0=F(d,K0);if(w0===void 0)return;return w0||J(p,O0)}let M=/\/|:/,N=/^(?:[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;function $(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let O=-2147483648,R=2147483647;function j(_){return Number.isInteger(_)&&_<=R&&_>=O}function w(_){return Number.isInteger(_)}function T(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),GD=Q0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let X=SZ(),Q=I0(),Y=Q.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:z})=>Q.str`should be ${G[L].okStr} ${z}`,params:({keyword:L,schemaCode:z})=>Q._`{comparison: ${G[L].okStr}, limit: ${z}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:z,data:J,schemaCode:K,keyword:Z,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new X.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else $();function N(){let U=z.scopeValue("formats",{ref:A.formats,code:I.code.formats}),O=z.const("fmt",Q._`${U}[${M.schemaCode}]`);L.fail$data((0,Q.or)(Q._`typeof ${O} != "object"`,Q._`${O} instanceof RegExp`,Q._`typeof ${O}.compare != "function"`,V(O)))}function $(){let U=M.schema,O=A.formats[U];if(!O||O===!0)return;if(typeof O!="object"||O instanceof RegExp||typeof O.compare!="function")throw Error(`"${Z}": format "${U}" does not define "compare" function`);let R=z.scopeValue("formats",{key:U,ref:O,code:I.code.formats?Q._`${I.code.formats}${(0,Q.getProperty)(U)}`:void 0});L.fail$data(V(R))}function V(U){return Q._`${U}.compare(${J}, ${K}) ${G[Z].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),BD=Q0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=YD(),Y=GD(),G=I0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(J,K={keywords:!0})=>{if(Array.isArray(K))return z(J,K,Q.fullFormats,B),J;let[Z,D]=K.mode==="fast"?[Q.fastFormats,F]:[Q.fullFormats,B];if(z(J,K.formats||Q.formatNames,Z,D),K.keywords)(0,Y.default)(J);return J};L.get=(J,K="full")=>{let Z=(K==="fast"?Q.fastFormats:Q.fullFormats)[J];if(!Z)throw Error(`Unknown format "${J}"`);return Z};function z(J,K,Z,D){var I,A;(I=(A=J.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)J.addFormat(M,Z[M])}X.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),FD=SZ(),LD=QD(),zD=bX(BD(),1),JD=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),KD=zD.default;KP=FD.Ajv});var y7=H0(()=>{CZ()});function g7(W){return!!W&&typeof W==="object"&&hZ in W}function HD(W){return W[hZ]?.complete}function ND(W){if(W?.maxRounds!==void 0&&(!Number.isInteger(W.maxRounds)||W.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${W.maxRounds})`);if(W?.roundTimeoutMs!==void 0&&(!Number.isFinite(W.roundTimeoutMs)||W.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${W.roundTimeoutMs})`);return{maxRounds:W?.maxRounds??UD,roundTimeoutMs:W?.roundTimeoutMs??AD,legacyShim:W?.legacyShim??!0}}function uZ(W,X,Q){if(Q===null||typeof Q!=="object"||typeof Q.method!=="string")throw new V0(Z0.InternalError,`Handler for ${W} returned an invalid input request '${X}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let Y=Q,G=gK(Y);if(G===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input request '${X}' of kind '${Y.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:Y,required:G}}function VD(){let W=globalThis.crypto;if(W?.randomUUID!==void 0)return W.randomUUID();let X=new Uint8Array(16);W.getRandomValues(X),X[6]=X[6]&15|64,X[8]=X[8]&63|128;let Q=[...X].map((Y)=>Y.toString(16).padStart(2,"0")).join("");return`${Q.slice(0,8)}-${Q.slice(8,12)}-${Q.slice(12,16)}-${Q.slice(16,20)}-${Q.slice(20)}`}function _7(W,X){if(W==="tools/call")return{content:[{type:"text",text:X}],isError:!0};throw new V0(Z0.InternalError,X)}function ED(W){return{...W}}function kZ(W,X){if(W){let Y=X;return async(G,B)=>Y(G,B)}let Q=X;return async(Y,G)=>Q(G)}function yZ(W){if(W===void 0)return;try{return G4(W,"output")}catch{return}}function _Z(W,X,Q){if(X){let Y=Q;return async(G,B)=>{let F=await k4(X,G);if(!F.success)throw new V0(Z0.InvalidParams,`Invalid arguments for prompt ${W}: ${F.error}`);return Y(F.data,B)}}else{let Y=Q;return async(G,B)=>{return Y(B)}}}function gZ(W){return{completion:{values:W.map(String).slice(0,100),total:W.length,hasMore:W.length>100}}}function fZ(W){let X=W;if(X.shape&&typeof X.shape==="object")return X.shape}function ID(W){return W?.type==="optional"}function xZ(W){if(!ID(W))return W;return W.def?.innerType??W}var hZ,UD=8,AD=600000,wD=class{constructor(W){this._host=W}async fulfill(W,X,Q,Y,G){let{maxRounds:B,roundTimeoutMs:F}=this._host,L=Y.mcpReq.signal,z=G,J=0;while(!0){if(J+=1,J>B)return _7(W,FZ(W,B));let K=z.inputRequests,Z=K!=null&&Object.keys(K).length>0,D=typeof z.requestState==="string"?z.requestState:void 0;if(!Z&&D===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let I;if(Z){let N=this._host.resolvedClientCapabilities(Y),$=[];for(let[U,O]of Object.entries(K)){let{embedded:R,required:j}=uZ(W,U,O);if(R.method!=="roots/list"&&R.params===void 0)throw new V0(Z0.InternalError,`Handler for ${W} returned an input request '${U}' of kind '${R.method}' without params`);if(HQ(j,N)!==void 0)return _7(W,`Cannot request input '${U}' (${R.method}): the client on this 2025-era connection did not declare the required capability${N===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);$.push([U,R])}let V=zZ(L);try{let U={relatedRequestId:Y.mcpReq.id,timeout:F,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:V.signal},O=await Promise.all($.map(async([R,j])=>{try{return[R,await this._dispatchLeg(j,U)]}catch(w){throw V.abort(w),w}}));I=Object.fromEntries(O)}catch(U){if(L.aborted)throw U;return _7(W,`Fulfilling input required by '${W}' failed: ${U instanceof Error?U.message:String(U)}`)}finally{V.dispose()}}else await LZ(BZ,L);let A={...Y,mcpReq:{...Y.mcpReq,inputResponses:I,droppedInputResponseKeys:void 0,requestState:XX(D)}};if(D!==void 0){let N=await this._host.verifyRequestState(D,A,W);if(N!==void 0)A=I7(A,N)}let M=await X(Q,A);if(!k5(M))return M;z=M}}async _dispatchLeg(W,X){switch(W.method){case"elicitation/create":{let Q=W.params;if(Q.mode==="url"&&Q.elicitationId===void 0)Q={...Q,elicitationId:VD()};return await this._host.sendElicitation(Q,X)}case"sampling/createMessage":return await this._host.sendSampling(W.params,X);case"roots/list":return await this._host.listRoots(W.params,X)}}},DD,MD,OD,jD,lZ,f7=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(W){let X=this._registeredTools[W];if(X===void 0||!X.enabled)return;if(Object.hasOwn(this._toolInputSchemaJson,W))return this._toolInputSchemaJson[W];if(X.inputSchema===void 0)return vZ;try{let Q=G4(X.inputSchema,"input");return this._toolInputSchemaJson[W]=Q,Q}catch{return}}constructor(W,X){if(this.server=new lZ(W,X),X?.capabilities?.tools)this.setToolRequestHandlers();if(X?.capabilities?.resources)this.setResourceRequestHandlers();if(X?.capabilities?.prompts)this.setPromptRequestHandlers()}async connect(W){return await this.server.connect(W)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler("tools/list"),this.server.assertCanSetRequestHandler("tools/call"),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler("tools/list",()=>({tools:Object.entries(this._registeredTools).filter(([,W])=>W.enabled).map(([W,X])=>{let Q={name:W,title:X.title,description:X.description,inputSchema:X.inputSchema?G4(X.inputSchema,"input"):vZ,annotations:X.annotations,icons:X.icons,execution:X.execution,_meta:X._meta};if(X.outputSchema)Q.outputSchema=G4(X.outputSchema,"output");return Q})})),this.server.setRequestHandler("tools/call",async(W,X)=>{let Q=this._registeredTools[W.params.name];if(!Q)throw new V0(Z0.InvalidParams,`Tool ${W.params.name} not found`);if(!Q.enabled)throw new V0(Z0.InvalidParams,`Tool ${W.params.name} disabled`);try{let Y=await this.validateToolInput(Q,W.params.arguments,W.params.name),G=await this.executeToolHandler(Q,Y,X);if(await this.validateToolOutput(Q,G,W.params.name),k5(G))return G;return this.server.projectCallToolResult(G,Q.outputSchemaJson)}catch(Y){if(Y instanceof V0&&Y.code===Z0.UrlElicitationRequired)throw Y;return this.createToolError(Y instanceof Error?Y.message:String(Y))}}),this._toolHandlersInitialized=!0}createToolError(W){return{content:[{type:"text",text:W}],isError:!0}}async validateToolInput(W,X,Q){if(!W.inputSchema)return;let Y=await k4(W.inputSchema,X??{});if(!Y.success)throw new V0(Z0.InvalidParams,`Input validation error: Invalid arguments for tool ${Q}: ${Y.error}`);return Y.data}async validateToolOutput(W,X,Q){if(!W.outputSchema)return;if(k5(X))return;if(X.isError)return;if(X.structuredContent===void 0)throw new V0(Z0.InvalidParams,`Output validation error: Tool ${Q} has an output schema but no structured content was provided`);let Y=await k4(W.outputSchema,X.structuredContent);if(!Y.success)throw new V0(Z0.InvalidParams,`Output validation error: Invalid structured content for tool ${Q}: ${Y.error}`)}async executeToolHandler(W,X,Q){return W.executor(X,Q)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async(W)=>{switch(W.params.ref.type){case"ref/prompt":return M7(W),this.handlePromptCompletion(W,W.params.ref);case"ref/resource":return O7(W),this.handleResourceCompletion(W,W.params.ref);default:throw new V0(Z0.InvalidParams,`Invalid completion reference: ${W.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(W,X){let Q=this._registeredPrompts[X.name];if(!Q)throw new V0(Z0.InvalidParams,`Prompt ${X.name} not found`);if(!Q.enabled)throw new V0(Z0.InvalidParams,`Prompt ${X.name} disabled`);if(!Q.argsSchema)return GX;let Y=xZ(fZ(Q.argsSchema)?.[W.params.argument.name]);if(!g7(Y))return GX;let G=HD(Y);if(!G)return GX;return gZ(await G(W.params.argument.value,W.params.context))}async handleResourceCompletion(W,X){let Q=Object.values(this._registeredResourceTemplates).find((G)=>G.resourceTemplate.uriTemplate.toString()===X.uri);if(!Q){if(this._registeredResources[X.uri])return GX;throw new V0(Z0.InvalidParams,`Resource template ${W.params.ref.uri} not found`)}let Y=Q.resourceTemplate.completeCallback(W.params.argument.name);if(!Y)return GX;return gZ(await Y(W.params.argument.value,W.params.context))}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler("resources/list"),this.server.assertCanSetRequestHandler("resources/templates/list"),this.server.assertCanSetRequestHandler("resources/read"),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler("resources/list",async(W,X)=>{let Q=Object.entries(this._registeredResources).filter(([G,B])=>B.enabled).map(([G,B])=>({uri:G,name:B.name,...B.metadata})),Y=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let B=await G.resourceTemplate.listCallback(X);for(let F of B.resources)Y.push({...G.metadata,...F})}return{resources:[...Q,...Y]}}),this.server.setRequestHandler("resources/templates/list",async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([W,X])=>({name:W,uriTemplate:X.resourceTemplate.uriTemplate.toString(),...X.metadata}))}}),this.server.setRequestHandler("resources/read",async(W,X)=>{let Q;try{Q=new URL(W.params.uri)}catch{throw new V0(Z0.InvalidParams,`Resource URI ${W.params.uri} is invalid`,{uri:W.params.uri,reason:"invalid_uri"})}let Y=this._registeredResources[Q.toString()];if(Y){if(!Y.enabled)throw new V0(Z0.InvalidParams,`Resource ${Q} disabled`);return UQ(await Y.readCallback(Q,X),Y.cacheHint)}for(let G of Object.values(this._registeredResourceTemplates)){let B=G.resourceTemplate.uriTemplate.match(Q.toString());if(B)return UQ(await G.readCallback(Q,B,X),G.cacheHint)}throw new AQ(W.params.uri)}),this._resourceHandlersInitialized=!0}_promptHandlersInitialized=!1;setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler("prompts/list"),this.server.assertCanSetRequestHandler("prompts/get"),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler("prompts/list",()=>({prompts:Object.entries(this._registeredPrompts).filter(([,W])=>W.enabled).map(([W,X])=>{return{name:W,title:X.title,description:X.description,arguments:X.argsSchema?GZ(X.argsSchema):void 0,icons:X.icons,_meta:X._meta}})})),this.server.setRequestHandler("prompts/get",async(W,X)=>{let Q=this._registeredPrompts[W.params.name];if(!Q)throw new V0(Z0.InvalidParams,`Prompt ${W.params.name} not found`);if(!Q.enabled)throw new V0(Z0.InvalidParams,`Prompt ${W.params.name} disabled`);return Q.handler(W.params.arguments,X)}),this._promptHandlersInitialized=!0}registerResource(W,X,Q,Y){let G=Q.cacheHint,B=Q;if(G!==void 0){N7(G,`resource ${W}`);let F={...Q};delete F.cacheHint,B=F}if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let F=this._createRegisteredResource(W,Q.title,X,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}else{if(this._registeredResourceTemplates[W])throw Error(`Resource template ${W} is already registered`);let F=this._createRegisteredResourceTemplate(W,Q.title,X,B,Y);if(G!==void 0)F.cacheHint=G;return this.setResourceRequestHandlers(),this.sendResourceListChanged(),F}}_createRegisteredResource(W,X,Q,Y,G){let B={name:W,title:X,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({uri:null}),update:(F)=>{if(F.uri!==void 0&&F.uri!==Q){if(delete this._registeredResources[Q],F.uri)this._registeredResources[F.uri]=B}if(F.name!==void 0)B.name=F.name;if(F.title!==void 0)B.title=F.title;if(F.metadata!==void 0)B.metadata=F.metadata;if(F.callback!==void 0)B.readCallback=F.callback;if(F.enabled!==void 0)B.enabled=F.enabled;this.sendResourceListChanged()}};return this._registeredResources[Q]=B,B}_createRegisteredResourceTemplate(W,X,Q,Y,G){let B={resourceTemplate:Q,title:X,metadata:Y,readCallback:G,enabled:!0,disable:()=>B.update({enabled:!1}),enable:()=>B.update({enabled:!0}),remove:()=>B.update({name:null}),update:(L)=>{if(L.name!==void 0&&L.name!==W){if(delete this._registeredResourceTemplates[W],L.name)this._registeredResourceTemplates[L.name]=B}if(L.title!==void 0)B.title=L.title;if(L.template!==void 0)B.resourceTemplate=L.template;if(L.metadata!==void 0)B.metadata=L.metadata;if(L.callback!==void 0)B.readCallback=L.callback;if(L.enabled!==void 0)B.enabled=L.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[W]=B;let F=Q.uriTemplate.variableNames;if(Array.isArray(F)&&F.some((L)=>!!Q.completeCallback(L)))this.setCompletionRequestHandler();return B}_createRegisteredPrompt(W,X,Q,Y,G,B,F){let L=Y,z=G,J={title:X,description:Q,argsSchema:Y,icons:B,_meta:F,handler:_Z(W,Y,G),enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(K)=>{if(K.name!==void 0&&K.name!==W){if(delete this._registeredPrompts[W],K.name)this._registeredPrompts[K.name]=J}if(K.title!==void 0)J.title=K.title;if(K.description!==void 0)J.description=K.description;if(K.icons!==void 0)J.icons=K.icons;if(K._meta!==void 0)J._meta=K._meta;let Z=!1;if(K.argsSchema!==void 0)J.argsSchema=K.argsSchema,L=K.argsSchema,Z=!0;if(K.callback!==void 0)z=K.callback,Z=!0;if(Z)J.handler=_Z(W,L,z);if(K.enabled!==void 0)J.enabled=K.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[W]=J,Y){let K=fZ(Y);if(K){if(Object.values(K).some((Z)=>{return g7(xZ(Z))}))this.setCompletionRequestHandler()}}return J}_createRegisteredTool(W,X,Q,Y,G,B,F,L,z,J){if(b7(W),Y!==void 0)try{let D=G4(Y,"input");this._toolInputSchemaJson[W]=D;let I=j7(D);if(!I.valid)console.warn(`[mcp-sdk] tool '${W}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${I.reason}`)}catch{}let K=J,Z={title:X,description:Q,inputSchema:Y,outputSchema:G,outputSchemaJson:yZ(G),annotations:B,icons:F,execution:L,_meta:z,handler:J,executor:kZ(Y,J),enabled:!0,disable:()=>Z.update({enabled:!1}),enable:()=>Z.update({enabled:!0}),remove:()=>Z.update({name:null}),update:(D)=>{if(D.name!==void 0&&D.name!==W){if(typeof D.name==="string")b7(D.name);if(delete this._registeredTools[W],delete this._toolInputSchemaJson[W],D.name)delete this._toolInputSchemaJson[D.name],this._registeredTools[D.name]=Z,W=D.name}if(D.title!==void 0)Z.title=D.title;if(D.description!==void 0)Z.description=D.description;let I=!1;if(D.paramsSchema!==void 0)Z.inputSchema=D.paramsSchema,delete this._toolInputSchemaJson[W],I=!0;if(D.callback!==void 0)Z.handler=D.callback,K=D.callback,I=!0;if(I)Z.executor=kZ(Z.inputSchema,K);if(D.outputSchema!==void 0)Z.outputSchema=D.outputSchema,Z.outputSchemaJson=yZ(D.outputSchema);if(D.annotations!==void 0)Z.annotations=D.annotations;if(D.icons!==void 0)Z.icons=D.icons;if(D._meta!==void 0)Z._meta=D._meta;if(D.enabled!==void 0)Z.enabled=D.enabled;this.sendToolListChanged()}};return this._registeredTools[W]=Z,this.setToolRequestHandlers(),this.sendToolListChanged(),Z}registerTool(W,X,Q){if(this._registeredTools[W])throw Error(`Tool ${W} is already registered`);let{title:Y,description:G,inputSchema:B,outputSchema:F,annotations:L,icons:z,_meta:J}=X;return this._createRegisteredTool(W,Y,G,wQ(B),wQ(F),L,z,void 0,J,Q)}registerPrompt(W,X,Q){if(this._registeredPrompts[W])throw Error(`Prompt ${W} is already registered`);let{title:Y,description:G,argsSchema:B,icons:F,_meta:L}=X,z=this._createRegisteredPrompt(W,Y,G,wQ(B),Q,F,L);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),z}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(W,X){return this.server.sendLoggingMessage(W,X)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}},vZ,GX;var mZ=H0(()=>{q7();y7();hZ=Symbol.for("mcp.completable");DD=new Set(["tools/call","prompts/get","resources/read"]),lZ=class extends R7{_clientCapabilities;_clientVersion;static{MD=(W,X)=>{if(X.clientCapabilities!==void 0)W._clientCapabilities=X.clientCapabilities;if(X.clientInfo!==void 0)W._clientVersion=X.clientInfo},OD=(W,X)=>{let Q=X.filter((Y)=>!W._supportedProtocolVersions.includes(Y));if(Q.length>0)W._supportedProtocolVersions=[...W._supportedProtocolVersions,...Q];W.setRequestHandler("server/discover",()=>W._ondiscover())},jD=(W)=>W._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new wD({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:(W)=>this._inputRequestCapabilityView(W),verifyRequestState:(W,X,Q)=>this._verifyRequestState(W,X,Q),sendElicitation:(W,X)=>this._sendElicitationLeg(W,X,{validateAcceptedContent:!1}),sendSampling:(W,X)=>this.createMessage(W,X),listRoots:(W,X)=>this.listRoots(W,X)})}oninitialized;constructor(W,X){super(X);if(this._serverInfo=W,this._capabilities=X?.capabilities?{...X.capabilities}:{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new RQ,this._requestStateVerify=X?.requestState?.verify,this._inputRequiredServing=ND(X?.inputRequired),X?.cacheHints!==void 0){for(let[Q,Y]of Object.entries(X.cacheHints))if(Y!==void 0)N7(Y,`cacheHints['${Q}']`);this._cacheHints=X.cacheHints}if(this.setRequestHandler("initialize",(Q)=>this._oninitialize(Q)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),K7(this._supportedProtocolVersions).length>0)this.setRequestHandler("server/discover",()=>this._ondiscover());if(this._capabilities.logging)this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(W,X)=>{let Q=X.sessionId||X.http?.req?.headers.get("mcp-session-id")||void 0,{level:Y}=W.params,G=VQ(r6,Y);if(G.success)this._loggingLevels.set(Q,G.data);return{}})}buildContext(W,X){let Q=W.http||X?.request||X?.closeSSEStream||X?.closeStandaloneSSEStream;return{...W,mcpReq:{...W.mcpReq,log:(Y,G,B)=>{if(!this._capabilities.logging)return Promise.resolve();let F;if(this._servedModernEra()){if(F=W.mcpReq.envelope?.[o1],F===void 0)return Promise.resolve()}else F=this._loggingLevels.get(W.sessionId)??this._loggingLevels.get(void 0);if(F!==void 0&&this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(F))return Promise.resolve();return W.mcpReq.notify({method:"notifications/message",params:{level:Y,data:G,logger:B}})},elicitInput:(Y,G)=>this.elicitInput(Y,G),requestSampling:(Y,G)=>this.createMessage(Y,G)},http:Q?{...W.http,req:X?.request,closeSSE:X?.closeSSEStream,closeStandaloneSSE:X?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(r6.options.map((W,X)=>[W,X]));isMessageIgnored=(W,X)=>{let Q=this._loggingLevels.get(X);return Q?this.LOG_LEVEL_SEVERITY.get(W)<this.LOG_LEVEL_SEVERITY.get(Q):!1};registerCapabilities(W){if(this.transport)throw new E0(q0.AlreadyConnected,"Cannot register capabilities after connecting to transport");let X=!!this._capabilities.logging;if(this._capabilities=T7(this._capabilities,W),!X&&this._capabilities.logging)this._registerLoggingHandler()}_wrapHandler(W,X){if(W!=="tools/call"){let Q=this._cacheHints?.[W],Y=DD.has(W);if(Q===void 0&&!Y)return async(G,B)=>{let F=await X(G,B);if(k5(F))throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F};return async(G,B)=>{let F=Y?await this._invokeInputRequiredCapableHandler(W,X,G,B):await X(G,B);if(k5(F)){if(!Y)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return F}return Q===void 0?F:UQ(F,Q)}}return async(Q,Y)=>{let G=c9(this._negotiatedProtocolVersion),B=G.validateRequest("tools/call",Q);if(!B.ok)throw new V0(B.reason==="not-in-era"?Z0.InternalError:Z0.InvalidParams,B.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${B.message}`);let F=await this._invokeInputRequiredCapableHandler("tools/call",X,Q,Y);if(k5(F))return F;let L=Z7(F),z=G.validateResult("tools/call",L);if(!z.ok)throw new V0(z.reason==="not-in-era"?Z0.InternalError:Z0.InvalidParams,z.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${z.message}`);return z.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&WX(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(W,X,Q,Y){let G=this._servedModernEra(),B=Y.mcpReq.requestState();if(B!==void 0&&typeof B!=="string")throw new V0(Z0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let F=Y;if(typeof B==="string"){let Z=await this._verifyRequestState(B,Y,W);if(Z!==void 0)F=I7(Y,Z)}let L;try{L=await X(Q,F)}catch(Z){if(Z instanceof V0&&Z.code===Z0.UrlElicitationRequired){if(!G)throw Z;throw new V0(Z0.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.`)}throw Z}if(!k5(L))return L;if(!G){if(!this._inputRequiredServing.legacyShim)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??R5}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(W,X,Q,F,L)}let z=L.inputRequests,J=z!=null&&Object.keys(z).length>0,K=typeof L.requestState==="string";if(!J&&!K)throw new V0(Z0.InternalError,`Handler for ${W} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(J){let Z=this._inputRequestCapabilityView(Y);for(let[D,I]of Object.entries(z)){let{embedded:A,required:M}=uZ(W,D,I),N=HQ(M,Z);if(N!==void 0)throw new NQ({requiredCapabilities:N},`Cannot request input '${D}' (${A.method}): the request's client capabilities do not declare the required capability`)}}return L}async _verifyRequestState(W,X,Q){if(this._requestStateVerify===void 0)return;try{return await this._requestStateVerify(W,X)}catch(Y){throw this.onerror?.(Error(`requestState verification rejected ${Q}: ${Y instanceof Error?Y.message:String(Y)}`)),new V0(Z0.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(W){return this._servedModernEra()?W.mcpReq.envelope?.[C1]:this._clientCapabilities}_assertPushApiInServedEra(W){if(this._servedModernEra())throw new E0(q0.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${W}' 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:W,era:"2026-07-28"})}assertCapabilityForMethod(W){switch(W){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new E0(q0.CapabilityNotSupported,`Client does not support sampling (required for ${W})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new E0(q0.CapabilityNotSupported,`Client does not support elicitation (required for ${W})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new E0(q0.CapabilityNotSupported,`Client does not support listing roots (required for ${W})`);break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/message":if(!this._capabilities.logging)throw new E0(q0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying about resources (required for ${W})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${W})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new E0(q0.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${W})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,`Client does not support URL elicitation (required for ${W})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"completion/complete":if(!this._capabilities.completions)throw new E0(q0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new E0(q0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new E0(q0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new E0(q0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new E0(q0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"ping":case"initialize":break}}async _oninitialize(W){let X=W.params.protocolVersion;this._clientCapabilities=W.params.capabilities,this._clientVersion=W.params.clientInfo;let Q=fK(this._supportedProtocolVersions),Y=Q.includes(X)?X:Q[0]??R5;return this._negotiatedProtocolVersion=Y,this.transport?.setProtocolVersion?.(Y),{protocolVersion:Y,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:K7(this._supportedProtocolVersions),capabilities:ED(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(W,X){return this._wireCodec().projectCallToolResult(W,X)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(W,X){if(this._assertPushApiInServedEra("sampling/createMessage"),(W.tools||W.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new E0(q0.CapabilityNotSupported,"Client does not support sampling tools capability.");if(W.messages.length>0){let B=W.messages.at(-1),F=Array.isArray(B.content)?B.content:[B.content],L=F.some((Z)=>Z.type==="tool_result"),z=W.messages.length>1?W.messages.at(-2):void 0,J=z?Array.isArray(z.content)?z.content:[z.content]:[],K=J.some((Z)=>Z.type==="tool_use");if(L){if(F.some((Z)=>Z.type!=="tool_result"))throw new V0(Z0.InvalidParams,"The last message must contain only tool_result content if any is present");if(!K)throw new V0(Z0.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(K){let Z=new Set(J.filter((I)=>I.type==="tool_use").map((I)=>I.id)),D=new Set(F.filter((I)=>I.type==="tool_result").map((I)=>I.toolUseId));if(Z.size!==D.size||![...Z].every((I)=>D.has(I)))throw new V0(Z0.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let Q=Boolean(W.tools||W.toolChoice),Y=await this.request({method:"sampling/createMessage",params:W},X),G=this._wireCodec().samplingResultVariant(Q,Y);if(!G.ok)throw new E0(q0.InvalidResult,`Invalid sampling/createMessage result: ${G.reason==="invalid"?G.message:G.reason}`);return G.value}async elicitInput(W,X){switch(this._assertPushApiInServedEra("elicitation/create"),W.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new E0(q0.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(W,X)}async _sendElicitationLeg(W,X,Q){let Y=W.mode??"form",G=Q?.validateAcceptedContent??!0;switch(Y){case"url":{let B=W;return this.request({method:"elicitation/create",params:B},X)}case"form":{let B=W.mode==="form"?W:{...W,mode:"form"},F=await this.request({method:"elicitation/create",params:B},X);if(G&&F.action==="accept"&&F.content&&B.requestedSchema)try{let L=this._jsonSchemaValidator.getValidator(B.requestedSchema)(F.content);if(!L.valid)throw new V0(Z0.InvalidParams,`Elicitation response content does not match requested schema: ${L.errorMessage}`)}catch(L){if(L instanceof V0)throw L;throw new V0(Z0.InternalError,`Error validating elicitation response: ${L instanceof Error?L.message:String(L)}`)}return F}}}createElicitationCompletionNotifier(W,X){if(!this._clientCapabilities?.elicitation?.url)throw new E0(q0.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:W}},X)}async listRoots(W,X){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:W},X)}async sendLoggingMessage(W,X){if(this._capabilities.logging&&!this.isMessageIgnored(W.level,X))return this.notification({method:"notifications/message",params:W})}async sendResourceUpdated(W){return this.notification({method:"notifications/resources/updated",params:W})}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"})}};vZ={type:"object",properties:{}};GX={completion:{values:[],hasMore:!1}}});var x7=H0(()=>{mZ();q7();y7()});var RD,TQ,TD,PD,SD,bD,G0=(W,X)=>()=>(X||W((X={exports:{}}).exports,X),X.exports),cZ=(W,X)=>{let Q={};for(var Y in W)TQ(Q,Y,{get:W[Y],enumerable:!0});if(X)TQ(Q,Symbol.toStringTag,{value:"Module"});return Q},qD=(W,X,Q,Y)=>{if(X&&typeof X==="object"||typeof X==="function"){for(var G=PD(X),B=0,F=G.length,L;B<F;B++)if(L=G[B],!bD.call(W,L)&&L!==Q)TQ(W,L,{get:((z)=>X[z]).bind(null,L),enumerable:!(Y=TD(X,L))||Y.enumerable})}return W},PQ=(W,X,Q)=>(Q=W!=null?RD(SD(W)):{},qD(X||!W||!W.__esModule?TQ(Q,"default",{value:W,enumerable:!0}):Q,W));var h7=H0(()=>{RD=Object.create,TQ=Object.defineProperty,TD=Object.getOwnPropertyDescriptor,PD=Object.getOwnPropertyNames,SD=Object.getPrototypeOf,bD=Object.prototype.hasOwnProperty});function _4(W,X){let Q=new Set,Y=X;while(typeof Y==="function"){let G=Y.mcpBrand;if(Object.prototype.hasOwnProperty.call(Y,"mcpBrand")&&typeof G==="string")Q.add(G);Y=Object.getPrototypeOf(Y)}if(Q.size===0)return;Object.defineProperty(W,p7,{value:Q,enumerable:!1,configurable:!0})}function a1(W,X){try{if(typeof X==="object"&&X!==null&&Object.prototype.hasOwnProperty.call(W,"mcpBrand")&&typeof W.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(X,p7)){let Q=X[p7];if(Q&&typeof Q.has==="function"&&Q.has(W.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(W,X)}function B4(W){return W>=X$}function a7(W){return W.filter((X)=>!B4(X))}function ZX(W){return W.filter((X)=>B4(X))}function Q$(W){let X=W.structuredContent;if(X===void 0)return W;if(!(typeof X!=="object"||X===null||Array.isArray(X)))return W;if(W.content?.some((Q)=>Q.type==="text")??!1)return W;return{...W,content:[...W.content??[],{type:"text",text:JSON.stringify(X)}]}}function kD(W){if(W===null||typeof W!=="object"||Array.isArray(W)||W.content!==void 0||Y$.some((X)=>(X in W)))return W;return{...W,content:[]}}function vD(){let W=l5(()=>a([H(),m(),o(),C6(),n(H(),W),f(W)])),X=n(H(),W),Q=a([H(),m().int()]),Y=H(),G=q({ttl:m().optional()}),B=q({taskId:H()}),F=F0({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":B.optional()}),L=q({_meta:F.optional()}),z=L.extend({task:G.optional()}),J=q({method:H(),params:L.loose().optional()}),K=q({_meta:F.optional()}),Z=q({method:H(),params:K.loose().optional()}),D=F0({_meta:F.optional()}),I=a([H(),m().int()]),A=D.strict(),M=K.extend({requestId:I.optional(),reason:H().optional()}),N=Z.extend({method:g("notifications/cancelled"),params:M}),$=q({src:H(),mimeType:H().optional(),sizes:f(H()).optional(),theme:J0(["light","dark"]).optional()}),V=q({icons:f($).optional()}),U=q({name:H(),title:H().optional()}),O=U.extend({...U.shape,...V.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),R=v1(q({applyDefaults:o().optional()}),X),j=k6((h0)=>{if(h0&&typeof h0==="object"&&!Array.isArray(h0)&&Object.keys(h0).length===0)return{form:{}};return h0},v1(q({form:R.optional(),url:X.optional()}),X.optional())),w=F0({list:X.optional(),cancel:X.optional(),requests:F0({sampling:F0({createMessage:X.optional()}).optional(),elicitation:F0({create:X.optional()}).optional()}).optional()}),T=F0({list:X.optional(),cancel:X.optional(),requests:F0({tools:F0({call:X.optional()}).optional()}).optional()}),k=q({experimental:n(H(),X).optional(),sampling:q({context:X.optional(),tools:X.optional()}).optional(),elicitation:j.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:w.optional(),extensions:n(H(),X).optional()}),l=L.extend({protocolVersion:H(),capabilities:k,clientInfo:O}),_=J.extend({method:g("initialize"),params:l}),h=q({experimental:n(H(),X).optional(),logging:X.optional(),completions:X.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:T.optional(),extensions:n(H(),X).optional()}),d=D.extend({protocolVersion:H(),capabilities:h,serverInfo:O,instructions:H().optional()}),p=Z.extend({method:g("notifications/initialized"),params:K.optional()}),K0=J.extend({method:g("ping"),params:L.optional()}),O0=q({progress:m(),total:X0(m()),message:X0(H())}),w0=q({...K.shape,...O0.shape,progressToken:Q}),S0=Z.extend({method:g("notifications/progress"),params:w0}),$0=L.extend({cursor:Y.optional()}),b=J.extend({params:$0.optional()}),v=D.extend({nextCursor:Y.optional()}),u=q({uri:H(),mimeType:X0(H()),_meta:n(H(),Y0()).optional()}),E=u.extend({text:H()}),S=H().refine((h0)=>{try{return atob(h0),!0}catch{return!1}},{message:"Invalid Base64 string"}),C=u.extend({blob:S}),c=J0(["user","assistant"]),r=q({audience:f(c).optional(),priority:m().min(0).max(1).optional(),lastModified:q1.datetime({offset:!0}).optional()}),z0=q({...U.shape,...V.shape,uri:H(),description:X0(H()),mimeType:X0(H()),size:X0(m()),annotations:r.optional(),_meta:X0(F0({}))}),e=q({...U.shape,...V.shape,uriTemplate:H(),description:X0(H()),mimeType:X0(H()),annotations:r.optional(),_meta:X0(F0({}))}),D0=b.extend({method:g("resources/list")}),u0=v.extend({resources:f(z0)}),P=b.extend({method:g("resources/templates/list")}),y=v.extend({resourceTemplates:f(e)}),x=L.extend({uri:H()}),s=x,t=J.extend({method:g("resources/read"),params:s}),L0=D.extend({contents:f(a([E,C]))}),T0=Z.extend({method:g("notifications/resources/list_changed"),params:K.optional()}),C0=x,f0=J.extend({method:g("resources/subscribe"),params:C0}),b0=x,j0=J.extend({method:g("resources/unsubscribe"),params:b0}),o0=K.extend({uri:H()}),k0=Z.extend({method:g("notifications/resources/updated"),params:o0}),B1=q({name:H(),description:X0(H()),required:X0(o())}),Q1=q({...U.shape,...V.shape,description:X0(H()),arguments:X0(f(B1)),_meta:X0(F0({}))}),F1=b.extend({method:g("prompts/list")}),Z1=v.extend({prompts:f(Q1)}),$1=L.extend({name:H(),arguments:n(H(),H()).optional()}),D1=J.extend({method:g("prompts/get"),params:$1}),M1=q({type:g("text"),text:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),O1=q({type:g("image"),data:S,mimeType:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),j1=q({type:g("audio"),data:S,mimeType:H(),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),X6=q({type:g("tool_use"),name:H(),id:H(),input:n(H(),Y0()),_meta:n(H(),Y0()).optional()}),H1=q({type:g("resource"),resource:a([E,C]),annotations:r.optional(),_meta:n(H(),Y0()).optional()}),Q6=z0.extend({type:g("resource_link")}),a0=a([M1,O1,j1,Q6,H1]),_1=q({role:c,content:a0}),g1=D.extend({description:H().optional(),messages:f(_1)}),E1=Z.extend({method:g("notifications/prompts/list_changed"),params:K.optional()}),Y6=q({title:H().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),f1=q({taskSupport:J0(["required","optional","forbidden"]).optional()}),I1=q({...U.shape,...V.shape,description:H().optional(),inputSchema:q({type:g("object"),properties:n(H(),W).optional(),required:f(H()).optional()}).catchall(Y0()),outputSchema:q({type:g("object"),properties:n(H(),W).optional(),required:f(H()).optional()}).catchall(Y0()).optional(),annotations:Y6.optional(),execution:f1.optional(),_meta:n(H(),Y0()).optional()}),x1=b.extend({method:g("tools/list")}),h1=v.extend({tools:f(I1)}),u1=D.extend({content:f(a0),structuredContent:n(H(),Y0()).optional(),isError:o().optional()}),x0=z.extend({name:H(),arguments:n(H(),Y0()).optional()}),G6=J.extend({method:g("tools/call"),params:x0}),X5=Z.extend({method:g("notifications/tools/list_changed"),params:K.optional()}),l1=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),B6=L.extend({level:l1}),F6=J.extend({method:g("logging/setLevel"),params:B6}),L6=K.extend({level:l1,logger:H().optional(),data:Y0()}),z6=Z.extend({method:g("notifications/message"),params:L6}),J6=q({name:H().optional()}),K6=q({hints:f(J6).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),Z6=q({mode:J0(["auto","required","none"]).optional()}),Q5=q({type:g("tool_result"),toolUseId:H().describe("The unique identifier for the corresponding tool call."),content:f(a0),structuredContent:q({}).loose().optional(),isError:o().optional(),_meta:n(H(),Y0()).optional()}),$6=E5("type",[M1,O1,j1]),U1=E5("type",[M1,O1,j1,X6,Q5]),H6=q({role:c,content:a([U1,f(U1)]),_meta:n(H(),Y0()).optional()}),U6=z.extend({messages:f(H6),modelPreferences:K6.optional(),systemPrompt:H().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f(H()).optional(),metadata:X.optional(),tools:f(I1).optional(),toolChoice:Z6.optional()}),A6=J.extend({method:g("sampling/createMessage"),params:U6}),N6=D.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens"]).or(H())),role:c,content:$6}),V6=D.extend({model:H(),stopReason:X0(J0(["endTurn","stopSequence","maxTokens","toolUse"]).or(H())),role:c,content:a([U1,f(U1)])}),w6=q({type:g("boolean"),title:H().optional(),description:H().optional(),default:o().optional()}),D6=q({type:g("string"),title:H().optional(),description:H().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:H().optional()}),M6=q({type:J0(["number","integer"]),title:H().optional(),description:H().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),O6=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),default:H().optional()}),j6=q({type:g("string"),title:H().optional(),description:H().optional(),oneOf:f(q({const:H(),title:H()})),default:H().optional()}),E6=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),enumNames:f(H()).optional(),default:H().optional()}),I6=a([O6,j6]),R1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f(H())}),default:f(H()).optional()}),T1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:H(),title:H()}))}),default:f(H()).optional()}),Y5=a([R1,T1]),G5=a([E6,I6,Y5]),i0=a([G5,w6,D6,M6]),n0=z.extend({mode:g("form").optional(),message:H(),requestedSchema:q({type:g("object"),properties:n(H(),i0),required:f(H()).optional()}).catchall(Y0())}),R6=z.extend({mode:g("url"),message:H(),elicitationId:H(),url:H().url()}),Y1=a([n0,R6]),B5=J.extend({method:g("elicitation/create"),params:Y1}),F5=K.extend({elicitationId:H()}),L5=Z.extend({method:g("notifications/elicitation/complete"),params:F5}),z5=D.extend({action:J0(["accept","decline","cancel"]),content:k6((h0)=>h0===null?void 0:h0,n(H(),a([H(),m(),o(),f(H())])).optional())}),J5=q({type:g("ref/resource"),uri:H()}),K5=q({type:g("ref/prompt"),name:H()}),Z5=L.extend({ref:a([K5,J5]),argument:q({name:H(),value:H()}),context:q({arguments:n(H(),H()).optional()}).optional()}),T6=J.extend({method:g("completion/complete"),params:Z5}),$5=D.extend({completion:F0({values:f(H()).max(100),total:X0(m().int()),hasMore:X0(o())})}),H5=q({uri:H().startsWith("file://"),name:H().optional(),_meta:n(H(),Y0()).optional()}),m1=J.extend({method:g("roots/list"),params:L.optional()}),P6=D.extend({roots:f(H5)}),U5=Z.extend({method:g("notifications/roots/list_changed"),params:K.optional()}),A5=F0({ttl:m().optional(),pollInterval:m().optional()}),N5=J0(["working","input_required","completed","failed","cancelled"]),A1=q({taskId:H(),status:N5,ttl:a([m(),C6()]),createdAt:H(),lastUpdatedAt:H(),pollInterval:X0(m()),statusMessage:X0(H())}),c0=D.extend({task:A1}),V5=K.merge(A1),P1=Z.extend({method:g("notifications/tasks/status"),params:V5}),c1=J.extend({method:g("tasks/get"),params:L.extend({taskId:H()})}),p1=D.merge(A1),d1=J.extend({method:g("tasks/result"),params:L.extend({taskId:H()})}),F4=D.loose(),p0=b.extend({method:g("tasks/list")}),P0=v.extend({tasks:f(A1)}),S1=J.extend({method:g("tasks/cancel"),params:L.extend({taskId:H()})});return{JSONValueSchema:W,JSONObjectSchema:X,ProgressTokenSchema:Q,CursorSchema:Y,TaskMetadataSchema:G,RelatedTaskMetadataSchema:B,RequestMetaSchema:F,BaseRequestParamsSchema:L,TaskAugmentedRequestParamsSchema:z,RequestSchema:J,NotificationsParamsSchema:K,NotificationSchema:Z,ResultSchema:D,RequestIdSchema:I,EmptyResultSchema:A,CancelledNotificationParamsSchema:M,CancelledNotificationSchema:N,IconSchema:$,IconsSchema:V,BaseMetadataSchema:U,ImplementationSchema:O,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:k,InitializeRequestParamsSchema:l,InitializeRequestSchema:_,ServerCapabilitiesSchema:h,InitializeResultSchema:d,InitializedNotificationSchema:p,PingRequestSchema:K0,ProgressSchema:O0,ProgressNotificationParamsSchema:w0,ProgressNotificationSchema:S0,PaginatedRequestParamsSchema:$0,PaginatedRequestSchema:b,PaginatedResultSchema:v,ResourceContentsSchema:u,TextResourceContentsSchema:E,BlobResourceContentsSchema:C,RoleSchema:c,AnnotationsSchema:r,ResourceSchema:z0,ResourceTemplateSchema:e,ListResourcesRequestSchema:D0,ListResourcesResultSchema:u0,ListResourceTemplatesRequestSchema:P,ListResourceTemplatesResultSchema:y,ResourceRequestParamsSchema:x,ReadResourceRequestParamsSchema:s,ReadResourceRequestSchema:t,ReadResourceResultSchema:L0,ResourceListChangedNotificationSchema:T0,SubscribeRequestParamsSchema:C0,SubscribeRequestSchema:f0,UnsubscribeRequestParamsSchema:b0,UnsubscribeRequestSchema:j0,ResourceUpdatedNotificationParamsSchema:o0,ResourceUpdatedNotificationSchema:k0,PromptArgumentSchema:B1,PromptSchema:Q1,ListPromptsRequestSchema:F1,ListPromptsResultSchema:Z1,GetPromptRequestParamsSchema:$1,GetPromptRequestSchema:D1,TextContentSchema:M1,ImageContentSchema:O1,AudioContentSchema:j1,ToolUseContentSchema:X6,EmbeddedResourceSchema:H1,ResourceLinkSchema:Q6,ContentBlockSchema:a0,PromptMessageSchema:_1,GetPromptResultSchema:g1,PromptListChangedNotificationSchema:E1,ToolAnnotationsSchema:Y6,ToolExecutionSchema:f1,ToolSchema:I1,ListToolsRequestSchema:x1,ListToolsResultSchema:h1,CallToolResultSchema:u1,CallToolRequestParamsSchema:x0,CallToolRequestSchema:G6,ToolListChangedNotificationSchema:X5,LoggingLevelSchema:l1,SetLevelRequestParamsSchema:B6,SetLevelRequestSchema:F6,LoggingMessageNotificationParamsSchema:L6,LoggingMessageNotificationSchema:z6,ModelHintSchema:J6,ModelPreferencesSchema:K6,ToolChoiceSchema:Z6,ToolResultContentSchema:Q5,SamplingContentSchema:$6,SamplingMessageContentBlockSchema:U1,SamplingMessageSchema:H6,CreateMessageRequestParamsSchema:U6,CreateMessageRequestSchema:A6,CreateMessageResultSchema:N6,CreateMessageResultWithToolsSchema:V6,BooleanSchemaSchema:w6,StringSchemaSchema:D6,NumberSchemaSchema:M6,UntitledSingleSelectEnumSchemaSchema:O6,TitledSingleSelectEnumSchemaSchema:j6,LegacyTitledEnumSchemaSchema:E6,SingleSelectEnumSchemaSchema:I6,UntitledMultiSelectEnumSchemaSchema:R1,TitledMultiSelectEnumSchemaSchema:T1,MultiSelectEnumSchemaSchema:Y5,EnumSchemaSchema:G5,PrimitiveSchemaDefinitionSchema:i0,ElicitRequestFormParamsSchema:n0,ElicitRequestURLParamsSchema:R6,ElicitRequestParamsSchema:Y1,ElicitRequestSchema:B5,ElicitationCompleteNotificationParamsSchema:F5,ElicitationCompleteNotificationSchema:L5,ElicitResultSchema:z5,ResourceTemplateReferenceSchema:J5,PromptReferenceSchema:K5,CompleteRequestParamsSchema:Z5,CompleteRequestSchema:T6,CompleteResultSchema:$5,RootSchema:H5,ListRootsRequestSchema:m1,ListRootsResultSchema:P6,RootsListChangedNotificationSchema:U5,TaskCreationParamsSchema:A5,TaskStatusSchema:N5,TaskSchema:A1,CreateTaskResultSchema:c0,TaskStatusNotificationParamsSchema:V5,TaskStatusNotificationSchema:P1,GetTaskRequestSchema:c1,GetTaskResultSchema:p1,GetTaskPayloadRequestSchema:d1,GetTaskPayloadResultSchema:F4,ListTasksRequestSchema:p0,ListTasksResultSchema:P0,CancelTaskRequestSchema:S1,CancelTaskResultSchema:D.merge(A1),ClientRequestSchema:a([K0,_,T6,F6,D1,F1,D0,P,t,f0,j0,G6,x1,c1,d1,p0,S1]),ClientNotificationSchema:a([N,S0,p,U5,P1]),ClientResultSchema:a([A,N6,V6,z5,P6,p1,P0,c0]),ServerRequestSchema:a([K0,A6,B5,m1,c1,d1,p0,S1]),ServerNotificationSchema:a([N,S0,z6,k0,T0,X5,E1,P1,L5]),ServerResultSchema:a([A,d,$5,g1,Z1,u0,y,L0,u1,h1,p1,P0,c0]),CallToolResultWireSchema:Y0().superRefine((h0,FY)=>{if(typeof h0!=="object"||h0===null||Array.isArray(h0)||h0.content!==void 0)return;for(let QW of Y$)if(QW in h0){FY.addIssue({code:"custom",message:`content is required when the body carries '${QW}' \u2014 another result family cannot default into an empty tools/call success`});return}}).transform(kD).pipe(u1)}}function G$(){return yD??=vD()}function B$(W){return W.type!=="object"}function fD(W){let X=typeof W.$schema==="string"?W.$schema:void 0;if(W.$id!==void 0)return{...X!==void 0&&{$schema:X},type:"object",properties:{result:W},required:["result"]};let Q=(Y,G)=>{if(Array.isArray(Y))return Y.map((F)=>Q(F,!1));if(Y===null||typeof Y!=="object")return Y;if(!G&&Y.$id!==void 0)return Y;let B={};for(let[F,L]of Object.entries(Y))if(G)B[F]=Q(L,!1);else if((F==="$ref"||F==="$dynamicRef")&&typeof L==="string")B[F]=L==="#"?"#/properties/result":L.startsWith("#/")?`#/properties/result${L.slice(1)}`:L;else if(_D.has(F))B[F]=L;else if(gD.has(F))B[F]=Q(L,!0);else B[F]=Q(L,!1);return B};return{...X!==void 0&&{$schema:X},type:"object",properties:{result:Q(W,!1)},required:["result"]}}function s7(){if(SQ)return SQ;let W=G$();return SQ={requestSchemas:{ping:W.PingRequestSchema,initialize:W.InitializeRequestSchema,"completion/complete":W.CompleteRequestSchema,"logging/setLevel":W.SetLevelRequestSchema,"prompts/get":W.GetPromptRequestSchema,"prompts/list":W.ListPromptsRequestSchema,"resources/list":W.ListResourcesRequestSchema,"resources/templates/list":W.ListResourceTemplatesRequestSchema,"resources/read":W.ReadResourceRequestSchema,"resources/subscribe":W.SubscribeRequestSchema,"resources/unsubscribe":W.UnsubscribeRequestSchema,"tools/call":W.CallToolRequestSchema,"tools/list":W.ListToolsRequestSchema,"tasks/get":W.GetTaskRequestSchema,"tasks/result":W.GetTaskPayloadRequestSchema,"tasks/list":W.ListTasksRequestSchema,"tasks/cancel":W.CancelTaskRequestSchema,"sampling/createMessage":W.CreateMessageRequestSchema,"elicitation/create":W.ElicitRequestSchema,"roots/list":W.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":W.CancelledNotificationSchema,"notifications/progress":W.ProgressNotificationSchema,"notifications/initialized":W.InitializedNotificationSchema,"notifications/roots/list_changed":W.RootsListChangedNotificationSchema,"notifications/tasks/status":W.TaskStatusNotificationSchema,"notifications/message":W.LoggingMessageNotificationSchema,"notifications/resources/updated":W.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":W.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":W.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":W.PromptListChangedNotificationSchema,"notifications/elicitation/complete":W.ElicitationCompleteNotificationSchema},resultSchemas:{ping:W.EmptyResultSchema,initialize:W.InitializeResultSchema,"completion/complete":W.CompleteResultSchema,"logging/setLevel":W.EmptyResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"resources/subscribe":W.EmptyResultSchema,"resources/unsubscribe":W.EmptyResultSchema,"tools/call":W.CallToolResultWireSchema,"tools/list":W.ListToolsResultSchema,"sampling/createMessage":W.CreateMessageResultWithToolsSchema,"elicitation/create":W.ElicitResultSchema,"roots/list":W.ListRootsResultSchema}},SQ}function z$(W){return Object.prototype.hasOwnProperty.call(F$,W)}function J$(W){return Object.prototype.hasOwnProperty.call(L$,W)}function hD(W){return Object.prototype.hasOwnProperty.call(xD,W)}function uD(W){return hD(W)?s7().resultSchemas[W]:void 0}function lD(W){return z$(W)?s7().requestSchemas[W]:void 0}function mD(W){return J$(W)?s7().notificationSchemas[W]:void 0}function d7(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function bQ(W,X){if(W===void 0)return{ok:!1,reason:"not-in-era"};let Q=W.safeParse(X);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}function dZ(W){return d7(W)&&d7(W.outputSchema)&&B$(W.outputSchema)}function iZ(W){return W}function cD(){let W=l5(()=>a([H(),m(),o(),C6(),n(H(),W),f(W)])),X=n(H(),W),Q=a([H(),m().int()]),Y=H(),G=a([H(),m().int()]),B=J0(["user","assistant"]),F=J0(["debug","info","notice","warning","error","critical","alert","emergency"]),L=H().refine((P0)=>{try{return atob(P0),!0}catch{return!1}},{message:"Invalid Base64 string"}),z=q({ttl:m().optional()}),J=q({taskId:H()}),K=F0({progressToken:Q.optional(),"io.modelcontextprotocol/related-task":J.optional()}),Z=q({_meta:K.optional()}),D=Z.extend({task:z.optional()}),I=q({_meta:K.optional()}),A=q({method:H(),params:I.loose().optional()}),M=q({src:H(),mimeType:H().optional(),sizes:f(H()).optional(),theme:J0(["light","dark"]).optional()}),N=q({icons:f(M).optional()}),$=q({name:H(),title:H().optional()}),V=$.extend({...$.shape,...N.shape,version:H(),websiteUrl:H().optional(),description:H().optional()}),U=v1(q({applyDefaults:o().optional()}),X),O=k6((P0)=>{if(P0&&typeof P0==="object"&&!Array.isArray(P0)&&Object.keys(P0).length===0)return{form:{}};return P0},v1(q({form:U.optional(),url:X.optional()}),X.optional())),R=F0({list:X.optional(),cancel:X.optional(),requests:F0({sampling:F0({createMessage:X.optional()}).optional(),elicitation:F0({create:X.optional()}).optional()}).optional()}),j=F0({list:X.optional(),cancel:X.optional(),requests:F0({tools:F0({call:X.optional()}).optional()}).optional()}),w=q({experimental:n(H(),X).optional(),sampling:q({context:X.optional(),tools:X.optional()}).optional(),elicitation:O.optional(),roots:q({listChanged:o().optional()}).optional(),tasks:R.optional(),extensions:n(H(),X).optional()}),T=q({experimental:n(H(),X).optional(),logging:X.optional(),completions:X.optional(),prompts:q({listChanged:o().optional()}).optional(),resources:q({subscribe:o().optional(),listChanged:o().optional()}).optional(),tools:q({listChanged:o().optional()}).optional(),tasks:j.optional(),extensions:n(H(),X).optional()}),k=q({progress:m(),total:X0(m()),message:X0(H())}),l=q({...I.shape,...k.shape,progressToken:Q}),_=A.extend({method:g("notifications/progress"),params:l}),h=I.extend({level:F,logger:H().optional(),data:Y0()}),d=A.extend({method:g("notifications/message"),params:h}),p=q({uri:H(),mimeType:X0(H()),_meta:n(H(),Y0()).optional()}),K0=p.extend({text:H()}),O0=p.extend({blob:L}),w0=q({audience:f(B).optional(),priority:m().min(0).max(1).optional(),lastModified:q1.datetime({offset:!0}).optional()}),S0=q({...$.shape,...N.shape,uri:H(),description:X0(H()),mimeType:X0(H()),size:X0(m()),annotations:w0.optional(),_meta:X0(F0({}))}),$0=q({...$.shape,...N.shape,uriTemplate:H(),description:X0(H()),mimeType:X0(H()),annotations:w0.optional(),_meta:X0(F0({}))}),b=A.extend({method:g("notifications/resources/list_changed"),params:I.optional()}),v=I.extend({uri:H()}),u=A.extend({method:g("notifications/resources/updated"),params:v}),E=q({name:H(),description:X0(H()),required:X0(o())}),S=q({...$.shape,...N.shape,description:X0(H()),arguments:X0(f(E)),_meta:X0(F0({}))}),C=A.extend({method:g("notifications/prompts/list_changed"),params:I.optional()}),c=q({type:g("text"),text:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),r=q({type:g("image"),data:L,mimeType:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),z0=q({type:g("audio"),data:L,mimeType:H(),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),e=q({type:g("tool_use"),name:H(),id:H(),input:n(H(),Y0()),_meta:n(H(),Y0()).optional()}),D0=q({type:g("resource"),resource:a([K0,O0]),annotations:w0.optional(),_meta:n(H(),Y0()).optional()}),u0=S0.extend({type:g("resource_link")}),P=a([c,r,z0,u0,D0]),y=q({role:B,content:P}),x=q({title:H().optional(),readOnlyHint:o().optional(),destructiveHint:o().optional(),idempotentHint:o().optional(),openWorldHint:o().optional()}),s=A.extend({method:g("notifications/tools/list_changed"),params:I.optional()}),t=q({name:H().optional()}),L0=q({hints:f(t).optional(),costPriority:m().min(0).max(1).optional(),speedPriority:m().min(0).max(1).optional(),intelligencePriority:m().min(0).max(1).optional()}),T0=q({mode:J0(["auto","required","none"]).optional()}),C0=q({type:g("boolean"),title:H().optional(),description:H().optional(),default:o().optional()}),f0=q({type:g("string"),title:H().optional(),description:H().optional(),minLength:m().optional(),maxLength:m().optional(),format:J0(["email","uri","date","date-time"]).optional(),default:H().optional()}),b0=q({type:J0(["number","integer"]),title:H().optional(),description:H().optional(),minimum:m().optional(),maximum:m().optional(),default:m().optional()}),j0=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),default:H().optional()}),o0=q({type:g("string"),title:H().optional(),description:H().optional(),oneOf:f(q({const:H(),title:H()})),default:H().optional()}),k0=q({type:g("string"),title:H().optional(),description:H().optional(),enum:f(H()),enumNames:f(H()).optional(),default:H().optional()}),B1=a([j0,o0]),Q1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({type:g("string"),enum:f(H())}),default:f(H()).optional()}),F1=q({type:g("array"),title:H().optional(),description:H().optional(),minItems:m().optional(),maxItems:m().optional(),items:q({anyOf:f(q({const:H(),title:H()}))}),default:f(H()).optional()}),Z1=a([Q1,F1]),$1=a([k0,B1,Z1]),D1=a([$1,C0,f0,b0]),M1=D.extend({mode:g("form").optional(),message:H(),requestedSchema:q({type:g("object"),properties:n(H(),D1),required:f(H()).optional()}).catchall(Y0())}),O1=q({type:g("ref/resource"),uri:H()}),j1=q({type:g("ref/prompt"),name:H()}),X6=q({uri:H().startsWith("file://"),name:H().optional(),_meta:n(H(),Y0()).optional()}),H1=w.shape,Q6=q({experimental:H1.experimental,sampling:H1.sampling,elicitation:H1.elicitation,roots:H1.roots,extensions:H1.extensions}),a0=T.shape,_1=q({experimental:a0.experimental,logging:a0.logging,completions:a0.completions,prompts:a0.prompts,resources:a0.resources,tools:a0.tools,extensions:a0.extensions}),g1=F0({progressToken:Q.optional(),[r1]:H(),[y6]:V.optional(),[C1]:Q6,[o1]:F.optional()}),E1=q({...$.shape,...N.shape,description:H().optional(),inputSchema:F0({$schema:H().optional(),type:g("object")}),outputSchema:F0({$schema:H().optional()}).optional(),annotations:x.optional(),_meta:n(H(),Y0()).optional()}),Y6=q({type:g("tool_result"),toolUseId:H(),content:f(P),structuredContent:Y0().optional(),isError:o().optional(),_meta:n(H(),Y0()).optional()}),f1=a([c,r,z0,e,Y6]),I1=q({role:B,content:a([f1,f(f1)]),_meta:n(H(),Y0()).optional()}),x1=H(),h1=F0({[w1]:V.optional().catch(void 0)}),u1=h1.optional();function x0(P0){return F0({_meta:u1,resultType:x1.default("complete"),...P0})}let G6=x0({}),X5=x0({nextCursor:Y.optional()}),l1=x0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),B6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(E1),nextCursor:Y.optional()}),F6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),L6=x0({description:H().optional(),messages:f(y)}),z6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),J6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f($0),nextCursor:Y.optional()}),K6=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,O0]))}),Z6=x0({completion:q({values:f(H()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),Q5=x0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"])}),$6=x0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f(H()),capabilities:_1,instructions:H().optional()}),U1=q({messages:f(I1),modelPreferences:L0.optional(),systemPrompt:H().optional(),includeContext:J0(["none","thisServer","allServers"]).optional(),temperature:m().optional(),maxTokens:m().int(),stopSequences:f(H()).optional(),metadata:X.optional(),tools:f(E1).optional(),toolChoice:T0.optional()}),H6=q({method:g("sampling/createMessage"),params:U1}),U6=q({method:g("roots/list"),params:q({_meta:n(H(),Y0()).optional()}).optional()}),A6=q({...I1.shape,model:H(),stopReason:H().optional()}),N6=q({roots:f(X6)}),V6=q({action:J0(["accept","decline","cancel"]),content:n(H(),a([H(),m(),o(),f(H())])).optional()}),w6=q({mode:g("url"),message:H(),url:H().url()}),D6=a([M1,w6]),M6=q({method:g("elicitation/create"),params:D6}),O6=a([H6,U6,M6]),j6=a([A6,N6,V6]),E6=n(H(),O6),I6=n(H(),j6),R1=x0({inputRequests:E6.optional(),requestState:H().optional()}),T1={inputResponses:I6.optional(),requestState:H().optional()},Y5=q({_meta:g1,...T1}),G5=F0({progressToken:Q.optional()});function i0(P0,S1){return q({method:g(P0),params:q({_meta:g1,...S1})})}function n0(P0,S1){return q({method:g(P0),params:q({_meta:G5.optional(),...S1}).optional()})}let R6={name:H(),arguments:n(H(),Y0()).optional(),...T1},Y1={cursor:Y.optional()},B5=i0("tools/call",R6),F5=i0("tools/list",Y1),L5=i0("prompts/list",Y1),z5=i0("prompts/get",{name:H(),arguments:n(H(),H()).optional(),...T1}),J5=i0("resources/list",Y1),K5=i0("resources/templates/list",Y1),Z5=i0("resources/read",{uri:H(),...T1}),T6={ref:a([j1,O1]),argument:q({name:H(),value:H()}),context:q({arguments:n(H(),H()).optional()}).optional()},$5=i0("completion/complete",T6),H5=i0("server/discover",{}),m1=q({toolsListChanged:o().optional(),promptsListChanged:o().optional(),resourcesListChanged:o().optional(),resourceSubscriptions:f(H()).optional()}),P6={notifications:m1},U5=i0("subscriptions/listen",P6),A5=h1.extend({"io.modelcontextprotocol/subscriptionId":G}),N5=F0({_meta:A5,resultType:x1.default("complete")}),A1={"tools/call":n0("tools/call",R6),"tools/list":n0("tools/list",Y1),"prompts/get":n0("prompts/get",{name:H(),arguments:n(H(),H()).optional()}),"prompts/list":n0("prompts/list",Y1),"resources/list":n0("resources/list",Y1),"resources/templates/list":n0("resources/templates/list",Y1),"resources/read":n0("resources/read",{uri:H()}),"completion/complete":n0("completion/complete",T6),"server/discover":n0("server/discover",{}),"subscriptions/listen":n0("subscriptions/listen",P6)};function c0(P0){return F0({_meta:u1,...P0})}let V5={"tools/call":c0({content:f(P),structuredContent:Y0().optional(),isError:o().optional()}),"tools/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),tools:f(E1),nextCursor:Y.optional()}),"prompts/get":c0({description:H().optional(),messages:f(y)}),"prompts/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),prompts:f(S),nextCursor:Y.optional()}),"resources/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resources:f(S0),nextCursor:Y.optional()}),"resources/templates/list":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),resourceTemplates:f($0),nextCursor:Y.optional()}),"resources/read":c0({ttlMs:m().int().min(0),cacheScope:J0(["public","private"]),contents:f(a([K0,O0]))}),"completion/complete":c0({completion:q({values:f(H()).max(100),total:m().int().optional(),hasMore:o().optional()}).loose()}),"server/discover":c0({ttlMs:m().int().min(0).catch(0),cacheScope:J0(["public","private"]).catch("private"),supportedVersions:f(H()),capabilities:_1,instructions:H().optional()}),"subscriptions/listen":c0({})},P1=F0({"io.modelcontextprotocol/subscriptionId":G.optional()}),c1=q({method:g("notifications/subscriptions/acknowledged"),params:q({_meta:P1.optional(),notifications:m1})}),p1=q({_meta:P1.optional(),requestId:G,reason:H().optional()}),d1=q({method:g("notifications/cancelled"),params:p1}),F4={"notifications/cancelled":d1,"notifications/progress":_,"notifications/message":d,"notifications/resources/updated":u,"notifications/resources/list_changed":b,"notifications/tools/list_changed":s,"notifications/prompts/list_changed":C,"notifications/subscriptions/acknowledged":c1},p0=(P0)=>q({jsonrpc:g("2.0"),id:a([H(),m().int()]),result:P0}).strict();return{JSONValueSchema:W,JSONObjectSchema:X,ProgressTokenSchema:Q,CursorSchema:Y,RequestIdSchema:G,RoleSchema:B,LoggingLevelSchema:F,TaskMetadataSchema:z,RelatedTaskMetadataSchema:J,RequestMetaSchema:K,BaseRequestParamsSchema:Z,TaskAugmentedRequestParamsSchema:D,NotificationsParamsSchema:I,NotificationSchema:A,IconSchema:M,IconsSchema:N,BaseMetadataSchema:$,ImplementationSchema:V,ClientTasksCapabilitySchema:R,ServerTasksCapabilitySchema:j,ClientCapabilitiesSchema:w,ServerCapabilitiesSchema:T,ProgressSchema:k,ProgressNotificationParamsSchema:l,ProgressNotificationSchema:_,LoggingMessageNotificationParamsSchema:h,LoggingMessageNotificationSchema:d,ResourceContentsSchema:p,TextResourceContentsSchema:K0,BlobResourceContentsSchema:O0,AnnotationsSchema:w0,ResourceSchema:S0,ResourceTemplateSchema:$0,ResourceListChangedNotificationSchema:b,ResourceUpdatedNotificationParamsSchema:v,ResourceUpdatedNotificationSchema:u,PromptArgumentSchema:E,PromptSchema:S,PromptListChangedNotificationSchema:C,TextContentSchema:c,ImageContentSchema:r,AudioContentSchema:z0,ToolUseContentSchema:e,EmbeddedResourceSchema:D0,ResourceLinkSchema:u0,ContentBlockSchema:P,PromptMessageSchema:y,ToolAnnotationsSchema:x,ToolListChangedNotificationSchema:s,ModelHintSchema:t,ModelPreferencesSchema:L0,ToolChoiceSchema:T0,BooleanSchemaSchema:C0,StringSchemaSchema:f0,NumberSchemaSchema:b0,UntitledSingleSelectEnumSchemaSchema:j0,TitledSingleSelectEnumSchemaSchema:o0,LegacyTitledEnumSchemaSchema:k0,SingleSelectEnumSchemaSchema:B1,UntitledMultiSelectEnumSchemaSchema:Q1,TitledMultiSelectEnumSchemaSchema:F1,MultiSelectEnumSchemaSchema:Z1,EnumSchemaSchema:$1,PrimitiveSchemaDefinitionSchema:D1,ElicitRequestFormParamsSchema:M1,ResourceTemplateReferenceSchema:O1,PromptReferenceSchema:j1,RootSchema:X6,ClientCapabilities2026Schema:Q6,ServerCapabilities2026Schema:_1,RequestMetaEnvelopeSchema:g1,ToolSchema:E1,ToolResultContentSchema:Y6,SamplingMessageContentBlockSchema:f1,SamplingMessageSchema:I1,ResultTypeSchema:x1,ResultMetaSchema:h1,ResultSchema:G6,PaginatedResultSchema:X5,CallToolResultSchema:l1,ListToolsResultSchema:B6,ListPromptsResultSchema:F6,GetPromptResultSchema:L6,ListResourcesResultSchema:z6,ListResourceTemplatesResultSchema:J6,ReadResourceResultSchema:K6,CompleteResultSchema:Z6,CacheableResultSchema:Q5,DiscoverResultSchema:$6,CreateMessageRequestParamsSchema:U1,CreateMessageRequestSchema:H6,ListRootsRequestSchema:U6,CreateMessageResultSchema:A6,ListRootsResultSchema:N6,ElicitResultSchema:V6,ElicitRequestURLParamsSchema:w6,ElicitRequestParamsSchema:D6,ElicitRequestSchema:M6,InputRequestSchema:O6,InputResponseSchema:j6,InputRequestsSchema:E6,InputResponsesSchema:I6,InputRequiredResultSchema:R1,InputResponseRequestParamsSchema:Y5,CallToolRequestSchema:B5,ListToolsRequestSchema:F5,ListPromptsRequestSchema:L5,GetPromptRequestSchema:z5,ListResourcesRequestSchema:J5,ListResourceTemplatesRequestSchema:K5,ReadResourceRequestSchema:Z5,CompleteRequestSchema:$5,DiscoverRequestSchema:H5,SubscriptionFilterSchema:m1,SubscriptionsListenRequestSchema:U5,SubscriptionsListenResultMetaSchema:A5,SubscriptionsListenResultSchema:N5,dispatchRequestSchemas:A1,dispatchResultSchemas:V5,NotificationMetaSchema:P1,SubscriptionsAcknowledgedNotificationSchema:c1,CancelledNotificationParamsSchema:p1,CancelledNotificationSchema:d1,notificationSchemas2026:F4,JSONRPCResultResponseSchema:p0(G6),CallToolResultResponseSchema:p0(a([l1,R1])),ListToolsResultResponseSchema:p0(B6),ListPromptsResultResponseSchema:p0(F6),GetPromptResultResponseSchema:p0(a([L6,R1])),ListResourcesResultResponseSchema:p0(z6),ListResourceTemplatesResultResponseSchema:p0(J6),ReadResourceResultResponseSchema:p0(a([K6,R1])),CompleteResultResponseSchema:p0(Z6),DiscoverResultResponseSchema:p0($6)}}function y4(){return pD??=cD()}function iD(W){return dD.includes(W)}function nD(W){return W[e7]}function K$(W){return typeof W==="number"&&Number.isSafeInteger(W)&&W>=0}function Z$(W){return W==="public"||W==="private"}function sD(W,X){let Q=X.resultType;if(Q===void 0)return{...X,resultType:"complete"};if(Q==="complete")return X;if(aD.includes(W))return X;throw new m0(M0.InternalError,`Handler for ${W} returned resultType '${String(Q)}', but results of ${W} only support 'complete' on protocol revision 2026-07-28`)}function tD(W,X){let Q=nD(X);if(X.resultType!=="complete"||!iD(W))return Q===void 0?X:YM(X);let Y=X,G=K$(Y.ttlMs)?Y.ttlMs:XM(Q),B=Z$(Y.cacheScope)?Y.cacheScope:QM(Q),F={...Y,ttlMs:G,cacheScope:B};return delete F[e7],F}function eD(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function WM(W,X){if(X===void 0)return W;let Q=W._meta;if(Q===void 0)return{...W,_meta:{[w1]:X}};if(!eD(Q))return W;if(Q[w1]!==void 0)return W;return{...W,_meta:{...Q,[w1]:X}}}function XM(W){return W!==void 0&&K$(W.ttlMs)?W.ttlMs:rD}function QM(W){return W!==void 0&&Z$(W.cacheScope)?W.cacheScope:oD}function YM(W){let X={...W};return delete X[e7],X}function A$(){if(qQ)return qQ;let W=y4();return qQ={request:{"elicitation/create":q({method:g("elicitation/create"),params:W.ElicitRequestParamsSchema}),"sampling/createMessage":q({method:g("sampling/createMessage"),params:W.CreateMessageRequestParamsSchema}),"roots/list":q({method:g("roots/list"),params:F0({}).optional()})},response:{"elicitation/create":W.ElicitResultSchema,"sampling/createMessage":W.CreateMessageResultSchema,"roots/list":W.ListRootsResultSchema}},qQ}function N$(W){return GM.includes(W)}function u7(W){return N$(W)?A$().request[W]:void 0}function BM(W){return N$(W)?A$().response[W]:void 0}function w$(W){return Object.prototype.hasOwnProperty.call(WB,W)}function D$(W){return Object.prototype.hasOwnProperty.call(V$,W)}function FM(W){return Object.prototype.hasOwnProperty.call(WB,W)}function LM(W){return w$(W)?y4().dispatchRequestSchemas[W]:void 0}function zM(W){return FM(W)?y4().dispatchResultSchemas[W]:void 0}function JM(W){return D$(W)?y4().notificationSchemas2026[W]:void 0}function LX(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function BX(W,X){if(W===void 0)return{ok:!1,reason:"not-in-era"};let Q=W.safeParse(X);return Q.success?{ok:!0,value:Q.data}:{ok:!1,reason:"invalid",message:String(Q.error)}}function $M(W,X){let Q=X,Y=!1,G=()=>{if(!Y)Q={...Q},Y=!0;return Q},B=X.tools;if(W==="tools/list"&&Array.isArray(B)&&B.some((L)=>LX(L)&&("execution"in L)))G().tools=B.map((L)=>{if(!LX(L)||!("execution"in L))return L;let z={...L};return delete z.execution,z});let F=X.capabilities;if(LX(F)&&"tasks"in F){let L={...F};delete L.tasks,G().capabilities=L}return Q}function HM(){if(CQ)return CQ;let W=y4();return CQ={"tools/call":W.CallToolResultSchema,"tools/list":W.ListToolsResultSchema,"prompts/get":W.GetPromptResultSchema,"prompts/list":W.ListPromptsResultSchema,"resources/list":W.ListResourcesResultSchema,"resources/templates/list":W.ListResourceTemplatesResultSchema,"resources/read":W.ReadResourceResultSchema,"completion/complete":W.CompleteResultSchema,"server/discover":W.DiscoverResultSchema},CQ}function v5(W){return W!==void 0&&B4(W)?XB:t7}function nZ(W){if(W.revision!==void 0)return v5(W.revision).era;return W.era==="modern"?XB.era:t7.era}function l7(W){return M$.some((X)=>X.hasRequestMethod(W))}function m7(W){return M$.some((X)=>X.hasNotificationMethod(W))}function YB(W){let X=[],Q=new Map,Y=(B,F,L)=>{if(B===null||typeof B!=="object")return;let z=B;if(rZ in z){if(!L||F.length===0)return`${kQ(F)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let K=z[rZ];if(typeof K!=="string"||K.length===0)return`${kQ(F)}: x-mcp-header MUST be a non-empty string`;if(!NM.test(K))return`${kQ(F)}: x-mcp-header '${K}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let Z=typeof z.type==="string"?z.type:void 0;if(Z===void 0||!VM.has(Z))return`${kQ(F)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${Z??"<none>"}`;let D=K.toLowerCase(),I=Q.get(D);if(I!==void 0)return`x-mcp-header '${K}' is not case-insensitively unique (also declared as '${I}')`;Q.set(D,K),X.push({path:F,headerName:K,type:Z})}let J=z.properties;if(J!==null&&typeof J==="object")for(let[K,Z]of Object.entries(J)){let D=Y(Z,[...F,K],L);if(D!==void 0)return D}for(let K of wM){let Z=z[K];if(Z===void 0)continue;let D=Array.isArray(Z)?Z:Z!==null&&typeof Z==="object"&&DM.has(K)?Object.values(Z):[Z];for(let I of D){let A=Y(I,[...F,`<${K}>`],!1);if(A!==void 0)return A}}},G=Y(W,[],!0);return G===void 0?{valid:!0,declarations:X}:{valid:!1,reason:G}}function kQ(W){return W.length===0?"<root>":W.join(".")}function MM(W){if(typeof W==="string")return W;if(typeof W==="boolean")return W?"true":"false";if(typeof W==="number"){if(!Number.isFinite(W))return;if(Number.isInteger(W)&&!Number.isSafeInteger(W))return;return String(W)}}function OM(W){if(W.length===0)return!0;if(W.startsWith(E$)&&W.endsWith(I$))return!0;if(W!==W.trim())return!0;for(let X=0;X<W.length;X++){let Q=W.codePointAt(X);if(Q===9||Q>=32&&Q<=126)continue;return!0}return!1}function jM(W){let X=new TextEncoder().encode(W),Q="";for(let Y of X)Q+=String.fromCodePoint(Y);return btoa(Q)}function R$(W){return OM(W)?`${E$}${jM(W)}${I$}`:W}function EM(W,X){let Q=W;for(let Y of X){if(Q===null||typeof Q!=="object")return;Q=Q[Y]}return Q}function T$(W,X){let Q={};for(let Y of W){let G=EM(X,Y.path);if(G===void 0||G===null)continue;let B=MM(G);if(B===void 0)continue;Q[`${AM}${Y.headerName}`]=R$(B)}return Q}function fQ(W,X){return n4(W,X)}function FX(W){return new Set(W.flatMap((X)=>Object.keys(X.shape)))}function i7(W){if(W==null)return!1;let X=typeof W;if(X!=="object"&&X!=="function")return!1;if(!("~standard"in W))return!1;return typeof W["~standard"]?.validate==="function"}function IM(W,X="input"){let Q=W["~standard"],Y;if(Q.jsonSchema)Y=Q.jsonSchema[X]({target:n7});else if(Q.vendor==="zod"){if(!("_zod"in W))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!oZ)oZ=!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.");Y=$4(W,{target:n7,io:X})}else throw Error(`Schema library "${Q.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(X==="output"){if(Y.type!==void 0)return Y;return P$(Y)?{type:"object",...Y}:Y}if(Y.type!==void 0&&Y.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(Y.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...Y}}function P$(W){if("properties"in W||"patternProperties"in W||"additionalProperties"in W||"required"in W)return!0;for(let X of["oneOf","anyOf","allOf"]){let Q=W[X];if(Array.isArray(Q)&&Q.length>0)return Q.every((Y)=>Y!==null&&typeof Y==="object"&&(Y.type==="object"||P$(Y)))}return!1}function RM(W){if(!W.path?.length)return W.message;return`${W.path.map((X)=>String(typeof X==="object"?X.key:X)).join(".")}: ${W.message}`}async function c7(W,X){let Q=await W["~standard"].validate(X);if(Q.issues&&Q.issues.length>0)return{success:!1,error:Q.issues.map((Y)=>RM(Y)).join(", ")};return{success:!0,data:Q.value}}function TM(W){let X=$4(W,{target:n7,io:"input"});return typeof X.pattern==="string"?X.pattern:void 0}function SM(W){let X=PM.exec(W),Q=[void 0,-1,0];if(X)Q.push(Number(X[1]));return[!1,!0].flatMap((Y)=>[!1,!0].flatMap((G)=>Q.map((B)=>q1.datetime({local:Y,offset:G,precision:B}))))}function bM(W,X){let Q;switch(W){case"email":Q=[oX()];break;case"uri":Q=[r4()];break;case"date":Q=[q1.date()];break;case"date-time":Q=SM(X);break}return new Set(Q.map((Y)=>TM(Y)).filter((Y)=>Y!==void 0))}function qM(W,X,Q){if(Q!=="zod")return!0;return bM(W,X).has(X)}function KX(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function CM(W){try{return IM(W,"input")}catch(X){let Q=X instanceof Error?X.message:String(X);throw new m0(M0.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${Q}`)}}function GB(W){return kM.has(W)||W.startsWith("x-")}function _M(W,X,Q,Y){if(!KX(W))return W;let G=typeof W.type==="string"&&Object.hasOwn(aZ,W.type)?aZ[W.type]:void 0;if(G===void 0)return W;let B={};for(let[F,L]of Object.entries(W))if(G.has(F)||GB(F))B[F]=L;else if(F==="pattern"&&W.type==="string"&&typeof W.format==="string"){if(!yM.has(W.format))B[F]=L;else if(typeof L!=="string"||!qM(W.format,L,Q))Y.push(`${X}.${F}`)}else Y.push(`${X}.${F}`);return B}function gM(W,X){let Q={},Y=[];for(let[G,B]of Object.entries(W))if(G==="properties"&&KX(B))Q[G]=Object.fromEntries(Object.entries(B).map(([F,L])=>[F,_M(L,`properties.${F}`,X,Y)]));else if(vM.has(G))Q[G]=B;else if(!GB(G))Y.push(G);if(Y.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${Y.join(", ")}`);return Q}function fM(W,X){if(!KX(W.properties))return X;let Q=Object.entries(W.properties).filter(([,Y])=>!fQ(Y4,Y).success).map(([Y])=>`properties.${Y}`);return Q.length>0?Q.join(", "):X}function r7(W,X,Q=""){if(Array.isArray(W)&&Array.isArray(X))return W.flatMap((Y,G)=>r7(Y,X[G],`${Q}[${G}]`));if(!KX(W)||!KX(X))return[];return Object.entries(W).flatMap(([Y,G])=>{let B=Q?`${Q}.${Y}`:Y;if(!Object.prototype.hasOwnProperty.call(X,Y))return GB(Y)?[]:[B];return r7(G,X[Y],B)})}function xM(W){if(!i7(W.requestedSchema))return{...W,mode:"form",requestedSchema:W.requestedSchema};let X=W.requestedSchema["~standard"].vendor,Q=gM(CM(W.requestedSchema),X),Y=fQ(s6.shape.requestedSchema,Q);if(!Y.success)throw new m0(M0.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${fM(Q,Y.error.message)}`);let G=r7(Q,Y.data);if(G.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${G.join(", ")}`);let B=(Y.data.required??[]).filter((F)=>!Object.prototype.hasOwnProperty.call(Y.data.properties,F));if(B.length>0)throw new m0(M0.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${B.join(", ")}`);return{...W,mode:"form",requestedSchema:Y.data}}function hM(W){let X=W.inputRequests!==void 0&&Object.keys(W.inputRequests).length>0,Q=typeof W.requestState==="string";if(!X&&!Q)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...W.inputRequests!==void 0&&{inputRequests:W.inputRequests},...W.requestState!==void 0&&{requestState:W.requestState}}}function S$(W){return{autoFulfill:W?.autoFulfill??uM,maxRounds:W?.maxRounds??lM}}function cM(W,X,Q){let Y=X!==void 0&&Object.keys(X).length>0;if(!Y&&Q===void 0)return W;return{...W,...Y&&{inputResponses:X},...Q!==void 0&&{requestState:Q}}}function pM(W,X){return`Multi-round-trip request '${W}' still required input after ${X} rounds (inputRequired.maxRounds)`}function dM(W,X){return new Promise((Q,Y)=>{if(X?.aborted){Y(X.reason instanceof U0?X.reason:new U0(A0.RequestTimeout,String(X.reason)));return}let G=setTimeout(()=>{X?.removeEventListener("abort",B),Q()},W),B=()=>{clearTimeout(G),Y(X?.reason instanceof U0?X.reason:new U0(A0.RequestTimeout,String(X?.reason)))};X?.addEventListener("abort",B,{once:!0})})}function iM(W){let X=new AbortController,Q=()=>X.abort(W?.reason);if(W?.addEventListener("abort",Q,{once:!0}),W?.aborted)X.abort(W.reason);return{signal:X.signal,abort:(Y)=>X.abort(Y),dispose:()=>W?.removeEventListener("abort",Q)}}async function nM(W){let{config:X,method:Q,originalParams:Y,requestOptions:G,hooks:B,signal:F}=W,L=W.flowStartedAt??Date.now(),z=W.firstPayload,J=0;while(!0){if(J+=1,J>X.maxRounds)throw new U0(A0.InputRequiredRoundsExceeded,pM(Q,X.maxRounds),{rounds:X.maxRounds,lastResult:{inputRequests:z.inputRequests,...z.requestState!==void 0&&{requestState:z.requestState}}});G.onprogress?.({progress:J,message:`Fulfilling input required by '${Q}' (round ${J})`});let K=Object.entries(z.inputRequests??{}),Z;if(K.length>0){let A=iM(F);try{let M=await Promise.all(K.map(async([N,$])=>{try{return[N,await B.dispatchInputRequest(N,$,A.signal)]}catch(V){throw A.abort(V),V}}));Z=Object.fromEntries(M)}finally{A.dispose()}}else await dM(mM,F);let D={...G.timeout!==void 0&&{timeout:G.timeout}};if(G.maxTotalTimeout!==void 0){let A=Date.now()-L,M=G.maxTotalTimeout-A;if(M<=0)throw new U0(A0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:G.maxTotalTimeout,totalElapsed:A});D.maxTotalTimeout=M}let I=await B.retry(cM(Y,Z,z.requestState),D);if(j$(I)){z={inputRequests:I.inputRequests??{},...I.requestState!==void 0&&{requestState:I.requestState}};continue}return I}}function C$(W,X){let Q=W.slice(0,-6);b$[Q]=X,q$[Q]=(Y)=>X.safeParse(Y).success}function sM(W){switch(W){case"initialize":case"notifications/initialized":return v5(void 0);case"server/discover":return v5(_Q);default:return}}function sZ(W,X){let Q=W.params;if(!zX(Q))return{message:W,lifted:{}};let Y=Q._meta,G=zX(Y)?tM.filter((z)=>(z in Y)):[],B=X==="request"?eM.filter((z)=>(z in Q)):[];if(G.length===0&&B.length===0)return{message:W,lifted:{}};let F={},L={...Q};if(G.length>0&&zX(Y)){let z={},J={...Y};for(let K of G)z[K]=Y[K],delete J[K];if(F.envelope=z,Object.keys(J).length>0)L._meta=J;else delete L._meta}for(let z of B){if(z==="inputResponses")F.inputResponses=L[z];if(z==="requestState")F.requestState=L[z];delete L[z]}return{message:{...W,params:L},lifted:F}}function tZ(W,X){let Q=W.validateResult(X,void 0);if(!Q.ok&&Q.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(Y){let G=W.validateResult(X,Y);if(G.ok)return{value:G.value};return{issues:[{message:G.reason==="invalid"?G.message:`not-in-era: ${X}`}]}}}}}function BB(W){return()=>W}function zX(W){return W!==null&&typeof W==="object"&&!Array.isArray(W)}function y$(W,X){let Q={...W};for(let Y in X){let G=Y,B=X[G];if(B===void 0)continue;let F=Q[G];Q[G]=zX(F)&&zX(B)?{...F,...B}:B}return Q}function vQ(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}function QO(W){let X={},Q=[];if(!vQ(W))return{accepted:X,droppedKeys:Q};for(let[Y,G]of Object.entries(W)){if(!vQ(G)||"method"in G||"result"in G){Q.push(Y);continue}X[Y]=G}return{accepted:X,droppedKeys:Q}}function eZ(W){throw new U0(A0.SendFailed,`ctx.mcpReq.${W} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function YO(W,X,Q,Y,G){return{sessionId:G,mcpReq:{id:W,method:X,_meta:Q?._meta,requestState:BB(void 0),signal:Y,send:()=>eZ("send"),notify:()=>eZ("notify")}}}async function GO(W,X,Q,Y,G){if(!vQ(Y)||typeof Y.method!=="string")throw new U0(A0.InvalidResult,`Invalid input request '${Q}': each inputRequests entry must be an embedded request object with a method`,{key:Q});let B=Y.method;if(!X.hasInputRequestMethod(B))throw new U0(A0.InvalidResult,`Invalid input request '${Q}': '${B}' is not an embedded request the ${X.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:Q,method:B});let F=W.getRequestHandler(B);if(F===void 0)throw new U0(A0.CapabilityNotSupported,`Cannot fulfil input request '${Q}': no handler is registered for '${B}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:Q,method:B});let L=vQ(Y.params)?Y.params:void 0;return await F({jsonrpc:"2.0",id:Q,method:B,...L!==void 0&&{params:L}},W.buildContext(YO(Q,B,L,G,W.sessionId)))}function BO(W,X){return{...W?.signal!==void 0&&{signal:W.signal},...W?.onprogress!==void 0&&{onprogress:W.onprogress},...W?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:W.resetTimeoutOnProgress},...W?.headers!==void 0&&{headers:W.headers},...X.timeout!==void 0&&{timeout:X.timeout},...X.maxTotalTimeout!==void 0&&{maxTotalTimeout:X.maxTotalTimeout},allowInputRequired:!0}}function _$(W,X,Q,Y){let{codec:G,request:B,options:F,flowStartedAt:L}=Y,z={inputRequests:Q.inputRequests,...Q.requestState!==void 0&&{requestState:Q.requestState}},J={dispatchInputRequest:(K,Z,D)=>GO(W,G,K,Z,D),retry:(K,Z)=>Y.retry(K,BO(F,Z))};return nM({config:X,method:B.method,originalParams:B.params,firstPayload:z,flowStartedAt:L,signal:F?.signal,requestOptions:{...F?.timeout!==void 0&&{timeout:F.timeout},...F?.maxTotalTimeout!==void 0&&{maxTotalTimeout:F.maxTotalTimeout},...F?.onprogress!==void 0&&{onprogress:F.onprogress}},hooks:J})}function FO(W){return{resultType:"input_required",inputRequests:W.inputRequests,...W.requestState!==void 0&&{requestState:W.requestState}}}function f$(W){return q5.parse(JSON.parse(W))}function LB(W){return JSON.stringify(W)+`
211
+ `}var p7,CD,A0,U0,W$,X$="2026-07-28",o7,Y$,yD,_D,gD,F$,L$,xD,SQ,oS,aS,pZ,t7,pD,dD,e7,M0,m0,$$,H$,yQ,U$,rD=0,oD="private",aD,GM,qQ,WB,V$,sS,tS,KM,ZM,XB,CQ,_Q="2026-07-28",M$,UM,QB=(W)=>c5.safeParse(W).success,O$=(W)=>p5.safeParse(W).success,JX=(W)=>S5.safeParse(W).success,gQ=(W)=>b5.safeParse(W).success,j$=(W)=>typeof W==="object"&&W!==null&&!Array.isArray(W)&&W.resultType==="input_required",AM="Mcp-Param-",rZ="x-mcp-header",NM,VM,wM,DM,E$="=?base64?",I$="?=",d9=-32020,eS,Wb,oZ=!1,n7="draft-2020-12",PM,kM,vM,aZ,yM,Xb,uM=!0,lM=10,mM=250,rM,oM,b$,q$,aM,k$,xQ=60000,tM,eM,WO,XO,v$,LO,Qb,g$=10485760,FB=class{_buffer;_maxBufferSize;constructor(W){this._maxBufferSize=W?.maxBufferSize??g$}append(W){if((this._buffer?.length??0)+W.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){while(this._buffer){let W=this._buffer.indexOf(`
212
+ `);if(W===-1)return null;let X=this._buffer.toString("utf8",0,W).replace(/\r$/,"");this._buffer=this._buffer.subarray(W+1);try{return f$(X)}catch(Q){if(Q instanceof SyntaxError)continue;throw Q}}return null}clear(){this._buffer=void 0}};var zB=H0(()=>{h7();W7();o4();p7=Symbol.for("mcp.sdk.errorBrands");CD=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](X){return a1(this,X)}static isInstance(X){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,X)}constructor(X,Q,Y){super(Q);this.code=X,this.errorUri=Y,this.name="OAuthError",_4(this,new.target)}toResponseObject(){let X={error:this.code,error_description:this.message};if(this.errorUri)X.error_uri=this.errorUri;return X}static fromResponse(X){return new W(X.error,X.error_description??X.error,X.error_uri)}},A0=function(W){return W.NotConnected="NOT_CONNECTED",W.AlreadyConnected="ALREADY_CONNECTED",W.NotInitialized="NOT_INITIALIZED",W.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",W.RequestTimeout="REQUEST_TIMEOUT",W.ConnectionClosed="CONNECTION_CLOSED",W.SendFailed="SEND_FAILED",W.InvalidResult="INVALID_RESULT",W.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",W.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",W.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",W.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",W.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",W.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",W.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",W.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",W.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",W.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",W.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",W}({}),U0=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](W){return a1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,W)}constructor(W,X,Q){super(X);this.code=W,this.data=Q,this.name="SdkError",_4(this,new.target)}},W$=class extends U0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(W,X,Q){super(W,X,Q);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}},o7=[X$];Y$=["task","inputRequests","requestState"];_D=new Set(["const","enum","default","examples"]),gD=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas"]);F$={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},L$={"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},xD={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};oS=Object.keys(F$),aS=Object.keys(L$);pZ={ok:!1,reason:"not-in-era"};t7={era:"2025-11-25",hasRequestMethod:z$,hasNotificationMethod:J$,validateRequest:(W,X)=>bQ(lD(W),X),validateResult:(W,X)=>bQ(uD(W),X),validateNotification:(W,X)=>bQ(mD(W),X),hasInputRequestMethod:()=>!1,validateInputRequest:()=>pZ,validateInputResponse:()=>pZ,samplingResultVariant:(W,X)=>{let Q=G$();return bQ(W?Q.CreateMessageResultWithToolsSchema:Q.CreateMessageResultSchema,X)},outboundEnvelope:(W)=>{return},validateEnvelopeMeta:(W)=>[],projectCallToolResult(W,X){let Q=Q$(W),Y=Q.structuredContent;if(Y===void 0)return Q;let G=typeof Y!=="object"||Y===null||Array.isArray(Y),B=X!==void 0&&B$(X);if(!G&&!B)return Q;return{...Q,structuredContent:{result:Y}}},decodeResult(W,X){if(d7(X)&&"resultType"in X){let Q={...X};return delete Q.resultType,{kind:"complete",result:iZ(Q)}}return{kind:"complete",result:iZ(X)}},encodeResult(W,X){if(W!=="tools/list")return X;let Q=X.tools;if(!Array.isArray(Q)||!Q.some((Y)=>dZ(Y)))return X;return{...X,tools:Q.map((Y)=>dZ(Y)?{...Y,outputSchema:fD(Y.outputSchema)}:Y)}},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope:(W)=>{return}};dD=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];e7=Symbol("modelcontextprotocol.resultCacheHintFallback");M0=function(W){return W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.ResourceNotFound=-32002]="ResourceNotFound",W[W.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",W[W.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired",W}({}),m0=class W extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](X){return a1(this,X)}static isInstance(X){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,X)}constructor(X,Q,Y){super(Q);this.code=X,this.data=Y,this.name="ProtocolError",_4(this,new.target)}static fromError(X,Q,Y){if(X===M0.UrlElicitationRequired&&Y){let G=Y;if(G.elicitations)return new H$(G.elicitations,Q)}if(X===M0.UnsupportedProtocolVersion&&Y){let G=Y;if(Array.isArray(G.supported)&&typeof G.requested==="string")return new yQ({supported:G.supported,requested:G.requested},Q)}if(X===M0.InvalidParams||X===M0.ResourceNotFound){let G=Y;if(typeof G?.uri==="string"&&(X===M0.ResourceNotFound||Object.keys(G).length===1))return new $$(G.uri,Q)}if(X===M0.MissingRequiredClientCapability&&Y){let G=Y;if(G.requiredCapabilities!==null&&typeof G.requiredCapabilities==="object"&&!Array.isArray(G.requiredCapabilities))return new U$({requiredCapabilities:G.requiredCapabilities},Q)}return new W(X,Q,Y)}},$$=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(W,X=`Resource not found: ${W}`){super(M0.InvalidParams,X,{uri:W})}get uri(){return this.data.uri}},H$=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(W,X=`URL elicitation${W.length>1?"s":""} required`){super(M0.UrlElicitationRequired,X,{elicitations:W})}get elicitations(){return this.data?.elicitations??[]}},yQ=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(W,X=`Unsupported protocol version: ${W.requested}`){super(M0.UnsupportedProtocolVersion,X,W)}get supported(){return this.data.supported}get requested(){return this.data.requested}},U$=class extends m0{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(W,X=`Missing required client capabilities: ${Object.keys(W.requiredCapabilities).join(", ")}`){super(M0.MissingRequiredClientCapability,X,W)}get requiredCapabilities(){return this.data.requiredCapabilities}},aD=["tools/call","prompts/get","resources/read"];GM=["elicitation/create","sampling/createMessage","roots/list"];WB={"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},V$={"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};sS=Object.keys(WB),tS=Object.keys(V$);KM={ok:!1,reason:"not-in-era"},ZM=[r1,C1];XB={era:"2026-07-28",hasRequestMethod:w$,hasNotificationMethod:D$,hasInputRequestMethod:(W)=>u7(W)!==void 0,validateRequest:(W,X)=>BX(LM(W),X),validateResult:(W,X)=>BX(zM(W),X),validateNotification:(W,X)=>BX(JM(W),X),validateInputRequest:(W,X)=>BX(u7(W),X),validateInputResponse:(W,X)=>BX(BM(W),X),samplingResultVariant:()=>KM,outboundEnvelope(W){return{[r1]:W.protocolVersion,[y6]:W.clientInfo,[C1]:W.clientCapabilities,...W.logLevel!==void 0&&{[o1]:W.logLevel}}},validateEnvelopeMeta(W){let X=[];for(let Y of ZM)if(!(Y in W))X.push({key:Y,problem:"missing"});let Q=y4().RequestMetaEnvelopeSchema.safeParse(W);if(!Q.success)for(let Y of Q.error.issues){let G=Y.path.map(String),B=G.length>0?G.join("."):"_meta";if(G.length===1&&X.some((F)=>F.key===B&&F.problem==="missing"))continue;X.push({key:B,problem:Y.message})}return X},projectCallToolResult:(W)=>Q$(W),inputRequestSchema:u7,decodeResult(W,X){if(!LX(X))return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: not an object`,{method:W})};let Q=X.resultType;if(Q===void 0)return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: 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:W,violation:"missing-resultType"})};if(typeof Q!=="string")return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: non-string resultType`,{method:W,resultType:Q})};if(Q==="input_required"){let F=X.inputRequests,L=LX(F)?F:{},z=X.requestState;if(Object.keys(L).length===0&&typeof z!=="string")return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:W,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:L,...typeof z==="string"&&{requestState:z}}}if(Q!=="complete")return{kind:"invalid",error:new U0(A0.UnsupportedResultType,`Unsupported result type '${Q}' for ${W}`,{resultType:Q,method:W})};let Y=HM(),G=Object.hasOwn(Y,W)?Y[W]:void 0;if(G!==void 0){let F=G.safeParse(X);if(!F.success)return{kind:"invalid",error:new U0(A0.InvalidResult,`Invalid result for ${W}: ${F.error}`,{method:W})}}let B={...X};return delete B.resultType,{kind:"complete",result:B}},encodeResult(W,X,Q){return WM(tD(W,sD(W,$M(W,X))),Q)},encodeErrorCode:(W)=>W===-32002?-32602:W,checkInboundEnvelope(W){if(W.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let X=y4().RequestMetaEnvelopeSchema.safeParse(W.envelope);if(!X.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${X.error.issues.map((Q)=>Q.message).join("; ")}`}};M$=[t7,XB],UM=cZ({AnnotationsSchema:()=>_6,AudioContentSchema:()=>o5,BaseMetadataSchema:()=>v6,BaseRequestParamsSchema:()=>G1,BlobResourceContentsSchema:()=>R4,BooleanSchemaSchema:()=>s5,CallToolRequestParamsSchema:()=>o8,CallToolRequestSchema:()=>a8,CallToolResultSchema:()=>b4,CancelTaskRequestSchema:()=>hW,CancelTaskResultSchema:()=>uW,CancelledNotificationParamsSchema:()=>e4,CancelledNotificationSchema:()=>D4,ClientCapabilitiesSchema:()=>Y8,ClientNotificationSchema:()=>mW,ClientRequestSchema:()=>lW,ClientResultSchema:()=>cW,ClientTasksCapabilitySchema:()=>X8,CompatibilityCallToolResultSchema:()=>bW,CompleteRequestParamsSchema:()=>E9,CompleteRequestSchema:()=>I9,CompleteResultSchema:()=>R9,ContentBlockSchema:()=>a5,CreateMessageRequestParamsSchema:()=>z9,CreateMessageRequestSchema:()=>J9,CreateMessageResultSchema:()=>K9,CreateMessageResultWithToolsSchema:()=>Z9,CreateTaskResultSchema:()=>CW,CursorSchema:()=>A4,DiscoverRequestSchema:()=>z8,DiscoverResultSchema:()=>C5,ElicitRequestFormParamsSchema:()=>s6,ElicitRequestParamsSchema:()=>N9,ElicitRequestSchema:()=>V9,ElicitRequestURLParamsSchema:()=>A9,ElicitResultSchema:()=>M9,ElicitationCompleteNotificationParamsSchema:()=>w9,ElicitationCompleteNotificationSchema:()=>D9,EmbeddedResourceSchema:()=>u8,EmptyResultSchema:()=>w4,EnumSchemaSchema:()=>U9,GetPromptRequestParamsSchema:()=>f8,GetPromptRequestSchema:()=>x8,GetPromptResultSchema:()=>c8,GetTaskPayloadRequestSchema:()=>_W,GetTaskPayloadResultSchema:()=>gW,GetTaskRequestSchema:()=>vW,GetTaskResultSchema:()=>yW,IconSchema:()=>W8,IconsSchema:()=>p6,ImageContentSchema:()=>r5,ImplementationSchema:()=>d5,InitializeRequestParamsSchema:()=>G8,InitializeRequestSchema:()=>B8,InitializeResultSchema:()=>F8,InitializedNotificationSchema:()=>L8,JSONArraySchema:()=>PW,JSONObjectSchema:()=>e0,JSONRPCErrorResponseSchema:()=>b5,JSONRPCMessageSchema:()=>q5,JSONRPCNotificationSchema:()=>p5,JSONRPCRequestSchema:()=>c5,JSONRPCResponseSchema:()=>SW,JSONRPCResultResponseSchema:()=>S5,JSONValueSchema:()=>m6,LegacyTitledEnumSchemaSchema:()=>W4,ListChangedOptionsBaseSchema:()=>q4,ListPromptsRequestSchema:()=>_8,ListPromptsResultSchema:()=>g8,ListResourceTemplatesRequestSchema:()=>A8,ListResourceTemplatesResultSchema:()=>N8,ListResourcesRequestSchema:()=>H8,ListResourcesResultSchema:()=>U8,ListRootsRequestSchema:()=>P9,ListRootsResultSchema:()=>S9,ListTasksRequestSchema:()=>fW,ListTasksResultSchema:()=>xW,ListToolsRequestSchema:()=>n8,ListToolsResultSchema:()=>r8,LoggingLevelSchema:()=>r6,LoggingMessageNotificationParamsSchema:()=>W9,LoggingMessageNotificationSchema:()=>X9,ModelHintSchema:()=>Q9,ModelPreferencesSchema:()=>Y9,MultiSelectEnumSchemaSchema:()=>H9,NotificationSchema:()=>K1,NotificationsParamsSchema:()=>J1,NumberSchemaSchema:()=>a6,PaginatedRequestParamsSchema:()=>Z8,PaginatedRequestSchema:()=>d6,PaginatedResultSchema:()=>i6,PingRequestSchema:()=>O4,PrimitiveSchemaDefinitionSchema:()=>Y4,ProgressNotificationParamsSchema:()=>K8,ProgressNotificationSchema:()=>j4,ProgressSchema:()=>J8,ProgressTokenSchema:()=>U4,PromptArgumentSchema:()=>v8,PromptListChangedNotificationSchema:()=>p8,PromptMessageSchema:()=>m8,PromptReferenceSchema:()=>j9,PromptSchema:()=>y8,ReadResourceRequestParamsSchema:()=>V8,ReadResourceRequestSchema:()=>w8,ReadResourceResultSchema:()=>D8,RelatedTaskMetadataSchema:()=>t4,RequestIdSchema:()=>c6,RequestMetaSchema:()=>N4,RequestSchema:()=>W1,ResourceContentsSchema:()=>E4,ResourceLinkSchema:()=>l8,ResourceListChangedNotificationSchema:()=>M8,ResourceRequestParamsSchema:()=>i5,ResourceSchema:()=>T4,ResourceTemplateReferenceSchema:()=>O9,ResourceTemplateSchema:()=>$8,ResourceUpdatedNotificationParamsSchema:()=>C8,ResourceUpdatedNotificationSchema:()=>k8,ResultMetaObjectSchema:()=>V4,ResultSchema:()=>X1,RoleSchema:()=>n6,RootSchema:()=>T9,RootsListChangedNotificationSchema:()=>b9,SamplingContentSchema:()=>F9,SamplingMessageContentBlockSchema:()=>I5,SamplingMessageSchema:()=>L9,ServerCapabilitiesSchema:()=>M4,ServerNotificationSchema:()=>dW,ServerRequestSchema:()=>pW,ServerResultSchema:()=>iW,ServerTasksCapabilitySchema:()=>Q8,SetLevelRequestParamsSchema:()=>t8,SetLevelRequestSchema:()=>e8,SingleSelectEnumSchemaSchema:()=>$9,StringSchemaSchema:()=>o6,SubscribeRequestParamsSchema:()=>O8,SubscribeRequestSchema:()=>j8,SubscriptionFilterSchema:()=>P4,SubscriptionsAcknowledgedNotificationParamsSchema:()=>P8,SubscriptionsAcknowledgedNotificationSchema:()=>S8,SubscriptionsListenRequestParamsSchema:()=>R8,SubscriptionsListenRequestSchema:()=>T8,SubscriptionsListenResultMetaSchema:()=>b8,SubscriptionsListenResultSchema:()=>q8,TaskAugmentedRequestParamsSchema:()=>P5,TaskCreationParamsSchema:()=>qW,TaskMetadataSchema:()=>s4,TaskSchema:()=>t6,TaskStatusNotificationParamsSchema:()=>C9,TaskStatusNotificationSchema:()=>kW,TaskStatusSchema:()=>q9,TextContentSchema:()=>n5,TextResourceContentsSchema:()=>I4,TitledMultiSelectEnumSchemaSchema:()=>Q4,TitledSingleSelectEnumSchemaSchema:()=>e5,ToolAnnotationsSchema:()=>d8,ToolChoiceSchema:()=>G9,ToolExecutionSchema:()=>i8,ToolListChangedNotificationSchema:()=>s8,ToolResultContentSchema:()=>B9,ToolSchema:()=>S4,ToolUseContentSchema:()=>h8,UnsubscribeRequestParamsSchema:()=>E8,UnsubscribeRequestSchema:()=>I8,UntitledMultiSelectEnumSchemaSchema:()=>X4,UntitledSingleSelectEnumSchemaSchema:()=>t5}),NM=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,VM=new Set(["string","integer","boolean","number"]);wM=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],DM=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);eS=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],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:[M0.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:[d9,M0.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:[M0.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:[M0.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:[M0.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:[d9],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:[M0.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:[d9],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."}],Wb={[M0.ParseError]:400,[M0.InvalidRequest]:400,[M0.MethodNotFound]:404,[M0.UnsupportedProtocolVersion]:400,[M0.MissingRequiredClientCapability]:400,[d9]:400};PM=/\\\.\\d\{(\d+)\}/;kM=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);vM=new Set(["$schema",...Object.keys(s6.shape.requestedSchema.shape)]),aZ={string:FX([o6,t5,e5,W4]),number:FX([a6]),integer:FX([a6]),boolean:FX([s5]),array:FX([X4,Q4])},yM=new Set(o6.shape.format.unwrap().options);Xb=Object.assign(hM,{elicit(W){try{return{method:"elicitation/create",params:xM(W)}}catch(X){throw X instanceof m0?TypeError(X.message,{cause:X}):X}},elicitUrl(W){return{method:"elicitation/create",params:{...W,mode:"url"}}},createMessage(W){return{method:"sampling/createMessage",params:W}},listRoots(){return{method:"roots/list"}}});rM=["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"],oM={IdJagTokenExchangeResponseSchema:g9,OAuthClientInformationFullSchema:u9,OAuthClientInformationSchema:h9,OAuthClientMetadataSchema:x9,OAuthClientRegistrationErrorSchema:nW,OAuthErrorResponseSchema:f9,OAuthMetadataSchema:C4,OAuthProtectedResourceMetadataSchema:k9,OAuthTokenRevocationRequestSchema:rW,OAuthTokensSchema:_9,OpenIdProviderDiscoveryMetadataSchema:y9,OpenIdProviderMetadataSchema:v9},b$={},q$={};for(let W of rM)C$(W,UM[W]);for(let[W,X]of Object.entries(oM))C$(W,X);aM=Object.freeze(b$),k$=Object.freeze(q$);tM=[r1,y6,C1,o1],eM=["inputResponses","requestState"];WO=BB(void 0),v$=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{XO=(W,X)=>{W._negotiatedProtocolVersion=X}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(W){this._options=W,this._supportedProtocolVersions=W?.supportedProtocolVersions??H4,this.setNotificationHandler("notifications/cancelled",(X)=>{this._oncancel(X)}),this.setNotificationHandler("notifications/progress",(X)=>{this._onprogress(X)}),this.setRequestHandler("ping",(X)=>({}))}_shouldDropInbound(W){}_outboundMetaEnvelope(){}_envelopeOutbound(W){let X=this._outboundMetaEnvelope();if(X===void 0)return W;let Q=W.params??{};return{...W,params:{...Q,_meta:{...X,...Q._meta}}}}_resolveNonCompleteResult(W,X){return Promise.reject(new U0(A0.UnsupportedResultType,`Unsupported result type '${W.kind}' for ${X.request.method}`,{resultType:W.kind,method:X.request.method}))}_getRequestHandler(W){return this._requestHandlers.get(W)}async _oncancel(W){if(!W.params.requestId)return;this._requestHandlerAbortControllers.get(W.params.requestId)?.abort(W.params.reason)}_setupTimeout(W,X,Q,Y,G=!1){this._timeoutInfo.set(W,{timeoutId:setTimeout(Y,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout(W){let X=this._timeoutInfo.get(W);if(!X)return!1;let Q=Date.now()-X.startTime;if(X.maxTotalTimeout&&Q>=X.maxTotalTimeout)throw this._timeoutInfo.delete(W),new U0(A0.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Q});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(W){let X=this._timeoutInfo.get(W);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(W)}async connect(W){this._transport=W;let X=this.transport?.onclose;this._transport.onclose=()=>{try{X?.()}finally{this._onclose()}};let Q=this.transport?.onerror;this._transport.onerror=(G)=>{Q?.(G),this._onerror(G)};let Y=this._transport?.onmessage;this._transport.onmessage=(G,B)=>{if(Y?.(G,B),JX(G)||gQ(G))this._onresponse(G);else if(QB(G))this._onrequest(G,B);else if(O$(G))this._onnotification(G,B);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},W.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();let X=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let Q=new U0(A0.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let Y of W.values())Y(Q);for(let Y of X.values())Y.abort(Q)}}_onerror(W){this.onerror?.(W)}_onnotification(W,X){let{message:Q}=sZ(W,"notification"),Y=this._negotiatedWireCodec();if(X?.classification===void 0&&this._shouldDropInbound(W)==="drop")return;if(X?.classification!==void 0){let F=nZ(X.classification);if(F!==Y.era){this._onerror(Error(`Era mismatch on inbound notification '${Q.method}': classified as ${F} but this instance serves ${Y.era}`));return}}if(m7(Q.method)&&!Y.hasNotificationMethod(Q.method))return;let G=this._notificationHandlers.get(Q.method),B=this.fallbackNotificationHandler;if(G===void 0&&B===void 0)return;Promise.resolve().then(()=>G===void 0?B(Q):G(Q,Y)).catch((F)=>this._onerror(Error(`Uncaught error in notification handler: ${F}`)))}_onrequest(W,X){let{message:Q,lifted:Y}=sZ(W,"request"),G=this._negotiatedWireCodec();if(X?.classification===void 0&&this._shouldDropInbound(W)==="drop"){this._onerror(Error(`Dropped inbound request '${W.method}': not servable on this connection's protocol era`));return}let B=this._transport,F=(M,N,$)=>{let V={jsonrpc:"2.0",id:Q.id,error:{code:M,message:N,...$!==void 0&&{data:$}}};B?.send(V).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)))};if(X?.classification!==void 0){let M=nZ(X.classification);if(M!==G.era){this._onerror(Error(`Era mismatch on inbound request '${Q.method}': classified as ${M} but this instance serves ${G.era}`));let N=X.classification.revision??M;F(M0.UnsupportedProtocolVersion,`Unsupported protocol version: ${N}`,{supported:this._supportedProtocolVersions,requested:N});return}}if(l7(Q.method)&&!G.hasRequestMethod(Q.method)){F(M0.MethodNotFound,"Method not found");return}let L=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler;if(L===void 0){F(M0.MethodNotFound,"Method not found");return}let z=G.checkInboundEnvelope(Y);if(z!==void 0){F(M0.InvalidParams,z);return}let J=(M,N)=>this._notificationViaCodec(this._resolveOutboundCodec(M.method),M,{...N,relatedRequestId:Q.id}),K=(M,N,$)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(M.method),M,N,{...$,relatedRequestId:Q.id}),Z=new AbortController;this._requestHandlerAbortControllers.set(Q.id,Z);let D=Y.inputResponses===void 0?void 0:QO(Y.inputResponses),I={sessionId:B?.sessionId,mcpReq:{id:Q.id,method:Q.method,_meta:Q.params?._meta,...Y.envelope!==void 0&&{envelope:Y.envelope},...D!==void 0&&{inputResponses:D.accepted},...D!==void 0&&D.droppedKeys.length>0&&{droppedInputResponseKeys:D.droppedKeys},requestState:Y.requestState===void 0?WO:BB(Y.requestState),signal:Z.signal,send:(M,N,$)=>{let V=this._resolveOutboundCodec(M.method);if(this._assertOutboundRequestInEra(V,M.method),i7(N))return K(M,N,$);let U=tZ(V,M.method);if(U===void 0)throw TypeError(`'${M.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return K(M,U,N)},notify:J},http:X?.authInfo?{authInfo:X.authInfo}:void 0},A=this.buildContext(I,X);Promise.resolve().then(()=>L(Q,A)).then(async(M)=>{if(Z.signal.aborted)return;let N;try{N=G.encodeResult(Q.method,M,this._outboundServerInfo())}catch(V){this._onerror(Error(`Failed to encode result for ${Q.method}: ${V}`)),F(M0.InternalError,"Internal error");return}let $={result:N,jsonrpc:"2.0",id:Q.id};await B?.send($)},async(M)=>{if(Z.signal.aborted)return;let N=Number.isSafeInteger(M.code)?M.code:M0.InternalError,$={jsonrpc:"2.0",id:Q.id,error:{code:G.encodeErrorCode(N),message:M.message??"Internal error",...M.data!==void 0&&{data:M.data}}};await B?.send($)}).catch((M)=>this._onerror(Error(`Failed to send response: ${M}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===Z)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(W){let{progressToken:X,...Q}=W.params,Y=Number(X),G=this._progressHandlers.get(Y);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(W)}`));return}let B=this._responseHandlers.get(Y),F=this._timeoutInfo.get(Y);if(F&&B&&F.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(L){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),B(L);return}G(Q)}_onresponse(W){let X=Number(W.id),Q=this._responseHandlers.get(X);if(Q===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(W)}`));return}if(this._responseHandlers.delete(X),this._cleanupTimeout(X),this._progressHandlers.delete(X),JX(W))Q(W);else Q(m0.fromError(W.error.code,W.error.message,W.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(W,X,Q){let Y=this._resolveOutboundCodec(W.method);if(this._assertOutboundRequestInEra(Y,W.method),i7(X))return this._requestWithSchemaViaCodec(Y,W,X,Q);let G=tZ(Y,W.method);if(G===void 0)throw TypeError(`'${W.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(Y,W,G,X)}_negotiatedWireCodec(){return v5(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(W){if(this._negotiatedProtocolVersion===void 0){let X=sM(W);if(X)return X}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(W,X){if(l7(X)&&!W.hasRequestMethod(X))throw new U0(A0.MethodNotSupportedByProtocolVersion,`Method '${X}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:X,era:W.era})}_requestWithSchema(W,X,Q){let Y=this._resolveOutboundCodec(W.method);return this._assertOutboundRequestInEra(Y,W.method),this._requestWithSchemaViaCodec(Y,W,X,Q)}_requestWithSchemaViaCodec(W,X,Q,Y){let{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L}=Y??{},z=Date.now(),J,K;return new Promise((Z,D)=>{let I=(j)=>{D(j)};if(!this._transport){I(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(X.method)}catch(j){I(j);return}if(Y?.signal?.aborted){let j=Y.signal.reason;throw j instanceof U0?j:new U0(A0.RequestTimeout,String(j))}let A=W.era===_Q&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,M=this._requestMessageId++;K=M;let N={...X,jsonrpc:"2.0",id:M};if(Y?.onprogress)this._progressHandlers.set(M,Y.onprogress),N.params={...X.params,_meta:{...X.params?._meta,progressToken:M}};let $=this._envelopeOutbound(N),V=!1,U=(j)=>{if(V)return;if(this._progressHandlers.delete(M),A===void 0)this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:M,reason:String(j)}}),{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));else A.abort();D(j instanceof U0?j:new U0(A0.RequestTimeout,String(j)))};this._responseHandlers.set(M,(j)=>{if(Y?.signal?.aborted)return;if(V=!0,j instanceof Error)return D(j);let w;try{w=W.decodeResult(X.method,j.result)}catch(k){return D(k instanceof Error?k:Error(String(k)))}if(w.kind==="invalid")return D(w.error);if(w.kind==="input_required"){if(Y?.allowInputRequired===!0)return Z(FO(w));let k={codec:W,request:X,resultSchema:Q,options:Y,flowStartedAt:z,retry:(l,_)=>this._requestWithSchemaViaCodec(W,l===void 0?{method:X.method}:{method:X.method,params:l},Q,_)};return Z(this._resolveNonCompleteResult(w,k))}let T=w.result;c7(Q,T).then((k)=>{if(k.success)Z(k.data);else D(new U0(A0.InvalidResult,`Invalid result for ${X.method}: ${k.error}`))},D)}),J=()=>U(Y?.signal?.reason),Y?.signal?.addEventListener("abort",J,{once:!0});let O=Y?.timeout??xQ,R=()=>U(new U0(A0.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(M,O,Y?.maxTotalTimeout,R,Y?.resetTimeoutOnProgress??!1),this._transport.send($,{relatedRequestId:G,resumptionToken:B,onresumptiontoken:F,headers:L,requestSignal:A?.signal}).catch((j)=>{this._progressHandlers.delete(M),D(j)})}).finally(()=>{if(J)Y?.signal?.removeEventListener("abort",J);if(K!==void 0)this._responseHandlers.delete(K),this._cleanupTimeout(K)})}async notification(W,X){return this._notificationViaCodec(this._resolveOutboundCodec(W.method),W,X)}async _notificationViaCodec(W,X,Q){if(!this._transport)throw new U0(A0.NotConnected,"Not connected");if(m7(X.method)&&!W.hasNotificationMethod(X.method))throw new U0(A0.MethodNotSupportedByProtocolVersion,`Notification '${X.method}' is not supported by the negotiated protocol version (wire era ${W.era})`,{method:X.method,era:W.era});this.assertNotificationCapability(X.method);let Y=this._envelopeOutbound({jsonrpc:"2.0",...X});if((this._options?.debouncedNotificationMethods??[]).includes(X.method)&&!X.params&&!Q?.relatedRequestId){if(this._pendingDebouncedNotifications.has(X.method))return;this._pendingDebouncedNotifications.add(X.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(X.method),!this._transport)return;this._transport?.send(Y,Q).catch((G)=>this._onerror(G))});return}await this._transport.send(Y,Q)}setRequestHandler(W,X,Q){this.assertRequestHandlerCapability(W);let Y;if(typeof X==="function"){if(!l7(W))throw TypeError(`'${W}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);Y=(G,B)=>{let F=this._negotiatedWireCodec(),L=F.validateRequest(W,G);if(!L.ok&&L.reason==="not-in-era")L=F.validateInputRequest(W,G);if(!L.ok){if(L.reason==="not-in-era")throw new m0(M0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(L.message)}return Promise.resolve(X(L.value,B))}}else if(Q)Y=async(G,B)=>{let F=await c7(X.params,{...G.params});if(!F.success)throw new m0(M0.InvalidParams,`Invalid params for ${W}: ${F.error}`);return Q(F.data,B)};else throw TypeError("setRequestHandler: handler is required");this._requestHandlers.set(W,this._wrapHandler(W,Y))}_wrapHandler(W,X){return X}_outboundServerInfo(){}removeRequestHandler(W){this._requestHandlers.delete(W)}assertCanSetRequestHandler(W){if(this._requestHandlers.has(W))throw Error(`A request handler for ${W} already exists, which would be overridden`)}setNotificationHandler(W,X,Q){if(typeof X==="function"){if(!m7(W))throw TypeError(`'${W}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(W,(Y,G)=>{let B=G.validateNotification(W,Y);if(!B.ok){if(B.reason==="not-in-era")throw new m0(M0.InternalError,`No wire schema for ${W} in the resolved era`);throw Error(B.message)}return Promise.resolve(X(B.value))});return}if(!Q)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(W,async(Y)=>{let G=await c7(X.params,{...Y.params});if(!G.success)throw new m0(M0.InvalidParams,`Invalid params for notification ${W}: ${G.error}`);await Q(G.data,Y)})}removeNotificationHandler(W){this._notificationHandlers.delete(W)}};/*!
101
213
  * content-type
102
214
  * Copyright(c) 2015 Douglas Christopher Wilson
103
215
  * MIT Licensed
104
- */uM=G0((W)=>{var Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,X=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var z=typeof L==="object"?B(L):L;if(typeof z!=="string")throw TypeError("argument string is required to be a string");var J=z.indexOf(";"),K=J!==-1?z.slice(0,J).trim():z.trim();if(!Y.test(K))throw TypeError("invalid media type");var H=new F(K.toLowerCase());if(J!==-1){var D,I,A;Q.lastIndex=J;while(I=Q.exec(z)){if(I.index!==J)throw TypeError("invalid parameter format");if(J+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(X,"$1")}H.parameters[D]=A}if(J!==z.length)throw TypeError("invalid parameter format")}return H}function B(L){var z;if(typeof L.getHeader==="function")z=L.getHeader("content-type");else if(typeof L.headers==="object")z=L.headers&&L.headers["content-type"];if(typeof z!=="string")throw TypeError("content-type header is missing from object");return z}function F(L){this.parameters=Object.create(null),this.type=L}}),_S=MX(uM(),1)});function ej(){let W=new oj.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tj(W),W}var kX,IH,R0,y0,f6,yX,lM,RH,TH,vX,mM,x6,cM,pM,PH,dM,_X,FQ,gX,LQ,fX,iM,SH,nM,rM,oM,bH,aM,t7,qH,sM,tM,eM,Wj,Qj,Xj,Yj,Gj,e7,Bj,Fj,Lj,CH,kH,vH,zj,Jj,Kj,WB,Zj,yH,Hj,$j,Uj,Aj,Nj,Vj,wj,Dj,_H,Mj,gH,fH,jj,Oj,xH,Ej,hH,uH,lH,Ij,Rj,Tj,Pj,Sj,bj,qj,Cj,kj,vj,yj,_j,gj,fj,xj,hj,uj,lj,mj,cj,pj,dj,ij,nj,rj,oj,aj,sj,tj,QB=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=ej()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!sj.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let Q=this.ajv,X="$id"in W&&typeof W.$id==="string"?Q.getSchema(W.$id)??Q.compile(W):Q.compile(W);return(Y)=>{return X(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Q.errorsText(X.errors)}}}},iS;var mH=$0(()=>{S7();kX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var Q=class{};W._CodeOrName=Q,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var X=class extends Q{constructor(Z){super();if(!W.IDENTIFIER.test(Z))throw Error("CodeGen: name must be a valid identifier");this.str=Z}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=X;var Y=class extends Q{constructor(Z){super();this._items=typeof Z==="string"?[Z]:Z}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Z=this._items[0];return Z===""||Z==='""'}get str(){var Z;return(Z=this._str)!==null&&Z!==void 0?Z:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var Z;return(Z=this._names)!==null&&Z!==void 0?Z:this._names=this._items.reduce((V,U)=>{if(U instanceof X)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G(Z,...V){let U=[Z[0]],j=0;while(j<V.length)L(U,V[j]),U.push(Z[++j]);return new Y(U)}W._=G;let B=new Y("+");function F(Z,...V){let U=[I(Z[0])],j=0;while(j<V.length)U.push(B),L(U,V[j]),U.push(B,I(Z[++j]));return z(U),new Y(U)}W.str=F;function L(Z,V){if(V instanceof Y)Z.push(...V._items);else if(V instanceof X)Z.push(V);else Z.push(H(V))}W.addCodeArg=L;function z(Z){let V=1;while(V<Z.length-1){if(Z[V]===B){let U=J(Z[V-1],Z[V+1]);if(U!==void 0){Z.splice(V-1,3,U);continue}Z[V++]="+"}V++}}function J(Z,V){if(V==='""')return Z;if(Z==='""')return V;if(typeof Z=="string"){if(V instanceof X||Z[Z.length-1]!=='"')return;if(typeof V!="string")return`${Z.slice(0,-1)}${V}"`;if(V[0]==='"')return Z.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!(Z instanceof X))return`"${Z}${V.slice(1)}`}function K(Z,V){return V.emptyStr()?Z:Z.emptyStr()?V:F`${Z}${V}`}W.strConcat=K;function H(Z){return typeof Z=="number"||typeof Z=="boolean"||Z===null?Z:I(Array.isArray(Z)?Z.join(","):Z)}function D(Z){return new Y(I(Z))}W.stringify=D;function I(Z){return JSON.stringify(Z).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A(Z){return typeof Z=="string"&&W.IDENTIFIER.test(Z)?new Y(`.${Z}`):G`[${Z}]`}W.getProperty=A;function M(Z){if(typeof Z=="string"&&W.IDENTIFIER.test(Z))return new Y(`${Z}`);throw Error(`CodeGen: invalid export name: ${Z}, use explicit $id name mapping`)}W.getEsmExportName=M;function N(Z){return new Y(Z.toString())}W.regexpCode=N}),IH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let Q=kX();var X=class extends Error{constructor(z){super(`CodeGen: "code" for ${z} not defined`);this.value=z.value}},Y;(function(z){z[z.Started=0]="Started",z[z.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new Q.Name("const"),let:new Q.Name("let"),var:new Q.Name("var")};var G=class{constructor({prefixes:z,parent:J}={}){this._names={},this._prefixes=z,this._parent=J}toName(z){return z instanceof Q.Name?z:this.name(z)}name(z){return new Q.Name(this._newName(z))}_newName(z){let J=this._names[z]||this._nameGroup(z);return`${z}${J.index++}`}_nameGroup(z){var J,K;if(((K=(J=this._parent)===null||J===void 0?void 0:J._prefixes)===null||K===void 0?void 0:K.has(z))||this._prefixes&&!this._prefixes.has(z))throw Error(`CodeGen: prefix "${z}" is not allowed in this scope`);return this._names[z]={prefix:z,index:0}}};W.Scope=G;var B=class extends Q.Name{constructor(z,J){super(J);this.prefix=z}setValue(z,{property:J,itemIndex:K}){this.value=z,this.scopePath=Q._`.${new Q.Name(J)}[${K}]`}};W.ValueScopeName=B;let F=Q._`\n`;var L=class extends G{constructor(z){super(z);this._values={},this._scope=z.scope,this.opts={...z,_n:z.lines?F:Q.nil}}get(){return this._scope}name(z){return new B(z,this._newName(z))}value(z,J){var K;if(J.ref===void 0)throw Error("CodeGen: ref must be passed in value");let H=this.toName(z),{prefix:D}=H,I=(K=J.key)!==null&&K!==void 0?K:J.ref,A=this._values[D];if(A){let Z=A.get(I);if(Z)return Z}else A=this._values[D]=new Map;A.set(I,H);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=J.ref,H.setValue(J,{property:D,itemIndex:N}),H}getValue(z,J){let K=this._values[z];if(!K)return;return K.get(J)}scopeRefs(z,J=this._values){return this._reduceValues(J,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return Q._`${z}${K.scopePath}`})}scopeCode(z=this._values,J,K){return this._reduceValues(z,(H)=>{if(H.value===void 0)throw Error(`CodeGen: name "${H}" has no value`);return H.value.code},J,K)}_reduceValues(z,J,K={},H){let D=Q.nil;for(let I in z){let A=z[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let Z=J(N);if(Z){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=Q._`${D}${V} ${N} = ${Z};${this.opts._n}`}else if(Z=H===null||H===void 0?void 0:H(N))D=Q._`${D}${Z}${this.opts._n}`;else throw new X(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),R0=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let Q=kX(),X=IH();var Y=kX();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=IH();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,S){return this}},F=class extends B{constructor(E,S,C){super();this.varKind=E,this.name=S,this.rhs=C}render({es5:E,_n:S}){let C=E?X.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+S}optimizeNames(E,S){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,S);return this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,S,C){super();this.lhs=E,this.rhs=S,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,S){if(this.lhs instanceof Q.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,S),this}get names(){return d(this.lhs instanceof Q.Name?{}:{...this.lhs.names},this.rhs)}},z=class extends L{constructor(E,S,C,c){super(E,C,c);this.op=S}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},J=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},H=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,S){return this.code=p(this.code,E,S),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((S,C)=>S+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,S=E.length;while(S--){let C=E[S].optimizeNodes();if(Array.isArray(C))E.splice(S,1,...C);else if(C)E[S]=C;else E.splice(S,1)}return E.length>0?this:void 0}optimizeNames(E,S){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,S))continue;K0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,S)=>h(E,S.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var Z=class E extends A{constructor(S,C){super(C);this.condition=S}render(S){let C=`if(${this.condition})`+super.render(S);if(this.else)C+="else "+this.else.render(S);return C}optimizeNodes(){super.optimizeNodes();let S=this.condition;if(S===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(S===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(j0(S),C instanceof E?[C]:C.nodes)}if(S===!1||!this.nodes.length)return;return this}optimizeNames(S,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(S,C),!(super.optimizeNames(S,C)||this.else))return;return this.condition=p(this.condition,S,C),this}get names(){let S=super.names;if(d(S,this.condition),this.else)h(S,this.else.names);return S}};Z.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iteration=p(this.iteration,E,S),this}get names(){return h(super.names,this.iteration.names)}},j=class extends V{constructor(E,S,C,c){super();this.varKind=E,this.name=S,this.from=C,this.to=c}render(E){let S=E.es5?X.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${S} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},R=class extends V{constructor(E,S,C,c){super();this.loop=E,this.varKind=S,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iterable=p(this.iterable,E,S),this}get names(){return h(super.names,this.iterable.names)}},O=class extends A{constructor(E,S,C){super();this.name=E,this.args=S,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};O.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var T=class extends A{render(E){let S="try"+super.render(E);if(this.catch)S+=this.catch.render(E);if(this.finally)S+=this.finally.render(E);return S}optimizeNodes(){var E,S;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(S=this.finally)===null||S===void 0||S.optimizeNodes(),this}optimizeNames(E,S){var C,c;return super.optimizeNames(E,S),(C=this.catch)===null||C===void 0||C.optimizeNames(E,S),(c=this.finally)===null||c===void 0||c.optimizeNames(E,S),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,S={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...S,_n:S.lines?`
105
- `:""},this._extScope=E,this._scope=new X.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,S){let C=this._extScope.value(E,S);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,S){return this._extScope.getValue(E,S)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,S,C,c){let r=this._scope.toName(S);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,S,C){return this._def(X.varKinds.const,E,S,C)}let(E,S,C){return this._def(X.varKinds.let,E,S,C)}var(E,S,C){return this._def(X.varKinds.var,E,S,C)}assign(E,S,C){return this._leafNode(new L(E,S,C))}add(E,S){return this._leafNode(new z(E,W.operators.ADD,S))}code(E){if(typeof E=="function")E();else if(E!==Q.nil)this._leafNode(new D(E));return this}object(...E){let S=["{"];for(let[C,c]of E){if(S.length>1)S.push(",");if(S.push(C),C!==c||this.opts.es5)S.push(":"),(0,Q.addCodeArg)(S,c)}return S.push("}"),new Q._Code(S)}if(E,S,C){if(this._blockNode(new Z(E)),S&&C)this.code(S).else().code(C).endIf();else if(S)this.code(S).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new Z(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode(Z,N)}_for(E,S){if(this._blockNode(E),S)this.code(S).endFor();return this}for(E,S){return this._for(new U(E),S)}forRange(E,S,C,c,r=this.opts.es5?X.varKinds.var:X.varKinds.let){let z0=this._scope.toName(E);return this._for(new j(r,z0,S,C),()=>c(z0))}forOf(E,S,C,c=X.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let z0=S instanceof Q.Name?S:this.var("_arr",S);return this.forRange("_i",0,Q._`${z0}.length`,(e)=>{this.var(r,Q._`${z0}[${e}]`),C(r)})}return this._for(new R("of",c,r,S),()=>C(r))}forIn(E,S,C,c=this.opts.es5?X.varKinds.var:X.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,Q._`Object.keys(${S})`,C);let r=this._scope.toName(E);return this._for(new R("in",c,r,S),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new J(E))}break(E){return this._leafNode(new K(E))}return(E){let S=new w;if(this._blockNode(S),this.code(E),S.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,S,C){if(!S&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new T;if(this._blockNode(c),this.code(E),S){let r=this.name("e");this._currNode=c.catch=new k(r),S(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new H(E))}block(E,S){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(S);return this}endBlock(E){let S=this._blockStarts.pop();if(S===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-S;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=S,this}func(E,S=Q.nil,C,c){if(this._blockNode(new O(E,S,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(O)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,S){let C=this._currNode;if(C instanceof E||S&&C instanceof S)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${S?`${E.kind}/${S.kind}`:E.kind}"`)}_elseNode(E){let S=this._currNode;if(!(S instanceof Z))throw Error('CodeGen: "else" without "if"');return this._currNode=S.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let S=this._nodes;S[S.length-1]=E}};W.CodeGen=_;function h(E,S){for(let C in S)E[C]=(E[C]||0)+(S[C]||0);return E}function d(E,S){return S instanceof Q._CodeOrName?h(E,S.names):E}function p(E,S,C){if(E instanceof Q.Name)return c(E);if(!r(E))return E;return new Q._Code(E._items.reduce((z0,e)=>{if(e instanceof Q.Name)e=c(e);if(e instanceof Q._Code)z0.push(...e._items);else z0.push(e);return z0},[]));function c(z0){let e=C[z0.str];if(e===void 0||S[z0.str]!==1)return z0;return delete S[z0.str],e}function r(z0){return z0 instanceof Q._Code&&z0._items.some((e)=>e instanceof Q.Name&&S[e.str]===1&&C[e.str]!==void 0)}}function K0(E,S){for(let C in S)E[C]=(E[C]||0)-(S[C]||0)}function j0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:Q._`!${u(E)}`}W.not=j0;let w0=v(W.operators.AND);function S0(...E){return E.reduce(w0)}W.and=S0;let H0=v(W.operators.OR);function b(...E){return E.reduce(H0)}W.or=b;function v(E){return(S,C)=>S===Q.nil?C:C===Q.nil?S:Q._`${u(S)} ${E} ${u(C)}`}function u(E){return E instanceof Q.Name?E:Q._`(${E})`}}),y0=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let Q=R0(),X=kX();function Y(O){let w={};for(let T of O)w[T]=!0;return w}W.toHash=Y;function G(O,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(O,w),!F(w,O.self.RULES.all)}W.alwaysValidSchema=G;function B(O,w=O.schema){let{opts:T,self:k}=O;if(!T.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])R(O,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(O,w){if(typeof O=="boolean")return!O;for(let T in O)if(w[T])return!0;return!1}W.schemaHasRules=F;function L(O,w){if(typeof O=="boolean")return!O;for(let T in O)if(T!=="$ref"&&w.all[T])return!0;return!1}W.schemaHasRulesButRef=L;function z({topSchemaRef:O,schemaPath:w},T,k,l){if(!l){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return Q._`${T}`}return Q._`${O}${w}${(0,Q.getProperty)(k)}`}W.schemaRefOrVal=z;function J(O){return D(decodeURIComponent(O))}W.unescapeFragment=J;function K(O){return encodeURIComponent(H(O))}W.escapeFragment=K;function H(O){if(typeof O=="number")return`${O}`;return O.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=H;function D(O){return O.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(O,w){if(Array.isArray(O))for(let T of O)w(T);else w(O)}W.eachItem=I;function A({mergeNames:O,mergeToName:w,mergeValues:T,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof Q.Name?(_ instanceof Q.Name?O(l,_,h):w(l,_,h),h):_ instanceof Q.Name?(w(l,h,_),_):T(_,h);return d===Q.Name&&!(p instanceof Q.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(O,w,T)=>O.if(Q._`${T} !== true && ${w} !== undefined`,()=>{O.if(Q._`${w} === true`,()=>O.assign(T,!0),()=>O.assign(T,Q._`${T} || {}`).code(Q._`Object.assign(${T}, ${w})`))}),mergeToName:(O,w,T)=>O.if(Q._`${T} !== true`,()=>{if(w===!0)O.assign(T,!0);else O.assign(T,Q._`${T} || {}`),N(O,T,w)}),mergeValues:(O,w)=>O===!0?!0:{...O,...w},resultToName:M}),items:A({mergeNames:(O,w,T)=>O.if(Q._`${T} !== true && ${w} !== undefined`,()=>O.assign(T,Q._`${w} === true ? true : ${T} > ${w} ? ${T} : ${w}`)),mergeToName:(O,w,T)=>O.if(Q._`${T} !== true`,()=>O.assign(T,w===!0?!0:Q._`${T} > ${w} ? ${T} : ${w}`)),mergeValues:(O,w)=>O===!0?!0:Math.max(O,w),resultToName:(O,w)=>O.var("items",w)})};function M(O,w){if(w===!0)return O.var("props",!0);let T=O.var("props",Q._`{}`);if(w!==void 0)N(O,T,w);return T}W.evaluatedPropsToName=M;function N(O,w,T){Object.keys(T).forEach((k)=>O.assign(Q._`${w}${(0,Q.getProperty)(k)}`,!0))}W.setEvaluated=N;let Z={};function V(O,w){return O.scopeValue("func",{ref:w,code:Z[w.code]||(Z[w.code]=new X._Code(w.code))})}W.useFunc=V;var U;(function(O){O[O.Num=0]="Num",O[O.Str=1]="Str"})(U||(W.Type=U={}));function j(O,w,T){if(O instanceof Q.Name){let k=w===U.Num;return T?k?Q._`"[" + ${O} + "]"`:Q._`"['" + ${O} + "']"`:k?Q._`"/" + ${O}`:Q._`"/" + ${O}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,Q.getProperty)(O).toString():"/"+H(O)}W.getErrorPath=j;function R(O,w,T=O.opts.strictSchema){if(!T)return;if(w=`strict mode: ${w}`,T===!0)throw Error(w);O.self.logger.warn(w)}W.checkStrictMode=R}),f6=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X={data:new Q.Name("data"),valCxt:new Q.Name("valCxt"),instancePath:new Q.Name("instancePath"),parentData:new Q.Name("parentData"),parentDataProperty:new Q.Name("parentDataProperty"),rootData:new Q.Name("rootData"),dynamicAnchors:new Q.Name("dynamicAnchors"),vErrors:new Q.Name("vErrors"),errors:new Q.Name("errors"),this:new Q.Name("this"),self:new Q.Name("self"),scope:new Q.Name("scope"),json:new Q.Name("json"),jsonPos:new Q.Name("jsonPos"),jsonLen:new Q.Name("jsonLen"),jsonPart:new Q.Name("jsonPart")};W.default=X}),yX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let Q=R0(),X=y0(),Y=f6();W.keywordError={message:({keyword:N})=>Q.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:Z})=>Z?Q.str`"${N}" keyword must be ${Z} ($data)`:Q.str`"${N}" keyword is invalid ($data)`};function G(N,Z=W.keywordError,V,U){let{it:j}=N,{gen:R,compositeRule:O,allErrors:w}=j,T=H(N,Z,V);if(U!==null&&U!==void 0?U:O||w)z(R,T);else J(j,Q._`[${T}]`)}W.reportError=G;function B(N,Z=W.keywordError,V){let{it:U}=N,{gen:j,compositeRule:R,allErrors:O}=U;if(z(j,H(N,Z,V)),!(R||O))J(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,Z){N.assign(Y.default.errors,Z),N.if(Q._`${Y.default.vErrors} !== null`,()=>N.if(Z,()=>N.assign(Q._`${Y.default.vErrors}.length`,Z),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:Z,schemaValue:V,data:U,errsCount:j,it:R}){if(j===void 0)throw Error("ajv implementation error");let O=N.name("err");N.forRange("i",j,Y.default.errors,(w)=>{if(N.const(O,Q._`${Y.default.vErrors}[${w}]`),N.if(Q._`${O}.instancePath === undefined`,()=>N.assign(Q._`${O}.instancePath`,(0,Q.strConcat)(Y.default.instancePath,R.errorPath))),N.assign(Q._`${O}.schemaPath`,Q.str`${R.errSchemaPath}/${Z}`),R.opts.verbose)N.assign(Q._`${O}.schema`,V),N.assign(Q._`${O}.data`,U)})}W.extendErrors=L;function z(N,Z){let V=N.const("err",Z);N.if(Q._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,Q._`[${V}]`),Q._`${Y.default.vErrors}.push(${V})`),N.code(Q._`${Y.default.errors}++`)}function J(N,Z){let{gen:V,validateName:U,schemaEnv:j}=N;if(j.$async)V.throw(Q._`new ${N.ValidationError}(${Z})`);else V.assign(Q._`${U}.errors`,Z),V.return(!1)}let K={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function H(N,Z,V){let{createErrors:U}=N.it;if(U===!1)return Q._`{}`;return D(N,Z,V)}function D(N,Z,V={}){let{gen:U,it:j}=N,R=[I(j,V),A(N,V)];return M(N,Z,R),U.object(...R)}function I({errorPath:N},{instancePath:Z}){let V=Z?Q.str`${N}${(0,X.getErrorPath)(Z,X.Type.Str)}`:N;return[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:Z}},{schemaPath:V,parentSchema:U}){let j=U?Z:Q.str`${Z}/${N}`;if(V)j=Q.str`${j}${(0,X.getErrorPath)(V,X.Type.Str)}`;return[K.schemaPath,j]}function M(N,{params:Z,message:V},U){let{keyword:j,data:R,schemaValue:O,it:w}=N,{opts:T,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,j],[K.params,typeof Z=="function"?Z(N):Z||Q._`{}`]),T.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(T.verbose)U.push([K.schema,O],[K.parentSchema,Q._`${l}${_}`],[Y.default.data,R]);if(k)U.push([K.propertyName,k])}}),lM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let Q=yX(),X=R0(),Y=f6(),G={message:"boolean schema is false"};function B(z){let{gen:J,schema:K,validateName:H}=z;if(K===!1)L(z,!1);else if(typeof K=="object"&&K.$async===!0)J.return(Y.default.data);else J.assign(X._`${H}.errors`,null),J.return(!0)}W.topBoolOrEmptySchema=B;function F(z,J){let{gen:K,schema:H}=z;if(H===!1)K.var(J,!1),L(z);else K.var(J,!0)}W.boolOrEmptySchema=F;function L(z,J){let{gen:K,data:H}=z,D={gen:K,keyword:"false schema",data:H,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:z};(0,Q.reportError)(D,G,void 0,J)}}),RH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let Q=new Set(["string","number","integer","boolean","null","object","array"]);function X(G){return typeof G=="string"&&Q.has(G)}W.isJSONType=X;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),TH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function Q({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&X(G,L)}W.schemaHasRulesForType=Q;function X(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=X;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),vX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let Q=RH(),X=TH(),Y=yX(),G=R0(),B=y0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let j=z(U.type);if(j.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!j.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)j.push("null")}return j}W.getSchemaTypes=L;function z(U){let j=Array.isArray(U)?U:U?[U]:[];if(j.every(Q.isJSONType))return j;throw Error("type must be JSONType or JSONType[]: "+j.join(","))}W.getJSONTypes=z;function J(U,j){let{gen:R,data:O,opts:w}=U,T=H(j,w.coerceTypes),k=j.length>0&&!(T.length===0&&j.length===1&&(0,X.schemaHasRulesForType)(U,j[0]));if(k){let l=M(j,O,w.strictNumbers,F.Wrong);R.if(l,()=>{if(T.length)D(U,j,T);else Z(U)})}return k}W.coerceAndCheckDataType=J;let K=new Set(["string","number","integer","boolean","null"]);function H(U,j){return j?U.filter((R)=>K.has(R)||j==="array"&&R==="array"):[]}function D(U,j,R){let{gen:O,data:w,opts:T}=U,k=O.let("dataType",G._`typeof ${w}`),l=O.let("coerced",G._`undefined`);if(T.coerceTypes==="array")O.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>O.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(j,w,T.strictNumbers),()=>O.assign(l,w)));O.if(G._`${l} !== undefined`);for(let h of R)if(K.has(h)||h==="array"&&T.coerceTypes==="array")_(h);O.else(),Z(U),O.endIf(),O.if(G._`${l} !== undefined`,()=>{O.assign(w,l),I(U,l)});function _(h){switch(h){case"string":O.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":O.elseIf(G._`${k} == "boolean" || ${w} === null
106
- || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":O.elseIf(G._`${k} === "boolean" || ${w} === null
107
- || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":O.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":O.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),O.assign(l,null);return;case"array":O.elseIf(G._`${k} === "string" || ${k} === "number"
108
- || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:j,parentDataProperty:R},O){U.if(G._`${j} !== undefined`,()=>U.assign(G._`${j}[${R}]`,O))}function A(U,j,R,O=F.Correct){let w=O===F.Correct?G.operators.EQ:G.operators.NEQ,T;switch(U){case"null":return G._`${j} ${w} null`;case"array":T=G._`Array.isArray(${j})`;break;case"object":T=G._`${j} && typeof ${j} == "object" && !Array.isArray(${j})`;break;case"integer":T=k(G._`!(${j} % 1) && !isNaN(${j})`);break;case"number":T=k();break;default:return G._`typeof ${j} ${w} ${U}`}return O===F.Correct?T:(0,G.not)(T);function k(l=G.nil){return(0,G.and)(G._`typeof ${j} == "number"`,l,R?G._`isFinite(${j})`:G.nil)}}W.checkDataType=A;function M(U,j,R,O){if(U.length===1)return A(U[0],j,R,O);let w,T=(0,B.toHash)(U);if(T.array&&T.object){let k=G._`typeof ${j} != "object"`;w=T.null?k:G._`!${j} || ${k}`,delete T.null,delete T.array,delete T.object}else w=G.nil;if(T.number)delete T.integer;for(let k in T)w=(0,G.and)(w,A(k,j,R,O));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:j})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${j}}`};function Z(U){let j=V(U);(0,Y.reportError)(j,N)}W.reportTypeError=Z;function V(U){let{gen:j,data:R,schema:O}=U,w=(0,B.schemaRefOrVal)(U,O,"type");return{gen:j,keyword:"type",data:R,schema:O.type,schemaCode:w,schemaValue:w,parentSchema:O,params:{},it:U}}}),mM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let Q=R0(),X=y0();function Y(B,F){let{properties:L,items:z}=B.schema;if(F==="object"&&L)for(let J in L)G(B,J,L[J].default);else if(F==="array"&&Array.isArray(z))z.forEach((J,K)=>G(B,K,J.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:z,compositeRule:J,data:K,opts:H}=B;if(L===void 0)return;let D=Q._`${K}${(0,Q.getProperty)(F)}`;if(J){(0,X.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=Q._`${D} === undefined`;if(H.useDefaults==="empty")I=Q._`${I} || ${D} === null || ${D} === ""`;z.if(I,Q._`${D} = ${(0,Q.stringify)(L)}`)}}),x6=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let Q=R0(),X=y0(),Y=f6(),G=y0();function B(U,j){let{gen:R,data:O,it:w}=U;R.if(H(R,O,j,w.opts.ownProperties),()=>{U.setParams({missingProperty:Q._`${j}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:j,it:{opts:R}},O,w){return(0,Q.or)(...O.map((T)=>(0,Q.and)(H(U,j,T,R.ownProperties),Q._`${w} = ${T}`)))}W.checkMissingProp=F;function L(U,j){U.setParams({missingProperty:j},!0),U.error()}W.reportMissingProp=L;function z(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Q._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=z;function J(U,j,R){return Q._`${z(U)}.call(${j}, ${R})`}W.isOwnProperty=J;function K(U,j,R,O){let w=Q._`${j}${(0,Q.getProperty)(R)} !== undefined`;return O?Q._`${w} && ${J(U,j,R)}`:w}W.propertyInData=K;function H(U,j,R,O){let w=Q._`${j}${(0,Q.getProperty)(R)} === undefined`;return O?(0,Q.or)(w,(0,Q.not)(J(U,j,R))):w}W.noPropertyInData=H;function D(U){return U?Object.keys(U).filter((j)=>j!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,j){return D(j).filter((R)=>!(0,X.alwaysValidSchema)(U,j[R]))}W.schemaProperties=I;function A({schemaCode:U,data:j,it:{gen:R,topSchemaRef:O,schemaPath:w,errorPath:T},it:k},l,_,h){let d=h?Q._`${U}, ${j}, ${O}${w}`:j,p=[[Y.default.instancePath,(0,Q.strConcat)(Y.default.instancePath,T)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let K0=Q._`${d}, ${R.object(...p)}`;return _!==Q.nil?Q._`${l}.call(${_}, ${K0})`:Q._`${l}(${K0})`}W.callValidateCode=A;let M=Q._`new RegExp`;function N({gen:U,it:{opts:j}},R){let O=j.unicodeRegExp?"u":"",{regExp:w}=j.code,T=w(R,O);return U.scopeValue("pattern",{key:T.toString(),ref:T,code:Q._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${R}, ${O})`})}W.usePattern=N;function Z(U){let{gen:j,data:R,keyword:O,it:w}=U,T=j.name("valid");if(w.allErrors){let l=j.let("valid",!0);return k(()=>j.assign(l,!1)),l}return j.var(T,!0),k(()=>j.break()),T;function k(l){let _=j.const("len",Q._`${R}.length`);j.forRange("i",0,_,(h)=>{U.subschema({keyword:O,dataProp:h,dataPropType:X.Type.Num},T),j.if((0,Q.not)(T),l)})}}W.validateArray=Z;function V(U){let{gen:j,schema:R,keyword:O,it:w}=U;if(!Array.isArray(R))throw Error("ajv implementation error");if(R.some((l)=>(0,X.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let T=j.let("valid",!1),k=j.name("_valid");j.block(()=>R.forEach((l,_)=>{let h=U.subschema({keyword:O,schemaProp:_,compositeRule:!0},k);if(j.assign(T,Q._`${T} || ${k}`),!U.mergeValidEvaluated(h,k))j.if((0,Q.not)(T))})),U.result(T,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),cM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let Q=R0(),X=f6(),Y=x6(),G=yX();function B(I,A){let{gen:M,keyword:N,schema:Z,parentSchema:V,it:U}=I,j=A.macro.call(U.self,Z,V,U),R=K(M,N,j);if(U.opts.validateSchema!==!1)U.self.validateSchema(j,!0);let O=M.name("valid");I.subschema({schema:j,schemaPath:Q.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:R,compositeRule:!0},O),I.pass(O,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:Z,schema:V,parentSchema:U,$data:j,it:R}=I;J(R,A);let O=K(N,Z,!j&&A.compile?A.compile.call(R.self,V,U,R):A.validate),w=N.let("valid");I.block$data(w,T),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function T(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>z(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(Q._`await `),(p)=>N.assign(w,!1).if(Q._`${p} instanceof ${R.ValidationError}`,()=>N.assign(d,Q._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=Q._`${O}.errors`;return N.assign(d,null),_(Q.nil),d}function _(d=A.async?Q._`await `:Q.nil){let p=R.opts.passContext?X.default.this:X.default.self,K0=!(("compile"in A)&&!j||A.schema===!1);N.assign(w,Q._`${d}${(0,Y.callValidateCode)(I,O,p,K0)}`,A.modifying)}function h(d){var p;N.if((0,Q.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,Q._`${N.parentData}[${N.parentDataProperty}]`))}function z(I,A){let{gen:M}=I;M.if(Q._`Array.isArray(${A})`,()=>{M.assign(X.default.vErrors,Q._`${X.default.vErrors} === null ? ${A} : ${X.default.vErrors}.concat(${A})`).assign(X.default.errors,Q._`${X.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function J({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,Q.stringify)(M)})}function H(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=H;function D({schema:I,opts:A,self:M,errSchemaPath:N},Z,V){if(Array.isArray(Z.keyword)?!Z.keyword.includes(V):Z.keyword!==V)throw Error("ajv implementation error");let U=Z.dependencies;if(U===null||U===void 0?void 0:U.some((j)=>!Object.prototype.hasOwnProperty.call(I,j)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if(Z.validateSchema){if(!Z.validateSchema(I[V])){let j=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText(Z.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(j);else throw Error(j)}}}W.validateKeywordUsage=D}),pM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let Q=R0(),X=y0();function Y(F,{keyword:L,schemaProp:z,schema:J,schemaPath:K,errSchemaPath:H,topSchemaRef:D}){if(L!==void 0&&J!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return z===void 0?{schema:I,schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[z],schemaPath:Q._`${F.schemaPath}${(0,Q.getProperty)(L)}${(0,Q.getProperty)(z)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,X.escapeFragment)(z)}`}}if(J!==void 0){if(K===void 0||H===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:J,schemaPath:K,topSchemaRef:D,errSchemaPath:H}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:z,dataPropType:J,data:K,dataTypes:H,propertyName:D}){if(K!==void 0&&z!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(z!==void 0){let{errorPath:M,dataPathArr:N,opts:Z}=L;A(I.let("data",Q._`${L.data}${(0,Q.getProperty)(z)}`,!0)),F.errorPath=Q.str`${M}${(0,X.getErrorPath)(z,J,Z.jsPropertySyntax)}`,F.parentDataProperty=Q._`${z}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof Q.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(H)F.dataTypes=H;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:z,compositeRule:J,createErrors:K,allErrors:H}){if(J!==void 0)F.compositeRule=J;if(K!==void 0)F.createErrors=K;if(H!==void 0)F.allErrors=H;F.jtdDiscriminator=L,F.jtdMetadata=z}W.extendSubschemaMode=B}),PH=G0((W,Q)=>{Q.exports=function X(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!X(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var z=L[F];if(!X(Y[z],G[z]))return!1}return!0}return Y!==Y&&G!==G}}),dM=G0((W,Q)=>{var X=Q.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var z=typeof L=="function"?L:L.pre||function(){},J=L.post||function(){};Y(F,z,J,B,"",B)};X.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},X.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},X.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},X.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 Y(B,F,L,z,J,K,H,D,I,A){if(z&&typeof z=="object"&&!Array.isArray(z)){F(z,J,K,H,D,I,A);for(var M in z){var N=z[M];if(Array.isArray(N)){if(M in X.arrayKeywords)for(var Z=0;Z<N.length;Z++)Y(B,F,L,N[Z],J+"/"+M+"/"+Z,K,J,M,z,Z)}else if(M in X.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],J+"/"+M+"/"+G(V),K,J,M,z,V)}else if(M in X.keywords||B.allKeys&&!(M in X.skipKeywords))Y(B,F,L,N,J+"/"+M,K,J,M,z)}L(z,J,K,H,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),_X=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let Q=y0(),X=PH(),Y=dM(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,Z=!0){if(typeof N=="boolean")return!0;if(Z===!0)return!L(N);if(!Z)return!1;return z(N)<=Z}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let Z in N){if(F.has(Z))return!0;let V=N[Z];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function z(N){let Z=0;for(let V in N){if(V==="$ref")return 1/0;if(Z++,G.has(V))continue;if(typeof N[V]=="object")(0,Q.eachItem)(N[V],(U)=>Z+=z(U));if(Z===1/0)return 1/0}return Z}function J(N,Z="",V){if(V!==!1)Z=D(Z);return K(N,N.parse(Z))}W.getFullPath=J;function K(N,Z){return N.serialize(Z).split("#")[0]+"#"}W._getFullPath=K;let H=/#\/?$/;function D(N){return N?N.replace(H,""):""}W.normalizeId=D;function I(N,Z,V){return V=D(V),N.resolve(Z,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,Z){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,j=D(N[V]||Z),R={"":j},O=J(U,j,!1),w={},T=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let K0=O+h,j0=R[p];if(typeof _[V]=="string")j0=w0.call(this,_[V]);S0.call(this,_.$anchor),S0.call(this,_.$dynamicAnchor),R[h]=j0;function w0(H0){let b=this.opts.uriResolver.resolve;if(H0=D(j0?b(j0,H0):H0),T.has(H0))throw l(H0);T.add(H0);let v=this.refs[H0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,H0);else if(H0!==D(K0))if(H0[0]==="#")k(_,w[H0],H0),w[H0]=_;else this.refs[H0]=K0;return H0}function S0(H0){if(typeof H0=="string"){if(!A.test(H0))throw Error(`invalid anchor "${H0}"`);w0.call(this,`#${H0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!X(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),FQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let Q=lM(),X=vX(),Y=TH(),G=vX(),B=mM(),F=cM(),L=pM(),z=R0(),J=f6(),K=_X(),H=y0(),D=yX();function I(P){if(O(P)){if(T(P),R(P)){Z(P);return}}A(P,()=>(0,Q.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},L0){if(t.code.es5)P.func(y,z._`${J.default.data}, ${J.default.valCxt}`,s.$async,()=>{P.code(z._`"use strict"; ${U(x,t)}`),N(P,t),P.code(L0)});else P.func(y,z._`${J.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(L0))}function M(P){return z._`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${P.dynamicRef?z._`, ${J.default.dynamicAnchors}={}`:z.nil}}={}`}function N(P,y){P.if(J.default.valCxt,()=>{if(P.var(J.default.instancePath,z._`${J.default.valCxt}.${J.default.instancePath}`),P.var(J.default.parentData,z._`${J.default.valCxt}.${J.default.parentData}`),P.var(J.default.parentDataProperty,z._`${J.default.valCxt}.${J.default.parentDataProperty}`),P.var(J.default.rootData,z._`${J.default.valCxt}.${J.default.rootData}`),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{if(P.var(J.default.instancePath,z._`""`),P.var(J.default.parentData,z._`undefined`),P.var(J.default.parentDataProperty,z._`undefined`),P.var(J.default.rootData,J.default.data),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`{}`)})}function Z(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(J.default.vErrors,null),s.let(J.default.errors,0),x.unevaluated)V(P);k(P),K0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",z._`${x}.evaluated`),y.if(z._`${P.evaluated}.dynamicProps`,()=>y.assign(z._`${P.evaluated}.props`,z._`undefined`)),y.if(z._`${P.evaluated}.dynamicItems`,()=>y.assign(z._`${P.evaluated}.items`,z._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?z._`/*# sourceURL=${x} */`:z.nil}function j(P,y){if(O(P)){if(T(P),R(P)){w(P,y);return}}(0,Q.boolOrEmptySchema)(P,y)}function R({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function O(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let L0=s.const("_errs",J.default.errors);k(P,L0),s.var(y,z._`${L0} === ${J.default.errors}`)}function T(P){(0,H.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return w0(P,[],!1,y);let x=(0,X.getSchemaTypes)(P.schema);w0(P,x,!(0,X.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,H.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,H.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let L0=x.$comment;if(t.$comment===!0)P.code(z._`${J.default.self}.logger.log(${L0})`);else if(typeof t.$comment=="function"){let T0=z.str`${s}/$comment`,C0=P.scopeValue("root",{ref:y.root});P.code(z._`${J.default.self}.opts.$comment(${L0}, ${T0}, ${C0}.schema)`)}}function K0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:L0}=P;if(x.$async)y.if(z._`${J.default.errors} === 0`,()=>y.return(J.default.data),()=>y.throw(z._`new ${t}(${J.default.vErrors})`));else{if(y.assign(z._`${s}.errors`,J.default.vErrors),L0.unevaluated)j0(P);y.return(z._`${J.default.errors} === 0`)}}function j0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof z.Name)P.assign(z._`${y}.props`,x);if(s instanceof z.Name)P.assign(z._`${y}.items`,s)}function w0(P,y,x,s){let{gen:t,schema:L0,data:T0,allErrors:C0,opts:f0,self:b0}=P,{RULES:O0}=b0;if(L0.$ref&&(f0.ignoreKeywordsWithRef||!(0,H.schemaHasRulesButRef)(L0,O0))){t.block(()=>z0(P,"$ref",O0.all.$ref.definition));return}if(!f0.jtd)H0(P,y);t.block(()=>{for(let k0 of O0.rules)o0(k0);o0(O0.post)});function o0(k0){if(!(0,Y.shouldUseGroup)(L0,k0))return;if(k0.type){if(t.if((0,G.checkDataType)(k0.type,T0,f0.strictNumbers)),S0(P,k0),y.length===1&&y[0]===k0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else S0(P,k0);if(!C0)t.if(z._`${J.default.errors} === ${s||0}`)}}function S0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let L0 of y.rules)if((0,Y.shouldUseRule)(s,L0))z0(P,L0.keyword,L0.definition,y.type)})}function H0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(b(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function b(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!S(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:L0}=t.definition;if(L0.length&&!L0.some((T0)=>E(y,T0)))c(P,`missing type "${L0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function S(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(S(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,H.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,H.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",u0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",J.default.errors)}result(P,y,x){this.failResult((0,z.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,z.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(z._`${y} !== undefined && (${(0,z.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=z.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=z.nil,y=z.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:L0}=this;if(x.if((0,z.or)(z._`${s} === undefined`,y)),P!==z.nil)x.assign(P,!0);if(t.length||L0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==z.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,z.or)(L0(),T0());function L0(){if(x.length){if(!(y instanceof z.Name))throw Error("ajv implementation error");let C0=Array.isArray(x)?x:[x];return z._`${(0,G.checkDataTypes)(C0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return z.nil}function T0(){if(s.validateSchema){let C0=P.scopeValue("validate$data",{ref:s.validateSchema});return z._`!${C0}(${y})`}return z.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return j(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=H.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=H.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,z.Name)),!0}};W.KeywordCxt=r;function z0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,D0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function u0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,L0;if(P==="")return J.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,L0=J.default.rootData}else{let b0=D0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let O0=+b0[1];if(t=b0[2],t==="#"){if(O0>=y)throw Error(f0("property/index",O0));return s[y-O0]}if(O0>y)throw Error(f0("data",O0));if(L0=x[y-O0],!t)return L0}let T0=L0,C0=t.split("/");for(let b0 of C0)if(b0)L0=z._`${L0}${(0,z.getProperty)((0,H.unescapeJsonPointer)(b0))}`,T0=z._`${T0} && ${L0}`;return T0;function f0(b0,O0){return`Cannot access ${b0} ${O0} levels up, current level is ${y}`}}W.getData=u0}),gX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var Q=class extends Error{constructor(X){super("validation failed");this.errors=X,this.ajv=this.validation=!0}};W.default=Q}),LQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=_X();var X=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,Q.resolveUrl)(Y,G,B),this.missingSchema=(0,Q.normalizeId)((0,Q.getFullPath)(Y,this.missingRef))}};W.default=X}),fX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let Q=R0(),X=gX(),Y=f6(),G=_X(),B=y0(),F=FQ();var L=class{constructor(Z){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof Z.schema=="object")U=Z.schema;this.schema=Z.schema,this.schemaId=Z.schemaId,this.root=Z.root||this,this.baseId=(V=Z.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[Z.schemaId||"$id"]),this.schemaPath=Z.schemaPath,this.localRefs=Z.localRefs,this.meta=Z.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function z(Z){let V=H.call(this,Z);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,Z.root.baseId),{es5:j,lines:R}=this.opts.code,{ownProperties:O}=this.opts,w=new Q.CodeGen(this.scope,{es5:j,lines:R,ownProperties:O}),T;if(Z.$async)T=w.scopeValue("Error",{ref:X.default,code:Q._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");Z.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[Q.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:Z.schema,code:(0,Q.stringify)(Z.schema)}:{ref:Z.schema}),validateName:k,ValidationError:T,schema:Z.schema,schemaEnv:Z,rootId:U,baseId:Z.baseId||U,schemaPath:Q.nil,errSchemaPath:Z.schemaPath||(this.opts.jtd?"":"#"),errorPath:Q._`""`,opts:this.opts,self:this},_;try{this._compilations.add(Z),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,Z);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=Z.schema,d.schemaEnv=Z,Z.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:K0}=l;if(d.evaluated={props:p instanceof Q.Name?void 0:p,items:K0 instanceof Q.Name?void 0:K0,dynamicProps:p instanceof Q.Name,dynamicItems:K0 instanceof Q.Name},d.source)d.source.evaluated=(0,Q.stringify)(d.evaluated)}return Z.validate=d,Z}catch(h){if(delete Z.validate,delete Z.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete(Z)}}W.compileSchema=z;function J(Z,V,U){var j;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let R=Z.refs[U];if(R)return R;let O=I.call(this,Z,U);if(O===void 0){let w=(j=Z.localRefs)===null||j===void 0?void 0:j[U],{schemaId:T}=this.opts;if(w)O=new L({schema:w,schemaId:T,root:Z,baseId:V})}if(O===void 0)return;return Z.refs[U]=K.call(this,O)}W.resolveRef=J;function K(Z){if((0,G.inlineRef)(Z.schema,this.opts.inlineRefs))return Z.schema;return Z.validate?Z:z.call(this,Z)}function H(Z){for(let V of this._compilations)if(D(V,Z))return V}W.getCompilingSchema=H;function D(Z,V){return Z.schema===V.schema&&Z.root===V.root&&Z.baseId===V.baseId}function I(Z,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,Z,V)}function A(Z,V){let U=this.opts.uriResolver.parse(V),j=(0,G._getFullPath)(this.opts.uriResolver,U),R=(0,G.getFullPath)(this.opts.uriResolver,Z.baseId,void 0);if(Object.keys(Z.schema).length>0&&j===R)return N.call(this,U,Z);let O=(0,G.normalizeId)(j),w=this.refs[O]||this.schemas[O];if(typeof w=="string"){let T=A.call(this,Z,w);if(typeof(T===null||T===void 0?void 0:T.schema)!=="object")return;return N.call(this,U,T)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)z.call(this,w);if(O===(0,G.normalizeId)(V)){let{schema:T}=w,{schemaId:k}=this.opts,l=T[k];if(l)R=(0,G.resolveUrl)(this.opts.uriResolver,R,l);return new L({schema:T,schemaId:k,root:Z,baseId:R})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N(Z,{baseId:V,schema:U,root:j}){var R;if(((R=Z.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let T of Z.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(T)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(T)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let O;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let T=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);O=A.call(this,j,T)}let{schemaId:w}=this.opts;if(O=O||new L({schema:U,schemaId:w,root:j,baseId:V}),O.schema!==O.root.schema)return O}}),iM=G0((W,Q)=>{Q.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}}),SH=G0((W,Q)=>{let X=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=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 G(A){let M="",N=0,Z=0;for(Z=0;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z];break}for(Z+=1;Z<A.length;Z++){if(N=A[Z].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[Z]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let Z=G(A);if(Z!=="")M.push(Z);else return N.error=!0,!1;A.length=0}return!0}function z(A){let M=0,N={error:!1,address:"",zone:""},Z=[],V=[],U=!1,j=!1,R=L;for(let O=0;O<A.length;O++){let w=A[O];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)j=!0;if(!R(V,Z,N))break;if(++M>7){N.error=!0;break}if(O>0&&A[O-1]===":")U=!0;Z.push(":");continue}else if(w==="%"){if(!R(V,Z,N))break;R=F}else{V.push(w);continue}}if(V.length)if(R===F)N.zone=V.join("");else if(j)Z.push(V.join(""));else Z.push(G(V));return N.address=Z.join(""),N}function J(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=z(A);if(!M.error){let{address:N,address:Z}=M;if(M.zone)N+="%"+M.zone,Z+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:Z}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let Z=0;Z<A.length;Z++)if(A[Z]===M)N++;return N}function H(A){let M=A,N=[],Z=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if((Z=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,Z)),M=M.slice(Z)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let Z=J(N);if(Z.isIPV6===!0)N=`[${Z.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}Q.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:H,isIPv4:Y,isUUID:X,normalizeIPv6:J,stringArrayToHexStripped:G}}),nM=G0((W,Q)=>{let{isUUID:X}=SH(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function z(w){let T=String(w.scheme).toLowerCase()==="https";if(w.port===(T?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function J(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[T,k]=w.resourceName.split("?");w.path=T&&T!=="/"?T:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function H(w,T){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=T.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=O(`${l}:${T.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,T)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,T){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=T.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=O(`${k}:${T.nid||l}`);if(_)w=_.serialize(w,T);let h=w,d=w.nss;return h.path=`${l||T.nid}:${d}`,T.skipEscape=!0,h}function I(w,T){let k=w;if(k.uuid=k.nss,k.nss=void 0,!T.tolerant&&(!k.uuid||!X(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let T=w;return T.nss=(w.uuid||"").toLowerCase(),T}let M={scheme:"http",domainHost:!0,parse:L,serialize:z},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:z},Z={scheme:"ws",domainHost:!0,parse:J,serialize:K},V={scheme:"wss",domainHost:Z.domainHost,parse:Z.parse,serialize:Z.serialize},R={http:M,https:N,ws:Z,wss:V,urn:{scheme:"urn",parse:H,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(R,null);function O(w){return w&&(R[w]||R[w.toLowerCase()])||void 0}Q.exports={wsIsSecure:F,SCHEMES:R,isValidSchemeName:B,getSchemeHandler:O}}),rM=G0((W,Q)=>{let{normalizeIPv6:X,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=SH(),{SCHEMES:z,getSchemeHandler:J}=nM();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function H(V,U,j){let R=j?Object.assign({scheme:"null"},j):{scheme:"null"},O=D(N(V,R),N(U,R),R,!0);return R.skipEscape=!0,A(O,R)}function D(V,U,j,R){let O={};if(!R)V=N(A(V,j),j),U=N(A(U,j),j);if(j=j||{},!j.tolerant&&U.scheme)O.scheme=U.scheme,O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)O.userinfo=U.userinfo,O.host=U.host,O.port=U.port,O.path=Y(U.path||""),O.query=U.query;else{if(!U.path)if(O.path=V.path,U.query!==void 0)O.query=U.query;else O.query=V.query;else{if(U.path[0]==="/")O.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)O.path="/"+U.path;else if(!V.path)O.path=U.path;else O.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;O.path=Y(O.path)}O.query=U.query}O.userinfo=V.userinfo,O.host=V.host,O.port=V.port}O.scheme=V.scheme}return O.fragment=U.fragment,O}function I(V,U,j){if(typeof V==="string")V=unescape(V),V=A(B(N(V,j),!0),{...j,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...j,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,j),!0),{...j,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...j,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let j={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},R=Object.assign({},U),O=[],w=J(R.scheme||j.scheme);if(w&&w.serialize)w.serialize(j,R);if(j.path!==void 0)if(!R.skipEscape){if(j.path=escape(j.path),j.scheme!==void 0)j.path=j.path.split("%3A").join(":")}else j.path=unescape(j.path);if(R.reference!=="suffix"&&j.scheme)O.push(j.scheme,":");let T=G(j);if(T!==void 0){if(R.reference!=="suffix")O.push("//");if(O.push(T),j.path&&j.path[0]!=="/")O.push("/")}if(j.path!==void 0){let k=j.path;if(!R.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(T===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);O.push(k)}if(j.query!==void 0)O.push("?",j.query);if(j.fragment!==void 0)O.push("#",j.fragment);return O.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let j=Object.assign({},U),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},O=!1;if(j.reference==="suffix")if(j.scheme)V=j.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(R.scheme=w[1],R.userinfo=w[3],R.host=w[4],R.port=parseInt(w[5],10),R.path=w[6]||"",R.query=w[7],R.fragment=w[8],isNaN(R.port))R.port=w[5];if(R.host)if(F(R.host)===!1){let k=X(R.host);R.host=k.host.toLowerCase(),O=k.isIPV6}else O=!0;if(R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path)R.reference="same-document";else if(R.scheme===void 0)R.reference="relative";else if(R.fragment===void 0)R.reference="absolute";else R.reference="uri";if(j.reference&&j.reference!=="suffix"&&j.reference!==R.reference)R.error=R.error||"URI is not a "+j.reference+" reference.";let T=J(j.scheme||R.scheme);if(!j.unicodeSupport&&(!T||!T.unicodeSupport)){if(R.host&&(j.domainHost||T&&T.domainHost)&&O===!1&&L(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(k){R.error=R.error||"Host's domain name can not be converted to ASCII: "+k}}if(!T||T&&!T.skipNormalize){if(V.indexOf("%")!==-1){if(R.scheme!==void 0)R.scheme=unescape(R.scheme);if(R.host!==void 0)R.host=unescape(R.host)}if(R.path)R.path=escape(unescape(R.path));if(R.fragment)R.fragment=encodeURI(decodeURIComponent(R.fragment))}if(T&&T.parse)T.parse(R,j)}else R.error=R.error||"URI can not be parsed.";return R}let Z={SCHEMES:z,normalize:K,resolve:H,resolveComponent:D,equal:I,serialize:A,parse:N};Q.exports=Z,Q.exports.default=Z,Q.exports.fastUri=Z}),oM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=rM();Q.code='require("ajv/dist/runtime/uri").default',W.default=Q}),bH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var Q=FQ();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return Q.KeywordCxt}});var X=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return X._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return X.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return X.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return X.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return X.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return X.CodeGen}});let Y=gX(),G=LQ(),B=RH(),F=fX(),L=R0(),z=_X(),J=vX(),K=y0(),H=iM(),D=oM(),I=(b,v)=>new RegExp(b,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={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."},Z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(b){var v,u,E,S,C,c,r,z0,e,D0,u0,P,y,x,s,t,L0,T0,C0,f0,b0,O0,o0,k0,B1;let X1=b.strict,F1=(v=b.code)===null||v===void 0?void 0:v.optimize,Z1=F1===!0||F1===void 0?1:F1||0,H1=(E=(u=b.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,w1=(S=b.uriResolver)!==null&&S!==void 0?S:D.default;return{strictSchema:(c=(C=b.strictSchema)!==null&&C!==void 0?C:X1)!==null&&c!==void 0?c:!0,strictNumbers:(z0=(r=b.strictNumbers)!==null&&r!==void 0?r:X1)!==null&&z0!==void 0?z0:!0,strictTypes:(D0=(e=b.strictTypes)!==null&&e!==void 0?e:X1)!==null&&D0!==void 0?D0:"log",strictTuples:(P=(u0=b.strictTuples)!==null&&u0!==void 0?u0:X1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=b.strictRequired)!==null&&y!==void 0?y:X1)!==null&&x!==void 0?x:!1,code:b.code?{...b.code,optimize:Z1,regExp:H1}:{optimize:Z1,regExp:H1},loopRequired:(s=b.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=b.loopEnum)!==null&&t!==void 0?t:V,meta:(L0=b.meta)!==null&&L0!==void 0?L0:!0,messages:(T0=b.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(C0=b.inlineRefs)!==null&&C0!==void 0?C0:!0,schemaId:(f0=b.schemaId)!==null&&f0!==void 0?f0:"$id",addUsedSchema:(b0=b.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(O0=b.validateSchema)!==null&&O0!==void 0?O0:!0,validateFormats:(o0=b.validateFormats)!==null&&o0!==void 0?o0:!0,unicodeRegExp:(k0=b.unicodeRegExp)!==null&&k0!==void 0?k0:!0,int32range:(B1=b.int32range)!==null&&B1!==void 0?B1:!0,uriResolver:w1}}var j=class{constructor(b={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,b=this.opts={...b,...U(b)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(b.logger);let E=b.validateFormats;if(b.validateFormats=!1,this.RULES=(0,B.getRules)(),R.call(this,N,b,"NOT SUPPORTED"),R.call(this,Z,b,"DEPRECATED","warn"),this._metaOpts=l.call(this),b.formats)T.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),b.keywords)k.call(this,b.keywords);if(typeof b.meta=="object")this.addMetaSchema(b.meta);w.call(this),b.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:b,meta:v,schemaId:u}=this.opts,E=H;if(u==="id")E={...H},E.id=E.$id,delete E.$id;if(v&&b)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:b,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof b=="object"?b[v]||b:void 0}validate(b,v){let u;if(typeof b=="string"){if(u=this.getSchema(b),!u)throw Error(`no schema with key or ref "${b}"`)}else u=this.compile(b);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(b,v){let u=this._addSchema(b,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(b,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,b,v);async function E(e,D0){await S.call(this,e.$schema);let u0=this._addSchema(e,D0);return u0.validate||C.call(this,u0)}async function S(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(D0){if(!(D0 instanceof G.default))throw D0;return c.call(this,D0),await r.call(this,D0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:D0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${D0} cannot be resolved`)}async function r(e){let D0=await z0.call(this,e);if(!this.refs[e])await S.call(this,D0.$schema);if(!this.refs[e])this.addSchema(D0,e,v)}async function z0(e){let D0=this._loading[e];if(D0)return D0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(b,v,u,E=this.opts.validateSchema){if(Array.isArray(b)){for(let C of b)this.addSchema(C,void 0,u,E);return this}let S;if(typeof b==="object"){let{schemaId:C}=this.opts;if(S=b[C],S!==void 0&&typeof S!="string")throw Error(`schema ${C} must be string`)}return v=(0,z.normalizeId)(v||S),this._checkUnique(v),this.schemas[v]=this._addSchema(b,u,v,E,!0),this}addMetaSchema(b,v,u=this.opts.validateSchema){return this.addSchema(b,v,!0,u),this}validateSchema(b,v){if(typeof b=="boolean")return!0;let u;if(u=b.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,b);if(!E&&v){let S="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(S);else throw Error(S)}return E}getSchema(b){let v;while(typeof(v=O.call(this,b))=="string")b=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,b),!v)return;this.refs[b]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(b){if(b instanceof RegExp)return this._removeAllSchemas(this.schemas,b),this._removeAllSchemas(this.refs,b),this;switch(typeof b){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=O.call(this,b);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[b],delete this.refs[b],this}case"object":{let v=b;this._cache.delete(v);let u=b[this.opts.schemaId];if(u)u=(0,z.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(b){for(let v of b)this.addKeyword(v);return this}addKeyword(b,v){let u;if(typeof b=="string"){if(u=b,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof b=="object"&&v===void 0){if(v=b,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(S)=>K0.call(this,S)),this;w0.call(this,v);let E={...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(S)=>K0.call(this,S,E):(S)=>E.type.forEach((C)=>K0.call(this,S,E,C))),this}getKeyword(b){let v=this.RULES.all[b];return typeof v=="object"?v.definition:!!v}removeKeyword(b){let{RULES:v}=this;delete v.keywords[b],delete v.all[b];for(let u of v.rules){let E=u.rules.findIndex((S)=>S.keyword===b);if(E>=0)u.rules.splice(E,1)}return this}addFormat(b,v){if(typeof v=="string")v=new RegExp(v);return this.formats[b]=v,this}errorsText(b=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!b||b.length===0)return"No errors";return b.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,S)=>E+v+S)}$dataMetaSchema(b,v){let u=this.RULES.all;b=JSON.parse(JSON.stringify(b));for(let E of v){let S=E.split("/").slice(1),C=b;for(let c of S)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:z0}=r.definition,e=C[c];if(z0&&e)C[c]=H0(e)}}return b}_removeAllSchemas(b,v){for(let u in b){let E=b[u];if(!v||v.test(u)){if(typeof E=="string")delete b[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete b[u]}}}_addSchema(b,v,u,E=this.opts.validateSchema,S=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof b=="object")C=b[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof b!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(b);if(r!==void 0)return r;u=(0,z.normalizeId)(C||u);let z0=z.getSchemaRefs.call(this,b,u);if(r=new F.SchemaEnv({schema:b,schemaId:c,meta:v,baseId:u,localRefs:z0}),this._cache.set(r.schema,r),S&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(b,!0);return r}_checkUnique(b){if(this.schemas[b]||this.refs[b])throw Error(`schema with key or id "${b}" already exists`)}_compileSchemaEnv(b){if(b.meta)this._compileMetaSchema(b);else F.compileSchema.call(this,b);if(!b.validate)throw Error("ajv implementation error");return b.validate}_compileMetaSchema(b){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,b)}finally{this.opts=v}}};j.ValidationError=Y.default,j.MissingRefError=G.default,W.default=j;function R(b,v,u,E="error"){for(let S in b){let C=S;if(C in v)this.logger[E](`${u}: option ${S}. ${b[C]}`)}}function O(b){return b=(0,z.normalizeId)(b),this.schemas[b]||this.refs[b]}function w(){let b=this.opts.schemas;if(!b)return;if(Array.isArray(b))this.addSchema(b);else for(let v in b)this.addSchema(b[v],v)}function T(){for(let b in this.opts.formats){let v=this.opts.formats[b];if(v)this.addFormat(b,v)}}function k(b){if(Array.isArray(b)){this.addVocabulary(b);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in b){let u=b[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let b={...this.opts};for(let v of A)delete b[v];return b}let _={log(){},warn(){},error(){}};function h(b){if(b===!1)return _;if(b===void 0)return console;if(b.log&&b.warn&&b.error)return b;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(b,v){let{RULES:u}=this;if((0,K.eachItem)(b,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function K0(b,v,u){var E;let S=v===null||v===void 0?void 0:v.post;if(u&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=S?C.post:C.rules.find(({type:z0})=>z0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[b]=!0,!v)return;let r={keyword:b,definition:{...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)}};if(v.before)j0.call(this,c,r,v.before);else c.rules.push(r);C.all[b]=r,(E=v.implements)===null||E===void 0||E.forEach((z0)=>this.addKeyword(z0))}function j0(b,v,u){let E=b.rules.findIndex((S)=>S.keyword===u);if(E>=0)b.rules.splice(E,0,v);else b.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function w0(b){let{metaSchema:v}=b;if(v===void 0)return;if(b.$data&&this.opts.$data)v=H0(v);b.validateSchema=this.compile(v,!0)}let S0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function H0(b){return{anyOf:[b,S0]}}}),aM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=Q}),t7=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let Q=LQ(),X=x6(),Y=R0(),G=f6(),B=fX(),F=y0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:H,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:Z,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return R();let j=B.resolveRef.call(V,U,A,D);if(j===void 0)throw new Q.default(I.opts.uriResolver,A,D);if(j instanceof B.SchemaEnv)return O(j);return w(j);function R(){if(M===U)return J(K,N,M,M.$async);let T=H.scopeValue("root",{ref:U});return J(K,Y._`${T}.validate`,U,U.$async)}function O(T){J(K,z(K,T),T,T.$async)}function w(T){let k=H.scopeValue("schema",Z.code.source===!0?{ref:T,code:(0,Y.stringify)(T)}:{ref:T}),l=H.name("valid"),_=K.subschema({schema:T,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function z(K,H){let{gen:D}=K;return H.validate?D.scopeValue("validate",{ref:H.validate}):Y._`${D.scopeValue("wrapper",{ref:H})}.validate`}W.getValidate=z;function J(K,H,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:Z,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)j();else R();function j(){if(!Z.$async)throw Error("async schema referenced by sync schema");let T=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,X.callValidateCode)(K,H,U)}`),w(H),!N)A.assign(T,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),O(k),!N)A.assign(T,!1)}),K.ok(T)}function R(){K.result((0,X.callValidateCode)(K,H,U),()=>w(H),()=>O(H))}function O(T){let k=Y._`${T}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(T){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${T}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${T}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=J,W.default=L}),qH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=aM(),X=t7(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Q.default,X.default];W.default=Y}),sM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=Q.operators,Y={maximum:{okStr:"<=",ok:X.LTE,fail:X.GT},minimum:{okStr:">=",ok:X.GTE,fail:X.LT},exclusiveMaximum:{okStr:"<",ok:X.LT,fail:X.GTE},exclusiveMinimum:{okStr:">",ok:X.GT,fail:X.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>Q.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>Q._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:z}=B;B.fail$data(Q._`${L} ${Y[F].fail} ${z} || isNaN(${L})`)}};W.default=G}),tM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>Q._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,z=L.opts.multipleOfPrecision,J=G.let("res"),K=z?Q._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:Q._`${J} !== parseInt(${J})`;Y.fail$data(Q._`(${F} === 0 || (${J} = ${B}/${F}, ${K}))`)}};W.default=X}),eM=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function Q(X){let Y=X.length,G=0,B=0,F;while(B<Y)if(G++,F=X.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=X.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=Q,Q.code='require("ajv/dist/runtime/ucs2length").default'}),Wj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y=eM(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return Q.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>Q._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:z,it:J}=B,K=F==="maxLength"?Q.operators.GT:Q.operators.LT,H=J.opts.unicode===!1?Q._`${L}.length`:Q._`${(0,X.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(Q._`${H} ${K} ${z}`)}};W.default=G}),Qj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=x6(),X=y0(),Y=R0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:H}=B,D=H.opts.unicodeRegExp?"u":"";if(z){let{regExp:I}=H.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,X.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,Q.usePattern)(B,J);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),Xj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`Object.keys(${B}).length ${L} ${F}`)}};W.default=X}),Yj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=x6(),X=R0(),Y=y0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>X.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>X._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:z,data:J,$data:K,it:H}=B,{opts:D}=H;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(H.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let j of L)if((V===null||V===void 0?void 0:V[j])===void 0&&!U.has(j)){let R=`required property "${j}" is not defined at "${H.schemaEnv.baseId+H.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(H,R,H.opts.strictRequired)}}function A(){if(I||K)B.block$data(X.nil,N);else for(let V of L)(0,Q.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>Z(V,U)),B.ok(U)}else F.if((0,Q.checkMissingProp)(B,L,V)),(0,Q.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",z,(V)=>{B.setParams({missingProperty:V}),F.if((0,Q.noPropertyInData)(F,J,V,D.ownProperties),()=>B.error())})}function Z(V,U){B.setParams({missingProperty:V}),F.forOf(V,z,()=>{F.assign(U,(0,Q.propertyInData)(F,J,V,D.ownProperties)),F.if((0,X.not)(U),()=>{B.error(),F.break()})},X.nil)}}};W.default=G}),Gj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return Q.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>Q._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?Q.operators.GT:Q.operators.LT;Y.fail$data(Q._`${B}.length ${L} ${F}`)}};W.default=X}),e7=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=PH();Q.code='require("ajv/dist/runtime/equal").default',W.default=Q}),Bj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=vX(),X=R0(),Y=y0(),G=e7(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>X.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>X._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:z,$data:J,schema:K,parentSchema:H,schemaCode:D,it:I}=F;if(!J&&!K)return;let A=L.let("valid"),M=H.items?(0,Q.getSchemaTypes)(H.items):[];F.block$data(A,N,X._`${D} === false`),F.ok(A);function N(){let j=L.let("i",X._`${z}.length`),R=L.let("j");F.setParams({i:j,j:R}),L.assign(A,!0),L.if(X._`${j} > 1`,()=>(Z()?V:U)(j,R))}function Z(){return M.length>0&&!M.some((j)=>j==="object"||j==="array")}function V(j,R){let O=L.name("item"),w=(0,Q.checkDataTypes)(M,O,I.opts.strictNumbers,Q.DataType.Wrong),T=L.const("indices",X._`{}`);L.for(X._`;${j}--;`,()=>{if(L.let(O,X._`${z}[${j}]`),L.if(w,X._`continue`),M.length>1)L.if(X._`typeof ${O} == "string"`,X._`${O} += "_"`);L.if(X._`typeof ${T}[${O}] == "number"`,()=>{L.assign(R,X._`${T}[${O}]`),F.error(),L.assign(A,!1).break()}).code(X._`${T}[${O}] = ${j}`)})}function U(j,R){let O=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(X._`;${j}--;`,()=>L.for(X._`${R} = ${j}; ${R}--;`,()=>L.if(X._`${O}(${z}[${j}], ${z}[${R}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),Fj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y=e7(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>Q._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:z,schemaCode:J,schema:K}=B;if(z||K&&typeof K=="object")B.fail$data(Q._`!${(0,X.useFunc)(F,Y.default)}(${L}, ${J})`);else B.fail(Q._`${K} !== ${L}`)}};W.default=G}),Lj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y=e7(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>Q._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:H}=B;if(!z&&J.length===0)throw Error("enum must have non-empty array");let D=J.length>=H.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,X.useFunc)(F,Y.default),M;if(D||z)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(J))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,Q.or)(...J.map((U,j)=>Z(V,j)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(Q._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function Z(V,U){let j=J[U];return typeof j==="object"&&j!==null?Q._`${A()}(${L}, ${V}[${U}])`:Q._`${L} === ${j}`}}};W.default=G}),CH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=sM(),X=tM(),Y=Wj(),G=Qj(),B=Xj(),F=Yj(),L=Gj(),z=Bj(),J=Fj(),K=Lj(),H=[Q.default,X.default,Y.default,G.default,B.default,F.default,L.default,z.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},J.default,K.default];W.default=H}),kH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let Q=R0(),X=y0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>Q.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>Q._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:z}=F;if(!Array.isArray(z)){(0,X.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,z)}};function G(B,F){let{gen:L,schema:z,data:J,keyword:K,it:H}=B;H.items=!0;let D=L.const("len",Q._`${J}.length`);if(z===!1)B.setParams({len:F.length}),B.pass(Q._`${D} <= ${F.length}`);else if(typeof z=="object"&&!(0,X.alwaysValidSchema)(H,z)){let A=L.var("valid",Q._`${D} <= ${F.length}`);L.if((0,Q.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:X.Type.Num},A),!H.allErrors)L.if((0,Q.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),vH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let Q=R0(),X=y0(),Y=x6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:z}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(z.items=!0,(0,X.alwaysValidSchema)(z,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,z=F.schema){let{gen:J,parentSchema:K,data:H,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&z.length&&I.items!==!0)I.items=X.mergeEvaluated.items(J,z.length,I.items);let A=J.name("valid"),M=J.const("len",Q._`${H}.length`);z.forEach((Z,V)=>{if((0,X.alwaysValidSchema)(I,Z))return;J.if(Q._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N(Z){let{opts:V,errSchemaPath:U}=I,j=z.length,R=j===Z.minItems&&(j===Z.maxItems||Z[L]===!1);if(V.strictTuples&&!R){let O=`"${D}" is ${j}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,X.checkStrictMode)(I,O,V.strictTuples)}}}W.validateTuple=B,W.default=G}),zj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=vH(),X={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,Q.validateTuple)(Y,"items")};W.default=X}),Jj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y=x6(),G=kH(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>Q.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>Q._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:z,it:J}=F,{prefixItems:K}=z;if(J.items=!0,(0,X.alwaysValidSchema)(J,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),Kj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?Q.str`must contain at least ${G} valid item(s)`:Q.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?Q._`{minContains: ${G}}`:Q._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:z,it:J}=G,K,H,{minContains:D,maxContains:I}=L;if(J.opts.next)K=D===void 0?1:D,H=I;else K=1;let A=B.const("len",Q._`${z}.length`);if(G.setParams({min:K,max:H}),H===void 0&&K===0){(0,X.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&K>H){(0,X.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,X.alwaysValidSchema)(J,F)){let U=Q._`${A} >= ${K}`;if(H!==void 0)U=Q._`${U} && ${A} <= ${H}`;G.pass(U);return}J.items=!0;let M=B.name("valid");if(H===void 0&&K===1)Z(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),H!==void 0)B.if(Q._`${z}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),j=B.let("count",0);Z(U,()=>B.if(U,()=>V(j)))}function Z(U,j){B.forRange("i",0,A,(R)=>{G.subschema({keyword:"contains",dataProp:R,dataPropType:X.Type.Num,compositeRule:!0},U),j()})}function V(U){if(B.code(Q._`${U}++`),H===void 0)B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(Q._`${U} > ${H}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(Q._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),WB=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let Q=R0(),X=y0(),Y=x6();W.error={message:({params:{property:z,depsCount:J,deps:K}})=>{let H=J===1?"property":"properties";return Q.str`must have ${H} ${K} when property ${z} is present`},params:({params:{property:z,depsCount:J,deps:K,missingProperty:H}})=>Q._`{property: ${z},
109
- missingProperty: ${H},
216
+ */LO=G0((W)=>{var X=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/\\([\u000b\u0020-\u00ff])/g,Y=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;W.parse=G;function G(L){if(!L)throw TypeError("argument string is required");var z=typeof L==="object"?B(L):L;if(typeof z!=="string")throw TypeError("argument string is required to be a string");var J=z.indexOf(";"),K=J!==-1?z.slice(0,J).trim():z.trim();if(!Y.test(K))throw TypeError("invalid media type");var Z=new F(K.toLowerCase());if(J!==-1){var D,I,A;X.lastIndex=J;while(I=X.exec(z)){if(I.index!==J)throw TypeError("invalid parameter format");if(J+=I[0].length,D=I[1].toLowerCase(),A=I[2],A.charCodeAt(0)===34){if(A=A.slice(1,-1),A.indexOf("\\")!==-1)A=A.replace(Q,"$1")}Z.parameters[D]=A}if(J!==z.length)throw TypeError("invalid parameter format")}return Z}function B(L){var z;if(typeof L.getHeader==="function")z=L.getHeader("content-type");else if(typeof L.headers==="object")z=L.headers&&L.headers["content-type"];if(typeof z!=="string")throw TypeError("content-type header is missing from object");return z}function F(L){this.parameters=Object.create(null),this.type=L}}),Qb=PQ(LO(),1)});function Mj(){let W=new Nj.Ajv2020({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Dj(W),W}var hQ,x$,R0,y0,x6,lQ,zO,h$,u$,uQ,JO,h6,KO,ZO,l$,$O,mQ,$X,cQ,HX,pQ,HO,m$,UO,AO,NO,c$,VO,JB,p$,wO,DO,MO,OO,jO,EO,IO,RO,KB,TO,PO,SO,d$,i$,n$,bO,qO,CO,ZB,kO,r$,vO,yO,_O,gO,fO,xO,hO,uO,o$,lO,a$,s$,mO,cO,t$,pO,e$,WH,XH,dO,iO,nO,rO,oO,aO,sO,tO,eO,Wj,Xj,Qj,Yj,Gj,Bj,Fj,Lj,zj,Jj,Kj,Zj,$j,Hj,Uj,Aj,Nj,Vj,wj,Dj,$B=class{_ajv;_userAjv;constructor(W){this._userAjv=W!==void 0,this._ajv=W}get ajv(){return this._ajv??=Mj()}getValidator(W){if(!this._userAjv&&"$schema"in W&&typeof W.$schema==="string"&&!wj.has(W.$schema.replace(/#$/,""))){let Y=W.$schema.slice(0,200);throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${Y}"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.`)}let X=this.ajv,Q="$id"in W&&typeof W.$id==="string"?X.getSchema(W.$id)??X.compile(W):X.compile(W);return(Y)=>{return Q(Y)?{valid:!0,data:Y,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:X.errorsText(Q.errors)}}}},Hb;var QH=H0(()=>{h7();hQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.regexpCode=W.getEsmExportName=W.getProperty=W.safeStringify=W.stringify=W.strConcat=W.addCodeArg=W.str=W._=W.nil=W._Code=W.Name=W.IDENTIFIER=W._CodeOrName=void 0;var X=class{};W._CodeOrName=X,W.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Q=class extends X{constructor($){super();if(!W.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};W.Name=Q;var Y=class extends X{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((V,U)=>`${V}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((V,U)=>{if(U instanceof Q)V[U.str]=(V[U.str]||0)+1;return V},{})}};W._Code=Y,W.nil=new Y("");function G($,...V){let U=[$[0]],O=0;while(O<V.length)L(U,V[O]),U.push($[++O]);return new Y(U)}W._=G;let B=new Y("+");function F($,...V){let U=[I($[0])],O=0;while(O<V.length)U.push(B),L(U,V[O]),U.push(B,I($[++O]));return z(U),new Y(U)}W.str=F;function L($,V){if(V instanceof Y)$.push(...V._items);else if(V instanceof Q)$.push(V);else $.push(Z(V))}W.addCodeArg=L;function z($){let V=1;while(V<$.length-1){if($[V]===B){let U=J($[V-1],$[V+1]);if(U!==void 0){$.splice(V-1,3,U);continue}$[V++]="+"}V++}}function J($,V){if(V==='""')return $;if($==='""')return V;if(typeof $=="string"){if(V instanceof Q||$[$.length-1]!=='"')return;if(typeof V!="string")return`${$.slice(0,-1)}${V}"`;if(V[0]==='"')return $.slice(0,-1)+V.slice(1);return}if(typeof V=="string"&&V[0]==='"'&&!($ instanceof Q))return`"${$}${V.slice(1)}`}function K($,V){return V.emptyStr()?$:$.emptyStr()?V:F`${$}${V}`}W.strConcat=K;function Z($){return typeof $=="number"||typeof $=="boolean"||$===null?$:I(Array.isArray($)?$.join(","):$)}function D($){return new Y(I($))}W.stringify=D;function I($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}W.safeStringify=I;function A($){return typeof $=="string"&&W.IDENTIFIER.test($)?new Y(`.${$}`):G`[${$}]`}W.getProperty=A;function M($){if(typeof $=="string"&&W.IDENTIFIER.test($))return new Y(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}W.getEsmExportName=M;function N($){return new Y($.toString())}W.regexpCode=N}),x$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.ValueScope=W.ValueScopeName=W.Scope=W.varKinds=W.UsedValueState=void 0;let X=hQ();var Q=class extends Error{constructor(z){super(`CodeGen: "code" for ${z} not defined`);this.value=z.value}},Y;(function(z){z[z.Started=0]="Started",z[z.Completed=1]="Completed"})(Y||(W.UsedValueState=Y={})),W.varKinds={const:new X.Name("const"),let:new X.Name("let"),var:new X.Name("var")};var G=class{constructor({prefixes:z,parent:J}={}){this._names={},this._prefixes=z,this._parent=J}toName(z){return z instanceof X.Name?z:this.name(z)}name(z){return new X.Name(this._newName(z))}_newName(z){let J=this._names[z]||this._nameGroup(z);return`${z}${J.index++}`}_nameGroup(z){var J,K;if(((K=(J=this._parent)===null||J===void 0?void 0:J._prefixes)===null||K===void 0?void 0:K.has(z))||this._prefixes&&!this._prefixes.has(z))throw Error(`CodeGen: prefix "${z}" is not allowed in this scope`);return this._names[z]={prefix:z,index:0}}};W.Scope=G;var B=class extends X.Name{constructor(z,J){super(J);this.prefix=z}setValue(z,{property:J,itemIndex:K}){this.value=z,this.scopePath=X._`.${new X.Name(J)}[${K}]`}};W.ValueScopeName=B;let F=X._`\n`;var L=class extends G{constructor(z){super(z);this._values={},this._scope=z.scope,this.opts={...z,_n:z.lines?F:X.nil}}get(){return this._scope}name(z){return new B(z,this._newName(z))}value(z,J){var K;if(J.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Z=this.toName(z),{prefix:D}=Z,I=(K=J.key)!==null&&K!==void 0?K:J.ref,A=this._values[D];if(A){let $=A.get(I);if($)return $}else A=this._values[D]=new Map;A.set(I,Z);let M=this._scope[D]||(this._scope[D]=[]),N=M.length;return M[N]=J.ref,Z.setValue(J,{property:D,itemIndex:N}),Z}getValue(z,J){let K=this._values[z];if(!K)return;return K.get(J)}scopeRefs(z,J=this._values){return this._reduceValues(J,(K)=>{if(K.scopePath===void 0)throw Error(`CodeGen: name "${K}" has no value`);return X._`${z}${K.scopePath}`})}scopeCode(z=this._values,J,K){return this._reduceValues(z,(Z)=>{if(Z.value===void 0)throw Error(`CodeGen: name "${Z}" has no value`);return Z.value.code},J,K)}_reduceValues(z,J,K={},Z){let D=X.nil;for(let I in z){let A=z[I];if(!A)continue;let M=K[I]=K[I]||new Map;A.forEach((N)=>{if(M.has(N))return;M.set(N,Y.Started);let $=J(N);if($){let V=this.opts.es5?W.varKinds.var:W.varKinds.const;D=X._`${D}${V} ${N} = ${$};${this.opts._n}`}else if($=Z===null||Z===void 0?void 0:Z(N))D=X._`${D}${$}${this.opts._n}`;else throw new Q(N);M.set(N,Y.Completed)})}return D}};W.ValueScope=L}),R0=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.or=W.and=W.not=W.CodeGen=W.operators=W.varKinds=W.ValueScopeName=W.ValueScope=W.Scope=W.Name=W.regexpCode=W.stringify=W.getProperty=W.nil=W.strConcat=W.str=W._=void 0;let X=hQ(),Q=x$();var Y=hQ();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Y._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Y.str}}),Object.defineProperty(W,"strConcat",{enumerable:!0,get:function(){return Y.strConcat}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Y.nil}}),Object.defineProperty(W,"getProperty",{enumerable:!0,get:function(){return Y.getProperty}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Y.stringify}}),Object.defineProperty(W,"regexpCode",{enumerable:!0,get:function(){return Y.regexpCode}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Y.Name}});var G=x$();Object.defineProperty(W,"Scope",{enumerable:!0,get:function(){return G.Scope}}),Object.defineProperty(W,"ValueScope",{enumerable:!0,get:function(){return G.ValueScope}}),Object.defineProperty(W,"ValueScopeName",{enumerable:!0,get:function(){return G.ValueScopeName}}),Object.defineProperty(W,"varKinds",{enumerable:!0,get:function(){return G.varKinds}}),W.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var B=class{optimizeNodes(){return this}optimizeNames(E,S){return this}},F=class extends B{constructor(E,S,C){super();this.varKind=E,this.name=S,this.rhs=C}render({es5:E,_n:S}){let C=E?Q.varKinds.var:this.varKind,c=this.rhs===void 0?"":` = ${this.rhs}`;return`${C} ${this.name}${c};`+S}optimizeNames(E,S){if(!E[this.name.str])return;if(this.rhs)this.rhs=p(this.rhs,E,S);return this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},L=class extends B{constructor(E,S,C){super();this.lhs=E,this.rhs=S,this.sideEffects=C}render({_n:E}){return`${this.lhs} = ${this.rhs};`+E}optimizeNames(E,S){if(this.lhs instanceof X.Name&&!E[this.lhs.str]&&!this.sideEffects)return;return this.rhs=p(this.rhs,E,S),this}get names(){return d(this.lhs instanceof X.Name?{}:{...this.lhs.names},this.rhs)}},z=class extends L{constructor(E,S,C,c){super(E,C,c);this.op=S}render({_n:E}){return`${this.lhs} ${this.op}= ${this.rhs};`+E}},J=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`${this.label}:`+E}},K=class extends B{constructor(E){super();this.label=E,this.names={}}render({_n:E}){return`break${this.label?` ${this.label}`:""};`+E}},Z=class extends B{constructor(E){super();this.error=E}render({_n:E}){return`throw ${this.error};`+E}get names(){return this.error.names}},D=class extends B{constructor(E){super();this.code=E}render({_n:E}){return`${this.code};`+E}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(E,S){return this.code=p(this.code,E,S),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},I=class extends B{constructor(E=[]){super();this.nodes=E}render(E){return this.nodes.reduce((S,C)=>S+C.render(E),"")}optimizeNodes(){let{nodes:E}=this,S=E.length;while(S--){let C=E[S].optimizeNodes();if(Array.isArray(C))E.splice(S,1,...C);else if(C)E[S]=C;else E.splice(S,1)}return E.length>0?this:void 0}optimizeNames(E,S){let{nodes:C}=this,c=C.length;while(c--){let r=C[c];if(r.optimizeNames(E,S))continue;K0(E,r.names),C.splice(c,1)}return C.length>0?this:void 0}get names(){return this.nodes.reduce((E,S)=>h(E,S.names),{})}},A=class extends I{render(E){return"{"+E._n+super.render(E)+"}"+E._n}},M=class extends I{},N=class extends A{};N.kind="else";var $=class E extends A{constructor(S,C){super(C);this.condition=S}render(S){let C=`if(${this.condition})`+super.render(S);if(this.else)C+="else "+this.else.render(S);return C}optimizeNodes(){super.optimizeNodes();let S=this.condition;if(S===!0)return this.nodes;let C=this.else;if(C){let c=C.optimizeNodes();C=this.else=Array.isArray(c)?new N(c):c}if(C){if(S===!1)return C instanceof E?C:C.nodes;if(this.nodes.length)return this;return new E(O0(S),C instanceof E?[C]:C.nodes)}if(S===!1||!this.nodes.length)return;return this}optimizeNames(S,C){var c;if(this.else=(c=this.else)===null||c===void 0?void 0:c.optimizeNames(S,C),!(super.optimizeNames(S,C)||this.else))return;return this.condition=p(this.condition,S,C),this}get names(){let S=super.names;if(d(S,this.condition),this.else)h(S,this.else.names);return S}};$.kind="if";var V=class extends A{};V.kind="for";var U=class extends V{constructor(E){super();this.iteration=E}render(E){return`for(${this.iteration})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iteration=p(this.iteration,E,S),this}get names(){return h(super.names,this.iteration.names)}},O=class extends V{constructor(E,S,C,c){super();this.varKind=E,this.name=S,this.from=C,this.to=c}render(E){let S=E.es5?Q.varKinds.var:this.varKind,{name:C,from:c,to:r}=this;return`for(${S} ${C}=${c}; ${C}<${r}; ${C}++)`+super.render(E)}get names(){return d(d(super.names,this.from),this.to)}},R=class extends V{constructor(E,S,C,c){super();this.loop=E,this.varKind=S,this.name=C,this.iterable=c}render(E){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(E)}optimizeNames(E,S){if(!super.optimizeNames(E,S))return;return this.iterable=p(this.iterable,E,S),this}get names(){return h(super.names,this.iterable.names)}},j=class extends A{constructor(E,S,C){super();this.name=E,this.args=S,this.async=C}render(E){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(E)}};j.kind="func";var w=class extends I{render(E){return"return "+super.render(E)}};w.kind="return";var T=class extends A{render(E){let S="try"+super.render(E);if(this.catch)S+=this.catch.render(E);if(this.finally)S+=this.finally.render(E);return S}optimizeNodes(){var E,S;return super.optimizeNodes(),(E=this.catch)===null||E===void 0||E.optimizeNodes(),(S=this.finally)===null||S===void 0||S.optimizeNodes(),this}optimizeNames(E,S){var C,c;return super.optimizeNames(E,S),(C=this.catch)===null||C===void 0||C.optimizeNames(E,S),(c=this.finally)===null||c===void 0||c.optimizeNames(E,S),this}get names(){let E=super.names;if(this.catch)h(E,this.catch.names);if(this.finally)h(E,this.finally.names);return E}},k=class extends A{constructor(E){super();this.error=E}render(E){return`catch(${this.error})`+super.render(E)}};k.kind="catch";var l=class extends A{render(E){return"finally"+super.render(E)}};l.kind="finally";var _=class{constructor(E,S={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...S,_n:S.lines?`
217
+ `:""},this._extScope=E,this._scope=new Q.Scope({parent:E}),this._nodes=[new M]}toString(){return this._root.render(this.opts)}name(E){return this._scope.name(E)}scopeName(E){return this._extScope.name(E)}scopeValue(E,S){let C=this._extScope.value(E,S);return(this._values[C.prefix]||(this._values[C.prefix]=new Set)).add(C),C}getScopeValue(E,S){return this._extScope.getValue(E,S)}scopeRefs(E){return this._extScope.scopeRefs(E,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(E,S,C,c){let r=this._scope.toName(S);if(C!==void 0&&c)this._constants[r.str]=C;return this._leafNode(new F(E,r,C)),r}const(E,S,C){return this._def(Q.varKinds.const,E,S,C)}let(E,S,C){return this._def(Q.varKinds.let,E,S,C)}var(E,S,C){return this._def(Q.varKinds.var,E,S,C)}assign(E,S,C){return this._leafNode(new L(E,S,C))}add(E,S){return this._leafNode(new z(E,W.operators.ADD,S))}code(E){if(typeof E=="function")E();else if(E!==X.nil)this._leafNode(new D(E));return this}object(...E){let S=["{"];for(let[C,c]of E){if(S.length>1)S.push(",");if(S.push(C),C!==c||this.opts.es5)S.push(":"),(0,X.addCodeArg)(S,c)}return S.push("}"),new X._Code(S)}if(E,S,C){if(this._blockNode(new $(E)),S&&C)this.code(S).else().code(C).endIf();else if(S)this.code(S).endIf();else if(C)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(E){return this._elseNode(new $(E))}else(){return this._elseNode(new N)}endIf(){return this._endBlockNode($,N)}_for(E,S){if(this._blockNode(E),S)this.code(S).endFor();return this}for(E,S){return this._for(new U(E),S)}forRange(E,S,C,c,r=this.opts.es5?Q.varKinds.var:Q.varKinds.let){let z0=this._scope.toName(E);return this._for(new O(r,z0,S,C),()=>c(z0))}forOf(E,S,C,c=Q.varKinds.const){let r=this._scope.toName(E);if(this.opts.es5){let z0=S instanceof X.Name?S:this.var("_arr",S);return this.forRange("_i",0,X._`${z0}.length`,(e)=>{this.var(r,X._`${z0}[${e}]`),C(r)})}return this._for(new R("of",c,r,S),()=>C(r))}forIn(E,S,C,c=this.opts.es5?Q.varKinds.var:Q.varKinds.const){if(this.opts.ownProperties)return this.forOf(E,X._`Object.keys(${S})`,C);let r=this._scope.toName(E);return this._for(new R("in",c,r,S),()=>C(r))}endFor(){return this._endBlockNode(V)}label(E){return this._leafNode(new J(E))}break(E){return this._leafNode(new K(E))}return(E){let S=new w;if(this._blockNode(S),this.code(E),S.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(w)}try(E,S,C){if(!S&&!C)throw Error('CodeGen: "try" without "catch" and "finally"');let c=new T;if(this._blockNode(c),this.code(E),S){let r=this.name("e");this._currNode=c.catch=new k(r),S(r)}if(C)this._currNode=c.finally=new l,this.code(C);return this._endBlockNode(k,l)}throw(E){return this._leafNode(new Z(E))}block(E,S){if(this._blockStarts.push(this._nodes.length),E)this.code(E).endBlock(S);return this}endBlock(E){let S=this._blockStarts.pop();if(S===void 0)throw Error("CodeGen: not in self-balancing block");let C=this._nodes.length-S;if(C<0||E!==void 0&&C!==E)throw Error(`CodeGen: wrong number of nodes: ${C} vs ${E} expected`);return this._nodes.length=S,this}func(E,S=X.nil,C,c){if(this._blockNode(new j(E,S,C)),c)this.code(c).endFunc();return this}endFunc(){return this._endBlockNode(j)}optimize(E=1){while(E-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(E){return this._currNode.nodes.push(E),this}_blockNode(E){this._currNode.nodes.push(E),this._nodes.push(E)}_endBlockNode(E,S){let C=this._currNode;if(C instanceof E||S&&C instanceof S)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${S?`${E.kind}/${S.kind}`:E.kind}"`)}_elseNode(E){let S=this._currNode;if(!(S instanceof $))throw Error('CodeGen: "else" without "if"');return this._currNode=S.else=E,this}get _root(){return this._nodes[0]}get _currNode(){let E=this._nodes;return E[E.length-1]}set _currNode(E){let S=this._nodes;S[S.length-1]=E}};W.CodeGen=_;function h(E,S){for(let C in S)E[C]=(E[C]||0)+(S[C]||0);return E}function d(E,S){return S instanceof X._CodeOrName?h(E,S.names):E}function p(E,S,C){if(E instanceof X.Name)return c(E);if(!r(E))return E;return new X._Code(E._items.reduce((z0,e)=>{if(e instanceof X.Name)e=c(e);if(e instanceof X._Code)z0.push(...e._items);else z0.push(e);return z0},[]));function c(z0){let e=C[z0.str];if(e===void 0||S[z0.str]!==1)return z0;return delete S[z0.str],e}function r(z0){return z0 instanceof X._Code&&z0._items.some((e)=>e instanceof X.Name&&S[e.str]===1&&C[e.str]!==void 0)}}function K0(E,S){for(let C in S)E[C]=(E[C]||0)-(S[C]||0)}function O0(E){return typeof E=="boolean"||typeof E=="number"||E===null?!E:X._`!${u(E)}`}W.not=O0;let w0=v(W.operators.AND);function S0(...E){return E.reduce(w0)}W.and=S0;let $0=v(W.operators.OR);function b(...E){return E.reduce($0)}W.or=b;function v(E){return(S,C)=>S===X.nil?C:C===X.nil?S:X._`${u(S)} ${E} ${u(C)}`}function u(E){return E instanceof X.Name?E:X._`(${E})`}}),y0=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;let X=R0(),Q=hQ();function Y(j){let w={};for(let T of j)w[T]=!0;return w}W.toHash=Y;function G(j,w){if(typeof w=="boolean")return w;if(Object.keys(w).length===0)return!0;return B(j,w),!F(w,j.self.RULES.all)}W.alwaysValidSchema=G;function B(j,w=j.schema){let{opts:T,self:k}=j;if(!T.strictSchema)return;if(typeof w==="boolean")return;let l=k.RULES.keywords;for(let _ in w)if(!l[_])R(j,`unknown keyword: "${_}"`)}W.checkUnknownRules=B;function F(j,w){if(typeof j=="boolean")return!j;for(let T in j)if(w[T])return!0;return!1}W.schemaHasRules=F;function L(j,w){if(typeof j=="boolean")return!j;for(let T in j)if(T!=="$ref"&&w.all[T])return!0;return!1}W.schemaHasRulesButRef=L;function z({topSchemaRef:j,schemaPath:w},T,k,l){if(!l){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return X._`${T}`}return X._`${j}${w}${(0,X.getProperty)(k)}`}W.schemaRefOrVal=z;function J(j){return D(decodeURIComponent(j))}W.unescapeFragment=J;function K(j){return encodeURIComponent(Z(j))}W.escapeFragment=K;function Z(j){if(typeof j=="number")return`${j}`;return j.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=Z;function D(j){return j.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=D;function I(j,w){if(Array.isArray(j))for(let T of j)w(T);else w(j)}W.eachItem=I;function A({mergeNames:j,mergeToName:w,mergeValues:T,resultToName:k}){return(l,_,h,d)=>{let p=h===void 0?_:h instanceof X.Name?(_ instanceof X.Name?j(l,_,h):w(l,_,h),h):_ instanceof X.Name?(w(l,h,_),_):T(_,h);return d===X.Name&&!(p instanceof X.Name)?k(l,p):p}}W.mergeEvaluated={props:A({mergeNames:(j,w,T)=>j.if(X._`${T} !== true && ${w} !== undefined`,()=>{j.if(X._`${w} === true`,()=>j.assign(T,!0),()=>j.assign(T,X._`${T} || {}`).code(X._`Object.assign(${T}, ${w})`))}),mergeToName:(j,w,T)=>j.if(X._`${T} !== true`,()=>{if(w===!0)j.assign(T,!0);else j.assign(T,X._`${T} || {}`),N(j,T,w)}),mergeValues:(j,w)=>j===!0?!0:{...j,...w},resultToName:M}),items:A({mergeNames:(j,w,T)=>j.if(X._`${T} !== true && ${w} !== undefined`,()=>j.assign(T,X._`${w} === true ? true : ${T} > ${w} ? ${T} : ${w}`)),mergeToName:(j,w,T)=>j.if(X._`${T} !== true`,()=>j.assign(T,w===!0?!0:X._`${T} > ${w} ? ${T} : ${w}`)),mergeValues:(j,w)=>j===!0?!0:Math.max(j,w),resultToName:(j,w)=>j.var("items",w)})};function M(j,w){if(w===!0)return j.var("props",!0);let T=j.var("props",X._`{}`);if(w!==void 0)N(j,T,w);return T}W.evaluatedPropsToName=M;function N(j,w,T){Object.keys(T).forEach((k)=>j.assign(X._`${w}${(0,X.getProperty)(k)}`,!0))}W.setEvaluated=N;let $={};function V(j,w){return j.scopeValue("func",{ref:w,code:$[w.code]||($[w.code]=new Q._Code(w.code))})}W.useFunc=V;var U;(function(j){j[j.Num=0]="Num",j[j.Str=1]="Str"})(U||(W.Type=U={}));function O(j,w,T){if(j instanceof X.Name){let k=w===U.Num;return T?k?X._`"[" + ${j} + "]"`:X._`"['" + ${j} + "']"`:k?X._`"/" + ${j}`:X._`"/" + ${j}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,X.getProperty)(j).toString():"/"+Z(j)}W.getErrorPath=O;function R(j,w,T=j.opts.strictSchema){if(!T)return;if(w=`strict mode: ${w}`,T===!0)throw Error(w);j.self.logger.warn(w)}W.checkStrictMode=R}),x6=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q={data:new X.Name("data"),valCxt:new X.Name("valCxt"),instancePath:new X.Name("instancePath"),parentData:new X.Name("parentData"),parentDataProperty:new X.Name("parentDataProperty"),rootData:new X.Name("rootData"),dynamicAnchors:new X.Name("dynamicAnchors"),vErrors:new X.Name("vErrors"),errors:new X.Name("errors"),this:new X.Name("this"),self:new X.Name("self"),scope:new X.Name("scope"),json:new X.Name("json"),jsonPos:new X.Name("jsonPos"),jsonLen:new X.Name("jsonLen"),jsonPart:new X.Name("jsonPart")};W.default=Q}),lQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendErrors=W.resetErrorsCount=W.reportExtraError=W.reportError=W.keyword$DataError=W.keywordError=void 0;let X=R0(),Q=y0(),Y=x6();W.keywordError={message:({keyword:N})=>X.str`must pass "${N}" keyword validation`},W.keyword$DataError={message:({keyword:N,schemaType:$})=>$?X.str`"${N}" keyword must be ${$} ($data)`:X.str`"${N}" keyword is invalid ($data)`};function G(N,$=W.keywordError,V,U){let{it:O}=N,{gen:R,compositeRule:j,allErrors:w}=O,T=Z(N,$,V);if(U!==null&&U!==void 0?U:j||w)z(R,T);else J(O,X._`[${T}]`)}W.reportError=G;function B(N,$=W.keywordError,V){let{it:U}=N,{gen:O,compositeRule:R,allErrors:j}=U;if(z(O,Z(N,$,V)),!(R||j))J(U,Y.default.vErrors)}W.reportExtraError=B;function F(N,$){N.assign(Y.default.errors,$),N.if(X._`${Y.default.vErrors} !== null`,()=>N.if($,()=>N.assign(X._`${Y.default.vErrors}.length`,$),()=>N.assign(Y.default.vErrors,null)))}W.resetErrorsCount=F;function L({gen:N,keyword:$,schemaValue:V,data:U,errsCount:O,it:R}){if(O===void 0)throw Error("ajv implementation error");let j=N.name("err");N.forRange("i",O,Y.default.errors,(w)=>{if(N.const(j,X._`${Y.default.vErrors}[${w}]`),N.if(X._`${j}.instancePath === undefined`,()=>N.assign(X._`${j}.instancePath`,(0,X.strConcat)(Y.default.instancePath,R.errorPath))),N.assign(X._`${j}.schemaPath`,X.str`${R.errSchemaPath}/${$}`),R.opts.verbose)N.assign(X._`${j}.schema`,V),N.assign(X._`${j}.data`,U)})}W.extendErrors=L;function z(N,$){let V=N.const("err",$);N.if(X._`${Y.default.vErrors} === null`,()=>N.assign(Y.default.vErrors,X._`[${V}]`),X._`${Y.default.vErrors}.push(${V})`),N.code(X._`${Y.default.errors}++`)}function J(N,$){let{gen:V,validateName:U,schemaEnv:O}=N;if(O.$async)V.throw(X._`new ${N.ValidationError}(${$})`);else V.assign(X._`${U}.errors`,$),V.return(!1)}let K={keyword:new X.Name("keyword"),schemaPath:new X.Name("schemaPath"),params:new X.Name("params"),propertyName:new X.Name("propertyName"),message:new X.Name("message"),schema:new X.Name("schema"),parentSchema:new X.Name("parentSchema")};function Z(N,$,V){let{createErrors:U}=N.it;if(U===!1)return X._`{}`;return D(N,$,V)}function D(N,$,V={}){let{gen:U,it:O}=N,R=[I(O,V),A(N,V)];return M(N,$,R),U.object(...R)}function I({errorPath:N},{instancePath:$}){let V=$?X.str`${N}${(0,Q.getErrorPath)($,Q.Type.Str)}`:N;return[Y.default.instancePath,(0,X.strConcat)(Y.default.instancePath,V)]}function A({keyword:N,it:{errSchemaPath:$}},{schemaPath:V,parentSchema:U}){let O=U?$:X.str`${$}/${N}`;if(V)O=X.str`${O}${(0,Q.getErrorPath)(V,Q.Type.Str)}`;return[K.schemaPath,O]}function M(N,{params:$,message:V},U){let{keyword:O,data:R,schemaValue:j,it:w}=N,{opts:T,propertyName:k,topSchemaRef:l,schemaPath:_}=w;if(U.push([K.keyword,O],[K.params,typeof $=="function"?$(N):$||X._`{}`]),T.messages)U.push([K.message,typeof V=="function"?V(N):V]);if(T.verbose)U.push([K.schema,j],[K.parentSchema,X._`${l}${_}`],[Y.default.data,R]);if(k)U.push([K.propertyName,k])}}),zO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.boolOrEmptySchema=W.topBoolOrEmptySchema=void 0;let X=lQ(),Q=R0(),Y=x6(),G={message:"boolean schema is false"};function B(z){let{gen:J,schema:K,validateName:Z}=z;if(K===!1)L(z,!1);else if(typeof K=="object"&&K.$async===!0)J.return(Y.default.data);else J.assign(Q._`${Z}.errors`,null),J.return(!0)}W.topBoolOrEmptySchema=B;function F(z,J){let{gen:K,schema:Z}=z;if(Z===!1)K.var(J,!1),L(z);else K.var(J,!0)}W.boolOrEmptySchema=F;function L(z,J){let{gen:K,data:Z}=z,D={gen:K,keyword:"false schema",data:Z,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:z};(0,X.reportError)(D,G,void 0,J)}}),h$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getRules=W.isJSONType=void 0;let X=new Set(["string","number","integer","boolean","null","object","array"]);function Q(G){return typeof G=="string"&&X.has(G)}W.isJSONType=Q;function Y(){let G={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...G,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},G.number,G.string,G.array,G.object],post:{rules:[]},all:{},keywords:{}}}W.getRules=Y}),u$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.shouldUseRule=W.shouldUseGroup=W.schemaHasRulesForType=void 0;function X({schema:G,self:B},F){let L=B.RULES.types[F];return L&&L!==!0&&Q(G,L)}W.schemaHasRulesForType=X;function Q(G,B){return B.rules.some((F)=>Y(G,F))}W.shouldUseGroup=Q;function Y(G,B){var F;return G[B.keyword]!==void 0||((F=B.definition.implements)===null||F===void 0?void 0:F.some((L)=>G[L]!==void 0))}W.shouldUseRule=Y}),uQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.reportTypeError=W.checkDataTypes=W.checkDataType=W.coerceAndCheckDataType=W.getJSONTypes=W.getSchemaTypes=W.DataType=void 0;let X=h$(),Q=u$(),Y=lQ(),G=R0(),B=y0();var F;(function(U){U[U.Correct=0]="Correct",U[U.Wrong=1]="Wrong"})(F||(W.DataType=F={}));function L(U){let O=z(U.type);if(O.includes("null")){if(U.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!O.length&&U.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(U.nullable===!0)O.push("null")}return O}W.getSchemaTypes=L;function z(U){let O=Array.isArray(U)?U:U?[U]:[];if(O.every(X.isJSONType))return O;throw Error("type must be JSONType or JSONType[]: "+O.join(","))}W.getJSONTypes=z;function J(U,O){let{gen:R,data:j,opts:w}=U,T=Z(O,w.coerceTypes),k=O.length>0&&!(T.length===0&&O.length===1&&(0,Q.schemaHasRulesForType)(U,O[0]));if(k){let l=M(O,j,w.strictNumbers,F.Wrong);R.if(l,()=>{if(T.length)D(U,O,T);else $(U)})}return k}W.coerceAndCheckDataType=J;let K=new Set(["string","number","integer","boolean","null"]);function Z(U,O){return O?U.filter((R)=>K.has(R)||O==="array"&&R==="array"):[]}function D(U,O,R){let{gen:j,data:w,opts:T}=U,k=j.let("dataType",G._`typeof ${w}`),l=j.let("coerced",G._`undefined`);if(T.coerceTypes==="array")j.if(G._`${k} == 'object' && Array.isArray(${w}) && ${w}.length == 1`,()=>j.assign(w,G._`${w}[0]`).assign(k,G._`typeof ${w}`).if(M(O,w,T.strictNumbers),()=>j.assign(l,w)));j.if(G._`${l} !== undefined`);for(let h of R)if(K.has(h)||h==="array"&&T.coerceTypes==="array")_(h);j.else(),$(U),j.endIf(),j.if(G._`${l} !== undefined`,()=>{j.assign(w,l),I(U,l)});function _(h){switch(h){case"string":j.elseIf(G._`${k} == "number" || ${k} == "boolean"`).assign(l,G._`"" + ${w}`).elseIf(G._`${w} === null`).assign(l,G._`""`);return;case"number":j.elseIf(G._`${k} == "boolean" || ${w} === null
218
+ || (${k} == "string" && ${w} && ${w} == +${w})`).assign(l,G._`+${w}`);return;case"integer":j.elseIf(G._`${k} === "boolean" || ${w} === null
219
+ || (${k} === "string" && ${w} && ${w} == +${w} && !(${w} % 1))`).assign(l,G._`+${w}`);return;case"boolean":j.elseIf(G._`${w} === "false" || ${w} === 0 || ${w} === null`).assign(l,!1).elseIf(G._`${w} === "true" || ${w} === 1`).assign(l,!0);return;case"null":j.elseIf(G._`${w} === "" || ${w} === 0 || ${w} === false`),j.assign(l,null);return;case"array":j.elseIf(G._`${k} === "string" || ${k} === "number"
220
+ || ${k} === "boolean" || ${w} === null`).assign(l,G._`[${w}]`)}}}function I({gen:U,parentData:O,parentDataProperty:R},j){U.if(G._`${O} !== undefined`,()=>U.assign(G._`${O}[${R}]`,j))}function A(U,O,R,j=F.Correct){let w=j===F.Correct?G.operators.EQ:G.operators.NEQ,T;switch(U){case"null":return G._`${O} ${w} null`;case"array":T=G._`Array.isArray(${O})`;break;case"object":T=G._`${O} && typeof ${O} == "object" && !Array.isArray(${O})`;break;case"integer":T=k(G._`!(${O} % 1) && !isNaN(${O})`);break;case"number":T=k();break;default:return G._`typeof ${O} ${w} ${U}`}return j===F.Correct?T:(0,G.not)(T);function k(l=G.nil){return(0,G.and)(G._`typeof ${O} == "number"`,l,R?G._`isFinite(${O})`:G.nil)}}W.checkDataType=A;function M(U,O,R,j){if(U.length===1)return A(U[0],O,R,j);let w,T=(0,B.toHash)(U);if(T.array&&T.object){let k=G._`typeof ${O} != "object"`;w=T.null?k:G._`!${O} || ${k}`,delete T.null,delete T.array,delete T.object}else w=G.nil;if(T.number)delete T.integer;for(let k in T)w=(0,G.and)(w,A(k,O,R,j));return w}W.checkDataTypes=M;let N={message:({schema:U})=>`must be ${U}`,params:({schema:U,schemaValue:O})=>typeof U=="string"?G._`{type: ${U}}`:G._`{type: ${O}}`};function $(U){let O=V(U);(0,Y.reportError)(O,N)}W.reportTypeError=$;function V(U){let{gen:O,data:R,schema:j}=U,w=(0,B.schemaRefOrVal)(U,j,"type");return{gen:O,keyword:"type",data:R,schema:j.type,schemaCode:w,schemaValue:w,parentSchema:j,params:{},it:U}}}),JO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.assignDefaults=void 0;let X=R0(),Q=y0();function Y(B,F){let{properties:L,items:z}=B.schema;if(F==="object"&&L)for(let J in L)G(B,J,L[J].default);else if(F==="array"&&Array.isArray(z))z.forEach((J,K)=>G(B,K,J.default))}W.assignDefaults=Y;function G(B,F,L){let{gen:z,compositeRule:J,data:K,opts:Z}=B;if(L===void 0)return;let D=X._`${K}${(0,X.getProperty)(F)}`;if(J){(0,Q.checkStrictMode)(B,`default is ignored for: ${D}`);return}let I=X._`${D} === undefined`;if(Z.useDefaults==="empty")I=X._`${I} || ${D} === null || ${D} === ""`;z.if(I,X._`${D} = ${(0,X.stringify)(L)}`)}}),h6=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;let X=R0(),Q=y0(),Y=x6(),G=y0();function B(U,O){let{gen:R,data:j,it:w}=U;R.if(Z(R,j,O,w.opts.ownProperties),()=>{U.setParams({missingProperty:X._`${O}`},!0),U.error()})}W.checkReportMissingProp=B;function F({gen:U,data:O,it:{opts:R}},j,w){return(0,X.or)(...j.map((T)=>(0,X.and)(Z(U,O,T,R.ownProperties),X._`${w} = ${T}`)))}W.checkMissingProp=F;function L(U,O){U.setParams({missingProperty:O},!0),U.error()}W.reportMissingProp=L;function z(U){return U.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:X._`Object.prototype.hasOwnProperty`})}W.hasPropFunc=z;function J(U,O,R){return X._`${z(U)}.call(${O}, ${R})`}W.isOwnProperty=J;function K(U,O,R,j){let w=X._`${O}${(0,X.getProperty)(R)} !== undefined`;return j?X._`${w} && ${J(U,O,R)}`:w}W.propertyInData=K;function Z(U,O,R,j){let w=X._`${O}${(0,X.getProperty)(R)} === undefined`;return j?(0,X.or)(w,(0,X.not)(J(U,O,R))):w}W.noPropertyInData=Z;function D(U){return U?Object.keys(U).filter((O)=>O!=="__proto__"):[]}W.allSchemaProperties=D;function I(U,O){return D(O).filter((R)=>!(0,Q.alwaysValidSchema)(U,O[R]))}W.schemaProperties=I;function A({schemaCode:U,data:O,it:{gen:R,topSchemaRef:j,schemaPath:w,errorPath:T},it:k},l,_,h){let d=h?X._`${U}, ${O}, ${j}${w}`:O,p=[[Y.default.instancePath,(0,X.strConcat)(Y.default.instancePath,T)],[Y.default.parentData,k.parentData],[Y.default.parentDataProperty,k.parentDataProperty],[Y.default.rootData,Y.default.rootData]];if(k.opts.dynamicRef)p.push([Y.default.dynamicAnchors,Y.default.dynamicAnchors]);let K0=X._`${d}, ${R.object(...p)}`;return _!==X.nil?X._`${l}.call(${_}, ${K0})`:X._`${l}(${K0})`}W.callValidateCode=A;let M=X._`new RegExp`;function N({gen:U,it:{opts:O}},R){let j=O.unicodeRegExp?"u":"",{regExp:w}=O.code,T=w(R,j);return U.scopeValue("pattern",{key:T.toString(),ref:T,code:X._`${w.code==="new RegExp"?M:(0,G.useFunc)(U,w)}(${R}, ${j})`})}W.usePattern=N;function $(U){let{gen:O,data:R,keyword:j,it:w}=U,T=O.name("valid");if(w.allErrors){let l=O.let("valid",!0);return k(()=>O.assign(l,!1)),l}return O.var(T,!0),k(()=>O.break()),T;function k(l){let _=O.const("len",X._`${R}.length`);O.forRange("i",0,_,(h)=>{U.subschema({keyword:j,dataProp:h,dataPropType:Q.Type.Num},T),O.if((0,X.not)(T),l)})}}W.validateArray=$;function V(U){let{gen:O,schema:R,keyword:j,it:w}=U;if(!Array.isArray(R))throw Error("ajv implementation error");if(R.some((l)=>(0,Q.alwaysValidSchema)(w,l))&&!w.opts.unevaluated)return;let T=O.let("valid",!1),k=O.name("_valid");O.block(()=>R.forEach((l,_)=>{let h=U.subschema({keyword:j,schemaProp:_,compositeRule:!0},k);if(O.assign(T,X._`${T} || ${k}`),!U.mergeValidEvaluated(h,k))O.if((0,X.not)(T))})),U.result(T,()=>U.reset(),()=>U.error(!0))}W.validateUnion=V}),KO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateKeywordUsage=W.validSchemaType=W.funcKeywordCode=W.macroKeywordCode=void 0;let X=R0(),Q=x6(),Y=h6(),G=lQ();function B(I,A){let{gen:M,keyword:N,schema:$,parentSchema:V,it:U}=I,O=A.macro.call(U.self,$,V,U),R=K(M,N,O);if(U.opts.validateSchema!==!1)U.self.validateSchema(O,!0);let j=M.name("valid");I.subschema({schema:O,schemaPath:X.nil,errSchemaPath:`${U.errSchemaPath}/${N}`,topSchemaRef:R,compositeRule:!0},j),I.pass(j,()=>I.error(!0))}W.macroKeywordCode=B;function F(I,A){var M;let{gen:N,keyword:$,schema:V,parentSchema:U,$data:O,it:R}=I;J(R,A);let j=K(N,$,!O&&A.compile?A.compile.call(R.self,V,U,R):A.validate),w=N.let("valid");I.block$data(w,T),I.ok((M=A.valid)!==null&&M!==void 0?M:w);function T(){if(A.errors===!1){if(_(),A.modifying)L(I);h(()=>I.error())}else{let d=A.async?k():l();if(A.modifying)L(I);h(()=>z(I,d))}}function k(){let d=N.let("ruleErrs",null);return N.try(()=>_(X._`await `),(p)=>N.assign(w,!1).if(X._`${p} instanceof ${R.ValidationError}`,()=>N.assign(d,X._`${p}.errors`),()=>N.throw(p))),d}function l(){let d=X._`${j}.errors`;return N.assign(d,null),_(X.nil),d}function _(d=A.async?X._`await `:X.nil){let p=R.opts.passContext?Q.default.this:Q.default.self,K0=!(("compile"in A)&&!O||A.schema===!1);N.assign(w,X._`${d}${(0,Y.callValidateCode)(I,j,p,K0)}`,A.modifying)}function h(d){var p;N.if((0,X.not)((p=A.valid)!==null&&p!==void 0?p:w),d)}}W.funcKeywordCode=F;function L(I){let{gen:A,data:M,it:N}=I;A.if(N.parentData,()=>A.assign(M,X._`${N.parentData}[${N.parentDataProperty}]`))}function z(I,A){let{gen:M}=I;M.if(X._`Array.isArray(${A})`,()=>{M.assign(Q.default.vErrors,X._`${Q.default.vErrors} === null ? ${A} : ${Q.default.vErrors}.concat(${A})`).assign(Q.default.errors,X._`${Q.default.vErrors}.length`),(0,G.extendErrors)(I)},()=>I.error())}function J({schemaEnv:I},A){if(A.async&&!I.$async)throw Error("async keyword in sync schema")}function K(I,A,M){if(M===void 0)throw Error(`keyword "${A}" failed to compile`);return I.scopeValue("keyword",typeof M=="function"?{ref:M}:{ref:M,code:(0,X.stringify)(M)})}function Z(I,A,M=!1){return!A.length||A.some((N)=>N==="array"?Array.isArray(I):N==="object"?I&&typeof I=="object"&&!Array.isArray(I):typeof I==N||M&&typeof I>"u")}W.validSchemaType=Z;function D({schema:I,opts:A,self:M,errSchemaPath:N},$,V){if(Array.isArray($.keyword)?!$.keyword.includes(V):$.keyword!==V)throw Error("ajv implementation error");let U=$.dependencies;if(U===null||U===void 0?void 0:U.some((O)=>!Object.prototype.hasOwnProperty.call(I,O)))throw Error(`parent schema must have dependencies of ${V}: ${U.join(",")}`);if($.validateSchema){if(!$.validateSchema(I[V])){let O=`keyword "${V}" value is invalid at path "${N}": `+M.errorsText($.validateSchema.errors);if(A.validateSchema==="log")M.logger.error(O);else throw Error(O)}}}W.validateKeywordUsage=D}),ZO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.extendSubschemaMode=W.extendSubschemaData=W.getSubschema=void 0;let X=R0(),Q=y0();function Y(F,{keyword:L,schemaProp:z,schema:J,schemaPath:K,errSchemaPath:Z,topSchemaRef:D}){if(L!==void 0&&J!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(L!==void 0){let I=F.schema[L];return z===void 0?{schema:I,schemaPath:X._`${F.schemaPath}${(0,X.getProperty)(L)}`,errSchemaPath:`${F.errSchemaPath}/${L}`}:{schema:I[z],schemaPath:X._`${F.schemaPath}${(0,X.getProperty)(L)}${(0,X.getProperty)(z)}`,errSchemaPath:`${F.errSchemaPath}/${L}/${(0,Q.escapeFragment)(z)}`}}if(J!==void 0){if(K===void 0||Z===void 0||D===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:J,schemaPath:K,topSchemaRef:D,errSchemaPath:Z}}throw Error('either "keyword" or "schema" must be passed')}W.getSubschema=Y;function G(F,L,{dataProp:z,dataPropType:J,data:K,dataTypes:Z,propertyName:D}){if(K!==void 0&&z!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:I}=L;if(z!==void 0){let{errorPath:M,dataPathArr:N,opts:$}=L;A(I.let("data",X._`${L.data}${(0,X.getProperty)(z)}`,!0)),F.errorPath=X.str`${M}${(0,Q.getErrorPath)(z,J,$.jsPropertySyntax)}`,F.parentDataProperty=X._`${z}`,F.dataPathArr=[...N,F.parentDataProperty]}if(K!==void 0){if(A(K instanceof X.Name?K:I.let("data",K,!0)),D!==void 0)F.propertyName=D}if(Z)F.dataTypes=Z;function A(M){F.data=M,F.dataLevel=L.dataLevel+1,F.dataTypes=[],L.definedProperties=new Set,F.parentData=L.data,F.dataNames=[...L.dataNames,M]}}W.extendSubschemaData=G;function B(F,{jtdDiscriminator:L,jtdMetadata:z,compositeRule:J,createErrors:K,allErrors:Z}){if(J!==void 0)F.compositeRule=J;if(K!==void 0)F.createErrors=K;if(Z!==void 0)F.allErrors=Z;F.jtdDiscriminator=L,F.jtdMetadata=z}W.extendSubschemaMode=B}),l$=G0((W,X)=>{X.exports=function Q(Y,G){if(Y===G)return!0;if(Y&&G&&typeof Y=="object"&&typeof G=="object"){if(Y.constructor!==G.constructor)return!1;var B,F,L;if(Array.isArray(Y)){if(B=Y.length,B!=G.length)return!1;for(F=B;F--!==0;)if(!Q(Y[F],G[F]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===G.source&&Y.flags===G.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===G.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===G.toString();if(L=Object.keys(Y),B=L.length,B!==Object.keys(G).length)return!1;for(F=B;F--!==0;)if(!Object.prototype.hasOwnProperty.call(G,L[F]))return!1;for(F=B;F--!==0;){var z=L[F];if(!Q(Y[z],G[z]))return!1}return!0}return Y!==Y&&G!==G}}),$O=G0((W,X)=>{var Q=X.exports=function(B,F,L){if(typeof F=="function")L=F,F={};L=F.cb||L;var z=typeof L=="function"?L:L.pre||function(){},J=L.post||function(){};Y(F,z,J,B,"",B)};Q.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},Q.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},Q.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},Q.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 Y(B,F,L,z,J,K,Z,D,I,A){if(z&&typeof z=="object"&&!Array.isArray(z)){F(z,J,K,Z,D,I,A);for(var M in z){var N=z[M];if(Array.isArray(N)){if(M in Q.arrayKeywords)for(var $=0;$<N.length;$++)Y(B,F,L,N[$],J+"/"+M+"/"+$,K,J,M,z,$)}else if(M in Q.propsKeywords){if(N&&typeof N=="object")for(var V in N)Y(B,F,L,N[V],J+"/"+M+"/"+G(V),K,J,M,z,V)}else if(M in Q.keywords||B.allKeys&&!(M in Q.skipKeywords))Y(B,F,L,N,J+"/"+M,K,J,M,z)}L(z,J,K,Z,D,I,A)}}function G(B){return B.replace(/~/g,"~0").replace(/\//g,"~1")}}),mQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getSchemaRefs=W.resolveUrl=W.normalizeId=W._getFullPath=W.getFullPath=W.inlineRef=void 0;let X=y0(),Q=l$(),Y=$O(),G=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function B(N,$=!0){if(typeof N=="boolean")return!0;if($===!0)return!L(N);if(!$)return!1;return z(N)<=$}W.inlineRef=B;let F=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function L(N){for(let $ in N){if(F.has($))return!0;let V=N[$];if(Array.isArray(V)&&V.some(L))return!0;if(typeof V=="object"&&L(V))return!0}return!1}function z(N){let $=0;for(let V in N){if(V==="$ref")return 1/0;if($++,G.has(V))continue;if(typeof N[V]=="object")(0,X.eachItem)(N[V],(U)=>$+=z(U));if($===1/0)return 1/0}return $}function J(N,$="",V){if(V!==!1)$=D($);return K(N,N.parse($))}W.getFullPath=J;function K(N,$){return N.serialize($).split("#")[0]+"#"}W._getFullPath=K;let Z=/#\/?$/;function D(N){return N?N.replace(Z,""):""}W.normalizeId=D;function I(N,$,V){return V=D(V),N.resolve($,V)}W.resolveUrl=I;let A=/^[a-z_][-a-z0-9._]*$/i;function M(N,$){if(typeof N=="boolean")return{};let{schemaId:V,uriResolver:U}=this.opts,O=D(N[V]||$),R={"":O},j=J(U,O,!1),w={},T=new Set;return Y(N,{allKeys:!0},(_,h,d,p)=>{if(p===void 0)return;let K0=j+h,O0=R[p];if(typeof _[V]=="string")O0=w0.call(this,_[V]);S0.call(this,_.$anchor),S0.call(this,_.$dynamicAnchor),R[h]=O0;function w0($0){let b=this.opts.uriResolver.resolve;if($0=D(O0?b(O0,$0):$0),T.has($0))throw l($0);T.add($0);let v=this.refs[$0];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")k(_,v.schema,$0);else if($0!==D(K0))if($0[0]==="#")k(_,w[$0],$0),w[$0]=_;else this.refs[$0]=K0;return $0}function S0($0){if(typeof $0=="string"){if(!A.test($0))throw Error(`invalid anchor "${$0}"`);w0.call(this,`#${$0}`)}}}),w;function k(_,h,d){if(h!==void 0&&!Q(_,h))throw l(d)}function l(_){return Error(`reference "${_}" resolves to more than one schema`)}}W.getSchemaRefs=M}),$X=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.getData=W.KeywordCxt=W.validateFunctionCode=void 0;let X=zO(),Q=uQ(),Y=u$(),G=uQ(),B=JO(),F=KO(),L=ZO(),z=R0(),J=x6(),K=mQ(),Z=y0(),D=lQ();function I(P){if(j(P)){if(T(P),R(P)){$(P);return}}A(P,()=>(0,X.topBoolOrEmptySchema)(P))}W.validateFunctionCode=I;function A({gen:P,validateName:y,schema:x,schemaEnv:s,opts:t},L0){if(t.code.es5)P.func(y,z._`${J.default.data}, ${J.default.valCxt}`,s.$async,()=>{P.code(z._`"use strict"; ${U(x,t)}`),N(P,t),P.code(L0)});else P.func(y,z._`${J.default.data}, ${M(t)}`,s.$async,()=>P.code(U(x,t)).code(L0))}function M(P){return z._`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${P.dynamicRef?z._`, ${J.default.dynamicAnchors}={}`:z.nil}}={}`}function N(P,y){P.if(J.default.valCxt,()=>{if(P.var(J.default.instancePath,z._`${J.default.valCxt}.${J.default.instancePath}`),P.var(J.default.parentData,z._`${J.default.valCxt}.${J.default.parentData}`),P.var(J.default.parentDataProperty,z._`${J.default.valCxt}.${J.default.parentDataProperty}`),P.var(J.default.rootData,z._`${J.default.valCxt}.${J.default.rootData}`),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{if(P.var(J.default.instancePath,z._`""`),P.var(J.default.parentData,z._`undefined`),P.var(J.default.parentDataProperty,z._`undefined`),P.var(J.default.rootData,J.default.data),y.dynamicRef)P.var(J.default.dynamicAnchors,z._`{}`)})}function $(P){let{schema:y,opts:x,gen:s}=P;A(P,()=>{if(x.$comment&&y.$comment)p(P);if(_(P),s.let(J.default.vErrors,null),s.let(J.default.errors,0),x.unevaluated)V(P);k(P),K0(P)})}function V(P){let{gen:y,validateName:x}=P;P.evaluated=y.const("evaluated",z._`${x}.evaluated`),y.if(z._`${P.evaluated}.dynamicProps`,()=>y.assign(z._`${P.evaluated}.props`,z._`undefined`)),y.if(z._`${P.evaluated}.dynamicItems`,()=>y.assign(z._`${P.evaluated}.items`,z._`undefined`))}function U(P,y){let x=typeof P=="object"&&P[y.schemaId];return x&&(y.code.source||y.code.process)?z._`/*# sourceURL=${x} */`:z.nil}function O(P,y){if(j(P)){if(T(P),R(P)){w(P,y);return}}(0,X.boolOrEmptySchema)(P,y)}function R({schema:P,self:y}){if(typeof P=="boolean")return!P;for(let x in P)if(y.RULES.all[x])return!0;return!1}function j(P){return typeof P.schema!="boolean"}function w(P,y){let{schema:x,gen:s,opts:t}=P;if(t.$comment&&x.$comment)p(P);h(P),d(P);let L0=s.const("_errs",J.default.errors);k(P,L0),s.var(y,z._`${L0} === ${J.default.errors}`)}function T(P){(0,Z.checkUnknownRules)(P),l(P)}function k(P,y){if(P.opts.jtd)return w0(P,[],!1,y);let x=(0,Q.getSchemaTypes)(P.schema);w0(P,x,!(0,Q.coerceAndCheckDataType)(P,x),y)}function l(P){let{schema:y,errSchemaPath:x,opts:s,self:t}=P;if(y.$ref&&s.ignoreKeywordsWithRef&&(0,Z.schemaHasRulesButRef)(y,t.RULES))t.logger.warn(`$ref: keywords ignored in schema at path "${x}"`)}function _(P){let{schema:y,opts:x}=P;if(y.default!==void 0&&x.useDefaults&&x.strictSchema)(0,Z.checkStrictMode)(P,"default is ignored in the schema root")}function h(P){let y=P.schema[P.opts.schemaId];if(y)P.baseId=(0,K.resolveUrl)(P.opts.uriResolver,P.baseId,y)}function d(P){if(P.schema.$async&&!P.schemaEnv.$async)throw Error("async schema in sync schema")}function p({gen:P,schemaEnv:y,schema:x,errSchemaPath:s,opts:t}){let L0=x.$comment;if(t.$comment===!0)P.code(z._`${J.default.self}.logger.log(${L0})`);else if(typeof t.$comment=="function"){let T0=z.str`${s}/$comment`,C0=P.scopeValue("root",{ref:y.root});P.code(z._`${J.default.self}.opts.$comment(${L0}, ${T0}, ${C0}.schema)`)}}function K0(P){let{gen:y,schemaEnv:x,validateName:s,ValidationError:t,opts:L0}=P;if(x.$async)y.if(z._`${J.default.errors} === 0`,()=>y.return(J.default.data),()=>y.throw(z._`new ${t}(${J.default.vErrors})`));else{if(y.assign(z._`${s}.errors`,J.default.vErrors),L0.unevaluated)O0(P);y.return(z._`${J.default.errors} === 0`)}}function O0({gen:P,evaluated:y,props:x,items:s}){if(x instanceof z.Name)P.assign(z._`${y}.props`,x);if(s instanceof z.Name)P.assign(z._`${y}.items`,s)}function w0(P,y,x,s){let{gen:t,schema:L0,data:T0,allErrors:C0,opts:f0,self:b0}=P,{RULES:j0}=b0;if(L0.$ref&&(f0.ignoreKeywordsWithRef||!(0,Z.schemaHasRulesButRef)(L0,j0))){t.block(()=>z0(P,"$ref",j0.all.$ref.definition));return}if(!f0.jtd)$0(P,y);t.block(()=>{for(let k0 of j0.rules)o0(k0);o0(j0.post)});function o0(k0){if(!(0,Y.shouldUseGroup)(L0,k0))return;if(k0.type){if(t.if((0,G.checkDataType)(k0.type,T0,f0.strictNumbers)),S0(P,k0),y.length===1&&y[0]===k0.type&&x)t.else(),(0,G.reportTypeError)(P);t.endIf()}else S0(P,k0);if(!C0)t.if(z._`${J.default.errors} === ${s||0}`)}}function S0(P,y){let{gen:x,schema:s,opts:{useDefaults:t}}=P;if(t)(0,B.assignDefaults)(P,y.type);x.block(()=>{for(let L0 of y.rules)if((0,Y.shouldUseRule)(s,L0))z0(P,L0.keyword,L0.definition,y.type)})}function $0(P,y){if(P.schemaEnv.meta||!P.opts.strictTypes)return;if(b(P,y),!P.opts.allowUnionTypes)v(P,y);u(P,P.dataTypes)}function b(P,y){if(!y.length)return;if(!P.dataTypes.length){P.dataTypes=y;return}y.forEach((x)=>{if(!S(P.dataTypes,x))c(P,`type "${x}" not allowed by context "${P.dataTypes.join(",")}"`)}),C(P,y)}function v(P,y){if(y.length>1&&!(y.length===2&&y.includes("null")))c(P,"use allowUnionTypes to allow union type keyword")}function u(P,y){let x=P.self.RULES.all;for(let s in x){let t=x[s];if(typeof t=="object"&&(0,Y.shouldUseRule)(P.schema,t)){let{type:L0}=t.definition;if(L0.length&&!L0.some((T0)=>E(y,T0)))c(P,`missing type "${L0.join(",")}" for keyword "${s}"`)}}}function E(P,y){return P.includes(y)||y==="number"&&P.includes("integer")}function S(P,y){return P.includes(y)||y==="integer"&&P.includes("number")}function C(P,y){let x=[];for(let s of P.dataTypes)if(S(y,s))x.push(s);else if(y.includes("integer")&&s==="number")x.push("integer");P.dataTypes=x}function c(P,y){let x=P.schemaEnv.baseId+P.errSchemaPath;y+=` at "${x}" (strictTypes)`,(0,Z.checkStrictMode)(P,y,P.opts.strictTypes)}var r=class{constructor(P,y,x){if((0,F.validateKeywordUsage)(P,y,x),this.gen=P.gen,this.allErrors=P.allErrors,this.keyword=x,this.data=P.data,this.schema=P.schema[x],this.$data=y.$data&&P.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Z.schemaRefOrVal)(P,this.schema,x,this.$data),this.schemaType=y.schemaType,this.parentSchema=P.schema,this.params={},this.it=P,this.def=y,this.$data)this.schemaCode=P.gen.const("vSchema",u0(this.$data,P));else if(this.schemaCode=this.schemaValue,!(0,F.validSchemaType)(this.schema,y.schemaType,y.allowUndefined))throw Error(`${x} value must be ${JSON.stringify(y.schemaType)}`);if("code"in y?y.trackErrors:y.errors!==!1)this.errsCount=P.gen.const("_errs",J.default.errors)}result(P,y,x){this.failResult((0,z.not)(P),y,x)}failResult(P,y,x){if(this.gen.if(P),x)x();else this.error();if(y){if(this.gen.else(),y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(P,y){this.failResult((0,z.not)(P),void 0,y)}fail(P){if(P===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(P),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(P){if(!this.$data)return this.fail(P);let{schemaCode:y}=this;this.fail(z._`${y} !== undefined && (${(0,z.or)(this.invalid$data(),P)})`)}error(P,y,x){if(y){this.setParams(y),this._error(P,x),this.setParams({});return}this._error(P,x)}_error(P,y){(P?D.reportExtraError:D.reportError)(this,this.def.error,y)}$dataError(){(0,D.reportError)(this,this.def.$dataError||D.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,D.resetErrorsCount)(this.gen,this.errsCount)}ok(P){if(!this.allErrors)this.gen.if(P)}setParams(P,y){if(y)Object.assign(this.params,P);else this.params=P}block$data(P,y,x=z.nil){this.gen.block(()=>{this.check$data(P,x),y()})}check$data(P=z.nil,y=z.nil){if(!this.$data)return;let{gen:x,schemaCode:s,schemaType:t,def:L0}=this;if(x.if((0,z.or)(z._`${s} === undefined`,y)),P!==z.nil)x.assign(P,!0);if(t.length||L0.validateSchema){if(x.elseIf(this.invalid$data()),this.$dataError(),P!==z.nil)x.assign(P,!1)}x.else()}invalid$data(){let{gen:P,schemaCode:y,schemaType:x,def:s,it:t}=this;return(0,z.or)(L0(),T0());function L0(){if(x.length){if(!(y instanceof z.Name))throw Error("ajv implementation error");let C0=Array.isArray(x)?x:[x];return z._`${(0,G.checkDataTypes)(C0,y,t.opts.strictNumbers,G.DataType.Wrong)}`}return z.nil}function T0(){if(s.validateSchema){let C0=P.scopeValue("validate$data",{ref:s.validateSchema});return z._`!${C0}(${y})`}return z.nil}}subschema(P,y){let x=(0,L.getSubschema)(this.it,P);(0,L.extendSubschemaData)(x,this.it,P),(0,L.extendSubschemaMode)(x,P);let s={...this.it,...x,items:void 0,props:void 0};return O(s,y),s}mergeEvaluated(P,y){let{it:x,gen:s}=this;if(!x.opts.unevaluated)return;if(x.props!==!0&&P.props!==void 0)x.props=Z.mergeEvaluated.props(s,P.props,x.props,y);if(x.items!==!0&&P.items!==void 0)x.items=Z.mergeEvaluated.items(s,P.items,x.items,y)}mergeValidEvaluated(P,y){let{it:x,gen:s}=this;if(x.opts.unevaluated&&(x.props!==!0||x.items!==!0))return s.if(y,()=>this.mergeEvaluated(P,z.Name)),!0}};W.KeywordCxt=r;function z0(P,y,x,s){let t=new r(P,x,y);if("code"in x)x.code(t,s);else if(t.$data&&x.validate)(0,F.funcKeywordCode)(t,x);else if("macro"in x)(0,F.macroKeywordCode)(t,x);else if(x.compile||x.validate)(0,F.funcKeywordCode)(t,x)}let e=/^\/(?:[^~]|~0|~1)*$/,D0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function u0(P,{dataLevel:y,dataNames:x,dataPathArr:s}){let t,L0;if(P==="")return J.default.rootData;if(P[0]==="/"){if(!e.test(P))throw Error(`Invalid JSON-pointer: ${P}`);t=P,L0=J.default.rootData}else{let b0=D0.exec(P);if(!b0)throw Error(`Invalid JSON-pointer: ${P}`);let j0=+b0[1];if(t=b0[2],t==="#"){if(j0>=y)throw Error(f0("property/index",j0));return s[y-j0]}if(j0>y)throw Error(f0("data",j0));if(L0=x[y-j0],!t)return L0}let T0=L0,C0=t.split("/");for(let b0 of C0)if(b0)L0=z._`${L0}${(0,z.getProperty)((0,Z.unescapeJsonPointer)(b0))}`,T0=z._`${T0} && ${L0}`;return T0;function f0(b0,j0){return`Cannot access ${b0} ${j0} levels up, current level is ${y}`}}W.getData=u0}),cQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});var X=class extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}};W.default=X}),HX=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=mQ();var Q=class extends Error{constructor(Y,G,B,F){super(F||`can't resolve reference ${B} from id ${G}`);this.missingRef=(0,X.resolveUrl)(Y,G,B),this.missingSchema=(0,X.normalizeId)((0,X.getFullPath)(Y,this.missingRef))}};W.default=Q}),pQ=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.resolveSchema=W.getCompilingSchema=W.resolveRef=W.compileSchema=W.SchemaEnv=void 0;let X=R0(),Q=cQ(),Y=x6(),G=mQ(),B=y0(),F=$X();var L=class{constructor($){var V;this.refs={},this.dynamicAnchors={};let U;if(typeof $.schema=="object")U=$.schema;this.schema=$.schema,this.schemaId=$.schemaId,this.root=$.root||this,this.baseId=(V=$.baseId)!==null&&V!==void 0?V:(0,G.normalizeId)(U===null||U===void 0?void 0:U[$.schemaId||"$id"]),this.schemaPath=$.schemaPath,this.localRefs=$.localRefs,this.meta=$.meta,this.$async=U===null||U===void 0?void 0:U.$async,this.refs={}}};W.SchemaEnv=L;function z($){let V=Z.call(this,$);if(V)return V;let U=(0,G.getFullPath)(this.opts.uriResolver,$.root.baseId),{es5:O,lines:R}=this.opts.code,{ownProperties:j}=this.opts,w=new X.CodeGen(this.scope,{es5:O,lines:R,ownProperties:j}),T;if($.$async)T=w.scopeValue("Error",{ref:Q.default,code:X._`require("ajv/dist/runtime/validation_error").default`});let k=w.scopeName("validate");$.validateName=k;let l={gen:w,allErrors:this.opts.allErrors,data:Y.default.data,parentData:Y.default.parentData,parentDataProperty:Y.default.parentDataProperty,dataNames:[Y.default.data],dataPathArr:[X.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:w.scopeValue("schema",this.opts.code.source===!0?{ref:$.schema,code:(0,X.stringify)($.schema)}:{ref:$.schema}),validateName:k,ValidationError:T,schema:$.schema,schemaEnv:$,rootId:U,baseId:$.baseId||U,schemaPath:X.nil,errSchemaPath:$.schemaPath||(this.opts.jtd?"":"#"),errorPath:X._`""`,opts:this.opts,self:this},_;try{this._compilations.add($),(0,F.validateFunctionCode)(l),w.optimize(this.opts.code.optimize);let h=w.toString();if(_=`${w.scopeRefs(Y.default.scope)}return ${h}`,this.opts.code.process)_=this.opts.code.process(_,$);let d=Function(`${Y.default.self}`,`${Y.default.scope}`,_)(this,this.scope.get());if(this.scope.value(k,{ref:d}),d.errors=null,d.schema=$.schema,d.schemaEnv=$,$.$async)d.$async=!0;if(this.opts.code.source===!0)d.source={validateName:k,validateCode:h,scopeValues:w._values};if(this.opts.unevaluated){let{props:p,items:K0}=l;if(d.evaluated={props:p instanceof X.Name?void 0:p,items:K0 instanceof X.Name?void 0:K0,dynamicProps:p instanceof X.Name,dynamicItems:K0 instanceof X.Name},d.source)d.source.evaluated=(0,X.stringify)(d.evaluated)}return $.validate=d,$}catch(h){if(delete $.validate,delete $.validateName,_)this.logger.error("Error compiling schema, function code:",_);throw h}finally{this._compilations.delete($)}}W.compileSchema=z;function J($,V,U){var O;U=(0,G.resolveUrl)(this.opts.uriResolver,V,U);let R=$.refs[U];if(R)return R;let j=I.call(this,$,U);if(j===void 0){let w=(O=$.localRefs)===null||O===void 0?void 0:O[U],{schemaId:T}=this.opts;if(w)j=new L({schema:w,schemaId:T,root:$,baseId:V})}if(j===void 0)return;return $.refs[U]=K.call(this,j)}W.resolveRef=J;function K($){if((0,G.inlineRef)($.schema,this.opts.inlineRefs))return $.schema;return $.validate?$:z.call(this,$)}function Z($){for(let V of this._compilations)if(D(V,$))return V}W.getCompilingSchema=Z;function D($,V){return $.schema===V.schema&&$.root===V.root&&$.baseId===V.baseId}function I($,V){let U;while(typeof(U=this.refs[V])=="string")V=U;return U||this.schemas[V]||A.call(this,$,V)}function A($,V){let U=this.opts.uriResolver.parse(V),O=(0,G._getFullPath)(this.opts.uriResolver,U),R=(0,G.getFullPath)(this.opts.uriResolver,$.baseId,void 0);if(Object.keys($.schema).length>0&&O===R)return N.call(this,U,$);let j=(0,G.normalizeId)(O),w=this.refs[j]||this.schemas[j];if(typeof w=="string"){let T=A.call(this,$,w);if(typeof(T===null||T===void 0?void 0:T.schema)!=="object")return;return N.call(this,U,T)}if(typeof(w===null||w===void 0?void 0:w.schema)!=="object")return;if(!w.validate)z.call(this,w);if(j===(0,G.normalizeId)(V)){let{schema:T}=w,{schemaId:k}=this.opts,l=T[k];if(l)R=(0,G.resolveUrl)(this.opts.uriResolver,R,l);return new L({schema:T,schemaId:k,root:$,baseId:R})}return N.call(this,U,w)}W.resolveSchema=A;let M=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function N($,{baseId:V,schema:U,root:O}){var R;if(((R=$.fragment)===null||R===void 0?void 0:R[0])!=="/")return;for(let T of $.fragment.slice(1).split("/")){if(typeof U==="boolean")return;let k=U[(0,B.unescapeFragment)(T)];if(k===void 0)return;U=k;let l=typeof U==="object"&&U[this.opts.schemaId];if(!M.has(T)&&l)V=(0,G.resolveUrl)(this.opts.uriResolver,V,l)}let j;if(typeof U!="boolean"&&U.$ref&&!(0,B.schemaHasRulesButRef)(U,this.RULES)){let T=(0,G.resolveUrl)(this.opts.uriResolver,V,U.$ref);j=A.call(this,O,T)}let{schemaId:w}=this.opts;if(j=j||new L({schema:U,schemaId:w,root:O,baseId:V}),j.schema!==j.root.schema)return j}}),HO=G0((W,X)=>{X.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}}),m$=G0((W,X)=>{let Q=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Y=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 G(A){let M="",N=0,$=0;for($=0;$<A.length;$++){if(N=A[$].charCodeAt(0),N===48)continue;if(!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[$];break}for($+=1;$<A.length;$++){if(N=A[$].charCodeAt(0),!(N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102))return"";M+=A[$]}return M}let B=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function F(A){return A.length=0,!0}function L(A,M,N){if(A.length){let $=G(A);if($!=="")M.push($);else return N.error=!0,!1;A.length=0}return!0}function z(A){let M=0,N={error:!1,address:"",zone:""},$=[],V=[],U=!1,O=!1,R=L;for(let j=0;j<A.length;j++){let w=A[j];if(w==="["||w==="]")continue;if(w===":"){if(U===!0)O=!0;if(!R(V,$,N))break;if(++M>7){N.error=!0;break}if(j>0&&A[j-1]===":")U=!0;$.push(":");continue}else if(w==="%"){if(!R(V,$,N))break;R=F}else{V.push(w);continue}}if(V.length)if(R===F)N.zone=V.join("");else if(O)$.push(V.join(""));else $.push(G(V));return N.address=$.join(""),N}function J(A){if(K(A,":")<2)return{host:A,isIPV6:!1};let M=z(A);if(!M.error){let{address:N,address:$}=M;if(M.zone)N+="%"+M.zone,$+="%25"+M.zone;return{host:N,isIPV6:!0,escapedHost:$}}else return{host:A,isIPV6:!1}}function K(A,M){let N=0;for(let $=0;$<A.length;$++)if(A[$]===M)N++;return N}function Z(A){let M=A,N=[],$=-1,V=0;while(V=M.length){if(V===1)if(M===".")break;else if(M==="/"){N.push("/");break}else{N.push(M);break}else if(V===2){if(M[0]==="."){if(M[1]===".")break;else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."||M[1]==="/"){N.push("/");break}}}else if(V===3){if(M==="/.."){if(N.length!==0)N.pop();N.push("/");break}}if(M[0]==="."){if(M[1]==="."){if(M[2]==="/"){M=M.slice(3);continue}}else if(M[1]==="/"){M=M.slice(2);continue}}else if(M[0]==="/"){if(M[1]==="."){if(M[2]==="/"){M=M.slice(2);continue}else if(M[2]==="."){if(M[3]==="/"){if(M=M.slice(3),N.length!==0)N.pop();continue}}}}if(($=M.indexOf("/",1))===-1){N.push(M);break}else N.push(M.slice(0,$)),M=M.slice($)}return N.join("")}function D(A,M){let N=M!==!0?escape:unescape;if(A.scheme!==void 0)A.scheme=N(A.scheme);if(A.userinfo!==void 0)A.userinfo=N(A.userinfo);if(A.host!==void 0)A.host=N(A.host);if(A.path!==void 0)A.path=N(A.path);if(A.query!==void 0)A.query=N(A.query);if(A.fragment!==void 0)A.fragment=N(A.fragment);return A}function I(A){let M=[];if(A.userinfo!==void 0)M.push(A.userinfo),M.push("@");if(A.host!==void 0){let N=unescape(A.host);if(!Y(N)){let $=J(N);if($.isIPV6===!0)N=`[${$.escapedHost}]`;else N=A.host}M.push(N)}if(typeof A.port==="number"||typeof A.port==="string")M.push(":"),M.push(String(A.port));return M.length?M.join(""):void 0}X.exports={nonSimpleDomain:B,recomposeAuthority:I,normalizeComponentEncoding:D,removeDotSegments:Z,isIPv4:Y,isUUID:Q,normalizeIPv6:J,stringArrayToHexStripped:G}}),UO=G0((W,X)=>{let{isUUID:Q}=m$(),Y=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G=["http","https","ws","wss","urn","urn:uuid"];function B(w){return G.indexOf(w)!==-1}function F(w){if(w.secure===!0)return!0;else if(w.secure===!1)return!1;else if(w.scheme)return w.scheme.length===3&&(w.scheme[0]==="w"||w.scheme[0]==="W")&&(w.scheme[1]==="s"||w.scheme[1]==="S")&&(w.scheme[2]==="s"||w.scheme[2]==="S");else return!1}function L(w){if(!w.host)w.error=w.error||"HTTP URIs must have a host.";return w}function z(w){let T=String(w.scheme).toLowerCase()==="https";if(w.port===(T?443:80)||w.port==="")w.port=void 0;if(!w.path)w.path="/";return w}function J(w){return w.secure=F(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w}function K(w){if(w.port===(F(w)?443:80)||w.port==="")w.port=void 0;if(typeof w.secure==="boolean")w.scheme=w.secure?"wss":"ws",w.secure=void 0;if(w.resourceName){let[T,k]=w.resourceName.split("?");w.path=T&&T!=="/"?T:void 0,w.query=k,w.resourceName=void 0}return w.fragment=void 0,w}function Z(w,T){if(!w.path)return w.error="URN can not be parsed",w;let k=w.path.match(Y);if(k){let l=T.scheme||w.scheme||"urn";w.nid=k[1].toLowerCase(),w.nss=k[2];let _=j(`${l}:${T.nid||w.nid}`);if(w.path=void 0,_)w=_.parse(w,T)}else w.error=w.error||"URN can not be parsed.";return w}function D(w,T){if(w.nid===void 0)throw Error("URN without nid cannot be serialized");let k=T.scheme||w.scheme||"urn",l=w.nid.toLowerCase(),_=j(`${k}:${T.nid||l}`);if(_)w=_.serialize(w,T);let h=w,d=w.nss;return h.path=`${l||T.nid}:${d}`,T.skipEscape=!0,h}function I(w,T){let k=w;if(k.uuid=k.nss,k.nss=void 0,!T.tolerant&&(!k.uuid||!Q(k.uuid)))k.error=k.error||"UUID is not valid.";return k}function A(w){let T=w;return T.nss=(w.uuid||"").toLowerCase(),T}let M={scheme:"http",domainHost:!0,parse:L,serialize:z},N={scheme:"https",domainHost:M.domainHost,parse:L,serialize:z},$={scheme:"ws",domainHost:!0,parse:J,serialize:K},V={scheme:"wss",domainHost:$.domainHost,parse:$.parse,serialize:$.serialize},R={http:M,https:N,ws:$,wss:V,urn:{scheme:"urn",parse:Z,serialize:D,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:I,serialize:A,skipNormalize:!0}};Object.setPrototypeOf(R,null);function j(w){return w&&(R[w]||R[w.toLowerCase()])||void 0}X.exports={wsIsSecure:F,SCHEMES:R,isValidSchemeName:B,getSchemeHandler:j}}),AO=G0((W,X)=>{let{normalizeIPv6:Q,removeDotSegments:Y,recomposeAuthority:G,normalizeComponentEncoding:B,isIPv4:F,nonSimpleDomain:L}=m$(),{SCHEMES:z,getSchemeHandler:J}=UO();function K(V,U){if(typeof V==="string")V=A(N(V,U),U);else if(typeof V==="object")V=N(A(V,U),U);return V}function Z(V,U,O){let R=O?Object.assign({scheme:"null"},O):{scheme:"null"},j=D(N(V,R),N(U,R),R,!0);return R.skipEscape=!0,A(j,R)}function D(V,U,O,R){let j={};if(!R)V=N(A(V,O),O),U=N(A(U,O),O);if(O=O||{},!O.tolerant&&U.scheme)j.scheme=U.scheme,j.userinfo=U.userinfo,j.host=U.host,j.port=U.port,j.path=Y(U.path||""),j.query=U.query;else{if(U.userinfo!==void 0||U.host!==void 0||U.port!==void 0)j.userinfo=U.userinfo,j.host=U.host,j.port=U.port,j.path=Y(U.path||""),j.query=U.query;else{if(!U.path)if(j.path=V.path,U.query!==void 0)j.query=U.query;else j.query=V.query;else{if(U.path[0]==="/")j.path=Y(U.path);else{if((V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)&&!V.path)j.path="/"+U.path;else if(!V.path)j.path=U.path;else j.path=V.path.slice(0,V.path.lastIndexOf("/")+1)+U.path;j.path=Y(j.path)}j.query=U.query}j.userinfo=V.userinfo,j.host=V.host,j.port=V.port}j.scheme=V.scheme}return j.fragment=U.fragment,j}function I(V,U,O){if(typeof V==="string")V=unescape(V),V=A(B(N(V,O),!0),{...O,skipEscape:!0});else if(typeof V==="object")V=A(B(V,!0),{...O,skipEscape:!0});if(typeof U==="string")U=unescape(U),U=A(B(N(U,O),!0),{...O,skipEscape:!0});else if(typeof U==="object")U=A(B(U,!0),{...O,skipEscape:!0});return V.toLowerCase()===U.toLowerCase()}function A(V,U){let O={host:V.host,scheme:V.scheme,userinfo:V.userinfo,port:V.port,path:V.path,query:V.query,nid:V.nid,nss:V.nss,uuid:V.uuid,fragment:V.fragment,reference:V.reference,resourceName:V.resourceName,secure:V.secure,error:""},R=Object.assign({},U),j=[],w=J(R.scheme||O.scheme);if(w&&w.serialize)w.serialize(O,R);if(O.path!==void 0)if(!R.skipEscape){if(O.path=escape(O.path),O.scheme!==void 0)O.path=O.path.split("%3A").join(":")}else O.path=unescape(O.path);if(R.reference!=="suffix"&&O.scheme)j.push(O.scheme,":");let T=G(O);if(T!==void 0){if(R.reference!=="suffix")j.push("//");if(j.push(T),O.path&&O.path[0]!=="/")j.push("/")}if(O.path!==void 0){let k=O.path;if(!R.absolutePath&&(!w||!w.absolutePath))k=Y(k);if(T===void 0&&k[0]==="/"&&k[1]==="/")k="/%2F"+k.slice(2);j.push(k)}if(O.query!==void 0)j.push("?",O.query);if(O.fragment!==void 0)j.push("#",O.fragment);return j.join("")}let M=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function N(V,U){let O=Object.assign({},U),R={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},j=!1;if(O.reference==="suffix")if(O.scheme)V=O.scheme+":"+V;else V="//"+V;let w=V.match(M);if(w){if(R.scheme=w[1],R.userinfo=w[3],R.host=w[4],R.port=parseInt(w[5],10),R.path=w[6]||"",R.query=w[7],R.fragment=w[8],isNaN(R.port))R.port=w[5];if(R.host)if(F(R.host)===!1){let k=Q(R.host);R.host=k.host.toLowerCase(),j=k.isIPV6}else j=!0;if(R.scheme===void 0&&R.userinfo===void 0&&R.host===void 0&&R.port===void 0&&R.query===void 0&&!R.path)R.reference="same-document";else if(R.scheme===void 0)R.reference="relative";else if(R.fragment===void 0)R.reference="absolute";else R.reference="uri";if(O.reference&&O.reference!=="suffix"&&O.reference!==R.reference)R.error=R.error||"URI is not a "+O.reference+" reference.";let T=J(O.scheme||R.scheme);if(!O.unicodeSupport&&(!T||!T.unicodeSupport)){if(R.host&&(O.domainHost||T&&T.domainHost)&&j===!1&&L(R.host))try{R.host=URL.domainToASCII(R.host.toLowerCase())}catch(k){R.error=R.error||"Host's domain name can not be converted to ASCII: "+k}}if(!T||T&&!T.skipNormalize){if(V.indexOf("%")!==-1){if(R.scheme!==void 0)R.scheme=unescape(R.scheme);if(R.host!==void 0)R.host=unescape(R.host)}if(R.path)R.path=escape(unescape(R.path));if(R.fragment)R.fragment=encodeURI(decodeURIComponent(R.fragment))}if(T&&T.parse)T.parse(R,O)}else R.error=R.error||"URI can not be parsed.";return R}let $={SCHEMES:z,normalize:K,resolve:Z,resolveComponent:D,equal:I,serialize:A,parse:N};X.exports=$,X.exports.default=$,X.exports.fastUri=$}),NO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=AO();X.code='require("ajv/dist/runtime/uri").default',W.default=X}),c$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=void 0;var X=$X();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return X.KeywordCxt}});var Q=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return Q._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return Q.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return Q.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return Q.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return Q.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return Q.CodeGen}});let Y=cQ(),G=HX(),B=h$(),F=pQ(),L=R0(),z=mQ(),J=uQ(),K=y0(),Z=HO(),D=NO(),I=(b,v)=>new RegExp(b,v);I.code="new RegExp";let A=["removeAdditional","useDefaults","coerceTypes"],M=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),N={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."},$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},V=200;function U(b){var v,u,E,S,C,c,r,z0,e,D0,u0,P,y,x,s,t,L0,T0,C0,f0,b0,j0,o0,k0,B1;let Q1=b.strict,F1=(v=b.code)===null||v===void 0?void 0:v.optimize,Z1=F1===!0||F1===void 0?1:F1||0,$1=(E=(u=b.code)===null||u===void 0?void 0:u.regExp)!==null&&E!==void 0?E:I,D1=(S=b.uriResolver)!==null&&S!==void 0?S:D.default;return{strictSchema:(c=(C=b.strictSchema)!==null&&C!==void 0?C:Q1)!==null&&c!==void 0?c:!0,strictNumbers:(z0=(r=b.strictNumbers)!==null&&r!==void 0?r:Q1)!==null&&z0!==void 0?z0:!0,strictTypes:(D0=(e=b.strictTypes)!==null&&e!==void 0?e:Q1)!==null&&D0!==void 0?D0:"log",strictTuples:(P=(u0=b.strictTuples)!==null&&u0!==void 0?u0:Q1)!==null&&P!==void 0?P:"log",strictRequired:(x=(y=b.strictRequired)!==null&&y!==void 0?y:Q1)!==null&&x!==void 0?x:!1,code:b.code?{...b.code,optimize:Z1,regExp:$1}:{optimize:Z1,regExp:$1},loopRequired:(s=b.loopRequired)!==null&&s!==void 0?s:V,loopEnum:(t=b.loopEnum)!==null&&t!==void 0?t:V,meta:(L0=b.meta)!==null&&L0!==void 0?L0:!0,messages:(T0=b.messages)!==null&&T0!==void 0?T0:!0,inlineRefs:(C0=b.inlineRefs)!==null&&C0!==void 0?C0:!0,schemaId:(f0=b.schemaId)!==null&&f0!==void 0?f0:"$id",addUsedSchema:(b0=b.addUsedSchema)!==null&&b0!==void 0?b0:!0,validateSchema:(j0=b.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(o0=b.validateFormats)!==null&&o0!==void 0?o0:!0,unicodeRegExp:(k0=b.unicodeRegExp)!==null&&k0!==void 0?k0:!0,int32range:(B1=b.int32range)!==null&&B1!==void 0?B1:!0,uriResolver:D1}}var O=class{constructor(b={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,b=this.opts={...b,...U(b)};let{es5:v,lines:u}=this.opts.code;this.scope=new L.ValueScope({scope:{},prefixes:M,es5:v,lines:u}),this.logger=h(b.logger);let E=b.validateFormats;if(b.validateFormats=!1,this.RULES=(0,B.getRules)(),R.call(this,N,b,"NOT SUPPORTED"),R.call(this,$,b,"DEPRECATED","warn"),this._metaOpts=l.call(this),b.formats)T.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),b.keywords)k.call(this,b.keywords);if(typeof b.meta=="object")this.addMetaSchema(b.meta);w.call(this),b.validateFormats=E}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:b,meta:v,schemaId:u}=this.opts,E=Z;if(u==="id")E={...Z},E.id=E.$id,delete E.$id;if(v&&b)this.addMetaSchema(E,E[u],!1)}defaultMeta(){let{meta:b,schemaId:v}=this.opts;return this.opts.defaultMeta=typeof b=="object"?b[v]||b:void 0}validate(b,v){let u;if(typeof b=="string"){if(u=this.getSchema(b),!u)throw Error(`no schema with key or ref "${b}"`)}else u=this.compile(b);let E=u(v);if(!("$async"in u))this.errors=u.errors;return E}compile(b,v){let u=this._addSchema(b,v);return u.validate||this._compileSchemaEnv(u)}compileAsync(b,v){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:u}=this.opts;return E.call(this,b,v);async function E(e,D0){await S.call(this,e.$schema);let u0=this._addSchema(e,D0);return u0.validate||C.call(this,u0)}async function S(e){if(e&&!this.getSchema(e))await E.call(this,{$ref:e},!0)}async function C(e){try{return this._compileSchemaEnv(e)}catch(D0){if(!(D0 instanceof G.default))throw D0;return c.call(this,D0),await r.call(this,D0.missingSchema),C.call(this,e)}}function c({missingSchema:e,missingRef:D0}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${D0} cannot be resolved`)}async function r(e){let D0=await z0.call(this,e);if(!this.refs[e])await S.call(this,D0.$schema);if(!this.refs[e])this.addSchema(D0,e,v)}async function z0(e){let D0=this._loading[e];if(D0)return D0;try{return await(this._loading[e]=u(e))}finally{delete this._loading[e]}}}addSchema(b,v,u,E=this.opts.validateSchema){if(Array.isArray(b)){for(let C of b)this.addSchema(C,void 0,u,E);return this}let S;if(typeof b==="object"){let{schemaId:C}=this.opts;if(S=b[C],S!==void 0&&typeof S!="string")throw Error(`schema ${C} must be string`)}return v=(0,z.normalizeId)(v||S),this._checkUnique(v),this.schemas[v]=this._addSchema(b,u,v,E,!0),this}addMetaSchema(b,v,u=this.opts.validateSchema){return this.addSchema(b,v,!0,u),this}validateSchema(b,v){if(typeof b=="boolean")return!0;let u;if(u=b.$schema,u!==void 0&&typeof u!="string")throw Error("$schema must be a string");if(u=u||this.opts.defaultMeta||this.defaultMeta(),!u)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let E=this.validate(u,b);if(!E&&v){let S="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(S);else throw Error(S)}return E}getSchema(b){let v;while(typeof(v=j.call(this,b))=="string")b=v;if(v===void 0){let{schemaId:u}=this.opts,E=new F.SchemaEnv({schema:{},schemaId:u});if(v=F.resolveSchema.call(this,E,b),!v)return;this.refs[b]=v}return v.validate||this._compileSchemaEnv(v)}removeSchema(b){if(b instanceof RegExp)return this._removeAllSchemas(this.schemas,b),this._removeAllSchemas(this.refs,b),this;switch(typeof b){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let v=j.call(this,b);if(typeof v=="object")this._cache.delete(v.schema);return delete this.schemas[b],delete this.refs[b],this}case"object":{let v=b;this._cache.delete(v);let u=b[this.opts.schemaId];if(u)u=(0,z.normalizeId)(u),delete this.schemas[u],delete this.refs[u];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(b){for(let v of b)this.addKeyword(v);return this}addKeyword(b,v){let u;if(typeof b=="string"){if(u=b,typeof v=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),v.keyword=u}else if(typeof b=="object"&&v===void 0){if(v=b,u=v.keyword,Array.isArray(u)&&!u.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(p.call(this,u,v),!v)return(0,K.eachItem)(u,(S)=>K0.call(this,S)),this;w0.call(this,v);let E={...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)};return(0,K.eachItem)(u,E.type.length===0?(S)=>K0.call(this,S,E):(S)=>E.type.forEach((C)=>K0.call(this,S,E,C))),this}getKeyword(b){let v=this.RULES.all[b];return typeof v=="object"?v.definition:!!v}removeKeyword(b){let{RULES:v}=this;delete v.keywords[b],delete v.all[b];for(let u of v.rules){let E=u.rules.findIndex((S)=>S.keyword===b);if(E>=0)u.rules.splice(E,1)}return this}addFormat(b,v){if(typeof v=="string")v=new RegExp(v);return this.formats[b]=v,this}errorsText(b=this.errors,{separator:v=", ",dataVar:u="data"}={}){if(!b||b.length===0)return"No errors";return b.map((E)=>`${u}${E.instancePath} ${E.message}`).reduce((E,S)=>E+v+S)}$dataMetaSchema(b,v){let u=this.RULES.all;b=JSON.parse(JSON.stringify(b));for(let E of v){let S=E.split("/").slice(1),C=b;for(let c of S)C=C[c];for(let c in u){let r=u[c];if(typeof r!="object")continue;let{$data:z0}=r.definition,e=C[c];if(z0&&e)C[c]=$0(e)}}return b}_removeAllSchemas(b,v){for(let u in b){let E=b[u];if(!v||v.test(u)){if(typeof E=="string")delete b[u];else if(E&&!E.meta)this._cache.delete(E.schema),delete b[u]}}}_addSchema(b,v,u,E=this.opts.validateSchema,S=this.opts.addUsedSchema){let C,{schemaId:c}=this.opts;if(typeof b=="object")C=b[c];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof b!="boolean")throw Error("schema must be object or boolean");let r=this._cache.get(b);if(r!==void 0)return r;u=(0,z.normalizeId)(C||u);let z0=z.getSchemaRefs.call(this,b,u);if(r=new F.SchemaEnv({schema:b,schemaId:c,meta:v,baseId:u,localRefs:z0}),this._cache.set(r.schema,r),S&&!u.startsWith("#")){if(u)this._checkUnique(u);this.refs[u]=r}if(E)this.validateSchema(b,!0);return r}_checkUnique(b){if(this.schemas[b]||this.refs[b])throw Error(`schema with key or id "${b}" already exists`)}_compileSchemaEnv(b){if(b.meta)this._compileMetaSchema(b);else F.compileSchema.call(this,b);if(!b.validate)throw Error("ajv implementation error");return b.validate}_compileMetaSchema(b){let v=this.opts;this.opts=this._metaOpts;try{F.compileSchema.call(this,b)}finally{this.opts=v}}};O.ValidationError=Y.default,O.MissingRefError=G.default,W.default=O;function R(b,v,u,E="error"){for(let S in b){let C=S;if(C in v)this.logger[E](`${u}: option ${S}. ${b[C]}`)}}function j(b){return b=(0,z.normalizeId)(b),this.schemas[b]||this.refs[b]}function w(){let b=this.opts.schemas;if(!b)return;if(Array.isArray(b))this.addSchema(b);else for(let v in b)this.addSchema(b[v],v)}function T(){for(let b in this.opts.formats){let v=this.opts.formats[b];if(v)this.addFormat(b,v)}}function k(b){if(Array.isArray(b)){this.addVocabulary(b);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let v in b){let u=b[v];if(!u.keyword)u.keyword=v;this.addKeyword(u)}}function l(){let b={...this.opts};for(let v of A)delete b[v];return b}let _={log(){},warn(){},error(){}};function h(b){if(b===!1)return _;if(b===void 0)return console;if(b.log&&b.warn&&b.error)return b;throw Error("logger must implement log, warn and error methods")}let d=/^[a-z_$][a-z0-9_$:-]*$/i;function p(b,v){let{RULES:u}=this;if((0,K.eachItem)(b,(E)=>{if(u.keywords[E])throw Error(`Keyword ${E} is already defined`);if(!d.test(E))throw Error(`Keyword ${E} has invalid name`)}),!v)return;if(v.$data&&!(("code"in v)||("validate"in v)))throw Error('$data keyword must have "code" or "validate" function')}function K0(b,v,u){var E;let S=v===null||v===void 0?void 0:v.post;if(u&&S)throw Error('keyword with "post" flag cannot have "type"');let{RULES:C}=this,c=S?C.post:C.rules.find(({type:z0})=>z0===u);if(!c)c={type:u,rules:[]},C.rules.push(c);if(C.keywords[b]=!0,!v)return;let r={keyword:b,definition:{...v,type:(0,J.getJSONTypes)(v.type),schemaType:(0,J.getJSONTypes)(v.schemaType)}};if(v.before)O0.call(this,c,r,v.before);else c.rules.push(r);C.all[b]=r,(E=v.implements)===null||E===void 0||E.forEach((z0)=>this.addKeyword(z0))}function O0(b,v,u){let E=b.rules.findIndex((S)=>S.keyword===u);if(E>=0)b.rules.splice(E,0,v);else b.rules.push(v),this.logger.warn(`rule ${u} is not defined`)}function w0(b){let{metaSchema:v}=b;if(v===void 0)return;if(b.$data&&this.opts.$data)v=$0(v);b.validateSchema=this.compile(v,!0)}let S0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function $0(b){return{anyOf:[b,S0]}}}),VO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};W.default=X}),JB=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.callRef=W.getValidate=void 0;let X=HX(),Q=h6(),Y=R0(),G=x6(),B=pQ(),F=y0(),L={keyword:"$ref",schemaType:"string",code(K){let{gen:Z,schema:D,it:I}=K,{baseId:A,schemaEnv:M,validateName:N,opts:$,self:V}=I,{root:U}=M;if((D==="#"||D==="#/")&&A===U.baseId)return R();let O=B.resolveRef.call(V,U,A,D);if(O===void 0)throw new X.default(I.opts.uriResolver,A,D);if(O instanceof B.SchemaEnv)return j(O);return w(O);function R(){if(M===U)return J(K,N,M,M.$async);let T=Z.scopeValue("root",{ref:U});return J(K,Y._`${T}.validate`,U,U.$async)}function j(T){J(K,z(K,T),T,T.$async)}function w(T){let k=Z.scopeValue("schema",$.code.source===!0?{ref:T,code:(0,Y.stringify)(T)}:{ref:T}),l=Z.name("valid"),_=K.subschema({schema:T,dataTypes:[],schemaPath:Y.nil,topSchemaRef:k,errSchemaPath:D},l);K.mergeEvaluated(_),K.ok(l)}}};function z(K,Z){let{gen:D}=K;return Z.validate?D.scopeValue("validate",{ref:Z.validate}):Y._`${D.scopeValue("wrapper",{ref:Z})}.validate`}W.getValidate=z;function J(K,Z,D,I){let{gen:A,it:M}=K,{allErrors:N,schemaEnv:$,opts:V}=M,U=V.passContext?G.default.this:Y.nil;if(I)O();else R();function O(){if(!$.$async)throw Error("async schema referenced by sync schema");let T=A.let("valid");A.try(()=>{if(A.code(Y._`await ${(0,Q.callValidateCode)(K,Z,U)}`),w(Z),!N)A.assign(T,!0)},(k)=>{if(A.if(Y._`!(${k} instanceof ${M.ValidationError})`,()=>A.throw(k)),j(k),!N)A.assign(T,!1)}),K.ok(T)}function R(){K.result((0,Q.callValidateCode)(K,Z,U),()=>w(Z),()=>j(Z))}function j(T){let k=Y._`${T}.errors`;A.assign(G.default.vErrors,Y._`${G.default.vErrors} === null ? ${k} : ${G.default.vErrors}.concat(${k})`),A.assign(G.default.errors,Y._`${G.default.vErrors}.length`)}function w(T){var k;if(!M.opts.unevaluated)return;let l=(k=D===null||D===void 0?void 0:D.validate)===null||k===void 0?void 0:k.evaluated;if(M.props!==!0)if(l&&!l.dynamicProps){if(l.props!==void 0)M.props=F.mergeEvaluated.props(A,l.props,M.props)}else{let _=A.var("props",Y._`${T}.evaluated.props`);M.props=F.mergeEvaluated.props(A,_,M.props,Y.Name)}if(M.items!==!0)if(l&&!l.dynamicItems){if(l.items!==void 0)M.items=F.mergeEvaluated.items(A,l.items,M.items)}else{let _=A.var("items",Y._`${T}.evaluated.items`);M.items=F.mergeEvaluated.items(A,_,M.items,Y.Name)}}}W.callRef=J,W.default=L}),p$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=VO(),Q=JB(),Y=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",X.default,Q.default];W.default=Y}),wO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=X.operators,Y={maximum:{okStr:"<=",ok:Q.LTE,fail:Q.GT},minimum:{okStr:">=",ok:Q.GTE,fail:Q.LT},exclusiveMaximum:{okStr:"<",ok:Q.LT,fail:Q.GTE},exclusiveMinimum:{okStr:">",ok:Q.GT,fail:Q.LTE}},G={keyword:Object.keys(Y),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:B,schemaCode:F})=>X.str`must be ${Y[B].okStr} ${F}`,params:({keyword:B,schemaCode:F})=>X._`{comparison: ${Y[B].okStr}, limit: ${F}}`},code(B){let{keyword:F,data:L,schemaCode:z}=B;B.fail$data(X._`${L} ${Y[F].fail} ${z} || isNaN(${L})`)}};W.default=G}),DO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:Y})=>X.str`must be multiple of ${Y}`,params:({schemaCode:Y})=>X._`{multipleOf: ${Y}}`},code(Y){let{gen:G,data:B,schemaCode:F,it:L}=Y,z=L.opts.multipleOfPrecision,J=G.let("res"),K=z?X._`Math.abs(Math.round(${J}) - ${J}) > 1e-${z}`:X._`${J} !== parseInt(${J})`;Y.fail$data(X._`(${F} === 0 || (${J} = ${B}/${F}, ${K}))`)}};W.default=Q}),MO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});function X(Q){let Y=Q.length,G=0,B=0,F;while(B<Y)if(G++,F=Q.charCodeAt(B++),F>=55296&&F<=56319&&B<Y){if(F=Q.charCodeAt(B),(F&64512)===56320)B++}return G}W.default=X,X.code='require("ajv/dist/runtime/ucs2length").default'}),OO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y=MO(),G={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:B,schemaCode:F}){let L=B==="maxLength"?"more":"fewer";return X.str`must NOT have ${L} than ${F} characters`},params:({schemaCode:B})=>X._`{limit: ${B}}`},code(B){let{keyword:F,data:L,schemaCode:z,it:J}=B,K=F==="maxLength"?X.operators.GT:X.operators.LT,Z=J.opts.unicode===!1?X._`${L}.length`:X._`${(0,Q.useFunc)(B.gen,Y.default)}(${L})`;B.fail$data(X._`${Z} ${K} ${z}`)}};W.default=G}),jO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=h6(),Q=y0(),Y=R0(),G={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:B})=>Y.str`must match pattern "${B}"`,params:({schemaCode:B})=>Y._`{pattern: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:Z}=B,D=Z.opts.unicodeRegExp?"u":"";if(z){let{regExp:I}=Z.opts.code,A=I.code==="new RegExp"?Y._`new RegExp`:(0,Q.useFunc)(F,I),M=F.let("valid");F.try(()=>F.assign(M,Y._`${A}(${K}, ${D}).test(${L})`),()=>F.assign(M,!1)),B.fail$data(Y._`!${M}`)}else{let I=(0,X.usePattern)(B,J);B.fail$data(Y._`!${I}.test(${L})`)}}};W.default=G}),EO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxProperties"?"more":"fewer";return X.str`must NOT have ${B} than ${G} properties`},params:({schemaCode:Y})=>X._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxProperties"?X.operators.GT:X.operators.LT;Y.fail$data(X._`Object.keys(${B}).length ${L} ${F}`)}};W.default=Q}),IO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=h6(),Q=R0(),Y=y0(),G={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:B}})=>Q.str`must have required property '${B}'`,params:({params:{missingProperty:B}})=>Q._`{missingProperty: ${B}}`},code(B){let{gen:F,schema:L,schemaCode:z,data:J,$data:K,it:Z}=B,{opts:D}=Z;if(!K&&L.length===0)return;let I=L.length>=D.loopRequired;if(Z.allErrors)A();else M();if(D.strictRequired){let V=B.parentSchema.properties,{definedProperties:U}=B.it;for(let O of L)if((V===null||V===void 0?void 0:V[O])===void 0&&!U.has(O)){let R=`required property "${O}" is not defined at "${Z.schemaEnv.baseId+Z.errSchemaPath}" (strictRequired)`;(0,Y.checkStrictMode)(Z,R,Z.opts.strictRequired)}}function A(){if(I||K)B.block$data(Q.nil,N);else for(let V of L)(0,X.checkReportMissingProp)(B,V)}function M(){let V=F.let("missing");if(I||K){let U=F.let("valid",!0);B.block$data(U,()=>$(V,U)),B.ok(U)}else F.if((0,X.checkMissingProp)(B,L,V)),(0,X.reportMissingProp)(B,V),F.else()}function N(){F.forOf("prop",z,(V)=>{B.setParams({missingProperty:V}),F.if((0,X.noPropertyInData)(F,J,V,D.ownProperties),()=>B.error())})}function $(V,U){B.setParams({missingProperty:V}),F.forOf(V,z,()=>{F.assign(U,(0,X.propertyInData)(F,J,V,D.ownProperties)),F.if((0,Q.not)(U),()=>{B.error(),F.break()})},Q.nil)}}};W.default=G}),RO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:Y,schemaCode:G}){let B=Y==="maxItems"?"more":"fewer";return X.str`must NOT have ${B} than ${G} items`},params:({schemaCode:Y})=>X._`{limit: ${Y}}`},code(Y){let{keyword:G,data:B,schemaCode:F}=Y,L=G==="maxItems"?X.operators.GT:X.operators.LT;Y.fail$data(X._`${B}.length ${L} ${F}`)}};W.default=Q}),KB=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=l$();X.code='require("ajv/dist/runtime/equal").default',W.default=X}),TO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=uQ(),Q=R0(),Y=y0(),G=KB(),B={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:F,j:L}})=>Q.str`must NOT have duplicate items (items ## ${L} and ${F} are identical)`,params:({params:{i:F,j:L}})=>Q._`{i: ${F}, j: ${L}}`},code(F){let{gen:L,data:z,$data:J,schema:K,parentSchema:Z,schemaCode:D,it:I}=F;if(!J&&!K)return;let A=L.let("valid"),M=Z.items?(0,X.getSchemaTypes)(Z.items):[];F.block$data(A,N,Q._`${D} === false`),F.ok(A);function N(){let O=L.let("i",Q._`${z}.length`),R=L.let("j");F.setParams({i:O,j:R}),L.assign(A,!0),L.if(Q._`${O} > 1`,()=>($()?V:U)(O,R))}function $(){return M.length>0&&!M.some((O)=>O==="object"||O==="array")}function V(O,R){let j=L.name("item"),w=(0,X.checkDataTypes)(M,j,I.opts.strictNumbers,X.DataType.Wrong),T=L.const("indices",Q._`{}`);L.for(Q._`;${O}--;`,()=>{if(L.let(j,Q._`${z}[${O}]`),L.if(w,Q._`continue`),M.length>1)L.if(Q._`typeof ${j} == "string"`,Q._`${j} += "_"`);L.if(Q._`typeof ${T}[${j}] == "number"`,()=>{L.assign(R,Q._`${T}[${j}]`),F.error(),L.assign(A,!1).break()}).code(Q._`${T}[${j}] = ${O}`)})}function U(O,R){let j=(0,Y.useFunc)(L,G.default),w=L.name("outer");L.label(w).for(Q._`;${O}--;`,()=>L.for(Q._`${R} = ${O}; ${R}--;`,()=>L.if(Q._`${j}(${z}[${O}], ${z}[${R}])`,()=>{F.error(),L.assign(A,!1).break(w)})))}}};W.default=B}),PO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y=KB(),G={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:B})=>X._`{allowedValue: ${B}}`},code(B){let{gen:F,data:L,$data:z,schemaCode:J,schema:K}=B;if(z||K&&typeof K=="object")B.fail$data(X._`!${(0,Q.useFunc)(F,Y.default)}(${L}, ${J})`);else B.fail(X._`${K} !== ${L}`)}};W.default=G}),SO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y=KB(),G={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:B})=>X._`{allowedValues: ${B}}`},code(B){let{gen:F,data:L,$data:z,schema:J,schemaCode:K,it:Z}=B;if(!z&&J.length===0)throw Error("enum must have non-empty array");let D=J.length>=Z.opts.loopEnum,I,A=()=>I!==null&&I!==void 0?I:I=(0,Q.useFunc)(F,Y.default),M;if(D||z)M=F.let("valid"),B.block$data(M,N);else{if(!Array.isArray(J))throw Error("ajv implementation error");let V=F.const("vSchema",K);M=(0,X.or)(...J.map((U,O)=>$(V,O)))}B.pass(M);function N(){F.assign(M,!1),F.forOf("v",K,(V)=>F.if(X._`${A()}(${L}, ${V})`,()=>F.assign(M,!0).break()))}function $(V,U){let O=J[U];return typeof O==="object"&&O!==null?X._`${A()}(${L}, ${V}[${U}])`:X._`${L} === ${O}`}}};W.default=G}),d$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=wO(),Q=DO(),Y=OO(),G=jO(),B=EO(),F=IO(),L=RO(),z=TO(),J=PO(),K=SO(),Z=[X.default,Q.default,Y.default,G.default,B.default,F.default,L.default,z.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},J.default,K.default];W.default=Z}),i$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateAdditionalItems=void 0;let X=R0(),Q=y0(),Y={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:B}})=>X.str`must NOT have more than ${B} items`,params:({params:{len:B}})=>X._`{limit: ${B}}`},code(B){let{parentSchema:F,it:L}=B,{items:z}=F;if(!Array.isArray(z)){(0,Q.checkStrictMode)(L,'"additionalItems" is ignored when "items" is not an array of schemas');return}G(B,z)}};function G(B,F){let{gen:L,schema:z,data:J,keyword:K,it:Z}=B;Z.items=!0;let D=L.const("len",X._`${J}.length`);if(z===!1)B.setParams({len:F.length}),B.pass(X._`${D} <= ${F.length}`);else if(typeof z=="object"&&!(0,Q.alwaysValidSchema)(Z,z)){let A=L.var("valid",X._`${D} <= ${F.length}`);L.if((0,X.not)(A),()=>I(A)),B.ok(A)}function I(A){L.forRange("i",F.length,D,(M)=>{if(B.subschema({keyword:K,dataProp:M,dataPropType:Q.Type.Num},A),!Z.allErrors)L.if((0,X.not)(A),()=>L.break())})}}W.validateAdditionalItems=G,W.default=Y}),n$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateTuple=void 0;let X=R0(),Q=y0(),Y=h6(),G={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(F){let{schema:L,it:z}=F;if(Array.isArray(L))return B(F,"additionalItems",L);if(z.items=!0,(0,Q.alwaysValidSchema)(z,L))return;F.ok((0,Y.validateArray)(F))}};function B(F,L,z=F.schema){let{gen:J,parentSchema:K,data:Z,keyword:D,it:I}=F;if(N(K),I.opts.unevaluated&&z.length&&I.items!==!0)I.items=Q.mergeEvaluated.items(J,z.length,I.items);let A=J.name("valid"),M=J.const("len",X._`${Z}.length`);z.forEach(($,V)=>{if((0,Q.alwaysValidSchema)(I,$))return;J.if(X._`${M} > ${V}`,()=>F.subschema({keyword:D,schemaProp:V,dataProp:V},A)),F.ok(A)});function N($){let{opts:V,errSchemaPath:U}=I,O=z.length,R=O===$.minItems&&(O===$.maxItems||$[L]===!1);if(V.strictTuples&&!R){let j=`"${D}" is ${O}-tuple, but minItems or maxItems/${L} are not specified or different at path "${U}"`;(0,Q.checkStrictMode)(I,j,V.strictTuples)}}}W.validateTuple=B,W.default=G}),bO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=n$(),Q={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Y)=>(0,X.validateTuple)(Y,"items")};W.default=Q}),qO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y=h6(),G=i$(),B={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:F}})=>X.str`must NOT have more than ${F} items`,params:({params:{len:F}})=>X._`{limit: ${F}}`},code(F){let{schema:L,parentSchema:z,it:J}=F,{prefixItems:K}=z;if(J.items=!0,(0,Q.alwaysValidSchema)(J,L))return;if(K)(0,G.validateAdditionalItems)(F,K);else F.ok((0,Y.validateArray)(F))}};W.default=B}),CO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:G,max:B}})=>B===void 0?X.str`must contain at least ${G} valid item(s)`:X.str`must contain at least ${G} and no more than ${B} valid item(s)`,params:({params:{min:G,max:B}})=>B===void 0?X._`{minContains: ${G}}`:X._`{minContains: ${G}, maxContains: ${B}}`},code(G){let{gen:B,schema:F,parentSchema:L,data:z,it:J}=G,K,Z,{minContains:D,maxContains:I}=L;if(J.opts.next)K=D===void 0?1:D,Z=I;else K=1;let A=B.const("len",X._`${z}.length`);if(G.setParams({min:K,max:Z}),Z===void 0&&K===0){(0,Q.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(Z!==void 0&&K>Z){(0,Q.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),G.fail();return}if((0,Q.alwaysValidSchema)(J,F)){let U=X._`${A} >= ${K}`;if(Z!==void 0)U=X._`${U} && ${A} <= ${Z}`;G.pass(U);return}J.items=!0;let M=B.name("valid");if(Z===void 0&&K===1)$(M,()=>B.if(M,()=>B.break()));else if(K===0){if(B.let(M,!0),Z!==void 0)B.if(X._`${z}.length > 0`,N)}else B.let(M,!1),N();G.result(M,()=>G.reset());function N(){let U=B.name("_valid"),O=B.let("count",0);$(U,()=>B.if(U,()=>V(O)))}function $(U,O){B.forRange("i",0,A,(R)=>{G.subschema({keyword:"contains",dataProp:R,dataPropType:Q.Type.Num,compositeRule:!0},U),O()})}function V(U){if(B.code(X._`${U}++`),Z===void 0)B.if(X._`${U} >= ${K}`,()=>B.assign(M,!0).break());else if(B.if(X._`${U} > ${Z}`,()=>B.assign(M,!1).break()),K===1)B.assign(M,!0);else B.if(X._`${U} >= ${K}`,()=>B.assign(M,!0))}}};W.default=Y}),ZB=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.validateSchemaDeps=W.validatePropertyDeps=W.error=void 0;let X=R0(),Q=y0(),Y=h6();W.error={message:({params:{property:z,depsCount:J,deps:K}})=>{let Z=J===1?"property":"properties";return X.str`must have ${Z} ${K} when property ${z} is present`},params:({params:{property:z,depsCount:J,deps:K,missingProperty:Z}})=>X._`{property: ${z},
221
+ missingProperty: ${Z},
110
222
  depsCount: ${J},
111
- deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(z){let[J,K]=B(z);F(z,J),L(z,K)}};function B({schema:z}){let J={},K={};for(let H in z){if(H==="__proto__")continue;let D=Array.isArray(z[H])?J:K;D[H]=z[H]}return[J,K]}function F(z,J=z.schema){let{gen:K,data:H,it:D}=z;if(Object.keys(J).length===0)return;let I=K.let("missing");for(let A in J){let M=J[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,H,A,D.opts.ownProperties);if(z.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let Z of M)(0,Y.checkReportMissingProp)(z,Z)});else K.if(Q._`${N} && (${(0,Y.checkMissingProp)(z,M,I)})`),(0,Y.reportMissingProp)(z,I),K.else()}}W.validatePropertyDeps=F;function L(z,J=z.schema){let{gen:K,data:H,keyword:D,it:I}=z,A=K.name("valid");for(let M in J){if((0,X.alwaysValidSchema)(I,J[M]))continue;K.if((0,Y.propertyInData)(K,H,M,I.opts.ownProperties),()=>{let N=z.subschema({keyword:D,schemaProp:M},A);z.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),z.ok(A)}}W.validateSchemaDeps=L,W.default=G}),Zj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>Q._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G;if((0,X.alwaysValidSchema)(z,F))return;let J=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},J),B.if((0,Q.not)(J),()=>{if(G.error(!0),!z.allErrors)B.break()})}),G.ok(J)}};W.default=Y}),yH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=x6(),X=R0(),Y=f6(),G=y0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>X._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:z,parentSchema:J,data:K,errsCount:H,it:D}=F;if(!H)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,z))return;let M=(0,Q.allSchemaProperties)(J.properties),N=(0,Q.allSchemaProperties)(J.patternProperties);Z(),F.ok(X._`${H} === ${Y.default.errors}`);function Z(){L.forIn("key",K,(O)=>{if(!M.length&&!N.length)j(O);else L.if(V(O),()=>j(O))})}function V(O){let w;if(M.length>8){let T=(0,G.schemaRefOrVal)(D,J.properties,"properties");w=(0,Q.isOwnProperty)(L,T,O)}else if(M.length)w=(0,X.or)(...M.map((T)=>X._`${O} === ${T}`));else w=X.nil;if(N.length)w=(0,X.or)(w,...N.map((T)=>X._`${(0,Q.usePattern)(F,T)}.test(${O})`));return(0,X.not)(w)}function U(O){L.code(X._`delete ${K}[${O}]`)}function j(O){if(A.removeAdditional==="all"||A.removeAdditional&&z===!1){U(O);return}if(z===!1){if(F.setParams({additionalProperty:O}),F.error(),!I)L.break();return}if(typeof z=="object"&&!(0,G.alwaysValidSchema)(D,z)){let w=L.name("valid");if(A.removeAdditional==="failing")R(O,w,!1),L.if((0,X.not)(w),()=>{F.reset(),U(O)});else if(R(O,w),!I)L.if((0,X.not)(w),()=>L.break())}}function R(O,w,T){let k={keyword:"additionalProperties",dataProp:O,dataPropType:G.Type.Str};if(T===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),Hj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=FQ(),X=x6(),Y=y0(),G=yH(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,parentSchema:J,data:K,it:H}=F;if(H.opts.removeAdditional==="all"&&J.additionalProperties===void 0)G.default.code(new Q.KeywordCxt(H,G.default,"additionalProperties"));let D=(0,X.allSchemaProperties)(z);for(let Z of D)H.definedProperties.add(Z);if(H.opts.unevaluated&&D.length&&H.props!==!0)H.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),H.props);let I=D.filter((Z)=>!(0,Y.alwaysValidSchema)(H,z[Z]));if(I.length===0)return;let A=L.name("valid");for(let Z of I){if(M(Z))N(Z);else{if(L.if((0,X.propertyInData)(L,K,Z,H.opts.ownProperties)),N(Z),!H.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add(Z),F.ok(A)}function M(Z){return H.opts.useDefaults&&!H.compositeRule&&z[Z].default!==void 0}function N(Z){F.subschema({keyword:"properties",schemaProp:Z,dataProp:Z},A)}}};W.default=B}),$j=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=x6(),X=R0(),Y=y0(),G=y0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,data:J,parentSchema:K,it:H}=F,{opts:D}=H,I=(0,Q.allSchemaProperties)(z),A=I.filter((R)=>(0,Y.alwaysValidSchema)(H,z[R]));if(I.length===0||A.length===I.length&&(!H.opts.unevaluated||H.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(H.props!==!0&&!(H.props instanceof X.Name))H.props=(0,G.evaluatedPropsToName)(L,H.props);let{props:Z}=H;V();function V(){for(let R of I){if(M)U(R);if(H.allErrors)j(R);else L.var(N,!0),j(R),L.if(N)}}function U(R){for(let O in M)if(new RegExp(R).test(O))(0,Y.checkStrictMode)(H,`property ${O} matches pattern ${R} (use allowMatchingProperties)`)}function j(R){L.forIn("key",J,(O)=>{L.if(X._`${(0,Q.usePattern)(F,R)}.test(${O})`,()=>{let w=A.includes(R);if(!w)F.subschema({keyword:"patternProperties",schemaProp:R,dataProp:O,dataPropType:G.Type.Str},N);if(H.opts.unevaluated&&Z!==!0)L.assign(X._`${Z}[${O}]`,!0);else if(!w&&!H.allErrors)L.if((0,X.not)(N),()=>L.break())})})}}};W.default=B}),Uj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=y0(),X={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,Q.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=X}),Aj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:x6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=Q}),Nj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>Q._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:z}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(z.opts.discriminator&&L.discriminator)return;let J=F,K=B.let("valid",!1),H=B.let("passing",null),D=B.name("_valid");G.setParams({passing:H}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){J.forEach((A,M)=>{let N;if((0,X.alwaysValidSchema)(z,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(Q._`${D} && ${K}`).assign(K,!1).assign(H,Q._`[${H}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(H,M),N)G.mergeEvaluated(N,Q.Name)})})}}};W.default=Y}),Vj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=y0(),X={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((z,J)=>{if((0,Q.alwaysValidSchema)(F,z))return;let K=Y.subschema({keyword:"allOf",schemaProp:J},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=X}),wj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>Q.str`must match "${B.ifClause}" schema`,params:({params:B})=>Q._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:z}=B;if(L.then===void 0&&L.else===void 0)(0,X.checkStrictMode)(z,'"if" without "then" and "else" is ignored');let J=G(z,"then"),K=G(z,"else");if(!J&&!K)return;let H=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),J&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(J)F.if(D,A("then"));else F.if((0,Q.not)(D),A("else"));B.pass(H,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let Z=B.subschema({keyword:M},D);if(F.assign(H,D),B.mergeValidEvaluated(Z,H),N)F.assign(N,Q._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,X.alwaysValidSchema)(B,L)}W.default=Y}),Dj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=y0(),X={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=X}),_H=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=kH(),X=zj(),Y=vH(),G=Jj(),B=Kj(),F=WB(),L=Zj(),z=yH(),J=Hj(),K=$j(),H=Uj(),D=Aj(),I=Nj(),A=Vj(),M=wj(),N=Dj();function Z(V=!1){let U=[H.default,D.default,I.default,A.default,M.default,N.default,L.default,z.default,F.default,J.default,K.default];if(V)U.push(X.default,G.default);else U.push(Q.default,Y.default);return U.push(B.default),U}W.default=Z}),Mj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>Q.str`must match format "${Y}"`,params:({schemaCode:Y})=>Q._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:z,schemaCode:J,it:K}=Y,{opts:H,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!H.validateFormats)return;if(L)M();else N();function M(){let Z=B.scopeValue("formats",{ref:A.formats,code:H.code.formats}),V=B.const("fDef",Q._`${Z}[${J}]`),U=B.let("fType"),j=B.let("format");B.if(Q._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,Q._`${V}.type || "string"`).assign(j,Q._`${V}.validate`),()=>B.assign(U,Q._`"string"`).assign(j,V)),Y.fail$data((0,Q.or)(R(),O()));function R(){if(H.strictSchema===!1)return Q.nil;return Q._`${J} && !${j}`}function O(){let w=I.$async?Q._`(${V}.async ? await ${j}(${F}) : ${j}(${F}))`:Q._`${j}(${F})`,T=Q._`(typeof ${j} == "function" ? ${w} : ${j}.test(${F}))`;return Q._`${j} && ${j} !== true && ${U} === ${G} && !${T}`}}function N(){let Z=A.formats[z];if(!Z){R();return}if(Z===!0)return;let[V,U,j]=O(Z);if(V===G)Y.pass(w());function R(){if(H.strictSchema===!1){A.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${D}"`}}function O(T){let k=T instanceof RegExp?(0,Q.regexpCode)(T):H.code.formats?Q._`${H.code.formats}${(0,Q.getProperty)(z)}`:void 0,l=B.scopeValue("formats",{key:z,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,Q._`${l}.validate`];return["string",T,l]}function w(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!I.$async)throw Error("async format in sync schema");return Q._`await ${j}(${F})`}return typeof U=="function"?Q._`${j}(${F})`:Q._`${j}.test(${F})`}}}};W.default=X}),gH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=[Mj().default];W.default=Q}),fH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),jj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=qH(),X=CH(),Y=_H(),G=gH(),B=fH(),F=[Q.default,X.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),Oj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var Q;(function(X){X.Tag="tag",X.Mapping="mapping"})(Q||(W.DiscrError=Q={}))}),xH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=Oj(),Y=fX(),G=LQ(),B=y0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:z}})=>L===X.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:L,tag:z,tagName:J}})=>Q._`{error: ${L}, tag: ${J}, tagValue: ${z}}`},code(L){let{gen:z,data:J,schema:K,parentSchema:H,it:D}=L,{oneOf:I}=H;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=z.let("valid",!1),N=z.const("tag",Q._`${J}${(0,Q.getProperty)(A)}`);z.if(Q._`typeof ${N} == "string"`,()=>Z(),()=>L.error(!1,{discrError:X.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function Z(){let j=U();z.if(!1);for(let R in j)z.elseIf(Q._`${N} === ${R}`),z.assign(M,V(j[R]));z.else(),L.error(!1,{discrError:X.DiscrError.Mapping,tag:N,tagName:A}),z.endIf()}function V(j){let R=z.name("valid"),O=L.subschema({keyword:"oneOf",schemaProp:j},R);return L.mergeEvaluated(O,Q.Name),R}function U(){var j;let R={},O=T(H),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(j=h===null||h===void 0?void 0:h.properties)===null||j===void 0?void 0:j[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(O||T(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return R;function T({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in R)throw Error(`discriminator: "${A}" values must be unique strings`);R[_]=h}}}};W.default=F}),Ej=G0((W,Q)=>{Q.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}}),hH=G0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let X=bH(),Y=jj(),G=xH(),B=Ej(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var z=class extends X.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=z,Q.exports=W=z,Q.exports.Ajv=z,Object.defineProperty(W,"__esModule",{value:!0}),W.default=z;var J=FQ();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var K=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var H=gX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return H.default}});var D=LQ();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),uH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let Q=R0(),X=f6(),Y=fX(),G=t7(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(z)=>F(z,z.schema)};function F(z,J){let{gen:K,it:H}=z;H.schemaEnv.root.dynamicAnchors[J]=!0;let D=Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(J)}`,I=H.errSchemaPath==="#"?H.validateName:L(z);K.if(Q._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(z){let{schemaEnv:J,schema:K,self:H}=z.it,{root:D,baseId:I,localRefs:A,meta:M}=J.root,{schemaId:N}=H.opts,Z=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(H,Z),(0,G.getValidate)(z,Z)}W.default=B}),lH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let Q=R0(),X=f6(),Y=t7(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:z,keyword:J,it:K}=F;if(L[0]!=="#")throw Error(`"${J}" only supports hash fragment reference`);let H=L.slice(1);if(K.allErrors)D();else{let A=z.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[H]){let M=z.let("_v",Q._`${X.default.dynamicAnchors}${(0,Q.getProperty)(H)}`);z.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>z.block(()=>{(0,Y.callRef)(F,A),z.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),Ij=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=uH(),X=y0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,Q.dynamicAnchor)(G,"");else(0,X.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),Rj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=lH(),X={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,Q.dynamicRef)(Y,Y.schema)};W.default=X}),Tj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=uH(),X=lH(),Y=Ij(),G=Rj(),B=[Q.default,X.default,Y.default,G.default];W.default=B}),Pj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=WB(),X={keyword:"dependentRequired",type:"object",schemaType:"object",error:Q.error,code:(Y)=>(0,Q.validatePropertyDeps)(Y)};W.default=X}),Sj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=WB(),X={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,Q.validateSchemaDeps)(Y)};W.default=X}),bj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=y0(),X={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,Q.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=X}),qj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=Pj(),X=Sj(),Y=bj(),G=[Q.default,X.default,Y.default];W.default=G}),Cj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y=f6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>Q._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:z,errsCount:J,it:K}=B;if(!J)throw Error("ajv implementation error");let{allErrors:H,props:D}=K;if(D instanceof Q.Name)F.if(Q._`${D} !== true`,()=>F.forIn("key",z,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",z,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(Q._`${J} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!H)F.break();return}if(!(0,X.alwaysValidSchema)(K,L)){let Z=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:X.Type.Str},Z),!H)F.if((0,Q.not)(Z),()=>F.break())}}function A(N,Z){return Q._`!${N} || !${N}[${Z}]`}function M(N,Z){let V=[];for(let U in N)if(N[U]===!0)V.push(Q._`${Z} !== ${U}`);return(0,Q.and)(...V)}}};W.default=G}),kj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=R0(),X=y0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>Q.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>Q._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G,J=z.items||0;if(J===!0)return;let K=B.const("len",Q._`${L}.length`);if(F===!1)G.setParams({len:J}),G.fail(Q._`${K} > ${J}`);else if(typeof F=="object"&&!(0,X.alwaysValidSchema)(z,F)){let D=B.var("valid",Q._`${K} <= ${J}`);B.if((0,Q.not)(D),()=>H(D,J)),G.ok(D)}z.items=!0;function H(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:X.Type.Num},D),!z.allErrors)B.if((0,Q.not)(D),()=>B.break())})}}};W.default=Y}),vj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=Cj(),X=kj(),Y=[Q.default,X.default];W.default=Y}),yj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=qH(),X=CH(),Y=_H(),G=Tj(),B=qj(),F=vj(),L=gH(),z=fH(),J=[G.default,Q.default,X.default,(0,Y.default)(!0),L.default,z.metadataVocabulary,z.contentVocabulary,B.default,F.default];W.default=J}),_j=G0((W,Q)=>{Q.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}}}}),gj=G0((W,Q)=>{Q.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"}}}}}),fj=G0((W,Q)=>{Q.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"}}}}),xj=G0((W,Q)=>{Q.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"}}}}),hj=G0((W,Q)=>{Q.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"}}}}),uj=G0((W,Q)=>{Q.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"}}}}),lj=G0((W,Q)=>{Q.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}}}}),mj=G0((W,Q)=>{Q.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:[]}}}}),cj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=_j(),X=gj(),Y=fj(),G=xj(),B=hj(),F=uj(),L=lj(),z=mj(),J=["/properties"];function K(H){return[Q,X,Y,G,B,D(this,F),L,D(this,z)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return H?I.$dataMetaSchema(A,J):A}}W.default=K}),pj=G0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let X=bH(),Y=yj(),G=xH(),B=cj(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends X.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,Q.exports=W=L,Q.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var z=FQ();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var J=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return J._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return J.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return J.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return J.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return J.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return J.CodeGen}});var K=gX();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var H=LQ();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return H.default}})}),dj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function Q(_,h){return{validate:_,compare:h}}W.fullFormats={date:Q(B,F),time:Q(z(!0),J),"date-time":Q(D(!0),I),"iso-time":Q(z(),K),"iso-date-time":Q(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Z,"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:l,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:U,int32:{type:"number",validate:O},int64:{type:"number",validate:w},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:Q(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,J),"date-time":Q(/^\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,I),"iso-time":Q(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":Q(/^\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,A),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},W.formatNames=Object.keys(W.fullFormats);function X(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],K0=+h[3];return p>=1&&p<=12&&K0>=1&&K0<=(p===2&&X(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function z(_){return function(d){let p=L.exec(d);if(!p)return!1;let K0=+p[1],j0=+p[2],w0=+p[3],S0=p[4],H0=p[5]==="-"?-1:1,b=+(p[6]||0),v=+(p[7]||0);if(b>23||v>59||_&&!S0)return!1;if(K0<=23&&j0<=59&&w0<60)return!0;let u=j0-v*H0,E=K0-b*H0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&w0<61}}function J(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let H=/t|\s/i;function D(_){let h=z(_);return function(p){let K0=p.split(H);return K0.length===2&&B(K0[0])&&h(K0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(H),[K0,j0]=h.split(H),w0=F(d,K0);if(w0===void 0)return;return w0||J(p,j0)}let M=/\/|:/,N=/^(?:[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;function Z(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let j=-2147483648,R=2147483647;function O(_){return Number.isInteger(_)&&_<=R&&_>=j}function w(_){return Number.isInteger(_)}function T(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),ij=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let Q=hH(),X=R0(),Y=X.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:z})=>X.str`should be ${G[L].okStr} ${z}`,params:({keyword:L,schemaCode:z})=>X._`{comparison: ${G[L].okStr}, limit: ${z}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:z,data:J,schemaCode:K,keyword:H,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new Q.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else Z();function N(){let U=z.scopeValue("formats",{ref:A.formats,code:I.code.formats}),j=z.const("fmt",X._`${U}[${M.schemaCode}]`);L.fail$data((0,X.or)(X._`typeof ${j} != "object"`,X._`${j} instanceof RegExp`,X._`typeof ${j}.compare != "function"`,V(j)))}function Z(){let U=M.schema,j=A.formats[U];if(!j||j===!0)return;if(typeof j!="object"||j instanceof RegExp||typeof j.compare!="function")throw Error(`"${H}": format "${U}" does not define "compare" function`);let R=z.scopeValue("formats",{key:U,ref:j,code:I.code.formats?X._`${I.code.formats}${(0,X.getProperty)(U)}`:void 0});L.fail$data(V(R))}function V(U){return X._`${U}.compare(${J}, ${K}) ${G[H].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),nj=G0((W,Q)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=dj(),Y=ij(),G=R0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(J,K={keywords:!0})=>{if(Array.isArray(K))return z(J,K,X.fullFormats,B),J;let[H,D]=K.mode==="fast"?[X.fastFormats,F]:[X.fullFormats,B];if(z(J,K.formats||X.formatNames,H,D),K.keywords)(0,Y.default)(J);return J};L.get=(J,K="full")=>{let H=(K==="fast"?X.fastFormats:X.fullFormats)[J];if(!H)throw Error(`Unknown format "${J}"`);return H};function z(J,K,H,D){var I,A;(I=(A=J.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)J.addFormat(M,H[M])}Q.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),rj=hH(),oj=pj(),aj=MX(nj(),1),sj=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),tj=aj.default;iS=rj.Ajv});var cH=$0(()=>{mH()});var WO;var pH=$0(()=>{WO=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then((W)=>W.webcrypto)});function XB(W){return`${W.method}\x00${JSON.stringify([W.partition??"",W.params??""])}`}function YB(W,Q){return Q===void 0?W:`${W}\x00${Q}`}function BO(W){let Q;try{Q=JSON.stringify(W)}catch(X){throw TypeError(`cache value is not JSON-serializable: ${X instanceof Error?X.message:String(X)}`)}if(typeof Q!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return Q}function zO(W,Q){switch(W.kind){case"result":return JO(W.result,Q);case"rpc-error":return tH(W,Q);case"http-error":return KO(W,Q);case"network-error":return dH(W.error,Q);case"auth-required":return{kind:"error",error:W.error};case"closed":if(Q.transportKind==="stdio")return{kind:"legacy"};return dH(Error("Connection closed during the version negotiation probe"),Q);case"timeout":if(Q.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new U0(A0.RequestTimeout,`Version negotiation probe timed out after ${W.timeoutMs}ms`,{timeout:W.timeoutMs})}}}function JO(W,Q){let X=v5(SX).validateResult("server/discover",W);if(!X.ok)return{kind:"legacy"};let Y=X.value.supportedVersions,G=Q.clientModernVersions.find((B)=>Y.includes(B));if(G!==void 0)return{kind:"modern",version:G,discover:X.value};if(Q.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new PX({supported:[...Y],requested:Q.requestedVersion})}}function tH(W,Q){let{code:X,message:Y,data:G}=W;if(X===FO){let B=$O(G);if(B===void 0)return{kind:"legacy"};let F=new PX({supported:B,requested:UO(G)??Q.requestedVersion},Y),L=BQ(B),z=Q.clientModernVersions.find((J)=>L.includes(J));if(z!==void 0)return{kind:"corrective",version:z,error:F};if(L.length>0)return{kind:"error",error:F};return Q.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:F}}if(LO.has(X))return{kind:"legacy"};return{kind:"legacy"}}function KO(W,Q){let X=AO(W.body);if(X!==void 0)return tH(X,Q);return{kind:"legacy"}}function dH(W,Q){if(Q.environment==="browser"&&ZO(W))return{kind:"legacy"};return{kind:"error",error:new U0(A0.EraNegotiationFailed,`Version negotiation probe failed: ${HO(W)}`,{cause:W})}}function ZO(W){return W instanceof TypeError||W instanceof Error&&W.name==="TypeError"}function HO(W){return W instanceof Error?W.message:String(W)}function $O(W){if(typeof W!=="object"||W===null)return;let Q=W.supported;if(!Array.isArray(Q)||Q.length===0||!Q.every((X)=>typeof X==="string"))return;return Q}function UO(W){if(typeof W!=="object"||W===null)return;let Q=W.requested;return typeof Q==="string"?Q:void 0}function AO(W){if(W===void 0||W==="")return;let Q;try{Q=JSON.parse(W)}catch{return}if(typeof Q!=="object"||Q===null)return;let X=Q.error;if(typeof X!=="object"||X===null)return;let{code:Y,message:G,data:B}=X;if(typeof Y!=="number")return;return{code:Y,message:typeof G==="string"?G:"",data:B}}function VO(W,Q){let X=W?.mode??NO;if(X==="legacy")return{kind:"legacy"};let Y=W?.probe??{};if(typeof X==="object"){if(!G4(X.pin))throw TypeError(`versionNegotiation: { pin: '${X.pin}' } is not a modern protocol revision \u2014 pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:X.pin,probe:Y}}let G=Q?BQ(Q):[];return{kind:"auto",modernVersions:G.length>0?G:[...x7],fallbackAvailable:Q?h7(Q).length>0:!0,probe:Y}}function iH(){let W=globalThis;return W.window!==void 0&&W.document!==void 0?"browser":"node"}function nH(W){return"stderr"in W&&"pid"in W?"stdio":"http"}function rH(W){let Q=GB.get(W);GB.delete(W),Q?.()}function DO(W,Q,X,Y){return{jsonrpc:"2.0",id:W,method:"server/discover",params:{_meta:v5(Q).outboundEnvelope({protocolVersion:Q,clientInfo:X,clientCapabilities:Y})}}}function MO(W,Q){switch(W.kind){case"response":return W.error===void 0?{kind:"result",result:W.result}:{kind:"rpc-error",...W.error};case"send-error":{let X=W.error;if(X instanceof uZ){let Y=X.data?.text;return{kind:"http-error",status:X.data.status,body:typeof Y==="string"?Y:void 0}}if(X instanceof QO||X instanceof Error&&X.name==="UnauthorizedError")return{kind:"auth-required",error:X};return{kind:"network-error",error:X}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:Q}}}async function eH(W,Q){let X=W.probe.timeoutMs??Q.defaultTimeoutMs,Y=Math.max(0,W.probe.maxRetries??0),G=W.kind==="pin"?[W.version]:W.modernVersions,B=W.kind==="auto"&&W.fallbackAvailable,F=await wO.open(Q.transport),L=async()=>{let J=G[0],K=!1,H=Y;for(;;){let D=await F.exchange((M)=>DO(M,J,Q.clientInfo,Q.capabilities),X);if(D.kind==="timeout"&&H>0){H--;continue}let I=MO(D,X),A=zO(I,{clientModernVersions:G,requestedVersion:J,fallbackAvailable:B,environment:Q.environment,transportKind:Q.transportKind});switch(A.kind){case"modern":return{era:"modern",version:A.version,discover:A.discover};case"corrective":if(K)throw A.error;K=!0,J=A.version;continue;case"legacy":{let M=I.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(W.kind==="pin")throw new U0(A0.EraNegotiationFailed,M===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${W.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${M} before the server offered pinned protocol version ${W.version} (no fallback in pin mode)`);if(!W.fallbackAvailable)throw new U0(A0.EraNegotiationFailed,M===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${M} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(M!==void 0&&Q.disposableProbe!==!0)throw new U0(A0.EraNegotiationFailed,`Version negotiation failed: ${M} (this transport probed in place \u2014 the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw A.error}}},z;try{z=await L()}catch(J){throw F.detach(),J}return F.release(),z}function jO(W){let Q=Object.getPrototypeOf(W);if(Q===null||!Object.prototype.hasOwnProperty.call(Q,"_dispose"))return;let X=W._serverParams;return typeof X==="object"&&X!==null&&typeof X.command==="string"?X:void 0}async function OO(W,Q,X,Y){let B=new Q.constructor({...X,stderr:"ignore"}),F=Q.close,L=!1,z,J=new Promise((H,D)=>{z=()=>D(oH())});Q.close=async function(){return L=!0,z?.(),F.call(Q)};let K;try{let H=eH(W,{...Y,transport:B,transportKind:"stdio",disposableProbe:!0});H.catch(()=>{}),K=await Promise.race([H,J])}finally{await EO(B),Q.close=F}if(L)throw oH();return K}function oH(){return new U0(A0.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function EO(W){try{let Q=W._dispose;await(typeof Q==="function"?Q.call(W):W.close())}catch{}}function aH(W){let Q=W._meta?.[V1];return wH.Implementation(Q)?Q:void 0}function hX(W,Q){if(!W||Q===null||typeof Q!=="object")return;if(W.type==="object"&&W.properties&&typeof W.properties==="object"){let X=Q,Y=W.properties;for(let G of Object.keys(Y)){let B=Y[G];if(X[G]===void 0&&Object.prototype.hasOwnProperty.call(B,"default"))X[G]=B.default;if(X[G]!==void 0)hX(B,X[G])}}if(Array.isArray(W.anyOf)){for(let X of W.anyOf)if(typeof X!=="boolean")hX(X,Q)}if(Array.isArray(W.oneOf)){for(let X of W.oneOf)if(typeof X!=="boolean")hX(X,Q)}}function IO(W){if(!W)return{supportsFormMode:!1,supportsUrlMode:!1};let Q=W.form!==void 0,X=W.url!==void 0;return{supportsFormMode:Q||!Q&&!X,supportsUrlMode:X}}function RO(W){if(typeof W==="object"&&W!==null){if(W.kind==="legacy"&&!("supportedVersions"in W)&&!("discover"in W))return W;if(W.kind==="modern"&&C5.safeParse(W.discover).success)return W}throw new U0(A0.EraNegotiationFailed,"connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }")}var zQ,Fq,Lq,zq,Jq,Kq,QO,xX,XO=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(W){this._maxEntries=W?.maxEntries??512}get size(){return this._entries.size}get(W){return this._entries.get(XB(W))}set(W,Q){let X=XB(W),Y=xX.has(W.method),G=!this._entries.has(X);if(!Y&&G&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let F of this._entries.keys())if(!xX.has(F.slice(0,F.indexOf("\x00")))){this._entries.delete(F),this._cappedSize--;break}}let B=++this._stamp;if(this._entries.set(X,{...Q,stamp:B}),G&&!Y)this._cappedSize++;return B}delete(W){if(this._entries.delete(XB(W))&&!xX.has(W.method))this._cappedSize--}evict(W){let Q=`${W}\x00`,X=xX.has(W);for(let Y of this._entries.keys())if(Y.startsWith(Q)){if(this._entries.delete(Y),!X)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}},YO=86400000,GO=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(W,Q,X=()=>{},Y="",G=Date.now){this._store=W,this._isUserSupplied=Q,this._reportError=X,this._cachePartition=Y,this._now=G}now(){return this._now()}setServerIdentity(W){this._serverIdentity=W}_partitionFor(W){return JSON.stringify([this._serverIdentity,W==="public"?"":this._cachePartition])}async _probe(W,Q){let X={method:W,params:Q??""},Y=this._partitionFor("private"),G=await this._store.get({...X,partition:Y});if(G!==void 0)return G;let B=this._partitionFor("public");if(B===Y)return;let F=await this._store.get({...X,partition:B});return F?.scope==="public"?F:void 0}async evict(W){this._evictionGeneration.set(W,(this._evictionGeneration.get(W)??0)+1),await this._deleteBoth(W,"")}async _deleteBoth(W,Q){let X=this._partitionFor("private"),Y=this._partitionFor("public");try{await this._store.delete({method:W,params:Q,partition:X})}catch(G){this._reportError(G)}if(Y!==X)try{await this._store.delete({method:W,params:Q,partition:Y})}catch(G){this._reportError(G)}}async evictKey(W,Q){let X=YB(W,Q),Y=this._evictionGeneration.get(X);if(Y!==void 0)this._evictionGeneration.set(X,Y+1);await this._deleteBoth(W,Q)}captureGeneration(W,Q){let X=YB(W,Q),Y=this._evictionGeneration.get(X)??0;return this._evictionGeneration.set(X,Y),Y}async write(W,Q,X,Y){if((this._evictionGeneration.get(YB(W,Y?.params))??0)!==X)return;let G=Y?.params??"",B=this._partitionFor("private"),F=this._partitionFor("public"),L=(Y?.scope??"private")==="public"?F:B;try{await this._store.set({method:W,params:G,partition:L},{value:BO(Q),expiresAt:Y?.expiresAt,scope:Y?.scope})}catch(z){this._reportError(z)}if(F!==B)try{await this._store.delete({method:W,params:G,partition:L===B?F:B})}catch(z){this._reportError(z)}}async read(W,Q){let X=await this._probe(W,Q);if(X?.expiresAt===void 0||!(X.expiresAt>this.now()))return;try{let Y=JSON.parse(X.value);if(typeof Y!=="object"||Y===null||Array.isArray(Y))throw TypeError("cached document is not an object");return{value:Y}}catch(Y){this._reportError(Y),await this._deleteBoth(W,Q??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(W){let Q=await this._probe("tools/list");if(Q===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==Q.stamp){let X=this._decodeListTools(Q),Y=new Map;if(X!==void 0)for(let G of X.tools)Y.set(G.name,G);this._toolIndex={stamp:Q.stamp,byName:Y}}return this._toolIndex.byName.get(W)}async outputValidator(W,Q){let X=await this._probe("tools/list");if(X===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==X.stamp){let Y=this._decodeListTools(X)??{tools:[]},G=new Map;for(let B of Y.tools){let F=Q(B);if(F!==void 0)G.set(B.name,F)}this._toolOutputValidatorIndex={stamp:X.stamp,byName:G}}return this._toolOutputValidatorIndex.byName.get(W)}_decodeListTools(W){try{let Q=JSON.parse(W.value);if(!Array.isArray(Q?.tools)||!Q.tools.every((X)=>X!==null&&typeof X==="object"))throw TypeError("cached tools/list document has a malformed tools array");return Q}catch(Q){this._reportError(Q);return}}},FO=-32022,LO,NO="legacy",wO=class W{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(Q){this._transport=Q,this._savedOnMessage=Q.onmessage,this._savedOnError=Q.onerror,this._savedOnClose=Q.onclose}static async open(Q){let X=new W(Q);Q.onmessage=(Y)=>{let G=X._pending;if(G!==void 0&&(YQ(Y)||bX(Y))&&Y.id===G.id){if(X._pending=void 0,YQ(Y))G.resolve({kind:"response",result:Y.result});else G.resolve({kind:"response",error:Y.error});return}},Q.onerror=(Y)=>{X._savedOnError?.(Y)},Q.onclose=()=>{let Y=X._pending;if(Y!==void 0)X._pending=void 0,Y.resolve({kind:"closed"});X._closeDelivered=!0,X._savedOnClose?.()};try{await Q.start()}catch(Y){throw X.detach(),Y}return X}async exchange(Q,X){let Y=`server-discover-probe-${++this._probeCounter}`;return new Promise((G)=>{let B=!1,F=(z)=>{if(B)return;if(B=!0,clearTimeout(L),this._pending?.id===Y)this._pending=void 0;G(z)},L=setTimeout(()=>F({kind:"timeout"}),X);this._pending={id:Y,resolve:F},this._transport.send(Q(Y)).catch((z)=>F({kind:"send-error",error:z}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let Q=this._savedOnClose,X=this._transport,Y=!1,G=()=>{if(!Y){Y=!0;return}Q()};X.onclose=G,GB.set(X,()=>{if(X.onclose===G)X.onclose=Q})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let Q=this._transport,X=Q.start,Y=!0;Q.start=async function(){if(Y){Y=!1,Q.start=X;return}return X.call(Q)}}},GB,sH,TO=64,W$,Zq;var Q$=$0(()=>{s7();cH();pH();zQ=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](W){return o1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,W)}constructor(W){super(W);this.name=new.target.name,y4(this,new.target)}},Fq=class extends zQ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(W,Q,X){super(`Issuer mismatch in ${W==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(Q)}, received ${JSON.stringify(X)}`);this.kind=W,this.expected=Q,this.received=X}},Lq=class extends zQ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(W){super(`Dynamic Client Registration rejected (HTTP ${W.status}): ${W.body}`);this.status=W.status,this.body=W.body,this.submittedMetadata=W.submittedMetadata}},zq=class extends zQ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(W){super(`Refusing to send credentials to non-https token endpoint '${W}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=W}},Jq=class extends zQ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(W,Q){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(W)}, callback resolved ${JSON.stringify(Q)}); refusing to send authorization_code/code_verifier to a different token endpoint`);this.recordedIssuer=W,this.currentIssuer=Q}},Kq=class extends zQ{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(W){super(`Insufficient scope${W.requiredScope?`: required "${W.requiredScope}"`:""}`);this.requiredScope=W.requiredScope,this.resourceMetadataUrl=W.resourceMetadataUrl,this.errorDescription=W.errorDescription}},QO=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](W){return o1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,W)}constructor(W){super(W??"Unauthorized");this.name="UnauthorizedError",y4(this,new.target)}},xX=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);LO=new Set([-32001,-32020,-32021]);GB=new WeakMap;sH={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},W$=class extends DH{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let W=new U0(A0.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let Q of this._listenState.values())Q.settle({cause:"remote",error:W})}this._listenState.clear();for(let W of this._listChangedDebounceTimers.values())clearTimeout(W);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(W,Q){super(Q);if(this._clientInfo=W,this._capabilities=Q?.capabilities?{...Q.capabilities}:{},this._jsonSchemaValidator=Q?.jsonSchemaValidator??new QB,this._enforceStrictCapabilities=Q?.enforceStrictCapabilities??!1,this._versionNegotiation=Q?.versionNegotiation,this._supportedProtocolVersionsOption=Q?.supportedProtocolVersions,this._inputRequiredDriverConfig=UH(Q?.inputRequired),this._cache=new GO(Q?.responseCacheStore??new XO,Q?.responseCacheStore!==void 0,(X)=>this._reportStoreError(X),Q?.cachePartition??""),this._defaultCacheTtlMs=Q?.defaultCacheTtlMs??0,this._listMaxPages=Q?.listMaxPages??TO,Q?.listChanged)this._listChangedConfig=Q.listChanged}buildContext(W,Q){return W}_shouldDropInbound(W){if(this._negotiatedProtocolVersion!==void 0&&G4(this._negotiatedProtocolVersion)&&d7(W))return"drop"}_outboundMetaEnvelope(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:W,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(W,Q){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new U0(A0.UnsupportedResultType,`Unsupported result type 'input_required' for ${Q.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance \u2014 pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:Q.request.method}));return jH({getRequestHandler:(X)=>this._getRequestHandler(X),buildContext:(X)=>this.buildContext(X,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,W,Q)}_setupListChangedHandlers(W){if(W.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",W.tools,async()=>{return(await this.listTools(void 0,{cacheMode:"refresh"})).tools});if(W.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",W.prompts,async()=>{return(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts});if(W.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",W.resources,async()=>{return(await this.listResources(void 0,{cacheMode:"refresh"})).resources})}registerCapabilities(W){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=MH(this._capabilities,W)}setVersionNegotiation(W){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=W}_wrapHandler(W,Q){if(W==="elicitation/create")return async(X,Y)=>{let G=v5(this._negotiatedProtocolVersion),B=G.validateRequest("elicitation/create",X);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("elicitation/create",X);if(!B.ok)throw new m0(B.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,B.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${B.message}`);let{params:F}=B.value;F.mode=F.mode??"form";let{supportsFormMode:L,supportsUrlMode:z}=IO(this._capabilities.elicitation);if(F.mode==="form"&&!L)throw new m0(M0.InvalidParams,"Client does not support form-mode elicitation requests");if(F.mode==="url"&&!z)throw new m0(M0.InvalidParams,"Client does not support URL-mode elicitation requests");let J=await Q(X,Y),K=G.validateResult("elicitation/create",J);if(!K.ok&&K.reason==="not-in-era")K=G.validateInputResponse("elicitation/create",J);if(!K.ok)throw new m0(K.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,K.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${K.message}`);let H=K.value,D=F.mode==="form"?F.requestedSchema:void 0;if(F.mode==="form"&&H.action==="accept"&&H.content&&D&&this._capabilities.elicitation?.form?.applyDefaults)try{hX(D,H.content)}catch{}return H};if(W==="sampling/createMessage")return async(X,Y)=>{let G=v5(this._negotiatedProtocolVersion),B=G.validateRequest("sampling/createMessage",X);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("sampling/createMessage",X);if(!B.ok)throw new m0(B.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,B.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${B.message}`);let{params:F}=B.value,L=await Q(X,Y),z=Boolean(F.tools||F.toolChoice),J=G.samplingResultVariant(z,L);if(!J.ok&&J.reason==="not-in-era")J=G.validateInputResponse("sampling/createMessage",L);if(!J.ok)throw new m0(J.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,J.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${J.message}`);return J.value};return Q}assertCapability(W,Q){if(!this._serverCapabilities?.[W])throw new U0(A0.CapabilityNotSupported,`Server does not support ${W} (required for ${Q})`)}async connect(W,Q){if(Q?.prior!=null)return this._connectFromPrior(W,RO(Q.prior),Q);let X=VO(this._versionNegotiation,this._supportedProtocolVersionsOption);if(X.kind!=="legacy")return this._connectNegotiated(W,X,Q);return this._connectPlainLegacy(W,Q)}async _connectPlainLegacy(W,Q){if(await super.connect(W),W.sessionId!==void 0){let X=this._negotiatedProtocolVersion;if(X!==void 0)W.setProtocolVersion?.(X);return}this._resetConnectionState(),await this._legacyHandshake(W,Q)}async _legacyHandshake(W,Q){let X=h7(this._supportedProtocolVersions);try{let Y=X[0];if(Y===void 0)throw new U0(A0.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let G=await this.request({method:"initialize",params:{protocolVersion:Y,capabilities:this._capabilities,clientInfo:this._clientInfo}},Q);if(G===void 0)throw Error(`Server sent invalid initialize result: ${G}`);if(!X.includes(G.protocolVersion))throw Error(`Server's protocol version is not supported: ${G.protocolVersion}`);if(this._serverCapabilities=G.capabilities,this._serverVersion=G.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(W)),W.setProtocolVersion)W.setProtocolVersion(G.protocolVersion);if(this._instructions=G.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=G.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(Y){throw this.close(),Y}}async _connectNegotiated(W,Q,X){if(W.sessionId!==void 0){await super.connect(W);let G=this._negotiatedProtocolVersion;if(G!==void 0&&W.setProtocolVersion)W.setProtocolVersion(G);return}this._resetConnectionState();let Y;try{let G=nH(W),B={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:iH(),defaultTimeoutMs:X?.timeout??CX},F=G==="stdio"?jO(W):void 0;Y=F===void 0?await eH(Q,{...B,transport:W,transportKind:G}):await OO(Q,W,F,B)}catch(G){throw await W.close().catch(()=>{}),rH(W),G}if(rH(W),await super.connect(W),Y.era==="legacy"){await this._legacyHandshake(W,X);return}if(this._serverCapabilities=Y.discover.capabilities,this._serverVersion=aH(Y.discover),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.discover.instructions,this._discoverResult=Y.discover,this._negotiatedProtocolVersion=Y.version,W.setProtocolVersion)W.setProtocolVersion(Y.version);if(this._listChangedConfig){let G=this._listChangedConfig,B=this._serverCapabilities,F={...G.tools&&B?.tools?.listChanged&&{tools:G.tools},...G.prompts&&B?.prompts?.listChanged&&{prompts:G.prompts},...G.resources&&B?.resources?.listChanged&&{resources:G.resources}},L=!0;try{this._setupListChangedHandlers(F)}catch(J){L=!1,this.onerror?.(J instanceof Error?J:Error(String(J)))}let z=L?{...F.tools&&{toolsListChanged:!0},...F.prompts&&{promptsListChanged:!0},...F.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(z).length>0){let J=new AbortController,K=()=>J.abort(X?.signal?.reason);if(X?.signal?.aborted)K();X?.signal?.addEventListener("abort",K);try{this._autoOpenedSubscription=await this.listen(z,{timeout:X?.timeout,signal:J.signal})}catch(H){if(X?.signal?.aborted)throw await this.close().catch(()=>{}),H;this.onerror?.(H instanceof Error?H:Error(String(H)))}finally{X?.signal?.removeEventListener("abort",K)}}}}async _connectFromPrior(W,Q,X){if(Q.kind==="legacy")return this._connectPlainLegacy(W,X);let Y=Q.discover;this._resetConnectionState();let G=this._supportedProtocolVersionsOption,B=(G&&BQ(G).length>0?BQ(G):x7).find((F)=>Y.supportedVersions.includes(F));if(B===void 0)throw new U0(A0.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(W),this._discoverResult=Y,this._serverCapabilities=Y.capabilities,this._serverVersion=aH(Y),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.instructions,this._negotiatedProtocolVersion=B,W.setProtocolVersion?.(B),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(F){this.onerror?.(F instanceof Error?F:Error(String(F)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(W){let Q=this._serverVersion;if(Q!==void 0)return`${Q.name}@${Q.version}`;return W.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return G4(W)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(W){switch(W){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new U0(A0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new U0(A0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new U0(A0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);if(W==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new U0(A0.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new U0(A0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new U0(A0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new U0(A0.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${W})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"sampling/createMessage":if(!this._capabilities.sampling)throw new U0(A0.CapabilityNotSupported,`Client does not support sampling capability (required for ${W})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new U0(A0.CapabilityNotSupported,`Client does not support elicitation capability (required for ${W})`);break;case"roots/list":if(!this._capabilities.roots)throw new U0(A0.CapabilityNotSupported,`Client does not support roots capability (required for ${W})`);break;case"ping":break}}async ping(W){return this.request({method:"ping"},W)}async discover(W){let Q=await this._requestWithSchema({method:"server/discover"},C5,W);return this._discoverResult=Q,Q}async complete(W,Q){return this.request({method:"completion/complete",params:W},Q)}async setLoggingLevel(W,Q){return this.request({method:"logging/setLevel",params:{level:W}},Q)}async getPrompt(W,Q){return this.request({method:"prompts/get",params:W},Q)}async listPrompts(W,Q){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(W?.cursor!==void 0)return this.request({method:"prompts/list",params:W},Q);let X=await this._serveFromCache("prompts/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("prompts/list",W,Q,(Y,G)=>Y.prompts.push(...G.prompts))}async listResources(W,Q){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(W?.cursor!==void 0)return this.request({method:"resources/list",params:W},Q);let X=await this._serveFromCache("resources/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("resources/list",W,Q,(Y,G)=>Y.resources.push(...G.resources))}async listResourceTemplates(W,Q){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(W?.cursor!==void 0)return this.request({method:"resources/templates/list",params:W},Q);let X=await this._serveFromCache("resources/templates/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("resources/templates/list",W,Q,(Y,G)=>Y.resourceTemplates.push(...G.resourceTemplates))}async _listAllPages(W,Q,X,Y,G){let B=X?.cacheMode==="bypass",F=this._cache.captureGeneration(W),L=await this.request({method:W,...Q&&{params:{...Q}}},X),z=L.nextCursor,J=new Set,K=1;while(z!==void 0&&!J.has(z)){if(this._listMaxPages!==0&&K>=this._listMaxPages)throw new U0(A0.ListPaginationExceeded,`${W}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:W,listMaxPages:this._listMaxPages});J.add(z);let H=await this.request({method:W,params:{...Q,cursor:z}},X);Y(L,H),z=H.nextCursor,K++}if(delete L.nextCursor,G?.(L),B)return L;return await this._cache.write(W,L,F,this._freshness(L)),L}_freshness(W,Q){let X=W,Y=typeof X.ttlMs==="number"?X.ttlMs:this._defaultCacheTtlMs,G=X.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,Y),YO),scope:G,params:Q}}async _serveFromCache(W,Q,X){if(X?.cacheMode==="bypass"||X?.cacheMode==="refresh")return;let Y=await this._cache.read(W,Q).catch((G)=>void this._reportStoreError(G));if(Y!==void 0){if(X?.signal?.aborted){let G=X.signal.reason;throw G instanceof U0?G:new U0(A0.RequestTimeout,String(G))}return Y.value}}_reportStoreError(W){this.onerror?.(W instanceof Error?W:Error(String(W)))}_compileOutputValidator(W){if(!W.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(W.outputSchema)}}catch(Q){return{ok:!1,compileError:Q}}}async _resolveXMcpHeaderScan(W,Q){let X=Q??await this._cache.toolDefinition(W);return X===void 0?void 0:i7(X.inputSchema)}async readResource(W,Q){let X=await this._serveFromCache("resources/read",W.uri,Q);if(X!==void 0)return X;let Y=this._cache.captureGeneration("resources/read",W.uri),G=await this.request({method:"resources/read",params:W},Q);if(Q?.cacheMode!=="bypass"){let B=this._freshness(G,W.uri);if(B.expiresAt>this._cache.now())await this._cache.write("resources/read",G,Y,B);else if(Q?.cacheMode==="refresh")await this._cache.evictKey("resources/read",W.uri)}return G}async subscribeResource(W,Q){return this.request({method:"resources/subscribe",params:W},Q)}async unsubscribeResource(W,Q){return this.request({method:"resources/unsubscribe",params:W},Q)}async listen(W,Q){if(this.transport===void 0)throw new U0(A0.NotConnected,"Not connected");let X=this._negotiatedProtocolVersion;if(X===void 0||!G4(X))throw new U0(A0.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${X??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:X});if(Q?.signal?.aborted){let V=Q.signal.reason;throw V instanceof U0?V:new U0(A0.RequestTimeout,String(V))}let Y=new AbortController,G=`listen:${this._nextListenId++}`,B="opening",F,L,z,J,K=new Promise((V,U)=>{z=V,J=U}),H,D=new Promise((V)=>{H=V}),I=(V)=>{if(B==="closed")return;let U=B==="opening";if(F!==void 0)clearTimeout(F),F=void 0;if("ack"in V){B="open",z(V.ack);return}if(B="closed",L!==void 0)Q?.signal?.removeEventListener("abort",L);if(this._listenState.delete(G),Y.abort(),H(V.cause),U)J(V.error??new U0(A0.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},A=async()=>{Y.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:G}}).catch(()=>{})},M=async()=>{if(B==="closed")return;I({cause:"local"}),await A()};this._listenState.set(G,{settle:I});let N=Q?.timeout??CX;if(F=setTimeout(()=>{I({cause:"remote",error:new U0(A0.RequestTimeout,"subscriptions/listen ack timed out",{timeout:N})}),A().catch(()=>{})},N),Q?.signal){let V=Q.signal;L=()=>{if(B==="closed")return;let U=V.reason;I({cause:"local",error:U instanceof Error?U:Error(String(U??"Aborted"))}),A().catch(()=>{})},V.addEventListener("abort",L,{once:!0})}let Z={jsonrpc:"2.0",id:G,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:W}};try{await this.transport.send(Z,{requestSignal:Y.signal,onRequestStreamEnd:()=>I({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(V){I({cause:"remote",error:V instanceof Error?V:Error(String(V))})}return{honoredFilter:await K,close:M,closed:D}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(W,Q){let X=Object.hasOwn(sH,W.method)?sH[W.method]:void 0;if(W.method==="notifications/resources/updated"){let Y=W.params?.uri;if(typeof Y==="string")this._cache.evictKey("resources/read",Y)}else if(X!==void 0)for(let Y of X)this._cache.evict(Y);if(W.method==="notifications/subscriptions/acknowledged"){let Y=W.params?._meta?.[l5],G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){let B=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",W);G.settle({ack:B.ok?B.value.params.notifications:{}});return}}if(W.method==="notifications/cancelled"){let Y=W.params?.requestId,G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){G.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(W,Q)}_onresponse(W){let Q=W.id,X=typeof Q==="string"?this._listenState.get(Q):void 0;if(X!==void 0){if(bX(W))X.settle({cause:"remote",error:m0.fromError(W.error.code,W.error.message,W.error.data)});else X.settle({cause:"graceful",error:new U0(A0.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(W)}_onclose(){if(this._listenState.size>0){let W=new U0(A0.ConnectionClosed,"Connection closed");for(let Q of this._listenState.values())Q.settle({cause:"remote",error:W});this._listenState.clear()}super._onclose()}async callTool(W,Q){let X=this.getProtocolEra()==="modern"&&iH()!=="browser",Y=async()=>{if(!X)return Q;let z;try{z=await this._resolveXMcpHeaderScan(W.name,Q?.toolDefinition)}catch(K){this._reportStoreError(K)}if(!z?.valid||z.declarations.length===0)return Q;let J=HH(z.declarations,W.arguments);return Object.keys(J).length===0?Q:{...Q,headers:{...Q?.headers,...J}}},G=Q?.toolDefinition===void 0?await this._cache.outputValidator(W.name,(z)=>this._compileOutputValidator(z)).catch((z)=>void this._reportStoreError(z)):this._compileOutputValidator(Q.toolDefinition),B=()=>{if(G===void 0||G.ok)return;let z=G.compileError,J=(z instanceof Error?z.message:String(z)).slice(0,200);throw new m0(M0.InvalidParams,`Tool '${W.name}' has an invalid outputSchema: ${J}`)};B();let F;try{F=await this.request({method:"tools/call",params:W},await Y())}catch(z){let J=z instanceof m0&&z.code===c9;if(!X||!J||Q?.toolDefinition!==void 0)throw z;let K={signal:Q?.signal,timeout:Q?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,K).catch((H)=>this._reportStoreError(H)),G=await this._cache.outputValidator(W.name,(H)=>this._compileOutputValidator(H)).catch((H)=>void this._reportStoreError(H)),B(),F=await this.request({method:"tools/call",params:W},await Y())}let L=G!==void 0&&G.ok?G.validator:void 0;if(L){if(F.structuredContent===void 0&&!F.isError)throw new m0(M0.InvalidRequest,`Tool ${W.name} has an output schema but did not return structured content`);if(F.structuredContent!==void 0&&!F.isError)try{let z=L(F.structuredContent);if(!z.valid)throw new m0(M0.InvalidParams,`Structured content does not match the tool's output schema: ${z.errorMessage}`)}catch(z){if(z instanceof m0)throw z;throw new m0(M0.InvalidParams,`Failed to validate structured content: ${z instanceof Error?z.message:String(z)}`)}}return F}async listTools(W,Q){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(W?.cursor!==void 0){let Y=await this.request({method:"tools/list",params:W},Q);return this._excludeInvalidXMcpHeaderTools(Y),Y}let X=await this._serveFromCache("tools/list",void 0,Q);if(X!==void 0)return X;return this._listAllPages("tools/list",W,Q,(Y,G)=>Y.tools.push(...G.tools),(Y)=>this._excludeInvalidXMcpHeaderTools(Y))}_excludeInvalidXMcpHeaderTools(W){if(this.getProtocolEra()!=="modern"||!this.transport||nH(this.transport)==="stdio")return;let Q=W.tools.filter((X)=>{let Y=i7(X.inputSchema);if(!Y.valid)return console.warn(`[mcp-sdk] excluding tool '${X.name}' from tools/list: invalid x-mcp-header declaration \u2014 ${Y.reason}`),!1;return!0});if(Q.length!==W.tools.length)W.tools=Q}_setupListChangedHandler(W,Q,X,Y){let G=qX(b4,X);if(!G.success)throw Error(`Invalid ${W} listChanged options: ${G.error.message}`);if(typeof X.onChanged!=="function")throw TypeError(`Invalid ${W} listChanged options: onChanged must be a function`);let{autoRefresh:B,debounceMs:F}=G.data,{onChanged:L}=X,z=async()=>{if(!B){L(null,null);return}try{L(null,await Y())}catch(K){L(K instanceof Error?K:Error(String(K)),null)}},J=()=>{if(F){let K=this._listChangedDebounceTimers.get(W);if(K)clearTimeout(K);let H=setTimeout(z,F);this._listChangedDebounceTimers.set(W,H)}else z()};this.setNotificationHandler(Q,J)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}},Zq=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](W){return o1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return o1(this,W)}constructor(W,Q,X){super(`SSE error: ${Q}`);this.code=W,this.event=X,y4(this,new.target)}}});var F$=d1((Iq,B$)=>{B$.exports=G$;G$.sync=SO;var X$=w5("fs");function PO(W,Q){var X=Q.pathExt!==void 0?Q.pathExt:process.env.PATHEXT;if(!X)return!0;if(X=X.split(";"),X.indexOf("")!==-1)return!0;for(var Y=0;Y<X.length;Y++){var G=X[Y].toLowerCase();if(G&&W.substr(-G.length).toLowerCase()===G)return!0}return!1}function Y$(W,Q,X){if(!W.isSymbolicLink()&&!W.isFile())return!1;return PO(Q,X)}function G$(W,Q,X){X$.stat(W,function(Y,G){X(Y,Y?!1:Y$(G,W,Q))})}function SO(W,Q){return Y$(X$.statSync(W),W,Q)}});var Z$=d1((Rq,K$)=>{K$.exports=z$;z$.sync=bO;var L$=w5("fs");function z$(W,Q,X){L$.stat(W,function(Y,G){X(Y,Y?!1:J$(G,Q))})}function bO(W,Q){return J$(L$.statSync(W),Q)}function J$(W,Q){return W.isFile()&&qO(W,Q)}function qO(W,Q){var{mode:X,uid:Y,gid:G}=W,B=Q.uid!==void 0?Q.uid:process.getuid&&process.getuid(),F=Q.gid!==void 0?Q.gid:process.getgid&&process.getgid(),L=parseInt("100",8),z=parseInt("010",8),J=parseInt("001",8),K=L|z,H=X&J||X&z&&G===F||X&L&&Y===B||X&K&&B===0;return H}});var $$=d1((Pq,H$)=>{var Tq=w5("fs"),uX;if(process.platform==="win32"||global.TESTING_WINDOWS)uX=F$();else uX=Z$();H$.exports=BB;BB.sync=CO;function BB(W,Q,X){if(typeof Q==="function")X=Q,Q={};if(!X){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(Y,G){BB(W,Q||{},function(B,F){if(B)G(B);else Y(F)})})}uX(W,Q||{},function(Y,G){if(Y){if(Y.code==="EACCES"||Q&&Q.ignoreErrors)Y=null,G=!1}X(Y,G)})}function CO(W,Q){try{return uX.sync(W,Q||{})}catch(X){if(Q&&Q.ignoreErrors||X.code==="EACCES")return!1;else throw X}}});var M$=d1((Sq,D$)=>{var p9=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",U$=w5("path"),kO=p9?";":":",A$=$$(),N$=(W)=>Object.assign(Error(`not found: ${W}`),{code:"ENOENT"}),V$=(W,Q)=>{let X=Q.colon||kO,Y=W.match(/\//)||p9&&W.match(/\\/)?[""]:[...p9?[process.cwd()]:[],...(Q.path||process.env.PATH||"").split(X)],G=p9?Q.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",B=p9?G.split(X):[""];if(p9){if(W.indexOf(".")!==-1&&B[0]!=="")B.unshift("")}return{pathEnv:Y,pathExt:B,pathExtExe:G}},w$=(W,Q,X)=>{if(typeof Q==="function")X=Q,Q={};if(!Q)Q={};let{pathEnv:Y,pathExt:G,pathExtExe:B}=V$(W,Q),F=[],L=(J)=>new Promise((K,H)=>{if(J===Y.length)return Q.all&&F.length?K(F):H(N$(W));let D=Y[J],I=/^".*"$/.test(D)?D.slice(1,-1):D,A=U$.join(I,W),M=!I&&/^\.[\\\/]/.test(W)?W.slice(0,2)+A:A;K(z(M,J,0))}),z=(J,K,H)=>new Promise((D,I)=>{if(H===G.length)return D(L(K+1));let A=G[H];A$(J+A,{pathExt:B},(M,N)=>{if(!M&&N)if(Q.all)F.push(J+A);else return D(J+A);return D(z(J,K,H+1))})});return X?L(0).then((J)=>X(null,J),X):L(0)},vO=(W,Q)=>{Q=Q||{};let{pathEnv:X,pathExt:Y,pathExtExe:G}=V$(W,Q),B=[];for(let F=0;F<X.length;F++){let L=X[F],z=/^".*"$/.test(L)?L.slice(1,-1):L,J=U$.join(z,W),K=!z&&/^\.[\\\/]/.test(W)?W.slice(0,2)+J:J;for(let H=0;H<Y.length;H++){let D=K+Y[H];try{if(A$.sync(D,{pathExt:G}))if(Q.all)B.push(D);else return D}catch(I){}}}if(Q.all&&B.length)return B;if(Q.nothrow)return null;throw N$(W)};D$.exports=w$;w$.sync=vO});var O$=d1((bq,FB)=>{var j$=(W={})=>{let Q=W.env||process.env;if((W.platform||process.platform)!=="win32")return"PATH";return Object.keys(Q).reverse().find((Y)=>Y.toUpperCase()==="PATH")||"Path"};FB.exports=j$;FB.exports.default=j$});var T$=d1((qq,R$)=>{var E$=w5("path"),yO=M$(),_O=O$();function I$(W,Q){let X=W.options.env||process.env,Y=process.cwd(),G=W.options.cwd!=null,B=G&&process.chdir!==void 0&&!process.chdir.disabled;if(B)try{process.chdir(W.options.cwd)}catch(L){}let F;try{F=yO.sync(W.command,{path:X[_O({env:X})],pathExt:Q?E$.delimiter:void 0})}catch(L){}finally{if(B)process.chdir(Y)}if(F)F=E$.resolve(G?W.options.cwd:"",F);return F}function gO(W){return I$(W)||I$(W,!0)}R$.exports=gO});var P$=d1((hO,zB)=>{var LB=/([()\][%!^"`<>&|;, *?])/g;function fO(W){return W=W.replace(LB,"^$1"),W}function xO(W,Q){if(W=`${W}`,W=W.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),W=W.replace(/(?=(\\+?)?)\1$/,"$1$1"),W=`"${W}"`,W=W.replace(LB,"^$1"),Q)W=W.replace(LB,"^$1");return W}hO.command=fO;hO.argument=xO});var b$=d1((Cq,S$)=>{S$.exports=/^#!(.*)/});var C$=d1((kq,q$)=>{var mO=b$();q$.exports=(W="")=>{let Q=W.match(mO);if(!Q)return null;let[X,Y]=Q[0].replace(/#! ?/,"").split(" "),G=X.split("/").pop();if(G==="env")return Y;return Y?`${G} ${Y}`:G}});var v$=d1((vq,k$)=>{var JB=w5("fs"),cO=C$();function pO(W){let X=Buffer.alloc(150),Y;try{Y=JB.openSync(W,"r"),JB.readSync(Y,X,0,150,0),JB.closeSync(Y)}catch(G){}return cO(X.toString())}k$.exports=pO});var f$=d1((yq,g$)=>{var dO=w5("path"),y$=T$(),_$=P$(),iO=v$(),nO=process.platform==="win32",rO=/\.(?:com|exe)$/i,oO=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function aO(W){W.file=y$(W);let Q=W.file&&iO(W.file);if(Q)return W.args.unshift(W.file),W.command=Q,y$(W);return W.file}function sO(W){if(!nO)return W;let Q=aO(W),X=!rO.test(Q);if(W.options.forceShell||X){let Y=oO.test(Q);W.command=dO.normalize(W.command),W.command=_$.command(W.command),W.args=W.args.map((B)=>_$.argument(B,Y));let G=[W.command].concat(W.args).join(" ");W.args=["/d","/s","/c",`"${G}"`],W.command=process.env.comspec||"cmd.exe",W.options.windowsVerbatimArguments=!0}return W}function tO(W,Q,X){if(Q&&!Array.isArray(Q))X=Q,Q=null;Q=Q?Q.slice(0):[],X=Object.assign({},X);let Y={command:W,args:Q,options:X,file:void 0,original:{command:W,args:Q}};return X.shell?Y:sO(Y)}g$.exports=tO});var u$=d1((_q,h$)=>{var KB=process.platform==="win32";function ZB(W,Q){return Object.assign(Error(`${Q} ${W.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${Q} ${W.command}`,path:W.command,spawnargs:W.args})}function eO(W,Q){if(!KB)return;let X=W.emit;W.emit=function(Y,G){if(Y==="exit"){let B=x$(G,Q);if(B)return X.call(W,"error",B)}return X.apply(W,arguments)}}function x$(W,Q){if(KB&&W===1&&!Q.file)return ZB(Q.original,"spawn");return null}function WE(W,Q){if(KB&&W===1&&!Q.file)return ZB(Q.original,"spawnSync");return null}h$.exports={hookChildProcess:eO,verifyENOENT:x$,verifyENOENTSync:WE,notFoundError:ZB}});var c$=d1((gq,d9)=>{var l$=w5("child_process"),HB=f$(),$B=u$();function m$(W,Q,X){let Y=HB(W,Q,X),G=l$.spawn(Y.command,Y.args,Y.options);return $B.hookChildProcess(G,Y),G}function QE(W,Q,X){let Y=HB(W,Q,X),G=l$.spawnSync(Y.command,Y.args,Y.options);return G.error=G.error||$B.verifyENOENTSync(G.status,Y),G}d9.exports=m$;d9.exports.spawn=m$;d9.exports.sync=QE;d9.exports._parse=HB;d9.exports._enoent=$B});import UB from"process";import{PassThrough as XE}from"stream";function GE(){let W={};for(let Q of YE){let X=UB.env[Q];if(X===void 0)continue;if(X.startsWith("()"))continue;W[Q]=X}return W}var p$,YE,d$=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(W){if(this._serverParams=W,this._readBuffer=new o7({maxBufferSize:W.maxBufferSize}),W.stderr==="pipe"||W.stderr==="overlapped")this._stderrStream=new XE}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((W,Q)=>{if(this._process=p$.default(this._serverParams.command,this._serverParams.args??[],{env:{...GE(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:UB.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",(X)=>{Q(X),this.onerror?.(X)}),this._process.on("spawn",()=>{W()}),this._process.on("close",(X)=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",(X)=>{this.onerror?.(X)}),this._process.stdout?.on("data",(X)=>{try{this._readBuffer.append(X),this.processReadBuffer()}catch(Y){this.onerror?.(Y),this.close().catch(()=>{})}}),this._process.stdout?.on("error",(X)=>{this.onerror?.(X)}),this._stderrStream&&this._process.stderr)this._process.stderr.pipe(this._stderrStream)})}get stderr(){if(this._stderrStream)return this._stderrStream;return this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;this.onmessage?.(W)}catch(W){this.onerror?.(W)}}async _dispose(){let W=this._process;if(this._process=void 0,W&&W.exitCode===null&&W.signalCode===null){let Q=new Promise((X)=>W.once("exit",()=>X()));try{W.stdin?.end()}catch{}try{W.kill("SIGTERM")}catch{}if(await Promise.race([Q,new Promise((X)=>setTimeout(X,1000).unref())]),W.exitCode===null&&W.signalCode===null)try{W.kill("SIGKILL")}catch{}await Q}try{W?.stdout?.destroy()}catch{}try{W?.stdin?.destroy()}catch{}try{W?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let W=this._process;this._process=void 0;let Q=new Promise((X)=>{W.once("close",()=>{X()})});try{W.stdin?.end()}catch{}if(await Promise.race([Q,new Promise((X)=>setTimeout(X,2000).unref())]),W.exitCode===null){try{W.kill("SIGTERM")}catch{}await Promise.race([Q,new Promise((X)=>setTimeout(X,2000).unref())])}if(W.exitCode===null)try{W.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(W){return new Promise((Q)=>{if(!this._process?.stdin)throw new U0(A0.NotConnected,"Not connected");let X=a7(W);if(this._process.stdin.write(X))Q();else this._process.stdin.once("drain",Q)})}};var i$=$0(()=>{s7();p$=iU(c$(),1),YE=UB.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"]});var n$={};F4(n$,{PACKAGE_ROOT:()=>AB,DPRINT_BINARY:()=>JE,AST_BRO_BINARY:()=>n9});import{realpathSync as BE}from"fs";import{createRequire as FE}from"module";import i9 from"path";var AB,LE,zE,n9,JE;var lX=$0(()=>{AB=i9.resolve(import.meta.dir,i9.basename(import.meta.dir)==="dist"?"..":"../.."),LE=i9.join(AB,"node_modules/.bin/ast-bro"),zE=FE(import.meta.url)(i9.join(i9.dirname(BE(LE)),"install.js")),n9=process.env.AST_BRO_BINARY??zE.getBinaryPath(),JE=process.env.DPRINT_BINARY??i9.join(AB,"node_modules/.bin/dprint")});async function h6(W,Q,X){let Y=new W$({name:"ast-mcp",version:"1.0.0"}),G=new d$({args:["mcp"],command:n9,cwd:X});try{return await Y.connect(G),await Y.callTool({arguments:Q,name:W})}finally{try{await Y.close()}catch{}}}var r$;var JQ=$0(()=>{Q$();i$();lX();lX();r$=["map","digest","show","implements","surface","deps","reverse_deps","cycles","graph","search","find_related","index","callers","callees","trace","impact","context","run","squeeze"]});function e6(W){let Q=W.content.filter((X)=>X.type==="text"&&typeof X.text==="string").map((X)=>X.text).join(`
112
- `);if(W.isError)throw Error(Q||"ast-bro MCP call failed");if(!Q)throw Error("ast-bro MCP returned no JSON text");try{return JSON.parse(Q)}catch(X){throw Error(`Invalid ast-bro MCP JSON: ${Q}`,{cause:X})}}function NB(W){let Q=e6(W);return[...new Set((Q.matches??[]).map((X)=>X.file).filter((X)=>typeof X==="string"))]}function o$(W){let Q=e6(W);return[...new Set((Q.files??[]).filter((X)=>X.status==="rewritten").map((X)=>X.file).filter((X)=>typeof X==="string"))]}var s$;var a$=$0(()=>{s$={callees:{description:"What does this symbol call? \u2014 AST-accurate forward call traversal. Suffix-matches the target like `callers`. Unresolved/external callees shown by default (tagged cyan/red). Returns text by default; set `json: true` for `ast-bro.callees.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_external:{description:"Drop unresolved/external callees. Default: false (shown with [unresolved]/[external] tags).",type:"boolean"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},callers:{description:"Find callers of a symbol \u2014 AST-accurate, no grep noise. Suffix-matches the target like `show`/`implements`: `TakeDamage`, or `Type.method` when ambiguous. Ambiguous matches shown by default (tagged red). Returns text by default; set `json: true` for `ast-bro.callers.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_ambiguous:{description:"Drop callers with multiple candidates. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},context:{description:"Token-budgeted context for a symbol \u2014 target body + direct callees (bodies) + callers/transitive (signatures), greedily packed into a caller-supplied token budget. Replaces chains of 4\u20135 `show`/`callers`/`callees` calls with ONE context-aware payload. Budget degrades gracefully from full bodies to signatures only. Returns text by default; set `json: true` for `ast-bro.context.v1`.",inputSchema:{properties:{budget:{description:"Token budget (default 8000). ~4 bytes per token rough.",minimum:100,type:"integer"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to build context for (same form as callers).",type:"string"}},required:["target"],type:"object"}},cycles:{description:"Find import cycles via Tarjan SCC. Returns the list of strongly-connected components with `len > 1` (or singletons with self-edges). Returns text by default; set `json: true` for `ast-bro.cycles.v1`. Exits non-zero when cycles exist (useful for CI gates).",inputSchema:{properties:{json:{type:"boolean"},min_size:{description:"Drop SCCs smaller than this (default 2).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},deps:{description:"Forward import-graph traversal: what does this file import (transitively)? Builds a per-repo dep graph at `.ast-bro/deps/graph.bin` on first call, then reuses it. Returns text by default; set `json: true` for `ast-bro.deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose imports to follow.",type:"string"},hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{type:"boolean"},rebuild:{description:"Drop the cached graph and rebuild.",type:"boolean"}},required:["file"],type:"object"}},digest:{description:"One-page module map for an unfamiliar directory: every file's types and public methods. Returns text by default; set `json: true` for `ast-bro.map.v1`.",inputSchema:{properties:{include_fields:{type:"boolean"},include_private:{type:"boolean"},json:{type:"boolean"},max_members:{description:"Cap members per type (default 50).",type:"integer"},paths:{description:"Files or directories to digest.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},find_related:{description:"Find chunks semantically similar to a given file:line. Useful for navigating to related code. Returns text by default; set `json: true` for `ast-bro.related.v1`.",inputSchema:{properties:{json:{type:"boolean"},line:{description:"1-indexed line within `path`.",minimum:1,type:"integer"},path:{description:"Repo-relative path of the source chunk.",type:"string"},root:{description:'Repo root containing the index (default ".").',type:"string"},top_k:{description:"Max results (default 10).",minimum:1,type:"integer"}},required:["path","line"],type:"object"}},graph:{description:"Emit the file-level dependency graph. Unresolved external imports shown by default (tagged `[external]`). Returns text by default; set `json: true` for `ast-bro.graph.v1`.",inputSchema:{properties:{hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{description:"Return JSON (schema `ast-bro.graph.v1`) instead of text.",type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},impact:{description:"Cross-file impact analysis: callers + callees + file reverse-deps + test detection in one call. Answers 'what would break if I change X?' and 'how wide is the blast radius?' in one shot. Four modes: `deps` (what it calls/imports), `dependents` (who calls/imports it), `tests` (affected tests only), `all` (default). Returns text by default; set `json: true` for `ast-bro.impact.v1`.",inputSchema:{properties:{depth:{description:"Transitive depth (default 2).",minimum:1,type:"integer"},exclude_tests:{description:"Exclude test files from output.",type:"boolean"},hide_ambiguous:{description:"Drop ambiguous call-edge matches. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Result cap per section (default 200).",minimum:1,type:"integer"},mode:{description:"Section: 'deps', 'dependents', 'tests', or 'all' (default).",enum:["deps","dependents","tests","all"],type:"string"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to analyse (e.g. 'handleRequest', 'Player.TakeDamage', 'src/Player.cs:TakeDamage').",type:"string"},tests:{description:"Show only test files.",type:"boolean"}},required:["target"],type:"object"}},implements:{description:"Find subclasses / implementations of a type using AST matching. Transitive by default \u2014 set `direct: true` for level-1 only. Returns text by default; set `json: true` for `ast-bro.implements.v1`.",inputSchema:{properties:{direct:{description:"Direct subtypes only (skip transitive).",type:"boolean"},json:{type:"boolean"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},target:{description:"Type name to look up.",type:"string"}},required:["target","paths"],type:"object"}},index:{description:"Build, refresh, or inspect the per-repo search index. With `stats: true` returns index stats. With `rebuild: true` drops the cache and rebuilds. Otherwise just opens (and incrementally refreshes if files changed). Returns text by default; set `json: true` for `ast-bro.index-stats.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{description:"Drop existing cache and rebuild.",type:"boolean"},stats:{description:"Print index stats and return.",type:"boolean"}},type:"object"}},map:{description:"AST-based structural map of source files \u2014 signatures with line ranges, no method bodies. Returns text by default (5\u201310\xD7 smaller than reading the file). Set `json: true` for the machine-readable schema `ast-bro.map.v1`.",inputSchema:{properties:{glob:{description:"Glob filter applied during directory walk.",type:"string"},json:{description:"Return JSON (schema `ast-bro.map.v1`) instead of text.",type:"boolean"},no_attrs:{description:"Hide attributes / decorators.",type:"boolean"},no_docs:{description:"Hide doc comments.",type:"boolean"},no_fields:{description:"Hide field declarations.",type:"boolean"},no_lines:{description:"Hide line-range suffixes.",type:"boolean"},no_private:{description:"Hide private declarations.",type:"boolean"},paths:{description:"Files or directories to map.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},reverse_deps:{description:"Reverse import-graph: who imports this file (transitively)? Useful for refactor blast-radius assessment. Returns text by default; set `json: true` for `ast-bro.reverse-deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose importers to find.",type:"string"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},rebuild:{type:"boolean"}},required:["file"],type:"object"}},run:{description:"AST-aware pattern search and rewrite. Use metavariables like $FUNC, $ARG, $$$BODY for structural matching. Search-only without rewrite; transform code with rewrite and write. WARNING: `write: true` mutates files on disk \u2014 a broad pattern can touch many files at once (capped at 50 per call). Always preview with the default dry-run first and confirm the diff before re-running with `write: true`. Returns text by default; set `json: true` for `ast-bro.run.v1`.",inputSchema:{properties:{glob:{description:"Glob pattern to filter files, e.g. '**/*.rs'.",type:"string"},json:{description:"Return results as JSON instead of text.",type:"boolean"},lang:{description:"Language (auto-detected from file paths if omitted).",type:"string"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},pattern:{description:"AST pattern with metavariables (e.g. '$FUNC($$$)').",type:"string"},rewrite:{description:"Replacement template (e.g. 'bar($A)'). Omit for search-only.",type:"string"},write:{description:"Write changes to disk. Default: false (dry-run). DANGEROUS: mutates files; preview the dry-run diff first and confirm before flipping to true.",type:"boolean"}},required:["pattern"],type:"object"}},search:{description:"Hybrid BM25 + dense semantic search over the repo. First call builds a per-repo index at `.ast-bro/index/` (one-time, ~seconds for typical repos). Returns text by default; set `json: true` for `ast-bro.search.v1`.",inputSchema:{properties:{alpha:{description:"Override semantic-vs-BM25 weight (0.0=pure BM25, 1.0=pure semantic). Default auto-detects from query type.",type:"number"},json:{description:"Return JSON (schema `ast-bro.search.v1`) instead of text.",type:"boolean"},languages:{description:'Restrict to chunks of these languages (e.g. ["rust", "python"]).',items:{type:"string"},type:"array"},path:{description:'Repo root to search in (default ".").',type:"string"},query:{description:"Search query (free-form text or symbol name).",type:"string"},top_k:{description:"Max results to return (default 10).",minimum:1,type:"integer"}},required:["query"],type:"object"}},show:{description:"Extract source of one or more symbols from a single file. Suffix matching: `TakeDamage`, or `Player.TakeDamage` when ambiguous. For markdown the symbol is a heading. Returns text by default; set `json: true` for `ast-bro.show.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:"File to search.",type:"string"},symbols:{description:"One or more symbol names to extract.",items:{type:"string"},minItems:1,type:"array"}},required:["path","symbols"],type:"object"}},squeeze:{description:"Compress repetitive log/text with a reversible legend (logs, not code).",inputSchema:{properties:{end:{description:"1-indexed inclusive end line of the slice.",minimum:1,type:"integer"},json:{description:"Return JSON (schema `ast-bro.squeeze.v1`) instead of text.",type:"boolean"},path:{description:"Path to the log/text file to read.",type:"string"},raw:{description:"Skip compression and emit the raw text.",type:"boolean"},start:{description:"1-indexed inclusive start line of the slice.",minimum:1,type:"integer"}},required:["path"],type:"object"}},surface:{description:"True public API surface \u2014 resolves `pub use` re-exports (Rust) and `__all__` (Python) to compute exactly what a downstream user sees, not just every `pub`/non-underscore item per file. Falls back to visibility-filtered output for Java/C#/Go/Kotlin (no real re-export concept). Returns text by default; set `json: true` for `ast-bro.surface.v1`.",inputSchema:{properties:{include_chain:{description:"Append the via-chain on each entry (text mode only).",type:"boolean"},include_private:{description:"Include private items \u2014 only meaningful for the fallback resolver.",type:"boolean"},json:{type:"boolean"},lang:{description:"Force a resolver: `rust`, `python`, or `fallback`.",type:"string"},max_depth:{description:"Recursion guard for re-export chains (default 16).",type:"integer"},path:{description:'Crate root file, package init, or directory to auto-detect (default ".").',type:"string"},tree:{description:"Render as a hierarchical tree grouped by module.",type:"boolean"}},type:"object"}},trace:{description:"Trace the static call path between two symbols \u2014 \"how does <from> reach <to>?\". Shortest-path BFS over the call graph with each hop's source body inlined, so a flow question (e.g. request\u2192handler, update\u2192render) is answered in ONE call instead of chaining `callers`/`callees`. If no static path exists the chain broke at dynamic dispatch \u2014 the response inlines both endpoints plus the target file's sibling callables. Targets are suffix-matched like `callers`. Returns text by default; set `json: true` for `ast-bro.trace.v1`.",inputSchema:{properties:{depth:{description:"Max path length in hops (default 12).",minimum:1,type:"integer"},from:{description:"Source symbol \u2014 where the path starts.",type:"string"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},to:{description:"Destination symbol \u2014 where the path should reach.",type:"string"}},required:["from","to"],type:"object"}}}});import{randomUUID as ZE}from"crypto";import{chmod as HE,rename as $E,unlink as UE,writeFile as AE}from"fs/promises";import mX from"path";async function t$(W,Q,X){let Y=mX.extname(W),G=mX.join(mX.dirname(W),`${mX.basename(W,Y)}.ast-mcp-restore-${ZE()}${Y}`);try{await AE(G,Q,{encoding:"utf8",flag:"wx",mode:X}),await HE(G,X),await $E(G,W)}finally{await UE(G).catch(()=>{return})}}var e$=()=>{};import{execFile as NE}from"child_process";function WU(W,Q,X){return new Promise((Y,G)=>{NE(W,Q,{encoding:"utf8",maxBuffer:16777216,timeout:30000},(F,L,z)=>{if(F)G(Error(`${W} failed: ${(z||L||F.message).trim()}`,{cause:F}));else Y({stderr:z,stdout:L})}).stdin?.end(X)})}var QU=()=>{};import{randomUUID as VE}from"crypto";import{chmod as wE,lstat as DE,readFile as XU,rename as ME,unlink as jE,writeFile as OE}from"fs/promises";import r9 from"path";async function KQ(W,Q){return(await WU(EE,["fmt","--config",RE,"--stdin",r9.basename(W)],Q)).stdout}async function YU(W){await KQ(W,await XU(W,"utf8"))}async function GU(W){let Q=await DE(W),X=await KQ(W,await XU(W,"utf8")),Y=r9.extname(W),G=r9.join(r9.dirname(W),`${r9.basename(W,Y)}.ast-mcp-format-${VE()}${Y}`);try{await OE(G,X,{encoding:"utf8",flag:"wx",mode:Q.mode}),await wE(G,Q.mode),await ME(G,W)}finally{await jE(G).catch(()=>{return})}}var EE,IE,RE;var VB=$0(async()=>{QU();({DPRINT_BINARY:EE,PACKAGE_ROOT:IE}=await Promise.resolve().then(() => (lX(),n$))),RE=process.env.AST_MCP_DPRINT_CONFIG??r9.join(IE,"dprint.json")});import{createHash as BU}from"crypto";import{createReadStream as TE}from"fs";function v1(W){return BU("sha256").update(W).digest("hex")}async function wB(W){let Q=BU("sha256");for await(let X of TE(W))Q.update(X);return Q.digest("hex")}var o9=()=>{};import{lstat as PE,open as SE,rm as bE}from"fs/promises";import cX from"path";async function qE(W){let Q=cX.dirname(W),X=Q;while(!0)try{if(!(await PE(X)).isDirectory())throw Error(`Lock parent is not a directory: ${X}`);break}catch(G){if(G.code!=="ENOENT")throw G;let B=cX.dirname(X);if(B===X)throw G;X=B}let Y=X===Q?`.${cX.basename(W)}.ast-mcp.lock`:`.${v1(W).slice(0,24)}.ast-mcp.lock`;return cX.join(X,Y)}async function CE(W){let Q=await qE(W);while(!0)try{return await(await SE(Q,"wx")).close(),()=>bE(Q,{force:!0})}catch(X){if(X.code!=="EEXIST")throw X;await new Promise((Y)=>setTimeout(Y,10))}}async function kE(W,Q){let X=pX.get(W)??Promise.resolve(),Y,G=new Promise((F)=>{Y=F}),B=X.then(()=>G);pX.set(W,B),await X;try{return await Q()}finally{if(Y(),pX.get(W)===B)pX.delete(W)}}async function dX(W,Q){return kE(W,async()=>{let X=await CE(W);try{return await Q()}finally{await X()}})}async function a9(W,Q){let X=[...new Set(W)].sort(),Y=async(G)=>G===X.length?Q():dX(X[G],()=>Y(G+1));return Y(0)}var pX;var ZQ=$0(()=>{o9();pX=new Map});import{lstat as vE,realpath as DB}from"fs/promises";import u6 from"path";function yE(){return(process.env.AST_MCP_ROOTS?.split(u6.delimiter).filter(Boolean)??[process.cwd()]).map((W)=>u6.resolve(W))}function MB(W,Q){let X=u6.relative(W,Q);return X===""||!X.startsWith("..")&&!u6.isAbsolute(X)}async function jB(){let W=await DB(process.cwd()).catch(()=>process.cwd()),Q=await Promise.all(yE().map(async(X)=>DB(X).catch(()=>X)));if(process.env.AST_MCP_ALLOW_EXTERNAL_ROOTS!=="1"&&Q.some((X)=>!MB(W,X)))throw Error("AST_MCP_ROOTS contains a root outside the server working directory; set AST_MCP_ALLOW_EXTERNAL_ROOTS=1 to opt in");return Q}async function FU(){return(await jB())[0]}async function LU(W){let Q=(await jB()).find((X)=>MB(X,W));if(!Q)throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);return Q}async function a1(W){let Q=await jB(),X=u6.isAbsolute(W)?W:u6.resolve(Q[0],W),Y=u6.dirname(X),G=[];while(!0)try{Y=await DB(Y);break}catch(F){if(F.code!=="ENOENT")throw F;let L=u6.dirname(Y);if(L===Y)throw F;G.unshift(u6.basename(Y)),Y=L}let B=u6.join(Y,...G,u6.basename(X));if(!Q.some((F)=>MB(F,B)))throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);if((await vE(B).catch(()=>{return}))?.isSymbolicLink())throw Error(`Symbolic-link targets are not writable: ${W}`);return B}var s9=()=>{};import{lstat as _E,readFile as gE}from"fs/promises";import zU from"path";function fE(W){return{"~standard":{jsonSchema:{input:()=>W,output:()=>({type:"object"})},validate(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)?{value:Q}:{issues:[{message:"Expected an object"}]}},vendor:"ast-mcp",version:1}}}async function t9(W,Q){return a1(zU.isAbsolute(Q)?Q:zU.resolve(W,Q))}async function hE(W,Q){for(let X of xE){let Y=W[X];if(typeof Y==="string")await t9(Q,Y)}if(!Array.isArray(W.paths))return;for(let X of W.paths)if(typeof X==="string")await t9(Q,X)}async function uE(W,Q){let X=Array.isArray(W.paths)?W.paths.filter((L)=>typeof L==="string"):[];for(let L of X.length?X:[Q])await t9(Q,L);if(W.write!==!0||typeof W.rewrite!=="string")return h6("run",W,Q);let Y={json:!0,paths:W.paths,pattern:W.pattern};for(let L of["glob","lang"])if(W[L]!==void 0)Y[L]=W[L];let G=await h6("run",Y,Q);if(e6(G).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let F=await Promise.all(NB(G).map((L)=>t9(Q,L)));return a9(F,async()=>{let L=await h6("run",Y,Q);if(e6(L).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let J=await Promise.all(NB(L).map((I)=>t9(Q,I)));if(F.length!==J.length||F.some((I,A)=>I!==J[A]))throw Error("ast-bro run targets changed while waiting for the write lock; preview again");let K=new Map;for(let I of J)await YU(I),K.set(I,{content:await gE(I,"utf8"),mode:(await _E(I)).mode});let H=await h6("run",{...W,json:!0},Q),D=await Promise.all(o$(H).map((I)=>t9(Q,I)));try{for(let I of D)await GU(I)}catch(I){for(let A of D){let M=K.get(A);if(M)await t$(A,M.content,M.mode)}throw I}return H})}function OB(W){for(let Q of r$){let X=s$[Q];W.registerTool(Q,{description:Q==="run"?"AST structural search and rewrite. Use for bounded inspection and previews; direct write is a lower-level escape hatch for exceptional cases. Normal agent edits belong in keyed file_patch, which supports ordered AST rules and Aider blocks.":X.description,inputSchema:fE(X.inputSchema),title:`ast-bro ${Q}`},async(Y)=>{try{let G=await FU();return await hE(Y,G),Q==="run"?await uE(Y,G):await h6(Q,Y,G)}catch(G){return{content:[{text:G instanceof Error?G.message:String(G),type:"text"}],isError:!0}}})}}var xE;var JU=$0(async()=>{JQ();a$();e$();ZQ();s9();await VB();xE=["file","path","root"]});import lE from"path";async function e9(W,Q){if(!Q)return!1;let X=Bun.spawn([n9,"map","--json",W],{cwd:lE.dirname(W),stderr:"pipe",stdout:"pipe"}),[Y,G,B]=await Promise.all([X.exited,new Response(X.stdout).text(),new Response(X.stderr).text()]),F=B.trim()||`ast-bro map exited ${Y}`;if(Y!==0)throw Error(F);return(JSON.parse(G).files??[]).find((J)=>J.path===W)?.error_count===0}var iX=$0(()=>{JQ()});async function EB(W,Q){if(Q==="markdown")return!1;return e9(W,Q)}var KU=$0(()=>{iX()});import{chmod as ZU,chown as HU,lstat as mE}from"fs/promises";function cE(W){if(!W)return;if(W.chmod!==void 0&&(!Number.isInteger(W.chmod)||W.chmod<0||W.chmod>511))throw Error("chmod must be an integer between 0 and 0o777");if(W.chown&&(!Number.isInteger(W.chown.uid)||W.chown.uid<0||!Number.isInteger(W.chown.gid)||W.chown.gid<0))throw Error("chown uid and gid must be non-negative integers");let Q=process.getuid?.(),X=process.getgid?.();if(W.chown&&(Q===void 0||X===void 0||W.chown.uid!==Q||W.chown.gid!==X))throw Error("chown may only preserve the server process owner");return W}async function rX(W,Q){let X=cE(Q),Y=await nX(W);if(!X)return Y;try{if(X.chown)await HU(W,X.chown.uid,X.chown.gid);if(X.chmod!==void 0)await ZU(W,X.chmod)}catch(G){throw await HU(W,Y.chown.uid,Y.chown.gid).catch(()=>{return}),await ZU(W,Y.chmod).catch(()=>{return}),G}return nX(W)}async function nX(W){let Q=await mE(W);return{chmod:Q.mode&511,chown:{gid:Q.gid,uid:Q.uid}}}var IB=()=>{};import pE from"path";function _4(W){return dE[pE.extname(W).toLowerCase()]}var dE;var oX=$0(()=>{dE={".cc":"cpp",".cjs":"javascript",".cpp":"cpp",".cs":"csharp",".cxx":"cpp",".ddl":"sql",".dml":"sql",".go":"go",".hh":"cpp",".hpp":"cpp",".java":"java",".js":"javascript",".jsx":"javascript",".kt":"kotlin",".kts":"kotlin",".markdown":"markdown",".md":"markdown",".mdown":"markdown",".mdx":"markdown",".mjs":"javascript",".php":"php",".py":"python",".pyi":"python",".rb":"ruby",".rs":"rust",".scala":"scala",".sql":"sql",".ts":"typescript",".tsx":"tsx"}});import{createReadStream as iE}from"fs";import{stat as $U}from"fs/promises";async function UU(W,Q){let X=Array(W.length),Y=0;return await Promise.all(Array.from({length:Math.min(4,W.length)},async()=>{while(Y<W.length){let G=Y;Y+=1,X[G]=await Q(W[G])}})),X}function rE(W){let[Q,X]=W.lines??nE,Y=W.maxBytes??WW;if(!Number.isInteger(Q)||Q<0)throw Error("file_read line start must be a non-negative integer");if(!Number.isInteger(X)||X<=Q)throw Error("file_read line end must be greater than line start");if(X-Q>aX)throw Error(`file_read line ranges are capped at ${aX} lines`);if(!Number.isInteger(Y)||Y<1||Y>WW)throw Error(`file_read maxBytes must be between 1 and ${WW}`);return{lines:[Q,X],maxBytes:Y}}async function oE(W,Q,X,Y){let[G,B]=X,F=[],L=0,z=0,J=!1,K=!1,H=iE(W);try{W:for await(let A of H){let M=Buffer.isBuffer(A)?A:Buffer.from(A),N=0;while(N<M.length){let Z=M.indexOf(10,N),V=Z<0?M.length:Z+1;if(z>=G&&z<B){let U=Y-L,j=V-N;if(j>U){if(U>0)F.push(M.subarray(N,N+U)),L+=U;K=!0,J=!0;break W}if(j>0)F.push(M.subarray(N,V)),L+=j}if(N=V,Z>=0){if(z+=1,z>=B){J=N<M.length;break W}}else break}}}finally{H.destroy()}let D=Buffer.concat(F,L),I=0;for(let A of D)if(A===10)I+=1;if(D.length>0&&D.at(-1)!==10)I+=1;return{content:D.toString("utf8"),hasMore:K||J||H.bytesRead<Q,lines:{requested:X,returned:[G,G+I]},truncated:K}}async function aE(W){let Q=await a1(W),X=await $U(Q);if(!X.isFile())throw Error(`Not a regular file: ${W}`);return{filePath:Q,sha256:await wB(Q),size:X.size}}async function AU(W){if(W.length<1||W.length>L1)throw Error(`file_hash requires between 1 and ${L1} paths`);return UU(W,aE)}async function sE(W){let Q=await a1(W.filePath),X=_4(Q);if(await e9(Q,X))throw Error("REJECTED: AST-capable files must use map, show, search, context, or run; use file_hash when only SHA-256 is required");let Y=await $U(Q);if(!Y.isFile())throw Error(`Not a regular file: ${W.filePath}`);let{lines:G,maxBytes:B}=rE(W),[F,L]=await Promise.all([oE(Q,Y.size,G,B),wB(Q)]);return{...F,filePath:Q,sha256:L,size:Y.size}}async function NU(W){if(W.length<1||W.length>L1)throw Error(`file_read requires between 1 and ${L1} files`);return UU(W,sE)}var nE,L1=50,WW=1048576,aX=1000;var sX=$0(()=>{iX();oX();o9();s9();nE=[0,100]});class QW{start1;start2;diffs=[];length1=0;length2=0;constructor(W,Q){this.start1=W,this.start2=Q}clone(){let W=new QW(this.start1,this.start2);return W.diffs=this.diffs.map((Q)=>[...Q]),W.length1=this.length1,W.length2=this.length2,W}toString(){let W=VU(this.start1,this.length1),Q=VU(this.start2,this.length2),X=[`@@ -${W} +${Q} @@
113
- `];for(let Y of this.diffs){let G=tE[Y[0]];X.push(G+encodeURI(Y[1])+`
114
- `)}return X.join("").replace(/%20/g," ")}}class RB{Diff_Timeout=1;Diff_EditCost=4;Match_Threshold=0.5;Match_Distance=1000;Patch_DeleteThreshold=0.5;Patch_Margin=4;Match_MaxBits=32;whitespaceRegex=/\s/;linebreakRegex=/\r\n/;blanklineEndRegex=/\n\r?\n$/;blanklineStartRegex=/^\r?\n\r?\n/;diff_main(W,Q,X,Y){if(typeof Y>"u")if(this.Diff_Timeout<=0)Y=Number.MAX_VALUE;else Y=new Date().getTime()+this.Diff_Timeout*1000;let G=Y;if(W==null||Q==null)throw Error("Null input. (diff_main)");if(W===Q){if(W)return[[B0.Equal,W]];return[]}if(typeof X>"u")X=!0;let B=X,F=this.diff_commonPrefix(W,Q),L=W.substring(0,F);W=W.substring(F),Q=Q.substring(F),F=this.diff_commonSuffix(W,Q);let z=W.substring(W.length-F);W=W.substring(0,W.length-F),Q=Q.substring(0,Q.length-F);let J=this.diff_compute_(W,Q,B,G);if(L)J.unshift([B0.Equal,L]);if(z)J.push([B0.Equal,z]);return this.diff_cleanupMerge(J),J}diff_cleanupSemantic(W){let Q=!1,X=[],Y=0,G=null,B=0,F=0,L=0,z=0,J=0;while(B<W.length){if(W[B][0]===B0.Equal)X[Y++]=B,F=z,L=J,z=0,J=0,G=W[B][1];else{if(W[B][0]===B0.Insert)z+=W[B][1].length;else J+=W[B][1].length;if(G&&G.length<=Math.max(F,L)&&G.length<=Math.max(z,J))W.splice(X[Y-1],0,[B0.Delete,G]),W[X[Y-1]+1][0]=B0.Insert,Y--,Y--,B=Y>0?X[Y-1]:-1,F=0,L=0,z=0,J=0,G=null,Q=!0}B++}if(Q)this.diff_cleanupMerge(W);this.diff_cleanupSemanticLossless(W),B=1;while(B<W.length){if(W[B-1][0]===B0.Delete&&W[B][0]===B0.Insert){let K=W[B-1][1],H=W[B][1],D=this.diff_commonOverlap_(K,H),I=this.diff_commonOverlap_(H,K);if(D>=I){if(D>=K.length/2||D>=H.length/2)W.splice(B,0,[B0.Equal,H.substring(0,D)]),W[B-1][1]=K.substring(0,K.length-D),W[B+1][1]=H.substring(D),B++}else if(I>=K.length/2||I>=H.length/2)W.splice(B,0,[B0.Equal,K.substring(0,I)]),W[B-1][0]=B0.Insert,W[B-1][1]=H.substring(0,H.length-I),W[B+1][0]=B0.Delete,W[B+1][1]=K.substring(I),B++;B++}B++}}diff_cleanupEfficiency(W){let Q=!1,X=[],Y=0,G=null,B=0,F=!1,L=!1,z=!1,J=!1;while(B<W.length){if(W[B][0]===B0.Equal){if(W[B][1].length<this.Diff_EditCost&&(z||J))X[Y++]=B,F=z,L=J,G=W[B][1];else Y=0,G=null;z=J=!1}else{if(W[B][0]===B0.Delete)J=!0;else z=!0;if(G&&(F&&L&&z&&J||G.length<this.Diff_EditCost/2&&(F?1:0)+(L?1:0)+(z?1:0)+(J?1:0)===3)){if(W.splice(X[Y-1],0,[B0.Delete,G]),W[X[Y-1]+1][0]=B0.Insert,Y--,G=null,F&&L)z=J=!0,Y=0;else Y--,B=Y>0?X[Y-1]:-1,z=J=!1;Q=!0}}B++}if(Q)this.diff_cleanupMerge(W)}diff_prettyHtml(W){let Q=[],X=/&/g,Y=/</g,G=/>/g,B=/\n/g;for(let F=0;F<W.length;F++){let L=W[F][0],J=W[F][1].replace(X,"&amp;").replace(Y,"&lt;").replace(G,"&gt;").replace(B,"&para;<br>");switch(L){case B0.Insert:Q[F]='<ins style="background:#e6ffe6;">'+J+"</ins>";break;case B0.Delete:Q[F]='<del style="background:#ffe6e6;">'+J+"</del>";break;case B0.Equal:Q[F]="<span>"+J+"</span>";break}}return Q.join("")}diff_levenshtein(W){let Q=0,X=0,Y=0;for(let G of W){let B=G[0],F=G[1];switch(B){case B0.Insert:X+=F.length;break;case B0.Delete:Y+=F.length;break;case B0.Equal:Q+=Math.max(X,Y),X=0,Y=0;break}}return Q+=Math.max(X,Y),Q}patch_make(W,Q,X){let Y,G;if(typeof W==="string"&&typeof Q==="string"&&typeof X>"u"){if(Y=W,G=this.diff_main(Y,Q,!0),G.length>2)this.diff_cleanupSemantic(G),this.diff_cleanupEfficiency(G)}else if(W&&typeof W==="object"&&typeof Q>"u"&&typeof X>"u")G=W,Y=this.diff_text1(G);else if(typeof W==="string"&&Q&&typeof Q==="object"&&typeof X>"u")Y=W,G=Q;else if(typeof W==="string"&&typeof Q==="string"&&X&&typeof X==="object")Y=W,G=X;else throw Error("Unknown call format to patch_make.");if(G.length===0)return[];let B=[],F=new QW(0,0),L=0,z=0,J=0,K=Y,H=Y;for(let D=0;D<G.length;D++){let I=G[D][0],A=G[D][1];if(!L&&I!==B0.Equal)F.start1=z,F.start2=J;switch(I){case B0.Insert:F.diffs[L++]=G[D],F.length2+=A.length,H=H.substring(0,J)+A+H.substring(J);break;case B0.Delete:F.length1+=A.length,F.diffs[L++]=G[D],H=H.substring(0,J)+H.substring(J+A.length);break;case B0.Equal:if(A.length<=2*this.Patch_Margin&&L&&G.length!==D+1)F.diffs[L++]=G[D],F.length1+=A.length,F.length2+=A.length;else if(A.length>=2*this.Patch_Margin){if(L)this.patch_addContext_(F,K),B.push(F),F=new QW(0,0),L=0,K=H,z=J}break}if(I!==B0.Insert)z+=A.length;if(I!==B0.Delete)J+=A.length}if(L)this.patch_addContext_(F,K),B.push(F);return B}patch_apply(W,Q){if(W.length===0)return[Q,[]];W=this.patch_deepCopy(W);let X=this.patch_addPadding(W);Q=X+Q+X,this.patch_splitMax(W);let Y=0,G=[];for(let B=0;B<W.length;B++){let F=W[B].start2+Y,L=this.diff_text1(W[B].diffs),z,J=-1;if(L.length>this.Match_MaxBits){if(z=this.match_main(Q,L.substring(0,this.Match_MaxBits),F),z!==-1){if(J=this.match_main(Q,L.substring(L.length-this.Match_MaxBits),F+L.length-this.Match_MaxBits),J===-1||z>=J)z=-1}}else z=this.match_main(Q,L,F);if(z===-1)G[B]=!1,Y-=W[B].length2-W[B].length1;else{G[B]=!0,Y=z-F;let K;if(J===-1)K=Q.substring(z,z+L.length);else K=Q.substring(z,J+this.Match_MaxBits);if(L===K)Q=Q.substring(0,z)+this.diff_text2(W[B].diffs)+Q.substring(z+L.length);else{let H=this.diff_main(L,K,!1);if(L.length>this.Match_MaxBits&&this.diff_levenshtein(H)/L.length>this.Patch_DeleteThreshold)G[B]=!1;else{this.diff_cleanupSemanticLossless(H);let D=0,I;for(let A of W[B].diffs){if(A[0]!==B0.Equal){if(I=this.diff_xIndex(H,D),A[0]===B0.Insert)Q=Q.substring(0,z+I)+A[1]+Q.substring(z+I);else if(A[0]===B0.Delete)Q=Q.substring(0,z+I)+Q.substring(z+this.diff_xIndex(H,D+A[1].length))}if(A[0]!==B0.Delete)D+=A[1].length}}}}}return Q=Q.substring(X.length,Q.length-X.length),[Q,G]}patch_toText(W){let Q=[];for(let X=0;X<W.length;X++)Q[X]=W[X];return Q.join("")}patch_fromText(W){let Q=[];if(!W)return Q;let X=W.split(`
115
- `),Y=0,G=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;while(Y<X.length){let B=X[Y].match(G);if(!B)throw Error("Invalid patch string: "+X[Y]);let F=new QW(parseInt(B[1],10),parseInt(B[3],10));if(Q.push(F),B[2]==="")F.start1--,F.length1=1;else if(B[2]==="0")F.length1=0;else F.start1--,F.length1=parseInt(B[2],10);if(B[4]==="")F.start2--,F.length2=1;else if(B[4]==="0")F.length2=0;else F.start2--,F.length2=parseInt(B[4],10);Y++;while(Y<X.length){let L=X[Y].charAt(0),z;try{z=decodeURI(X[Y].substring(1))}catch(J){throw Error("Illegal escape in patch_fromText: "+z,{cause:J})}if(L==="-")F.diffs.push([B0.Delete,z]);else if(L==="+")F.diffs.push([B0.Insert,z]);else if(L===" ")F.diffs.push([B0.Equal,z]);else if(L==="@")break;else if(L==="");else throw Error('Invalid patch mode "'+L+'" in: '+z);Y++}}return Q}diff_commonPrefix(W,Q){if(!W||!Q||W.charAt(0)!==Q.charAt(0))return 0;let X=0,Y=Math.min(W.length,Q.length),G=Y,B=0;while(X<G){if(W.substring(B,G)===Q.substring(B,G))X=G,B=X;else Y=G;G=Math.floor((Y-X)/2+X)}return G}diff_commonSuffix(W,Q){if(!W||!Q||W.charAt(W.length-1)!==Q.charAt(Q.length-1))return 0;let X=0,Y=Math.min(W.length,Q.length),G=Y,B=0;while(X<G){if(W.substring(W.length-G,W.length-B)===Q.substring(Q.length-G,Q.length-B))X=G,B=X;else Y=G;G=Math.floor((Y-X)/2+X)}return G}diff_cleanupMerge(W){W.push([B0.Equal,""]);let Q=0,X=0,Y=0,G="",B="",F;while(Q<W.length)switch(W[Q][0]){case B0.Insert:Y++,B+=W[Q][1],Q++;break;case B0.Delete:X++,G+=W[Q][1],Q++;break;case B0.Equal:if(X+Y>1){if(X!==0&&Y!==0){if(F=this.diff_commonPrefix(B,G),F!==0){if(Q-X-Y>0&&W[Q-X-Y-1][0]===B0.Equal)W[Q-X-Y-1][1]+=B.substring(0,F);else W.splice(0,0,[B0.Equal,B.substring(0,F)]),Q++;B=B.substring(F),G=G.substring(F)}if(F=this.diff_commonSuffix(B,G),F!==0)W[Q][1]=B.substring(B.length-F)+W[Q][1],B=B.substring(0,B.length-F),G=G.substring(0,G.length-F)}if(X===0)W.splice(Q-Y,X+Y,[B0.Insert,B]);else if(Y===0)W.splice(Q-X,X+Y,[B0.Delete,G]);else W.splice(Q-X-Y,X+Y,[B0.Delete,G],[B0.Insert,B]);Q=Q-X-Y+(X?1:0)+(Y?1:0)+1}else if(Q!==0&&W[Q-1][0]===B0.Equal)W[Q-1][1]+=W[Q][1],W.splice(Q,1);else Q++;Y=0,X=0,G="",B="";break}if(W[W.length-1][1]==="")W.pop();let L=!1;Q=1;while(Q<W.length-1){if(W[Q-1][0]===B0.Equal&&W[Q+1][0]===B0.Equal){if(W[Q][1].substring(W[Q][1].length-W[Q-1][1].length)===W[Q-1][1])W[Q][1]=W[Q-1][1]+W[Q][1].substring(0,W[Q][1].length-W[Q-1][1].length),W[Q+1][1]=W[Q-1][1]+W[Q+1][1],W.splice(Q-1,1),L=!0;else if(W[Q][1].substring(0,W[Q+1][1].length)===W[Q+1][1])W[Q-1][1]+=W[Q+1][1],W[Q][1]=W[Q][1].substring(W[Q+1][1].length)+W[Q+1][1],W.splice(Q+1,1),L=!0}Q++}if(L)this.diff_cleanupMerge(W)}diff_text1(W){let Q=[];for(let X=0;X<W.length;X++)if(W[X][0]!==B0.Insert)Q[X]=W[X][1];return Q.join("")}diff_text2(W){let Q=[];for(let X=0;X<W.length;X++)if(W[X][0]!==B0.Delete)Q[X]=W[X][1];return Q.join("")}diff_lineMode(W,Q){let X=this.diff_linesToChars_(W,Q),Y=this.diff_main(X.chars1,X.chars2,!1);return this.diff_charsToLines_(Y,X.lineArray),Y}diff_compute_(W,Q,X,Y){let G;if(!W)return[[B0.Insert,Q]];if(!Q)return[[B0.Delete,W]];let B=W.length>Q.length?W:Q,F=W.length>Q.length?Q:W,L=B.indexOf(F);if(L!==-1){if(G=[[B0.Insert,B.substring(0,L)],[B0.Equal,F],[B0.Insert,B.substring(L+F.length)]],W.length>Q.length)G[0][0]=G[2][0]=B0.Delete;return G}if(F.length===1)return[[B0.Delete,W],[B0.Insert,Q]];let z=this.diff_halfMatch_(W,Q);if(z){let J=z[0],K=z[1],H=z[2],D=z[3],I=z[4],A=this.diff_main(J,H,X,Y),M=this.diff_main(K,D,X,Y);return A.concat([[B0.Equal,I]],M)}if(X&&W.length>100&&Q.length>100)return this.diff_lineMode_(W,Q,Y);return this.diff_bisect_(W,Q,Y)}diff_lineMode_(W,Q,X){let Y=this.diff_linesToChars_(W,Q);W=Y.chars1,Q=Y.chars2;let G=Y.lineArray,B=this.diff_main(W,Q,!1,X);this.diff_charsToLines_(B,G),this.diff_cleanupSemantic(B),B.push([B0.Equal,""]);let F=0,L=0,z=0,J="",K="";while(F<B.length){switch(B[F][0]){case B0.Insert:z++,K+=B[F][1];break;case B0.Delete:L++,J+=B[F][1];break;case B0.Equal:if(L>=1&&z>=1){B.splice(F-L-z,L+z),F=F-L-z;let H=this.diff_main(J,K,!1,X);for(let D=H.length-1;D>=0;D--)B.splice(F,0,H[D]);F=F+H.length}z=0,L=0,J="",K="";break}F++}return B.pop(),B}diff_bisect_(W,Q,X){let Y=W.length,G=Q.length,B=Math.ceil((Y+G)/2),F=B,L=2*B,z=Array(L),J=Array(L);for(let N=0;N<L;N++)z[N]=-1,J[N]=-1;z[F+1]=0,J[F+1]=0;let K=Y-G,H=K%2!==0,D=0,I=0,A=0,M=0;for(let N=0;N<B;N++){if(new Date().getTime()>X)break;for(let Z=-N+D;Z<=N-I;Z+=2){let V=F+Z,U;if(Z===-N||Z!==N&&z[V-1]<z[V+1])U=z[V+1];else U=z[V-1]+1;let j=U-Z;while(U<Y&&j<G&&W.charAt(U)===Q.charAt(j))U++,j++;if(z[V]=U,U>Y)I+=2;else if(j>G)D+=2;else if(H){let R=F+K-Z;if(R>=0&&R<L&&J[R]!==-1){let O=Y-J[R];if(U>=O)return this.diff_bisectSplit_(W,Q,U,j,X)}}}for(let Z=-N+A;Z<=N-M;Z+=2){let V=F+Z,U;if(Z===-N||Z!==N&&J[V-1]<J[V+1])U=J[V+1];else U=J[V-1]+1;let j=U-Z;while(U<Y&&j<G&&W.charAt(Y-U-1)===Q.charAt(G-j-1))U++,j++;if(J[V]=U,U>Y)M+=2;else if(j>G)A+=2;else if(!H){let R=F+K-Z;if(R>=0&&R<L&&z[R]!==-1){let O=z[R],w=F+O-R;if(U=Y-U,O>=U)return this.diff_bisectSplit_(W,Q,O,w,X)}}}}return[[B0.Delete,W],[B0.Insert,Q]]}diff_bisectSplit_(W,Q,X,Y,G){let B=W.substring(0,X),F=Q.substring(0,Y),L=W.substring(X),z=Q.substring(Y),J=this.diff_main(B,F,!1,G),K=this.diff_main(L,z,!1,G);return J.concat(K)}diff_linesToChars_(W,Q){let X=[],Y={};X[0]="";let G=this.diff_linesToCharsMunge_(W,X,Y),B=this.diff_linesToCharsMunge_(Q,X,Y);return{chars1:G,chars2:B,lineArray:X}}diff_linesToCharsMunge_(W,Q,X){let Y="",G=0,B=-1,F=Q.length;while(B<W.length-1){if(B=W.indexOf(`
116
- `,G),B===-1)B=W.length-1;let L=W.substring(G,B+1);if(G=B+1,Object.hasOwn(X,L)||X[L]!==void 0)Y+=String.fromCharCode(X[L]);else Y+=String.fromCharCode(F),X[L]=F,Q[F++]=L}return Y}diff_charsToLines_(W,Q){for(let X of W){let Y=X[1],G=[];for(let B=0;B<Y.length;B++)G[B]=Q[Y.charCodeAt(B)];X[1]=G.join("")}}diff_commonOverlap_(W,Q){let X=W.length,Y=Q.length;if(X===0||Y===0)return 0;if(X>Y)W=W.substring(X-Y);else if(X<Y)Q=Q.substring(0,X);let G=Math.min(X,Y);if(W===Q)return G;let B=0,F=1;for(;;){let L=W.substring(G-F),z=Q.indexOf(L);if(z===-1)return B;if(F+=z,z===0||W.substring(G-F)===Q.substring(0,F))B=F,F++}}diff_halfMatch_(W,Q){if(this.Diff_Timeout<=0)return null;let X=W.length>Q.length?W:Q,Y=W.length>Q.length?Q:W;if(X.length<4||Y.length*2<X.length)return null;let G=this.diff_halfMatchI_(X,Y,Math.ceil(X.length/4),this),B=this.diff_halfMatchI_(X,Y,Math.ceil(X.length/2),this),F;if(G===null&&B===null)return null;else if(G!==null&&B!==null)F=G[4].length>B[4].length?G:B;else if(G!==null)F=G;else if(B!==null)F=B;if(F===void 0)throw Error("hm expected to be defined but was undefined");let L,z,J,K;if(W.length>Q.length)L=F[0],z=F[1],J=F[2],K=F[3];else J=F[0],K=F[1],L=F[2],z=F[3];let H=F[4];return[L,z,J,K,H]}diff_halfMatchI_(W,Q,X,Y){let G=W.substring(X,X+Math.floor(W.length/4)),B=-1,F="",L="",z="",J="",K="";while((B=Q.indexOf(G,B+1))!==-1){let H=Y.diff_commonPrefix(W.substring(X),Q.substring(B)),D=Y.diff_commonSuffix(W.substring(0,X),Q.substring(0,B));if(F.length<D+H)F=Q.substring(B-D,B)+Q.substring(B,B+H),L=W.substring(0,X-D),z=W.substring(X+H),J=Q.substring(0,B-D),K=Q.substring(B+H)}if(F.length*2>=W.length)return[L,z,J,K,F];return null}diff_cleanupSemanticLossless(W){let Q=(Y,G)=>{if(!Y||!G)return 6;let B=/[^a-zA-Z0-9]/,F=Y.charAt(Y.length-1),L=G.charAt(0),z=F.match(B),J=L.match(B),K=z&&F.match(this.whitespaceRegex),H=J&&L.match(this.whitespaceRegex),D=K&&F.match(this.linebreakRegex),I=H&&L.match(this.linebreakRegex),A=D&&Y.match(this.blanklineEndRegex),M=I&&G.match(this.blanklineStartRegex);if(A||M)return 5;else if(D||I)return 4;else if(z&&!K&&H)return 3;else if(K||H)return 2;else if(z||J)return 1;return 0},X=1;while(X<W.length-1){if(W[X-1][0]===B0.Equal&&W[X+1][0]===B0.Equal){let Y=W[X-1][1],G=W[X][1],B=W[X+1][1],F=this.diff_commonSuffix(Y,G);if(F){let H=G.substring(G.length-F);Y=Y.substring(0,Y.length-F),G=H+G.substring(0,G.length-F),B=H+B}let L=Y,z=G,J=B,K=Q(Y,G)+Q(G,B);while(G.charAt(0)===B.charAt(0)){Y+=G.charAt(0),G=G.substring(1)+B.charAt(0),B=B.substring(1);let H=Q(Y,G)+Q(G,B);if(H>=K)K=H,L=Y,z=G,J=B}if(W[X-1][1]!==L){if(L)W[X-1][1]=L;else W.splice(X-1,1),X--;if(W[X][1]=z,J)W[X+1][1]=J;else W.splice(X+1,1),X--}}X++}}diff_xIndex(W,Q){let X=0,Y=0,G=0,B=0,F;for(F=0;F<W.length;F++){if(W[F][0]!==B0.Insert)X+=W[F][1].length;if(W[F][0]!==B0.Delete)Y+=W[F][1].length;if(X>Q)break;G=X,B=Y}if(W.length!==F&&W[F][0]===B0.Delete)return B;return B+(Q-G)}diff_toDelta(W){let Q=[];for(let X=0;X<W.length;X++)switch(W[X][0]){case B0.Insert:Q[X]="+"+encodeURI(W[X][1]);break;case B0.Delete:Q[X]="-"+W[X][1].length;break;case B0.Equal:Q[X]="="+W[X][1].length;break}return Q.join("\t").replace(/%20/g," ")}diff_fromDelta(W,Q){let X=[],Y=0,G=0,B=Q.split(/\t/g);for(let F of B){let L=F.substring(1);switch(F.charAt(0)){case"+":{try{X[Y++]=[B0.Insert,decodeURI(L)]}catch(z){throw Error("Illegal escape in diff_fromDelta: "+L,{cause:z})}break}case"-":case"=":{let z=parseInt(L,10);if(isNaN(z)||z<0)throw Error("Invalid number in diff_fromDelta: "+L);let J=W.substring(G,G+=z);if(F.charAt(0)==="=")X[Y++]=[B0.Equal,J];else X[Y++]=[B0.Delete,J];break}default:if(F)throw Error(`Invalid diff operation in diff_fromDelta: ${F}`)}}if(G!==W.length)throw Error("Delta length ("+G+") does not equal source text length ("+W.length+").");return X}match_main(W,Q,X){if(W==null||Q==null||X==null)throw Error("Null input. (match_main)");if(X=Math.max(0,Math.min(X,W.length)),W===Q)return 0;else if(!W.length)return-1;else if(W.substring(X,X+Q.length)===Q)return X;else return this.match_bitap_(W,Q,X)}match_bitap_(W,Q,X){if(Q.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");let Y=this.match_alphabet_(Q),G=(D,I)=>{let A=D/Q.length,M=Math.abs(X-I);if(!this.Match_Distance)return M?1:A;return A+M/this.Match_Distance},B=this.Match_Threshold,F=W.indexOf(Q,X);if(F!==-1){if(B=Math.min(G(0,F),B),F=W.lastIndexOf(Q,X+Q.length),F!==-1)B=Math.min(G(0,F),B)}let L=1<<Q.length-1;F=-1;let z,J,K=Q.length+W.length,H;for(let D=0;D<Q.length;D++){z=0,J=K;while(z<J){if(G(D,X+J)<=B)z=J;else K=J;J=Math.floor((K-z)/2+z)}K=J;let I=Math.max(1,X-J+1),A=Math.min(X+J,W.length)+Q.length,M=Array(A+2);M[A+1]=(1<<D)-1;for(let N=A;N>=I;N--){let Z=Y[W.charAt(N-1)];if(D===0)M[N]=(M[N+1]<<1|1)&Z;else{if(H===void 0)throw Error("last_rd should have been set by the previous loop but is undefined");M[N]=(M[N+1]<<1|1)&Z|((H[N+1]|H[N])<<1|1)|H[N+1]}if(M[N]&L){let V=G(D,N-1);if(V<=B)if(B=V,F=N-1,F>X)I=Math.max(1,2*X-F);else break}}if(G(D+1,X)>B)break;H=M}return F}match_alphabet_(W){let Q={};for(let X=0;X<W.length;X++)Q[W.charAt(X)]=0;for(let X=0;X<W.length;X++)Q[W.charAt(X)]|=1<<W.length-X-1;return Q}patch_addContext_(W,Q){if(Q.length===0)return;let X=Q.substring(W.start2,W.start2+W.length1),Y=0;while(Q.indexOf(X)!==Q.lastIndexOf(X)&&X.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin)Y+=this.Patch_Margin,X=Q.substring(W.start2-Y,W.start2+W.length1+Y);Y+=this.Patch_Margin;let G=Q.substring(W.start2-Y,W.start2);if(G)W.diffs.unshift([B0.Equal,G]);let B=Q.substring(W.start2+W.length1,W.start2+W.length1+Y);if(B)W.diffs.push([B0.Equal,B]);W.start1-=G.length,W.start2-=G.length,W.length1+=G.length+B.length,W.length2+=G.length+B.length}patch_deepCopy(W){return W.map((Q)=>Q.clone())}patch_addPadding(W){let Q=this.Patch_Margin,X="";for(let B=1;B<=Q;B++)X+=String.fromCharCode(B);for(let B of W)B.start1+=Q,B.start2+=Q;let Y=W[0],G=Y.diffs;if(G.length===0||G[0][0]!==B0.Equal)G.unshift([B0.Equal,X]),Y.start1-=Q,Y.start2-=Q,Y.length1+=Q,Y.length2+=Q;else if(Q>G[0][1].length){let B=Q-G[0][1].length;G[0][1]=X.substring(G[0][1].length)+G[0][1],Y.start1-=B,Y.start2-=B,Y.length1+=B,Y.length2+=B}if(Y=W[W.length-1],G=Y.diffs,G.length===0||G[G.length-1][0]!==B0.Equal)G.push([B0.Equal,X]),Y.length1+=Q,Y.length2+=Q;else if(Q>G[G.length-1][1].length){let B=Q-G[G.length-1][1].length;G[G.length-1][1]+=X.substring(0,B),Y.length1+=B,Y.length2+=B}return X}patch_splitMax(W){let Q=this.Match_MaxBits;for(let X=0;X<W.length;X++){if(W[X].length1<=Q)continue;let Y=W[X];W.splice(X--,1);let{start1:G,start2:B}=Y,F="";while(Y.diffs.length!==0){let L=new QW(G-F.length,B-F.length),z=!0;if(F!=="")L.length1=L.length2=F.length,L.diffs.push([B0.Equal,F]);while(Y.diffs.length!==0&&L.length1<Q-this.Patch_Margin){let K=Y.diffs[0][0],H=Y.diffs[0][1];if(K===B0.Insert)L.length2+=H.length,B+=H.length,L.diffs.push(Y.diffs.shift()),z=!1;else if(K===B0.Delete&&L.diffs.length===1&&L.diffs[0][0]===B0.Equal&&H.length>2*Q)L.length1+=H.length,G+=H.length,z=!1,L.diffs.push([K,H]),Y.diffs.shift();else{if(H=H.substring(0,Q-L.length1-this.Patch_Margin),L.length1+=H.length,G+=H.length,K===B0.Equal)L.length2+=H.length,B+=H.length;else z=!1;if(L.diffs.push([K,H]),H===Y.diffs[0][1])Y.diffs.shift();else Y.diffs[0][1]=Y.diffs[0][1].substring(H.length)}}F=this.diff_text2(L.diffs),F=F.substring(F.length-this.Patch_Margin);let J=this.diff_text1(Y.diffs).substring(0,this.Patch_Margin);if(J!=="")if(L.length1+=J.length,L.length2+=J.length,L.diffs.length!==0&&L.diffs[L.diffs.length-1][0]===B0.Equal)L.diffs[L.diffs.length-1][1]+=J;else L.diffs.push([B0.Equal,J]);if(!z)W.splice(++X,0,L)}}}}var B0,tE,VU=(W,Q)=>{if(Q===0)return W+",0";else if(Q===1)return`${W+1}`;return`${W+1},${Q}`};var wU=$0(()=>{(function(W){W[W.Delete=-1]="Delete",W[W.Equal=0]="Equal",W[W.Insert=1]="Insert"})(B0||(B0={}));tE={[B0.Insert]:"+",[B0.Delete]:"-",[B0.Equal]:" "}});function eE(W,Q,X,Y){let G=W.slice(0,Q).join(`
117
- `),B=W.slice(Q+X).join(`
223
+ deps: ${K}}`};let G={keyword:"dependencies",type:"object",schemaType:"object",error:W.error,code(z){let[J,K]=B(z);F(z,J),L(z,K)}};function B({schema:z}){let J={},K={};for(let Z in z){if(Z==="__proto__")continue;let D=Array.isArray(z[Z])?J:K;D[Z]=z[Z]}return[J,K]}function F(z,J=z.schema){let{gen:K,data:Z,it:D}=z;if(Object.keys(J).length===0)return;let I=K.let("missing");for(let A in J){let M=J[A];if(M.length===0)continue;let N=(0,Y.propertyInData)(K,Z,A,D.opts.ownProperties);if(z.setParams({property:A,depsCount:M.length,deps:M.join(", ")}),D.allErrors)K.if(N,()=>{for(let $ of M)(0,Y.checkReportMissingProp)(z,$)});else K.if(X._`${N} && (${(0,Y.checkMissingProp)(z,M,I)})`),(0,Y.reportMissingProp)(z,I),K.else()}}W.validatePropertyDeps=F;function L(z,J=z.schema){let{gen:K,data:Z,keyword:D,it:I}=z,A=K.name("valid");for(let M in J){if((0,Q.alwaysValidSchema)(I,J[M]))continue;K.if((0,Y.propertyInData)(K,Z,M,I.opts.ownProperties),()=>{let N=z.subschema({keyword:D,schemaProp:M},A);z.mergeValidEvaluated(N,A)},()=>K.var(A,!0)),z.ok(A)}}W.validateSchemaDeps=L,W.default=G}),kO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:G})=>X._`{propertyName: ${G.propertyName}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G;if((0,Q.alwaysValidSchema)(z,F))return;let J=B.name("valid");B.forIn("key",L,(K)=>{G.setParams({propertyName:K}),G.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},J),B.if((0,X.not)(J),()=>{if(G.error(!0),!z.allErrors)B.break()})}),G.ok(J)}};W.default=Y}),r$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=h6(),Q=R0(),Y=x6(),G=y0(),B={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:F})=>Q._`{additionalProperty: ${F.additionalProperty}}`},code(F){let{gen:L,schema:z,parentSchema:J,data:K,errsCount:Z,it:D}=F;if(!Z)throw Error("ajv implementation error");let{allErrors:I,opts:A}=D;if(D.props=!0,A.removeAdditional!=="all"&&(0,G.alwaysValidSchema)(D,z))return;let M=(0,X.allSchemaProperties)(J.properties),N=(0,X.allSchemaProperties)(J.patternProperties);$(),F.ok(Q._`${Z} === ${Y.default.errors}`);function $(){L.forIn("key",K,(j)=>{if(!M.length&&!N.length)O(j);else L.if(V(j),()=>O(j))})}function V(j){let w;if(M.length>8){let T=(0,G.schemaRefOrVal)(D,J.properties,"properties");w=(0,X.isOwnProperty)(L,T,j)}else if(M.length)w=(0,Q.or)(...M.map((T)=>Q._`${j} === ${T}`));else w=Q.nil;if(N.length)w=(0,Q.or)(w,...N.map((T)=>Q._`${(0,X.usePattern)(F,T)}.test(${j})`));return(0,Q.not)(w)}function U(j){L.code(Q._`delete ${K}[${j}]`)}function O(j){if(A.removeAdditional==="all"||A.removeAdditional&&z===!1){U(j);return}if(z===!1){if(F.setParams({additionalProperty:j}),F.error(),!I)L.break();return}if(typeof z=="object"&&!(0,G.alwaysValidSchema)(D,z)){let w=L.name("valid");if(A.removeAdditional==="failing")R(j,w,!1),L.if((0,Q.not)(w),()=>{F.reset(),U(j)});else if(R(j,w),!I)L.if((0,Q.not)(w),()=>L.break())}}function R(j,w,T){let k={keyword:"additionalProperties",dataProp:j,dataPropType:G.Type.Str};if(T===!1)Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1});F.subschema(k,w)}}};W.default=B}),vO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=$X(),Q=h6(),Y=y0(),G=r$(),B={keyword:"properties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,parentSchema:J,data:K,it:Z}=F;if(Z.opts.removeAdditional==="all"&&J.additionalProperties===void 0)G.default.code(new X.KeywordCxt(Z,G.default,"additionalProperties"));let D=(0,Q.allSchemaProperties)(z);for(let $ of D)Z.definedProperties.add($);if(Z.opts.unevaluated&&D.length&&Z.props!==!0)Z.props=Y.mergeEvaluated.props(L,(0,Y.toHash)(D),Z.props);let I=D.filter(($)=>!(0,Y.alwaysValidSchema)(Z,z[$]));if(I.length===0)return;let A=L.name("valid");for(let $ of I){if(M($))N($);else{if(L.if((0,Q.propertyInData)(L,K,$,Z.opts.ownProperties)),N($),!Z.allErrors)L.else().var(A,!0);L.endIf()}F.it.definedProperties.add($),F.ok(A)}function M($){return Z.opts.useDefaults&&!Z.compositeRule&&z[$].default!==void 0}function N($){F.subschema({keyword:"properties",schemaProp:$,dataProp:$},A)}}};W.default=B}),yO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=h6(),Q=R0(),Y=y0(),G=y0(),B={keyword:"patternProperties",type:"object",schemaType:"object",code(F){let{gen:L,schema:z,data:J,parentSchema:K,it:Z}=F,{opts:D}=Z,I=(0,X.allSchemaProperties)(z),A=I.filter((R)=>(0,Y.alwaysValidSchema)(Z,z[R]));if(I.length===0||A.length===I.length&&(!Z.opts.unevaluated||Z.props===!0))return;let M=D.strictSchema&&!D.allowMatchingProperties&&K.properties,N=L.name("valid");if(Z.props!==!0&&!(Z.props instanceof Q.Name))Z.props=(0,G.evaluatedPropsToName)(L,Z.props);let{props:$}=Z;V();function V(){for(let R of I){if(M)U(R);if(Z.allErrors)O(R);else L.var(N,!0),O(R),L.if(N)}}function U(R){for(let j in M)if(new RegExp(R).test(j))(0,Y.checkStrictMode)(Z,`property ${j} matches pattern ${R} (use allowMatchingProperties)`)}function O(R){L.forIn("key",J,(j)=>{L.if(Q._`${(0,X.usePattern)(F,R)}.test(${j})`,()=>{let w=A.includes(R);if(!w)F.subschema({keyword:"patternProperties",schemaProp:R,dataProp:j,dataPropType:G.Type.Str},N);if(Z.opts.unevaluated&&$!==!0)L.assign(Q._`${$}[${j}]`,!0);else if(!w&&!Z.allErrors)L.if((0,Q.not)(N),()=>L.break())})})}}};W.default=B}),_O=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=y0(),Q={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Y){let{gen:G,schema:B,it:F}=Y;if((0,X.alwaysValidSchema)(F,B)){Y.fail();return}let L=G.name("valid");Y.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},L),Y.failResult(L,()=>Y.reset(),()=>Y.error())},error:{message:"must NOT be valid"}};W.default=Q}),gO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:h6().validateUnion,error:{message:"must match a schema in anyOf"}};W.default=X}),fO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:G})=>X._`{passingSchemas: ${G.passing}}`},code(G){let{gen:B,schema:F,parentSchema:L,it:z}=G;if(!Array.isArray(F))throw Error("ajv implementation error");if(z.opts.discriminator&&L.discriminator)return;let J=F,K=B.let("valid",!1),Z=B.let("passing",null),D=B.name("_valid");G.setParams({passing:Z}),B.block(I),G.result(K,()=>G.reset(),()=>G.error(!0));function I(){J.forEach((A,M)=>{let N;if((0,Q.alwaysValidSchema)(z,A))B.var(D,!0);else N=G.subschema({keyword:"oneOf",schemaProp:M,compositeRule:!0},D);if(M>0)B.if(X._`${D} && ${K}`).assign(K,!1).assign(Z,X._`[${Z}, ${M}]`).else();B.if(D,()=>{if(B.assign(K,!0),B.assign(Z,M),N)G.mergeEvaluated(N,X.Name)})})}}};W.default=Y}),xO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=y0(),Q={keyword:"allOf",schemaType:"array",code(Y){let{gen:G,schema:B,it:F}=Y;if(!Array.isArray(B))throw Error("ajv implementation error");let L=G.name("valid");B.forEach((z,J)=>{if((0,X.alwaysValidSchema)(F,z))return;let K=Y.subschema({keyword:"allOf",schemaProp:J},L);Y.ok(L),Y.mergeEvaluated(K)})}};W.default=Q}),hO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:B})=>X.str`must match "${B.ifClause}" schema`,params:({params:B})=>X._`{failingKeyword: ${B.ifClause}}`},code(B){let{gen:F,parentSchema:L,it:z}=B;if(L.then===void 0&&L.else===void 0)(0,Q.checkStrictMode)(z,'"if" without "then" and "else" is ignored');let J=G(z,"then"),K=G(z,"else");if(!J&&!K)return;let Z=F.let("valid",!0),D=F.name("_valid");if(I(),B.reset(),J&&K){let M=F.let("ifClause");B.setParams({ifClause:M}),F.if(D,A("then",M),A("else",M))}else if(J)F.if(D,A("then"));else F.if((0,X.not)(D),A("else"));B.pass(Z,()=>B.error(!0));function I(){let M=B.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},D);B.mergeEvaluated(M)}function A(M,N){return()=>{let $=B.subschema({keyword:M},D);if(F.assign(Z,D),B.mergeValidEvaluated($,Z),N)F.assign(N,X._`${M}`);else B.setParams({ifClause:M})}}}};function G(B,F){let L=B.schema[F];return L!==void 0&&!(0,Q.alwaysValidSchema)(B,L)}W.default=Y}),uO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=y0(),Q={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Y,parentSchema:G,it:B}){if(G.if===void 0)(0,X.checkStrictMode)(B,`"${Y}" without "if" is ignored`)}};W.default=Q}),o$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=i$(),Q=bO(),Y=n$(),G=qO(),B=CO(),F=ZB(),L=kO(),z=r$(),J=vO(),K=yO(),Z=_O(),D=gO(),I=fO(),A=xO(),M=hO(),N=uO();function $(V=!1){let U=[Z.default,D.default,I.default,A.default,M.default,N.default,L.default,z.default,F.default,J.default,K.default];if(V)U.push(Q.default,G.default);else U.push(X.default,Y.default);return U.push(B.default),U}W.default=$}),lO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:Y})=>X.str`must match format "${Y}"`,params:({schemaCode:Y})=>X._`{format: ${Y}}`},code(Y,G){let{gen:B,data:F,$data:L,schema:z,schemaCode:J,it:K}=Y,{opts:Z,errSchemaPath:D,schemaEnv:I,self:A}=K;if(!Z.validateFormats)return;if(L)M();else N();function M(){let $=B.scopeValue("formats",{ref:A.formats,code:Z.code.formats}),V=B.const("fDef",X._`${$}[${J}]`),U=B.let("fType"),O=B.let("format");B.if(X._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>B.assign(U,X._`${V}.type || "string"`).assign(O,X._`${V}.validate`),()=>B.assign(U,X._`"string"`).assign(O,V)),Y.fail$data((0,X.or)(R(),j()));function R(){if(Z.strictSchema===!1)return X.nil;return X._`${J} && !${O}`}function j(){let w=I.$async?X._`(${V}.async ? await ${O}(${F}) : ${O}(${F}))`:X._`${O}(${F})`,T=X._`(typeof ${O} == "function" ? ${w} : ${O}.test(${F}))`;return X._`${O} && ${O} !== true && ${U} === ${G} && !${T}`}}function N(){let $=A.formats[z];if(!$){R();return}if($===!0)return;let[V,U,O]=j($);if(V===G)Y.pass(w());function R(){if(Z.strictSchema===!1){A.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${z}" ignored in schema at path "${D}"`}}function j(T){let k=T instanceof RegExp?(0,X.regexpCode)(T):Z.code.formats?X._`${Z.code.formats}${(0,X.getProperty)(z)}`:void 0,l=B.scopeValue("formats",{key:z,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,X._`${l}.validate`];return["string",T,l]}function w(){if(typeof $=="object"&&!($ instanceof RegExp)&&$.async){if(!I.$async)throw Error("async format in sync schema");return X._`await ${O}(${F})`}return typeof U=="function"?X._`${O}(${F})`:X._`${O}.test(${F})`}}}};W.default=Q}),a$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=[lO().default];W.default=X}),s$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.contentVocabulary=W.metadataVocabulary=void 0,W.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],W.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),mO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=p$(),Q=d$(),Y=o$(),G=a$(),B=s$(),F=[X.default,Q.default,(0,Y.default)(),G.default,B.metadataVocabulary,B.contentVocabulary];W.default=F}),cO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.DiscrError=void 0;var X;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(X||(W.DiscrError=X={}))}),t$=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=cO(),Y=pQ(),G=HX(),B=y0(),F={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:L,tagName:z}})=>L===Q.DiscrError.Tag?`tag "${z}" must be string`:`value of tag "${z}" must be in oneOf`,params:({params:{discrError:L,tag:z,tagName:J}})=>X._`{error: ${L}, tag: ${J}, tagValue: ${z}}`},code(L){let{gen:z,data:J,schema:K,parentSchema:Z,it:D}=L,{oneOf:I}=Z;if(!D.opts.discriminator)throw Error("discriminator: requires discriminator option");let A=K.propertyName;if(typeof A!="string")throw Error("discriminator: requires propertyName");if(K.mapping)throw Error("discriminator: mapping is not supported");if(!I)throw Error("discriminator: requires oneOf keyword");let M=z.let("valid",!1),N=z.const("tag",X._`${J}${(0,X.getProperty)(A)}`);z.if(X._`typeof ${N} == "string"`,()=>$(),()=>L.error(!1,{discrError:Q.DiscrError.Tag,tag:N,tagName:A})),L.ok(M);function $(){let O=U();z.if(!1);for(let R in O)z.elseIf(X._`${N} === ${R}`),z.assign(M,V(O[R]));z.else(),L.error(!1,{discrError:Q.DiscrError.Mapping,tag:N,tagName:A}),z.endIf()}function V(O){let R=z.name("valid"),j=L.subschema({keyword:"oneOf",schemaProp:O},R);return L.mergeEvaluated(j,X.Name),R}function U(){var O;let R={},j=T(Z),w=!0;for(let _=0;_<I.length;_++){let h=I[_];if((h===null||h===void 0?void 0:h.$ref)&&!(0,B.schemaHasRulesButRef)(h,D.self.RULES)){let p=h.$ref;if(h=Y.resolveRef.call(D.self,D.schemaEnv.root,D.baseId,p),h instanceof Y.SchemaEnv)h=h.schema;if(h===void 0)throw new G.default(D.opts.uriResolver,D.baseId,p)}let d=(O=h===null||h===void 0?void 0:h.properties)===null||O===void 0?void 0:O[A];if(typeof d!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${A}"`);w=w&&(j||T(h)),k(d,_)}if(!w)throw Error(`discriminator: "${A}" must be required`);return R;function T({required:_}){return Array.isArray(_)&&_.includes(A)}function k(_,h){if(_.const)l(_.const,h);else if(_.enum)for(let d of _.enum)l(d,h);else throw Error(`discriminator: "properties/${A}" must have "const" or "enum"`)}function l(_,h){if(typeof _!="string"||_ in R)throw Error(`discriminator: "${A}" values must be unique strings`);R[_]=h}}}};W.default=F}),pO=G0((W,X)=>{X.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}}),e$=G0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv=void 0;let Q=c$(),Y=mO(),G=t$(),B=pO(),F=["/properties"],L="http://json-schema.org/draft-07/schema";var z=class extends Q.default{_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((I)=>this.addVocabulary(I)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let I=this.opts.$data?this.$dataMetaSchema(B,F):B;this.addMetaSchema(I,L,!1),this.refs["http://json-schema.org/schema"]=L}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(L)?L:void 0)}};W.Ajv=z,X.exports=W=z,X.exports.Ajv=z,Object.defineProperty(W,"__esModule",{value:!0}),W.default=z;var J=$X();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return J.KeywordCxt}});var K=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return K._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return K.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return K.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return K.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return K.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return K.CodeGen}});var Z=cQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return Z.default}});var D=HX();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return D.default}})}),WH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicAnchor=void 0;let X=R0(),Q=x6(),Y=pQ(),G=JB(),B={keyword:"$dynamicAnchor",schemaType:"string",code:(z)=>F(z,z.schema)};function F(z,J){let{gen:K,it:Z}=z;Z.schemaEnv.root.dynamicAnchors[J]=!0;let D=X._`${Q.default.dynamicAnchors}${(0,X.getProperty)(J)}`,I=Z.errSchemaPath==="#"?Z.validateName:L(z);K.if(X._`!${D}`,()=>K.assign(D,I))}W.dynamicAnchor=F;function L(z){let{schemaEnv:J,schema:K,self:Z}=z.it,{root:D,baseId:I,localRefs:A,meta:M}=J.root,{schemaId:N}=Z.opts,$=new Y.SchemaEnv({schema:K,schemaId:N,root:D,baseId:I,localRefs:A,meta:M});return Y.compileSchema.call(Z,$),(0,G.getValidate)(z,$)}W.default=B}),XH=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.dynamicRef=void 0;let X=R0(),Q=x6(),Y=JB(),G={keyword:"$dynamicRef",schemaType:"string",code:(F)=>B(F,F.schema)};function B(F,L){let{gen:z,keyword:J,it:K}=F;if(L[0]!=="#")throw Error(`"${J}" only supports hash fragment reference`);let Z=L.slice(1);if(K.allErrors)D();else{let A=z.let("valid",!1);D(A),F.ok(A)}function D(A){if(K.schemaEnv.root.dynamicAnchors[Z]){let M=z.let("_v",X._`${Q.default.dynamicAnchors}${(0,X.getProperty)(Z)}`);z.if(M,I(M,A),I(K.validateName,A))}else I(K.validateName,A)()}function I(A,M){return M?()=>z.block(()=>{(0,Y.callRef)(F,A),z.let(M,!0)}):()=>(0,Y.callRef)(F,A)}}W.dynamicRef=B,W.default=G}),dO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=WH(),Q=y0(),Y={keyword:"$recursiveAnchor",schemaType:"boolean",code(G){if(G.schema)(0,X.dynamicAnchor)(G,"");else(0,Q.checkStrictMode)(G.it,"$recursiveAnchor: false is ignored")}};W.default=Y}),iO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=XH(),Q={keyword:"$recursiveRef",schemaType:"string",code:(Y)=>(0,X.dynamicRef)(Y,Y.schema)};W.default=Q}),nO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=WH(),Q=XH(),Y=dO(),G=iO(),B=[X.default,Q.default,Y.default,G.default];W.default=B}),rO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=ZB(),Q={keyword:"dependentRequired",type:"object",schemaType:"object",error:X.error,code:(Y)=>(0,X.validatePropertyDeps)(Y)};W.default=Q}),oO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=ZB(),Q={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(Y)=>(0,X.validateSchemaDeps)(Y)};W.default=Q}),aO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=y0(),Q={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:Y,parentSchema:G,it:B}){if(G.contains===void 0)(0,X.checkStrictMode)(B,`"${Y}" without "contains" is ignored`)}};W.default=Q}),sO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=rO(),Q=oO(),Y=aO(),G=[X.default,Q.default,Y.default];W.default=G}),tO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y=x6(),G={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:B})=>X._`{unevaluatedProperty: ${B.unevaluatedProperty}}`},code(B){let{gen:F,schema:L,data:z,errsCount:J,it:K}=B;if(!J)throw Error("ajv implementation error");let{allErrors:Z,props:D}=K;if(D instanceof X.Name)F.if(X._`${D} !== true`,()=>F.forIn("key",z,(N)=>F.if(A(D,N),()=>I(N))));else if(D!==!0)F.forIn("key",z,(N)=>D===void 0?I(N):F.if(M(D,N),()=>I(N)));K.props=!0,B.ok(X._`${J} === ${Y.default.errors}`);function I(N){if(L===!1){if(B.setParams({unevaluatedProperty:N}),B.error(),!Z)F.break();return}if(!(0,Q.alwaysValidSchema)(K,L)){let $=F.name("valid");if(B.subschema({keyword:"unevaluatedProperties",dataProp:N,dataPropType:Q.Type.Str},$),!Z)F.if((0,X.not)($),()=>F.break())}}function A(N,$){return X._`!${N} || !${N}[${$}]`}function M(N,$){let V=[];for(let U in N)if(N[U]===!0)V.push(X._`${$} !== ${U}`);return(0,X.and)(...V)}}};W.default=G}),eO=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=R0(),Q=y0(),Y={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:G}})=>X.str`must NOT have more than ${G} items`,params:({params:{len:G}})=>X._`{limit: ${G}}`},code(G){let{gen:B,schema:F,data:L,it:z}=G,J=z.items||0;if(J===!0)return;let K=B.const("len",X._`${L}.length`);if(F===!1)G.setParams({len:J}),G.fail(X._`${K} > ${J}`);else if(typeof F=="object"&&!(0,Q.alwaysValidSchema)(z,F)){let D=B.var("valid",X._`${K} <= ${J}`);B.if((0,X.not)(D),()=>Z(D,J)),G.ok(D)}z.items=!0;function Z(D,I){B.forRange("i",I,K,(A)=>{if(G.subschema({keyword:"unevaluatedItems",dataProp:A,dataPropType:Q.Type.Num},D),!z.allErrors)B.if((0,X.not)(D),()=>B.break())})}}};W.default=Y}),Wj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=tO(),Q=eO(),Y=[X.default,Q.default];W.default=Y}),Xj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=p$(),Q=d$(),Y=o$(),G=nO(),B=sO(),F=Wj(),L=a$(),z=s$(),J=[G.default,X.default,Q.default,(0,Y.default)(!0),L.default,z.metadataVocabulary,z.contentVocabulary,B.default,F.default];W.default=J}),Qj=G0((W,X)=>{X.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}}}}),Yj=G0((W,X)=>{X.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"}}}}}),Gj=G0((W,X)=>{X.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"}}}}),Bj=G0((W,X)=>{X.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"}}}}),Fj=G0((W,X)=>{X.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"}}}}),Lj=G0((W,X)=>{X.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"}}}}),zj=G0((W,X)=>{X.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}}}}),Jj=G0((W,X)=>{X.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:[]}}}}),Kj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0});let X=Qj(),Q=Yj(),Y=Gj(),G=Bj(),B=Fj(),F=Lj(),L=zj(),z=Jj(),J=["/properties"];function K(Z){return[X,Q,Y,G,B,D(this,F),L,D(this,z)].forEach((I)=>this.addMetaSchema(I,void 0,!1)),this;function D(I,A){return Z?I.$dataMetaSchema(A,J):A}}W.default=K}),Zj=G0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.MissingRefError=W.ValidationError=W.CodeGen=W.Name=W.nil=W.stringify=W.str=W._=W.KeywordCxt=W.Ajv2020=void 0;let Q=c$(),Y=Xj(),G=t$(),B=Kj(),F="https://json-schema.org/draft/2020-12/schema";var L=class extends Q.default{constructor(D={}){super({...D,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),Y.default.forEach((D)=>this.addVocabulary(D)),this.opts.discriminator)this.addKeyword(G.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:D,meta:I}=this.opts;if(!I)return;B.default.call(this,D),this.refs["http://json-schema.org/schema"]=F}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(F)?F:void 0)}};W.Ajv2020=L,X.exports=W=L,X.exports.Ajv2020=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L;var z=$X();Object.defineProperty(W,"KeywordCxt",{enumerable:!0,get:function(){return z.KeywordCxt}});var J=R0();Object.defineProperty(W,"_",{enumerable:!0,get:function(){return J._}}),Object.defineProperty(W,"str",{enumerable:!0,get:function(){return J.str}}),Object.defineProperty(W,"stringify",{enumerable:!0,get:function(){return J.stringify}}),Object.defineProperty(W,"nil",{enumerable:!0,get:function(){return J.nil}}),Object.defineProperty(W,"Name",{enumerable:!0,get:function(){return J.Name}}),Object.defineProperty(W,"CodeGen",{enumerable:!0,get:function(){return J.CodeGen}});var K=cQ();Object.defineProperty(W,"ValidationError",{enumerable:!0,get:function(){return K.default}});var Z=HX();Object.defineProperty(W,"MissingRefError",{enumerable:!0,get:function(){return Z.default}})}),$j=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatNames=W.fastFormats=W.fullFormats=void 0;function X(_,h){return{validate:_,compare:h}}W.fullFormats={date:X(B,F),time:X(z(!0),J),"date-time":X(D(!0),I),"iso-time":X(z(),K),"iso-date-time":X(D(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:$,"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:l,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:U,int32:{type:"number",validate:j},int64:{type:"number",validate:w},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},W.fastFormats={...W.fullFormats,date:X(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,F),time:X(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,J),"date-time":X(/^\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,I),"iso-time":X(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,K),"iso-date-time":X(/^\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,A),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},W.formatNames=Object.keys(W.fullFormats);function Q(_){return _%4===0&&(_%100!==0||_%400===0)}let Y=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,G=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B(_){let h=Y.exec(_);if(!h)return!1;let d=+h[1],p=+h[2],K0=+h[3];return p>=1&&p<=12&&K0>=1&&K0<=(p===2&&Q(d)?29:G[p])}function F(_,h){if(!(_&&h))return;if(_>h)return 1;if(_<h)return-1;return 0}let L=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function z(_){return function(d){let p=L.exec(d);if(!p)return!1;let K0=+p[1],O0=+p[2],w0=+p[3],S0=p[4],$0=p[5]==="-"?-1:1,b=+(p[6]||0),v=+(p[7]||0);if(b>23||v>59||_&&!S0)return!1;if(K0<=23&&O0<=59&&w0<60)return!0;let u=O0-v*$0,E=K0-b*$0-(u<0?1:0);return(E===23||E===-1)&&(u===59||u===-1)&&w0<61}}function J(_,h){if(!(_&&h))return;let d=new Date("2020-01-01T"+_).valueOf(),p=new Date("2020-01-01T"+h).valueOf();if(!(d&&p))return;return d-p}function K(_,h){if(!(_&&h))return;let d=L.exec(_),p=L.exec(h);if(!(d&&p))return;if(_=d[1]+d[2]+d[3],h=p[1]+p[2]+p[3],_>h)return 1;if(_<h)return-1;return 0}let Z=/t|\s/i;function D(_){let h=z(_);return function(p){let K0=p.split(Z);return K0.length===2&&B(K0[0])&&h(K0[1])}}function I(_,h){if(!(_&&h))return;let d=new Date(_).valueOf(),p=new Date(h).valueOf();if(!(d&&p))return;return d-p}function A(_,h){if(!(_&&h))return;let[d,p]=_.split(Z),[K0,O0]=h.split(Z),w0=F(d,K0);if(w0===void 0)return;return w0||J(p,O0)}let M=/\/|:/,N=/^(?:[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;function $(_){return M.test(_)&&N.test(_)}let V=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function U(_){return V.lastIndex=0,V.test(_)}let O=-2147483648,R=2147483647;function j(_){return Number.isInteger(_)&&_<=R&&_>=O}function w(_){return Number.isInteger(_)}function T(){return!0}let k=/[^\\]\\Z/;function l(_){if(k.test(_))return!1;try{return new RegExp(_),!0}catch(h){return!1}}}),Hj=G0((W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.formatLimitDefinition=void 0;let X=e$(),Q=R0(),Y=Q.operators,G={formatMaximum:{okStr:"<=",ok:Y.LTE,fail:Y.GT},formatMinimum:{okStr:">=",ok:Y.GTE,fail:Y.LT},formatExclusiveMaximum:{okStr:"<",ok:Y.LT,fail:Y.GTE},formatExclusiveMinimum:{okStr:">",ok:Y.GT,fail:Y.LTE}},B={message:({keyword:L,schemaCode:z})=>Q.str`should be ${G[L].okStr} ${z}`,params:({keyword:L,schemaCode:z})=>Q._`{comparison: ${G[L].okStr}, limit: ${z}}`};W.formatLimitDefinition={keyword:Object.keys(G),type:"string",schemaType:"string",$data:!0,error:B,code(L){let{gen:z,data:J,schemaCode:K,keyword:Z,it:D}=L,{opts:I,self:A}=D;if(!I.validateFormats)return;let M=new X.KeywordCxt(D,A.RULES.all.format.definition,"format");if(M.$data)N();else $();function N(){let U=z.scopeValue("formats",{ref:A.formats,code:I.code.formats}),O=z.const("fmt",Q._`${U}[${M.schemaCode}]`);L.fail$data((0,Q.or)(Q._`typeof ${O} != "object"`,Q._`${O} instanceof RegExp`,Q._`typeof ${O}.compare != "function"`,V(O)))}function $(){let U=M.schema,O=A.formats[U];if(!O||O===!0)return;if(typeof O!="object"||O instanceof RegExp||typeof O.compare!="function")throw Error(`"${Z}": format "${U}" does not define "compare" function`);let R=z.scopeValue("formats",{key:U,ref:O,code:I.code.formats?Q._`${I.code.formats}${(0,Q.getProperty)(U)}`:void 0});L.fail$data(V(R))}function V(U){return Q._`${U}.compare(${J}, ${K}) ${G[Z].fail} 0`}},dependencies:["format"]};let F=(L)=>{return L.addKeyword(W.formatLimitDefinition),L};W.default=F}),Uj=G0((W,X)=>{Object.defineProperty(W,"__esModule",{value:!0});let Q=$j(),Y=Hj(),G=R0(),B=new G.Name("fullFormats"),F=new G.Name("fastFormats"),L=(J,K={keywords:!0})=>{if(Array.isArray(K))return z(J,K,Q.fullFormats,B),J;let[Z,D]=K.mode==="fast"?[Q.fastFormats,F]:[Q.fullFormats,B];if(z(J,K.formats||Q.formatNames,Z,D),K.keywords)(0,Y.default)(J);return J};L.get=(J,K="full")=>{let Z=(K==="fast"?Q.fastFormats:Q.fullFormats)[J];if(!Z)throw Error(`Unknown format "${J}"`);return Z};function z(J,K,Z,D){var I,A;(I=(A=J.opts.code).formats)!==null&&I!==void 0||(A.formats=G._`require("ajv-formats/dist/formats").${D}`);for(let M of K)J.addFormat(M,Z[M])}X.exports=W=L,Object.defineProperty(W,"__esModule",{value:!0}),W.default=L}),Aj=e$(),Nj=Zj(),Vj=PQ(Uj(),1),wj=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Dj=Vj.default;Hb=Aj.Ajv});var YH=H0(()=>{QH()});var Oj;var GH=H0(()=>{Oj=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then((W)=>W.webcrypto)});function HB(W){return`${W.method}\x00${JSON.stringify([W.partition??"",W.params??""])}`}function UB(W,X){return X===void 0?W:`${W}\x00${X}`}function Tj(W){let X;try{X=JSON.stringify(W)}catch(Q){throw TypeError(`cache value is not JSON-serializable: ${Q instanceof Error?Q.message:String(Q)}`)}if(typeof X!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return X}function bj(W,X){switch(W.kind){case"result":return qj(W.result,X);case"rpc-error":return $H(W,X);case"http-error":return Cj(W,X);case"network-error":return BH(W.error,X);case"auth-required":return{kind:"error",error:W.error};case"closed":if(X.transportKind==="stdio")return{kind:"legacy"};return BH(Error("Connection closed during the version negotiation probe"),X);case"timeout":if(X.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new U0(A0.RequestTimeout,`Version negotiation probe timed out after ${W.timeoutMs}ms`,{timeout:W.timeoutMs})}}}function qj(W,X){let Q=v5(_Q).validateResult("server/discover",W);if(!Q.ok)return{kind:"legacy"};let Y=Q.value.supportedVersions,G=X.clientModernVersions.find((B)=>Y.includes(B));if(G!==void 0)return{kind:"modern",version:G,discover:Q.value};if(X.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new yQ({supported:[...Y],requested:X.requestedVersion})}}function $H(W,X){let{code:Q,message:Y,data:G}=W;if(Q===Pj){let B=yj(G);if(B===void 0)return{kind:"legacy"};let F=new yQ({supported:B,requested:_j(G)??X.requestedVersion},Y),L=ZX(B),z=X.clientModernVersions.find((J)=>L.includes(J));if(z!==void 0)return{kind:"corrective",version:z,error:F};if(L.length>0)return{kind:"error",error:F};return X.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:F}}if(Sj.has(Q))return{kind:"legacy"};return{kind:"legacy"}}function Cj(W,X){let Q=gj(W.body);if(Q!==void 0)return $H(Q,X);return{kind:"legacy"}}function BH(W,X){if(X.environment==="browser"&&kj(W))return{kind:"legacy"};return{kind:"error",error:new U0(A0.EraNegotiationFailed,`Version negotiation probe failed: ${vj(W)}`,{cause:W})}}function kj(W){return W instanceof TypeError||W instanceof Error&&W.name==="TypeError"}function vj(W){return W instanceof Error?W.message:String(W)}function yj(W){if(typeof W!=="object"||W===null)return;let X=W.supported;if(!Array.isArray(X)||X.length===0||!X.every((Q)=>typeof Q==="string"))return;return X}function _j(W){if(typeof W!=="object"||W===null)return;let X=W.requested;return typeof X==="string"?X:void 0}function gj(W){if(W===void 0||W==="")return;let X;try{X=JSON.parse(W)}catch{return}if(typeof X!=="object"||X===null)return;let Q=X.error;if(typeof Q!=="object"||Q===null)return;let{code:Y,message:G,data:B}=Q;if(typeof Y!=="number")return;return{code:Y,message:typeof G==="string"?G:"",data:B}}function xj(W,X){let Q=W?.mode??fj;if(Q==="legacy")return{kind:"legacy"};let Y=W?.probe??{};if(typeof Q==="object"){if(!B4(Q.pin))throw TypeError(`versionNegotiation: { pin: '${Q.pin}' } is not a modern protocol revision \u2014 pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:Q.pin,probe:Y}}let G=X?ZX(X):[];return{kind:"auto",modernVersions:G.length>0?G:[...o7],fallbackAvailable:X?a7(X).length>0:!0,probe:Y}}function FH(){let W=globalThis;return W.window!==void 0&&W.document!==void 0?"browser":"node"}function LH(W){return"stderr"in W&&"pid"in W?"stdio":"http"}function zH(W){let X=AB.get(W);AB.delete(W),X?.()}function uj(W,X,Q,Y){return{jsonrpc:"2.0",id:W,method:"server/discover",params:{_meta:v5(X).outboundEnvelope({protocolVersion:X,clientInfo:Q,clientCapabilities:Y})}}}function lj(W,X){switch(W.kind){case"response":return W.error===void 0?{kind:"result",result:W.result}:{kind:"rpc-error",...W.error};case"send-error":{let Q=W.error;if(Q instanceof W$){let Y=Q.data?.text;return{kind:"http-error",status:Q.data.status,body:typeof Y==="string"?Y:void 0}}if(Q instanceof jj||Q instanceof Error&&Q.name==="UnauthorizedError")return{kind:"auth-required",error:Q};return{kind:"network-error",error:Q}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:X}}}async function HH(W,X){let Q=W.probe.timeoutMs??X.defaultTimeoutMs,Y=Math.max(0,W.probe.maxRetries??0),G=W.kind==="pin"?[W.version]:W.modernVersions,B=W.kind==="auto"&&W.fallbackAvailable,F=await hj.open(X.transport),L=async()=>{let J=G[0],K=!1,Z=Y;for(;;){let D=await F.exchange((M)=>uj(M,J,X.clientInfo,X.capabilities),Q);if(D.kind==="timeout"&&Z>0){Z--;continue}let I=lj(D,Q),A=bj(I,{clientModernVersions:G,requestedVersion:J,fallbackAvailable:B,environment:X.environment,transportKind:X.transportKind});switch(A.kind){case"modern":return{era:"modern",version:A.version,discover:A.discover};case"corrective":if(K)throw A.error;K=!0,J=A.version;continue;case"legacy":{let M=I.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(W.kind==="pin")throw new U0(A0.EraNegotiationFailed,M===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${W.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${M} before the server offered pinned protocol version ${W.version} (no fallback in pin mode)`);if(!W.fallbackAvailable)throw new U0(A0.EraNegotiationFailed,M===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${M} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(M!==void 0&&X.disposableProbe!==!0)throw new U0(A0.EraNegotiationFailed,`Version negotiation failed: ${M} (this transport probed in place \u2014 the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw A.error}}},z;try{z=await L()}catch(J){throw F.detach(),J}return F.release(),z}function mj(W){let X=Object.getPrototypeOf(W);if(X===null||!Object.prototype.hasOwnProperty.call(X,"_dispose"))return;let Q=W._serverParams;return typeof Q==="object"&&Q!==null&&typeof Q.command==="string"?Q:void 0}async function cj(W,X,Q,Y){let B=new X.constructor({...Q,stderr:"ignore"}),F=X.close,L=!1,z,J=new Promise((Z,D)=>{z=()=>D(JH())});X.close=async function(){return L=!0,z?.(),F.call(X)};let K;try{let Z=HH(W,{...Y,transport:B,transportKind:"stdio",disposableProbe:!0});Z.catch(()=>{}),K=await Promise.race([Z,J])}finally{await pj(B),X.close=F}if(L)throw JH();return K}function JH(){return new U0(A0.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function pj(W){try{let X=W._dispose;await(typeof X==="function"?X.call(W):W.close())}catch{}}function KH(W){let X=W._meta?.[w1];return k$.Implementation(X)?X:void 0}function iQ(W,X){if(!W||X===null||typeof X!=="object")return;if(W.type==="object"&&W.properties&&typeof W.properties==="object"){let Q=X,Y=W.properties;for(let G of Object.keys(Y)){let B=Y[G];if(Q[G]===void 0&&Object.prototype.hasOwnProperty.call(B,"default"))Q[G]=B.default;if(Q[G]!==void 0)iQ(B,Q[G])}}if(Array.isArray(W.anyOf)){for(let Q of W.anyOf)if(typeof Q!=="boolean")iQ(Q,X)}if(Array.isArray(W.oneOf)){for(let Q of W.oneOf)if(typeof Q!=="boolean")iQ(Q,X)}}function dj(W){if(!W)return{supportsFormMode:!1,supportsUrlMode:!1};let X=W.form!==void 0,Q=W.url!==void 0;return{supportsFormMode:X||!X&&!Q,supportsUrlMode:Q}}function ij(W){if(typeof W==="object"&&W!==null){if(W.kind==="legacy"&&!("supportedVersions"in W)&&!("discover"in W))return W;if(W.kind==="modern"&&C5.safeParse(W.discover).success)return W}throw new U0(A0.EraNegotiationFailed,"connect({ prior }): unrecognized prior \u2014 expected { kind: 'modern', discover } or { kind: 'legacy' }")}var UX,Pq,Sq,bq,qq,Cq,jj,dQ,Ej=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(W){this._maxEntries=W?.maxEntries??512}get size(){return this._entries.size}get(W){return this._entries.get(HB(W))}set(W,X){let Q=HB(W),Y=dQ.has(W.method),G=!this._entries.has(Q);if(!Y&&G&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let F of this._entries.keys())if(!dQ.has(F.slice(0,F.indexOf("\x00")))){this._entries.delete(F),this._cappedSize--;break}}let B=++this._stamp;if(this._entries.set(Q,{...X,stamp:B}),G&&!Y)this._cappedSize++;return B}delete(W){if(this._entries.delete(HB(W))&&!dQ.has(W.method))this._cappedSize--}evict(W){let X=`${W}\x00`,Q=dQ.has(W);for(let Y of this._entries.keys())if(Y.startsWith(X)){if(this._entries.delete(Y),!Q)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}},Ij=86400000,Rj=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(W,X,Q=()=>{},Y="",G=Date.now){this._store=W,this._isUserSupplied=X,this._reportError=Q,this._cachePartition=Y,this._now=G}now(){return this._now()}setServerIdentity(W){this._serverIdentity=W}_partitionFor(W){return JSON.stringify([this._serverIdentity,W==="public"?"":this._cachePartition])}async _probe(W,X){let Q={method:W,params:X??""},Y=this._partitionFor("private"),G=await this._store.get({...Q,partition:Y});if(G!==void 0)return G;let B=this._partitionFor("public");if(B===Y)return;let F=await this._store.get({...Q,partition:B});return F?.scope==="public"?F:void 0}async evict(W){this._evictionGeneration.set(W,(this._evictionGeneration.get(W)??0)+1),await this._deleteBoth(W,"")}async _deleteBoth(W,X){let Q=this._partitionFor("private"),Y=this._partitionFor("public");try{await this._store.delete({method:W,params:X,partition:Q})}catch(G){this._reportError(G)}if(Y!==Q)try{await this._store.delete({method:W,params:X,partition:Y})}catch(G){this._reportError(G)}}async evictKey(W,X){let Q=UB(W,X),Y=this._evictionGeneration.get(Q);if(Y!==void 0)this._evictionGeneration.set(Q,Y+1);await this._deleteBoth(W,X)}captureGeneration(W,X){let Q=UB(W,X),Y=this._evictionGeneration.get(Q)??0;return this._evictionGeneration.set(Q,Y),Y}async write(W,X,Q,Y){if((this._evictionGeneration.get(UB(W,Y?.params))??0)!==Q)return;let G=Y?.params??"",B=this._partitionFor("private"),F=this._partitionFor("public"),L=(Y?.scope??"private")==="public"?F:B;try{await this._store.set({method:W,params:G,partition:L},{value:Tj(X),expiresAt:Y?.expiresAt,scope:Y?.scope})}catch(z){this._reportError(z)}if(F!==B)try{await this._store.delete({method:W,params:G,partition:L===B?F:B})}catch(z){this._reportError(z)}}async read(W,X){let Q=await this._probe(W,X);if(Q?.expiresAt===void 0||!(Q.expiresAt>this.now()))return;try{let Y=JSON.parse(Q.value);if(typeof Y!=="object"||Y===null||Array.isArray(Y))throw TypeError("cached document is not an object");return{value:Y}}catch(Y){this._reportError(Y),await this._deleteBoth(W,X??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(W){let X=await this._probe("tools/list");if(X===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==X.stamp){let Q=this._decodeListTools(X),Y=new Map;if(Q!==void 0)for(let G of Q.tools)Y.set(G.name,G);this._toolIndex={stamp:X.stamp,byName:Y}}return this._toolIndex.byName.get(W)}async outputValidator(W,X){let Q=await this._probe("tools/list");if(Q===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==Q.stamp){let Y=this._decodeListTools(Q)??{tools:[]},G=new Map;for(let B of Y.tools){let F=X(B);if(F!==void 0)G.set(B.name,F)}this._toolOutputValidatorIndex={stamp:Q.stamp,byName:G}}return this._toolOutputValidatorIndex.byName.get(W)}_decodeListTools(W){try{let X=JSON.parse(W.value);if(!Array.isArray(X?.tools)||!X.tools.every((Q)=>Q!==null&&typeof Q==="object"))throw TypeError("cached tools/list document has a malformed tools array");return X}catch(X){this._reportError(X);return}}},Pj=-32022,Sj,fj="legacy",hj=class W{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(X){this._transport=X,this._savedOnMessage=X.onmessage,this._savedOnError=X.onerror,this._savedOnClose=X.onclose}static async open(X){let Q=new W(X);X.onmessage=(Y)=>{let G=Q._pending;if(G!==void 0&&(JX(Y)||gQ(Y))&&Y.id===G.id){if(Q._pending=void 0,JX(Y))G.resolve({kind:"response",result:Y.result});else G.resolve({kind:"response",error:Y.error});return}},X.onerror=(Y)=>{Q._savedOnError?.(Y)},X.onclose=()=>{let Y=Q._pending;if(Y!==void 0)Q._pending=void 0,Y.resolve({kind:"closed"});Q._closeDelivered=!0,Q._savedOnClose?.()};try{await X.start()}catch(Y){throw Q.detach(),Y}return Q}async exchange(X,Q){let Y=`server-discover-probe-${++this._probeCounter}`;return new Promise((G)=>{let B=!1,F=(z)=>{if(B)return;if(B=!0,clearTimeout(L),this._pending?.id===Y)this._pending=void 0;G(z)},L=setTimeout(()=>F({kind:"timeout"}),Q);this._pending={id:Y,resolve:F},this._transport.send(X(Y)).catch((z)=>F({kind:"send-error",error:z}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let X=this._savedOnClose,Q=this._transport,Y=!1,G=()=>{if(!Y){Y=!0;return}X()};Q.onclose=G,AB.set(Q,()=>{if(Q.onclose===G)Q.onclose=X})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let X=this._transport,Q=X.start,Y=!0;X.start=async function(){if(Y){Y=!1,X.start=Q;return}return Q.call(X)}}},AB,ZH,nj=64,UH,kq;var AH=H0(()=>{zB();YH();GH();UX=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](W){return a1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,W)}constructor(W){super(W);this.name=new.target.name,_4(this,new.target)}},Pq=class extends UX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(W,X,Q){super(`Issuer mismatch in ${W==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(X)}, received ${JSON.stringify(Q)}`);this.kind=W,this.expected=X,this.received=Q}},Sq=class extends UX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(W){super(`Dynamic Client Registration rejected (HTTP ${W.status}): ${W.body}`);this.status=W.status,this.body=W.body,this.submittedMetadata=W.submittedMetadata}},bq=class extends UX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(W){super(`Refusing to send credentials to non-https token endpoint '${W}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=W}},qq=class extends UX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(W,X){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(W)}, callback resolved ${JSON.stringify(X)}); refusing to send authorization_code/code_verifier to a different token endpoint`);this.recordedIssuer=W,this.currentIssuer=X}},Cq=class extends UX{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(W){super(`Insufficient scope${W.requiredScope?`: required "${W.requiredScope}"`:""}`);this.requiredScope=W.requiredScope,this.resourceMetadataUrl=W.resourceMetadataUrl,this.errorDescription=W.errorDescription}},jj=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](W){return a1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,W)}constructor(W){super(W??"Unauthorized");this.name="UnauthorizedError",_4(this,new.target)}},dQ=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]);Sj=new Set([-32001,-32020,-32021]);AB=new WeakMap;ZH={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},UH=class extends v${_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let W=new U0(A0.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let X of this._listenState.values())X.settle({cause:"remote",error:W})}this._listenState.clear();for(let W of this._listChangedDebounceTimers.values())clearTimeout(W);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(W,X){super(X);if(this._clientInfo=W,this._capabilities=X?.capabilities?{...X.capabilities}:{},this._jsonSchemaValidator=X?.jsonSchemaValidator??new $B,this._enforceStrictCapabilities=X?.enforceStrictCapabilities??!1,this._versionNegotiation=X?.versionNegotiation,this._supportedProtocolVersionsOption=X?.supportedProtocolVersions,this._inputRequiredDriverConfig=S$(X?.inputRequired),this._cache=new Rj(X?.responseCacheStore??new Ej,X?.responseCacheStore!==void 0,(Q)=>this._reportStoreError(Q),X?.cachePartition??""),this._defaultCacheTtlMs=X?.defaultCacheTtlMs??0,this._listMaxPages=X?.listMaxPages??nj,X?.listChanged)this._listChangedConfig=X.listChanged}buildContext(W,X){return W}_shouldDropInbound(W){if(this._negotiatedProtocolVersion!==void 0&&B4(this._negotiatedProtocolVersion)&&QB(W))return"drop"}_outboundMetaEnvelope(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:W,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(W,X){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new U0(A0.UnsupportedResultType,`Unsupported result type 'input_required' for ${X.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance \u2014 pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:X.request.method}));return _$({getRequestHandler:(Q)=>this._getRequestHandler(Q),buildContext:(Q)=>this.buildContext(Q,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,W,X)}_setupListChangedHandlers(W){if(W.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",W.tools,async()=>{return(await this.listTools(void 0,{cacheMode:"refresh"})).tools});if(W.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",W.prompts,async()=>{return(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts});if(W.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",W.resources,async()=>{return(await this.listResources(void 0,{cacheMode:"refresh"})).resources})}registerCapabilities(W){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=y$(this._capabilities,W)}setVersionNegotiation(W){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=W}_wrapHandler(W,X){if(W==="elicitation/create")return async(Q,Y)=>{let G=v5(this._negotiatedProtocolVersion),B=G.validateRequest("elicitation/create",Q);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("elicitation/create",Q);if(!B.ok)throw new m0(B.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,B.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${B.message}`);let{params:F}=B.value;F.mode=F.mode??"form";let{supportsFormMode:L,supportsUrlMode:z}=dj(this._capabilities.elicitation);if(F.mode==="form"&&!L)throw new m0(M0.InvalidParams,"Client does not support form-mode elicitation requests");if(F.mode==="url"&&!z)throw new m0(M0.InvalidParams,"Client does not support URL-mode elicitation requests");let J=await X(Q,Y),K=G.validateResult("elicitation/create",J);if(!K.ok&&K.reason==="not-in-era")K=G.validateInputResponse("elicitation/create",J);if(!K.ok)throw new m0(K.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,K.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${K.message}`);let Z=K.value,D=F.mode==="form"?F.requestedSchema:void 0;if(F.mode==="form"&&Z.action==="accept"&&Z.content&&D&&this._capabilities.elicitation?.form?.applyDefaults)try{iQ(D,Z.content)}catch{}return Z};if(W==="sampling/createMessage")return async(Q,Y)=>{let G=v5(this._negotiatedProtocolVersion),B=G.validateRequest("sampling/createMessage",Q);if(!B.ok&&B.reason==="not-in-era")B=G.validateInputRequest("sampling/createMessage",Q);if(!B.ok)throw new m0(B.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,B.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${B.message}`);let{params:F}=B.value,L=await X(Q,Y),z=Boolean(F.tools||F.toolChoice),J=G.samplingResultVariant(z,L);if(!J.ok&&J.reason==="not-in-era")J=G.validateInputResponse("sampling/createMessage",L);if(!J.ok)throw new m0(J.reason==="not-in-era"?M0.InternalError:M0.InvalidParams,J.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${J.message}`);return J.value};return X}assertCapability(W,X){if(!this._serverCapabilities?.[W])throw new U0(A0.CapabilityNotSupported,`Server does not support ${W} (required for ${X})`)}async connect(W,X){if(X?.prior!=null)return this._connectFromPrior(W,ij(X.prior),X);let Q=xj(this._versionNegotiation,this._supportedProtocolVersionsOption);if(Q.kind!=="legacy")return this._connectNegotiated(W,Q,X);return this._connectPlainLegacy(W,X)}async _connectPlainLegacy(W,X){if(await super.connect(W),W.sessionId!==void 0){let Q=this._negotiatedProtocolVersion;if(Q!==void 0)W.setProtocolVersion?.(Q);return}this._resetConnectionState(),await this._legacyHandshake(W,X)}async _legacyHandshake(W,X){let Q=a7(this._supportedProtocolVersions);try{let Y=Q[0];if(Y===void 0)throw new U0(A0.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let G=await this.request({method:"initialize",params:{protocolVersion:Y,capabilities:this._capabilities,clientInfo:this._clientInfo}},X);if(G===void 0)throw Error(`Server sent invalid initialize result: ${G}`);if(!Q.includes(G.protocolVersion))throw Error(`Server's protocol version is not supported: ${G.protocolVersion}`);if(this._serverCapabilities=G.capabilities,this._serverVersion=G.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(W)),W.setProtocolVersion)W.setProtocolVersion(G.protocolVersion);if(this._instructions=G.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=G.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(Y){throw this.close(),Y}}async _connectNegotiated(W,X,Q){if(W.sessionId!==void 0){await super.connect(W);let G=this._negotiatedProtocolVersion;if(G!==void 0&&W.setProtocolVersion)W.setProtocolVersion(G);return}this._resetConnectionState();let Y;try{let G=LH(W),B={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:FH(),defaultTimeoutMs:Q?.timeout??xQ},F=G==="stdio"?mj(W):void 0;Y=F===void 0?await HH(X,{...B,transport:W,transportKind:G}):await cj(X,W,F,B)}catch(G){throw await W.close().catch(()=>{}),zH(W),G}if(zH(W),await super.connect(W),Y.era==="legacy"){await this._legacyHandshake(W,Q);return}if(this._serverCapabilities=Y.discover.capabilities,this._serverVersion=KH(Y.discover),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.discover.instructions,this._discoverResult=Y.discover,this._negotiatedProtocolVersion=Y.version,W.setProtocolVersion)W.setProtocolVersion(Y.version);if(this._listChangedConfig){let G=this._listChangedConfig,B=this._serverCapabilities,F={...G.tools&&B?.tools?.listChanged&&{tools:G.tools},...G.prompts&&B?.prompts?.listChanged&&{prompts:G.prompts},...G.resources&&B?.resources?.listChanged&&{resources:G.resources}},L=!0;try{this._setupListChangedHandlers(F)}catch(J){L=!1,this.onerror?.(J instanceof Error?J:Error(String(J)))}let z=L?{...F.tools&&{toolsListChanged:!0},...F.prompts&&{promptsListChanged:!0},...F.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(z).length>0){let J=new AbortController,K=()=>J.abort(Q?.signal?.reason);if(Q?.signal?.aborted)K();Q?.signal?.addEventListener("abort",K);try{this._autoOpenedSubscription=await this.listen(z,{timeout:Q?.timeout,signal:J.signal})}catch(Z){if(Q?.signal?.aborted)throw await this.close().catch(()=>{}),Z;this.onerror?.(Z instanceof Error?Z:Error(String(Z)))}finally{Q?.signal?.removeEventListener("abort",K)}}}}async _connectFromPrior(W,X,Q){if(X.kind==="legacy")return this._connectPlainLegacy(W,Q);let Y=X.discover;this._resetConnectionState();let G=this._supportedProtocolVersionsOption,B=(G&&ZX(G).length>0?ZX(G):o7).find((F)=>Y.supportedVersions.includes(F));if(B===void 0)throw new U0(A0.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(W),this._discoverResult=Y,this._serverCapabilities=Y.capabilities,this._serverVersion=KH(Y),this._cache.setServerIdentity(this._deriveServerIdentity(W)),this._instructions=Y.instructions,this._negotiatedProtocolVersion=B,W.setProtocolVersion?.(B),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(F){this.onerror?.(F instanceof Error?F:Error(String(F)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(W){let X=this._serverVersion;if(X!==void 0)return`${X.name}@${X.version}`;return W.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let W=this._negotiatedProtocolVersion;if(W===void 0)return;return B4(W)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(W){switch(W){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new U0(A0.CapabilityNotSupported,`Server does not support logging (required for ${W})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new U0(A0.CapabilityNotSupported,`Server does not support prompts (required for ${W})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new U0(A0.CapabilityNotSupported,`Server does not support resources (required for ${W})`);if(W==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new U0(A0.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${W})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new U0(A0.CapabilityNotSupported,`Server does not support tools (required for ${W})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new U0(A0.CapabilityNotSupported,`Server does not support completions (required for ${W})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(W){switch(W){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new U0(A0.CapabilityNotSupported,`Client does not support roots list changed notifications (required for ${W})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(W){switch(W){case"sampling/createMessage":if(!this._capabilities.sampling)throw new U0(A0.CapabilityNotSupported,`Client does not support sampling capability (required for ${W})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new U0(A0.CapabilityNotSupported,`Client does not support elicitation capability (required for ${W})`);break;case"roots/list":if(!this._capabilities.roots)throw new U0(A0.CapabilityNotSupported,`Client does not support roots capability (required for ${W})`);break;case"ping":break}}async ping(W){return this.request({method:"ping"},W)}async discover(W){let X=await this._requestWithSchema({method:"server/discover"},C5,W);return this._discoverResult=X,X}async complete(W,X){return this.request({method:"completion/complete",params:W},X)}async setLoggingLevel(W,X){return this.request({method:"logging/setLevel",params:{level:W}},X)}async getPrompt(W,X){return this.request({method:"prompts/get",params:W},X)}async listPrompts(W,X){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(W?.cursor!==void 0)return this.request({method:"prompts/list",params:W},X);let Q=await this._serveFromCache("prompts/list",void 0,X);if(Q!==void 0)return Q;return this._listAllPages("prompts/list",W,X,(Y,G)=>Y.prompts.push(...G.prompts))}async listResources(W,X){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(W?.cursor!==void 0)return this.request({method:"resources/list",params:W},X);let Q=await this._serveFromCache("resources/list",void 0,X);if(Q!==void 0)return Q;return this._listAllPages("resources/list",W,X,(Y,G)=>Y.resources.push(...G.resources))}async listResourceTemplates(W,X){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(W?.cursor!==void 0)return this.request({method:"resources/templates/list",params:W},X);let Q=await this._serveFromCache("resources/templates/list",void 0,X);if(Q!==void 0)return Q;return this._listAllPages("resources/templates/list",W,X,(Y,G)=>Y.resourceTemplates.push(...G.resourceTemplates))}async _listAllPages(W,X,Q,Y,G){let B=Q?.cacheMode==="bypass",F=this._cache.captureGeneration(W),L=await this.request({method:W,...X&&{params:{...X}}},Q),z=L.nextCursor,J=new Set,K=1;while(z!==void 0&&!J.has(z)){if(this._listMaxPages!==0&&K>=this._listMaxPages)throw new U0(A0.ListPaginationExceeded,`${W}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:W,listMaxPages:this._listMaxPages});J.add(z);let Z=await this.request({method:W,params:{...X,cursor:z}},Q);Y(L,Z),z=Z.nextCursor,K++}if(delete L.nextCursor,G?.(L),B)return L;return await this._cache.write(W,L,F,this._freshness(L)),L}_freshness(W,X){let Q=W,Y=typeof Q.ttlMs==="number"?Q.ttlMs:this._defaultCacheTtlMs,G=Q.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,Y),Ij),scope:G,params:X}}async _serveFromCache(W,X,Q){if(Q?.cacheMode==="bypass"||Q?.cacheMode==="refresh")return;let Y=await this._cache.read(W,X).catch((G)=>void this._reportStoreError(G));if(Y!==void 0){if(Q?.signal?.aborted){let G=Q.signal.reason;throw G instanceof U0?G:new U0(A0.RequestTimeout,String(G))}return Y.value}}_reportStoreError(W){this.onerror?.(W instanceof Error?W:Error(String(W)))}_compileOutputValidator(W){if(!W.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(W.outputSchema)}}catch(X){return{ok:!1,compileError:X}}}async _resolveXMcpHeaderScan(W,X){let Q=X??await this._cache.toolDefinition(W);return Q===void 0?void 0:YB(Q.inputSchema)}async readResource(W,X){let Q=await this._serveFromCache("resources/read",W.uri,X);if(Q!==void 0)return Q;let Y=this._cache.captureGeneration("resources/read",W.uri),G=await this.request({method:"resources/read",params:W},X);if(X?.cacheMode!=="bypass"){let B=this._freshness(G,W.uri);if(B.expiresAt>this._cache.now())await this._cache.write("resources/read",G,Y,B);else if(X?.cacheMode==="refresh")await this._cache.evictKey("resources/read",W.uri)}return G}async subscribeResource(W,X){return this.request({method:"resources/subscribe",params:W},X)}async unsubscribeResource(W,X){return this.request({method:"resources/unsubscribe",params:W},X)}async listen(W,X){if(this.transport===void 0)throw new U0(A0.NotConnected,"Not connected");let Q=this._negotiatedProtocolVersion;if(Q===void 0||!B4(Q))throw new U0(A0.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${Q??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:Q});if(X?.signal?.aborted){let V=X.signal.reason;throw V instanceof U0?V:new U0(A0.RequestTimeout,String(V))}let Y=new AbortController,G=`listen:${this._nextListenId++}`,B="opening",F,L,z,J,K=new Promise((V,U)=>{z=V,J=U}),Z,D=new Promise((V)=>{Z=V}),I=(V)=>{if(B==="closed")return;let U=B==="opening";if(F!==void 0)clearTimeout(F),F=void 0;if("ack"in V){B="open",z(V.ack);return}if(B="closed",L!==void 0)X?.signal?.removeEventListener("abort",L);if(this._listenState.delete(G),Y.abort(),Z(V.cause),U)J(V.error??new U0(A0.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},A=async()=>{Y.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:G}}).catch(()=>{})},M=async()=>{if(B==="closed")return;I({cause:"local"}),await A()};this._listenState.set(G,{settle:I});let N=X?.timeout??xQ;if(F=setTimeout(()=>{I({cause:"remote",error:new U0(A0.RequestTimeout,"subscriptions/listen ack timed out",{timeout:N})}),A().catch(()=>{})},N),X?.signal){let V=X.signal;L=()=>{if(B==="closed")return;let U=V.reason;I({cause:"local",error:U instanceof Error?U:Error(String(U??"Aborted"))}),A().catch(()=>{})},V.addEventListener("abort",L,{once:!0})}let $={jsonrpc:"2.0",id:G,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:W}};try{await this.transport.send($,{requestSignal:Y.signal,onRequestStreamEnd:()=>I({cause:"remote",error:Error("subscriptions/listen: stream ended")})})}catch(V){I({cause:"remote",error:V instanceof Error?V:Error(String(V))})}return{honoredFilter:await K,close:M,closed:D}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(W,X){let Q=Object.hasOwn(ZH,W.method)?ZH[W.method]:void 0;if(W.method==="notifications/resources/updated"){let Y=W.params?.uri;if(typeof Y==="string")this._cache.evictKey("resources/read",Y)}else if(Q!==void 0)for(let Y of Q)this._cache.evict(Y);if(W.method==="notifications/subscriptions/acknowledged"){let Y=W.params?._meta?.[m5],G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){let B=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",W);G.settle({ack:B.ok?B.value.params.notifications:{}});return}}if(W.method==="notifications/cancelled"){let Y=W.params?.requestId,G=typeof Y==="string"?this._listenState.get(Y):void 0;if(G!==void 0){G.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(W,X)}_onresponse(W){let X=W.id,Q=typeof X==="string"?this._listenState.get(X):void 0;if(Q!==void 0){if(gQ(W))Q.settle({cause:"remote",error:m0.fromError(W.error.code,W.error.message,W.error.data)});else Q.settle({cause:"graceful",error:new U0(A0.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(W)}_onclose(){if(this._listenState.size>0){let W=new U0(A0.ConnectionClosed,"Connection closed");for(let X of this._listenState.values())X.settle({cause:"remote",error:W});this._listenState.clear()}super._onclose()}async callTool(W,X){let Q=this.getProtocolEra()==="modern"&&FH()!=="browser",Y=async()=>{if(!Q)return X;let z;try{z=await this._resolveXMcpHeaderScan(W.name,X?.toolDefinition)}catch(K){this._reportStoreError(K)}if(!z?.valid||z.declarations.length===0)return X;let J=T$(z.declarations,W.arguments);return Object.keys(J).length===0?X:{...X,headers:{...X?.headers,...J}}},G=X?.toolDefinition===void 0?await this._cache.outputValidator(W.name,(z)=>this._compileOutputValidator(z)).catch((z)=>void this._reportStoreError(z)):this._compileOutputValidator(X.toolDefinition),B=()=>{if(G===void 0||G.ok)return;let z=G.compileError,J=(z instanceof Error?z.message:String(z)).slice(0,200);throw new m0(M0.InvalidParams,`Tool '${W.name}' has an invalid outputSchema: ${J}`)};B();let F;try{F=await this.request({method:"tools/call",params:W},await Y())}catch(z){let J=z instanceof m0&&z.code===d9;if(!Q||!J||X?.toolDefinition!==void 0)throw z;let K={signal:X?.signal,timeout:X?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,K).catch((Z)=>this._reportStoreError(Z)),G=await this._cache.outputValidator(W.name,(Z)=>this._compileOutputValidator(Z)).catch((Z)=>void this._reportStoreError(Z)),B(),F=await this.request({method:"tools/call",params:W},await Y())}let L=G!==void 0&&G.ok?G.validator:void 0;if(L){if(F.structuredContent===void 0&&!F.isError)throw new m0(M0.InvalidRequest,`Tool ${W.name} has an output schema but did not return structured content`);if(F.structuredContent!==void 0&&!F.isError)try{let z=L(F.structuredContent);if(!z.valid)throw new m0(M0.InvalidParams,`Structured content does not match the tool's output schema: ${z.errorMessage}`)}catch(z){if(z instanceof m0)throw z;throw new m0(M0.InvalidParams,`Failed to validate structured content: ${z instanceof Error?z.message:String(z)}`)}}return F}async listTools(W,X){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(W?.cursor!==void 0){let Y=await this.request({method:"tools/list",params:W},X);return this._excludeInvalidXMcpHeaderTools(Y),Y}let Q=await this._serveFromCache("tools/list",void 0,X);if(Q!==void 0)return Q;return this._listAllPages("tools/list",W,X,(Y,G)=>Y.tools.push(...G.tools),(Y)=>this._excludeInvalidXMcpHeaderTools(Y))}_excludeInvalidXMcpHeaderTools(W){if(this.getProtocolEra()!=="modern"||!this.transport||LH(this.transport)==="stdio")return;let X=W.tools.filter((Q)=>{let Y=YB(Q.inputSchema);if(!Y.valid)return console.warn(`[mcp-sdk] excluding tool '${Q.name}' from tools/list: invalid x-mcp-header declaration \u2014 ${Y.reason}`),!1;return!0});if(X.length!==W.tools.length)W.tools=X}_setupListChangedHandler(W,X,Q,Y){let G=fQ(q4,Q);if(!G.success)throw Error(`Invalid ${W} listChanged options: ${G.error.message}`);if(typeof Q.onChanged!=="function")throw TypeError(`Invalid ${W} listChanged options: onChanged must be a function`);let{autoRefresh:B,debounceMs:F}=G.data,{onChanged:L}=Q,z=async()=>{if(!B){L(null,null);return}try{L(null,await Y())}catch(K){L(K instanceof Error?K:Error(String(K)),null)}},J=()=>{if(F){let K=this._listChangedDebounceTimers.get(W);if(K)clearTimeout(K);let Z=setTimeout(z,F);this._listChangedDebounceTimers.set(W,Z)}else z()};this.setNotificationHandler(X,J)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}},kq=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](W){return a1(this,W)}static isInstance(W){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return a1(this,W)}constructor(W,X,Q){super(`SSE error: ${X}`);this.code=W,this.event=Q,_4(this,new.target)}}});var MH=i1((dq,DH)=>{DH.exports=wH;wH.sync=oj;var NH=w5("fs");function rj(W,X){var Q=X.pathExt!==void 0?X.pathExt:process.env.PATHEXT;if(!Q)return!0;if(Q=Q.split(";"),Q.indexOf("")!==-1)return!0;for(var Y=0;Y<Q.length;Y++){var G=Q[Y].toLowerCase();if(G&&W.substr(-G.length).toLowerCase()===G)return!0}return!1}function VH(W,X,Q){if(!W.isSymbolicLink()&&!W.isFile())return!1;return rj(X,Q)}function wH(W,X,Q){NH.stat(W,function(Y,G){Q(Y,Y?!1:VH(G,W,X))})}function oj(W,X){return VH(NH.statSync(W),W,X)}});var RH=i1((iq,IH)=>{IH.exports=jH;jH.sync=aj;var OH=w5("fs");function jH(W,X,Q){OH.stat(W,function(Y,G){Q(Y,Y?!1:EH(G,X))})}function aj(W,X){return EH(OH.statSync(W),X)}function EH(W,X){return W.isFile()&&sj(W,X)}function sj(W,X){var{mode:Q,uid:Y,gid:G}=W,B=X.uid!==void 0?X.uid:process.getuid&&process.getuid(),F=X.gid!==void 0?X.gid:process.getgid&&process.getgid(),L=parseInt("100",8),z=parseInt("010",8),J=parseInt("001",8),K=L|z,Z=Q&J||Q&z&&G===F||Q&L&&Y===B||Q&K&&B===0;return Z}});var PH=i1((rq,TH)=>{var nq=w5("fs"),nQ;if(process.platform==="win32"||global.TESTING_WINDOWS)nQ=MH();else nQ=RH();TH.exports=NB;NB.sync=tj;function NB(W,X,Q){if(typeof X==="function")Q=X,X={};if(!Q){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(Y,G){NB(W,X||{},function(B,F){if(B)G(B);else Y(F)})})}nQ(W,X||{},function(Y,G){if(Y){if(Y.code==="EACCES"||X&&X.ignoreErrors)Y=null,G=!1}Q(Y,G)})}function tj(W,X){try{return nQ.sync(W,X||{})}catch(Q){if(X&&X.ignoreErrors||Q.code==="EACCES")return!1;else throw Q}}});var yH=i1((oq,vH)=>{var i9=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",SH=w5("path"),ej=i9?";":":",bH=PH(),qH=(W)=>Object.assign(Error(`not found: ${W}`),{code:"ENOENT"}),CH=(W,X)=>{let Q=X.colon||ej,Y=W.match(/\//)||i9&&W.match(/\\/)?[""]:[...i9?[process.cwd()]:[],...(X.path||process.env.PATH||"").split(Q)],G=i9?X.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",B=i9?G.split(Q):[""];if(i9){if(W.indexOf(".")!==-1&&B[0]!=="")B.unshift("")}return{pathEnv:Y,pathExt:B,pathExtExe:G}},kH=(W,X,Q)=>{if(typeof X==="function")Q=X,X={};if(!X)X={};let{pathEnv:Y,pathExt:G,pathExtExe:B}=CH(W,X),F=[],L=(J)=>new Promise((K,Z)=>{if(J===Y.length)return X.all&&F.length?K(F):Z(qH(W));let D=Y[J],I=/^".*"$/.test(D)?D.slice(1,-1):D,A=SH.join(I,W),M=!I&&/^\.[\\\/]/.test(W)?W.slice(0,2)+A:A;K(z(M,J,0))}),z=(J,K,Z)=>new Promise((D,I)=>{if(Z===G.length)return D(L(K+1));let A=G[Z];bH(J+A,{pathExt:B},(M,N)=>{if(!M&&N)if(X.all)F.push(J+A);else return D(J+A);return D(z(J,K,Z+1))})});return Q?L(0).then((J)=>Q(null,J),Q):L(0)},WE=(W,X)=>{X=X||{};let{pathEnv:Q,pathExt:Y,pathExtExe:G}=CH(W,X),B=[];for(let F=0;F<Q.length;F++){let L=Q[F],z=/^".*"$/.test(L)?L.slice(1,-1):L,J=SH.join(z,W),K=!z&&/^\.[\\\/]/.test(W)?W.slice(0,2)+J:J;for(let Z=0;Z<Y.length;Z++){let D=K+Y[Z];try{if(bH.sync(D,{pathExt:G}))if(X.all)B.push(D);else return D}catch(I){}}}if(X.all&&B.length)return B;if(X.nothrow)return null;throw qH(W)};vH.exports=kH;kH.sync=WE});var gH=i1((aq,VB)=>{var _H=(W={})=>{let X=W.env||process.env;if((W.platform||process.platform)!=="win32")return"PATH";return Object.keys(X).reverse().find((Y)=>Y.toUpperCase()==="PATH")||"Path"};VB.exports=_H;VB.exports.default=_H});var uH=i1((sq,hH)=>{var fH=w5("path"),XE=yH(),QE=gH();function xH(W,X){let Q=W.options.env||process.env,Y=process.cwd(),G=W.options.cwd!=null,B=G&&process.chdir!==void 0&&!process.chdir.disabled;if(B)try{process.chdir(W.options.cwd)}catch(L){}let F;try{F=XE.sync(W.command,{path:Q[QE({env:Q})],pathExt:X?fH.delimiter:void 0})}catch(L){}finally{if(B)process.chdir(Y)}if(F)F=fH.resolve(G?W.options.cwd:"",F);return F}function YE(W){return xH(W)||xH(W,!0)}hH.exports=YE});var lH=i1((FE,DB)=>{var wB=/([()\][%!^"`<>&|;, *?])/g;function GE(W){return W=W.replace(wB,"^$1"),W}function BE(W,X){if(W=`${W}`,W=W.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),W=W.replace(/(?=(\\+?)?)\1$/,"$1$1"),W=`"${W}"`,W=W.replace(wB,"^$1"),X)W=W.replace(wB,"^$1");return W}FE.command=GE;FE.argument=BE});var cH=i1((tq,mH)=>{mH.exports=/^#!(.*)/});var dH=i1((eq,pH)=>{var JE=cH();pH.exports=(W="")=>{let X=W.match(JE);if(!X)return null;let[Q,Y]=X[0].replace(/#! ?/,"").split(" "),G=Q.split("/").pop();if(G==="env")return Y;return Y?`${G} ${Y}`:G}});var nH=i1((WC,iH)=>{var MB=w5("fs"),KE=dH();function ZE(W){let Q=Buffer.alloc(150),Y;try{Y=MB.openSync(W,"r"),MB.readSync(Y,Q,0,150,0),MB.closeSync(Y)}catch(G){}return KE(Q.toString())}iH.exports=ZE});var sH=i1((XC,aH)=>{var $E=w5("path"),rH=uH(),oH=lH(),HE=nH(),UE=process.platform==="win32",AE=/\.(?:com|exe)$/i,NE=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function VE(W){W.file=rH(W);let X=W.file&&HE(W.file);if(X)return W.args.unshift(W.file),W.command=X,rH(W);return W.file}function wE(W){if(!UE)return W;let X=VE(W),Q=!AE.test(X);if(W.options.forceShell||Q){let Y=NE.test(X);W.command=$E.normalize(W.command),W.command=oH.command(W.command),W.args=W.args.map((B)=>oH.argument(B,Y));let G=[W.command].concat(W.args).join(" ");W.args=["/d","/s","/c",`"${G}"`],W.command=process.env.comspec||"cmd.exe",W.options.windowsVerbatimArguments=!0}return W}function DE(W,X,Q){if(X&&!Array.isArray(X))Q=X,X=null;X=X?X.slice(0):[],Q=Object.assign({},Q);let Y={command:W,args:X,options:Q,file:void 0,original:{command:W,args:X}};return Q.shell?Y:wE(Y)}aH.exports=DE});var WU=i1((QC,eH)=>{var OB=process.platform==="win32";function jB(W,X){return Object.assign(Error(`${X} ${W.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${X} ${W.command}`,path:W.command,spawnargs:W.args})}function ME(W,X){if(!OB)return;let Q=W.emit;W.emit=function(Y,G){if(Y==="exit"){let B=tH(G,X);if(B)return Q.call(W,"error",B)}return Q.apply(W,arguments)}}function tH(W,X){if(OB&&W===1&&!X.file)return jB(X.original,"spawn");return null}function OE(W,X){if(OB&&W===1&&!X.file)return jB(X.original,"spawnSync");return null}eH.exports={hookChildProcess:ME,verifyENOENT:tH,verifyENOENTSync:OE,notFoundError:jB}});var YU=i1((YC,n9)=>{var XU=w5("child_process"),EB=sH(),IB=WU();function QU(W,X,Q){let Y=EB(W,X,Q),G=XU.spawn(Y.command,Y.args,Y.options);return IB.hookChildProcess(G,Y),G}function jE(W,X,Q){let Y=EB(W,X,Q),G=XU.spawnSync(Y.command,Y.args,Y.options);return G.error=G.error||IB.verifyENOENTSync(G.status,Y),G}n9.exports=QU;n9.exports.spawn=QU;n9.exports.sync=jE;n9.exports._parse=EB;n9.exports._enoent=IB});import RB from"process";import{PassThrough as EE}from"stream";function RE(){let W={};for(let X of IE){let Q=RB.env[X];if(Q===void 0)continue;if(Q.startsWith("()"))continue;W[X]=Q}return W}var GU,IE,BU=class{_process;_readBuffer;_serverParams;_stderrStream=null;onclose;onerror;onmessage;constructor(W){if(this._serverParams=W,this._readBuffer=new FB({maxBufferSize:W.maxBufferSize}),W.stderr==="pipe"||W.stderr==="overlapped")this._stderrStream=new EE}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((W,X)=>{if(this._process=GU.default(this._serverParams.command,this._serverParams.args??[],{env:{...RE(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:RB.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",(Q)=>{X(Q),this.onerror?.(Q)}),this._process.on("spawn",()=>{W()}),this._process.on("close",(Q)=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",(Q)=>{this.onerror?.(Q)}),this._process.stdout?.on("data",(Q)=>{try{this._readBuffer.append(Q),this.processReadBuffer()}catch(Y){this.onerror?.(Y),this.close().catch(()=>{})}}),this._process.stdout?.on("error",(Q)=>{this.onerror?.(Q)}),this._stderrStream&&this._process.stderr)this._process.stderr.pipe(this._stderrStream)})}get stderr(){if(this._stderrStream)return this._stderrStream;return this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;this.onmessage?.(W)}catch(W){this.onerror?.(W)}}async _dispose(){let W=this._process;if(this._process=void 0,W&&W.exitCode===null&&W.signalCode===null){let X=new Promise((Q)=>W.once("exit",()=>Q()));try{W.stdin?.end()}catch{}try{W.kill("SIGTERM")}catch{}if(await Promise.race([X,new Promise((Q)=>setTimeout(Q,1000).unref())]),W.exitCode===null&&W.signalCode===null)try{W.kill("SIGKILL")}catch{}await X}try{W?.stdout?.destroy()}catch{}try{W?.stdin?.destroy()}catch{}try{W?.stderr?.destroy()}catch{}this._readBuffer.clear()}async close(){if(this._process){let W=this._process;this._process=void 0;let X=new Promise((Q)=>{W.once("close",()=>{Q()})});try{W.stdin?.end()}catch{}if(await Promise.race([X,new Promise((Q)=>setTimeout(Q,2000).unref())]),W.exitCode===null){try{W.kill("SIGTERM")}catch{}await Promise.race([X,new Promise((Q)=>setTimeout(Q,2000).unref())])}if(W.exitCode===null)try{W.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(W){return new Promise((X)=>{if(!this._process?.stdin)throw new U0(A0.NotConnected,"Not connected");let Q=LB(W);if(this._process.stdin.write(Q))X();else this._process.stdin.once("drain",X)})}};var FU=H0(()=>{zB();GU=BA(YU(),1),IE=RB.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"]});async function u6(W,X,Q){let Y=new UH({name:"ast-mcp",version:"1.0.0"}),G=new BU({args:["mcp"],command:z4,cwd:Q});try{return await Y.connect(G),await Y.callTool({arguments:X,name:W})}finally{try{await Y.close()}catch{}}}var LU;var AX=H0(()=>{AH();FU();LW();LW();LU=["map","digest","show","implements","surface","deps","reverse_deps","cycles","graph","search","find_related","index","callers","callees","trace","impact","context","run","squeeze"]});function e6(W){let X=W.content.filter((Q)=>Q.type==="text"&&typeof Q.text==="string").map((Q)=>Q.text).join(`
224
+ `);if(W.isError)throw Error(X||"ast-bro MCP call failed");if(!X)throw Error("ast-bro MCP returned no JSON text");try{return JSON.parse(X)}catch(Q){throw Error(`Invalid ast-bro MCP JSON: ${X}`,{cause:Q})}}function TB(W){let X=e6(W);return[...new Set((X.matches??[]).map((Q)=>Q.file).filter((Q)=>typeof Q==="string"))]}function zU(W){let X=e6(W);return[...new Set((X.files??[]).filter((Q)=>Q.status==="rewritten").map((Q)=>Q.file).filter((Q)=>typeof Q==="string"))]}var KU;var JU=H0(()=>{KU={callees:{description:"What does this symbol call? \u2014 AST-accurate forward call traversal. Suffix-matches the target like `callers`. Unresolved/external callees shown by default (tagged cyan/red). Returns text by default; set `json: true` for `ast-bro.callees.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_external:{description:"Drop unresolved/external callees. Default: false (shown with [unresolved]/[external] tags).",type:"boolean"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},callers:{description:"Find callers of a symbol \u2014 AST-accurate, no grep noise. Suffix-matches the target like `show`/`implements`: `TakeDamage`, or `Type.method` when ambiguous. Ambiguous matches shown by default (tagged red). Returns text by default; set `json: true` for `ast-bro.callers.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 1).",minimum:1,type:"integer"},hide_ambiguous:{description:"Drop callers with multiple candidates. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},target:{description:"Symbol name to look up.",type:"string"}},required:["target"],type:"object"}},context:{description:"Token-budgeted context for a symbol \u2014 target body + direct callees (bodies) + callers/transitive (signatures), greedily packed into a caller-supplied token budget. Replaces chains of 4\u20135 `show`/`callers`/`callees` calls with ONE context-aware payload. Budget degrades gracefully from full bodies to signatures only. Returns text by default; set `json: true` for `ast-bro.context.v1`.",inputSchema:{properties:{budget:{description:"Token budget (default 8000). ~4 bytes per token rough.",minimum:100,type:"integer"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to build context for (same form as callers).",type:"string"}},required:["target"],type:"object"}},cycles:{description:"Find import cycles via Tarjan SCC. Returns the list of strongly-connected components with `len > 1` (or singletons with self-edges). Returns text by default; set `json: true` for `ast-bro.cycles.v1`. Exits non-zero when cycles exist (useful for CI gates).",inputSchema:{properties:{json:{type:"boolean"},min_size:{description:"Drop SCCs smaller than this (default 2).",minimum:1,type:"integer"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},deps:{description:"Forward import-graph traversal: what does this file import (transitively)? Builds a per-repo dep graph at `.ast-bro/deps/graph.bin` on first call, then reuses it. Returns text by default; set `json: true` for `ast-bro.deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose imports to follow.",type:"string"},hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{type:"boolean"},rebuild:{description:"Drop the cached graph and rebuild.",type:"boolean"}},required:["file"],type:"object"}},digest:{description:"One-page module map for an unfamiliar directory: every file's types and public methods. Returns text by default; set `json: true` for `ast-bro.map.v1`.",inputSchema:{properties:{include_fields:{type:"boolean"},include_private:{type:"boolean"},json:{type:"boolean"},max_members:{description:"Cap members per type (default 50).",type:"integer"},paths:{description:"Files or directories to digest.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},find_related:{description:"Find chunks semantically similar to a given file:line. Useful for navigating to related code. Returns text by default; set `json: true` for `ast-bro.related.v1`.",inputSchema:{properties:{json:{type:"boolean"},line:{description:"1-indexed line within `path`.",minimum:1,type:"integer"},path:{description:"Repo-relative path of the source chunk.",type:"string"},root:{description:'Repo root containing the index (default ".").',type:"string"},top_k:{description:"Max results (default 10).",minimum:1,type:"integer"}},required:["path","line"],type:"object"}},graph:{description:"Emit the file-level dependency graph. Unresolved external imports shown by default (tagged `[external]`). Returns text by default; set `json: true` for `ast-bro.graph.v1`.",inputSchema:{properties:{hide_external:{description:"Drop unresolved imports. Default: false (shown with [external] tag).",type:"boolean"},json:{description:"Return JSON (schema `ast-bro.graph.v1`) instead of text.",type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"}},type:"object"}},impact:{description:"Cross-file impact analysis: callers + callees + file reverse-deps + test detection in one call. Answers 'what would break if I change X?' and 'how wide is the blast radius?' in one shot. Four modes: `deps` (what it calls/imports), `dependents` (who calls/imports it), `tests` (affected tests only), `all` (default). Returns text by default; set `json: true` for `ast-bro.impact.v1`.",inputSchema:{properties:{depth:{description:"Transitive depth (default 2).",minimum:1,type:"integer"},exclude_tests:{description:"Exclude test files from output.",type:"boolean"},hide_ambiguous:{description:"Drop ambiguous call-edge matches. Default: false (shown with Ambiguous tag).",type:"boolean"},json:{type:"boolean"},limit:{description:"Result cap per section (default 200).",minimum:1,type:"integer"},mode:{description:"Section: 'deps', 'dependents', 'tests', or 'all' (default).",enum:["deps","dependents","tests","all"],type:"string"},path:{description:'Repo root (default ".").',type:"string"},target:{description:"Symbol to analyse (e.g. 'handleRequest', 'Player.TakeDamage', 'src/Player.cs:TakeDamage').",type:"string"},tests:{description:"Show only test files.",type:"boolean"}},required:["target"],type:"object"}},implements:{description:"Find subclasses / implementations of a type using AST matching. Transitive by default \u2014 set `direct: true` for level-1 only. Returns text by default; set `json: true` for `ast-bro.implements.v1`.",inputSchema:{properties:{direct:{description:"Direct subtypes only (skip transitive).",type:"boolean"},json:{type:"boolean"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},target:{description:"Type name to look up.",type:"string"}},required:["target","paths"],type:"object"}},index:{description:"Build, refresh, or inspect the per-repo search index. With `stats: true` returns index stats. With `rebuild: true` drops the cache and rebuilds. Otherwise just opens (and incrementally refreshes if files changed). Returns text by default; set `json: true` for `ast-bro.index-stats.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{description:"Drop existing cache and rebuild.",type:"boolean"},stats:{description:"Print index stats and return.",type:"boolean"}},type:"object"}},map:{description:"AST-based structural map of source files \u2014 signatures with line ranges, no method bodies. Returns text by default (5\u201310\xD7 smaller than reading the file). Set `json: true` for the machine-readable schema `ast-bro.map.v1`.",inputSchema:{properties:{glob:{description:"Glob filter applied during directory walk.",type:"string"},json:{description:"Return JSON (schema `ast-bro.map.v1`) instead of text.",type:"boolean"},no_attrs:{description:"Hide attributes / decorators.",type:"boolean"},no_docs:{description:"Hide doc comments.",type:"boolean"},no_fields:{description:"Hide field declarations.",type:"boolean"},no_lines:{description:"Hide line-range suffixes.",type:"boolean"},no_private:{description:"Hide private declarations.",type:"boolean"},paths:{description:"Files or directories to map.",items:{type:"string"},minItems:1,type:"array"}},required:["paths"],type:"object"}},reverse_deps:{description:"Reverse import-graph: who imports this file (transitively)? Useful for refactor blast-radius assessment. Returns text by default; set `json: true` for `ast-bro.reverse-deps.v1`.",inputSchema:{properties:{depth:{description:"Max BFS depth (default 3).",minimum:1,type:"integer"},file:{description:"Path to the file whose importers to find.",type:"string"},json:{type:"boolean"},limit:{description:"Cap result count (default 200).",minimum:1,type:"integer"},rebuild:{type:"boolean"}},required:["file"],type:"object"}},run:{description:"AST-aware pattern search and rewrite. Use metavariables like $FUNC, $ARG, $$$BODY for structural matching. Search-only without rewrite; transform code with rewrite and write. WARNING: `write: true` mutates files on disk \u2014 a broad pattern can touch many files at once (capped at 50 per call). Always preview with the default dry-run first and confirm the diff before re-running with `write: true`. Returns text by default; set `json: true` for `ast-bro.run.v1`.",inputSchema:{properties:{glob:{description:"Glob pattern to filter files, e.g. '**/*.rs'.",type:"string"},json:{description:"Return results as JSON instead of text.",type:"boolean"},lang:{description:"Language (auto-detected from file paths if omitted).",type:"string"},paths:{description:"Files or directories to search.",items:{type:"string"},minItems:1,type:"array"},pattern:{description:"AST pattern with metavariables (e.g. '$FUNC($$$)').",type:"string"},rewrite:{description:"Replacement template (e.g. 'bar($A)'). Omit for search-only.",type:"string"},write:{description:"Write changes to disk. Default: false (dry-run). DANGEROUS: mutates files; preview the dry-run diff first and confirm before flipping to true.",type:"boolean"}},required:["pattern"],type:"object"}},search:{description:"Hybrid BM25 + dense semantic search over the repo. First call builds a per-repo index at `.ast-bro/index/` (one-time, ~seconds for typical repos). Returns text by default; set `json: true` for `ast-bro.search.v1`.",inputSchema:{properties:{alpha:{description:"Override semantic-vs-BM25 weight (0.0=pure BM25, 1.0=pure semantic). Default auto-detects from query type.",type:"number"},json:{description:"Return JSON (schema `ast-bro.search.v1`) instead of text.",type:"boolean"},languages:{description:'Restrict to chunks of these languages (e.g. ["rust", "python"]).',items:{type:"string"},type:"array"},path:{description:'Repo root to search in (default ".").',type:"string"},query:{description:"Search query (free-form text or symbol name).",type:"string"},top_k:{description:"Max results to return (default 10).",minimum:1,type:"integer"}},required:["query"],type:"object"}},show:{description:"Extract source of one or more symbols from a single file. Suffix matching: `TakeDamage`, or `Player.TakeDamage` when ambiguous. For markdown the symbol is a heading. Returns text by default; set `json: true` for `ast-bro.show.v1`.",inputSchema:{properties:{json:{type:"boolean"},path:{description:"File to search.",type:"string"},symbols:{description:"One or more symbol names to extract.",items:{type:"string"},minItems:1,type:"array"}},required:["path","symbols"],type:"object"}},squeeze:{description:"Compress repetitive log/text with a reversible legend (logs, not code).",inputSchema:{properties:{end:{description:"1-indexed inclusive end line of the slice.",minimum:1,type:"integer"},json:{description:"Return JSON (schema `ast-bro.squeeze.v1`) instead of text.",type:"boolean"},path:{description:"Path to the log/text file to read.",type:"string"},raw:{description:"Skip compression and emit the raw text.",type:"boolean"},start:{description:"1-indexed inclusive start line of the slice.",minimum:1,type:"integer"}},required:["path"],type:"object"}},surface:{description:"True public API surface \u2014 resolves `pub use` re-exports (Rust) and `__all__` (Python) to compute exactly what a downstream user sees, not just every `pub`/non-underscore item per file. Falls back to visibility-filtered output for Java/C#/Go/Kotlin (no real re-export concept). Returns text by default; set `json: true` for `ast-bro.surface.v1`.",inputSchema:{properties:{include_chain:{description:"Append the via-chain on each entry (text mode only).",type:"boolean"},include_private:{description:"Include private items \u2014 only meaningful for the fallback resolver.",type:"boolean"},json:{type:"boolean"},lang:{description:"Force a resolver: `rust`, `python`, or `fallback`.",type:"string"},max_depth:{description:"Recursion guard for re-export chains (default 16).",type:"integer"},path:{description:'Crate root file, package init, or directory to auto-detect (default ".").',type:"string"},tree:{description:"Render as a hierarchical tree grouped by module.",type:"boolean"}},type:"object"}},trace:{description:"Trace the static call path between two symbols \u2014 \"how does <from> reach <to>?\". Shortest-path BFS over the call graph with each hop's source body inlined, so a flow question (e.g. request\u2192handler, update\u2192render) is answered in ONE call instead of chaining `callers`/`callees`. If no static path exists the chain broke at dynamic dispatch \u2014 the response inlines both endpoints plus the target file's sibling callables. Targets are suffix-matched like `callers`. Returns text by default; set `json: true` for `ast-bro.trace.v1`.",inputSchema:{properties:{depth:{description:"Max path length in hops (default 12).",minimum:1,type:"integer"},from:{description:"Source symbol \u2014 where the path starts.",type:"string"},json:{type:"boolean"},path:{description:'Repo root (default ".").',type:"string"},rebuild:{type:"boolean"},to:{description:"Destination symbol \u2014 where the path should reach.",type:"string"}},required:["from","to"],type:"object"}}}});import{randomUUID as PE}from"crypto";import{chmod as SE,rename as bE,unlink as qE,writeFile as CE}from"fs/promises";import rQ from"path";async function ZU(W,X,Q){let Y=rQ.extname(W),G=rQ.join(rQ.dirname(W),`${rQ.basename(W,Y)}.ast-mcp-restore-${PE()}${Y}`);try{await CE(G,X,{encoding:"utf8",flag:"wx",mode:Q}),await SE(G,Q),await bE(G,W)}finally{await qE(G).catch(()=>{return})}}var $U=()=>{};import{execFile as kE}from"child_process";function HU(W,X,Q){return new Promise((Y,G)=>{kE(W,X,{encoding:"utf8",maxBuffer:16777216,timeout:30000},(F,L,z)=>{if(F)G(Error(`${W} failed: ${(z||L||F.message).trim()}`,{cause:F}));else Y({stderr:z,stdout:L})}).stdin?.end(Q)})}var UU=()=>{};import{randomUUID as vE}from"crypto";import{chmod as yE,lstat as _E,readFile as AU,rename as gE,unlink as fE,writeFile as xE}from"fs/promises";import r9 from"path";async function NX(W,X){return(await HU(hE,["fmt","--config",lE,"--stdin",r9.basename(W)],X)).stdout}async function NU(W){await NX(W,await AU(W,"utf8"))}async function VU(W){let X=await _E(W),Q=await NX(W,await AU(W,"utf8")),Y=r9.extname(W),G=r9.join(r9.dirname(W),`${r9.basename(W,Y)}.ast-mcp-format-${vE()}${Y}`);try{await xE(G,Q,{encoding:"utf8",flag:"wx",mode:X.mode}),await yE(G,X.mode),await gE(G,W)}finally{await fE(G).catch(()=>{return})}}var hE,uE,lE;var PB=H0(async()=>{UU();({DPRINT_BINARY:hE,PACKAGE_ROOT:uE}=await Promise.resolve().then(() => (LW(),aB))),lE=process.env.AST_MCP_DPRINT_CONFIG??r9.join(uE,"dprint.json")});import{createHash as wU}from"crypto";import{createReadStream as mE}from"fs";function y1(W){return wU("sha256").update(W).digest("hex")}async function SB(W){let X=wU("sha256");for await(let Q of mE(W))X.update(Q);return X.digest("hex")}var o9=()=>{};import{lstat as cE,open as pE,rm as dE}from"fs/promises";import oQ from"path";async function iE(W){let X=oQ.dirname(W),Q=X;while(!0)try{if(!(await cE(Q)).isDirectory())throw Error(`Lock parent is not a directory: ${Q}`);break}catch(G){if(G.code!=="ENOENT")throw G;let B=oQ.dirname(Q);if(B===Q)throw G;Q=B}let Y=Q===X?`.${oQ.basename(W)}.ast-mcp.lock`:`.${y1(W).slice(0,24)}.ast-mcp.lock`;return oQ.join(Q,Y)}async function nE(W){let X=await iE(W);while(!0)try{return await(await pE(X,"wx")).close(),()=>dE(X,{force:!0})}catch(Q){if(Q.code!=="EEXIST")throw Q;await new Promise((Y)=>setTimeout(Y,10))}}async function rE(W,X){let Q=aQ.get(W)??Promise.resolve(),Y,G=new Promise((F)=>{Y=F}),B=Q.then(()=>G);aQ.set(W,B),await Q;try{return await X()}finally{if(Y(),aQ.get(W)===B)aQ.delete(W)}}async function sQ(W,X){return rE(W,async()=>{let Q=await nE(W);try{return await X()}finally{await Q()}})}async function a9(W,X){let Q=[...new Set(W)].sort(),Y=async(G)=>G===Q.length?X():sQ(Q[G],()=>Y(G+1));return Y(0)}var aQ;var VX=H0(()=>{o9();aQ=new Map});import{lstat as oE,realpath as bB}from"fs/promises";import l6 from"path";function aE(){return(process.env.AST_MCP_ROOTS?.split(l6.delimiter).filter(Boolean)??[process.cwd()]).map((W)=>l6.resolve(W))}function qB(W,X){let Q=l6.relative(W,X);return Q===""||!Q.startsWith("..")&&!l6.isAbsolute(Q)}async function CB(){let W=await bB(process.cwd()).catch(()=>process.cwd()),X=await Promise.all(aE().map(async(Q)=>bB(Q).catch(()=>Q)));if(process.env.AST_MCP_ALLOW_EXTERNAL_ROOTS!=="1"&&X.some((Q)=>!qB(W,Q)))throw Error("AST_MCP_ROOTS contains a root outside the server working directory; set AST_MCP_ALLOW_EXTERNAL_ROOTS=1 to opt in");return X}async function DU(){return(await CB())[0]}async function MU(W){let X=(await CB()).find((Q)=>qB(Q,W));if(!X)throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);return X}async function s1(W){let X=await CB(),Q=l6.isAbsolute(W)?W:l6.resolve(X[0],W),Y=l6.dirname(Q),G=[];while(!0)try{Y=await bB(Y);break}catch(F){if(F.code!=="ENOENT")throw F;let L=l6.dirname(Y);if(L===Y)throw F;G.unshift(l6.basename(Y)),Y=L}let B=l6.join(Y,...G,l6.basename(Q));if(!X.some((F)=>qB(F,B)))throw Error(`Path is outside AST_MCP_ROOTS: ${W}`);if((await oE(B).catch(()=>{return}))?.isSymbolicLink())throw Error(`Symbolic-link targets are not writable: ${W}`);return B}var s9=()=>{};import{lstat as sE,readFile as tE}from"fs/promises";import OU from"path";function eE(W){return{"~standard":{jsonSchema:{input:()=>W,output:()=>({type:"object"})},validate(X){return X!==null&&typeof X==="object"&&!Array.isArray(X)?{value:X}:{issues:[{message:"Expected an object"}]}},vendor:"ast-mcp",version:1}}}async function t9(W,X){return s1(OU.isAbsolute(X)?X:OU.resolve(W,X))}async function XI(W,X){for(let Q of WI){let Y=W[Q];if(typeof Y==="string")await t9(X,Y)}if(!Array.isArray(W.paths))return;for(let Q of W.paths)if(typeof Q==="string")await t9(X,Q)}async function QI(W,X){let Q=Array.isArray(W.paths)?W.paths.filter((L)=>typeof L==="string"):[];for(let L of Q.length?Q:[X])await t9(X,L);if(W.write!==!0||typeof W.rewrite!=="string")return u6("run",W,X);let Y={json:!0,paths:W.paths,pattern:W.pattern};for(let L of["glob","lang"])if(W[L]!==void 0)Y[L]=W[L];let G=await u6("run",Y,X);if(e6(G).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let F=await Promise.all(TB(G).map((L)=>t9(X,L)));return a9(F,async()=>{let L=await u6("run",Y,X);if(e6(L).capped)throw Error("ast-bro run preview was capped; narrow paths or pattern before writing");let J=await Promise.all(TB(L).map((I)=>t9(X,I)));if(F.length!==J.length||F.some((I,A)=>I!==J[A]))throw Error("ast-bro run targets changed while waiting for the write lock; preview again");let K=new Map;for(let I of J)await NU(I),K.set(I,{content:await tE(I,"utf8"),mode:(await sE(I)).mode});let Z=await u6("run",{...W,json:!0},X),D=await Promise.all(zU(Z).map((I)=>t9(X,I)));try{for(let I of D)await VU(I)}catch(I){for(let A of D){let M=K.get(A);if(M)await ZU(A,M.content,M.mode)}throw I}return Z})}function kB(W){for(let X of LU){let Q=KU[X];W.registerTool(X,{description:X==="run"?"AST structural search and rewrite. Use for bounded inspection and previews; direct write is a lower-level escape hatch for exceptional cases. Normal agent edits belong in keyed file_patch, which supports ordered AST rules and Aider blocks.":Q.description,inputSchema:eE(Q.inputSchema),title:`ast-bro ${X}`},async(Y)=>{try{let G=await DU();return await XI(Y,G),X==="run"?await QI(Y,G):await u6(X,Y,G)}catch(G){return{content:[{text:G instanceof Error?G.message:String(G),type:"text"}],isError:!0}}})}}var WI;var jU=H0(async()=>{AX();JU();$U();VX();s9();await PB();WI=["file","path","root"]});import YI from"path";async function e9(W,X){if(!X)return!1;let Q=Bun.spawn([z4,"map","--json",W],{cwd:YI.dirname(W),stderr:"pipe",stdout:"pipe"}),[Y,G,B]=await Promise.all([Q.exited,new Response(Q.stdout).text(),new Response(Q.stderr).text()]),F=B.trim()||`ast-bro map exited ${Y}`;if(Y!==0)throw Error(F);return(JSON.parse(G).files??[]).find((J)=>J.path===W)?.error_count===0}var tQ=H0(()=>{AX()});async function vB(W,X){if(X==="markdown")return!1;return e9(W,X)}var EU=H0(()=>{tQ()});import{chmod as IU,chown as RU,lstat as GI}from"fs/promises";function BI(W){if(!W)return;if(W.chmod!==void 0&&(!Number.isInteger(W.chmod)||W.chmod<0||W.chmod>511))throw Error("chmod must be an integer between 0 and 0o777");if(W.chown&&(!Number.isInteger(W.chown.uid)||W.chown.uid<0||!Number.isInteger(W.chown.gid)||W.chown.gid<0))throw Error("chown uid and gid must be non-negative integers");let X=process.getuid?.(),Q=process.getgid?.();if(W.chown&&(X===void 0||Q===void 0||W.chown.uid!==X||W.chown.gid!==Q))throw Error("chown may only preserve the server process owner");return W}async function WY(W,X){let Q=BI(X),Y=await eQ(W);if(!Q)return Y;try{if(Q.chown)await RU(W,Q.chown.uid,Q.chown.gid);if(Q.chmod!==void 0)await IU(W,Q.chmod)}catch(G){throw await RU(W,Y.chown.uid,Y.chown.gid).catch(()=>{return}),await IU(W,Y.chmod).catch(()=>{return}),G}return eQ(W)}async function eQ(W){let X=await GI(W);return{chmod:X.mode&511,chown:{gid:X.gid,uid:X.uid}}}var yB=()=>{};import FI from"path";function g4(W){return LI[FI.extname(W).toLowerCase()]}var LI;var XY=H0(()=>{LI={".cc":"cpp",".cjs":"javascript",".cpp":"cpp",".cs":"csharp",".cxx":"cpp",".ddl":"sql",".dml":"sql",".go":"go",".hh":"cpp",".hpp":"cpp",".java":"java",".js":"javascript",".jsx":"javascript",".kt":"kotlin",".kts":"kotlin",".markdown":"markdown",".md":"markdown",".mdown":"markdown",".mdx":"markdown",".mjs":"javascript",".php":"php",".py":"python",".pyi":"python",".rb":"ruby",".rs":"rust",".scala":"scala",".sql":"sql",".ts":"typescript",".tsx":"tsx"}});import{createReadStream as zI}from"fs";import{stat as TU}from"fs/promises";async function PU(W,X){let Q=Array(W.length),Y=0;return await Promise.all(Array.from({length:Math.min(4,W.length)},async()=>{while(Y<W.length){let G=Y;Y+=1,Q[G]=await X(W[G])}})),Q}function KI(W){let[X,Q]=W.lines??JI,Y=W.maxBytes??WW;if(!Number.isInteger(X)||X<0)throw Error("file_read line start must be a non-negative integer");if(!Number.isInteger(Q)||Q<=X)throw Error("file_read line end must be greater than line start");if(Q-X>QY)throw Error(`file_read line ranges are capped at ${QY} lines`);if(!Number.isInteger(Y)||Y<1||Y>WW)throw Error(`file_read maxBytes must be between 1 and ${WW}`);return{lines:[X,Q],maxBytes:Y}}async function ZI(W,X,Q,Y){let[G,B]=Q,F=[],L=0,z=0,J=!1,K=!1,Z=zI(W);try{W:for await(let A of Z){let M=Buffer.isBuffer(A)?A:Buffer.from(A),N=0;while(N<M.length){let $=M.indexOf(10,N),V=$<0?M.length:$+1;if(z>=G&&z<B){let U=Y-L,O=V-N;if(O>U){if(U>0)F.push(M.subarray(N,N+U)),L+=U;K=!0,J=!0;break W}if(O>0)F.push(M.subarray(N,V)),L+=O}if(N=V,$>=0){if(z+=1,z>=B){J=N<M.length;break W}}else break}}}finally{Z.destroy()}let D=Buffer.concat(F,L),I=0;for(let A of D)if(A===10)I+=1;if(D.length>0&&D.at(-1)!==10)I+=1;return{content:D.toString("utf8"),hasMore:K||J||Z.bytesRead<X,lines:{requested:Q,returned:[G,G+I]},truncated:K}}async function $I(W){let X=await s1(W),Q=await TU(X);if(!Q.isFile())throw Error(`Not a regular file: ${W}`);return{filePath:X,sha256:await SB(X),size:Q.size}}async function SU(W){if(W.length<1||W.length>L1)throw Error(`file_hash requires between 1 and ${L1} paths`);return PU(W,$I)}async function HI(W){let X=await s1(W.filePath),Q=g4(X);if(await e9(X,Q))throw Error("REJECTED: AST-capable files must use map, show, search, context, or run; use file_hash when only SHA-256 is required");let Y=await TU(X);if(!Y.isFile())throw Error(`Not a regular file: ${W.filePath}`);let{lines:G,maxBytes:B}=KI(W),[F,L]=await Promise.all([ZI(X,Y.size,G,B),SB(X)]);return{...F,filePath:X,sha256:L,size:Y.size}}async function bU(W){if(W.length<1||W.length>L1)throw Error(`file_read requires between 1 and ${L1} files`);return PU(W,HI)}var JI,L1=50,WW=1048576,QY=1000;var YY=H0(()=>{tQ();XY();o9();s9();JI=[0,100]});class XW{start1;start2;diffs=[];length1=0;length2=0;constructor(W,X){this.start1=W,this.start2=X}clone(){let W=new XW(this.start1,this.start2);return W.diffs=this.diffs.map((X)=>[...X]),W.length1=this.length1,W.length2=this.length2,W}toString(){let W=qU(this.start1,this.length1),X=qU(this.start2,this.length2),Q=[`@@ -${W} +${X} @@
225
+ `];for(let Y of this.diffs){let G=UI[Y[0]];Q.push(G+encodeURI(Y[1])+`
226
+ `)}return Q.join("").replace(/%20/g," ")}}class _B{Diff_Timeout=1;Diff_EditCost=4;Match_Threshold=0.5;Match_Distance=1000;Patch_DeleteThreshold=0.5;Patch_Margin=4;Match_MaxBits=32;whitespaceRegex=/\s/;linebreakRegex=/\r\n/;blanklineEndRegex=/\n\r?\n$/;blanklineStartRegex=/^\r?\n\r?\n/;diff_main(W,X,Q,Y){if(typeof Y>"u")if(this.Diff_Timeout<=0)Y=Number.MAX_VALUE;else Y=new Date().getTime()+this.Diff_Timeout*1000;let G=Y;if(W==null||X==null)throw Error("Null input. (diff_main)");if(W===X){if(W)return[[B0.Equal,W]];return[]}if(typeof Q>"u")Q=!0;let B=Q,F=this.diff_commonPrefix(W,X),L=W.substring(0,F);W=W.substring(F),X=X.substring(F),F=this.diff_commonSuffix(W,X);let z=W.substring(W.length-F);W=W.substring(0,W.length-F),X=X.substring(0,X.length-F);let J=this.diff_compute_(W,X,B,G);if(L)J.unshift([B0.Equal,L]);if(z)J.push([B0.Equal,z]);return this.diff_cleanupMerge(J),J}diff_cleanupSemantic(W){let X=!1,Q=[],Y=0,G=null,B=0,F=0,L=0,z=0,J=0;while(B<W.length){if(W[B][0]===B0.Equal)Q[Y++]=B,F=z,L=J,z=0,J=0,G=W[B][1];else{if(W[B][0]===B0.Insert)z+=W[B][1].length;else J+=W[B][1].length;if(G&&G.length<=Math.max(F,L)&&G.length<=Math.max(z,J))W.splice(Q[Y-1],0,[B0.Delete,G]),W[Q[Y-1]+1][0]=B0.Insert,Y--,Y--,B=Y>0?Q[Y-1]:-1,F=0,L=0,z=0,J=0,G=null,X=!0}B++}if(X)this.diff_cleanupMerge(W);this.diff_cleanupSemanticLossless(W),B=1;while(B<W.length){if(W[B-1][0]===B0.Delete&&W[B][0]===B0.Insert){let K=W[B-1][1],Z=W[B][1],D=this.diff_commonOverlap_(K,Z),I=this.diff_commonOverlap_(Z,K);if(D>=I){if(D>=K.length/2||D>=Z.length/2)W.splice(B,0,[B0.Equal,Z.substring(0,D)]),W[B-1][1]=K.substring(0,K.length-D),W[B+1][1]=Z.substring(D),B++}else if(I>=K.length/2||I>=Z.length/2)W.splice(B,0,[B0.Equal,K.substring(0,I)]),W[B-1][0]=B0.Insert,W[B-1][1]=Z.substring(0,Z.length-I),W[B+1][0]=B0.Delete,W[B+1][1]=K.substring(I),B++;B++}B++}}diff_cleanupEfficiency(W){let X=!1,Q=[],Y=0,G=null,B=0,F=!1,L=!1,z=!1,J=!1;while(B<W.length){if(W[B][0]===B0.Equal){if(W[B][1].length<this.Diff_EditCost&&(z||J))Q[Y++]=B,F=z,L=J,G=W[B][1];else Y=0,G=null;z=J=!1}else{if(W[B][0]===B0.Delete)J=!0;else z=!0;if(G&&(F&&L&&z&&J||G.length<this.Diff_EditCost/2&&(F?1:0)+(L?1:0)+(z?1:0)+(J?1:0)===3)){if(W.splice(Q[Y-1],0,[B0.Delete,G]),W[Q[Y-1]+1][0]=B0.Insert,Y--,G=null,F&&L)z=J=!0,Y=0;else Y--,B=Y>0?Q[Y-1]:-1,z=J=!1;X=!0}}B++}if(X)this.diff_cleanupMerge(W)}diff_prettyHtml(W){let X=[],Q=/&/g,Y=/</g,G=/>/g,B=/\n/g;for(let F=0;F<W.length;F++){let L=W[F][0],J=W[F][1].replace(Q,"&amp;").replace(Y,"&lt;").replace(G,"&gt;").replace(B,"&para;<br>");switch(L){case B0.Insert:X[F]='<ins style="background:#e6ffe6;">'+J+"</ins>";break;case B0.Delete:X[F]='<del style="background:#ffe6e6;">'+J+"</del>";break;case B0.Equal:X[F]="<span>"+J+"</span>";break}}return X.join("")}diff_levenshtein(W){let X=0,Q=0,Y=0;for(let G of W){let B=G[0],F=G[1];switch(B){case B0.Insert:Q+=F.length;break;case B0.Delete:Y+=F.length;break;case B0.Equal:X+=Math.max(Q,Y),Q=0,Y=0;break}}return X+=Math.max(Q,Y),X}patch_make(W,X,Q){let Y,G;if(typeof W==="string"&&typeof X==="string"&&typeof Q>"u"){if(Y=W,G=this.diff_main(Y,X,!0),G.length>2)this.diff_cleanupSemantic(G),this.diff_cleanupEfficiency(G)}else if(W&&typeof W==="object"&&typeof X>"u"&&typeof Q>"u")G=W,Y=this.diff_text1(G);else if(typeof W==="string"&&X&&typeof X==="object"&&typeof Q>"u")Y=W,G=X;else if(typeof W==="string"&&typeof X==="string"&&Q&&typeof Q==="object")Y=W,G=Q;else throw Error("Unknown call format to patch_make.");if(G.length===0)return[];let B=[],F=new XW(0,0),L=0,z=0,J=0,K=Y,Z=Y;for(let D=0;D<G.length;D++){let I=G[D][0],A=G[D][1];if(!L&&I!==B0.Equal)F.start1=z,F.start2=J;switch(I){case B0.Insert:F.diffs[L++]=G[D],F.length2+=A.length,Z=Z.substring(0,J)+A+Z.substring(J);break;case B0.Delete:F.length1+=A.length,F.diffs[L++]=G[D],Z=Z.substring(0,J)+Z.substring(J+A.length);break;case B0.Equal:if(A.length<=2*this.Patch_Margin&&L&&G.length!==D+1)F.diffs[L++]=G[D],F.length1+=A.length,F.length2+=A.length;else if(A.length>=2*this.Patch_Margin){if(L)this.patch_addContext_(F,K),B.push(F),F=new XW(0,0),L=0,K=Z,z=J}break}if(I!==B0.Insert)z+=A.length;if(I!==B0.Delete)J+=A.length}if(L)this.patch_addContext_(F,K),B.push(F);return B}patch_apply(W,X){if(W.length===0)return[X,[]];W=this.patch_deepCopy(W);let Q=this.patch_addPadding(W);X=Q+X+Q,this.patch_splitMax(W);let Y=0,G=[];for(let B=0;B<W.length;B++){let F=W[B].start2+Y,L=this.diff_text1(W[B].diffs),z,J=-1;if(L.length>this.Match_MaxBits){if(z=this.match_main(X,L.substring(0,this.Match_MaxBits),F),z!==-1){if(J=this.match_main(X,L.substring(L.length-this.Match_MaxBits),F+L.length-this.Match_MaxBits),J===-1||z>=J)z=-1}}else z=this.match_main(X,L,F);if(z===-1)G[B]=!1,Y-=W[B].length2-W[B].length1;else{G[B]=!0,Y=z-F;let K;if(J===-1)K=X.substring(z,z+L.length);else K=X.substring(z,J+this.Match_MaxBits);if(L===K)X=X.substring(0,z)+this.diff_text2(W[B].diffs)+X.substring(z+L.length);else{let Z=this.diff_main(L,K,!1);if(L.length>this.Match_MaxBits&&this.diff_levenshtein(Z)/L.length>this.Patch_DeleteThreshold)G[B]=!1;else{this.diff_cleanupSemanticLossless(Z);let D=0,I;for(let A of W[B].diffs){if(A[0]!==B0.Equal){if(I=this.diff_xIndex(Z,D),A[0]===B0.Insert)X=X.substring(0,z+I)+A[1]+X.substring(z+I);else if(A[0]===B0.Delete)X=X.substring(0,z+I)+X.substring(z+this.diff_xIndex(Z,D+A[1].length))}if(A[0]!==B0.Delete)D+=A[1].length}}}}}return X=X.substring(Q.length,X.length-Q.length),[X,G]}patch_toText(W){let X=[];for(let Q=0;Q<W.length;Q++)X[Q]=W[Q];return X.join("")}patch_fromText(W){let X=[];if(!W)return X;let Q=W.split(`
227
+ `),Y=0,G=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;while(Y<Q.length){let B=Q[Y].match(G);if(!B)throw Error("Invalid patch string: "+Q[Y]);let F=new XW(parseInt(B[1],10),parseInt(B[3],10));if(X.push(F),B[2]==="")F.start1--,F.length1=1;else if(B[2]==="0")F.length1=0;else F.start1--,F.length1=parseInt(B[2],10);if(B[4]==="")F.start2--,F.length2=1;else if(B[4]==="0")F.length2=0;else F.start2--,F.length2=parseInt(B[4],10);Y++;while(Y<Q.length){let L=Q[Y].charAt(0),z;try{z=decodeURI(Q[Y].substring(1))}catch(J){throw Error("Illegal escape in patch_fromText: "+z,{cause:J})}if(L==="-")F.diffs.push([B0.Delete,z]);else if(L==="+")F.diffs.push([B0.Insert,z]);else if(L===" ")F.diffs.push([B0.Equal,z]);else if(L==="@")break;else if(L==="");else throw Error('Invalid patch mode "'+L+'" in: '+z);Y++}}return X}diff_commonPrefix(W,X){if(!W||!X||W.charAt(0)!==X.charAt(0))return 0;let Q=0,Y=Math.min(W.length,X.length),G=Y,B=0;while(Q<G){if(W.substring(B,G)===X.substring(B,G))Q=G,B=Q;else Y=G;G=Math.floor((Y-Q)/2+Q)}return G}diff_commonSuffix(W,X){if(!W||!X||W.charAt(W.length-1)!==X.charAt(X.length-1))return 0;let Q=0,Y=Math.min(W.length,X.length),G=Y,B=0;while(Q<G){if(W.substring(W.length-G,W.length-B)===X.substring(X.length-G,X.length-B))Q=G,B=Q;else Y=G;G=Math.floor((Y-Q)/2+Q)}return G}diff_cleanupMerge(W){W.push([B0.Equal,""]);let X=0,Q=0,Y=0,G="",B="",F;while(X<W.length)switch(W[X][0]){case B0.Insert:Y++,B+=W[X][1],X++;break;case B0.Delete:Q++,G+=W[X][1],X++;break;case B0.Equal:if(Q+Y>1){if(Q!==0&&Y!==0){if(F=this.diff_commonPrefix(B,G),F!==0){if(X-Q-Y>0&&W[X-Q-Y-1][0]===B0.Equal)W[X-Q-Y-1][1]+=B.substring(0,F);else W.splice(0,0,[B0.Equal,B.substring(0,F)]),X++;B=B.substring(F),G=G.substring(F)}if(F=this.diff_commonSuffix(B,G),F!==0)W[X][1]=B.substring(B.length-F)+W[X][1],B=B.substring(0,B.length-F),G=G.substring(0,G.length-F)}if(Q===0)W.splice(X-Y,Q+Y,[B0.Insert,B]);else if(Y===0)W.splice(X-Q,Q+Y,[B0.Delete,G]);else W.splice(X-Q-Y,Q+Y,[B0.Delete,G],[B0.Insert,B]);X=X-Q-Y+(Q?1:0)+(Y?1:0)+1}else if(X!==0&&W[X-1][0]===B0.Equal)W[X-1][1]+=W[X][1],W.splice(X,1);else X++;Y=0,Q=0,G="",B="";break}if(W[W.length-1][1]==="")W.pop();let L=!1;X=1;while(X<W.length-1){if(W[X-1][0]===B0.Equal&&W[X+1][0]===B0.Equal){if(W[X][1].substring(W[X][1].length-W[X-1][1].length)===W[X-1][1])W[X][1]=W[X-1][1]+W[X][1].substring(0,W[X][1].length-W[X-1][1].length),W[X+1][1]=W[X-1][1]+W[X+1][1],W.splice(X-1,1),L=!0;else if(W[X][1].substring(0,W[X+1][1].length)===W[X+1][1])W[X-1][1]+=W[X+1][1],W[X][1]=W[X][1].substring(W[X+1][1].length)+W[X+1][1],W.splice(X+1,1),L=!0}X++}if(L)this.diff_cleanupMerge(W)}diff_text1(W){let X=[];for(let Q=0;Q<W.length;Q++)if(W[Q][0]!==B0.Insert)X[Q]=W[Q][1];return X.join("")}diff_text2(W){let X=[];for(let Q=0;Q<W.length;Q++)if(W[Q][0]!==B0.Delete)X[Q]=W[Q][1];return X.join("")}diff_lineMode(W,X){let Q=this.diff_linesToChars_(W,X),Y=this.diff_main(Q.chars1,Q.chars2,!1);return this.diff_charsToLines_(Y,Q.lineArray),Y}diff_compute_(W,X,Q,Y){let G;if(!W)return[[B0.Insert,X]];if(!X)return[[B0.Delete,W]];let B=W.length>X.length?W:X,F=W.length>X.length?X:W,L=B.indexOf(F);if(L!==-1){if(G=[[B0.Insert,B.substring(0,L)],[B0.Equal,F],[B0.Insert,B.substring(L+F.length)]],W.length>X.length)G[0][0]=G[2][0]=B0.Delete;return G}if(F.length===1)return[[B0.Delete,W],[B0.Insert,X]];let z=this.diff_halfMatch_(W,X);if(z){let J=z[0],K=z[1],Z=z[2],D=z[3],I=z[4],A=this.diff_main(J,Z,Q,Y),M=this.diff_main(K,D,Q,Y);return A.concat([[B0.Equal,I]],M)}if(Q&&W.length>100&&X.length>100)return this.diff_lineMode_(W,X,Y);return this.diff_bisect_(W,X,Y)}diff_lineMode_(W,X,Q){let Y=this.diff_linesToChars_(W,X);W=Y.chars1,X=Y.chars2;let G=Y.lineArray,B=this.diff_main(W,X,!1,Q);this.diff_charsToLines_(B,G),this.diff_cleanupSemantic(B),B.push([B0.Equal,""]);let F=0,L=0,z=0,J="",K="";while(F<B.length){switch(B[F][0]){case B0.Insert:z++,K+=B[F][1];break;case B0.Delete:L++,J+=B[F][1];break;case B0.Equal:if(L>=1&&z>=1){B.splice(F-L-z,L+z),F=F-L-z;let Z=this.diff_main(J,K,!1,Q);for(let D=Z.length-1;D>=0;D--)B.splice(F,0,Z[D]);F=F+Z.length}z=0,L=0,J="",K="";break}F++}return B.pop(),B}diff_bisect_(W,X,Q){let Y=W.length,G=X.length,B=Math.ceil((Y+G)/2),F=B,L=2*B,z=Array(L),J=Array(L);for(let N=0;N<L;N++)z[N]=-1,J[N]=-1;z[F+1]=0,J[F+1]=0;let K=Y-G,Z=K%2!==0,D=0,I=0,A=0,M=0;for(let N=0;N<B;N++){if(new Date().getTime()>Q)break;for(let $=-N+D;$<=N-I;$+=2){let V=F+$,U;if($===-N||$!==N&&z[V-1]<z[V+1])U=z[V+1];else U=z[V-1]+1;let O=U-$;while(U<Y&&O<G&&W.charAt(U)===X.charAt(O))U++,O++;if(z[V]=U,U>Y)I+=2;else if(O>G)D+=2;else if(Z){let R=F+K-$;if(R>=0&&R<L&&J[R]!==-1){let j=Y-J[R];if(U>=j)return this.diff_bisectSplit_(W,X,U,O,Q)}}}for(let $=-N+A;$<=N-M;$+=2){let V=F+$,U;if($===-N||$!==N&&J[V-1]<J[V+1])U=J[V+1];else U=J[V-1]+1;let O=U-$;while(U<Y&&O<G&&W.charAt(Y-U-1)===X.charAt(G-O-1))U++,O++;if(J[V]=U,U>Y)M+=2;else if(O>G)A+=2;else if(!Z){let R=F+K-$;if(R>=0&&R<L&&z[R]!==-1){let j=z[R],w=F+j-R;if(U=Y-U,j>=U)return this.diff_bisectSplit_(W,X,j,w,Q)}}}}return[[B0.Delete,W],[B0.Insert,X]]}diff_bisectSplit_(W,X,Q,Y,G){let B=W.substring(0,Q),F=X.substring(0,Y),L=W.substring(Q),z=X.substring(Y),J=this.diff_main(B,F,!1,G),K=this.diff_main(L,z,!1,G);return J.concat(K)}diff_linesToChars_(W,X){let Q=[],Y={};Q[0]="";let G=this.diff_linesToCharsMunge_(W,Q,Y),B=this.diff_linesToCharsMunge_(X,Q,Y);return{chars1:G,chars2:B,lineArray:Q}}diff_linesToCharsMunge_(W,X,Q){let Y="",G=0,B=-1,F=X.length;while(B<W.length-1){if(B=W.indexOf(`
228
+ `,G),B===-1)B=W.length-1;let L=W.substring(G,B+1);if(G=B+1,Object.hasOwn(Q,L)||Q[L]!==void 0)Y+=String.fromCharCode(Q[L]);else Y+=String.fromCharCode(F),Q[L]=F,X[F++]=L}return Y}diff_charsToLines_(W,X){for(let Q of W){let Y=Q[1],G=[];for(let B=0;B<Y.length;B++)G[B]=X[Y.charCodeAt(B)];Q[1]=G.join("")}}diff_commonOverlap_(W,X){let Q=W.length,Y=X.length;if(Q===0||Y===0)return 0;if(Q>Y)W=W.substring(Q-Y);else if(Q<Y)X=X.substring(0,Q);let G=Math.min(Q,Y);if(W===X)return G;let B=0,F=1;for(;;){let L=W.substring(G-F),z=X.indexOf(L);if(z===-1)return B;if(F+=z,z===0||W.substring(G-F)===X.substring(0,F))B=F,F++}}diff_halfMatch_(W,X){if(this.Diff_Timeout<=0)return null;let Q=W.length>X.length?W:X,Y=W.length>X.length?X:W;if(Q.length<4||Y.length*2<Q.length)return null;let G=this.diff_halfMatchI_(Q,Y,Math.ceil(Q.length/4),this),B=this.diff_halfMatchI_(Q,Y,Math.ceil(Q.length/2),this),F;if(G===null&&B===null)return null;else if(G!==null&&B!==null)F=G[4].length>B[4].length?G:B;else if(G!==null)F=G;else if(B!==null)F=B;if(F===void 0)throw Error("hm expected to be defined but was undefined");let L,z,J,K;if(W.length>X.length)L=F[0],z=F[1],J=F[2],K=F[3];else J=F[0],K=F[1],L=F[2],z=F[3];let Z=F[4];return[L,z,J,K,Z]}diff_halfMatchI_(W,X,Q,Y){let G=W.substring(Q,Q+Math.floor(W.length/4)),B=-1,F="",L="",z="",J="",K="";while((B=X.indexOf(G,B+1))!==-1){let Z=Y.diff_commonPrefix(W.substring(Q),X.substring(B)),D=Y.diff_commonSuffix(W.substring(0,Q),X.substring(0,B));if(F.length<D+Z)F=X.substring(B-D,B)+X.substring(B,B+Z),L=W.substring(0,Q-D),z=W.substring(Q+Z),J=X.substring(0,B-D),K=X.substring(B+Z)}if(F.length*2>=W.length)return[L,z,J,K,F];return null}diff_cleanupSemanticLossless(W){let X=(Y,G)=>{if(!Y||!G)return 6;let B=/[^a-zA-Z0-9]/,F=Y.charAt(Y.length-1),L=G.charAt(0),z=F.match(B),J=L.match(B),K=z&&F.match(this.whitespaceRegex),Z=J&&L.match(this.whitespaceRegex),D=K&&F.match(this.linebreakRegex),I=Z&&L.match(this.linebreakRegex),A=D&&Y.match(this.blanklineEndRegex),M=I&&G.match(this.blanklineStartRegex);if(A||M)return 5;else if(D||I)return 4;else if(z&&!K&&Z)return 3;else if(K||Z)return 2;else if(z||J)return 1;return 0},Q=1;while(Q<W.length-1){if(W[Q-1][0]===B0.Equal&&W[Q+1][0]===B0.Equal){let Y=W[Q-1][1],G=W[Q][1],B=W[Q+1][1],F=this.diff_commonSuffix(Y,G);if(F){let Z=G.substring(G.length-F);Y=Y.substring(0,Y.length-F),G=Z+G.substring(0,G.length-F),B=Z+B}let L=Y,z=G,J=B,K=X(Y,G)+X(G,B);while(G.charAt(0)===B.charAt(0)){Y+=G.charAt(0),G=G.substring(1)+B.charAt(0),B=B.substring(1);let Z=X(Y,G)+X(G,B);if(Z>=K)K=Z,L=Y,z=G,J=B}if(W[Q-1][1]!==L){if(L)W[Q-1][1]=L;else W.splice(Q-1,1),Q--;if(W[Q][1]=z,J)W[Q+1][1]=J;else W.splice(Q+1,1),Q--}}Q++}}diff_xIndex(W,X){let Q=0,Y=0,G=0,B=0,F;for(F=0;F<W.length;F++){if(W[F][0]!==B0.Insert)Q+=W[F][1].length;if(W[F][0]!==B0.Delete)Y+=W[F][1].length;if(Q>X)break;G=Q,B=Y}if(W.length!==F&&W[F][0]===B0.Delete)return B;return B+(X-G)}diff_toDelta(W){let X=[];for(let Q=0;Q<W.length;Q++)switch(W[Q][0]){case B0.Insert:X[Q]="+"+encodeURI(W[Q][1]);break;case B0.Delete:X[Q]="-"+W[Q][1].length;break;case B0.Equal:X[Q]="="+W[Q][1].length;break}return X.join("\t").replace(/%20/g," ")}diff_fromDelta(W,X){let Q=[],Y=0,G=0,B=X.split(/\t/g);for(let F of B){let L=F.substring(1);switch(F.charAt(0)){case"+":{try{Q[Y++]=[B0.Insert,decodeURI(L)]}catch(z){throw Error("Illegal escape in diff_fromDelta: "+L,{cause:z})}break}case"-":case"=":{let z=parseInt(L,10);if(isNaN(z)||z<0)throw Error("Invalid number in diff_fromDelta: "+L);let J=W.substring(G,G+=z);if(F.charAt(0)==="=")Q[Y++]=[B0.Equal,J];else Q[Y++]=[B0.Delete,J];break}default:if(F)throw Error(`Invalid diff operation in diff_fromDelta: ${F}`)}}if(G!==W.length)throw Error("Delta length ("+G+") does not equal source text length ("+W.length+").");return Q}match_main(W,X,Q){if(W==null||X==null||Q==null)throw Error("Null input. (match_main)");if(Q=Math.max(0,Math.min(Q,W.length)),W===X)return 0;else if(!W.length)return-1;else if(W.substring(Q,Q+X.length)===X)return Q;else return this.match_bitap_(W,X,Q)}match_bitap_(W,X,Q){if(X.length>this.Match_MaxBits)throw Error("Pattern too long for this browser.");let Y=this.match_alphabet_(X),G=(D,I)=>{let A=D/X.length,M=Math.abs(Q-I);if(!this.Match_Distance)return M?1:A;return A+M/this.Match_Distance},B=this.Match_Threshold,F=W.indexOf(X,Q);if(F!==-1){if(B=Math.min(G(0,F),B),F=W.lastIndexOf(X,Q+X.length),F!==-1)B=Math.min(G(0,F),B)}let L=1<<X.length-1;F=-1;let z,J,K=X.length+W.length,Z;for(let D=0;D<X.length;D++){z=0,J=K;while(z<J){if(G(D,Q+J)<=B)z=J;else K=J;J=Math.floor((K-z)/2+z)}K=J;let I=Math.max(1,Q-J+1),A=Math.min(Q+J,W.length)+X.length,M=Array(A+2);M[A+1]=(1<<D)-1;for(let N=A;N>=I;N--){let $=Y[W.charAt(N-1)];if(D===0)M[N]=(M[N+1]<<1|1)&$;else{if(Z===void 0)throw Error("last_rd should have been set by the previous loop but is undefined");M[N]=(M[N+1]<<1|1)&$|((Z[N+1]|Z[N])<<1|1)|Z[N+1]}if(M[N]&L){let V=G(D,N-1);if(V<=B)if(B=V,F=N-1,F>Q)I=Math.max(1,2*Q-F);else break}}if(G(D+1,Q)>B)break;Z=M}return F}match_alphabet_(W){let X={};for(let Q=0;Q<W.length;Q++)X[W.charAt(Q)]=0;for(let Q=0;Q<W.length;Q++)X[W.charAt(Q)]|=1<<W.length-Q-1;return X}patch_addContext_(W,X){if(X.length===0)return;let Q=X.substring(W.start2,W.start2+W.length1),Y=0;while(X.indexOf(Q)!==X.lastIndexOf(Q)&&Q.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin)Y+=this.Patch_Margin,Q=X.substring(W.start2-Y,W.start2+W.length1+Y);Y+=this.Patch_Margin;let G=X.substring(W.start2-Y,W.start2);if(G)W.diffs.unshift([B0.Equal,G]);let B=X.substring(W.start2+W.length1,W.start2+W.length1+Y);if(B)W.diffs.push([B0.Equal,B]);W.start1-=G.length,W.start2-=G.length,W.length1+=G.length+B.length,W.length2+=G.length+B.length}patch_deepCopy(W){return W.map((X)=>X.clone())}patch_addPadding(W){let X=this.Patch_Margin,Q="";for(let B=1;B<=X;B++)Q+=String.fromCharCode(B);for(let B of W)B.start1+=X,B.start2+=X;let Y=W[0],G=Y.diffs;if(G.length===0||G[0][0]!==B0.Equal)G.unshift([B0.Equal,Q]),Y.start1-=X,Y.start2-=X,Y.length1+=X,Y.length2+=X;else if(X>G[0][1].length){let B=X-G[0][1].length;G[0][1]=Q.substring(G[0][1].length)+G[0][1],Y.start1-=B,Y.start2-=B,Y.length1+=B,Y.length2+=B}if(Y=W[W.length-1],G=Y.diffs,G.length===0||G[G.length-1][0]!==B0.Equal)G.push([B0.Equal,Q]),Y.length1+=X,Y.length2+=X;else if(X>G[G.length-1][1].length){let B=X-G[G.length-1][1].length;G[G.length-1][1]+=Q.substring(0,B),Y.length1+=B,Y.length2+=B}return Q}patch_splitMax(W){let X=this.Match_MaxBits;for(let Q=0;Q<W.length;Q++){if(W[Q].length1<=X)continue;let Y=W[Q];W.splice(Q--,1);let{start1:G,start2:B}=Y,F="";while(Y.diffs.length!==0){let L=new XW(G-F.length,B-F.length),z=!0;if(F!=="")L.length1=L.length2=F.length,L.diffs.push([B0.Equal,F]);while(Y.diffs.length!==0&&L.length1<X-this.Patch_Margin){let K=Y.diffs[0][0],Z=Y.diffs[0][1];if(K===B0.Insert)L.length2+=Z.length,B+=Z.length,L.diffs.push(Y.diffs.shift()),z=!1;else if(K===B0.Delete&&L.diffs.length===1&&L.diffs[0][0]===B0.Equal&&Z.length>2*X)L.length1+=Z.length,G+=Z.length,z=!1,L.diffs.push([K,Z]),Y.diffs.shift();else{if(Z=Z.substring(0,X-L.length1-this.Patch_Margin),L.length1+=Z.length,G+=Z.length,K===B0.Equal)L.length2+=Z.length,B+=Z.length;else z=!1;if(L.diffs.push([K,Z]),Z===Y.diffs[0][1])Y.diffs.shift();else Y.diffs[0][1]=Y.diffs[0][1].substring(Z.length)}}F=this.diff_text2(L.diffs),F=F.substring(F.length-this.Patch_Margin);let J=this.diff_text1(Y.diffs).substring(0,this.Patch_Margin);if(J!=="")if(L.length1+=J.length,L.length2+=J.length,L.diffs.length!==0&&L.diffs[L.diffs.length-1][0]===B0.Equal)L.diffs[L.diffs.length-1][1]+=J;else L.diffs.push([B0.Equal,J]);if(!z)W.splice(++Q,0,L)}}}}var B0,UI,qU=(W,X)=>{if(X===0)return W+",0";else if(X===1)return`${W+1}`;return`${W+1},${X}`};var CU=H0(()=>{(function(W){W[W.Delete=-1]="Delete",W[W.Equal=0]="Equal",W[W.Insert=1]="Insert"})(B0||(B0={}));UI={[B0.Insert]:"+",[B0.Delete]:"-",[B0.Equal]:" "}});function AI(W,X,Q,Y){let G=W.slice(0,X).join(`
229
+ `),B=W.slice(X+Q).join(`
118
230
  `);return G+(G?`
119
231
  `:"")+Y+(B?`
120
- `:"")+B}function DU(W,Q,X){let Y=W.replace(/\r\n/g,`
121
- `),G=Q.replace(/\r\n/g,`
122
- `),B=X.replace(/\r\n/g,`
232
+ `:"")+B}function kU(W,X,Q){let Y=W.replace(/\r\n/g,`
233
+ `),G=X.replace(/\r\n/g,`
234
+ `),B=Q.replace(/\r\n/g,`
123
235
  `);if(!G.trim()&&B.trim())return{content:Y+(Y.endsWith(`
124
236
  `)?"":`
125
237
  `)+B,method:"append"};if(!G)throw Error("Aider SEARCH block must not be empty when replacement is empty");let F=Y.split(G).length-1;if(F===1)return{content:Y.replace(G,()=>B),method:"exact"};if(F>1)throw Error("Aider exact match is ambiguous");let L=(V)=>{let U=V.match(/^[ \t]*/)?.[0]??"";return U.replace(/\t/g," ")+V.slice(U.length).replace(/[ \t]+/g," ").trimEnd()},z=Y.split(`
126
238
  `),J=G.split(`
127
- `),K=[];for(let V=0;V<=z.length-J.length;V+=1)if(J.every((U,j)=>L(z[V+j])===L(U)))K.push(V);if(K.length===1)return{content:eE(z,K[0],J.length,B),method:"whitespace"};if(K.length>1)throw Error("Aider whitespace match is ambiguous");let H=J.find((V)=>V.trim());if(H){let V=H.match(/^[ \t]*/)?.[0]??"",U=[];for(let j of z){if(j.trim()!==H.trim())continue;let R=j.match(/^[ \t]*/)?.[0]??"";if(R===V)continue;let O=J.map((T)=>T.startsWith(V)?R+T.slice(V.length):T).join(`
128
- `),w=Y.indexOf(O);if(w>=0&&Y.indexOf(O,w+1)<0)U.push({index:w,length:O.length})}if(U.length===1){let j=U[0];return{content:Y.slice(0,j.index)+B+Y.slice(j.index+j.length),method:"relative-indentation"}}if(U.length>1)throw Error("Aider indentation match is ambiguous")}let D=new RB;D.Match_Distance=Math.max(1000,Y.length),D.Match_Threshold=0.5;let I=G.slice(0,D.Match_MaxBits),A=[];for(let V=Y.indexOf(I);V>=0;V=Y.indexOf(I,V+1))A.push(V);if(!A.length){let U=D.match_main(Y,I,0);if(U>=0)A.push(U)}let M=Math.min(64,Math.max(4,Math.ceil(G.length*0.2))),N=[];for(let V of A){let U=Math.max(1,G.length-M),j=Math.min(Y.length-V,G.length+M),R;for(let O=U;O<=j;O+=1){let w=Y.slice(V,V+O),k=D.diff_levenshtein(D.diff_main(G,w))/Math.max(G.length,O);if(!R||k<R.ratio||k===R.ratio&&Math.abs(O-G.length)<Math.abs(R.length-G.length))R={index:V,length:O,ratio:k}}if(R)N.push(R)}N.sort((V,U)=>V.ratio-U.ratio);let Z=N[0];if(!Z||Z.ratio>0.5)throw Error("Aider cascade match failed: SEARCH block was not found with sufficient confidence");if(N[1]&&Math.abs(N[1].ratio-Z.ratio)<Number.EPSILON)throw Error("Aider diff-match-patch match is ambiguous");return{content:Y.slice(0,Z.index)+B+Y.slice(Z.index+Z.length),method:"diff-match-patch"}}var MU=$0(()=>{wU()});import{randomUUID as WI}from"crypto";import{chmod as QI,lstat as TB,mkdir as XI,readFile as g4,rename as YI,unlink as GI,writeFile as PB}from"fs/promises";import W5 from"path";function jU(W){let Q=W5.extname(W);return W5.join(W5.dirname(W),`${W5.basename(W,Q)}.ast-mcp-${WI()}${Q}`)}async function OU(W){try{await GI(W)}catch{}}async function BI(W){let Q=W5.dirname(W),X=await XI(Q,{recursive:!0});if(await a1(W)!==W)throw Error("Parent creation changed the resolved write path");if(!X)return[];let G=[X],B=X;for(let F of W5.relative(X,Q).split(W5.sep)){if(!F)continue;B=W5.join(B,F),G.push(B)}return G}async function tX(W,Q,X,Y,G){let B=jU(W),F=[];try{let L=await KQ(W,Q);try{await PB(B,L,{encoding:"utf8",flag:"wx",mode:X})}catch(z){if(z.code!=="ENOENT")throw z;F=await BI(W),await PB(B,L,{encoding:"utf8",flag:"wx",mode:X})}if(X!==void 0)await QI(B,X);if(await rX(B,G),Y){let z=await g4(W,"utf8"),J=v1(z);if(J!==Y)throw Error(`Stale file context: expected ${Y}, found ${J}`)}return await YI(B,W),F}finally{await OU(B)}}function FI(W,Q,X){if(Q===X)return"";let Y=Q.split(`
129
- `),G=X.split(`
239
+ `),K=[];for(let V=0;V<=z.length-J.length;V+=1)if(J.every((U,O)=>L(z[V+O])===L(U)))K.push(V);if(K.length===1)return{content:AI(z,K[0],J.length,B),method:"whitespace"};if(K.length>1)throw Error("Aider whitespace match is ambiguous");let Z=J.find((V)=>V.trim());if(Z){let V=Z.match(/^[ \t]*/)?.[0]??"",U=[];for(let O of z){if(O.trim()!==Z.trim())continue;let R=O.match(/^[ \t]*/)?.[0]??"";if(R===V)continue;let j=J.map((T)=>T.startsWith(V)?R+T.slice(V.length):T).join(`
240
+ `),w=Y.indexOf(j);if(w>=0&&Y.indexOf(j,w+1)<0)U.push({index:w,length:j.length})}if(U.length===1){let O=U[0];return{content:Y.slice(0,O.index)+B+Y.slice(O.index+O.length),method:"relative-indentation"}}if(U.length>1)throw Error("Aider indentation match is ambiguous")}let D=new _B;D.Match_Distance=Math.max(1000,Y.length),D.Match_Threshold=0.5;let I=G.slice(0,D.Match_MaxBits),A=[];for(let V=Y.indexOf(I);V>=0;V=Y.indexOf(I,V+1))A.push(V);if(!A.length){let U=D.match_main(Y,I,0);if(U>=0)A.push(U)}let M=Math.min(64,Math.max(4,Math.ceil(G.length*0.2))),N=[];for(let V of A){let U=Math.max(1,G.length-M),O=Math.min(Y.length-V,G.length+M),R;for(let j=U;j<=O;j+=1){let w=Y.slice(V,V+j),k=D.diff_levenshtein(D.diff_main(G,w))/Math.max(G.length,j);if(!R||k<R.ratio||k===R.ratio&&Math.abs(j-G.length)<Math.abs(R.length-G.length))R={index:V,length:j,ratio:k}}if(R)N.push(R)}N.sort((V,U)=>V.ratio-U.ratio);let $=N[0];if(!$||$.ratio>0.5)throw Error("Aider cascade match failed: SEARCH block was not found with sufficient confidence");if(N[1]&&Math.abs(N[1].ratio-$.ratio)<Number.EPSILON)throw Error("Aider diff-match-patch match is ambiguous");return{content:Y.slice(0,$.index)+B+Y.slice($.index+$.length),method:"diff-match-patch"}}var vU=H0(()=>{CU()});import{randomUUID as NI}from"crypto";import{chmod as VI,lstat as gB,mkdir as wI,readFile as f4,rename as DI,unlink as MI,writeFile as fB}from"fs/promises";import W5 from"path";function yU(W){let X=W5.extname(W);return W5.join(W5.dirname(W),`${W5.basename(W,X)}.ast-mcp-${NI()}${X}`)}async function _U(W){try{await MI(W)}catch{}}async function OI(W){let X=W5.dirname(W),Q=await wI(X,{recursive:!0});if(await s1(W)!==W)throw Error("Parent creation changed the resolved write path");if(!Q)return[];let G=[Q],B=Q;for(let F of W5.relative(Q,X).split(W5.sep)){if(!F)continue;B=W5.join(B,F),G.push(B)}return G}async function GY(W,X,Q,Y,G){let B=yU(W),F=[];try{let L=await NX(W,X);try{await fB(B,L,{encoding:"utf8",flag:"wx",mode:Q})}catch(z){if(z.code!=="ENOENT")throw z;F=await OI(W),await fB(B,L,{encoding:"utf8",flag:"wx",mode:Q})}if(Q!==void 0)await VI(B,Q);if(await WY(B,G),Y){let z=await f4(W,"utf8"),J=y1(z);if(J!==Y)throw Error(`Stale file context: expected ${Y}, found ${J}`)}return await DI(B,W),F}finally{await _U(B)}}function jI(W,X,Q){if(X===Q)return"";let Y=X.split(`
241
+ `),G=Q.split(`
130
242
  `),B=0;while(B<Y.length&&B<G.length&&Y[B]===G[B])B+=1;let F=Y.length,L=G.length;while(F>B&&L>B&&Y[F-1]===G[L-1])F-=1,L-=1;let z=[`--- ${W}`,`+++ ${W}`,`@@ -${B+1},${F-B} +${B+1},${L-B} @@`,...Y.slice(B,F).map((J)=>`-${J}`),...G.slice(B,L).map((J)=>`+${J}`)];return z.length>200?[...z.slice(0,199),"... diff truncated"].join(`
131
243
  `):z.join(`
132
- `)}async function LI(W,Q){let X=await a1(W);return dX(X,async()=>{let Y=await g4(X,"utf8"),G=v1(Y);if(G!==Q.expectedSha256)throw Error("Stale file context: expected "+Q.expectedSha256+", found "+G);let B=Q.astRules??[],F=Q.aiderBlocks??[],L=_4(X),z=await EB(X,L),J=async(I,A)=>{let M=await KQ(X,I);return{changed:M!==Y,diff:FI(X,Y,M),filePath:X,matches:A.matches,matchMethods:A.matchMethods,operations:A.operations,preview:!0,sha256:v1(M),strategy:A.strategy}};if(Q.patchStrategy==="ast"){if(!z||!L)throw Error("REJECTED: non-structurally-rewritable files require patchStrategy 'aider_block' with aiderBlocks");if(B.length===0||F.length>0)throw Error("REJECTED: patchStrategy 'ast' requires astRules and no aiderBlocks");let I=jU(X),A=await TB(X);try{await PB(I,Y,{encoding:"utf8",flag:"wx",mode:A.mode});let M=0;for(let V of B){let U=e6(await h6("run",{json:!0,lang:L,paths:[I],pattern:V.pattern},W5.dirname(X)));if(U.error_count)throw Error(`ast-bro preview failed with ${U.error_count} errors`);let j=Array.isArray(U.matches)?U.matches.length:0,R=V.expectedMatches??1;if(j!==R)throw Error(`AST rule matched ${j} nodes; expected ${R}`);if(R!==1)throw Error("ast-bro run rewrites only the first match per file; narrow the AST rule to exactly one node");let O=e6(await h6("run",{json:!0,lang:L,paths:[I],pattern:V.pattern,rewrite:V.fix,write:!0},W5.dirname(X)));if(O.error_count||O.rewrite_count!==1||O.files?.[0]?.status!=="rewritten")throw Error("ast-bro run did not rewrite exactly one file");M+=j}let N=await g4(I,"utf8");if(Q.preview)return J(N,{matches:M,operations:B.length,strategy:"ast"});await tX(X,N,A.mode,G,Q.chattr);let Z=await g4(X,"utf8");return{engine:"ast-bro.run",filePath:X,matches:M,operations:B.length,preview:!1,sha256:v1(Z),strategy:"ast"}}finally{await OU(I)}}if(z)throw Error("REJECTED: structurally rewritable files require patchStrategy 'ast' with astRules");if(F.length===0||B.length>0)throw Error("REJECTED: patchStrategy 'aider_block' requires aiderBlocks and no astRules");let K=Y,H=[];for(let I of F){let A=DU(K,I.search,I.replace);K=A.content,H.push(A.method)}if(Q.preview)return J(K,{matchMethods:H,operations:F.length,strategy:"aider_block"});await tX(X,K,(await TB(X)).mode,G,Q.chattr);let D=await g4(X,"utf8");return{filePath:X,matchMethods:H,operations:F.length,preview:!1,sha256:v1(D),strategy:"aider_block"}})}async function EU(W){let Q=Object.entries(W);if(Q.length<1||Q.length>L1)throw Error(`file_patch requires between 1 and ${L1} files`);let X={};for(let[Y,G]of Q)X[Y]=await LI(Y,G);return{files:X}}async function zI(W){let Q=await a1(W.filePath);return dX(Q,async()=>{let X=await g4(Q,"utf8").catch(()=>{return}),Y;if(X!==void 0){if(!W.expectedSha256)throw Error("Overwriting an existing file requires expectedSha256");let B=v1(X);if(B!==W.expectedSha256)throw Error("Stale file context: expected "+W.expectedSha256+", found "+B);let F=_4(Q);if(await EB(Q,F))throw Error("REJECTED: structurally rewritable existing files require file_patch with patchStrategy 'ast'");Y=await tX(Q,W.content,(await TB(Q)).mode,B,W.chattr)}else Y=await tX(Q,W.content,void 0,void 0,W.chattr);let G=await g4(Q,"utf8");return{chattr:await nX(Q),created:X===void 0,createdDirectories:Y,filePath:Q,sha256:v1(G)}})}async function IU(W){let Q=Object.entries(W);if(Q.length<1||Q.length>L1)throw Error(`file_write requires between 1 and ${L1} files`);let X={};for(let[Y,G]of Q)X[Y]=await zI({chattr:G.chattr,content:G.content,expectedSha256:G.expectedSha256,filePath:Y});return{files:X}}var RU=$0(async()=>{JQ();KU();IB();sX();o9();ZQ();s9();MU();oX();await VB()});function SB(W){let Q=eJ([m().int().nonnegative(),m().int().positive()]).describe("Zero-based, end-exclusive [start, end] line range"),X=q({filePath:$(),lines:Q.optional(),maxBytes:m().int().positive().max(WW).optional()}),Y=q({replace:$(),search:$()}),G=q({expectedMatches:m().int().positive().optional(),fix:$(),pattern:$().min(1)}),B=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()}),F=q({chattr:B.optional(),content:$(),expectedSha256:$().length(64).optional()}),L=(z,J)=>n($().min(1),z).refine((K)=>Object.keys(K).length>0&&Object.keys(K).length<=L1,J);W.registerTool("file_read",{description:`Batches bounded line slices from non-AST files only. AST-capable files are rejected and must use map/show/search/context/run. Each slice defaults to lines [0, 100], is capped at ${aX} lines and ${WW} bytes, and includes a streaming whole-file SHA-256.`,inputSchema:q({files:f(X).min(1).max(L1)}),title:"Read Bounded Non-AST File Slices"},async({files:z})=>{try{return{content:[{text:JSON.stringify({files:await NU(z)}),type:"text"}]}}catch(J){return eX(J)}}),W.registerTool("file_hash",{description:`Batches streaming whole-file SHA-256 calculations without loading file contents into memory. Use this for fresh patch hashes, including AST-capable files. Accepts up to ${L1} paths.`,inputSchema:q({filePaths:f($()).min(1).max(L1)}),title:"Hash Files Without Reading Content"},async({filePaths:z})=>{try{return{content:[{text:JSON.stringify({files:await AU(z)}),type:"text"}]}}catch(J){return eX(J)}}),W.registerTool("file_write",{description:"Creates or replaces multiple files in one keyed batch. Each key is a file path and each value contains content plus an optional fresh expectedSha256 for existing non-structurally-rewritable files.",inputSchema:L(F,"file_write requires between 1 and 50 files"),title:"Write Files Safely"},async(z)=>{try{return{content:[{text:JSON.stringify(await IU(z)),type:"text"}]}}catch(J){return eX(J)}}),W.registerTool("file_patch",{description:"Patches multiple files in one keyed batch. Each key is a file path and each value contains one expectedSha256, a patchStrategy, ordered aiderBlocks or astRules, and optional preview mode. Preview runs the complete guarded operation and returns a bounded diff without committing.",inputSchema:L(q({aiderBlocks:f(Y).max(L1).optional(),astRules:f(G).max(L1).optional(),chattr:B.optional(),expectedSha256:$().length(64),patchStrategy:J0(["ast","aider_block"]),preview:o().optional()}),"file_patch requires between 1 and 50 files"),title:"Patch Files Through the Enforced State Machine"},async(z)=>{try{return{content:[{text:JSON.stringify(await EU(z)),type:"text"}]}}catch(J){return eX(J)}})}var eX=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var TU=$0(async()=>{n4();sX();await RU()});import{lstat as JI,readdir as KI,rm as ZI,rmdir as HI}from"fs/promises";import HQ from"path";async function $I(W,Q){let X=_4(W);if(!await e9(W,X))return[];return(e6(await h6("reverse_deps",{file:HQ.relative(Q,W),json:!0},Q)).importers??[]).map((G)=>G.file).filter((G)=>typeof G==="string")}async function UI(W,Q){let X=[],Y=HQ.dirname(W);while(!0){let G=HQ.relative(Q,Y);if(Y===Q||G.startsWith("..")||HQ.isAbsolute(G))break;if((await KI(Y)).length!==0)break;await HI(Y),X.push(Y),Y=HQ.dirname(Y)}return X}async function PU(W){let Q=await Promise.all(Object.entries(W).map(async([G,B])=>{let F=await a1(G);if(!(await JI(F)).isFile())throw Error(`file_delete accepts files only: ${G}`);let z=await LU(F),J=await $I(F,z);if(J.length>0&&!B.forceReferences)throw Error(`file_delete rejected ${G}: referenced by ${J.join(", ")}; set forceReferences to override`);return{filePath:F,importers:J,request:B,root:z}})),X=await a9(Q.map(({filePath:G})=>G),async()=>{let G={};for(let{filePath:B,request:F}of Q){let L=await Bun.file(B).text(),z=v1(L);if(z!==F.expectedSha256)throw Error(`Stale file context: expected ${F.expectedSha256}, found ${z}`)}for(let{filePath:B,importers:F,request:L}of Q)await ZI(B),G[B]={deleted:!0,forcedReferences:F.length>0&&L.forceReferences===!0};return G}),Y=new Set;for(let{filePath:G,root:B}of Q)for(let F of await UI(G,B))Y.add(F);return{files:X,removedDirectories:[...Y].sort()}}var SU=$0(()=>{iX();JQ();oX();o9();ZQ();s9()});function bB(W){W.registerTool("file_chattr",{description:"Applies the shared chattr contract to multiple root-bounded files under deterministic locks.",inputSchema:n($().min(1),q({chattr:AI,expectedSha256:$().length(64).optional()})).refine((Q)=>Object.keys(Q).length>0&&Object.keys(Q).length<=L1,"file_chattr requires between 1 and 50 files"),title:"Change File Attributes Safely"},async(Q)=>{try{let X=await Promise.all(Object.entries(Q).map(async([G,B])=>({filePath:await a1(G),request:B}))),Y={};return await a9(X.map(({filePath:G})=>G),async()=>{for(let{filePath:G,request:B}of X){if(B.expectedSha256){let F=v1(await Bun.file(G).text());if(F!==B.expectedSha256)throw Error(`Stale file context: expected ${B.expectedSha256}, found ${F}`)}Y[G]={chattr:await rX(G,B.chattr)}}}),{content:[{text:JSON.stringify({files:Y}),type:"text"}]}}catch(X){return bU(X)}}),W.registerTool("file_delete",{description:"Deletes hash-guarded files in one reference-preflighted batch and removes empty ancestor directories within configured roots.",inputSchema:n($().min(1),q({expectedSha256:$().length(64),forceReferences:o().optional()})).refine((Q)=>Object.keys(Q).length>0&&Object.keys(Q).length<=L1,"file_delete requires between 1 and 50 files"),title:"Delete Files Safely"},async(Q)=>{try{return{content:[{text:JSON.stringify(await PU(Q)),type:"text"}]}}catch(X){return bU(X)}})}var AI,bU=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var qU=$0(()=>{n4();IB();SU();sX();o9();ZQ();s9();AI=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()})});function qB(W){SB(W),bB(W),OB(W)}var CU=$0(async()=>{qU();await oU([JU(),TU()])});function kU(){let W=new T7({name:"ast-mcp",version:"1.0.0"});return qB(W),W}var vU=$0(async()=>{P7();await CU()});function yU(){let W=kU();return rB(W.close.bind(W)),W}var _U=$0(async()=>{oB();await vU()});class CB{stdin;stdout;buffer=Buffer.alloc(0);started=!1;closed=!1;constructor(W=process.stdin,Q=process.stdout){this.stdin=W;this.stdout=Q}onclose;onerror;onmessage;onData=(W)=>{try{let Q=Buffer.isBuffer(W)?W:Buffer.from(W);if(this.buffer.length+Q.length>gU)throw this.buffer=Buffer.alloc(0),Error(`Stdio input exceeded maximum size of ${gU} bytes`);this.buffer=Buffer.concat([this.buffer,Q]),this.processReadBuffer()}catch(Q){this.onerror?.(Q instanceof Error?Q:Error(String(Q))),this.close()}};onError=(W)=>{this.onerror?.(W)};async start(){if(this.started)throw Error("Stdio transport already started");this.started=!0,this.stdin.on("data",this.onData),this.stdin.on("error",this.onError),this.stdout.on("error",this.onError)}reportInvalidRequest(W){this.onerror?.(W),this.send({error:{code:-32600,message:"Invalid Request"},id:null,jsonrpc:"2.0"}).catch((Q)=>{this.onerror?.(Q instanceof Error?Q:Error(String(Q)))})}processReadBuffer(){while(!0){let W=this.buffer.indexOf(10);if(W===-1)return;let Q=this.buffer.subarray(0,W).toString("utf8").replace(/\r$/,"");this.buffer=this.buffer.subarray(W+1);try{let X=JSON.parse(Q);if(Array.isArray(X)&&X.length===0){this.reportInvalidRequest(Error("JSON-RPC batches must not be empty"));continue}let Y=(Array.isArray(X)?X:[X]).flatMap((G)=>{try{return[N7(JSON.stringify(G))]}catch(B){return this.reportInvalidRequest(B instanceof Error?B:Error(String(B))),[]}});for(let G of Y)this.onmessage?.(G)}catch(X){this.reportInvalidRequest(X instanceof Error?X:Error(String(X)))}}}async close(){if(this.closed)return;if(this.closed=!0,this.stdin.off("data",this.onData),this.stdin.off("error",this.onError),this.stdout.off("error",this.onError),this.stdin.listenerCount("data")===0)this.stdin.pause();this.buffer=Buffer.alloc(0),this.onclose?.()}send(W){if(this.closed)return Promise.reject(Error("Stdio transport is closed"));return new Promise((Q,X)=>{let Y=!1,G=(F)=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),X(F)},B=()=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),Q()};if(this.stdout.once("error",G),this.stdout.write(V7(W))){if(Y)return;Y=!0,this.stdout.off("error",G),Q()}else this.stdout.once("drain",B)})}}var gU=10485760;var fU=$0(()=>{P7()});var wI={};var NI,VI;var xU=$0(async()=>{fU();await _U();NI=yU(),VI=new CB;await NI.connect(VI)});var{runCli:DI}=await Promise.resolve().then(() => kB);process.exit(await DI(process.argv.slice(2),{hook:async()=>{let{runHook:W}=await _B().then(() => yB);return W()},installer:async(W)=>{let{runInstallerCli:Q}=await nB().then(() => iB);await Q(W)},mcp:async()=>{await xU().then(() => wI)}})??0);
244
+ `)}async function EI(W,X){let Q=await s1(W);return sQ(Q,async()=>{let Y=await f4(Q,"utf8"),G=y1(Y);if(G!==X.expectedSha256)throw Error("Stale file context: expected "+X.expectedSha256+", found "+G);let B=X.astRules??[],F=X.aiderBlocks??[],L=g4(Q),z=await vB(Q,L),J=async(I,A)=>{let M=await NX(Q,I);return{changed:M!==Y,diff:jI(Q,Y,M),filePath:Q,matches:A.matches,matchMethods:A.matchMethods,operations:A.operations,preview:!0,sha256:y1(M),strategy:A.strategy}};if(X.patchStrategy==="ast"){if(!z||!L)throw Error("REJECTED: non-structurally-rewritable files require patchStrategy 'aider_block' with aiderBlocks");if(B.length===0||F.length>0)throw Error("REJECTED: patchStrategy 'ast' requires astRules and no aiderBlocks");let I=yU(Q),A=await gB(Q);try{await fB(I,Y,{encoding:"utf8",flag:"wx",mode:A.mode});let M=0;for(let V of B){let U=e6(await u6("run",{json:!0,lang:L,paths:[I],pattern:V.pattern},W5.dirname(Q)));if(U.error_count)throw Error(`ast-bro preview failed with ${U.error_count} errors`);let O=Array.isArray(U.matches)?U.matches.length:0,R=V.expectedMatches??1;if(O!==R)throw Error(`AST rule matched ${O} nodes; expected ${R}`);if(R!==1)throw Error("ast-bro run rewrites only the first match per file; narrow the AST rule to exactly one node");let j=e6(await u6("run",{json:!0,lang:L,paths:[I],pattern:V.pattern,rewrite:V.fix,write:!0},W5.dirname(Q)));if(j.error_count||j.rewrite_count!==1||j.files?.[0]?.status!=="rewritten")throw Error("ast-bro run did not rewrite exactly one file");M+=O}let N=await f4(I,"utf8");if(X.preview)return J(N,{matches:M,operations:B.length,strategy:"ast"});await GY(Q,N,A.mode,G,X.chattr);let $=await f4(Q,"utf8");return{engine:"ast-bro.run",filePath:Q,matches:M,operations:B.length,preview:!1,sha256:y1($),strategy:"ast"}}finally{await _U(I)}}if(z)throw Error("REJECTED: structurally rewritable files require patchStrategy 'ast' with astRules");if(F.length===0||B.length>0)throw Error("REJECTED: patchStrategy 'aider_block' requires aiderBlocks and no astRules");let K=Y,Z=[];for(let I of F){let A=kU(K,I.search,I.replace);K=A.content,Z.push(A.method)}if(X.preview)return J(K,{matchMethods:Z,operations:F.length,strategy:"aider_block"});await GY(Q,K,(await gB(Q)).mode,G,X.chattr);let D=await f4(Q,"utf8");return{filePath:Q,matchMethods:Z,operations:F.length,preview:!1,sha256:y1(D),strategy:"aider_block"}})}async function gU(W){let X=Object.entries(W);if(X.length<1||X.length>L1)throw Error(`file_patch requires between 1 and ${L1} files`);let Q={};for(let[Y,G]of X)Q[Y]=await EI(Y,G);return{files:Q}}async function II(W){let X=await s1(W.filePath);return sQ(X,async()=>{let Q=await f4(X,"utf8").catch(()=>{return}),Y;if(Q!==void 0){if(!W.expectedSha256)throw Error("Overwriting an existing file requires expectedSha256");let B=y1(Q);if(B!==W.expectedSha256)throw Error("Stale file context: expected "+W.expectedSha256+", found "+B);let F=g4(X);if(await vB(X,F))throw Error("REJECTED: structurally rewritable existing files require file_patch with patchStrategy 'ast'");Y=await GY(X,W.content,(await gB(X)).mode,B,W.chattr)}else Y=await GY(X,W.content,void 0,void 0,W.chattr);let G=await f4(X,"utf8");return{chattr:await eQ(X),created:Q===void 0,createdDirectories:Y,filePath:X,sha256:y1(G)}})}async function fU(W){let X=Object.entries(W);if(X.length<1||X.length>L1)throw Error(`file_write requires between 1 and ${L1} files`);let Q={};for(let[Y,G]of X)Q[Y]=await II({chattr:G.chattr,content:G.content,expectedSha256:G.expectedSha256,filePath:Y});return{files:Q}}var xU=H0(async()=>{AX();EU();yB();YY();o9();VX();s9();vU();XY();await PB()});function xB(W){let X=HK([m().int().nonnegative(),m().int().positive()]).describe("Zero-based, end-exclusive [start, end] line range"),Q=q({filePath:H(),lines:X.optional(),maxBytes:m().int().positive().max(WW).optional()}),Y=q({replace:H(),search:H()}),G=q({expectedMatches:m().int().positive().optional(),fix:H(),pattern:H().min(1)}),B=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()}),F=q({chattr:B.optional(),content:H(),expectedSha256:H().length(64).optional()}),L=(z,J)=>n(H().min(1),z).refine((K)=>Object.keys(K).length>0&&Object.keys(K).length<=L1,J);W.registerTool("file_read",{description:`Batches bounded line slices from non-AST files only. AST-capable files are rejected and must use map/show/search/context/run. Each slice defaults to lines [0, 100], is capped at ${QY} lines and ${WW} bytes, and includes a streaming whole-file SHA-256.`,inputSchema:q({files:f(Q).min(1).max(L1)}),title:"Read Bounded Non-AST File Slices"},async({files:z})=>{try{return{content:[{text:JSON.stringify({files:await bU(z)}),type:"text"}]}}catch(J){return BY(J)}}),W.registerTool("file_hash",{description:`Batches streaming whole-file SHA-256 calculations without loading file contents into memory. Use this for fresh patch hashes, including AST-capable files. Accepts up to ${L1} paths.`,inputSchema:q({filePaths:f(H()).min(1).max(L1)}),title:"Hash Files Without Reading Content"},async({filePaths:z})=>{try{return{content:[{text:JSON.stringify({files:await SU(z)}),type:"text"}]}}catch(J){return BY(J)}}),W.registerTool("file_write",{description:"Creates or replaces multiple files in one keyed batch. Each key is a file path and each value contains content plus an optional fresh expectedSha256 for existing non-structurally-rewritable files.",inputSchema:L(F,"file_write requires between 1 and 50 files"),title:"Write Files Safely"},async(z)=>{try{return{content:[{text:JSON.stringify(await fU(z)),type:"text"}]}}catch(J){return BY(J)}}),W.registerTool("file_patch",{description:"Patches multiple files in one keyed batch. Each key is a file path and each value contains one expectedSha256, a patchStrategy, ordered aiderBlocks or astRules, and optional preview mode. Preview runs the complete guarded operation and returns a bounded diff without committing.",inputSchema:L(q({aiderBlocks:f(Y).max(L1).optional(),astRules:f(G).max(L1).optional(),chattr:B.optional(),expectedSha256:H().length(64),patchStrategy:J0(["ast","aider_block"]),preview:o().optional()}),"file_patch requires between 1 and 50 files"),title:"Patch Files Through the Enforced State Machine"},async(z)=>{try{return{content:[{text:JSON.stringify(await gU(z)),type:"text"}]}}catch(J){return BY(J)}})}var BY=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var hU=H0(async()=>{o4();YY();await xU()});import{lstat as RI,readdir as TI,rm as PI,rmdir as SI}from"fs/promises";import wX from"path";async function bI(W,X){let Q=g4(W);if(!await e9(W,Q))return[];return(e6(await u6("reverse_deps",{file:wX.relative(X,W),json:!0},X)).importers??[]).map((G)=>G.file).filter((G)=>typeof G==="string")}async function qI(W,X){let Q=[],Y=wX.dirname(W);while(!0){let G=wX.relative(X,Y);if(Y===X||G.startsWith("..")||wX.isAbsolute(G))break;if((await TI(Y)).length!==0)break;await SI(Y),Q.push(Y),Y=wX.dirname(Y)}return Q}async function uU(W){let X=await Promise.all(Object.entries(W).map(async([G,B])=>{let F=await s1(G);if(!(await RI(F)).isFile())throw Error(`file_delete accepts files only: ${G}`);let z=await MU(F),J=await bI(F,z);if(J.length>0&&!B.forceReferences)throw Error(`file_delete rejected ${G}: referenced by ${J.join(", ")}; set forceReferences to override`);return{filePath:F,importers:J,request:B,root:z}})),Q=await a9(X.map(({filePath:G})=>G),async()=>{let G={};for(let{filePath:B,request:F}of X){let L=await Bun.file(B).text(),z=y1(L);if(z!==F.expectedSha256)throw Error(`Stale file context: expected ${F.expectedSha256}, found ${z}`)}for(let{filePath:B,importers:F,request:L}of X)await PI(B),G[B]={deleted:!0,forcedReferences:F.length>0&&L.forceReferences===!0};return G}),Y=new Set;for(let{filePath:G,root:B}of X)for(let F of await qI(G,B))Y.add(F);return{files:Q,removedDirectories:[...Y].sort()}}var lU=H0(()=>{tQ();AX();XY();o9();VX();s9()});function hB(W){W.registerTool("file_chattr",{description:"Applies the shared chattr contract to multiple root-bounded files under deterministic locks.",inputSchema:n(H().min(1),q({chattr:CI,expectedSha256:H().length(64).optional()})).refine((X)=>Object.keys(X).length>0&&Object.keys(X).length<=L1,"file_chattr requires between 1 and 50 files"),title:"Change File Attributes Safely"},async(X)=>{try{let Q=await Promise.all(Object.entries(X).map(async([G,B])=>({filePath:await s1(G),request:B}))),Y={};return await a9(Q.map(({filePath:G})=>G),async()=>{for(let{filePath:G,request:B}of Q){if(B.expectedSha256){let F=y1(await Bun.file(G).text());if(F!==B.expectedSha256)throw Error(`Stale file context: expected ${B.expectedSha256}, found ${F}`)}Y[G]={chattr:await WY(G,B.chattr)}}}),{content:[{text:JSON.stringify({files:Y}),type:"text"}]}}catch(Q){return mU(Q)}}),W.registerTool("file_delete",{description:"Deletes hash-guarded files in one reference-preflighted batch and removes empty ancestor directories within configured roots.",inputSchema:n(H().min(1),q({expectedSha256:H().length(64),forceReferences:o().optional()})).refine((X)=>Object.keys(X).length>0&&Object.keys(X).length<=L1,"file_delete requires between 1 and 50 files"),title:"Delete Files Safely"},async(X)=>{try{return{content:[{text:JSON.stringify(await uU(X)),type:"text"}]}}catch(Q){return mU(Q)}})}var CI,mU=(W)=>({content:[{text:W instanceof Error?W.message:String(W),type:"text"}],isError:!0});var cU=H0(()=>{o4();yB();lU();YY();o9();VX();s9();CI=q({chmod:m().int().min(0).max(511).optional(),chown:q({gid:m().int().nonnegative(),uid:m().int().nonnegative()}).optional()})});function uB(W){xB(W),hB(W),kB(W)}var pU=H0(async()=>{cU();await zA([jU(),hU()])});function dU(){let W=new f7({name:"ast-mcp",version:"1.0.0"});return uB(W),W}var iU=H0(async()=>{x7();await pU()});function nU(){let W=dU();return zF(W.close.bind(W)),W}var rU=H0(async()=>{JF();await iU()});class lB{stdin;stdout;buffer=Buffer.alloc(0);started=!1;closed=!1;constructor(W=process.stdin,X=process.stdout){this.stdin=W;this.stdout=X}onclose;onerror;onmessage;onData=(W)=>{try{let X=Buffer.isBuffer(W)?W:Buffer.from(W);if(this.buffer.length+X.length>oU)throw this.buffer=Buffer.alloc(0),Error(`Stdio input exceeded maximum size of ${oU} bytes`);this.buffer=Buffer.concat([this.buffer,X]),this.processReadBuffer()}catch(X){this.onerror?.(X instanceof Error?X:Error(String(X))),this.close()}};onError=(W)=>{this.onerror?.(W)};async start(){if(this.started)throw Error("Stdio transport already started");this.started=!0,this.stdin.on("data",this.onData),this.stdin.on("error",this.onError),this.stdout.on("error",this.onError)}reportInvalidRequest(W){this.onerror?.(W),this.send({error:{code:-32600,message:"Invalid Request"},id:null,jsonrpc:"2.0"}).catch((X)=>{this.onerror?.(X instanceof Error?X:Error(String(X)))})}processReadBuffer(){while(!0){let W=this.buffer.indexOf(10);if(W===-1)return;let X=this.buffer.subarray(0,W).toString("utf8").replace(/\r$/,"");this.buffer=this.buffer.subarray(W+1);try{let Q=JSON.parse(X);if(Array.isArray(Q)&&Q.length===0){this.reportInvalidRequest(Error("JSON-RPC batches must not be empty"));continue}let Y=(Array.isArray(Q)?Q:[Q]).flatMap((G)=>{try{return[P7(JSON.stringify(G))]}catch(B){return this.reportInvalidRequest(B instanceof Error?B:Error(String(B))),[]}});for(let G of Y)this.onmessage?.(G)}catch(Q){this.reportInvalidRequest(Q instanceof Error?Q:Error(String(Q)))}}}async close(){if(this.closed)return;if(this.closed=!0,this.stdin.off("data",this.onData),this.stdin.off("error",this.onError),this.stdout.off("error",this.onError),this.stdin.listenerCount("data")===0)this.stdin.pause();this.buffer=Buffer.alloc(0),this.onclose?.()}send(W){if(this.closed)return Promise.reject(Error("Stdio transport is closed"));return new Promise((X,Q)=>{let Y=!1,G=(F)=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),Q(F)},B=()=>{if(Y)return;Y=!0,this.stdout.off("error",G),this.stdout.off("drain",B),X()};if(this.stdout.once("error",G),this.stdout.write(S7(W))){if(Y)return;Y=!0,this.stdout.off("error",G),X()}else this.stdout.once("drain",B)})}}var oU=10485760;var aU=H0(()=>{x7()});var yI={};var kI,vI;var sU=H0(async()=>{aU();await rU();kI=nU(),vI=new lB;await kI.connect(vI)});var{runCli:_I}=await Promise.resolve().then(() => (cB(),mB));try{let W=await _I(process.argv.slice(2),{hook:async()=>{let{runHook:X}=await iB().then(() => dB);return X()},installer:async(X)=>{let{runInstallerCli:Q}=await LF().then(() => FF);await Q(X)},mcp:async()=>{await sU().then(() => yI)}});if(W!==void 0)process.exitCode=W}catch(W){let X=W instanceof Error?W.message:String(W);process.stderr.write(`ast-mcp: ${X}
245
+ `),process.exitCode=1}
133
246
 
134
- //# debugId=469F7A8CE1D1E5C164756E2164756E21
247
+ //# debugId=8F6B79A970ACE45064756E2164756E21