@dimassetoid/septum-mcp 0.3.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +38 -55
  2. package/package.json +7 -5
  3. package/src/cli/commands/check.ts +14 -10
  4. package/src/cli/commands/hook.ts +41 -6
  5. package/src/cli/commands/init.ts +10 -1
  6. package/src/cli/commands/stats.ts +33 -0
  7. package/src/cli/commands/sync-progress.ts +71 -0
  8. package/src/cli/commands/sync.ts +32 -4
  9. package/src/cli/index.ts +7 -0
  10. package/src/cli/templates/hooks.ts +3 -14
  11. package/src/cli/templates/skill.ts +17 -10
  12. package/src/core/boundary/audit.ts +383 -0
  13. package/src/core/boundary/evaluator.ts +251 -114
  14. package/src/core/boundary/staged-auditor.ts +147 -55
  15. package/src/core/config/domain-ownership.ts +6 -4
  16. package/src/core/config/domain-registration.ts +141 -0
  17. package/src/core/config/loader.ts +1 -25
  18. package/src/core/config/schema.ts +24 -36
  19. package/src/core/database/client.ts +2 -0
  20. package/src/core/database/repositories/dependency.repository.ts +334 -572
  21. package/src/core/database/repositories/domain.repository.ts +2 -1
  22. package/src/core/database/repositories/file.repository.ts +10 -0
  23. package/src/core/database/repositories/symbol.repository.ts +97 -398
  24. package/src/core/database/repository.ts +68 -9
  25. package/src/core/database/schema.ts +26 -0
  26. package/src/core/discovery/declarative-routes.ts +69 -0
  27. package/src/core/discovery/framework-detector.ts +149 -0
  28. package/src/core/discovery/navigation.ts +222 -58
  29. package/src/core/discovery/topology-detector.ts +93 -168
  30. package/src/core/errors.ts +19 -0
  31. package/src/core/ingestion/pipeline.ts +287 -88
  32. package/src/core/parser/extractors/base.ts +11 -3
  33. package/src/core/parser/extractors/csharp.ts +2 -2
  34. package/src/core/parser/extractors/django-routing.ts +163 -0
  35. package/src/core/parser/extractors/django-semantic.ts +397 -481
  36. package/src/core/parser/extractors/elysia-semantic.ts +172 -475
  37. package/src/core/parser/extractors/express-semantic.ts +195 -383
  38. package/src/core/parser/extractors/fastapi-semantic.ts +178 -361
  39. package/src/core/parser/extractors/fastify-semantic.ts +216 -717
  40. package/src/core/parser/extractors/flask-semantic.ts +89 -352
  41. package/src/core/parser/extractors/go-routing.ts +344 -0
  42. package/src/core/parser/extractors/go-semantic.ts +205 -562
  43. package/src/core/parser/extractors/go.ts +6 -3
  44. package/src/core/parser/extractors/graphql-entrypoint.ts +146 -0
  45. package/src/core/parser/extractors/hono-semantic.ts +132 -509
  46. package/src/core/parser/extractors/java.ts +2 -2
  47. package/src/core/parser/extractors/laravel-routing.ts +263 -0
  48. package/src/core/parser/extractors/laravel-semantic.ts +143 -335
  49. package/src/core/parser/extractors/manifest-helpers.ts +64 -0
  50. package/src/core/parser/extractors/mcp-cli-dispatch.ts +268 -0
  51. package/src/core/parser/extractors/mcp-cli-semantic.ts +82 -333
  52. package/src/core/parser/extractors/nestjs-semantic.ts +238 -494
  53. package/src/core/parser/extractors/nextjs-semantic.ts +164 -0
  54. package/src/core/parser/extractors/php-ast-helpers.ts +51 -0
  55. package/src/core/parser/extractors/php.ts +1 -1
  56. package/src/core/parser/extractors/python-route-ast.ts +249 -0
  57. package/src/core/parser/extractors/python.ts +5 -9
  58. package/src/core/parser/extractors/registry.ts +2 -0
  59. package/src/core/parser/extractors/route-prefixes.ts +43 -0
  60. package/src/core/parser/extractors/ruby.ts +2 -2
  61. package/src/core/parser/extractors/rust.ts +4 -4
  62. package/src/core/parser/extractors/symfony-routing.ts +114 -0
  63. package/src/core/parser/extractors/symfony-semantic.ts +72 -226
  64. package/src/core/parser/extractors/typescript-bindings.ts +333 -0
  65. package/src/core/parser/extractors/typescript-compiler-fallback.ts +380 -0
  66. package/src/core/parser/extractors/typescript-fallback.ts +207 -0
  67. package/src/core/parser/extractors/typescript-route-context.ts +58 -0
  68. package/src/core/parser/extractors/typescript.ts +23 -216
  69. package/src/core/parser/language-capabilities.ts +1 -1
  70. package/src/core/parser/schema/providers/laravel-migration-provider.ts +4 -1
  71. package/src/core/parser/wasm-loader.ts +6 -2
  72. package/src/core/resolver/ast-method-tracer.ts +230 -0
  73. package/src/core/resolver/call-graph-helpers.ts +72 -0
  74. package/src/core/resolver/call-graph-tracer.ts +169 -414
  75. package/src/core/resolver/dependency-analysis.ts +593 -0
  76. package/src/core/resolver/import-candidates.ts +120 -0
  77. package/src/core/resolver/import-evidence.ts +88 -0
  78. package/src/core/resolver/import-resolver.ts +60 -7
  79. package/src/core/resolver/interpretation-inputs.ts +60 -2
  80. package/src/core/resolver/languages/python.ts +31 -13
  81. package/src/core/resolver/languages/shared.ts +4 -1
  82. package/src/core/resolver/module-resolver.ts +10 -3
  83. package/src/core/resolver/path-resolver.ts +6 -3
  84. package/src/core/resolver/polyglot-slice-tracer.ts +197 -0
  85. package/src/core/resolver/slice-catalog.ts +21 -6
  86. package/src/core/resolver/slice-format.ts +13 -0
  87. package/src/core/resolver/slice-selection.ts +237 -0
  88. package/src/core/resolver/symbol-impact.ts +104 -8
  89. package/src/core/resolver/symbol-locator.ts +82 -15
  90. package/src/core/resolver/vertical-slice-tracer.ts +31 -230
  91. package/src/core/resources/ignore.ts +0 -1
  92. package/src/core/resources/limits.ts +2 -1
  93. package/src/core/resources/work-queue.ts +167 -4
  94. package/src/core/retrieval/context-page.ts +11 -4
  95. package/src/core/retrieval/context.ts +363 -226
  96. package/src/{mcp/tools/get-symbol.ts → core/retrieval/source-context.ts} +145 -96
  97. package/src/core/retrieval/symbol-details.ts +453 -0
  98. package/src/core/retrieval/symbol-evidence.ts +3 -3
  99. package/src/core/retrieval/typescript-references.ts +38 -7
  100. package/src/core/retrieval/universal-context.ts +182 -0
  101. package/src/core/telemetry/summary.ts +114 -0
  102. package/src/core/telemetry/telemetry.ts +192 -49
  103. package/src/mcp/formatters/compact-text.ts +439 -0
  104. package/src/mcp/resources-and-prompts.ts +255 -0
  105. package/src/mcp/schemas/boundary.ts +145 -0
  106. package/src/mcp/schemas/map.ts +250 -0
  107. package/src/mcp/schemas/shared.ts +52 -0
  108. package/src/mcp/schemas/slice.ts +60 -0
  109. package/src/mcp/schemas/symbol.ts +268 -0
  110. package/src/mcp/schemas.ts +5 -746
  111. package/src/mcp/server.ts +269 -429
  112. package/src/mcp/tool-catalog.ts +331 -0
  113. package/src/mcp/tools/boundary.ts +68 -3
  114. package/src/mcp/tools/map.ts +104 -4
  115. package/src/mcp/tools/slice.ts +101 -3
  116. package/src/mcp/tools/symbol.ts +469 -17
  117. package/src/mcp/ui/app-client.ts +899 -0
  118. package/src/mcp/ui/app.html +478 -0
  119. package/src/mcp/workflow-playbooks.ts +181 -0
  120. package/src/mcp/workspace-boundary.ts +50 -0
  121. package/src/mcp/workspace-manager.ts +88 -15
  122. package/src/mcp/workspace-watcher.ts +30 -11
  123. package/src/types/index.ts +12 -0
  124. package/src/mcp/tools/check-boundary.ts +0 -382
  125. package/src/mcp/tools/get-domain-catalog.ts +0 -39
  126. package/src/mcp/tools/get-symbol-impact.ts +0 -104
  127. package/src/mcp/tools/locate-symbol.ts +0 -236
  128. package/src/mcp/tools/register-domain.ts +0 -113
  129. package/src/mcp/tools/trace-vertical-slice.ts +0 -106
@@ -0,0 +1,478 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Septum Architecture</title>
7
+ <style>
8
+ :root {
9
+ color-scheme: light dark;
10
+ }
11
+ * { box-sizing: border-box; }
12
+ body {
13
+ margin: 0;
14
+ padding: 12px;
15
+ background: var(--color-background-primary, #ffffff);
16
+ color: var(--color-text-primary, #1f1f1f);
17
+ font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
18
+ font-size: 13px;
19
+ line-height: 1.45;
20
+ }
21
+ .shell { display: flex; flex-direction: column; gap: 12px; }
22
+ .bar {
23
+ display: flex; align-items: center; justify-content: space-between;
24
+ gap: 8px; flex-wrap: wrap;
25
+ border-bottom: 1px solid var(--color-border-primary, #e2e8f0);
26
+ padding-bottom: 8px;
27
+ }
28
+ .tabs, .actions { display: flex; gap: 6px; }
29
+ .tab, .btn {
30
+ border: 1px solid var(--color-border-primary, #cbd5e1);
31
+ background: var(--color-background-secondary, #f8fafc);
32
+ color: var(--color-text-primary, #1f1f1f);
33
+ border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
34
+ }
35
+ .tab.active {
36
+ background: var(--color-background-inverse, #0f172a);
37
+ color: var(--color-text-inverse, #ffffff);
38
+ border-color: var(--color-border-inverse, #0f172a);
39
+ }
40
+ .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
41
+ .stat, .card {
42
+ background: var(--color-background-secondary, #f8fafc);
43
+ border: 1px solid var(--color-border-primary, #e2e8f0);
44
+ border-radius: 8px; padding: 8px 10px;
45
+ }
46
+ .stat .label { display: block; font-size: 11px; color: var(--color-text-secondary, #64748b); }
47
+ .stat .val { font-size: 15px; font-weight: 600; }
48
+ .val.ok { color: var(--color-text-success, #15803d); }
49
+ .val.danger, .danger { color: var(--color-text-danger, #b91c1c); }
50
+ .val.warn { color: var(--color-text-warning, #b45309); }
51
+ .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
52
+ .card-title { font-weight: 600; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
53
+ .list { display: flex; flex-direction: column; gap: 6px; }
54
+ .row {
55
+ display: flex; align-items: center; justify-content: space-between; gap: 8px;
56
+ background: var(--color-background-secondary, #f8fafc);
57
+ border: 1px solid var(--color-border-primary, #e2e8f0);
58
+ border-radius: 6px; padding: 6px 10px;
59
+ }
60
+ .clickable { cursor: pointer; }
61
+ .clickable:hover { border-color: var(--color-ring-primary, #3b82f6); }
62
+ .badge {
63
+ display: inline-block; font-size: 11px; font-weight: 600;
64
+ padding: 1px 6px; border-radius: 4px;
65
+ background: var(--color-background-tertiary, #e2e8f0);
66
+ color: var(--color-text-primary, #1f1f1f);
67
+ }
68
+ .muted { color: var(--color-text-secondary, #64748b); font-size: 12px; }
69
+ .meta { font-size: 11px; margin-top: 4px; color: var(--color-text-secondary, #475569); }
70
+ .empty { padding: 16px; text-align: center; color: var(--color-text-secondary, #64748b); }
71
+ .alert {
72
+ padding: 8px 10px; border-radius: 6px;
73
+ background: var(--color-background-danger, #fef2f2);
74
+ color: var(--color-text-danger, #b91c1c);
75
+ border: 1px solid var(--color-border-danger, #fecaca);
76
+ }
77
+ .warn-box {
78
+ display: flex; flex-direction: column; gap: 6px;
79
+ padding: 8px 10px; border-radius: 8px;
80
+ background: var(--color-background-warning, #fffbeb);
81
+ color: var(--color-text-warning, #92400e);
82
+ border: 1px solid var(--color-border-warning, #fde68a);
83
+ }
84
+ .warn-box ul { margin: 0; padding-left: 18px; }
85
+ .warn-box li { margin: 2px 0; }
86
+ .brand { display: flex; align-items: center; gap: 6px; min-width: 0; }
87
+ .scope-pill, .scope-select {
88
+ font-size: 11px; padding: 2px 6px; border-radius: 4px;
89
+ background: var(--color-background-secondary, #f8fafc);
90
+ border: 1px solid var(--color-border-primary, #cbd5e1);
91
+ color: var(--color-text-secondary, #475569);
92
+ max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
93
+ }
94
+ .status-bar { font-size: 11px; color: var(--color-text-secondary, #64748b); min-height: 14px; }
95
+ .primary-btn { font-weight: 600; }
96
+ .ai-bar {
97
+ display: flex; flex-direction: column; gap: 6px;
98
+ padding: 8px 10px; border-radius: 8px;
99
+ background: var(--color-background-secondary, #f8fafc);
100
+ border: 1px solid var(--color-border-primary, #e2e8f0);
101
+ }
102
+ .preset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
103
+ .chip {
104
+ border: 1px solid var(--color-border-primary, #cbd5e1);
105
+ background: var(--color-background-primary, #ffffff);
106
+ color: var(--color-text-primary, #1f1f1f);
107
+ border-radius: 999px; padding: 2px 9px; font-size: 11px; cursor: pointer;
108
+ }
109
+ .chip:hover { border-color: var(--color-ring-primary, #3b82f6); }
110
+ .prompt-form { display: flex; gap: 6px; align-items: center; }
111
+ .prompt-input {
112
+ flex: 1; min-width: 0; padding: 5px 8px; border-radius: 6px; font-size: 12px;
113
+ border: 1px solid var(--color-border-primary, #cbd5e1);
114
+ background: var(--color-background-primary, #ffffff);
115
+ color: var(--color-text-primary, #1f1f1f);
116
+ }
117
+ .card.selected, .row.selected { border-color: var(--color-ring-primary, #3b82f6); }
118
+ .chk-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
119
+ .chk { cursor: pointer; margin: 0; }
120
+ .mini-btn {
121
+ border: 1px solid var(--color-border-primary, #cbd5e1);
122
+ background: var(--color-background-primary, #ffffff);
123
+ color: var(--color-text-primary, #1f1f1f);
124
+ border-radius: 5px; padding: 2px 7px; font-size: 11px; cursor: pointer;
125
+ }
126
+ h3 { margin: 10px 0 6px; font-size: 13px; font-weight: 600; }
127
+ code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
128
+ </style>
129
+ </head>
130
+ <body>
131
+ <div id="root"></div>
132
+ <script type="module">var{create:dT,defineProperty:ku,getOwnPropertyDescriptor:mT,getOwnPropertyNames:hT,getPrototypeOf:fT}=Object,gT=Object.prototype.hasOwnProperty,Xf=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qf=(e,t)=>{let r={};for(var o in e)ku(r,o,{get:e[o],enumerable:!0});if(t)ku(r,Symbol.toStringTag,{value:"Module"});return r},_T=(e,t,r,o)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=hT(t),s=0,i=n.length,a;s<i;s++)if(a=n[s],!gT.call(e,a)&&a!==r)ku(e,a,{get:((c)=>t[c]).bind(null,a),enumerable:!(o=mT(t,a))||o.enumerable})}return e},eg=(e,t,r)=>(r=e!=null?dT(fT(e)):{},_T(t||!e||!e.__esModule?ku(r,"default",{value:e,enumerable:!0}):r,e));var yT=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),tg=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),vT=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),ST=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function rg(e){return typeof e==="string"&&tg.has(e.replace(/#$/,""))}function og(e,t){if(!("$schema"in e)||typeof e.$schema!=="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(yT.has(r))return"2020-12";if(tg.has(r))return"2019-09";if(vT.has(r)||ST.has(r))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}function ui(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function od(e,t="|"){return e.map((r)=>id(r)).join(t)}function li(e,t){if(typeof t==="bigint")return t.toString();return t}class sg{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function pi(e){return new sg(e)}function ig(e){return e===null||e===void 0}function Ru(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ag(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}var ng=Symbol("evaluating");function cg(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===ng)return;if(o===void 0)o=ng,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Yt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function di(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function qr(e){return di(e._zod.def)??e._zod.def.shape}function ug(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return Yt(this,t,o),o},enumerable:!0,configurable:!0})}function lg(e,t,r){if(t in e)Yt(e,t,r);else e[t]=r}function Bo(e,t,r,o){let n=qr(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);if(!i.enumerable)continue;if(i.get)ug(e,s,()=>{let a=t._zod.def.shape[s];return o?o(a,s):a});else lg(e,s,o?o(i.value,s):i.value)}}function bT(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)ug(e,r,()=>t[r]);else lg(e,r,o.value)}}function Mt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function pg(e){return JSON.stringify(e)}function dg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var nd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function In(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var mg=pi(()=>{if($t.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ho(e){if(In(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(In(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function sd(e){if(Ho(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var hg=new Set(["string","number","symbol"]);function ho(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function B(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function id(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function fg(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Pu=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),ad={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zT(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return Bo(s,e,Tu(e,t)),nr(e,Mt(r,{shape:s,checks:[]}))}function Tu(e,t){let r=qr(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function xT(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Tu(e,t)),i={};return Bo(i,e,Reflect.ownKeys(qr(e)).filter((a)=>!s.has(a))),nr(e,Mt(r,{shape:i,checks:[]}))}function wT(e,t){if(!Ho(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=qr(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return nr(e,Mt(e._zod.def,{shape:gg(e,t)}))}function gg(e,t){let r={};return Bo(r,e,Reflect.ownKeys(qr(e))),bT(r,t),r}function $T(e,t){if(!Ho(t))throw Error("Invalid input to safeExtend: expected a plain object");return nr(e,Mt(e._zod.def,{shape:gg(e,t)}))}function kT(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Bo(r,e,Reflect.ownKeys(qr(e))),Bo(r,t,Reflect.ownKeys(qr(t)));let o=Mt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return nr(e,o)}function _g(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(Tu(t,r)):void 0,c={};return Bo(c,t,Reflect.ownKeys(qr(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),nr(t,Mt(t._zod.def,{shape:c,checks:[]}))}function RT(e,t,r){let o=r?new Set(Tu(t,r)):void 0,n={};return Bo(n,t,Reflect.ownKeys(qr(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),nr(t,Mt(t._zod.def,{shape:n}))}function yr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function yg(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function fo(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function ci(e){return typeof e==="string"?e:e?.message}function cd(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function vr(e,t,r){var o;let n=e.inst?._zod?.traits;if(n?.has("$ZodType"))if(n.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:ci(e.inst?._zod.def?.error?.(e))??ci(s?.(e))??ci(t?.error?.(e))??ci(r.customError?.(e))??ci(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var PT=/[\uD800-\uDBFF]/;function Eu(e){let t=e.length;if(!PT.test(e))return t;let r=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)r--,o++;return r}function Iu(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function vg(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Jo(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function Sg(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else TT(e,r,o.value)}}function Dr(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Cu(e,t,r){return Dr(e,t,r,!1)}function bg(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Dr(this,r,o(this))},set(n){Dr(this,r,n)}})}return t}function TT(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Dr(this,t,r.bind(this))},set(o){Dr(this,t,o)}})}function ET(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var rd,mo=!1,IT={configurable:!0,get(){mo=!0;return}};function me(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&rd!==e._zod){rd=void 0;return}rd=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,IT);let n=mo;mo=!1;try{let s=r(this);if(mo)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return mo=mo||n,s}catch(s){throw delete this[t],mo=mo||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function CT(e,t,r,o){let n=ET(e,t);if(!n)return;Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var OT="~constantCatch";function zg(e){let t=()=>e;return t[OT]=!0,t}var xg,ld=Object.freeze({status:"aborted"}),ud={value:void 0,enumerable:!1},wg="captureStackTrace"in Error?Error:null;function AT(e){let t=wg;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return wg=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function S(e,t,r,o){let n={};function s(d){this.def=d,this.constr=p,this.traits=new Set}s.prototype=n;let i=r,a=i&&new WeakSet;function c(d,h){if(!d._zod){ud.value=new s(h);try{Object.defineProperty(d,"_zod",ud)}finally{ud.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,h),a){let _=Object.getPrototypeOf(d),v=d._zod.constr.prototype,k=_;while(k&&k!==v)k=Object.getPrototypeOf(k);let Z=k??_;if(!a.has(Z))a.add(Z),Sg(Z,i)}let f=p.prototype;for(let _ in f){if(!Object.prototype.hasOwnProperty.call(f,_))continue;if(!(_ in d))d[_]=f[_].bind(d)}}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(d){let h=o?.Parent?AT(l):this;c(h,d);let f=h._zod.deferred;if(f){for(let v of f)v();h._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(h);return h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class Sr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mi extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(xg=globalThis).__zod_globalConfig??(xg.__zod_globalConfig={});var $t=globalThis.__zod_globalConfig;function kt(e){if(e)Object.assign($t,e);return $t}function NT(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,li,2)),e.message}function ZT(e){this._zod.message=e}var MT={get:NT,set:ZT,enumerable:!0,configurable:!0},dd={value:void 0,enumerable:!1},$g=new WeakSet([Object.prototype,Error.prototype]),kg=(e,t)=>{e.name="$ZodError",dd.value=t,Object.defineProperty(e,"issues",dd),dd.value=void 0,Object.defineProperty(e,"message",MT);let r=Object.getPrototypeOf(e);if(!$g.has(r))$g.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},Rg=S("$ZodError",kg),Gj=S("$ZodError",kg,void 0,{Parent:Error});function jT(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function md(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)jT(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function hd(e,t=(r)=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],p=u===a.length-1;if(l==="_errors"){if(p)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[l];if(p)d._errors.push(t(i));c=d,u++}}}};return o(e),r}function Ou(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Au=(e)=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new Sr;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>vr(u,i,kt())));throw nd(c,s?.callee??t),c}return a.value};return t};var Nu=(e)=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>vr(u,i,kt())));throw nd(c,s?.callee??t),c}return a.value};return t};var Zu=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Sr;return s.issues.length?Pg(e,s.issues,n):{success:!0,data:s.value}};function Pg(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>vr(n,r,kt()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var Mu=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?Pg(e,s.issues,n):{success:!0,data:s.value}};var LT=Symbol.for("zod.compile.invalid"),qT=Symbol.for("zod.compile.fallback"),fd=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==LT)return!0;if(o.definite===!0&&r===void 0)return!1}return DT(e,t,r)};function DT(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n)o[qT]=!0,s=n({value:t,issues:[]},o);else s=e._zod.run({value:t,issues:[]},o);if(s instanceof Promise)throw new Sr;return s.issues.length===0}var gd=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},Tg=(e)=>{let t=Au(e),r=(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,a,Ou(r,i))};return r};var Eg=(e)=>{let t=Au(e),r=(o,n,s,i)=>t(o,n,s,Ou(r,i));return r};var Ig=(e)=>{let t=Nu(e),r=async(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,a,Ou(r,i))};return r};var Cg=(e)=>{let t=Nu(e),r=async(o,n,s,i)=>await t(o,n,s,Ou(r,i));return r};var Og=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Zu(e)(t,r,n)};var Ag=(e)=>(t,r,o)=>Zu(e)(t,r,o);var Ng=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Mu(e)(t,r,n)};var Zg=(e)=>async(t,r,o)=>Mu(e)(t,r,o);var Mg=/^[cC][0-9a-z]{6,}$/,jg=/^[0-9a-z]+$/,Lg=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,qg=/^[0-9a-vA-V]{20}$/,Dg=/^[A-Za-z0-9]{27}$/,Ug=/^[a-zA-Z0-9_-]{21}$/;function Fg(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vg=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Bg=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yd=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Hg=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var UT="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Jg(){return new RegExp(UT,"u")}var Kg=/^(?:(?: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])$/,Wg=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Gg=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Yg=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qg=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var e_=/^https?$/,t_=/^\+[1-9]\d{6,14}$/;var r_="(?:(?:\\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])))";function FT(e){return new RegExp(`^${e}$`)}var o_=FT(r_);function _d(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function n_(e){return new RegExp(`^${_d(e)}$`)}function s_(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${_d({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${_d({precision:e.precision})}`:r;return new RegExp(`^${r_}T(?:${o})$`)}var i_=/^[\s\S]{0,}$/;var vd=/^-?\d+$/,hi=/^-?\d+(?:\.\d+)?$/,a_=/^(?:true|false)$/i,c_=/^null$/i;var u_=/^[^A-Z]*$/,l_=/^[^a-z]*$/;var nt=S("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Sd=(e)=>{let t=e.value;return!ig(t)&&t.length!==void 0},ju={number:"number",bigint:"bigint",object:"date"},bd=S("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);let r=ju[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:ju[typeof o.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zd=S("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);let r=ju[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:ju[typeof o.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),p_=S("$ZodCheckMultipleOf",(e,t)=>{nt.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):ag(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),d_=S("$ZodCheckNumberFormat",(e,t)=>{nt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Pu[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var m_=S("$ZodCheckMaxLength",(e,t)=>{var r;nt.init(e,t),(r=e._zod.def).when??(r.when=Sd),e._zod.check=(o)=>{let n=o.value,s=n.length;if((typeof n==="string"&&s>t.maximum?Eu(n):s)<=t.maximum)return;let a=Iu(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),h_=S("$ZodCheckMinLength",(e,t)=>{var r;nt.init(e,t),(r=e._zod.def).when??(r.when=Sd),e._zod.check=(o)=>{let n=o.value,s=n.length;if((typeof n==="string"&&s>=t.minimum&&s<t.minimum*2?Eu(n):s)>=t.minimum)return;let a=Iu(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),f_=S("$ZodCheckLengthEquals",(e,t)=>{var r;nt.init(e,t),(r=e._zod.def).when??(r.when=Sd),e._zod.check=(o)=>{let n=o.value,s=n.length,i=typeof n==="string"&&s>=t.length&&s<=t.length*2?Eu(n):s;if(i===t.length)return;let a=Iu(n),c=i>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),fi=S("$ZodCheckStringFormat",(e,t)=>{var r,o;if(nt.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),g_=S("$ZodCheckRegex",(e,t)=>{fi.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),__=S("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=u_),fi.init(e,t)}),y_=S("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=l_),fi.init(e,t)}),v_=S("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);let r=ho(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),S_=S("$ZodCheckStartsWith",(e,t)=>{nt.init(e,t);let r=new RegExp(`^${ho(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),b_=S("$ZodCheckEndsWith",(e,t)=>{nt.init(e,t);let r=new RegExp(`.*${ho(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var z_=S("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class xd{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
133
+ `).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
134
+ ${t.join(`
135
+ `)}
136
+ };`)(...Object.values(this.closed))}}var w_={major:4,minor:6,patch:5};var be=S("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=w_;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=yr(a),p;for(let d of c){if(d._zod.def.when){if(yg(a))continue;if(!d._zod.def.when(a))continue}else if(l)continue;let h=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new Sr;if(p||f instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await f,a.issues.length===h)return;if(cd(a.issues,h,e),!l)l=yr(a,h)});else{if(a.issues.length===h)continue;if(cd(a.issues,h,e),!l)l=yr(a,h)}}if(p)return p.then(()=>a);return a},i=(a,c,u)=>{if(yr(a))return a.aborted=!0,a;let l=s(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new Sr;return l.then((p)=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((p)=>i(p,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Sr;return u.then((l)=>s(l,n,c))}return s(u,n,c)}}},{get "~standard"(){return Cu(this,"~standard",$d(this))},set "~standard"(e){Dr(this,"~standard",e)}}),N_=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>vr(r,t,kt()))}:{value:e.value};async function VT(e,t){let r={async:!0};return N_(await e._zod.run({value:t,issues:[]},r),r)}function $d(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return N_(o,r)}catch(o){}return VT(e,t)},vendor:"zod",version:1}}var Uu=S("$ZodString",(e,t)=>{be.init(e,t),e._zod.pattern=t.pattern??i_,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ee=S("$ZodStringFormat",(e,t)=>{fi.init(e,t),Uu.init(e,t)}),Z_=S("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Bg),Ee.init(e,t)}),M_=S("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yd(o))}else t.pattern??(t.pattern=yd());Ee.init(e,t)}),j_=S("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hg),Ee.init(e,t)}),L_=1,qu=2;function q_(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function BT(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return q_(e)||qu;return HT(e,t)}function HT(e,t){if(!t.normalize&&t.protocol?.source===e_.source&&!/^https?:\/\//i.test(e))return L_;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??qu}return new URL(e)}catch{return qu}}var JT=/[\t\n\r]/g;function $_(e){return e.replace(JT,"")}function KT(e,t){return t.lastIndex=0,t.test(e.hostname)}function WT(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var D_=S("$ZodURL",(e,t)=>{Ee.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=BT(o,t);if(n===L_){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===qu){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=$_(o);return}if(t.hostname&&!KT(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!WT(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:$_(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),U_=S("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Jg()),Ee.init(e,t)}),F_=S("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Ug:Fg(t.length)),Ee.init(e,t)}),V_=S("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mg),Ee.init(e,t)}),B_=S("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=jg),Ee.init(e,t)}),H_=S("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Lg),Ee.init(e,t)}),J_=S("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qg),Ee.init(e,t)}),K_=S("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Dg),Ee.init(e,t)}),W_=S("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=s_(t)),Ee.init(e,t)}),G_=S("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=o_),Ee.init(e,t)}),Y_=S("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=n_(t)),Ee.init(e,t)}),X_=S("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vg),Ee.init(e,t)}),Q_=S("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Kg),Ee.init(e,t)}),GT=/^[0-9a-fA-F:.]+$/;function ey(e){if(!GT.test(e))return!1;return q_(`http://[${e}]`)}var ty=S("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wg),Ee.init(e,t),e._zod.check=(r)=>{if(!ey(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var ry=S("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Gg),Ee.init(e,t)});function YT(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return ey(r)}var oy=S("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yg),Ee.init(e,t),e._zod.check=(r)=>{if(!YT(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function ny(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var kd=/^[0-9a-zA-Z+/]*={0,2}$/,sy=S("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=kd),Ee.init(e,t),e._zod.check=(r)=>{if(ny(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Fu=/^[A-Za-z0-9_-]*$/;function XT(e){if(!Fu.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return ny(r)}var iy=S("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fu),Ee.init(e,t),e._zod.check=(r)=>{if(XT(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ay=S("$ZodE164",(e,t)=>{t.pattern??(t.pattern=t_),Ee.init(e,t)});function QT(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var cy=S("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=(r)=>{if(QT(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Rd=S("$ZodNumber",(e,t)=>{be.init(e,t),e._zod.pattern=hi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),uy=S("$ZodNumberFormat",(e,t)=>{d_.init(e,t),Rd.init(e,t)}),ly=S("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=a_,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var py=S("$ZodNull",(e,t)=>{be.init(e,t),e._zod.pattern=c_,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),dy=S("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=(r)=>r}),my=S("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=(r)=>r}),hy=S("$ZodNever",(e,t)=>{be.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function k_(e,t,r){if(e.issues.length)t.issues.push(...fo(r,e.issues));t.value[r]=e.value}var fy=S("$ZodArray",(e,t)=>{be.init(e,t);let r=$t.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],a=n?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>k_(p,o,c)));else if(k_(l,o,c),a&&l.issues.length!==0&&yr(l))break}if(i.length)return Promise.all(i).then(()=>o);return o}});function Du(e,t,r,o,n,s){let i=r in o,a=s==="optional";if(!i&&a&&n==="optional")return;if(e.issues.length){if(n!==void 0&&a&&!i)return;t.issues.push(...fo(r,e.issues))}if(!i&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||n==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var eE=[];function gy(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:eE,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=fg(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function _y(e,t,r,o,n,s,i){let a=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,{optin:p,optout:d}=u,h=0;for(let f in t){if(i&&r.issues.length!==h){if(yr(r,h))break;h=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){if(l==="never")a.push(f);continue}if(l==="never"){a.push(f);continue}let _=u.run({value:t[f],issues:[]},o);if(_ instanceof Promise)e.push(_.then((v)=>Du(v,r,f,t,p,d)));else Du(_,r,f,t,p,d)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var tE=S("$ZodObject",(e,t)=>{be.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=pi(()=>gy(t));me(e,"propValues",(u)=>{let l=u.def.shape,p={};for(let d in l){let h=l[d]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(p,d))Yt(p,d,new Set);for(let f of h.values)p[d].add(f);if(h.optin!==void 0)p[d].add(void 0)}}return p});let s=In,i=t.catchall,a,c=$t.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=n.value);let p=u.value;if(!s(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],h=a.shape,f=l?.abortEarly,_=u.issues.length;for(let v of a.allKeys){if(f&&u.issues.length!==_){if(yr(u,_))break;_=u.issues.length}if(v==="__proto__")continue;let k=h[v],Z=k._zod.optin,E=k._zod.optout,ee=k._zod.run({value:p[v],issues:[]},l);if(ee instanceof Promise)d.push(ee.then((G)=>Du(G,u,v,p,Z,E)));else Du(ee,u,v,p,Z,E)}if(!i)return d.length?Promise.all(d).then(()=>u):u;return _y(d,p,u,l,n.value,e,f===!0)}}),yy=S("$ZodObjectJIT",(e,t)=>{tE.init(e,t);let r=e._zod.parse,o=pi(()=>gy(t)),n=$t.memoizer,s=(h)=>{let f=o.value,_=f.symbolKeys,v=new xd(["payload","ctx"],{shape:h,inst:e,memo:n,syms:_}),k=(G)=>`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`,Z=(G,P)=>`
137
+ let ${G}_ab = false;
138
+ for (let i = 0; i < ${G}.issues.length; i++) {
139
+ const iss = ${G}.issues[i];
140
+ iss.path = iss.path ? [${P}, ...iss.path] : [${P}];
141
+ payload.issues.push(iss);
142
+ if (iss.continue !== true) ${G}_ab = true;
143
+ }
144
+ if (${G}_ab && ctx && ctx.abortEarly) {
145
+ payload.value = newResult;
146
+ return payload;
147
+ }`;v.write("const input = payload.value;");let E=Object.create(null),ee=0;for(let G of f.allKeys)E[G]=`key_${ee++}`;v.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let G of f.allKeys){if(G==="__proto__")continue;let P=E[G],ae=typeof G==="symbol"?`syms[${_.indexOf(G)}]`:pg(G),We=`${ae} in input`,$e=h[G],Xe=$e?._zod?.optin,ot=Xe!==void 0,Vt=$e?._zod?.optout==="optional";if(v.write(`const ${P} = ${k(ae)};`),ot&&Vt){let Bt=Xe==="optional"?`${P}_present`:`${P}.value !== undefined || ${P}_present`;v.write(`
148
+ const ${P}_present = ${We};
149
+ if (!${P}.issues.length || ${P}_present) {
150
+ if (${P}.issues.length) {${Z(P,ae)}
151
+ }
152
+
153
+ if (${Bt}) {
154
+ newResult[${ae}] = ${P}.value;
155
+ }
156
+ }
157
+
158
+ `)}else if(!ot)v.write(`
159
+ const ${P}_present = ${We};
160
+ if (${P}.issues.length) {${Z(P,ae)}
161
+ }
162
+ if (!${P}_present && !${P}.issues.length) {
163
+ payload.issues.push({
164
+ code: "invalid_type",
165
+ expected: "nonoptional",
166
+ input: undefined,
167
+ path: [${ae}]
168
+ });
169
+ if (ctx && ctx.abortEarly) {
170
+ payload.value = newResult;
171
+ return payload;
172
+ }
173
+ }
174
+
175
+ if (${P}_present) {
176
+ newResult[${ae}] = ${P}.value;
177
+ }
178
+
179
+ `);else if(v.write(`
180
+ if (${P}.issues.length) {${Z(P,ae)}
181
+ }
182
+ `),Xe==="defaulted")v.write(`newResult[${ae}] = ${P}.value;`);else v.write(`
183
+ if (${P}.value !== undefined || ${We}) {
184
+ newResult[${ae}] = ${P}.value;
185
+ }
186
+ `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()},i,a=In,c=!$t.jitless,l=c&&mg.value,p=t.catchall,d;e._zod.parse=(h,f)=>{d??(d=o.value);let _=h.value;if(!a(_))return h.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),h;if(c&&l&&f?.async===!1&&f.jitless!==!0){if(!i)i=s(t.shape);if(h=i(h,f),!p)return h;return _y([],_,h,f,d,e,f?.abortEarly===!0)}return r(h,f)}});function R_(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!yr(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>vr(i,o,kt())))}),t}var Pd=S("$ZodUnion",(e,t)=>{be.init(e,t),me(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),me(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),me(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),me(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${n.map((s)=>Ru(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return R_(i,o,e,n);return Promise.all(i).then((a)=>R_(a,o,e,n))}});function rE(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var vy=S("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Pd.init(e,t);let r=e._zod.parse;me(e,"propValues",(n)=>{let s={},i=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);if(c[n.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(s,u))Yt(s,u,new Set);for(let p of l)s[u].add(p)}}if(!n.def.unionFallback&&i>1)s[n.def.discriminator]?.delete(void 0);return s}),t.options.forEach((n,s)=>{let i=di(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let o=pi(()=>rE(t));e._zod.parse=(n,s)=>{let i=n.value;if(!In(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=i?.[t.discriminator],c=o.value.get(a);if(c&&(a!==void 0||s.direction!=="backward"))return c._zod.run(n,s);if(t.unionFallback||s.direction==="backward")return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((u)=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n}}),Sy=S("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>P_(r,c,u));return P_(r,s,i)}});function wd(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ho(e)&&Ho(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=wd(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=wd(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function P_(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!s.has(d))s.set(d,u);p=[d]}else return!1;for(let d of p){if(!o.has(d))o.set(d,{});o.get(d)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=n?a.filter((l)=>n.keys.includes(l)):[];if(u.length)e.issues.push({...n,keys:u});for(let l of a)if(!u.includes(l)&&s.has(l))e.issues.push(s.get(l))}let c=wd(t.value,r.value);if(!c.valid){if(yr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var by=S("$ZodRecord",(e,t)=>{be.init(e,t);let r=$t.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Ho(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((f)=>vr(f,n,kt())),input:l,path:[l],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:s[l],issues:[]},n);if(h instanceof Promise)i.push(h.then((f)=>{if(f.issues.length)o.issues.push(...fo(l,f.issues));o.value[d]=f.value}));else{if(h.issues.length)o.issues.push(...fo(l,h.issues));o.value[d]=h.value}}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);if(u&&u.length>0)o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&hi.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},n);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)l=f}if(l.issues.length){if(t.mode==="loose")o.value[u]=s[u];else if(a)c=c??[],c.push(u);else o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((f)=>vr(f,n,kt())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:s[u],issues:[]},n);if(h instanceof Promise)i.push(h.then((f)=>{if(f.issues.length)o.issues.push(...fo(u,f.issues));o.value[d]=f.value}));else{if(h.issues.length)o.issues.push(...fo(u,h.issues));o.value[d]=h.value}}if(c&&c.length>0)o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>o);return o}});var zy=S("$ZodEnum",(e,t)=>{be.init(e,t);let r=ui(t.entries),o=new Set(r);e._zod.values=o,me(e,"pattern",(n)=>{let s=ui(n.def.entries).filter((i)=>hg.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>ho(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),xy=S("$ZodLiteral",(e,t)=>{be.init(e,t);let r=new Set(t.values);e._zod.values=r,me(e,"pattern",(o)=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map((s)=>typeof s==="string"?ho(s):s?ho(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var wy=S("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.optin="optional",$t.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new mi(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new Sr;return r.value=n,r}});function T_(e,t){return e.value=t.issues.length?void 0:t.value,e}var Td=S("$ZodOptional",(e,t)=>{be.init(e,t),me(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",me(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),me(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Ru(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((s)=>T_(r,s));return T_(r,n)}return t.innerType._zod.run(r,o)}}),$y=S("$ZodExactOptional",(e,t)=>{Td.init(e,t),me(e,"values",(r)=>r.def.innerType._zod.values),me(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ky=S("$ZodNullable",(e,t)=>{be.init(e,t),me(e,"optin",(r)=>r.def.innerType._zod.optin),me(e,"optout",(r)=>r.def.innerType._zod.optout),me(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Ru(o.source)}|null)$`):void 0}),me(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Ry=S("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="defaulted",me(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>E_(s,t));return E_(n,t)}});function E_(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Py=S("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="defaulted",me(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Ty=S("$ZodNonOptional",(e,t)=>{be.init(e,t),me(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>I_(s,e));return I_(n,e)}});function I_(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function C_(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>vr(n,o,kt()))},input:e.value}),e}var Ey=S("$ZodCatch",(e,t)=>{be.init(e,t),me(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),me(e,"optout",(r)=>r.def.innerType._zod.optout),me(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((s)=>C_(r,s,t,o));return C_(r,n,t,o)}});var Ed=S("$ZodPipe",(e,t)=>{be.init(e,t),me(e,"values",(r)=>r.def.in._zod.values),me(e,"optin",(r)=>r.def.in._zod.optin),me(e,"optout",(r)=>r.def.out._zod.optout),me(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>Lu(i,t.in,o));return Lu(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Lu(s,t.out,o));return Lu(n,t.out,o)}});function Lu(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Iy=S("$ZodPreprocess",(e,t)=>{Ed.init(e,t)}),Cy=S("$ZodReadonly",(e,t)=>{be.init(e,t),me(e,"propValues",(r)=>r.def.innerType._zod.propValues),me(e,"values",(r)=>r.def.innerType._zod.values),me(e,"optin",(r)=>r.def.innerType?._zod?.optin),me(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(O_);return O_(n)}});function O_(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Oy=S("$ZodLazy",(e,t)=>{be.init(e,t),cg(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),me(e,"pattern",(r)=>r.innerType?._zod?.pattern),me(e,"propValues",(r)=>r.innerType?._zod?.propValues),me(e,"optin",(r)=>r.innerType?._zod?.optin??void 0),me(e,"optout",(r)=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Ay=S("$ZodCustom",(e,t)=>{nt.init(e,t),be.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>A_(s,r,o,e));A_(n,r,o,e);return}});function A_(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Jo(n))}}class Zy extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Cd="~memo",Ny=[];function My(e){return e!==null&&typeof e==="object"}function Id(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var jy=new WeakMap,gi=0,Hu=1,_i=2;function Ju(e,t,r){let o=jy.get(e);if(o!==void 0)return o?_i:gi;if(t.has(e))return _i;t.add(e);let n=gi,s=(l)=>{if(n!==_i&&l?._zod){let p=Ju(l,t,r);if(p>n)n=p}},i=(l,p)=>{let d=gi;for(let h of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,h);if(p&&!f.enumerable)continue;let _=f.get?Hu:f.value?._zod?Ju(f.value,t,r):gi;if(_>d)d=_}return d},a=(l)=>{if(l>n)n=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=di(c);a(l?i(l,!0):Hu),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Ju(l,t,!1):Hu);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let d=p.value;if(!d||typeof d!=="object")continue;if(d._zod)s(d);else if(Array.isArray(d))for(let h of d)s(h)}}return t.delete(e),oE(e,n)}function oE(e,t){if(t!==Hu)jy.set(e,t===_i);return t}function nE(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Vu,Bu=[],sE={alloc(e,t,r){let o=Vu;if(!o)return r;Vu=void 0;let n={value:r,issues:null};return o.set(t.value,n),Bu.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&iE(s,n.value))throw new Zy;return r(n,s)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let k=Ju(e,new Set,!1);if(k===gi){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(k===_i||o)r=!0;else o=!0}let l=c.value;if(!My(l))return i(c,u);let p=u[Cd];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[Cd]=p;let d;if(n===u)d=s;else d=nE(p,e),n=u,s=d;let h=d.get(l);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...Id(h.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value);return c}Vu=d;let f=Bu.length,_=i(c,u);Vu=void 0;let v=Bu.length>f?Bu.pop():void 0;if(_ instanceof Promise)return _.then((k)=>{if(v)v.issues=k.issues.length?Id(k.issues):Ny;return k});if(v)v.issues=_.issues.length?Id(_.issues):Ny;return _};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Od(){return sE}function iE(e,t){let r=e[Cd]?.backEdges;return r!==void 0&&My(t)&&r.has(t)}var aE=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return o[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=n(s.expected),a=vg(s.input),c=n(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${id(s.values[0])}`;return`Invalid option: expected one of ${od(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${od(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Ad(){return{localeError:aE()}}var Ly;class qy{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Dy(){return new qy}(Ly=globalThis).__zod_globalRegistry??(Ly.__zod_globalRegistry=Dy());var go=globalThis.__zod_globalRegistry;function Nd(e){if(e.checks)e.checks=[...e.checks];return e}function Uy(e,t){return new e(Nd({type:"string",...B(t)}))}function Fy(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...B(t)})}function Vy(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...B(t)})}function By(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...B(t)})}function Hy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(t)})}function Jy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(t)})}function Ky(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(t)})}function Zd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...B(t)})}function Wy(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...B(t)})}function Gy(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(t)})}function Yy(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...B(t)})}function Xy(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(t)})}function Qy(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...B(t)})}function ev(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...B(t)})}function tv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(t)})}function rv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(t)})}function ov(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(t)})}function nv(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(t)})}function sv(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(t)})}function iv(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...B(t)})}function av(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...B(t)})}function cv(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...B(t)})}function uv(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...B(t)})}function Ku(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(t)})}function Md(e,t){return new e({type:"string",format:"date",check:"string_format",...B(t)})}function jd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...B(t)})}function Ld(e,t){return new e({type:"string",format:"duration",check:"string_format",...B(t)})}function lv(e,t){return new e(Nd({type:"number",checks:[],...B(t)}))}function pv(e,t){return new e(Nd({type:"number",coerce:!0,checks:[],...B(t)}))}function dv(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...B(t)})}function mv(e,t){return new e({type:"boolean",...B(t)})}function hv(e,t){return new e({type:"null",...B(t)})}function fv(e){return new e({type:"any"})}function gv(e){return new e({type:"unknown"})}function _v(e,t){return new e({type:"never",...B(t)})}function Wu(e,t){return new bd({check:"less_than",...B(t),value:e,inclusive:!1})}function yi(e,t){return new bd({check:"less_than",...B(t),value:e,inclusive:!0})}function Gu(e,t){return new zd({check:"greater_than",...B(t),value:e,inclusive:!1})}function vi(e,t){return new zd({check:"greater_than",...B(t),value:e,inclusive:!0})}function Yu(e,t){return new p_({check:"multiple_of",...B(t),value:e})}function Xu(e,t){return new m_({check:"max_length",...B(t),maximum:e})}function On(e,t){return new h_({check:"min_length",...B(t),minimum:e})}function Qu(e,t){return new f_({check:"length_equals",...B(t),length:e})}function qd(e,t){return new g_({check:"string_format",format:"regex",...B(t),pattern:e})}function Dd(e){return new __({check:"string_format",format:"lowercase",...B(e)})}function Ud(e){return new y_({check:"string_format",format:"uppercase",...B(e)})}function Fd(e,t){return new v_({check:"string_format",format:"includes",...B(t),includes:e})}function Vd(e,t){return new S_({check:"string_format",format:"starts_with",...B(t),prefix:e})}function Bd(e,t){return new b_({check:"string_format",format:"ends_with",...B(t),suffix:e})}function _o(e){return new z_({check:"overwrite",tx:e})}function Hd(e){return _o((t)=>t.normalize(e))}function Jd(){return _o((e)=>e.trim())}function Kd(){return _o((e)=>e.toLowerCase())}function Wd(){return _o((e)=>e.toUpperCase())}function Gd(){return _o((e)=>dg(e))}function yv(e,t,r){return new e({type:"array",element:t,...B(r)})}function vv(e,t,r){return new e({type:"custom",check:"custom",fn:t,...B(r)})}function Sv(e,t){let r=cE((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(Jo(n,o.value,r._zod.def));else{let s=n;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=o.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Jo(s))}},e(o.value,o)),t);return r}function cE(e,t){let r=new nt({check:"custom",...B(t)});return r._zod.check=e,r}function Si(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))Yt(e,o,r[o]);return e}function Xd(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??go,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ur(e,t,r,o,n){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(n);return Object.assign(r,s),!0}function Je(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let d=i.schema,h=t.processors[n.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,d,l)}let p=e._zod.parent;if(p){if(!i.ref)i.ref=p;Je(p,t,l),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Si(i.schema,c);if(t.io==="input"&&vt(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function bv(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Qd(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,d=e.external.uri??((f)=>f);if(p)return{ref:d(p)};let h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${d("__shared")}#/${a}/${bv(h)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+bv(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
187
+
188
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function wv(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;wv(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var $v=new Set(["type","properties","required","additionalProperties"]),zv=["oneOf","anyOf"];function xv(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Yd(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!$v.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??xv(u);if(l===null||l===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:Yd(a)??{allOf:a};Yt(r,i,c)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((s)=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let a=xv(i);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)n.additionalProperties=s[0];else if(s.length>1)n.additionalProperties={allOf:s}}return n}function uE(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of $v)if(n in e)return;let r=t.filter((n)=>zv.some((s)=>Array.isArray(n[s]))),o=null;if(!r.length)o=Yd(t);else{let n=r[0],s=zv.find((c)=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let i=t.filter((c)=>c!==n),a=n[s].map((c)=>Yd([...i,c]));if(a.some((c)=>!c))return;o={[s]:a}}if(!o)return;delete e.allOf,Si(e,o)}function em(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let h=e.seen.get(p),f=h.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else Si(u,f);if(Si(u,l),a._zod.parent===p)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in l))delete u[v]}if(f.$ref&&h.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v]))delete u[v]}}let d=a._zod.parent;if(d&&d!==p){o(d);let h=e.seen.get(d);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in h.def&&JSON.stringify(u[f])===JSON.stringify(h.def[f]))delete u[f]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())wv(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);if(p)p.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])uE(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Si(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&n.id===s)delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Yt(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")n.$defs=i;else n.definitions=i;try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:bi(t,"input",e.processors),output:bi(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function vt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return vt(o.element,r);if(o.type==="set")return vt(o.valueType,r);if(o.type==="lazy")return vt(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return vt(o.innerType,r);if(o.type==="intersection")return vt(o.left,r)||vt(o.right,r);if(o.type==="record"||o.type==="map")return vt(o.keyType,r)||vt(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return vt(o.in,r)||vt(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(vt(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(vt(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(vt(n,r))return!0;if(o.rest&&vt(o.rest,r))return!0;return!1}return!1}var kv=(e,t={})=>(r)=>{let o=Xd({...r,processors:t});return Je(e,o),Qd(o,e),em(o,e)},bi=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=Xd({...n??{},target:s,io:t,processors:r});return Je(e,i),Qd(i,e),em(i,e)};var An=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},Nn=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},Rv=(e,t)=>{An(e,"minimum",t),Nn(e,"maximum",t)},Iv=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Cv=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Ov=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Av=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pv=(e,t)=>An(e,"minimum",t.minimum),Tv=(e,t)=>Nn(e,"maximum",t.maximum),Ev=(e)=>(t,r)=>{Av(t,r.format);let[o,n]=e[r.format];An(t,"minimum",o),Nn(t,"maximum",n)},lE={greater_than:(e,t)=>An(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Nn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Iv(e,t.value),number_format:Ev(Pu),bigint_format:Ev(ad),min_length:Pv,max_length:Tv,length_equals:(e,t)=>Rv(e,t.length),min_size:Pv,max_size:Tv,size_equals:(e,t)=>Rv(e,t.size),string_format:(e,t)=>{if(Av(e,t.format),t.pattern)Cv(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Ov(e,t.mime)};function Qt(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)lE[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)An(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)An(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)Nn(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)Nn(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Iv(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Ov(t,n.mime);for(let s of n.patterns??[])Cv(t,s);return t}var pE={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},dE=new Map([[kd,Xg],[Fu,Qg]]),Nv=(e)=>dE.get(e)??e,Zv=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Qt(e);if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=pE[a]??a,n.format==="")delete n.format;if(a==="time"||l)delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let p=[...c].map(Nv);if(p.length===1)n.pattern=p[0].source;else if(p.length>1)n.allOf=[...p.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},Mv=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Qt(e);n.type=l?"integer":"number";let p=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),d=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=u,n.exclusiveMinimum=!0;else n.exclusiveMinimum=u;else if(typeof s==="number")n.minimum=s;if(d)if(h)n.maximum=c,n.exclusiveMaximum=!0;else n.exclusiveMaximum=c;else if(typeof i==="number")n.maximum=i;if(a){let f=new Set;for(let k of a)if(Number.isFinite(k)&&k!==0)f.add(Math.abs(k));else Ur(e,t,n,o,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[_,...v]=f;if(_!==void 0)n.multipleOf=_;if(v.length)n.allOf=[...n.allOf??[],...v.map((k)=>({multipleOf:k}))]}},jv=(e,t,r,o)=>{r.type="boolean"};var Lv=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var qv=(e,t,r,o)=>{r.not={}},Dv=(e,t,r,o)=>{},Uv=(e,t,r,o)=>{};var Fv=(e,t,r,o)=>{let n=e._zod.def,s=ui(n.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},Vv=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(Ur(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(Ur(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var Bv=(e,t,r,o)=>{Ur(e,t,r,o,"Custom types cannot be represented in JSON Schema")};var Hv=(e,t,r,o)=>{Ur(e,t,r,o,"Transforms cannot be represented in JSON Schema")};var Jv=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=Qt(e);if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=Je(s.element,t,{...o,path:[...o.path,"items"]})};function el(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return el(t.out);if(t.type==="catch")return el(t.innerType);return e._zod.optin}var Kv=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ur(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)Yt(n.properties,u,Je(i[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];if(t.io==="input"?el(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)n.required=c;if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=Je(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Wv=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>Je(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},Gv=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Je(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)};function tm(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let _=tm(e,f,r);return _===f?t:_}for(let f of["anyOf","oneOf"]){let _=t[f];if(!Array.isArray(_))continue;let v=_.map((k)=>tm(e,k,r));if(v.some((k,Z)=>k!==_[Z]))t={...t,[f]:v}}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some((f)=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some((f)=>typeof f==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:d,...h}=t;if(h.enum)h.enum=h.enum.map((f)=>typeof f==="number"?String(f):f);else if(typeof h.const==="number")h.const=String(h.const);if(!n)return h;if(h.type="string",!s)h.pattern=(o.includes("number")?hi:vd).source;return h}var rm=new WeakMap;function mE(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let r=new Map;for(let o of rm.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=tm(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);if(s)n.propertyNames=s}}var Yv=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,a=Qt(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=Je(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of a)Yt(n.patternProperties,Nv(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=Je(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=rm.get(t);if(!l)l=[],rm.set(t,l),t.deferred.push(()=>mE(t));l.push(e)}n.additionalProperties=Je(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&el(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)n.required=l.map(String)}},Xv=(e,t,r,o)=>{let n=e._zod.def,s=Je(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Qv=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},om=Symbol();function eS(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(i);return Ur(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),om}var tS=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=eS(n.defaultValue,e,t,r,o);if(i!==om)r.default=i},rS=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=eS(n.defaultValue,e,t,r,o);if(i!==om)r._prefault=i},oS=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{Ur(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},nS=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;Je(i,t,o);let a=t.seen.get(e);a.ref=i},sS=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var nm=(e,t,r,o)=>{let n=e._zod.def;Je(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},iS=(e,t,r,o)=>{let n=e._zod.innerType;Je(n,t,o);let s=t.seen.get(e);s.ref=n};var aS=new WeakSet([Object.prototype,Error.prototype]);function tl(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var zE=(e,t)=>{Rg.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(aS.has(r))return;aS.add(r),tl(r,"format",(o)=>(n)=>hd(o,n)),tl(r,"flatten",(o)=>(n)=>md(o,n)),tl(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,li,2)}),tl(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,li,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var jt=S("ZodError",zE,void 0,{Parent:Error});var cS=Au(jt),uS=Nu(jt),lS=Zu(jt),pS=Mu(jt),dS=Tg(jt),mS=Eg(jt),hS=Ig(jt),fS=Cg(jt),gS=Og(jt),_S=Ag(jt),yS=Ng(jt),vS=Zg(jt);function wE(){if(!$t.localeError)kt(Ad())}function ol(){if(!$t.memoizer)kt({memoizer:Od()})}var ke=S("ZodType",(e,t)=>(wE(),be.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Mt(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return nr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mI(e,t))},superRefine(e,t){return this.check(hI(e,t))},overwrite(e){return this.check(_o(e))},optional(){return Ne(this)},exactOptional(){return QE(this)},nullable(){return zS(this)},nullish(){return Ne(zS(this))},nonoptional(e){return sI(this,e)},array(){return T(this)},or(e){return Re([this,e])},and(e){return sl(this,e)},transform(e){return xS(this,NS(e))},default(e){return rI(this,e)},prefault(e){return nI(this,e)},catch(e){return aI(this,e)},pipe(e){return xS(this,e)},readonly(){return lI(this)},describe(e){let t=this.clone();return go.add(t,{description:e}),t},meta(...e){if(e.length===0)return go.get(this);let t=this.clone();return go.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Cu(this,"~standard",{...$d(this),jsonSchema:{input:bi(this,"input"),output:bi(this,"output")}})},set "~standard"(e){Dr(this,"~standard",e)},parse:function e(t,r){return cS(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await uS(this,t,r,{callee:e})},safeParse(e,t){return lS(this,e,t)},async safeParseAsync(e,t){return pS(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Dr(this,"spa",e)},validate(e,t){return fd(this,e,t)},validateAsync(e,t){return gd(this,e,t)},encode:function e(t,r){return dS(this,t,r,{callee:e})},decode:function e(t,r){return mS(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await hS(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await fS(this,t,r,{callee:e})},safeEncode(e,t){return gS(this,e,t)},safeDecode(e,t){return _S(this,e,t)},async safeEncodeAsync(e,t){return yS(this,e,t)},async safeDecodeAsync(e,t){return vS(this,e,t)},toJSONSchema(e){return kv(this,{})(e)},get description(){return go.get(this)?.description},get _def(){return this._zod.def}}),wS=S("_ZodString",(e,t)=>{Uu.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zv(e,r,o,n)},bg({format:(e)=>Qt(e).format??null,minLength:(e)=>Qt(e).minimum??null,maxLength:(e)=>Qt(e).maximum??null},{regex(...e){return this.check(qd(...e))},includes(...e){return this.check(Fd(...e))},startsWith(...e){return this.check(Vd(...e))},endsWith(...e){return this.check(Bd(...e))},min(...e){return this.check(On(...e))},max(...e){return this.check(Xu(...e))},length(...e){return this.check(Qu(...e))},nonempty(...e){return this.check(On(1,...e))},lowercase(e){return this.check(Dd(e))},uppercase(e){return this.check(Ud(e))},trim(){return this.check(Jd())},normalize(...e){return this.check(Hd(...e))},toLowerCase(){return this.check(Kd())},toUpperCase(){return this.check(Wd())},slugify(){return this.check(Gd())}})),$S=S("ZodString",(e,t)=>{Uu.init(e,t),wS.init(e,t)},{email(e){return this.check(Fy($E,e))},url(e){return this.check(Zd(TS,e))},jwt(e){return this.check(uv(DE,e))},emoji(e){return this.check(Wy(RE,e))},guid(e){return this.check(Vy(kE,e))},uuid(e){return this.check(By(rl,e))},uuidv4(e){return this.check(Hy(rl,e))},uuidv6(e){return this.check(Jy(rl,e))},uuidv7(e){return this.check(Ky(rl,e))},nanoid(e){return this.check(Gy(PE,e))},cuid(e){return this.check(Yy(TE,e))},cuid2(e){return this.check(Xy(EE,e))},ulid(e){return this.check(Qy(IE,e))},base64(e){return this.check(iv(jE,e))},base64url(e){return this.check(av(LE,e))},xid(e){return this.check(ev(CE,e))},ksuid(e){return this.check(tv(OE,e))},ipv4(e){return this.check(rv(AE,e))},ipv6(e){return this.check(ov(NE,e))},cidrv4(e){return this.check(nv(ZE,e))},cidrv6(e){return this.check(sv(ME,e))},e164(e){return this.check(cv(qE,e))},datetime(e){return this.check(Ku(im,e))},date(e){return this.check(Md(kS,e))},time(e){return this.check(jd(RS,e))},duration(e){return this.check(Ld(PS,e))}});function g(e){return Uy($S,e)}var De=S("ZodStringFormat",(e,t)=>{Ee.init(e,t),wS.init(e,t)}),im=S("ZodISODateTime",(e,t)=>{W_.init(e,t),De.init(e,t)}),kS=S("ZodISODate",(e,t)=>{G_.init(e,t),De.init(e,t)}),RS=S("ZodISOTime",(e,t)=>{Y_.init(e,t),De.init(e,t)}),PS=S("ZodISODuration",(e,t)=>{X_.init(e,t),De.init(e,t)}),$E=S("ZodEmail",(e,t)=>{j_.init(e,t),De.init(e,t)});var kE=S("ZodGUID",(e,t)=>{Z_.init(e,t),De.init(e,t)});var rl=S("ZodUUID",(e,t)=>{M_.init(e,t),De.init(e,t)});var TS=S("ZodURL",(e,t)=>{D_.init(e,t),De.init(e,t)});function ES(e){return Zd(TS,e)}var RE=S("ZodEmoji",(e,t)=>{U_.init(e,t),De.init(e,t)});var PE=S("ZodNanoID",(e,t)=>{F_.init(e,t),De.init(e,t)});var TE=S("ZodCUID",(e,t)=>{V_.init(e,t),De.init(e,t)});var EE=S("ZodCUID2",(e,t)=>{B_.init(e,t),De.init(e,t)});var IE=S("ZodULID",(e,t)=>{H_.init(e,t),De.init(e,t)});var CE=S("ZodXID",(e,t)=>{J_.init(e,t),De.init(e,t)});var OE=S("ZodKSUID",(e,t)=>{K_.init(e,t),De.init(e,t)});var AE=S("ZodIPv4",(e,t)=>{Q_.init(e,t),De.init(e,t)});var NE=S("ZodIPv6",(e,t)=>{ty.init(e,t),De.init(e,t)});var ZE=S("ZodCIDRv4",(e,t)=>{ry.init(e,t),De.init(e,t)});var ME=S("ZodCIDRv6",(e,t)=>{oy.init(e,t),De.init(e,t)});var jE=S("ZodBase64",(e,t)=>{sy.init(e,t),De.init(e,t)});var LE=S("ZodBase64URL",(e,t)=>{iy.init(e,t),De.init(e,t)});var qE=S("ZodE164",(e,t)=>{ay.init(e,t),De.init(e,t)});var DE=S("ZodJWT",(e,t)=>{cy.init(e,t),De.init(e,t)});var nl=S("ZodNumber",(e,t)=>{Rd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mv(e,r,o,n),e.isFinite=!0},bg({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Qt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Qt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Qt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Qt(e).format??null},{gt(e,t){return this.check(Gu(e,t))},gte(e,t){return this.check(vi(e,t))},min(e,t){return this.check(vi(e,t))},lt(e,t){return this.check(Wu(e,t))},lte(e,t){return this.check(yi(e,t))},max(e,t){return this.check(yi(e,t))},int(e){return this.check(SS(e))},safe(e){return this.check(SS(e))},positive(e){return this.check(Gu(0,e))},nonnegative(e){return this.check(vi(0,e))},negative(e){return this.check(Wu(0,e))},nonpositive(e){return this.check(yi(0,e))},multipleOf(e,t){return this.check(Yu(e,t))},step(e,t){return this.check(Yu(e,t))},finite(){return this}}));function _e(e){return lv(nl,e)}var UE=S("ZodNumberFormat",(e,t)=>{uy.init(e,t),nl.init(e,t)});function SS(e){return dv(UE,e)}var IS=S("ZodBoolean",(e,t)=>{ly.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jv(e,r,o,n)});function ve(e){return mv(IS,e)}var FE=S("ZodNull",(e,t)=>{py.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lv(e,r,o,n)});function am(e){return hv(FE,e)}var VE=S("ZodAny",(e,t)=>{dy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dv(e,r,o,n)});function CS(){return fv(VE)}var BE=S("ZodUnknown",(e,t)=>{my.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uv(e,r,o,n)});function qe(){return gv(BE)}var HE=S("ZodNever",(e,t)=>{hy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qv(e,r,o,n)});function JE(e){return _v(HE,e)}var KE=S("ZodArray",(e,t)=>{ol(),fy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jv(e,r,o,n),e.element=t.element},{min(e,t){return this.check(On(e,t))},nonempty(e){return this.check(On(1,e))},max(e,t){return this.check(Xu(e,t))},length(e,t){return this.check(Qu(e,t))},unwrap(){return this.element}});function T(e,t){return yv(KE,e,t)}var OS=S("ZodObject",(e,t)=>{ol(),yy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kv(e,r,o,n),CT(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Rt(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Mt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Mt(this._zod.def,{catchall:qe()}))},loose(){return this.clone(Mt(this._zod.def,{catchall:qe()}))},strict(){return this.clone(Mt(this._zod.def,{catchall:JE()}))},strip(){return this.clone(Mt(this._zod.def,{catchall:void 0}))},extend(e){return wT(this,e)},safeExtend(e){return $T(this,e)},merge(e){return kT(this,e)},pick(e){return zT(this,e)},omit(e){return xT(this,e)},partial(...e){return _g(ZS,this,e[0])},exactPartial(...e){return _g(MS,this,e[0],"exactPartial")},required(...e){return RT(jS,this,e[0])}});function I(e,t){let r={type:"object",shape:e??{},...B(t)};return new OS(r)}function Ye(e,t){return new OS({type:"object",shape:e,catchall:qe(),...B(t)})}var AS=S("ZodUnion",(e,t)=>{Pd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wv(e,r,o,n),e.options=t.options});function Re(e,t){return new AS({type:"union",options:e,...B(t)})}var WE=S("ZodDiscriminatedUnion",(e,t)=>{AS.init(e,t),vy.init(e,t)});function cm(e,t,r){return new WE({type:"union",options:t,discriminator:e,...B(r)})}var GE=S("ZodIntersection",(e,t)=>{Sy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gv(e,r,o,n)});function sl(e,t){return new GE({type:"intersection",left:e,right:t})}var bS=S("ZodRecord",(e,t)=>{ol(),by.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yv(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Ze(e,t,r){if(!t||!t._zod)return new bS({type:"record",keyType:g(),valueType:e,...B(t)});return new bS({type:"record",keyType:e,valueType:t,...B(r)})}var sm=S("ZodEnum",(e,t)=>{zy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Fv(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new sm({...t,checks:[],...B(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new sm({...t,checks:[],...B(n),entries:s})}});function Rt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new sm({type:"enum",entries:r,...B(t)})}var YE=S("ZodLiteral",(e,t)=>{xy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vv(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V(e,t){return new YE({type:"literal",values:Array.isArray(e)?e:[e],...B(t)})}var XE=S("ZodTransform",(e,t)=>{ol(),wy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hv(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new mi(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(Jo(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(Jo(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function NS(e){return new XE({type:"transform",transform:e})}var ZS=S("ZodOptional",(e,t)=>{Td.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ne(e){return new ZS({type:"optional",innerType:e})}var MS=S("ZodExactOptional",(e,t)=>{$y.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function QE(e){return new MS({type:"optional",innerType:e})}var eI=S("ZodNullable",(e,t)=>{ky.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xv(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function zS(e){return new eI({type:"nullable",innerType:e})}var tI=S("ZodDefault",(e,t)=>{Ry.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tS(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rI(e,t){return new tI({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():sd(t)}})}var oI=S("ZodPrefault",(e,t)=>{Py.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rS(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nI(e,t){return new oI({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():sd(t)}})}var jS=S("ZodNonOptional",(e,t)=>{Ty.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qv(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sI(e,t){return new jS({type:"nonoptional",innerType:e,...B(t)})}var iI=S("ZodCatch",(e,t)=>{Ey.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>oS(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function aI(e,t){return new iI({type:"catch",innerType:e,catchValue:typeof t==="function"?t:zg(t)})}var LS=S("ZodPipe",(e,t)=>{Ed.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nS(e,r,o,n),e.in=t.in,e.out=t.out});function xS(e,t){return new LS({type:"pipe",in:e,out:t})}var cI=S("ZodPreprocess",(e,t)=>{LS.init(e,t),Iy.init(e,t)}),uI=S("ZodReadonly",(e,t)=>{Cy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sS(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function lI(e){return new uI({type:"readonly",innerType:e})}var pI=S("ZodLazy",(e,t)=>{Oy.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>iS(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function qS(e){return new pI({type:"lazy",getter:e})}var dI=S("ZodCustom",(e,t)=>{Ay.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bv(e,r,o,n)});function mI(e,t={}){return vv(dI,e,t)}function hI(e,t){return Sv(e,t)}function um(e,t){return new cI({type:"pipe",in:NS(e),out:t})}var US={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var DS;(function(e){})(DS||(DS={}));function gI(e){return Ku(im,e)}function _I(e){return pv(nl,e)}var zi="2025-11-25";var il=[zi,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],al="io.modelcontextprotocol/related-task",Ko="io.modelcontextprotocol/protocolVersion",Mn="io.modelcontextprotocol/clientInfo",zr="io.modelcontextprotocol/serverInfo",Wo="io.modelcontextprotocol/clientCapabilities",jn="io.modelcontextprotocol/subscriptionId",Ln="io.modelcontextprotocol/logLevel";var Go="2.0";var Fr=qS(()=>Re([g(),_e(),ve(),am(),Ze(g(),Fr),T(Fr)])),Ue=Ze(g(),Fr),cl=T(Fr),qn=Re([g(),_e().int()]),Dn=g(),xi=I({ttl:_e().optional()}),wi=I({taskId:g()}),Un=Ye({progressToken:qn.optional(),[al]:wi.optional()}),et=I({_meta:Un.optional()}),vo=et.extend({task:xi.optional()}),Fe=I({method:g(),params:et.loose().optional()}),lt=I({_meta:Un.optional()}),st=I({method:g(),params:lt.loose().optional()}),Fn=Ye({get[zr](){return xr.optional().catch(void 0)}}),Ve=Ye({_meta:Fn.optional()}),sr=Re([g(),_e().int()]),Vn=I({jsonrpc:V(Go),id:sr,...Fe.shape}).strict(),Bn=I({jsonrpc:V(Go),...st.shape}).strict(),Yo=I({jsonrpc:V(Go),id:sr,result:Ve}).strict(),Xo=I({jsonrpc:V(Go),id:sr.optional(),error:I({code:_e().int(),message:g(),data:qe().optional()})}).strict(),Qo=Re([Vn,Bn,Yo,Xo]),ul=Re([Yo,Xo]),So=Ve.strict(),$i=lt.extend({requestId:sr.optional(),reason:g().optional()}),Hn=st.extend({method:V("notifications/cancelled"),params:$i}),ki=I({src:g(),mimeType:g().optional(),sizes:T(g()).optional(),theme:Rt(["light","dark"]).optional()}),Vr=I({icons:T(ki).optional()}),br=I({name:g(),title:g().optional()}),xr=br.extend({...br.shape,...Vr.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),vI=sl(I({applyDefaults:ve().optional()}),Ue),SI=um((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},sl(I({form:vI.optional(),url:Ue.optional()}),Ue.optional())),ll=Ye({list:Ue.optional(),cancel:Ue.optional(),requests:Ye({sampling:Ye({createMessage:Ue.optional()}).optional(),elicitation:Ye({create:Ue.optional()}).optional()}).optional()}),pl=Ye({list:Ue.optional(),cancel:Ue.optional(),requests:Ye({tools:Ye({call:Ue.optional()}).optional()}).optional()}),Ri=I({experimental:Ze(g(),Ue).optional(),sampling:I({context:Ue.optional(),tools:Ue.optional()}).optional(),elicitation:SI.optional(),roots:I({listChanged:ve().optional()}).optional(),tasks:ll.optional(),extensions:Ze(g(),Ue).optional()}),Pi=et.extend({protocolVersion:g(),capabilities:Ri,clientInfo:xr}),Ti=Fe.extend({method:V("initialize"),params:Pi}),Jn=I({experimental:Ze(g(),Ue).optional(),logging:Ue.optional(),completions:Ue.optional(),prompts:I({listChanged:ve().optional()}).optional(),resources:I({subscribe:ve().optional(),listChanged:ve().optional()}).optional(),tools:I({listChanged:ve().optional()}).optional(),tasks:pl.optional(),extensions:Ze(g(),Ue).optional()}),Ei=Ve.extend({protocolVersion:g(),capabilities:Jn,serverInfo:xr,instructions:g().optional()}),Ii=st.extend({method:V("notifications/initialized"),params:lt.optional()}),Ci=Fe.extend({method:V("server/discover"),params:et.optional()}),bo=Ve.extend({supportedVersions:T(g()),capabilities:Jn,instructions:g().optional()}),Kn=Fe.extend({method:V("ping"),params:et.optional()}),Oi=I({progress:_e(),total:Ne(_e()),message:Ne(g())}),Ai=I({...lt.shape,...Oi.shape,progressToken:qn}),Wn=st.extend({method:V("notifications/progress"),params:Ai}),Ni=et.extend({cursor:Dn.optional()}),Br=Fe.extend({params:Ni.optional()}),Hr=Ve.extend({nextCursor:Dn.optional()}),Gn=I({uri:g(),mimeType:Ne(g()),_meta:Ze(g(),qe()).optional()}),Yn=Gn.extend({text:g()}),lm=g().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xn=Gn.extend({blob:lm}),Jr=Rt(["user","assistant"]),wr=I({audience:T(Jr).optional(),priority:_e().min(0).max(1).optional(),lastModified:gI({offset:!0}).optional()}),Qn=I({...br.shape,...Vr.shape,uri:g(),description:Ne(g()),mimeType:Ne(g()),size:Ne(_e()),annotations:wr.optional(),_meta:Ne(Ye({}))}),Zi=I({...br.shape,...Vr.shape,uriTemplate:g(),description:Ne(g()),mimeType:Ne(g()),annotations:wr.optional(),_meta:Ne(Ye({}))}),Mi=Br.extend({method:V("resources/list")}),ji=Hr.extend({resources:T(Qn)}),Li=Br.extend({method:V("resources/templates/list")}),qi=Hr.extend({resourceTemplates:T(Zi)}),en=et.extend({uri:g()}),Di=en,Ui=Fe.extend({method:V("resources/read"),params:Di}),Fi=Ve.extend({contents:T(Re([Yn,Xn]))}),Vi=st.extend({method:V("notifications/resources/list_changed"),params:lt.optional()}),Bi=en,Hi=Fe.extend({method:V("resources/subscribe"),params:Bi}),Ji=en,Ki=Fe.extend({method:V("resources/unsubscribe"),params:Ji}),es=I({toolsListChanged:ve().optional(),promptsListChanged:ve().optional(),resourcesListChanged:ve().optional(),resourceSubscriptions:T(g()).optional()}),Wi=et.extend({notifications:es}),Gi=Fe.extend({method:V("subscriptions/listen"),params:Wi}),Yi=lt.extend({notifications:es}),Xi=st.extend({method:V("notifications/subscriptions/acknowledged"),params:Yi}),Qi=Fn.extend({[jn]:sr}),ea=Ve.extend({_meta:Qi}),ta=lt.extend({uri:g()}),ra=st.extend({method:V("notifications/resources/updated"),params:ta}),oa=I({name:g(),description:Ne(g()),required:Ne(ve())}),na=I({...br.shape,...Vr.shape,description:Ne(g()),arguments:Ne(T(oa)),_meta:Ne(Ye({}))}),sa=Br.extend({method:V("prompts/list")}),ia=Hr.extend({prompts:T(na)}),aa=et.extend({name:g(),arguments:Ze(g(),g()).optional()}),ca=Fe.extend({method:V("prompts/get"),params:aa}),tn=I({type:V("text"),text:g(),annotations:wr.optional(),_meta:Ze(g(),qe()).optional()}),rn=I({type:V("image"),data:lm,mimeType:g(),annotations:wr.optional(),_meta:Ze(g(),qe()).optional()}),on=I({type:V("audio"),data:lm,mimeType:g(),annotations:wr.optional(),_meta:Ze(g(),qe()).optional()}),ua=I({type:V("tool_use"),name:g(),id:g(),input:Ze(g(),qe()),_meta:Ze(g(),qe()).optional()}),nn=I({type:V("resource"),resource:Re([Yn,Xn]),annotations:wr.optional(),_meta:Ze(g(),qe()).optional()}),sn=Qn.extend({type:V("resource_link")}),$r=Re([tn,rn,on,sn,nn]),la=I({role:Jr,content:$r}),pa=Ve.extend({description:g().optional(),messages:T(la)}),da=st.extend({method:V("notifications/prompts/list_changed"),params:lt.optional()}),ma=I({title:g().optional(),readOnlyHint:ve().optional(),destructiveHint:ve().optional(),idempotentHint:ve().optional(),openWorldHint:ve().optional()}),ha=I({taskSupport:Rt(["required","optional","forbidden"]).optional()}),zo=I({...br.shape,...Vr.shape,description:g().optional(),inputSchema:I({type:V("object"),properties:Ze(g(),Fr).optional(),required:T(g()).optional()}).catchall(qe()),outputSchema:Ye({$schema:g().optional()}).optional(),annotations:ma.optional(),execution:ha.optional(),_meta:Ze(g(),qe()).optional()}),fa=Br.extend({method:V("tools/list")}),ga=Hr.extend({tools:T(zo)}),xo=Ve.extend({content:T($r).default([]),structuredContent:qe().optional(),isError:ve().optional()}),dl=xo.or(Ve.extend({toolResult:qe()})),_a=vo.extend({name:g(),arguments:Ze(g(),qe()).optional()}),ya=Fe.extend({method:V("tools/call"),params:_a}),va=st.extend({method:V("notifications/tools/list_changed"),params:lt.optional()}),Sa=I({autoRefresh:ve().default(!0),debounceMs:_e().int().nonnegative().default(300)}),ts=Rt(["debug","info","notice","warning","error","critical","alert","emergency"]),ba=et.extend({level:ts}),za=Fe.extend({method:V("logging/setLevel"),params:ba}),xa=lt.extend({level:ts,logger:g().optional(),data:qe()}),wa=st.extend({method:V("notifications/message"),params:xa}),$a=I({name:g().optional()}),ka=I({hints:T($a).optional(),costPriority:_e().min(0).max(1).optional(),speedPriority:_e().min(0).max(1).optional(),intelligencePriority:_e().min(0).max(1).optional()}),Ra=I({mode:Rt(["auto","required","none"]).optional()}),Pa=I({type:V("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:T($r),structuredContent:qe().optional(),isError:ve().optional(),_meta:Ze(g(),qe()).optional()}),Ta=cm("type",[tn,rn,on]),yo=cm("type",[tn,rn,on,ua,Pa]),Ea=I({role:Jr,content:Re([yo,T(yo)]),_meta:Ze(g(),qe()).optional()}),Ia=vo.extend({messages:T(Ea),modelPreferences:ka.optional(),systemPrompt:g().optional(),includeContext:Rt(["none","thisServer","allServers"]).optional(),temperature:_e().optional(),maxTokens:_e().int(),stopSequences:T(g()).optional(),metadata:Ue.optional(),tools:T(zo).optional(),toolChoice:Ra.optional()}),Ca=Fe.extend({method:V("sampling/createMessage"),params:Ia}),Oa=Ve.extend({model:g(),stopReason:Ne(Rt(["endTurn","stopSequence","maxTokens"]).or(g())),role:Jr,content:Ta}),Aa=Ve.extend({model:g(),stopReason:Ne(Rt(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Jr,content:Re([yo,T(yo)])}),rs=I({type:V("boolean"),title:g().optional(),description:g().optional(),default:ve().optional()}),an=I({type:V("string"),title:g().optional(),description:g().optional(),minLength:_e().optional(),maxLength:_e().optional(),format:Rt(["email","uri","date","date-time"]).optional(),default:g().optional()}),cn=I({type:Rt(["number","integer"]),title:g().optional(),description:g().optional(),minimum:_e().optional(),maximum:_e().optional(),default:_e().optional()}),os=I({type:V("string"),title:g().optional(),description:g().optional(),enum:T(g()),default:g().optional()}),ns=I({type:V("string"),title:g().optional(),description:g().optional(),oneOf:T(I({const:g(),title:g()})),default:g().optional()}),ss=I({type:V("string"),title:g().optional(),description:g().optional(),enum:T(g()),enumNames:T(g()).optional(),default:g().optional()}),Na=Re([os,ns]),is=I({type:V("array"),title:g().optional(),description:g().optional(),minItems:_e().optional(),maxItems:_e().optional(),items:I({type:V("string"),enum:T(g())}),default:T(g()).optional()}),as=I({type:V("array"),title:g().optional(),description:g().optional(),minItems:_e().optional(),maxItems:_e().optional(),items:I({anyOf:T(I({const:g(),title:g()}))}),default:T(g()).optional()}),Za=Re([is,as]),Ma=Re([ss,Na,Za]),cs=Re([Ma,rs,an,cn]),un=vo.extend({mode:V("form").optional(),message:g(),requestedSchema:I({type:V("object"),properties:Ze(g(),cs),required:T(g()).optional()}).catchall(qe())}),ja=vo.extend({mode:V("url"),message:g(),elicitationId:g(),url:g().url()}),La=Re([un,ja]),qa=Fe.extend({method:V("elicitation/create"),params:La}),Da=lt.extend({elicitationId:g()}),Ua=st.extend({method:V("notifications/elicitation/complete"),params:Da}),Fa=Ve.extend({action:Rt(["accept","decline","cancel"]),content:um((e)=>e===null?void 0:e,Ze(g(),Re([g(),_e(),ve(),T(g())])).optional())}),Va=I({type:V("ref/resource"),uri:g()}),Ba=I({type:V("ref/prompt"),name:g()}),Ha=et.extend({ref:Re([Ba,Va]),argument:I({name:g(),value:g()}),context:I({arguments:Ze(g(),g()).optional()}).optional()}),Ja=Fe.extend({method:V("completion/complete"),params:Ha}),Ka=Ve.extend({completion:Ye({values:T(g()).max(100),total:Ne(_e().int()),hasMore:Ne(ve())})}),Wa=I({uri:g().startsWith("file://"),name:g().optional(),_meta:Ze(g(),qe()).optional()}),Ga=Fe.extend({method:V("roots/list"),params:et.optional()}),Ya=Ve.extend({roots:T(Wa)}),Xa=st.extend({method:V("notifications/roots/list_changed"),params:lt.optional()}),ml=Ye({ttl:_e().optional(),pollInterval:_e().optional()}),Qa=Rt(["working","input_required","completed","failed","cancelled"]),Kr=I({taskId:g(),status:Qa,ttl:Re([_e(),am()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:Ne(_e()),statusMessage:Ne(g())}),hl=Ve.extend({task:Kr}),ec=lt.merge(Kr),fl=st.extend({method:V("notifications/tasks/status"),params:ec}),gl=Fe.extend({method:V("tasks/get"),params:et.extend({taskId:g()})}),_l=Ve.merge(Kr),yl=Fe.extend({method:V("tasks/result"),params:et.extend({taskId:g()})}),vl=Ve.loose(),Sl=Br.extend({method:V("tasks/list")}),bl=Hr.extend({tasks:T(Kr)}),zl=Fe.extend({method:V("tasks/cancel"),params:et.extend({taskId:g()})}),xl=Ve.merge(Kr),wl=Re([Kn,Ti,Ci,Ja,za,ca,sa,Mi,Li,Ui,Hi,Ki,Gi,ya,fa]),$l=Re([Hn,Wn,Ii,Xa]),kl=Re([So,Oa,Aa,Fa,Ya]),Rl=Re([Kn,Ca,qa,Ga]),Pl=Re([Hn,Wn,wa,ra,Vi,va,da,Xi,Ua]),Tl=Re([So,Ei,bo,Ka,pa,ia,ji,qi,Fi,xo,ga,ea]);var tt=ES().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:US.custom,message:"URL must be parseable",fatal:!0}),ld}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),tc=Ye({resource:g().url(),authorization_servers:T(tt).optional(),jwks_uri:g().url().optional(),scopes_supported:T(g()).optional(),bearer_methods_supported:T(g()).optional(),resource_signing_alg_values_supported:T(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:ve().optional(),authorization_details_types_supported:T(g()).optional(),dpop_signing_alg_values_supported:T(g()).optional(),dpop_bound_access_tokens_required:ve().optional()}),us=Ye({issuer:g(),authorization_endpoint:tt,token_endpoint:tt,registration_endpoint:tt.optional(),scopes_supported:T(g()).optional(),response_types_supported:T(g()),response_modes_supported:T(g()).optional(),grant_types_supported:T(g()).optional(),token_endpoint_auth_methods_supported:T(g()).optional(),token_endpoint_auth_signing_alg_values_supported:T(g()).optional(),service_documentation:tt.optional(),revocation_endpoint:tt.optional(),revocation_endpoint_auth_methods_supported:T(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:T(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:T(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:T(g()).optional(),code_challenge_methods_supported:T(g()).optional(),client_id_metadata_document_supported:ve().optional(),authorization_response_iss_parameter_supported:ve().optional().catch(void 0),dpop_signing_alg_values_supported:T(g()).optional()}),rc=Ye({issuer:g(),authorization_endpoint:tt,token_endpoint:tt,userinfo_endpoint:tt.optional(),jwks_uri:tt,registration_endpoint:tt.optional(),scopes_supported:T(g()).optional(),response_types_supported:T(g()),response_modes_supported:T(g()).optional(),grant_types_supported:T(g()).optional(),acr_values_supported:T(g()).optional(),subject_types_supported:T(g()),id_token_signing_alg_values_supported:T(g()),id_token_encryption_alg_values_supported:T(g()).optional(),id_token_encryption_enc_values_supported:T(g()).optional(),userinfo_signing_alg_values_supported:T(g()).optional(),userinfo_encryption_alg_values_supported:T(g()).optional(),userinfo_encryption_enc_values_supported:T(g()).optional(),request_object_signing_alg_values_supported:T(g()).optional(),request_object_encryption_alg_values_supported:T(g()).optional(),request_object_encryption_enc_values_supported:T(g()).optional(),token_endpoint_auth_methods_supported:T(g()).optional(),token_endpoint_auth_signing_alg_values_supported:T(g()).optional(),display_values_supported:T(g()).optional(),claim_types_supported:T(g()).optional(),claims_supported:T(g()).optional(),service_documentation:g().optional(),claims_locales_supported:T(g()).optional(),ui_locales_supported:T(g()).optional(),claims_parameter_supported:ve().optional(),request_parameter_supported:ve().optional(),request_uri_parameter_supported:ve().optional(),require_request_uri_registration:ve().optional(),op_policy_uri:tt.optional(),op_tos_uri:tt.optional(),client_id_metadata_document_supported:ve().optional(),authorization_response_iss_parameter_supported:ve().optional().catch(void 0)}),oc=I({...rc.shape,...us.pick({code_challenge_methods_supported:!0}).shape}),ls=I({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:_I().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),nc=I({issued_token_type:V("urn:ietf:params:oauth:token-type:id-jag"),access_token:g(),token_type:g().optional(),expires_in:_e().optional(),scope:g().optional()}).strip(),ps=I({error:g(),error_description:g().optional(),error_uri:g().optional()}),pm=tt.optional().or(V("").transform(()=>{return})),sc=I({redirect_uris:T(tt),token_endpoint_auth_method:g().optional(),grant_types:T(g()).optional(),response_types:T(g()).optional(),application_type:g().optional(),client_name:g().optional(),client_uri:tt.optional(),logo_uri:pm,scope:g().optional(),contacts:T(g()).optional(),tos_uri:pm,policy_uri:g().optional(),jwks_uri:tt.optional(),jwks:CS().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),ic=I({client_id:g(),client_secret:g().optional(),client_id_issued_at:_e().optional(),client_secret_expires_at:_e().optional(),issuer:g().optional().catch(void 0)}).strip(),ac=sc.merge(ic),El=I({error:g(),error_description:g().optional()}).strip(),Il=I({token:g(),token_type_hint:g().optional()}).strip();function uc(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function mm(e,t="|"){return e.map((r)=>gm(r)).join(t)}function lc(e,t){if(typeof t==="bigint")return t.toString();return t}class tb{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function pc(e){return new tb(e)}function rb(e){return e===null||e===void 0}function Cl(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ob(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}var eb=Symbol("evaluating");function nb(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===eb)return;if(o===void 0)o=eb,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Lt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function dc(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Wr(e){return dc(e._zod.def)??e._zod.def.shape}function sb(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return Lt(this,t,o),o},enumerable:!0,configurable:!0})}function ib(e,t,r){if(t in e)Lt(e,t,r);else e[t]=r}function ln(e,t,r,o){let n=Wr(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);if(!i.enumerable)continue;if(i.get)sb(e,s,()=>{let a=t._zod.def.shape[s];return o?o(a,s):a});else ib(e,s,o?o(i.value,s):i.value)}}function bI(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);if(!o.enumerable)continue;if(o.get)sb(e,r,()=>t[r]);else ib(e,r,o.value)}}function qt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ab(e){return JSON.stringify(e)}function cb(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var hm="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ds(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ub=pc(()=>{if(Pt.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function pn(e){if(ds(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(ds(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function fm(e){if(pn(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var lb=new Set(["string","number","symbol"]);function $o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function J(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function gm(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function pb(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ol=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),_m={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zI(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return ln(s,e,Al(e,t)),kr(e,qt(r,{shape:s,checks:[]}))}function Al(e,t){let r=Wr(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw Error(`Unrecognized key: "${String(n)}"`);if(t[n])o.push(n)}return o}function xI(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Al(e,t)),i={};return ln(i,e,Reflect.ownKeys(Wr(e)).filter((a)=>!s.has(a))),kr(e,qt(r,{shape:i,checks:[]}))}function wI(e,t){if(!pn(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=Wr(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return kr(e,qt(e._zod.def,{shape:db(e,t)}))}function db(e,t){let r={};return ln(r,e,Reflect.ownKeys(Wr(e))),bI(r,t),r}function $I(e,t){if(!pn(t))throw Error("Invalid input to safeExtend: expected a plain object");return kr(e,qt(e._zod.def,{shape:db(e,t)}))}function kI(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ln(r,e,Reflect.ownKeys(Wr(e))),ln(r,t,Reflect.ownKeys(Wr(t)));let o=qt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return kr(e,o)}function mb(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${o}() cannot be used on object schemas containing refinements`);let a=r?new Set(Al(t,r)):void 0,c={};return ln(c,t,Reflect.ownKeys(Wr(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),kr(t,qt(t._zod.def,{shape:c,checks:[]}))}function RI(e,t,r){let o=r?new Set(Al(t,r)):void 0,n={};return ln(n,t,Reflect.ownKeys(Wr(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),kr(t,qt(t._zod.def,{shape:n}))}function Rr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function hb(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function ko(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function cc(e){return typeof e==="string"?e:e?.message}function ym(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function Pr(e,t,r){var o;let n=e.inst?._zod?.traits;if(n?.has("$ZodType"))if(n.has("$ZodCheck"))(o=e).schema??(o.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:cc(e.inst?._zod.def?.error?.(e))??cc(s?.(e))??cc(t?.error?.(e))??cc(r.customError?.(e))??cc(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var PI=/[\uD800-\uDBFF]/;function Nl(e){let t=e.length;if(!PI.test(e))return t;let r=t;for(let o=0;o<t-1;o++)if((e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320)r--,o++;return r}function Zl(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function fb(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function dn(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function gb(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);if(o.get)Object.defineProperty(e,r,{...o,enumerable:!1});else TI(e,r,o.value)}}function Gr(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Ml(e,t,r){return Gr(e,t,r,!1)}function _b(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Gr(this,r,o(this))},set(n){Gr(this,r,n)}})}return t}function TI(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Gr(this,t,r.bind(this))},set(o){Gr(this,t,o)}})}function EI(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var dm,wo=!1,II={configurable:!0,get(){wo=!0;return}};function he(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&dm!==e._zod){dm=void 0;return}dm=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,II);let n=wo;wo=!1;try{let s=r(this);if(wo)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return wo=wo||n,s}catch(s){throw delete this[t],wo=wo||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function CI(e,t,r,o){let n=EI(e,t);if(!n)return;Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var OI="~constantCatch";function yb(e){let t=()=>e;return t[OI]=!0,t}var vb;var vm={value:void 0,enumerable:!1},Sb="captureStackTrace"in Error?Error:null;function AI(e){let t=Sb;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Sb=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,o){let n={};function s(d){this.def=d,this.constr=p,this.traits=new Set}s.prototype=n;let i=r,a=i&&new WeakSet;function c(d,h){if(!d._zod){vm.value=new s(h);try{Object.defineProperty(d,"_zod",vm)}finally{vm.value=void 0}}else if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,h),a){let _=Object.getPrototypeOf(d),v=d._zod.constr.prototype,k=_;while(k&&k!==v)k=Object.getPrototypeOf(k);let Z=k??_;if(!a.has(Z))a.add(Z),gb(Z,i)}let f=p.prototype;for(let _ in f){if(!Object.prototype.hasOwnProperty.call(f,_))continue;if(!(_ in d))d[_]=f[_].bind(d)}}let u=o?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function p(d){let h=o?.Parent?AI(l):this;c(h,d);let f=h._zod.deferred;if(f){for(let v of f)v();h._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(h);return h}return Object.defineProperty(p,"init",{value:c}),Object.defineProperty(p,Symbol.hasInstance,{value:(d)=>{if(o?.Parent&&d instanceof o.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class Tr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mc extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(vb=globalThis).__zod_globalConfig??(vb.__zod_globalConfig={});var Pt=globalThis.__zod_globalConfig;function Dt(e){if(e)Object.assign(Pt,e);return Pt}function NI(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,lc,2)),e.message}function ZI(e){this._zod.message=e}var MI={get:NI,set:ZI,enumerable:!0,configurable:!0},bm={value:void 0,enumerable:!1},bb=new WeakSet([Object.prototype,Error.prototype]),zb=(e,t)=>{e.name="$ZodError",bm.value=t,Object.defineProperty(e,"issues",bm),bm.value=void 0,Object.defineProperty(e,"message",MI);let r=Object.getPrototypeOf(e);if(!bb.has(r))bb.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}})},xb=b("$ZodError",zb),qq=b("$ZodError",zb,void 0,{Parent:Error});function jI(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function wb(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)jI(r,n.path[0],()=>[]).push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function $b(e,t=(r)=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;while(u<a.length){let l=a[u],p=u===a.length-1;if(l==="_errors"){if(p)c._errors.push(t(i));u++;continue}if(!Object.prototype.hasOwnProperty.call(c,l))Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[l];if(p)d._errors.push(t(i));c=d,u++}}}};return o(e),r}function jl(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ll=(e)=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new Tr;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>Pr(u,i,Dt())));throw hm(c,s?.callee??t),c}return a.value};return t};var ql=(e)=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},a=r._zod.run({value:o,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map((u)=>Pr(u,i,Dt())));throw hm(c,s?.callee??t),c}return a.value};return t};var Dl=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Tr;return s.issues.length?kb(e,s.issues,n):{success:!0,data:s.value}};function kb(e,t,r){let o;return{success:!1,get error(){if(!o)o=new e(t.map((n)=>Pr(n,r,Dt()))),t=void 0,r=void 0;return o},set error(n){o=n,t=void 0,r=void 0}}}var Ul=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?kb(e,s.issues,n):{success:!0,data:s.value}};var LI=Symbol.for("zod.compile.invalid"),qI=Symbol.for("zod.compile.fallback"),zm=(e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==LI)return!0;if(o.definite===!0&&r===void 0)return!1}return DI(e,t,r)};function DI(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n)o[qI]=!0,s=n({value:t,issues:[]},o);else s=e._zod.run({value:t,issues:[]},o);if(s instanceof Promise)throw new Tr;return s.issues.length===0}var xm=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);if(n instanceof Promise)n=await n;return n.issues.length===0},Rb=(e)=>{let t=Ll(e),r=(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,a,jl(r,i))};return r};var Pb=(e)=>{let t=Ll(e),r=(o,n,s,i)=>t(o,n,s,jl(r,i));return r};var Tb=(e)=>{let t=ql(e),r=async(o,n,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,a,jl(r,i))};return r};var Eb=(e)=>{let t=ql(e),r=async(o,n,s,i)=>await t(o,n,s,jl(r,i));return r};var Ib=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Dl(e)(t,r,n)};var Cb=(e)=>(t,r,o)=>Dl(e)(t,r,o);var Ob=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ul(e)(t,r,n)};var Ab=(e)=>async(t,r,o)=>Ul(e)(t,r,o);var Nb=/^[cC][0-9a-z]{6,}$/,Zb=/^[0-9a-z]+$/,Mb=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,jb=/^[0-9a-vA-V]{20}$/,Lb=/^[A-Za-z0-9]{27}$/,qb=/^[a-zA-Z0-9_-]{21}$/;function Db(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ub=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Fb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$m=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Vb=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var UI="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Bb(){return new RegExp(UI,"u")}var Hb=/^(?:(?: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])$/,Jb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Kb=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Wb=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yb=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Xb=/^https?$/,Qb=/^\+[1-9]\d{6,14}$/;var ez="(?:(?:\\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])))";function FI(e){return new RegExp(`^${e}$`)}var tz=FI(ez);function wm(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function rz(e){return new RegExp(`^${wm(e)}$`)}function oz(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${wm({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${wm({precision:e.precision})}`:r;return new RegExp(`^${ez}T(?:${o})$`)}var nz=/^[\s\S]{0,}$/;var km=/^-?\d+$/,hc=/^-?\d+(?:\.\d+)?$/,sz=/^(?:true|false)$/i,iz=/^null$/i;var az=/^[^A-Z]*$/,cz=/^[^a-z]*$/;var it=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Rm=(e)=>{let t=e.value;return!rb(t)&&t.length!==void 0},Fl={number:"number",bigint:"bigint",object:"date"},Pm=b("$ZodCheckLessThan",(e,t)=>{it.init(e,t);let r=Fl[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:Fl[typeof o.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tm=b("$ZodCheckGreaterThan",(e,t)=>{it.init(e,t);let r=Fl[typeof t.value];e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:Fl[typeof o.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uz=b("$ZodCheckMultipleOf",(e,t)=>{it.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):ob(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),lz=b("$ZodCheckNumberFormat",(e,t)=>{it.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Ol[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var pz=b("$ZodCheckMaxLength",(e,t)=>{var r;it.init(e,t),(r=e._zod.def).when??(r.when=Rm),e._zod.check=(o)=>{let n=o.value,s=n.length;if((typeof n==="string"&&s>t.maximum?Nl(n):s)<=t.maximum)return;let a=Zl(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dz=b("$ZodCheckMinLength",(e,t)=>{var r;it.init(e,t),(r=e._zod.def).when??(r.when=Rm),e._zod.check=(o)=>{let n=o.value,s=n.length;if((typeof n==="string"&&s>=t.minimum&&s<t.minimum*2?Nl(n):s)>=t.minimum)return;let a=Zl(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),mz=b("$ZodCheckLengthEquals",(e,t)=>{var r;it.init(e,t),(r=e._zod.def).when??(r.when=Rm),e._zod.check=(o)=>{let n=o.value,s=n.length,i=typeof n==="string"&&s>=t.length&&s<=t.length*2?Nl(n):s;if(i===t.length)return;let a=Zl(n),c=i>t.length;o.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),gc=b("$ZodCheckStringFormat",(e,t)=>{var r,o;if(it.init(e,t),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),hz=b("$ZodCheckRegex",(e,t)=>{gc.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fz=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=az),gc.init(e,t)}),gz=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cz),gc.init(e,t)}),_z=b("$ZodCheckIncludes",(e,t)=>{it.init(e,t);let r=$o(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),yz=b("$ZodCheckStartsWith",(e,t)=>{it.init(e,t);let r=new RegExp(`^${$o(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),vz=b("$ZodCheckEndsWith",(e,t)=>{it.init(e,t);let r=new RegExp(`.*${$o(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Sz=b("$ZodCheckOverwrite",(e,t)=>{it.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Em{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
189
+ `).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
190
+ ${t.join(`
191
+ `)}
192
+ };`)(...Object.values(this.closed))}}var zz={major:4,minor:6,patch:5};var Pe=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=zz;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=Rr(a),p;for(let d of c){if(d._zod.def.when){if(hb(a))continue;if(!d._zod.def.when(a))continue}else if(l)continue;let h=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&u?.async===!1)throw new Tr;if(p||f instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await f,a.issues.length===h)return;if(ym(a.issues,h,e),!l)l=Rr(a,h)});else{if(a.issues.length===h)continue;if(ym(a.issues,h,e),!l)l=Rr(a,h)}}if(p)return p.then(()=>a);return a},i=(a,c,u)=>{if(Rr(a))return a.aborted=!0,a;let l=s(c,n,u);if(l instanceof Promise){if(u.async===!1)throw new Tr;return l.then((p)=>e._zod.parse(p,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(l instanceof Promise)return l.then((p)=>i(p,a,c));return i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Tr;return u.then((l)=>s(l,n,c))}return s(u,n,c)}}},{get "~standard"(){return Ml(this,"~standard",Cm(this))},set "~standard"(e){Gr(this,"~standard",e)}}),Oz=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>Pr(r,t,Dt()))}:{value:e.value};async function VI(e,t){let r={async:!0};return Oz(await e._zod.run({value:t,issues:[]},r),r)}function Cm(e){return{validate:(t)=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Oz(o,r)}catch(o){}return VI(e,t)},vendor:"zod",version:1}}var Jl=b("$ZodString",(e,t)=>{Pe.init(e,t),e._zod.pattern=t.pattern??nz,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ie=b("$ZodStringFormat",(e,t)=>{gc.init(e,t),Jl.init(e,t)}),Az=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fb),Ie.init(e,t)}),Nz=b("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$m(o))}else t.pattern??(t.pattern=$m());Ie.init(e,t)}),Zz=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Vb),Ie.init(e,t)}),Mz=1,Bl=2;function jz(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function BI(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return jz(e)||Bl;return HI(e,t)}function HI(e,t){if(!t.normalize&&t.protocol?.source===Xb.source&&!/^https?:\/\//i.test(e))return Mz;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Bl}return new URL(e)}catch{return Bl}}var JI=/[\t\n\r]/g;function xz(e){return e.replace(JI,"")}function KI(e,t){return t.lastIndex=0,t.test(e.hostname)}function WI(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Lz=b("$ZodURL",(e,t)=>{Ie.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=BI(o,t);if(n===Mz){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Bl){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=xz(o);return}if(t.hostname&&!KI(n,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!WI(n,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?n.href:xz(o);return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),qz=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Bb()),Ie.init(e,t)}),Dz=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?qb:Db(t.length)),Ie.init(e,t)}),Uz=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Nb),Ie.init(e,t)}),Fz=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Zb),Ie.init(e,t)}),Vz=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Mb),Ie.init(e,t)}),Bz=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jb),Ie.init(e,t)}),Hz=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lb),Ie.init(e,t)}),Jz=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=oz(t)),Ie.init(e,t)}),Kz=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tz),Ie.init(e,t)}),Wz=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=rz(t)),Ie.init(e,t)}),Gz=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ub),Ie.init(e,t)}),Yz=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Hb),Ie.init(e,t)}),GI=/^[0-9a-fA-F:.]+$/;function Xz(e){if(!GI.test(e))return!1;return jz(`http://[${e}]`)}var Qz=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jb),Ie.init(e,t),e._zod.check=(r)=>{if(!Xz(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var ex=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Kb),Ie.init(e,t)});function YI(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);if(`${n}`!==o)return!1;if(n<0||n>128)return!1;return Xz(r)}var tx=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Wb),Ie.init(e,t),e._zod.check=(r)=>{if(!YI(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function rx(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Om=/^[0-9a-zA-Z+/]*={0,2}$/,ox=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Om),Ie.init(e,t),e._zod.check=(r)=>{if(rx(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Kl=/^[A-Za-z0-9_-]*$/;function XI(e){if(!Kl.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return rx(r)}var nx=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Kl),Ie.init(e,t),e._zod.check=(r)=>{if(XI(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),sx=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Qb),Ie.init(e,t)});function QI(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var ix=b("$ZodJWT",(e,t)=>{Ie.init(e,t),e._zod.check=(r)=>{if(QI(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Am=b("$ZodNumber",(e,t)=>{Pe.init(e,t),e._zod.pattern=hc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?String(n):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),ax=b("$ZodNumberFormat",(e,t)=>{lz.init(e,t),Am.init(e,t)}),cx=b("$ZodBoolean",(e,t)=>{Pe.init(e,t),e._zod.pattern=sz,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var ux=b("$ZodNull",(e,t)=>{Pe.init(e,t),e._zod.pattern=iz,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var lx=b("$ZodUnknown",(e,t)=>{Pe.init(e,t),e._zod.parse=(r)=>r}),px=b("$ZodNever",(e,t)=>{Pe.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function wz(e,t,r){if(e.issues.length)t.issues.push(...ko(r,e.issues));t.value[r]=e.value}var dx=b("$ZodArray",(e,t)=>{Pe.init(e,t);let r=Pt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],a=n?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},n);if(l instanceof Promise)i.push(l.then((p)=>wz(p,o,c)));else if(wz(l,o,c),a&&l.issues.length!==0&&Rr(l))break}if(i.length)return Promise.all(i).then(()=>o);return o}});function Hl(e,t,r,o,n,s){let i=r in o,a=s==="optional";if(!i&&a&&n==="optional")return;if(e.issues.length){if(n!==void 0&&a&&!i)return;t.issues.push(...ko(r,e.issues))}if(!i&&n===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||n==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var eC=[];function mx(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:eC,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=pb(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function hx(e,t,r,o,n,s,i){let a=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,{optin:p,optout:d}=u,h=0;for(let f in t){if(i&&r.issues.length!==h){if(Rr(r,h))break;h=r.issues.length}if(c.has(f))continue;if(f==="__proto__"){if(l==="never")a.push(f);continue}if(l==="never"){a.push(f);continue}let _=u.run({value:t[f],issues:[]},o);if(_ instanceof Promise)e.push(_.then((v)=>Hl(v,r,f,t,p,d)));else Hl(_,r,f,t,p,d)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var tC=b("$ZodObject",(e,t)=>{Pe.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let l={...o};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=pc(()=>mx(t));he(e,"propValues",(u)=>{let l=u.def.shape,p={};for(let d in l){let h=l[d]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(p,d))Lt(p,d,new Set);for(let f of h.values)p[d].add(f);if(h.optin!==void 0)p[d].add(void 0)}}return p});let s=ds,i=t.catchall,a,c=Pt.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=n.value);let p=u.value;if(!s(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],h=a.shape,f=l?.abortEarly,_=u.issues.length;for(let v of a.allKeys){if(f&&u.issues.length!==_){if(Rr(u,_))break;_=u.issues.length}if(v==="__proto__")continue;let k=h[v],Z=k._zod.optin,E=k._zod.optout,ee=k._zod.run({value:p[v],issues:[]},l);if(ee instanceof Promise)d.push(ee.then((G)=>Hl(G,u,v,p,Z,E)));else Hl(ee,u,v,p,Z,E)}if(!i)return d.length?Promise.all(d).then(()=>u):u;return hx(d,p,u,l,n.value,e,f===!0)}}),fx=b("$ZodObjectJIT",(e,t)=>{tC.init(e,t);let r=e._zod.parse,o=pc(()=>mx(t)),n=Pt.memoizer,s=(h)=>{let f=o.value,_=f.symbolKeys,v=new Em(["payload","ctx"],{shape:h,inst:e,memo:n,syms:_}),k=(G)=>`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`,Z=(G,P)=>`
193
+ let ${G}_ab = false;
194
+ for (let i = 0; i < ${G}.issues.length; i++) {
195
+ const iss = ${G}.issues[i];
196
+ iss.path = iss.path ? [${P}, ...iss.path] : [${P}];
197
+ payload.issues.push(iss);
198
+ if (iss.continue !== true) ${G}_ab = true;
199
+ }
200
+ if (${G}_ab && ctx && ctx.abortEarly) {
201
+ payload.value = newResult;
202
+ return payload;
203
+ }`;v.write("const input = payload.value;");let E=Object.create(null),ee=0;for(let G of f.allKeys)E[G]=`key_${ee++}`;v.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let G of f.allKeys){if(G==="__proto__")continue;let P=E[G],ae=typeof G==="symbol"?`syms[${_.indexOf(G)}]`:ab(G),We=`${ae} in input`,$e=h[G],Xe=$e?._zod?.optin,ot=Xe!==void 0,Vt=$e?._zod?.optout==="optional";if(v.write(`const ${P} = ${k(ae)};`),ot&&Vt){let Bt=Xe==="optional"?`${P}_present`:`${P}.value !== undefined || ${P}_present`;v.write(`
204
+ const ${P}_present = ${We};
205
+ if (!${P}.issues.length || ${P}_present) {
206
+ if (${P}.issues.length) {${Z(P,ae)}
207
+ }
208
+
209
+ if (${Bt}) {
210
+ newResult[${ae}] = ${P}.value;
211
+ }
212
+ }
213
+
214
+ `)}else if(!ot)v.write(`
215
+ const ${P}_present = ${We};
216
+ if (${P}.issues.length) {${Z(P,ae)}
217
+ }
218
+ if (!${P}_present && !${P}.issues.length) {
219
+ payload.issues.push({
220
+ code: "invalid_type",
221
+ expected: "nonoptional",
222
+ input: undefined,
223
+ path: [${ae}]
224
+ });
225
+ if (ctx && ctx.abortEarly) {
226
+ payload.value = newResult;
227
+ return payload;
228
+ }
229
+ }
230
+
231
+ if (${P}_present) {
232
+ newResult[${ae}] = ${P}.value;
233
+ }
234
+
235
+ `);else if(v.write(`
236
+ if (${P}.issues.length) {${Z(P,ae)}
237
+ }
238
+ `),Xe==="defaulted")v.write(`newResult[${ae}] = ${P}.value;`);else v.write(`
239
+ if (${P}.value !== undefined || ${We}) {
240
+ newResult[${ae}] = ${P}.value;
241
+ }
242
+ `)}return v.write("payload.value = newResult;"),v.write("return payload;"),v.compile()},i,a=ds,c=!Pt.jitless,l=c&&ub.value,p=t.catchall,d;e._zod.parse=(h,f)=>{d??(d=o.value);let _=h.value;if(!a(_))return h.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),h;if(c&&l&&f?.async===!1&&f.jitless!==!0){if(!i)i=s(t.shape);if(h=i(h,f),!p)return h;return hx([],_,h,f,d,e,f?.abortEarly===!0)}return r(h,f)}});function $z(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!Rr(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>Pr(i,o,Dt())))}),t}var Nm=b("$ZodUnion",(e,t)=>{Pe.init(e,t),he(e,"optin",(o)=>o.def.options.some((n)=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some((n)=>n._zod.optin!==void 0)?"optional":void 0),he(e,"optout",(o)=>o.def.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),he(e,"values",(o)=>{if(o.def.options.every((n)=>n._zod.values))return new Set(o.def.options.flatMap((n)=>Array.from(n._zod.values)));return}),he(e,"pattern",(o)=>{if(o.def.options.every((n)=>n._zod.pattern)){let n=o.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${n.map((s)=>Cl(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}if(!s)return $z(i,o,e,n);return Promise.all(i).then((a)=>$z(a,o,e,n))}});function rC(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var gx=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Nm.init(e,t);let r=e._zod.parse;he(e,"propValues",(n)=>{let s={},i=0;for(let a of n.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${n.def.options.indexOf(a)}"`);if(c[n.def.discriminator]?.has(void 0))i++;for(let[u,l]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(s,u))Lt(s,u,new Set);for(let p of l)s[u].add(p)}}if(!n.def.unionFallback&&i>1)s[n.def.discriminator]?.delete(void 0);return s}),t.options.forEach((n,s)=>{let i=dc(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let o=pc(()=>rC(t));e._zod.parse=(n,s)=>{let i=n.value;if(!ds(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=i?.[t.discriminator],c=o.value.get(a);if(c&&(a!==void 0||s.direction!=="backward"))return c._zod.run(n,s);if(t.unionFallback||s.direction==="backward")return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter((u)=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n}}),_x=b("$ZodIntersection",(e,t)=>{Pe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>kz(r,c,u));return kz(r,s,i)}});function Im(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(pn(e)&&pn(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};if(Object.prototype.hasOwnProperty.call(n,"__proto__"))delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=Im(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Im(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function kz(e,t,r){let o=new Map,n,s=new Map,i=(u,l)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);if(!s.has(d))s.set(d,u);p=[d]}else return!1;for(let d of p){if(!o.has(d))o.set(d,{});o.get(d)[l]=!0}return!0};for(let u of t.issues)if(!i(u,"l"))e.issues.push(u);for(let u of r.issues)if(!i(u,"r"))e.issues.push(u);let a=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=n?a.filter((l)=>n.keys.includes(l)):[];if(u.length)e.issues.push({...n,keys:u});for(let l of a)if(!u.includes(l)&&s.has(l))e.issues.push(s.get(l))}let c=Im(t.value,r.value);if(!c.valid){if(Rr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var yx=b("$ZodRecord",(e,t)=>{Pe.init(e,t);let r=Pt.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!pn(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let c=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(c.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let p=t.keyType._zod.run({value:l,issues:[]},n);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map((f)=>Pr(f,n,Dt())),input:l,path:[l],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:s[l],issues:[]},n);if(h instanceof Promise)i.push(h.then((f)=>{if(f.issues.length)o.issues.push(...ko(l,f.issues));o.value[d]=f.value}));else{if(h.issues.length)o.issues.push(...ko(l,h.issues));o.value[d]=h.value}}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;o.value[l]=s[l]}else u=u??[],u.push(l);if(u&&u.length>0)o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof u==="string"&&hc.test(u)&&l.issues.length){let f=t.keyType._zod.run({value:Number(u),issues:[]},n);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)l=f}if(l.issues.length){if(t.mode==="loose")o.value[u]=s[u];else if(a)c=c??[],c.push(u);else o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((f)=>Pr(f,n,Dt())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:s[u],issues:[]},n);if(h instanceof Promise)i.push(h.then((f)=>{if(f.issues.length)o.issues.push(...ko(u,f.issues));o.value[d]=f.value}));else{if(h.issues.length)o.issues.push(...ko(u,h.issues));o.value[d]=h.value}}if(c&&c.length>0)o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}if(i.length)return Promise.all(i).then(()=>o);return o}});var vx=b("$ZodEnum",(e,t)=>{Pe.init(e,t);let r=uc(t.entries),o=new Set(r);e._zod.values=o,he(e,"pattern",(n)=>{let s=uc(n.def.entries).filter((i)=>lb.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>$o(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),Sx=b("$ZodLiteral",(e,t)=>{Pe.init(e,t);let r=new Set(t.values);e._zod.values=r,he(e,"pattern",(o)=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map((s)=>typeof s==="string"?$o(s):s?$o(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var bx=b("$ZodTransform",(e,t)=>{Pe.init(e,t),e._zod.optin="optional",Pt.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new mc(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new Tr;return r.value=n,r}});function Rz(e,t){return e.value=t.issues.length?void 0:t.value,e}var Zm=b("$ZodOptional",(e,t)=>{Pe.init(e,t),he(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",he(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),he(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Cl(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((s)=>Rz(r,s));return Rz(r,n)}return t.innerType._zod.run(r,o)}}),zx=b("$ZodExactOptional",(e,t)=>{Zm.init(e,t),he(e,"values",(r)=>r.def.innerType._zod.values),he(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),xx=b("$ZodNullable",(e,t)=>{Pe.init(e,t),he(e,"optin",(r)=>r.def.innerType._zod.optin),he(e,"optout",(r)=>r.def.innerType._zod.optout),he(e,"pattern",(r)=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Cl(o.source)}|null)$`):void 0}),he(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),wx=b("$ZodDefault",(e,t)=>{Pe.init(e,t),e._zod.optin="defaulted",he(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Pz(s,t));return Pz(n,t)}});function Pz(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var $x=b("$ZodPrefault",(e,t)=>{Pe.init(e,t),e._zod.optin="defaulted",he(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),kx=b("$ZodNonOptional",(e,t)=>{Pe.init(e,t),he(e,"values",(r)=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter((n)=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Tz(s,e));return Tz(n,e)}});function Tz(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Ez(e,t,r,o){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((n)=>Pr(n,o,Dt()))},input:e.value}),e}var Rx=b("$ZodCatch",(e,t)=>{Pe.init(e,t),he(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),he(e,"optout",(r)=>r.def.innerType._zod.optout),he(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);if(n instanceof Promise)return n.then((s)=>Ez(r,s,t,o));return Ez(r,n,t,o)}});var Mm=b("$ZodPipe",(e,t)=>{Pe.init(e,t),he(e,"values",(r)=>r.def.in._zod.values),he(e,"optin",(r)=>r.def.in._zod.optin),he(e,"optout",(r)=>r.def.out._zod.optout),he(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>Vl(i,t.in,o));return Vl(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Vl(s,t.out,o));return Vl(n,t.out,o)}});function Vl(e,t,r){if(e.issues.some((o)=>o.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Px=b("$ZodPreprocess",(e,t)=>{Mm.init(e,t)}),Tx=b("$ZodReadonly",(e,t)=>{Pe.init(e,t),he(e,"propValues",(r)=>r.def.innerType._zod.propValues),he(e,"values",(r)=>r.def.innerType._zod.values),he(e,"optin",(r)=>r.def.innerType?._zod?.optin),he(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Iz);return Iz(n)}});function Iz(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var Ex=b("$ZodLazy",(e,t)=>{Pe.init(e,t),nb(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),he(e,"pattern",(r)=>r.innerType?._zod?.pattern),he(e,"propValues",(r)=>r.innerType?._zod?.propValues),he(e,"optin",(r)=>r.innerType?._zod?.optin??void 0),he(e,"optout",(r)=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Ix=b("$ZodCustom",(e,t)=>{it.init(e,t),Pe.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Cz(s,r,o,e));Cz(n,r,o,e);return}});function Cz(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(dn(n))}}class Ox extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Lm="~memo",Cx=[];function Ax(e){return e!==null&&typeof e==="object"}function jm(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Nx=new WeakMap,_c=0,Yl=1,yc=2;function Xl(e,t,r){let o=Nx.get(e);if(o!==void 0)return o?yc:_c;if(t.has(e))return yc;t.add(e);let n=_c,s=(l)=>{if(n!==yc&&l?._zod){let p=Xl(l,t,r);if(p>n)n=p}},i=(l,p)=>{let d=_c;for(let h of Reflect.ownKeys(l)){let f=Object.getOwnPropertyDescriptor(l,h);if(p&&!f.enumerable)continue;let _=f.get?Yl:f.value?._zod?Xl(f.value,t,r):_c;if(_>d)d=_}return d},a=(l)=>{if(l>n)n=l},c=e._zod.def,u=c.type;switch(u){case"object":{let l=dc(c);a(l?i(l,!0):Yl),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?Xl(l,t,!1):Yl);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let p=Object.getOwnPropertyDescriptor(c,l);if(!p||p.get)continue;let d=p.value;if(!d||typeof d!=="object")continue;if(d._zod)s(d);else if(Array.isArray(d))for(let h of d)s(h)}}return t.delete(e),oC(e,n)}function oC(e,t){if(t!==Yl)Nx.set(e,t===yc);return t}function nC(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Wl,Gl=[],sC={alloc(e,t,r){let o=Wl;if(!o)return r;Wl=void 0;let n={value:r,issues:null};return o.set(t.value,n),Gl.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&iC(s,n.value))throw new Ox;return r(n,s)};if(e._zod.parse=o,e._zod.run===r)e._zod.run=o})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let k=Xl(e,new Set,!1);if(k===_c){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(c,u)}if(k===yc||o)r=!0;else o=!0}let l=c.value;if(!Ax(l))return i(c,u);let p=u[Lm];if(!p)p={buckets:new WeakMap,backEdges:void 0},u[Lm]=p;let d;if(n===u)d=s;else d=nC(p,e),n=u,s=d;let h=d.get(l);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...jm(h.issues))}else c.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value);return c}Wl=d;let f=Gl.length,_=i(c,u);Wl=void 0;let v=Gl.length>f?Gl.pop():void 0;if(_ instanceof Promise)return _.then((k)=>{if(v)v.issues=k.issues.length?jm(k.issues):Cx;return k});if(v)v.issues=_.issues.length?jm(_.issues):Cx;return _};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Zx(){return sC}function iC(e,t){let r=e[Lm]?.backEdges;return r!==void 0&&Ax(t)&&r.has(t)}var aC=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return o[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=n(s.expected),a=fb(s.input),c=n(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${gm(s.values[0])}`;return`Invalid option: expected one of ${mm(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${mm(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function qm(){return{localeError:aC()}}var Mx;class jx{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function cC(){return new jx}(Mx=globalThis).__zod_globalRegistry??(Mx.__zod_globalRegistry=cC());var mn=globalThis.__zod_globalRegistry;function Lx(e){if(e.checks)e.checks=[...e.checks];return e}function qx(e,t){return new e(Lx({type:"string",...J(t)}))}function Dm(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...J(t)})}function Dx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...J(t)})}function Ux(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...J(t)})}function Fx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...J(t)})}function Vx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...J(t)})}function Bx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...J(t)})}function Um(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...J(t)})}function Hx(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...J(t)})}function Jx(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...J(t)})}function Kx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...J(t)})}function Wx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...J(t)})}function Gx(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...J(t)})}function Yx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...J(t)})}function Xx(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...J(t)})}function Qx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...J(t)})}function ew(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...J(t)})}function tw(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...J(t)})}function rw(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...J(t)})}function ow(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...J(t)})}function nw(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...J(t)})}function sw(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...J(t)})}function iw(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...J(t)})}function Ql(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...J(t)})}function ep(e,t){return new e({type:"string",format:"date",check:"string_format",...J(t)})}function Fm(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...J(t)})}function Vm(e,t){return new e({type:"string",format:"duration",check:"string_format",...J(t)})}function aw(e,t){return new e(Lx({type:"number",checks:[],...J(t)}))}function cw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...J(t)})}function uw(e,t){return new e({type:"boolean",...J(t)})}function lw(e,t){return new e({type:"null",...J(t)})}function pw(e){return new e({type:"unknown"})}function dw(e,t){return new e({type:"never",...J(t)})}function tp(e,t){return new Pm({check:"less_than",...J(t),value:e,inclusive:!1})}function vc(e,t){return new Pm({check:"less_than",...J(t),value:e,inclusive:!0})}function rp(e,t){return new Tm({check:"greater_than",...J(t),value:e,inclusive:!1})}function Sc(e,t){return new Tm({check:"greater_than",...J(t),value:e,inclusive:!0})}function op(e,t){return new uz({check:"multiple_of",...J(t),value:e})}function np(e,t){return new pz({check:"max_length",...J(t),maximum:e})}function ms(e,t){return new dz({check:"min_length",...J(t),minimum:e})}function sp(e,t){return new mz({check:"length_equals",...J(t),length:e})}function Bm(e,t){return new hz({check:"string_format",format:"regex",...J(t),pattern:e})}function Hm(e){return new fz({check:"string_format",format:"lowercase",...J(e)})}function Jm(e){return new gz({check:"string_format",format:"uppercase",...J(e)})}function Km(e,t){return new _z({check:"string_format",format:"includes",...J(t),includes:e})}function Wm(e,t){return new yz({check:"string_format",format:"starts_with",...J(t),prefix:e})}function Gm(e,t){return new vz({check:"string_format",format:"ends_with",...J(t),suffix:e})}function Ro(e){return new Sz({check:"overwrite",tx:e})}function Ym(e){return Ro((t)=>t.normalize(e))}function Xm(){return Ro((e)=>e.trim())}function Qm(){return Ro((e)=>e.toLowerCase())}function eh(){return Ro((e)=>e.toUpperCase())}function th(){return Ro((e)=>cb(e))}function mw(e,t,r){return new e({type:"array",element:t,...J(r)})}function hw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...J(r)})}function fw(e,t){let r=uC((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(dn(n,o.value,r._zod.def));else{let s=n;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=o.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(dn(s))}},e(o.value,o)),t);return r}function uC(e,t){let r=new it({check:"custom",...J(t)});return r._zod.check=e,r}function bc(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,o))Lt(e,o,r[o]);return e}function xc(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??mn,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function rt(e,t,r,o,n){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(n);return Object.assign(r,s),!0}function ze(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let d=i.schema,h=t.processors[n.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,d,l)}let p=e._zod.parent;if(p){if(!i.ref)i.ref=p;ze(p,t,l),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)bc(i.schema,c);if(t.io==="input"&&St(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function gw(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function wc(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,d=e.external.uri??((f)=>f);if(p)return{ref:d(p)};let h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${d("__shared")}#/${a}/${gw(h)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+gw(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);if(a.def={...a.schema},u)a.defId=u;let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
243
+
244
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function vw(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!=="object")return;vw(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Sw=new Set(["type","properties","required","additionalProperties"]),_w=["oneOf","anyOf"];function yw(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function rh(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!Sw.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??yw(u);if(l===null||l===void 0)continue;if(!a.some((p)=>JSON.stringify(p)===JSON.stringify(l)))a.push(l)}let c=a.length===1?a[0]:rh(a)??{allOf:a};Lt(r,i,c)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size)n.required=[...o];if(t.every((s)=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let a=yw(i);if(a&&!s.some((c)=>JSON.stringify(c)===JSON.stringify(a)))s.push(a)}if(s.length===1)n.additionalProperties=s[0];else if(s.length>1)n.additionalProperties={allOf:s}}return n}function lC(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Sw)if(n in e)return;let r=t.filter((n)=>_w.some((s)=>Array.isArray(n[s]))),o=null;if(!r.length)o=rh(t);else{let n=r[0],s=_w.find((c)=>Array.isArray(n[c]));if(Object.keys(n).length!==1)return;let i=t.filter((c)=>c!==n),a=n[s].map((c)=>rh([...i,c]));if(a.some((c)=>!c))return;o={[s]:a}}if(!o)return;delete e.allOf,bc(e,o)}function $c(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let h=e.seen.get(p),f=h.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else bc(u,f);if(bc(u,l),a._zod.parent===p)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(!(v in l))delete u[v]}if(f.$ref&&h.def)for(let v in u){if(v==="$ref"||v==="allOf")continue;if(v in h.def&&JSON.stringify(u[v])===JSON.stringify(h.def[v]))delete u[v]}}let d=a._zod.parent;if(d&&d!==p){o(d);let h=e.seen.get(d);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in h.def&&JSON.stringify(u[f])===JSON.stringify(h.def[f]))delete u[f]}}}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())o(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())vw(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let p=a.get(l);if(p)p.push(u);else a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])lC(u)}}let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}bc(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&n.id===s)delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Lt(i,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")n.$defs=i;else n.definitions=i;try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:zc(t,"input",e.processors),output:zc(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function St(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return St(o.element,r);if(o.type==="set")return St(o.valueType,r);if(o.type==="lazy")return St(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return St(o.innerType,r);if(o.type==="intersection")return St(o.left,r)||St(o.right,r);if(o.type==="record"||o.type==="map")return St(o.keyType,r)||St(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return St(o.in,r)||St(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(St(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(St(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(St(n,r))return!0;if(o.rest&&St(o.rest,r))return!0;return!1}return!1}var bw=(e,t={})=>(r)=>{let o=xc({...r,processors:t});return ze(e,o),wc(o,e),$c(o,e)},zc=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=xc({...n??{},target:s,io:t,processors:r});return ze(e,i),wc(i,e),$c(i,e)};var hs=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},fs=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},zw=(e,t)=>{hs(e,"minimum",t),fs(e,"maximum",t)},Rw=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Pw=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Tw=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ew=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},xw=(e,t)=>hs(e,"minimum",t.minimum),ww=(e,t)=>fs(e,"maximum",t.maximum),$w=(e)=>(t,r)=>{Ew(t,r.format);let[o,n]=e[r.format];hs(t,"minimum",o),fs(t,"maximum",n)},pC={greater_than:(e,t)=>hs(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>fs(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rw(e,t.value),number_format:$w(Ol),bigint_format:$w(_m),min_length:xw,max_length:ww,length_equals:(e,t)=>zw(e,t.length),min_size:xw,max_size:ww,size_equals:(e,t)=>zw(e,t.size),string_format:(e,t)=>{if(Ew(e,t.format),t.pattern)Pw(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Tw(e,t.mime)};function Tt(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)pC[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;if(n.minimum!==void 0)hs(t,"minimum",n.minimum);if(n.exclusiveMinimum!==void 0)hs(t,"exclusiveMinimum",n.exclusiveMinimum);if(n.maximum!==void 0)fs(t,"maximum",n.maximum);if(n.exclusiveMaximum!==void 0)fs(t,"exclusiveMaximum",n.exclusiveMaximum);if(n.multipleOf!==void 0)Rw(t,n.multipleOf);if(n.format!==void 0){if(t.format??(t.format=n.format),n.format.includes("int"))t.isInt=!0}if(n.mime)Tw(t,n.mime);for(let s of n.patterns??[])Pw(t,s);return t}var dC={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},mC=new Map([[Om,Gb],[Kl,Yb]]),Iw=(e)=>mC.get(e)??e,sh=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=Tt(e);if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=dC[a]??a,n.format==="")delete n.format;if(a==="time"||l)delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let p=[...c].map(Iw);if(p.length===1)n.pattern=p[0].source;else if(p.length>1)n.allOf=[...p.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},ih=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=Tt(e);n.type=l?"integer":"number";let p=typeof u==="number"&&u>=(s??Number.NEGATIVE_INFINITY),d=typeof c==="number"&&c<=(i??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=u,n.exclusiveMinimum=!0;else n.exclusiveMinimum=u;else if(typeof s==="number")n.minimum=s;if(d)if(h)n.maximum=c,n.exclusiveMaximum=!0;else n.exclusiveMaximum=c;else if(typeof i==="number")n.maximum=i;if(a){let f=new Set;for(let k of a)if(Number.isFinite(k)&&k!==0)f.add(Math.abs(k));else rt(e,t,n,o,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[_,...v]=f;if(_!==void 0)n.multipleOf=_;if(v.length)n.allOf=[...n.allOf??[],...v.map((k)=>({multipleOf:k}))]}},ah=(e,t,r,o)=>{r.type="boolean"},Cw=(e,t,r,o)=>{rt(e,t,r,o,"BigInt cannot be represented in JSON Schema")},Ow=(e,t,r,o)=>{rt(e,t,r,o,"Symbols cannot be represented in JSON Schema")},ch=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Aw=(e,t,r,o)=>{rt(e,t,r,o,"Undefined cannot be represented in JSON Schema")},Nw=(e,t,r,o)=>{rt(e,t,r,o,"Void cannot be represented in JSON Schema")},uh=(e,t,r,o)=>{r.not={}},Zw=(e,t,r,o)=>{},lh=(e,t,r,o)=>{},Mw=(e,t,r,o)=>{rt(e,t,r,o,"Date cannot be represented in JSON Schema")},ph=(e,t,r,o)=>{let n=e._zod.def,s=uc(n.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},dh=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(rt(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(rt(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}},jw=(e,t,r,o)=>{rt(e,t,r,o,"NaN cannot be represented in JSON Schema")},Lw=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},qw=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:s,maximum:i,mime:a}=Tt(e);if(s!==void 0)n.minLength=s;if(i!==void 0)n.maxLength=i;if(!a)return;if(a.length===0)n.not={};else if(a.length===1)n.contentMediaType=a[0];else n.anyOf=a.map((c)=>({contentMediaType:c}))},Dw=(e,t,r,o)=>{r.type="boolean"},mh=(e,t,r,o)=>{rt(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Uw=(e,t,r,o)=>{rt(e,t,r,o,"Function types cannot be represented in JSON Schema")},hh=(e,t,r,o)=>{rt(e,t,r,o,"Transforms cannot be represented in JSON Schema")},Fw=(e,t,r,o)=>{rt(e,t,r,o,"Map cannot be represented in JSON Schema")},Vw=(e,t,r,o)=>{rt(e,t,r,o,"Set cannot be represented in JSON Schema")},fh=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=Tt(e);if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=ze(s.element,t,{...o,path:[...o.path,"items"]})};function kc(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return kc(t.out);if(t.type==="catch")return kc(t.innerType);return e._zod.optin}var gh=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&rt(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)Lt(n.properties,u,ze(i[u],t,{...o,path:[...o.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];if(t.io==="input"?kc(l)===void 0:l._zod.optout===void 0)c.push(u)}if(c.length>0)n.required=c;if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=ze(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},_h=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>ze(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));if(s)r.oneOf=i;else r.anyOf=i},yh=(e,t,r,o)=>{let n=e._zod.def,s=ze(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ze(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c,t.intersections.push(c)},Bw=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((_,v)=>ze(_,t,{...o,path:[...o.path,i,v]})),u=s.rest?ze(s.rest,t,{...o,path:[...o.path,a,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,l=s.items.length;while(l>0){let _=s.items[l-1];if(!(t.io==="input"?kc(_)!==void 0:_._zod.optout==="optional"))break;l--}let p=s.items.length,d=!s.rest;if(t.target==="draft-2020-12"){if(n.prefixItems=c,d)n.items=!1;else if(u)n.items=u;if(l>0)n.minItems=l;if(d)n.maxItems=p}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(l>0)n.minItems=l;if(d)n.maxItems=p}else{if(n.items=c,d)n.additionalItems=!1;else if(u)n.additionalItems=u;if(l>0)n.minItems=l;if(d)n.maxItems=p}let{minimum:h,maximum:f}=Tt(e);if(typeof h==="number")n.minItems=h;if(typeof f==="number")n.maxItems=f};function oh(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let f=e.get(t)?.def;if(!f)return t;let _=oh(e,f,r);return _===f?t:_}for(let f of["anyOf","oneOf"]){let _=t[f];if(!Array.isArray(_))continue;let v=_.map((k)=>oh(e,k,r));if(v.some((k,Z)=>k!==_[Z]))t={...t,[f]:v}}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some((f)=>f==="number"||f==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some((f)=>typeof f==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:p,id:d,...h}=t;if(h.enum)h.enum=h.enum.map((f)=>typeof f==="number"?String(f):f);else if(typeof h.const==="number")h.const=String(h.const);if(!n)return h;if(h.type="string",!s)h.pattern=(o.includes("number")?hc:km).source;return h}var nh=new WeakMap;function hC(e){let t=new Map;for(let o of e.seen.values())if(o.def&&!t.has(o.schema))t.set(o.schema,o);let r=new Map;for(let o of nh.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=oh(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);if(s)n.propertyNames=s}}var vh=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,a=Tt(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=ze(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of a)Lt(n.patternProperties,Iw(p).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ze(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let l=nh.get(t);if(!l)l=[],nh.set(t,l),t.deferred.push(()=>hC(t));l.push(e)}n.additionalProperties=ze(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&kc(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)n.required=l.map(String)}},Sh=(e,t,r,o)=>{let n=e._zod.def,s=ze(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},bh=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},zh=Symbol();function Hw(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return s=!0,null});if(!s)return JSON.parse(i);return rt(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),zh}var xh=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=Hw(n.defaultValue,e,t,r,o);if(i!==zh)r.default=i},wh=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=Hw(n.defaultValue,e,t,r,o);if(i!==zh)r._prefault=i},$h=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{rt(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},kh=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ze(i,t,o);let a=t.seen.get(e);a.ref=i},Rh=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Jw=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},ip=(e,t,r,o)=>{let n=e._zod.def;ze(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ph=(e,t,r,o)=>{let n=e._zod.innerType;ze(n,t,o);let s=t.seen.get(e);s.ref=n},kw={string:sh,number:ih,boolean:ah,bigint:Cw,symbol:Ow,null:ch,undefined:Aw,void:Nw,never:uh,any:Zw,unknown:lh,date:Mw,enum:ph,literal:dh,nan:jw,template_literal:Lw,file:qw,success:Dw,custom:mh,function:Uw,transform:hh,map:Fw,set:Vw,array:fh,object:gh,union:_h,intersection:yh,tuple:Bw,record:vh,nullable:Sh,nonoptional:bh,default:xh,prefault:wh,catch:$h,pipe:kh,readonly:Rh,promise:Jw,optional:ip,lazy:Ph};function ap(e,t){if("_idmap"in e){let o=e,n=xc({...t,processors:kw}),s={};for(let c of o._idmap.entries()){let[u,l]=c;ze(l,n)}let i={},a={registry:o,uri:t?.uri,defs:s};n.external=a;for(let c of o._idmap.entries()){let[u,l]=c;wc(n,l),Lt(i,u,$c(n,l))}if(Object.keys(s).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:s}}return{schemas:i}}let r=xc({...t,processors:kw});return ze(e,r),wc(r,e),$c(r,e)}var Kw=new WeakSet([Object.prototype,Error.prototype]);function cp(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var xC=(e,t)=>{xb.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Kw.has(r))return;Kw.add(r),cp(r,"format",(o)=>(n)=>$b(o,n)),cp(r,"flatten",(o)=>(n)=>wb(o,n)),cp(r,"addIssue",(o)=>(n)=>{o.issues.push(n),o.message=JSON.stringify(o.issues,lc,2)}),cp(r,"addIssues",(o)=>(n)=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,lc,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Ut=b("ZodError",xC,void 0,{Parent:Error});var Ww=Ll(Ut),Gw=ql(Ut),up=Dl(Ut),Yw=Ul(Ut),Xw=Rb(Ut),Qw=Pb(Ut),e$=Tb(Ut),t$=Eb(Ut),r$=Ib(Ut),o$=Cb(Ut),n$=Ob(Ut),s$=Ab(Ut);function $C(){if(!Pt.localeError)Dt(qm())}function pp(){if(!Pt.memoizer)Dt({memoizer:Zx()})}var Ce=b("ZodType",(e,t)=>($C(),Pe.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(qt(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return kr(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(hO(e,t))},superRefine(e,t){return this.check(fO(e,t))},overwrite(e){return this.check(Ro(e))},optional(){return pe(this)},exactOptional(){return eO(this)},nullable(){return c$(this)},nullish(){return pe(c$(this))},nonoptional(e){return iO(this,e)},array(){return C(this)},or(e){return se([this,e])},and(e){return gs(this,e)},transform(e){return u$(this,S$(e))},default(e){return oO(this,e)},prefault(e){return sO(this,e)},catch(e){return cO(this,e)},pipe(e){return u$(this,e)},readonly(){return pO(this)},describe(e){let t=this.clone();return mn.add(t,{description:e}),t},meta(...e){if(e.length===0)return mn.get(this);let t=this.clone();return mn.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Ml(this,"~standard",{...Cm(this),jsonSchema:{input:zc(this,"input"),output:zc(this,"output")}})},set "~standard"(e){Gr(this,"~standard",e)},parse:function e(t,r){return Ww(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Gw(this,t,r,{callee:e})},safeParse(e,t){return up(this,e,t)},async safeParseAsync(e,t){return Yw(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Gr(this,"spa",e)},validate(e,t){return zm(this,e,t)},validateAsync(e,t){return xm(this,e,t)},encode:function e(t,r){return Xw(this,t,r,{callee:e})},decode:function e(t,r){return Qw(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await e$(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await t$(this,t,r,{callee:e})},safeEncode(e,t){return r$(this,e,t)},safeDecode(e,t){return o$(this,e,t)},async safeEncodeAsync(e,t){return n$(this,e,t)},async safeDecodeAsync(e,t){return s$(this,e,t)},toJSONSchema(e){return bw(this,{})(e)},get description(){return mn.get(this)?.description},get _def(){return this._zod.def}}),l$=b("_ZodString",(e,t)=>{Jl.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sh(e,r,o,n)},_b({format:(e)=>Tt(e).format??null,minLength:(e)=>Tt(e).minimum??null,maxLength:(e)=>Tt(e).maximum??null},{regex(...e){return this.check(Bm(...e))},includes(...e){return this.check(Km(...e))},startsWith(...e){return this.check(Wm(...e))},endsWith(...e){return this.check(Gm(...e))},min(...e){return this.check(ms(...e))},max(...e){return this.check(np(...e))},length(...e){return this.check(sp(...e))},nonempty(...e){return this.check(ms(1,...e))},lowercase(e){return this.check(Hm(e))},uppercase(e){return this.check(Jm(e))},trim(){return this.check(Xm())},normalize(...e){return this.check(Ym(...e))},toLowerCase(){return this.check(Qm())},toUpperCase(){return this.check(eh())},slugify(){return this.check(th())}})),kC=b("ZodString",(e,t)=>{Jl.init(e,t),l$.init(e,t)},{email(e){return this.check(Dm(m$,e))},url(e){return this.check(Um(f$,e))},jwt(e){return this.check(iw(UC,e))},emoji(e){return this.check(Hx(PC,e))},guid(e){return this.check(Dx(RC,e))},uuid(e){return this.check(Ux(lp,e))},uuidv4(e){return this.check(Fx(lp,e))},uuidv6(e){return this.check(Vx(lp,e))},uuidv7(e){return this.check(Bx(lp,e))},nanoid(e){return this.check(Jx(TC,e))},cuid(e){return this.check(Kx(EC,e))},cuid2(e){return this.check(Wx(IC,e))},ulid(e){return this.check(Gx(CC,e))},base64(e){return this.check(ow(LC,e))},base64url(e){return this.check(nw(qC,e))},xid(e){return this.check(Yx(OC,e))},ksuid(e){return this.check(Xx(AC,e))},ipv4(e){return this.check(Qx(NC,e))},ipv6(e){return this.check(ew(ZC,e))},cidrv4(e){return this.check(tw(MC,e))},cidrv6(e){return this.check(rw(jC,e))},e164(e){return this.check(sw(DC,e))},datetime(e){return this.check(Ql(Eh,e))},date(e){return this.check(ep(Ih,e))},time(e){return this.check(Fm(p$,e))},duration(e){return this.check(Vm(d$,e))}});function m(e){return qx(kC,e)}var Be=b("ZodStringFormat",(e,t)=>{Ie.init(e,t),l$.init(e,t)}),Eh=b("ZodISODateTime",(e,t)=>{Jz.init(e,t),Be.init(e,t)}),Ih=b("ZodISODate",(e,t)=>{Kz.init(e,t),Be.init(e,t)}),p$=b("ZodISOTime",(e,t)=>{Wz.init(e,t),Be.init(e,t)}),d$=b("ZodISODuration",(e,t)=>{Gz.init(e,t),Be.init(e,t)}),m$=b("ZodEmail",(e,t)=>{Zz.init(e,t),Be.init(e,t)});function h$(e){return Dm(m$,e)}var RC=b("ZodGUID",(e,t)=>{Az.init(e,t),Be.init(e,t)});var lp=b("ZodUUID",(e,t)=>{Nz.init(e,t),Be.init(e,t)});var f$=b("ZodURL",(e,t)=>{Lz.init(e,t),Be.init(e,t)});function g$(e){return Um(f$,e)}var PC=b("ZodEmoji",(e,t)=>{qz.init(e,t),Be.init(e,t)});var TC=b("ZodNanoID",(e,t)=>{Dz.init(e,t),Be.init(e,t)});var EC=b("ZodCUID",(e,t)=>{Uz.init(e,t),Be.init(e,t)});var IC=b("ZodCUID2",(e,t)=>{Fz.init(e,t),Be.init(e,t)});var CC=b("ZodULID",(e,t)=>{Vz.init(e,t),Be.init(e,t)});var OC=b("ZodXID",(e,t)=>{Bz.init(e,t),Be.init(e,t)});var AC=b("ZodKSUID",(e,t)=>{Hz.init(e,t),Be.init(e,t)});var NC=b("ZodIPv4",(e,t)=>{Yz.init(e,t),Be.init(e,t)});var ZC=b("ZodIPv6",(e,t)=>{Qz.init(e,t),Be.init(e,t)});var MC=b("ZodCIDRv4",(e,t)=>{ex.init(e,t),Be.init(e,t)});var jC=b("ZodCIDRv6",(e,t)=>{tx.init(e,t),Be.init(e,t)});var LC=b("ZodBase64",(e,t)=>{ox.init(e,t),Be.init(e,t)});var qC=b("ZodBase64URL",(e,t)=>{nx.init(e,t),Be.init(e,t)});var DC=b("ZodE164",(e,t)=>{sx.init(e,t),Be.init(e,t)});var UC=b("ZodJWT",(e,t)=>{ix.init(e,t),Be.init(e,t)});var _$=b("ZodNumber",(e,t)=>{Am.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ih(e,r,o,n),e.isFinite=!0},_b({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Tt(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Tt(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Tt(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Tt(e).format??null},{gt(e,t){return this.check(rp(e,t))},gte(e,t){return this.check(Sc(e,t))},min(e,t){return this.check(Sc(e,t))},lt(e,t){return this.check(tp(e,t))},lte(e,t){return this.check(vc(e,t))},max(e,t){return this.check(vc(e,t))},int(e){return this.check(i$(e))},safe(e){return this.check(i$(e))},positive(e){return this.check(rp(0,e))},nonnegative(e){return this.check(Sc(0,e))},negative(e){return this.check(tp(0,e))},nonpositive(e){return this.check(vc(0,e))},multipleOf(e,t){return this.check(op(e,t))},step(e,t){return this.check(op(e,t))},finite(){return this}}));function q(e){return aw(_$,e)}var FC=b("ZodNumberFormat",(e,t)=>{ax.init(e,t),_$.init(e,t)});function i$(e){return cw(FC,e)}var VC=b("ZodBoolean",(e,t)=>{cx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ah(e,r,o,n)});function le(e){return uw(VC,e)}var BC=b("ZodNull",(e,t)=>{ux.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ch(e,r,o,n)});function dp(e){return lw(BC,e)}var HC=b("ZodUnknown",(e,t)=>{lx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lh(e,r,o,n)});function ue(){return pw(HC)}var JC=b("ZodNever",(e,t)=>{px.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uh(e,r,o,n)});function KC(e){return dw(JC,e)}var WC=b("ZodArray",(e,t)=>{pp(),dx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fh(e,r,o,n),e.element=t.element},{min(e,t){return this.check(ms(e,t))},nonempty(e){return this.check(ms(1,e))},max(e,t){return this.check(np(e,t))},length(e,t){return this.check(sp(e,t))},unwrap(){return this.element}});function C(e,t){return mw(WC,e,t)}var y$=b("ZodObject",(e,t)=>{pp(),fx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gh(e,r,o,n),CI(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return ye(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(qt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(qt(this._zod.def,{catchall:ue()}))},loose(){return this.clone(qt(this._zod.def,{catchall:ue()}))},strict(){return this.clone(qt(this._zod.def,{catchall:KC()}))},strip(){return this.clone(qt(this._zod.def,{catchall:void 0}))},extend(e){return wI(this,e)},safeExtend(e){return $I(this,e)},merge(e){return kI(this,e)},pick(e){return zI(this,e)},omit(e){return xI(this,e)},partial(...e){return mb(b$,this,e[0])},exactPartial(...e){return mb(z$,this,e[0],"exactPartial")},required(...e){return RI(x$,this,e[0])}});function y(e,t){let r={type:"object",shape:e??{},...J(t)};return new y$(r)}function fe(e,t){return new y$({type:"object",shape:e,catchall:ue(),...J(t)})}var v$=b("ZodUnion",(e,t)=>{Nm.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_h(e,r,o,n),e.options=t.options});function se(e,t){return new v$({type:"union",options:e,...J(t)})}var GC=b("ZodDiscriminatedUnion",(e,t)=>{v$.init(e,t),gx.init(e,t)});function Ch(e,t,r){return new GC({type:"union",options:t,discriminator:e,...J(r)})}var YC=b("ZodIntersection",(e,t)=>{_x.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yh(e,r,o,n)});function gs(e,t){return new YC({type:"intersection",left:e,right:t})}var a$=b("ZodRecord",(e,t)=>{pp(),yx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vh(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function re(e,t,r){if(!t||!t._zod)return new a$({type:"record",keyType:m(),valueType:e,...J(t)});return new a$({type:"record",keyType:e,valueType:t,...J(r)})}var Th=b("ZodEnum",(e,t)=>{vx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ph(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Th({...t,checks:[],...J(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Th({...t,checks:[],...J(n),entries:s})}});function ye(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Th({type:"enum",entries:r,...J(t)})}var XC=b("ZodLiteral",(e,t)=>{Sx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dh(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function R(e,t){return new XC({type:"literal",values:Array.isArray(e)?e:[e],...J(t)})}var QC=b("ZodTransform",(e,t)=>{pp(),bx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hh(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new mc(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(dn(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(dn(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function S$(e){return new QC({type:"transform",transform:e})}var b$=b("ZodOptional",(e,t)=>{Zm.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ip(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pe(e){return new b$({type:"optional",innerType:e})}var z$=b("ZodExactOptional",(e,t)=>{zx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ip(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function eO(e){return new z$({type:"optional",innerType:e})}var tO=b("ZodNullable",(e,t)=>{xx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function c$(e){return new tO({type:"nullable",innerType:e})}var rO=b("ZodDefault",(e,t)=>{wx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function oO(e,t){return new rO({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():fm(t)}})}var nO=b("ZodPrefault",(e,t)=>{$x.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sO(e,t){return new nO({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():fm(t)}})}var x$=b("ZodNonOptional",(e,t)=>{kx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function iO(e,t){return new x$({type:"nonoptional",innerType:e,...J(t)})}var aO=b("ZodCatch",(e,t)=>{Rx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$h(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cO(e,t){return new aO({type:"catch",innerType:e,catchValue:typeof t==="function"?t:yb(t)})}var w$=b("ZodPipe",(e,t)=>{Mm.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kh(e,r,o,n),e.in=t.in,e.out=t.out});function u$(e,t){return new w$({type:"pipe",in:e,out:t})}var uO=b("ZodPreprocess",(e,t)=>{w$.init(e,t),Px.init(e,t)}),lO=b("ZodReadonly",(e,t)=>{Tx.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rh(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pO(e){return new lO({type:"readonly",innerType:e})}var dO=b("ZodLazy",(e,t)=>{Ex.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ph(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Oh(e){return new dO({type:"lazy",getter:e})}var mO=b("ZodCustom",(e,t)=>{Ix.init(e,t),Ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mh(e,r,o,n)});function hO(e,t={}){return hw(mO,e,t)}function fO(e,t){return fw(e,t)}function mp(e,t){return new uO({type:"pipe",in:S$(e),out:t})}function Ah(e){return Ql(Eh,e)}function gO(e){return ep(Ih,e)}var Lh=Symbol.for("mcp.sdk.errorBrands");function To(e,t){let r=new Set,o=t;while(typeof o==="function"){let n=o.mcpBrand;if(Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n==="string")r.add(n);o=Object.getPrototypeOf(o)}if(r.size===0)return;Object.defineProperty(e,Lh,{value:r,enumerable:!1,configurable:!0})}function Et(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Lh)){let r=t[Lh];if(r&&typeof r.has==="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var j$=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Et(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,t)}constructor(t,r,o){super(r);this.code=t,this.errorUri=o,this.name="OAuthError",To(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},H=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),D=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,e)}constructor(e,t,r,o){super(t,o);this.code=e,this.data=r,this.name="SdkError",To(this,new.target)}},Oc=class extends D{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var L$="2026-07-28",Vh=[L$];function Xr(e){return e>=L$}function Bh(e){return e.filter((t)=>!Xr(t))}function Ac(e){return e.filter((t)=>Xr(t))}function q$(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((r)=>r.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var D$=["task","inputRequests","requestState"];function _O(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||D$.some((t)=>(t in e)))return e;return{...e,content:[]}}function yO(){let e=Oh(()=>se([m(),q(),le(),dp(),re(m(),e),C(e)])),t=re(m(),e),r=se([m(),q().int()]),o=m(),n=y({ttl:q().optional()}),s=y({taskId:m()}),i=fe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),a=y({_meta:i.optional()}),c=a.extend({task:n.optional()}),u=y({method:m(),params:a.loose().optional()}),l=y({_meta:i.optional()}),p=y({method:m(),params:l.loose().optional()}),d=fe({_meta:i.optional()}),h=se([m(),q().int()]),f=d.strict(),_=l.extend({requestId:h.optional(),reason:m().optional()}),v=p.extend({method:R("notifications/cancelled"),params:_}),k=y({src:m(),mimeType:m().optional(),sizes:C(m()).optional(),theme:ye(["light","dark"]).optional()}),Z=y({icons:C(k).optional()}),E=y({name:m(),title:m().optional()}),ee=E.extend({...E.shape,...Z.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),G=gs(y({applyDefaults:le().optional()}),t),P=mp((ut)=>{if(ut&&typeof ut==="object"&&!Array.isArray(ut)&&Object.keys(ut).length===0)return{form:{}};return ut},gs(y({form:G.optional(),url:t.optional()}),t.optional())),ae=fe({list:t.optional(),cancel:t.optional(),requests:fe({sampling:fe({createMessage:t.optional()}).optional(),elicitation:fe({create:t.optional()}).optional()}).optional()}),We=fe({list:t.optional(),cancel:t.optional(),requests:fe({tools:fe({call:t.optional()}).optional()}).optional()}),$e=y({experimental:re(m(),t).optional(),sampling:y({context:t.optional(),tools:t.optional()}).optional(),elicitation:P.optional(),roots:y({listChanged:le().optional()}).optional(),tasks:ae.optional(),extensions:re(m(),t).optional()}),Xe=a.extend({protocolVersion:m(),capabilities:$e,clientInfo:ee}),ot=u.extend({method:R("initialize"),params:Xe}),Vt=y({experimental:re(m(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:y({listChanged:le().optional()}).optional(),resources:y({subscribe:le().optional(),listChanged:le().optional()}).optional(),tools:y({listChanged:le().optional()}).optional(),tasks:We.optional(),extensions:re(m(),t).optional()}),Bt=d.extend({protocolVersion:m(),capabilities:Vt,serverInfo:ee,instructions:m().optional()}),ur=p.extend({method:R("notifications/initialized"),params:l.optional()}),Ht=u.extend({method:R("ping"),params:a.optional()}),lr=y({progress:q(),total:pe(q()),message:pe(m())}),zt=y({...l.shape,...lr.shape,progressToken:r}),Jt=p.extend({method:R("notifications/progress"),params:zt}),pr=a.extend({cursor:o.optional()}),Ct=u.extend({params:pr.optional()}),ft=d.extend({nextCursor:o.optional()}),jr=y({uri:m(),mimeType:pe(m()),_meta:re(m(),ue()).optional()}),Lr=jr.extend({text:m()}),dr=m().refine((ut)=>{try{return atob(ut),!0}catch{return!1}},{message:"Invalid Base64 string"}),at=jr.extend({blob:dr}),gt=ye(["user","assistant"]),_t=y({audience:C(gt).optional(),priority:q().min(0).max(1).optional(),lastModified:Ah({offset:!0}).optional()}),rr=y({...E.shape,...Z.shape,uri:m(),description:pe(m()),mimeType:pe(m()),size:pe(q()),annotations:_t.optional(),_meta:pe(fe({}))}),Ao=y({...E.shape,...Z.shape,uriTemplate:m(),description:pe(m()),mimeType:pe(m()),annotations:_t.optional(),_meta:pe(fe({}))}),Ot=Ct.extend({method:R("resources/list")}),At=ft.extend({resources:C(rr)}),xt=Ct.extend({method:R("resources/templates/list")}),Kt=ft.extend({resourceTemplates:C(Ao)}),Wt=a.extend({uri:m()}),mr=Wt,hr=u.extend({method:R("resources/read"),params:mr}),co=d.extend({contents:C(se([Lr,at]))}),fr=p.extend({method:R("notifications/resources/list_changed"),params:l.optional()}),No=Wt,M=u.extend({method:R("resources/subscribe"),params:No}),gr=Wt,Y=u.extend({method:R("resources/unsubscribe"),params:gr}),F=l.extend({uri:m()}),ie=p.extend({method:R("notifications/resources/updated"),params:F}),j=y({name:m(),description:pe(m()),required:pe(le())}),O=y({...E.shape,...Z.shape,description:pe(m()),arguments:pe(C(j)),_meta:pe(fe({}))}),te=Ct.extend({method:R("prompts/list")}),X=ft.extend({prompts:C(O)}),Qe=a.extend({name:m(),arguments:re(m(),m()).optional()}),Zo=u.extend({method:R("prompts/get"),params:Qe}),_r=y({type:R("text"),text:m(),annotations:_t.optional(),_meta:re(m(),ue()).optional()}),Mo=y({type:R("image"),data:dr,mimeType:m(),annotations:_t.optional(),_meta:re(m(),ue()).optional()}),jo=y({type:R("audio"),data:dr,mimeType:m(),annotations:_t.optional(),_meta:re(m(),ue()).optional()}),As=y({type:R("tool_use"),name:m(),id:m(),input:re(m(),ue()),_meta:re(m(),ue()).optional()}),uo=y({type:R("resource"),resource:se([Lr,at]),annotations:_t.optional(),_meta:re(m(),ue()).optional()}),Ns=rr.extend({type:R("resource_link")}),Gt=se([_r,Mo,jo,Ns,uo]),Sn=y({role:gt,content:Gt}),bn=d.extend({description:m().optional(),messages:C(Sn)}),Lo=p.extend({method:R("notifications/prompts/list_changed"),params:l.optional()}),Zs=y({title:m().optional(),readOnlyHint:le().optional(),destructiveHint:le().optional(),idempotentHint:le().optional(),openWorldHint:le().optional()}),zn=y({taskSupport:ye(["required","optional","forbidden"]).optional()}),qo=y({...E.shape,...Z.shape,description:m().optional(),inputSchema:y({type:R("object"),properties:re(m(),e).optional(),required:C(m()).optional()}).catchall(ue()),outputSchema:y({type:R("object"),properties:re(m(),e).optional(),required:C(m()).optional()}).catchall(ue()).optional(),annotations:Zs.optional(),execution:zn.optional(),_meta:re(m(),ue()).optional()}),xn=Ct.extend({method:R("tools/list")}),wn=ft.extend({tools:C(qo)}),$n=d.extend({content:C(Gt),structuredContent:re(m(),ue()).optional(),isError:le().optional()}),ct=c.extend({name:m(),arguments:re(m(),ue()).optional()}),Ms=u.extend({method:R("tools/call"),params:ct}),lu=p.extend({method:R("notifications/tools/list_changed"),params:l.optional()}),kn=ye(["debug","info","notice","warning","error","critical","alert","emergency"]),js=a.extend({level:kn}),Ls=u.extend({method:R("logging/setLevel"),params:js}),qs=l.extend({level:kn,logger:m().optional(),data:ue()}),Ds=p.extend({method:R("notifications/message"),params:qs}),Us=y({name:m().optional()}),Fs=y({hints:C(Us).optional(),costPriority:q().min(0).max(1).optional(),speedPriority:q().min(0).max(1).optional(),intelligencePriority:q().min(0).max(1).optional()}),Vs=y({mode:ye(["auto","required","none"]).optional()}),pu=y({type:R("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:C(Gt),structuredContent:y({}).loose().optional(),isError:le().optional(),_meta:re(m(),ue()).optional()}),Bs=Ch("type",[_r,Mo,jo]),lo=Ch("type",[_r,Mo,jo,As,pu]),Hs=y({role:gt,content:se([lo,C(lo)]),_meta:re(m(),ue()).optional()}),Js=c.extend({messages:C(Hs),modelPreferences:Fs.optional(),systemPrompt:m().optional(),includeContext:ye(["none","thisServer","allServers"]).optional(),temperature:q().optional(),maxTokens:q().int(),stopSequences:C(m()).optional(),metadata:t.optional(),tools:C(qo).optional(),toolChoice:Vs.optional()}),Ks=u.extend({method:R("sampling/createMessage"),params:Js}),Ws=d.extend({model:m(),stopReason:pe(ye(["endTurn","stopSequence","maxTokens"]).or(m())),role:gt,content:Bs}),Gs=d.extend({model:m(),stopReason:pe(ye(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:gt,content:se([lo,C(lo)])}),Ys=y({type:R("boolean"),title:m().optional(),description:m().optional(),default:le().optional()}),Xs=y({type:R("string"),title:m().optional(),description:m().optional(),minLength:q().optional(),maxLength:q().optional(),format:ye(["email","uri","date","date-time"]).optional(),default:m().optional()}),Qs=y({type:ye(["number","integer"]),title:m().optional(),description:m().optional(),minimum:q().optional(),maximum:q().optional(),default:q().optional()}),ei=y({type:R("string"),title:m().optional(),description:m().optional(),enum:C(m()),default:m().optional()}),ti=y({type:R("string"),title:m().optional(),description:m().optional(),oneOf:C(y({const:m(),title:m()})),default:m().optional()}),ri=y({type:R("string"),title:m().optional(),description:m().optional(),enum:C(m()),enumNames:C(m()).optional(),default:m().optional()}),oi=se([ei,ti]),Do=y({type:R("array"),title:m().optional(),description:m().optional(),minItems:q().optional(),maxItems:q().optional(),items:y({type:R("string"),enum:C(m())}),default:C(m()).optional()}),Uo=y({type:R("array"),title:m().optional(),description:m().optional(),minItems:q().optional(),maxItems:q().optional(),items:y({anyOf:C(y({const:m(),title:m()}))}),default:C(m()).optional()}),du=se([Do,Uo]),mu=se([ri,oi,du]),Nt=se([mu,Ys,Xs,Qs]),Zt=c.extend({mode:R("form").optional(),message:m(),requestedSchema:y({type:R("object"),properties:re(m(),Nt),required:C(m()).optional()}).catchall(ue())}),ni=c.extend({mode:R("url"),message:m(),elicitationId:m(),url:m().url()}),or=se([Zt,ni]),hu=u.extend({method:R("elicitation/create"),params:or}),fu=l.extend({elicitationId:m()}),gu=p.extend({method:R("notifications/elicitation/complete"),params:fu}),_u=d.extend({action:ye(["accept","decline","cancel"]),content:mp((ut)=>ut===null?void 0:ut,re(m(),se([m(),q(),le(),C(m())])).optional())}),yu=y({type:R("ref/resource"),uri:m()}),vu=y({type:R("ref/prompt"),name:m()}),Su=a.extend({ref:se([vu,yu]),argument:y({name:m(),value:m()}),context:y({arguments:re(m(),m()).optional()}).optional()}),si=u.extend({method:R("completion/complete"),params:Su}),bu=d.extend({completion:fe({values:C(m()).max(100),total:pe(q().int()),hasMore:pe(le())})}),zu=y({uri:m().startsWith("file://"),name:m().optional(),_meta:re(m(),ue()).optional()}),Rn=u.extend({method:R("roots/list"),params:a.optional()}),ii=d.extend({roots:C(zu)}),xu=p.extend({method:R("notifications/roots/list_changed"),params:l.optional()}),wu=fe({ttl:q().optional(),pollInterval:q().optional()}),ai=ye(["working","input_required","completed","failed","cancelled"]),po=y({taskId:m(),status:ai,ttl:se([q(),dp()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:pe(q()),statusMessage:pe(m())}),wt=d.extend({task:po}),$u=l.merge(po),Fo=p.extend({method:R("notifications/tasks/status"),params:$u}),Pn=u.extend({method:R("tasks/get"),params:a.extend({taskId:m()})}),Tn=d.merge(po),En=u.extend({method:R("tasks/result"),params:a.extend({taskId:m()})}),td=d.loose(),yt=Ct.extend({method:R("tasks/list")}),Ge=ft.extend({tasks:C(po)}),Vo=u.extend({method:R("tasks/cancel"),params:a.extend({taskId:m()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:a,TaskAugmentedRequestParamsSchema:c,RequestSchema:u,NotificationsParamsSchema:l,NotificationSchema:p,ResultSchema:d,RequestIdSchema:h,EmptyResultSchema:f,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:v,IconSchema:k,IconsSchema:Z,BaseMetadataSchema:E,ImplementationSchema:ee,ClientTasksCapabilitySchema:ae,ServerTasksCapabilitySchema:We,ClientCapabilitiesSchema:$e,InitializeRequestParamsSchema:Xe,InitializeRequestSchema:ot,ServerCapabilitiesSchema:Vt,InitializeResultSchema:Bt,InitializedNotificationSchema:ur,PingRequestSchema:Ht,ProgressSchema:lr,ProgressNotificationParamsSchema:zt,ProgressNotificationSchema:Jt,PaginatedRequestParamsSchema:pr,PaginatedRequestSchema:Ct,PaginatedResultSchema:ft,ResourceContentsSchema:jr,TextResourceContentsSchema:Lr,BlobResourceContentsSchema:at,RoleSchema:gt,AnnotationsSchema:_t,ResourceSchema:rr,ResourceTemplateSchema:Ao,ListResourcesRequestSchema:Ot,ListResourcesResultSchema:At,ListResourceTemplatesRequestSchema:xt,ListResourceTemplatesResultSchema:Kt,ResourceRequestParamsSchema:Wt,ReadResourceRequestParamsSchema:mr,ReadResourceRequestSchema:hr,ReadResourceResultSchema:co,ResourceListChangedNotificationSchema:fr,SubscribeRequestParamsSchema:No,SubscribeRequestSchema:M,UnsubscribeRequestParamsSchema:gr,UnsubscribeRequestSchema:Y,ResourceUpdatedNotificationParamsSchema:F,ResourceUpdatedNotificationSchema:ie,PromptArgumentSchema:j,PromptSchema:O,ListPromptsRequestSchema:te,ListPromptsResultSchema:X,GetPromptRequestParamsSchema:Qe,GetPromptRequestSchema:Zo,TextContentSchema:_r,ImageContentSchema:Mo,AudioContentSchema:jo,ToolUseContentSchema:As,EmbeddedResourceSchema:uo,ResourceLinkSchema:Ns,ContentBlockSchema:Gt,PromptMessageSchema:Sn,GetPromptResultSchema:bn,PromptListChangedNotificationSchema:Lo,ToolAnnotationsSchema:Zs,ToolExecutionSchema:zn,ToolSchema:qo,ListToolsRequestSchema:xn,ListToolsResultSchema:wn,CallToolResultSchema:$n,CallToolRequestParamsSchema:ct,CallToolRequestSchema:Ms,ToolListChangedNotificationSchema:lu,LoggingLevelSchema:kn,SetLevelRequestParamsSchema:js,SetLevelRequestSchema:Ls,LoggingMessageNotificationParamsSchema:qs,LoggingMessageNotificationSchema:Ds,ModelHintSchema:Us,ModelPreferencesSchema:Fs,ToolChoiceSchema:Vs,ToolResultContentSchema:pu,SamplingContentSchema:Bs,SamplingMessageContentBlockSchema:lo,SamplingMessageSchema:Hs,CreateMessageRequestParamsSchema:Js,CreateMessageRequestSchema:Ks,CreateMessageResultSchema:Ws,CreateMessageResultWithToolsSchema:Gs,BooleanSchemaSchema:Ys,StringSchemaSchema:Xs,NumberSchemaSchema:Qs,UntitledSingleSelectEnumSchemaSchema:ei,TitledSingleSelectEnumSchemaSchema:ti,LegacyTitledEnumSchemaSchema:ri,SingleSelectEnumSchemaSchema:oi,UntitledMultiSelectEnumSchemaSchema:Do,TitledMultiSelectEnumSchemaSchema:Uo,MultiSelectEnumSchemaSchema:du,EnumSchemaSchema:mu,PrimitiveSchemaDefinitionSchema:Nt,ElicitRequestFormParamsSchema:Zt,ElicitRequestURLParamsSchema:ni,ElicitRequestParamsSchema:or,ElicitRequestSchema:hu,ElicitationCompleteNotificationParamsSchema:fu,ElicitationCompleteNotificationSchema:gu,ElicitResultSchema:_u,ResourceTemplateReferenceSchema:yu,PromptReferenceSchema:vu,CompleteRequestParamsSchema:Su,CompleteRequestSchema:si,CompleteResultSchema:bu,RootSchema:zu,ListRootsRequestSchema:Rn,ListRootsResultSchema:ii,RootsListChangedNotificationSchema:xu,TaskCreationParamsSchema:wu,TaskStatusSchema:ai,TaskSchema:po,CreateTaskResultSchema:wt,TaskStatusNotificationParamsSchema:$u,TaskStatusNotificationSchema:Fo,GetTaskRequestSchema:Pn,GetTaskResultSchema:Tn,GetTaskPayloadRequestSchema:En,GetTaskPayloadResultSchema:td,ListTasksRequestSchema:yt,ListTasksResultSchema:Ge,CancelTaskRequestSchema:Vo,CancelTaskResultSchema:d.merge(po),ClientRequestSchema:se([Ht,ot,si,Ls,Zo,te,Ot,xt,hr,M,Y,Ms,xn,Pn,En,yt,Vo]),ClientNotificationSchema:se([v,Jt,ur,xu,Fo]),ClientResultSchema:se([f,Ws,Gs,_u,ii,Tn,Ge,wt]),ServerRequestSchema:se([Ht,Ks,hu,Rn,Pn,En,yt,Vo]),ServerNotificationSchema:se([v,Jt,Ds,ie,fr,lu,Lo,Fo,gu]),ServerResultSchema:se([f,Bt,bu,bn,X,At,Kt,co,$n,wn,Tn,Ge,wt]),CallToolResultWireSchema:ue().superRefine((ut,pT)=>{if(typeof ut!=="object"||ut===null||Array.isArray(ut)||ut.content!==void 0)return;for(let Yf of D$)if(Yf in ut){pT.addIssue({code:"custom",message:`content is required when the body carries '${Yf}' — another result family cannot default into an empty tools/call success`});return}}).transform(_O).pipe($n)}}var vO;function U$(){return vO??=yO()}function F$(e){return e.type!=="object"}var SO=new Set(["const","enum","default","examples"]),bO=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function k$(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function zO(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(k$(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=rg(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map((c)=>o(c,!1));if(n===null||typeof n!=="object")return n;if(!s&&k$(n.$id))return n;let i={},a=!1;for(let[c,u]of Object.entries(n))if(s)i[c]=o(u,!1);else if((c==="$ref"||c==="$dynamicRef")&&typeof u==="string")i[c]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u;else if(c==="$recursiveRef"&&u==="#"&&r)a=!0;else if(SO.has(c))i[c]=u;else if(bO.has(c))i[c]=o(u,!0);else i[c]=o(u,!1);if(a)if("$ref"in i)i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}];else i.$ref="#/properties/result";return i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var V$={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},B$={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},xO={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},hp;function Hh(){if(hp)return hp;let e=U$();return hp={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},hp}function H$(e){return Object.prototype.hasOwnProperty.call(V$,e)}function J$(e){return Object.prototype.hasOwnProperty.call(B$,e)}function wO(e){return Object.prototype.hasOwnProperty.call(xO,e)}function $O(e){return wO(e)?Hh().resultSchemas[e]:void 0}function kO(e){return H$(e)?Hh().requestSchemas[e]:void 0}function RO(e){return J$(e)?Hh().notificationSchemas[e]:void 0}var GU=Object.keys(V$),YU=Object.keys(B$);function qh(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function fp(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var R$={ok:!1,reason:"not-in-era"};function P$(e){return qh(e)&&qh(e.outputSchema)&&F$(e.outputSchema)}function T$(e){return e}var Jh={era:"2025-11-25",hasRequestMethod:H$,hasNotificationMethod:J$,validateRequest:(e,t)=>fp(kO(e),t),validateResult:(e,t)=>fp($O(e),t),validateNotification:(e,t)=>fp(RO(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>R$,validateInputResponse:()=>R$,samplingResultVariant:(e,t)=>{let r=U$();return fp(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let r=q$(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!=="object"||o===null||Array.isArray(o),s=t!==void 0&&F$(t);if(!n&&!s)return r;return{...r,structuredContent:{result:o}}},decodeResult(e,t){if(qh(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:T$(r)}}return{kind:"complete",result:T$(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;if(!Array.isArray(r)||!r.some((o)=>P$(o)))return t;return{...t,tools:r.map((o)=>P$(o)?{...o,outputSchema:zO(o.outputSchema)}:o)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function PO(){let e=Oh(()=>se([m(),q(),le(),dp(),re(m(),e),C(e)])),t=re(m(),e),r=se([m(),q().int()]),o=m(),n=se([m(),q().int()]),s=ye(["user","assistant"]),i=ye(["debug","info","notice","warning","error","critical","alert","emergency"]),a=m().refine((Ge)=>{try{return atob(Ge),!0}catch{return!1}},{message:"Invalid Base64 string"}),c=y({ttl:q().optional()}),u=y({taskId:m()}),l=fe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=y({_meta:l.optional()}),d=p.extend({task:c.optional()}),h=y({_meta:l.optional()}),f=y({method:m(),params:h.loose().optional()}),_=y({src:m(),mimeType:m().optional(),sizes:C(m()).optional(),theme:ye(["light","dark"]).optional()}),v=y({icons:C(_).optional()}),k=y({name:m(),title:m().optional()}),Z=k.extend({...k.shape,...v.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),E=gs(y({applyDefaults:le().optional()}),t),ee=mp((Ge)=>{if(Ge&&typeof Ge==="object"&&!Array.isArray(Ge)&&Object.keys(Ge).length===0)return{form:{}};return Ge},gs(y({form:E.optional(),url:t.optional()}),t.optional())),G=fe({list:t.optional(),cancel:t.optional(),requests:fe({sampling:fe({createMessage:t.optional()}).optional(),elicitation:fe({create:t.optional()}).optional()}).optional()}),P=fe({list:t.optional(),cancel:t.optional(),requests:fe({tools:fe({call:t.optional()}).optional()}).optional()}),ae=y({experimental:re(m(),t).optional(),sampling:y({context:t.optional(),tools:t.optional()}).optional(),elicitation:ee.optional(),roots:y({listChanged:le().optional()}).optional(),tasks:G.optional(),extensions:re(m(),t).optional()}),We=y({experimental:re(m(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:y({listChanged:le().optional()}).optional(),resources:y({subscribe:le().optional(),listChanged:le().optional()}).optional(),tools:y({listChanged:le().optional()}).optional(),tasks:P.optional(),extensions:re(m(),t).optional()}),$e=y({progress:q(),total:pe(q()),message:pe(m())}),Xe=y({...h.shape,...$e.shape,progressToken:r}),ot=f.extend({method:R("notifications/progress"),params:Xe}),Vt=h.extend({level:i,logger:m().optional(),data:ue()}),Bt=f.extend({method:R("notifications/message"),params:Vt}),ur=y({uri:m(),mimeType:pe(m()),_meta:re(m(),ue()).optional()}),Ht=ur.extend({text:m()}),lr=ur.extend({blob:a}),zt=y({audience:C(s).optional(),priority:q().min(0).max(1).optional(),lastModified:Ah({offset:!0}).optional()}),Jt=y({...k.shape,...v.shape,uri:m(),description:pe(m()),mimeType:pe(m()),size:pe(q()),annotations:zt.optional(),_meta:pe(fe({}))}),pr=y({...k.shape,...v.shape,uriTemplate:m(),description:pe(m()),mimeType:pe(m()),annotations:zt.optional(),_meta:pe(fe({}))}),Ct=f.extend({method:R("notifications/resources/list_changed"),params:h.optional()}),ft=h.extend({uri:m()}),jr=f.extend({method:R("notifications/resources/updated"),params:ft}),Lr=y({name:m(),description:pe(m()),required:pe(le())}),dr=y({...k.shape,...v.shape,description:pe(m()),arguments:pe(C(Lr)),_meta:pe(fe({}))}),at=f.extend({method:R("notifications/prompts/list_changed"),params:h.optional()}),gt=y({type:R("text"),text:m(),annotations:zt.optional(),_meta:re(m(),ue()).optional()}),_t=y({type:R("image"),data:a,mimeType:m(),annotations:zt.optional(),_meta:re(m(),ue()).optional()}),rr=y({type:R("audio"),data:a,mimeType:m(),annotations:zt.optional(),_meta:re(m(),ue()).optional()}),Ao=y({type:R("tool_use"),name:m(),id:m(),input:re(m(),ue()),_meta:re(m(),ue()).optional()}),Ot=y({type:R("resource"),resource:se([Ht,lr]),annotations:zt.optional(),_meta:re(m(),ue()).optional()}),At=Jt.extend({type:R("resource_link")}),xt=se([gt,_t,rr,At,Ot]),Kt=y({role:s,content:xt}),Wt=y({title:m().optional(),readOnlyHint:le().optional(),destructiveHint:le().optional(),idempotentHint:le().optional(),openWorldHint:le().optional()}),mr=f.extend({method:R("notifications/tools/list_changed"),params:h.optional()}),hr=y({name:m().optional()}),co=y({hints:C(hr).optional(),costPriority:q().min(0).max(1).optional(),speedPriority:q().min(0).max(1).optional(),intelligencePriority:q().min(0).max(1).optional()}),fr=y({mode:ye(["auto","required","none"]).optional()}),No=y({type:R("boolean"),title:m().optional(),description:m().optional(),default:le().optional()}),M=y({type:R("string"),title:m().optional(),description:m().optional(),minLength:q().optional(),maxLength:q().optional(),format:ye(["email","uri","date","date-time"]).optional(),default:m().optional()}),gr=y({type:ye(["number","integer"]),title:m().optional(),description:m().optional(),minimum:q().optional(),maximum:q().optional(),default:q().optional()}),Y=y({type:R("string"),title:m().optional(),description:m().optional(),enum:C(m()),default:m().optional()}),F=y({type:R("string"),title:m().optional(),description:m().optional(),oneOf:C(y({const:m(),title:m()})),default:m().optional()}),ie=y({type:R("string"),title:m().optional(),description:m().optional(),enum:C(m()),enumNames:C(m()).optional(),default:m().optional()}),j=se([Y,F]),O=y({type:R("array"),title:m().optional(),description:m().optional(),minItems:q().optional(),maxItems:q().optional(),items:y({type:R("string"),enum:C(m())}),default:C(m()).optional()}),te=y({type:R("array"),title:m().optional(),description:m().optional(),minItems:q().optional(),maxItems:q().optional(),items:y({anyOf:C(y({const:m(),title:m()}))}),default:C(m()).optional()}),X=se([O,te]),Qe=se([ie,j,X]),Zo=se([Qe,No,M,gr]),_r=d.extend({mode:R("form").optional(),message:m(),requestedSchema:y({type:R("object"),properties:re(m(),Zo),required:C(m()).optional()}).catchall(ue())}),Mo=y({type:R("ref/resource"),uri:m()}),jo=y({type:R("ref/prompt"),name:m()}),As=y({uri:m().startsWith("file://"),name:m().optional(),_meta:re(m(),ue()).optional()}),uo=ae.shape,Ns=y({experimental:uo.experimental,sampling:uo.sampling,elicitation:uo.elicitation,roots:uo.roots,extensions:uo.extensions}),Gt=We.shape,Sn=y({experimental:Gt.experimental,logging:Gt.logging,completions:Gt.completions,prompts:Gt.prompts,resources:Gt.resources,tools:Gt.tools,extensions:Gt.extensions}),bn=fe({progressToken:r.optional(),[Ko]:m(),[Mn]:Z.optional(),[Wo]:Ns,[Ln]:i.optional()}),Lo=y({...k.shape,...v.shape,description:m().optional(),inputSchema:fe({$schema:m().optional(),type:R("object")}),outputSchema:fe({$schema:m().optional()}).optional(),annotations:Wt.optional(),_meta:re(m(),ue()).optional()}),Zs=y({type:R("tool_result"),toolUseId:m(),content:C(xt),structuredContent:ue().optional(),isError:le().optional(),_meta:re(m(),ue()).optional()}),zn=se([gt,_t,rr,Ao,Zs]),qo=y({role:s,content:se([zn,C(zn)]),_meta:re(m(),ue()).optional()}),xn=m(),wn=fe({[zr]:Z.optional().catch(void 0)}),$n=wn.optional();function ct(Ge){return fe({_meta:$n,resultType:xn.default("complete"),...Ge})}let Ms=ct({}),lu=ct({nextCursor:o.optional()}),kn=ct({content:C(xt),structuredContent:ue().optional(),isError:le().optional()}),js=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),tools:C(Lo),nextCursor:o.optional()}),Ls=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),prompts:C(dr),nextCursor:o.optional()}),qs=ct({description:m().optional(),messages:C(Kt)}),Ds=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),resources:C(Jt),nextCursor:o.optional()}),Us=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),resourceTemplates:C(pr),nextCursor:o.optional()}),Fs=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),contents:C(se([Ht,lr]))}),Vs=ct({completion:y({values:C(m()).max(100),total:q().int().optional(),hasMore:le().optional()}).loose()}),pu=ct({ttlMs:q().int().min(0),cacheScope:ye(["public","private"])}),Bs=ct({ttlMs:q().int().min(0).catch(0),cacheScope:ye(["public","private"]).catch("private"),supportedVersions:C(m()),capabilities:Sn,instructions:m().optional()}),lo=y({messages:C(qo),modelPreferences:co.optional(),systemPrompt:m().optional(),includeContext:ye(["none","thisServer","allServers"]).optional(),temperature:q().optional(),maxTokens:q().int(),stopSequences:C(m()).optional(),metadata:t.optional(),tools:C(Lo).optional(),toolChoice:fr.optional()}),Hs=y({method:R("sampling/createMessage"),params:lo}),Js=y({method:R("roots/list"),params:y({_meta:re(m(),ue()).optional()}).optional()}),Ks=y({...qo.shape,model:m(),stopReason:m().optional()}),Ws=y({roots:C(As)}),Gs=y({action:ye(["accept","decline","cancel"]),content:re(m(),se([m(),q(),le(),C(m())])).optional()}),Ys=y({mode:R("url"),message:m(),url:m().url()}),Xs=se([_r,Ys]),Qs=y({method:R("elicitation/create"),params:Xs}),ei=se([Hs,Js,Qs]),ti=se([Ks,Ws,Gs]),ri=re(m(),ei),oi=re(m(),ti),Do=ct({inputRequests:ri.optional(),requestState:m().optional()}),Uo={inputResponses:oi.optional(),requestState:m().optional()},du=y({_meta:bn,...Uo}),mu=fe({progressToken:r.optional()});function Nt(Ge,Vo){return y({method:R(Ge),params:y({_meta:bn,...Vo})})}function Zt(Ge,Vo){return y({method:R(Ge),params:y({_meta:mu.optional(),...Vo}).optional()})}let ni={name:m(),arguments:re(m(),ue()).optional(),...Uo},or={cursor:o.optional()},hu=Nt("tools/call",ni),fu=Nt("tools/list",or),gu=Nt("prompts/list",or),_u=Nt("prompts/get",{name:m(),arguments:re(m(),m()).optional(),...Uo}),yu=Nt("resources/list",or),vu=Nt("resources/templates/list",or),Su=Nt("resources/read",{uri:m(),...Uo}),si={ref:se([jo,Mo]),argument:y({name:m(),value:m()}),context:y({arguments:re(m(),m()).optional()}).optional()},bu=Nt("completion/complete",si),zu=Nt("server/discover",{}),Rn=y({toolsListChanged:le().optional(),promptsListChanged:le().optional(),resourcesListChanged:le().optional(),resourceSubscriptions:C(m()).optional()}),ii={notifications:Rn},xu=Nt("subscriptions/listen",ii),wu=wn.extend({"io.modelcontextprotocol/subscriptionId":n}),ai=fe({_meta:wu,resultType:xn.default("complete")}),po={"tools/call":Zt("tools/call",ni),"tools/list":Zt("tools/list",or),"prompts/get":Zt("prompts/get",{name:m(),arguments:re(m(),m()).optional()}),"prompts/list":Zt("prompts/list",or),"resources/list":Zt("resources/list",or),"resources/templates/list":Zt("resources/templates/list",or),"resources/read":Zt("resources/read",{uri:m()}),"completion/complete":Zt("completion/complete",si),"server/discover":Zt("server/discover",{}),"subscriptions/listen":Zt("subscriptions/listen",ii)};function wt(Ge){return fe({_meta:$n,...Ge})}let $u={"tools/call":wt({content:C(xt),structuredContent:ue().optional(),isError:le().optional()}),"tools/list":wt({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),tools:C(Lo),nextCursor:o.optional()}),"prompts/get":wt({description:m().optional(),messages:C(Kt)}),"prompts/list":wt({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),prompts:C(dr),nextCursor:o.optional()}),"resources/list":wt({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),resources:C(Jt),nextCursor:o.optional()}),"resources/templates/list":wt({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),resourceTemplates:C(pr),nextCursor:o.optional()}),"resources/read":wt({ttlMs:q().int().min(0),cacheScope:ye(["public","private"]),contents:C(se([Ht,lr]))}),"completion/complete":wt({completion:y({values:C(m()).max(100),total:q().int().optional(),hasMore:le().optional()}).loose()}),"server/discover":wt({ttlMs:q().int().min(0).catch(0),cacheScope:ye(["public","private"]).catch("private"),supportedVersions:C(m()),capabilities:Sn,instructions:m().optional()}),"subscriptions/listen":wt({})},Fo=fe({"io.modelcontextprotocol/subscriptionId":n.optional()}),Pn=y({method:R("notifications/subscriptions/acknowledged"),params:y({_meta:Fo.optional(),notifications:Rn})}),Tn=y({_meta:Fo.optional(),requestId:n,reason:m().optional()}),En=y({method:R("notifications/cancelled"),params:Tn}),td={"notifications/cancelled":En,"notifications/progress":ot,"notifications/message":Bt,"notifications/resources/updated":jr,"notifications/resources/list_changed":Ct,"notifications/tools/list_changed":mr,"notifications/prompts/list_changed":at,"notifications/subscriptions/acknowledged":Pn},yt=(Ge)=>y({jsonrpc:R("2.0"),id:se([m(),q().int()]),result:Ge}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:c,RelatedTaskMetadataSchema:u,RequestMetaSchema:l,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:d,NotificationsParamsSchema:h,NotificationSchema:f,IconSchema:_,IconsSchema:v,BaseMetadataSchema:k,ImplementationSchema:Z,ClientTasksCapabilitySchema:G,ServerTasksCapabilitySchema:P,ClientCapabilitiesSchema:ae,ServerCapabilitiesSchema:We,ProgressSchema:$e,ProgressNotificationParamsSchema:Xe,ProgressNotificationSchema:ot,LoggingMessageNotificationParamsSchema:Vt,LoggingMessageNotificationSchema:Bt,ResourceContentsSchema:ur,TextResourceContentsSchema:Ht,BlobResourceContentsSchema:lr,AnnotationsSchema:zt,ResourceSchema:Jt,ResourceTemplateSchema:pr,ResourceListChangedNotificationSchema:Ct,ResourceUpdatedNotificationParamsSchema:ft,ResourceUpdatedNotificationSchema:jr,PromptArgumentSchema:Lr,PromptSchema:dr,PromptListChangedNotificationSchema:at,TextContentSchema:gt,ImageContentSchema:_t,AudioContentSchema:rr,ToolUseContentSchema:Ao,EmbeddedResourceSchema:Ot,ResourceLinkSchema:At,ContentBlockSchema:xt,PromptMessageSchema:Kt,ToolAnnotationsSchema:Wt,ToolListChangedNotificationSchema:mr,ModelHintSchema:hr,ModelPreferencesSchema:co,ToolChoiceSchema:fr,BooleanSchemaSchema:No,StringSchemaSchema:M,NumberSchemaSchema:gr,UntitledSingleSelectEnumSchemaSchema:Y,TitledSingleSelectEnumSchemaSchema:F,LegacyTitledEnumSchemaSchema:ie,SingleSelectEnumSchemaSchema:j,UntitledMultiSelectEnumSchemaSchema:O,TitledMultiSelectEnumSchemaSchema:te,MultiSelectEnumSchemaSchema:X,EnumSchemaSchema:Qe,PrimitiveSchemaDefinitionSchema:Zo,ElicitRequestFormParamsSchema:_r,ResourceTemplateReferenceSchema:Mo,PromptReferenceSchema:jo,RootSchema:As,ClientCapabilities2026Schema:Ns,ServerCapabilities2026Schema:Sn,RequestMetaEnvelopeSchema:bn,ToolSchema:Lo,ToolResultContentSchema:Zs,SamplingMessageContentBlockSchema:zn,SamplingMessageSchema:qo,ResultTypeSchema:xn,ResultMetaSchema:wn,ResultSchema:Ms,PaginatedResultSchema:lu,CallToolResultSchema:kn,ListToolsResultSchema:js,ListPromptsResultSchema:Ls,GetPromptResultSchema:qs,ListResourcesResultSchema:Ds,ListResourceTemplatesResultSchema:Us,ReadResourceResultSchema:Fs,CompleteResultSchema:Vs,CacheableResultSchema:pu,DiscoverResultSchema:Bs,CreateMessageRequestParamsSchema:lo,CreateMessageRequestSchema:Hs,ListRootsRequestSchema:Js,CreateMessageResultSchema:Ks,ListRootsResultSchema:Ws,ElicitResultSchema:Gs,ElicitRequestURLParamsSchema:Ys,ElicitRequestParamsSchema:Xs,ElicitRequestSchema:Qs,InputRequestSchema:ei,InputResponseSchema:ti,InputRequestsSchema:ri,InputResponsesSchema:oi,InputRequiredResultSchema:Do,InputResponseRequestParamsSchema:du,CallToolRequestSchema:hu,ListToolsRequestSchema:fu,ListPromptsRequestSchema:gu,GetPromptRequestSchema:_u,ListResourcesRequestSchema:yu,ListResourceTemplatesRequestSchema:vu,ReadResourceRequestSchema:Su,CompleteRequestSchema:bu,DiscoverRequestSchema:zu,SubscriptionFilterSchema:Rn,SubscriptionsListenRequestSchema:xu,SubscriptionsListenResultMetaSchema:wu,SubscriptionsListenResultSchema:ai,dispatchRequestSchemas:po,dispatchResultSchemas:$u,NotificationMetaSchema:Fo,SubscriptionsAcknowledgedNotificationSchema:Pn,CancelledNotificationParamsSchema:Tn,CancelledNotificationSchema:En,notificationSchemas2026:td,JSONRPCResultResponseSchema:yt(Ms),CallToolResultResponseSchema:yt(se([kn,Do])),ListToolsResultResponseSchema:yt(js),ListPromptsResultResponseSchema:yt(Ls),GetPromptResultResponseSchema:yt(se([qs,Do])),ListResourcesResultResponseSchema:yt(Ds),ListResourceTemplatesResultResponseSchema:yt(Us),ReadResourceResultResponseSchema:yt(se([Fs,Do])),CompleteResultResponseSchema:yt(Vs),DiscoverResultResponseSchema:yt(Bs),SubscriptionsListenResultResponseSchema:yt(ai)}}var TO;function Po(){return TO??=PO()}var EO=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function IO(e){return EO.includes(e)}var Kh=Symbol("modelcontextprotocol.resultCacheHintFallback");function CO(e){return e[Kh]}function K$(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function W$(e){return e==="public"||e==="private"}var Q=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),Se=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Et(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,t)}constructor(t,r,o){super(r);this.code=t,this.data=o,this.name="ProtocolError",To(this,new.target)}static fromError(t,r,o){if(t===Q.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Y$(n.elicitations,r)}if(t===Q.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new Nc({supported:n.supported,requested:n.requested},r)}if(t===Q.InvalidParams||t===Q.ResourceNotFound){let n=o;if(typeof n?.uri==="string"&&(t===Q.ResourceNotFound||Object.keys(n).length===1))return new G$(n.uri,r)}if(t===Q.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new X$({requiredCapabilities:n.requiredCapabilities},r)}return new e(t,r,o)}},G$=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(Q.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Y$=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Nc=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Q.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},X$=class extends Se{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(Q.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},OO=0,AO="private",NO=["tools/call","prompts/get","resources/read"];function ZO(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete")return t;if(NO.includes(e))return t;throw new Se(Q.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function MO(e,t){let r=CO(t);if(t.resultType!=="complete"||!IO(e))return r===void 0?t:UO(t);let o=t,n=K$(o.ttlMs)?o.ttlMs:qO(r),s=W$(o.cacheScope)?o.cacheScope:DO(r),i={...o,ttlMs:n,cacheScope:s};return delete i[Kh],i}function jO(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function LO(e,t){if(t===void 0)return e;let r=e._meta;if(r===void 0)return{...e,_meta:{[zr]:t}};if(!jO(r))return e;if(r[zr]!==void 0)return e;return{...e,_meta:{...r,[zr]:t}}}function qO(e){return e!==void 0&&K$(e.ttlMs)?e.ttlMs:OO}function DO(e){return e!==void 0&&W$(e.cacheScope)?e.cacheScope:AO}function UO(e){let t={...e};return delete t[Kh],t}var FO=["elicitation/create","sampling/createMessage","roots/list"],gp;function Q$(){if(gp)return gp;let e=Po();return gp={request:{"elicitation/create":y({method:R("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":y({method:R("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":y({method:R("roots/list"),params:fe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},gp}function ek(e){return FO.includes(e)}function Nh(e){return ek(e)?Q$().request[e]:void 0}function VO(e){return ek(e)?Q$().response[e]:void 0}var Wh={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},tk={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function rk(e){return Object.prototype.hasOwnProperty.call(Wh,e)}function ok(e){return Object.prototype.hasOwnProperty.call(tk,e)}function BO(e){return Object.prototype.hasOwnProperty.call(Wh,e)}function HO(e){return rk(e)?Po().dispatchRequestSchemas[e]:void 0}function JO(e){return BO(e)?Po().dispatchResultSchemas[e]:void 0}function KO(e){return ok(e)?Po().notificationSchemas2026[e]:void 0}var XU=Object.keys(Wh),QU=Object.keys(tk);function Ec(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Pc(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var WO={ok:!1,reason:"not-in-era"},GO=[Ko,Wo];function YO(e,t){let r=t,o=!1,n=()=>{if(!o)r={...r},o=!0;return r},s=t.tools;if(e==="tools/list"&&Array.isArray(s)&&s.some((a)=>Ec(a)&&("execution"in a)))n().tools=s.map((a)=>{if(!Ec(a)||!("execution"in a))return a;let c={...a};return delete c.execution,c});let i=t.capabilities;if(Ec(i)&&"tasks"in i){let a={...i};delete a.tasks,n().capabilities=a}return r}var Gh={era:"2026-07-28",hasRequestMethod:rk,hasNotificationMethod:ok,hasInputRequestMethod:(e)=>Nh(e)!==void 0,validateRequest:(e,t)=>Pc(HO(e),t),validateResult:(e,t)=>Pc(JO(e),t),validateNotification:(e,t)=>Pc(KO(e),t),validateInputRequest:(e,t)=>Pc(Nh(e),t),validateInputResponse:(e,t)=>Pc(VO(e),t),samplingResultVariant:()=>WO,outboundEnvelope(e){return{[Ko]:e.protocolVersion,[Mn]:e.clientInfo,[Wo]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ln]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of GO)if(!(o in e))t.push({key:o,problem:"missing"});let r=Po().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((i)=>i.key===s&&i.problem==="missing"))continue;t.push({key:s,problem:o.message})}return t},projectCallToolResult:(e)=>q$(e),inputRequestSchema:Nh,decodeResult(e,t){if(!Ec(t))return{kind:"invalid",error:new D(H.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new D(H.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!=="string")return{kind:"invalid",error:new D(H.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,a=Ec(i)?i:{},c=t.requestState,u=t._meta===void 0?void 0:Po().ResultMetaSchema.safeParse(t._meta),l=u?.success?u.data:void 0;if(Object.keys(a).length===0&&typeof c!=="string")return{kind:"invalid",error:new D(H.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:a,...typeof c==="string"&&{requestState:c},...l!==void 0&&{_meta:l}}}if(r!=="complete")return{kind:"invalid",error:new D(H.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=XO(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new D(H.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return LO(MO(e,ZO(e,YO(e,t))),r)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Po().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((r)=>r.message).join("; ")}`}},_p;function XO(){if(_p)return _p;let e=Po();return _p={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},_p}var Sp="2026-07-28";function Yr(e){return e!==void 0&&Xr(e)?Gh:Jh}function E$(e){if(e.revision!==void 0)return Yr(e.revision).era;return e.era==="modern"?Gh.era:Jh.era}function Zh(e){return nk.some((t)=>t.hasRequestMethod(e))}function Mh(e){return nk.some((t)=>t.hasNotificationMethod(e))}function I$(e){return e==="tasks/get"||e==="tasks/cancel"}var nk=[Jh,Gh],QO=Qf({AnnotationsSchema:()=>wr,AudioContentSchema:()=>on,BaseMetadataSchema:()=>br,BaseRequestParamsSchema:()=>et,BlobResourceContentsSchema:()=>Xn,BooleanSchemaSchema:()=>rs,CallToolRequestParamsSchema:()=>_a,CallToolRequestSchema:()=>ya,CallToolResultSchema:()=>xo,CancelTaskRequestSchema:()=>zl,CancelTaskResultSchema:()=>xl,CancelledNotificationParamsSchema:()=>$i,CancelledNotificationSchema:()=>Hn,ClientCapabilitiesSchema:()=>Ri,ClientNotificationSchema:()=>$l,ClientRequestSchema:()=>wl,ClientResultSchema:()=>kl,ClientTasksCapabilitySchema:()=>ll,CompatibilityCallToolResultSchema:()=>dl,CompleteRequestParamsSchema:()=>Ha,CompleteRequestSchema:()=>Ja,CompleteResultSchema:()=>Ka,ContentBlockSchema:()=>$r,CreateMessageRequestParamsSchema:()=>Ia,CreateMessageRequestSchema:()=>Ca,CreateMessageResultSchema:()=>Oa,CreateMessageResultWithToolsSchema:()=>Aa,CreateTaskResultSchema:()=>hl,CursorSchema:()=>Dn,DiscoverRequestSchema:()=>Ci,DiscoverResultSchema:()=>bo,ElicitRequestFormParamsSchema:()=>un,ElicitRequestParamsSchema:()=>La,ElicitRequestSchema:()=>qa,ElicitRequestURLParamsSchema:()=>ja,ElicitResultSchema:()=>Fa,ElicitationCompleteNotificationParamsSchema:()=>Da,ElicitationCompleteNotificationSchema:()=>Ua,EmbeddedResourceSchema:()=>nn,EmptyResultSchema:()=>So,EnumSchemaSchema:()=>Ma,GetPromptRequestParamsSchema:()=>aa,GetPromptRequestSchema:()=>ca,GetPromptResultSchema:()=>pa,GetTaskPayloadRequestSchema:()=>yl,GetTaskPayloadResultSchema:()=>vl,GetTaskRequestSchema:()=>gl,GetTaskResultSchema:()=>_l,IconSchema:()=>ki,IconsSchema:()=>Vr,ImageContentSchema:()=>rn,ImplementationSchema:()=>xr,InitializeRequestParamsSchema:()=>Pi,InitializeRequestSchema:()=>Ti,InitializeResultSchema:()=>Ei,InitializedNotificationSchema:()=>Ii,JSONArraySchema:()=>cl,JSONObjectSchema:()=>Ue,JSONRPCErrorResponseSchema:()=>Xo,JSONRPCMessageSchema:()=>Qo,JSONRPCNotificationSchema:()=>Bn,JSONRPCRequestSchema:()=>Vn,JSONRPCResponseSchema:()=>ul,JSONRPCResultResponseSchema:()=>Yo,JSONValueSchema:()=>Fr,LegacyTitledEnumSchemaSchema:()=>ss,ListChangedOptionsBaseSchema:()=>Sa,ListPromptsRequestSchema:()=>sa,ListPromptsResultSchema:()=>ia,ListResourceTemplatesRequestSchema:()=>Li,ListResourceTemplatesResultSchema:()=>qi,ListResourcesRequestSchema:()=>Mi,ListResourcesResultSchema:()=>ji,ListRootsRequestSchema:()=>Ga,ListRootsResultSchema:()=>Ya,ListTasksRequestSchema:()=>Sl,ListTasksResultSchema:()=>bl,ListToolsRequestSchema:()=>fa,ListToolsResultSchema:()=>ga,LoggingLevelSchema:()=>ts,LoggingMessageNotificationParamsSchema:()=>xa,LoggingMessageNotificationSchema:()=>wa,ModelHintSchema:()=>$a,ModelPreferencesSchema:()=>ka,MultiSelectEnumSchemaSchema:()=>Za,NotificationSchema:()=>st,NotificationsParamsSchema:()=>lt,NumberSchemaSchema:()=>cn,PaginatedRequestParamsSchema:()=>Ni,PaginatedRequestSchema:()=>Br,PaginatedResultSchema:()=>Hr,PingRequestSchema:()=>Kn,PrimitiveSchemaDefinitionSchema:()=>cs,ProgressNotificationParamsSchema:()=>Ai,ProgressNotificationSchema:()=>Wn,ProgressSchema:()=>Oi,ProgressTokenSchema:()=>qn,PromptArgumentSchema:()=>oa,PromptListChangedNotificationSchema:()=>da,PromptMessageSchema:()=>la,PromptReferenceSchema:()=>Ba,PromptSchema:()=>na,ReadResourceRequestParamsSchema:()=>Di,ReadResourceRequestSchema:()=>Ui,ReadResourceResultSchema:()=>Fi,RelatedTaskMetadataSchema:()=>wi,RequestIdSchema:()=>sr,RequestMetaSchema:()=>Un,RequestSchema:()=>Fe,ResourceContentsSchema:()=>Gn,ResourceLinkSchema:()=>sn,ResourceListChangedNotificationSchema:()=>Vi,ResourceRequestParamsSchema:()=>en,ResourceSchema:()=>Qn,ResourceTemplateReferenceSchema:()=>Va,ResourceTemplateSchema:()=>Zi,ResourceUpdatedNotificationParamsSchema:()=>ta,ResourceUpdatedNotificationSchema:()=>ra,ResultMetaObjectSchema:()=>Fn,ResultSchema:()=>Ve,RoleSchema:()=>Jr,RootSchema:()=>Wa,RootsListChangedNotificationSchema:()=>Xa,SamplingContentSchema:()=>Ta,SamplingMessageContentBlockSchema:()=>yo,SamplingMessageSchema:()=>Ea,ServerCapabilitiesSchema:()=>Jn,ServerNotificationSchema:()=>Pl,ServerRequestSchema:()=>Rl,ServerResultSchema:()=>Tl,ServerTasksCapabilitySchema:()=>pl,SetLevelRequestParamsSchema:()=>ba,SetLevelRequestSchema:()=>za,SingleSelectEnumSchemaSchema:()=>Na,StringSchemaSchema:()=>an,SubscribeRequestParamsSchema:()=>Bi,SubscribeRequestSchema:()=>Hi,SubscriptionFilterSchema:()=>es,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Yi,SubscriptionsAcknowledgedNotificationSchema:()=>Xi,SubscriptionsListenRequestParamsSchema:()=>Wi,SubscriptionsListenRequestSchema:()=>Gi,SubscriptionsListenResultMetaSchema:()=>Qi,SubscriptionsListenResultSchema:()=>ea,TaskAugmentedRequestParamsSchema:()=>vo,TaskCreationParamsSchema:()=>ml,TaskMetadataSchema:()=>xi,TaskSchema:()=>Kr,TaskStatusNotificationParamsSchema:()=>ec,TaskStatusNotificationSchema:()=>fl,TaskStatusSchema:()=>Qa,TextContentSchema:()=>tn,TextResourceContentsSchema:()=>Yn,TitledMultiSelectEnumSchemaSchema:()=>as,TitledSingleSelectEnumSchemaSchema:()=>ns,ToolAnnotationsSchema:()=>ma,ToolChoiceSchema:()=>Ra,ToolExecutionSchema:()=>ha,ToolListChangedNotificationSchema:()=>va,ToolResultContentSchema:()=>Pa,ToolSchema:()=>zo,ToolUseContentSchema:()=>ua,UnsubscribeRequestParamsSchema:()=>Ji,UnsubscribeRequestSchema:()=>Ki,UntitledMultiSelectEnumSchemaSchema:()=>is,UntitledSingleSelectEnumSchemaSchema:()=>os});var bp=(e)=>Vn.safeParse(e).success,sk=(e)=>Bn.safeParse(e).success,ys=(e)=>Yo.safeParse(e).success,Zc=(e)=>Xo.safeParse(e).success;var ik=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var eA="Mcp-Param-",C$="x-mcp-header",tA=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,rA=new Set(["string","integer","boolean"]);function Yh(e){let t=[],r=new Map,o,n=(i,a,c)=>{if(i===null||typeof i!=="object")return;let u=i;if(C$ in u){if(!c||a.length===0)return`${yp(a)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let p=u[C$];if(typeof p!=="string"||p.length===0)return`${yp(a)}: x-mcp-header MUST be a non-empty string`;if(!tA.test(p))return`${yp(a)}: x-mcp-header '${p}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let d=typeof u.type==="string"?u.type:void 0;if(d===void 0||!rA.has(d)){let _=`${yp(a)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;if(d!=="number")return _;o??=_}let h=p.toLowerCase(),f=r.get(h);if(f!==void 0)return`x-mcp-header '${p}' is not case-insensitively unique (also declared as '${f}')`;r.set(h,p),t.push({path:a,headerName:p,type:d})}let l=u.properties;if(l!==null&&typeof l==="object")for(let[p,d]of Object.entries(l)){let h=n(d,[...a,p],c);if(h!==void 0)return h}for(let p of oA){let d=u[p];if(d===void 0)continue;let h=Array.isArray(d)?d:d!==null&&typeof d==="object"&&nA.has(p)?Object.values(d):[d];for(let f of h){let _=n(f,[...a,`<${p}>`],!1);if(_!==void 0)return _}}},s=n(e,[],!0);if(s!==void 0)return{valid:!1,reason:o??s};return o===void 0?{valid:!0,declarations:t}:{valid:!1,reason:o,declarations:t}}var oA=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],nA=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function yp(e){return e.length===0?"<root>":e.join(".")}var ak="=?base64?",ck="?=";function sA(e){if(typeof e==="string")return e;if(typeof e==="boolean")return e?"true":"false";if(typeof e==="number"){if(!Number.isFinite(e))return;if(Number.isInteger(e)&&!Number.isSafeInteger(e))return;return String(e)}}function iA(e){if(e.length===0)return!0;if(e.startsWith(ak)&&e.endsWith(ck))return!0;if(e!==e.trim())return!0;for(let t=0;t<e.length;t++){let r=e.codePointAt(t);if(r===9||r>=32&&r<=126)continue;return!0}return!1}function aA(e){let t=new TextEncoder().encode(e),r="";for(let o of t)r+=String.fromCodePoint(o);return btoa(r)}function uk(e){return iA(e)?`${ak}${aA(e)}${ck}`:e}function cA(e,t){let r=e;for(let o of t){if(r===null||typeof r!=="object")return;r=r[o]}return r}function lk(e,t){let r={};for(let o of e){let n=cA(t,o.path);if(n===void 0||n===null)continue;let s=sA(n);if(s===void 0)continue;r[`${eA}${o.headerName}`]=uk(s)}return r}var _s=-32020,e4=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[Q.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[_s,Q.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[Q.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[Q.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[Q.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[_s],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[Q.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[_s],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],t4={[Q.ParseError]:400,[Q.InvalidRequest]:400,[Q.MethodNotFound]:404,[Q.UnsupportedProtocolVersion]:400,[Q.MissingRequiredClientCapability]:400,[_s]:400};function zp(e,t){return up(e,t)}function Tc(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Dh(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var O$=!1,Uh="draft-2020-12";function uA(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Uh});else if(r.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!O$)O$=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");o=ap(e,{target:Uh,io:t})}else throw Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(o.type!==void 0)return o;return pk(o)?{type:"object",...o}:o}if(o.type!==void 0&&o.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}var lA=/^#\/(\$defs|definitions)\/([^/~%]+)$/;function pk(e,t=e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;let r=typeof e.$ref==="string"&&lA.exec(e.$ref);if(r&&t[r[1]]?.[r[2]]?.type==="object")return!0;for(let o of["oneOf","anyOf","allOf"]){let n=e[o];if(Array.isArray(n)&&n.length>0)return n.every((s)=>s!==null&&typeof s==="object"&&(s.type==="object"||pk(s,"$id"in s?{}:t)))}return!1}function pA(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function jh(e,t){let r=await e["~standard"].validate(t);if(r.issues&&r.issues.length>0)return{success:!1,error:r.issues.map((o)=>pA(o)).join(", ")};return{success:!0,data:r.value}}function dA(e){let t=ap(e,{target:Uh,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var mA=/\\\.\\d\{(\d+)\}/;function hA(e){let t=mA.exec(e),r=[void 0,-1,0];if(t)r.push(Number(t[1]));return[!1,!0].flatMap((o)=>[!1,!0].flatMap((n)=>r.map((s)=>Ah({local:o,offset:n,precision:s}))))}function fA(e,t){let r;switch(e){case"email":r=[h$()];break;case"uri":r=[g$()];break;case"date":r=[gO()];break;case"date-time":r=hA(t);break}return new Set(r.map((o)=>dA(o)).filter((o)=>o!==void 0))}function gA(e,t,r){if(r!=="zod")return!0;return fA(e,t).has(t)}function Cc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function _A(e){try{return uA(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new Se(Q.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var yA=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Xh(e){return yA.has(e)||e.startsWith("x-")}var vA=new Set(["$schema",...Object.keys(un.shape.requestedSchema.shape)]),A$={string:Tc([an,os,ns,ss]),number:Tc([cn]),integer:Tc([cn]),boolean:Tc([rs]),array:Tc([is,as])},SA=new Set(an.shape.format.unwrap().options);function bA(e,t,r,o){if(!Cc(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(A$,e.type)?A$[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,a]of Object.entries(e))if(n.has(i)||Xh(i))s[i]=a;else if(i==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!SA.has(e.format))s[i]=a;else if(typeof a!=="string"||!gA(e.format,a,r))o.push(`${t}.${i}`)}else o.push(`${t}.${i}`);return s}function zA(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))if(n==="properties"&&Cc(s))r[n]=Object.fromEntries(Object.entries(s).map(([i,a])=>[i,bA(a,`properties.${i}`,t,o)]));else if(vA.has(n))r[n]=s;else if(!Xh(n))o.push(n);if(o.length>0)throw new Se(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function xA(e,t){if(!Cc(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!zp(cs,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Fh(e,t,r=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((o,n)=>Fh(o,t[n],`${r}[${n}]`));if(!Cc(e)||!Cc(t))return[];return Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;if(!Object.prototype.hasOwnProperty.call(t,o))return Xh(o)?[]:[s];return Fh(n,t[o],s)})}function wA(e){if(!Dh(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=zA(_A(e.requestedSchema),t),o=zp(un.shape.requestedSchema,r);if(!o.success)throw new Se(Q.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${xA(r,o.error.message)}`);let n=Fh(r,o.data);if(n.length>0)throw new Se(Q.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter((i)=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new Se(Q.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function $A(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState==="string";if(!t&&!r)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var r4=Object.assign($A,{elicit(e){try{return{method:"elicitation/create",params:wA(e)}}catch(t){throw t instanceof Se?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var kA=!0,RA=10,PA=250;function dk(e){return{autoFulfill:e?.autoFulfill??kA,maxRounds:e?.maxRounds??RA}}function TA(e,t,r){let o=t!==void 0&&Object.keys(t).length>0;if(!o&&r===void 0)return e;return{...e,...o&&{inputResponses:t},...r!==void 0&&{requestState:r}}}function EA(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function IA(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof D?t.reason:new D(H.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof D?t.reason:new D(H.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function CA(e){let t=new AbortController,r=()=>t.abort(e?.reason);if(e?.addEventListener("abort",r,{once:!0}),e?.aborted)t.abort(e.reason);return{signal:t.signal,abort:(o)=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}async function OA(e){let{config:t,method:r,originalParams:o,requestOptions:n,hooks:s,signal:i}=e,a=e.flowStartedAt??Date.now(),c=e.firstPayload,u=0;while(!0){if(u+=1,u>t.maxRounds)throw new D(H.InputRequiredRoundsExceeded,EA(r,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});n.onprogress?.({progress:u,message:`Fulfilling input required by '${r}' (round ${u})`});let l=Object.entries(c.inputRequests??{}),p;if(l.length>0){let f=CA(i);try{let _=await Promise.all(l.map(async([v,k])=>{try{return[v,await s.dispatchInputRequest(v,k,f.signal)]}catch(Z){throw f.abort(Z),Z}}));p=Object.fromEntries(_)}finally{f.dispose()}}else await IA(PA,i);let d={...n.timeout!==void 0&&{timeout:n.timeout}};if(n.maxTotalTimeout!==void 0){let f=Date.now()-a,_=n.maxTotalTimeout-f;if(_<=0)throw new D(H.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:f});d.maxTotalTimeout=_}let h=await s.retry(TA(o,p,c.requestState),d);if(ik(h)){c={inputRequests:h.inputRequests??{},...h.requestState!==void 0&&{requestState:h.requestState}};continue}return h}}var AA=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],NA={IdJagTokenExchangeResponseSchema:nc,OAuthClientInformationFullSchema:ac,OAuthClientInformationSchema:ic,OAuthClientMetadataSchema:sc,OAuthClientRegistrationErrorSchema:El,OAuthErrorResponseSchema:ps,OAuthMetadataSchema:us,OAuthProtectedResourceMetadataSchema:tc,OAuthTokenRevocationRequestSchema:Il,OAuthTokensSchema:ls,OpenIdProviderDiscoveryMetadataSchema:oc,OpenIdProviderMetadataSchema:rc},mk={},hk={};function fk(e,t){let r=e.slice(0,-6);mk[r]=t,hk[r]=(o)=>t.safeParse(o).success}for(let e of AA)fk(e,QO[e]);for(let[e,t]of Object.entries(NA))fk(e,t);var ZA=Object.freeze(mk),Qh=Object.freeze(hk);function MA(e){switch(e){case"initialize":case"notifications/initialized":return Yr(void 0);case"server/discover":return Yr(Sp);default:return}}var Mc=60000,jA=[Ko,Mn,Wo,Ln],LA=["inputResponses","requestState"];function N$(e,t){let r=e.params;if(!Ic(r))return{message:e,lifted:{}};let o=r._meta,n=Ic(o)?jA.filter((c)=>(c in o)):[],s=t==="request"?LA.filter((c)=>(c in r)):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},a={...r};if(n.length>0&&Ic(o)){let c={},u={...o};for(let l of n)c[l]=o[l],delete u[l];if(i.envelope=c,Object.keys(u).length>0)a._meta=u;else delete a._meta}for(let c of s){if(c==="inputResponses")i.inputResponses=a[c];if(c==="requestState")i.requestState=a[c];delete a[c]}return{message:{...e,params:a},lifted:i}}function Z$(e,t){let r=e.validateResult(t,void 0);if(!r.ok&&r.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function ef(e){return()=>e}var qA=ef(void 0),DA,jc=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{DA=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??il,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new D(H.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new D(H.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),ys(n)||Zc(n))this._onresponse(n);else if(bp(n))this._onrequest(n,s);else if(sk(n))this._onnotification(n,s);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new D(H.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=N$(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=E$(t.classification);if(i!==o.era){this._onerror(Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Mh(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;if(n===void 0&&s===void 0)return;Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch((i)=>this._onerror(Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=N$(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(_,v,k)=>{let Z={jsonrpc:"2.0",id:r.id,error:{code:_,message:v,...k!==void 0&&{data:k}}};s?.send(Z).catch((E)=>this._onerror(Error(`Failed to send an error response: ${E}`)))};if(t?.classification!==void 0){let _=E$(t.classification);if(_!==n.era){this._onerror(Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${n.era}`));let v=t.classification.revision??_;i(Q.UnsupportedProtocolVersion,`Unsupported protocol version: ${v}`,{supported:this._supportedProtocolVersions,requested:v});return}}if(Zh(r.method)&&!n.hasRequestMethod(r.method)&&!(I$(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(Q.MethodNotFound,"Method not found");return}let a=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(a===void 0){i(Q.MethodNotFound,"Method not found");return}let c=n.checkInboundEnvelope(o);if(c!==void 0){i(Q.InvalidParams,c);return}let u=(_,v)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...v,relatedRequestId:r.id}),l=(_,v,k)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,v,{...k,relatedRequestId:r.id}),p=new AbortController;this._requestHandlerAbortControllers.set(r.id,p);let d=o.inputResponses===void 0?void 0:UA(o.inputResponses),h={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...d!==void 0&&{inputResponses:d.accepted},...d!==void 0&&d.droppedKeys.length>0&&{droppedInputResponseKeys:d.droppedKeys},requestState:o.requestState===void 0?qA:ef(o.requestState),signal:p.signal,send:(_,v,k)=>{let Z=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(Z,_.method),Dh(v))return l(_,v,k);let E=Z$(Z,_.method);if(E===void 0)throw TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return l(_,E,v)},notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},f=this.buildContext(h,t);Promise.resolve().then(()=>a(r,f)).then(async(_)=>{if(p.signal.aborted)return;let v;try{v=n.encodeResult(r.method,_,this._outboundServerInfo())}catch(Z){this._onerror(Error(`Failed to encode result for ${r.method}: ${Z}`)),i(Q.InternalError,"Internal error");return}let k={result:v,jsonrpc:"2.0",id:r.id};await s?.send(k)},async(_)=>{if(p.signal.aborted)return;let v=Number.isSafeInteger(_.code)?_.code:Q.InternalError,k={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(v),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await s?.send(k)}).catch((_)=>this._onerror(Error(`Failed to send response: ${_}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(r.id)===p)this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),ys(e))r(e);else r(Se.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(Dh(t)){if(!I$(e.method))this._assertOutboundRequestInEra(o,e.method);return this._requestWithSchemaViaCodec(o,e,t,r)}this._assertOutboundRequestInEra(o,e.method);let n=Z$(o,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return Yr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=MA(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Zh(t)&&!e.hasRequestMethod(t))throw new D(H.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a}=o??{},c=Date.now(),u,l;return new Promise((p,d)=>{let h=(P)=>{d(P)};if(!this._transport){h(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(P){h(P);return}if(o?.signal?.aborted){let P=o.signal.reason;throw P instanceof D?P:new D(H.RequestTimeout,String(P))}let f=e.era===Sp&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;l=_;let v={...t,jsonrpc:"2.0",id:_};if(o?.onprogress)this._progressHandlers.set(_,o.onprogress),v.params={...t.params,_meta:{...t.params?._meta,progressToken:_}};let k=this._envelopeOutbound(v),Z=!1,E=(P)=>{if(Z)return;if(this._progressHandlers.delete(_),f===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(P)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch((ae)=>this._onerror(Error(`Failed to send cancellation: ${ae}`)))}else f.abort();d(P instanceof D?P:new D(H.RequestTimeout,String(P)))};this._responseHandlers.set(_,(P)=>{if(o?.signal?.aborted)return;if(Z=!0,P instanceof Error)return d(P);let ae;try{ae=e.decodeResult(t.method,P.result)}catch($e){return d($e instanceof Error?$e:Error(String($e)))}if(ae.kind==="invalid")return d(ae.error);if(ae.kind==="input_required"){if(o?.allowInputRequired===!0)return p(HA(ae));let $e={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:c,retry:(Xe,ot)=>this._requestWithSchemaViaCodec(e,Xe===void 0?{method:t.method}:{method:t.method,params:Xe},r,ot)};return p(this._resolveNonCompleteResult(ae,$e))}let We=ae.result;jh(r,We).then(($e)=>{if($e.success)p($e.data);else d(new D(H.InvalidResult,`Invalid result for ${t.method}: ${$e.error}`))},d)}),u=()=>E(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let ee=o?.timeout??Mc,G=()=>E(new D(H.RequestTimeout,"Request timed out",{timeout:ee}));this._setupTimeout(_,ee,o?.maxTotalTimeout,G,o?.resetTimeoutOnProgress??!1),this._transport.send(k,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:a,requestSignal:f?.signal}).catch((P)=>{this._progressHandlers.delete(_),d(P)})}).finally(()=>{if(u)o?.signal?.removeEventListener("abort",u);if(l!==void 0)this._responseHandlers.delete(l),this._cleanupTimeout(l)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new D(H.NotConnected,"Not connected");if(Mh(t.method)&&!e.hasNotificationMethod(t.method))throw new D(H.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(o,r).catch((n)=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t==="function"){if(!Zh(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason==="not-in-era")a=i.validateInputRequest(e,n);if(!a.ok){if(a.reason==="not-in-era")throw new Se(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(a.message)}return Promise.resolve(t(a.value,s))}}else if(r)o=async(n,s)=>{let i=await jh(t.params,{...n.params});if(!i.success)throw new Se(Q.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t==="function"){if(!Mh(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok){if(s.reason==="not-in-era")throw new Se(Q.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(s.message)}return Promise.resolve(t(s.value))});return}if(!r)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(o)=>{let n=await jh(t.params,{...o.params});if(!n.success)throw new Se(Q.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ic(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tf(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Ic(i)&&Ic(s)?{...i,...s}:s}return r}function vp(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function UA(e){let t={},r=[];if(!vp(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!vp(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function M$(e){throw new D(H.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function FA(e,t,r,o,n){return{sessionId:n,mcpReq:{id:e,method:t,_meta:r?._meta,requestState:ef(void 0),signal:o,send:()=>M$("send"),notify:()=>M$("notify")}}}async function VA(e,t,r,o,n){if(!vp(o)||typeof o.method!=="string")throw new D(H.InvalidResult,`Invalid input request '${r}': each inputRequests entry must be an embedded request object with a method`,{key:r});let s=o.method;if(!t.hasInputRequestMethod(s))throw new D(H.InvalidResult,`Invalid input request '${r}': '${s}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:r,method:s});let i=e.getRequestHandler(s);if(i===void 0)throw new D(H.CapabilityNotSupported,`Cannot fulfil input request '${r}': no handler is registered for '${s}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:r,method:s});let a=vp(o.params)?o.params:void 0;return await i({jsonrpc:"2.0",id:r,method:s,...a!==void 0&&{params:a}},e.buildContext(FA(r,s,a,n,e.sessionId)))}function BA(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function gk(e,t,r,o){let{codec:n,request:s,options:i,flowStartedAt:a}=o,c={inputRequests:r.inputRequests,...r.requestState!==void 0&&{requestState:r.requestState}},u={dispatchInputRequest:(l,p,d)=>VA(e,n,l,p,d),retry:(l,p)=>o.retry(l,BA(i,p))};return OA({config:t,method:s.method,originalParams:s.params,firstPayload:c,flowStartedAt:a,signal:i?.signal,requestOptions:{...i?.timeout!==void 0&&{timeout:i.timeout},...i?.maxTotalTimeout!==void 0&&{maxTotalTimeout:i.maxTotalTimeout},...i?.onprogress!==void 0&&{onprogress:i.onprogress}},hooks:u})}function HA(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
245
+ * content-type
246
+ * Copyright(c) 2015 Douglas Christopher Wilson
247
+ * MIT Licensed
248
+ */var JA=Xf((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(a){if(!a)throw TypeError("argument string is required");var c=typeof a==="object"?s(a):a;if(typeof c!=="string")throw TypeError("argument string is required to be a string");var u=c.indexOf(";"),l=u!==-1?c.slice(0,u).trim():c.trim();if(!o.test(l))throw TypeError("invalid media type");var p=new i(l.toLowerCase());if(u!==-1){var d,h,f;t.lastIndex=u;while(h=t.exec(c)){if(h.index!==u)throw TypeError("invalid parameter format");if(u+=h[0].length,d=h[1].toLowerCase(),f=h[2],f.charCodeAt(0)===34){if(f=f.slice(1,-1),f.indexOf("\\")!==-1)f=f.replace(r,"$1")}p.parameters[d]=f}if(u!==c.length)throw TypeError("invalid parameter format")}return p}function s(a){var c;if(typeof a.getHeader==="function")c=a.getHeader("content-type");else if(typeof a.headers==="object")c=a.headers&&a.headers["content-type"];if(typeof c!=="string")throw TypeError("content-type header is missing from object");return c}function i(a){this.parameters=Object.create(null),this.type=a}}),o4=eg(JA(),1);function Lc(e,t){let r=typeof e;if(r!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let o=e.length;if(o!==t.length)return!1;for(let n=0;n<o;n++)if(!Lc(e[n],t[n]))return!1;return!0}if(r==="object"){if(!e||!t)return e===t;let o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(let s of o)if(!Lc(e[s],t[s]))return!1;return!0}return e===t}function ar(e){return encodeURI(KA(e))}function KA(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var WA={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},GA={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},YA={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!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},XA=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");function hn(e,t=Object.create(null),r=XA,o=""){if(e&&typeof e==="object"&&!Array.isArray(e)){let s=e.$id||e.id;if(s){let i=new URL(s,r.href);if(i.hash.length>1)t[i.href]=e;else if(i.hash="",o==="")r=i;else hn(e,t,r)}}else if(e!==!0&&e!==!1)return t;let n=r.href+(o?"#"+o:"");if(t[n]!==void 0)throw Error(`Duplicate schema URI "${n}".`);if(t[n]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0)Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:n});if(e.$ref&&e.__absolute_ref__===void 0){let s=new URL(e.$ref,r.href);s.hash=s.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:s.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let s=new URL(e.$recursiveRef,r.href);s.hash=s.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:s.href})}if(e.$anchor){let s=new URL("#"+e.$anchor,r.href);t[s.href]=e}for(let s in e){if(YA[s])continue;let i=`${o}/${ar(s)}`,a=e[s];if(Array.isArray(a)){if(WA[s]){let c=a.length;for(let u=0;u<c;u++)hn(a[u],t,r,`${i}/${u}`)}}else if(GA[s])for(let c in a)hn(a[c],t,r,`${i}/${ar(c)}`);else hn(a,t,r,i)}return t}var QA=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,eN=[0,31,28,31,30,31,30,31,31,30,31,30,31],tN=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,rN=/^(?=.{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,oN=/^(?:[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,nN=/^(?:(?:[^\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,sN=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,iN=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,aN=/^(?:\/(?:[^~/]|~0|~1)*)*$/,cN=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,uN=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,lN=(e)=>{if(e[0]==='"')return!1;let[t,r,...o]=e.split("@");if(!t||!r||o.length!==0||t.length>64||r.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(r)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return r.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},pN=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,dN=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,mN=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Er(e){return e.test.bind(e)}var _k={date:yk,time:vk.bind(void 0,!1),"date-time":gN,duration:mN,uri:vN,"uri-reference":Er(oN),"uri-template":Er(nN),url:Er(sN),email:lN,hostname:Er(rN),ipv4:Er(pN),ipv6:Er(dN),regex:bN,uuid:Er(iN),"json-pointer":Er(aN),"json-pointer-uri-fragment":Er(cN),"relative-json-pointer":Er(uN)};function hN(e){return e%4===0&&(e%100!==0||e%400===0)}function yk(e){let t=e.match(QA);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o==2&&hN(r)?29:eN[o])}function vk(e,t){let r=t.match(tN);if(!r)return!1;let o=+r[1],n=+r[2],s=+r[3],i=!!r[5];return(o<=23&&n<=59&&s<=59||o==23&&n==59&&s==60)&&(!e||i)}var fN=/t|\s/i;function gN(e){let t=e.split(fN);return t.length==2&&yk(t[0])&&vk(!0,t[1])}var _N=/\/|:/,yN=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function vN(e){return _N.test(e)&&yN.test(e)}var SN=/[^\\]\\Z/;function bN(e){if(SN.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}function zN(e){let t=0,r=e.length,o=0,n;while(o<r)if(t++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<r){if(n=e.charCodeAt(o),(n&64512)==56320)o++}return t}function He(e,t,r="2019-09",o=hn(t),n=!0,s=null,i="#",a="#",c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:i,keyword:"false",keywordLocation:i,error:"False boolean schema."}]};let u=typeof e,l;switch(u){case"boolean":case"number":case"string":l=u;break;case"object":if(e===null)l="null";else if(Array.isArray(e))l="array";else l="object";break;default:throw Error(`Instances of "${u}" type are not supported.`)}let{$ref:p,$recursiveRef:d,$recursiveAnchor:h,type:f,const:_,enum:v,required:k,not:Z,anyOf:E,allOf:ee,oneOf:G,if:P,then:ae,else:We,format:$e,properties:Xe,patternProperties:ot,additionalProperties:Vt,unevaluatedProperties:Bt,minProperties:ur,maxProperties:Ht,propertyNames:lr,dependentRequired:zt,dependentSchemas:Jt,dependencies:pr,prefixItems:Ct,items:ft,additionalItems:jr,unevaluatedItems:Lr,contains:dr,minContains:at,maxContains:gt,minItems:_t,maxItems:rr,uniqueItems:Ao,minimum:Ot,maximum:At,exclusiveMinimum:xt,exclusiveMaximum:Kt,multipleOf:Wt,minLength:mr,maxLength:hr,pattern:co,__absolute_ref__:fr,__absolute_recursive_ref__:No}=t,M=[];if(h===!0&&s===null)s=t;if(d==="#"){let Y=s===null?o[No]:s,F=`${a}/$recursiveRef`,ie=He(e,s===null?t:s,r,o,n,Y,i,F,c);if(!ie.valid)M.push({instanceLocation:i,keyword:"$recursiveRef",keywordLocation:F,error:"A subschema had errors."},...ie.errors)}if(p!==void 0){let Y=o[fr||p];if(Y===void 0){let j=`Unresolved $ref "${p}".`;if(fr&&fr!==p)j+=` Absolute URI "${fr}".`;throw j+=`
249
+ Known schemas:
250
+ - ${Object.keys(o).join(`
251
+ - `)}`,Error(j)}let F=`${a}/$ref`,ie=He(e,Y,r,o,n,s,i,F,c);if(!ie.valid)M.push({instanceLocation:i,keyword:"$ref",keywordLocation:F,error:"A subschema had errors."},...ie.errors);if(r==="4"||r==="7")return{valid:M.length===0,errors:M}}if(Array.isArray(f)){let Y=f.length,F=!1;for(let ie=0;ie<Y;ie++)if(l===f[ie]||f[ie]==="integer"&&l==="number"&&e%1===0&&e===e){F=!0;break}if(!F)M.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${l}" is invalid. Expected "${f.join('", "')}".`})}else if(f==="integer"){if(l!=="number"||e%1||e!==e)M.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${l}" is invalid. Expected "${f}".`})}else if(f!==void 0&&l!==f)M.push({instanceLocation:i,keyword:"type",keywordLocation:`${a}/type`,error:`Instance type "${l}" is invalid. Expected "${f}".`});if(_!==void 0){if(l==="object"||l==="array"){if(!Lc(e,_))M.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}else if(e!==_)M.push({instanceLocation:i,keyword:"const",keywordLocation:`${a}/const`,error:`Instance does not match ${JSON.stringify(_)}.`})}if(v!==void 0){if(l==="object"||l==="array"){if(!v.some((Y)=>Lc(e,Y)))M.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}else if(!v.some((Y)=>e===Y))M.push({instanceLocation:i,keyword:"enum",keywordLocation:`${a}/enum`,error:`Instance does not match any of ${JSON.stringify(v)}.`})}if(Z!==void 0){let Y=`${a}/not`;if(He(e,Z,r,o,n,s,i,Y).valid)M.push({instanceLocation:i,keyword:"not",keywordLocation:Y,error:'Instance matched "not" schema.'})}let gr=[];if(E!==void 0){let Y=`${a}/anyOf`,F=M.length,ie=!1;for(let j=0;j<E.length;j++){let O=E[j],te=Object.create(c),X=He(e,O,r,o,n,h===!0?s:null,i,`${Y}/${j}`,te);if(M.push(...X.errors),ie=ie||X.valid,X.valid)gr.push(te)}if(ie)M.length=F;else M.splice(F,0,{instanceLocation:i,keyword:"anyOf",keywordLocation:Y,error:"Instance does not match any subschemas."})}if(ee!==void 0){let Y=`${a}/allOf`,F=M.length,ie=!0;for(let j=0;j<ee.length;j++){let O=ee[j],te=Object.create(c),X=He(e,O,r,o,n,h===!0?s:null,i,`${Y}/${j}`,te);if(M.push(...X.errors),ie=ie&&X.valid,X.valid)gr.push(te)}if(ie)M.length=F;else M.splice(F,0,{instanceLocation:i,keyword:"allOf",keywordLocation:Y,error:"Instance does not match every subschema."})}if(G!==void 0){let Y=`${a}/oneOf`,F=M.length,ie=G.filter((j,O)=>{let te=Object.create(c),X=He(e,j,r,o,n,h===!0?s:null,i,`${Y}/${O}`,te);if(M.push(...X.errors),X.valid)gr.push(te);return X.valid}).length;if(ie===1)M.length=F;else M.splice(F,0,{instanceLocation:i,keyword:"oneOf",keywordLocation:Y,error:`Instance does not match exactly one subschema (${ie} matches).`})}if(l==="object"||l==="array")Object.assign(c,...gr);if(P!==void 0){let Y=`${a}/if`;if(He(e,P,r,o,n,s,i,Y,c).valid){if(ae!==void 0){let F=He(e,ae,r,o,n,s,i,`${a}/then`,c);if(!F.valid)M.push({instanceLocation:i,keyword:"if",keywordLocation:Y,error:'Instance does not match "then" schema.'},...F.errors)}}else if(We!==void 0){let F=He(e,We,r,o,n,s,i,`${a}/else`,c);if(!F.valid)M.push({instanceLocation:i,keyword:"if",keywordLocation:Y,error:'Instance does not match "else" schema.'},...F.errors)}}if(l==="object"){if(k!==void 0){for(let j of k)if(!(j in e))M.push({instanceLocation:i,keyword:"required",keywordLocation:`${a}/required`,error:`Instance does not have required property "${j}".`})}let Y=Object.keys(e);if(ur!==void 0&&Y.length<ur)M.push({instanceLocation:i,keyword:"minProperties",keywordLocation:`${a}/minProperties`,error:`Instance does not have at least ${ur} properties.`});if(Ht!==void 0&&Y.length>Ht)M.push({instanceLocation:i,keyword:"maxProperties",keywordLocation:`${a}/maxProperties`,error:`Instance does not have at least ${Ht} properties.`});if(lr!==void 0){let j=`${a}/propertyNames`;for(let O in e){let te=`${i}/${ar(O)}`,X=He(O,lr,r,o,n,s,te,j);if(!X.valid)M.push({instanceLocation:i,keyword:"propertyNames",keywordLocation:j,error:`Property name "${O}" does not match schema.`},...X.errors)}}if(zt!==void 0){let j=`${a}/dependantRequired`;for(let O in zt)if(O in e){let te=zt[O];for(let X of te)if(!(X in e))M.push({instanceLocation:i,keyword:"dependentRequired",keywordLocation:j,error:`Instance has "${O}" but does not have "${X}".`})}}if(Jt!==void 0)for(let j in Jt){let O=`${a}/dependentSchemas`;if(j in e){let te=He(e,Jt[j],r,o,n,s,i,`${O}/${ar(j)}`,c);if(!te.valid)M.push({instanceLocation:i,keyword:"dependentSchemas",keywordLocation:O,error:`Instance has "${j}" but does not match dependant schema.`},...te.errors)}}if(pr!==void 0){let j=`${a}/dependencies`;for(let O in pr)if(O in e){let te=pr[O];if(Array.isArray(te)){for(let X of te)if(!(X in e))M.push({instanceLocation:i,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not have "${X}".`})}else{let X=He(e,te,r,o,n,s,i,`${j}/${ar(O)}`);if(!X.valid)M.push({instanceLocation:i,keyword:"dependencies",keywordLocation:j,error:`Instance has "${O}" but does not match dependant schema.`},...X.errors)}}}let F=Object.create(null),ie=!1;if(Xe!==void 0){let j=`${a}/properties`;for(let O in Xe){if(!(O in e))continue;let te=`${i}/${ar(O)}`,X=He(e[O],Xe[O],r,o,n,s,te,`${j}/${ar(O)}`);if(X.valid)c[O]=F[O]=!0;else if(ie=n,M.push({instanceLocation:i,keyword:"properties",keywordLocation:j,error:`Property "${O}" does not match schema.`},...X.errors),ie)break}}if(!ie&&ot!==void 0){let j=`${a}/patternProperties`;for(let O in ot){let te=new RegExp(O,"u"),X=ot[O];for(let Qe in e){if(!te.test(Qe))continue;let Zo=`${i}/${ar(Qe)}`,_r=He(e[Qe],X,r,o,n,s,Zo,`${j}/${ar(O)}`);if(_r.valid)c[Qe]=F[Qe]=!0;else ie=n,M.push({instanceLocation:i,keyword:"patternProperties",keywordLocation:j,error:`Property "${Qe}" matches pattern "${O}" but does not match associated schema.`},..._r.errors)}}}if(!ie&&Vt!==void 0){let j=`${a}/additionalProperties`;for(let O in e){if(F[O])continue;let te=`${i}/${ar(O)}`,X=He(e[O],Vt,r,o,n,s,te,j);if(X.valid)c[O]=!0;else ie=n,M.push({instanceLocation:i,keyword:"additionalProperties",keywordLocation:j,error:`Property "${O}" does not match additional properties schema.`},...X.errors)}}else if(!ie&&Bt!==void 0){let j=`${a}/unevaluatedProperties`;for(let O in e)if(!c[O]){let te=`${i}/${ar(O)}`,X=He(e[O],Bt,r,o,n,s,te,j);if(X.valid)c[O]=!0;else M.push({instanceLocation:i,keyword:"unevaluatedProperties",keywordLocation:j,error:`Property "${O}" does not match unevaluated properties schema.`},...X.errors)}}}else if(l==="array"){if(rr!==void 0&&e.length>rr)M.push({instanceLocation:i,keyword:"maxItems",keywordLocation:`${a}/maxItems`,error:`Array has too many items (${e.length} > ${rr}).`});if(_t!==void 0&&e.length<_t)M.push({instanceLocation:i,keyword:"minItems",keywordLocation:`${a}/minItems`,error:`Array has too few items (${e.length} < ${_t}).`});let Y=e.length,F=0,ie=!1;if(Ct!==void 0){let j=`${a}/prefixItems`,O=Math.min(Ct.length,Y);for(;F<O;F++){let te=He(e[F],Ct[F],r,o,n,s,`${i}/${F}`,`${j}/${F}`);if(c[F]=!0,!te.valid){if(ie=n,M.push({instanceLocation:i,keyword:"prefixItems",keywordLocation:j,error:"Items did not match schema."},...te.errors),ie)break}}}if(ft!==void 0){let j=`${a}/items`;if(Array.isArray(ft)){let O=Math.min(ft.length,Y);for(;F<O;F++){let te=He(e[F],ft[F],r,o,n,s,`${i}/${F}`,`${j}/${F}`);if(c[F]=!0,!te.valid){if(ie=n,M.push({instanceLocation:i,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...te.errors),ie)break}}}else for(;F<Y;F++){let O=He(e[F],ft,r,o,n,s,`${i}/${F}`,j);if(c[F]=!0,!O.valid){if(ie=n,M.push({instanceLocation:i,keyword:"items",keywordLocation:j,error:"Items did not match schema."},...O.errors),ie)break}}if(!ie&&jr!==void 0){let O=`${a}/additionalItems`;for(;F<Y;F++){let te=He(e[F],jr,r,o,n,s,`${i}/${F}`,O);if(c[F]=!0,!te.valid)ie=n,M.push({instanceLocation:i,keyword:"additionalItems",keywordLocation:O,error:"Items did not match additional items schema."},...te.errors)}}}if(dr!==void 0)if(Y===0&&at===void 0)M.push({instanceLocation:i,keyword:"contains",keywordLocation:`${a}/contains`,error:"Array is empty. It must contain at least one item matching the schema."});else if(at!==void 0&&Y<at)M.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array has less items (${Y}) than minContains (${at}).`});else{let j=`${a}/contains`,O=M.length,te=0;for(let X=0;X<Y;X++){let Qe=He(e[X],dr,r,o,n,s,`${i}/${X}`,j);if(Qe.valid)c[X]=!0,te++;else M.push(...Qe.errors)}if(te>=(at||0))M.length=O;if(at===void 0&&gt===void 0&&te===0)M.splice(O,0,{instanceLocation:i,keyword:"contains",keywordLocation:j,error:"Array does not contain item matching schema."});else if(at!==void 0&&te<at)M.push({instanceLocation:i,keyword:"minContains",keywordLocation:`${a}/minContains`,error:`Array must contain at least ${at} items matching schema. Only ${te} items were found.`});else if(gt!==void 0&&te>gt)M.push({instanceLocation:i,keyword:"maxContains",keywordLocation:`${a}/maxContains`,error:`Array may contain at most ${gt} items matching schema. ${te} items were found.`})}if(!ie&&Lr!==void 0){let j=`${a}/unevaluatedItems`;for(;F<Y;F++){if(c[F])continue;let O=He(e[F],Lr,r,o,n,s,`${i}/${F}`,j);if(c[F]=!0,!O.valid)M.push({instanceLocation:i,keyword:"unevaluatedItems",keywordLocation:j,error:"Items did not match unevaluated items schema."},...O.errors)}}if(Ao)for(let j=0;j<Y;j++){let O=e[j],te=typeof O==="object"&&O!==null;for(let X=0;X<Y;X++){if(j===X)continue;let Qe=e[X];if(O===Qe||te&&typeof Qe==="object"&&Qe!==null&&Lc(O,Qe))M.push({instanceLocation:i,keyword:"uniqueItems",keywordLocation:`${a}/uniqueItems`,error:`Duplicate items at indexes ${j} and ${X}.`}),j=Number.MAX_SAFE_INTEGER,X=Number.MAX_SAFE_INTEGER}}}else if(l==="number"){if(r==="4"){if(Ot!==void 0&&(xt===!0&&e<=Ot||e<Ot))M.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${xt?"or equal to ":""} ${Ot}.`});if(At!==void 0&&(Kt===!0&&e>=At||e>At))M.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${Kt?"or equal to ":""} ${At}.`})}else{if(Ot!==void 0&&e<Ot)M.push({instanceLocation:i,keyword:"minimum",keywordLocation:`${a}/minimum`,error:`${e} is less than ${Ot}.`});if(At!==void 0&&e>At)M.push({instanceLocation:i,keyword:"maximum",keywordLocation:`${a}/maximum`,error:`${e} is greater than ${At}.`});if(xt!==void 0&&e<=xt)M.push({instanceLocation:i,keyword:"exclusiveMinimum",keywordLocation:`${a}/exclusiveMinimum`,error:`${e} is less than ${xt}.`});if(Kt!==void 0&&e>=Kt)M.push({instanceLocation:i,keyword:"exclusiveMaximum",keywordLocation:`${a}/exclusiveMaximum`,error:`${e} is greater than or equal to ${Kt}.`})}if(Wt!==void 0){let Y=e%Wt;if(Math.abs(0-Y)>=0.00000011920929&&Math.abs(Wt-Y)>=0.00000011920929)M.push({instanceLocation:i,keyword:"multipleOf",keywordLocation:`${a}/multipleOf`,error:`${e} is not a multiple of ${Wt}.`})}}else if(l==="string"){let Y=mr===void 0&&hr===void 0?0:zN(e);if(mr!==void 0&&Y<mr)M.push({instanceLocation:i,keyword:"minLength",keywordLocation:`${a}/minLength`,error:`String is too short (${Y} < ${mr}).`});if(hr!==void 0&&Y>hr)M.push({instanceLocation:i,keyword:"maxLength",keywordLocation:`${a}/maxLength`,error:`String is too long (${Y} > ${hr}).`});if(co!==void 0&&!new RegExp(co,"u").test(e))M.push({instanceLocation:i,keyword:"pattern",keywordLocation:`${a}/pattern`,error:"String does not match pattern."});if($e!==void 0&&_k[$e]&&!_k[$e](e))M.push({instanceLocation:i,keyword:"format",keywordLocation:`${a}/format`,error:`String does not match format "${$e}".`})}return{valid:M.length===0,errors:M}}var xN=class{schema;draft;shortCircuit;lookup;constructor(e,t="2019-09",r=!0){this.schema=e,this.draft=t,this.shortCircuit=r,this.lookup=hn(e)}validate(e){return He(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){if(t)e={...e,$id:t};hn(e,this.lookup)}},xp=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=og(e,"pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.");return t==="draft-7"?"7":t}getValidator(e){let t=new xN(e,this.draft??this._draftFor(e),this.shortcircuit);return(r)=>{let o=t.validate(r);return o.valid?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:o.errors.map((n)=>`${n.instanceLocation}: ${n.error}`).join("; ")}}}};var wN;wN=globalThis.crypto;var vs=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,e)}constructor(e){super(e);this.name=new.target.name,To(this,new.target)}},EN=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,r){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(r)}`);this.kind=e,this.expected=t,this.received=r}},IN=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},CN=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},ON=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},AN=class extends vs{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var Rk=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",To(this,new.target)}};var wp=new Set(["tools/list","prompts/list","resources/list","resources/templates/list","server/discover"]),Pk=class{_entries=new Map;_maxEntries;_stamp=0;_cappedSize=0;constructor(e){this._maxEntries=e?.maxEntries??512}get size(){return this._entries.size}get(e){return this._entries.get(rf(e))}set(e,t){let r=rf(e),o=wp.has(e.method),n=!this._entries.has(r);if(!o&&n&&this._maxEntries>0&&this._cappedSize>=this._maxEntries){for(let i of this._entries.keys())if(!wp.has(i.slice(0,i.indexOf("\x00")))){this._entries.delete(i),this._cappedSize--;break}}let s=++this._stamp;if(this._entries.set(r,{...t,stamp:s}),n&&!o)this._cappedSize++;return s}delete(e){if(this._entries.delete(rf(e))&&!wp.has(e.method))this._cappedSize--}evict(e){let t=`${e}\x00`,r=wp.has(e);for(let o of this._entries.keys())if(o.startsWith(t)){if(this._entries.delete(o),!r)this._cappedSize--}}clear(){this._entries.clear(),this._cappedSize=0}};function rf(e){return`${e.method}\x00${JSON.stringify([e.partition??"",e.params??""])}`}function of(e,t){return t===void 0?e:`${e}\x00${t}`}var Tk=86400000,NN=class{_evictionGeneration=new Map;_toolIndex;_toolOutputValidatorIndex;_serverIdentity="";constructor(e,t,r=()=>{},o="",n=Date.now){this._store=e,this._isUserSupplied=t,this._reportError=r,this._cachePartition=o,this._now=n}now(){return this._now()}setServerIdentity(e){this._serverIdentity=e}_partitionFor(e){return JSON.stringify([this._serverIdentity,e==="public"?"":this._cachePartition])}async _probe(e,t){let r={method:e,params:t??""},o=this._partitionFor("private"),n=await this._store.get({...r,partition:o});if(n!==void 0)return n;let s=this._partitionFor("public");if(s===o)return;let i=await this._store.get({...r,partition:s});return i?.scope==="public"?i:void 0}async evict(e){this._evictionGeneration.set(e,(this._evictionGeneration.get(e)??0)+1),await this._deleteBoth(e,"")}async _deleteBoth(e,t){let r=this._partitionFor("private"),o=this._partitionFor("public");try{await this._store.delete({method:e,params:t,partition:r})}catch(n){this._reportError(n)}if(o!==r)try{await this._store.delete({method:e,params:t,partition:o})}catch(n){this._reportError(n)}}async evictKey(e,t){let r=of(e,t),o=this._evictionGeneration.get(r);if(o!==void 0)this._evictionGeneration.set(r,o+1);await this._deleteBoth(e,t)}captureGeneration(e,t){let r=of(e,t),o=this._evictionGeneration.get(r)??0;return this._evictionGeneration.set(r,o),o}async write(e,t,r,o){if((this._evictionGeneration.get(of(e,o?.params))??0)!==r)return;let n=o?.params??"",s=this._partitionFor("private"),i=this._partitionFor("public"),a=(o?.scope??"private")==="public"?i:s;try{await this._store.set({method:e,params:n,partition:a},{value:ZN(t),expiresAt:o?.expiresAt,scope:o?.scope})}catch(c){this._reportError(c)}if(i!==s)try{await this._store.delete({method:e,params:n,partition:a===s?i:s})}catch(c){this._reportError(c)}}async read(e,t){let r=await this._probe(e,t);if(r?.expiresAt===void 0||!(r.expiresAt>this.now()))return;try{let o=JSON.parse(r.value);if(typeof o!=="object"||o===null||Array.isArray(o))throw TypeError("cached document is not an object");return{value:o}}catch(o){this._reportError(o),await this._deleteBoth(e,t??"");return}}resetForReconnect(){if(!this._isUserSupplied)this._store.clear();this._evictionGeneration.clear(),this._toolIndex=void 0,this._toolOutputValidatorIndex=void 0,this._serverIdentity=""}async toolDefinition(e){let t=await this._probe("tools/list");if(t===void 0){this._toolIndex=void 0;return}if(this._toolIndex?.stamp!==t.stamp){let r=this._decodeListTools(t),o=new Map;if(r!==void 0)for(let n of r.tools)o.set(n.name,n);this._toolIndex={stamp:t.stamp,byName:o}}return this._toolIndex.byName.get(e)}async outputValidator(e,t){let r=await this._probe("tools/list");if(r===void 0){this._toolOutputValidatorIndex=void 0;return}if(this._toolOutputValidatorIndex?.stamp!==r.stamp){let o=this._decodeListTools(r)??{tools:[]},n=new Map;for(let s of o.tools){let i=t(s);if(i!==void 0)n.set(s.name,i)}this._toolOutputValidatorIndex={stamp:r.stamp,byName:n}}return this._toolOutputValidatorIndex.byName.get(e)}_decodeListTools(e){try{let t=JSON.parse(e.value);if(!Array.isArray(t?.tools)||!t.tools.every((r)=>r!==null&&typeof r==="object"))throw TypeError("cached tools/list document has a malformed tools array");return t}catch(t){this._reportError(t);return}}};function ZN(e){let t;try{t=JSON.stringify(e)}catch(r){throw TypeError(`cache value is not JSON-serializable: ${r instanceof Error?r.message:String(r)}`)}if(typeof t!=="string")throw TypeError("cache value is not JSON-serializable: it has no JSON representation");return t}var MN=Symbol.for("mcp.authSeamEscape");function jN(e){return(typeof e==="object"&&e!==null||typeof e==="function")&&e[MN]===!0}var LN=-32022,qN=new Set([-32001,-32020,-32021]);function DN(e,t){switch(e.kind){case"result":return UN(e.result,t);case"rpc-error":return Ek(e,t);case"http-error":return FN(e,t);case"network-error":return Sk(e.error,t);case"unusable-reply":return{kind:"error",error:new D(H.EraNegotiationFailed,`Version negotiation probe failed: the server answered with an unusable reply (${Ik(e.error)})`,{cause:e.error},{cause:e.error})};case"auth-required":return{kind:"error",error:e.error};case"closed":if(t.transportKind==="stdio")return{kind:"legacy"};return Sk(Error("Connection closed during the version negotiation probe"),t);case"timeout":if(t.transportKind==="stdio")return{kind:"legacy"};return{kind:"error",error:new D(H.RequestTimeout,`Version negotiation probe timed out after ${e.timeoutMs}ms`,{timeout:e.timeoutMs})}}}function UN(e,t){let r=Yr(Sp).validateResult("server/discover",e);if(!r.ok)return{kind:"legacy"};let o=r.value.supportedVersions,n=t.clientModernVersions.find((s)=>o.includes(s));if(n!==void 0)return{kind:"modern",version:n,discover:r.value};if(t.fallbackAvailable)return{kind:"legacy"};return{kind:"error",error:new Nc({supported:[...o],requested:t.requestedVersion})}}function Ek(e,t){let{code:r,message:o,data:n}=e;if(r===LN){let s=BN(n);if(s===void 0)return{kind:"legacy"};let i=new Nc({supported:s,requested:HN(n)??t.requestedVersion},o),a=Ac(s),c=t.clientModernVersions.find((u)=>a.includes(u));if(c!==void 0)return{kind:"corrective",version:c,error:i};if(a.length>0)return{kind:"error",error:i};return t.fallbackAvailable?{kind:"legacy"}:{kind:"error",error:i}}if(qN.has(r))return{kind:"legacy"};return{kind:"legacy"}}function FN(e,t){if(e.status===401||e.status===403){let o=e.status===403;return{kind:"error",error:new Oc(o?H.ClientHttpForbidden:H.ClientHttpAuthentication,`Version negotiation failed: ${o?"the server denied access (HTTP 403)":"the server requires authorization (HTTP 401)"}`,{status:e.status,statusText:e.statusText,text:e.body})}}if(e.status>=500)return{kind:"error",error:new Oc(H.EraNegotiationFailed,`Version negotiation failed: the server answered the probe with HTTP ${e.status}`,{status:e.status,statusText:e.statusText,text:e.body})};let r=JN(e.body);if(r!==void 0)return Ek(r,t);return{kind:"legacy"}}function Sk(e,t){if(t.environment==="browser"&&VN(e))return{kind:"legacy"};return{kind:"error",error:new D(H.EraNegotiationFailed,`Version negotiation probe failed: ${Ik(e)}`,{cause:e},{cause:e})}}function VN(e){return e instanceof TypeError||e instanceof Error&&e.name==="TypeError"}function Ik(e){return e instanceof Error?e.message:String(e)}function BN(e){if(typeof e!=="object"||e===null)return;let t=e.supported;if(!Array.isArray(t)||t.length===0||!t.every((r)=>typeof r==="string"))return;return t}function HN(e){if(typeof e!=="object"||e===null)return;let t=e.requested;return typeof t==="string"?t:void 0}function JN(e){if(e===void 0||e==="")return;let t;try{t=JSON.parse(e)}catch{return}if(typeof t!=="object"||t===null)return;let r=t.error;if(typeof r!=="object"||r===null)return;let{code:o,message:n,data:s}=r;if(typeof o!=="number")return;return{code:o,message:typeof n==="string"?n:"",data:s}}var KN="legacy";function WN(e,t){let r=e?.mode??KN;if(r==="legacy")return{kind:"legacy"};let o=e?.probe??{};if(typeof r==="object"){if(!Xr(r.pin))throw TypeError(`versionNegotiation: { pin: '${r.pin}' } is not a modern protocol revision — pinning is for 2026-07-28 and later; omit versionNegotiation (or use mode: 'legacy') for 2025-era servers.`);return{kind:"pin",version:r.pin,probe:o}}let n=t?Ac(t):[];return{kind:"auto",modernVersions:n.length>0?n:[...Vh],fallbackAvailable:t?Bh(t).length>0:!0,probe:o}}function bk(){let e=globalThis;return e.window!==void 0&&e.document!==void 0?"browser":"node"}function zk(e){return"stderr"in e&&"pid"in e?"stdio":"http"}var GN=class e{_pending;_probeCounter=0;_savedOnMessage;_savedOnError;_savedOnClose;_closeDelivered=!1;constructor(t){this._transport=t,this._savedOnMessage=t.onmessage,this._savedOnError=t.onerror,this._savedOnClose=t.onclose}static async open(t){let r=new e(t);t.onmessage=(o)=>{let n=r._pending;if(n!==void 0&&(ys(o)||Zc(o))&&o.id===n.id){if(r._pending=void 0,ys(o))n.resolve({kind:"response",result:o.result});else n.resolve({kind:"response",error:o.error});return}},t.onerror=(o)=>{r._savedOnError?.(o)},t.onclose=()=>{let o=r._pending;if(o!==void 0)r._pending=void 0,o.resolve({kind:"closed"});r._closeDelivered=!0,r._savedOnClose?.()};try{await t.start()}catch(o){throw r.detach(),o}return r}async exchange(t,r){let o=`server-discover-probe-${++this._probeCounter}`;return new Promise((n)=>{let s=!1,i=(c)=>{if(s)return;if(s=!0,clearTimeout(a),this._pending?.id===o)this._pending=void 0;n(c)},a=setTimeout(()=>i({kind:"timeout"}),r);this._pending={id:o,resolve:i},this._transport.send(t(o)).catch((c)=>i({kind:"send-error",error:c}))})}detach(){if(this._pending=void 0,this._transport.onmessage=this._savedOnMessage,this._transport.onerror=this._savedOnError,this._closeDelivered&&this._savedOnClose!==void 0){let t=this._savedOnClose,r=this._transport,o=!1,n=()=>{if(!o){o=!0;return}t()};r.onclose=n,sf.set(r,()=>{if(r.onclose===n)r.onclose=t})}else this._transport.onclose=this._savedOnClose}release(){this.detach();let t=this._transport,r=t.start,o=!0;t.start=async function(){if(o){o=!1,t.start=r;return}return r.call(t)}}},sf=new WeakMap;function xk(e){let t=sf.get(e);sf.delete(e),t?.()}function YN(e,t,r,o){return{jsonrpc:"2.0",id:e,method:"server/discover",params:{_meta:Yr(t).outboundEnvelope({protocolVersion:t,clientInfo:r,clientCapabilities:o})}}}function XN(e){if(e instanceof D&&e.code===H.ClientHttpUnexpectedContent)return!0;return e instanceof Error&&e.name==="SyntaxError"}function QN(e,t){switch(e.kind){case"response":return e.error===void 0?{kind:"result",result:e.result}:{kind:"rpc-error",...e.error};case"send-error":{let r=e.error;if(jN(r)||r instanceof Rk||r instanceof Error&&r.name==="UnauthorizedError")return{kind:"auth-required",error:r};if(r instanceof Oc){let o=r.data?.text;return{kind:"http-error",status:r.data.status,body:typeof o==="string"?o:void 0,statusText:r.data.statusText}}if(XN(r))return{kind:"unusable-reply",error:r};return{kind:"network-error",error:r}}case"closed":return{kind:"closed"};case"timeout":return{kind:"timeout",timeoutMs:t}}}async function Ck(e,t){let r=e.probe.timeoutMs??t.defaultTimeoutMs,o=Math.max(0,e.probe.maxRetries??0),n=e.kind==="pin"?[e.version]:e.modernVersions,s=e.kind==="auto"&&e.fallbackAvailable,i=await GN.open(t.transport),a=async()=>{let u=n[0],l=!1,p=o;for(;;){let d=await i.exchange((_)=>YN(_,u,t.clientInfo,t.capabilities),r);if(d.kind==="timeout"&&p>0){p--;continue}let h=QN(d,r),f=DN(h,{clientModernVersions:n,requestedVersion:u,fallbackAvailable:s,environment:t.environment,transportKind:t.transportKind});switch(f.kind){case"modern":return{era:"modern",version:f.version,discover:f.discover};case"corrective":if(l)throw f.error;l=!0,u=f.version;continue;case"legacy":{let _=h.kind==="closed"?"the connection closed during the server/discover probe":void 0;if(e.kind==="pin")throw new D(H.EraNegotiationFailed,_===void 0?`Version negotiation failed: the server did not offer pinned protocol version ${e.version} via server/discover (no fallback in pin mode)`:`Version negotiation failed: ${_} before the server offered pinned protocol version ${e.version} (no fallback in pin mode)`);if(!e.fallbackAvailable)throw new D(H.EraNegotiationFailed,_===void 0?"Version negotiation failed: the server gave no modern evidence and this client supports no pre-2026-07-28 protocol version to fall back to":`Version negotiation failed: ${_} and this client supports no pre-2026-07-28 protocol version to fall back to`);if(_!==void 0&&t.disposableProbe!==!0)throw new D(H.EraNegotiationFailed,`Version negotiation failed: ${_} (this transport probed in place — the disposable sibling probe requires the SDK's base StdioClientTransport)`);return{era:"legacy"}}case"error":throw f.error}}},c;try{c=await a()}catch(u){throw i.detach(),u}return i.release(),c}function eZ(e){let t=Object.getPrototypeOf(e);if(t===null||!Object.prototype.hasOwnProperty.call(t,"_dispose"))return;let r=e._serverParams;return typeof r==="object"&&r!==null&&typeof r.command==="string"?r:void 0}async function tZ(e,t,r,o){let s=new t.constructor({...r,stderr:"ignore"}),i=t.close,a=!1,c,u=new Promise((p,d)=>{c=()=>d(wk())});t.close=async function(){return a=!0,c?.(),i.call(t)};let l;try{let p=Ck(e,{...o,transport:s,transportKind:"stdio",disposableProbe:!0});p.catch(()=>{}),l=await Promise.race([p,u])}finally{await rZ(s),t.close=i}if(a)throw wk();return l}function wk(){return new D(H.EraNegotiationFailed,"Version negotiation failed: the transport was closed during the server/discover probe")}async function rZ(e){try{let t=e._dispose;await(typeof t==="function"?t.call(e):e.close())}catch{}}function $k(e){let t=e._meta?.[zr];return Qh.Implementation(t)?t:void 0}function $p(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)$p(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")$p(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")$p(r,t)}}function Ok(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}function oZ(e){if(typeof e==="object"&&e!==null){if(e.kind==="legacy"&&!("supportedVersions"in e)&&!("discover"in e))return e;if(e.kind==="modern"&&bo.safeParse(e.discover).success)return e}throw new D(H.EraNegotiationFailed,"connect({ prior }): unrecognized prior — expected { kind: 'modern', discover } or { kind: 'legacy' }")}var kk={"notifications/tools/list_changed":["tools/list"],"notifications/prompts/list_changed":["prompts/list"],"notifications/resources/list_changed":["resources/list","resources/templates/list"]},nZ=64,nf={},sZ=class extends jc{_serverCapabilities;_serverVersion;_capabilities;_instructions;_jsonSchemaValidator;_cache;_defaultCacheTtlMs;_listMaxPages;_listChangedDebounceTimers=new Map;_listChangedConfig;_enforceStrictCapabilities;_versionNegotiation;_supportedProtocolVersionsOption;_inputRequiredDriverConfig;_listenState=new Map;_nextListenId=0;_autoOpenedSubscription;_discoverResult;static{nf.enforceStrictCapabilities=(e)=>e._enforceStrictCapabilities,nf.walkPages=(e,t,r,o)=>e._walkPages(t,r,o),nf.readResource=(e,t,r)=>e._readResource(t,r)}_resetConnectionState(){if(this._negotiatedProtocolVersion=void 0,this._serverCapabilities=void 0,this._serverVersion=void 0,this._instructions=void 0,this._discoverResult=void 0,this._autoOpenedSubscription=void 0,this._listenState.size>0){let e=new D(H.ConnectionClosed,"subscriptions/listen: client reconnected or closed; subscription state from the previous connection was reset");for(let t of this._listenState.values())t.settle({cause:"remote",error:e})}this._listenState.clear();for(let e of this._listChangedDebounceTimers.values())clearTimeout(e);this._listChangedDebounceTimers.clear(),this._cache.resetForReconnect()}async close(){try{await super.close()}finally{this._resetConnectionState()}}constructor(e,t){super(t);if(this._clientInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new xp,this._enforceStrictCapabilities=t?.enforceStrictCapabilities??!1,this._versionNegotiation=t?.versionNegotiation,this._supportedProtocolVersionsOption=t?.supportedProtocolVersions,this._inputRequiredDriverConfig=dk(t?.inputRequired),this._cache=new NN(t?.responseCacheStore??new Pk,t?.responseCacheStore!==void 0,(r)=>this._reportStoreError(r),t?.cachePartition??""),this._defaultCacheTtlMs=t?.defaultCacheTtlMs??0,this._listMaxPages=t?.listMaxPages??nZ,t?.listChanged)this._listChangedConfig=t.listChanged}buildContext(e,t){return e}_shouldDropInbound(e){if(this._negotiatedProtocolVersion!==void 0&&Xr(this._negotiatedProtocolVersion)&&bp(e))return"drop"}_outboundMetaEnvelope(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return this._wireCodec().outboundEnvelope({protocolVersion:e,clientInfo:this._clientInfo,clientCapabilities:this._capabilities})}_resolveNonCompleteResult(e,t){if(!this._inputRequiredDriverConfig.autoFulfill)return Promise.reject(new D(H.UnsupportedResultType,`Unsupported result type 'input_required' for ${t.request.method}: multi-round-trip auto-fulfilment is not enabled on this instance — pass allowInputRequired: true to handle it manually, or enable inputRequired.autoFulfill`,{resultType:"input_required",method:t.request.method}));return gk({getRequestHandler:(r)=>this._getRequestHandler(r),buildContext:(r)=>this.buildContext(r,void 0),sessionId:this.transport?.sessionId},this._inputRequiredDriverConfig,e,t)}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools","notifications/tools/list_changed",e.tools,async()=>(await this.listTools(void 0,{cacheMode:"refresh"})).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts","notifications/prompts/list_changed",e.prompts,async()=>(await this.listPrompts(void 0,{cacheMode:"refresh"})).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources","notifications/resources/list_changed",e.resources,async()=>(await this.listResources(void 0,{cacheMode:"refresh"})).resources)}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=tf(this._capabilities,e)}setVersionNegotiation(e){if(this.transport)throw Error("Cannot configure version negotiation after connecting to transport");this._versionNegotiation=e}_wrapHandler(e,t){if(e==="elicitation/create")return async(r,o)=>{let n=Yr(this._negotiatedProtocolVersion),s=n.validateRequest("elicitation/create",r);if(!s.ok&&s.reason==="not-in-era")s=n.validateInputRequest("elicitation/create",r);if(!s.ok)throw new Se(s.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,s.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation request: ${s.message}`);let{params:i}=s.value;i.mode=i.mode??"form";let{supportsFormMode:a,supportsUrlMode:c}=Ok(this._capabilities.elicitation);if(i.mode==="form"&&!a)throw new Se(Q.InvalidParams,"Client does not support form-mode elicitation requests");if(i.mode==="url"&&!c)throw new Se(Q.InvalidParams,"Client does not support URL-mode elicitation requests");let u=await t(r,o),l=n.validateResult("elicitation/create",u);if(!l.ok&&l.reason==="not-in-era")l=n.validateInputResponse("elicitation/create",u);if(!l.ok)throw new Se(l.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,l.reason==="not-in-era"?"No wire schema for elicitation/create in the resolved era":`Invalid elicitation result: ${l.message}`);let p=l.value,d=i.mode==="form"?i.requestedSchema:void 0;if(i.mode==="form"&&p.action==="accept"&&p.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{$p(d,p.content)}catch{}return p};if(e==="sampling/createMessage")return async(r,o)=>{let n=Yr(this._negotiatedProtocolVersion),s=n.validateRequest("sampling/createMessage",r);if(!s.ok&&s.reason==="not-in-era")s=n.validateInputRequest("sampling/createMessage",r);if(!s.ok)throw new Se(s.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,s.reason==="not-in-era"?"No wire schema for sampling/createMessage in the resolved era":`Invalid sampling request: ${s.message}`);let{params:i}=s.value,a=await t(r,o),c=Boolean(i.tools||i.toolChoice),u=n.samplingResultVariant(c,a);if(!u.ok&&u.reason==="not-in-era")u=n.validateInputResponse("sampling/createMessage",a);if(!u.ok)throw new Se(u.reason==="not-in-era"?Q.InternalError:Q.InvalidParams,u.reason==="not-in-era"?"No result schema for sampling/createMessage in the resolved era":`Invalid sampling result: ${u.message}`);return u.value};return t}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new D(H.CapabilityNotSupported,`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(t?.prior!=null)return this._connectFromPrior(e,oZ(t.prior),t);let r=WN(this._versionNegotiation,this._supportedProtocolVersionsOption);if(r.kind!=="legacy")return this._connectNegotiated(e,r,t);return this._connectPlainLegacy(e,t)}async _connectPlainLegacy(e,t){if(await super.connect(e),e.sessionId!==void 0){let r=this._negotiatedProtocolVersion;if(r!==void 0)e.setProtocolVersion?.(r);return}this._resetConnectionState(),await this._legacyHandshake(e,t)}async _legacyHandshake(e,t){let r=Bh(this._supportedProtocolVersions);try{let o=r[0];if(o===void 0)throw new D(H.EraNegotiationFailed,"Cannot run the initialize handshake: supportedProtocolVersions contains no pre-2026-07-28 protocol version");let n=await this.request({method:"initialize",params:{protocolVersion:o,capabilities:this._capabilities,clientInfo:this._clientInfo}},t);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);if(!r.includes(n.protocolVersion))throw Error(`Server's protocol version is not supported: ${n.protocolVersion}`);if(this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,this._cache.setServerIdentity(this._deriveServerIdentity(e)),e.setProtocolVersion)e.setProtocolVersion(n.protocolVersion);if(this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._negotiatedProtocolVersion=n.protocolVersion,this._listChangedConfig)this._setupListChangedHandlers(this._listChangedConfig)}catch(o){throw this.close(),o}}async _connectNegotiated(e,t,r){if(e.sessionId!==void 0){await super.connect(e);let n=this._negotiatedProtocolVersion;if(n!==void 0&&e.setProtocolVersion)e.setProtocolVersion(n);return}this._resetConnectionState();let o;try{let n=zk(e),s={clientInfo:this._clientInfo,capabilities:this._capabilities,environment:bk(),defaultTimeoutMs:r?.timeout??Mc},i=n==="stdio"?eZ(e):void 0;o=i===void 0?await Ck(t,{...s,transport:e,transportKind:n}):await tZ(t,e,i,s)}catch(n){throw await e.close().catch(()=>{}),xk(e),n}if(xk(e),await super.connect(e),o.era==="legacy"){await this._legacyHandshake(e,r);return}if(this._serverCapabilities=o.discover.capabilities,this._serverVersion=$k(o.discover),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.discover.instructions,this._discoverResult=o.discover,this._negotiatedProtocolVersion=o.version,e.setProtocolVersion)e.setProtocolVersion(o.version);if(this._listChangedConfig){let n=this._listChangedConfig,s=this._serverCapabilities,i={...n.tools&&s?.tools?.listChanged&&{tools:n.tools},...n.prompts&&s?.prompts?.listChanged&&{prompts:n.prompts},...n.resources&&s?.resources?.listChanged&&{resources:n.resources}},a=!0;try{this._setupListChangedHandlers(i)}catch(u){a=!1,this.onerror?.(u instanceof Error?u:Error(String(u)))}let c=a?{...i.tools&&{toolsListChanged:!0},...i.prompts&&{promptsListChanged:!0},...i.resources&&{resourcesListChanged:!0}}:{};if(Object.keys(c).length>0){let u=new AbortController,l=()=>u.abort(r?.signal?.reason);if(r?.signal?.aborted)l();r?.signal?.addEventListener("abort",l);try{this._autoOpenedSubscription=await this.listen(c,{timeout:r?.timeout,signal:u.signal})}catch(p){if(r?.signal?.aborted)throw await this.close().catch(()=>{}),p;this.onerror?.(p instanceof Error?p:Error(String(p)))}finally{r?.signal?.removeEventListener("abort",l)}}}}async _connectFromPrior(e,t,r){if(t.kind==="legacy")return this._connectPlainLegacy(e,r);let o=t.discover;this._resetConnectionState();let n=this._supportedProtocolVersionsOption,s=(n&&Ac(n).length>0?Ac(n):Vh).find((i)=>o.supportedVersions.includes(i));if(s===void 0)throw new D(H.EraNegotiationFailed,"connect({ prior }) with a modern verdict requires a 2026-07-28+ mutual protocol version; the supplied DiscoverResult and this client's supportedProtocolVersions have no modern overlap. For a server known to be legacy, pass prior: { kind: 'legacy' } to skip the probe and initialize directly, or use versionNegotiation: { mode: 'auto' } to re-probe with legacy fallback.");if(await super.connect(e),this._discoverResult=o,this._serverCapabilities=o.capabilities,this._serverVersion=$k(o),this._cache.setServerIdentity(this._deriveServerIdentity(e)),this._instructions=o.instructions,this._negotiatedProtocolVersion=s,e.setProtocolVersion?.(s),this._listChangedConfig)try{this._setupListChangedHandlers(this._listChangedConfig)}catch(i){this.onerror?.(i instanceof Error?i:Error(String(i)))}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}_deriveServerIdentity(e){let t=this._serverVersion;if(t!==void 0)return`${t.name}@${t.version}`;return e.sessionId??`anonymous:${Date.now()}-${Math.random().toString(36).slice(2)}`}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}getProtocolEra(){let e=this._negotiatedProtocolVersion;if(e===void 0)return;return Xr(e)?"modern":"legacy"}getInstructions(){return this._instructions}getDiscoverResult(){return this._discoverResult}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new D(H.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new D(H.CapabilityNotSupported,`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(!this._serverCapabilities?.resources)throw new D(H.CapabilityNotSupported,`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new D(H.CapabilityNotSupported,`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new D(H.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new D(H.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"initialize":break;case"server/discover":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new D(H.CapabilityNotSupported,`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 D(H.CapabilityNotSupported,`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new D(H.CapabilityNotSupported,`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new D(H.CapabilityNotSupported,`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},e)}async discover(e){let t=await this._requestWithSchema({method:"server/discover"},bo,e);return this._discoverResult=t,t}async complete(e,t){return this.request({method:"completion/complete",params:e},t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},t)}async listPrompts(e,t){if(!this._serverCapabilities?.prompts&&!this._enforceStrictCapabilities)return console.debug("Client.listPrompts() called but server does not advertise prompts capability - returning empty list"),{prompts:[]};if(e?.cursor!==void 0)return this.request({method:"prompts/list",params:e},t);let r=await this._serveFromCache("prompts/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("prompts/list",e,t,(o)=>o.prompts)}async listResources(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResources() called but server does not advertise resources capability - returning empty list"),{resources:[]};if(e?.cursor!==void 0)return this.request({method:"resources/list",params:e},t);let r=await this._serveFromCache("resources/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/list",e,t,(o)=>o.resources)}async listResourceTemplates(e,t){if(!this._serverCapabilities?.resources&&!this._enforceStrictCapabilities)return console.debug("Client.listResourceTemplates() called but server does not advertise resources capability - returning empty list"),{resourceTemplates:[]};if(e?.cursor!==void 0)return this.request({method:"resources/templates/list",params:e},t);let r=await this._serveFromCache("resources/templates/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("resources/templates/list",e,t,(o)=>o.resourceTemplates)}async _listAllPages(e,t,r,o,n){let s=r?.cacheMode==="bypass",i=this._cache.captureGeneration(e),a=(u)=>{let l=u===void 0?t&&{...t}:{...t,cursor:u};return this.request({method:e,...l&&{params:l}},r)},c=await this._walkPages(e,a,o);if(delete c.nextCursor,n?.(c),s)return c;return await this._cache.write(e,c,i,this._freshness(c)),c}async _walkPages(e,t,r){let o=await t(void 0),n=o.nextCursor,s=o,i=1;while(n!==void 0){if(this._listMaxPages!==0&&i>=this._listMaxPages)throw new D(H.ListPaginationExceeded,`${e}: exceeded listMaxPages (${this._listMaxPages}); server pagination did not terminate`,{method:e,listMaxPages:this._listMaxPages});let a=await t(n);if(a.nextCursor===n&&JSON.stringify(r(a))===JSON.stringify(r(s)))break;r(o).push(...r(a)),s=a,n=a.nextCursor,i++}return o}_freshness(e,t){let r=e,o=typeof r.ttlMs==="number"?r.ttlMs:this._defaultCacheTtlMs,n=r.cacheScope==="public"?"public":"private";return{expiresAt:this._cache.now()+Math.min(Math.max(0,o),Tk),scope:n,params:t}}async _serveFromCache(e,t,r){if(r?.cacheMode==="bypass"||r?.cacheMode==="refresh")return;let o=await this._cache.read(e,t).catch((n)=>void this._reportStoreError(n));if(o!==void 0){if(r?.signal?.aborted){let n=r.signal.reason;throw n instanceof D?n:new D(H.RequestTimeout,String(n))}return o.value}}_reportStoreError(e){this.onerror?.(e instanceof Error?e:Error(String(e)))}_compileOutputValidator(e){if(!e.outputSchema)return;try{return{ok:!0,validator:this._jsonSchemaValidator.getValidator(e.outputSchema)}}catch(t){return{ok:!1,compileError:t}}}async _resolveXMcpHeaderScan(e,t){let r=t??await this._cache.toolDefinition(e);return r===void 0?void 0:Yh(r.inputSchema)}async readResource(e,t){let{result:r}=await this._readResource(e,t);return r}async _readResource(e,t){let r=await this._serveFromCache("resources/read",e.uri,t);if(r!==void 0)return{result:r,cached:!0};let o=this._cache.captureGeneration("resources/read",e.uri),n=await this.request({method:"resources/read",params:e},t);if(t?.cacheMode!=="bypass"){let s=this._freshness(n,e.uri);if(s.expiresAt>this._cache.now())await this._cache.write("resources/read",n,o,s);else if(t?.cacheMode==="refresh")await this._cache.evictKey("resources/read",e.uri)}return{result:n,cached:!1}}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},t)}async listen(e,t){if(this.transport===void 0)throw new D(H.NotConnected,"Not connected");let r=this._negotiatedProtocolVersion;if(r===void 0||!Xr(r))throw new D(H.MethodNotSupportedByProtocolVersion,`subscriptions/listen requires a 2026-07-28-era connection (negotiated: ${r??"none"}). On a 2025-era connection, change notifications are delivered unsolicited: use ClientOptions.listChanged and resources/subscribe instead.`,{method:"subscriptions/listen",protocolVersion:r});if(t?.signal?.aborted){let E=t.signal.reason;throw E instanceof D?E:new D(H.RequestTimeout,String(E))}let o=new AbortController,n=`listen:${this._nextListenId++}`,s="opening",i,a,c,u,l=new Promise((E,ee)=>{c=E,u=ee}),p,d=new Promise((E)=>{p=E}),h=(E)=>{if(s==="closed")return;let ee=s==="opening";if(i!==void 0)clearTimeout(i),i=void 0;if("ack"in E){s="open",c(E.ack);return}if(s="closed",a!==void 0)t?.signal?.removeEventListener("abort",a);if(this._listenState.delete(n),o.abort(),p(E.cause),ee)u(E.error??new D(H.ConnectionClosed,"subscriptions/listen closed before the server acknowledged"))},f=async()=>{o.abort(),await this.notification({method:"notifications/cancelled",params:{requestId:n}}).catch(()=>{})},_=async()=>{if(s==="closed")return;h({cause:"local"}),await f()};this._listenState.set(n,{settle:h});let v=t?.timeout??Mc;if(i=setTimeout(()=>{h({cause:"remote",error:new D(H.RequestTimeout,"subscriptions/listen ack timed out",{timeout:v})}),f().catch(()=>{})},v),t?.signal){let E=t.signal;a=()=>{if(s==="closed")return;let ee=E.reason;h({cause:"local",error:ee instanceof Error?ee:Error(String(ee??"Aborted"))}),f().catch(()=>{})},E.addEventListener("abort",a,{once:!0})}let k={jsonrpc:"2.0",id:n,method:"subscriptions/listen",params:{_meta:{...this._outboundMetaEnvelope()},notifications:e}},Z=(E)=>{h({cause:"remote",error:E instanceof Error?E:Error(String(E))})};try{this.transport.send(k,{requestSignal:o.signal,onRequestStreamEnd:()=>h({cause:"remote",error:Error("subscriptions/listen: stream ended")})}).catch(Z)}catch(E){Z(E)}return{honoredFilter:await l,close:_,closed:d}}get autoOpenedSubscription(){return this._autoOpenedSubscription}_onnotification(e,t){let r=Object.hasOwn(kk,e.method)?kk[e.method]:void 0;if(e.method==="notifications/resources/updated"){let o=e.params?.uri;if(typeof o==="string")this._cache.evictKey("resources/read",o)}else if(r!==void 0)for(let o of r)this._cache.evict(o);if(e.method==="notifications/subscriptions/acknowledged"){let o=e.params?._meta?.[jn],n=typeof o==="string"?this._listenState.get(o):void 0;if(n!==void 0){let s=this._wireCodec().validateNotification("notifications/subscriptions/acknowledged",e);n.settle({ack:s.ok?s.value.params.notifications:{}});return}}if(e.method==="notifications/cancelled"){let o=e.params?.requestId,n=typeof o==="string"?this._listenState.get(o):void 0;if(n!==void 0){n.settle({cause:"remote",error:Error("subscriptions/listen: server cancelled the subscription")});return}}super._onnotification(e,t)}_onresponse(e){let t=e.id,r=typeof t==="string"?this._listenState.get(t):void 0;if(r!==void 0){if(Zc(e))r.settle({cause:"remote",error:Se.fromError(e.error.code,e.error.message,e.error.data)});else r.settle({cause:"graceful",error:new D(H.ConnectionClosed,"subscriptions/listen: server closed the subscription gracefully before acknowledging")});return}super._onresponse(e)}_onclose(){if(this._listenState.size>0){let e=new D(H.ConnectionClosed,"Connection closed");for(let t of this._listenState.values())t.settle({cause:"remote",error:e});this._listenState.clear()}super._onclose()}async callTool(e,t){let r=this.getProtocolEra()==="modern"&&bk()!=="browser",o=async()=>{if(!r)return t;let c;try{c=await this._resolveXMcpHeaderScan(e.name,t?.toolDefinition)}catch(l){this._reportStoreError(l)}if(!c?.valid||c.declarations.length===0)return t;let u=lk(c.declarations,e.arguments);return Object.keys(u).length===0?t:{...t,headers:{...t?.headers,...u}}},n=t?.toolDefinition===void 0?await this._cache.outputValidator(e.name,(c)=>this._compileOutputValidator(c)).catch((c)=>void this._reportStoreError(c)):this._compileOutputValidator(t.toolDefinition),s=()=>{if(n===void 0||n.ok)return;let c=n.compileError,u=(c instanceof Error?c.message:String(c)).slice(0,200);throw new Se(Q.InvalidParams,`Tool '${e.name}' has an invalid outputSchema: ${u}`)};s();let i;try{i=await this.request({method:"tools/call",params:e},await o())}catch(c){let u=c instanceof Se&&c.code===_s;if(!r||!u||t?.toolDefinition!==void 0)throw c;let l={signal:t?.signal,timeout:t?.timeout,cacheMode:"refresh"};await this._cache.evict("tools/list"),await this.listTools(void 0,l).catch((p)=>this._reportStoreError(p)),n=await this._cache.outputValidator(e.name,(p)=>this._compileOutputValidator(p)).catch((p)=>void this._reportStoreError(p)),s(),i=await this.request({method:"tools/call",params:e},await o())}let a=n!==void 0&&n.ok?n.validator:void 0;if(a){if(i.structuredContent===void 0&&!i.isError)throw new Se(Q.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(i.structuredContent!==void 0&&!i.isError)try{let c=a(i.structuredContent);if(!c.valid)throw new Se(Q.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)}catch(c){if(c instanceof Se)throw c;throw new Se(Q.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)}}return i}async listTools(e,t){if(!this._serverCapabilities?.tools&&!this._enforceStrictCapabilities)return console.debug("Client.listTools() called but server does not advertise tools capability - returning empty list"),{tools:[]};if(e?.cursor!==void 0){let o=await this.request({method:"tools/list",params:e},t);return this._excludeInvalidXMcpHeaderTools(o),o}let r=await this._serveFromCache("tools/list",void 0,t);if(r!==void 0)return r;return this._listAllPages("tools/list",e,t,(o)=>o.tools,(o)=>this._excludeInvalidXMcpHeaderTools(o))}_excludeInvalidXMcpHeaderTools(e){if(this.getProtocolEra()!=="modern"||!this.transport||zk(this.transport)==="stdio")return;let t=e.tools.filter((r)=>{let o=Yh(r.inputSchema);if(!o.valid)return console.warn(`[mcp-sdk] excluding tool '${r.name}' from tools/list: invalid x-mcp-header declaration — ${o.reason}`),!1;return!0});if(t.length!==e.tools.length)e.tools=t}_setupListChangedHandler(e,t,r,o){let n=zp(Sa,r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw TypeError(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,c=async()=>{if(!s){a(null,null);return}try{a(null,await o())}catch(l){a(l instanceof Error?l:Error(String(l)),null)}},u=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let p=setTimeout(c,i);this._listChangedDebounceTimers.set(e,p)}else c()};this.setNotificationHandler(t,u)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var M2=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Et(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Et(this,e)}constructor(e,t,r){super(`SSE error: ${t}`);this.code=e,this.event=r,To(this,new.target)}};var iZ=Object.freeze({status:"aborted"});function z(e,t,r){function o(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(let l in i.prototype)if(!(l in a))Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var aZ=Symbol("zod_brand");class Eo extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var kp={};function It(e){if(e)Object.assign(kp,e);return kp}function Ak(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function cf(e,t="|"){return e.map((r)=>df(r)).join(t)}function Nk(e,t){if(typeof t==="bigint")return t.toString();return t}function uf(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Tp(e){return e===null||e===void 0}function Ep(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Zk(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}function Oe(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function lf(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ss(e){return JSON.stringify(e)}var pf=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Pp(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Mk=uf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function qc(e){if(Pp(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Pp(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}var jk=new Set(["string","number","symbol"]);function fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ir(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function W(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function df(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Lk(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var qk={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function cZ(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return Ir(e,{...e._zod.def,shape:r,checks:[]})}function uZ(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ir(e,{...e._zod.def,shape:r,checks:[]})}function lZ(e,t){if(!qc(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return lf(this,"shape",o),o},checks:[]};return Ir(e,r)}function pZ(e,t){return Ir(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return lf(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function dZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=e?new e({type:"optional",innerType:o[s]}):o[s]}else for(let s in o)n[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Ir(t,{...t._zod.def,shape:n,checks:[]})}function mZ(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=new e({type:"nonoptional",innerType:o[s]})}else for(let s in o)n[s]=new e({type:"nonoptional",innerType:o[s]});return Ir(t,{...t._zod.def,shape:n,checks:[]})}function bs(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Qr(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Rp(e){return typeof e==="string"?e:e?.message}function Cr(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Rp(e.inst?._zod.def?.error?.(e))??Rp(t?.error?.(e))??Rp(r.customError?.(e))??Rp(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Ip(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function zs(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Dk=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Nk,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Cp=z("$ZodError",Dk),mf=z("$ZodError",Dk,{Parent:Error});function hf(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function ff(e,t){let r=t||function(s){return s.message},o={_errors:[]},n=(s)=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,c=0;while(c<i.path.length){let u=i.path[c];if(c!==i.path.length-1)a[u]=a[u]||{_errors:[]};else a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i));a=a[u],c++}}};return n(e),o}var Uk=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Eo;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((c)=>Cr(c,s,It())));throw pf(a,n?.callee),a}return i.value};var Fk=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((c)=>Cr(c,s,It())));throw pf(a,n?.callee),a}return i.value};var gf=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Eo;return s.issues.length?{success:!1,error:new(e??Cp)(s.issues.map((i)=>Cr(i,n,It())))}:{success:!0,data:s.value}},Vk=gf(mf),_f=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Cr(i,n,It())))}:{success:!0,data:s.value}},Bk=_f(mf);var Hk=/^[cC][^\s-]{8,}$/,Jk=/^[0-9a-z]+$/,Kk=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wk=/^[0-9a-vA-V]{20}$/,Gk=/^[A-Za-z0-9]{27}$/,Yk=/^[a-zA-Z0-9_-]{21}$/,Xk=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Qk=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,yf=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var eR=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function tR(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var rR=/^(?:(?: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])$/,oR=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,nR=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,sR=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,iR=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vf=/^[A-Za-z0-9_-]*$/,aR=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var cR=/^\+(?:[0-9]){6,14}[0-9]$/,uR="(?:(?:\\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])))",lR=new RegExp(`^${uR}$`);function pR(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function dR(e){return new RegExp(`^${pR(e)}$`)}function mR(e){let t=pR({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${uR}T(?:${o})$`)}var hR=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var fR=/^\d+$/,gR=/^-?\d+(?:\.\d+)?/i,_R=/true|false/i;var yR=/undefined/i;var vR=/^[^A-Z]*$/,SR=/^[^a-z]*$/;var pt=z("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bR={number:"number",bigint:"bigint",object:"date"},Sf=z("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);let r=bR[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bf=z("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);let r=bR[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zR=z("$ZodCheckMultipleOf",(e,t)=>{pt.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Zk(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),xR=z("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=qk[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=fR}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var wR=z("$ZodCheckMaxLength",(e,t)=>{var r;pt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Tp(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=Ip(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$R=z("$ZodCheckMinLength",(e,t)=>{var r;pt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Tp(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=Ip(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),kR=z("$ZodCheckLengthEquals",(e,t)=>{var r;pt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Tp(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Ip(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Dc=z("$ZodCheckStringFormat",(e,t)=>{var r,o;if(pt.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),RR=z("$ZodCheckRegex",(e,t)=>{Dc.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),PR=z("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vR),Dc.init(e,t)}),TR=z("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=SR),Dc.init(e,t)}),ER=z("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);let r=fn(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),IR=z("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);let r=new RegExp(`^${fn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),CR=z("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);let r=new RegExp(`.*${fn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var OR=z("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class zf{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
252
+ `).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
253
+ `))}}var NR={major:4,minor:0,patch:0};var xe=z("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=NR;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,i,a)=>{let c=bs(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let p=s.issues.length,d=l._zod.check(s);if(d instanceof Promise&&a?.async===!1)throw new Eo;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{if(await d,s.issues.length===p)return;if(!c)c=bs(s,p)});else{if(s.issues.length===p)continue;if(!c)c=bs(s,p)}}if(u)return u.then(()=>s);return s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new Eo;return a.then((c)=>n(c,o,i))}return n(a,o,i)}}e["~standard"]={validate:(n)=>{try{let s=Vk(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Bk(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Np=z("$ZodString",(e,t)=>{xe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hR(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ae=z("$ZodStringFormat",(e,t)=>{Dc.init(e,t),Np.init(e,t)}),BR=z("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Qk),Ae.init(e,t)}),HR=z("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=yf(o))}else t.pattern??(t.pattern=yf());Ae.init(e,t)}),JR=z("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=eR),Ae.init(e,t)}),KR=z("$ZodURL",(e,t)=>{Ae.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),s=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:aR.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&s.endsWith("/"))r.value=s.slice(0,-1);else r.value=s;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),WR=z("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=tR()),Ae.init(e,t)}),GR=z("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Yk),Ae.init(e,t)}),YR=z("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Hk),Ae.init(e,t)}),XR=z("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jk),Ae.init(e,t)}),QR=z("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Kk),Ae.init(e,t)}),eP=z("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wk),Ae.init(e,t)}),tP=z("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gk),Ae.init(e,t)}),rP=z("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mR(t)),Ae.init(e,t)}),oP=z("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=lR),Ae.init(e,t)}),nP=z("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=dR(t)),Ae.init(e,t)}),sP=z("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xk),Ae.init(e,t)}),iP=z("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=rR),Ae.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),aP=z("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=oR),Ae.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),cP=z("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nR),Ae.init(e,t)}),uP=z("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=sR),Ae.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let s=Number(n);if(`${s}`!==n)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function lP(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var pP=z("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=iR),Ae.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(lP(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function fZ(e){if(!vf.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return lP(r)}var dP=z("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vf),Ae.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(fZ(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),mP=z("$ZodE164",(e,t)=>{t.pattern??(t.pattern=cR),Ae.init(e,t)});function gZ(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var hP=z("$ZodJWT",(e,t)=>{Ae.init(e,t),e._zod.check=(r)=>{if(gZ(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wf=z("$ZodNumber",(e,t)=>{xe.init(e,t),e._zod.pattern=e._zod.bag.pattern??gR,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),fP=z("$ZodNumber",(e,t)=>{xR.init(e,t),wf.init(e,t)}),gP=z("$ZodBoolean",(e,t)=>{xe.init(e,t),e._zod.pattern=_R,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var _P=z("$ZodUndefined",(e,t)=>{xe.init(e,t),e._zod.pattern=yR,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;if(typeof n>"u")return r;return r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}});var yP=z("$ZodAny",(e,t)=>{xe.init(e,t),e._zod.parse=(r)=>r}),vP=z("$ZodUnknown",(e,t)=>{xe.init(e,t),e._zod.parse=(r)=>r}),SP=z("$ZodNever",(e,t)=>{xe.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ZR(e,t,r){if(e.issues.length)t.issues.push(...Qr(r,e.issues));t.value[r]=e.value}var bP=z("$ZodArray",(e,t)=>{xe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);if(c instanceof Promise)s.push(c.then((u)=>ZR(u,r,i)));else ZR(c,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Ap(e,t,r){if(e.issues.length)t.issues.push(...Qr(r,e.issues));t.value[r]=e.value}function MR(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...Qr(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var zP=z("$ZodObject",(e,t)=>{xe.init(e,t);let r=uf(()=>{let p=Object.keys(t.shape);for(let h of p)if(!(t.shape[h]instanceof xe))throw Error(`Invalid element at key "${h}": expected a Zod schema`);let d=Lk(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(d)}});Oe(e._zod,"propValues",()=>{let p=t.shape,d={};for(let h in p){let f=p[h]._zod;if(f.values){d[h]??(d[h]=new Set);for(let _ of f.values)d[h].add(_)}}return d});let o=(p)=>{let d=new zf(["shape","payload","ctx"]),h=r.value,f=(Z)=>{let E=Ss(Z);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};d.write("const input = payload.value;");let _=Object.create(null),v=0;for(let Z of h.keys)_[Z]=`key_${v++}`;d.write("const newResult = {}");for(let Z of h.keys)if(h.optionalKeys.has(Z)){let E=_[Z];d.write(`const ${E} = ${f(Z)};`);let ee=Ss(Z);d.write(`
254
+ if (${E}.issues.length) {
255
+ if (input[${ee}] === undefined) {
256
+ if (${ee} in input) {
257
+ newResult[${ee}] = undefined;
258
+ }
259
+ } else {
260
+ payload.issues = payload.issues.concat(
261
+ ${E}.issues.map((iss) => ({
262
+ ...iss,
263
+ path: iss.path ? [${ee}, ...iss.path] : [${ee}],
264
+ }))
265
+ );
266
+ }
267
+ } else if (${E}.value === undefined) {
268
+ if (${ee} in input) newResult[${ee}] = undefined;
269
+ } else {
270
+ newResult[${ee}] = ${E}.value;
271
+ }
272
+ `)}else{let E=_[Z];d.write(`const ${E} = ${f(Z)};`),d.write(`
273
+ if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
274
+ ...iss,
275
+ path: iss.path ? [${Ss(Z)}, ...iss.path] : [${Ss(Z)}]
276
+ })));`),d.write(`newResult[${Ss(Z)}] = ${E}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");let k=d.compile();return(Z,E)=>k(p,Z,E)},n,s=Pp,i=!kp.jitless,c=i&&Mk.value,u=t.catchall,l;e._zod.parse=(p,d)=>{l??(l=r.value);let h=p.value;if(!s(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;let f=[];if(i&&c&&d?.async===!1&&d.jitless!==!0){if(!n)n=o(t.shape);p=n(p,d)}else{p.value={};let E=l.shape;for(let ee of l.keys){let G=E[ee],P=G._zod.run({value:h[ee],issues:[]},d),ae=G._zod.optin==="optional"&&G._zod.optout==="optional";if(P instanceof Promise)f.push(P.then((We)=>ae?MR(We,p,ee,h):Ap(We,p,ee)));else if(ae)MR(P,p,ee,h);else Ap(P,p,ee)}}if(!u)return f.length?Promise.all(f).then(()=>p):p;let _=[],v=l.keySet,k=u._zod,Z=k.def.type;for(let E of Object.keys(h)){if(v.has(E))continue;if(Z==="never"){_.push(E);continue}let ee=k.run({value:h[E],issues:[]},d);if(ee instanceof Promise)f.push(ee.then((G)=>Ap(G,p,E)));else Ap(ee,p,E)}if(_.length)p.issues.push({code:"unrecognized_keys",keys:_,input:h,inst:e});if(!f.length)return p;return Promise.all(f).then(()=>p)}});function jR(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((s)=>Cr(s,o,It())))}),t}var xP=z("$ZodUnion",(e,t)=>{xe.init(e,t),Oe(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),Oe(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),Oe(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),Oe(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>Ep(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!n)return jR(s,r,e,o);return Promise.all(s).then((i)=>jR(i,r,e,o))}});var wP=z("$ZodIntersection",(e,t)=>{xe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([c,u])=>LR(r,c,u));return LR(r,s,i)}});function xf(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(qc(e)&&qc(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=xf(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=xf(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function LR(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(bs(e))return e;let o=xf(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var $P=z("$ZodRecord",(e,t)=>{xe.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!qc(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let c of i)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){let u=t.valueType._zod.run({value:n[c],issues:[]},o);if(u instanceof Promise)s.push(u.then((l)=>{if(l.issues.length)r.issues.push(...Qr(c,l.issues));r.value[c]=l.value}));else{if(u.issues.length)r.issues.push(...Qr(c,u.issues));r.value[c]=u.value}}let a;for(let c in n)if(!i.has(c))a=a??[],a.push(c);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map((u)=>Cr(u,o,It())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:n[i],issues:[]},o);if(c instanceof Promise)s.push(c.then((u)=>{if(u.issues.length)r.issues.push(...Qr(i,u.issues));r.value[a.value]=u.value}));else{if(c.issues.length)r.issues.push(...Qr(i,c.issues));r.value[a.value]=c.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var kP=z("$ZodEnum",(e,t)=>{xe.init(e,t);let r=Ak(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>jk.has(typeof o)).map((o)=>typeof o==="string"?fn(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(e._zod.values.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),RP=z("$ZodLiteral",(e,t)=>{xe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?fn(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}});var PP=z("$ZodTransform",(e,t)=>{xe.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new Eo;return r.value=n,r}}),TP=z("$ZodOptional",(e,t)=>{xe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ep(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),EP=z("$ZodNullable",(e,t)=>{xe.init(e,t),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ep(r.source)}|null)$`):void 0}),Oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),IP=z("$ZodDefault",(e,t)=>{xe.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>qR(s,t));return qR(n,t)}});function qR(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var CP=z("$ZodPrefault",(e,t)=>{xe.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),OP=z("$ZodNonOptional",(e,t)=>{xe.init(e,t),Oe(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>DR(s,e));return DR(n,e)}});function DR(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var AP=z("$ZodCatch",(e,t)=>{xe.init(e,t),e._zod.optin="optional",Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>Cr(i,o,It()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>Cr(s,o,It()))},input:r.value}),r.issues=[];return r}});var NP=z("$ZodPipe",(e,t)=>{xe.init(e,t),Oe(e._zod,"values",()=>t.in._zod.values),Oe(e._zod,"optin",()=>t.in._zod.optin),Oe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>UR(s,t,o));return UR(n,t,o)}});function UR(e,t,r){if(bs(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var ZP=z("$ZodReadonly",(e,t)=>{xe.init(e,t),Oe(e._zod,"propValues",()=>t.innerType._zod.propValues),Oe(e._zod,"values",()=>t.innerType._zod.values),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(FR);return FR(n)}});function FR(e){return e.value=Object.freeze(e.value),e}var MP=z("$ZodCustom",(e,t)=>{pt.init(e,t),xe.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>VR(s,r,o,e));VR(n,r,o,e);return}});function VR(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(zs(n))}}var _Z=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},yZ=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${_Z(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${df(o.values[0])}`;return`Invalid option: expected one of ${cf(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=t(o.origin);if(s)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${cf(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function $f(){return{localeError:yZ()}}var vZ=Symbol("ZodOutput"),SZ=Symbol("ZodInput");class jP{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function LP(){return new jP}var xs=LP();function qP(e,t){return new e({type:"string",...W(t)})}function DP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...W(t)})}function kf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...W(t)})}function UP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...W(t)})}function FP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...W(t)})}function VP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...W(t)})}function BP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...W(t)})}function HP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...W(t)})}function JP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...W(t)})}function KP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...W(t)})}function WP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...W(t)})}function GP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...W(t)})}function YP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...W(t)})}function XP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...W(t)})}function QP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...W(t)})}function e0(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...W(t)})}function t0(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...W(t)})}function r0(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...W(t)})}function o0(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...W(t)})}function n0(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...W(t)})}function s0(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...W(t)})}function i0(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...W(t)})}function a0(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...W(t)})}function c0(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...W(t)})}function u0(e,t){return new e({type:"string",format:"date",check:"string_format",...W(t)})}function l0(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...W(t)})}function p0(e,t){return new e({type:"string",format:"duration",check:"string_format",...W(t)})}function d0(e,t){return new e({type:"number",checks:[],...W(t)})}function m0(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...W(t)})}function h0(e,t){return new e({type:"boolean",...W(t)})}function f0(e,t){return new e({type:"undefined",...W(t)})}function g0(e){return new e({type:"any"})}function _0(e){return new e({type:"unknown"})}function y0(e,t){return new e({type:"never",...W(t)})}function Zp(e,t){return new Sf({check:"less_than",...W(t),value:e,inclusive:!1})}function Uc(e,t){return new Sf({check:"less_than",...W(t),value:e,inclusive:!0})}function Mp(e,t){return new bf({check:"greater_than",...W(t),value:e,inclusive:!1})}function Fc(e,t){return new bf({check:"greater_than",...W(t),value:e,inclusive:!0})}function jp(e,t){return new zR({check:"multiple_of",...W(t),value:e})}function Lp(e,t){return new wR({check:"max_length",...W(t),maximum:e})}function ws(e,t){return new $R({check:"min_length",...W(t),minimum:e})}function qp(e,t){return new kR({check:"length_equals",...W(t),length:e})}function Rf(e,t){return new RR({check:"string_format",format:"regex",...W(t),pattern:e})}function Pf(e){return new PR({check:"string_format",format:"lowercase",...W(e)})}function Tf(e){return new TR({check:"string_format",format:"uppercase",...W(e)})}function Ef(e,t){return new ER({check:"string_format",format:"includes",...W(t),includes:e})}function If(e,t){return new IR({check:"string_format",format:"starts_with",...W(t),prefix:e})}function Cf(e,t){return new CR({check:"string_format",format:"ends_with",...W(t),suffix:e})}function gn(e){return new OR({check:"overwrite",tx:e})}function Of(e){return gn((t)=>t.normalize(e))}function Af(){return gn((e)=>e.trim())}function Nf(){return gn((e)=>e.toLowerCase())}function Zf(){return gn((e)=>e.toUpperCase())}function v0(e,t,r){return new e({type:"array",element:t,...W(r)})}function S0(e,t,r){return new e({type:"custom",check:"custom",fn:t,...W(r)})}var RZ=z("ZodISODateTime",(e,t)=>{rP.init(e,t),Me.init(e,t)});function b0(e){return c0(RZ,e)}var PZ=z("ZodISODate",(e,t)=>{oP.init(e,t),Me.init(e,t)});function z0(e){return u0(PZ,e)}var TZ=z("ZodISOTime",(e,t)=>{nP.init(e,t),Me.init(e,t)});function x0(e){return l0(TZ,e)}var EZ=z("ZodISODuration",(e,t)=>{sP.init(e,t),Me.init(e,t)});function w0(e){return p0(EZ,e)}var k0=(e,t)=>{Cp.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>ff(e,r)},flatten:{value:(r)=>hf(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},IF=z("ZodError",k0),Bc=z("ZodError",k0,{Parent:Error});var R0=Uk(Bc),P0=Fk(Bc),T0=gf(Bc),E0=_f(Bc);var je=z("ZodType",(e,t)=>(xe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>Ir(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>R0(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>T0(e,r,o),e.parseAsync=async(r,o)=>P0(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>E0(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(kM(r,o)),e.superRefine=(r)=>e.check(RM(r)),e.overwrite=(r)=>e.check(gn(r)),e.optional=()=>O0(e),e.nullable=()=>A0(e),e.nullish=()=>O0(A0(e)),e.nonoptional=(r)=>yM(e,r),e.array=()=>er(e),e.or=(r)=>tr([e,r]),e.and=(r)=>aM(e,r),e.transform=(r)=>N0(e,dM(r)),e.default=(r)=>fM(e,r),e.prefault=(r)=>_M(e,r),e.catch=(r)=>SM(e,r),e.pipe=(r)=>N0(e,r),e.readonly=()=>xM(e),e.describe=(r)=>{let o=e.clone();return xs.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return xs.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return xs.get(e);let o=e.clone();return xs.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Z0=z("_ZodString",(e,t)=>{Np.init(e,t),je.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Rf(...o)),e.includes=(...o)=>e.check(Ef(...o)),e.startsWith=(...o)=>e.check(If(...o)),e.endsWith=(...o)=>e.check(Cf(...o)),e.min=(...o)=>e.check(ws(...o)),e.max=(...o)=>e.check(Lp(...o)),e.length=(...o)=>e.check(qp(...o)),e.nonempty=(...o)=>e.check(ws(1,...o)),e.lowercase=(o)=>e.check(Pf(o)),e.uppercase=(o)=>e.check(Tf(o)),e.trim=()=>e.check(Af()),e.normalize=(...o)=>e.check(Of(...o)),e.toLowerCase=()=>e.check(Nf()),e.toUpperCase=()=>e.check(Zf())}),OZ=z("ZodString",(e,t)=>{Np.init(e,t),Z0.init(e,t),e.email=(r)=>e.check(DP(AZ,r)),e.url=(r)=>e.check(HP(NZ,r)),e.jwt=(r)=>e.check(a0(GZ,r)),e.emoji=(r)=>e.check(JP(ZZ,r)),e.guid=(r)=>e.check(kf(I0,r)),e.uuid=(r)=>e.check(UP(Dp,r)),e.uuidv4=(r)=>e.check(FP(Dp,r)),e.uuidv6=(r)=>e.check(VP(Dp,r)),e.uuidv7=(r)=>e.check(BP(Dp,r)),e.nanoid=(r)=>e.check(KP(MZ,r)),e.guid=(r)=>e.check(kf(I0,r)),e.cuid=(r)=>e.check(WP(jZ,r)),e.cuid2=(r)=>e.check(GP(LZ,r)),e.ulid=(r)=>e.check(YP(qZ,r)),e.base64=(r)=>e.check(n0(JZ,r)),e.base64url=(r)=>e.check(s0(KZ,r)),e.xid=(r)=>e.check(XP(DZ,r)),e.ksuid=(r)=>e.check(QP(UZ,r)),e.ipv4=(r)=>e.check(e0(FZ,r)),e.ipv6=(r)=>e.check(t0(VZ,r)),e.cidrv4=(r)=>e.check(r0(BZ,r)),e.cidrv6=(r)=>e.check(o0(HZ,r)),e.e164=(r)=>e.check(i0(WZ,r)),e.datetime=(r)=>e.check(b0(r)),e.date=(r)=>e.check(z0(r)),e.time=(r)=>e.check(x0(r)),e.duration=(r)=>e.check(w0(r))});function Te(e){return qP(OZ,e)}var Me=z("ZodStringFormat",(e,t)=>{Ae.init(e,t),Z0.init(e,t)}),AZ=z("ZodEmail",(e,t)=>{JR.init(e,t),Me.init(e,t)});var I0=z("ZodGUID",(e,t)=>{BR.init(e,t),Me.init(e,t)});var Dp=z("ZodUUID",(e,t)=>{HR.init(e,t),Me.init(e,t)});var NZ=z("ZodURL",(e,t)=>{KR.init(e,t),Me.init(e,t)});var ZZ=z("ZodEmoji",(e,t)=>{WR.init(e,t),Me.init(e,t)});var MZ=z("ZodNanoID",(e,t)=>{GR.init(e,t),Me.init(e,t)});var jZ=z("ZodCUID",(e,t)=>{YR.init(e,t),Me.init(e,t)});var LZ=z("ZodCUID2",(e,t)=>{XR.init(e,t),Me.init(e,t)});var qZ=z("ZodULID",(e,t)=>{QR.init(e,t),Me.init(e,t)});var DZ=z("ZodXID",(e,t)=>{eP.init(e,t),Me.init(e,t)});var UZ=z("ZodKSUID",(e,t)=>{tP.init(e,t),Me.init(e,t)});var FZ=z("ZodIPv4",(e,t)=>{iP.init(e,t),Me.init(e,t)});var VZ=z("ZodIPv6",(e,t)=>{aP.init(e,t),Me.init(e,t)});var BZ=z("ZodCIDRv4",(e,t)=>{cP.init(e,t),Me.init(e,t)});var HZ=z("ZodCIDRv6",(e,t)=>{uP.init(e,t),Me.init(e,t)});var JZ=z("ZodBase64",(e,t)=>{pP.init(e,t),Me.init(e,t)});var KZ=z("ZodBase64URL",(e,t)=>{dP.init(e,t),Me.init(e,t)});var WZ=z("ZodE164",(e,t)=>{mP.init(e,t),Me.init(e,t)});var GZ=z("ZodJWT",(e,t)=>{hP.init(e,t),Me.init(e,t)});var M0=z("ZodNumber",(e,t)=>{wf.init(e,t),je.init(e,t),e.gt=(o,n)=>e.check(Mp(o,n)),e.gte=(o,n)=>e.check(Fc(o,n)),e.min=(o,n)=>e.check(Fc(o,n)),e.lt=(o,n)=>e.check(Zp(o,n)),e.lte=(o,n)=>e.check(Uc(o,n)),e.max=(o,n)=>e.check(Uc(o,n)),e.int=(o)=>e.check(C0(o)),e.safe=(o)=>e.check(C0(o)),e.positive=(o)=>e.check(Mp(0,o)),e.nonnegative=(o)=>e.check(Fc(0,o)),e.negative=(o)=>e.check(Zp(0,o)),e.nonpositive=(o)=>e.check(Uc(0,o)),e.multipleOf=(o,n)=>e.check(jp(o,n)),e.step=(o,n)=>e.check(jp(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function Or(e){return d0(M0,e)}var YZ=z("ZodNumberFormat",(e,t)=>{fP.init(e,t),M0.init(e,t)});function C0(e){return m0(YZ,e)}var XZ=z("ZodBoolean",(e,t)=>{gP.init(e,t),je.init(e,t)});function eo(e){return h0(XZ,e)}var QZ=z("ZodUndefined",(e,t)=>{_P.init(e,t),je.init(e,t)});function jf(e){return f0(QZ,e)}var eM=z("ZodAny",(e,t)=>{yP.init(e,t),je.init(e,t)});function j0(){return g0(eM)}var tM=z("ZodUnknown",(e,t)=>{vP.init(e,t),je.init(e,t)});function $s(){return _0(tM)}var rM=z("ZodNever",(e,t)=>{SP.init(e,t),je.init(e,t)});function Lf(e){return y0(rM,e)}var oM=z("ZodArray",(e,t)=>{bP.init(e,t),je.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(ws(r,o)),e.nonempty=(r)=>e.check(ws(1,r)),e.max=(r,o)=>e.check(Lp(r,o)),e.length=(r,o)=>e.check(qp(r,o)),e.unwrap=()=>e.element});function er(e,t){return v0(oM,e,t)}var nM=z("ZodObject",(e,t)=>{zP.init(e,t),je.init(e,t),Oe(e,"shape",()=>t.shape),e.keyof=()=>uM(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:$s()}),e.loose=()=>e.clone({...e._zod.def,catchall:$s()}),e.strict=()=>e.clone({...e._zod.def,catchall:Lf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>lZ(e,r),e.merge=(r)=>pZ(e,r),e.pick=(r)=>cZ(e,r),e.omit=(r)=>uZ(e,r),e.partial=(...r)=>dZ(L0,e,r[0]),e.required=(...r)=>mZ(q0,e,r[0])});function N(e,t){let r={type:"object",get shape(){return lf(this,"shape",{...e}),this.shape},...W(t)};return new nM(r)}var sM=z("ZodUnion",(e,t)=>{xP.init(e,t),je.init(e,t),e.options=t.options});function tr(e,t){return new sM({type:"union",options:e,...W(t)})}var iM=z("ZodIntersection",(e,t)=>{wP.init(e,t),je.init(e,t)});function aM(e,t){return new iM({type:"intersection",left:e,right:t})}var cM=z("ZodRecord",(e,t)=>{$P.init(e,t),je.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function to(e,t,r){return new cM({type:"record",keyType:e,valueType:t,...W(r)})}var Mf=z("ZodEnum",(e,t)=>{kP.init(e,t),je.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Mf({...t,checks:[],...W(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Mf({...t,checks:[],...W(n),entries:s})}});function uM(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Mf({type:"enum",entries:r,...W(t)})}var lM=z("ZodLiteral",(e,t)=>{RP.init(e,t),je.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function x(e,t){return new lM({type:"literal",values:Array.isArray(e)?e:[e],...W(t)})}var pM=z("ZodTransform",(e,t)=>{PP.init(e,t),je.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(zs(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(zs(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function dM(e){return new pM({type:"transform",transform:e})}var L0=z("ZodOptional",(e,t)=>{TP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType});function O0(e){return new L0({type:"optional",innerType:e})}var mM=z("ZodNullable",(e,t)=>{EP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType});function A0(e){return new mM({type:"nullable",innerType:e})}var hM=z("ZodDefault",(e,t)=>{IP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fM(e,t){return new hM({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var gM=z("ZodPrefault",(e,t)=>{CP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _M(e,t){return new gM({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var q0=z("ZodNonOptional",(e,t)=>{OP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType});function yM(e,t){return new q0({type:"nonoptional",innerType:e,...W(t)})}var vM=z("ZodCatch",(e,t)=>{AP.init(e,t),je.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function SM(e,t){return new vM({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var bM=z("ZodPipe",(e,t)=>{NP.init(e,t),je.init(e,t),e.in=t.in,e.out=t.out});function N0(e,t){return new bM({type:"pipe",in:e,out:t})}var zM=z("ZodReadonly",(e,t)=>{ZP.init(e,t),je.init(e,t)});function xM(e){return new zM({type:"readonly",innerType:e})}var wM=z("ZodCustom",(e,t)=>{MP.init(e,t),je.init(e,t)});function $M(e){let t=new pt({check:"custom"});return t._zod.check=e,t}function kM(e,t={}){return S0(wM,e,t)}function RM(e){let t=$M((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(zs(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(zs(n))}},e(r.value,r)));return t}It($f());class H0{_eventSlots=new Map;setHandler(e,t){let r=this._ensureEventSlot(e);if(r.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);r.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let r=this._eventSlots.get(e);if(!r)return;let o=r.listeners.indexOf(t);if(o!==-1)r.listeners.splice(o,1)}dispatch(e,t){let r=this._eventSlots.get(e);if(!r)return;r.onHandler?.(t);for(let o of[...r.listeners])o(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class J0{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var D0=new Set;function U0(e,t){let[r,o]=t,n=r?.shape;if(typeof n?.method?.value!=="string")return;let s=n.method.value,i=e==="request"?"setRequestHandler":"setNotificationHandler";if(!D0.has(i))D0.add(i),console.warn(`[ext-apps] ${i}(Schema, handler) is deprecated; use ${i}("${s}", { params: Schema.shape.params }, handler).`);let a=o;return[s,{params:n.params},e==="request"?(c,u)=>a({method:s,params:c},PM(u)):(c)=>a({method:s,params:c})]}function PM(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var TM="2026-01-26";var EM="ui/notifications/tool-input-partial";class K0{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(r)=>{if(t&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let o=Qo.safeParse(r.data);if(o.success)console.debug("Parsed message",o.data),this.onmessage?.(o.data);else if(r.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",o.error.message,r);else console.error("Failed to parse message",o.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==EM)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var IM=tr([x("light"),x("dark")]).describe("Color theme preference for the host environment."),Hc=tr([x("inline"),x("fullscreen"),x("pip")]).describe("Display mode for UI presentation."),CM=tr([x("--color-background-primary"),x("--color-background-secondary"),x("--color-background-tertiary"),x("--color-background-inverse"),x("--color-background-ghost"),x("--color-background-info"),x("--color-background-danger"),x("--color-background-success"),x("--color-background-warning"),x("--color-background-disabled"),x("--color-text-primary"),x("--color-text-secondary"),x("--color-text-tertiary"),x("--color-text-inverse"),x("--color-text-ghost"),x("--color-text-info"),x("--color-text-danger"),x("--color-text-success"),x("--color-text-warning"),x("--color-text-disabled"),x("--color-border-primary"),x("--color-border-secondary"),x("--color-border-tertiary"),x("--color-border-inverse"),x("--color-border-ghost"),x("--color-border-info"),x("--color-border-danger"),x("--color-border-success"),x("--color-border-warning"),x("--color-border-disabled"),x("--color-ring-primary"),x("--color-ring-secondary"),x("--color-ring-inverse"),x("--color-ring-info"),x("--color-ring-danger"),x("--color-ring-success"),x("--color-ring-warning"),x("--font-sans"),x("--font-mono"),x("--font-weight-normal"),x("--font-weight-medium"),x("--font-weight-semibold"),x("--font-weight-bold"),x("--font-text-xs-size"),x("--font-text-sm-size"),x("--font-text-md-size"),x("--font-text-lg-size"),x("--font-heading-xs-size"),x("--font-heading-sm-size"),x("--font-heading-md-size"),x("--font-heading-lg-size"),x("--font-heading-xl-size"),x("--font-heading-2xl-size"),x("--font-heading-3xl-size"),x("--font-text-xs-line-height"),x("--font-text-sm-line-height"),x("--font-text-md-line-height"),x("--font-text-lg-line-height"),x("--font-heading-xs-line-height"),x("--font-heading-sm-line-height"),x("--font-heading-md-line-height"),x("--font-heading-lg-line-height"),x("--font-heading-xl-line-height"),x("--font-heading-2xl-line-height"),x("--font-heading-3xl-line-height"),x("--border-radius-xs"),x("--border-radius-sm"),x("--border-radius-md"),x("--border-radius-lg"),x("--border-radius-xl"),x("--border-radius-full"),x("--border-width-regular"),x("--shadow-hairline"),x("--shadow-sm"),x("--shadow-md"),x("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),OM=to(CM.describe(`Style variables for theming MCP apps.
277
+
278
+ Individual style keys are optional - hosts may provide any subset of these values.
279
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
280
+
281
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
282
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),tr([Te(),jf()]).describe(`Style variables for theming MCP apps.
283
+
284
+ Individual style keys are optional - hosts may provide any subset of these values.
285
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
286
+
287
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
288
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
289
+
290
+ Individual style keys are optional - hosts may provide any subset of these values.
291
+ Values are strings containing CSS values (colors, sizes, font stacks, etc.).
292
+
293
+ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
294
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),N9=N({method:x("ui/open-link"),params:N({url:Te().describe("URL to open in the host's browser")})}),AM=N({isError:eo().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),NM=N({isError:eo().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),ZM=N({isError:eo().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),Z9=N({method:x("ui/notifications/sandbox-proxy-ready"),params:N({})}),Df=N({connectDomains:er(Te()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
295
+
296
+ - Maps to CSP \`connect-src\` directive
297
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:er(Te()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:er(Te()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:er(Te()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Uf=N({camera:N({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:N({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:N({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:N({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),M9=N({method:x("ui/notifications/size-changed"),params:N({width:Or().optional().describe("New width in pixels."),height:Or().optional().describe("New height in pixels.")})}),MM=N({method:x("ui/notifications/tool-input"),params:N({arguments:to(Te(),$s().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),jM=N({method:x("ui/notifications/tool-input-partial"),params:N({arguments:to(Te(),$s().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),LM=N({method:x("ui/notifications/tool-cancelled"),params:N({reason:Te().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),qM=N({fonts:Te().optional()}),DM=N({variables:OM.optional().describe("CSS variables for theming the app."),css:qM.optional().describe("CSS blocks that apps can inject.")}),UM=N({method:x("ui/resource-teardown"),params:N({})}),FM=to(Te(),$s()),F0=N({text:N({}).optional().describe("Host supports text content blocks."),image:N({}).optional().describe("Host supports image content blocks."),audio:N({}).optional().describe("Host supports audio content blocks."),resource:N({}).optional().describe("Host supports resource content blocks."),resourceLink:N({}).optional().describe("Host supports resource link content blocks."),structuredContent:N({}).optional().describe("Host supports structured content.")}),j9=N({method:x("ui/notifications/request-teardown"),params:N({}).optional()}),VM=N({experimental:to(Te(),to(Te(),j0()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:N({}).optional().describe("Host supports opening external URLs."),downloadFile:N({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:N({listChanged:eo().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:N({listChanged:eo().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:N({}).optional().describe("Host accepts log messages."),sandbox:N({permissions:Uf.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Df.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:F0.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:F0.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:N({tools:N({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),BM=N({experimental:to(Te(),to(Te(),j0()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:N({listChanged:eo().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:er(Hc).optional().describe("Display modes the app supports.")}),L9=N({method:x("ui/notifications/initialized"),params:N({}).optional()}),q9=N({csp:Df.optional().describe("Content Security Policy configuration for UI resources."),permissions:Uf.optional().describe("Sandbox permissions requested by the UI resource."),domain:Te().optional().describe(`Dedicated origin for view sandbox.
298
+
299
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
300
+
301
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
302
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
303
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
304
+
305
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:eo().optional().describe(`Visual boundary preference - true if view prefers a visible border.
306
+
307
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
308
+
309
+ - \`true\`: request visible border + background
310
+ - \`false\`: request no visible border + background
311
+ - omitted: host decides border`)}),D9=N({method:x("ui/request-display-mode"),params:N({mode:Hc.describe("The display mode being requested.")})}),HM=N({mode:Hc.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),JM=tr([x("model"),x("app")]).describe("Tool visibility scope - who can access the tool."),U9=N({resourceUri:Te().optional(),visibility:er(JM).optional().describe(`Who can access this tool. Default: ["model", "app"]
312
+ - "model": Tool visible to and callable by the agent
313
+ - "app": Tool callable by the app from this server only`),csp:Lf().optional(),permissions:Lf().optional()}),F9=N({mimeTypes:er(Te()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),V9=N({method:x("ui/download-file"),params:N({contents:er(tr([nn,sn])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),B9=N({method:x("ui/message"),params:N({role:x("user").describe('Message role, currently only "user" is supported.'),content:er($r).describe("Message content blocks (text, image, etc.).")})}),H9=N({method:x("ui/notifications/sandbox-resource-ready"),params:N({html:Te().describe("HTML content to load into the inner iframe."),sandbox:Te().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Df.optional().describe("CSP configuration from resource metadata."),permissions:Uf.optional().describe("Sandbox permissions from resource metadata.")})}),KM=N({method:x("ui/notifications/tool-result"),params:xo.describe("Standard MCP tool execution result.")}),W0=N({toolInfo:N({id:sr.optional().describe("JSON-RPC id of the tools/call request."),tool:zo.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:IM.optional().describe("Current color theme preference."),styles:DM.optional().describe("Style configuration for theming the app."),displayMode:Hc.optional().describe("How the UI is currently displayed."),availableDisplayModes:er(Hc).optional().describe("Display modes the host supports."),containerDimensions:tr([N({height:Or().describe("Fixed container height in pixels.")}),N({maxHeight:tr([Or(),jf()]).optional().describe("Maximum container height in pixels.")})]).and(tr([N({width:Or().describe("Fixed container width in pixels.")}),N({maxWidth:tr([Or(),jf()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
314
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:Te().optional().describe("User's language and region preference in BCP 47 format."),timeZone:Te().optional().describe("User's timezone in IANA format."),userAgent:Te().optional().describe("Host application identifier."),platform:tr([x("web"),x("desktop"),x("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:N({touch:eo().optional().describe("Whether the device supports touch input."),hover:eo().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:N({top:Or().describe("Top safe area inset in pixels."),right:Or().describe("Right safe area inset in pixels."),bottom:Or().describe("Bottom safe area inset in pixels."),left:Or().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),WM=N({method:x("ui/notifications/host-context-changed"),params:W0.describe("Partial context update containing only changed fields.")}),J9=N({method:x("ui/update-model-context"),params:N({content:er($r).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:to(Te(),$s().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),K9=N({method:x("ui/initialize"),params:N({appInfo:xr.describe("App identification (name and version)."),appCapabilities:BM.describe("Features and capabilities this app provides."),protocolVersion:Te().describe("Protocol version this app supports.")})}),GM=N({protocolVersion:Te().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:xr.describe("Host application identification and version."),hostCapabilities:VM.describe("Features and capabilities provided by the host."),hostContext:W0.describe("Rich context about the host environment.")}).passthrough(),YM={target:"draft-2020-12"};async function V0(e,t){let r=e["~standard"];if(r.jsonSchema)return r.jsonSchema[t](YM);throw Error(`Schema (vendor: ${r.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function B0(e,t,r=""){let o=await e["~standard"].validate(t);if(o.issues){let n=o.issues.map((s)=>{let i=s.path?.map((a)=>typeof a==="object"?a.key:a).join(".");return i?`${i}: ${s.message}`:s.message}).join("; ");throw Error(r+n)}return o.value}function G0(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function Y0(e,t=document.documentElement){for(let[r,o]of Object.entries(e))if(o!==void 0)t.style.setProperty(r,o)}function XM(e,t){let r={...e,...t};if(t.experimental!==void 0)r.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)r.tools={...e.tools,...t.tools};return r}class Up extends jc{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new H0;_methods=new J0;setRequestHandler=(...e)=>{let[t,...r]=U0("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...r)};setNotificationHandler=(...e)=>{let[t,...r]=U0("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...r)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:MM,toolinputpartial:jM,toolresult:KM,toolcancelled:LM,hostcontextchanged:WM};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!Up.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(r)=>{let o=r;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...o};this._events.dispatch(e,o)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,r){if(t&&r)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},r={autoResize:!0}){super(r);if(this._appInfo=e,this._appCapabilities=t,this.options=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!r.allowUnsafeEval)It({jitless:!0});this.replaceRequestHandler("ping",(o)=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=XM(this._appCapabilities,e)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let o=this,n=()=>{if(o._initializedSent&&o._appCapabilities.tools?.listChanged)o.sendToolListChanged()},s=t.inputSchema!==void 0,i={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(a){Object.assign(this,a),n()},remove(){if(o._registeredTools[e]!==i)return;delete o._registeredTools[e],n()},handler:async(a,c)=>{if(!i.enabled)throw Error(`Tool ${e} is disabled`);let u;if(s){let l=i.inputSchema,p=l?await B0(l,a??{},`Invalid input for tool ${e}: `):a??{};u=await r(p,c)}else u=await r(c);if(i.outputSchema&&!u.isError)u.structuredContent=await B0(i.outputSchema,u.structuredContent,`Invalid output for tool ${e}: `);return u}};if(this._registeredTools[e]=i,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),i}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let r=this._registeredTools[e.name];if(!r)throw Error(`Tool ${e.name} not found`);return r.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,o])=>o.enabled).map(async([r,o])=>{let n={name:r,title:o.title,description:o.description,inputSchema:o.inputSchema?await V0(o.inputSchema,"input"):{type:"object",properties:{}}};if(o.outputSchema)n.outputSchema=await V0(o.outputSchema,"output");if(o.annotations)n.annotations=o.annotations;if(o._meta)n._meta=o._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:UM.shape.params,result:FM},(t,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,r)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},ZM,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},So,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},AM,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},NM,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},HM,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,r=0,o=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let s=document.documentElement,i=s.style.height;s.style.height="max-content";let a=Math.ceil(s.getBoundingClientRect().height);s.style.height=i;let c=Math.ceil(window.innerWidth);if(c!==t||a!==r)t=c,r=a,this.sendSizeChanged({width:c,height:a})})};o();let n=new ResizeObserver(o);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new K0(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:TM}},GM,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}}var ge;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let s={};for(let i of n)s[i]=i;return s},e.getValidEnumValues=(n)=>{let s=e.objectKeys(n).filter((a)=>typeof n[n[a]]!=="number"),i={};for(let a of s)i[a]=n[a];return e.objectValues(i)},e.objectValues=(n)=>e.objectKeys(n).map(function(s){return n[s]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let s=[];for(let i in n)if(Object.prototype.hasOwnProperty.call(n,i))s.push(i);return s},e.find=(n,s)=>{for(let i of n)if(s(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,s=" | "){return n.map((i)=>typeof i==="string"?`'${i}'`:i).join(s)}e.joinValues=o,e.jsonStringifyReplacer=(n,s)=>{if(typeof s==="bigint")return s.toString();return s}})(ge||(ge={}));var X0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(X0||(X0={}));var L=ge.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ro=(e)=>{switch(typeof e){case"undefined":return L.undefined;case"string":return L.string;case"number":return Number.isNaN(e)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":if(Array.isArray(e))return L.array;if(e===null)return L.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return L.promise;if(typeof Map<"u"&&e instanceof Map)return L.map;if(typeof Set<"u"&&e instanceof Set)return L.set;if(typeof Date<"u"&&e instanceof Date)return L.date;return L.object;default:return L.unknown}};var w=ge.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"]);class Ft extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},o=(n)=>{for(let s of n.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let c=s.path[a];if(a!==s.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s));i=i[c],a++}}};return o(this),r}static assert(e){if(!(e instanceof Ft))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ge.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let o of this.issues)if(o.path.length>0){let n=o.path[0];t[n]=t[n]||[],t[n].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Ft.create=(e)=>new Ft(e);var QM=(e,t)=>{let r;switch(e.code){case w.invalid_type:if(e.received===L.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ge.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${ge.joinValues(e.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ge.joinValues(e.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${ge.joinValues(e.options)}, received '${e.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else ge.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case w.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case w.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=t.defaultError,ge.assertNever(e)}return{message:r}},Co=QM;var ej=Co;function Jc(){return ej}var Fp=(e)=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,s=[...r,...n.path||[]],i={...n,path:s};if(n.message!==void 0)return{...n,path:s,message:n.message};let a="",c=o.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...n,path:s,message:a}};function A(e,t){let r=Jc(),o=Fp({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Co?void 0:Co].filter((n)=>!!n)});e.common.issues.push(o)}class dt{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let o of t){if(o.status==="aborted")return oe;if(o.status==="dirty")e.dirty();r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let o of t){let n=await o.key,s=await o.value;r.push({key:n,value:s})}return dt.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let o of t){let{key:n,value:s}=o;if(n.status==="aborted")return oe;if(s.status==="aborted")return oe;if(n.status==="dirty")e.dirty();if(s.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet))r[n.value]=s.value}return{status:e.value,value:r}}}var oe=Object.freeze({status:"aborted"}),ks=(e)=>({status:"dirty",value:e}),bt=(e)=>({status:"valid",value:e}),Ff=(e)=>e.status==="aborted",Vf=(e)=>e.status==="dirty",_n=(e)=>e.status==="valid",Kc=(e)=>typeof Promise<"u"&&e instanceof Promise;var K;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(K||(K={}));class cr{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var Q0=(e,t)=>{if(_n(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ft(e.common.issues);return this._error=r,this._error}}}};function ce(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??o??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:n}}class de{get description(){return this._def.description}_getType(e){return ro(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ro(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new dt,ctx:{common:e.parent.common,data:e.data,parsedType:ro(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Kc(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ro(e)},o=this._parseSync({data:e,path:r.path,parent:r});return Q0(r,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ro(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return _n(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>_n(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ro(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(Kc(o)?o:Promise.resolve(o));return Q0(r,n)}refine(e,t){let r=(o)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(o);else return t};return this._refinement((o,n)=>{let s=e(o),i=()=>n.addIssue({code:w.custom,...r(o)});if(typeof Promise<"u"&&s instanceof Promise)return s.then((a)=>{if(!a)return i(),!1;else return!0});if(!s)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,o)=>{if(!e(r))return o.addIssue(typeof t==="function"?t(r,o):t),!1;else return!0})}_refinement(e){return new Zr({schema:this,typeName:ne.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 Nr.create(this,this._def)}nullable(){return Oo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ar.create(this)}promise(){return Is.create(this,this._def)}or(e){return Qc.create([this,e],this._def)}and(e){return eu.create(this,e,this._def)}transform(e){return new Zr({...ce(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new nu({...ce(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new Kf({typeName:ne.ZodBranded,type:this,...ce(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new su({...ce(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Yp.create(this,e)}readonly(){return iu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var tj=/^c[^\s-]{8,}$/i,rj=/^[0-9a-z]+$/,oj=/^[0-9A-HJKMNP-TV-Z]{26}$/i,nj=/^[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,sj=/^[a-z0-9_-]{21}$/i,ij=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,aj=/^[-+]?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)?)??$/,cj=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,uj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Bf,lj=/^(?:(?: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])$/,pj=/^(?:(?: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])$/,dj=/^(([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]))$/,mj=/^(([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])$/,hj=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fj=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,eT="((\\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])))",gj=new RegExp(`^${eT}$`);function tT(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function _j(e){return new RegExp(`^${tT(e)}$`)}function yj(e){let t=`${eT}T${tT(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function vj(e,t){if((t==="v4"||!t)&&lj.test(e))return!0;if((t==="v6"||!t)&&dj.test(e))return!0;return!1}function Sj(e,t){if(!ij.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function bj(e,t){if((t==="v4"||!t)&&pj.test(e))return!0;if((t==="v6"||!t)&&mj.test(e))return!0;return!1}class no extends de{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==L.string){let n=this._getOrReturnCtx(e);return A(n,{code:w.invalid_type,expected:L.string,received:n.parsedType}),oe}let r=new dt,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)o=this._getOrReturnCtx(e,o),A(o,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)o=this._getOrReturnCtx(e,o),A(o,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let s=e.data.length>n.value,i=e.data.length<n.value;if(s||i){if(o=this._getOrReturnCtx(e,o),s)A(o,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(i)A(o,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!cj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"email",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!Bf)Bf=new RegExp(uj,"u");if(!Bf.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"emoji",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!nj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"uuid",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!sj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"nanoid",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!tj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"cuid",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!rj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"cuid2",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!oj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"ulid",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),A(o,{validation:"url",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"regex",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!yj(n).test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!gj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!_j(n).test(e.data))o=this._getOrReturnCtx(e,o),A(o,{code:w.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!aj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"duration",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!vj(e.data,n.version))o=this._getOrReturnCtx(e,o),A(o,{validation:"ip",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!Sj(e.data,n.alg))o=this._getOrReturnCtx(e,o),A(o,{validation:"jwt",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!bj(e.data,n.version))o=this._getOrReturnCtx(e,o),A(o,{validation:"cidr",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!hj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"base64",code:w.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!fj.test(e.data))o=this._getOrReturnCtx(e,o),A(o,{validation:"base64url",code:w.invalid_string,message:n.message}),r.dirty()}else ge.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((o)=>e.test(o),{validation:t,code:w.invalid_string,...K.errToObj(r)})}_addCheck(e){return new no({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...K.errToObj(e)})}url(e){return this._addCheck({kind:"url",...K.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...K.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...K.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...K.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...K.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...K.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...K.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...K.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...K.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...K.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...K.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...K.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...K.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...K.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...K.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...K.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...K.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...K.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...K.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...K.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...K.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...K.errToObj(t)})}nonempty(e){return this.min(1,K.errToObj(e))}trim(){return new no({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new no({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new no({...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)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}no.create=(e)=>new no({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...ce(e)});function zj(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}class Ps extends de{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);if(this._getType(e)!==L.number){let n=this._getOrReturnCtx(e);return A(n,{code:w.invalid_type,expected:L.number,received:n.parsedType}),oe}let r=void 0,o=new dt;for(let n of this._def.checks)if(n.kind==="int"){if(!ge.isInteger(e.data))r=this._getOrReturnCtx(e,r),A(r,{code:w.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:w.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(zj(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),A(r,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),A(r,{code:w.not_finite,message:n.message}),o.dirty()}else ge.assertNever(n);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,K.toString(t))}gt(e,t){return this.setLimit("min",e,!1,K.toString(t))}lte(e,t){return this.setLimit("max",e,!0,K.toString(t))}lt(e,t){return this.setLimit("max",e,!1,K.toString(t))}setLimit(e,t,r,o){return new Ps({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:K.toString(o)}]})}_addCheck(e){return new Ps({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:K.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:K.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:K.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:K.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:K.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&ge.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Ps.create=(e)=>new Ps({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...ce(e)});class Ts extends de{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)!==L.bigint)return this._getInvalidInput(e);let r=void 0,o=new dt;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:w.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),A(r,{code:w.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),A(r,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else ge.assertNever(n);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return A(t,{code:w.invalid_type,expected:L.bigint,received:t.parsedType}),oe}gte(e,t){return this.setLimit("min",e,!0,K.toString(t))}gt(e,t){return this.setLimit("min",e,!1,K.toString(t))}lte(e,t){return this.setLimit("max",e,!0,K.toString(t))}lt(e,t){return this.setLimit("max",e,!1,K.toString(t))}setLimit(e,t,r,o){return new Ts({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:K.toString(o)}]})}_addCheck(e){return new Ts({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:K.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Ts.create=(e)=>new Ts({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...ce(e)});class Vp extends de{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==L.boolean){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.boolean,received:r.parsedType}),oe}return bt(e.data)}}Vp.create=(e)=>new Vp({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...ce(e)});class Gc extends de{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==L.date){let n=this._getOrReturnCtx(e);return A(n,{code:w.invalid_type,expected:L.date,received:n.parsedType}),oe}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return A(n,{code:w.invalid_date}),oe}let r=new dt,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)o=this._getOrReturnCtx(e,o),A(o,{code:w.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)o=this._getOrReturnCtx(e,o),A(o,{code:w.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else ge.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Gc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:K.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:K.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(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)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}Gc.create=(e)=>new Gc({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...ce(e)});class Bp extends de{_parse(e){if(this._getType(e)!==L.symbol){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.symbol,received:r.parsedType}),oe}return bt(e.data)}}Bp.create=(e)=>new Bp({typeName:ne.ZodSymbol,...ce(e)});class Yc extends de{_parse(e){if(this._getType(e)!==L.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.undefined,received:r.parsedType}),oe}return bt(e.data)}}Yc.create=(e)=>new Yc({typeName:ne.ZodUndefined,...ce(e)});class Xc extends de{_parse(e){if(this._getType(e)!==L.null){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.null,received:r.parsedType}),oe}return bt(e.data)}}Xc.create=(e)=>new Xc({typeName:ne.ZodNull,...ce(e)});class Hp extends de{constructor(){super(...arguments);this._any=!0}_parse(e){return bt(e.data)}}Hp.create=(e)=>new Hp({typeName:ne.ZodAny,...ce(e)});class yn extends de{constructor(){super(...arguments);this._unknown=!0}_parse(e){return bt(e.data)}}yn.create=(e)=>new yn({typeName:ne.ZodUnknown,...ce(e)});class so extends de{_parse(e){let t=this._getOrReturnCtx(e);return A(t,{code:w.invalid_type,expected:L.never,received:t.parsedType}),oe}}so.create=(e)=>new so({typeName:ne.ZodNever,...ce(e)});class Jp extends de{_parse(e){if(this._getType(e)!==L.undefined){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.void,received:r.parsedType}),oe}return bt(e.data)}}Jp.create=(e)=>new Jp({typeName:ne.ZodVoid,...ce(e)});class Ar extends de{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==L.array)return A(t,{code:w.invalid_type,expected:L.array,received:t.parsedType}),oe;if(o.exactLength!==null){let s=t.data.length>o.exactLength.value,i=t.data.length<o.exactLength.value;if(s||i)A(t,{code:s?w.too_big:w.too_small,minimum:i?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty()}if(o.minLength!==null){if(t.data.length<o.minLength.value)A(t,{code:w.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()}if(o.maxLength!==null){if(t.data.length>o.maxLength.value)A(t,{code:w.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((s,i)=>o.type._parseAsync(new cr(t,s,t.path,i)))).then((s)=>dt.mergeArray(r,s));let n=[...t.data].map((s,i)=>o.type._parseSync(new cr(t,s,t.path,i)));return dt.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Ar({...this._def,minLength:{value:e,message:K.toString(t)}})}max(e,t){return new Ar({...this._def,maxLength:{value:e,message:K.toString(t)}})}length(e,t){return new Ar({...this._def,exactLength:{value:e,message:K.toString(t)}})}nonempty(e){return this.min(1,e)}}Ar.create=(e,t)=>new Ar({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...ce(t)});function Rs(e){if(e instanceof Ke){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=Nr.create(Rs(o))}return new Ke({...e._def,shape:()=>t})}else if(e instanceof Ar)return new Ar({...e._def,type:Rs(e.element)});else if(e instanceof Nr)return Nr.create(Rs(e.unwrap()));else if(e instanceof Oo)return Oo.create(Rs(e.unwrap()));else if(e instanceof io)return io.create(e.items.map((t)=>Rs(t)));else return e}class Ke extends de{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=ge.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==L.object){let c=this._getOrReturnCtx(e);return A(c,{code:w.invalid_type,expected:L.object,received:c.parsedType}),oe}let{status:r,ctx:o}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof so&&this._def.unknownKeys==="strip")){for(let c in o.data)if(!s.includes(c))i.push(c)}let a=[];for(let c of s){let u=n[c],l=o.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new cr(o,l,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof so){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict"){if(i.length>0)A(o,{code:w.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let l=o.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new cr(o,l,o.path,u)),alwaysSet:u in o.data})}}if(o.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let l=await u.key,p=await u.value;c.push({key:l,value:p,alwaysSet:u.alwaysSet})}return c}).then((c)=>dt.mergeObjectSync(r,c));else return dt.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return K.errToObj,new Ke({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let o=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:K.errToObj(e).message??o};return{message:o}}}:{}})}strip(){return new Ke({...this._def,unknownKeys:"strip"})}passthrough(){return new Ke({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ke({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ke({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ke({...this._def,catchall:e})}pick(e){let t={};for(let r of ge.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Ke({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ge.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Ke({...this._def,shape:()=>t})}deepPartial(){return Rs(this)}partial(e){let t={};for(let r of ge.objectKeys(this.shape)){let o=this.shape[r];if(e&&!e[r])t[r]=o;else t[r]=o.optional()}return new Ke({...this._def,shape:()=>t})}required(e){let t={};for(let r of ge.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof Nr)n=n._def.innerType;t[r]=n}return new Ke({...this._def,shape:()=>t})}keyof(){return rT(ge.objectKeys(this.shape))}}Ke.create=(e,t)=>new Ke({shape:()=>e,unknownKeys:"strip",catchall:so.create(),typeName:ne.ZodObject,...ce(t)});Ke.strictCreate=(e,t)=>new Ke({shape:()=>e,unknownKeys:"strict",catchall:so.create(),typeName:ne.ZodObject,...ce(t)});Ke.lazycreate=(e,t)=>new Ke({shape:e,unknownKeys:"strip",catchall:so.create(),typeName:ne.ZodObject,...ce(t)});class Qc extends de{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function o(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let s=n.map((i)=>new Ft(i.ctx.common.issues));return A(t,{code:w.invalid_union,unionErrors:s}),oe}if(t.common.async)return Promise.all(r.map(async(n)=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(o);else{let n=void 0,s=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!n)n={result:u,ctx:c};if(c.common.issues.length)s.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=s.map((a)=>new Ft(a));return A(t,{code:w.invalid_union,unionErrors:i}),oe}}get options(){return this._def.options}}Qc.create=(e,t)=>new Qc({options:e,typeName:ne.ZodUnion,...ce(t)});var oo=(e)=>{if(e instanceof tu)return oo(e.schema);else if(e instanceof Zr)return oo(e.innerType());else if(e instanceof ru)return[e.value];else if(e instanceof vn)return e.options;else if(e instanceof ou)return ge.objectValues(e.enum);else if(e instanceof nu)return oo(e._def.innerType);else if(e instanceof Yc)return[void 0];else if(e instanceof Xc)return[null];else if(e instanceof Nr)return[void 0,...oo(e.unwrap())];else if(e instanceof Oo)return[null,...oo(e.unwrap())];else if(e instanceof Kf)return oo(e.unwrap());else if(e instanceof iu)return oo(e.unwrap());else if(e instanceof su)return oo(e._def.innerType);else return[]};class Jf extends de{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.object)return A(t,{code:w.invalid_type,expected:L.object,received:t.parsedType}),oe;let r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);if(!n)return A(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),oe;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let o=new Map;for(let n of t){let s=oo(n.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(o.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);o.set(i,n)}}return new Jf({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...ce(r)})}}function Hf(e,t){let r=ro(e),o=ro(t);if(e===t)return{valid:!0,data:e};else if(r===L.object&&o===L.object){let n=ge.objectKeys(t),s=ge.objectKeys(e).filter((a)=>n.indexOf(a)!==-1),i={...e,...t};for(let a of s){let c=Hf(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===L.array&&o===L.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=Hf(i,a);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else if(r===L.date&&o===L.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class eu extends de{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=(n,s)=>{if(Ff(n)||Ff(s))return oe;let i=Hf(n.value,s.value);if(!i.valid)return A(r,{code:w.invalid_intersection_types}),oe;if(Vf(n)||Vf(s))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,s])=>o(n,s));else return o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}eu.create=(e,t,r)=>new eu({left:e,right:t,typeName:ne.ZodIntersection,...ce(r)});class io extends de{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.array)return A(r,{code:w.invalid_type,expected:L.array,received:r.parsedType}),oe;if(r.data.length<this._def.items.length)return A(r,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;if(!this._def.rest&&r.data.length>this._def.items.length)A(r,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((s,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new cr(r,s,r.path,i))}).filter((s)=>!!s);if(r.common.async)return Promise.all(n).then((s)=>dt.mergeArray(t,s));else return dt.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new io({...this._def,rest:e})}}io.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new io({items:e,typeName:ne.ZodTuple,rest:null,...ce(t)})};class Kp extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.object)return A(r,{code:w.invalid_type,expected:L.object,received:r.parsedType}),oe;let o=[],n=this._def.keyType,s=this._def.valueType;for(let i in r.data)o.push({key:n._parse(new cr(r,i,r.path,i)),value:s._parse(new cr(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return dt.mergeObjectAsync(t,o);else return dt.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof de)return new Kp({keyType:e,valueType:t,typeName:ne.ZodRecord,...ce(r)});return new Kp({keyType:no.create(),valueType:e,typeName:ne.ZodRecord,...ce(t)})}}class Wp extends de{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.map)return A(r,{code:w.invalid_type,expected:L.map,received:r.parsedType}),oe;let o=this._def.keyType,n=this._def.valueType,s=[...r.data.entries()].map(([i,a],c)=>({key:o._parse(new cr(r,i,r.path,[c,"key"])),value:n._parse(new cr(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of s){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of s){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return oe;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}}Wp.create=(e,t,r)=>new Wp({valueType:t,keyType:e,typeName:ne.ZodMap,...ce(r)});class Es extends de{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.set)return A(r,{code:w.invalid_type,expected:L.set,received:r.parsedType}),oe;let o=this._def;if(o.minSize!==null){if(r.data.size<o.minSize.value)A(r,{code:w.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()}if(o.maxSize!==null){if(r.data.size>o.maxSize.value)A(r,{code:w.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty()}let n=this._def.valueType;function s(a){let c=new Set;for(let u of a){if(u.status==="aborted")return oe;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>n._parse(new cr(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>s(a));else return s(i)}min(e,t){return new Es({...this._def,minSize:{value:e,message:K.toString(t)}})}max(e,t){return new Es({...this._def,maxSize:{value:e,message:K.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Es.create=(e,t)=>new Es({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...ce(t)});class Wc extends de{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.function)return A(t,{code:w.invalid_type,expected:L.function,received:t.parsedType}),oe;function r(i,a){return Fp({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jc(),Co].filter((c)=>!!c),issueData:{code:w.invalid_arguments,argumentsError:a}})}function o(i,a){return Fp({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jc(),Co].filter((c)=>!!c),issueData:{code:w.invalid_return_type,returnTypeError:a}})}let n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Is){let i=this;return bt(async function(...a){let c=new Ft([]),u=await i._def.args.parseAsync(a,n).catch((d)=>{throw c.addIssue(r(a,d)),c}),l=await Reflect.apply(s,this,u);return await i._def.returns._def.type.parseAsync(l,n).catch((d)=>{throw c.addIssue(o(l,d)),c})})}else{let i=this;return bt(function(...a){let c=i._def.args.safeParse(a,n);if(!c.success)throw new Ft([r(a,c.error)]);let u=Reflect.apply(s,this,c.data),l=i._def.returns.safeParse(u,n);if(!l.success)throw new Ft([o(u,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Wc({...this._def,args:io.create(e).rest(yn.create())})}returns(e){return new Wc({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Wc({args:e?e:io.create([]).rest(yn.create()),returns:t||yn.create(),typeName:ne.ZodFunction,...ce(r)})}}class tu extends de{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})}}tu.create=(e,t)=>new tu({getter:e,typeName:ne.ZodLazy,...ce(t)});class ru extends de{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return A(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}}ru.create=(e,t)=>new ru({value:e,typeName:ne.ZodLiteral,...ce(t)});function rT(e,t){return new vn({values:e,typeName:ne.ZodEnum,...ce(t)})}class vn extends de{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{expected:ge.joinValues(r),received:t.parsedType,code:w.invalid_type}),oe}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return A(t,{received:t.data,code:w.invalid_enum_value,options:r}),oe}return bt(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 vn.create(e,{...this._def,...t})}exclude(e,t=this._def){return vn.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}vn.create=rT;class ou extends de{_parse(e){let t=ge.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==L.string&&r.parsedType!==L.number){let o=ge.objectValues(t);return A(r,{expected:ge.joinValues(o),received:r.parsedType,code:w.invalid_type}),oe}if(!this._cache)this._cache=new Set(ge.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let o=ge.objectValues(t);return A(r,{received:r.data,code:w.invalid_enum_value,options:o}),oe}return bt(e.data)}get enum(){return this._def.values}}ou.create=(e,t)=>new ou({values:e,typeName:ne.ZodNativeEnum,...ce(t)});class Is extends de{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.promise&&t.common.async===!1)return A(t,{code:w.invalid_type,expected:L.promise,received:t.parsedType}),oe;let r=t.parsedType===L.promise?t.data:Promise.resolve(t.data);return bt(r.then((o)=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Is.create=(e,t)=>new Is({type:e,typeName:ne.ZodPromise,...ce(t)});class Zr extends de{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:(s)=>{if(A(r,s),s.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){let s=o.transform(r.data,n);if(r.common.async)return Promise.resolve(s).then(async(i)=>{if(t.value==="aborted")return oe;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return oe;if(a.status==="dirty")return ks(a.value);if(t.value==="dirty")return ks(a.value);return a});else{if(t.value==="aborted")return oe;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});if(i.status==="aborted")return oe;if(i.status==="dirty")return ks(i.value);if(t.value==="dirty")return ks(i.value);return i}}if(o.type==="refinement"){let s=(i)=>{let a=o.refinement(i,n);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return oe;if(i.status==="dirty")t.dirty();return s(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return oe;if(i.status==="dirty")t.dirty();return s(i.value).then(()=>({status:t.value,value:i.value}))})}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!_n(s))return oe;let i=o.transform(s.value,n);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((s)=>{if(!_n(s))return oe;return Promise.resolve(o.transform(s.value,n)).then((i)=>({status:t.value,value:i}))});ge.assertNever(o)}}Zr.create=(e,t,r)=>new Zr({schema:e,typeName:ne.ZodEffects,effect:t,...ce(r)});Zr.createWithPreprocess=(e,t,r)=>new Zr({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...ce(r)});class Nr extends de{_parse(e){if(this._getType(e)===L.undefined)return bt(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Nr.create=(e,t)=>new Nr({innerType:e,typeName:ne.ZodOptional,...ce(t)});class Oo extends de{_parse(e){if(this._getType(e)===L.null)return bt(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oo.create=(e,t)=>new Oo({innerType:e,typeName:ne.ZodNullable,...ce(t)});class nu extends de{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===L.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}nu.create=(e,t)=>new nu({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...ce(t)});class su extends de{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(Kc(o))return o.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ft(r.common.issues)},input:r.data})}));else return{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ft(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}su.create=(e,t)=>new su({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...ce(t)});class Gp extends de{_parse(e){if(this._getType(e)!==L.nan){let r=this._getOrReturnCtx(e);return A(r,{code:w.invalid_type,expected:L.nan,received:r.parsedType}),oe}return{status:"valid",value:e.data}}}Gp.create=(e)=>new Gp({typeName:ne.ZodNaN,...ce(e)});var h6=Symbol("zod_brand");class Kf extends de{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Yp extends de{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return oe;if(n.status==="dirty")return t.dirty(),ks(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return oe;if(o.status==="dirty")return t.dirty(),{status:"dirty",value:o.value};else return this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,t){return new Yp({in:e,out:t,typeName:ne.ZodPipeline})}}class iu extends de{_parse(e){let t=this._def.innerType._parse(e),r=(o)=>{if(_n(o))o.value=Object.freeze(o.value);return o};return Kc(t)?t.then((o)=>r(o)):r(t)}unwrap(){return this._def.innerType}}iu.create=(e,t)=>new iu({innerType:e,typeName:ne.ZodReadonly,...ce(t)});var f6={object:Ke.lazycreate},ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ne||(ne={}));var g6=no.create,_6=Ps.create,y6=Gp.create,v6=Ts.create,xj=Vp.create,S6=Gc.create,b6=Bp.create,z6=Yc.create,x6=Xc.create,w6=Hp.create,$6=yn.create,k6=so.create,R6=Jp.create,P6=Ar.create,{create:wj,strictCreate:T6}=Ke,E6=Qc.create,I6=Jf.create,C6=eu.create,O6=io.create,A6=Kp.create,N6=Wp.create,Z6=Es.create,M6=Wc.create,j6=tu.create,L6=ru.create,q6=vn.create,D6=ou.create,U6=Is.create,F6=Zr.create,V6=Nr.create,B6=Oo.create,H6=Zr.createWithPreprocess,J6=Yp.create;var oT="0.5.1";var Qp="__default__",Rj=wj({isError:xj().optional()}).passthrough(),sT={map:[{label:"Explain architecture",prompt:"Explain the architecture and responsibilities of these domains."},{label:"Audit domain coupling",prompt:"Audit cross-domain dependencies and highlight tight coupling or risky edges."}],slice:[{label:"Trace execution flow",prompt:"Trace and explain the step-by-step execution flow of this slice."},{label:"Check bugs / validation",prompt:"Inspect this execution chain for potential bugs, missing validation, or boundary issues."}],boundary:[{label:"Fix violations",prompt:"Propose and apply clean fixes for these boundary violations without breaking domain rules."},{label:"Explain forbidden rules",prompt:"Explain why these imports violate domain policies and what the intended alternative is."}]},Pj={map:"Analyze this Septum architecture context:",slice:"Analyze this Septum execution slice:",boundary:"Analyze this Septum boundary audit and suggest remediations:"},ht=new Up({name:"Septum Architecture",version:oT}),we="map",Le,Gf,au=[],cu=new Map,uu="",ao=null,iT="",Os=!1;function U(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Tj(e){return e?.trim()||Qp}function Ej(){return{map:null,domainDetail:null,slice:null,boundary:null,selectedDomains:new Set,selectedSliceNodes:new Set,selectedViolations:new Set}}function Cs(e){let t=Tj(e),r=cu.get(t);if(!r)r=Ej(),cu.set(t,r);return r}function Ij(e){let t=e?.trim();if(!t)return;if(!au.includes(t))au.push(t);if(au.length===1&&cu.has(Qp)){let r=cu.get(Qp),o=Cs(t);o.map??=r.map,o.domainDetail??=r.domainDetail,o.slice??=r.slice,o.boundary??=r.boundary,cu.delete(Qp)}Le=t}function nT(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]??e}function aT(e){if(!e)return;if(e.theme)G0(e.theme);if(e.styles?.variables)Y0(e.styles.variables)}function Mr(e){iT=e;let t=document.getElementById("status-bar");if(t)t.textContent=Os?"Loading...":e}function Cj(e){if(!e||typeof e!=="object")return null;if(e.schema==="navigation/v1"||Array.isArray(e.domains)||Array.isArray(e.files))return"map";if("entrypoint"in e||Array.isArray(e.chain))return"slice";if("scope"in e&&(("total_violations"in e)||("violations"in e)||("status"in e)))return"boundary";return null}function ed(e,t){ao=null;let r=e?.structuredContent??null;if(!r&&Array.isArray(e?.content)){let i=e.content.find((a)=>a?.type==="text"&&typeof a.text==="string");if(i)try{r=JSON.parse(i.text)}catch{}}if(!r){if(e?.isError){let i=e?.content?.[0]?.text??"Tool execution failed.";ao=String(i)}Mr(""),mt();return}let o=typeof r.workspace_root==="string"&&r.workspace_root.trim()?r.workspace_root.trim():t??Gf??Le;if(o)Ij(o);Gf=void 0;let n=Cj(r),s=Cs(o??Le);if(n==="map"){if(Array.isArray(r.files)&&r.files.length>0&&!Array.isArray(r.domains))s.domainDetail=r;else s.map=r,s.domainDetail=null,s.selectedDomains.clear();we="map"}else if(n==="slice")s.slice=r,s.selectedSliceNodes.clear(),we="slice";else if(n==="boundary")s.boundary=r,s.selectedViolations.clear(),we="boundary";Mr(""),mt()}function Oj(e){let t=e.replace(/\\/g,"/");return t.startsWith("/")?`file://${encodeURI(t)}`:`file:///${encodeURI(t)}`}async function Aj(e){if(!e)return;let t=e.startsWith("/")||!Le?e:`${Le.replace(/\/+$/,"")}/${e.replace(/^\/+/,"")}`;try{if((await ht.request({method:"com.google.antigravity/toggle-aux-pane",params:{tabType:"fileView",uri:Oj(t)}},Rj))?.isError)Mr(`Cannot open side pane for ${e} on this surface.`)}catch(r){let o=r instanceof Error?r.message:String(r);if(o.includes("-32601"))Mr(`Side pane navigation is unavailable in this host (${e}).`);else Mr(`Open file failed: ${o}`)}}function cT(e,t){return`${t}:${e.symbol??""}:${e.file??""}:${e.line??""}`}function uT(e,t){return`${t}:${e.rule??""}:${e.file??""}:${e.line??""}`}function lT(e,t){if(e==="map")return t.selectedDomains.size;if(e==="slice")return t.selectedSliceNodes.size;return t.selectedViolations.size}function Nj(e,t){if(e==="map")t.selectedDomains.clear();else if(e==="slice")t.selectedSliceNodes.clear();else t.selectedViolations.clear()}function Zj(e,t){let r=[];if(Le)r.push(`Workspace: ${Le}`);if(e==="map"&&t.map){let o=t.map,n=o.domains??[],s=t.selectedDomains,i=s.size>0?n.filter((l)=>s.has(String(l.name))):n,a=o.health??{};if(r.push(`# Septum Architecture (index=${a.index??o.status??"unknown"}, coverage=${a.coverage??"unknown"}, unresolved=${a.unresolved_imports??0})`),t.domainDetail){let p=t.domainDetail.files??[];r.push(`
315
+ ## Focused Domain Files (${p.length})`);for(let d of p.slice(0,30))r.push(`- ${d.path}${d.archetype?` [${d.archetype}]`:""}`);if(p.length>30)r.push(`- ... +${p.length-30} more files`)}if(i.length>0){r.push(`
316
+ ## Domains (${s.size>0?`${i.length} selected`:i.length})`);for(let l of i){let p=l.allowed_dependencies?.length?` allow=[${l.allowed_dependencies.join(",")}]`:"",d=l.forbidden_dependencies?.length?` forbid=[${l.forbidden_dependencies.join(",")}]`:"";r.push(`- ${l.name} (${l.root}, ${l.file_count??0} files)${p}${d}`)}}let c=(o.dependencies??[]).filter((l)=>s.size===0||s.has(String(l.from))||s.has(String(l.to)));if(c.length>0){r.push(`
317
+ ## Dependencies (${c.length})`);for(let l of c.slice(0,20))r.push(`- ${l.from} -> ${l.to} (x${l.count??1})`)}let u=o.entrypoints??[];if(u.length>0&&s.size===0){r.push(`
318
+ ## Entrypoints (${u.length})`);for(let l of u.slice(0,15))r.push(`- [${l.method}] ${l.target} (${l.file})`)}return r.join(`
319
+ `)}if(e==="slice"&&t.slice){let o=t.slice,n=o.entrypoint,s=o.chain??[];if(r.push(`# Septum Slice: ${o.query??"entrypoint"} [status=${o.status??"unknown"}, confidence=${o.confidence??"-"}, style=${o.architecture_style??"-"}]`),n)r.push(`Entrypoint: [${n.method}] ${n.uri} -> ${n.controller}::${n.action} (${n.file}:${n.line})`);let i=t.selectedSliceNodes,a=i.size>0?s.filter((c,u)=>i.has(cT(c,u))):s;if(a.length>0){r.push(`
320
+ ## Execution Chain (${i.size>0?`${a.length} selected`:a.length})`);for(let c of a.slice(0,20))r.push(`- [${c.stage}] ${c.symbol}${c.file?` @ ${c.file}:${c.line??""}`:""}${c.description?` — ${c.description}`:""}`)}else if(o.message)r.push(o.message);return r.join(`
321
+ `)}if(e==="boundary"&&t.boundary){let o=t.boundary,n=o.violations??[],s=t.selectedViolations,i=s.size>0?n.filter((a,c)=>s.has(uT(a,c))):n;if(r.push(`# Septum Boundary Audit [verdict=${o.status}, scope=${o.scope??"-"}, violations=${o.total_violations??n.length}, cycles=${o.circular_dependencies_count??0}]`),i.length>0){r.push(`
322
+ ## Violations (${s.size>0?`${i.length} selected`:i.length})`);for(let a of i.slice(0,20))r.push(`- [${a.rule??"violation"}] ${a.source_domain} -> ${a.target_domain} @ ${a.file??"?"}:${a.line??"?"} (${a.message??a.target??""})`)}else if(o.message)r.push(o.message);return r.join(`
323
+ `)}return null}async function Xp(e,t){let r=Cs(Le),o=Zj(we,r);if(!o)return;let n=ht.getHostCapabilities();try{if(e==="context"){if(!n?.updateModelContext)return;await ht.updateModelContext({content:[{type:"text",text:o}]});let a=lT(we,r);Mr(a>0?`Attached ${a} selected item(s) to chat context.`:`Attached ${we} context to chat.`);return}let i=`${(t??uu).trim()||Pj[we]}
324
+
325
+ ${o}`;if(n?.message){if(await ht.sendMessage({role:"user",content:[{type:"text",text:i}]}),!t&&uu.trim()){uu="";let a=document.getElementById("ai-prompt-input");if(a)a.value=""}Mr("Sent instruction + Septum context to conversation.")}else if(n?.updateModelContext)await ht.updateModelContext({content:[{type:"text",text:i}]}),Mr("Host does not support direct messages; attached to model context instead.")}catch(s){Mr(s instanceof Error?s.message:String(s))}}async function Mj(e){if(!ht.getHostCapabilities()?.serverTools||!e)return;Os=!0,ao=null,mt();try{let r=await ht.callServerTool({name:"septum_map",arguments:{action:"catalog",domain:e,detail_level:"compact",format:"json",...Le?{workspace_path:Le}:{}}});ed(r,Le)}catch(r){ao=r instanceof Error?r.message:String(r)}finally{Os=!1,mt()}}async function Wf(e=Le){if(!ht.getHostCapabilities()?.serverTools)return;if(we==="slice"){mt();return}Os=!0,ao=null,mt();try{if(we==="map"){let r=await ht.callServerTool({name:"septum_map",arguments:{action:"catalog",format:"json",...e?{workspace_path:e}:{}}});ed(r,e)}else if(we==="boundary"){let r=await ht.callServerTool({name:"septum_boundary",arguments:{scope:"all",format:"json",...e?{workspace_path:e}:{}}});ed(r,e)}}catch(r){ao=r instanceof Error?r.message:String(r)}finally{Os=!1,mt()}}function jj(e){if(e.status==="NOT_INDEXED")return`
326
+ <div class="warn-box">
327
+ <div><strong>Workspace Not Initialized</strong> — ${U(e.message??"Septum has not indexed this workspace yet.")}</div>
328
+ <ul>
329
+ <li>Run <code>septum init</code> in the workspace terminal, or</li>
330
+ <li>Register a domain via <code>septum_map({ action: "register", name: "core", root: "src", ingest_now: true })</code>.</li>
331
+ </ul>
332
+ <div><button type="button" class="mini-btn" id="btn-fix-coverage">Ask AI to Initialize</button></div>
333
+ </div>
334
+ `;let t=e.health??{},r=Array.isArray(t.reasons)?t.reasons:[],o=Number(t.unsupported_files??0),n=Number(t.skipped_files??0),s=Number(t.unresolved_imports??0),i=Boolean(t.sync_needed);if(!(t.coverage==="partial"||t.index&&t.index!=="complete"||i||o>0||n>0||s>0))return"";let c=[];if(i||t.index&&t.index!=="complete")c.push("Run <code>septum sync</code> to refresh stale or incomplete index state.");if(n>0)c.push(`${n} file(s) skipped — register missing directories with <code>septum_map(action="register")</code> or review <code>ignore_patterns</code>.`);if(o>0)c.push(`${o} file(s) use unsupported extensions/languages and are excluded from AST slicing.`);if(s>0)c.push(`${s} unresolved import(s) — verify path aliases / <code>tsconfig.json</code> or missing packages.`);if(c.length===0)c.push("Check <code>septum://apps</code> or run <code>septum sync</code> to inspect coverage details.");return`
335
+ <div class="warn-box">
336
+ <div><strong>Partial Index Coverage</strong>${r.length?` <span class="badge">${U(r.join(", "))}</span>`:""}</div>
337
+ <ul>${c.map((u)=>`<li>${u}</li>`).join("")}</ul>
338
+ <div><button type="button" class="mini-btn" id="btn-fix-coverage">Ask AI to Resolve Gaps</button></div>
339
+ </div>
340
+ `}function Lj(e,t){let r=e.map;if(!r)return'<div class="empty">Run <code>septum_map</code> or click Refresh to load the workspace architecture.</div>';let o=r.health??{},n=r.domains??[],s=r.dependencies??[],i=r.entrypoints??[],a=e.domainDetail,c=a?.files??[];return`
341
+ <div class="stats">
342
+ <div class="stat"><span class="label">Index</span><span class="val">${U(o.index??r.status??"unknown")}</span></div>
343
+ <div class="stat"><span class="label">Coverage</span><span class="val">${U(o.coverage??"unknown")}</span></div>
344
+ <div class="stat"><span class="label">Domains</span><span class="val">${n.length}</span></div>
345
+ <div class="stat"><span class="label">Unresolved</span><span class="val">${U(o.unresolved_imports??0)}</span></div>
346
+ </div>
347
+ ${jj(r)}
348
+ ${a?`<div class="bar">
349
+ <h3>Domain Files (${c.length})</h3>
350
+ <button class="mini-btn" id="btn-close-domain">Back to Domains</button>
351
+ </div>
352
+ <div class="list">
353
+ ${c.slice(0,40).map((u)=>`
354
+ <div class="row clickable" data-file="${U(u.path)}">
355
+ <code>${U(u.path)}</code>
356
+ <span class="badge">${U(u.archetype??"file")}</span>
357
+ </div>`).join("")}
358
+ </div>`:""}
359
+ ${n.length?`<h3>Domains</h3>
360
+ <div class="grid">
361
+ ${n.map((u)=>{let l=String(u.name??""),p=e.selectedDomains.has(l);return`
362
+ <div class="card ${p?"selected":""}">
363
+ <div class="card-title" style="justify-content:space-between">
364
+ <label class="chk-wrap">
365
+ <input type="checkbox" class="chk sel-domain" value="${U(l)}" ${p?"checked":""} />
366
+ <span>${U(l)}</span>
367
+ <span class="badge">${U(u.file_count??0)} files</span>
368
+ </label>
369
+ ${t?`<button class="mini-btn" data-inspect-domain="${U(l)}">Files</button>`:""}
370
+ </div>
371
+ <div class="muted">${U(u.root)}</div>
372
+ ${u.allowed_dependencies?.length?`<div class="meta">Allow: ${U(u.allowed_dependencies.join(", "))}</div>`:""}
373
+ ${u.forbidden_dependencies?.length?`<div class="meta danger">Forbid: ${U(u.forbidden_dependencies.join(", "))}</div>`:""}
374
+ </div>`}).join("")}
375
+ </div>`:""}
376
+ ${s.length?`<h3>Dependencies (${s.length})</h3>
377
+ <div class="list">
378
+ ${s.slice(0,25).map((u)=>`
379
+ <div class="row">
380
+ <span><code>${U(u.from)}</code> &rarr; <code>${U(u.to)}</code></span>
381
+ <span class="badge">${U(u.count??1)}</span>
382
+ </div>`).join("")}
383
+ </div>`:""}
384
+ ${i.length?`<h3>Entrypoints (${i.length})</h3>
385
+ <div class="list">
386
+ ${i.slice(0,20).map((u)=>`
387
+ <div class="row clickable" data-file="${U(u.file)}">
388
+ <span><span class="badge">${U(u.method)}</span> <code>${U(u.target)}</code></span>
389
+ <span class="muted">${U(u.file)}</span>
390
+ </div>`).join("")}
391
+ </div>`:""}
392
+ `}function qj(e){let t=e.slice;if(!t)return'<div class="empty">Run <code>septum_slice</code> to inspect an HTTP, GraphQL, or CLI execution chain.</div>';let r=t.entrypoint,o=t.chain??[];return`
393
+ <div class="stats">
394
+ <div class="stat"><span class="label">Status</span><span class="val">${U(t.status??(t.found?"success":"not_found"))}</span></div>
395
+ <div class="stat"><span class="label">Confidence</span><span class="val">${U(t.confidence??"-")}</span></div>
396
+ <div class="stat"><span class="label">Style</span><span class="val">${U(t.architecture_style??"-")}</span></div>
397
+ </div>
398
+ ${r?`<div class="card clickable" data-file="${U(r.file)}">
399
+ <div class="card-title"><span class="badge">${U(r.method)}</span> ${U(r.uri)}</div>
400
+ <div class="muted">${U(r.controller)}::${U(r.action)} (${U(r.file)}:${U(r.line)})</div>
401
+ </div>`:`<div class="empty">${U(t.message??"No matching slice found.")}</div>`}
402
+ ${o.length?`<h3>Execution Chain (${o.length})</h3>
403
+ <div class="list">
404
+ ${o.map((n,s)=>{let i=cT(n,s),a=e.selectedSliceNodes.has(i);return`
405
+ <div class="row ${a?"selected":""}">
406
+ <div class="chk-wrap">
407
+ <input type="checkbox" class="chk sel-slice" value="${U(i)}" ${a?"checked":""} />
408
+ <div class="${n.file?"clickable":""}" data-file="${U(n.file??"")}">
409
+ <span class="badge">${U(n.stage)}</span>
410
+ <strong>${U(n.symbol)}</strong>
411
+ <div class="muted">${U(n.description??"")}</div>
412
+ </div>
413
+ </div>
414
+ <span class="muted ${n.file?"clickable":""}" data-file="${U(n.file??"")}">${n.file?`${U(n.file)}:${U(n.line??"")}`:U(n.relationship?.derivation??"")}</span>
415
+ </div>`}).join("")}
416
+ </div>`:""}
417
+ `}function Dj(e){let t=e.boundary;if(!t)return'<div class="empty">Run <code>septum_boundary</code> or click Refresh to audit domain boundaries.</div>';let r=t.violations??[];return`
418
+ <div class="stats">
419
+ <div class="stat"><span class="label">Verdict</span><span class="val ${t.status==="approved"?"ok":t.status==="rejected"?"danger":"warn"}">${U(t.status)}</span></div>
420
+ <div class="stat"><span class="label">Scope</span><span class="val">${U(t.scope??"-")}</span></div>
421
+ <div class="stat"><span class="label">Violations</span><span class="val">${U(t.total_violations??r.length)}</span></div>
422
+ <div class="stat"><span class="label">Cycles</span><span class="val">${U(t.circular_dependencies_count??0)}</span></div>
423
+ </div>
424
+ <p class="muted">${U(t.message??"")}</p>
425
+ ${r.length?`<h3>Violations (${r.length})</h3>
426
+ <div class="list">
427
+ ${r.slice(0,25).map((n,s)=>{let i=uT(n,s),a=e.selectedViolations.has(i);return`
428
+ <div class="row ${a?"selected":""}">
429
+ <div class="chk-wrap">
430
+ <input type="checkbox" class="chk sel-violation" value="${U(i)}" ${a?"checked":""} />
431
+ <div class="${n.file?"clickable":""}" data-file="${U(n.file??"")}">
432
+ <span class="badge danger">${U(n.rule??"violation")}</span>
433
+ <code>${U(n.source_domain)}</code> &rarr; <code>${U(n.target_domain)}</code>
434
+ <div class="muted">${U(n.message??n.target??"")}</div>
435
+ </div>
436
+ </div>
437
+ <span class="muted ${n.file?"clickable":""}" data-file="${U(n.file??"")}">${U(n.file??"")}:${U(n.line??"")}</span>
438
+ </div>`}).join("")}
439
+ </div>`:""}
440
+ `}function Uj(){if(au.length>1)return`<select id="workspace-select" class="scope-select" title="${U(Le??"")}">
441
+ ${au.map((e)=>`<option value="${U(e)}" ${e===Le?"selected":""}>${U(nT(e))}</option>`).join("")}
442
+ </select>`;if(Le)return`<span class="scope-pill" title="${U(Le)}">${U(nT(Le))}</span>`;return""}function Fj(e,t,r){if(!t&&!r)return"";let o=lT(we,e),n=sT[we];return`
443
+ <section class="ai-bar">
444
+ <div class="preset-row">
445
+ <span class="muted">${o>0?`${o} selected`:`All ${we}`}</span>
446
+ ${o>0?'<button type="button" class="mini-btn" id="btn-clear-sel">Clear</button>':""}
447
+ ${n.map((s,i)=>`<button type="button" class="chip" data-preset="${i}">${U(s.label)}</button>`).join("")}
448
+ </div>
449
+ <form id="ai-prompt-form" class="prompt-form">
450
+ <input id="ai-prompt-input" class="prompt-input" type="text" placeholder="Instruct AI about ${U(o>0?`${o} selected item(s)`:`this ${we}`)}..." value="${U(uu)}" />
451
+ ${r?'<button type="button" class="btn" id="btn-attach">Attach Context</button>':""}
452
+ ${t?'<button type="submit" class="btn primary-btn" id="btn-ask-ai">Ask AI</button>':""}
453
+ </form>
454
+ </section>
455
+ `}function mt(){let e=document.getElementById("root");if(!e)return;let t=ht.getHostCapabilities(),r=Boolean(t?.serverTools),o=Boolean(t?.updateModelContext),n=Boolean(t?.message),s=Cs(Le),i=Boolean(s[we]),a=we==="map"?Lj(s,r):we==="slice"?qj(s):Dj(s);e.innerHTML=`
456
+ <div class="shell">
457
+ <header class="bar">
458
+ <div class="brand">
459
+ <div class="tabs">
460
+ <button class="tab ${we==="map"?"active":""}" data-tab="map">Architecture</button>
461
+ <button class="tab ${we==="slice"?"active":""}" data-tab="slice">Slice</button>
462
+ <button class="tab ${we==="boundary"?"active":""}" data-tab="boundary">Boundary</button>
463
+ </div>
464
+ ${Uj()}
465
+ </div>
466
+ <div class="actions">
467
+ ${r&&we!=="slice"?'<button class="btn" id="btn-refresh">Refresh</button>':""}
468
+ </div>
469
+ </header>
470
+ ${i?Fj(s,n,o):""}
471
+ <div id="status-bar" class="status-bar">${Os?"Loading...":U(iT)}</div>
472
+ ${ao?`<div class="alert">${U(ao)}</div>`:""}
473
+ <main>${a}</main>
474
+ </div>
475
+ `,e.querySelectorAll("[data-tab]").forEach((l)=>{l.onclick=()=>{let p=l.dataset.tab;we=p;let d=Cs(Le);if((p==="boundary"||p==="map")&&!d[p]&&r)Wf(Le);else mt()}});let c=document.getElementById("workspace-select");if(c)c.onchange=()=>{Le=c.value;let l=Cs(Le);if((we==="map"||we==="boundary")&&!l[we]&&r)Wf(Le);else mt()};e.querySelectorAll(".sel-domain").forEach((l)=>{l.onchange=()=>{if(l.checked)s.selectedDomains.add(l.value);else s.selectedDomains.delete(l.value);mt()}}),e.querySelectorAll(".sel-slice").forEach((l)=>{l.onchange=()=>{if(l.checked)s.selectedSliceNodes.add(l.value);else s.selectedSliceNodes.delete(l.value);mt()}}),e.querySelectorAll(".sel-violation").forEach((l)=>{l.onchange=()=>{if(l.checked)s.selectedViolations.add(l.value);else s.selectedViolations.delete(l.value);mt()}}),e.querySelectorAll("[data-inspect-domain]").forEach((l)=>{l.onclick=()=>{let p=l.dataset.inspectDomain;if(p)Mj(p)}}),document.getElementById("btn-close-domain")?.addEventListener("click",()=>{s.domainDetail=null,mt()}),e.querySelectorAll(".clickable[data-file]").forEach((l)=>{l.onclick=()=>{let p=l.dataset.file;if(p)Aj(p)}});let u=document.getElementById("ai-prompt-input");if(u)u.oninput=()=>{uu=u.value};document.getElementById("ai-prompt-form")?.addEventListener("submit",(l)=>{l.preventDefault(),Xp("message")}),e.querySelectorAll("[data-preset]").forEach((l)=>{l.onclick=()=>{let p=Number(l.dataset.preset),d=sT[we][p];if(d)Xp("message",d.prompt)}}),document.getElementById("btn-clear-sel")?.addEventListener("click",()=>{Nj(we,s),mt()}),document.getElementById("btn-refresh")?.addEventListener("click",()=>void Wf(Le)),document.getElementById("btn-attach")?.addEventListener("click",()=>void Xp("context")),document.getElementById("btn-fix-coverage")?.addEventListener("click",()=>{let l=s.map?.status==="NOT_INDEXED"?"Initialize or register Septum domains for this workspace so architecture coverage becomes complete.":"Inspect the partial index coverage diagnostics (skipped/unsupported files, unresolved imports, or dirty state) and guide or apply the appropriate fix.";Xp("message",l)})}ht.ontoolinput=({arguments:e})=>{if(e&&typeof e.workspace_path==="string"&&e.workspace_path.trim())Gf=e.workspace_path.trim();Mr("Running Septum analysis...")};ht.ontoolresult=(e)=>{ed(e)};ht.onhostcontextchanged=(e)=>{aT(e)};async function Vj(){mt();try{await ht.connect(),aT(ht.getHostContext())}catch(e){ao=e instanceof Error?e.message:String(e),mt()}}Vj();
476
+ </script>
477
+ </body>
478
+ </html>