@stablyai/internal-playwright 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +168 -0
  4. package/ThirdPartyNotices.txt +6277 -0
  5. package/cli.js +19 -0
  6. package/index.d.ts +17 -0
  7. package/index.js +17 -0
  8. package/index.mjs +18 -0
  9. package/jsx-runtime.js +42 -0
  10. package/jsx-runtime.mjs +21 -0
  11. package/lib/agents/generateAgents.js +265 -0
  12. package/lib/agents/generator.md +102 -0
  13. package/lib/agents/healer.md +78 -0
  14. package/lib/agents/planner.md +135 -0
  15. package/lib/cli.js +274 -0
  16. package/lib/common/config.js +274 -0
  17. package/lib/common/config.js.map +7 -0
  18. package/lib/common/configLoader.js +377 -0
  19. package/lib/common/configLoader.js.map +7 -0
  20. package/lib/common/esmLoaderHost.js +102 -0
  21. package/lib/common/esmLoaderHost.js.map +7 -0
  22. package/lib/common/expectBundle.js +52 -0
  23. package/lib/common/expectBundle.js.map +7 -0
  24. package/lib/common/expectBundleImpl.js +389 -0
  25. package/lib/common/expectBundleImpl.js.map +7 -0
  26. package/lib/common/fixtures.js +302 -0
  27. package/lib/common/fixtures.js.map +7 -0
  28. package/lib/common/globals.js +58 -0
  29. package/lib/common/globals.js.map +7 -0
  30. package/lib/common/ipc.js +60 -0
  31. package/lib/common/ipc.js.map +7 -0
  32. package/lib/common/poolBuilder.js +85 -0
  33. package/lib/common/poolBuilder.js.map +7 -0
  34. package/lib/common/process.js +104 -0
  35. package/lib/common/process.js.map +7 -0
  36. package/lib/common/suiteUtils.js +140 -0
  37. package/lib/common/suiteUtils.js.map +7 -0
  38. package/lib/common/test.js +321 -0
  39. package/lib/common/test.js.map +7 -0
  40. package/lib/common/testLoader.js +100 -0
  41. package/lib/common/testLoader.js.map +7 -0
  42. package/lib/common/testType.js +310 -0
  43. package/lib/common/testType.js.map +7 -0
  44. package/lib/fsWatcher.js +67 -0
  45. package/lib/fsWatcher.js.map +7 -0
  46. package/lib/index.js +696 -0
  47. package/lib/index.js.map +7 -0
  48. package/lib/internalsForTest.js +42 -0
  49. package/lib/internalsForTest.js.map +7 -0
  50. package/lib/isomorphic/events.js +77 -0
  51. package/lib/isomorphic/events.js.map +7 -0
  52. package/lib/isomorphic/folders.js +30 -0
  53. package/lib/isomorphic/folders.js.map +7 -0
  54. package/lib/isomorphic/stringInternPool.js +69 -0
  55. package/lib/isomorphic/stringInternPool.js.map +7 -0
  56. package/lib/isomorphic/teleReceiver.js +507 -0
  57. package/lib/isomorphic/teleReceiver.js.map +7 -0
  58. package/lib/isomorphic/teleSuiteUpdater.js +137 -0
  59. package/lib/isomorphic/teleSuiteUpdater.js.map +7 -0
  60. package/lib/isomorphic/testServerConnection.js +211 -0
  61. package/lib/isomorphic/testServerConnection.js.map +7 -0
  62. package/lib/isomorphic/testServerInterface.js +16 -0
  63. package/lib/isomorphic/testServerInterface.js.map +7 -0
  64. package/lib/isomorphic/testTree.js +334 -0
  65. package/lib/isomorphic/testTree.js.map +7 -0
  66. package/lib/isomorphic/types.d.js +16 -0
  67. package/lib/isomorphic/types.d.js.map +7 -0
  68. package/lib/loader/loaderMain.js +59 -0
  69. package/lib/loader/loaderMain.js.map +7 -0
  70. package/lib/matchers/expect.js +325 -0
  71. package/lib/matchers/expect.js.map +7 -0
  72. package/lib/matchers/matcherHint.js +87 -0
  73. package/lib/matchers/matcherHint.js.map +7 -0
  74. package/lib/matchers/matchers.js +366 -0
  75. package/lib/matchers/matchers.js.map +7 -0
  76. package/lib/matchers/toBeTruthy.js +73 -0
  77. package/lib/matchers/toBeTruthy.js.map +7 -0
  78. package/lib/matchers/toEqual.js +99 -0
  79. package/lib/matchers/toEqual.js.map +7 -0
  80. package/lib/matchers/toHaveURL.js +102 -0
  81. package/lib/matchers/toHaveURL.js.map +7 -0
  82. package/lib/matchers/toMatchAriaSnapshot.js +159 -0
  83. package/lib/matchers/toMatchAriaSnapshot.js.map +7 -0
  84. package/lib/matchers/toMatchSnapshot.js +359 -0
  85. package/lib/matchers/toMatchSnapshot.js.map +7 -0
  86. package/lib/matchers/toMatchText.js +99 -0
  87. package/lib/matchers/toMatchText.js.map +7 -0
  88. package/lib/mcp/browser/actions.d.js +16 -0
  89. package/lib/mcp/browser/backend.js +93 -0
  90. package/lib/mcp/browser/backend.js.map +7 -0
  91. package/lib/mcp/browser/browserContextFactory.js +296 -0
  92. package/lib/mcp/browser/browserServerBackend.js +76 -0
  93. package/lib/mcp/browser/codegen.js +66 -0
  94. package/lib/mcp/browser/config.js +385 -0
  95. package/lib/mcp/browser/context.js +287 -0
  96. package/lib/mcp/browser/response.js +228 -0
  97. package/lib/mcp/browser/sessionLog.js +160 -0
  98. package/lib/mcp/browser/tab.js +277 -0
  99. package/lib/mcp/browser/tool.js +30 -0
  100. package/lib/mcp/browser/tool.js.map +7 -0
  101. package/lib/mcp/browser/tools/common.js +63 -0
  102. package/lib/mcp/browser/tools/console.js +44 -0
  103. package/lib/mcp/browser/tools/dialogs.js +60 -0
  104. package/lib/mcp/browser/tools/evaluate.js +70 -0
  105. package/lib/mcp/browser/tools/files.js +58 -0
  106. package/lib/mcp/browser/tools/form.js +74 -0
  107. package/lib/mcp/browser/tools/install.js +69 -0
  108. package/lib/mcp/browser/tools/keyboard.js +85 -0
  109. package/lib/mcp/browser/tools/mouse.js +107 -0
  110. package/lib/mcp/browser/tools/navigate.js +62 -0
  111. package/lib/mcp/browser/tools/network.js +54 -0
  112. package/lib/mcp/browser/tools/pdf.js +59 -0
  113. package/lib/mcp/browser/tools/screenshot.js +88 -0
  114. package/lib/mcp/browser/tools/snapshot.js +182 -0
  115. package/lib/mcp/browser/tools/tabs.js +67 -0
  116. package/lib/mcp/browser/tools/tool.js +49 -0
  117. package/lib/mcp/browser/tools/tracing.js +74 -0
  118. package/lib/mcp/browser/tools/utils.js +100 -0
  119. package/lib/mcp/browser/tools/verify.js +154 -0
  120. package/lib/mcp/browser/tools/wait.js +63 -0
  121. package/lib/mcp/browser/tools.js +80 -0
  122. package/lib/mcp/browser/tools.js.map +7 -0
  123. package/lib/mcp/browser/watchdog.js +44 -0
  124. package/lib/mcp/config.d.js +16 -0
  125. package/lib/mcp/extension/cdpRelay.js +351 -0
  126. package/lib/mcp/extension/extensionContextFactory.js +75 -0
  127. package/lib/mcp/extension/protocol.js +28 -0
  128. package/lib/mcp/index.js +61 -0
  129. package/lib/mcp/log.js +35 -0
  130. package/lib/mcp/program.js +96 -0
  131. package/lib/mcp/sdk/bundle.js +81 -0
  132. package/lib/mcp/sdk/bundle.js.map +7 -0
  133. package/lib/mcp/sdk/call.js +49 -0
  134. package/lib/mcp/sdk/call.js.map +7 -0
  135. package/lib/mcp/sdk/exports.js +32 -0
  136. package/lib/mcp/sdk/exports.js.map +7 -0
  137. package/lib/mcp/sdk/http.js +187 -0
  138. package/lib/mcp/sdk/http.js.map +7 -0
  139. package/lib/mcp/sdk/inProcessTransport.js +71 -0
  140. package/lib/mcp/sdk/inProcessTransport.js.map +7 -0
  141. package/lib/mcp/sdk/mdb.js +206 -0
  142. package/lib/mcp/sdk/mdb.js.map +7 -0
  143. package/lib/mcp/sdk/proxyBackend.js +128 -0
  144. package/lib/mcp/sdk/proxyBackend.js.map +7 -0
  145. package/lib/mcp/sdk/server.js +189 -0
  146. package/lib/mcp/sdk/server.js.map +7 -0
  147. package/lib/mcp/sdk/tool.js +51 -0
  148. package/lib/mcp/sdk/tool.js.map +7 -0
  149. package/lib/mcp/test/backend.js +67 -0
  150. package/lib/mcp/test/backend.js.map +7 -0
  151. package/lib/mcp/test/browserBackend.js +98 -0
  152. package/lib/mcp/test/context.js +48 -0
  153. package/lib/mcp/test/context.js.map +7 -0
  154. package/lib/mcp/test/generatorTools.js +122 -0
  155. package/lib/mcp/test/plannerTools.js +46 -0
  156. package/lib/mcp/test/seed.js +72 -0
  157. package/lib/mcp/test/streams.js +39 -0
  158. package/lib/mcp/test/streams.js.map +7 -0
  159. package/lib/mcp/test/testBackend.js +97 -0
  160. package/lib/mcp/test/testContext.js +176 -0
  161. package/lib/mcp/test/testTool.js +30 -0
  162. package/lib/mcp/test/testTools.js +115 -0
  163. package/lib/mcp/test/tool.js +30 -0
  164. package/lib/mcp/test/tool.js.map +7 -0
  165. package/lib/mcp/test/tools.js +150 -0
  166. package/lib/mcp/test/tools.js.map +7 -0
  167. package/lib/mcp/vscode/host.js +187 -0
  168. package/lib/mcp/vscode/main.js +77 -0
  169. package/lib/mcpBundleImpl.js +41 -0
  170. package/lib/mcpBundleImpl.js.map +7 -0
  171. package/lib/plugins/gitCommitInfoPlugin.js +198 -0
  172. package/lib/plugins/gitCommitInfoPlugin.js.map +7 -0
  173. package/lib/plugins/index.js +28 -0
  174. package/lib/plugins/index.js.map +7 -0
  175. package/lib/plugins/webServerPlugin.js +209 -0
  176. package/lib/plugins/webServerPlugin.js.map +7 -0
  177. package/lib/program.js +412 -0
  178. package/lib/program.js.map +7 -0
  179. package/lib/reporters/base.js +609 -0
  180. package/lib/reporters/base.js.map +7 -0
  181. package/lib/reporters/blob.js +135 -0
  182. package/lib/reporters/blob.js.map +7 -0
  183. package/lib/reporters/dot.js +82 -0
  184. package/lib/reporters/dot.js.map +7 -0
  185. package/lib/reporters/empty.js +32 -0
  186. package/lib/reporters/empty.js.map +7 -0
  187. package/lib/reporters/github.js +128 -0
  188. package/lib/reporters/github.js.map +7 -0
  189. package/lib/reporters/html.js +644 -0
  190. package/lib/reporters/html.js.map +7 -0
  191. package/lib/reporters/internalReporter.js +130 -0
  192. package/lib/reporters/internalReporter.js.map +7 -0
  193. package/lib/reporters/json.js +254 -0
  194. package/lib/reporters/json.js.map +7 -0
  195. package/lib/reporters/junit.js +230 -0
  196. package/lib/reporters/junit.js.map +7 -0
  197. package/lib/reporters/line.js +113 -0
  198. package/lib/reporters/line.js.map +7 -0
  199. package/lib/reporters/list.js +235 -0
  200. package/lib/reporters/list.js.map +7 -0
  201. package/lib/reporters/listModeReporter.js +69 -0
  202. package/lib/reporters/listModeReporter.js.map +7 -0
  203. package/lib/reporters/markdown.js +144 -0
  204. package/lib/reporters/markdown.js.map +7 -0
  205. package/lib/reporters/merge.js +535 -0
  206. package/lib/reporters/merge.js.map +7 -0
  207. package/lib/reporters/multiplexer.js +104 -0
  208. package/lib/reporters/multiplexer.js.map +7 -0
  209. package/lib/reporters/reporterV2.js +102 -0
  210. package/lib/reporters/reporterV2.js.map +7 -0
  211. package/lib/reporters/teleEmitter.js +297 -0
  212. package/lib/reporters/teleEmitter.js.map +7 -0
  213. package/lib/reporters/versions/blobV1.js +16 -0
  214. package/lib/reporters/versions/blobV1.js.map +7 -0
  215. package/lib/runner/dispatcher.js +491 -0
  216. package/lib/runner/dispatcher.js.map +7 -0
  217. package/lib/runner/failureTracker.js +72 -0
  218. package/lib/runner/failureTracker.js.map +7 -0
  219. package/lib/runner/lastRun.js +77 -0
  220. package/lib/runner/lastRun.js.map +7 -0
  221. package/lib/runner/loadUtils.js +333 -0
  222. package/lib/runner/loadUtils.js.map +7 -0
  223. package/lib/runner/loaderHost.js +89 -0
  224. package/lib/runner/loaderHost.js.map +7 -0
  225. package/lib/runner/processHost.js +161 -0
  226. package/lib/runner/processHost.js.map +7 -0
  227. package/lib/runner/projectUtils.js +241 -0
  228. package/lib/runner/projectUtils.js.map +7 -0
  229. package/lib/runner/rebase.js +189 -0
  230. package/lib/runner/rebase.js.map +7 -0
  231. package/lib/runner/reporters.js +137 -0
  232. package/lib/runner/reporters.js.map +7 -0
  233. package/lib/runner/runner.js +173 -0
  234. package/lib/runner/sigIntWatcher.js +96 -0
  235. package/lib/runner/sigIntWatcher.js.map +7 -0
  236. package/lib/runner/taskRunner.js +127 -0
  237. package/lib/runner/taskRunner.js.map +7 -0
  238. package/lib/runner/tasks.js +410 -0
  239. package/lib/runner/tasks.js.map +7 -0
  240. package/lib/runner/testGroups.js +117 -0
  241. package/lib/runner/testGroups.js.map +7 -0
  242. package/lib/runner/testRunner.js +390 -0
  243. package/lib/runner/testRunner.js.map +7 -0
  244. package/lib/runner/testServer.js +264 -0
  245. package/lib/runner/testServer.js.map +7 -0
  246. package/lib/runner/uiMode.js +271 -0
  247. package/lib/runner/uiModeReporter.js +30 -0
  248. package/lib/runner/uiModeReporter.js.map +7 -0
  249. package/lib/runner/vcs.js +72 -0
  250. package/lib/runner/vcs.js.map +7 -0
  251. package/lib/runner/watchMode.js +395 -0
  252. package/lib/runner/watchMode.js.map +7 -0
  253. package/lib/runner/workerHost.js +95 -0
  254. package/lib/runner/workerHost.js.map +7 -0
  255. package/lib/store.js +98 -0
  256. package/lib/third_party/pirates.js +62 -0
  257. package/lib/third_party/pirates.js.map +7 -0
  258. package/lib/third_party/tsconfig-loader.js +103 -0
  259. package/lib/third_party/tsconfig-loader.js.map +7 -0
  260. package/lib/transform/babelBundle.js +43 -0
  261. package/lib/transform/babelBundle.js.map +7 -0
  262. package/lib/transform/babelBundleImpl.js +461 -0
  263. package/lib/transform/babelBundleImpl.js.map +7 -0
  264. package/lib/transform/compilationCache.js +272 -0
  265. package/lib/transform/compilationCache.js.map +7 -0
  266. package/lib/transform/esmLoader.js +104 -0
  267. package/lib/transform/esmLoader.js.map +7 -0
  268. package/lib/transform/esmUtils.js +32 -0
  269. package/lib/transform/portTransport.js +67 -0
  270. package/lib/transform/portTransport.js.map +7 -0
  271. package/lib/transform/transform.js +293 -0
  272. package/lib/transform/transform.js.map +7 -0
  273. package/lib/util.js +403 -0
  274. package/lib/util.js.map +7 -0
  275. package/lib/utilsBundle.js +43 -0
  276. package/lib/utilsBundle.js.map +7 -0
  277. package/lib/utilsBundleImpl.js +100 -0
  278. package/lib/utilsBundleImpl.js.map +7 -0
  279. package/lib/worker/fixtureRunner.js +258 -0
  280. package/lib/worker/fixtureRunner.js.map +7 -0
  281. package/lib/worker/stepContext.js +34 -0
  282. package/lib/worker/testInfo.js +508 -0
  283. package/lib/worker/testInfo.js.map +7 -0
  284. package/lib/worker/testTracing.js +344 -0
  285. package/lib/worker/testTracing.js.map +7 -0
  286. package/lib/worker/timeoutManager.js +174 -0
  287. package/lib/worker/timeoutManager.js.map +7 -0
  288. package/lib/worker/util.js +31 -0
  289. package/lib/worker/util.js.map +7 -0
  290. package/lib/worker/workerMain.js +520 -0
  291. package/lib/worker/workerMain.js.map +7 -0
  292. package/package.json +74 -0
  293. package/test.d.ts +18 -0
  294. package/test.js +24 -0
  295. package/test.mjs +33 -0
  296. package/types/test.d.ts +10217 -0
  297. package/types/testReporter.d.ts +816 -0
@@ -0,0 +1,41 @@
1
+ "use strict";var md=Object.create;var Aa=Object.defineProperty;var vd=Object.getOwnPropertyDescriptor;var gd=Object.getOwnPropertyNames;var yd=Object.getPrototypeOf,_d=Object.prototype.hasOwnProperty;var z=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),xi=(a,e)=>{for(var t in e)Aa(a,t,{get:e[t],enumerable:!0})},Ei=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of gd(e))!_d.call(a,r)&&r!==t&&Aa(a,r,{get:()=>e[r],enumerable:!(s=vd(e,r))||s.enumerable});return a};var br=(a,e,t)=>(t=a!=null?md(yd(a)):{},Ei(e||!a||!a.__esModule?Aa(t,"default",{value:a,enumerable:!0}):t,a)),bd=a=>Ei(Aa({},"__esModule",{value:!0}),a);var Yi=z((Ba,Ki)=>{(function(a,e){typeof Ba=="object"&&typeof Ki!="undefined"?e(Ba):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Ba,(function(a){"use strict";function e(){for(var _=arguments.length,p=Array(_),b=0;b<_;b++)p[b]=arguments[b];if(p.length>1){p[0]=p[0].slice(0,-1);for(var x=p.length-1,E=1;E<x;++E)p[E]=p[E].slice(1,-1);return p[x]=p[x].slice(1),p.join("")}else return p[0]}function t(_){return"(?:"+_+")"}function s(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function r(_){return _.toUpperCase()}function n(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function i(_,p){var b=_;if(p)for(var x in p)b[x]=p[x];return b}function o(_){var p="[A-Za-z]",b="[\\x0D]",x="[0-9]",E="[\\x22]",j=e(x,"[A-Fa-f]"),W="[\\x0A]",se="[\\x20]",le=t(t("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+t("%[89A-Fa-f]"+j+"%"+j+j)+"|"+t("%"+j+j)),xe="[\\:\\/\\?\\#\\[\\]\\@]",ae="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",me=e(xe,ae),Ee=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",he=_?"[\\uE000-\\uF8FF]":"[]",ie=e(p,x,"[\\-\\.\\_\\~]",Ee),ve=t(p+e(p,x,"[\\+\\-\\.]")+"*"),ue=t(t(le+"|"+e(ie,ae,"[\\:]"))+"*"),Zr=t(t("25[0-5]")+"|"+t("2[0-4]"+x)+"|"+t("1"+x+x)+"|"+t("[1-9]"+x)+"|"+x),Be=t(t("25[0-5]")+"|"+t("2[0-4]"+x)+"|"+t("1"+x+x)+"|"+t("0?[1-9]"+x)+"|0?0?"+x),Ge=t(Be+"\\."+Be+"\\."+Be+"\\."+Be),de=t(j+"{1,4}"),Je=t(t(de+"\\:"+de)+"|"+Ge),Ke=t(t(de+"\\:")+"{6}"+Je),ur=t("\\:\\:"+t(de+"\\:")+"{5}"+Je),Br=t(t(de)+"?\\:\\:"+t(de+"\\:")+"{4}"+Je),gr=t(t(t(de+"\\:")+"{0,1}"+de)+"?\\:\\:"+t(de+"\\:")+"{3}"+Je),Qt=t(t(t(de+"\\:")+"{0,2}"+de)+"?\\:\\:"+t(de+"\\:")+"{2}"+Je),Ta=t(t(t(de+"\\:")+"{0,3}"+de)+"?\\:\\:"+de+"\\:"+Je),Ca=t(t(t(de+"\\:")+"{0,4}"+de)+"?\\:\\:"+Je),bt=t(t(t(de+"\\:")+"{0,5}"+de)+"?\\:\\:"+de),wt=t(t(t(de+"\\:")+"{0,6}"+de)+"?\\:\\:"),yr=t([Ke,ur,Br,gr,Qt,Ta,Ca,bt,wt].join("|")),xt=t(t(ie+"|"+le)+"+"),ks=t(yr+"\\%25"+xt),Jr=t(yr+t("\\%25|\\%(?!"+j+"{2})")+xt),ld=t("[vV]"+j+"+\\."+e(ie,ae,"[\\:]")+"+"),cd=t("\\["+t(Jr+"|"+yr+"|"+ld)+"\\]"),yi=t(t(le+"|"+e(ie,ae))+"*"),Wt=t(cd+"|"+Ge+"(?!"+yi+")|"+yi),Gt=t(x+"*"),_i=t(t(ue+"@")+"?"+Wt+t("\\:"+Gt)+"?"),Kt=t(le+"|"+e(ie,ae,"[\\:\\@]")),ud=t(Kt+"*"),bi=t(Kt+"+"),dd=t(t(le+"|"+e(ie,ae,"[\\@]"))+"+"),_r=t(t("\\/"+ud)+"*"),Et=t("\\/"+t(bi+_r)+"?"),Ds=t(dd+_r),Ia=t(bi+_r),Pt="(?!"+Kt+")",bv=t(_r+"|"+Et+"|"+Ds+"|"+Ia+"|"+Pt),St=t(t(Kt+"|"+e("[\\/\\?]",he))+"*"),Yt=t(t(Kt+"|[\\/\\?]")+"*"),wi=t(t("\\/\\/"+_i+_r)+"|"+Et+"|"+Ia+"|"+Pt),hd=t(ve+"\\:"+wi+t("\\?"+St)+"?"+t("\\#"+Yt)+"?"),fd=t(t("\\/\\/"+_i+_r)+"|"+Et+"|"+Ds+"|"+Pt),pd=t(fd+t("\\?"+St)+"?"+t("\\#"+Yt)+"?"),wv=t(hd+"|"+pd),xv=t(ve+"\\:"+wi+t("\\?"+St)+"?"),Ev="^("+ve+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Wt+")"+t("\\:("+Gt+")")+"?)")+"?("+_r+"|"+Et+"|"+Ia+"|"+Pt+")")+t("\\?("+St+")")+"?"+t("\\#("+Yt+")")+"?$",Pv="^(){0}"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Wt+")"+t("\\:("+Gt+")")+"?)")+"?("+_r+"|"+Et+"|"+Ds+"|"+Pt+")")+t("\\?("+St+")")+"?"+t("\\#("+Yt+")")+"?$",Sv="^("+ve+")\\:"+t(t("\\/\\/("+t("("+ue+")@")+"?("+Wt+")"+t("\\:("+Gt+")")+"?)")+"?("+_r+"|"+Et+"|"+Ia+"|"+Pt+")")+t("\\?("+St+")")+"?$",Rv="^"+t("\\#("+Yt+")")+"?$",Ov="^"+t("("+ue+")@")+"?("+Wt+")"+t("\\:("+Gt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",p,x,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ie,ae),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ie,ae),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ie,ae),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ie,ae),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]",he),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ie,ae,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ie,ae),"g"),UNRESERVED:new RegExp(ie,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ie,me),"g"),PCT_ENCODED:new RegExp(le,"g"),IPV4ADDRESS:new RegExp("^("+Ge+")$"),IPV6ADDRESS:new RegExp("^\\[?("+yr+")"+t(t("\\%25|\\%(?!"+j+"{2})")+"("+xt+")")+"?\\]?$")}}var u=o(!1),c=o(!0),h=(function(){function _(p,b){var x=[],E=!0,j=!1,W=void 0;try{for(var se=p[Symbol.iterator](),le;!(E=(le=se.next()).done)&&(x.push(le.value),!(b&&x.length===b));E=!0);}catch(xe){j=!0,W=xe}finally{try{!E&&se.return&&se.return()}finally{if(j)throw W}}return x}return function(p,b){if(Array.isArray(p))return p;if(Symbol.iterator in Object(p))return _(p,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),f=function(_){if(Array.isArray(_)){for(var p=0,b=Array(_.length);p<_.length;p++)b[p]=_[p];return b}else return Array.from(_)},g=2147483647,d=36,y=1,m=26,v=38,w=700,S=72,P=128,O="-",I=/^xn--/,A=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},$=d-y,U=Math.floor,F=String.fromCharCode;function L(_){throw new RangeError(q[_])}function C(_,p){for(var b=[],x=_.length;x--;)b[x]=p(_[x]);return b}function k(_,p){var b=_.split("@"),x="";b.length>1&&(x=b[0]+"@",_=b[1]),_=_.replace(H,".");var E=_.split("."),j=C(E,p).join(".");return x+j}function M(_){for(var p=[],b=0,x=_.length;b<x;){var E=_.charCodeAt(b++);if(E>=55296&&E<=56319&&b<x){var j=_.charCodeAt(b++);(j&64512)==56320?p.push(((E&1023)<<10)+(j&1023)+65536):(p.push(E),b--)}else p.push(E)}return p}var ce=function(p){return String.fromCodePoint.apply(String,f(p))},Y=function(p){return p-48<10?p-22:p-65<26?p-65:p-97<26?p-97:d},te=function(p,b){return p+22+75*(p<26)-((b!=0)<<5)},K=function(p,b,x){var E=0;for(p=x?U(p/w):p>>1,p+=U(p/b);p>$*m>>1;E+=d)p=U(p/$);return U(E+($+1)*p/(p+v))},Z=function(p){var b=[],x=p.length,E=0,j=P,W=S,se=p.lastIndexOf(O);se<0&&(se=0);for(var le=0;le<se;++le)p.charCodeAt(le)>=128&&L("not-basic"),b.push(p.charCodeAt(le));for(var xe=se>0?se+1:0;xe<x;){for(var ae=E,me=1,Ee=d;;Ee+=d){xe>=x&&L("invalid-input");var he=Y(p.charCodeAt(xe++));(he>=d||he>U((g-E)/me))&&L("overflow"),E+=he*me;var ie=Ee<=W?y:Ee>=W+m?m:Ee-W;if(he<ie)break;var ve=d-ie;me>U(g/ve)&&L("overflow"),me*=ve}var ue=b.length+1;W=K(E-ae,ue,ae==0),U(E/ue)>g-j&&L("overflow"),j+=U(E/ue),E%=ue,b.splice(E++,0,j)}return String.fromCodePoint.apply(String,b)},ge=function(p){var b=[];p=M(p);var x=p.length,E=P,j=0,W=S,se=!0,le=!1,xe=void 0;try{for(var ae=p[Symbol.iterator](),me;!(se=(me=ae.next()).done);se=!0){var Ee=me.value;Ee<128&&b.push(F(Ee))}}catch(Jr){le=!0,xe=Jr}finally{try{!se&&ae.return&&ae.return()}finally{if(le)throw xe}}var he=b.length,ie=he;for(he&&b.push(O);ie<x;){var ve=g,ue=!0,Zr=!1,Be=void 0;try{for(var Ge=p[Symbol.iterator](),de;!(ue=(de=Ge.next()).done);ue=!0){var Je=de.value;Je>=E&&Je<ve&&(ve=Je)}}catch(Jr){Zr=!0,Be=Jr}finally{try{!ue&&Ge.return&&Ge.return()}finally{if(Zr)throw Be}}var Ke=ie+1;ve-E>U((g-j)/Ke)&&L("overflow"),j+=(ve-E)*Ke,E=ve;var ur=!0,Br=!1,gr=void 0;try{for(var Qt=p[Symbol.iterator](),Ta;!(ur=(Ta=Qt.next()).done);ur=!0){var Ca=Ta.value;if(Ca<E&&++j>g&&L("overflow"),Ca==E){for(var bt=j,wt=d;;wt+=d){var yr=wt<=W?y:wt>=W+m?m:wt-W;if(bt<yr)break;var xt=bt-yr,ks=d-yr;b.push(F(te(yr+xt%ks,0))),bt=U(xt/ks)}b.push(F(te(bt,0))),W=K(j,Ke,ie==he),j=0,++ie}}}catch(Jr){Br=!0,gr=Jr}finally{try{!ur&&Qt.return&&Qt.return()}finally{if(Br)throw gr}}++j,++E}return b.join("")},Ie=function(p){return k(p,function(b){return I.test(b)?Z(b.slice(4).toLowerCase()):b})},De=function(p){return k(p,function(b){return A.test(b)?"xn--"+ge(b):b})},ne={version:"2.1.0",ucs2:{decode:M,encode:ce},decode:Z,encode:ge,toASCII:De,toUnicode:Ie},be={};function Re(_){var p=_.charCodeAt(0),b=void 0;return p<16?b="%0"+p.toString(16).toUpperCase():p<128?b="%"+p.toString(16).toUpperCase():p<2048?b="%"+(p>>6|192).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase():b="%"+(p>>12|224).toString(16).toUpperCase()+"%"+(p>>6&63|128).toString(16).toUpperCase()+"%"+(p&63|128).toString(16).toUpperCase(),b}function Ne(_){for(var p="",b=0,x=_.length;b<x;){var E=parseInt(_.substr(b+1,2),16);if(E<128)p+=String.fromCharCode(E),b+=3;else if(E>=194&&E<224){if(x-b>=6){var j=parseInt(_.substr(b+4,2),16);p+=String.fromCharCode((E&31)<<6|j&63)}else p+=_.substr(b,6);b+=6}else if(E>=224){if(x-b>=9){var W=parseInt(_.substr(b+4,2),16),se=parseInt(_.substr(b+7,2),16);p+=String.fromCharCode((E&15)<<12|(W&63)<<6|se&63)}else p+=_.substr(b,9);b+=9}else p+=_.substr(b,3),b+=3}return p}function Cr(_,p){function b(x){var E=Ne(x);return E.match(p.UNRESERVED)?E:x}return _.scheme&&(_.scheme=String(_.scheme).replace(p.PCT_ENCODED,b).toLowerCase().replace(p.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(p.PCT_ENCODED,b).replace(p.NOT_USERINFO,Re).replace(p.PCT_ENCODED,r)),_.host!==void 0&&(_.host=String(_.host).replace(p.PCT_ENCODED,b).toLowerCase().replace(p.NOT_HOST,Re).replace(p.PCT_ENCODED,r)),_.path!==void 0&&(_.path=String(_.path).replace(p.PCT_ENCODED,b).replace(_.scheme?p.NOT_PATH:p.NOT_PATH_NOSCHEME,Re).replace(p.PCT_ENCODED,r)),_.query!==void 0&&(_.query=String(_.query).replace(p.PCT_ENCODED,b).replace(p.NOT_QUERY,Re).replace(p.PCT_ENCODED,r)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(p.PCT_ENCODED,b).replace(p.NOT_FRAGMENT,Re).replace(p.PCT_ENCODED,r)),_}function mr(_){return _.replace(/^0*(.*)/,"$1")||"0"}function we(_,p){var b=_.match(p.IPV4ADDRESS)||[],x=h(b,2),E=x[1];return E?E.split(".").map(mr).join("."):_}function ye(_,p){var b=_.match(p.IPV6ADDRESS)||[],x=h(b,3),E=x[1],j=x[2];if(E){for(var W=E.toLowerCase().split("::").reverse(),se=h(W,2),le=se[0],xe=se[1],ae=xe?xe.split(":").map(mr):[],me=le.split(":").map(mr),Ee=p.IPV4ADDRESS.test(me[me.length-1]),he=Ee?7:8,ie=me.length-he,ve=Array(he),ue=0;ue<he;++ue)ve[ue]=ae[ue]||me[ie+ue]||"";Ee&&(ve[he-1]=we(ve[he-1],p));var Zr=ve.reduce(function(Ke,ur,Br){if(!ur||ur==="0"){var gr=Ke[Ke.length-1];gr&&gr.index+gr.length===Br?gr.length++:Ke.push({index:Br,length:1})}return Ke},[]),Be=Zr.sort(function(Ke,ur){return ur.length-Ke.length})[0],Ge=void 0;if(Be&&Be.length>1){var de=ve.slice(0,Be.index),Je=ve.slice(Be.index+Be.length);Ge=de.join(":")+"::"+Je.join(":")}else Ge=ve.join(":");return j&&(Ge+="%"+j),Ge}else return _}var zr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Ae="".match(/(){0}/)[1]===void 0;function oe(_){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},x=p.iri!==!1?c:u;p.reference==="suffix"&&(_=(p.scheme?p.scheme+":":"")+"//"+_);var E=_.match(zr);if(E){Ae?(b.scheme=E[1],b.userinfo=E[3],b.host=E[4],b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=E[7],b.fragment=E[8],isNaN(b.port)&&(b.port=E[5])):(b.scheme=E[1]||void 0,b.userinfo=_.indexOf("@")!==-1?E[3]:void 0,b.host=_.indexOf("//")!==-1?E[4]:void 0,b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=_.indexOf("?")!==-1?E[7]:void 0,b.fragment=_.indexOf("#")!==-1?E[8]:void 0,isNaN(b.port)&&(b.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),b.host&&(b.host=ye(we(b.host,x),x)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",p.reference&&p.reference!=="suffix"&&p.reference!==b.reference&&(b.error=b.error||"URI is not a "+p.reference+" reference.");var j=be[(p.scheme||b.scheme||"").toLowerCase()];if(!p.unicodeSupport&&(!j||!j.unicodeSupport)){if(b.host&&(p.domainHost||j&&j.domainHost))try{b.host=ne.toASCII(b.host.replace(x.PCT_ENCODED,Ne).toLowerCase())}catch(W){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+W}Cr(b,u)}else Cr(b,x);j&&j.parse&&j.parse(b,p)}else b.error=b.error||"URI can not be parsed.";return b}function Ir(_,p){var b=p.iri!==!1?c:u,x=[];return _.userinfo!==void 0&&(x.push(_.userinfo),x.push("@")),_.host!==void 0&&x.push(ye(we(String(_.host),b),b).replace(b.IPV6ADDRESS,function(E,j,W){return"["+j+(W?"%25"+W:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(x.push(":"),x.push(String(_.port))),x.length?x.join(""):void 0}var vr=/^\.\.?\//,Vr=/^\/\.(\/|$)/,Hr=/^\/\.\.(\/|$)/,Te=/^\/?(?:.|\n)*?(?=\/|$)/;function We(_){for(var p=[];_.length;)if(_.match(vr))_=_.replace(vr,"");else if(_.match(Vr))_=_.replace(Vr,"/");else if(_.match(Hr))_=_.replace(Hr,"/"),p.pop();else if(_==="."||_==="..")_="";else{var b=_.match(Te);if(b){var x=b[0];_=_.slice(x.length),p.push(x)}else throw new Error("Unexpected dot segment condition")}return p.join("")}function Fe(_){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=p.iri?c:u,x=[],E=be[(p.scheme||_.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(_,p),_.host&&!b.IPV6ADDRESS.test(_.host)){if(p.domainHost||E&&E.domainHost)try{_.host=p.iri?ne.toUnicode(_.host):ne.toASCII(_.host.replace(b.PCT_ENCODED,Ne).toLowerCase())}catch(se){_.error=_.error||"Host's domain name can not be converted to "+(p.iri?"Unicode":"ASCII")+" via punycode: "+se}}Cr(_,b),p.reference!=="suffix"&&_.scheme&&(x.push(_.scheme),x.push(":"));var j=Ir(_,p);if(j!==void 0&&(p.reference!=="suffix"&&x.push("//"),x.push(j),_.path&&_.path.charAt(0)!=="/"&&x.push("/")),_.path!==void 0){var W=_.path;!p.absolutePath&&(!E||!E.absolutePath)&&(W=We(W)),j===void 0&&(W=W.replace(/^\/\//,"/%2F")),x.push(W)}return _.query!==void 0&&(x.push("?"),x.push(_.query)),_.fragment!==void 0&&(x.push("#"),x.push(_.fragment)),x.join("")}function je(_,p){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},x=arguments[3],E={};return x||(_=oe(Fe(_,b),b),p=oe(Fe(p,b),b)),b=b||{},!b.tolerant&&p.scheme?(E.scheme=p.scheme,E.userinfo=p.userinfo,E.host=p.host,E.port=p.port,E.path=We(p.path||""),E.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(E.userinfo=p.userinfo,E.host=p.host,E.port=p.port,E.path=We(p.path||""),E.query=p.query):(p.path?(p.path.charAt(0)==="/"?E.path=We(p.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?E.path="/"+p.path:_.path?E.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+p.path:E.path=p.path,E.path=We(E.path)),E.query=p.query):(E.path=_.path,p.query!==void 0?E.query=p.query:E.query=_.query),E.userinfo=_.userinfo,E.host=_.host,E.port=_.port),E.scheme=_.scheme),E.fragment=p.fragment,E}function lr(_,p,b){var x=i({scheme:"null"},b);return Fe(je(oe(_,x),oe(p,x),x,!0),x)}function Ze(_,p){return typeof _=="string"?_=Fe(oe(_,p),p):s(_)==="object"&&(_=oe(Fe(_,p),p)),_}function Oa(_,p,b){return typeof _=="string"?_=Fe(oe(_,b),b):s(_)==="object"&&(_=Fe(_,b)),typeof p=="string"?p=Fe(oe(p,b),b):s(p)==="object"&&(p=Fe(p,b)),_===p}function As(_,p){return _&&_.toString().replace(!p||!p.iri?u.ESCAPE:c.ESCAPE,Re)}function ar(_,p){return _&&_.toString().replace(!p||!p.iri?u.PCT_ENCODED:c.PCT_ENCODED,Ne)}var Bt={scheme:"http",domainHost:!0,parse:function(p,b){return p.host||(p.error=p.error||"HTTP URIs must have a host."),p},serialize:function(p,b){var x=String(p.scheme).toLowerCase()==="https";return(p.port===(x?443:80)||p.port==="")&&(p.port=void 0),p.path||(p.path="/"),p}},ui={scheme:"https",domainHost:Bt.domainHost,parse:Bt.parse,serialize:Bt.serialize};function di(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var Jt={scheme:"ws",domainHost:!0,parse:function(p,b){var x=p;return x.secure=di(x),x.resourceName=(x.path||"/")+(x.query?"?"+x.query:""),x.path=void 0,x.query=void 0,x},serialize:function(p,b){if((p.port===(di(p)?443:80)||p.port==="")&&(p.port=void 0),typeof p.secure=="boolean"&&(p.scheme=p.secure?"wss":"ws",p.secure=void 0),p.resourceName){var x=p.resourceName.split("?"),E=h(x,2),j=E[0],W=E[1];p.path=j&&j!=="/"?j:void 0,p.query=W,p.resourceName=void 0}return p.fragment=void 0,p}},hi={scheme:"wss",domainHost:Jt.domainHost,parse:Jt.parse,serialize:Jt.serialize},Gu={},Ku=!0,fi="[A-Za-z0-9\\-\\.\\_\\~"+(Ku?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",cr="[0-9A-Fa-f]",Yu=t(t("%[EFef]"+cr+"%"+cr+cr+"%"+cr+cr)+"|"+t("%[89A-Fa-f]"+cr+"%"+cr+cr)+"|"+t("%"+cr+cr)),Xu="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",ed="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",rd=e(ed,'[\\"\\\\]'),td="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",ad=new RegExp(fi,"g"),_t=new RegExp(Yu,"g"),sd=new RegExp(e("[^]",Xu,"[\\.]",'[\\"]',rd),"g"),pi=new RegExp(e("[^]",fi,td),"g"),nd=pi;function $s(_){var p=Ne(_);return p.match(ad)?p:_}var mi={scheme:"mailto",parse:function(p,b){var x=p,E=x.to=x.path?x.path.split(","):[];if(x.path=void 0,x.query){for(var j=!1,W={},se=x.query.split("&"),le=0,xe=se.length;le<xe;++le){var ae=se[le].split("=");switch(ae[0]){case"to":for(var me=ae[1].split(","),Ee=0,he=me.length;Ee<he;++Ee)E.push(me[Ee]);break;case"subject":x.subject=ar(ae[1],b);break;case"body":x.body=ar(ae[1],b);break;default:j=!0,W[ar(ae[0],b)]=ar(ae[1],b);break}}j&&(x.headers=W)}x.query=void 0;for(var ie=0,ve=E.length;ie<ve;++ie){var ue=E[ie].split("@");if(ue[0]=ar(ue[0]),b.unicodeSupport)ue[1]=ar(ue[1],b).toLowerCase();else try{ue[1]=ne.toASCII(ar(ue[1],b).toLowerCase())}catch(Zr){x.error=x.error||"Email address's domain name can not be converted to ASCII via punycode: "+Zr}E[ie]=ue.join("@")}return x},serialize:function(p,b){var x=p,E=n(p.to);if(E){for(var j=0,W=E.length;j<W;++j){var se=String(E[j]),le=se.lastIndexOf("@"),xe=se.slice(0,le).replace(_t,$s).replace(_t,r).replace(sd,Re),ae=se.slice(le+1);try{ae=b.iri?ne.toUnicode(ae):ne.toASCII(ar(ae,b).toLowerCase())}catch(ie){x.error=x.error||"Email address's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ie}E[j]=xe+"@"+ae}x.path=E.join(",")}var me=p.headers=p.headers||{};p.subject&&(me.subject=p.subject),p.body&&(me.body=p.body);var Ee=[];for(var he in me)me[he]!==Gu[he]&&Ee.push(he.replace(_t,$s).replace(_t,r).replace(pi,Re)+"="+me[he].replace(_t,$s).replace(_t,r).replace(nd,Re));return Ee.length&&(x.query=Ee.join("&")),x}},id=/^([^\:]+)\:(.*)/,vi={scheme:"urn",parse:function(p,b){var x=p.path&&p.path.match(id),E=p;if(x){var j=b.scheme||E.scheme||"urn",W=x[1].toLowerCase(),se=x[2],le=j+":"+(b.nid||W),xe=be[le];E.nid=W,E.nss=se,E.path=void 0,xe&&(E=xe.parse(E,b))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(p,b){var x=b.scheme||p.scheme||"urn",E=p.nid,j=x+":"+(b.nid||E),W=be[j];W&&(p=W.serialize(p,b));var se=p,le=p.nss;return se.path=(E||b.nid)+":"+le,se}},od=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,gi={scheme:"urn:uuid",parse:function(p,b){var x=p;return x.uuid=x.nss,x.nss=void 0,!b.tolerant&&(!x.uuid||!x.uuid.match(od))&&(x.error=x.error||"UUID is not valid."),x},serialize:function(p,b){var x=p;return x.nss=(p.uuid||"").toLowerCase(),x}};be[Bt.scheme]=Bt,be[ui.scheme]=ui,be[Jt.scheme]=Jt,be[hi.scheme]=hi,be[mi.scheme]=mi,be[vi.scheme]=vi,be[gi.scheme]=gi,a.SCHEMES=be,a.pctEncChar=Re,a.pctDecChars=Ne,a.parse=oe,a.removeDotSegments=We,a.serialize=Fe,a.resolveComponents=je,a.resolve=lr,a.normalize=Ze,a.equal=Oa,a.escapeComponent=As,a.unescapeComponent=ar,Object.defineProperty(a,"__esModule",{value:!0})}))});var Ja=z((hg,Xi)=>{"use strict";Xi.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var i=n[r];if(!a(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}});var ro=z((fg,eo)=>{"use strict";eo.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var ht=z((pg,so)=>{"use strict";so.exports={copy:yf,checkDataType:an,checkDataTypes:_f,coerceToTypes:bf,toHash:nn,getProperty:on,escapeQuotes:ln,equal:Ja(),ucs2length:ro(),varOccurences:Ef,varReplace:Pf,schemaHasRules:Sf,schemaHasRulesExcept:Rf,schemaUnknownRules:Of,toQuotedString:sn,getPathExpr:Tf,getPath:Cf,getData:$f,unescapeFragment:kf,unescapeJsonPointer:un,escapeFragment:Df,escapeJsonPointer:cn};function yf(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function an(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",i=s?"!":"",o=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return i+"Array.isArray("+e+")";case"object":return"("+i+e+n+"typeof "+e+r+'"object"'+n+o+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+o+"("+e+" % 1)"+n+e+r+e+(t?n+i+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+i+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function _f(a,e,t){switch(a.length){case 1:return an(a[0],e,t,!0);default:var s="",r=nn(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+an(n,e,t,!0);return s}}var to=nn(["string","number","integer","boolean","null"]);function bf(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(to[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(to[e])return[e];if(a==="array"&&e==="array")return["array"]}}function nn(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var wf=/^[a-z$_][a-z$_0-9]*$/i,xf=/'|\\/g;function on(a){return typeof a=="number"?"["+a+"]":wf.test(a)?"."+a:"['"+ln(a)+"']"}function ln(a){return a.replace(xf,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Ef(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function Pf(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Sf(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function Rf(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function Of(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function sn(a){return"'"+ln(a)+"'"}function Tf(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return ao(a,r)}function Cf(a,e,t){var s=sn(t?"/"+cn(e):on(e));return ao(a,s)}var If=/^\/(?:[^~]|~0|~1)*$/,Af=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function $f(a,e,t){var s,r,n,i;if(a==="")return"rootData";if(a[0]=="/"){if(!If.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(i=a.match(Af),!i)throw new Error("Invalid JSON-pointer: "+a);if(s=+i[1],r=i[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var o=n,u=r.split("/"),c=0;c<u.length;c++){var h=u[c];h&&(n+=on(un(h)),o+=" && "+n)}return o}function ao(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function kf(a){return un(decodeURIComponent(a))}function Df(a){return encodeURIComponent(cn(a))}function cn(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function un(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var dn=z((mg,no)=>{"use strict";var Nf=ht();no.exports=jf;function jf(a){Nf.copy(a,this)}});var oo=z((vg,io)=>{"use strict";var jr=io.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Qa(e,s,r,a,"",a)};jr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};jr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};jr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};jr.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 Qa(a,e,t,s,r,n,i,o,u,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,i,o,u,c);for(var h in s){var f=s[h];if(Array.isArray(f)){if(h in jr.arrayKeywords)for(var g=0;g<f.length;g++)Qa(a,e,t,f[g],r+"/"+h+"/"+g,n,r,h,s,g)}else if(h in jr.propsKeywords){if(f&&typeof f=="object")for(var d in f)Qa(a,e,t,f[d],r+"/"+h+"/"+Lf(d),n,r,h,s,d)}else(h in jr.keywords||a.allKeys&&!(h in jr.skipKeywords))&&Qa(a,e,t,f,r+"/"+h,n,r,h,s)}t(s,r,n,i,o,u,c)}}function Lf(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var es=z((gg,ho)=>{"use strict";var na=Yi(),lo=Ja(),Ya=ht(),Wa=dn(),Mf=oo();ho.exports=Mr;Mr.normalizeId=Lr;Mr.fullPath=Ga;Mr.url=Ka;Mr.ids=Vf;Mr.inlineRef=hn;Mr.schema=Xa;function Mr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Mr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Wa)return hn(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Xa.call(this,e,t),n,i,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof Wa?i=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(i=hn(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),i}function Xa(a,e){var t=na.parse(e),s=uo(t),r=Ga(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Lr(s),i=this._refs[n];if(typeof i=="string")return Ff.call(this,a,i,t);if(i instanceof Wa)i.validate||this._compile(i),a=i;else if(i=this._schemas[n],i instanceof Wa){if(i.validate||this._compile(i),n==Lr(e))return{schema:i,root:a,baseId:r};a=i}else return;if(!a.schema)return;r=Ga(this._getId(a.schema))}return co.call(this,t,r,a.schema,a)}function Ff(a,e,t){var s=Xa.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var i=this._getId(r);return i&&(n=Ka(n,i)),co.call(this,t,n,r,a)}}var qf=Ya.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function co(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var i=r[n];if(i){if(i=Ya.unescapeFragment(i),t=t[i],t===void 0)break;var o;if(!qf[i]&&(o=this._getId(t),o&&(e=Ka(e,o)),t.$ref)){var u=Ka(e,t.$ref),c=Xa.call(this,s,u);c&&(t=c.schema,s=c.root,e=c.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var Uf=Ya.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function hn(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return fn(a);if(e)return pn(a)<=e}function fn(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!fn(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!fn(e)))return!1;return!0}function pn(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=pn(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(Uf[r])e++;else if(t=a[r],typeof t=="object"&&(e+=pn(t)+1),e==1/0)return 1/0}return e}function Ga(a,e){e!==!1&&(a=Lr(a));var t=na.parse(a);return uo(t)}function uo(a){return na.serialize(a).split("#")[0]+"#"}var zf=/#\/?$/;function Lr(a){return a?a.replace(zf,""):""}function Ka(a,e){return e=Lr(e),na.resolve(a,e)}function Vf(a){var e=Lr(this._getId(a)),t={"":e},s={"":Ga(e,!1)},r={},n=this;return Mf(a,{allKeys:!0},function(i,o,u,c,h,f,g){if(o!==""){var d=n._getId(i),y=t[c],m=s[c]+"/"+h;if(g!==void 0&&(m+="/"+(typeof g=="number"?g:Ya.escapeFragment(g))),typeof d=="string"){d=y=Lr(y?na.resolve(y,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!lo(i,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Lr(m))if(d[0]=="#"){if(r[d]&&!lo(i,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=i}else n._refs[d]=m}t[o]=y,s[o]=m}}),r}});var rs=z((yg,po)=>{"use strict";var mn=es();po.exports={Validation:fo(Hf),MissingRef:fo(vn)};function Hf(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}vn.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function vn(a,e,t){this.message=t||vn.message(a,e),this.missingRef=mn.url(a,e),this.missingSchema=mn.normalizeId(mn.fullPath(this.missingRef))}function fo(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var gn=z((_g,mo)=>{"use strict";mo.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&(function(n){return function(i){return function(o,u){var c={key:o,value:i[o]},h={key:u,value:i[u]};return n(c,h)}}})(e.cmp),r=[];return(function n(i){if(i&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i!==void 0){if(typeof i=="number")return isFinite(i)?""+i:"null";if(typeof i!="object")return JSON.stringify(i);var o,u;if(Array.isArray(i)){for(u="[",o=0;o<i.length;o++)o&&(u+=","),u+=n(i[o])||"null";return u+"]"}if(i===null)return"null";if(r.indexOf(i)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(i)-1,h=Object.keys(i).sort(s&&s(i));for(u="",o=0;o<h.length;o++){var f=h[o],g=n(i[f]);g&&(u&&(u+=","),u+=JSON.stringify(f)+":"+g)}return r.splice(c,1),"{"+u+"}"}})(a)}});var yn=z((bg,vo)=>{"use strict";vo.exports=function(e,t,s){var r="",n=e.schema.$async===!0,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var u=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(u){var c="unknown keyword: "+u;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(i||e.schema.$ref)){var t="false schema",h=e.level,f=e.dataLevel,g=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,I=!e.opts.allErrors,q,m="data"+(f||""),O="valid"+h;if(e.schema===!1){e.isTop?I=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var w=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var S=e.isTop,h=e.level=0,f=e.dataLevel=0,m="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var h=e.level,f=e.dataLevel,m="data"+(f||"");if(o&&(e.baseId=e.resolve.url(e.baseId,o)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+h+" = errors;"}var O="valid"+h,I=!e.opts.allErrors,A="",H="",q,$=e.schema.type,U=Array.isArray($);if($&&e.opts.nullable&&e.schema.nullable===!0&&(U?$.indexOf("null")==-1&&($=$.concat("null")):$!="null"&&($=[$,"null"],U=!0)),U&&$.length==1&&($=$[0],U=!1),e.schema.$ref&&i){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),$){if(e.opts.coerceTypes)var F=e.util.coerceToTypes(e.opts.coerceTypes,$);var L=e.RULES.types[$];if(F||U||L===!0||L&&!Te(L)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",C=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[C]($,m,e.opts.strictNumbers,!0)+") { ",F){var k="dataType"+h,M="coerced"+h;r+=" var "+k+" = typeof "+m+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+k+" == 'object' && Array.isArray("+m+") && "+m+".length == 1) { "+m+" = "+m+"[0]; "+k+" = typeof "+m+"; if ("+e.util.checkDataType(e.schema.type,m,e.opts.strictNumbers)+") "+M+" = "+m+"; } "),r+=" if ("+M+" !== undefined) ; ";var ce=F;if(ce)for(var Y,te=-1,K=ce.length-1;te<K;)Y=ce[te+=1],Y=="string"?r+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+M+" = '' + "+m+"; else if ("+m+" === null) "+M+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+k+" == 'boolean' || "+m+" === null || ("+k+" == 'string' && "+m+" && "+m+" == +"+m+" ",Y=="integer"&&(r+=" && !("+m+" % 1)"),r+=")) "+M+" = +"+m+"; "):Y=="boolean"?r+=" else if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+M+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+M+" = true; ":Y=="null"?r+=" else if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+M+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+m+" == null) "+M+" = ["+m+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var w=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+M+" !== undefined) { ";var Z=f?"data"+(f-1||""):"parentData",ge=f?e.dataPathArr[f]:"parentDataProperty";r+=" "+m+" = "+M+"; ",f||(r+="if ("+Z+" !== undefined)"),r+=" "+Z+"["+ge+"] = "+M+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var w=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!i)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",I&&(r+=" } if (errors === ",S?r+="0":r+="errs_"+h,r+=") { ",H+="}");else{var Ie=e.RULES;if(Ie){for(var L,De=-1,ne=Ie.length-1;De<ne;)if(L=Ie[De+=1],Te(L)){if(L.type&&(r+=" if ("+e.util.checkDataType(L.type,m,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(L.type=="object"&&e.schema.properties){var g=e.schema.properties,be=Object.keys(g),Re=be;if(Re)for(var Ne,Cr=-1,mr=Re.length-1;Cr<mr;){Ne=Re[Cr+=1];var we=g[Ne];if(we.default!==void 0){var ye=m+e.util.getProperty(Ne);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ye;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ye+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ye+" === null || "+ye+" === '' "),r+=" ) "+ye+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(we.default)+" ":r+=" "+JSON.stringify(we.default)+" ",r+="; "}}}else if(L.type=="array"&&Array.isArray(e.schema.items)){var zr=e.schema.items;if(zr){for(var we,te=-1,Ae=zr.length-1;te<Ae;)if(we=zr[te+=1],we.default!==void 0){var ye=m+"["+te+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ye;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ye+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ye+" === null || "+ye+" === '' "),r+=" ) "+ye+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(we.default)+" ":r+=" "+JSON.stringify(we.default)+" ",r+="; "}}}}var oe=L.rules;if(oe){for(var Ir,vr=-1,Vr=oe.length-1;vr<Vr;)if(Ir=oe[vr+=1],We(Ir)){var Hr=Ir.code(e,Ir.keyword,L.type);Hr&&(r+=" "+Hr+" ",I&&(A+="}"))}}if(I&&(r+=" "+A+" ",A=""),L.type&&(r+=" } ",$&&$===L.type&&!F)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+$.join(","):r+=""+$,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+$.join(","):r+=""+$,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var w=r;r=v.pop(),!e.compositeRule&&I?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}I&&(r+=" if (errors === ",S?r+="0":r+="errs_"+h,r+=") { ",H+="}")}}}I&&(r+=" "+H+" "),S?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+h+";";function Te(je){for(var lr=je.rules,Ze=0;Ze<lr.length;Ze++)if(We(lr[Ze]))return!0}function We(je){return e.schema[je.keyword]!==void 0||je.implements&&Fe(je)}function Fe(je){for(var lr=je.implements,Ze=0;Ze<lr.length;Ze++)if(e.schema[lr[Ze]]!==void 0)return!0}return r}});var wo=z((wg,bo)=>{"use strict";var ts=es(),ss=ht(),yo=rs(),Zf=gn(),go=yn(),Bf=ss.ucs2length,Jf=Ja(),Qf=yo.Validation;bo.exports=_n;function _n(a,e,t,s){var r=this,n=this._opts,i=[void 0],o={},u=[],c={},h=[],f={},g=[];e=e||{schema:a,refVal:i,refs:o};var d=Wf.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=P;var m=this._formats,v=this.RULES;try{var w=O(a,e,t,s);y.validate=w;var S=y.callValidate;return S&&(S.schema=w.schema,S.errors=null,S.refs=w.refs,S.refVal=w.refVal,S.root=w.root,S.$async=w.$async,n.sourceCode&&(S.source=w.source)),w}finally{Gf.call(this,a,e,s)}function P(){var C=y.validate,k=C.apply(this,arguments);return P.errors=C.errors,k}function O(C,k,M,ce){var Y=!k||k&&k.schema==C;if(k.schema!=e.schema)return _n.call(r,C,k,M,ce);var te=C.$async===!0,K=go({isTop:!0,schema:C,isRoot:Y,baseId:ce,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:yo.MissingRef,RULES:v,validate:go,util:ss,resolve:ts,resolveRef:I,usePattern:U,useDefault:F,useCustomRule:L,opts:n,formats:m,logger:r.logger,self:r});K=as(i,Xf)+as(u,Kf)+as(h,Yf)+as(g,ep)+K,n.processCode&&(K=n.processCode(K,C));var Z;try{var ge=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",K);Z=ge(r,v,m,e,i,h,g,Jf,Bf,Qf),i[0]=Z}catch(Ie){throw r.logger.error("Error compiling schema, function code:",K),Ie}return Z.schema=C,Z.errors=null,Z.refs=o,Z.refVal=i,Z.root=Y?Z:k,te&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:K,patterns:u,defaults:h}),Z}function I(C,k,M){k=ts.url(C,k);var ce=o[k],Y,te;if(ce!==void 0)return Y=i[ce],te="refVal["+ce+"]",$(Y,te);if(!M&&e.refs){var K=e.refs[k];if(K!==void 0)return Y=e.refVal[K],te=A(k,Y),$(Y,te)}te=A(k);var Z=ts.call(r,O,e,k);if(Z===void 0){var ge=t&&t[k];ge&&(Z=ts.inlineRef(ge,n.inlineRefs)?ge:_n.call(r,ge,e,t,C))}if(Z===void 0)H(k);else return q(k,Z),$(Z,te)}function A(C,k){var M=i.length;return i[M]=k,o[C]=M,"refVal"+M}function H(C){delete o[C]}function q(C,k){var M=o[C];i[M]=k}function $(C,k){return typeof C=="object"||typeof C=="boolean"?{code:k,schema:C,inline:!0}:{code:k,$async:C&&!!C.$async}}function U(C){var k=c[C];return k===void 0&&(k=c[C]=u.length,u[k]=C),"pattern"+k}function F(C){switch(typeof C){case"boolean":case"number":return""+C;case"string":return ss.toQuotedString(C);case"object":if(C===null)return"null";var k=Zf(C),M=f[k];return M===void 0&&(M=f[k]=h.length,h[M]=C),"default"+M}}function L(C,k,M,ce){if(r._opts.validateSchema!==!1){var Y=C.definition.dependencies;if(Y&&!Y.every(function(Re){return Object.prototype.hasOwnProperty.call(M,Re)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var te=C.definition.validateSchema;if(te){var K=te(k);if(!K){var Z="keyword schema is invalid: "+r.errorsText(te.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var ge=C.definition.compile,Ie=C.definition.inline,De=C.definition.macro,ne;if(ge)ne=ge.call(r,k,M,ce);else if(De)ne=De.call(r,k,M,ce),n.validateSchema!==!1&&r.validateSchema(ne,!0);else if(Ie)ne=Ie.call(r,ce,C.keyword,k,M);else if(ne=C.definition.validate,!ne)return;if(ne===void 0)throw new Error('custom keyword "'+C.keyword+'"failed to compile');var be=g.length;return g[be]=ne,{code:"customRule"+be,validate:ne}}}function Wf(a,e,t){var s=_o.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function Gf(a,e,t){var s=_o.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function _o(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function Kf(a,e){return"var pattern"+a+" = new RegExp("+ss.toQuotedString(e[a])+");"}function Yf(a){return"var default"+a+" = defaults["+a+"];"}function Xf(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function ep(a){return"var customRule"+a+" = customRules["+a+"];"}function as(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Eo=z((xg,xo)=>{"use strict";var ns=xo.exports=function(){this._cache={}};ns.prototype.put=function(e,t){this._cache[e]=t};ns.prototype.get=function(e){return this._cache[e]};ns.prototype.del=function(e){delete this._cache[e]};ns.prototype.clear=function(){this._cache={}}});var No=z((Eg,Do)=>{"use strict";var rp=ht(),tp=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ap=[0,31,28,31,30,31,30,31,31,30,31,30,31],sp=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Po=/^(?=.{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,np=/^(?:[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,ip=/^(?:[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,So=/^(?:(?:[^\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,Ro=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Oo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,To=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Co=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Io=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Do.exports=is;function is(a){return a=a=="full"?"full":"fast",rp.copy(is[a])}is.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\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,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":So,url:Ro,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,hostname:Po,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ko,uuid:Oo,"json-pointer":To,"json-pointer-uri-fragment":Co,"relative-json-pointer":Io};is.full={date:Ao,time:$o,"date-time":cp,uri:dp,"uri-reference":ip,"uri-template":So,url:Ro,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:Po,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[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}))|:)))(?:%.+)?\s*$/i,regex:ko,uuid:Oo,"json-pointer":To,"json-pointer-uri-fragment":Co,"relative-json-pointer":Io};function op(a){return a%4===0&&(a%100!==0||a%400===0)}function Ao(a){var e=a.match(tp);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&op(t)?29:ap[s])}function $o(a,e){var t=a.match(sp);if(!t)return!1;var s=t[1],r=t[2],n=t[3],i=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||i)}var lp=/t|\s/i;function cp(a){var e=a.split(lp);return e.length==2&&Ao(e[0])&&$o(e[1],!0)}var up=/\/|:/;function dp(a){return up.test(a)&&np.test(a)}var hp=/[^\\]\\Z/;function ko(a){if(hp.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var Lo=z((Pg,jo)=>{"use strict";jo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,h="data"+(i||""),f="valid"+n,g,d;if(o=="#"||o=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,o,e.isRoot);if(y===void 0){var m=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs=="fail"){e.logger.error(m);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { ref: '"+e.util.escapeQuotes(o)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(o)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(o)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),r+=" } "):r+=" {} ";var w=r;r=v.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(m),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,m)}else if(y.inline){var S=e.util.copy(e);S.level++;var P="valid"+S.level;S.schema=y.schema,S.schemaPath="",S.errSchemaPath=o;var O=e.validate(S).replace(/validate\.schema/g,y.code);r+=" "+O+" ",c&&(r+=" if ("+P+") { ")}else g=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+h+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var I=i?"data"+(i-1||""):"parentData",A=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+I+" , "+A+", rootData) ";var H=r;if(r=v.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+f+"; "),r+=" try { await "+H+"; ",c&&(r+=" "+f+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+f+" = false; "),r+=" } ",c&&(r+=" if ("+f+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r}});var Fo=z((Sg,Mo)=>{"use strict";Mo.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c=e.util.copy(e),h="";c.level++;var f="valid"+c.level,g=c.baseId,d=!0,y=n;if(y)for(var m,v=-1,w=y.length-1;v<w;)m=y[v+=1],(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(d=!1,c.schema=m,c.schemaPath=i+"["+v+"]",c.errSchemaPath=o+"/"+v,r+=" "+e.validate(c)+" ",c.baseId=g,u&&(r+=" if ("+f+") { ",h+="}"));return u&&(d?r+=" if (true) { ":r+=" "+h.slice(0,-1)+" "),r}});var Uo=z((Rg,qo)=>{"use strict";qo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,w=o.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(w){var S=y.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=o;if(O)for(var I,A=-1,H=O.length-1;A<H;)I=O[A+=1],y.schema=I,y.schemaPath=u+"["+A+"]",y.errSchemaPath=c+"/"+A,r+=" "+e.validate(y)+" ",y.baseId=S,r+=" "+g+" = "+g+" || "+v+"; if (!"+g+") { ",m+="}";e.compositeRule=y.compositeRule=P,r+=" "+m+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else h&&(r+=" if (true) { ");return r}});var Vo=z((Og,zo)=>{"use strict";zo.exports=function(e,t,s){var r=" ",n=e.schema[t],i=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,u=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+u+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+u+", "+e.util.toQuotedString(i)+", validate.root.schema);"),r}});var Zo=z((Tg,Ho)=>{"use strict";Ho.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,d||(r+=" var schema"+n+" = validate.schema"+u+";"),r+="var "+g+" = equal("+f+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var Jo=z((Cg,Bo)=>{"use strict";Bo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,w="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId,I=e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",I){var A=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+v+" = false; for (var "+w+" = 0; "+w+" < "+f+".length; "+w+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var H=f+"["+w+"]";y.dataPathArr[S]=w;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,H)+" ":r+=" var "+P+" = "+H+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=A,r+=" "+m+" if (!"+v+") {"}else r+=" if ("+f+".length == 0) {";var $=$||[];$.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var U=r;return r=$.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",I&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var Wo=z((Ig,Qo)=>{"use strict";Qo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v={},w={},S=e.opts.ownProperties;for(A in o)if(A!="__proto__"){var P=o[A],O=Array.isArray(P)?w:v;O[A]=P}r+="var "+g+" = errors;";var I=e.errorPath;r+="var missing"+n+";";for(var A in w)if(O=w[A],O.length){if(r+=" if ( "+f+e.util.getProperty(A)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(A)+"') "),h){r+=" && ( ";var H=O;if(H)for(var q,$=-1,U=H.length-1;$<U;){q=H[$+=1],$&&(r+=" || ");var F=e.util.getProperty(q),L=f+F;r+=" ( ( "+L+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:F)+") ) "}r+=")) { ";var C="missing"+n,k="' + "+C+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,C,!0):I+" + "+C);var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var ce=r;r=M.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ce+"]); ":r+=" validate.errors = ["+ce+"]; return false; ":r+=" var err = "+ce+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,te=-1,K=Y.length-1;te<K;){q=Y[te+=1];var F=e.util.getProperty(q),k=e.util.escapeQuotes(q),L=f+F;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,q,e.opts.jsonPointers)),r+=" if ( "+L+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(A)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(A)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",h&&(y+="}",r+=" else { ")}e.errorPath=I;var Z=d.baseId;for(var A in v){var P=v[A];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+m+" = true; if ( "+f+e.util.getProperty(A)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(A)+"') "),r+=") { ",d.schema=P,d.schemaPath=u+e.util.getProperty(A),d.errSchemaPath=c+"/"+e.util.escapeFragment(A),r+=" "+e.validate(d)+" ",d.baseId=Z,r+=" } ",h&&(r+=" if ("+m+") { ",y+="}"))}return h&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Ko=z((Ag,Go)=>{"use strict";Go.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var m="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+u+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+v+".length; "+m+"++) if (equal("+f+", "+v+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;return r=w.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",h&&(r+=" else { "),r}});var Xo=z(($g,Yo)=>{"use strict";Yo.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||"");if(e.opts.format===!1)return h&&(r+=" if (true) { "),r;var g=e.opts.$data&&o&&o.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=e.opts.unknownFormats,m=Array.isArray(y);if(g){var v="format"+n,w="isObject"+n,S="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+w+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+S+" = "+w+" && "+v+".type || 'string'; if ("+w+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+v+" ",m&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+S+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+f+") : "+v+"("+f+")) ":r+=" "+v+"("+f+") ",r+=" : "+v+".test("+f+"))))) {"}else{var v=e.formats[o];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+o+'" ignored in schema at path "'+e.errSchemaPath+'"'),h&&(r+=" if (true) { "),r;if(m&&y.indexOf(o)>=0)return h&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var w=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,S=w&&v.type||"string";if(w){var P=v.async===!0;v=v.validate}if(S!=s)return h&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+O+"("+f+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(o);w&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+f+") ":r+=" "+O+".test("+f+") ",r+=") { "}}var I=I||[];I.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var A=r;return r=I.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var rl=z((kg,el)=>{"use strict";el.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var m="valid"+y.level,v=e.schema.then,w=e.schema.else,S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=w!==void 0&&(e.opts.strictKeywords?typeof w=="object"&&Object.keys(w).length>0||w===!1:e.util.schemaHasRules(w,e.RULES.all)),O=y.baseId;if(S||P){var I;y.createErrors=!1,y.schema=o,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var A=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=A,S?(r+=" if ("+m+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(I="ifClause"+n,r+=" var "+I+" = 'then'; "):I="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+m+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(I="ifClause"+n,r+=" var "+I+" = 'else'; "):I="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+I+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+I+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var al=z((Dg,tl)=>{"use strict";tl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,w="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(o)){var I=e.schema.additionalItems;if(I===!1){r+=" "+g+" = "+f+".length <= "+o.length+"; ";var A=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+o.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+o.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var q=r;r=H.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=A,h&&(m+="}",r+=" else { ")}var $=o;if($){for(var U,F=-1,L=$.length-1;F<L;)if(U=$[F+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+f+".length > "+F+") { ";var C=f+"["+F+"]";y.schema=U,y.schemaPath=u+"["+F+"]",y.errSchemaPath=c+"/"+F,y.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),y.dataPathArr[S]=F;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,C)+" ":r+=" var "+P+" = "+C+"; "+k+" ",r+=" } ",h&&(r+=" if ("+v+") { ",m+="}")}}if(typeof I=="object"&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))){y.schema=I,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+f+".length > "+o.length+") { for (var "+w+" = "+o.length+"; "+w+" < "+f+".length; "+w+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var C=f+"["+w+"]";y.dataPathArr[S]=w;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,C)+" ":r+=" var "+P+" = "+C+"; "+k+" ",h&&(r+=" if (!"+v+") break; "),r+=" } } ",h&&(r+=" if ("+v+") { ",m+="}")}}else if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){y.schema=o,y.schemaPath=u,y.errSchemaPath=c,r+=" for (var "+w+" = 0; "+w+" < "+f+".length; "+w+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0);var C=f+"["+w+"]";y.dataPathArr[S]=w;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,C)+" ":r+=" var "+P+" = "+C+"; "+k+" ",h&&(r+=" if (!"+v+") break; "),r+=" }"}return h&&(r+=" "+m+" if ("+d+" == errors) {"),r}});var bn=z((Ng,sl)=>{"use strict";sl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,O,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=t=="maximum",m=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[m],w=e.opts.$data&&v&&v.$data,S=y?"<":">",P=y?">":"<",O=void 0;if(!(g||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(w||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(m+" must be number or boolean");if(w){var I=e.util.getData(v.$data,i,e.dataPathArr),A="exclusive"+n,H="exclType"+n,q="exclIsNumber"+n,$="op"+n,U="' + "+$+" + '";r+=" var schemaExcl"+n+" = "+I+"; ",I="schemaExcl"+n,r+=" var "+A+"; var "+H+" = typeof "+I+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var O=m,F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var L=r;r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+A+" = "+d+" === undefined || "+I+" "+S+"= "+d+") ? "+f+" "+P+"= "+I+" : "+f+" "+P+" "+d+" ) : ( ("+A+" = "+I+" === true) ? "+f+" "+P+"= "+d+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { var op"+n+" = "+A+" ? '"+S+"' : '"+S+"='; ",o===void 0&&(O=m,c=e.errSchemaPath+"/"+m,d=I,g=w)}else{var q=typeof v=="number",U=S;if(q&&g){var $="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+S+"= "+d+" ? "+f+" "+P+"= "+v+" : "+f+" "+P+" "+d+" ) || "+f+" !== "+f+") { "}else{q&&o===void 0?(A=!0,O=m,c=e.errSchemaPath+"/"+m,d=v,P+="="):(q&&(d=Math[y?"min":"max"](v,o)),v===(q?d:!0)?(A=!0,O=m,c=e.errSchemaPath+"/"+m,P+="="):(A=!1,U+="="));var $="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+" "+P+" "+d+" || "+f+" !== "+f+") { "}}O=O||t;var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+$+", limit: "+d+", exclusive: "+A+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var L=r;return r=F.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { "),r}});var wn=z((jg,nl)=>{"use strict";nl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(g||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+f+".length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var w=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var xn=z((Lg,il)=>{"use strict";il.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(g||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+f+".length ":r+=" ucs2length("+f+") ",r+=" "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var w=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var En=z((Mg,ol)=>{"use strict";ol.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,m,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(g||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+f+").length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var w=r;return r=v.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+w+"]); ":r+=" validate.errors = ["+w+"]; return false; ":r+=" var err = "+w+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var cl=z((Fg,ll)=>{"use strict";ll.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o,!(g||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+f+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var m=r;return r=y.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var dl=z((qg,ul)=>{"use strict";ul.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=u,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var m=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=m,r+=" if ("+y+") { ";var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var S=r;r=w.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",h&&(r+=" if (false) { ");return r}});var fl=z((Ug,hl)=>{"use strict";hl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,w=y.baseId,S="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+S+" = false , "+g+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var I=o;if(I)for(var A,H=-1,q=I.length-1;H<q;)A=I[H+=1],(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))?(y.schema=A,y.schemaPath=u+"["+H+"]",y.errSchemaPath=c+"/"+H,r+=" "+e.validate(y)+" ",y.baseId=w):r+=" var "+v+" = true; ",H&&(r+=" if ("+v+" && "+S+") { "+g+" = false; "+P+" = ["+P+", "+H+"]; } else { ",m+="}"),r+=" if ("+v+") { "+g+" = "+S+" = true; "+P+" = "+H+"; }";return e.compositeRule=y.compositeRule=O,r+=""+m+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var ml=z((zg,pl)=>{"use strict";pl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g=e.opts.$data&&o&&o.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",d="schema"+n):d=o;var y=g?"(new RegExp("+d+"))":e.usePattern(o);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+f+") ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",h&&(r+=" else { "),r}});var gl=z((Vg,vl)=>{"use strict";vl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v="key"+n,w="idx"+n,S=d.dataLevel=e.dataLevel+1,P="data"+S,O="dataProperties"+n,I=Object.keys(o||{}).filter(te),A=e.schema.patternProperties||{},H=Object.keys(A).filter(te),q=e.schema.additionalProperties,$=I.length||H.length,U=q===!1,F=typeof q=="object"&&Object.keys(q).length,L=e.opts.removeAdditional,C=U||F||L,k=e.opts.ownProperties,M=e.baseId,ce=e.schema.required;if(ce&&!(e.opts.$data&&ce.$data)&&ce.length<e.opts.loopRequired)var Y=e.util.toHash(ce);function te(ar){return ar!=="__proto__"}if(r+="var "+g+" = errors;var "+m+" = true;",k&&(r+=" var "+O+" = undefined;"),C){if(k?r+=" "+O+" = "+O+" || Object.keys("+f+"); for (var "+w+"=0; "+w+"<"+O+".length; "+w+"++) { var "+v+" = "+O+"["+w+"]; ":r+=" for (var "+v+" in "+f+") { ",$){if(r+=" var isAdditional"+n+" = !(false ",I.length)if(I.length>8)r+=" || validate.schema"+u+".hasOwnProperty("+v+") ";else{var K=I;if(K)for(var Z,ge=-1,Ie=K.length-1;ge<Ie;)Z=K[ge+=1],r+=" || "+v+" == "+e.util.toQuotedString(Z)+" "}if(H.length){var De=H;if(De)for(var ne,be=-1,Re=De.length-1;be<Re;)ne=De[be+=1],r+=" || "+e.usePattern(ne)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(L=="all")r+=" delete "+f+"["+v+"]; ";else{var Ne=e.errorPath,Cr="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(L)r+=" delete "+f+"["+v+"]; ";else{r+=" "+m+" = false; ";var mr=c;c=e.errSchemaPath+"/additionalProperties";var we=we||[];we.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+Cr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var ye=r;r=we.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ye+"]); ":r+=" validate.errors = ["+ye+"]; return false; ":r+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=mr,h&&(r+=" break; ")}else if(F)if(L=="failing"){r+=" var "+g+" = errors; ";var zr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Ae=f+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Ae)+" ":r+=" var "+P+" = "+Ae+"; "+oe+" ",r+=" if (!"+m+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+f+"["+v+"]; } ",e.compositeRule=d.compositeRule=zr}else{d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Ae=f+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Ae)+" ":r+=" var "+P+" = "+Ae+"; "+oe+" ",h&&(r+=" if (!"+m+") break; ")}e.errorPath=Ne}$&&(r+=" } "),r+=" } ",h&&(r+=" if ("+m+") { ",y+="}")}var Ir=e.opts.useDefaults&&!e.compositeRule;if(I.length){var vr=I;if(vr)for(var Z,Vr=-1,Hr=vr.length-1;Vr<Hr;){Z=vr[Vr+=1];var Te=o[Z];if(e.opts.strictKeywords?typeof Te=="object"&&Object.keys(Te).length>0||Te===!1:e.util.schemaHasRules(Te,e.RULES.all)){var We=e.util.getProperty(Z),Ae=f+We,Fe=Ir&&Te.default!==void 0;d.schema=Te,d.schemaPath=u+We,d.errSchemaPath=c+"/"+e.util.escapeFragment(Z),d.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),d.dataPathArr[S]=e.util.toQuotedString(Z);var oe=e.validate(d);if(d.baseId=M,e.util.varOccurences(oe,P)<2){oe=e.util.varReplace(oe,P,Ae);var je=Ae}else{var je=P;r+=" var "+P+" = "+Ae+"; "}if(Fe)r+=" "+oe+" ";else{if(Y&&Y[Z]){r+=" if ( "+je+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = false; ";var Ne=e.errorPath,mr=c,lr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ne,Z,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var we=we||[];we.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+lr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+lr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var ye=r;r=we.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+ye+"]); ":r+=" validate.errors = ["+ye+"]; return false; ":r+=" var err = "+ye+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=mr,e.errorPath=Ne,r+=" } else { "}else h?(r+=" if ( "+je+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = true; } else { "):(r+=" if ("+je+" !== undefined ",k&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+oe+" } "}}h&&(r+=" if ("+m+") { ",y+="}")}}if(H.length){var Ze=H;if(Ze)for(var ne,Oa=-1,As=Ze.length-1;Oa<As;){ne=Ze[Oa+=1];var Te=A[ne];if(e.opts.strictKeywords?typeof Te=="object"&&Object.keys(Te).length>0||Te===!1:e.util.schemaHasRules(Te,e.RULES.all)){d.schema=Te,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ne),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ne),k?r+=" "+O+" = "+O+" || Object.keys("+f+"); for (var "+w+"=0; "+w+"<"+O+".length; "+w+"++) { var "+v+" = "+O+"["+w+"]; ":r+=" for (var "+v+" in "+f+") { ",r+=" if ("+e.usePattern(ne)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Ae=f+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=M,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Ae)+" ":r+=" var "+P+" = "+Ae+"; "+oe+" ",h&&(r+=" if (!"+m+") break; "),r+=" } ",h&&(r+=" else "+m+" = true; "),r+=" } ",h&&(r+=" if ("+m+") { ",y+="}")}}}return h&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var _l=z((Hg,yl)=>{"use strict";yl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof o=="object"&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){d.schema=o,d.schemaPath=u,d.errSchemaPath=c;var v="key"+n,w="idx"+n,S="i"+n,P="' + "+v+" + '",O=d.dataLevel=e.dataLevel+1,I="data"+O,A="dataProperties"+n,H=e.opts.ownProperties,q=e.baseId;H&&(r+=" var "+A+" = undefined; "),H?r+=" "+A+" = "+A+" || Object.keys("+f+"); for (var "+w+"=0; "+w+"<"+A+".length; "+w+"++) { var "+v+" = "+A+"["+w+"]; ":r+=" for (var "+v+" in "+f+") { ",r+=" var startErrs"+n+" = errors; ";var $=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var F=e.validate(d);d.baseId=q,e.util.varOccurences(F,I)<2?r+=" "+e.util.varReplace(F,I,$)+" ":r+=" var "+I+" = "+$+"; "+F+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+m+") { for (var "+S+"=startErrs"+n+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),h&&(r+=" break; "),r+=" } }"}return h&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var wl=z((Zg,bl)=>{"use strict";bl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d=e.opts.$data&&o&&o.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o;var m="schema"+n;if(!d)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],w=o;if(w)for(var S,P=-1,O=w.length-1;P<O;){S=w[P+=1];var I=e.schema.properties[S];I&&(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))||(v[v.length]=S)}}else var v=o;if(d||v.length){var A=e.errorPath,H=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(h)if(r+=" var missing"+n+"; ",H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,U,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+$+" = 0; "+$+" < "+m+".length; "+$+"++) { "+g+" = "+f+"["+m+"["+$+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+f+", "+m+"["+$+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var C=r;r=L.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var k=v;if(k)for(var M,$=-1,ce=k.length-1;$<ce;){M=k[$+=1],$&&(r+=" || ");var Y=e.util.getProperty(M),te=f+Y;r+=" ( ( "+te+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:Y)+") ) "}r+=") { ";var U="missing"+n,F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,U,!0):A+" + "+U);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var C=r;r=L.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var $="i"+n,U="schema"+n+"["+$+"]",F="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(A,U,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+$+" = 0; "+$+" < "+m+".length; "+$+"++) { if ("+f+"["+m+"["+$+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", "+m+"["+$+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var K=v;if(K)for(var M,Z=-1,ge=K.length-1;Z<ge;){M=K[Z+=1];var Y=e.util.getProperty(M),F=e.util.escapeQuotes(M),te=f+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,M,e.opts.jsonPointers)),r+=" if ( "+te+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+f+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=A}else h&&(r+=" if (true) {");return r}});var El=z((Bg,xl)=>{"use strict";xl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f="data"+(i||""),g="valid"+n,d=e.opts.$data&&o&&o.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",y="schema"+n):y=o,(o||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+y+" === false || "+y+" === undefined) "+g+" = true; else if (typeof "+y+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+f+".length , "+g+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,v=Array.isArray(m);if(!m||m=="object"||m=="array"||v&&(m.indexOf("object")>=0||m.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+f+"[i], "+f+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+f+"[i]; ";var w="checkDataType"+(v?"s":"");r+=" if ("+e.util[w](m,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+u:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var P=r;r=S.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",h&&(r+=" else { ")}else h&&(r+=" if (true) { ");return r}});var Sl=z((Jg,Pl)=>{"use strict";Pl.exports={$ref:Lo(),allOf:Fo(),anyOf:Uo(),$comment:Vo(),const:Zo(),contains:Jo(),dependencies:Wo(),enum:Ko(),format:Xo(),if:rl(),items:al(),maximum:bn(),minimum:bn(),maxItems:wn(),minItems:wn(),maxLength:xn(),minLength:xn(),maxProperties:En(),minProperties:En(),multipleOf:cl(),not:dl(),oneOf:fl(),pattern:ml(),properties:gl(),propertyNames:_l(),required:wl(),uniqueItems:El(),validate:yn()}});var Tl=z((Qg,Ol)=>{"use strict";var Rl=Sl(),Pn=ht().toHash;Ol.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=Pn(t),e.types=Pn(r),e.forEach(function(n){n.rules=n.rules.map(function(i){var o;if(typeof i=="object"){var u=Object.keys(i)[0];o=i[u],i=u,o.forEach(function(h){t.push(h),e.all[h]=!0})}t.push(i);var c=e.all[i]={keyword:i,code:Rl[i],implements:o};return c}),e.all.$comment={keyword:"$comment",code:Rl.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=Pn(t.concat(s)),e.custom={},e}});var Al=z((Wg,Il)=>{"use strict";var Cl=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Il.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Cl.length;n++){var i=Cl[n],o=r[i];o&&(r[i]={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Dl=z((Gg,kl)=>{"use strict";var fp=rs().MissingRef;kl.exports=$l;function $l(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var o=s._addSchema(a,void 0,e);return o.validate||i(o)});return t&&r.then(function(o){t(null,o)},t),r;function n(o){var u=o.$schema;return u&&!s.getSchema(u)?$l.call(s,{$ref:u},!0):Promise.resolve()}function i(o){try{return s._compile(o)}catch(c){if(c instanceof fp)return u(c);throw c}function u(c){var h=c.missingSchema;if(d(h))throw new Error("Schema "+h+" is loaded but "+c.missingRef+" cannot be resolved");var f=s._loadingSchemas[h];return f||(f=s._loadingSchemas[h]=s._opts.loadSchema(h),f.then(g,g)),f.then(function(y){if(!d(h))return n(y).then(function(){d(h)||s.addSchema(y,h,void 0,e)})}).then(function(){return i(o)});function g(){delete s._loadingSchemas[h]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var jl=z((Kg,Nl)=>{"use strict";Nl.exports=function(e,t,s){var r=" ",n=e.level,i=e.dataLevel,o=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,h=!e.opts.allErrors,f,g="data"+(i||""),d="valid"+n,y="errs__"+n,m=e.opts.$data&&o&&o.$data,v;m?(r+=" var schema"+n+" = "+e.util.getData(o.$data,i,e.dataPathArr)+"; ",v="schema"+n):v=o;var w=this,S="definition"+n,P=w.definition,O="",I,A,H,q,$;if(m&&P.$data){$="keywordValidate"+n;var U=P.validateSchema;r+=" var "+S+" = RULES.custom['"+t+"'].definition; var "+$+" = "+S+".validate;"}else{if(q=e.useCustomRule(w,o,e.schema,e),!q)return;v="validate.schema"+u,$=q.code,I=P.compile,A=P.inline,H=P.macro}var F=$+".errors",L="i"+n,C="ruleErr"+n,k=P.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(A||H||(r+=""+F+" = null;"),r+="var "+y+" = errors;var "+d+";",m&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(O+="}",r+=" "+d+" = "+S+".validateSchema("+v+"); if ("+d+") { ")),A)P.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(H){var M=e.util.copy(e),O="";M.level++;var ce="valid"+M.level;M.schema=q.validate,M.schemaPath="";var Y=e.compositeRule;e.compositeRule=M.compositeRule=!0;var te=e.validate(M).replace(/validate\.schema/g,$);e.compositeRule=M.compositeRule=Y,r+=" "+te}else{var K=K||[];K.push(r),r="",r+=" "+$+".call( ",e.opts.passContext?r+="this":r+="self",I||P.schema===!1?r+=" , "+g+" ":r+=" , "+v+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=i?"data"+(i-1||""):"parentData",ge=i?e.dataPathArr[i]:"parentDataProperty";r+=" , "+Z+" , "+ge+" , rootData ) ";var Ie=r;r=K.pop(),P.errors===!1?(r+=" "+d+" = ",k&&(r+="await "),r+=""+Ie+"; "):k?(F="customErrors"+n,r+=" var "+F+" = null; try { "+d+" = await "+Ie+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+F+" = e.errors; else throw e; } "):r+=" "+F+" = null; "+d+" = "+Ie+"; "}if(P.modifying&&(r+=" if ("+Z+") "+g+" = "+Z+"["+ge+"];"),r+=""+O,P.valid)h&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",H?r+=""+ce:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",f=w.keyword;var K=K||[];K.push(r),r="";var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+w.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var De=r;r=K.pop(),!e.compositeRule&&h?e.async?r+=" throw new ValidationError(["+De+"]); ":r+=" validate.errors = ["+De+"]; return false; ":r+=" var err = "+De+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var ne=r;r=K.pop(),A?P.errors?P.errors!="full"&&(r+=" for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+C+" = vErrors["+L+"]; if ("+C+".dataPath === undefined) "+C+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+C+".schemaPath === undefined) { "+C+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+C+".schema = "+v+"; "+C+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+ne+" ":(r+=" if ("+y+" == errors) { "+ne+" } else { for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+C+" = vErrors["+L+"]; if ("+C+".dataPath === undefined) "+C+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+C+".schemaPath === undefined) { "+C+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+C+".schema = "+v+"; "+C+".data = "+g+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(f||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+w.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+w.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&h&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+ne+" ":(r+=" if (Array.isArray("+F+")) { if (vErrors === null) vErrors = "+F+"; else vErrors = vErrors.concat("+F+"); errors = vErrors.length; for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+C+" = vErrors["+L+"]; if ("+C+".dataPath === undefined) "+C+".dataPath = (dataPath || '') + "+e.errorPath+"; "+C+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+C+".schema = "+v+"; "+C+".data = "+g+"; "),r+=" } } else { "+ne+" } "),r+=" } ",h&&(r+=" else { ")}return r}});var Sn=z((Yg,pp)=>{pp.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}});var Fl=z((Xg,Ml)=>{"use strict";var Ll=Sn();Ml.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:Ll.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:Ll.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var Ul=z((ey,ql)=>{"use strict";var mp=/^[a-z_$][a-z0-9_$-]*$/i,vp=jl(),gp=Fl();ql.exports={add:yp,get:_p,remove:bp,validate:Rn};function yp(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!mp.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)i(a,s[r],e);else i(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function i(o,u,c){for(var h,f=0;f<t.length;f++){var g=t[f];if(g.type==u){h=g;break}}h||(h={type:u,rules:[]},t.push(h));var d={keyword:o,definition:c,custom:!0,code:vp,implements:c.implements};h.rules.push(d),t.custom[o]=d}return this}function _p(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function bp(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function Rn(a,e){Rn.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(gp,!0);if(t(a))return!0;if(Rn.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var zl=z((ry,wp)=>{wp.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Tn=z((ty,Kl)=>{"use strict";var Hl=wo(),ft=es(),xp=Eo(),Zl=dn(),Ep=gn(),Pp=No(),Sp=Tl(),Bl=Al(),Jl=ht();Kl.exports=_e;_e.prototype.validate=Op;_e.prototype.compile=Tp;_e.prototype.addSchema=Cp;_e.prototype.addMetaSchema=Ip;_e.prototype.validateSchema=Ap;_e.prototype.getSchema=kp;_e.prototype.removeSchema=Np;_e.prototype.addFormat=Vp;_e.prototype.errorsText=zp;_e.prototype._addSchema=jp;_e.prototype._compile=Lp;_e.prototype.compileAsync=Dl();var cs=Ul();_e.prototype.addKeyword=cs.add;_e.prototype.getKeyword=cs.get;_e.prototype.removeKeyword=cs.remove;_e.prototype.validateKeyword=cs.validate;var Ql=rs();_e.ValidationError=Ql.Validation;_e.MissingRefError=Ql.MissingRef;_e.$dataMetaSchema=Bl;var ls="http://json-schema.org/draft-07/schema",Vl=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Rp=["/properties"];function _e(a){if(!(this instanceof _e))return new _e(a);a=this._opts=Jl.copy(a)||{},Wp(this),this._schemas={},this._refs={},this._fragments={},this._formats=Pp(a.format),this._cache=a.cache||new xp,this._loadingSchemas={},this._compilations=[],this.RULES=Sp(),this._getId=Mp(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Ep),this._metaOpts=Qp(this),a.formats&&Bp(this),a.keywords&&Jp(this),Hp(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Zp(this)}function Op(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Tp(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Cp(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=ft.normalizeId(e||n),Gl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Ip(a,e,t){return this.addSchema(a,e,t,!0),this}function Ap(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||$p(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function $p(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(ls)?ls:void 0,a._opts.defaultMeta}function kp(a){var e=Wl(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Dp(this,a)}}function Dp(a,e){var t=ft.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,i=Hl.call(a,s,r,void 0,n);return a._fragments[e]=new Zl({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:i}),i}}function Wl(a,e){return e=ft.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function Np(a){if(a instanceof RegExp)return os(this,this._schemas,a),os(this,this._refs,a),this;switch(typeof a){case"undefined":return os(this,this._schemas),os(this,this._refs),this._cache.clear(),this;case"string":var e=Wl(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=ft.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function os(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function jp(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,i=this._cache.get(n);if(i)return i;s=s||this._opts.addUsedSchema!==!1;var o=ft.normalizeId(this._getId(a));o&&s&&Gl(this,o);var u=this._opts.validateSchema!==!1&&!e,c;u&&!(c=o&&o==ft.normalizeId(a.$schema))&&this.validateSchema(a,!0);var h=ft.ids.call(this,a),f=new Zl({id:o,schema:a,localRefs:h,cacheKey:n,meta:t});return o[0]!="#"&&s&&(this._refs[o]=f),this._cache.put(n,f),u&&c&&this.validateSchema(a,!0),f}function Lp(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=Hl.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,i=n.apply(this,arguments);return r.errors=n.errors,i}}function Mp(a){switch(a.schemaId){case"auto":return Up;case"id":return Fp;default:return qp}}function Fp(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function qp(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function Up(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function zp(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var i=a[n];i&&(r+=s+i.dataPath+" "+i.message+t)}return r.slice(0,-t.length)}function Vp(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function Hp(a){var e;if(a._opts.$data&&(e=zl(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=Sn();a._opts.$data&&(t=Bl(t,Rp)),a.addMetaSchema(t,ls,!0),a._refs["http://json-schema.org/schema"]=ls}}function Zp(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function Bp(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function Jp(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function Gl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Qp(a){for(var e=Jl.copy(a._opts),t=0;t<Vl.length;t++)delete e[Vl[t]];return e}function Wp(a){var e=a._opts.logger;if(e===!1)a.logger={log:On,warn:On,error:On};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function On(){}});var yc=z((Iy,ys)=>{"use strict";ys.exports=Em;ys.exports.format=vc;ys.exports.parse=gc;var bm=/\B(?=(\d{3})+(?!\d))/g,wm=/(?:\.0*|(\.[^0]+)0+)$/,Ur={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},xm=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function Em(a,e){return typeof a=="string"?gc(a):typeof a=="number"?vc(a,e):null}function vc(a,e){if(!Number.isFinite(a))return null;var t=Math.abs(a),s=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,i=!!(e&&e.fixedDecimals),o=e&&e.unit||"";(!o||!Ur[o.toLowerCase()])&&(t>=Ur.pb?o="PB":t>=Ur.tb?o="TB":t>=Ur.gb?o="GB":t>=Ur.mb?o="MB":t>=Ur.kb?o="KB":o="B");var u=a/Ur[o.toLowerCase()],c=u.toFixed(n);return i||(c=c.replace(wm,"$1")),s&&(c=c.split(".").map(function(h,f){return f===0?h.replace(bm,s):h}).join(".")),c+r+o}function gc(a){if(typeof a=="number"&&!isNaN(a))return a;if(typeof a!="string")return null;var e=xm.exec(a),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(a,10),s="b"),isNaN(t)?null:Math.floor(Ur[s]*t)}});var Qn=z(Jn=>{"use strict";var bc=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Pm=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,wc=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Sm=/\\([\u000b\u0020-\u00ff])/g,Rm=/([\\"])/g,xc=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Jn.format=Om;Jn.parse=Tm;function Om(a){if(!a||typeof a!="object")throw new TypeError("argument obj is required");var e=a.parameters,t=a.type;if(!t||!xc.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var r,n=Object.keys(e).sort(),i=0;i<n.length;i++){if(r=n[i],!wc.test(r))throw new TypeError("invalid parameter name");s+="; "+r+"="+Im(e[r])}return s}function Tm(a){if(!a)throw new TypeError("argument string is required");var e=typeof a=="object"?Cm(a):a;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var t=e.indexOf(";"),s=t!==-1?e.slice(0,t).trim():e.trim();if(!xc.test(s))throw new TypeError("invalid media type");var r=new Am(s.toLowerCase());if(t!==-1){var n,i,o;for(bc.lastIndex=t;i=bc.exec(e);){if(i.index!==t)throw new TypeError("invalid parameter format");t+=i[0].length,n=i[1].toLowerCase(),o=i[2],o.charCodeAt(0)===34&&(o=o.slice(1,-1),o.indexOf("\\")!==-1&&(o=o.replace(Sm,"$1"))),r.parameters[n]=o}if(t!==e.length)throw new TypeError("invalid parameter format")}return r}function Cm(a){var e;if(typeof a.getHeader=="function"?e=a.getHeader("content-type"):typeof a.headers=="object"&&(e=a.headers&&a.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function Im(a){var e=String(a);if(wc.test(e))return e;if(e.length>0&&!Pm.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(Rm,"\\$1")+'"'}function Am(a){this.parameters=Object.create(null),this.type=a}});var Ic=z((jy,Cc)=>{Cc.exports=Tc;Tc.sync=Dm;var Rc=require("fs");function km(a,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s<t.length;s++){var r=t[s].toLowerCase();if(r&&a.substr(-r.length).toLowerCase()===r)return!0}return!1}function Oc(a,e,t){return!a.isSymbolicLink()&&!a.isFile()?!1:km(e,t)}function Tc(a,e,t){Rc.stat(a,function(s,r){t(s,s?!1:Oc(r,a,e))})}function Dm(a,e){return Oc(Rc.statSync(a),a,e)}});var Nc=z((Ly,Dc)=>{Dc.exports=$c;$c.sync=Nm;var Ac=require("fs");function $c(a,e,t){Ac.stat(a,function(s,r){t(s,s?!1:kc(r,e))})}function Nm(a,e){return kc(Ac.statSync(a),e)}function kc(a,e){return a.isFile()&&jm(a,e)}function jm(a,e){var t=a.mode,s=a.uid,r=a.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),o=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),h=o|u,f=t&c||t&u&&r===i||t&o&&s===n||t&h&&n===0;return f}});var Lc=z((Fy,jc)=>{var My=require("fs"),bs;process.platform==="win32"||global.TESTING_WINDOWS?bs=Ic():bs=Nc();jc.exports=Wn;Wn.sync=Lm;function Wn(a,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,r){Wn(a,e||{},function(n,i){n?r(n):s(i)})})}bs(a,e||{},function(s,r){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,r=!1),t(s,r)})}function Lm(a,e){try{return bs.sync(a,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Hc=z((qy,Vc)=>{var Vt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Mc=require("path"),Mm=Vt?";":":",Fc=Lc(),qc=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),Uc=(a,e)=>{let t=e.colon||Mm,s=a.match(/\//)||Vt&&a.match(/\\/)?[""]:[...Vt?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],r=Vt?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Vt?r.split(t):[""];return Vt&&a.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:r}},zc=(a,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:s,pathExt:r,pathExtExe:n}=Uc(a,e),i=[],o=c=>new Promise((h,f)=>{if(c===s.length)return e.all&&i.length?h(i):f(qc(a));let g=s[c],d=/^".*"$/.test(g)?g.slice(1,-1):g,y=Mc.join(d,a),m=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+y:y;h(u(m,c,0))}),u=(c,h,f)=>new Promise((g,d)=>{if(f===r.length)return g(o(h+1));let y=r[f];Fc(c+y,{pathExt:n},(m,v)=>{if(!m&&v)if(e.all)i.push(c+y);else return g(c+y);return g(u(c,h,f+1))})});return t?o(0).then(c=>t(null,c),t):o(0)},Fm=(a,e)=>{e=e||{};let{pathEnv:t,pathExt:s,pathExtExe:r}=Uc(a,e),n=[];for(let i=0;i<t.length;i++){let o=t[i],u=/^".*"$/.test(o)?o.slice(1,-1):o,c=Mc.join(u,a),h=!u&&/^\.[\\\/]/.test(a)?a.slice(0,2)+c:c;for(let f=0;f<s.length;f++){let g=h+s[f];try{if(Fc.sync(g,{pathExt:r}))if(e.all)n.push(g);else return g}catch{}}}if(e.all&&n.length)return n;if(e.nothrow)return null;throw qc(a)};Vc.exports=zc;zc.sync=Fm});var Bc=z((Uy,Gn)=>{"use strict";var Zc=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};Gn.exports=Zc;Gn.exports.default=Zc});var Gc=z((zy,Wc)=>{"use strict";var Jc=require("path"),qm=Hc(),Um=Bc();function Qc(a,e){let t=a.options.env||process.env,s=process.cwd(),r=a.options.cwd!=null,n=r&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(a.options.cwd)}catch{}let i;try{i=qm.sync(a.command,{path:t[Um({env:t})],pathExt:e?Jc.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return i&&(i=Jc.resolve(r?a.options.cwd:"",i)),i}function zm(a){return Qc(a)||Qc(a,!0)}Wc.exports=zm});var Kc=z((Vy,Yn)=>{"use strict";var Kn=/([()\][%!^"`<>&|;, *?])/g;function Vm(a){return a=a.replace(Kn,"^$1"),a}function Hm(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(Kn,"^$1"),e&&(a=a.replace(Kn,"^$1")),a}Yn.exports.command=Vm;Yn.exports.argument=Hm});var Xc=z((Hy,Yc)=>{"use strict";Yc.exports=/^#!(.*)/});var ru=z((Zy,eu)=>{"use strict";var Zm=Xc();eu.exports=(a="")=>{let e=a.match(Zm);if(!e)return null;let[t,s]=e[0].replace(/#! ?/,"").split(" "),r=t.split("/").pop();return r==="env"?s:s?`${r} ${s}`:r}});var au=z((By,tu)=>{"use strict";var Xn=require("fs"),Bm=ru();function Jm(a){let t=Buffer.alloc(150),s;try{s=Xn.openSync(a,"r"),Xn.readSync(s,t,0,150,0),Xn.closeSync(s)}catch{}return Bm(t.toString())}tu.exports=Jm});var ou=z((Jy,iu)=>{"use strict";var Qm=require("path"),su=Gc(),nu=Kc(),Wm=au(),Gm=process.platform==="win32",Km=/\.(?:com|exe)$/i,Ym=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Xm(a){a.file=su(a);let e=a.file&&Wm(a.file);return e?(a.args.unshift(a.file),a.command=e,su(a)):a.file}function ev(a){if(!Gm)return a;let e=Xm(a),t=!Km.test(e);if(a.options.forceShell||t){let s=Ym.test(e);a.command=Qm.normalize(a.command),a.command=nu.command(a.command),a.args=a.args.map(n=>nu.argument(n,s));let r=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${r}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function rv(a,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let s={command:a,args:e,options:t,file:void 0,original:{command:a,args:e}};return t.shell?s:ev(s)}iu.exports=rv});var uu=z((Qy,cu)=>{"use strict";var ei=process.platform==="win32";function ri(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function tv(a,e){if(!ei)return;let t=a.emit;a.emit=function(s,r){if(s==="exit"){let n=lu(r,e);if(n)return t.call(a,"error",n)}return t.apply(a,arguments)}}function lu(a,e){return ei&&a===1&&!e.file?ri(e.original,"spawn"):null}function av(a,e){return ei&&a===1&&!e.file?ri(e.original,"spawnSync"):null}cu.exports={hookChildProcess:tv,verifyENOENT:lu,verifyENOENTSync:av,notFoundError:ri}});var fu=z((Wy,Ht)=>{"use strict";var du=require("child_process"),ti=ou(),ai=uu();function hu(a,e,t){let s=ti(a,e,t),r=du.spawn(s.command,s.args,s.options);return ai.hookChildProcess(r,s),r}function sv(a,e,t){let s=ti(a,e,t),r=du.spawnSync(s.command,s.args,s.options);return r.error=r.error||ai.verifyENOENTSync(r.status,s),r}Ht.exports=hu;Ht.exports.spawn=hu;Ht.exports.sync=sv;Ht.exports._parse=ti;Ht.exports._enoent=ai});var _v={};xi(_v,{CallToolRequestSchema:()=>Gs,Client:()=>us,ListRootsRequestSchema:()=>rn,ListToolsRequestSchema:()=>Qs,PingRequestSchema:()=>Nt,ProgressNotificationSchema:()=>jt,SSEClientTransport:()=>gs,SSEServerTransport:()=>_s,Server:()=>ds,StdioClientTransport:()=>xs,StdioServerTransport:()=>Es,StreamableHTTPClientTransport:()=>Rs,StreamableHTTPServerTransport:()=>Ps,z:()=>l,zodToJsonSchema:()=>ci});module.exports=bd(_v);var l={};xi(l,{BRAND:()=>Bd,DIRTY:()=>Qr,EMPTY_PATH:()=>Pd,INVALID:()=>B,NEVER:()=>Ih,OK:()=>$e,ParseStatus:()=>Ce,Schema:()=>G,ZodAny:()=>kr,ZodArray:()=>Pr,ZodBigInt:()=>Gr,ZodBoolean:()=>Kr,ZodBranded:()=>ea,ZodCatch:()=>lt,ZodDate:()=>Yr,ZodDefault:()=>ot,ZodDiscriminatedUnion:()=>Da,ZodEffects:()=>er,ZodEnum:()=>nt,ZodError:()=>qe,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>ja,ZodIntersection:()=>tt,ZodIssueCode:()=>R,ZodLazy:()=>at,ZodLiteral:()=>st,ZodMap:()=>At,ZodNaN:()=>kt,ZodNativeEnum:()=>it,ZodNever:()=>sr,ZodNull:()=>et,ZodNullable:()=>fr,ZodNumber:()=>Wr,ZodObject:()=>Ue,ZodOptional:()=>Ye,ZodParsedType:()=>N,ZodPipeline:()=>ra,ZodPromise:()=>Dr,ZodReadonly:()=>ct,ZodRecord:()=>Na,ZodSchema:()=>G,ZodSet:()=>$t,ZodString:()=>$r,ZodSymbol:()=>Ct,ZodTransformer:()=>er,ZodTuple:()=>hr,ZodType:()=>G,ZodUndefined:()=>Xr,ZodUnion:()=>rt,ZodUnknown:()=>Er,ZodVoid:()=>It,addIssueToContext:()=>D,any:()=>rh,array:()=>nh,bigint:()=>Gd,boolean:()=>Di,coerce:()=>Ch,custom:()=>Ai,date:()=>Kd,datetimeRegex:()=>Ci,defaultErrorMap:()=>wr,discriminatedUnion:()=>ch,effect:()=>wh,enum:()=>yh,function:()=>mh,getErrorMap:()=>Rt,getParsedType:()=>dr,instanceof:()=>Qd,intersection:()=>uh,isAborted:()=>$a,isAsync:()=>Ot,isDirty:()=>ka,isValid:()=>Ar,late:()=>Jd,lazy:()=>vh,literal:()=>gh,makeIssue:()=>Xt,map:()=>fh,nan:()=>Wd,nativeEnum:()=>_h,never:()=>ah,null:()=>eh,nullable:()=>Eh,number:()=>ki,object:()=>ih,objectUtil:()=>Ns,oboolean:()=>Th,onumber:()=>Oh,optional:()=>xh,ostring:()=>Rh,pipeline:()=>Sh,preprocess:()=>Ph,promise:()=>bh,quotelessJson:()=>wd,record:()=>hh,set:()=>ph,setErrorMap:()=>Ed,strictObject:()=>oh,string:()=>$i,symbol:()=>Yd,transformer:()=>wh,tuple:()=>dh,undefined:()=>Xd,union:()=>lh,unknown:()=>th,util:()=>X,void:()=>sh});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let i of r)n[i]=i;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(let o of n)i[o]=r[o];return a.objectValues(i)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&n.push(i);return n},a.find=(r,n)=>{for(let i of r)if(n(i))return i},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Ns;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ns||(Ns={}));var N=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dr=a=>{switch(typeof a){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map!="undefined"&&a instanceof Map?N.map:typeof Set!="undefined"&&a instanceof Set?N.set:typeof Date!="undefined"&&a instanceof Date?N.date:N.object;default:return N.unknown}};var R=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),wd=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),qe=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,u=0;for(;u<i.path.length;){let c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};qe.create=a=>new qe(a);var xd=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===N.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},wr=xd;var Pi=wr;function Ed(a){Pi=a}function Rt(){return Pi}var Xt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],i={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)o=c(i,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},Pd=[];function D(a,e){let t=Rt(),s=Xt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===wr?void 0:wr].filter(r=>!!r)});a.common.issues.push(s)}var Ce=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,i=await r.value;s.push({key:n,value:i})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:i}=r;if(n.status==="aborted"||i.status==="aborted")return B;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value!="undefined"||r.alwaysSet)&&(s[n.value]=i.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Qr=a=>({status:"dirty",value:a}),$e=a=>({status:"valid",value:a}),$a=a=>a.status==="aborted",ka=a=>a.status==="dirty",Ar=a=>a.status==="valid",Ot=a=>typeof Promise!="undefined"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Xe=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Si=(a,e)=>{if(Ar(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new qe(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,h;let{message:u}=a;return i.code==="invalid_enum_value"?{message:u!=null?u:o.defaultError}:typeof o.data=="undefined"?{message:(c=u!=null?u:s)!=null?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(h=u!=null?u:t)!=null?h:o.defaultError}},description:r}}var G=class{get description(){return this._def.description}_getType(e){return dr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ce,ctx:{common:e.parent.common,data:e.data,parsedType:dr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ot(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t==null?void 0:t.async)!=null?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Si(s,r)}"~validate"(e){var s,r;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Ar(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Ar(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(Ot(r)?r:Promise.resolve(r));return Si(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let i=e(r),o=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new er({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ye.create(this,this._def)}nullable(){return fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return Dr.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new er({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ot({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new ea({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new lt({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ra.create(this,e)}readonly(){return ct.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Sd=/^c[^\s-]{8,}$/i,Rd=/^[0-9a-z]+$/,Od=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Td=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Cd=/^[a-z0-9_-]{21}$/i,Id=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ad=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,$d=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",js,Dd=/^(?:(?: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])$/,Nd=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,jd=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ld=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Md=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Oi="((\\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])))",qd=new RegExp(`^${Oi}$`);function Ti(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Ud(a){return new RegExp(`^${Ti(a)}$`)}function Ci(a){let e=`${Oi}T${Ti(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zd(a,e){return!!((e==="v4"||!e)&&Dd.test(a)||(e==="v6"||!e)&&jd.test(a))}function Vd(a,e){if(!Id.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Hd(a,e){return!!((e==="v4"||!e)&&Nd.test(a)||(e==="v6"||!e)&&Ld.test(a))}var $r=class a extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:N.string,received:n.parsedType}),B}let s=new Ce,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")$d.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")js||(js=new RegExp(kd,"u")),js.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Td.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Cd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Sd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Rd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Od.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),D(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"regex",code:R.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ci(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?qd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?Ud(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Ad.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?zd(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?Vd(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?Hd(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?Md.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?Fd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1,...V.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...V.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...V.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};$r.create=a=>{var e;return new $r({checks:[],typeName:T.ZodString,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};function Zd(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return n%i/10**r}var Wr=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==N.number){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:N.number,received:n.parsedType}),B}let s,r=new Ce;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?Zd(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Wr.create=a=>new Wr({checks:[],typeName:T.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Gr=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let s,r=new Ce;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:N.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Gr.create=a=>{var e;return new Gr({checks:[],typeName:T.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};var Kr=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.boolean,received:s.parsedType}),B}return $e(e.data)}};Kr.create=a=>new Kr({typeName:T.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Yr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:N.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_date}),B}let s=new Ce,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Yr.create=a=>new Yr({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:T.ZodDate,...Q(a)});var Ct=class extends G{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.symbol,received:s.parsedType}),B}return $e(e.data)}};Ct.create=a=>new Ct({typeName:T.ZodSymbol,...Q(a)});var Xr=class extends G{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.undefined,received:s.parsedType}),B}return $e(e.data)}};Xr.create=a=>new Xr({typeName:T.ZodUndefined,...Q(a)});var et=class extends G{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.null,received:s.parsedType}),B}return $e(e.data)}};et.create=a=>new et({typeName:T.ZodNull,...Q(a)});var kr=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return $e(e.data)}};kr.create=a=>new kr({typeName:T.ZodAny,...Q(a)});var Er=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $e(e.data)}};Er.create=a=>new Er({typeName:T.ZodUnknown,...Q(a)});var sr=class extends G{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:N.never,received:t.parsedType}),B}};sr.create=a=>new sr({typeName:T.ZodNever,...Q(a)});var It=class extends G{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.void,received:s.parsedType}),B}return $e(e.data)}};It.create=a=>new It({typeName:T.ZodVoid,...Q(a)});var Pr=class a extends G{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return D(t,{code:R.invalid_type,expected:N.array,received:t.parsedType}),B;if(r.exactLength!==null){let i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(D(t,{code:i?R.too_big:R.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(D(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(D(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new Xe(t,i,t.path,o)))).then(i=>Ce.mergeArray(s,i));let n=[...t.data].map((i,o)=>r.type._parseSync(new Xe(t,i,t.path,o)));return Ce.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};Pr.create=(a,e)=>new Pr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function Tt(a){if(a instanceof Ue){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ye.create(Tt(s))}return new Ue({...a._def,shape:()=>e})}else return a instanceof Pr?new Pr({...a._def,type:Tt(a.element)}):a instanceof Ye?Ye.create(Tt(a.unwrap())):a instanceof fr?fr.create(Tt(a.unwrap())):a instanceof hr?hr.create(a.items.map(e=>Tt(e))):a}var Ue=class a extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let c=this._getOrReturnCtx(e);return D(c,{code:R.invalid_type,expected:N.object,received:c.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof sr&&this._def.unknownKeys==="strip"))for(let c in r.data)i.includes(c)||o.push(c);let u=[];for(let c of i){let h=n[c],f=r.data[c];u.push({key:{status:"valid",value:c},value:h._parse(new Xe(r,f,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof sr){let c=this._def.unknownKeys;if(c==="passthrough")for(let h of o)u.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(c==="strict")o.length>0&&(D(r,{code:R.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let h of o){let f=r.data[h];u.push({key:{status:"valid",value:h},value:c._parse(new Xe(r,f,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let h of u){let f=await h.key,g=await h.value;c.push({key:f,value:g,alwaysSet:h.alwaysSet})}return c}).then(c=>Ce.mergeObjectSync(s,c)):Ce.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,i,o,u;let r=(o=(i=(n=this._def).errorMap)==null?void 0:i.call(n,t,s).message)!=null?o:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return Tt(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ye;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Ii(X.objectKeys(this.shape))}};Ue.create=(a,e)=>new Ue({shape:()=>a,unknownKeys:"strip",catchall:sr.create(),typeName:T.ZodObject,...Q(e)});Ue.strictCreate=(a,e)=>new Ue({shape:()=>a,unknownKeys:"strict",catchall:sr.create(),typeName:T.ZodObject,...Q(e)});Ue.lazycreate=(a,e)=>new Ue({shape:a,unknownKeys:"strip",catchall:sr.create(),typeName:T.ZodObject,...Q(e)});var rt=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let o of n)if(o.result.status==="valid")return o.result;for(let o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=n.map(o=>new qe(o.ctx.common.issues));return D(t,{code:R.invalid_union,unionErrors:i}),B}if(t.common.async)return Promise.all(s.map(async n=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(r);{let n,i=[];for(let u of s){let c={...t,common:{...t.common,issues:[]},parent:null},h=u._parseSync({data:t.data,path:t.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=i.map(u=>new qe(u));return D(t,{code:R.invalid_union,unionErrors:o}),B}}get options(){return this._def.options}};rt.create=(a,e)=>new rt({options:a,typeName:T.ZodUnion,...Q(e)});var xr=a=>a instanceof at?xr(a.schema):a instanceof er?xr(a.innerType()):a instanceof st?[a.value]:a instanceof nt?a.options:a instanceof it?X.objectValues(a.enum):a instanceof ot?xr(a._def.innerType):a instanceof Xr?[void 0]:a instanceof et?[null]:a instanceof Ye?[void 0,...xr(a.unwrap())]:a instanceof fr?[null,...xr(a.unwrap())]:a instanceof ea||a instanceof ct?xr(a.unwrap()):a instanceof lt?xr(a._def.innerType):[],Da=class a extends G{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return D(t,{code:R.invalid_type,expected:N.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(D(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let i=xr(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function Ls(a,e){let t=dr(a),s=dr(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(o=>r.indexOf(o)!==-1),i={...a,...e};for(let o of n){let u=Ls(a[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===N.array&&s===N.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let i=a[n],o=e[n],u=Ls(i,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var tt=class extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,i)=>{if($a(n)||$a(i))return B;let o=Ls(n.value,i.value);return o.valid?((ka(n)||ka(i))&&t.dirty(),{status:t.value,value:o.data}):(D(s,{code:R.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,i])=>r(n,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};tt.create=(a,e,t)=>new tt({left:a,right:e,typeName:T.ZodIntersection,...Q(t)});var hr=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return D(s,{code:R.invalid_type,expected:N.array,received:s.parsedType}),B;if(s.data.length<this._def.items.length)return D(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new Xe(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(n).then(i=>Ce.mergeArray(t,i)):Ce.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};hr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hr({items:a,typeName:T.ZodTuple,rest:null,...Q(e)})};var Na=class a extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.object)return D(s,{code:R.invalid_type,expected:N.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,i=this._def.valueType;for(let o in s.data)r.push({key:n._parse(new Xe(s,o,s.path,o)),value:i._parse(new Xe(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Ce.mergeObjectAsync(t,r):Ce.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof G?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(s)}):new a({keyType:$r.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},At=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.map)return D(s,{code:R.invalid_type,expected:N.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,i=[...s.data.entries()].map(([o,u],c)=>({key:r._parse(new Xe(s,o,s.path,[c,"key"])),value:n._parse(new Xe(s,u,s.path,[c,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let c=await u.key,h=await u.value;if(c.status==="aborted"||h.status==="aborted")return B;(c.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(c.value,h.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return B;(c.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(c.value,h.value)}return{status:t.value,value:o}}}};At.create=(a,e,t)=>new At({valueType:e,keyType:a,typeName:T.ZodMap,...Q(t)});var $t=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return D(s,{code:R.invalid_type,expected:N.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(D(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(D(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function i(u){let c=new Set;for(let h of u){if(h.status==="aborted")return B;h.status==="dirty"&&t.dirty(),c.add(h.value)}return{status:t.value,value:c}}let o=[...s.data.values()].map((u,c)=>n._parse(new Xe(s,u,s.path,c)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};$t.create=(a,e)=>new $t({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var ja=class a extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return D(t,{code:R.invalid_type,expected:N.function,received:t.parsedType}),B;function s(o,u){return Xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rt(),wr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:u}})}function r(o,u){return Xt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rt(),wr].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:u}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Dr){let o=this;return $e(async function(...u){let c=new qe([]),h=await o._def.args.parseAsync(u,n).catch(d=>{throw c.addIssue(s(u,d)),c}),f=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(f,n).catch(d=>{throw c.addIssue(r(f,d)),c})})}else{let o=this;return $e(function(...u){let c=o._def.args.safeParse(u,n);if(!c.success)throw new qe([s(u,c.error)]);let h=Reflect.apply(i,this,c.data),f=o._def.returns.safeParse(h,n);if(!f.success)throw new qe([r(h,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:hr.create(e).rest(Er.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||hr.create([]).rest(Er.create()),returns:t||Er.create(),typeName:T.ZodFunction,...Q(s)})}},at=class extends G{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};at.create=(a,e)=>new at({getter:a,typeName:T.ZodLazy,...Q(e)});var st=class extends G{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};st.create=(a,e)=>new st({value:a,typeName:T.ZodLiteral,...Q(e)});function Ii(a,e){return new nt({values:a,typeName:T.ZodEnum,...Q(e)})}var nt=class a extends G{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:X.joinValues(s),received:t.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{received:t.data,code:R.invalid_enum_value,options:s}),B}return $e(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};nt.create=Ii;var it=class extends G{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=X.objectValues(t);return D(s,{expected:X.joinValues(r),received:s.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return D(s,{received:s.data,code:R.invalid_enum_value,options:r}),B}return $e(e.data)}get enum(){return this._def.values}};it.create=(a,e)=>new it({values:a,typeName:T.ZodNativeEnum,...Q(e)});var Dr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return D(t,{code:R.invalid_type,expected:N.promise,received:t.parsedType}),B;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return $e(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Dr.create=(a,e)=>new Dr({type:a,typeName:T.ZodPromise,...Q(e)});var er=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:i=>{D(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let i=r.transform(s.data,n);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?B:u.status==="dirty"?Qr(u.value):t.value==="dirty"?Qr(u.value):u});{if(t.value==="aborted")return B;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?B:o.status==="dirty"?Qr(o.value):t.value==="dirty"?Qr(o.value):o}}if(r.type==="refinement"){let i=o=>{let u=r.refinement(o,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?B:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?B:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ar(i))return B;let o=r.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Ar(i)?Promise.resolve(r.transform(i.value,n)).then(o=>({status:t.value,value:o})):B);X.assertNever(r)}};er.create=(a,e,t)=>new er({schema:a,typeName:T.ZodEffects,effect:e,...Q(t)});er.createWithPreprocess=(a,e,t)=>new er({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...Q(t)});var Ye=class extends G{_parse(e){return this._getType(e)===N.undefined?$e(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ye.create=(a,e)=>new Ye({innerType:a,typeName:T.ZodOptional,...Q(e)});var fr=class extends G{_parse(e){return this._getType(e)===N.null?$e(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};fr.create=(a,e)=>new fr({innerType:a,typeName:T.ZodNullable,...Q(e)});var ot=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ot.create=(a,e)=>new ot({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var lt=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Ot(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new qe(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};lt.create=(a,e)=>new lt({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var kt=class extends G{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:N.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};kt.create=a=>new kt({typeName:T.ZodNaN,...Q(a)});var Bd=Symbol("zod_brand"),ea=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},ra=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Qr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:T.ZodPipeline})}},ct=class extends G{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Ar(r)&&(r.value=Object.freeze(r.value)),r);return Ot(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};ct.create=(a,e)=>new ct({innerType:a,typeName:T.ZodReadonly,...Q(e)});function Ri(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Ai(a,e={},t){return a?kr.create().superRefine((s,r)=>{var i,o;let n=a(s);if(n instanceof Promise)return n.then(u=>{var c,h;if(!u){let f=Ri(e,s),g=(h=(c=f.fatal)!=null?c:t)!=null?h:!0;r.addIssue({code:"custom",...f,fatal:g})}});if(!n){let u=Ri(e,s),c=(o=(i=u.fatal)!=null?i:t)!=null?o:!0;r.addIssue({code:"custom",...u,fatal:c})}}):kr.create()}var Jd={object:Ue.lazycreate},T;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(T||(T={}));var Qd=(a,e={message:`Input not instance of ${a.name}`})=>Ai(t=>t instanceof a,e),$i=$r.create,ki=Wr.create,Wd=kt.create,Gd=Gr.create,Di=Kr.create,Kd=Yr.create,Yd=Ct.create,Xd=Xr.create,eh=et.create,rh=kr.create,th=Er.create,ah=sr.create,sh=It.create,nh=Pr.create,ih=Ue.create,oh=Ue.strictCreate,lh=rt.create,ch=Da.create,uh=tt.create,dh=hr.create,hh=Na.create,fh=At.create,ph=$t.create,mh=ja.create,vh=at.create,gh=st.create,yh=nt.create,_h=it.create,bh=Dr.create,wh=er.create,xh=Ye.create,Eh=fr.create,Ph=er.createWithPreprocess,Sh=ra.create,Rh=()=>$i().optional(),Oh=()=>ki().optional(),Th=()=>Di().optional(),Ch={string:(a=>$r.create({...a,coerce:!0})),number:(a=>Wr.create({...a,coerce:!0})),boolean:(a=>Kr.create({...a,coerce:!0})),bigint:(a=>Gr.create({...a,coerce:!0})),date:(a=>Yr.create({...a,coerce:!0}))};var Ih=B;var Nr="2025-06-18",Ni="2025-03-26",ut=[Nr,"2025-03-26","2024-11-05","2024-10-07"],La="2.0",ji=l.union([l.string(),l.number().int()]),Li=l.string(),Ah=l.object({progressToken:l.optional(ji)}).passthrough(),rr=l.object({_meta:l.optional(Ah)}).passthrough(),ze=l.object({method:l.string(),params:l.optional(rr)}),ta=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),pr=l.object({method:l.string(),params:l.optional(ta)}),tr=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ma=l.union([l.string(),l.number().int()]),Mi=l.object({jsonrpc:l.literal(La),id:Ma}).merge(ze).strict(),dt=a=>Mi.safeParse(a).success,Fi=l.object({jsonrpc:l.literal(La)}).merge(pr).strict(),qi=a=>Fi.safeParse(a).success,Ui=l.object({jsonrpc:l.literal(La),id:Ma,result:tr}).strict(),Sr=a=>Ui.safeParse(a).success,Le;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(Le||(Le={}));var zi=l.object({jsonrpc:l.literal(La),id:Ma,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),Dt=a=>zi.safeParse(a).success,Qe=l.union([Mi,Fi,Ui,zi]),Rr=tr.strict(),Fa=pr.extend({method:l.literal("notifications/cancelled"),params:ta.extend({requestId:Ma,reason:l.string().optional()})}),aa=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),Vi=aa.extend({version:l.string()}),$h=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),qa=ze.extend({method:l.literal("initialize"),params:rr.extend({protocolVersion:l.string(),capabilities:$h,clientInfo:Vi})}),Hi=a=>qa.safeParse(a).success,kh=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),Ms=tr.extend({protocolVersion:l.string(),capabilities:kh,serverInfo:Vi,instructions:l.optional(l.string())}),Ua=pr.extend({method:l.literal("notifications/initialized")}),Zi=a=>Ua.safeParse(a).success,Nt=ze.extend({method:l.literal("ping")}),Dh=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),jt=pr.extend({method:l.literal("notifications/progress"),params:ta.merge(Dh).extend({progressToken:ji})}),za=ze.extend({params:rr.extend({cursor:l.optional(Li)}).optional()}),Va=tr.extend({nextCursor:l.optional(Li)}),Bi=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Ji=Bi.extend({text:l.string()}),Fs=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),Qi=Bi.extend({blob:Fs}),Wi=aa.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),Nh=aa.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),jh=za.extend({method:l.literal("resources/list")}),qs=Va.extend({resources:l.array(Wi)}),Lh=za.extend({method:l.literal("resources/templates/list")}),Us=Va.extend({resourceTemplates:l.array(Nh)}),Mh=ze.extend({method:l.literal("resources/read"),params:rr.extend({uri:l.string()})}),zs=tr.extend({contents:l.array(l.union([Ji,Qi]))}),Fh=pr.extend({method:l.literal("notifications/resources/list_changed")}),qh=ze.extend({method:l.literal("resources/subscribe"),params:rr.extend({uri:l.string()})}),Uh=ze.extend({method:l.literal("resources/unsubscribe"),params:rr.extend({uri:l.string()})}),zh=pr.extend({method:l.literal("notifications/resources/updated"),params:ta.extend({uri:l.string()})}),Vh=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),Hh=aa.extend({description:l.optional(l.string()),arguments:l.optional(l.array(Vh)),_meta:l.optional(l.object({}).passthrough())}),Zh=za.extend({method:l.literal("prompts/list")}),Vs=Va.extend({prompts:l.array(Hh)}),Bh=ze.extend({method:l.literal("prompts/get"),params:rr.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),Hs=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Zs=l.object({type:l.literal("image"),data:Fs,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Bs=l.object({type:l.literal("audio"),data:Fs,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Jh=l.object({type:l.literal("resource"),resource:l.union([Ji,Qi]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Qh=Wi.extend({type:l.literal("resource_link")}),Gi=l.union([Hs,Zs,Bs,Qh,Jh]),Wh=l.object({role:l.enum(["user","assistant"]),content:Gi}).passthrough(),Js=tr.extend({description:l.optional(l.string()),messages:l.array(Wh)}),Gh=pr.extend({method:l.literal("notifications/prompts/list_changed")}),Kh=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),Yh=aa.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(Kh),_meta:l.optional(l.object({}).passthrough())}),Qs=za.extend({method:l.literal("tools/list")}),Ws=Va.extend({tools:l.array(Yh)}),Ha=tr.extend({content:l.array(Gi).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),tg=Ha.or(tr.extend({toolResult:l.unknown()})),Gs=ze.extend({method:l.literal("tools/call"),params:rr.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),Xh=pr.extend({method:l.literal("notifications/tools/list_changed")}),sa=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Ks=ze.extend({method:l.literal("logging/setLevel"),params:rr.extend({level:sa})}),ef=pr.extend({method:l.literal("notifications/message"),params:ta.extend({level:sa,logger:l.optional(l.string()),data:l.unknown()})}),rf=l.object({name:l.string().optional()}).passthrough(),tf=l.object({hints:l.optional(l.array(rf)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),af=l.object({role:l.enum(["user","assistant"]),content:l.union([Hs,Zs,Bs])}).passthrough(),sf=ze.extend({method:l.literal("sampling/createMessage"),params:rr.extend({messages:l.array(af),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(tf)})}),Ys=tr.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[Hs,Zs,Bs])}),nf=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),of=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),lf=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),cf=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),uf=l.union([nf,of,lf,cf]),df=ze.extend({method:l.literal("elicitation/create"),params:rr.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),uf),required:l.optional(l.array(l.string()))}).passthrough()})}),Xs=tr.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),hf=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var ff=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),pf=ze.extend({method:l.literal("completion/complete"),params:rr.extend({ref:l.union([ff,hf]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),en=tr.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),mf=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),rn=ze.extend({method:l.literal("roots/list")}),tn=tr.extend({roots:l.array(mf)}),vf=pr.extend({method:l.literal("notifications/roots/list_changed")}),ag=l.union([Nt,qa,pf,Ks,Bh,Zh,jh,Lh,Mh,qh,Uh,Gs,Qs]),sg=l.union([Fa,jt,Ua,vf]),ng=l.union([Rr,Ys,Xs,tn]),ig=l.union([Nt,sf,df,rn]),og=l.union([Fa,jt,ef,zh,Fh,Xh,Gh]),lg=l.union([Rr,Ms,en,Js,Vs,qs,Us,zs,Ha,Ws]),ke=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var gf=6e4,Lt=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Fa,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(jt,t=>{this._onprogress(t)}),this.setRequestHandler(Nt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ke(Le.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};let i=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=u=>{i==null||i(u),this._onerror(u)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,c)=>{o==null||o(u,c),Sr(u)||Dt(u)?this._onresponse(u):dt(u)?this._onrequest(u,c):qi(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new ke(Le.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,i=this._transport;if(n===void 0){i==null||i.send({jsonrpc:"2.0",id:e.id,error:{code:Le.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let u={signal:o.signal,sessionId:i==null?void 0:i.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,h,f)=>this.request(c,h,{...f,relatedRequestId:e.id}),authInfo:t==null?void 0:t.authInfo,requestId:e.id,requestInfo:t==null?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,u)).then(c=>{if(!o.signal.aborted)return i==null?void 0:i.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var h;if(!o.signal.aborted)return i==null?void 0:i.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Le.InternalError,message:(h=c.message)!==null&&h!==void 0?h:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&i&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){i(u);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Sr(e))s(e);else{let r=new ke(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}=s!=null?s:{};return new Promise((o,u)=>{var c,h,f,g,d,y;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(h=s==null?void 0:s.signal)===null||h===void 0||h.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};s!=null&&s.onprogress&&(this._progressHandlers.set(m,s.onprogress),v.params={...e.params,_meta:{...((f=e.params)===null||f===void 0?void 0:f._meta)||{},progressToken:m}});let w=O=>{var I;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(I=this._transport)===null||I===void 0||I.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`))),u(O)};this._responseHandlers.set(m,O=>{var I;if(!(!((I=s==null?void 0:s.signal)===null||I===void 0)&&I.aborted)){if(O instanceof Error)return u(O);try{let A=t.parse(O.result);o(A)}catch(A){u(A)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var O;w((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let S=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:gf,P=()=>w(new ke(Le.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,s==null?void 0:s.maxTotalTimeout,P,(y=s==null?void 0:s.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:i}).catch(O=>{this._cleanupTimeout(m),u(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(t!=null&&t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,t).catch(h=>this._onerror(h))});return}let o={...e,jsonrpc:"2.0"};await this._transport.send(o,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Za(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var Yl=br(Tn(),1),us=class extends Lt{constructor(e,t){var s;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._ajv=new Yl.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Za(this._capabilities,e)}assertCapability(e,t){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let s=await this.request({method:"initialize",params:{protocolVersion:Nr,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ms,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!ut.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,s,r,n,i;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((i=this._serverCapabilities)===null||i===void 0)&&i.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},Rr,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},en,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},Rr,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Js,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Vs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},qs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Us,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},zs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},Rr,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},Rr,t)}async callTool(e,t=Ha,s){let r=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new ke(Le.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new ke(Le.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(i){throw i instanceof ke?i:new ke(Le.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let s=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let s=await this.request({method:"tools/list",params:e},Ws,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var Xl=br(Tn(),1),ds=class extends Lt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(sa.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let i=this._loggingLevels.get(n);return i?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(qa,r=>this._oninitialize(r)),this.setNotificationHandler(Ua,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ks,async(r,n)=>{var i;let o=n.sessionId||((i=n.requestInfo)===null||i===void 0?void 0:i.headers["mcp-session-id"])||void 0,{level:u}=r.params,c=sa.safeParse(u);return o&&c.success&&this._loggingLevels.set(o,c.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Za(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ut.includes(t)?t:Nr,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Rr)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ys,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Xs,t);if(s.action==="accept"&&s.content)try{let r=new Xl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new ke(Le.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof ke?r:new ke(Le.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},tn,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&(!t||!this.isMessageIgnored(e.level,t)))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var hs=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Cn(a){}function fs(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Cn,onError:t=Cn,onRetry:s=Cn,onComment:r}=a,n="",i=!0,o,u="",c="";function h(m){let v=i?m.replace(/^\xEF\xBB\xBF/,""):m,[w,S]=Gp(`${n}${v}`);for(let P of w)f(P);n=S,i=!1}function f(m){if(m===""){d();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}let v=m.indexOf(":");if(v!==-1){let w=m.slice(0,v),S=m[v+1]===" "?2:1,P=m.slice(v+S);g(w,P,m);return}g(m,"",m)}function g(m,v,w){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
2
+ `;break;case"id":o=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?s(parseInt(v,10)):t(new hs(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:w}));break;default:t(new hs(`Unknown field "${m.length>20?`${m.slice(0,20)}\u2026`:m}"`,{type:"unknown-field",field:m,value:v,line:w}));break}}function d(){u.length>0&&e({id:o,event:c||void 0,data:u.endsWith(`
3
+ `)?u.slice(0,-1):u}),o=void 0,u="",c=""}function y(m={}){n&&m.consume&&f(n),i=!0,o=void 0,u="",c="",n=""}return{feed:h,reset:y}}function Gp(a){let e=[],t="",s=0;for(;s<a.length;){let r=a.indexOf("\r",s),n=a.indexOf(`
4
+ `,s),i=-1;if(r!==-1&&n!==-1?i=Math.min(r,n):r!==-1?i=r:n!==-1&&(i=n),i===-1){t=a.slice(s);break}else{let o=a.slice(s,i);e.push(o),s=i+1,a[s-1]==="\r"&&a[s]===`
5
+ `&&s++}}return[e,t]}var ms=class extends Event{constructor(e,t){var s,r;super(e),this.code=(s=t==null?void 0:t.code)!=null?s:void 0,this.message=(r=t==null?void 0:t.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,t,s){return s(ec(this),t)}[Symbol.for("Deno.customInspect")](e,t){return e(ec(this),t)}};function Kp(a){let e=globalThis.DOMException;return typeof e=="function"?new e(a,"SyntaxError"):new SyntaxError(a)}function In(a){return a instanceof Error?"errors"in a&&Array.isArray(a.errors)?a.errors.map(In).join(", "):"cause"in a&&a.cause instanceof Error?`${a}: ${In(a.cause)}`:a.message:`${a}`}function ec(a){return{type:a.type,message:a.message,code:a.code,defaultPrevented:a.defaultPrevented,cancelable:a.cancelable,timeStamp:a.timeStamp}}var tc=a=>{throw TypeError(a)},Mn=(a,e,t)=>e.has(a)||tc("Cannot "+t),ee=(a,e,t)=>(Mn(a,e,"read from private field"),t?t.call(a):e.get(a)),Se=(a,e,t)=>e.has(a)?tc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),fe=(a,e,t,s)=>(Mn(a,e,"write to private field"),e.set(a,t),t),Or=(a,e,t)=>(Mn(a,e,"access private method"),t),Ve,pt,Mt,ps,vs,la,Ut,ca,Fr,Ft,zt,qt,ia,nr,An,$n,kn,rc,Dn,Nn,oa,jn,Ln,mt=class extends EventTarget{constructor(e,t){var s,r;super(),Se(this,nr),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,Se(this,Ve),Se(this,pt),Se(this,Mt),Se(this,ps),Se(this,vs),Se(this,la),Se(this,Ut),Se(this,ca,null),Se(this,Fr),Se(this,Ft),Se(this,zt,null),Se(this,qt,null),Se(this,ia,null),Se(this,$n,async n=>{var i;ee(this,Ft).reset();let{body:o,redirected:u,status:c,headers:h}=n;if(c===204){Or(this,nr,oa).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?fe(this,Mt,new URL(n.url)):fe(this,Mt,void 0),c!==200){Or(this,nr,oa).call(this,`Non-200 status code (${c})`,c);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Or(this,nr,oa).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(ee(this,Ve)===this.CLOSED)return;fe(this,Ve,this.OPEN);let f=new Event("open");if((i=ee(this,ia))==null||i.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){Or(this,nr,oa).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}let g=new TextDecoder,d=o.getReader(),y=!0;do{let{done:m,value:v}=await d.read();v&&ee(this,Ft).feed(g.decode(v,{stream:!m})),m&&(y=!1,ee(this,Ft).reset(),Or(this,nr,jn).call(this))}while(y)}),Se(this,kn,n=>{fe(this,Fr,void 0),!(n.name==="AbortError"||n.type==="aborted")&&Or(this,nr,jn).call(this,In(n))}),Se(this,Dn,n=>{typeof n.id=="string"&&fe(this,ca,n.id);let i=new MessageEvent(n.event||"message",{data:n.data,origin:ee(this,Mt)?ee(this,Mt).origin:ee(this,pt).origin,lastEventId:n.id||""});ee(this,qt)&&(!n.event||n.event==="message")&&ee(this,qt).call(this,i),this.dispatchEvent(i)}),Se(this,Nn,n=>{fe(this,la,n)}),Se(this,Ln,()=>{fe(this,Ut,void 0),ee(this,Ve)===this.CONNECTING&&Or(this,nr,An).call(this)});try{if(e instanceof URL)fe(this,pt,e);else if(typeof e=="string")fe(this,pt,new URL(e,Yp()));else throw new Error("Invalid URL")}catch{throw Kp("An invalid or illegal string was specified")}fe(this,Ft,fs({onEvent:ee(this,Dn),onRetry:ee(this,Nn)})),fe(this,Ve,this.CONNECTING),fe(this,la,3e3),fe(this,vs,(s=t==null?void 0:t.fetch)!=null?s:globalThis.fetch),fe(this,ps,(r=t==null?void 0:t.withCredentials)!=null?r:!1),Or(this,nr,An).call(this)}get readyState(){return ee(this,Ve)}get url(){return ee(this,pt).href}get withCredentials(){return ee(this,ps)}get onerror(){return ee(this,zt)}set onerror(e){fe(this,zt,e)}get onmessage(){return ee(this,qt)}set onmessage(e){fe(this,qt,e)}get onopen(){return ee(this,ia)}set onopen(e){fe(this,ia,e)}addEventListener(e,t,s){let r=t;super.addEventListener(e,r,s)}removeEventListener(e,t,s){let r=t;super.removeEventListener(e,r,s)}close(){ee(this,Ut)&&clearTimeout(ee(this,Ut)),ee(this,Ve)!==this.CLOSED&&(ee(this,Fr)&&ee(this,Fr).abort(),fe(this,Ve,this.CLOSED),fe(this,Fr,void 0))}};Ve=new WeakMap,pt=new WeakMap,Mt=new WeakMap,ps=new WeakMap,vs=new WeakMap,la=new WeakMap,Ut=new WeakMap,ca=new WeakMap,Fr=new WeakMap,Ft=new WeakMap,zt=new WeakMap,qt=new WeakMap,ia=new WeakMap,nr=new WeakSet,An=function(){fe(this,Ve,this.CONNECTING),fe(this,Fr,new AbortController),ee(this,vs)(ee(this,pt),Or(this,nr,rc).call(this)).then(ee(this,$n)).catch(ee(this,kn))},$n=new WeakMap,kn=new WeakMap,rc=function(){var a;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...ee(this,ca)?{"Last-Event-ID":ee(this,ca)}:void 0},cache:"no-store",signal:(a=ee(this,Fr))==null?void 0:a.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Dn=new WeakMap,Nn=new WeakMap,oa=function(a,e){var t;ee(this,Ve)!==this.CLOSED&&fe(this,Ve,this.CLOSED);let s=new ms("error",{code:e,message:a});(t=ee(this,zt))==null||t.call(this,s),this.dispatchEvent(s)},jn=function(a,e){var t;if(ee(this,Ve)===this.CLOSED)return;fe(this,Ve,this.CONNECTING);let s=new ms("error",{code:e,message:a});(t=ee(this,zt))==null||t.call(this,s),this.dispatchEvent(s),fe(this,Ut,setTimeout(ee(this,Ln),ee(this,la)))},Ln=new WeakMap,mt.CONNECTING=0,mt.OPEN=1,mt.CLOSED=2;function Yp(){let a="document"in globalThis?globalThis.document:void 0;return a&&typeof a=="object"&&"baseURI"in a&&typeof a.baseURI=="string"?a.baseURI:void 0}var Fn,ac,sc,nc;Fn=(nc=(sc=(ac=globalThis.crypto)==null?void 0:ac.webcrypto)!=null?sc:globalThis.crypto)!=null?nc:import("node:crypto").then(a=>a.webcrypto);async function Xp(a){return(await Fn).getRandomValues(new Uint8Array(a))}async function em(a){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await Xp(a);for(let r=0;r<a;r++){let n=s[r]%e.length;t+=e[n]}return t}async function rm(a){return await em(a)}async function tm(a){let e=await(await Fn).subtle.digest("SHA-256",new TextEncoder().encode(a));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function qn(a){if(a||(a=43),a<43||a>128)throw`Expected a length between 43 and 128. Received ${a}.`;let e=await rm(a),t=await tm(e);return{code_verifier:e,code_challenge:t}}var Oe=l.string().url().superRefine((a,e)=>{if(!URL.canParse(a))return e.addIssue({code:l.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),l.NEVER}).refine(a=>{let e=new URL(a);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),ic=l.object({resource:l.string().url(),authorization_servers:l.array(Oe).optional(),jwks_uri:l.string().url().optional(),scopes_supported:l.array(l.string()).optional(),bearer_methods_supported:l.array(l.string()).optional(),resource_signing_alg_values_supported:l.array(l.string()).optional(),resource_name:l.string().optional(),resource_documentation:l.string().optional(),resource_policy_uri:l.string().url().optional(),resource_tos_uri:l.string().url().optional(),tls_client_certificate_bound_access_tokens:l.boolean().optional(),authorization_details_types_supported:l.array(l.string()).optional(),dpop_signing_alg_values_supported:l.array(l.string()).optional(),dpop_bound_access_tokens_required:l.boolean().optional()}).passthrough(),Un=l.object({issuer:l.string(),authorization_endpoint:Oe,token_endpoint:Oe,registration_endpoint:Oe.optional(),scopes_supported:l.array(l.string()).optional(),response_types_supported:l.array(l.string()),response_modes_supported:l.array(l.string()).optional(),grant_types_supported:l.array(l.string()).optional(),token_endpoint_auth_methods_supported:l.array(l.string()).optional(),token_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),service_documentation:Oe.optional(),revocation_endpoint:Oe.optional(),revocation_endpoint_auth_methods_supported:l.array(l.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),introspection_endpoint:l.string().optional(),introspection_endpoint_auth_methods_supported:l.array(l.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),code_challenge_methods_supported:l.array(l.string()).optional()}).passthrough(),am=l.object({issuer:l.string(),authorization_endpoint:Oe,token_endpoint:Oe,userinfo_endpoint:Oe.optional(),jwks_uri:Oe,registration_endpoint:Oe.optional(),scopes_supported:l.array(l.string()).optional(),response_types_supported:l.array(l.string()),response_modes_supported:l.array(l.string()).optional(),grant_types_supported:l.array(l.string()).optional(),acr_values_supported:l.array(l.string()).optional(),subject_types_supported:l.array(l.string()),id_token_signing_alg_values_supported:l.array(l.string()),id_token_encryption_alg_values_supported:l.array(l.string()).optional(),id_token_encryption_enc_values_supported:l.array(l.string()).optional(),userinfo_signing_alg_values_supported:l.array(l.string()).optional(),userinfo_encryption_alg_values_supported:l.array(l.string()).optional(),userinfo_encryption_enc_values_supported:l.array(l.string()).optional(),request_object_signing_alg_values_supported:l.array(l.string()).optional(),request_object_encryption_alg_values_supported:l.array(l.string()).optional(),request_object_encryption_enc_values_supported:l.array(l.string()).optional(),token_endpoint_auth_methods_supported:l.array(l.string()).optional(),token_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),display_values_supported:l.array(l.string()).optional(),claim_types_supported:l.array(l.string()).optional(),claims_supported:l.array(l.string()).optional(),service_documentation:l.string().optional(),claims_locales_supported:l.array(l.string()).optional(),ui_locales_supported:l.array(l.string()).optional(),claims_parameter_supported:l.boolean().optional(),request_parameter_supported:l.boolean().optional(),request_uri_parameter_supported:l.boolean().optional(),require_request_uri_registration:l.boolean().optional(),op_policy_uri:Oe.optional(),op_tos_uri:Oe.optional()}).passthrough(),oc=am.merge(Un.pick({code_challenge_methods_supported:!0})),zn=l.object({access_token:l.string(),id_token:l.string().optional(),token_type:l.string(),expires_in:l.number().optional(),scope:l.string().optional(),refresh_token:l.string().optional()}).strip(),lc=l.object({error:l.string(),error_description:l.string().optional(),error_uri:l.string().optional()}),sm=l.object({redirect_uris:l.array(Oe),token_endpoint_auth_method:l.string().optional(),grant_types:l.array(l.string()).optional(),response_types:l.array(l.string()).optional(),client_name:l.string().optional(),client_uri:Oe.optional(),logo_uri:Oe.optional(),scope:l.string().optional(),contacts:l.array(l.string()).optional(),tos_uri:Oe.optional(),policy_uri:l.string().optional(),jwks_uri:Oe.optional(),jwks:l.any().optional(),software_id:l.string().optional(),software_version:l.string().optional(),software_statement:l.string().optional()}).strip(),nm=l.object({client_id:l.string(),client_secret:l.string().optional(),client_id_issued_at:l.number().optional(),client_secret_expires_at:l.number().optional()}).strip(),cc=sm.merge(nm),py=l.object({error:l.string(),error_description:l.string().optional()}).strip(),my=l.object({token:l.string(),token_type_hint:l.string().optional()}).strip();function uc(a){let e=typeof a=="string"?new URL(a):new URL(a.href);return e.hash="",e}function dc({requestedResource:a,configuredResource:e}){let t=typeof a=="string"?new URL(a):new URL(a.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(t.origin!==s.origin||t.pathname.length<s.pathname.length)return!1;let r=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}var Pe=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},ua=class extends Pe{};ua.errorCode="invalid_request";var vt=class extends Pe{};vt.errorCode="invalid_client";var gt=class extends Pe{};gt.errorCode="invalid_grant";var yt=class extends Pe{};yt.errorCode="unauthorized_client";var da=class extends Pe{};da.errorCode="unsupported_grant_type";var ha=class extends Pe{};ha.errorCode="invalid_scope";var fa=class extends Pe{};fa.errorCode="access_denied";var Tr=class extends Pe{};Tr.errorCode="server_error";var pa=class extends Pe{};pa.errorCode="temporarily_unavailable";var ma=class extends Pe{};ma.errorCode="unsupported_response_type";var va=class extends Pe{};va.errorCode="unsupported_token_type";var ga=class extends Pe{};ga.errorCode="invalid_token";var ya=class extends Pe{};ya.errorCode="method_not_allowed";var _a=class extends Pe{};_a.errorCode="too_many_requests";var ba=class extends Pe{};ba.errorCode="invalid_client_metadata";var wa=class extends Pe{};wa.errorCode="insufficient_scope";var hc={[ua.errorCode]:ua,[vt.errorCode]:vt,[gt.errorCode]:gt,[yt.errorCode]:yt,[da.errorCode]:da,[ha.errorCode]:ha,[fa.errorCode]:fa,[Tr.errorCode]:Tr,[pa.errorCode]:pa,[ma.errorCode]:ma,[va.errorCode]:va,[ga.errorCode]:ga,[ya.errorCode]:ya,[_a.errorCode]:_a,[ba.errorCode]:ba,[wa.errorCode]:wa};var He=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function pc(a,e){let t=a.client_secret!==void 0;return e.length===0?t?"client_secret_post":"none":t&&e.includes("client_secret_basic")?"client_secret_basic":t&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":t?"client_secret_post":"none"}function mc(a,e,t,s){let{client_id:r,client_secret:n}=e;switch(a){case"client_secret_basic":im(r,n,t);return;case"client_secret_post":om(r,n,s);return;case"none":lm(r,s);return;default:throw new Error(`Unsupported client authentication method: ${a}`)}}function im(a,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${a}:${e}`);t.set("Authorization",`Basic ${s}`)}function om(a,e,t){t.set("client_id",a),e&&t.set("client_secret",e)}function lm(a,e){e.set("client_id",a)}async function Hn(a){let e=a instanceof Response?a.status:void 0,t=a instanceof Response?await a.text():a;try{let s=lc.parse(JSON.parse(t)),{error:r,error_description:n,error_uri:i}=s,o=hc[r]||Tr;return new o(n||"",i)}catch(s){let r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new Tr(r)}}async function qr(a,e){var t,s;try{return await Vn(a,e)}catch(r){if(r instanceof vt||r instanceof yt)return await((t=a.invalidateCredentials)===null||t===void 0?void 0:t.call(a,"all")),await Vn(a,e);if(r instanceof gt)return await((s=a.invalidateCredentials)===null||s===void 0?void 0:s.call(a,"tokens")),await Vn(a,e);throw r}}async function Vn(a,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:r,fetchFn:n}){let i,o;try{i=await um(e,{resourceMetadataUrl:r},n),i.authorization_servers&&i.authorization_servers.length>0&&(o=i.authorization_servers[0])}catch{}o||(o=e);let u=await cm(e,a,i),c=await mm(o,{fetchFn:n}),h=await Promise.resolve(a.clientInformation());if(!h){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!a.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await _m(o,{metadata:c,clientMetadata:a.clientMetadata,fetchFn:n});await a.saveClientInformation(m),h=m}if(t!==void 0){let m=await a.codeVerifier(),v=await gm(o,{metadata:c,clientInformation:h,authorizationCode:t,codeVerifier:m,redirectUri:a.redirectUrl,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(v),"AUTHORIZED"}let f=await a.tokens();if(f!=null&&f.refresh_token)try{let m=await ym(o,{metadata:c,clientInformation:h,refreshToken:f.refresh_token,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(m),"AUTHORIZED"}catch(m){if(!(!(m instanceof Pe)||m instanceof Tr))throw m}let g=a.state?await a.state():void 0,{authorizationUrl:d,codeVerifier:y}=await vm(o,{metadata:c,clientInformation:h,state:g,redirectUrl:a.redirectUrl,scope:s||a.clientMetadata.scope,resource:u});return await a.saveCodeVerifier(y),await a.redirectToAuthorization(d),"REDIRECT"}async function cm(a,e,t){let s=uc(a);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!dc({requestedResource:s,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${s} (or origin)`);return new URL(t.resource)}}function xa(a){let e=a.headers.get("WWW-Authenticate");if(!e)return;let[t,s]=e.split(" ");if(t.toLowerCase()!=="bearer"||!s)return;let n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function um(a,e,t=fetch){let s=await fm(a,"oauth-protected-resource",t,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return ic.parse(await s.json())}async function Zn(a,e,t=fetch){try{return await t(a,{headers:e})}catch(s){if(s instanceof TypeError)return e?Zn(a,void 0,t):void 0;throw s}}function dm(a,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${a}`:`/.well-known/${a}${e}`}async function fc(a,e,t=fetch){return await Zn(a,{"MCP-Protocol-Version":e},t)}function hm(a,e){return!a||a.status>=400&&a.status<500&&e!=="/"}async function fm(a,e,t,s){var r,n;let i=new URL(a),o=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Nr,u;if(s!=null&&s.metadataUrl)u=new URL(s.metadataUrl);else{let h=dm(e,i.pathname);u=new URL(h,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:i),u.search=i.search}let c=await fc(u,o,t);if(!(s!=null&&s.metadataUrl)&&hm(c,i.pathname)){let h=new URL(`/.well-known/${e}`,i);c=await fc(h,o,t)}return c}function pm(a){let e=typeof a=="string"?new URL(a):a,t=e.pathname!=="/",s=[];if(!t)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function mm(a,{fetchFn:e=fetch,protocolVersion:t=Nr}={}){var s;let r={"MCP-Protocol-Version":t},n=pm(a);for(let{url:i,type:o}of n){let u=await Zn(i,r,e);if(u){if(!u.ok){if(u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${o==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}if(o==="oauth")return Un.parse(await u.json());{let c=oc.parse(await u.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${i}: does not support S256 code challenge method required by MCP specification`);return c}}}}async function vm(a,{metadata:e,clientInformation:t,redirectUrl:s,scope:r,state:n,resource:i}){let o="code",u="S256",c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(o))throw new Error(`Incompatible auth server: does not support response type ${o}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(u))throw new Error(`Incompatible auth server: does not support code challenge method ${u}`)}else c=new URL("/authorize",a);let h=await qn(),f=h.code_verifier,g=h.code_challenge;return c.searchParams.set("response_type",o),c.searchParams.set("client_id",t.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",u),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),i&&c.searchParams.set("resource",i.href),{authorizationUrl:c,codeVerifier:f}}async function gm(a,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:i,addClientAuthentication:o,fetchFn:u}){var c;let h="authorization_code",f=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",a);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(h))throw new Error(`Incompatible auth server: does not support grant type ${h}`);let g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:h,code:s,code_verifier:r,redirect_uri:String(n)});if(o)o(g,d,a,e);else{let m=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],v=pc(t,m);mc(v,t,g,d)}i&&d.set("resource",i.href);let y=await(u!=null?u:fetch)(f,{method:"POST",headers:g,body:d});if(!y.ok)throw await Hn(y);return zn.parse(await y.json())}async function ym(a,{metadata:e,clientInformation:t,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:i}){var o;let u="refresh_token",c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`)}else c=new URL("/token",a);let h=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),f=new URLSearchParams({grant_type:u,refresh_token:s});if(n)n(h,f,a,e);else{let d=(o=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&o!==void 0?o:[],y=pc(t,d);mc(y,t,h,f)}r&&f.set("resource",r.href);let g=await(i!=null?i:fetch)(c,{method:"POST",headers:h,body:f});if(!g.ok)throw await Hn(g);return zn.parse({refresh_token:s,...await g.json()})}async function _m(a,{metadata:e,clientMetadata:t,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",a);let n=await(s!=null?s:fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await Hn(n);return cc.parse(await n.json())}var Bn=class extends Error{constructor(e,t,s){super(`SSE error: ${t}`),this.code=e,this.event=s}},gs=class{constructor(e,t){this._url=e,this._resourceMetadataUrl=void 0,this._eventSourceInit=t==null?void 0:t.eventSourceInit,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch}async _authThenStart(){var e;if(!this._authProvider)throw new He("No auth provider");let t;try{t=await qr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new He;return await this._startOrAuth()}async _commonHeaders(){var e;let t={};if(this._authProvider){let s=await this._authProvider.tokens();s&&(t.Authorization=`Bearer ${s.access_token}`)}return this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion),new Headers({...t,...(e=this._requestInit)===null||e===void 0?void 0:e.headers})}_startOrAuth(){var e,t,s;let r=(s=(t=(e=this===null||this===void 0?void 0:this._eventSourceInit)===null||e===void 0?void 0:e.fetch)!==null&&t!==void 0?t:this._fetch)!==null&&s!==void 0?s:fetch;return new Promise((n,i)=>{this._eventSource=new mt(this._url.href,{...this._eventSourceInit,fetch:async(o,u)=>{let c=await this._commonHeaders();c.set("Accept","text/event-stream");let h=await r(o,{...u,headers:c});return h.status===401&&h.headers.has("www-authenticate")&&(this._resourceMetadataUrl=xa(h)),h}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{var u;if(o.code===401&&this._authProvider){this._authThenStart().then(n,i);return}let c=new Bn(o.code,o.message,o);i(c),(u=this.onerror)===null||u===void 0||u.call(this,c)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{var u;let c=o;try{if(this._endpoint=new URL(c.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(h){i(h),(u=this.onerror)===null||u===void 0||u.call(this,h),this.close();return}n()}),this._eventSource.onmessage=o=>{var u,c;let h=o,f;try{f=Qe.parse(JSON.parse(h.data))}catch(g){(u=this.onerror)===null||u===void 0||u.call(this,g);return}(c=this.onmessage)===null||c===void 0||c.call(this,f)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new He("No auth provider");if(await qr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new He("Failed to authorize")}async close(){var e,t,s;(e=this._abortController)===null||e===void 0||e.abort(),(t=this._eventSource)===null||t===void 0||t.close(),(s=this.onclose)===null||s===void 0||s.call(this)}async send(e){var t,s,r;if(!this._endpoint)throw new Error("Not connected");try{let n=await this._commonHeaders();n.set("content-type","application/json");let i={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:(t=this._abortController)===null||t===void 0?void 0:t.signal},o=await((s=this._fetch)!==null&&s!==void 0?s:fetch)(this._endpoint,i);if(!o.ok){if(o.status===401&&this._authProvider){if(this._resourceMetadataUrl=xa(o),await qr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new He;return this.send(e)}let u=await o.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${u}`)}}catch(n){throw(r=this.onerror)===null||r===void 0||r.call(this,n),n}}setProtocolVersion(e){this._protocolVersion=e}};var Ec=require("node:crypto");var _c=br(yc());function Ea(a,{limit:e,encoding:t}){let s=_c.default.parse(e);return new Promise((r,n)=>{let i=0,o=[];a.on("data",u=>{if(i+=u.length,i>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));o.push(u)}),a.on("end",()=>{try{r(Buffer.concat(o).toString(t))}catch(u){n(u)}}),a.on("error",u=>{n(u)})})}var Pc=br(Qn(),1),Sc=require("url"),$m="4mb",_s=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,Ec.randomUUID)(),this._options=s||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let t=e.headers.host;if(!t||!this._options.allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._options.allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",t=new Sc.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
6
+ data: ${s}
7
+
8
+ `),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,i,o;if(!this._sseResponse){let g="SSE connection not established";throw t.writeHead(500).end(g),new Error(g)}let u=this.validateRequestHeaders(e);if(u){t.writeHead(403).end(u),(r=this.onerror)===null||r===void 0||r.call(this,new Error(u));return}let c=e.auth,h={headers:e.headers},f;try{let g=Pc.default.parse((n=e.headers["content-type"])!==null&&n!==void 0?n:"");if(g.type!=="application/json")throw new Error(`Unsupported content-type: ${g.type}`);f=s!=null?s:await Ea(e,{limit:$m,encoding:(i=g.parameters.charset)!==null&&i!==void 0?i:"utf-8"})}catch(g){t.writeHead(400).end(String(g)),(o=this.onerror)===null||o===void 0||o.call(this,g);return}try{await this.handleMessage(typeof f=="string"?JSON.parse(f):f,{requestInfo:h,authInfo:c})}catch{t.writeHead(400).end(`Invalid message: ${f}`);return}t.writeHead(202).end("Accepted")}async handleMessage(e,t){var s,r;let n;try{n=Qe.parse(e)}catch(i){throw(s=this.onerror)===null||s===void 0||s.call(this,i),i}(r=this.onmessage)===null||r===void 0||r.call(this,n,t)}async close(){var e,t;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(t=this.onclose)===null||t===void 0||t.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
9
+ data: ${JSON.stringify(e)}
10
+
11
+ `)}get sessionId(){return this._sessionId}};var pu=br(fu(),1),Pa=br(require("node:process"),1),mu=require("node:stream");var Zt=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
12
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),nv(t)}clear(){this._buffer=void 0}};function nv(a){return Qe.parse(JSON.parse(a))}function ws(a){return JSON.stringify(a)+`
13
+ `}var iv=Pa.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function ov(){let a={};for(let e of iv){let t=Pa.default.env[e];t!==void 0&&(t.startsWith("()")||(a[e]=t))}return a}var xs=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new Zt,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new mu.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{var s,r,n,i,o;this._process=(0,pu.default)(this._serverParams.command,(s=this._serverParams.args)!==null&&s!==void 0?s:[],{env:{...ov(),...this._serverParams.env},stdio:["pipe","pipe",(r=this._serverParams.stderr)!==null&&r!==void 0?r:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Pa.default.platform==="win32"&&lv(),cwd:this._serverParams.cwd}),this._process.on("error",u=>{var c,h;if(u.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}t(u),(h=this.onerror)===null||h===void 0||h.call(this,u)}),this._process.on("spawn",()=>{e()}),this._process.on("close",u=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(n=this._process.stdin)===null||n===void 0||n.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),(i=this._process.stdout)===null||i===void 0||i.on("data",u=>{this._readBuffer.append(u),this.processReadBuffer()}),(o=this._process.stdout)===null||o===void 0||o.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,t;return this._stderrStream?this._stderrStream:(t=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&t!==void 0?t:null}get pid(){var e,t;return(t=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&t!==void 0?t:null}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(t=>{var s;if(!(!((s=this._process)===null||s===void 0)&&s.stdin))throw new Error("Not connected");let r=ws(e);this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};function lv(){return"type"in Pa.default}var si=br(require("node:process"),1);var Es=class{constructor(e=si.default.stdin,t=si.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Zt,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=ws(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var vu=br(Qn(),1),gu=require("node:crypto"),cv="4mb",Ps=class{constructor(e){var t,s;this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=(t=e.enableJsonResponse)!==null&&t!==void 0?t:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(s=e.enableDnsRebindingProtection)!==null&&s!==void 0?s:!1}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.host;if(!t||!this._allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async handleRequest(e,t,s){var r;let n=this.validateRequestHeaders(e);if(n){t.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:n},id:null})),(r=this.onerror)===null||r===void 0||r.call(this,new Error(n));return}e.method==="POST"?await this.handlePostRequest(e,t,s):e.method==="GET"?await this.handleGetRequest(e,t):e.method==="DELETE"?await this.handleDeleteRequest(e,t):await this.handleUnsupportedRequest(t)}async handleGetRequest(e,t){let s=e.headers.accept;if(!(s!=null&&s.includes("text/event-stream"))){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept text/event-stream"},id:null}));return}if(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t))return;if(this._eventStore){let n=e.headers["last-event-id"];if(n){await this.replayEvents(n,t);return}}let r={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(r["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){t.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}t.writeHead(200,r).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,t),t.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)})}async replayEvents(e,t){var s,r;if(this._eventStore)try{let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(n["mcp-session-id"]=this.sessionId),t.writeHead(200,n).flushHeaders();let i=await((s=this._eventStore)===null||s===void 0?void 0:s.replayEventsAfter(e,{send:async(o,u)=>{var c;this.writeSSEEvent(t,u,o)||((c=this.onerror)===null||c===void 0||c.call(this,new Error("Failed replay events")),t.end())}}));this._streamMapping.set(i,t)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}writeSSEEvent(e,t,s){let r=`event: message
14
+ `;return s&&(r+=`id: ${s}
15
+ `),r+=`data: ${JSON.stringify(t)}
16
+
17
+ `,e.write(r)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,t,s){var r,n,i,o,u;try{let c=e.headers.accept;if(!(c!=null&&c.includes("application/json"))||!c.includes("text/event-stream")){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let h=e.headers["content-type"];if(!h||!h.includes("application/json")){t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let f=e.auth,g={headers:e.headers},d;if(s!==void 0)d=s;else{let w=vu.default.parse(h),S=await Ea(e,{limit:cv,encoding:(r=w.parameters.charset)!==null&&r!==void 0?r:"utf-8"});d=JSON.parse(S.toString())}let y;Array.isArray(d)?y=d.map(w=>Qe.parse(w)):y=[Qe.parse(d)];let m=y.some(Hi);if(m){if(this._initialized&&this.sessionId!==void 0){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(y.length>1){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(n=this.sessionIdGenerator)===null||n===void 0?void 0:n.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!m&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let v=y.some(dt);if(v){if(v){let w=(0,gu.randomUUID)();if(!this._enableJsonResponse){let S={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(S["mcp-session-id"]=this.sessionId),t.writeHead(200,S)}for(let S of y)dt(S)&&(this._streamMapping.set(w,t),this._requestToStreamMapping.set(S.id,w));t.on("close",()=>{this._streamMapping.delete(w)});for(let S of y)(o=this.onmessage)===null||o===void 0||o.call(this,S,{authInfo:f,requestInfo:g})}}else{t.writeHead(202).end();for(let w of y)(i=this.onmessage)===null||i===void 0||i.call(this,w,{authInfo:f,requestInfo:g})}}catch(c){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(c)},id:null})),(u=this.onerror)===null||u===void 0||u.call(this,c)}}async handleDeleteRequest(e,t){var s;this.validateSession(e,t)&&this.validateProtocolVersion(e,t)&&(await Promise.resolve((s=this._onsessionclosed)===null||s===void 0?void 0:s.call(this,this.sessionId)),await this.close(),t.writeHead(200).end())}validateSession(e,t){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let s=e.headers["mcp-session-id"];if(s){if(Array.isArray(s))return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(s!==this.sessionId)return t.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,t){var s;let r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Ni;return Array.isArray(r)&&(r=r[r.length-1]),ut.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${ut.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(t=>{t.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}async send(e,t){let s=t==null?void 0:t.relatedRequestId;if((Sr(e)||Dt(e))&&(s=e.id),s===void 0){if(Sr(e)||Dt(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let i=this._streamMapping.get(this._standaloneSseStreamId);if(i===void 0)return;let o;this._eventStore&&(o=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(i,e,o);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let i;this._eventStore&&(i=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,i)}if(Sr(e)||Dt(e)){this._requestResponseMap.set(s,e);let i=Array.from(this._requestToStreamMapping.entries()).filter(([u,c])=>this._streamMapping.get(c)===n).map(([u])=>u);if(i.every(u=>this._requestResponseMap.has(u))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let u={"Content-Type":"application/json"};this.sessionId!==void 0&&(u["mcp-session-id"]=this.sessionId);let c=i.map(h=>this._requestResponseMap.get(h));n.writeHead(200,u),c.length===1?n.end(JSON.stringify(c[0])):n.end(JSON.stringify(c))}else n.end();for(let u of i)this._requestResponseMap.delete(u),this._requestToStreamMapping.delete(u)}}}};var Ss=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(n){r=fs({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:t,onComment:s})},transform(n){r.feed(n)}})}};var uv={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Sa=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},Rs=class{constructor(e,t){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch,this._sessionId=t==null?void 0:t.sessionId,this._reconnectionOptions=(s=t==null?void 0:t.reconnectionOptions)!==null&&s!==void 0?s:uv}async _authThenStart(){var e;if(!this._authProvider)throw new He("No auth provider");let t;try{t=await qr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new He;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...t,...s})}async _startOrAuthSse(e){var t,s,r;let{resumptionToken:n}=e;try{let i=await this._commonHeaders();i.set("Accept","text/event-stream"),n&&i.set("last-event-id",n);let o=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,{method:"GET",headers:i,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!o.ok){if(o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Sa(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(i){throw(r=this.onerror)===null||r===void 0||r.call(this,i),i}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,t=0){var s;let r=this._reconnectionOptions.maxRetries;if(r>0&&t>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,s){if(!e)return;let{onresumptiontoken:r,replayMessageId:n}=t,i;(async()=>{var u,c,h,f;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ss).getReader();for(;;){let{value:d,done:y}=await g.read();if(y)break;if(d.id&&(i=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{let m=Qe.parse(JSON.parse(d.data));n!==void 0&&Sr(m)&&(m.id=n),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m)}}}catch(g){if((h=this.onerror)===null||h===void 0||h.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(f=this.onerror)===null||f===void 0||f.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new He("No auth provider");if(await qr(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new He("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var s,r,n,i;try{let{resumptionToken:o,onresumptiontoken:u}=t||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:dt(e)?e.id:void 0}).catch(v=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,v)});return}let c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");let h={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},f=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,h),g=f.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!f.ok){if(f.status===401&&this._authProvider){if(this._resourceMetadataUrl=xa(f),await qr(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new He;return this.send(e)}let v=await f.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${f.status}): ${v}`)}if(f.status===202){Zi(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var w;return(w=this.onerror)===null||w===void 0?void 0:w.call(this,v)});return}let y=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,m=f.headers.get("content-type");if(y)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(f.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let v=await f.json(),w=Array.isArray(v)?v.map(S=>Qe.parse(S)):[Qe.parse(v)];for(let S of w)(n=this.onmessage)===null||n===void 0||n.call(this,S)}else throw new Sa(-1,`Unexpected content type: ${m}`)}catch(o){throw(i=this.onerror)===null||i===void 0||i.call(this,o),o}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},i=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,n);if(!i.ok&&i.status!==405)throw new Sa(i.status,`Failed to terminate session: ${i.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var _u=Symbol("Let zodToJsonSchema decide on which parser to use");var yu={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},bu=a=>typeof a=="string"?{...yu,name:a}:{...yu,...a};var wu=a=>{let e=bu(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function ni(a,e,t,s){s!=null&&s.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function re(a,e,t,s,r){a[e]=t,ni(a,e,s,r)}var Os=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function pe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?Os(e,a.currentPath):e.join("/")}}function xu(a,e){var s,r,n;let t={type:"array"};return(s=a.type)!=null&&s._def&&((n=(r=a.type)==null?void 0:r._def)==null?void 0:n.typeName)!==T.ZodAny&&(t.items=J(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&re(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&re(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(re(t,"minItems",a.exactLength.value,a.exactLength.message,e),re(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function Eu(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function Pu(){return{type:"boolean"}}function Ts(a,e){return J(a.type._def,e)}var Su=(a,e)=>J(a.innerType._def,e);function ii(a,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>ii(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return dv(a,e)}}var dv=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":re(t,"minimum",s.value,s.message,e);break;case"max":re(t,"maximum",s.value,s.message,e);break}return t};function Ru(a,e){return{...J(a.innerType._def,e),default:a.defaultValue()}}function Ou(a,e){return e.effectStrategy==="input"?J(a.schema._def,e):pe(e)}function Tu(a){return{type:"string",enum:Array.from(a.values)}}var hv=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Cu(a,e){let t=[J(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),J(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(hv(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...u}=n;i=u}else s=void 0;r.push(i)}}),r.length?{allOf:r,...s}:void 0}function Iu(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var oi,ir={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(oi===void 0&&(oi=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),oi),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Cs(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":or(t,"email",s.message,e);break;case"format:idn-email":or(t,"idn-email",s.message,e);break;case"pattern:zod":Me(t,ir.email,s.message,e);break}break;case"url":or(t,"uri",s.message,e);break;case"uuid":or(t,"uuid",s.message,e);break;case"regex":Me(t,s.regex,s.message,e);break;case"cuid":Me(t,ir.cuid,s.message,e);break;case"cuid2":Me(t,ir.cuid2,s.message,e);break;case"startsWith":Me(t,RegExp(`^${li(s.value,e)}`),s.message,e);break;case"endsWith":Me(t,RegExp(`${li(s.value,e)}$`),s.message,e);break;case"datetime":or(t,"date-time",s.message,e);break;case"date":or(t,"date",s.message,e);break;case"time":or(t,"time",s.message,e);break;case"duration":or(t,"duration",s.message,e);break;case"length":re(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),re(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Me(t,RegExp(li(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&or(t,"ipv4",s.message,e),s.version!=="v4"&&or(t,"ipv6",s.message,e);break}case"base64url":Me(t,ir.base64url,s.message,e);break;case"jwt":Me(t,ir.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Me(t,ir.ipv4Cidr,s.message,e),s.version!=="v4"&&Me(t,ir.ipv6Cidr,s.message,e);break}case"emoji":Me(t,ir.emoji(),s.message,e);break;case"ulid":{Me(t,ir.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{or(t,"binary",s.message,e);break}case"contentEncoding:base64":{re(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Me(t,ir.base64,s.message,e);break}}break}case"nanoid":Me(t,ir.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function li(a,e){return e.patternStrategy==="escape"?pv(a):a}var fv=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pv(a){let e="";for(let t=0;t<a.length;t++)fv.has(a[t])||(e+="\\"),e+=a[t];return e}function or(a,e,t,s){var r;a.format||(r=a.anyOf)!=null&&r.some(n=>n.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):re(a,"format",e,t,s)}function Me(a,e,t,s){var r;a.pattern||(r=a.allOf)!=null&&r.some(n=>n.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Au(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):re(a,"pattern",Au(e,s),t,s)}function Au(a,e){var u;if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,i=!1,o=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(i){if(s[c].match(/[a-z]/)){o?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),o=!1):s[c+1]==="-"&&((u=s[c+2])!=null&&u.match(/[a-z]/))?(r+=s[c],o=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
18
+ ]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
19
+ ]))`;continue}}if(t.s&&s[c]==="."){r+=i?`${s[c]}\r
20
+ `:`[${s[c]}\r
21
+ ]`;continue}r+=s[c],s[c]==="\\"?n=!0:i&&s[c]==="]"?i=!1:!i&&s[c]==="["&&(i=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function Is(a,e){var s,r,n,i,o,u,c;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=a.keyType)==null?void 0:s._def.typeName)===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((h,f)=>{var g;return{...h,[f]:(g=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",f]}))!=null?g:pe(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===T.ZodString&&((i=a.keyType._def.checks)!=null&&i.length)){let{type:h,...f}=Cs(a.keyType._def,e);return{...t,propertyNames:f}}else{if(((o=a.keyType)==null?void 0:o._def.typeName)===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((u=a.keyType)==null?void 0:u._def.typeName)===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&((c=a.keyType._def.type._def.checks)!=null&&c.length)){let{type:h,...f}=Ts(a.keyType._def,e);return{...t,propertyNames:f}}}return t}function $u(a,e){if(e.mapStrategy==="record")return Is(a,e);let t=J(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||pe(e),s=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||pe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function ku(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Du(a){return a.target==="openAi"?void 0:{not:pe({...a,currentPath:[...a.currentPath,"not"]})}}function Nu(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ra={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Lu(a,e){if(e.target==="openApi3")return ju(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ra&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let i=Ra[n._def.typeName];return i&&!r.includes(i)?[...r,i]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let i=typeof n._def.value;switch(i){case"string":case"number":case"boolean":return[...r,i];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,i,o)=>o.indexOf(n)===i);return{type:r.length>1?r:r[0],enum:t.reduce((n,i)=>n.includes(i._def.value)?n:[...n,i._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return ju(a,e)}var ju=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>J(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function Mu(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ra[a.innerType._def.typeName],nullable:!0}:{type:[Ra[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=J(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Fu(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",ni(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?re(t,"minimum",s.value,s.message,e):re(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),re(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?re(t,"maximum",s.value,s.message,e):re(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),re(t,"maximum",s.value,s.message,e));break;case"multipleOf":re(t,"multipleOf",s.value,s.message,e);break}return t}function qu(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let u=n[o];if(u===void 0||u._def===void 0)continue;let c=vv(u);c&&t&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),c=!1);let h=J(u._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});h!==void 0&&(s.properties[o]=h,c||r.push(o))}r.length&&(s.required=r);let i=mv(a,e);return i!==void 0&&(s.additionalProperties=i),s}function mv(a,e){if(a.catchall._def.typeName!=="ZodNever")return J(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function vv(a){try{return a.isOptional()}catch{return!0}}var Uu=(a,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return J(a.innerType._def,e);let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:pe(e)},t]}:pe(e)};var zu=(a,e)=>{if(e.pipeStrategy==="input")return J(a.in._def,e);if(e.pipeStrategy==="output")return J(a.out._def,e);let t=J(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=J(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Vu(a,e){return J(a.type._def,e)}function Hu(a,e){let s={type:"array",uniqueItems:!0,items:J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&re(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&re(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Zu(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:J(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Bu(a){return{not:pe(a)}}function Ju(a){return pe(a)}var Qu=(a,e)=>J(a.innerType._def,e);var Wu=(a,e,t)=>{switch(e){case T.ZodString:return Cs(a,t);case T.ZodNumber:return Fu(a,t);case T.ZodObject:return qu(a,t);case T.ZodBigInt:return Eu(a,t);case T.ZodBoolean:return Pu();case T.ZodDate:return ii(a,t);case T.ZodUndefined:return Bu(t);case T.ZodNull:return Nu(t);case T.ZodArray:return xu(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return Lu(a,t);case T.ZodIntersection:return Cu(a,t);case T.ZodTuple:return Zu(a,t);case T.ZodRecord:return Is(a,t);case T.ZodLiteral:return Iu(a,t);case T.ZodEnum:return Tu(a);case T.ZodNativeEnum:return ku(a);case T.ZodNullable:return Mu(a,t);case T.ZodOptional:return Uu(a,t);case T.ZodMap:return $u(a,t);case T.ZodSet:return Hu(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return Vu(a,t);case T.ZodNaN:case T.ZodNever:return Du(t);case T.ZodEffects:return Ou(a,t);case T.ZodAny:return pe(t);case T.ZodUnknown:return Ju(t);case T.ZodDefault:return Ru(a,t);case T.ZodBranded:return Ts(a,t);case T.ZodReadonly:return Qu(a,t);case T.ZodCatch:return Su(a,t);case T.ZodPipeline:return zu(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function J(a,e,t=!1){var o;let s=e.seen.get(a);if(e.override){let u=(o=e.override)==null?void 0:o.call(e,a,e,s,t);if(u!==_u)return u}if(s&&!t){let u=gv(s,e);if(u!==void 0)return u}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=Wu(a,a.typeName,e),i=typeof n=="function"?J(n(),e):n;if(i&&yv(a,e,i),e.postProcess){let u=e.postProcess(i,a,e);return r.jsonSchema=i,u}return r.jsonSchema=i,i}var gv=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:Os(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),pe(e)):e.$refStrategy==="seen"?pe(e):void 0}},yv=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var ci=(a,e)=>{var u;let t=wu(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[h,f])=>{var g;return{...c,[h]:(g=J(f._def,{...t,currentPath:[...t.basePath,t.definitionPath,h]},!0))!=null?g:pe(t)}},{}):void 0,r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(u=J(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1))!=null?u:pe(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(n.title=i),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,PingRequestSchema,ProgressNotificationSchema,SSEClientTransport,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
22
+ /*! Bundled license information:
23
+
24
+ uri-js/dist/es5/uri.all.js:
25
+ (** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
26
+
27
+ bytes/index.js:
28
+ (*!
29
+ * bytes
30
+ * Copyright(c) 2012-2014 TJ Holowaychuk
31
+ * Copyright(c) 2015 Jed Watson
32
+ * MIT Licensed
33
+ *)
34
+
35
+ content-type/index.js:
36
+ (*!
37
+ * content-type
38
+ * Copyright(c) 2015 Douglas Christopher Wilson
39
+ * MIT Licensed
40
+ *)
41
+ */