@cpenned/mcp 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -6
- package/dist/apps.js +109 -0
- package/dist/apps.js.map +1 -0
- package/dist/open.js +94 -0
- package/dist/open.js.map +1 -0
- package/dist/server.js +21 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/index.js +0 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/ui.js +4 -37
- package/dist/tools/ui.js.map +1 -1
- package/dist-ui/activity.html +768 -0
- package/dist-ui/agenda.html +773 -0
- package/dist-ui/board.html +778 -0
- package/dist-ui/book.html +770 -0
- package/dist-ui/calendar.html +768 -0
- package/dist-ui/habits.html +773 -0
- package/dist-ui/person.html +769 -0
- package/dist-ui/reading.html +768 -0
- package/dist-ui/receipt.html +772 -0
- package/dist-ui/reviews.html +771 -0
- package/dist-ui/task.html +776 -0
- package/dist-ui/triage.html +774 -0
- package/package.json +6 -4
- package/skills/open-brain-mcp/SKILL.md +14 -4
|
@@ -0,0 +1,768 @@
|
|
|
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" />
|
|
6
|
+
<style>/* Studio Sheets palette (packages/web/src/styles.css), deferring to the host's
|
|
7
|
+
MCP Apps style variables when it sends them. */
|
|
8
|
+
:root {
|
|
9
|
+
color-scheme: light dark;
|
|
10
|
+
--ob-sheet: var(--color-background-primary, #ffffff);
|
|
11
|
+
--ob-panel: var(--color-background-secondary, #f4f4f6);
|
|
12
|
+
--ob-ink: var(--color-text-primary, #18181b);
|
|
13
|
+
--ob-muted: var(--color-text-secondary, #66666f);
|
|
14
|
+
--ob-line: var(--color-border-primary, #e4e4e8);
|
|
15
|
+
--ob-accent: #5151cc;
|
|
16
|
+
--ob-on-accent: #ffffff;
|
|
17
|
+
--ob-danger: #c13b2f;
|
|
18
|
+
--ob-sun: #c98a12;
|
|
19
|
+
--ob-radius: var(--border-radius-lg, 14px);
|
|
20
|
+
--ob-font: var(--font-sans, "Geist", ui-sans-serif, system-ui, sans-serif);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:root[data-theme="dark"] {
|
|
24
|
+
--ob-sheet: var(--color-background-primary, #121215);
|
|
25
|
+
--ob-panel: var(--color-background-secondary, #1b1b20);
|
|
26
|
+
--ob-ink: var(--color-text-primary, #ececf1);
|
|
27
|
+
--ob-muted: var(--color-text-secondary, #8f8f9b);
|
|
28
|
+
--ob-line: var(--color-border-primary, #2a2a31);
|
|
29
|
+
--ob-accent: #9090fa;
|
|
30
|
+
--ob-on-accent: #0c0c14;
|
|
31
|
+
--ob-danger: #f2705f;
|
|
32
|
+
--ob-sun: #e8b13a;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (prefers-color-scheme: dark) {
|
|
36
|
+
:root:not([data-theme]) {
|
|
37
|
+
--ob-sheet: var(--color-background-primary, #121215);
|
|
38
|
+
--ob-panel: var(--color-background-secondary, #1b1b20);
|
|
39
|
+
--ob-ink: var(--color-text-primary, #ececf1);
|
|
40
|
+
--ob-muted: var(--color-text-secondary, #8f8f9b);
|
|
41
|
+
--ob-line: var(--color-border-primary, #2a2a31);
|
|
42
|
+
--ob-accent: #9090fa;
|
|
43
|
+
--ob-on-accent: #0c0c14;
|
|
44
|
+
--ob-danger: #f2705f;
|
|
45
|
+
--ob-sun: #e8b13a;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
* {
|
|
50
|
+
box-sizing: border-box;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
html,
|
|
54
|
+
body {
|
|
55
|
+
margin: 0;
|
|
56
|
+
background: transparent;
|
|
57
|
+
color: var(--ob-ink);
|
|
58
|
+
font-family: var(--ob-font);
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
line-height: 1.45;
|
|
61
|
+
-webkit-font-smoothing: antialiased;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
main {
|
|
65
|
+
padding: 2px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.card {
|
|
69
|
+
margin: 0;
|
|
70
|
+
padding: 14px 16px;
|
|
71
|
+
background: var(--ob-sheet);
|
|
72
|
+
border: 1px solid var(--ob-line);
|
|
73
|
+
border-radius: var(--ob-radius);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.card.loading {
|
|
77
|
+
color: var(--ob-muted);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
h1 {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-size: 15px;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
letter-spacing: -0.01em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
button {
|
|
88
|
+
font: inherit;
|
|
89
|
+
font-size: 13px;
|
|
90
|
+
color: var(--ob-ink);
|
|
91
|
+
background: var(--ob-panel);
|
|
92
|
+
border: 1px solid var(--ob-line);
|
|
93
|
+
border-radius: 8px;
|
|
94
|
+
padding: 5px 11px;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
transition:
|
|
97
|
+
background-color 120ms ease,
|
|
98
|
+
transform 120ms ease;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
button:hover:not(:disabled) {
|
|
102
|
+
background: color-mix(in oklab, var(--ob-panel) 85%, var(--ob-ink));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
button:active:not(:disabled) {
|
|
106
|
+
transform: scale(0.97);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
button:disabled {
|
|
110
|
+
opacity: 0.55;
|
|
111
|
+
cursor: default;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
button:focus-visible {
|
|
115
|
+
outline: 2px solid var(--ob-accent);
|
|
116
|
+
outline-offset: 2px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
button.primary {
|
|
120
|
+
background: var(--ob-accent);
|
|
121
|
+
border-color: var(--ob-accent);
|
|
122
|
+
color: var(--ob-on-accent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
button.primary:hover:not(:disabled) {
|
|
126
|
+
background: color-mix(in oklab, var(--ob-accent) 88%, var(--ob-ink));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
button.link {
|
|
130
|
+
background: none;
|
|
131
|
+
border: none;
|
|
132
|
+
padding: 2px 4px;
|
|
133
|
+
color: var(--ob-accent);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.check {
|
|
137
|
+
flex: none;
|
|
138
|
+
width: 18px;
|
|
139
|
+
height: 18px;
|
|
140
|
+
padding: 0;
|
|
141
|
+
border-radius: 50%;
|
|
142
|
+
border: 1.5px solid var(--ob-muted);
|
|
143
|
+
background: transparent;
|
|
144
|
+
position: relative;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.check[aria-pressed="true"] {
|
|
148
|
+
background: var(--ob-accent);
|
|
149
|
+
border-color: var(--ob-accent);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.check[aria-pressed="true"]::after {
|
|
153
|
+
content: "";
|
|
154
|
+
position: absolute;
|
|
155
|
+
left: 5px;
|
|
156
|
+
top: 2px;
|
|
157
|
+
width: 4px;
|
|
158
|
+
height: 8px;
|
|
159
|
+
border: solid var(--ob-on-accent);
|
|
160
|
+
border-width: 0 2px 2px 0;
|
|
161
|
+
transform: rotate(45deg);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.chip {
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
gap: 4px;
|
|
168
|
+
font-size: 12px;
|
|
169
|
+
line-height: 1;
|
|
170
|
+
padding: 4px 7px;
|
|
171
|
+
border-radius: 999px;
|
|
172
|
+
background: var(--ob-panel);
|
|
173
|
+
color: var(--ob-muted);
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.chip.danger {
|
|
178
|
+
color: var(--ob-danger);
|
|
179
|
+
background: color-mix(in oklab, var(--ob-danger) 12%, var(--ob-sheet));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.chip.warn {
|
|
183
|
+
color: var(--ob-sun);
|
|
184
|
+
background: color-mix(in oklab, var(--ob-sun) 14%, var(--ob-sheet));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.chip.status.in_progress {
|
|
188
|
+
color: var(--ob-accent);
|
|
189
|
+
background: color-mix(in oklab, var(--ob-accent) 14%, var(--ob-sheet));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.pri {
|
|
193
|
+
flex: none;
|
|
194
|
+
font-size: 11px;
|
|
195
|
+
font-weight: 600;
|
|
196
|
+
text-transform: uppercase;
|
|
197
|
+
letter-spacing: 0.04em;
|
|
198
|
+
color: var(--ob-muted);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.pri-high {
|
|
202
|
+
color: var(--ob-danger);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.pri-medium {
|
|
206
|
+
color: var(--ob-sun);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Task card */
|
|
210
|
+
.task-head {
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: flex-start;
|
|
213
|
+
gap: 10px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.task-head .check {
|
|
217
|
+
margin-top: 1px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.task-head .title {
|
|
221
|
+
flex: 1;
|
|
222
|
+
min-width: 0;
|
|
223
|
+
overflow-wrap: anywhere;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.meta {
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-wrap: wrap;
|
|
229
|
+
gap: 6px;
|
|
230
|
+
margin: 10px 0 0 28px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.notes {
|
|
234
|
+
margin: 10px 0 0 28px;
|
|
235
|
+
color: var(--ob-muted);
|
|
236
|
+
font-size: 13px;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.refs {
|
|
240
|
+
display: flex;
|
|
241
|
+
flex-wrap: wrap;
|
|
242
|
+
gap: 6px;
|
|
243
|
+
margin: 10px 0 0 28px;
|
|
244
|
+
font-size: 12px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.tag {
|
|
248
|
+
--tag: var(--ob-muted);
|
|
249
|
+
color: var(--tag);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.tag::before {
|
|
253
|
+
content: "#";
|
|
254
|
+
opacity: 0.6;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.person {
|
|
258
|
+
color: var(--ob-muted);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.person::before {
|
|
262
|
+
content: "@";
|
|
263
|
+
opacity: 0.6;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.actions {
|
|
267
|
+
display: flex;
|
|
268
|
+
gap: 8px;
|
|
269
|
+
margin: 14px 0 0 28px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.error {
|
|
273
|
+
margin: 10px 0 0;
|
|
274
|
+
color: var(--ob-danger);
|
|
275
|
+
font-size: 13px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Agenda + receipt */
|
|
279
|
+
.agenda-head {
|
|
280
|
+
display: flex;
|
|
281
|
+
align-items: baseline;
|
|
282
|
+
gap: 8px;
|
|
283
|
+
margin-bottom: 6px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.agenda-head button:not(.open-link) {
|
|
287
|
+
margin-left: auto;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.count {
|
|
291
|
+
color: var(--ob-muted);
|
|
292
|
+
font-size: 12px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.count.danger {
|
|
296
|
+
color: var(--ob-danger);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.rows {
|
|
300
|
+
list-style: none;
|
|
301
|
+
margin: 0;
|
|
302
|
+
padding: 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.row {
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
gap: 10px;
|
|
309
|
+
padding: 8px 0;
|
|
310
|
+
border-top: 1px solid var(--ob-line);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.row:first-child {
|
|
314
|
+
border-top: none;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.row-title {
|
|
318
|
+
flex: 1;
|
|
319
|
+
min-width: 0;
|
|
320
|
+
overflow: hidden;
|
|
321
|
+
text-overflow: ellipsis;
|
|
322
|
+
white-space: nowrap;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.row-meta {
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 6px;
|
|
329
|
+
flex: none;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
[data-status="done"] .title,
|
|
333
|
+
[data-status="canceled"] .title,
|
|
334
|
+
.row[data-status="done"] .row-title,
|
|
335
|
+
.row.undone .row-title {
|
|
336
|
+
color: var(--ob-muted);
|
|
337
|
+
text-decoration: line-through;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.row.failed .row-title {
|
|
341
|
+
color: var(--ob-danger);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.empty,
|
|
345
|
+
.more {
|
|
346
|
+
margin: 8px 0 0;
|
|
347
|
+
color: var(--ob-muted);
|
|
348
|
+
font-size: 13px;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
@media (max-width: 420px) {
|
|
352
|
+
.row {
|
|
353
|
+
flex-wrap: wrap;
|
|
354
|
+
}
|
|
355
|
+
.row-meta {
|
|
356
|
+
width: 100%;
|
|
357
|
+
padding-left: 28px;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
@media (prefers-reduced-motion: reduce) {
|
|
362
|
+
button {
|
|
363
|
+
transition: none;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/* Titles that open the item in the app or web */
|
|
368
|
+
.open-link {
|
|
369
|
+
background: none;
|
|
370
|
+
border: none;
|
|
371
|
+
border-radius: 4px;
|
|
372
|
+
padding: 0;
|
|
373
|
+
font-size: inherit;
|
|
374
|
+
font-weight: inherit;
|
|
375
|
+
color: inherit;
|
|
376
|
+
text-align: left;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.open-link:hover:not(:disabled) {
|
|
380
|
+
background: none;
|
|
381
|
+
text-decoration: underline;
|
|
382
|
+
text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
|
|
383
|
+
text-underline-offset: 3px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.actions .push {
|
|
387
|
+
margin-left: auto;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
h2 {
|
|
391
|
+
margin: 14px 0 2px;
|
|
392
|
+
font-size: 11px;
|
|
393
|
+
font-weight: 600;
|
|
394
|
+
letter-spacing: 0.05em;
|
|
395
|
+
text-transform: uppercase;
|
|
396
|
+
color: var(--ob-muted);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.sub {
|
|
400
|
+
font-size: 12px;
|
|
401
|
+
color: var(--ob-muted);
|
|
402
|
+
white-space: nowrap;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.count.warn {
|
|
406
|
+
color: var(--ob-sun);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.chip.streak {
|
|
410
|
+
color: var(--ob-accent);
|
|
411
|
+
background: color-mix(in oklab, var(--ob-accent) 12%, var(--ob-sheet));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/* Triage */
|
|
415
|
+
.kind {
|
|
416
|
+
flex: none;
|
|
417
|
+
width: 58px;
|
|
418
|
+
font-size: 11px;
|
|
419
|
+
font-weight: 600;
|
|
420
|
+
letter-spacing: 0.04em;
|
|
421
|
+
text-transform: uppercase;
|
|
422
|
+
color: var(--ob-muted);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.questions {
|
|
426
|
+
list-style: none;
|
|
427
|
+
margin: 0;
|
|
428
|
+
padding: 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.question {
|
|
432
|
+
display: grid;
|
|
433
|
+
gap: 2px;
|
|
434
|
+
padding: 8px 10px;
|
|
435
|
+
margin-top: 6px;
|
|
436
|
+
border-radius: 10px;
|
|
437
|
+
background: color-mix(in oklab, var(--ob-sun) 10%, var(--ob-sheet));
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.question span {
|
|
441
|
+
color: var(--ob-muted);
|
|
442
|
+
font-size: 13px;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/* Garden board */
|
|
446
|
+
.board-title {
|
|
447
|
+
font-size: 15px;
|
|
448
|
+
font-weight: 600;
|
|
449
|
+
letter-spacing: -0.01em;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.projects {
|
|
453
|
+
display: flex;
|
|
454
|
+
flex-wrap: wrap;
|
|
455
|
+
gap: 6px;
|
|
456
|
+
margin: 4px 0 2px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.project-chip {
|
|
460
|
+
font-size: 12px;
|
|
461
|
+
padding: 4px 9px;
|
|
462
|
+
border-radius: 999px;
|
|
463
|
+
border: 1px solid var(--ob-line);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.columns {
|
|
467
|
+
display: grid;
|
|
468
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
469
|
+
gap: 10px;
|
|
470
|
+
margin-top: 6px;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.column {
|
|
474
|
+
min-width: 0;
|
|
475
|
+
padding: 0 8px 8px;
|
|
476
|
+
border-radius: 12px;
|
|
477
|
+
background: var(--ob-panel);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.column h2 {
|
|
481
|
+
margin-top: 10px;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.column .empty {
|
|
485
|
+
font-size: 12px;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.tiles {
|
|
489
|
+
list-style: none;
|
|
490
|
+
margin: 6px 0 0;
|
|
491
|
+
padding: 0;
|
|
492
|
+
display: grid;
|
|
493
|
+
gap: 6px;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.tile {
|
|
497
|
+
display: flex;
|
|
498
|
+
gap: 8px;
|
|
499
|
+
align-items: flex-start;
|
|
500
|
+
padding: 8px;
|
|
501
|
+
border-radius: 9px;
|
|
502
|
+
background: var(--ob-sheet);
|
|
503
|
+
border: 1px solid var(--ob-line);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.tile .check {
|
|
507
|
+
margin-top: 1px;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.tile-body {
|
|
511
|
+
min-width: 0;
|
|
512
|
+
flex: 1;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.tile-title {
|
|
516
|
+
display: block;
|
|
517
|
+
font-size: 13px;
|
|
518
|
+
overflow-wrap: anywhere;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.tile[data-status="done"] .tile-title {
|
|
522
|
+
color: var(--ob-muted);
|
|
523
|
+
text-decoration: line-through;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.tile-meta {
|
|
527
|
+
display: flex;
|
|
528
|
+
flex-wrap: wrap;
|
|
529
|
+
align-items: center;
|
|
530
|
+
gap: 4px;
|
|
531
|
+
margin-top: 4px;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.tile-meta .chip {
|
|
535
|
+
font-size: 11px;
|
|
536
|
+
padding: 3px 6px;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/* Triage replies */
|
|
540
|
+
.reply {
|
|
541
|
+
display: flex;
|
|
542
|
+
gap: 6px;
|
|
543
|
+
margin-top: 6px;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.reply input {
|
|
547
|
+
flex: 1;
|
|
548
|
+
min-width: 0;
|
|
549
|
+
font: inherit;
|
|
550
|
+
font-size: 13px;
|
|
551
|
+
color: var(--ob-ink);
|
|
552
|
+
background: var(--ob-sheet);
|
|
553
|
+
border: 1px solid var(--ob-line);
|
|
554
|
+
border-radius: 8px;
|
|
555
|
+
padding: 5px 9px;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.reply input:focus-visible {
|
|
559
|
+
outline: 2px solid var(--ob-accent);
|
|
560
|
+
outline-offset: 1px;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.answered {
|
|
564
|
+
margin: 4px 0 0;
|
|
565
|
+
font-size: 13px;
|
|
566
|
+
color: var(--ob-accent);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/* Single-item cards (person, book, reading, activity) */
|
|
570
|
+
.item-head {
|
|
571
|
+
display: grid;
|
|
572
|
+
gap: 2px;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.item .flush {
|
|
576
|
+
margin-left: 0;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.sub.line {
|
|
580
|
+
display: block;
|
|
581
|
+
margin: 8px 0 0;
|
|
582
|
+
white-space: normal;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
.progress {
|
|
586
|
+
height: 6px;
|
|
587
|
+
margin-top: 12px;
|
|
588
|
+
border-radius: 999px;
|
|
589
|
+
background: var(--ob-panel);
|
|
590
|
+
overflow: hidden;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.progress span {
|
|
594
|
+
display: block;
|
|
595
|
+
height: 100%;
|
|
596
|
+
border-radius: inherit;
|
|
597
|
+
background: var(--ob-accent);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.stats {
|
|
601
|
+
display: grid;
|
|
602
|
+
grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
|
|
603
|
+
gap: 8px;
|
|
604
|
+
margin-top: 12px;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.stat {
|
|
608
|
+
display: grid;
|
|
609
|
+
gap: 2px;
|
|
610
|
+
padding: 8px 10px;
|
|
611
|
+
border-radius: 10px;
|
|
612
|
+
background: var(--ob-panel);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.stat span {
|
|
616
|
+
font-size: 11px;
|
|
617
|
+
letter-spacing: 0.04em;
|
|
618
|
+
text-transform: uppercase;
|
|
619
|
+
color: var(--ob-muted);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.stat strong {
|
|
623
|
+
font-size: 16px;
|
|
624
|
+
font-weight: 600;
|
|
625
|
+
font-variant-numeric: tabular-nums;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/* Calendar */
|
|
629
|
+
.calendar h2.today {
|
|
630
|
+
color: var(--ob-accent);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.event .dot {
|
|
634
|
+
--dot: var(--ob-accent);
|
|
635
|
+
flex: none;
|
|
636
|
+
width: 8px;
|
|
637
|
+
height: 8px;
|
|
638
|
+
border-radius: 50%;
|
|
639
|
+
background: var(--dot);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.event .when {
|
|
643
|
+
flex: none;
|
|
644
|
+
width: 128px;
|
|
645
|
+
font-size: 12px;
|
|
646
|
+
color: var(--ob-muted);
|
|
647
|
+
font-variant-numeric: tabular-nums;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@media (max-width: 420px) {
|
|
651
|
+
.event .when {
|
|
652
|
+
width: auto;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
</style>
|
|
656
|
+
</head>
|
|
657
|
+
<body>
|
|
658
|
+
<main id="root"></main>
|
|
659
|
+
<script>"use strict";(()=>{var pg=Object.defineProperty;var yt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var D=(e,t)=>()=>(e&&(t=e(e=0)),t);var Le=(e,t)=>{for(var r in t)pg(e,r,{get:t[r],enumerable:!0})};var v={};Le(v,{BIGINT_FORMAT_RANGES:()=>Br,CONSTANT_CATCH:()=>ko,Class:()=>Ta,NUMBER_FORMAT_RANGES:()=>Hr,aborted:()=>ge,allowsEval:()=>Ca,assert:()=>gg,assertEqual:()=>fg,assertIs:()=>mg,assertNever:()=>hg,assertNotEqual:()=>dg,assignProp:()=>ce,attachSchema:()=>Jr,base64ToUint8Array:()=>Fd,base64urlToUint8Array:()=>Ng,cached:()=>rr,captureStackTrace:()=>wo,cleanEnum:()=>Eg,cleanRegex:()=>qe,clone:()=>L,cloneDef:()=>_g,codePointLength:()=>$t,constantCatch:()=>ja,createTransparentProxy:()=>kg,defineLazy:()=>Oa,defineLazyInternal:()=>C,derived:()=>Mg,esc:()=>he,escapeRegex:()=>Oe,explicitlyAborted:()=>Na,extend:()=>Ig,finalizeIssue:()=>xe,floatSafeRemainder:()=>Vr,getElementAtPath:()=>$g,getEnumValues:()=>er,getLengthableOrigin:()=>Wr,getParsedType:()=>vg,getSizableOrigin:()=>Kr,hexToUint8Array:()=>Dg,hide:()=>Gr,installLazyProp:()=>Fg,isObject:()=>_t,isPlainObject:()=>Te,issue:()=>ir,joinValues:()=>$o,jsonStringifyReplacer:()=>tr,members:()=>Da,merge:()=>Og,mergeDefs:()=>Ne,normalizeParams:()=>_,nullish:()=>xo,numKeys:()=>zg,objectClone:()=>yg,omit:()=>Pg,optionalKeys:()=>Ea,own:()=>tt,parsedType:()=>Za,partial:()=>Ag,pick:()=>Sg,prefixIssues:()=>$e,primitiveTypes:()=>Ra,promiseAllObject:()=>xg,propertyKeyTypes:()=>qr,randomString:()=>wg,rawShape:()=>nr,required:()=>Cg,safeExtend:()=>Tg,shallowClone:()=>Fr,sizeCaps:()=>or,slugify:()=>Aa,stringifyPrimitive:()=>zo,toZod:()=>Xt,uint8ArrayToBase64:()=>qd,uint8ArrayToBase64url:()=>Zg,uint8ArrayToHex:()=>jg,unwrapMessage:()=>Yt});function fg(e){return e}function dg(e){return e}function Xt(){return e=>e}function mg(e){}function hg(e){throw new Error("Unexpected value in exhaustive check")}function gg(e){}function er(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function $o(e,t="|"){return e.map(r=>zo(r)).join(t)}function tr(e,t){return typeof t=="bigint"?t.toString():t}function rr(e){return new Ia(e)}function xo(e){return e==null}function qe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function Oa(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Md)return n===void 0&&(n=Md,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function yg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ce(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Fe(e){return nr(e._zod.def)??e._zod.def.shape}function Ld(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ce(this,t,n),n},enumerable:!0,configurable:!0})}function Ud(e,t,r){t in e?ce(e,t,r):e[t]=r}function bt(e,t,r,n){let o=Fe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Ld(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a}):Ud(e,i,n?n(s.value,i):s.value))}}function bg(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Ld(e,r,()=>t[r]):Ud(e,r,n.value))}}function Ne(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function _g(e){return Ne(e._zod.def)}function $g(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function xg(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function wg(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function he(e){return JSON.stringify(e)}function Aa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function _t(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Te(e){if(_t(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_t(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Fr(e){return Te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function zg(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function _(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 new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function kg(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function zo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ea(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function Sg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return bt(i,e,vo(e,t)),L(e,Ne(r,{shape:i,checks:[]}))}function vo(e,t){let r=Fe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Pg(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(vo(e,t)),s={};return bt(s,e,Reflect.ownKeys(Fe(e)).filter(a=>!i.has(a))),L(e,Ne(r,{shape:s,checks:[]}))}function Ig(e,t){if(!Te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Fe(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,Ne(e._zod.def,{shape:Vd(e,t)}))}function Vd(e,t){let r={};return bt(r,e,Reflect.ownKeys(Fe(e))),bg(r,t),r}function Tg(e,t){if(!Te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,Ne(e._zod.def,{shape:Vd(e,t)}))}function Og(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};bt(r,e,Reflect.ownKeys(Fe(e))),bt(r,t,Reflect.ownKeys(Fe(t)));let n=Ne(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,n)}function Ag(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(vo(t,r)):void 0,c={};return bt(c,t,Reflect.ownKeys(Fe(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,Ne(t._zod.def,{shape:c,checks:[]}))}function Cg(e,t,r){let n=r?new Set(vo(t,r)):void 0,o={};return bt(o,t,Reflect.ownKeys(Fe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,Ne(t._zod.def,{shape:o}))}function ge(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 Na(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 $e(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Yt(e){return typeof e=="string"?e:e?.message}function or(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Jr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function xe(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Yt(e.inst?._zod.def?.error?.(e))??Yt(i?.(e))??Yt(t?.error?.(e))??Yt(r.customError?.(e))??Yt(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Kr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function $t(e){let t=e.length;if(!Rg.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Wr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Za(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 ir(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Eg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Fd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function qd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ng(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Fd(t+r)}function Zg(e){return qd(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Dg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function jg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Da(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Lg(e,r,n.value)}}function tt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Gr(e,t,r){return tt(e,t,r,!1)}function Mg(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return tt(this,r,n(this))},set(o){tt(this,r,o)}})}return t}function Lg(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:tt(this,t,r.bind(this))},set(n){tt(this,t,n)}})}function Ug(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function C(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Pa!==e._zod){Pa=void 0;return}Pa=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Vg);let o=et;et=!1;try{let i=r(this);return et?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),et=et||o,i}catch(i){throw delete this[t],et=et||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Fg(e,t,r,n){let o=Ug(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function ja(e){let t=()=>e;return t[ko]=!0,t}var Ia,Md,wo,Ca,vg,qr,Ra,Hr,Br,Rg,Ta,Pa,et,Vg,ko,ee=D(()=>{rt();Ia=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};Md=Symbol("evaluating");wo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Ca=rr(()=>{if(oe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});vg=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},qr=new Set(["string","number","symbol"]),Ra=new Set(["string","number","bigint","boolean","symbol","undefined"]);Hr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Br={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Rg=/[\uD800-\uDBFF]/;Ta=class{constructor(...t){}};et=!1,Vg={configurable:!0,get(){et=!0}};ko="~constantCatch"});function qg(e){let t=Bd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Bd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Ma.value=new i(m);try{Object.defineProperty(d,"_zod",Ma)}finally{Ma.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let b=Object.getPrototypeOf(d),x=d._zod.constr.prototype,I=b;for(;I&&I!==x;)I=Object.getPrototypeOf(I);let $=I??b;a.has($)||(a.add($),Da($,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?qg(l):this;c(m,d);let g=m._zod.deferred;if(g){for(let x of g)x();m._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(m),m}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}function Y(e){return e&&Object.assign(oe,e),oe}var Hd,So,Ma,Bd,Po,we,nt,oe,rt=D(()=>{ee();So=Object.freeze({status:"aborted"}),Ma={value:void 0,enumerable:!1},Bd="captureStackTrace"in Error?Error:null;Po=Symbol("zod_brand"),we=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},nt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Hd=globalThis).__zod_globalConfig??(Hd.__zod_globalConfig={});oe=globalThis.__zod_globalConfig});function Hg(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,tr,2)),e.message}function Bg(e){this._zod.message=e}function Kg(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function sr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Kg(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ar(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[l];f&&d._errors.push(t(s)),c=d,u++}}}};return n(e),r}function Io(e,t=r=>r.message){let r={errors:[]},n=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>n({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){r.errors.push(t(a));continue}let u=r,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),d&&u.errors.push(t(a)),l++}}};return n(e),r}function Wd(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function To(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${Wd(n.path)}`);return t.join(`
|
|
660
|
+
`)}var Jg,Ua,Jd,Kd,Va,ze,Fa=D(()=>{rt();ee();Jg={get:Hg,set:Bg,enumerable:!0,configurable:!0},Ua={value:void 0,enumerable:!1},Jd=new WeakSet([Object.prototype,Error.prototype]),Kd=(e,t)=>{e.name="$ZodError",Ua.value=t,Object.defineProperty(e,"issues",Ua),Ua.value=void 0,Object.defineProperty(e,"message",Jg);let r=Object.getPrototypeOf(e);Jd.has(r)||(Jd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},Va=h("$ZodError",Kd),ze=h("$ZodError",Kd,void 0,{Parent:Error})});function Oo(e,t){return{callee:t?.callee??e,Err:t?.Err}}function Gd(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>xe(o,r,Y()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}function Yg(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Qg]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new we;return i.issues.length===0}var cr,Qr,ur,Yr,lr,Ao,pr,qa,Gg,Qg,xt,wt,Co,Qd,Ro,Yd,Eo,Xd,No,em,Zo,tm,Do,rm,jo,nm,Mo,om,Ha=D(()=>{rt();Fa();ee();cr=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new we;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>xe(u,s,Y())));throw wo(c,i?.callee??t),c}return a.value};return t},Qr=cr(ze),ur=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>xe(u,s,Y())));throw wo(c,i?.callee??t),c}return a.value};return t},Yr=ur(ze),lr=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new we;return i.issues.length?Gd(e,i.issues,o):{success:!0,data:i.value}},Ao=lr(ze);pr=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?Gd(e,i.issues,o):{success:!0,data:i.value}},qa=pr(ze),Gg=Symbol.for("zod.compile.invalid"),Qg=Symbol.for("zod.compile.fallback"),xt=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Gg)return!0;if(n.definite===!0&&r===void 0)return!1}return Yg(e,t,r)});wt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Co=e=>{let t=cr(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,Oo(r,s))};return r},Qd=Co(ze),Ro=e=>{let t=cr(e),r=(n,o,i,s)=>t(n,o,i,Oo(r,s));return r},Yd=Ro(ze),Eo=e=>{let t=ur(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Oo(r,s))};return r},Xd=Eo(ze),No=e=>{let t=ur(e),r=async(n,o,i,s)=>await t(n,o,i,Oo(r,s));return r},em=No(ze),Zo=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return lr(e)(t,r,o)},tm=Zo(ze),Do=e=>(t,r,n)=>lr(e)(t,r,n),rm=Do(ze),jo=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return pr(e)(t,r,o)},nm=jo(ze),Mo=e=>async(t,r,n)=>pr(e)(t,r,n),om=Mo(ze)});var Pe={};Le(Pe,{anyString:()=>bc,base64:()=>uc,base64url:()=>lc,bigint:()=>$c,boolean:()=>xc,browserEmail:()=>sy,cidrv4:()=>ac,cidrv6:()=>cc,creditCard:()=>Lo,cuid:()=>Ja,cuid2:()=>Ka,currencyCode:()=>mc,date:()=>hc,datetime:()=>yc,domain:()=>fc,duration:()=>ec,e164:()=>dc,email:()=>rc,emoji:()=>nc,extendedDuration:()=>Xg,guid:()=>tc,hex:()=>Sc,hostname:()=>pc,html5Email:()=>ny,httpProtocol:()=>Xr,iban:()=>Uo,idnEmail:()=>iy,integer:()=>en,ipv4:()=>oc,ipv6:()=>ic,ksuid:()=>Qa,lowercase:()=>vc,mac:()=>sc,md5_base64:()=>ly,md5_base64url:()=>py,md5_hex:()=>uy,nanoid:()=>Ya,nanoidOfLength:()=>Xa,null:()=>wc,number:()=>He,rfc5322Email:()=>oy,sha1_base64:()=>dy,sha1_base64url:()=>my,sha1_hex:()=>fy,sha256_base64:()=>gy,sha256_base64url:()=>yy,sha256_hex:()=>hy,sha384_base64:()=>_y,sha384_base64url:()=>$y,sha384_hex:()=>by,sha512_base64:()=>wy,sha512_base64url:()=>zy,sha512_hex:()=>xy,string:()=>_c,time:()=>gc,ulid:()=>Wa,undefined:()=>zc,unicodeEmail:()=>im,uppercase:()=>kc,uuid:()=>zt,uuid4:()=>ey,uuid6:()=>ty,uuid7:()=>ry,xid:()=>Ga});function Xa(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function nc(){return new RegExp(ay,"u")}function cy(e){return new RegExp(`^${e}$`)}function Ba(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gc(e){return new RegExp(`^${Ba(e)}$`)}function yc(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ba({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ba({precision:e.precision})}`:r;return new RegExp(`^${sm}T(?:${n})$`)}function tn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function rn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ja,Ka,Wa,Ga,Qa,Ya,ec,Xg,tc,zt,ey,ty,ry,rc,ny,oy,im,iy,sy,ay,oc,ic,sc,ac,cc,uc,lc,pc,fc,Xr,dc,Lo,mc,Uo,sm,hc,bc,_c,$c,en,He,xc,wc,zc,vc,kc,Sc,uy,ly,py,fy,dy,my,hy,gy,yy,by,_y,$y,xy,wy,zy,vt=D(()=>{ee();Ja=/^[cC][0-9a-z]{6,}$/,Ka=/^[0-9a-z]+$/,Wa=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ga=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,Ya=/^[a-zA-Z0-9_-]{21}$/;ec=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xg=/^[-+]?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)?)??$/,tc=/^([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})$/,zt=e=>e?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})$`):/^([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)$/,ey=zt(4),ty=zt(6),ry=zt(7),rc=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ny=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,oy=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,im=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,iy=im,sy=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ay="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";oc=/^(?:(?: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])$/,ic=/^(([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}|:))$/,sc=e=>{let t=Oe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ac=/^((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])$/,cc=/^(([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])$/,uc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lc=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,pc=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,fc=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Xr=/^https?$/,dc=/^\+[1-9]\d{6,14}$/,Lo=/^\d(?:[ -]?\d){11,18}$/,mc=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Uo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,sm="(?:(?:\\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])))";hc=cy(sm);bc=/^[\s\S]{0,}$/,_c=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},$c=/^-?\d+n?$/,en=/^-?\d+$/,He=/^-?\d+(?:\.\d+)?$/,xc=/^(?:true|false)$/i,wc=/^null$/i,zc=/^undefined$/i,vc=/^[^A-Z]*$/,kc=/^[^a-z]*$/,Sc=/^[0-9a-fA-F]*$/;uy=/^[0-9a-fA-F]{32}$/,ly=tn(22,"=="),py=rn(22),fy=/^[0-9a-fA-F]{40}$/,dy=tn(27,"="),my=rn(27),hy=/^[0-9a-fA-F]{64}$/,gy=tn(43,"="),yy=rn(43),by=/^[0-9a-fA-F]{96}$/,_y=tn(64,""),$y=rn(64),xy=/^[0-9a-fA-F]{128}$/,wy=tn(86,"=="),zy=rn(86)});function Fo(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues))}var W,Pc,Ic,Vo,qo,Ho,Tc,Oc,Ac,Cc,Rc,Ec,Nc,Zc,Dc,fr,jc,Mc,Lc,Uc,Vc,Fc,qc,Hc,Bc,Jc,Bo=D(()=>{rt();vt();ee();W=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Pc=e=>{let t=e.value;return!xo(t)&&t.size!==void 0},Ic=e=>{let t=e.value;return!xo(t)&&t.length!==void 0},Vo={number:"number",bigint:"bigint",object:"date"},qo=h("$ZodCheckLessThan",(e,t)=>{W.init(e,t);let r=Vo[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:Vo[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ho=h("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);let r=Vo[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:Vo[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tc=h("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Vr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Oc=h("$ZodCheckNumberFormat",(e,t)=>{W.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Hr[t.format];e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Ac=h("$ZodCheckBigIntFormat",(e,t)=>{W.init(e,t);let[r,n]=Br[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Cc=h("$ZodCheckMaxSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Pc),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Kr(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Rc=h("$ZodCheckMinSize",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Pc),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Kr(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ec=h("$ZodCheckSizeEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Pc),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let s=i>t.size;n.issues.push({origin:Kr(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nc=h("$ZodCheckMaxLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ic),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?$t(o):i)<=t.maximum)return;let a=Wr(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Zc=h("$ZodCheckMinLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ic),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?$t(o):i)>=t.minimum)return;let a=Wr(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Dc=h("$ZodCheckLengthEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=Ic),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?$t(o):i;if(s===t.length)return;let a=Wr(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fr=h("$ZodCheckStringFormat",(e,t)=>{var r,n;W.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),jc=h("$ZodCheckRegex",(e,t)=>{fr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Mc=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vc),fr.init(e,t)}),Lc=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=kc),fr.init(e,t)}),Uc=h("$ZodCheckIncludes",(e,t)=>{W.init(e,t);let r=Oe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Vc=h("$ZodCheckStartsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`^${Oe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Fc=h("$ZodCheckEndsWith",(e,t)=>{W.init(e,t);let r=new RegExp(`.*${Oe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});qc=h("$ZodCheckProperty",(e,t)=>{W.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Fo(o,r,t.property));Fo(n,r,t.property)}}),Hc=h("$ZodCheckProperties",(e,t)=>{W.init(e,t),Gr(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=n.value,i;for(let[s,a]of r){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Fo(u,n,s)))):Fo(c,n,s)}if(i)return Promise.all(i).then(()=>{})}}),Bc=h("$ZodCheckMimeType",(e,t)=>{W.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Jc=h("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var kt,Jo=D(()=>{kt=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
661
|
+
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
662
|
+
${r.join(`
|
|
663
|
+
`)}
|
|
664
|
+
};`)(...Object.values(this.closed))}}});var Kc,Wc=D(()=>{Kc={major:4,minor:6,patch:7}});async function vy(e,t){let r={async:!0};return zm(await e._zod.run({value:t,issues:[]},r),r)}function Yo(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return zm(n,r)}catch{}return vy(e,t)},vendor:"zod",version:1}}function tu(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Xo(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?tu(e)||nn:vm(e,t)}function vm(e,t){if(!t.normalize&&t.protocol?.source===Xr.source&&!/^https?:\/\//i.test(e))return eu;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??nn}return new URL(e)}catch{return nn}}function on(e){return e.replace(ky,"")}function ei(e,t){return t.lastIndex=0,t.test(e.hostname)}function ti(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function sn(e){return Sy.test(e)?tu(`http://[${e}]`):!1}function ri(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:sn(r)}function an(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function oi(e){if(!cn.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return an(r)}function Iy(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}function ii(e){return Lo.test(e)?Iy(e.replace(Py,"")):!1}function Ty(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function si(e){return Uo.test(e)?Ty(e):!1}function ai(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function Zu(e,t){let r=or(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of or(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Jr(i.issues,l,e),i}}return o(i,s)}}function cm(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function Qo(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...$e(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}function km(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ry,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Ea(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Sm(e,t,r,n,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,d=u.optout,m=0;for(let g in t){if(s&&r.issues.length!==m){if(ge(r,m))break;m=r.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},n);b instanceof Promise?e.push(b.then(x=>Qo(x,r,g,t,f,d))):Qo(b,r,g,t,f,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}function um(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ge(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>xe(s,n,Y())))}),t)}function lm(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>xe(s,n,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}function li(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Im(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Im(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}function dr(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(Te(e)&&Te(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=dr(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=dr(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function pm(e,t,r){let n=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)n.has(d)||n.set(d,{}),n.get(d)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=dr(t.value,r.value);if(!c.valid){if(ge(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}function fm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function dm(e,t,r){e.issues.length&&t.issues.push(...$e(r,e.issues)),t.value[r]=e.value}function mm(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],a=i<n.length;if(!a&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...$e(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function hm(e,t,r,n,o,i,s){e.issues.length&&(qr.has(typeof n)?r.issues.push(...$e(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>xe(a,s,Y()))})),t.issues.length&&(qr.has(typeof n)?r.issues.push(...$e(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(a=>xe(a,s,Y()))})),r.value.set(e.value,t.value)}function gm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function ym(e,t){return e.value=t.issues.length?void 0:t.value,e}function bm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function _m(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function $m(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>xe(o,n,Y()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function Ko(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function Wo(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Go(e,i,t.out,r)):Go(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Go(e,i,t.in,r)):Go(e,o,t.in,r)}}function Go(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function xm(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Ey(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(r=c.pattern),n||(n=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return _c({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(n&&s===He?en:s)?.source}function Gc(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=Gc(n);return r&&o&&i&&i!==o?r.replace(qe(o),()=>qe(i)):r}if(t.options){let o=t.options.map(Gc);if(o.every(Boolean))return`^(${o.map(i=>qe(i)).join("|")})$`}return Ey(e)}function wm(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ir(o))}}var O,zm,St,V,Qc,Yc,Xc,eu,nn,ky,ru,nu,ou,iu,su,au,cu,uu,lu,pu,fu,du,mu,Sy,hu,gu,yu,bu,ni,_u,cn,$u,xu,Py,wu,zu,vu,ku,ci,Su,un,ui,Pu,Iu,Tu,Ou,Au,Cu,Ru,Eu,Nu,Oy,Ay,Cy,Du,Ry,Pm,ju,ln,Mu,Lu,Uu,pi,Vu,Fu,qu,Hu,Bu,Ju,Ku,fi,Wu,Gu,Qu,Yu,Xu,el,tl,rl,di,pn,nl,ol,il,sl,al,fn,cl,mr=D(()=>{Bo();rt();Jo();Ha();vt();ee();Wc();ee();O=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Kc;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._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 i=(a,c,u)=>{if(a.memo)return a;let l=ge(a),f;for(let d of c){if(d._zod.def.when){if(Na(a)||!d._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new we;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(Jr(a.issues,m,e),l||(l=ge(a,m)))});else{if(a.issues.length===m)continue;Jr(a.issues,m,e),l||(l=ge(a,m))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(ge(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new we;return l.then(f=>e._zod.parse(f,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});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new we;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return Gr(this,"~standard",Yo(this))},set"~standard"(e){tt(this,"~standard",e)}}),zm=(e,t)=>e.issues.length?{issues:e.issues.map(r=>xe(r,t,Y()))}:{value:e.value};St=h("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??bc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),V=h("$ZodStringFormat",(e,t)=>{fr.init(e,t),St.init(e,t)}),Qc=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=tc),V.init(e,t)}),Yc=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=zt(n))}else t.pattern??(t.pattern=zt());V.init(e,t)}),Xc=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=rc),V.init(e,t)}),eu=1,nn=2;ky=/[\t\n\r]/g;ru=h("$ZodURL",(e,t)=>{V.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Xo(n,t);if(o===eu){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===nn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=on(n);return}t.hostname&&!ei(o,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}),t.protocol&&!ti(o,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?o.href:on(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),nu=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=nc()),V.init(e,t)}),ou=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Ya:Xa(t.length)),V.init(e,t)}),iu=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ja),V.init(e,t)}),su=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ka),V.init(e,t)}),au=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Wa),V.init(e,t)}),cu=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ga),V.init(e,t)}),uu=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qa),V.init(e,t)}),lu=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=yc(t)),V.init(e,t)}),pu=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=hc),V.init(e,t)}),fu=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gc(t)),V.init(e,t)}),du=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ec),V.init(e,t)}),mu=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=oc),V.init(e,t)}),Sy=/^[0-9a-fA-F:.]+$/;hu=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ic),V.init(e,t),e._zod.check=r=>{sn(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),gu=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=sc(t.delimiter)),V.init(e,t)}),yu=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ac),V.init(e,t)});bu=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=cc),V.init(e,t),e._zod.check=r=>{ri(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});ni=/^[0-9a-zA-Z+/]*={0,2}$/,_u=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ni),V.init(e,t),e._zod.check=r=>{an(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),cn=/^[A-Za-z0-9_-]*$/;$u=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=cn),V.init(e,t),e._zod.check=r=>{oi(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),xu=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=dc),V.init(e,t)}),Py=/[- ]/g;wu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Lo),V.init(e,t),e._zod.check=r=>{ii(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});zu=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Uo),V.init(e,t),e._zod.check=r=>{si(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});vu=h("$ZodJWT",(e,t)=>{V.init(e,t),e._zod.check=r=>{ai(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ku=h("$ZodCustomStringFormat",(e,t)=>{V.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),ci=h("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=He,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Su=h("$ZodNumberFormat",(e,t)=>{Oc.init(e,t),ci.init(e,t)}),un=h("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=xc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ui=h("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=$c,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Pu=h("$ZodBigIntFormat",(e,t)=>{Ac.init(e,t),ui.init(e,t)}),Iu=h("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),Tu=h("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=zc,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Ou=h("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=wc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Au=h("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),Cu=h("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=r=>r}),Ru=h("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Eu=h("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Nu=h("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});Oy=e=>Array.isArray(e)?e.length:-1,Ay=e=>e instanceof Map?e.size:-1,Cy=e=>e instanceof Set?e.size:-1;Du=h("$ZodArray",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>cm(f,n,c)));else if(cm(l,n,c),a&&l.issues.length!==0&&ge(l))break}return s.length?Promise.all(s).then(()=>n):n},Zu(e,Oy)});Ry=[];Pm=h("$ZodObject",(e,t)=>{O.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=rr(()=>km(t));C(e,"propValues",u=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||ce(f,d,new Set);for(let g of m.values)f[d].add(g);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=_t,s=t.catchall,a,c=oe.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],m=a.shape,g=l?.abortEarly,b=u.issues.length;for(let x of a.allKeys){if(g&&u.issues.length!==b){if(ge(u,b))break;b=u.issues.length}if(x==="__proto__")continue;let I=m[x],$=I._zod.optin,S=I._zod.optout,N=I._zod.run({value:f[x],issues:[]},l);N instanceof Promise?d.push(N.then(G=>Qo(G,u,x,f,$,S))):Qo(N,u,x,f,$,S)}return s?Sm(d,f,u,l,o.value,e,g===!0):d.length?Promise.all(d).then(()=>u):u}}),ju=h("$ZodObjectJIT",(e,t)=>{Pm.init(e,t);let r=e._zod.parse,n=rr(()=>km(t)),o=oe.memoizer,i=m=>{let g=n.value,b=g.symbolKeys,x=new kt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:b}),I=G=>`shape[${G}]._zod.run({ value: input[${G}], issues: [] }, ctx)`,$=(G,Z)=>`
|
|
665
|
+
let ${G}_ab = false;
|
|
666
|
+
for (let i = 0; i < ${G}.issues.length; i++) {
|
|
667
|
+
const iss = ${G}.issues[i];
|
|
668
|
+
iss.path = iss.path ? [${Z}, ...iss.path] : [${Z}];
|
|
669
|
+
payload.issues.push(iss);
|
|
670
|
+
if (iss.continue !== true) ${G}_ab = true;
|
|
671
|
+
}
|
|
672
|
+
if (${G}_ab && ctx && ctx.abortEarly) {
|
|
673
|
+
payload.value = newResult;
|
|
674
|
+
return payload;
|
|
675
|
+
}`;x.write("const input = payload.value;");let S=Object.create(null),N=0;for(let G of g.allKeys)S[G]=`key_${N++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let G of g.allKeys){if(G==="__proto__")continue;let Z=S[G],fe=typeof G=="symbol"?`syms[${b.indexOf(G)}]`:he(G),Ur=`${fe} in input`,Dd=m[G],Sa=Dd?._zod?.optin,jd=Sa!==void 0,ug=Dd?._zod?.optout==="optional";if(x.write(`const ${Z} = ${I(fe)};`),jd&&ug){let lg=Sa==="optional"?`${Z}_present`:`${Z}.value !== undefined || ${Z}_present`;x.write(`
|
|
676
|
+
const ${Z}_present = ${Ur};
|
|
677
|
+
if (!${Z}.issues.length || ${Z}_present) {
|
|
678
|
+
if (${Z}.issues.length) {${$(Z,fe)}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (${lg}) {
|
|
682
|
+
newResult[${fe}] = ${Z}.value;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
`)}else jd?(x.write(`
|
|
687
|
+
if (${Z}.issues.length) {${$(Z,fe)}
|
|
688
|
+
}
|
|
689
|
+
`),Sa==="defaulted"?x.write(`newResult[${fe}] = ${Z}.value;`):x.write(`
|
|
690
|
+
if (${Z}.value !== undefined || ${Ur}) {
|
|
691
|
+
newResult[${fe}] = ${Z}.value;
|
|
692
|
+
}
|
|
693
|
+
`)):x.write(`
|
|
694
|
+
const ${Z}_present = ${Ur};
|
|
695
|
+
if (${Z}.issues.length) {${$(Z,fe)}
|
|
696
|
+
}
|
|
697
|
+
if (!${Z}_present && !${Z}.issues.length) {
|
|
698
|
+
payload.issues.push({
|
|
699
|
+
code: "invalid_type",
|
|
700
|
+
expected: "nonoptional",
|
|
701
|
+
input: undefined,
|
|
702
|
+
path: [${fe}]
|
|
703
|
+
});
|
|
704
|
+
if (ctx && ctx.abortEarly) {
|
|
705
|
+
payload.value = newResult;
|
|
706
|
+
return payload;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (${Z}_present) {
|
|
711
|
+
newResult[${fe}] = ${Z}.value;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,a=_t,c=!oe.jitless,l=c&&Ca.value,f=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let b=m.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),m=s(m,g),f?Sm([],b,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m)}});ln=h("$ZodUnion",(e,t)=>{O.init(e,t),C(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),C(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),C(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),C(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>qe(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>um(a,n,e,o)):um(s,n,e,o)}});Mu=h("$ZodXor",(e,t)=>{ln.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>lm(a,n,e,o)):lm(s,n,e,o)}});Lu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ln.init(e,t);let r=e._zod.parse;C(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||ce(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=nr(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=rr(()=>Im(t));e._zod.parse=(o,i)=>{let s=o.value;if(!_t(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),Uu=h("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>pm(r,c,u)):pm(r,i,s)}});pi=h("$ZodTuple",(e,t)=>{O.init(e,t);let r=t.items,n=oe.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let a=[],c=fm(r,"optin"),u=fm(r,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(r.length),f=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:s[m],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[m]=b})):(l[m]=g,f&&!d&&g.issues.length&&(d=ge(g)))}if(t.rest&&!d){let m=r.length-1,g=s.slice(r.length),b=o.issues.length;for(let x of g){if(f&&o.issues.length!==b){if(ge(o,b))break;b=o.issues.length}m++;let I=t.rest._zod.run({value:x,issues:[]},i);I instanceof Promise?a.push(I.then($=>dm($,o,m))):dm(I,o,m)}}return a.length?Promise.all(a).then(()=>mm(l,o,r,s,u)):mm(l,o,r,s,u)}});Vu=h("$ZodRecord",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Te(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};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 f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>xe(g,o,Y())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(l,m.issues)),n.value[d]=m.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&He.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[u]=i[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>xe(g,o,Y())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(...$e(u,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...$e(u,m.issues)),n.value[d]=m.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>n):n}}),Fu=h("$ZodMap",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let s=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let a=o?.abortEarly,c=n.issues.length;for(let[u,l]of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),d=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||d instanceof Promise?s.push(Promise.all([f,d]).then(([m,g])=>{hm(m,g,n,u,i,e,o)})):hm(f,d,n,u,i,e,o)}return s.length?Promise.all(s).then(()=>n):n},Zu(e,Ay)});qu=h("$ZodSet",(e,t)=>{O.init(e,t);let r=oe.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let s=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let a=o?.abortEarly,c=n.issues.length;for(let u of i){if(a&&n.issues.length!==c){if(ge(n,c))break;c=n.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>gm(f,n))):gm(l,n)}return s.length?Promise.all(s).then(()=>n):n},Zu(e,Cy)});Hu=h("$ZodEnum",(e,t)=>{O.init(e,t);let r=er(t.entries),n=new Set(r);e._zod.values=n,C(e,"pattern",o=>{let i=er(o.def.entries).filter(s=>qr.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>Oe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),Bu=h("$ZodLiteral",(e,t)=>{O.init(e,t);let r=new Set(t.values);e._zod.values=r,C(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?Oe(i):i?Oe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Ju=h("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Ku=h("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",oe.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new we;return r.value=o,r}});fi=h("$ZodOptional",(e,t)=>{O.init(e,t),C(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",C(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),C(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${qe(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>ym(r,i)):ym(r,o)}return t.innerType._zod.run(r,n)}}),Wu=h("$ZodExactOptional",(e,t)=>{fi.init(e,t),C(e,"values",r=>r.def.innerType._zod.values),C(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Gu=h("$ZodNullable",(e,t)=>{O.init(e,t),C(e,"optin",r=>r.def.innerType._zod.optin),C(e,"optout",r=>r.def.innerType._zod.optout),C(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${qe(n.source)}|null)$`):void 0}),C(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Qu=h("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",C(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bm(i,t)):bm(o,t)}});Yu=h("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",C(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Xu=h("$ZodNonOptional",(e,t)=>{O.init(e,t),C(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>_m(i,e)):_m(o,e)}});el=h("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});tl=h("$ZodCatch",(e,t)=>{O.init(e,t),C(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),C(e,"optout",r=>r.def.innerType._zod.optout),C(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>$m(r,i,t,n)):$m(r,o,t,n)}}),rl=h("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),di=h("$ZodPipe",(e,t)=>{O.init(e,t),C(e,"values",r=>r.def.in._zod.values),C(e,"optin",r=>r.def.in._zod.optin),C(e,"optout",r=>r.def.out._zod.optout),C(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Ko(s,t.in,n)):Ko(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ko(i,t.out,n)):Ko(o,t.out,n)}});pn=h("$ZodCodec",(e,t)=>{O.init(e,t),C(e,"values",r=>r.def.in._zod.values),C(e,"optin",r=>r.def.in._zod.optin),C(e,"optout",r=>r.def.out._zod.optout),C(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(s=>Wo(s,t,n)):Wo(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>Wo(s,t,n)):Wo(i,t,n)}}});nl=h("$ZodPreprocess",(e,t)=>{di.init(e,t)}),ol=h("$ZodReadonly",(e,t)=>{O.init(e,t),C(e,"propValues",r=>r.def.innerType._zod.propValues),C(e,"values",r=>r.def.innerType._zod.values),C(e,"optin",r=>r.def.innerType?._zod?.optin),C(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(xm):xm(o)}});il=h("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=Gc(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(qe(o))}else if(n===null||Ra.has(typeof n))r.push(Oe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),sl=h("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Qr(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Qr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await Yr(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Yr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new pi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),al=h("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),fn=h("$ZodLazy",(e,t)=>{O.init(e,t),Oa(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),C(e,"pattern",r=>r.innerType?._zod?.pattern),C(e,"propValues",r=>r.innerType?._zod?.propValues),C(e,"optin",r=>r.innerType?._zod?.optin??void 0),C(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),cl=h("$ZodCustom",(e,t)=>{W.init(e,t),O.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>wm(i,r,n,e));wm(o,r,n,e)}})});function Am(e){return e!==null&&typeof e=="object"}function ul(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function mn(e,t,r){let n=Cm.get(e);if(n!==void 0)return n?dn:hr;if(t.has(e))return dn;t.add(e);let o=hr,i=l=>{if(o!==dn&&l?._zod){let f=mn(l,t,r);f>o&&(o=f)}},s=(l,f)=>{let d=hr;for(let m of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,m);if(f&&!g.enumerable)continue;let b=g.get?gi:g.value?._zod?mn(g.value,t,r):hr;b>d&&(d=b)}return d},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=nr(c);a(l?s(l,!0):gi),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?mn(l,t,!1):gi);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 f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let d=f.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),Ny(e,o)}function Ny(e,t){return t!==gi&&Cm.set(e,t===dn),t}function bi(e){return mn(e,new Set,!0)!==hr}function Zy(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}function gr(){return Dy}function _i(e,t){let r=e[ll]?.backEdges;return r!==void 0&&Am(t)&&r.has(t)}var yi,ll,Om,Cm,hr,gi,dn,mi,hi,Dy,pl=D(()=>{ee();yi=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},ll="~memo",Om=[];Cm=new WeakMap,hr=0,gi=1,dn=2;hi=[],Dy={alloc(e,t,r){let n=mi;if(!n)return r;mi=void 0;let o={value:r,issues:null};return n.set(t.value,o),hi.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&_i(i,o.value))throw new yi;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(r===void 0){let I=mn(e,new Set,!1);if(I===hr)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);I===dn||n?r=!0:n=!0}let l=c.value;if(!Am(l))return s(c,u);let f=u[ll];f||(f={buckets:new WeakMap,backEdges:void 0},u[ll]=f);let d;o===u?d=i:(d=Zy(f,e),o=u,i=d);let m=d.get(l);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...ul(m.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),c;mi=d;let g=hi.length,b=s(c,u);mi=void 0;let x=hi.length>g?hi.pop():void 0;return b instanceof Promise?b.then(I=>(x&&(x.issues=I.issues.length?ul(I.issues):Om),I)):(x&&(x.issues=b.issues.length?ul(b.issues):Om),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}}});function $i(){return{localeError:jy()}}var jy,fl=D(()=>{ee();jy=()=>{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(i){return e[i]??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"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Za(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${zo(i.values[0])}`:`Invalid option: expected one of ${$o(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${$o(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}}});var yr={};Le(yr,{en:()=>$i});var dl=D(()=>{fl()});function hn(){return new xi}var Rm,wi,zi,xi,ie,gn=D(()=>{wi=Symbol("ZodOutput"),zi=Symbol("ZodInput"),xi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};(Rm=globalThis).__zod_globalRegistry??(Rm.__zod_globalRegistry=hn());ie=globalThis.__zod_globalRegistry});function Ly(e,t){try{return ki(e,{assertOnly:!0})}catch{return t}}function vi(e,t){try{let r=ki(e),n=yn(e,r);return n._zod.bag.validator=Ly(e,r),n}catch(r){if(t?.strict)throw r;return e}}function yn(e,t){if(bi(e))throw new E("a schema whose subtree contains a reference cycle");let r=L(e),n=e._zod.run,o=n.__originalRun??n,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Em]||a&&_i(a,s.value))return o(s,a);let c=t(s.value);return c!==me?(s.value=c,s):(a&&(a[Em]=!0),o(s,a))};return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Uy(r,e,t),r}function Uy(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(s,a)=>{let c=r(s);return c!==me?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(s,a)=>{let c=r(s);return c!==me?c:i(s,a)}}}function ki(e,t){let r=!0;try{r=bi(e)}catch{}if(r)throw new E("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new kt(["input"]),i=Q(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...n.constants.keys()],a=[me,...n.constants.values()],c=o.content.join(`
|
|
715
|
+
`),u=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
|
|
716
|
+
${c}`:c:"",l=Function,f=`return (input) => {
|
|
717
|
+
${c}
|
|
718
|
+
}`,d;try{d=new l(...s,f)(...a)}catch(m){throw new E(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=u),d.definite=n.definite,d}function T(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function It(e,t){return e.definite=!1,T(e,t)}function P(e){return`v${e.varCounter++}`}function Vy(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return me;let n=r;return n.issues.length===0?n.value:me}function de(e,t,r,n,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return Q(e,t,r,n,o)}catch(u){if(!(u instanceof E)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,Fy(e,t,r,n)}}function Fy(e,t,r,n){t.definite=!1;let o=T(t,r),i=T(t,Vy),s=P(t);return e.write(`const ${s} = ${i}(${o}, ${n});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function Hy(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let s of o){let a=s._zod.def;if(a.when&&!qy.has(a.check))throw new E('check with a custom "when" condition');switch(a.check){case"greater_than":By(e,t,a,i);break;case"less_than":Jy(e,t,a,i);break;case"multiple_of":Ky(e,t,a,i);break;case"number_format":Lm(e,a,i);break;case"min_length":{let c=ot(a.minimum,"min_length"),u=ml(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=ot(a.maximum,"max_length"),u=ml(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=ot(a.length,"length_equals"),u=ml(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${ot(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${ot(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${ot(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Um(e,t,a,i);break;case"custom":i=eb(e,t,s,i);break;case"bigint_format":Wy(e,a,i);break;case"mime_type":Gy(e,t,a,i);break;case"property":Yy(e,t,a,i);break;case"properties":Qy(e,t,a,i);break;case"overwrite":{let c=P(t);Xy(e,t,s,i,c),i=c;break}default:throw new E(`check type ${a.check}`)}}return i}function ml(e,t,r,n){let o=T(t,$t),i=P(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}function ot(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new E(`${t} bound of type ${typeof e}`);return`${e}`}function Mm(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new E("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new E("comparison check with Invalid Date bound");return T(e,t)}throw new E(`comparison check bound of type ${typeof t}`)}function By(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Mm(t,r.value)}) return INVALID;`)}function Jy(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Mm(t,r.value)}) return INVALID;`)}function Ky(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new E("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=T(t,Vr);e.write(`if (${o}(${n}, ${ot(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function Lm(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new E(`number format ${n}`)}}function Wy(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new E(`bigint format ${n}`)}}function Gy(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=T(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function Qy(e,t,r,n){if(r.when)throw new E('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?T(t,i):he(i),a=P(t);e.write(`const ${a} = ${n}[${s}];`),de(e,t,o[i],a,!1)}}function Yy(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;Q(e,t,r.schema,o)}function Xy(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new E("overwrite check without a transform function");if(Tt(i))throw new Ae("z.compile: async overwrite transforms are not supported");let s=T(t,i);e.write(`const ${o} = ${s}(${n});`)}function hl(){throw new we}function yl(e){this.issues.push(e)}function eb(e,t,r,n){let o=r._zod.def;if(o.fn){if(Tt(o.fn))throw new Ae("z.compile: async .refine() predicates are not supported");let i=It(t,o.fn),s=T(t,hl),a=P(t);return e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),n}if(r._zod.check){if(Tt(r._zod.check))throw new Ae("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,a=It(t,u=>{let l={value:u,issues:[],addIssue:yl};return i(l)instanceof Promise&&hl(),l.issues.length===0?l.value:me}),c=P(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new E("custom check without a predicate or check function")}function Um(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let u=T(t,an);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="base64url"){let u=T(t,oi);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="jwt"){let u=T(t,ai),l=T(t,r.alg??null);return e.write(`if (!${u}(${n}, ${l})) return INVALID;`),n}if(i==="ipv6"){let u=T(t,sn);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="cidrv6"){let u=T(t,ri);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="credit_card"){let u=T(t,ii);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(i==="iban"){let u=T(t,si);return e.write(`if (!${u}(${n})) return INVALID;`),n}let s=r;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=T(t,Xo),l=T(t,r),f=P(t),d=P(t);if(e.write(`const ${f} = ${n}.trim();`),e.write(`const ${d} = ${u}(${f}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=T(t,ei);e.write(`if (!${b}(${d}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=T(t,ti);e.write(`if (!${b}(${d}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let m=P(t),g=s.normalize?`${d}.href`:`${T(t,on)}(${f})`;return e.write(`const ${m} = ${g};`),m}let a=r.fn;if(a){if(Tt(a))throw new E(`async string format ${i}`);let u=T(t,a);return e.write(`if (!${u}(${n})) return INVALID;`),n}if(tb.has(i)&&r.pattern){let u=T(t,r.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${n})) return INVALID;`),n}let c=r.format;switch(c){case"regex":throw new E("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${he(r.includes)})) return INVALID;`);break;case"starts_with":{let u=r.prefix;e.write(`if (${n}.slice(0, ${u.length}) !== ${he(u)}) return INVALID;`);break}case"ends_with":{let u=r.suffix;e.write(`if (${n}.slice(-${u.length}) !== ${he(u)}) return INVALID;`);break}default:throw new E(`string format ${c}`)}return n}function Q(e,t,r,n,o=!0){let i=r._zod.def,s=i.type;if(i.coerce)throw new E(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=rb(e,t,r,n,a);break;case"number":c=nb(e,r,n);break;case"boolean":c=ob(e,n);break;case"bigint":c=ib(e,r,n);break;case"symbol":c=sb(e,n);break;case"undefined":c=ab(e,n);break;case"null":c=cb(e,n);break;case"any":case"unknown":c=n;break;case"never":e.write("return INVALID;"),c=n;break;case"void":c=ub(e,n);break;case"nan":c=lb(e,n);break;case"date":c=pb(e,n);break;case"object":c=fb(e,t,r,n,a);break;case"optional":c=db(e,t,r,n,a);break;case"nullable":c=gb(e,t,r,n,a);break;case"array":c=yb(e,t,r,n,a);break;case"literal":c=bb(e,t,r,n);break;case"enum":c=_b(e,t,r,n);break;case"readonly":{let u=Zm(e,t,r,n),l=P(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Zm(e,t,r,n),c="true";break;case"default":case"prefault":c=$b(e,t,r,n);break;case"nonoptional":c=xb(e,t,r,n);break;case"tuple":c=wb(e,t,r,n);break;case"union":c=zb(e,t,r,n);break;case"intersection":c=Sb(e,t,r,n);break;case"record":c=Pb(e,t,r,n);break;case"map":c=Tb(e,t,r,n);break;case"set":c=Ob(e,t,r,n);break;case"file":c=Ab(e,n);break;case"template_literal":c=Cb(e,t,r,n);break;case"lazy":c=Rb(e,t,r,n);break;case"pipe":c=Eb(e,t,r,n);break;case"custom":c=Nb(e,t,r,n);break;case"transform":c=jb(e,t,r,n);break;case"catch":c=Db(e,t,r,n);break;default:throw new E(`schema type ${s}`)}return c===null?null:Hy(e,t,r,c)}function rb(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Um(e,t,i,n,o)}function nb(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Lm(e,{format:n.format},r),r}function ob(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function ib(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function sb(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function ab(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function cb(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function ub(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function lb(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function pb(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function fb(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=$=>typeof $=="symbol"?T(t,$):he($),f=$=>typeof $=="symbol"?`[${l($)}]`:he($),d=s;if(a.includes("__proto__"))throw new E('object shape key "__proto__"');let m=new Map;for(let $ of u){let S=d[$],N=l($),G=P(t);if(e.write(`const ${G} = ${n}[${N}];`),S._zod.optin!==void 0){let Z=P(t);e.write(`let ${Z} = (() => {`),e.indented(fe=>{let Ur=de(fe,t,S,G);fe.write(`return ${Ur};`)}),e.write("})();"),S._zod.optout==="optional"?(e.write(`if (${Z} === INVALID) {`),e.indented(fe=>{fe.write(`if (${N} in ${n}) return INVALID;`),fe.write(`${Z} = undefined;`)}),e.write("}")):e.write(`if (${Z} === INVALID) return INVALID;`),m.set($,Z)}else{hb(S)&&e.write(`if (!(${N} in ${n})) return INVALID;`);let Z=de(e,t,S,G,o);Z!==null&&m.set($,Z)}}let g=i.catchall,b="none";if(g){let $=g._zod.def.type;if($==="never"){let S=a.map(N=>`k !== ${he(N)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(N=>{N.write(`if (${S}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let x=P(t),I=u.some($=>Nm(d[$])||gl(d[$]));if(!o){if(b==="schema"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(S=>{S.write('if (k === "__proto__") continue;'),$&&S.write(`if (${$}.has(k)) continue;`);let N=P(t);S.write(`const ${N} = ${n}[k];`),de(S,t,g,N,!1)}),e.write("}")}return null}if(I){e.write(`const ${x} = {};`);for(let $ of u){let S=l($),N=m.get($);gl(d[$])?e.write(`if (${S} in ${n}) ${x}[${S}] = ${N};`):Nm(d[$])?e.write(`if (${N} !== undefined || ${S} in ${n}) ${x}[${S}] = ${N};`):e.write(`${x}[${S}] = ${N};`)}}else{let $=u.map(S=>`${f(S)}: ${m.get(S)}`).join(", ");e.write(`const ${x} = { ${$} };`)}if(b!=="none"){let $=a.length>0?T(t,new Set(a)):null;e.write(`for (const k in ${n}) {`),e.indented(S=>{if(S.write('if (k === "__proto__") continue;'),$&&S.write(`if (${$}.has(k)) continue;`),b==="passthrough")S.write(`${x}[k] = ${n}[k];`);else{let N=P(t);S.write(`const ${N} = ${n}[k];`);let G=de(S,t,g,N);S.write(`${x}[k] = ${G};`)}}),e.write("}")}return x}function db(e,t,r,n,o=!0){let i=r._zod.def;if(mb(r))return Q(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let a=P(t),c=P(t);return e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=Q(l,t,i.innerType,n);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=Q(u,t,i.innerType,n);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?P(t):null;return s&&e.write(`let ${s};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function mb(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function hb(e){return e._zod.optin===void 0&&Pt(e)}function Pt(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Pt(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Pt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Pt):!0;case"intersection":return!t.left||!t.right?!0:Pt(t.left)&&Pt(t.right);case"pipe":return t.in?Pt(t.in):!0;default:return!0}}function gl(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Nm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&br(e)}function br(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?br(t.innerType):!0;case"union":return t.options?t.options.some(br):!0;case"intersection":return!t.left||!t.right||br(t.left)||br(t.right);case"pipe":return t.out?br(t.out):!0;default:return!0}}function gb(e,t,r,n,o=!0){let i=r._zod.def,s=o?P(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${n} !== null) {`),e.indented(a=>{let c=Q(a,t,i.innerType,n,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function bl(e,t,r){for(let[n,o]of or(t._zod.def.checks))e.write(`if (${r} > ${ot(n,o._zod.def.check)}) return INVALID;`)}function yb(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`),bl(e,r,`${n}.length`);let s=o?P(t):null,a=P(t),c=P(t);return s&&e.write(`const ${s} = new Array(${n}.length);`),e.write(`for (let ${a} = 0; ${a} < ${n}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${n}[${a}];`);let l=de(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function bb(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=T(t,new Set(i));return e.write(`if (!${a}.has(${n})) return INVALID;`),n}if(typeof s=="string")e.write(`if (${n} !== ${he(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${n} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${n} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${n} !== ${s}n) return INVALID;`);else throw new E(`literal type ${typeof s}`);return n}function _b(e,t,r,n){let o=r._zod.values;if(!o)throw new E("enum schema without enumerated values");let i=T(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function Zm(e,t,r,n){let o=r._zod.def;return Q(e,t,o.innerType,n)}function $b(e,t,r,n){let o=r._zod.def,s=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!s)return Q(e,t,o.innerType,n);let c=T(t,s),u=P(t);return e.write(`let ${u} = ${n};`),e.write(`if (${n} === undefined) ${u} = ${c}();`),Q(e,t,o.innerType,u)}let a=P(t);if(s){let c=T(t,s),u=T(t,Fr);e.write(`let ${a};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=Q(l,t,o.innerType,n);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let u=Q(c,t,o.innerType,n);c.write(`${a} = ${u};`)}),e.write("}");return a}function xb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.innerType,n),s=P(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function wb(e,t,r,n){let o=r._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let a=Dm(i,"optin"),c=Dm(i,"optout");s?e.write(`if (${n}.length < ${a}) return INVALID;`):e.write(`if (${n}.length < ${a} || ${n}.length > ${i.length}) return INVALID;`);let u=P(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(d=>{d.write(`if (${l} < ${n}.length) {`),d.indented(m=>{let g=P(t);m.write(`const ${g} = ${n}[${l}];`);let b=de(m,t,f,g);m.write(`${u}[${l}] = ${b};`)}),d.write("} else {"),d.indented(m=>{if(gl(f)){m.write(`${u}.length = ${l};`);return}let g=P(t),b=P(t);m.write(`const ${g} = undefined;`),m.write(`const ${b} = (() => {`),m.indented(x=>{let I=de(x,t,f,g);x.write(`return ${I};`)}),m.write("})();"),m.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=P(t);e.write(`const ${d} = ${n}[${l}];`);let m=de(e,t,f,d);e.write(`${u}[${l}] = ${m};`)}}if(s){let l=P(t),f=P(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${n}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${f} = ${n}[${l}];`);let m=de(d,t,s,f);d.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function Dm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function zb(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return vb(e,t,o,n);if(o.inclusive===!1)throw new E("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return Q(e,t,i[0],n);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=T(t,c);return e.write(`if (!${u}.has(${n})) return INVALID;`),n}let a=P(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=Q(l,t,u,n);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function vb(e,t,r,n){if(r.unionFallback)throw new E("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=P(t),i=P(t);e.write(`const ${o} = ${n}?.[${he(r.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of r.options){let u=c._zod.propValues?.[r.discriminator];if(!u||u.size===0)throw new E("discriminated union option without static discriminator values");for(let d of u){if(a.has(d))throw new E(`duplicate discriminator value ${String(d)}`);a.add(d)}let l=Array.from(u,d=>kb(t,o,d)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(d=>{let m=Q(d,t,c,n);d.write(`${i} = ${m};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function kb(e,t,r){if(typeof r=="string")return`${t} === ${he(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=T(e,r);return`${t} === ${n}`}throw new E(`literal discriminator value ${String(r)}`)}function Sb(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=de(e,t,o.left,n),s=de(e,t,o.right,n),a=T(t,dr),c=P(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Pb(e,t,r,n){let o=r._zod.def,i=T(t,Te);e.write(`if (!${i}(${n})) return INVALID;`);let s=P(t),a=P(t),c=P(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let m=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new E(`record key value ${String(b)}`);let x=typeof b=="number"?b.toString():b;if(x==="__proto__")throw new E('record key "__proto__"');m.push(x);let I=T(t,b),$=Q(e,t,o.keyType,I),S=P(t);e.write(`const ${S} = ${n}[${Ib(t,x)}];`);let N=de(e,t,o.valueType,S);e.write(`${s}[${$}] = ${N};`)}let g=T(t,new Set(m));return e.write(`for (const ${a} in ${n}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${n}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let m=o.mode==="loose",g=ki(o.keyType);g.definite===!1&&(t.definite=!1);let b=T(t,g),x=T(t,He),I=P(t);return jm(e,t,n,a,$=>{$.write(`let ${I} = ${b}(${a});`),$.write(`if (${I} === INVALID && typeof ${a} === "string" && ${x}.test(${a})) ${I} = ${b}(Number(${a}));`),m?$.write(`if (${I} === INVALID) { ${s}[${a}] = ${n}[${a}]; continue; }`):$.write(`if (${I} === INVALID) return INVALID;`),$.write(`if (${I} === "__proto__") continue;`);let S=P(t);$.write(`const ${S} = ${n}[${a}];`);let N=de($,t,o.valueType,S);$.write(`${s}[${I}] = ${N};`)}),s}return jm(e,t,n,a,m=>{m.write(`const ${c} = ${n}[${a}];`);let g=de(m,t,o.valueType,c);m.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function jm(e,t,r,n,o,i){let s=T(t,Object.prototype.propertyIsEnumerable),a=P(t),c=P(t),u=P(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${c} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${c}[${u}];`),l.write(`if (${n} === "__proto__" || !${s}.call(${r}, ${n})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${n} = ${a}[${u}];`),l.write(`if (!${s}.call(${r}, ${n})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Ib(e,t){return typeof t=="string"?he(t):T(e,t)}function Tb(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`),bl(e,r,`${n}.size`);let i=P(t),s=P(t),a=P(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${n}) {`),e.indented(c=>{let u=Q(c,t,o.keyType,s),l=Q(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Ob(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`),bl(e,r,`${n}.size`);let i=P(t),s=P(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${n}) {`),e.indented(a=>{let c=Q(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Ab(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Cb(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=T(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function Rb(e,t,r,n){let o=r._zod.def,i=It(t,o.getter),s=T(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=P(t);return e.write(`const ${a} = ${s}.parser(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Eb(e,t,r,n){let o=r._zod.def,i=Q(e,t,o.in,n);if(o.transform){if(Tt(o.transform))throw new Ae("z.compile: async transforms in pipes are not supported");let s=o.transform,c=It(t,l=>{let f={value:l,issues:[],addIssue:yl},d=s(l,f);return d instanceof Promise?me:f.issues.length===0?d:me}),u=P(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),Q(e,t,o.out,u)}else return Q(e,t,o.out,i)}function Tt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Nb(e,t,r,n){let o=r._zod.def;if(o.fn){if(Tt(o.fn))throw new Ae("z.compile: async custom predicates are not supported");let i=It(t,o.fn),s=T(t,hl),a=P(t);e.write(`const ${a} = ${i}(${n});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new E("custom schema without a predicate function");return n}function Zb(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return me;let o=n;return o.issues.length===0?o.value:t()}function Db(e,t,r,n){let o=r._zod.def;if(!o.catchValue[ko])throw new E("catch with a callback (only a constant catch value compiles)",!1);let i=P(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=de(u,t,o.innerType,n);u.write(`return ${l};`)}),e.write("})();");let s=T(t,o.innerType),a=It(t,o.catchValue),c=T(t,Zb);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${n});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function jb(e,t,r,n){let o=r._zod.def;if(o.transform){if(Tt(o.transform))throw new Ae("z.compile: async transforms are not supported");let i=o.transform,a=It(t,u=>{let l={value:u,issues:[],addIssue:yl},f=i(u,l);return f instanceof Promise?me:l.issues.length===0?f:me}),c=P(t);return e.write(`const ${c} = ${a}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return n}var me,Em,Ae,E,qy,tb,Vm=D(()=>{rt();Jo();pl();vt();mr();ee();me=Symbol.for("zod.compile.invalid"),Em=Symbol.for("zod.compile.fallback"),Ae=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},E=class extends Error{constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};qy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);tb=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"])});function Si(e){return e.checks&&(e.checks=[...e.checks]),e}function _l(e,t){return new e(Si({type:"string",..._(t)}))}function $l(e,t){return new e(Si({type:"string",coerce:!0,..._(t)}))}function Pi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Ii(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function bn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Ri(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function Ei(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function Ni(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Zi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Di(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function ji(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Mi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Li(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Ui(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function xl(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Vi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Fi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function qi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Hi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Bi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function wl(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function zl(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Ji(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function _n(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function $n(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function xn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function wn(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function vl(e,t){return new e(Si({type:"number",checks:[],..._(t)}))}function kl(e,t){return new e(Si({type:"number",coerce:!0,checks:[],..._(t)}))}function Sl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Pl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Il(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Tl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function Ol(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function Al(e,t){return new e({type:"boolean",..._(t)})}function Cl(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function Rl(e,t){return new e({type:"bigint",..._(t)})}function El(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function Nl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function Zl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function Dl(e,t){return new e({type:"symbol",..._(t)})}function jl(e,t){return new e({type:"undefined",..._(t)})}function Ml(e,t){return new e({type:"null",..._(t)})}function Ll(e){return new e({type:"any"})}function Ul(e){return new e({type:"unknown"})}function Vl(e,t){return new e({type:"never",..._(t)})}function Fl(e,t){return new e({type:"void",..._(t)})}function ql(e,t){return new e({type:"date",..._(t)})}function Hl(e,t){return new e({type:"date",coerce:!0,..._(t)})}function Bl(e,t){return new e({type:"nan",..._(t)})}function Ze(e,t){return new qo({check:"less_than",..._(t),value:e,inclusive:!1})}function ve(e,t){return new qo({check:"less_than",..._(t),value:e,inclusive:!0})}function De(e,t){return new Ho({check:"greater_than",..._(t),value:e,inclusive:!1})}function ke(e,t){return new Ho({check:"greater_than",..._(t),value:e,inclusive:!0})}function zn(e){return De(0,e)}function vn(e){return Ze(0,e)}function kn(e){return ve(0,e)}function Sn(e){return ke(0,e)}function Be(e,t){return new Tc({check:"multiple_of",..._(t),value:e})}function Je(e,t){return new Cc({check:"max_size",..._(t),maximum:e})}function je(e,t){return new Rc({check:"min_size",..._(t),minimum:e})}function it(e,t){return new Ec({check:"size_equals",..._(t),size:e})}function st(e,t){return new Nc({check:"max_length",..._(t),maximum:e})}function Ue(e,t){return new Zc({check:"min_length",..._(t),minimum:e})}function at(e,t){return new Dc({check:"length_equals",..._(t),length:e})}function Ot(e,t){return new jc({check:"string_format",format:"regex",..._(t),pattern:e})}function At(e){return new Mc({check:"string_format",format:"lowercase",..._(e)})}function Ct(e){return new Lc({check:"string_format",format:"uppercase",..._(e)})}function Rt(e,t){return new Uc({check:"string_format",format:"includes",..._(t),includes:e})}function Et(e,t){return new Vc({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Nt(e,t){return new Fc({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Pn(e,t,r){return new qc({check:"property",property:e,schema:t,..._(r)})}function Zt(e,t){return new Hc({check:"properties",shape:e,..._(t)})}function Dt(e,t){return new Bc({check:"mime_type",mime:e,..._(t)})}function Ce(e){return new Jc({check:"overwrite",tx:e})}function jt(e){return Ce(t=>t.normalize(e))}function Mt(){return Ce(e=>e.trim())}function Lt(){return Ce(e=>e.toLowerCase())}function Ut(){return Ce(e=>e.toUpperCase())}function Vt(){return Ce(e=>Aa(e))}function Jl(e,t,r){return new e({type:"array",element:t,..._(r)})}function Mb(e,t,r){return new e({type:"union",options:t,..._(r)})}function Lb(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}function Ub(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}function Vb(e,t,r){return new e({type:"intersection",left:t,right:r})}function Fb(e,t,r,n){let o=r instanceof O,i=o?n:r,s=o?r:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function qb(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}function Hb(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}function Bb(e,t,r){return new e({type:"set",valueType:t,..._(r)})}function Jb(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}function Kb(e,t,r){return new e({type:"enum",entries:t,..._(r)})}function Wb(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}function Kl(e,t){return new e({type:"file",..._(t)})}function Gb(e,t){return new e({type:"transform",transform:t})}function Qb(e,t){return new e({type:"optional",innerType:t})}function Yb(e,t){return new e({type:"nullable",innerType:t})}function Xb(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Fr(r)}})}function e_(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}function t_(e,t){return new e({type:"success",innerType:t})}function r_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:ja(r)})}function n_(e,t,r){return new e({type:"pipe",in:t,out:r})}function o_(e,t){return new e({type:"readonly",innerType:t})}function i_(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}function s_(e,t){return new e({type:"lazy",getter:t})}function a_(e,t){return new e({type:"promise",innerType:t})}function Wl(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Gl(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}function Ql(e,t){let r=Fm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ir(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ir(i))}},e(n.value,n)),t);return r}function Fm(e,t){let r=new W({check:"custom",..._(t)});return r._zod.check=e,r}function Yl(e){let t=new W({check:"describe"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function Xl(e){let t=new W({check:"meta"});return t._zod.onattach=[r=>{let n=ie.get(r)??{};ie.add(r,{...n,...e})}],t._zod.check=()=>{},t}function ep(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),s=new Set(o),a=e.Codec??pn,c=e.Boolean??un,u=e.String??St,l=new u({type:"string",error:r.error}),f=new c({type:"boolean",error:r.error}),d=new a({type:"pipe",in:l,out:f,transform:((m,g)=>{let b=m;return r.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:d,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}function Ft(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:a=>r.test(a),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}var Ki,qm=D(()=>{Bo();gn();mr();ee();Ki={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function In(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&ce(e,n,r[n]);return e}function ct(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ie,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 te(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function F(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),F(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&In(s.schema,c),t.io==="input"&&ye(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Hm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ut(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Hm(m)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Hm(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
719
|
+
|
|
720
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Km(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Km(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function Jm(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function tp(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Wm.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Jm(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:tp(a)??{allOf:a};ce(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Jm(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function c_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Wm)if(o in e)return;let r=t.filter(o=>Bm.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=tp(t);else{let o=r[0],i=Bm.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>tp([...s,c]));if(a.some(c=>!c))return;n={[i]:a}}n&&(delete e.allOf,In(e,n))}function lt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){n(f);let m=e.seen.get(f),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):In(u,g),In(u,l),a._zod.parent===f)for(let x in u)x==="$ref"||x==="allOf"||x in l||delete u[x];if(g.$ref&&m.def)for(let x in u)x==="$ref"||x==="allOf"||x in m.def&&JSON.stringify(u[x])===JSON.stringify(m.def[x])&&delete u[x]}let d=a._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Km(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 f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])c_(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}In(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,ce(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:_r(t,"input",e.processors),output:_r(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return ye(n.element,r);if(n.type==="set")return ye(n.valueType,r);if(n.type==="lazy")return ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return ye(n.innerType,r);if(n.type==="intersection")return ye(n.left,r)||ye(n.right,r);if(n.type==="record"||n.type==="map")return ye(n.keyType,r)||ye(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ye(n.in,r)||ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(ye(o,r))return!0;return!!(n.rest&&ye(n.rest,r))}return!1}var Wm,Bm,rp,_r,Tn=D(()=>{gn();ee();Wm=new Set(["type","properties","required","additionalProperties"]),Bm=["oneOf","anyOf"];rp=(e,t={})=>r=>{let n=ct({...r,processors:t});return F(e,n),ut(n,e),lt(n,e)},_r=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=ct({...o??{},target:i,io:t,processors:r});return F(e,s),ut(s,e),lt(s,e)}});function re(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)u_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&$r(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&$r(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&xr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&xr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&eh(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&rh(t,o.mime);for(let i of o.patterns??[])th(t,i);return t}function On(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?On(t.out):t.type==="catch"?On(t.innerType):e._zod.optin}function np(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let b=np(e,g,r);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let x=b.map(I=>np(e,I,r));x.some((I,$)=>I!==b[$])&&(t={...t,[g]:x})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?He:en).source)),m}function f_(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of op.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=np(t,i,new Set);s!==i&&r.set(i,s)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}function ih(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(te(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Np):JSON.parse(s)}function An(e,t){if("_idmap"in e){let n=e,o=ct({...t,processors:Wi}),i={};for(let c of n._idmap.entries()){let[u,l]=c;F(l,o)}let s={},a={registry:n,uri:t?.uri,defs:i};o.external=a;for(let c of n._idmap.entries()){let[u,l]=c;ut(o,l),ce(s,u,lt(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let r=ct({...t,processors:Wi});return F(e,r),ut(r,e),lt(r,e)}var $r,xr,Gm,eh,th,rh,nh,Qm,Ym,Xm,u_,l_,p_,oh,ip,sp,ap,cp,up,lp,pp,fp,dp,mp,hp,gp,yp,bp,_p,$p,xp,wp,zp,vp,kp,Sp,Pp,Ip,Tp,Gi,Op,Ap,op,Cp,Rp,Ep,Np,Zp,Dp,jp,Mp,Lp,Up,Qi,Vp,Wi,Cn=D(()=>{vt();mr();Tn();ee();$r=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},xr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Gm=(e,t)=>{$r(e,"minimum",t),xr(e,"maximum",t)},eh=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},th=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},rh=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},nh=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Qm=(e,t)=>$r(e,"minimum",t.minimum),Ym=(e,t)=>xr(e,"maximum",t.maximum),Xm=e=>(t,r)=>{nh(t,r.format);let[n,o]=e[r.format];$r(t,"minimum",n),xr(t,"maximum",o)},u_={greater_than:(e,t)=>$r(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>eh(e,t.value),number_format:Xm(Hr),bigint_format:Xm(Br),min_length:Qm,max_length:Ym,length_equals:(e,t)=>Gm(e,t.length),min_size:Qm,max_size:Ym,size_equals:(e,t)=>Gm(e,t.size),string_format:(e,t)=>{nh(e,t.format),t.pattern&&th(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>rh(e,t.mime)};l_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},p_=new Map([[ni,uc],[cn,lc]]),oh=e=>p_.get(e)??e,ip=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=re(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=l_[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(oh);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},sp=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=re(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let I of a)Number.isFinite(I)&&I!==0?g.add(Math.abs(I)):te(e,t,o,n,`A multipleOf divisor of ${I} cannot be represented in JSON Schema`);let[b,...x]=g;b!==void 0&&(o.multipleOf=b),x.length&&(o.allOf=[...o.allOf??[],...x.map(I=>({multipleOf:I}))])}},ap=(e,t,r,n)=>{r.type="boolean"},cp=(e,t,r,n)=>{te(e,t,r,n,"BigInt cannot be represented in JSON Schema")},up=(e,t,r,n)=>{te(e,t,r,n,"Symbols cannot be represented in JSON Schema")},lp=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},pp=(e,t,r,n)=>{te(e,t,r,n,"Undefined cannot be represented in JSON Schema")},fp=(e,t,r,n)=>{te(e,t,r,n,"Void cannot be represented in JSON Schema")},dp=(e,t,r,n)=>{r.not={}},mp=(e,t,r,n)=>{},hp=(e,t,r,n)=>{},gp=(e,t,r,n)=>{te(e,t,r,n,"Date cannot be represented in JSON Schema")},yp=(e,t,r,n)=>{let o=e._zod.def,i=er(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},bp=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(te(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(te(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},_p=(e,t,r,n)=>{te(e,t,r,n,"NaN cannot be represented in JSON Schema")},$p=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},xp=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=re(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},wp=(e,t,r,n)=>{r.type="boolean"},zp=(e,t,r,n)=>{te(e,t,r,n,"Custom types cannot be represented in JSON Schema")},vp=(e,t,r,n)=>{te(e,t,r,n,"Function types cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{te(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Sp=(e,t,r,n)=>{te(e,t,r,n,"Map cannot be represented in JSON Schema")},Pp=(e,t,r,n)=>{te(e,t,r,n,"Set cannot be represented in JSON Schema")},Ip=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=re(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=F(i.element,t,{...n,path:[...n.path,"items"]})};Tp=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&te(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)ce(o.properties,u,F(s[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?On(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=F(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Gi=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>F(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=s:r.anyOf=s},Op=(e,t,r,n)=>{let o=e._zod.def,i=F(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=F(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},Ap=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((b,x)=>F(b,t,{...n,path:[...n.path,s,x]})),u=i.rest?F(i.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?On(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,d?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):(o.items=c,d?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),d&&(o.maxItems=f));let{minimum:m,maximum:g}=re(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)};op=new WeakMap;Cp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,a=re(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=F(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)ce(o.patternProperties,oh(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=F(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=op.get(t);l||(l=[],op.set(t,l),t.deferred.push(()=>f_(t))),l.push(e)}o.additionalProperties=F(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&On(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},Rp=(e,t,r,n)=>{let o=e._zod.def,i=F(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Ep=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Np=Symbol();Zp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=ih(o.defaultValue,e,t,r,n);s!==Np&&(r.default=s)},Dp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=ih(o.defaultValue,e,t,r,n);s!==Np&&(r._prefault=s)},jp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{te(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Mp=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;F(s,t,n);let a=t.seen.get(e);a.ref=s},Lp=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Up=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Qi=(e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Vp=(e,t,r,n)=>{let o=e._zod.innerType;F(o,t,n);let i=t.seen.get(e);i.ref=o},Wi={string:ip,number:sp,boolean:ap,bigint:cp,symbol:up,null:lp,undefined:pp,void:fp,never:dp,any:mp,unknown:hp,date:gp,enum:yp,literal:bp,nan:_p,template_literal:$p,file:xp,success:wp,custom:zp,function:vp,transform:kp,map:Sp,set:Pp,array:Ip,object:Tp,union:Gi,intersection:Op,tuple:Ap,record:Cp,nullable:Rp,nonoptional:Ep,default:Zp,prefault:Dp,catch:jp,pipe:Mp,readonly:Lp,promise:Up,optional:Qi,lazy:Vp}});var Yi,sh=D(()=>{Cn();Tn();Yi=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ct({processors:Wi,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return F(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ut(this.ctx,t);let n=lt(this.ctx,t),{"~standard":o,...i}=n;return i}}});var ah={};var ch=D(()=>{});var Ve={};Le(Ve,{$ZodAny:()=>Au,$ZodArray:()=>Du,$ZodAsyncError:()=>we,$ZodBase64:()=>_u,$ZodBase64URL:()=>$u,$ZodBigInt:()=>ui,$ZodBigIntFormat:()=>Pu,$ZodBoolean:()=>un,$ZodCIDRv4:()=>yu,$ZodCIDRv6:()=>bu,$ZodCUID:()=>iu,$ZodCUID2:()=>su,$ZodCatch:()=>tl,$ZodCheck:()=>W,$ZodCheckBigIntFormat:()=>Ac,$ZodCheckEndsWith:()=>Fc,$ZodCheckGreaterThan:()=>Ho,$ZodCheckIncludes:()=>Uc,$ZodCheckLengthEquals:()=>Dc,$ZodCheckLessThan:()=>qo,$ZodCheckLowerCase:()=>Mc,$ZodCheckMaxLength:()=>Nc,$ZodCheckMaxSize:()=>Cc,$ZodCheckMimeType:()=>Bc,$ZodCheckMinLength:()=>Zc,$ZodCheckMinSize:()=>Rc,$ZodCheckMultipleOf:()=>Tc,$ZodCheckNumberFormat:()=>Oc,$ZodCheckOverwrite:()=>Jc,$ZodCheckProperties:()=>Hc,$ZodCheckProperty:()=>qc,$ZodCheckRegex:()=>jc,$ZodCheckSizeEquals:()=>Ec,$ZodCheckStartsWith:()=>Vc,$ZodCheckStringFormat:()=>fr,$ZodCheckUpperCase:()=>Lc,$ZodCodec:()=>pn,$ZodCreditCard:()=>wu,$ZodCustom:()=>cl,$ZodCustomStringFormat:()=>ku,$ZodCyclicError:()=>yi,$ZodDate:()=>Nu,$ZodDefault:()=>Qu,$ZodDiscriminatedUnion:()=>Lu,$ZodE164:()=>xu,$ZodEmail:()=>Xc,$ZodEmoji:()=>nu,$ZodEncodeError:()=>nt,$ZodEnum:()=>Hu,$ZodError:()=>Va,$ZodExactOptional:()=>Wu,$ZodFile:()=>Ju,$ZodFunction:()=>sl,$ZodGUID:()=>Qc,$ZodIBAN:()=>zu,$ZodIPv4:()=>mu,$ZodIPv6:()=>hu,$ZodISODate:()=>pu,$ZodISODateTime:()=>lu,$ZodISODuration:()=>du,$ZodISOTime:()=>fu,$ZodIntersection:()=>Uu,$ZodJWT:()=>vu,$ZodKSUID:()=>uu,$ZodLazy:()=>fn,$ZodLiteral:()=>Bu,$ZodMAC:()=>gu,$ZodMap:()=>Fu,$ZodNaN:()=>rl,$ZodNanoID:()=>ou,$ZodNever:()=>Ru,$ZodNonOptional:()=>Xu,$ZodNull:()=>Ou,$ZodNullable:()=>Gu,$ZodNumber:()=>ci,$ZodNumberFormat:()=>Su,$ZodObject:()=>Pm,$ZodObjectJIT:()=>ju,$ZodOptional:()=>fi,$ZodPipe:()=>di,$ZodPrefault:()=>Yu,$ZodPreprocess:()=>nl,$ZodPromise:()=>al,$ZodReadonly:()=>ol,$ZodRealError:()=>ze,$ZodRecord:()=>Vu,$ZodRegistry:()=>xi,$ZodSet:()=>qu,$ZodString:()=>St,$ZodStringFormat:()=>V,$ZodSuccess:()=>el,$ZodSymbol:()=>Iu,$ZodTemplateLiteral:()=>il,$ZodTransform:()=>Ku,$ZodTuple:()=>pi,$ZodType:()=>O,$ZodULID:()=>au,$ZodURL:()=>ru,$ZodUUID:()=>Yc,$ZodUndefined:()=>Tu,$ZodUnion:()=>ln,$ZodUnknown:()=>Cu,$ZodVoid:()=>Eu,$ZodXID:()=>cu,$ZodXor:()=>Mu,$brand:()=>Po,$constructor:()=>h,$input:()=>zi,$output:()=>wi,Doc:()=>kt,INVALID:()=>me,JSONSchema:()=>ah,JSONSchemaGenerator:()=>Yi,NEVER:()=>So,TimePrecision:()=>Ki,URL_BAD_FORMAT:()=>eu,URL_UNPARSEABLE:()=>nn,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>E,_any:()=>Ll,_array:()=>Jl,_base64:()=>qi,_base64url:()=>Hi,_bigint:()=>Rl,_boolean:()=>Al,_catch:()=>r_,_check:()=>Fm,_cidrv4:()=>Vi,_cidrv6:()=>Fi,_coercedBigint:()=>El,_coercedBoolean:()=>Cl,_coercedDate:()=>Hl,_coercedNumber:()=>kl,_coercedString:()=>$l,_creditCard:()=>wl,_cuid:()=>Ni,_cuid2:()=>Zi,_custom:()=>Wl,_date:()=>ql,_decode:()=>Ro,_decodeAsync:()=>No,_default:()=>Xb,_discriminatedUnion:()=>Ub,_e164:()=>Bi,_email:()=>Pi,_emoji:()=>Ri,_encode:()=>Co,_encodeAsync:()=>Eo,_endsWith:()=>Nt,_enum:()=>Jb,_file:()=>Kl,_float32:()=>Pl,_float64:()=>Il,_gt:()=>De,_gte:()=>ke,_guid:()=>Ii,_iban:()=>zl,_includes:()=>Rt,_int:()=>Sl,_int32:()=>Tl,_int64:()=>Nl,_intersection:()=>Vb,_ipv4:()=>Li,_ipv6:()=>Ui,_isoDate:()=>$n,_isoDateTime:()=>_n,_isoDuration:()=>wn,_isoTime:()=>xn,_jwt:()=>Ji,_ksuid:()=>Mi,_lazy:()=>s_,_length:()=>at,_literal:()=>Wb,_lowercase:()=>At,_lt:()=>Ze,_lte:()=>ve,_mac:()=>xl,_map:()=>Hb,_max:()=>ve,_maxLength:()=>st,_maxSize:()=>Je,_mime:()=>Dt,_min:()=>ke,_minLength:()=>Ue,_minSize:()=>je,_multipleOf:()=>Be,_nan:()=>Bl,_nanoid:()=>Ei,_nativeEnum:()=>Kb,_negative:()=>vn,_never:()=>Vl,_nonnegative:()=>Sn,_nonoptional:()=>e_,_nonpositive:()=>kn,_normalize:()=>jt,_null:()=>Ml,_nullable:()=>Yb,_number:()=>vl,_optional:()=>Qb,_overwrite:()=>Ce,_parse:()=>cr,_parseAsync:()=>ur,_pipe:()=>n_,_positive:()=>zn,_promise:()=>a_,_properties:()=>Zt,_property:()=>Pn,_readonly:()=>o_,_record:()=>qb,_refine:()=>Gl,_regex:()=>Ot,_safeDecode:()=>Do,_safeDecodeAsync:()=>Mo,_safeEncode:()=>Zo,_safeEncodeAsync:()=>jo,_safeParse:()=>lr,_safeParseAsync:()=>pr,_set:()=>Bb,_size:()=>it,_slugify:()=>Vt,_startsWith:()=>Et,_string:()=>_l,_stringFormat:()=>Ft,_stringbool:()=>ep,_success:()=>t_,_superRefine:()=>Ql,_symbol:()=>Dl,_templateLiteral:()=>i_,_toLowerCase:()=>Lt,_toUpperCase:()=>Ut,_transform:()=>Gb,_trim:()=>Mt,_tuple:()=>Fb,_uint32:()=>Ol,_uint64:()=>Zl,_ulid:()=>Di,_undefined:()=>jl,_union:()=>Mb,_unknown:()=>Ul,_uppercase:()=>Ct,_url:()=>bn,_uuid:()=>Ti,_uuidv4:()=>Oi,_uuidv6:()=>Ai,_uuidv7:()=>Ci,_void:()=>Fl,_xid:()=>ji,_xor:()=>Lb,base64Charset:()=>ni,base64urlCharset:()=>cn,canParseURL:()=>tu,clone:()=>L,compile:()=>vi,compileFn:()=>ki,config:()=>Y,createStandardJSONSchemaMethod:()=>_r,createToJSONSchemaMethod:()=>rp,decode:()=>Yd,decodeAsync:()=>em,describe:()=>Yl,encode:()=>Qd,encodeAsync:()=>Xd,extractDefs:()=>ut,finalize:()=>lt,flattenError:()=>sr,formatError:()=>ar,getDiscriminatedOption:()=>li,globalConfig:()=>oe,globalRegistry:()=>ie,handleUnrepresentable:()=>te,initializeContext:()=>ct,isBackEdge:()=>_i,isRecursiveSchema:()=>bi,isValidBase64:()=>an,isValidBase64URL:()=>oi,isValidCIDRv6:()=>ri,isValidCreditCard:()=>ii,isValidIBAN:()=>si,isValidIPv6:()=>sn,isValidJWT:()=>ai,locales:()=>yr,memoizer:()=>gr,mergeValues:()=>dr,meta:()=>Xl,parse:()=>Qr,parseAsync:()=>Yr,parseURLObject:()=>vm,prettifyError:()=>To,process:()=>F,processSchema:()=>F,regexes:()=>Pe,registry:()=>hn,safeDecode:()=>rm,safeDecodeAsync:()=>om,safeEncode:()=>tm,safeEncodeAsync:()=>nm,safeParse:()=>Ao,safeParseAsync:()=>qa,standardProps:()=>Yo,stripTabAndNewline:()=>on,toDotPath:()=>Wd,toJSONSchema:()=>An,toZod:()=>Xt,treeifyError:()=>Io,urlHostnameOk:()=>ei,urlProtocolOk:()=>ti,util:()=>v,validate:()=>xt,validateAsync:()=>wt,validateURL:()=>Xo,version:()=>Kc,withParser:()=>yn});var Se=D(()=>{rt();Ha();Fa();mr();pl();Bo();Wc();ee();ee();vt();dl();gn();Jo();Vm();qm();Tn();Cn();sh();ch()});function Rn(e,t){let r=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},n=new Map;function o(s){let a=n.get(s);if(a===uh)return new fn({type:"lazy",getter:()=>n.get(s)});if(a!==void 0)return a;n.set(s,uh);let c=i(s),u=r(c,c!==s);return n.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,d={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),d[g]=b}let m=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(f=!0)),f?L(s,{...a,shape:d,catchall:m}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let m of u){let g=o(m);g!==m&&(l=!0),f.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:d}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let d of u){let m=o(d);m!==d&&(l=!0),f.push(m)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,getter:()=>o(u())})}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":return s;default:return s}}return o(e)}var uh,Fp=D(()=>{mr();ee();uh=Symbol("z.visit/resolving")});var ts={};Le(ts,{endsWith:()=>Nt,gt:()=>De,gte:()=>ke,includes:()=>Rt,length:()=>at,lowercase:()=>At,lt:()=>Ze,lte:()=>ve,maxLength:()=>st,maxSize:()=>Je,mime:()=>Dt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Be,negative:()=>vn,nonnegative:()=>Sn,nonpositive:()=>kn,normalize:()=>jt,overwrite:()=>Ce,positive:()=>zn,properties:()=>Zt,property:()=>Pn,regex:()=>Ot,size:()=>it,slugify:()=>Vt,startsWith:()=>Et,toLowerCase:()=>Lt,toUpperCase:()=>Ut,trim:()=>Mt,uppercase:()=>Ct});var rs=D(()=>{Se()});function ns(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var fh,dh,mh,be,qp=D(()=>{Se();Se();ee();fh=new WeakSet([Object.prototype,Error.prototype]);dh=(e,t)=>{Va.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);fh.has(r)||(fh.add(r),ns(r,"format",n=>o=>ar(n,o)),ns(r,"flatten",n=>o=>sr(n,o)),ns(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,tr,2)}),ns(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,tr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},mh=h("ZodError",dh),be=h("ZodError",dh,void 0,{Parent:Error})});var os,is,ss,as,cs,us,ls,ps,fs,ds,ms,hs,Hp=D(()=>{Se();qp();Se();os=cr(be),is=ur(be),ss=lr(be),as=pr(be),cs=Co(be),us=Ro(be),ls=Eo(be),ps=No(be),fs=Zo(be),ds=Do(be),ms=jo(be),hs=Mo(be)});var Er={};Le(Er,{ZodAny:()=>ws,ZodArray:()=>Ss,ZodBase64:()=>Gn,ZodBase64URL:()=>Qn,ZodBigInt:()=>Gt,ZodBigIntFormat:()=>eo,ZodBoolean:()=>Wt,ZodCIDRv4:()=>Kn,ZodCIDRv6:()=>Wn,ZodCUID:()=>Un,ZodCUID2:()=>Vn,ZodCatch:()=>Hs,ZodCodec:()=>Ar,ZodCreditCard:()=>ys,ZodCustom:()=>Cr,ZodCustomStringFormat:()=>pt,ZodDate:()=>kr,ZodDefault:()=>Ms,ZodDiscriminatedUnion:()=>Is,ZodE164:()=>Yn,ZodEmail:()=>Dn,ZodEmoji:()=>Mn,ZodEnum:()=>Ht,ZodExactOptional:()=>no,ZodFile:()=>Ns,ZodFunction:()=>ta,ZodGUID:()=>jn,ZodIBAN:()=>bs,ZodIPv4:()=>Bn,ZodIPv6:()=>Jn,ZodISODate:()=>We,ZodISODateTime:()=>Ke,ZodISODuration:()=>Qe,ZodISOTime:()=>Ge,ZodInstanceOf:()=>oa,ZodIntersection:()=>Ts,ZodJWT:()=>Xn,ZodKSUID:()=>Hn,ZodLazy:()=>Ys,ZodLiteral:()=>Es,ZodMAC:()=>gs,ZodMap:()=>Cs,ZodNaN:()=>Js,ZodNanoID:()=>Ln,ZodNever:()=>vs,ZodNonOptional:()=>oo,ZodNull:()=>xs,ZodNullable:()=>js,ZodNumber:()=>Kt,ZodNumberFormat:()=>ft,ZodObject:()=>Sr,ZodOptional:()=>Tr,ZodPipe:()=>Or,ZodPrefault:()=>Us,ZodPreprocess:()=>Ks,ZodPromise:()=>ea,ZodReadonly:()=>Ws,ZodRecord:()=>qt,ZodSet:()=>Rs,ZodString:()=>Jt,ZodStringFormat:()=>H,ZodSuccess:()=>qs,ZodSymbol:()=>_s,ZodTemplateLiteral:()=>Qs,ZodTransform:()=>Zs,ZodTuple:()=>Os,ZodType:()=>A,ZodULID:()=>Fn,ZodURL:()=>zr,ZodUUID:()=>Me,ZodUndefined:()=>$s,ZodUnion:()=>Pr,ZodUnknown:()=>zs,ZodVoid:()=>ks,ZodXID:()=>qn,ZodXor:()=>Ps,_ZodString:()=>Zn,_default:()=>Ls,_function:()=>Yf,any:()=>Rf,array:()=>R,base64:()=>df,base64url:()=>mf,bigint:()=>If,boolean:()=>X,catch:()=>Bs,check:()=>Xf,cidrv4:()=>pf,cidrv6:()=>ff,codec:()=>Kf,creditCard:()=>gf,cuid:()=>rf,cuid2:()=>nf,currencyCode:()=>wf,custom:()=>io,date:()=>Nf,describe:()=>ed,discriminatedUnion:()=>Ir,e164:()=>hf,email:()=>Bp,emoji:()=>ef,enum:()=>ae,exactOptional:()=>Ds,file:()=>qf,float32:()=>vf,float64:()=>kf,function:()=>Yf,guid:()=>Jp,hash:()=>zf,hex:()=>xf,hostname:()=>$f,httpUrl:()=>Xp,iban:()=>yf,instanceof:()=>rd,int:()=>En,int32:()=>Sf,int64:()=>Tf,intersection:()=>Qt,invertCodec:()=>Wf,ipv4:()=>cf,ipv6:()=>lf,json:()=>od,jwt:()=>bf,keyof:()=>Zf,ksuid:()=>af,lazy:()=>Xs,literal:()=>k,looseObject:()=>se,looseRecord:()=>Lf,mac:()=>uf,map:()=>Uf,meta:()=>td,nan:()=>Jf,nanoid:()=>tf,nativeEnum:()=>Ff,never:()=>to,nonoptional:()=>Fs,null:()=>vr,nullable:()=>wr,nullish:()=>Hf,number:()=>j,object:()=>z,optional:()=>q,partialRecord:()=>Mf,pipe:()=>Nn,prefault:()=>Vs,preprocess:()=>Rr,promise:()=>Qf,readonly:()=>Gs,record:()=>B,refine:()=>ra,set:()=>Vf,strictObject:()=>Df,string:()=>y,stringFormat:()=>_f,stringbool:()=>nd,success:()=>Bf,superRefine:()=>na,symbol:()=>Af,templateLiteral:()=>Gf,transform:()=>ro,tuple:()=>As,uint32:()=>Pf,uint64:()=>Of,ulid:()=>of,undefined:()=>Cf,union:()=>U,unknown:()=>K,url:()=>Yp,uuid:()=>Kp,uuidv4:()=>Wp,uuidv6:()=>Gp,uuidv7:()=>Qp,void:()=>Ef,xid:()=>sf,xor:()=>jf});function h_(){oe.localeError||Y($i())}function Bt(){oe.memoizer||Y({memoizer:gr()})}function y(e){return _l(Jt,e)}function Bp(e){return Pi(Dn,e)}function Jp(e){return Ii(jn,e)}function Kp(e){return Ti(Me,e)}function Wp(e){return Oi(Me,e)}function Gp(e){return Ai(Me,e)}function Qp(e){return Ci(Me,e)}function Yp(e){return bn(zr,e)}function Xp(e){return bn(zr,{protocol:Xr,hostname:fc,...v.normalizeParams(e)})}function ef(e){return Ri(Mn,e)}function tf(e){return Ei(Ln,e)}function rf(e){return Ni(Un,e)}function nf(e){return Zi(Vn,e)}function of(e){return Di(Fn,e)}function sf(e){return ji(qn,e)}function af(e){return Mi(Hn,e)}function cf(e){return Li(Bn,e)}function uf(e){return xl(gs,e)}function lf(e){return Ui(Jn,e)}function pf(e){return Vi(Kn,e)}function ff(e){return Fi(Wn,e)}function df(e){return qi(Gn,e)}function mf(e){return Hi(Qn,e)}function hf(e){return Bi(Yn,e)}function gf(e){return wl(ys,e)}function yf(e){return zl(bs,e)}function bf(e){return Ji(Xn,e)}function _f(e,t,r={}){return Ft(pt,e,t,r)}function $f(e){return Ft(pt,"hostname",pc,e)}function xf(e){return Ft(pt,"hex",Sc,e)}function wf(e){return Ft(pt,"currency_code",mc,e)}function zf(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Pe[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ft(pt,n,o,t)}function j(e){return vl(Kt,e)}function En(e){return Sl(ft,e)}function vf(e){return Pl(ft,e)}function kf(e){return Il(ft,e)}function Sf(e){return Tl(ft,e)}function Pf(e){return Ol(ft,e)}function X(e){return Al(Wt,e)}function If(e){return Rl(Gt,e)}function Tf(e){return Nl(eo,e)}function Of(e){return Zl(eo,e)}function Af(e){return Dl(_s,e)}function Cf(e){return jl($s,e)}function vr(e){return Ml(xs,e)}function Rf(){return Ll(ws)}function K(){return Ul(zs)}function to(e){return Vl(vs,e)}function Ef(e){return Fl(ks,e)}function Nf(e){return ql(kr,e)}function R(e,t){return Jl(Ss,e,t)}function Zf(e){let t=e._zod.def.shape;return ae(Object.keys(t))}function z(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Sr(r)}function Df(e,t){return new Sr({type:"object",shape:e,catchall:to(),...v.normalizeParams(t)})}function se(e,t){return new Sr({type:"object",shape:e,catchall:K(),...v.normalizeParams(t)})}function U(e,t){return new Pr({type:"union",options:e,...v.normalizeParams(t)})}function jf(e,t){return new Ps({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}function Ir(e,t,r){return new Is({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}function Qt(e,t){return new Ts({type:"intersection",left:e,right:t})}function As(e,t,r){let n=t instanceof O,o=n?r:t,i=n?t:null;return new Os({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}function B(e,t,r){return!t||!t._zod?new qt({type:"record",keyType:y(),valueType:e,...v.normalizeParams(t)}):new qt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}function Mf(e,t,r){return new qt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}function Lf(e,t,r){return new qt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}function Uf(e,t,r){return new Cs({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}function Vf(e,t){return new Rs({type:"set",valueType:e,...v.normalizeParams(t)})}function ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ht({type:"enum",entries:r,...v.normalizeParams(t)})}function Ff(e,t){return new Ht({type:"enum",entries:e,...v.normalizeParams(t)})}function k(e,t){return new Es({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}function qf(e){return Kl(Ns,e)}function ro(e){return new Zs({type:"transform",transform:e})}function q(e){return new Tr({type:"optional",innerType:e})}function Ds(e){return new no({type:"optional",innerType:e})}function wr(e){return new js({type:"nullable",innerType:e})}function Hf(e){return q(wr(e))}function Ls(e,t){return new Ms({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Vs(e,t){return new Us({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}function Fs(e,t){return new oo({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}function Bf(e){return new qs({type:"success",innerType:e})}function Bs(e,t){return new Hs({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}function Jf(e){return Bl(Js,e)}function Nn(e,t){return new Or({type:"pipe",in:e,out:t})}function Kf(e,t,r){return new Ar({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Wf(e){let t=e._zod.def;return new Ar({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function Gs(e){return new Ws({type:"readonly",innerType:e})}function Gf(e,t){return new Qs({type:"template_literal",parts:e,...v.normalizeParams(t)})}function Xs(e){return new Ys({type:"lazy",getter:e})}function Qf(e){return new ea({type:"promise",innerType:e})}function Yf(e){return new ta({type:"function",input:Array.isArray(e?.input)?As(e?.input):e?.input??R(K()),output:e?.output??K()})}function Xf(e){let t=new W({check:"custom"});return t._zod.check=e,t}function io(e,t){return Wl(Cr,e??(()=>!0),t)}function ra(e,t={}){return Gl(Cr,e,t)}function na(e,t){return Ql(e,t)}function rd(e,t={}){let r=new oa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function od(e){let t=Xs(()=>U([y(e),j(),X(),vr(),R(t),B(y(),t)]));return t}function Rr(e,t){return new Ks({type:"pipe",in:ro(e),out:t})}var A,Zn,Jt,H,Ke,We,Ge,Qe,Dn,jn,Me,zr,Mn,Ln,Un,Vn,Fn,qn,Hn,Bn,gs,Jn,Kn,Wn,Gn,Qn,Yn,ys,bs,Xn,pt,Kt,ft,Wt,Gt,eo,_s,$s,xs,ws,zs,vs,ks,kr,Ss,Sr,Pr,Ps,Is,Ts,Os,qt,Cs,Rs,Ht,Es,Ns,Zs,Tr,no,js,Ms,Us,oo,qs,Hs,Js,Or,Ar,Ks,Ws,Qs,Ys,ea,ta,Cr,ed,td,oa,nd,dt=D(()=>{Se();Se();Cn();vt();Tn();fl();rs();Hp();A=h("ZodType",(e,t)=>(h_(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(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 L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ra(e,t))},superRefine(e,t){return this.check(na(e,t))},overwrite(e){return this.check(Ce(e))},optional(){return q(this)},exactOptional(){return Ds(this)},nullable(){return wr(this)},nullish(){return q(wr(this))},nonoptional(e){return Fs(this,e)},array(){return R(this)},or(e){return U([this,e])},and(e){return Qt(this,e)},transform(e){return Nn(this,ro(e))},default(e){return Ls(this,e)},prefault(e){return Vs(this,e)},catch(e){return Bs(this,e)},pipe(e){return Nn(this,e)},readonly(){return Gs(this)},describe(e){let t=this.clone();return ie.add(t,{description:e}),t},meta(...e){if(e.length===0)return ie.get(this);let t=this.clone();return ie.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 v.hide(this,"~standard",{...Yo(this),jsonSchema:{input:_r(this,"input"),output:_r(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:function e(t,r){return os(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await is(this,t,r,{callee:e})},safeParse(e,t){return ss(this,e,t)},async safeParseAsync(e,t){return as(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return xt(this,e,t)},validateAsync(e,t){return wt(this,e,t)},encode:function e(t,r){return cs(this,t,r,{callee:e})},decode:function e(t,r){return us(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ls(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await ps(this,t,r,{callee:e})},safeEncode(e,t){return fs(this,e,t)},safeDecode(e,t){return ds(this,e,t)},async safeEncodeAsync(e,t){return ms(this,e,t)},async safeDecodeAsync(e,t){return hs(this,e,t)},toJSONSchema(e){return rp(this,{})(e)},get description(){return ie.get(this)?.description},get _def(){return this._zod.def}}),Zn=h("_ZodString",(e,t)=>{St.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ip(e,r,n,o)},v.derived({format:e=>re(e).format??null,minLength:e=>re(e).minimum??null,maxLength:e=>re(e).maximum??null},{regex(...e){return this.check(Ot(...e))},includes(...e){return this.check(Rt(...e))},startsWith(...e){return this.check(Et(...e))},endsWith(...e){return this.check(Nt(...e))},min(...e){return this.check(Ue(...e))},max(...e){return this.check(st(...e))},length(...e){return this.check(at(...e))},nonempty(...e){return this.check(Ue(1,...e))},lowercase(e){return this.check(At(e))},uppercase(e){return this.check(Ct(e))},trim(){return this.check(Mt())},normalize(...e){return this.check(jt(...e))},toLowerCase(){return this.check(Lt())},toUpperCase(){return this.check(Ut())},slugify(){return this.check(Vt())}})),Jt=h("ZodString",(e,t)=>{St.init(e,t),Zn.init(e,t)},{email(e){return this.check(Pi(Dn,e))},url(e){return this.check(bn(zr,e))},jwt(e){return this.check(Ji(Xn,e))},emoji(e){return this.check(Ri(Mn,e))},guid(e){return this.check(Ii(jn,e))},uuid(e){return this.check(Ti(Me,e))},uuidv4(e){return this.check(Oi(Me,e))},uuidv6(e){return this.check(Ai(Me,e))},uuidv7(e){return this.check(Ci(Me,e))},nanoid(e){return this.check(Ei(Ln,e))},cuid(e){return this.check(Ni(Un,e))},cuid2(e){return this.check(Zi(Vn,e))},ulid(e){return this.check(Di(Fn,e))},base64(e){return this.check(qi(Gn,e))},base64url(e){return this.check(Hi(Qn,e))},xid(e){return this.check(ji(qn,e))},ksuid(e){return this.check(Mi(Hn,e))},ipv4(e){return this.check(Li(Bn,e))},ipv6(e){return this.check(Ui(Jn,e))},cidrv4(e){return this.check(Vi(Kn,e))},cidrv6(e){return this.check(Fi(Wn,e))},e164(e){return this.check(Bi(Yn,e))},datetime(e){return this.check(_n(Ke,e))},date(e){return this.check($n(We,e))},time(e){return this.check(xn(Ge,e))},duration(e){return this.check(wn(Qe,e))}});H=h("ZodStringFormat",(e,t)=>{V.init(e,t),Zn.init(e,t)}),Ke=h("ZodISODateTime",(e,t)=>{lu.init(e,t),H.init(e,t)}),We=h("ZodISODate",(e,t)=>{pu.init(e,t),H.init(e,t)}),Ge=h("ZodISOTime",(e,t)=>{fu.init(e,t),H.init(e,t)}),Qe=h("ZodISODuration",(e,t)=>{du.init(e,t),H.init(e,t)}),Dn=h("ZodEmail",(e,t)=>{Xc.init(e,t),H.init(e,t)});jn=h("ZodGUID",(e,t)=>{Qc.init(e,t),H.init(e,t)});Me=h("ZodUUID",(e,t)=>{Yc.init(e,t),H.init(e,t)});zr=h("ZodURL",(e,t)=>{ru.init(e,t),H.init(e,t)});Mn=h("ZodEmoji",(e,t)=>{nu.init(e,t),H.init(e,t)});Ln=h("ZodNanoID",(e,t)=>{ou.init(e,t),H.init(e,t)});Un=h("ZodCUID",(e,t)=>{iu.init(e,t),H.init(e,t)});Vn=h("ZodCUID2",(e,t)=>{su.init(e,t),H.init(e,t)});Fn=h("ZodULID",(e,t)=>{au.init(e,t),H.init(e,t)});qn=h("ZodXID",(e,t)=>{cu.init(e,t),H.init(e,t)});Hn=h("ZodKSUID",(e,t)=>{uu.init(e,t),H.init(e,t)});Bn=h("ZodIPv4",(e,t)=>{mu.init(e,t),H.init(e,t)});gs=h("ZodMAC",(e,t)=>{gu.init(e,t),H.init(e,t)});Jn=h("ZodIPv6",(e,t)=>{hu.init(e,t),H.init(e,t)});Kn=h("ZodCIDRv4",(e,t)=>{yu.init(e,t),H.init(e,t)});Wn=h("ZodCIDRv6",(e,t)=>{bu.init(e,t),H.init(e,t)});Gn=h("ZodBase64",(e,t)=>{_u.init(e,t),H.init(e,t)});Qn=h("ZodBase64URL",(e,t)=>{$u.init(e,t),H.init(e,t)});Yn=h("ZodE164",(e,t)=>{xu.init(e,t),H.init(e,t)});ys=h("ZodCreditCard",(e,t)=>{wu.init(e,t),H.init(e,t)});bs=h("ZodIBAN",(e,t)=>{zu.init(e,t),H.init(e,t)});Xn=h("ZodJWT",(e,t)=>{vu.init(e,t),H.init(e,t)});pt=h("ZodCustomStringFormat",(e,t)=>{ku.init(e,t),H.init(e,t)});Kt=h("ZodNumber",(e,t)=>{ci.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sp(e,r,n,o),e.isFinite=!0},v.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=re(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=re(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=re(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>re(e).format??null},{gt(e,t){return this.check(De(e,t))},gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},lt(e,t){return this.check(Ze(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},int(e){return this.check(En(e))},safe(e){return this.check(En(e))},positive(e){return this.check(De(0,e))},nonnegative(e){return this.check(ke(0,e))},negative(e){return this.check(Ze(0,e))},nonpositive(e){return this.check(ve(0,e))},multipleOf(e,t){return this.check(Be(e,t))},step(e,t){return this.check(Be(e,t))},finite(){return this}}));ft=h("ZodNumberFormat",(e,t)=>{Su.init(e,t),Kt.init(e,t)});Wt=h("ZodBoolean",(e,t)=>{un.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ap(e,r,n,o)});Gt=h("ZodBigInt",(e,t)=>{ui.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o)},v.derived({minValue:e=>re(e).minimum??null,maxValue:e=>re(e).maximum??null,format:e=>re(e).format??null},{gte(e,t){return this.check(ke(e,t))},min(e,t){return this.check(ke(e,t))},gt(e,t){return this.check(De(e,t))},lt(e,t){return this.check(Ze(e,t))},lte(e,t){return this.check(ve(e,t))},max(e,t){return this.check(ve(e,t))},positive(e){return this.check(De(BigInt(0),e))},negative(e){return this.check(Ze(BigInt(0),e))},nonpositive(e){return this.check(ve(BigInt(0),e))},nonnegative(e){return this.check(ke(BigInt(0),e))},multipleOf(e,t){return this.check(Be(e,t))}}));eo=h("ZodBigIntFormat",(e,t)=>{Pu.init(e,t),Gt.init(e,t)});_s=h("ZodSymbol",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>up(e,r,n,o)});$s=h("ZodUndefined",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pp(e,r,n,o)});xs=h("ZodNull",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lp(e,r,n,o)});ws=h("ZodAny",(e,t)=>{Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mp(e,r,n,o)});zs=h("ZodUnknown",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hp(e,r,n,o)});vs=h("ZodNever",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dp(e,r,n,o)});ks=h("ZodVoid",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fp(e,r,n,o)});kr=h("ZodDate",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gp(e,r,n,o),e.min=(r,n)=>e.check(ke(r,n)),e.max=(r,n)=>e.check(ve(r,n))},v.derived({minDate:e=>{let{minimum:t}=re(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=re(e);return t?new Date(t):null}},{}));Ss=h("ZodArray",(e,t)=>{Bt(),Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ip(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ue(e,t))},nonempty(e){return this.check(Ue(1,e))},max(e,t){return this.check(st(e,t))},length(e,t){return this.check(at(e,t))},unwrap(){return this.element}});Sr=h("ZodObject",(e,t)=>{Bt(),ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tp(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return ae(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:K()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:to()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Tr,this,e[0])},exactPartial(...e){return v.partial(no,this,e[0],"exactPartial")},required(...e){return v.required(oo,this,e[0])}});Pr=h("ZodUnion",(e,t)=>{ln.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gi(e,r,n,o),e.options=t.options});Ps=h("ZodXor",(e,t)=>{Pr.init(e,t),Mu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gi(e,r,n,o),e.options=t.options});Is=h("ZodDiscriminatedUnion",(e,t)=>{Pr.init(e,t),Lu.init(e,t)});Ts=h("ZodIntersection",(e,t)=>{Uu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Op(e,r,n,o)});Os=h("ZodTuple",(e,t)=>{Bt(),pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ap(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Tr({type:"optional",innerType:t}))})}});qt=h("ZodRecord",(e,t)=>{Bt(),Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cp(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});Cs=h("ZodMap",(e,t)=>{Bt(),Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sp(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(Je(...r)),e.size=(...r)=>e.check(it(...r))});Rs=h("ZodSet",(e,t)=>{Bt(),qu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pp(e,r,n,o),e.min=(...r)=>e.check(je(...r)),e.nonempty=r=>e.check(je(1,r)),e.max=(...r)=>e.check(Je(...r)),e.size=(...r)=>e.check(it(...r))});Ht=h("ZodEnum",(e,t)=>{Hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>yp(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Ht({...t,checks:[],...v.normalizeParams(o),entries:i})}});Es=h("ZodLiteral",(e,t)=>{Bu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});Ns=h("ZodFile",(e,t)=>{Ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xp(e,r,n,o),e.min=(r,n)=>e.check(je(r,n)),e.max=(r,n)=>e.check(Je(r,n)),e.mime=(r,n)=>e.check(Dt(Array.isArray(r)?r:[r],n))});Zs=h("ZodTransform",(e,t)=>{Bt(),Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kp(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new nt(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(v.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});Tr=h("ZodOptional",(e,t)=>{fi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});no=h("ZodExactOptional",(e,t)=>{Wu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});js=h("ZodNullable",(e,t)=>{Gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Ms=h("ZodDefault",(e,t)=>{Qu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});Us=h("ZodPrefault",(e,t)=>{Yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});oo=h("ZodNonOptional",(e,t)=>{Xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});qs=h("ZodSuccess",(e,t)=>{el.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Hs=h("ZodCatch",(e,t)=>{tl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});Js=h("ZodNaN",(e,t)=>{rl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o)});Or=h("ZodPipe",(e,t)=>{di.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mp(e,r,n,o),e.in=t.in,e.out=t.out});Ar=h("ZodCodec",(e,t)=>{Or.init(e,t),pn.init(e,t)});Ks=h("ZodPreprocess",(e,t)=>{Or.init(e,t),nl.init(e,t)}),Ws=h("ZodReadonly",(e,t)=>{ol.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Qs=h("ZodTemplateLiteral",(e,t)=>{il.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o)});Ys=h("ZodLazy",(e,t)=>{fn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vp(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});ea=h("ZodPromise",(e,t)=>{al.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Up(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});ta=h("ZodFunction",(e,t)=>{sl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vp(e,r,n,o)});Cr=h("ZodCustom",(e,t)=>{cl.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zp(e,r,n,o)});ed=Yl,td=Xl,oa=h("ZodInstanceOf",(e,t)=>{Cr.init(e,t)},{properties(e,t){return this.check(Zt(e,t))}});nd=(...e)=>ep({Codec:Ar,Boolean:Wt,String:Jt},...e)});function gh(e){Y({customError:e})}function yh(){return Y().customError}var hh,ia,bh=D(()=>{Se();hh={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"};ia||(ia={})});var mt={};Le(mt,{ZodISODate:()=>We,ZodISODateTime:()=>Ke,ZodISODuration:()=>Qe,ZodISOTime:()=>Ge,date:()=>y_,datetime:()=>g_,duration:()=>__,time:()=>b_});function g_(e){return _n(Ke,e)}function y_(e){return $n(We,e)}function b_(e){return xn(Ge,e)}function __(e){return wn(Qe,e)}var sa=D(()=>{Se();dt();dt()});function x_(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function _h(e,t){return e.map((r,n)=>n<t?r:r.optional())}function w_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function z_(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:w_(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function v_(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);a.success||n.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function id(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=id(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let s=id(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}function so(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(so):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>k_.has(t)?so(r):!S_.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(so))}function $h(e){return e===1?"element":"elements"}function P_(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=id(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${$h(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${$h(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function xh(e,t){if(e!==!1)return e===void 0||e===!0?w.any():_e(e,t)}function wh(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return w.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=z_(o,t),s=_e(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(s=>typeof s=="string"))return w.enum(o);let i=o.map(s=>w.literal(s));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let s={...e,type:i};return wh(s,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(I_)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?w.number().int():w.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?_e(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(i)){let m=_e(d,t);ce(o,f,s.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let b of d){let x=_e(f[b],t),I=w.string().regex(new RegExp(b));m.push(w.looseRecord(I,x))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let b=w.intersection(g[0],g[1]);for(let x=2;x<g.length;x++)b=w.intersection(b,g[x]);n=b}if(e.additionalProperties===!1){let b=Object.keys(o),x=d.map($=>new RegExp($)),I=n;n=n.check($=>{if(!Te($.value))return;let S=[];for(let N of Object.keys($.value))b.includes(N)||x.some(G=>G.test(N))||S.push(N);S.length&&$.issues.push({code:"unrecognized_keys",keys:S,input:$.value,inst:I})})}}else{let f=w.object(o);e.additionalProperties===!1?n=f.strict():a?n=f.catchall(a):n=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=_e(d,t)}n=v_(n,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>_e(f,t)),c=_h(a,s),u=Array.isArray(i)?void 0:xh(i,t),l=w.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>_e(f,t)),c=_h(a,s),u=xh(e.additionalItems,t),l=w.tuple(c);n=u?l.rest(u):l,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let s=_e(i,t),a=w.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=P_(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?_e(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}function _e(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=wh(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>_e(u,t)),c=w.union(a);r=n?w.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>_e(u,t)),c=w.xor(a);r=n?w.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let a=n?r:_e(e.allOf[0],t),c=n?0:1;for(let u=c;u<e.allOf.length;u++)a=w.intersection(a,_e(e.allOf[u],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!so(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!so(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))$_.has(a)||ce(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function sd(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=x_(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ie};return _e(r,i)}var w,$_,k_,S_,I_,zh=D(()=>{gn();ee();rs();sa();dt();w={...Er,...ts,iso:mt},$_=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);k_=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),S_=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);I_=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/});function ad(e){return Rn(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:U(r.options)}})}var vh=D(()=>{Fp();dt()});function T_(e,t){if(!t?.length)return e;let r=e._zod.def;return L(e,Ne(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function kh(e){return T_(e.out,e.checks)}function O_(e){return e.in._zod.traits.has("$ZodTransform")?kh(e):e.in}function cd(e){return Rn(e,{pipe:t=>O_(t._zod.def),default:(t,r)=>r?q(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function ud(e){return Rn(e,{pipe:t=>kh(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Sh=D(()=>{ee();Fp();dt()});var aa={};Le(aa,{bigint:()=>E_,boolean:()=>R_,date:()=>N_,number:()=>C_,string:()=>A_});function A_(e){return $l(Jt,e)}function C_(e){return kl(Kt,e)}function R_(e){return Cl(Wt,e)}function E_(e){return El(Gt,e)}function N_(e){return Hl(kr,e)}var Ph=D(()=>{Se();dt()});var p={};Le(p,{$brand:()=>Po,$input:()=>zi,$output:()=>wi,INVALID:()=>me,NEVER:()=>So,TimePrecision:()=>Ki,ZodAny:()=>ws,ZodArray:()=>Ss,ZodBase64:()=>Gn,ZodBase64URL:()=>Qn,ZodBigInt:()=>Gt,ZodBigIntFormat:()=>eo,ZodBoolean:()=>Wt,ZodCIDRv4:()=>Kn,ZodCIDRv6:()=>Wn,ZodCUID:()=>Un,ZodCUID2:()=>Vn,ZodCatch:()=>Hs,ZodCodec:()=>Ar,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>E,ZodCreditCard:()=>ys,ZodCustom:()=>Cr,ZodCustomStringFormat:()=>pt,ZodDate:()=>kr,ZodDefault:()=>Ms,ZodDiscriminatedUnion:()=>Is,ZodE164:()=>Yn,ZodEmail:()=>Dn,ZodEmoji:()=>Mn,ZodEnum:()=>Ht,ZodError:()=>mh,ZodExactOptional:()=>no,ZodFile:()=>Ns,ZodFirstPartyTypeKind:()=>ia,ZodFunction:()=>ta,ZodGUID:()=>jn,ZodIBAN:()=>bs,ZodIPv4:()=>Bn,ZodIPv6:()=>Jn,ZodISODate:()=>We,ZodISODateTime:()=>Ke,ZodISODuration:()=>Qe,ZodISOTime:()=>Ge,ZodInstanceOf:()=>oa,ZodIntersection:()=>Ts,ZodIssueCode:()=>hh,ZodJWT:()=>Xn,ZodKSUID:()=>Hn,ZodLazy:()=>Ys,ZodLiteral:()=>Es,ZodMAC:()=>gs,ZodMap:()=>Cs,ZodNaN:()=>Js,ZodNanoID:()=>Ln,ZodNever:()=>vs,ZodNonOptional:()=>oo,ZodNull:()=>xs,ZodNullable:()=>js,ZodNumber:()=>Kt,ZodNumberFormat:()=>ft,ZodObject:()=>Sr,ZodOptional:()=>Tr,ZodPipe:()=>Or,ZodPrefault:()=>Us,ZodPreprocess:()=>Ks,ZodPromise:()=>ea,ZodReadonly:()=>Ws,ZodRealError:()=>be,ZodRecord:()=>qt,ZodSet:()=>Rs,ZodString:()=>Jt,ZodStringFormat:()=>H,ZodSuccess:()=>qs,ZodSymbol:()=>_s,ZodTemplateLiteral:()=>Qs,ZodTransform:()=>Zs,ZodTuple:()=>Os,ZodType:()=>A,ZodULID:()=>Fn,ZodURL:()=>zr,ZodUUID:()=>Me,ZodUndefined:()=>$s,ZodUnion:()=>Pr,ZodUnknown:()=>zs,ZodVoid:()=>ks,ZodXID:()=>qn,ZodXor:()=>Ps,_ZodString:()=>Zn,_default:()=>Ls,_function:()=>Yf,any:()=>Rf,array:()=>R,base64:()=>df,base64url:()=>mf,bigint:()=>If,boolean:()=>X,catch:()=>Bs,check:()=>Xf,cidrv4:()=>pf,cidrv6:()=>ff,clone:()=>L,codec:()=>Kf,coerce:()=>aa,compile:()=>vi,config:()=>Y,core:()=>Ve,creditCard:()=>gf,cuid:()=>rf,cuid2:()=>nf,currencyCode:()=>wf,custom:()=>io,date:()=>Nf,decode:()=>us,decodeAsync:()=>ps,deepPartial:()=>ad,describe:()=>ed,discriminatedUnion:()=>Ir,e164:()=>hf,email:()=>Bp,emoji:()=>ef,encode:()=>cs,encodeAsync:()=>ls,endsWith:()=>Nt,enum:()=>ae,exactOptional:()=>Ds,file:()=>qf,flattenError:()=>sr,float32:()=>vf,float64:()=>kf,formatError:()=>ar,fromJSONSchema:()=>sd,function:()=>Yf,getDiscriminatedOption:()=>li,getErrorMap:()=>yh,globalRegistry:()=>ie,gt:()=>De,gte:()=>ke,guid:()=>Jp,hash:()=>zf,hex:()=>xf,hostname:()=>$f,httpUrl:()=>Xp,iban:()=>yf,includes:()=>Rt,input:()=>cd,instanceof:()=>rd,int:()=>En,int32:()=>Sf,int64:()=>Tf,intersection:()=>Qt,invertCodec:()=>Wf,ipv4:()=>cf,ipv6:()=>lf,iso:()=>mt,json:()=>od,jwt:()=>bf,keyof:()=>Zf,ksuid:()=>af,lazy:()=>Xs,length:()=>at,literal:()=>k,locales:()=>yr,looseObject:()=>se,looseRecord:()=>Lf,lowercase:()=>At,lt:()=>Ze,lte:()=>ve,mac:()=>uf,map:()=>Uf,maxLength:()=>st,maxSize:()=>Je,memoizer:()=>gr,meta:()=>td,mime:()=>Dt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Be,nan:()=>Jf,nanoid:()=>tf,nativeEnum:()=>Ff,negative:()=>vn,never:()=>to,nonnegative:()=>Sn,nonoptional:()=>Fs,nonpositive:()=>kn,normalize:()=>jt,null:()=>vr,nullable:()=>wr,nullish:()=>Hf,number:()=>j,object:()=>z,optional:()=>q,output:()=>ud,overwrite:()=>Ce,parse:()=>os,parseAsync:()=>is,partialRecord:()=>Mf,pipe:()=>Nn,positive:()=>zn,prefault:()=>Vs,preprocess:()=>Rr,prettifyError:()=>To,promise:()=>Qf,properties:()=>Zt,property:()=>Pn,readonly:()=>Gs,record:()=>B,refine:()=>ra,regex:()=>Ot,regexes:()=>Pe,registry:()=>hn,safeDecode:()=>ds,safeDecodeAsync:()=>hs,safeEncode:()=>fs,safeEncodeAsync:()=>ms,safeParse:()=>ss,safeParseAsync:()=>as,set:()=>Vf,setErrorMap:()=>gh,size:()=>it,slugify:()=>Vt,startsWith:()=>Et,strictObject:()=>Df,string:()=>y,stringFormat:()=>_f,stringbool:()=>nd,success:()=>Bf,superRefine:()=>na,symbol:()=>Af,templateLiteral:()=>Gf,toJSONSchema:()=>An,toLowerCase:()=>Lt,toUpperCase:()=>Ut,toZod:()=>Xt,transform:()=>ro,treeifyError:()=>Io,trim:()=>Mt,tuple:()=>As,uint32:()=>Pf,uint64:()=>Of,ulid:()=>of,undefined:()=>Cf,union:()=>U,unknown:()=>K,uppercase:()=>Ct,url:()=>Yp,util:()=>v,uuid:()=>Kp,uuidv4:()=>Wp,uuidv6:()=>Gp,uuidv7:()=>Qp,validate:()=>xt,validateAsync:()=>wt,void:()=>Ef,withParser:()=>yn,xid:()=>sf,xor:()=>jf});var ca=D(()=>{Se();dt();rs();qp();Hp();bh();Se();Cn();zh();vh();Sh();dl();sa();sa();Ph()});var Ih=D(()=>{ca();ca()});var ld={};Le(ld,{$brand:()=>Po,$input:()=>zi,$output:()=>wi,INVALID:()=>me,NEVER:()=>So,TimePrecision:()=>Ki,ZodAny:()=>ws,ZodArray:()=>Ss,ZodBase64:()=>Gn,ZodBase64URL:()=>Qn,ZodBigInt:()=>Gt,ZodBigIntFormat:()=>eo,ZodBoolean:()=>Wt,ZodCIDRv4:()=>Kn,ZodCIDRv6:()=>Wn,ZodCUID:()=>Un,ZodCUID2:()=>Vn,ZodCatch:()=>Hs,ZodCodec:()=>Ar,ZodCompileAsyncError:()=>Ae,ZodCompileUnsupportedError:()=>E,ZodCreditCard:()=>ys,ZodCustom:()=>Cr,ZodCustomStringFormat:()=>pt,ZodDate:()=>kr,ZodDefault:()=>Ms,ZodDiscriminatedUnion:()=>Is,ZodE164:()=>Yn,ZodEmail:()=>Dn,ZodEmoji:()=>Mn,ZodEnum:()=>Ht,ZodError:()=>mh,ZodExactOptional:()=>no,ZodFile:()=>Ns,ZodFirstPartyTypeKind:()=>ia,ZodFunction:()=>ta,ZodGUID:()=>jn,ZodIBAN:()=>bs,ZodIPv4:()=>Bn,ZodIPv6:()=>Jn,ZodISODate:()=>We,ZodISODateTime:()=>Ke,ZodISODuration:()=>Qe,ZodISOTime:()=>Ge,ZodInstanceOf:()=>oa,ZodIntersection:()=>Ts,ZodIssueCode:()=>hh,ZodJWT:()=>Xn,ZodKSUID:()=>Hn,ZodLazy:()=>Ys,ZodLiteral:()=>Es,ZodMAC:()=>gs,ZodMap:()=>Cs,ZodNaN:()=>Js,ZodNanoID:()=>Ln,ZodNever:()=>vs,ZodNonOptional:()=>oo,ZodNull:()=>xs,ZodNullable:()=>js,ZodNumber:()=>Kt,ZodNumberFormat:()=>ft,ZodObject:()=>Sr,ZodOptional:()=>Tr,ZodPipe:()=>Or,ZodPrefault:()=>Us,ZodPreprocess:()=>Ks,ZodPromise:()=>ea,ZodReadonly:()=>Ws,ZodRealError:()=>be,ZodRecord:()=>qt,ZodSet:()=>Rs,ZodString:()=>Jt,ZodStringFormat:()=>H,ZodSuccess:()=>qs,ZodSymbol:()=>_s,ZodTemplateLiteral:()=>Qs,ZodTransform:()=>Zs,ZodTuple:()=>Os,ZodType:()=>A,ZodULID:()=>Fn,ZodURL:()=>zr,ZodUUID:()=>Me,ZodUndefined:()=>$s,ZodUnion:()=>Pr,ZodUnknown:()=>zs,ZodVoid:()=>ks,ZodXID:()=>qn,ZodXor:()=>Ps,_ZodString:()=>Zn,_default:()=>Ls,_function:()=>Yf,any:()=>Rf,array:()=>R,base64:()=>df,base64url:()=>mf,bigint:()=>If,boolean:()=>X,catch:()=>Bs,check:()=>Xf,cidrv4:()=>pf,cidrv6:()=>ff,clone:()=>L,codec:()=>Kf,coerce:()=>aa,compile:()=>vi,config:()=>Y,core:()=>Ve,creditCard:()=>gf,cuid:()=>rf,cuid2:()=>nf,currencyCode:()=>wf,custom:()=>io,date:()=>Nf,decode:()=>us,decodeAsync:()=>ps,deepPartial:()=>ad,default:()=>p,describe:()=>ed,discriminatedUnion:()=>Ir,e164:()=>hf,email:()=>Bp,emoji:()=>ef,encode:()=>cs,encodeAsync:()=>ls,endsWith:()=>Nt,enum:()=>ae,exactOptional:()=>Ds,file:()=>qf,flattenError:()=>sr,float32:()=>vf,float64:()=>kf,formatError:()=>ar,fromJSONSchema:()=>sd,function:()=>Yf,getDiscriminatedOption:()=>li,getErrorMap:()=>yh,globalRegistry:()=>ie,gt:()=>De,gte:()=>ke,guid:()=>Jp,hash:()=>zf,hex:()=>xf,hostname:()=>$f,httpUrl:()=>Xp,iban:()=>yf,includes:()=>Rt,input:()=>cd,instanceof:()=>rd,int:()=>En,int32:()=>Sf,int64:()=>Tf,intersection:()=>Qt,invertCodec:()=>Wf,ipv4:()=>cf,ipv6:()=>lf,iso:()=>mt,json:()=>od,jwt:()=>bf,keyof:()=>Zf,ksuid:()=>af,lazy:()=>Xs,length:()=>at,literal:()=>k,locales:()=>yr,looseObject:()=>se,looseRecord:()=>Lf,lowercase:()=>At,lt:()=>Ze,lte:()=>ve,mac:()=>uf,map:()=>Uf,maxLength:()=>st,maxSize:()=>Je,memoizer:()=>gr,meta:()=>td,mime:()=>Dt,minLength:()=>Ue,minSize:()=>je,multipleOf:()=>Be,nan:()=>Jf,nanoid:()=>tf,nativeEnum:()=>Ff,negative:()=>vn,never:()=>to,nonnegative:()=>Sn,nonoptional:()=>Fs,nonpositive:()=>kn,normalize:()=>jt,null:()=>vr,nullable:()=>wr,nullish:()=>Hf,number:()=>j,object:()=>z,optional:()=>q,output:()=>ud,overwrite:()=>Ce,parse:()=>os,parseAsync:()=>is,partialRecord:()=>Mf,pipe:()=>Nn,positive:()=>zn,prefault:()=>Vs,preprocess:()=>Rr,prettifyError:()=>To,promise:()=>Qf,properties:()=>Zt,property:()=>Pn,readonly:()=>Gs,record:()=>B,refine:()=>ra,regex:()=>Ot,regexes:()=>Pe,registry:()=>hn,safeDecode:()=>ds,safeDecodeAsync:()=>hs,safeEncode:()=>fs,safeEncodeAsync:()=>ms,safeParse:()=>ss,safeParseAsync:()=>as,set:()=>Vf,setErrorMap:()=>gh,size:()=>it,slugify:()=>Vt,startsWith:()=>Et,strictObject:()=>Df,string:()=>y,stringFormat:()=>_f,stringbool:()=>nd,success:()=>Bf,superRefine:()=>na,symbol:()=>Af,templateLiteral:()=>Gf,toJSONSchema:()=>An,toLowerCase:()=>Lt,toUpperCase:()=>Ut,toZod:()=>Xt,transform:()=>ro,treeifyError:()=>Io,trim:()=>Mt,tuple:()=>As,uint32:()=>Pf,uint64:()=>Of,ulid:()=>of,undefined:()=>Cf,union:()=>U,unknown:()=>K,uppercase:()=>Ct,url:()=>Yp,util:()=>v,uuid:()=>Kp,uuidv4:()=>Wp,uuidv6:()=>Gp,uuidv7:()=>Qp,validate:()=>xt,validateAsync:()=>wt,void:()=>Ef,withParser:()=>yn,xid:()=>sf,xor:()=>jf,z:()=>p});var ao=D(()=>{ca();Ih()});Se();function Xi(e){return!!e._zod}function es(e,t){return Xi(e)?Ao(e,t):e.safeParse(t)}function lh(e){if(!e)return;let t;if(Xi(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function ph(e){if(Xi(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}ao();var ht="io.modelcontextprotocol/related-task",la="2.0",ne=io(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Th=U([y(),j().int()]),Oh=y(),Tz=se({ttl:j().optional(),pollInterval:j().optional()}),Z_=z({ttl:j().optional()}),D_=z({taskId:y()}),fd=se({progressToken:Th.optional(),[ht]:D_.optional()}),Ie=z({_meta:fd.optional()}),co=Ie.extend({task:Z_.optional()}),Ah=e=>co.safeParse(e).success,ue=z({method:y(),params:Ie.loose().optional()}),Re=z({_meta:fd.optional()}),Ee=z({method:y(),params:Re.loose().optional()}),le=se({_meta:fd.optional()}),Zr=U([y(),j().int()]),Ch=z({jsonrpc:k(la),id:Zr,...ue.shape}).strict(),dd=e=>Ch.safeParse(e).success,Rh=z({jsonrpc:k(la),...Ee.shape}).strict(),Eh=e=>Rh.safeParse(e).success,md=z({jsonrpc:k(la),id:Zr,result:le}).strict(),uo=e=>md.safeParse(e).success;var J;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",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.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(J||(J={}));var hd=z({jsonrpc:k(la),id:Zr.optional(),error:z({code:j().int(),message:y(),data:K().optional()})}).strict();var Nh=e=>hd.safeParse(e).success;var Zh=U([Ch,Rh,md,hd]),Oz=U([md,hd]),pa=le.strict(),j_=Re.extend({requestId:Zr.optional(),reason:y().optional()}),fa=Ee.extend({method:k("notifications/cancelled"),params:j_}),M_=z({src:y(),mimeType:y().optional(),sizes:R(y()).optional(),theme:ae(["light","dark"]).optional()}),lo=z({icons:R(M_).optional()}),Nr=z({name:y(),title:y().optional()}),po=Nr.extend({...Nr.shape,...lo.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),L_=Qt(z({applyDefaults:X().optional()}),B(y(),K())),U_=Rr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Qt(z({form:L_.optional(),url:ne.optional()}),B(y(),K()).optional())),V_=se({list:ne.optional(),cancel:ne.optional(),requests:se({sampling:se({createMessage:ne.optional()}).optional(),elicitation:se({create:ne.optional()}).optional()}).optional()}),F_=se({list:ne.optional(),cancel:ne.optional(),requests:se({tools:se({call:ne.optional()}).optional()}).optional()}),q_=z({experimental:B(y(),ne).optional(),sampling:z({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:U_.optional(),roots:z({listChanged:X().optional()}).optional(),tasks:V_.optional(),extensions:B(y(),ne).optional()}),H_=Ie.extend({protocolVersion:y(),capabilities:q_,clientInfo:po}),B_=ue.extend({method:k("initialize"),params:H_});var J_=z({experimental:B(y(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:z({listChanged:X().optional()}).optional(),resources:z({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:z({listChanged:X().optional()}).optional(),tasks:F_.optional(),extensions:B(y(),ne).optional()}),K_=le.extend({protocolVersion:y(),capabilities:J_,serverInfo:po,instructions:y().optional()}),W_=Ee.extend({method:k("notifications/initialized"),params:Re.optional()});var Dr=ue.extend({method:k("ping"),params:Ie.optional()}),G_=z({progress:j(),total:q(j()),message:q(y())}),Q_=z({...Re.shape,...G_.shape,progressToken:Th}),da=Ee.extend({method:k("notifications/progress"),params:Q_}),Y_=Ie.extend({cursor:Oh.optional()}),fo=ue.extend({params:Y_.optional()}),mo=le.extend({nextCursor:Oh.optional()}),X_=ae(["working","input_required","completed","failed","cancelled"]),ho=z({taskId:y(),status:X_,ttl:U([j(),vr()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:q(j()),statusMessage:q(y())}),ma=le.extend({task:ho}),e$=Re.merge(ho),go=Ee.extend({method:k("notifications/tasks/status"),params:e$}),ha=ue.extend({method:k("tasks/get"),params:Ie.extend({taskId:y()})}),ga=le.merge(ho),ya=ue.extend({method:k("tasks/result"),params:Ie.extend({taskId:y()})}),Az=le.loose(),ba=fo.extend({method:k("tasks/list")}),_a=mo.extend({tasks:R(ho)}),$a=ue.extend({method:k("tasks/cancel"),params:Ie.extend({taskId:y()})}),Dh=le.merge(ho),jh=z({uri:y(),mimeType:q(y()),_meta:B(y(),K()).optional()}),Mh=jh.extend({text:y()}),gd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Lh=jh.extend({blob:gd}),yo=ae(["user","assistant"]),jr=z({audience:R(yo).optional(),priority:j().min(0).max(1).optional(),lastModified:mt.datetime({offset:!0}).optional()}),Uh=z({...Nr.shape,...lo.shape,uri:y(),description:q(y()),mimeType:q(y()),size:q(j()),annotations:jr.optional(),_meta:q(se({}))}),t$=z({...Nr.shape,...lo.shape,uriTemplate:y(),description:q(y()),mimeType:q(y()),annotations:jr.optional(),_meta:q(se({}))}),r$=fo.extend({method:k("resources/list")}),yd=mo.extend({resources:R(Uh)}),n$=fo.extend({method:k("resources/templates/list")}),o$=mo.extend({resourceTemplates:R(t$)}),bd=Ie.extend({uri:y()}),i$=bd,s$=ue.extend({method:k("resources/read"),params:i$}),_d=le.extend({contents:R(U([Mh,Lh]))}),a$=Ee.extend({method:k("notifications/resources/list_changed"),params:Re.optional()}),c$=bd,u$=ue.extend({method:k("resources/subscribe"),params:c$}),l$=bd,p$=ue.extend({method:k("resources/unsubscribe"),params:l$}),f$=Re.extend({uri:y()}),d$=Ee.extend({method:k("notifications/resources/updated"),params:f$}),m$=z({name:y(),description:q(y()),required:q(X())}),h$=z({...Nr.shape,...lo.shape,description:q(y()),arguments:q(R(m$)),_meta:q(se({}))}),g$=fo.extend({method:k("prompts/list")}),y$=mo.extend({prompts:R(h$)}),b$=Ie.extend({name:y(),arguments:B(y(),y()).optional()}),_$=ue.extend({method:k("prompts/get"),params:b$}),$d=z({type:k("text"),text:y(),annotations:jr.optional(),_meta:B(y(),K()).optional()}),xd=z({type:k("image"),data:gd,mimeType:y(),annotations:jr.optional(),_meta:B(y(),K()).optional()}),wd=z({type:k("audio"),data:gd,mimeType:y(),annotations:jr.optional(),_meta:B(y(),K()).optional()}),$$=z({type:k("tool_use"),name:y(),id:y(),input:B(y(),K()),_meta:B(y(),K()).optional()}),zd=z({type:k("resource"),resource:U([Mh,Lh]),annotations:jr.optional(),_meta:B(y(),K()).optional()}),vd=Uh.extend({type:k("resource_link")}),Mr=U([$d,xd,wd,vd,zd]),x$=z({role:yo,content:Mr}),w$=le.extend({description:y().optional(),messages:R(x$)}),z$=Ee.extend({method:k("notifications/prompts/list_changed"),params:Re.optional()}),v$=z({title:y().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),k$=z({taskSupport:ae(["required","optional","forbidden"]).optional()}),xa=z({...Nr.shape,...lo.shape,description:y().optional(),inputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:R(y()).optional()}).catchall(K()),outputSchema:z({type:k("object"),properties:B(y(),ne).optional(),required:R(y()).optional()}).catchall(K()).optional(),annotations:v$.optional(),execution:k$.optional(),_meta:B(y(),K()).optional()}),kd=fo.extend({method:k("tools/list")}),S$=mo.extend({tools:R(xa)}),Lr=le.extend({content:R(Mr).default([]),structuredContent:B(y(),K()).optional(),isError:X().optional()}),Cz=Lr.or(le.extend({toolResult:K()})),P$=co.extend({name:y(),arguments:B(y(),K()).optional()}),Sd=ue.extend({method:k("tools/call"),params:P$}),I$=Ee.extend({method:k("notifications/tools/list_changed"),params:Re.optional()}),Rz=z({autoRefresh:X().default(!0),debounceMs:j().int().nonnegative().default(300)}),Vh=ae(["debug","info","notice","warning","error","critical","alert","emergency"]),T$=Ie.extend({level:Vh}),O$=ue.extend({method:k("logging/setLevel"),params:T$}),A$=Re.extend({level:Vh,logger:y().optional(),data:K()}),C$=Ee.extend({method:k("notifications/message"),params:A$}),R$=z({name:y().optional()}),E$=z({hints:R(R$).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),N$=z({mode:ae(["auto","required","none"]).optional()}),Z$=z({type:k("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:R(Mr).default([]),structuredContent:z({}).loose().optional(),isError:X().optional(),_meta:B(y(),K()).optional()}),D$=Ir("type",[$d,xd,wd]),ua=Ir("type",[$d,xd,wd,$$,Z$]),j$=z({role:yo,content:U([ua,R(ua)]),_meta:B(y(),K()).optional()}),M$=co.extend({messages:R(j$),modelPreferences:E$.optional(),systemPrompt:y().optional(),includeContext:ae(["none","thisServer","allServers"]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:R(y()).optional(),metadata:ne.optional(),tools:R(xa).optional(),toolChoice:N$.optional()}),L$=ue.extend({method:k("sampling/createMessage"),params:M$}),Pd=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens"]).or(y())),role:yo,content:D$}),Id=le.extend({model:y(),stopReason:q(ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:yo,content:U([ua,R(ua)])}),U$=z({type:k("boolean"),title:y().optional(),description:y().optional(),default:X().optional()}),V$=z({type:k("string"),title:y().optional(),description:y().optional(),minLength:j().optional(),maxLength:j().optional(),format:ae(["email","uri","date","date-time"]).optional(),default:y().optional()}),F$=z({type:ae(["number","integer"]),title:y().optional(),description:y().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),q$=z({type:k("string"),title:y().optional(),description:y().optional(),enum:R(y()),default:y().optional()}),H$=z({type:k("string"),title:y().optional(),description:y().optional(),oneOf:R(z({const:y(),title:y()})),default:y().optional()}),B$=z({type:k("string"),title:y().optional(),description:y().optional(),enum:R(y()),enumNames:R(y()).optional(),default:y().optional()}),J$=U([q$,H$]),K$=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({type:k("string"),enum:R(y())}),default:R(y()).optional()}),W$=z({type:k("array"),title:y().optional(),description:y().optional(),minItems:j().optional(),maxItems:j().optional(),items:z({anyOf:R(z({const:y(),title:y()}))}),default:R(y()).optional()}),G$=U([K$,W$]),Q$=U([B$,J$,G$]),Y$=U([Q$,U$,V$,F$]),X$=co.extend({mode:k("form").optional(),message:y(),requestedSchema:z({type:k("object"),properties:B(y(),Y$),required:R(y()).optional()})}),ex=co.extend({mode:k("url"),message:y(),elicitationId:y(),url:y().url()}),tx=U([X$,ex]),rx=ue.extend({method:k("elicitation/create"),params:tx}),nx=Re.extend({elicitationId:y()}),ox=Ee.extend({method:k("notifications/elicitation/complete"),params:nx}),ix=le.extend({action:ae(["accept","decline","cancel"]),content:Rr(e=>e===null?void 0:e,B(y(),U([y(),j(),X(),R(y())])).optional())}),sx=z({type:k("ref/resource"),uri:y()});var ax=z({type:k("ref/prompt"),name:y()}),cx=Ie.extend({ref:U([ax,sx]),argument:z({name:y(),value:y()}),context:z({arguments:B(y(),y()).optional()}).optional()}),ux=ue.extend({method:k("completion/complete"),params:cx});var lx=le.extend({completion:se({values:R(y()).max(100),total:q(j().int()),hasMore:q(X())})}),px=z({uri:y().startsWith("file://"),name:y().optional(),_meta:B(y(),K()).optional()}),fx=ue.extend({method:k("roots/list"),params:Ie.optional()}),dx=le.extend({roots:R(px)}),mx=Ee.extend({method:k("notifications/roots/list_changed"),params:Re.optional()}),Ez=U([Dr,B_,ux,O$,_$,g$,r$,n$,s$,u$,p$,Sd,kd,ha,ya,ba,$a]),Nz=U([fa,da,W_,mx,go]),Zz=U([pa,Pd,Id,ix,dx,ga,_a,ma]),Dz=U([Dr,L$,rx,fx,ha,ya,ba,$a]),jz=U([fa,da,C$,d$,a$,I$,z$,go,ox]),Mz=U([pa,K_,lx,w$,y$,yd,o$,_d,Lr,S$,ga,_a,ma]),M=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===J.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pd(o.elicitations,r)}return new e(t,r,n)}},pd=class extends M{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(J.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function gt(e){return e==="completed"||e==="failed"||e==="cancelled"}var hx=Symbol("Let zodToJsonSchema decide on which parser to use");var bv=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Td(e){let r=lh(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ph(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Od(e,t){let r=es(e,t);if(!r.success)throw r.error;return r.data}var xx=6e4,wa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(fa,r=>{this._oncancel(r)}),this.setNotificationHandler(da,r=>{this._onprogress(r)}),this.setRequestHandler(Dr,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ha,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ya,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let f=c,d=new M(f.error.code,f.error.message,f.error.data);l(d)}else{let f=a.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let s=await this._taskStore.getTask(i,n.sessionId);if(!s)throw new M(J.InvalidParams,`Task not found: ${i}`);if(!gt(s.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(gt(s.status)){let a=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...a,_meta:{...a._meta,[ht]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(ba,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new M(J.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler($a,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new M(J.InvalidParams,`Task not found: ${r.params.taskId}`);if(gt(o.status))throw new M(J.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new M(J.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof M?o:new M(J.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),M.fromError(J.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),uo(i)||Nh(i)?this._onresponse(i):dd(i)?this._onrequest(i,s):Eh(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=M.fromError(J.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[ht]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:J.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):o?.send(l).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=Ah(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let f={relatedRequestId:t.id};i&&(f.relatedTask={taskId:i}),await this.notification(l,f)},sendRequest:async(l,f,d)=>{if(s.signal.aborted)throw new M(J.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,f,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(s.signal.aborted)return;let f={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)},async l=>{if(s.signal.aborted)return;let f={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:J.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),uo(t))n(t);else{let s=new M(t.error.code,t.error.message,t.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(uo(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),uo(t))o(t);else{let s=M.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}return}let i;try{let s=await this.request(t,ma,n);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new M(J.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:a},gt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:a.status==="failed"?yield{type:"error",error:new M(J.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new M(J.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof M?s:new M(J.InternalError,String(s))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let f=$=>{l($)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch($){f($);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[ht]:c}});let g=$=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String($)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`)));let S=$ instanceof M?$:new M(J.RequestTimeout,String($));l(S)};this._responseHandlers.set(d,$=>{if(!n?.signal?.aborted){if($ instanceof Error)return l($);try{let S=es(r,$.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let b=n?.timeout??xx,x=()=>g(M.fromError(J.RequestTimeout,"Request timed out",{timeout:b}));this._setupTimeout(d,b,n?.maxTotalTimeout,x,n?.resetTimeoutOnProgress??!1);let I=c?.taskId;if(I){let $=S=>{let N=this._responseHandlers.get(d);N?N(S):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,$),this._enqueueTaskMessage(I,{type:"request",message:m,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(d),l(S)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch($=>{this._cleanupTimeout(d),l($)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ga,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},_a,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Dh,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ht]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ht]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ht]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let n=Td(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=Od(t,o);return Promise.resolve(r(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Td(t);this._notificationHandlers.set(n,o=>{let i=Od(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&dd(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new M(J.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new M(J.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s),i(new M(J.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new M(J.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=go.parse({method:"notifications/tasks/status",params:a});await this.notification(c),gt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new M(J.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(gt(a.status))throw new M(J.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=go.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Fh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qh(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];Fh(s)&&Fh(i)?r[o]={...s,...i}:r[o]=i}return r}ao();ao();var gP=(e=>typeof yt<"u"?yt:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof yt<"u"?yt:t)[r]}):e)(function(e){if(typeof yt<"u")return yt.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Ad=class extends wa{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(t,r){}_ensureEventSlot(t){let r=this._eventSlots.get(t);if(!r){let n=this.eventSchemas[t];if(!n)throw Error(`Unknown event: ${String(t)}`);r={listeners:[]},this._eventSlots.set(t,r);let o=n.shape.method.value;this._registeredMethods.add(o);let i=r;super.setNotificationHandler(n,s=>{let a=s.params;this.onEventDispatch(t,a),i.onHandler?.(a);for(let c of[...i.listeners])c(a)})}return r}setEventHandler(t,r){let n=this._ensureEventSlot(t);n.onHandler&&r&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", \u2026) to add multiple listeners without replacing.`),n.onHandler=r}getEventHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,r){this._ensureEventSlot(t).listeners.push(r)}removeEventListener(t,r){let n=this._eventSlots.get(t);if(!n)return;let o=n.listeners.indexOf(r);o!==-1&&n.listeners.splice(o,1)}setRequestHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setRequestHandler"),super.setRequestHandler(t,r)};setNotificationHandler=(t,r)=>{this._assertMethodNotRegistered(t,"setNotificationHandler"),super.setNotificationHandler(t,r)};warnIfRequestHandlerReplaced(t,r,n){r&&n&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(t,r)=>{let n=t.shape.method.value;this._registeredMethods.add(n),super.setRequestHandler(t,r)};_assertMethodNotRegistered(t,r){let n=t.shape.method.value;if(this._registeredMethods.has(n))throw Error(`Handler for "${n}" already registered (via ${r}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(n)}},wx="2026-01-26";var zx="ui/notifications/tool-input-partial";var Cd=class{eventTarget;eventSource;messageListener;constructor(t=window.parent,r){this.eventTarget=t,this.eventSource=r,this.messageListener=n=>{if(r&&n.source!==this.eventSource){console.debug("Ignoring message from unknown source",n);return}let o=Zh.safeParse(n.data);o.success?(console.debug("Parsed message",o.data),this.onmessage?.(o.data)):n.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",o.error.message,n):(console.error("Failed to parse message",o.error.message,n),this.onerror?.(Error("Invalid JSON-RPC message received: "+o.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,r){t.method!==zx&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},vx=p.union([p.literal("light"),p.literal("dark")]).describe("Color theme preference for the host environment."),_o=p.union([p.literal("inline"),p.literal("fullscreen"),p.literal("pip")]).describe("Display mode for UI presentation."),kx=p.union([p.literal("--color-background-primary"),p.literal("--color-background-secondary"),p.literal("--color-background-tertiary"),p.literal("--color-background-inverse"),p.literal("--color-background-ghost"),p.literal("--color-background-info"),p.literal("--color-background-danger"),p.literal("--color-background-success"),p.literal("--color-background-warning"),p.literal("--color-background-disabled"),p.literal("--color-text-primary"),p.literal("--color-text-secondary"),p.literal("--color-text-tertiary"),p.literal("--color-text-inverse"),p.literal("--color-text-ghost"),p.literal("--color-text-info"),p.literal("--color-text-danger"),p.literal("--color-text-success"),p.literal("--color-text-warning"),p.literal("--color-text-disabled"),p.literal("--color-border-primary"),p.literal("--color-border-secondary"),p.literal("--color-border-tertiary"),p.literal("--color-border-inverse"),p.literal("--color-border-ghost"),p.literal("--color-border-info"),p.literal("--color-border-danger"),p.literal("--color-border-success"),p.literal("--color-border-warning"),p.literal("--color-border-disabled"),p.literal("--color-ring-primary"),p.literal("--color-ring-secondary"),p.literal("--color-ring-inverse"),p.literal("--color-ring-info"),p.literal("--color-ring-danger"),p.literal("--color-ring-success"),p.literal("--color-ring-warning"),p.literal("--font-sans"),p.literal("--font-mono"),p.literal("--font-weight-normal"),p.literal("--font-weight-medium"),p.literal("--font-weight-semibold"),p.literal("--font-weight-bold"),p.literal("--font-text-xs-size"),p.literal("--font-text-sm-size"),p.literal("--font-text-md-size"),p.literal("--font-text-lg-size"),p.literal("--font-heading-xs-size"),p.literal("--font-heading-sm-size"),p.literal("--font-heading-md-size"),p.literal("--font-heading-lg-size"),p.literal("--font-heading-xl-size"),p.literal("--font-heading-2xl-size"),p.literal("--font-heading-3xl-size"),p.literal("--font-text-xs-line-height"),p.literal("--font-text-sm-line-height"),p.literal("--font-text-md-line-height"),p.literal("--font-text-lg-line-height"),p.literal("--font-heading-xs-line-height"),p.literal("--font-heading-sm-line-height"),p.literal("--font-heading-md-line-height"),p.literal("--font-heading-lg-line-height"),p.literal("--font-heading-xl-line-height"),p.literal("--font-heading-2xl-line-height"),p.literal("--font-heading-3xl-line-height"),p.literal("--border-radius-xs"),p.literal("--border-radius-sm"),p.literal("--border-radius-md"),p.literal("--border-radius-lg"),p.literal("--border-radius-xl"),p.literal("--border-radius-full"),p.literal("--border-width-regular"),p.literal("--shadow-hairline"),p.literal("--shadow-sm"),p.literal("--shadow-md"),p.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Sx=p.record(kx.describe(`Style variables for theming MCP apps.
|
|
721
|
+
|
|
722
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
723
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
724
|
+
|
|
725
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
726
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),p.union([p.string(),p.undefined()]).describe(`Style variables for theming MCP apps.
|
|
727
|
+
|
|
728
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
729
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
730
|
+
|
|
731
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
732
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
733
|
+
|
|
734
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
735
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
736
|
+
|
|
737
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
738
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),zP=p.object({method:p.literal("ui/open-link"),params:p.object({url:p.string().describe("URL to open in the host's browser")})}),Px=p.object({isError:p.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Ix=p.object({isError:p.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Tx=p.object({isError:p.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),vP=p.object({method:p.literal("ui/notifications/sandbox-proxy-ready"),params:p.object({})}),Rd=p.object({connectDomains:p.array(p.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
739
|
+
|
|
740
|
+
- Maps to CSP \`connect-src\` directive
|
|
741
|
+
- Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:p.array(p.string()).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 \u2192 no network resources (secure default)"),frameDomains:p.array(p.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:p.array(p.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),Ed=p.object({camera:p.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:p.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:p.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:p.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),kP=p.object({method:p.literal("ui/notifications/size-changed"),params:p.object({width:p.number().optional().describe("New width in pixels."),height:p.number().optional().describe("New height in pixels.")})}),Ox=p.object({method:p.literal("ui/notifications/tool-input"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Ax=p.object({method:p.literal("ui/notifications/tool-input-partial"),params:p.object({arguments:p.record(p.string(),p.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Cx=p.object({method:p.literal("ui/notifications/tool-cancelled"),params:p.object({reason:p.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Rx=p.object({fonts:p.string().optional()}),Ex=p.object({variables:Sx.optional().describe("CSS variables for theming the app."),css:Rx.optional().describe("CSS blocks that apps can inject.")}),Nx=p.object({method:p.literal("ui/resource-teardown"),params:p.object({})}),SP=p.record(p.string(),p.unknown()),Hh=p.object({text:p.object({}).optional().describe("Host supports text content blocks."),image:p.object({}).optional().describe("Host supports image content blocks."),audio:p.object({}).optional().describe("Host supports audio content blocks."),resource:p.object({}).optional().describe("Host supports resource content blocks."),resourceLink:p.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:p.object({}).optional().describe("Host supports structured content.")}),PP=p.object({method:p.literal("ui/notifications/request-teardown"),params:p.object({}).optional()}),Zx=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:p.object({}).optional().describe("Host supports opening external URLs."),downloadFile:p.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:p.object({listChanged:p.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:p.object({listChanged:p.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:p.object({}).optional().describe("Host accepts log messages."),sandbox:p.object({permissions:Ed.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Rd.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Hh.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Hh.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:p.object({tools:p.object({}).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.")}),Dx=p.object({experimental:p.record(p.string(),p.record(p.string(),p.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:p.object({listChanged:p.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:p.array(_o).optional().describe("Display modes the app supports.")}),IP=p.object({method:p.literal("ui/notifications/initialized"),params:p.object({}).optional()}),TP=p.object({csp:Rd.optional().describe("Content Security Policy configuration for UI resources."),permissions:Ed.optional().describe("Sandbox permissions requested by the UI resource."),domain:p.string().optional().describe(`Dedicated origin for view sandbox.
|
|
742
|
+
|
|
743
|
+
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
744
|
+
|
|
745
|
+
**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:
|
|
746
|
+
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
747
|
+
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
748
|
+
|
|
749
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:p.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
750
|
+
|
|
751
|
+
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.
|
|
752
|
+
|
|
753
|
+
- \`true\`: request visible border + background
|
|
754
|
+
- \`false\`: request no visible border + background
|
|
755
|
+
- omitted: host decides border`)}),OP=p.object({method:p.literal("ui/request-display-mode"),params:p.object({mode:_o.describe("The display mode being requested.")})}),jx=p.object({mode:_o.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Mx=p.union([p.literal("model"),p.literal("app")]).describe("Tool visibility scope - who can access the tool."),AP=p.object({resourceUri:p.string().optional(),visibility:p.array(Mx).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
756
|
+
- "model": Tool visible to and callable by the agent
|
|
757
|
+
- "app": Tool callable by the app from this server only`),csp:p.never().optional(),permissions:p.never().optional()}),CP=p.object({mimeTypes:p.array(p.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),RP=p.object({method:p.literal("ui/download-file"),params:p.object({contents:p.array(p.union([zd,vd])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),EP=p.object({method:p.literal("ui/message"),params:p.object({role:p.literal("user").describe('Message role, currently only "user" is supported.'),content:p.array(Mr).describe("Message content blocks (text, image, etc.).")})}),NP=p.object({method:p.literal("ui/notifications/sandbox-resource-ready"),params:p.object({html:p.string().describe("HTML content to load into the inner iframe."),sandbox:p.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Rd.optional().describe("CSP configuration from resource metadata."),permissions:Ed.optional().describe("Sandbox permissions from resource metadata.")})}),Lx=p.object({method:p.literal("ui/notifications/tool-result"),params:Lr.describe("Standard MCP tool execution result.")}),Kh=p.object({toolInfo:p.object({id:Zr.optional().describe("JSON-RPC id of the tools/call request."),tool:xa.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:vx.optional().describe("Current color theme preference."),styles:Ex.optional().describe("Style configuration for theming the app."),displayMode:_o.optional().describe("How the UI is currently displayed."),availableDisplayModes:p.array(_o).optional().describe("Display modes the host supports."),containerDimensions:p.union([p.object({height:p.number().describe("Fixed container height in pixels.")}),p.object({maxHeight:p.union([p.number(),p.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(p.union([p.object({width:p.number().describe("Fixed container width in pixels.")}),p.object({maxWidth:p.union([p.number(),p.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
758
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:p.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:p.string().optional().describe("User's timezone in IANA format."),userAgent:p.string().optional().describe("Host application identifier."),platform:p.union([p.literal("web"),p.literal("desktop"),p.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:p.object({touch:p.boolean().optional().describe("Whether the device supports touch input."),hover:p.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:p.object({top:p.number().describe("Top safe area inset in pixels."),right:p.number().describe("Right safe area inset in pixels."),bottom:p.number().describe("Bottom safe area inset in pixels."),left:p.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Ux=p.object({method:p.literal("ui/notifications/host-context-changed"),params:Kh.describe("Partial context update containing only changed fields.")}),ZP=p.object({method:p.literal("ui/update-model-context"),params:p.object({content:p.array(Mr).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:p.record(p.string(),p.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),DP=p.object({method:p.literal("ui/initialize"),params:p.object({appInfo:po.describe("App identification (name and version)."),appCapabilities:Dx.describe("Features and capabilities this app provides."),protocolVersion:p.string().describe("Protocol version this app supports.")})}),Vx=p.object({protocolVersion:p.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:po.describe("Host application identification and version."),hostCapabilities:Zx.describe("Features and capabilities provided by the host."),hostContext:Kh.describe("Rich context about the host environment.")}).passthrough(),Fx={target:"draft-2020-12"};async function Bh(e,t){let r=e["~standard"];if(r.jsonSchema)return r.jsonSchema[t](Fx);if(r.vendor==="zod"){let{z:n}=await Promise.resolve().then(()=>(ao(),ld));return n.toJSONSchema(e,{io:t})}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 Jh(e,t,r=""){let n=await e["~standard"].validate(t);if(n.issues){let o=n.issues.map(i=>{let s=i.path?.map(a=>typeof a=="object"?a.key:a).join(".");return s?`${s}: ${i.message}`:i.message}).join("; ");throw Error(r+o)}return n.value}function Wh(e){let t=document.documentElement;t.setAttribute("data-theme",e),t.style.colorScheme=e}function Gh(e,t=document.documentElement){for(let[r,n]of Object.entries(e))n!==void 0&&t.style.setProperty(r,n)}function Qh(e){if(document.getElementById("__mcp-host-fonts"))return;let t=document.createElement("style");t.id="__mcp-host-fonts",t.textContent=e,document.head.appendChild(t)}var za=class e extends Ad{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_assertInitialized(t){if(this._initializedSent)return;let r=`[ext-apps] App.${t}() 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(r);console.warn(`${r}. This will throw in a future release.`)}eventSchemas={toolinput:Ox,toolinputpartial:Ax,toolresult:Lx,toolcancelled:Cx,hostcontextchanged:Ux};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let r=`[ext-apps] "${String(t)}" 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(r);console.warn(r)}setEventHandler(t,r){r&&this._assertHandlerTiming(t),super.setEventHandler(t,r)}addEventListener(t,r){this._assertHandlerTiming(t),super.addEventListener(t,r)}onEventDispatch(t,r){t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...r})}constructor(t,r={},n={autoResize:!0}){super(n),this._appInfo=t,this._capabilities=r,this.options=n,n.allowUnsafeEval||p.config({jitless:!0}),this.setRequestHandler(Dr,o=>(console.log("Received ping:",o.params),{})),this.setEventHandler("hostcontextchanged",void 0)}registerCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._capabilities=qh(this._capabilities,t)}registerTool(t,r,n){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let o=this,i=()=>{o._initializedSent&&o._capabilities.tools?.listChanged&&o.sendToolListChanged()},s=r.inputSchema!==void 0,a={title:r.title,description:r.description,inputSchema:r.inputSchema,outputSchema:r.outputSchema,annotations:r.annotations,_meta:r._meta,enabled:!0,enable(){this.enabled=!0,i()},disable(){this.enabled=!1,i()},update(c){Object.assign(this,c),i()},remove(){o._registeredTools[t]===a&&(delete o._registeredTools[t],i())},handler:async(c,u)=>{if(!a.enabled)throw Error(`Tool ${t} is disabled`);let l;if(s){let f=a.inputSchema,d=f?await Jh(f,c??{},`Invalid input for tool ${t}: `):c??{};l=await n(d,u)}else l=await n(u);return a.outputSchema&&!l.isError&&(l.structuredContent=await Jh(a.outputSchema,l.structuredContent,`Invalid output for tool ${t}: `)),l}};return this._registeredTools[t]=a,!this._capabilities.tools&&!this.transport&&this.registerCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),i(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,r)=>{let n=this._registeredTools[t.name];if(!n)throw Error(`Tool ${t.name} not found`);return n.handler(t.arguments,r)},this.onlisttools=async(t,r)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([n,o])=>o.enabled).map(async([n,o])=>{let i={name:n,title:o.title,description:o.description,inputSchema:o.inputSchema?await Bh(o.inputSchema,"input"):{type:"object",properties:{}}};return o.outputSchema&&(i.outputSchema=await Bh(o.outputSchema,"output")),o.annotations&&(i.annotations=o.annotations),o._meta&&(i._meta=o._meta),i}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler(Nx,(r,n)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(r.params,n)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler(Sd,(r,n)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(r.params,n)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler(kd,(r,n)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(r.params,n)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${t} registered`)}}assertNotificationCapability(t){}assertTaskCapability(t){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(t){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(t,r){if(this._assertInitialized("callServerTool"),typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},Lr,{onprogress:()=>{},resetTimeoutOnProgress:!0,...r})}async readServerResource(t,r){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},_d,r)}async listServerResources(t,r){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},yd,r)}async createSamplingMessage(t,r){this._assertInitialized("createSamplingMessage");let n=t.tools?Id:Pd;return await this.request({method:"sampling/createMessage",params:t},n,r)}sendMessage(t,r){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},Tx,r)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,r){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},pa,r)}openLink(t,r){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Px,r)}sendOpenLink=this.openLink;downloadFile(t,r){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Ix,r)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,r){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},jx,r)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,r=0,n=0,o=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let s=document.documentElement,a=s.style.height;s.style.height="max-content";let c=Math.ceil(s.getBoundingClientRect().height);s.style.height=a;let u=Math.ceil(window.innerWidth);(u!==r||c!==n)&&(r=u,n=c,this.sendSizeChanged({width:u,height:c}))}))};o();let i=new ResizeObserver(o);return i.observe(document.documentElement),i.observe(document.body),()=>i.disconnect()}async connect(t=new Cd(window.parent,window.parent),r){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1,await super.connect(t);try{let n=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:wx}},Vx,r);if(n===void 0)throw Error(`Server sent invalid initialize result: ${n}`);this._hostCapabilities=n.hostCapabilities,this._hostInfo=n.hostInfo,this._hostContext=n.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(n){throw this.close(),n}}};function va(e){let t=e.content?.map(r=>r.type==="text"?r.text:"").join("");if(e.isError)throw new Error(t||"The tool call failed.");return e.structuredContent?e.structuredContent:JSON.parse(t||"null")}function Yh(e){e&&(e.theme&&Wh(e.theme),e.styles?.variables&&Gh(e.styles.variables),e.styles?.css?.fonts&&Qh(e.styles.css.fonts))}function Xh(e,t){let r=new za({name:`open-brain-${e}`,version:"1.0.0"});return r.ontoolinput=n=>t.onInput?.(n.arguments??{}),r.ontoolresult=n=>t.onResult(n),r.onhostcontextchanged=n=>Yh(n),r.connect().then(()=>Yh(r.getHostContext())).catch(n=>console.error("Open Brain card failed to connect",n)),{async callTool(n,o){return va(await r.callServerTool({name:n,arguments:o}))},async open(n,o){let i=await va(await r.callServerTool({name:"open_item",arguments:{kind:n,id:o}}));i.opened||await r.openLink({url:i.url})},async openUrl(n){if(!/^https?:\/\//i.test(n))throw new Error("Only web links can be opened.");await r.openLink({url:n})},async sendMessage(n){if((await r.sendMessage({role:"user",content:[{type:"text",text:n}]}))?.isError)throw new Error("The chat didn't accept the message.")},tellModel(n){r.updateModelContext({content:[{type:"text",text:n}]}).catch(()=>{})}}}function ka(e){return e instanceof Error?e.message:String(e)}function eg(e,t,r,n){e.addEventListener("click",o=>{let i=o.target.closest("[data-action]");if(!i||i.hasAttribute("disabled"))return;let s=i.dataset.action??"";if(s==="open"){let{kind:a,id:c}=i.dataset;a&&c&&t.open(a,c).catch(u=>r(ka(u)));return}n(s,i)})}function tg(e,t,r){let n=document.createElement("p");n.className=r?"card error":"card loading",n.setAttribute("role",r?"alert":"status"),n.textContent=r??t,e.replaceChildren(n)}function rg(){let e=document.getElementById("root");if(!e)throw new Error("Missing #root");return e}function ng(e){let t=rg(),r,n=!1,o,i=()=>{if(!r){tg(t,e.loading,o);return}t.innerHTML=e.render({item:r,busy:n,error:o})},s=Xh(e.name,{onResult(c){try{r=va(c),o=void 0}catch(u){o=ka(u)}i()}});eg(t,s,c=>{o=c,i()},async c=>{let u=r;if(!u)return;let l=e.local?.[c],f=e.actions?.[c];if(!(!l&&!f)){n=!0,o=void 0,i();try{if(l)await l(u,s);else if(f){let d=await s.callTool(f.tool,f.args(u));r=f.refetch?await s.callTool(f.refetch,{id:u.id}):{...u,...d},s.tellModel(`From the ${e.noun} card, the user ${f.did}: "${e.label(u)}" (${u.id}).`)}}catch(d){o=ka(d)}finally{n=!1,i()}}}),i()}function Xe(e){return String(e??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}var qx=864e5;function Nd(e){let t=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function ig(e){if(typeof e=="string"&&/^\d{4}-\d{2}-\d{2}/.test(e))return e.slice(0,10);if(typeof e=="number"&&Number.isFinite(e))return Nd(new Date(e))}function og(e){let[t,r,n]=e.split("-").map(Number);return Date.UTC(t,r-1,n)/qx}function sg(e,t){let r=og(e)-og(t);if(r===0)return"Today";if(r===1)return"Tomorrow";if(r===-1)return"Yesterday";let n=new Date(`${e}T12:00:00`);if(r>1&&r<7)return n.toLocaleDateString(void 0,{weekday:"long"});let o=e.slice(0,4)===t.slice(0,4);return n.toLocaleDateString(void 0,{month:"short",day:"numeric",...o?{}:{year:"numeric"}})}function Hx(e){return e?`<p class="error" role="alert">${Xe(e)}</p>`:""}function Bx(e,t){return`<button class="link push" data-action="open" data-kind="${e}" data-id="${Xe(t)}">Open</button>`}function Jx(e,t){let r=[...(e??[]).map(n=>`<span class="tag">${Xe(n.name)}</span>`),...(t??[]).map(n=>`<span class="person">${Xe(n.name)}</span>`)];return r.length?`<div class="refs flush">${r.join("")}</div>`:""}function Kx(e,t=240){let r=(e??"").replace(/\s+/g," ").trim();if(!r)return"";let n=r.length>t?`${r.slice(0,t-1).trimEnd()}\u2026`:r;return`<p class="notes flush">${Xe(n)}</p>`}function Wx(e,t,r,n,o){return`<article class="card item item-${e}"${o?' aria-busy="true"':""}>
|
|
759
|
+
<header class="item-head">${t}</header>
|
|
760
|
+
${r}
|
|
761
|
+
<footer class="actions flush">${n}</footer>`}function ag(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.round(e%60);return t?`${t}:${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`:`${r}:${String(n).padStart(2,"0")}`}var Zd=1609.344,Gx=.3048;function Qx(e,t){let r=[];if(e.distanceMeters&&r.push(["Distance",t?`${(e.distanceMeters/Zd).toFixed(2)} mi`:`${(e.distanceMeters/1e3).toFixed(2)} km`]),e.movingTimeSec&&r.push(["Moving time",ag(e.movingTimeSec)]),e.distanceMeters&&e.movingTimeSec&&/run|walk|hike/i.test(e.type??"")){let n=e.movingTimeSec/(e.distanceMeters/(t?Zd:1e3));r.push(["Pace",`${ag(n)} /${t?"mi":"km"}`])}else e.averageSpeedMps&&r.push(["Avg speed",t?`${(e.averageSpeedMps*3600/Zd).toFixed(1)} mph`:`${(e.averageSpeedMps*3.6).toFixed(1)} km/h`]);return e.totalElevationGainMeters&&r.push(["Elevation",t?`${Math.round(e.totalElevationGainMeters/Gx)} ft`:`${Math.round(e.totalElevationGainMeters)} m`]),e.averageHeartrate&&r.push(["Avg HR",`${Math.round(e.averageHeartrate)} bpm`]),r}function cg({item:e,today:t,imperial:r,error:n}){let o=ig(typeof e.startDate=="string"?Date.parse(e.startDate):e.startDate),i=[e.type,o?sg(o,t):"",e.gearName].filter(Boolean).map(a=>Xe(a)).join(" \xB7 "),s=Qx(e,r).map(([a,c])=>`<div class="stat"><span>${a}</span><strong>${Xe(c)}</strong></div>`).join("");return`${Wx("activity",`<h1 class="title">${Xe(e.title||e.name||"Activity")}</h1>${i?`<span class="sub">${i}</span>`:""}`,`${s?`<div class="stats flush">${s}</div>`:""}
|
|
762
|
+
${Kx(e.notes)}
|
|
763
|
+
${Jx(e.tags,void 0)}`,Bx("activity",e.id),!1)}
|
|
764
|
+
${Hx(n)}
|
|
765
|
+
</article>`}var Yx=/^en-US$/i.test(navigator.language);ng({name:"activity",noun:"activity",loading:"Loading activity\u2026",label:e=>e.title??e.name??"",render:e=>cg({...e,today:Nd(new Date),imperial:Yx})});})();
|
|
766
|
+
</script>
|
|
767
|
+
</body>
|
|
768
|
+
</html>
|