yk-grid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +355 -0
  3. package/dist/server.cjs +88 -0
  4. package/dist/server.mjs +3144 -0
  5. package/dist/types/DataGrid.d.ts +5 -0
  6. package/dist/types/ai/aiClient.d.ts +3 -0
  7. package/dist/types/ai/applyCommand.d.ts +3 -0
  8. package/dist/types/ai/schema.d.ts +28 -0
  9. package/dist/types/index.d.ts +2 -0
  10. package/dist/types/server/gridAiRoute.d.ts +47 -0
  11. package/dist/types/server/index.d.ts +1 -0
  12. package/dist/types/server/providers/anthropic.d.ts +7 -0
  13. package/dist/types/server/providers/openai.d.ts +7 -0
  14. package/dist/types/server/providers/types.d.ts +3 -0
  15. package/dist/types/server/schema.d.ts +28 -0
  16. package/dist/types/state/aggregations.d.ts +2 -0
  17. package/dist/types/state/exportCsv.d.ts +3 -0
  18. package/dist/types/state/gridReducer.d.ts +43 -0
  19. package/dist/types/state/paginate.d.ts +3 -0
  20. package/dist/types/state/processRows.d.ts +5 -0
  21. package/dist/types/state/selection.d.ts +1 -0
  22. package/dist/types/state/useGridState.d.ts +8 -0
  23. package/dist/types/types.d.ts +106 -0
  24. package/dist/types/ui/AiBar.d.ts +13 -0
  25. package/dist/types/ui/Cell.d.ts +13 -0
  26. package/dist/types/ui/ColumnMenu.d.ts +10 -0
  27. package/dist/types/ui/FilterPanel.d.ts +11 -0
  28. package/dist/types/ui/GroupRow.d.ts +9 -0
  29. package/dist/types/ui/HeaderCell.d.ts +21 -0
  30. package/dist/types/ui/NumberFilter.d.ts +9 -0
  31. package/dist/types/ui/Pagination.d.ts +10 -0
  32. package/dist/types/ui/Row.d.ts +20 -0
  33. package/dist/types/ui/SelectionCell.d.ts +10 -0
  34. package/dist/types/ui/Toolbar.d.ts +21 -0
  35. package/dist/yk-grid.cjs.js +8 -0
  36. package/dist/yk-grid.css +2 -0
  37. package/dist/yk-grid.es.js +1973 -0
  38. package/package.json +90 -0
@@ -0,0 +1,3144 @@
1
+ //#region server/providers/anthropic.ts
2
+ var e = class {
3
+ apiKey;
4
+ model;
5
+ constructor(e = process.env.ANTHROPIC_API_KEY ?? "", t = "claude-haiku-4-5-20251001") {
6
+ if (!e) throw Error("ANTHROPIC_API_KEY is not set");
7
+ this.apiKey = e, this.model = t;
8
+ }
9
+ async complete(e, t) {
10
+ let n = await fetch("https://api.anthropic.com/v1/messages", {
11
+ method: "POST",
12
+ headers: {
13
+ "Content-Type": "application/json",
14
+ "x-api-key": this.apiKey,
15
+ "anthropic-version": "2023-06-01"
16
+ },
17
+ body: JSON.stringify({
18
+ model: this.model,
19
+ max_tokens: 1024,
20
+ system: e,
21
+ messages: [{
22
+ role: "user",
23
+ content: t
24
+ }]
25
+ })
26
+ });
27
+ if (!n.ok) {
28
+ let e = await n.text();
29
+ throw console.error(`Anthropic API error ${n.status}: ${e}`), Error(`AI request failed (status ${n.status})`);
30
+ }
31
+ let r = (await n.json()).content.find((e) => e.type === "text");
32
+ if (!r) throw Error("No text block in Anthropic response");
33
+ return r.text;
34
+ }
35
+ }, t = class {
36
+ apiKey;
37
+ model;
38
+ constructor(e = process.env.OPENAI_API_KEY ?? "", t = "gpt-4o-mini") {
39
+ if (!e) throw Error("OPENAI_API_KEY is not set");
40
+ this.apiKey = e, this.model = t;
41
+ }
42
+ async complete(e, t) {
43
+ let n = await fetch("https://api.openai.com/v1/chat/completions", {
44
+ method: "POST",
45
+ headers: {
46
+ "Content-Type": "application/json",
47
+ Authorization: `Bearer ${this.apiKey}`
48
+ },
49
+ body: JSON.stringify({
50
+ model: this.model,
51
+ response_format: { type: "json_object" },
52
+ messages: [{
53
+ role: "system",
54
+ content: e
55
+ }, {
56
+ role: "user",
57
+ content: t
58
+ }]
59
+ })
60
+ });
61
+ if (!n.ok) {
62
+ let e = await n.text();
63
+ throw console.error(`OpenAI API error ${n.status}: ${e}`), Error(`AI request failed (status ${n.status})`);
64
+ }
65
+ return (await n.json()).choices[0].message.content;
66
+ }
67
+ }, n;
68
+ function r(e, t, n) {
69
+ function r(n, r) {
70
+ if (n._zod || Object.defineProperty(n, "_zod", {
71
+ value: {
72
+ def: r,
73
+ constr: o,
74
+ traits: /* @__PURE__ */ new Set()
75
+ },
76
+ enumerable: !1
77
+ }), n._zod.traits.has(e)) return;
78
+ n._zod.traits.add(e), t(n, r);
79
+ let i = o.prototype, a = Object.keys(i);
80
+ for (let e = 0; e < a.length; e++) {
81
+ let t = a[e];
82
+ t in n || (n[t] = i[t].bind(n));
83
+ }
84
+ }
85
+ let i = n?.Parent ?? Object;
86
+ class a extends i {}
87
+ Object.defineProperty(a, "name", { value: e });
88
+ function o(e) {
89
+ var t;
90
+ let i = n?.Parent ? new a() : this;
91
+ r(i, e), (t = i._zod).deferred ?? (t.deferred = []);
92
+ for (let e of i._zod.deferred) e();
93
+ return i;
94
+ }
95
+ return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, { value: (t) => n?.Parent && t instanceof n.Parent ? !0 : t?._zod?.traits?.has(e) }), Object.defineProperty(o, "name", { value: e }), o;
96
+ }
97
+ var i = class extends Error {
98
+ constructor() {
99
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
100
+ }
101
+ }, a = class extends Error {
102
+ constructor(e) {
103
+ super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
104
+ }
105
+ };
106
+ (n = globalThis).__zod_globalConfig ?? (n.__zod_globalConfig = {});
107
+ var o = globalThis.__zod_globalConfig;
108
+ function s(e) {
109
+ return e && Object.assign(o, e), o;
110
+ }
111
+ //#endregion
112
+ //#region node_modules/zod/v4/core/util.js
113
+ function c(e) {
114
+ let t = Object.values(e).filter((e) => typeof e == "number");
115
+ return Object.entries(e).filter(([e, n]) => t.indexOf(+e) === -1).map(([e, t]) => t);
116
+ }
117
+ function l(e, t) {
118
+ return typeof t == "bigint" ? t.toString() : t;
119
+ }
120
+ function u(e) {
121
+ return { get value() {
122
+ {
123
+ let t = e();
124
+ return Object.defineProperty(this, "value", { value: t }), t;
125
+ }
126
+ throw Error("cached value already set");
127
+ } };
128
+ }
129
+ function d(e) {
130
+ return e == null;
131
+ }
132
+ function f(e) {
133
+ let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
134
+ return e.slice(t, n);
135
+ }
136
+ function p(e, t) {
137
+ let n = e / t, r = Math.round(n), i = 2 ** -52 * Math.max(Math.abs(n), 1);
138
+ return Math.abs(n - r) < i ? 0 : n - r;
139
+ }
140
+ var ee = /* @__PURE__*/ Symbol("evaluating");
141
+ function m(e, t, n) {
142
+ let r;
143
+ Object.defineProperty(e, t, {
144
+ get() {
145
+ if (r !== ee) return r === void 0 && (r = ee, r = n()), r;
146
+ },
147
+ set(n) {
148
+ Object.defineProperty(e, t, { value: n });
149
+ },
150
+ configurable: !0
151
+ });
152
+ }
153
+ function h(e, t, n) {
154
+ Object.defineProperty(e, t, {
155
+ value: n,
156
+ writable: !0,
157
+ enumerable: !0,
158
+ configurable: !0
159
+ });
160
+ }
161
+ function g(...e) {
162
+ let t = {};
163
+ for (let n of e) Object.assign(t, Object.getOwnPropertyDescriptors(n));
164
+ return Object.defineProperties({}, t);
165
+ }
166
+ function te(e) {
167
+ return JSON.stringify(e);
168
+ }
169
+ function ne(e) {
170
+ return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
171
+ }
172
+ var re = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {};
173
+ function _(e) {
174
+ return typeof e == "object" && !!e && !Array.isArray(e);
175
+ }
176
+ var ie = /* @__PURE__*/ u(() => {
177
+ if (o.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
178
+ try {
179
+ return Function(""), !0;
180
+ } catch {
181
+ return !1;
182
+ }
183
+ });
184
+ function v(e) {
185
+ if (_(e) === !1) return !1;
186
+ let t = e.constructor;
187
+ if (t === void 0 || typeof t != "function") return !0;
188
+ let n = t.prototype;
189
+ return !(_(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
190
+ }
191
+ function ae(e) {
192
+ return v(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
193
+ }
194
+ var oe = /* @__PURE__*/ new Set([
195
+ "string",
196
+ "number",
197
+ "symbol"
198
+ ]);
199
+ function y(e) {
200
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
201
+ }
202
+ function b(e, t, n) {
203
+ let r = new e._zod.constr(t ?? e._zod.def);
204
+ return (!t || n?.parent) && (r._zod.parent = e), r;
205
+ }
206
+ function x(e) {
207
+ let t = e;
208
+ if (!t) return {};
209
+ if (typeof t == "string") return { error: () => t };
210
+ if (t?.message !== void 0) {
211
+ if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
212
+ t.error = t.message;
213
+ }
214
+ return delete t.message, typeof t.error == "string" ? {
215
+ ...t,
216
+ error: () => t.error
217
+ } : t;
218
+ }
219
+ function se(e) {
220
+ return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
221
+ }
222
+ var ce = {
223
+ safeint: [-(2 ** 53 - 1), 2 ** 53 - 1],
224
+ int32: [-2147483648, 2147483647],
225
+ uint32: [0, 4294967295],
226
+ float32: [-34028234663852886e22, 34028234663852886e22],
227
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
228
+ };
229
+ function le(e, t) {
230
+ let n = e._zod.def, r = n.checks;
231
+ if (r && r.length > 0) throw Error(".pick() cannot be used on object schemas containing refinements");
232
+ return b(e, g(e._zod.def, {
233
+ get shape() {
234
+ let e = {};
235
+ for (let r in t) {
236
+ if (!(r in n.shape)) throw Error(`Unrecognized key: "${r}"`);
237
+ t[r] && (e[r] = n.shape[r]);
238
+ }
239
+ return h(this, "shape", e), e;
240
+ },
241
+ checks: []
242
+ }));
243
+ }
244
+ function ue(e, t) {
245
+ let n = e._zod.def, r = n.checks;
246
+ if (r && r.length > 0) throw Error(".omit() cannot be used on object schemas containing refinements");
247
+ return b(e, g(e._zod.def, {
248
+ get shape() {
249
+ let r = { ...e._zod.def.shape };
250
+ for (let e in t) {
251
+ if (!(e in n.shape)) throw Error(`Unrecognized key: "${e}"`);
252
+ t[e] && delete r[e];
253
+ }
254
+ return h(this, "shape", r), r;
255
+ },
256
+ checks: []
257
+ }));
258
+ }
259
+ function de(e, t) {
260
+ if (!v(t)) throw Error("Invalid input to extend: expected a plain object");
261
+ let n = e._zod.def.checks;
262
+ if (n && n.length > 0) {
263
+ let n = e._zod.def.shape;
264
+ for (let e in t) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
265
+ }
266
+ return b(e, g(e._zod.def, { get shape() {
267
+ let n = {
268
+ ...e._zod.def.shape,
269
+ ...t
270
+ };
271
+ return h(this, "shape", n), n;
272
+ } }));
273
+ }
274
+ function fe(e, t) {
275
+ if (!v(t)) throw Error("Invalid input to safeExtend: expected a plain object");
276
+ return b(e, g(e._zod.def, { get shape() {
277
+ let n = {
278
+ ...e._zod.def.shape,
279
+ ...t
280
+ };
281
+ return h(this, "shape", n), n;
282
+ } }));
283
+ }
284
+ function pe(e, t) {
285
+ if (e._zod.def.checks?.length) throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
286
+ return b(e, g(e._zod.def, {
287
+ get shape() {
288
+ let n = {
289
+ ...e._zod.def.shape,
290
+ ...t._zod.def.shape
291
+ };
292
+ return h(this, "shape", n), n;
293
+ },
294
+ get catchall() {
295
+ return t._zod.def.catchall;
296
+ },
297
+ checks: t._zod.def.checks ?? []
298
+ }));
299
+ }
300
+ function me(e, t, n) {
301
+ let r = t._zod.def.checks;
302
+ if (r && r.length > 0) throw Error(".partial() cannot be used on object schemas containing refinements");
303
+ return b(t, g(t._zod.def, {
304
+ get shape() {
305
+ let r = t._zod.def.shape, i = { ...r };
306
+ if (n) for (let t in n) {
307
+ if (!(t in r)) throw Error(`Unrecognized key: "${t}"`);
308
+ n[t] && (i[t] = e ? new e({
309
+ type: "optional",
310
+ innerType: r[t]
311
+ }) : r[t]);
312
+ }
313
+ else for (let t in r) i[t] = e ? new e({
314
+ type: "optional",
315
+ innerType: r[t]
316
+ }) : r[t];
317
+ return h(this, "shape", i), i;
318
+ },
319
+ checks: []
320
+ }));
321
+ }
322
+ function he(e, t, n) {
323
+ return b(t, g(t._zod.def, { get shape() {
324
+ let r = t._zod.def.shape, i = { ...r };
325
+ if (n) for (let t in n) {
326
+ if (!(t in i)) throw Error(`Unrecognized key: "${t}"`);
327
+ n[t] && (i[t] = new e({
328
+ type: "nonoptional",
329
+ innerType: r[t]
330
+ }));
331
+ }
332
+ else for (let t in r) i[t] = new e({
333
+ type: "nonoptional",
334
+ innerType: r[t]
335
+ });
336
+ return h(this, "shape", i), i;
337
+ } }));
338
+ }
339
+ function S(e, t = 0) {
340
+ if (e.aborted === !0) return !0;
341
+ for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0;
342
+ return !1;
343
+ }
344
+ function ge(e, t = 0) {
345
+ if (e.aborted === !0) return !0;
346
+ for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0;
347
+ return !1;
348
+ }
349
+ function _e(e, t) {
350
+ return t.map((t) => {
351
+ var n;
352
+ return (n = t).path ?? (n.path = []), t.path.unshift(e), t;
353
+ });
354
+ }
355
+ function C(e) {
356
+ return typeof e == "string" ? e : e?.message;
357
+ }
358
+ function w(e, t, n) {
359
+ let r = e.message ? e.message : C(e.inst?._zod.def?.error?.(e)) ?? C(t?.error?.(e)) ?? C(n.customError?.(e)) ?? C(n.localeError?.(e)) ?? "Invalid input", { inst: i, continue: a, input: o, ...s } = e;
360
+ return s.path ??= [], s.message = r, t?.reportInput && (s.input = o), s;
361
+ }
362
+ function T(e) {
363
+ return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
364
+ }
365
+ function E(...e) {
366
+ let [t, n, r] = e;
367
+ return typeof t == "string" ? {
368
+ message: t,
369
+ code: "custom",
370
+ input: n,
371
+ inst: r
372
+ } : { ...t };
373
+ }
374
+ //#endregion
375
+ //#region node_modules/zod/v4/core/errors.js
376
+ var ve = (e, t) => {
377
+ e.name = "$ZodError", Object.defineProperty(e, "_zod", {
378
+ value: e._zod,
379
+ enumerable: !1
380
+ }), Object.defineProperty(e, "issues", {
381
+ value: t,
382
+ enumerable: !1
383
+ }), e.message = JSON.stringify(t, l, 2), Object.defineProperty(e, "toString", {
384
+ value: () => e.message,
385
+ enumerable: !1
386
+ });
387
+ }, ye = r("$ZodError", ve), be = r("$ZodError", ve, { Parent: Error });
388
+ function xe(e, t = (e) => e.message) {
389
+ let n = {}, r = [];
390
+ for (let i of e.issues) i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : r.push(t(i));
391
+ return {
392
+ formErrors: r,
393
+ fieldErrors: n
394
+ };
395
+ }
396
+ function Se(e, t = (e) => e.message) {
397
+ let n = { _errors: [] }, r = (e, i = []) => {
398
+ for (let a of e.issues) if (a.code === "invalid_union" && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path]));
399
+ else if (a.code === "invalid_key") r({ issues: a.issues }, [...i, ...a.path]);
400
+ else if (a.code === "invalid_element") r({ issues: a.issues }, [...i, ...a.path]);
401
+ else {
402
+ let e = [...i, ...a.path];
403
+ if (e.length === 0) n._errors.push(t(a));
404
+ else {
405
+ let r = n, i = 0;
406
+ for (; i < e.length;) {
407
+ let n = e[i];
408
+ i === e.length - 1 ? (r[n] = r[n] || { _errors: [] }, r[n]._errors.push(t(a))) : r[n] = r[n] || { _errors: [] }, r = r[n], i++;
409
+ }
410
+ }
411
+ }
412
+ };
413
+ return r(e), n;
414
+ }
415
+ //#endregion
416
+ //#region node_modules/zod/v4/core/parse.js
417
+ var D = (e) => (t, n, r, a) => {
418
+ let o = r ? {
419
+ ...r,
420
+ async: !1
421
+ } : { async: !1 }, c = t._zod.run({
422
+ value: n,
423
+ issues: []
424
+ }, o);
425
+ if (c instanceof Promise) throw new i();
426
+ if (c.issues.length) {
427
+ let t = new (a?.Err ?? e)(c.issues.map((e) => w(e, o, s())));
428
+ throw re(t, a?.callee), t;
429
+ }
430
+ return c.value;
431
+ }, O = (e) => async (t, n, r, i) => {
432
+ let a = r ? {
433
+ ...r,
434
+ async: !0
435
+ } : { async: !0 }, o = t._zod.run({
436
+ value: n,
437
+ issues: []
438
+ }, a);
439
+ if (o instanceof Promise && (o = await o), o.issues.length) {
440
+ let t = new (i?.Err ?? e)(o.issues.map((e) => w(e, a, s())));
441
+ throw re(t, i?.callee), t;
442
+ }
443
+ return o.value;
444
+ }, k = (e) => (t, n, r) => {
445
+ let a = r ? {
446
+ ...r,
447
+ async: !1
448
+ } : { async: !1 }, o = t._zod.run({
449
+ value: n,
450
+ issues: []
451
+ }, a);
452
+ if (o instanceof Promise) throw new i();
453
+ return o.issues.length ? {
454
+ success: !1,
455
+ error: new (e ?? ye)(o.issues.map((e) => w(e, a, s())))
456
+ } : {
457
+ success: !0,
458
+ data: o.value
459
+ };
460
+ }, Ce = /* @__PURE__*/ k(be), A = (e) => async (t, n, r) => {
461
+ let i = r ? {
462
+ ...r,
463
+ async: !0
464
+ } : { async: !0 }, a = t._zod.run({
465
+ value: n,
466
+ issues: []
467
+ }, i);
468
+ return a instanceof Promise && (a = await a), a.issues.length ? {
469
+ success: !1,
470
+ error: new e(a.issues.map((e) => w(e, i, s())))
471
+ } : {
472
+ success: !0,
473
+ data: a.value
474
+ };
475
+ }, we = /* @__PURE__*/ A(be), Te = (e) => (t, n, r) => {
476
+ let i = r ? {
477
+ ...r,
478
+ direction: "backward"
479
+ } : { direction: "backward" };
480
+ return D(e)(t, n, i);
481
+ }, Ee = (e) => (t, n, r) => D(e)(t, n, r), De = (e) => async (t, n, r) => {
482
+ let i = r ? {
483
+ ...r,
484
+ direction: "backward"
485
+ } : { direction: "backward" };
486
+ return O(e)(t, n, i);
487
+ }, Oe = (e) => async (t, n, r) => O(e)(t, n, r), ke = (e) => (t, n, r) => {
488
+ let i = r ? {
489
+ ...r,
490
+ direction: "backward"
491
+ } : { direction: "backward" };
492
+ return k(e)(t, n, i);
493
+ }, Ae = (e) => (t, n, r) => k(e)(t, n, r), je = (e) => async (t, n, r) => {
494
+ let i = r ? {
495
+ ...r,
496
+ direction: "backward"
497
+ } : { direction: "backward" };
498
+ return A(e)(t, n, i);
499
+ }, Me = (e) => async (t, n, r) => A(e)(t, n, r), Ne = /^[cC][0-9a-z]{6,}$/, Pe = /^[0-9a-z]+$/, Fe = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Ie = /^[0-9a-vA-V]{20}$/, Le = /^[A-Za-z0-9]{27}$/, Re = /^[a-zA-Z0-9_-]{21}$/, ze = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Be = /^([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})$/, Ve = (e) => e ? 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)$/, He = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Ue = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
500
+ function We() {
501
+ return new RegExp(Ue, "u");
502
+ }
503
+ var Ge = /^(?:(?: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])$/, Ke = /^(([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}|:))$/, qe = /^((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])$/, Je = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ye = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, Xe = /^[A-Za-z0-9_-]*$/, Ze = /^https?$/, Qe = /^\+[1-9]\d{6,14}$/, $e = "(?:(?:\\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])))", et = /*@__PURE__*/ RegExp(`^${$e}$`);
504
+ function tt(e) {
505
+ let t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
506
+ return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
507
+ }
508
+ function nt(e) {
509
+ return RegExp(`^${tt(e)}$`);
510
+ }
511
+ function rt(e) {
512
+ let t = tt({ precision: e.precision }), n = ["Z"];
513
+ e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
514
+ let r = `${t}(?:${n.join("|")})`;
515
+ return RegExp(`^${$e}T(?:${r})$`);
516
+ }
517
+ var it = (e) => {
518
+ let t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
519
+ return RegExp(`^${t}$`);
520
+ }, at = /^-?\d+$/, ot = /^-?\d+(?:\.\d+)?$/, st = /^(?:true|false)$/i, ct = /^[^A-Z]*$/, lt = /^[^a-z]*$/, j = /*@__PURE__*/ r("$ZodCheck", (e, t) => {
521
+ var n;
522
+ e._zod ??= {}, e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
523
+ }), ut = {
524
+ number: "number",
525
+ bigint: "bigint",
526
+ object: "date"
527
+ }, dt = /*@__PURE__*/ r("$ZodCheckLessThan", (e, t) => {
528
+ j.init(e, t);
529
+ let n = ut[typeof t.value];
530
+ e._zod.onattach.push((e) => {
531
+ let n = e._zod.bag, r = (t.inclusive ? n.maximum : n.exclusiveMaximum) ?? Infinity;
532
+ t.value < r && (t.inclusive ? n.maximum = t.value : n.exclusiveMaximum = t.value);
533
+ }), e._zod.check = (r) => {
534
+ (t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
535
+ origin: n,
536
+ code: "too_big",
537
+ maximum: typeof t.value == "object" ? t.value.getTime() : t.value,
538
+ input: r.value,
539
+ inclusive: t.inclusive,
540
+ inst: e,
541
+ continue: !t.abort
542
+ });
543
+ };
544
+ }), ft = /*@__PURE__*/ r("$ZodCheckGreaterThan", (e, t) => {
545
+ j.init(e, t);
546
+ let n = ut[typeof t.value];
547
+ e._zod.onattach.push((e) => {
548
+ let n = e._zod.bag, r = (t.inclusive ? n.minimum : n.exclusiveMinimum) ?? -Infinity;
549
+ t.value > r && (t.inclusive ? n.minimum = t.value : n.exclusiveMinimum = t.value);
550
+ }), e._zod.check = (r) => {
551
+ (t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
552
+ origin: n,
553
+ code: "too_small",
554
+ minimum: typeof t.value == "object" ? t.value.getTime() : t.value,
555
+ input: r.value,
556
+ inclusive: t.inclusive,
557
+ inst: e,
558
+ continue: !t.abort
559
+ });
560
+ };
561
+ }), pt = /*@__PURE__*/ r("$ZodCheckMultipleOf", (e, t) => {
562
+ j.init(e, t), e._zod.onattach.push((e) => {
563
+ var n;
564
+ (n = e._zod.bag).multipleOf ?? (n.multipleOf = t.value);
565
+ }), e._zod.check = (n) => {
566
+ if (typeof n.value != typeof t.value) throw Error("Cannot mix number and bigint in multiple_of check.");
567
+ (typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : p(n.value, t.value) === 0) || n.issues.push({
568
+ origin: typeof n.value,
569
+ code: "not_multiple_of",
570
+ divisor: t.value,
571
+ input: n.value,
572
+ inst: e,
573
+ continue: !t.abort
574
+ });
575
+ };
576
+ }), mt = /*@__PURE__*/ r("$ZodCheckNumberFormat", (e, t) => {
577
+ j.init(e, t), t.format = t.format || "float64";
578
+ let n = t.format?.includes("int"), r = n ? "int" : "number", [i, a] = ce[t.format];
579
+ e._zod.onattach.push((e) => {
580
+ let r = e._zod.bag;
581
+ r.format = t.format, r.minimum = i, r.maximum = a, n && (r.pattern = at);
582
+ }), e._zod.check = (o) => {
583
+ let s = o.value;
584
+ if (n) {
585
+ if (!Number.isInteger(s)) {
586
+ o.issues.push({
587
+ expected: r,
588
+ format: t.format,
589
+ code: "invalid_type",
590
+ continue: !1,
591
+ input: s,
592
+ inst: e
593
+ });
594
+ return;
595
+ }
596
+ if (!Number.isSafeInteger(s)) {
597
+ s > 0 ? o.issues.push({
598
+ input: s,
599
+ code: "too_big",
600
+ maximum: 2 ** 53 - 1,
601
+ note: "Integers must be within the safe integer range.",
602
+ inst: e,
603
+ origin: r,
604
+ inclusive: !0,
605
+ continue: !t.abort
606
+ }) : o.issues.push({
607
+ input: s,
608
+ code: "too_small",
609
+ minimum: -(2 ** 53 - 1),
610
+ note: "Integers must be within the safe integer range.",
611
+ inst: e,
612
+ origin: r,
613
+ inclusive: !0,
614
+ continue: !t.abort
615
+ });
616
+ return;
617
+ }
618
+ }
619
+ s < i && o.issues.push({
620
+ origin: "number",
621
+ input: s,
622
+ code: "too_small",
623
+ minimum: i,
624
+ inclusive: !0,
625
+ inst: e,
626
+ continue: !t.abort
627
+ }), s > a && o.issues.push({
628
+ origin: "number",
629
+ input: s,
630
+ code: "too_big",
631
+ maximum: a,
632
+ inclusive: !0,
633
+ inst: e,
634
+ continue: !t.abort
635
+ });
636
+ };
637
+ }), ht = /*@__PURE__*/ r("$ZodCheckMaxLength", (e, t) => {
638
+ var n;
639
+ j.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
640
+ let t = e.value;
641
+ return !d(t) && t.length !== void 0;
642
+ }), e._zod.onattach.push((e) => {
643
+ let n = e._zod.bag.maximum ?? Infinity;
644
+ t.maximum < n && (e._zod.bag.maximum = t.maximum);
645
+ }), e._zod.check = (n) => {
646
+ let r = n.value;
647
+ if (r.length <= t.maximum) return;
648
+ let i = T(r);
649
+ n.issues.push({
650
+ origin: i,
651
+ code: "too_big",
652
+ maximum: t.maximum,
653
+ inclusive: !0,
654
+ input: r,
655
+ inst: e,
656
+ continue: !t.abort
657
+ });
658
+ };
659
+ }), gt = /*@__PURE__*/ r("$ZodCheckMinLength", (e, t) => {
660
+ var n;
661
+ j.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
662
+ let t = e.value;
663
+ return !d(t) && t.length !== void 0;
664
+ }), e._zod.onattach.push((e) => {
665
+ let n = e._zod.bag.minimum ?? -Infinity;
666
+ t.minimum > n && (e._zod.bag.minimum = t.minimum);
667
+ }), e._zod.check = (n) => {
668
+ let r = n.value;
669
+ if (r.length >= t.minimum) return;
670
+ let i = T(r);
671
+ n.issues.push({
672
+ origin: i,
673
+ code: "too_small",
674
+ minimum: t.minimum,
675
+ inclusive: !0,
676
+ input: r,
677
+ inst: e,
678
+ continue: !t.abort
679
+ });
680
+ };
681
+ }), _t = /*@__PURE__*/ r("$ZodCheckLengthEquals", (e, t) => {
682
+ var n;
683
+ j.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
684
+ let t = e.value;
685
+ return !d(t) && t.length !== void 0;
686
+ }), e._zod.onattach.push((e) => {
687
+ let n = e._zod.bag;
688
+ n.minimum = t.length, n.maximum = t.length, n.length = t.length;
689
+ }), e._zod.check = (n) => {
690
+ let r = n.value, i = r.length;
691
+ if (i === t.length) return;
692
+ let a = T(r), o = i > t.length;
693
+ n.issues.push({
694
+ origin: a,
695
+ ...o ? {
696
+ code: "too_big",
697
+ maximum: t.length
698
+ } : {
699
+ code: "too_small",
700
+ minimum: t.length
701
+ },
702
+ inclusive: !0,
703
+ exact: !0,
704
+ input: n.value,
705
+ inst: e,
706
+ continue: !t.abort
707
+ });
708
+ };
709
+ }), M = /*@__PURE__*/ r("$ZodCheckStringFormat", (e, t) => {
710
+ var n, r;
711
+ j.init(e, t), e._zod.onattach.push((e) => {
712
+ let n = e._zod.bag;
713
+ n.format = t.format, t.pattern && (n.patterns ??= /* @__PURE__ */ new Set(), n.patterns.add(t.pattern));
714
+ }), t.pattern ? (n = e._zod).check ?? (n.check = (n) => {
715
+ t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
716
+ origin: "string",
717
+ code: "invalid_format",
718
+ format: t.format,
719
+ input: n.value,
720
+ ...t.pattern ? { pattern: t.pattern.toString() } : {},
721
+ inst: e,
722
+ continue: !t.abort
723
+ });
724
+ }) : (r = e._zod).check ?? (r.check = () => {});
725
+ }), vt = /*@__PURE__*/ r("$ZodCheckRegex", (e, t) => {
726
+ M.init(e, t), e._zod.check = (n) => {
727
+ t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
728
+ origin: "string",
729
+ code: "invalid_format",
730
+ format: "regex",
731
+ input: n.value,
732
+ pattern: t.pattern.toString(),
733
+ inst: e,
734
+ continue: !t.abort
735
+ });
736
+ };
737
+ }), yt = /*@__PURE__*/ r("$ZodCheckLowerCase", (e, t) => {
738
+ t.pattern ??= ct, M.init(e, t);
739
+ }), bt = /*@__PURE__*/ r("$ZodCheckUpperCase", (e, t) => {
740
+ t.pattern ??= lt, M.init(e, t);
741
+ }), xt = /*@__PURE__*/ r("$ZodCheckIncludes", (e, t) => {
742
+ j.init(e, t);
743
+ let n = y(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
744
+ t.pattern = r, e._zod.onattach.push((e) => {
745
+ let t = e._zod.bag;
746
+ t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(r);
747
+ }), e._zod.check = (n) => {
748
+ n.value.includes(t.includes, t.position) || n.issues.push({
749
+ origin: "string",
750
+ code: "invalid_format",
751
+ format: "includes",
752
+ includes: t.includes,
753
+ input: n.value,
754
+ inst: e,
755
+ continue: !t.abort
756
+ });
757
+ };
758
+ }), St = /*@__PURE__*/ r("$ZodCheckStartsWith", (e, t) => {
759
+ j.init(e, t);
760
+ let n = RegExp(`^${y(t.prefix)}.*`);
761
+ t.pattern ??= n, e._zod.onattach.push((e) => {
762
+ let t = e._zod.bag;
763
+ t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
764
+ }), e._zod.check = (n) => {
765
+ n.value.startsWith(t.prefix) || n.issues.push({
766
+ origin: "string",
767
+ code: "invalid_format",
768
+ format: "starts_with",
769
+ prefix: t.prefix,
770
+ input: n.value,
771
+ inst: e,
772
+ continue: !t.abort
773
+ });
774
+ };
775
+ }), Ct = /*@__PURE__*/ r("$ZodCheckEndsWith", (e, t) => {
776
+ j.init(e, t);
777
+ let n = RegExp(`.*${y(t.suffix)}$`);
778
+ t.pattern ??= n, e._zod.onattach.push((e) => {
779
+ let t = e._zod.bag;
780
+ t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
781
+ }), e._zod.check = (n) => {
782
+ n.value.endsWith(t.suffix) || n.issues.push({
783
+ origin: "string",
784
+ code: "invalid_format",
785
+ format: "ends_with",
786
+ suffix: t.suffix,
787
+ input: n.value,
788
+ inst: e,
789
+ continue: !t.abort
790
+ });
791
+ };
792
+ }), wt = /*@__PURE__*/ r("$ZodCheckOverwrite", (e, t) => {
793
+ j.init(e, t), e._zod.check = (e) => {
794
+ e.value = t.tx(e.value);
795
+ };
796
+ }), Tt = class {
797
+ constructor(e = []) {
798
+ this.content = [], this.indent = 0, this && (this.args = e);
799
+ }
800
+ indented(e) {
801
+ this.indent += 1, e(this), --this.indent;
802
+ }
803
+ write(e) {
804
+ if (typeof e == "function") {
805
+ e(this, { execution: "sync" }), e(this, { execution: "async" });
806
+ return;
807
+ }
808
+ let t = e.split("\n").filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => " ".repeat(this.indent * 2) + e);
809
+ for (let e of r) this.content.push(e);
810
+ }
811
+ compile() {
812
+ let e = Function, t = this?.args, n = [...(this?.content ?? [""]).map((e) => ` ${e}`)];
813
+ return new e(...t, n.join("\n"));
814
+ }
815
+ }, Et = {
816
+ major: 4,
817
+ minor: 4,
818
+ patch: 3
819
+ }, N = /*@__PURE__*/ r("$ZodType", (e, t) => {
820
+ var n;
821
+ e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Et;
822
+ let r = [...e._zod.def.checks ?? []];
823
+ e._zod.traits.has("$ZodCheck") && r.unshift(e);
824
+ for (let t of r) for (let n of t._zod.onattach) n(e);
825
+ if (r.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
826
+ e._zod.run = e._zod.parse;
827
+ });
828
+ else {
829
+ let t = (e, t, n) => {
830
+ let r = S(e), a;
831
+ for (let o of t) {
832
+ if (o._zod.def.when) {
833
+ if (ge(e) || !o._zod.def.when(e)) continue;
834
+ } else if (r) continue;
835
+ let t = e.issues.length, s = o._zod.check(e);
836
+ if (s instanceof Promise && n?.async === !1) throw new i();
837
+ if (a || s instanceof Promise) a = (a ?? Promise.resolve()).then(async () => {
838
+ await s, e.issues.length !== t && (r ||= S(e, t));
839
+ });
840
+ else {
841
+ if (e.issues.length === t) continue;
842
+ r ||= S(e, t);
843
+ }
844
+ }
845
+ return a ? a.then(() => e) : e;
846
+ }, n = (n, a, o) => {
847
+ if (S(n)) return n.aborted = !0, n;
848
+ let s = t(a, r, o);
849
+ if (s instanceof Promise) {
850
+ if (o.async === !1) throw new i();
851
+ return s.then((t) => e._zod.parse(t, o));
852
+ }
853
+ return e._zod.parse(s, o);
854
+ };
855
+ e._zod.run = (a, o) => {
856
+ if (o.skipChecks) return e._zod.parse(a, o);
857
+ if (o.direction === "backward") {
858
+ let t = e._zod.parse({
859
+ value: a.value,
860
+ issues: []
861
+ }, {
862
+ ...o,
863
+ skipChecks: !0
864
+ });
865
+ return t instanceof Promise ? t.then((e) => n(e, a, o)) : n(t, a, o);
866
+ }
867
+ let s = e._zod.parse(a, o);
868
+ if (s instanceof Promise) {
869
+ if (o.async === !1) throw new i();
870
+ return s.then((e) => t(e, r, o));
871
+ }
872
+ return t(s, r, o);
873
+ };
874
+ }
875
+ m(e, "~standard", () => ({
876
+ validate: (t) => {
877
+ try {
878
+ let n = Ce(e, t);
879
+ return n.success ? { value: n.data } : { issues: n.error?.issues };
880
+ } catch {
881
+ return we(e, t).then((e) => e.success ? { value: e.data } : { issues: e.error?.issues });
882
+ }
883
+ },
884
+ vendor: "zod",
885
+ version: 1
886
+ }));
887
+ }), P = /*@__PURE__*/ r("$ZodString", (e, t) => {
888
+ N.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? it(e._zod.bag), e._zod.parse = (n, r) => {
889
+ if (t.coerce) try {
890
+ n.value = String(n.value);
891
+ } catch {}
892
+ return typeof n.value == "string" || n.issues.push({
893
+ expected: "string",
894
+ code: "invalid_type",
895
+ input: n.value,
896
+ inst: e
897
+ }), n;
898
+ };
899
+ }), F = /*@__PURE__*/ r("$ZodStringFormat", (e, t) => {
900
+ M.init(e, t), P.init(e, t);
901
+ }), Dt = /*@__PURE__*/ r("$ZodGUID", (e, t) => {
902
+ t.pattern ??= Be, F.init(e, t);
903
+ }), Ot = /*@__PURE__*/ r("$ZodUUID", (e, t) => {
904
+ if (t.version) {
905
+ let e = {
906
+ v1: 1,
907
+ v2: 2,
908
+ v3: 3,
909
+ v4: 4,
910
+ v5: 5,
911
+ v6: 6,
912
+ v7: 7,
913
+ v8: 8
914
+ }[t.version];
915
+ if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`);
916
+ t.pattern ??= Ve(e);
917
+ } else t.pattern ??= Ve();
918
+ F.init(e, t);
919
+ }), kt = /*@__PURE__*/ r("$ZodEmail", (e, t) => {
920
+ t.pattern ??= He, F.init(e, t);
921
+ }), At = /*@__PURE__*/ r("$ZodURL", (e, t) => {
922
+ F.init(e, t), e._zod.check = (n) => {
923
+ try {
924
+ let r = n.value.trim();
925
+ if (!t.normalize && t.protocol?.source === Ze.source && !/^https?:\/\//i.test(r)) {
926
+ n.issues.push({
927
+ code: "invalid_format",
928
+ format: "url",
929
+ note: "Invalid URL format",
930
+ input: n.value,
931
+ inst: e,
932
+ continue: !t.abort
933
+ });
934
+ return;
935
+ }
936
+ let i = new URL(r);
937
+ t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
938
+ code: "invalid_format",
939
+ format: "url",
940
+ note: "Invalid hostname",
941
+ pattern: t.hostname.source,
942
+ input: n.value,
943
+ inst: e,
944
+ continue: !t.abort
945
+ })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
946
+ code: "invalid_format",
947
+ format: "url",
948
+ note: "Invalid protocol",
949
+ pattern: t.protocol.source,
950
+ input: n.value,
951
+ inst: e,
952
+ continue: !t.abort
953
+ })), t.normalize ? n.value = i.href : n.value = r;
954
+ return;
955
+ } catch {
956
+ n.issues.push({
957
+ code: "invalid_format",
958
+ format: "url",
959
+ input: n.value,
960
+ inst: e,
961
+ continue: !t.abort
962
+ });
963
+ }
964
+ };
965
+ }), jt = /*@__PURE__*/ r("$ZodEmoji", (e, t) => {
966
+ t.pattern ??= We(), F.init(e, t);
967
+ }), Mt = /*@__PURE__*/ r("$ZodNanoID", (e, t) => {
968
+ t.pattern ??= Re, F.init(e, t);
969
+ }), Nt = /*@__PURE__*/ r("$ZodCUID", (e, t) => {
970
+ t.pattern ??= Ne, F.init(e, t);
971
+ }), Pt = /*@__PURE__*/ r("$ZodCUID2", (e, t) => {
972
+ t.pattern ??= Pe, F.init(e, t);
973
+ }), Ft = /*@__PURE__*/ r("$ZodULID", (e, t) => {
974
+ t.pattern ??= Fe, F.init(e, t);
975
+ }), It = /*@__PURE__*/ r("$ZodXID", (e, t) => {
976
+ t.pattern ??= Ie, F.init(e, t);
977
+ }), Lt = /*@__PURE__*/ r("$ZodKSUID", (e, t) => {
978
+ t.pattern ??= Le, F.init(e, t);
979
+ }), Rt = /*@__PURE__*/ r("$ZodISODateTime", (e, t) => {
980
+ t.pattern ??= rt(t), F.init(e, t);
981
+ }), zt = /*@__PURE__*/ r("$ZodISODate", (e, t) => {
982
+ t.pattern ??= et, F.init(e, t);
983
+ }), Bt = /*@__PURE__*/ r("$ZodISOTime", (e, t) => {
984
+ t.pattern ??= nt(t), F.init(e, t);
985
+ }), Vt = /*@__PURE__*/ r("$ZodISODuration", (e, t) => {
986
+ t.pattern ??= ze, F.init(e, t);
987
+ }), Ht = /*@__PURE__*/ r("$ZodIPv4", (e, t) => {
988
+ t.pattern ??= Ge, F.init(e, t), e._zod.bag.format = "ipv4";
989
+ }), Ut = /*@__PURE__*/ r("$ZodIPv6", (e, t) => {
990
+ t.pattern ??= Ke, F.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
991
+ try {
992
+ new URL(`http://[${n.value}]`);
993
+ } catch {
994
+ n.issues.push({
995
+ code: "invalid_format",
996
+ format: "ipv6",
997
+ input: n.value,
998
+ inst: e,
999
+ continue: !t.abort
1000
+ });
1001
+ }
1002
+ };
1003
+ }), Wt = /*@__PURE__*/ r("$ZodCIDRv4", (e, t) => {
1004
+ t.pattern ??= qe, F.init(e, t);
1005
+ }), Gt = /*@__PURE__*/ r("$ZodCIDRv6", (e, t) => {
1006
+ t.pattern ??= Je, F.init(e, t), e._zod.check = (n) => {
1007
+ let r = n.value.split("/");
1008
+ try {
1009
+ if (r.length !== 2) throw Error();
1010
+ let [e, t] = r;
1011
+ if (!t) throw Error();
1012
+ let n = Number(t);
1013
+ if (`${n}` !== t || n < 0 || n > 128) throw Error();
1014
+ new URL(`http://[${e}]`);
1015
+ } catch {
1016
+ n.issues.push({
1017
+ code: "invalid_format",
1018
+ format: "cidrv6",
1019
+ input: n.value,
1020
+ inst: e,
1021
+ continue: !t.abort
1022
+ });
1023
+ }
1024
+ };
1025
+ });
1026
+ function Kt(e) {
1027
+ if (e === "") return !0;
1028
+ if (/\s/.test(e) || e.length % 4 != 0) return !1;
1029
+ try {
1030
+ return atob(e), !0;
1031
+ } catch {
1032
+ return !1;
1033
+ }
1034
+ }
1035
+ var qt = /*@__PURE__*/ r("$ZodBase64", (e, t) => {
1036
+ t.pattern ??= Ye, F.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
1037
+ Kt(n.value) || n.issues.push({
1038
+ code: "invalid_format",
1039
+ format: "base64",
1040
+ input: n.value,
1041
+ inst: e,
1042
+ continue: !t.abort
1043
+ });
1044
+ };
1045
+ });
1046
+ function Jt(e) {
1047
+ if (!Xe.test(e)) return !1;
1048
+ let t = e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/");
1049
+ return Kt(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
1050
+ }
1051
+ var Yt = /*@__PURE__*/ r("$ZodBase64URL", (e, t) => {
1052
+ t.pattern ??= Xe, F.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
1053
+ Jt(n.value) || n.issues.push({
1054
+ code: "invalid_format",
1055
+ format: "base64url",
1056
+ input: n.value,
1057
+ inst: e,
1058
+ continue: !t.abort
1059
+ });
1060
+ };
1061
+ }), Xt = /*@__PURE__*/ r("$ZodE164", (e, t) => {
1062
+ t.pattern ??= Qe, F.init(e, t);
1063
+ });
1064
+ function Zt(e, t = null) {
1065
+ try {
1066
+ let n = e.split(".");
1067
+ if (n.length !== 3) return !1;
1068
+ let [r] = n;
1069
+ if (!r) return !1;
1070
+ let i = JSON.parse(atob(r));
1071
+ return !("typ" in i && i?.typ !== "JWT" || !i.alg || t && (!("alg" in i) || i.alg !== t));
1072
+ } catch {
1073
+ return !1;
1074
+ }
1075
+ }
1076
+ var Qt = /*@__PURE__*/ r("$ZodJWT", (e, t) => {
1077
+ F.init(e, t), e._zod.check = (n) => {
1078
+ Zt(n.value, t.alg) || n.issues.push({
1079
+ code: "invalid_format",
1080
+ format: "jwt",
1081
+ input: n.value,
1082
+ inst: e,
1083
+ continue: !t.abort
1084
+ });
1085
+ };
1086
+ }), $t = /*@__PURE__*/ r("$ZodNumber", (e, t) => {
1087
+ N.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? ot, e._zod.parse = (n, r) => {
1088
+ if (t.coerce) try {
1089
+ n.value = Number(n.value);
1090
+ } catch {}
1091
+ let i = n.value;
1092
+ if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i)) return n;
1093
+ let a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
1094
+ return n.issues.push({
1095
+ expected: "number",
1096
+ code: "invalid_type",
1097
+ input: i,
1098
+ inst: e,
1099
+ ...a ? { received: a } : {}
1100
+ }), n;
1101
+ };
1102
+ }), en = /*@__PURE__*/ r("$ZodNumberFormat", (e, t) => {
1103
+ mt.init(e, t), $t.init(e, t);
1104
+ }), tn = /*@__PURE__*/ r("$ZodBoolean", (e, t) => {
1105
+ N.init(e, t), e._zod.pattern = st, e._zod.parse = (n, r) => {
1106
+ if (t.coerce) try {
1107
+ n.value = !!n.value;
1108
+ } catch {}
1109
+ let i = n.value;
1110
+ return typeof i == "boolean" || n.issues.push({
1111
+ expected: "boolean",
1112
+ code: "invalid_type",
1113
+ input: i,
1114
+ inst: e
1115
+ }), n;
1116
+ };
1117
+ }), nn = /*@__PURE__*/ r("$ZodUnknown", (e, t) => {
1118
+ N.init(e, t), e._zod.parse = (e) => e;
1119
+ }), rn = /*@__PURE__*/ r("$ZodNever", (e, t) => {
1120
+ N.init(e, t), e._zod.parse = (t, n) => (t.issues.push({
1121
+ expected: "never",
1122
+ code: "invalid_type",
1123
+ input: t.value,
1124
+ inst: e
1125
+ }), t);
1126
+ });
1127
+ function an(e, t, n) {
1128
+ e.issues.length && t.issues.push(..._e(n, e.issues)), t.value[n] = e.value;
1129
+ }
1130
+ var on = /*@__PURE__*/ r("$ZodArray", (e, t) => {
1131
+ N.init(e, t), e._zod.parse = (n, r) => {
1132
+ let i = n.value;
1133
+ if (!Array.isArray(i)) return n.issues.push({
1134
+ expected: "array",
1135
+ code: "invalid_type",
1136
+ input: i,
1137
+ inst: e
1138
+ }), n;
1139
+ n.value = Array(i.length);
1140
+ let a = [];
1141
+ for (let e = 0; e < i.length; e++) {
1142
+ let o = i[e], s = t.element._zod.run({
1143
+ value: o,
1144
+ issues: []
1145
+ }, r);
1146
+ s instanceof Promise ? a.push(s.then((t) => an(t, n, e))) : an(s, n, e);
1147
+ }
1148
+ return a.length ? Promise.all(a).then(() => n) : n;
1149
+ };
1150
+ });
1151
+ function I(e, t, n, r, i, a) {
1152
+ let o = n in r;
1153
+ if (e.issues.length) {
1154
+ if (i && a && !o) return;
1155
+ t.issues.push(..._e(n, e.issues));
1156
+ }
1157
+ if (!o && !i) {
1158
+ e.issues.length || t.issues.push({
1159
+ code: "invalid_type",
1160
+ expected: "nonoptional",
1161
+ input: void 0,
1162
+ path: [n]
1163
+ });
1164
+ return;
1165
+ }
1166
+ e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
1167
+ }
1168
+ function sn(e) {
1169
+ let t = Object.keys(e.shape);
1170
+ for (let n of t) if (!e.shape?.[n]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${n}": expected a Zod schema`);
1171
+ let n = se(e.shape);
1172
+ return {
1173
+ ...e,
1174
+ keys: t,
1175
+ keySet: new Set(t),
1176
+ numKeys: t.length,
1177
+ optionalKeys: new Set(n)
1178
+ };
1179
+ }
1180
+ function cn(e, t, n, r, i, a) {
1181
+ let o = [], s = i.keySet, c = i.catchall._zod, l = c.def.type, u = c.optin === "optional", d = c.optout === "optional";
1182
+ for (let i in t) {
1183
+ if (i === "__proto__" || s.has(i)) continue;
1184
+ if (l === "never") {
1185
+ o.push(i);
1186
+ continue;
1187
+ }
1188
+ let a = c.run({
1189
+ value: t[i],
1190
+ issues: []
1191
+ }, r);
1192
+ a instanceof Promise ? e.push(a.then((e) => I(e, n, i, t, u, d))) : I(a, n, i, t, u, d);
1193
+ }
1194
+ return o.length && n.issues.push({
1195
+ code: "unrecognized_keys",
1196
+ keys: o,
1197
+ input: t,
1198
+ inst: a
1199
+ }), e.length ? Promise.all(e).then(() => n) : n;
1200
+ }
1201
+ var ln = /*@__PURE__*/ r("$ZodObject", (e, t) => {
1202
+ if (N.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
1203
+ let e = t.shape;
1204
+ Object.defineProperty(t, "shape", { get: () => {
1205
+ let n = { ...e };
1206
+ return Object.defineProperty(t, "shape", { value: n }), n;
1207
+ } });
1208
+ }
1209
+ let n = u(() => sn(t));
1210
+ m(e._zod, "propValues", () => {
1211
+ let e = t.shape, n = {};
1212
+ for (let t in e) {
1213
+ let r = e[t]._zod;
1214
+ if (r.values) {
1215
+ n[t] ?? (n[t] = /* @__PURE__ */ new Set());
1216
+ for (let e of r.values) n[t].add(e);
1217
+ }
1218
+ }
1219
+ return n;
1220
+ });
1221
+ let r = _, i = t.catchall, a;
1222
+ e._zod.parse = (t, o) => {
1223
+ a ??= n.value;
1224
+ let s = t.value;
1225
+ if (!r(s)) return t.issues.push({
1226
+ expected: "object",
1227
+ code: "invalid_type",
1228
+ input: s,
1229
+ inst: e
1230
+ }), t;
1231
+ t.value = {};
1232
+ let c = [], l = a.shape;
1233
+ for (let e of a.keys) {
1234
+ let n = l[e], r = n._zod.optin === "optional", i = n._zod.optout === "optional", a = n._zod.run({
1235
+ value: s[e],
1236
+ issues: []
1237
+ }, o);
1238
+ a instanceof Promise ? c.push(a.then((n) => I(n, t, e, s, r, i))) : I(a, t, e, s, r, i);
1239
+ }
1240
+ return i ? cn(c, s, t, o, n.value, e) : c.length ? Promise.all(c).then(() => t) : t;
1241
+ };
1242
+ }), un = /*@__PURE__*/ r("$ZodObjectJIT", (e, t) => {
1243
+ ln.init(e, t);
1244
+ let n = e._zod.parse, r = u(() => sn(t)), i = (e) => {
1245
+ let t = new Tt([
1246
+ "shape",
1247
+ "payload",
1248
+ "ctx"
1249
+ ]), n = r.value, i = (e) => {
1250
+ let t = te(e);
1251
+ return `shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`;
1252
+ };
1253
+ t.write("const input = payload.value;");
1254
+ let a = Object.create(null), o = 0;
1255
+ for (let e of n.keys) a[e] = `key_${o++}`;
1256
+ t.write("const newResult = {};");
1257
+ for (let r of n.keys) {
1258
+ let n = a[r], o = te(r), s = e[r], c = s?._zod?.optin === "optional", l = s?._zod?.optout === "optional";
1259
+ t.write(`const ${n} = ${i(r)};`), c && l ? t.write(`
1260
+ if (${n}.issues.length) {
1261
+ if (${o} in input) {
1262
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1263
+ ...iss,
1264
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
1265
+ })));
1266
+ }
1267
+ }
1268
+
1269
+ if (${n}.value === undefined) {
1270
+ if (${o} in input) {
1271
+ newResult[${o}] = undefined;
1272
+ }
1273
+ } else {
1274
+ newResult[${o}] = ${n}.value;
1275
+ }
1276
+
1277
+ `) : c ? t.write(`
1278
+ if (${n}.issues.length) {
1279
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1280
+ ...iss,
1281
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
1282
+ })));
1283
+ }
1284
+
1285
+ if (${n}.value === undefined) {
1286
+ if (${o} in input) {
1287
+ newResult[${o}] = undefined;
1288
+ }
1289
+ } else {
1290
+ newResult[${o}] = ${n}.value;
1291
+ }
1292
+
1293
+ `) : t.write(`
1294
+ const ${n}_present = ${o} in input;
1295
+ if (${n}.issues.length) {
1296
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1297
+ ...iss,
1298
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
1299
+ })));
1300
+ }
1301
+ if (!${n}_present && !${n}.issues.length) {
1302
+ payload.issues.push({
1303
+ code: "invalid_type",
1304
+ expected: "nonoptional",
1305
+ input: undefined,
1306
+ path: [${o}]
1307
+ });
1308
+ }
1309
+
1310
+ if (${n}_present) {
1311
+ if (${n}.value === undefined) {
1312
+ newResult[${o}] = undefined;
1313
+ } else {
1314
+ newResult[${o}] = ${n}.value;
1315
+ }
1316
+ }
1317
+
1318
+ `);
1319
+ }
1320
+ t.write("payload.value = newResult;"), t.write("return payload;");
1321
+ let s = t.compile();
1322
+ return (t, n) => s(e, t, n);
1323
+ }, a, s = _, c = !o.jitless, l = c && ie.value, d = t.catchall, f;
1324
+ e._zod.parse = (o, u) => {
1325
+ f ??= r.value;
1326
+ let p = o.value;
1327
+ return s(p) ? c && l && u?.async === !1 && u.jitless !== !0 ? (a ||= i(t.shape), o = a(o, u), d ? cn([], p, o, u, f, e) : o) : n(o, u) : (o.issues.push({
1328
+ expected: "object",
1329
+ code: "invalid_type",
1330
+ input: p,
1331
+ inst: e
1332
+ }), o);
1333
+ };
1334
+ });
1335
+ function dn(e, t, n, r) {
1336
+ for (let n of e) if (n.issues.length === 0) return t.value = n.value, t;
1337
+ let i = e.filter((e) => !S(e));
1338
+ return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
1339
+ code: "invalid_union",
1340
+ input: t.value,
1341
+ inst: n,
1342
+ errors: e.map((e) => e.issues.map((e) => w(e, r, s())))
1343
+ }), t);
1344
+ }
1345
+ var fn = /*@__PURE__*/ r("$ZodUnion", (e, t) => {
1346
+ N.init(e, t), m(e._zod, "optin", () => t.options.some((e) => e._zod.optin === "optional") ? "optional" : void 0), m(e._zod, "optout", () => t.options.some((e) => e._zod.optout === "optional") ? "optional" : void 0), m(e._zod, "values", () => {
1347
+ if (t.options.every((e) => e._zod.values)) return new Set(t.options.flatMap((e) => Array.from(e._zod.values)));
1348
+ }), m(e._zod, "pattern", () => {
1349
+ if (t.options.every((e) => e._zod.pattern)) {
1350
+ let e = t.options.map((e) => e._zod.pattern);
1351
+ return RegExp(`^(${e.map((e) => f(e.source)).join("|")})$`);
1352
+ }
1353
+ });
1354
+ let n = t.options.length === 1 ? t.options[0]._zod.run : null;
1355
+ e._zod.parse = (r, i) => {
1356
+ if (n) return n(r, i);
1357
+ let a = !1, o = [];
1358
+ for (let e of t.options) {
1359
+ let t = e._zod.run({
1360
+ value: r.value,
1361
+ issues: []
1362
+ }, i);
1363
+ if (t instanceof Promise) o.push(t), a = !0;
1364
+ else {
1365
+ if (t.issues.length === 0) return t;
1366
+ o.push(t);
1367
+ }
1368
+ }
1369
+ return a ? Promise.all(o).then((t) => dn(t, r, e, i)) : dn(o, r, e, i);
1370
+ };
1371
+ }), pn = /*@__PURE__*/ r("$ZodIntersection", (e, t) => {
1372
+ N.init(e, t), e._zod.parse = (e, n) => {
1373
+ let r = e.value, i = t.left._zod.run({
1374
+ value: r,
1375
+ issues: []
1376
+ }, n), a = t.right._zod.run({
1377
+ value: r,
1378
+ issues: []
1379
+ }, n);
1380
+ return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => mn(e, t, n)) : mn(e, i, a);
1381
+ };
1382
+ });
1383
+ function L(e, t) {
1384
+ if (e === t || e instanceof Date && t instanceof Date && +e == +t) return {
1385
+ valid: !0,
1386
+ data: e
1387
+ };
1388
+ if (v(e) && v(t)) {
1389
+ let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = {
1390
+ ...e,
1391
+ ...t
1392
+ };
1393
+ for (let n of r) {
1394
+ let r = L(e[n], t[n]);
1395
+ if (!r.valid) return {
1396
+ valid: !1,
1397
+ mergeErrorPath: [n, ...r.mergeErrorPath]
1398
+ };
1399
+ i[n] = r.data;
1400
+ }
1401
+ return {
1402
+ valid: !0,
1403
+ data: i
1404
+ };
1405
+ }
1406
+ if (Array.isArray(e) && Array.isArray(t)) {
1407
+ if (e.length !== t.length) return {
1408
+ valid: !1,
1409
+ mergeErrorPath: []
1410
+ };
1411
+ let n = [];
1412
+ for (let r = 0; r < e.length; r++) {
1413
+ let i = e[r], a = t[r], o = L(i, a);
1414
+ if (!o.valid) return {
1415
+ valid: !1,
1416
+ mergeErrorPath: [r, ...o.mergeErrorPath]
1417
+ };
1418
+ n.push(o.data);
1419
+ }
1420
+ return {
1421
+ valid: !0,
1422
+ data: n
1423
+ };
1424
+ }
1425
+ return {
1426
+ valid: !1,
1427
+ mergeErrorPath: []
1428
+ };
1429
+ }
1430
+ function mn(e, t, n) {
1431
+ let r = /* @__PURE__ */ new Map(), i;
1432
+ for (let n of t.issues) if (n.code === "unrecognized_keys") {
1433
+ i ??= n;
1434
+ for (let e of n.keys) r.has(e) || r.set(e, {}), r.get(e).l = !0;
1435
+ } else e.issues.push(n);
1436
+ for (let t of n.issues) if (t.code === "unrecognized_keys") for (let e of t.keys) r.has(e) || r.set(e, {}), r.get(e).r = !0;
1437
+ else e.issues.push(t);
1438
+ let a = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e);
1439
+ if (a.length && i && e.issues.push({
1440
+ ...i,
1441
+ keys: a
1442
+ }), S(e)) return e;
1443
+ let o = L(t.value, n.value);
1444
+ if (!o.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
1445
+ return e.value = o.data, e;
1446
+ }
1447
+ var hn = /*@__PURE__*/ r("$ZodEnum", (e, t) => {
1448
+ N.init(e, t);
1449
+ let n = c(t.entries), r = new Set(n);
1450
+ e._zod.values = r, e._zod.pattern = RegExp(`^(${n.filter((e) => oe.has(typeof e)).map((e) => typeof e == "string" ? y(e) : e.toString()).join("|")})$`), e._zod.parse = (t, i) => {
1451
+ let a = t.value;
1452
+ return r.has(a) || t.issues.push({
1453
+ code: "invalid_value",
1454
+ values: n,
1455
+ input: a,
1456
+ inst: e
1457
+ }), t;
1458
+ };
1459
+ }), gn = /*@__PURE__*/ r("$ZodTransform", (e, t) => {
1460
+ N.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
1461
+ if (r.direction === "backward") throw new a(e.constructor.name);
1462
+ let o = t.transform(n.value, n);
1463
+ if (r.async) return (o instanceof Promise ? o : Promise.resolve(o)).then((e) => (n.value = e, n.fallback = !0, n));
1464
+ if (o instanceof Promise) throw new i();
1465
+ return n.value = o, n.fallback = !0, n;
1466
+ };
1467
+ });
1468
+ function _n(e, t) {
1469
+ return t === void 0 && (e.issues.length || e.fallback) ? {
1470
+ issues: [],
1471
+ value: void 0
1472
+ } : e;
1473
+ }
1474
+ var vn = /*@__PURE__*/ r("$ZodOptional", (e, t) => {
1475
+ N.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", m(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, void 0]) : void 0), m(e._zod, "pattern", () => {
1476
+ let e = t.innerType._zod.pattern;
1477
+ return e ? RegExp(`^(${f(e.source)})?$`) : void 0;
1478
+ }), e._zod.parse = (e, n) => {
1479
+ if (t.innerType._zod.optin === "optional") {
1480
+ let r = e.value, i = t.innerType._zod.run(e, n);
1481
+ return i instanceof Promise ? i.then((e) => _n(e, r)) : _n(i, r);
1482
+ }
1483
+ return e.value === void 0 ? e : t.innerType._zod.run(e, n);
1484
+ };
1485
+ }), yn = /*@__PURE__*/ r("$ZodExactOptional", (e, t) => {
1486
+ vn.init(e, t), m(e._zod, "values", () => t.innerType._zod.values), m(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (e, n) => t.innerType._zod.run(e, n);
1487
+ }), bn = /*@__PURE__*/ r("$ZodNullable", (e, t) => {
1488
+ N.init(e, t), m(e._zod, "optin", () => t.innerType._zod.optin), m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "pattern", () => {
1489
+ let e = t.innerType._zod.pattern;
1490
+ return e ? RegExp(`^(${f(e.source)}|null)$`) : void 0;
1491
+ }), m(e._zod, "values", () => t.innerType._zod.values ? new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n);
1492
+ }), xn = /*@__PURE__*/ r("$ZodDefault", (e, t) => {
1493
+ N.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1494
+ if (n.direction === "backward") return t.innerType._zod.run(e, n);
1495
+ if (e.value === void 0) return e.value = t.defaultValue, e;
1496
+ let r = t.innerType._zod.run(e, n);
1497
+ return r instanceof Promise ? r.then((e) => Sn(e, t)) : Sn(r, t);
1498
+ };
1499
+ });
1500
+ function Sn(e, t) {
1501
+ return e.value === void 0 && (e.value = t.defaultValue), e;
1502
+ }
1503
+ var Cn = /*@__PURE__*/ r("$ZodPrefault", (e, t) => {
1504
+ N.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => (n.direction === "backward" || e.value === void 0 && (e.value = t.defaultValue), t.innerType._zod.run(e, n));
1505
+ }), wn = /*@__PURE__*/ r("$ZodNonOptional", (e, t) => {
1506
+ N.init(e, t), m(e._zod, "values", () => {
1507
+ let e = t.innerType._zod.values;
1508
+ return e ? new Set([...e].filter((e) => e !== void 0)) : void 0;
1509
+ }), e._zod.parse = (n, r) => {
1510
+ let i = t.innerType._zod.run(n, r);
1511
+ return i instanceof Promise ? i.then((t) => Tn(t, e)) : Tn(i, e);
1512
+ };
1513
+ });
1514
+ function Tn(e, t) {
1515
+ return !e.issues.length && e.value === void 0 && e.issues.push({
1516
+ code: "invalid_type",
1517
+ expected: "nonoptional",
1518
+ input: e.value,
1519
+ inst: t
1520
+ }), e;
1521
+ }
1522
+ var En = /*@__PURE__*/ r("$ZodCatch", (e, t) => {
1523
+ N.init(e, t), e._zod.optin = "optional", m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1524
+ if (n.direction === "backward") return t.innerType._zod.run(e, n);
1525
+ let r = t.innerType._zod.run(e, n);
1526
+ return r instanceof Promise ? r.then((r) => (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1527
+ ...e,
1528
+ error: { issues: r.issues.map((e) => w(e, n, s())) },
1529
+ input: e.value
1530
+ }), e.issues = [], e.fallback = !0), e)) : (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1531
+ ...e,
1532
+ error: { issues: r.issues.map((e) => w(e, n, s())) },
1533
+ input: e.value
1534
+ }), e.issues = [], e.fallback = !0), e);
1535
+ };
1536
+ }), Dn = /*@__PURE__*/ r("$ZodPipe", (e, t) => {
1537
+ N.init(e, t), m(e._zod, "values", () => t.in._zod.values), m(e._zod, "optin", () => t.in._zod.optin), m(e._zod, "optout", () => t.out._zod.optout), m(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (e, n) => {
1538
+ if (n.direction === "backward") {
1539
+ let r = t.out._zod.run(e, n);
1540
+ return r instanceof Promise ? r.then((e) => R(e, t.in, n)) : R(r, t.in, n);
1541
+ }
1542
+ let r = t.in._zod.run(e, n);
1543
+ return r instanceof Promise ? r.then((e) => R(e, t.out, n)) : R(r, t.out, n);
1544
+ };
1545
+ });
1546
+ function R(e, t, n) {
1547
+ return e.issues.length ? (e.aborted = !0, e) : t._zod.run({
1548
+ value: e.value,
1549
+ issues: e.issues,
1550
+ fallback: e.fallback
1551
+ }, n);
1552
+ }
1553
+ var On = /*@__PURE__*/ r("$ZodReadonly", (e, t) => {
1554
+ N.init(e, t), m(e._zod, "propValues", () => t.innerType._zod.propValues), m(e._zod, "values", () => t.innerType._zod.values), m(e._zod, "optin", () => t.innerType?._zod?.optin), m(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (e, n) => {
1555
+ if (n.direction === "backward") return t.innerType._zod.run(e, n);
1556
+ let r = t.innerType._zod.run(e, n);
1557
+ return r instanceof Promise ? r.then(kn) : kn(r);
1558
+ };
1559
+ });
1560
+ function kn(e) {
1561
+ return e.value = Object.freeze(e.value), e;
1562
+ }
1563
+ var An = /*@__PURE__*/ r("$ZodCustom", (e, t) => {
1564
+ j.init(e, t), N.init(e, t), e._zod.parse = (e, t) => e, e._zod.check = (n) => {
1565
+ let r = n.value, i = t.fn(r);
1566
+ if (i instanceof Promise) return i.then((t) => jn(t, n, r, e));
1567
+ jn(i, n, r, e);
1568
+ };
1569
+ });
1570
+ function jn(e, t, n, r) {
1571
+ if (!e) {
1572
+ let e = {
1573
+ code: "custom",
1574
+ input: n,
1575
+ inst: r,
1576
+ path: [...r._zod.def.path ?? []],
1577
+ continue: !r._zod.def.abort
1578
+ };
1579
+ r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(E(e));
1580
+ }
1581
+ }
1582
+ //#endregion
1583
+ //#region node_modules/zod/v4/core/registries.js
1584
+ var Mn, Nn = class {
1585
+ constructor() {
1586
+ this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1587
+ }
1588
+ add(e, ...t) {
1589
+ let n = t[0];
1590
+ return this._map.set(e, n), n && typeof n == "object" && "id" in n && this._idmap.set(n.id, e), this;
1591
+ }
1592
+ clear() {
1593
+ return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1594
+ }
1595
+ remove(e) {
1596
+ let t = this._map.get(e);
1597
+ return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(e), this;
1598
+ }
1599
+ get(e) {
1600
+ let t = e._zod.parent;
1601
+ if (t) {
1602
+ let n = { ...this.get(t) ?? {} };
1603
+ delete n.id;
1604
+ let r = {
1605
+ ...n,
1606
+ ...this._map.get(e)
1607
+ };
1608
+ return Object.keys(r).length ? r : void 0;
1609
+ }
1610
+ return this._map.get(e);
1611
+ }
1612
+ has(e) {
1613
+ return this._map.has(e);
1614
+ }
1615
+ };
1616
+ function Pn() {
1617
+ return new Nn();
1618
+ }
1619
+ (Mn = globalThis).__zod_globalRegistry ?? (Mn.__zod_globalRegistry = Pn());
1620
+ var z = globalThis.__zod_globalRegistry;
1621
+ //#endregion
1622
+ //#region node_modules/zod/v4/core/api.js
1623
+ // @__NO_SIDE_EFFECTS__
1624
+ function Fn(e, t) {
1625
+ return new e({
1626
+ type: "string",
1627
+ ...x(t)
1628
+ });
1629
+ }
1630
+ // @__NO_SIDE_EFFECTS__
1631
+ function In(e, t) {
1632
+ return new e({
1633
+ type: "string",
1634
+ format: "email",
1635
+ check: "string_format",
1636
+ abort: !1,
1637
+ ...x(t)
1638
+ });
1639
+ }
1640
+ // @__NO_SIDE_EFFECTS__
1641
+ function Ln(e, t) {
1642
+ return new e({
1643
+ type: "string",
1644
+ format: "guid",
1645
+ check: "string_format",
1646
+ abort: !1,
1647
+ ...x(t)
1648
+ });
1649
+ }
1650
+ // @__NO_SIDE_EFFECTS__
1651
+ function Rn(e, t) {
1652
+ return new e({
1653
+ type: "string",
1654
+ format: "uuid",
1655
+ check: "string_format",
1656
+ abort: !1,
1657
+ ...x(t)
1658
+ });
1659
+ }
1660
+ // @__NO_SIDE_EFFECTS__
1661
+ function zn(e, t) {
1662
+ return new e({
1663
+ type: "string",
1664
+ format: "uuid",
1665
+ check: "string_format",
1666
+ abort: !1,
1667
+ version: "v4",
1668
+ ...x(t)
1669
+ });
1670
+ }
1671
+ // @__NO_SIDE_EFFECTS__
1672
+ function Bn(e, t) {
1673
+ return new e({
1674
+ type: "string",
1675
+ format: "uuid",
1676
+ check: "string_format",
1677
+ abort: !1,
1678
+ version: "v6",
1679
+ ...x(t)
1680
+ });
1681
+ }
1682
+ // @__NO_SIDE_EFFECTS__
1683
+ function Vn(e, t) {
1684
+ return new e({
1685
+ type: "string",
1686
+ format: "uuid",
1687
+ check: "string_format",
1688
+ abort: !1,
1689
+ version: "v7",
1690
+ ...x(t)
1691
+ });
1692
+ }
1693
+ // @__NO_SIDE_EFFECTS__
1694
+ function Hn(e, t) {
1695
+ return new e({
1696
+ type: "string",
1697
+ format: "url",
1698
+ check: "string_format",
1699
+ abort: !1,
1700
+ ...x(t)
1701
+ });
1702
+ }
1703
+ // @__NO_SIDE_EFFECTS__
1704
+ function Un(e, t) {
1705
+ return new e({
1706
+ type: "string",
1707
+ format: "emoji",
1708
+ check: "string_format",
1709
+ abort: !1,
1710
+ ...x(t)
1711
+ });
1712
+ }
1713
+ // @__NO_SIDE_EFFECTS__
1714
+ function Wn(e, t) {
1715
+ return new e({
1716
+ type: "string",
1717
+ format: "nanoid",
1718
+ check: "string_format",
1719
+ abort: !1,
1720
+ ...x(t)
1721
+ });
1722
+ }
1723
+ // @__NO_SIDE_EFFECTS__
1724
+ function Gn(e, t) {
1725
+ return new e({
1726
+ type: "string",
1727
+ format: "cuid",
1728
+ check: "string_format",
1729
+ abort: !1,
1730
+ ...x(t)
1731
+ });
1732
+ }
1733
+ // @__NO_SIDE_EFFECTS__
1734
+ function Kn(e, t) {
1735
+ return new e({
1736
+ type: "string",
1737
+ format: "cuid2",
1738
+ check: "string_format",
1739
+ abort: !1,
1740
+ ...x(t)
1741
+ });
1742
+ }
1743
+ // @__NO_SIDE_EFFECTS__
1744
+ function qn(e, t) {
1745
+ return new e({
1746
+ type: "string",
1747
+ format: "ulid",
1748
+ check: "string_format",
1749
+ abort: !1,
1750
+ ...x(t)
1751
+ });
1752
+ }
1753
+ // @__NO_SIDE_EFFECTS__
1754
+ function Jn(e, t) {
1755
+ return new e({
1756
+ type: "string",
1757
+ format: "xid",
1758
+ check: "string_format",
1759
+ abort: !1,
1760
+ ...x(t)
1761
+ });
1762
+ }
1763
+ // @__NO_SIDE_EFFECTS__
1764
+ function Yn(e, t) {
1765
+ return new e({
1766
+ type: "string",
1767
+ format: "ksuid",
1768
+ check: "string_format",
1769
+ abort: !1,
1770
+ ...x(t)
1771
+ });
1772
+ }
1773
+ // @__NO_SIDE_EFFECTS__
1774
+ function Xn(e, t) {
1775
+ return new e({
1776
+ type: "string",
1777
+ format: "ipv4",
1778
+ check: "string_format",
1779
+ abort: !1,
1780
+ ...x(t)
1781
+ });
1782
+ }
1783
+ // @__NO_SIDE_EFFECTS__
1784
+ function Zn(e, t) {
1785
+ return new e({
1786
+ type: "string",
1787
+ format: "ipv6",
1788
+ check: "string_format",
1789
+ abort: !1,
1790
+ ...x(t)
1791
+ });
1792
+ }
1793
+ // @__NO_SIDE_EFFECTS__
1794
+ function Qn(e, t) {
1795
+ return new e({
1796
+ type: "string",
1797
+ format: "cidrv4",
1798
+ check: "string_format",
1799
+ abort: !1,
1800
+ ...x(t)
1801
+ });
1802
+ }
1803
+ // @__NO_SIDE_EFFECTS__
1804
+ function $n(e, t) {
1805
+ return new e({
1806
+ type: "string",
1807
+ format: "cidrv6",
1808
+ check: "string_format",
1809
+ abort: !1,
1810
+ ...x(t)
1811
+ });
1812
+ }
1813
+ // @__NO_SIDE_EFFECTS__
1814
+ function er(e, t) {
1815
+ return new e({
1816
+ type: "string",
1817
+ format: "base64",
1818
+ check: "string_format",
1819
+ abort: !1,
1820
+ ...x(t)
1821
+ });
1822
+ }
1823
+ // @__NO_SIDE_EFFECTS__
1824
+ function tr(e, t) {
1825
+ return new e({
1826
+ type: "string",
1827
+ format: "base64url",
1828
+ check: "string_format",
1829
+ abort: !1,
1830
+ ...x(t)
1831
+ });
1832
+ }
1833
+ // @__NO_SIDE_EFFECTS__
1834
+ function nr(e, t) {
1835
+ return new e({
1836
+ type: "string",
1837
+ format: "e164",
1838
+ check: "string_format",
1839
+ abort: !1,
1840
+ ...x(t)
1841
+ });
1842
+ }
1843
+ // @__NO_SIDE_EFFECTS__
1844
+ function rr(e, t) {
1845
+ return new e({
1846
+ type: "string",
1847
+ format: "jwt",
1848
+ check: "string_format",
1849
+ abort: !1,
1850
+ ...x(t)
1851
+ });
1852
+ }
1853
+ // @__NO_SIDE_EFFECTS__
1854
+ function ir(e, t) {
1855
+ return new e({
1856
+ type: "string",
1857
+ format: "datetime",
1858
+ check: "string_format",
1859
+ offset: !1,
1860
+ local: !1,
1861
+ precision: null,
1862
+ ...x(t)
1863
+ });
1864
+ }
1865
+ // @__NO_SIDE_EFFECTS__
1866
+ function ar(e, t) {
1867
+ return new e({
1868
+ type: "string",
1869
+ format: "date",
1870
+ check: "string_format",
1871
+ ...x(t)
1872
+ });
1873
+ }
1874
+ // @__NO_SIDE_EFFECTS__
1875
+ function or(e, t) {
1876
+ return new e({
1877
+ type: "string",
1878
+ format: "time",
1879
+ check: "string_format",
1880
+ precision: null,
1881
+ ...x(t)
1882
+ });
1883
+ }
1884
+ // @__NO_SIDE_EFFECTS__
1885
+ function sr(e, t) {
1886
+ return new e({
1887
+ type: "string",
1888
+ format: "duration",
1889
+ check: "string_format",
1890
+ ...x(t)
1891
+ });
1892
+ }
1893
+ // @__NO_SIDE_EFFECTS__
1894
+ function cr(e, t) {
1895
+ return new e({
1896
+ type: "number",
1897
+ checks: [],
1898
+ ...x(t)
1899
+ });
1900
+ }
1901
+ // @__NO_SIDE_EFFECTS__
1902
+ function lr(e, t) {
1903
+ return new e({
1904
+ type: "number",
1905
+ check: "number_format",
1906
+ abort: !1,
1907
+ format: "safeint",
1908
+ ...x(t)
1909
+ });
1910
+ }
1911
+ // @__NO_SIDE_EFFECTS__
1912
+ function ur(e, t) {
1913
+ return new e({
1914
+ type: "boolean",
1915
+ ...x(t)
1916
+ });
1917
+ }
1918
+ // @__NO_SIDE_EFFECTS__
1919
+ function dr(e) {
1920
+ return new e({ type: "unknown" });
1921
+ }
1922
+ // @__NO_SIDE_EFFECTS__
1923
+ function fr(e, t) {
1924
+ return new e({
1925
+ type: "never",
1926
+ ...x(t)
1927
+ });
1928
+ }
1929
+ // @__NO_SIDE_EFFECTS__
1930
+ function pr(e, t) {
1931
+ return new dt({
1932
+ check: "less_than",
1933
+ ...x(t),
1934
+ value: e,
1935
+ inclusive: !1
1936
+ });
1937
+ }
1938
+ // @__NO_SIDE_EFFECTS__
1939
+ function B(e, t) {
1940
+ return new dt({
1941
+ check: "less_than",
1942
+ ...x(t),
1943
+ value: e,
1944
+ inclusive: !0
1945
+ });
1946
+ }
1947
+ // @__NO_SIDE_EFFECTS__
1948
+ function mr(e, t) {
1949
+ return new ft({
1950
+ check: "greater_than",
1951
+ ...x(t),
1952
+ value: e,
1953
+ inclusive: !1
1954
+ });
1955
+ }
1956
+ // @__NO_SIDE_EFFECTS__
1957
+ function V(e, t) {
1958
+ return new ft({
1959
+ check: "greater_than",
1960
+ ...x(t),
1961
+ value: e,
1962
+ inclusive: !0
1963
+ });
1964
+ }
1965
+ // @__NO_SIDE_EFFECTS__
1966
+ function hr(e, t) {
1967
+ return new pt({
1968
+ check: "multiple_of",
1969
+ ...x(t),
1970
+ value: e
1971
+ });
1972
+ }
1973
+ // @__NO_SIDE_EFFECTS__
1974
+ function gr(e, t) {
1975
+ return new ht({
1976
+ check: "max_length",
1977
+ ...x(t),
1978
+ maximum: e
1979
+ });
1980
+ }
1981
+ // @__NO_SIDE_EFFECTS__
1982
+ function H(e, t) {
1983
+ return new gt({
1984
+ check: "min_length",
1985
+ ...x(t),
1986
+ minimum: e
1987
+ });
1988
+ }
1989
+ // @__NO_SIDE_EFFECTS__
1990
+ function _r(e, t) {
1991
+ return new _t({
1992
+ check: "length_equals",
1993
+ ...x(t),
1994
+ length: e
1995
+ });
1996
+ }
1997
+ // @__NO_SIDE_EFFECTS__
1998
+ function vr(e, t) {
1999
+ return new vt({
2000
+ check: "string_format",
2001
+ format: "regex",
2002
+ ...x(t),
2003
+ pattern: e
2004
+ });
2005
+ }
2006
+ // @__NO_SIDE_EFFECTS__
2007
+ function yr(e) {
2008
+ return new yt({
2009
+ check: "string_format",
2010
+ format: "lowercase",
2011
+ ...x(e)
2012
+ });
2013
+ }
2014
+ // @__NO_SIDE_EFFECTS__
2015
+ function br(e) {
2016
+ return new bt({
2017
+ check: "string_format",
2018
+ format: "uppercase",
2019
+ ...x(e)
2020
+ });
2021
+ }
2022
+ // @__NO_SIDE_EFFECTS__
2023
+ function xr(e, t) {
2024
+ return new xt({
2025
+ check: "string_format",
2026
+ format: "includes",
2027
+ ...x(t),
2028
+ includes: e
2029
+ });
2030
+ }
2031
+ // @__NO_SIDE_EFFECTS__
2032
+ function Sr(e, t) {
2033
+ return new St({
2034
+ check: "string_format",
2035
+ format: "starts_with",
2036
+ ...x(t),
2037
+ prefix: e
2038
+ });
2039
+ }
2040
+ // @__NO_SIDE_EFFECTS__
2041
+ function Cr(e, t) {
2042
+ return new Ct({
2043
+ check: "string_format",
2044
+ format: "ends_with",
2045
+ ...x(t),
2046
+ suffix: e
2047
+ });
2048
+ }
2049
+ // @__NO_SIDE_EFFECTS__
2050
+ function U(e) {
2051
+ return new wt({
2052
+ check: "overwrite",
2053
+ tx: e
2054
+ });
2055
+ }
2056
+ // @__NO_SIDE_EFFECTS__
2057
+ function wr(e) {
2058
+ return /* @__PURE__ */ U((t) => t.normalize(e));
2059
+ }
2060
+ // @__NO_SIDE_EFFECTS__
2061
+ function Tr() {
2062
+ return /* @__PURE__ */ U((e) => e.trim());
2063
+ }
2064
+ // @__NO_SIDE_EFFECTS__
2065
+ function Er() {
2066
+ return /* @__PURE__ */ U((e) => e.toLowerCase());
2067
+ }
2068
+ // @__NO_SIDE_EFFECTS__
2069
+ function Dr() {
2070
+ return /* @__PURE__ */ U((e) => e.toUpperCase());
2071
+ }
2072
+ // @__NO_SIDE_EFFECTS__
2073
+ function Or() {
2074
+ return /* @__PURE__ */ U((e) => ne(e));
2075
+ }
2076
+ // @__NO_SIDE_EFFECTS__
2077
+ function kr(e, t, n) {
2078
+ return new e({
2079
+ type: "array",
2080
+ element: t,
2081
+ ...x(n)
2082
+ });
2083
+ }
2084
+ // @__NO_SIDE_EFFECTS__
2085
+ function Ar(e, t, n) {
2086
+ return new e({
2087
+ type: "custom",
2088
+ check: "custom",
2089
+ fn: t,
2090
+ ...x(n)
2091
+ });
2092
+ }
2093
+ // @__NO_SIDE_EFFECTS__
2094
+ function jr(e, t) {
2095
+ let n = /* @__PURE__ */ Mr((t) => (t.addIssue = (e) => {
2096
+ if (typeof e == "string") t.issues.push(E(e, t.value, n._zod.def));
2097
+ else {
2098
+ let r = e;
2099
+ r.fatal && (r.continue = !1), r.code ??= "custom", r.input ??= t.value, r.inst ??= n, r.continue ??= !n._zod.def.abort, t.issues.push(E(r));
2100
+ }
2101
+ }, e(t.value, t)), t);
2102
+ return n;
2103
+ }
2104
+ // @__NO_SIDE_EFFECTS__
2105
+ function Mr(e, t) {
2106
+ let n = new j({
2107
+ check: "custom",
2108
+ ...x(t)
2109
+ });
2110
+ return n._zod.check = e, n;
2111
+ }
2112
+ //#endregion
2113
+ //#region node_modules/zod/v4/core/to-json-schema.js
2114
+ function Nr(e) {
2115
+ let t = e?.target ?? "draft-2020-12";
2116
+ return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
2117
+ processors: e.processors ?? {},
2118
+ metadataRegistry: e?.metadata ?? z,
2119
+ target: t,
2120
+ unrepresentable: e?.unrepresentable ?? "throw",
2121
+ override: e?.override ?? (() => {}),
2122
+ io: e?.io ?? "output",
2123
+ counter: 0,
2124
+ seen: /* @__PURE__ */ new Map(),
2125
+ cycles: e?.cycles ?? "ref",
2126
+ reused: e?.reused ?? "inline",
2127
+ external: e?.external ?? void 0
2128
+ };
2129
+ }
2130
+ function W(e, t, n = {
2131
+ path: [],
2132
+ schemaPath: []
2133
+ }) {
2134
+ var r;
2135
+ let i = e._zod.def, a = t.seen.get(e);
2136
+ if (a) return a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema;
2137
+ let o = {
2138
+ schema: {},
2139
+ count: 1,
2140
+ cycle: void 0,
2141
+ path: n.path
2142
+ };
2143
+ t.seen.set(e, o);
2144
+ let s = e._zod.toJSONSchema?.();
2145
+ if (s) o.schema = s;
2146
+ else {
2147
+ let r = {
2148
+ ...n,
2149
+ schemaPath: [...n.schemaPath, e],
2150
+ path: n.path
2151
+ };
2152
+ if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r);
2153
+ else {
2154
+ let n = o.schema, a = t.processors[i.type];
2155
+ if (!a) throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
2156
+ a(e, t, n, r);
2157
+ }
2158
+ let a = e._zod.parent;
2159
+ a && (o.ref ||= a, W(a, t, r), t.seen.get(a).isParent = !0);
2160
+ }
2161
+ let c = t.metadataRegistry.get(e);
2162
+ return c && Object.assign(o.schema, c), t.io === "input" && G(e) && (delete o.schema.examples, delete o.schema.default), t.io === "input" && "_prefault" in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema;
2163
+ }
2164
+ function Pr(e, t) {
2165
+ let n = e.seen.get(t);
2166
+ if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
2167
+ let r = /* @__PURE__ */ new Map();
2168
+ for (let t of e.seen.entries()) {
2169
+ let n = e.metadataRegistry.get(t[0])?.id;
2170
+ if (n) {
2171
+ let e = r.get(n);
2172
+ if (e && e !== t[0]) throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2173
+ r.set(n, t[0]);
2174
+ }
2175
+ }
2176
+ let i = (t) => {
2177
+ let r = e.target === "draft-2020-12" ? "$defs" : "definitions";
2178
+ if (e.external) {
2179
+ let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e);
2180
+ if (n) return { ref: i(n) };
2181
+ let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`;
2182
+ return t[1].defId = a, {
2183
+ defId: a,
2184
+ ref: `${i("__shared")}#/${r}/${a}`
2185
+ };
2186
+ }
2187
+ if (t[1] === n) return { ref: "#" };
2188
+ let i = `#/${r}/`, a = t[1].schema.id ?? `__schema${e.counter++}`;
2189
+ return {
2190
+ defId: a,
2191
+ ref: i + a
2192
+ };
2193
+ }, a = (e) => {
2194
+ if (e[1].schema.$ref) return;
2195
+ let t = e[1], { ref: n, defId: r } = i(e);
2196
+ t.def = { ...t.schema }, r && (t.defId = r);
2197
+ let a = t.schema;
2198
+ for (let e in a) delete a[e];
2199
+ a.$ref = n;
2200
+ };
2201
+ if (e.cycles === "throw") for (let t of e.seen.entries()) {
2202
+ let e = t[1];
2203
+ if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
2204
+
2205
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2206
+ }
2207
+ for (let n of e.seen.entries()) {
2208
+ let r = n[1];
2209
+ if (t === n[0]) {
2210
+ a(n);
2211
+ continue;
2212
+ }
2213
+ if (e.external) {
2214
+ let r = e.external.registry.get(n[0])?.id;
2215
+ if (t !== n[0] && r) {
2216
+ a(n);
2217
+ continue;
2218
+ }
2219
+ }
2220
+ if (e.metadataRegistry.get(n[0])?.id) {
2221
+ a(n);
2222
+ continue;
2223
+ }
2224
+ if (r.cycle) {
2225
+ a(n);
2226
+ continue;
2227
+ }
2228
+ if (r.count > 1 && e.reused === "ref") {
2229
+ a(n);
2230
+ continue;
2231
+ }
2232
+ }
2233
+ }
2234
+ function Fr(e, t) {
2235
+ let n = e.seen.get(t);
2236
+ if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
2237
+ let r = (t) => {
2238
+ let n = e.seen.get(t);
2239
+ if (n.ref === null) return;
2240
+ let i = n.def ?? n.schema, a = { ...i }, o = n.ref;
2241
+ if (n.ref = null, o) {
2242
+ r(o);
2243
+ let n = e.seen.get(o), s = n.schema;
2244
+ if (s.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (i.allOf = i.allOf ?? [], i.allOf.push(s)) : Object.assign(i, s), Object.assign(i, a), t._zod.parent === o) for (let e in i) e === "$ref" || e === "allOf" || e in a || delete i[e];
2245
+ if (s.$ref && n.def) for (let e in i) e === "$ref" || e === "allOf" || e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e];
2246
+ }
2247
+ let s = t._zod.parent;
2248
+ if (s && s !== o) {
2249
+ r(s);
2250
+ let t = e.seen.get(s);
2251
+ if (t?.schema.$ref && (i.$ref = t.schema.$ref, t.def)) for (let e in i) e === "$ref" || e === "allOf" || e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e];
2252
+ }
2253
+ e.override({
2254
+ zodSchema: t,
2255
+ jsonSchema: i,
2256
+ path: n.path ?? []
2257
+ });
2258
+ };
2259
+ for (let t of [...e.seen.entries()].reverse()) r(t[0]);
2260
+ let i = {};
2261
+ if (e.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
2262
+ let n = e.external.registry.get(t)?.id;
2263
+ if (!n) throw Error("Schema is missing an `id` property");
2264
+ i.$id = e.external.uri(n);
2265
+ }
2266
+ Object.assign(i, n.def ?? n.schema);
2267
+ let a = e.metadataRegistry.get(t)?.id;
2268
+ a !== void 0 && i.id === a && delete i.id;
2269
+ let o = e.external?.defs ?? {};
2270
+ for (let t of e.seen.entries()) {
2271
+ let e = t[1];
2272
+ e.def && e.defId && (e.def.id === e.defId && delete e.def.id, o[e.defId] = e.def);
2273
+ }
2274
+ e.external || Object.keys(o).length > 0 && (e.target === "draft-2020-12" ? i.$defs = o : i.definitions = o);
2275
+ try {
2276
+ let n = JSON.parse(JSON.stringify(i));
2277
+ return Object.defineProperty(n, "~standard", {
2278
+ value: {
2279
+ ...t["~standard"],
2280
+ jsonSchema: {
2281
+ input: K(t, "input", e.processors),
2282
+ output: K(t, "output", e.processors)
2283
+ }
2284
+ },
2285
+ enumerable: !1,
2286
+ writable: !1
2287
+ }), n;
2288
+ } catch {
2289
+ throw Error("Error converting schema to JSON.");
2290
+ }
2291
+ }
2292
+ function G(e, t) {
2293
+ let n = t ?? { seen: /* @__PURE__ */ new Set() };
2294
+ if (n.seen.has(e)) return !1;
2295
+ n.seen.add(e);
2296
+ let r = e._zod.def;
2297
+ if (r.type === "transform") return !0;
2298
+ if (r.type === "array") return G(r.element, n);
2299
+ if (r.type === "set") return G(r.valueType, n);
2300
+ if (r.type === "lazy") return G(r.getter(), n);
2301
+ if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault") return G(r.innerType, n);
2302
+ if (r.type === "intersection") return G(r.left, n) || G(r.right, n);
2303
+ if (r.type === "record" || r.type === "map") return G(r.keyType, n) || G(r.valueType, n);
2304
+ if (r.type === "pipe") return e._zod.traits.has("$ZodCodec") ? !0 : G(r.in, n) || G(r.out, n);
2305
+ if (r.type === "object") {
2306
+ for (let e in r.shape) if (G(r.shape[e], n)) return !0;
2307
+ return !1;
2308
+ }
2309
+ if (r.type === "union") {
2310
+ for (let e of r.options) if (G(e, n)) return !0;
2311
+ return !1;
2312
+ }
2313
+ if (r.type === "tuple") {
2314
+ for (let e of r.items) if (G(e, n)) return !0;
2315
+ return !!(r.rest && G(r.rest, n));
2316
+ }
2317
+ return !1;
2318
+ }
2319
+ var Ir = (e, t = {}) => (n) => {
2320
+ let r = Nr({
2321
+ ...n,
2322
+ processors: t
2323
+ });
2324
+ return W(e, r), Pr(r, e), Fr(r, e);
2325
+ }, K = (e, t, n = {}) => (r) => {
2326
+ let { libraryOptions: i, target: a } = r ?? {}, o = Nr({
2327
+ ...i ?? {},
2328
+ target: a,
2329
+ io: t,
2330
+ processors: n
2331
+ });
2332
+ return W(e, o), Pr(o, e), Fr(o, e);
2333
+ }, Lr = {
2334
+ guid: "uuid",
2335
+ url: "uri",
2336
+ datetime: "date-time",
2337
+ json_string: "json-string",
2338
+ regex: ""
2339
+ }, Rr = (e, t, n, r) => {
2340
+ let i = n;
2341
+ i.type = "string";
2342
+ let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l } = e._zod.bag;
2343
+ if (typeof a == "number" && (i.minLength = a), typeof o == "number" && (i.maxLength = o), s && (i.format = Lr[s] ?? s, i.format === "" && delete i.format, s === "time" && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) {
2344
+ let e = [...c];
2345
+ e.length === 1 ? i.pattern = e[0].source : e.length > 1 && (i.allOf = [...e.map((e) => ({
2346
+ ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
2347
+ pattern: e.source
2348
+ }))]);
2349
+ }
2350
+ }, zr = (e, t, n, r) => {
2351
+ let i = n, { minimum: a, maximum: o, format: s, multipleOf: c, exclusiveMaximum: l, exclusiveMinimum: u } = e._zod.bag;
2352
+ typeof s == "string" && s.includes("int") ? i.type = "integer" : i.type = "number";
2353
+ let d = typeof u == "number" && u >= (a ?? -Infinity), f = typeof l == "number" && l <= (o ?? Infinity), p = t.target === "draft-04" || t.target === "openapi-3.0";
2354
+ d ? p ? (i.minimum = u, i.exclusiveMinimum = !0) : i.exclusiveMinimum = u : typeof a == "number" && (i.minimum = a), f ? p ? (i.maximum = l, i.exclusiveMaximum = !0) : i.exclusiveMaximum = l : typeof o == "number" && (i.maximum = o), typeof c == "number" && (i.multipleOf = c);
2355
+ }, Br = (e, t, n, r) => {
2356
+ n.type = "boolean";
2357
+ }, Vr = (e, t, n, r) => {
2358
+ n.not = {};
2359
+ }, Hr = (e, t, n, r) => {
2360
+ let i = e._zod.def, a = c(i.entries);
2361
+ a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), n.enum = a;
2362
+ }, Ur = (e, t, n, r) => {
2363
+ if (t.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
2364
+ }, Wr = (e, t, n, r) => {
2365
+ if (t.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
2366
+ }, Gr = (e, t, n, r) => {
2367
+ let i = n, a = e._zod.def, { minimum: o, maximum: s } = e._zod.bag;
2368
+ typeof o == "number" && (i.minItems = o), typeof s == "number" && (i.maxItems = s), i.type = "array", i.items = W(a.element, t, {
2369
+ ...r,
2370
+ path: [...r.path, "items"]
2371
+ });
2372
+ }, Kr = (e, t, n, r) => {
2373
+ let i = n, a = e._zod.def;
2374
+ i.type = "object", i.properties = {};
2375
+ let o = a.shape;
2376
+ for (let e in o) i.properties[e] = W(o[e], t, {
2377
+ ...r,
2378
+ path: [
2379
+ ...r.path,
2380
+ "properties",
2381
+ e
2382
+ ]
2383
+ });
2384
+ let s = new Set(Object.keys(o)), c = new Set([...s].filter((e) => {
2385
+ let n = a.shape[e]._zod;
2386
+ return t.io === "input" ? n.optin === void 0 : n.optout === void 0;
2387
+ }));
2388
+ c.size > 0 && (i.required = Array.from(c)), a.catchall?._zod.def.type === "never" ? i.additionalProperties = !1 : a.catchall ? a.catchall && (i.additionalProperties = W(a.catchall, t, {
2389
+ ...r,
2390
+ path: [...r.path, "additionalProperties"]
2391
+ })) : t.io === "output" && (i.additionalProperties = !1);
2392
+ }, qr = (e, t, n, r) => {
2393
+ let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => W(e, t, {
2394
+ ...r,
2395
+ path: [
2396
+ ...r.path,
2397
+ a ? "oneOf" : "anyOf",
2398
+ n
2399
+ ]
2400
+ }));
2401
+ a ? n.oneOf = o : n.anyOf = o;
2402
+ }, Jr = (e, t, n, r) => {
2403
+ let i = e._zod.def, a = W(i.left, t, {
2404
+ ...r,
2405
+ path: [
2406
+ ...r.path,
2407
+ "allOf",
2408
+ 0
2409
+ ]
2410
+ }), o = W(i.right, t, {
2411
+ ...r,
2412
+ path: [
2413
+ ...r.path,
2414
+ "allOf",
2415
+ 1
2416
+ ]
2417
+ }), s = (e) => "allOf" in e && Object.keys(e).length === 1;
2418
+ n.allOf = [...s(a) ? a.allOf : [a], ...s(o) ? o.allOf : [o]];
2419
+ }, Yr = (e, t, n, r) => {
2420
+ let i = e._zod.def, a = W(i.innerType, t, r), o = t.seen.get(e);
2421
+ t.target === "openapi-3.0" ? (o.ref = i.innerType, n.nullable = !0) : n.anyOf = [a, { type: "null" }];
2422
+ }, Xr = (e, t, n, r) => {
2423
+ let i = e._zod.def;
2424
+ W(i.innerType, t, r);
2425
+ let a = t.seen.get(e);
2426
+ a.ref = i.innerType;
2427
+ }, Zr = (e, t, n, r) => {
2428
+ let i = e._zod.def;
2429
+ W(i.innerType, t, r);
2430
+ let a = t.seen.get(e);
2431
+ a.ref = i.innerType, n.default = JSON.parse(JSON.stringify(i.defaultValue));
2432
+ }, Qr = (e, t, n, r) => {
2433
+ let i = e._zod.def;
2434
+ W(i.innerType, t, r);
2435
+ let a = t.seen.get(e);
2436
+ a.ref = i.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
2437
+ }, $r = (e, t, n, r) => {
2438
+ let i = e._zod.def;
2439
+ W(i.innerType, t, r);
2440
+ let a = t.seen.get(e);
2441
+ a.ref = i.innerType;
2442
+ let o;
2443
+ try {
2444
+ o = i.catchValue(void 0);
2445
+ } catch {
2446
+ throw Error("Dynamic catch values are not supported in JSON Schema");
2447
+ }
2448
+ n.default = o;
2449
+ }, ei = (e, t, n, r) => {
2450
+ let i = e._zod.def, a = i.in._zod.traits.has("$ZodTransform"), o = t.io === "input" ? a ? i.out : i.in : i.out;
2451
+ W(o, t, r);
2452
+ let s = t.seen.get(e);
2453
+ s.ref = o;
2454
+ }, ti = (e, t, n, r) => {
2455
+ let i = e._zod.def;
2456
+ W(i.innerType, t, r);
2457
+ let a = t.seen.get(e);
2458
+ a.ref = i.innerType, n.readOnly = !0;
2459
+ }, ni = (e, t, n, r) => {
2460
+ let i = e._zod.def;
2461
+ W(i.innerType, t, r);
2462
+ let a = t.seen.get(e);
2463
+ a.ref = i.innerType;
2464
+ }, ri = /*@__PURE__*/ r("ZodISODateTime", (e, t) => {
2465
+ Rt.init(e, t), Z.init(e, t);
2466
+ });
2467
+ function ii(e) {
2468
+ return /* @__PURE__ */ ir(ri, e);
2469
+ }
2470
+ var ai = /*@__PURE__*/ r("ZodISODate", (e, t) => {
2471
+ zt.init(e, t), Z.init(e, t);
2472
+ });
2473
+ function oi(e) {
2474
+ return /* @__PURE__ */ ar(ai, e);
2475
+ }
2476
+ var si = /*@__PURE__*/ r("ZodISOTime", (e, t) => {
2477
+ Bt.init(e, t), Z.init(e, t);
2478
+ });
2479
+ function ci(e) {
2480
+ return /* @__PURE__ */ or(si, e);
2481
+ }
2482
+ var li = /*@__PURE__*/ r("ZodISODuration", (e, t) => {
2483
+ Vt.init(e, t), Z.init(e, t);
2484
+ });
2485
+ function ui(e) {
2486
+ return /* @__PURE__ */ sr(li, e);
2487
+ }
2488
+ var q = /*@__PURE__*/ r("ZodError", (e, t) => {
2489
+ ye.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2490
+ format: { value: (t) => Se(e, t) },
2491
+ flatten: { value: (t) => xe(e, t) },
2492
+ addIssue: { value: (t) => {
2493
+ e.issues.push(t), e.message = JSON.stringify(e.issues, l, 2);
2494
+ } },
2495
+ addIssues: { value: (t) => {
2496
+ e.issues.push(...t), e.message = JSON.stringify(e.issues, l, 2);
2497
+ } },
2498
+ isEmpty: { get() {
2499
+ return e.issues.length === 0;
2500
+ } }
2501
+ });
2502
+ }, { Parent: Error }), di = /* @__PURE__ */ D(q), fi = /* @__PURE__ */ O(q), pi = /* @__PURE__ */ k(q), mi = /* @__PURE__ */ A(q), hi = /* @__PURE__ */ Te(q), gi = /* @__PURE__ */ Ee(q), _i = /* @__PURE__ */ De(q), vi = /* @__PURE__ */ Oe(q), yi = /* @__PURE__ */ ke(q), bi = /* @__PURE__ */ Ae(q), xi = /* @__PURE__ */ je(q), Si = /* @__PURE__ */ Me(q), Ci = /* @__PURE__ */ new WeakMap();
2503
+ function J(e, t, n) {
2504
+ let r = Object.getPrototypeOf(e), i = Ci.get(r);
2505
+ if (i || (i = /* @__PURE__ */ new Set(), Ci.set(r, i)), !i.has(t)) {
2506
+ i.add(t);
2507
+ for (let e in n) {
2508
+ let t = n[e];
2509
+ Object.defineProperty(r, e, {
2510
+ configurable: !0,
2511
+ enumerable: !1,
2512
+ get() {
2513
+ let n = t.bind(this);
2514
+ return Object.defineProperty(this, e, {
2515
+ configurable: !0,
2516
+ writable: !0,
2517
+ enumerable: !0,
2518
+ value: n
2519
+ }), n;
2520
+ },
2521
+ set(t) {
2522
+ Object.defineProperty(this, e, {
2523
+ configurable: !0,
2524
+ writable: !0,
2525
+ enumerable: !0,
2526
+ value: t
2527
+ });
2528
+ }
2529
+ });
2530
+ }
2531
+ }
2532
+ }
2533
+ var Y = /*@__PURE__*/ r("ZodType", (e, t) => (N.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
2534
+ input: K(e, "input"),
2535
+ output: K(e, "output")
2536
+ } }), e.toJSONSchema = Ir(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (t, n) => di(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => pi(e, t, n), e.parseAsync = async (t, n) => fi(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => mi(e, t, n), e.spa = e.safeParseAsync, e.encode = (t, n) => hi(e, t, n), e.decode = (t, n) => gi(e, t, n), e.encodeAsync = async (t, n) => _i(e, t, n), e.decodeAsync = async (t, n) => vi(e, t, n), e.safeEncode = (t, n) => yi(e, t, n), e.safeDecode = (t, n) => bi(e, t, n), e.safeEncodeAsync = async (t, n) => xi(e, t, n), e.safeDecodeAsync = async (t, n) => Si(e, t, n), J(e, "ZodType", {
2537
+ check(...e) {
2538
+ let t = this.def;
2539
+ return this.clone(g(t, { checks: [...t.checks ?? [], ...e.map((e) => typeof e == "function" ? { _zod: {
2540
+ check: e,
2541
+ def: { check: "custom" },
2542
+ onattach: []
2543
+ } } : e)] }), { parent: !0 });
2544
+ },
2545
+ with(...e) {
2546
+ return this.check(...e);
2547
+ },
2548
+ clone(e, t) {
2549
+ return b(this, e, t);
2550
+ },
2551
+ brand() {
2552
+ return this;
2553
+ },
2554
+ register(e, t) {
2555
+ return e.add(this, t), this;
2556
+ },
2557
+ refine(e, t) {
2558
+ return this.check(Aa(e, t));
2559
+ },
2560
+ superRefine(e, t) {
2561
+ return this.check(ja(e, t));
2562
+ },
2563
+ overwrite(e) {
2564
+ return this.check(/* @__PURE__ */ U(e));
2565
+ },
2566
+ optional() {
2567
+ return fa(this);
2568
+ },
2569
+ exactOptional() {
2570
+ return ma(this);
2571
+ },
2572
+ nullable() {
2573
+ return ga(this);
2574
+ },
2575
+ nullish() {
2576
+ return fa(ga(this));
2577
+ },
2578
+ nonoptional(e) {
2579
+ return Sa(this, e);
2580
+ },
2581
+ array() {
2582
+ return $(this);
2583
+ },
2584
+ or(e) {
2585
+ return ia([this, e]);
2586
+ },
2587
+ and(e) {
2588
+ return oa(this, e);
2589
+ },
2590
+ transform(e) {
2591
+ return Ea(this, ua(e));
2592
+ },
2593
+ default(e) {
2594
+ return va(this, e);
2595
+ },
2596
+ prefault(e) {
2597
+ return ba(this, e);
2598
+ },
2599
+ catch(e) {
2600
+ return wa(this, e);
2601
+ },
2602
+ pipe(e) {
2603
+ return Ea(this, e);
2604
+ },
2605
+ readonly() {
2606
+ return Oa(this);
2607
+ },
2608
+ describe(e) {
2609
+ let t = this.clone();
2610
+ return z.add(t, { description: e }), t;
2611
+ },
2612
+ meta(...e) {
2613
+ if (e.length === 0) return z.get(this);
2614
+ let t = this.clone();
2615
+ return z.add(t, e[0]), t;
2616
+ },
2617
+ isOptional() {
2618
+ return this.safeParse(void 0).success;
2619
+ },
2620
+ isNullable() {
2621
+ return this.safeParse(null).success;
2622
+ },
2623
+ apply(e) {
2624
+ return e(this);
2625
+ }
2626
+ }), Object.defineProperty(e, "description", {
2627
+ get() {
2628
+ return z.get(e)?.description;
2629
+ },
2630
+ configurable: !0
2631
+ }), e)), wi = /*@__PURE__*/ r("_ZodString", (e, t) => {
2632
+ P.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Rr(e, t, n, r);
2633
+ let n = e._zod.bag;
2634
+ e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, J(e, "_ZodString", {
2635
+ regex(...e) {
2636
+ return this.check(/* @__PURE__ */ vr(...e));
2637
+ },
2638
+ includes(...e) {
2639
+ return this.check(/* @__PURE__ */ xr(...e));
2640
+ },
2641
+ startsWith(...e) {
2642
+ return this.check(/* @__PURE__ */ Sr(...e));
2643
+ },
2644
+ endsWith(...e) {
2645
+ return this.check(/* @__PURE__ */ Cr(...e));
2646
+ },
2647
+ min(...e) {
2648
+ return this.check(/* @__PURE__ */ H(...e));
2649
+ },
2650
+ max(...e) {
2651
+ return this.check(/* @__PURE__ */ gr(...e));
2652
+ },
2653
+ length(...e) {
2654
+ return this.check(/* @__PURE__ */ _r(...e));
2655
+ },
2656
+ nonempty(...e) {
2657
+ return this.check(/* @__PURE__ */ H(1, ...e));
2658
+ },
2659
+ lowercase(e) {
2660
+ return this.check(/* @__PURE__ */ yr(e));
2661
+ },
2662
+ uppercase(e) {
2663
+ return this.check(/* @__PURE__ */ br(e));
2664
+ },
2665
+ trim() {
2666
+ return this.check(/* @__PURE__ */ Tr());
2667
+ },
2668
+ normalize(...e) {
2669
+ return this.check(/* @__PURE__ */ wr(...e));
2670
+ },
2671
+ toLowerCase() {
2672
+ return this.check(/* @__PURE__ */ Er());
2673
+ },
2674
+ toUpperCase() {
2675
+ return this.check(/* @__PURE__ */ Dr());
2676
+ },
2677
+ slugify() {
2678
+ return this.check(/* @__PURE__ */ Or());
2679
+ }
2680
+ });
2681
+ }), Ti = /*@__PURE__*/ r("ZodString", (e, t) => {
2682
+ P.init(e, t), wi.init(e, t), e.email = (t) => e.check(/* @__PURE__ */ In(Ei, t)), e.url = (t) => e.check(/* @__PURE__ */ Hn(Oi, t)), e.jwt = (t) => e.check(/* @__PURE__ */ rr(Ui, t)), e.emoji = (t) => e.check(/* @__PURE__ */ Un(ki, t)), e.guid = (t) => e.check(/* @__PURE__ */ Ln(Di, t)), e.uuid = (t) => e.check(/* @__PURE__ */ Rn(Q, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ zn(Q, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ Bn(Q, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ Vn(Q, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ Wn(Ai, t)), e.guid = (t) => e.check(/* @__PURE__ */ Ln(Di, t)), e.cuid = (t) => e.check(/* @__PURE__ */ Gn(ji, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ Kn(Mi, t)), e.ulid = (t) => e.check(/* @__PURE__ */ qn(Ni, t)), e.base64 = (t) => e.check(/* @__PURE__ */ er(Bi, t)), e.base64url = (t) => e.check(/* @__PURE__ */ tr(Vi, t)), e.xid = (t) => e.check(/* @__PURE__ */ Jn(Pi, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ Yn(Fi, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ Xn(Ii, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ Zn(Li, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ Qn(Ri, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ $n(zi, t)), e.e164 = (t) => e.check(/* @__PURE__ */ nr(Hi, t)), e.datetime = (t) => e.check(ii(t)), e.date = (t) => e.check(oi(t)), e.time = (t) => e.check(ci(t)), e.duration = (t) => e.check(ui(t));
2683
+ });
2684
+ function X(e) {
2685
+ return /* @__PURE__ */ Fn(Ti, e);
2686
+ }
2687
+ var Z = /*@__PURE__*/ r("ZodStringFormat", (e, t) => {
2688
+ F.init(e, t), wi.init(e, t);
2689
+ }), Ei = /*@__PURE__*/ r("ZodEmail", (e, t) => {
2690
+ kt.init(e, t), Z.init(e, t);
2691
+ }), Di = /*@__PURE__*/ r("ZodGUID", (e, t) => {
2692
+ Dt.init(e, t), Z.init(e, t);
2693
+ }), Q = /*@__PURE__*/ r("ZodUUID", (e, t) => {
2694
+ Ot.init(e, t), Z.init(e, t);
2695
+ }), Oi = /*@__PURE__*/ r("ZodURL", (e, t) => {
2696
+ At.init(e, t), Z.init(e, t);
2697
+ }), ki = /*@__PURE__*/ r("ZodEmoji", (e, t) => {
2698
+ jt.init(e, t), Z.init(e, t);
2699
+ }), Ai = /*@__PURE__*/ r("ZodNanoID", (e, t) => {
2700
+ Mt.init(e, t), Z.init(e, t);
2701
+ }), ji = /*@__PURE__*/ r("ZodCUID", (e, t) => {
2702
+ Nt.init(e, t), Z.init(e, t);
2703
+ }), Mi = /*@__PURE__*/ r("ZodCUID2", (e, t) => {
2704
+ Pt.init(e, t), Z.init(e, t);
2705
+ }), Ni = /*@__PURE__*/ r("ZodULID", (e, t) => {
2706
+ Ft.init(e, t), Z.init(e, t);
2707
+ }), Pi = /*@__PURE__*/ r("ZodXID", (e, t) => {
2708
+ It.init(e, t), Z.init(e, t);
2709
+ }), Fi = /*@__PURE__*/ r("ZodKSUID", (e, t) => {
2710
+ Lt.init(e, t), Z.init(e, t);
2711
+ }), Ii = /*@__PURE__*/ r("ZodIPv4", (e, t) => {
2712
+ Ht.init(e, t), Z.init(e, t);
2713
+ }), Li = /*@__PURE__*/ r("ZodIPv6", (e, t) => {
2714
+ Ut.init(e, t), Z.init(e, t);
2715
+ }), Ri = /*@__PURE__*/ r("ZodCIDRv4", (e, t) => {
2716
+ Wt.init(e, t), Z.init(e, t);
2717
+ }), zi = /*@__PURE__*/ r("ZodCIDRv6", (e, t) => {
2718
+ Gt.init(e, t), Z.init(e, t);
2719
+ }), Bi = /*@__PURE__*/ r("ZodBase64", (e, t) => {
2720
+ qt.init(e, t), Z.init(e, t);
2721
+ }), Vi = /*@__PURE__*/ r("ZodBase64URL", (e, t) => {
2722
+ Yt.init(e, t), Z.init(e, t);
2723
+ }), Hi = /*@__PURE__*/ r("ZodE164", (e, t) => {
2724
+ Xt.init(e, t), Z.init(e, t);
2725
+ }), Ui = /*@__PURE__*/ r("ZodJWT", (e, t) => {
2726
+ Qt.init(e, t), Z.init(e, t);
2727
+ }), Wi = /*@__PURE__*/ r("ZodNumber", (e, t) => {
2728
+ $t.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => zr(e, t, n, r), J(e, "ZodNumber", {
2729
+ gt(e, t) {
2730
+ return this.check(/* @__PURE__ */ mr(e, t));
2731
+ },
2732
+ gte(e, t) {
2733
+ return this.check(/* @__PURE__ */ V(e, t));
2734
+ },
2735
+ min(e, t) {
2736
+ return this.check(/* @__PURE__ */ V(e, t));
2737
+ },
2738
+ lt(e, t) {
2739
+ return this.check(/* @__PURE__ */ pr(e, t));
2740
+ },
2741
+ lte(e, t) {
2742
+ return this.check(/* @__PURE__ */ B(e, t));
2743
+ },
2744
+ max(e, t) {
2745
+ return this.check(/* @__PURE__ */ B(e, t));
2746
+ },
2747
+ int(e) {
2748
+ return this.check(qi(e));
2749
+ },
2750
+ safe(e) {
2751
+ return this.check(qi(e));
2752
+ },
2753
+ positive(e) {
2754
+ return this.check(/* @__PURE__ */ mr(0, e));
2755
+ },
2756
+ nonnegative(e) {
2757
+ return this.check(/* @__PURE__ */ V(0, e));
2758
+ },
2759
+ negative(e) {
2760
+ return this.check(/* @__PURE__ */ pr(0, e));
2761
+ },
2762
+ nonpositive(e) {
2763
+ return this.check(/* @__PURE__ */ B(0, e));
2764
+ },
2765
+ multipleOf(e, t) {
2766
+ return this.check(/* @__PURE__ */ hr(e, t));
2767
+ },
2768
+ step(e, t) {
2769
+ return this.check(/* @__PURE__ */ hr(e, t));
2770
+ },
2771
+ finite() {
2772
+ return this;
2773
+ }
2774
+ });
2775
+ let n = e._zod.bag;
2776
+ e.minValue = Math.max(n.minimum ?? -Infinity, n.exclusiveMinimum ?? -Infinity) ?? null, e.maxValue = Math.min(n.maximum ?? Infinity, n.exclusiveMaximum ?? Infinity) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? .5), e.isFinite = !0, e.format = n.format ?? null;
2777
+ });
2778
+ function Gi(e) {
2779
+ return /* @__PURE__ */ cr(Wi, e);
2780
+ }
2781
+ var Ki = /*@__PURE__*/ r("ZodNumberFormat", (e, t) => {
2782
+ en.init(e, t), Wi.init(e, t);
2783
+ });
2784
+ function qi(e) {
2785
+ return /* @__PURE__ */ lr(Ki, e);
2786
+ }
2787
+ var Ji = /*@__PURE__*/ r("ZodBoolean", (e, t) => {
2788
+ tn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Br(e, t, n, r);
2789
+ });
2790
+ function Yi(e) {
2791
+ return /* @__PURE__ */ ur(Ji, e);
2792
+ }
2793
+ var Xi = /*@__PURE__*/ r("ZodUnknown", (e, t) => {
2794
+ nn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
2795
+ });
2796
+ function Zi() {
2797
+ return /* @__PURE__ */ dr(Xi);
2798
+ }
2799
+ var Qi = /*@__PURE__*/ r("ZodNever", (e, t) => {
2800
+ rn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Vr(e, t, n, r);
2801
+ });
2802
+ function $i(e) {
2803
+ return /* @__PURE__ */ fr(Qi, e);
2804
+ }
2805
+ var ea = /*@__PURE__*/ r("ZodArray", (e, t) => {
2806
+ on.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Gr(e, t, n, r), e.element = t.element, J(e, "ZodArray", {
2807
+ min(e, t) {
2808
+ return this.check(/* @__PURE__ */ H(e, t));
2809
+ },
2810
+ nonempty(e) {
2811
+ return this.check(/* @__PURE__ */ H(1, e));
2812
+ },
2813
+ max(e, t) {
2814
+ return this.check(/* @__PURE__ */ gr(e, t));
2815
+ },
2816
+ length(e, t) {
2817
+ return this.check(/* @__PURE__ */ _r(e, t));
2818
+ },
2819
+ unwrap() {
2820
+ return this.element;
2821
+ }
2822
+ });
2823
+ });
2824
+ function $(e, t) {
2825
+ return /* @__PURE__ */ kr(ea, e, t);
2826
+ }
2827
+ var ta = /*@__PURE__*/ r("ZodObject", (e, t) => {
2828
+ un.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Kr(e, t, n, r), m(e, "shape", () => t.shape), J(e, "ZodObject", {
2829
+ keyof() {
2830
+ return ca(Object.keys(this._zod.def.shape));
2831
+ },
2832
+ catchall(e) {
2833
+ return this.clone({
2834
+ ...this._zod.def,
2835
+ catchall: e
2836
+ });
2837
+ },
2838
+ passthrough() {
2839
+ return this.clone({
2840
+ ...this._zod.def,
2841
+ catchall: Zi()
2842
+ });
2843
+ },
2844
+ loose() {
2845
+ return this.clone({
2846
+ ...this._zod.def,
2847
+ catchall: Zi()
2848
+ });
2849
+ },
2850
+ strict() {
2851
+ return this.clone({
2852
+ ...this._zod.def,
2853
+ catchall: $i()
2854
+ });
2855
+ },
2856
+ strip() {
2857
+ return this.clone({
2858
+ ...this._zod.def,
2859
+ catchall: void 0
2860
+ });
2861
+ },
2862
+ extend(e) {
2863
+ return de(this, e);
2864
+ },
2865
+ safeExtend(e) {
2866
+ return fe(this, e);
2867
+ },
2868
+ merge(e) {
2869
+ return pe(this, e);
2870
+ },
2871
+ pick(e) {
2872
+ return le(this, e);
2873
+ },
2874
+ omit(e) {
2875
+ return ue(this, e);
2876
+ },
2877
+ partial(...e) {
2878
+ return me(da, this, e[0]);
2879
+ },
2880
+ required(...e) {
2881
+ return he(xa, this, e[0]);
2882
+ }
2883
+ });
2884
+ });
2885
+ function na(e, t) {
2886
+ return new ta({
2887
+ type: "object",
2888
+ shape: e ?? {},
2889
+ ...x(t)
2890
+ });
2891
+ }
2892
+ var ra = /*@__PURE__*/ r("ZodUnion", (e, t) => {
2893
+ fn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => qr(e, t, n, r), e.options = t.options;
2894
+ });
2895
+ function ia(e, t) {
2896
+ return new ra({
2897
+ type: "union",
2898
+ options: e,
2899
+ ...x(t)
2900
+ });
2901
+ }
2902
+ var aa = /*@__PURE__*/ r("ZodIntersection", (e, t) => {
2903
+ pn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Jr(e, t, n, r);
2904
+ });
2905
+ function oa(e, t) {
2906
+ return new aa({
2907
+ type: "intersection",
2908
+ left: e,
2909
+ right: t
2910
+ });
2911
+ }
2912
+ var sa = /*@__PURE__*/ r("ZodEnum", (e, t) => {
2913
+ hn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Hr(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
2914
+ let n = new Set(Object.keys(t.entries));
2915
+ e.extract = (e, r) => {
2916
+ let i = {};
2917
+ for (let r of e) if (n.has(r)) i[r] = t.entries[r];
2918
+ else throw Error(`Key ${r} not found in enum`);
2919
+ return new sa({
2920
+ ...t,
2921
+ checks: [],
2922
+ ...x(r),
2923
+ entries: i
2924
+ });
2925
+ }, e.exclude = (e, r) => {
2926
+ let i = { ...t.entries };
2927
+ for (let t of e) if (n.has(t)) delete i[t];
2928
+ else throw Error(`Key ${t} not found in enum`);
2929
+ return new sa({
2930
+ ...t,
2931
+ checks: [],
2932
+ ...x(r),
2933
+ entries: i
2934
+ });
2935
+ };
2936
+ });
2937
+ function ca(e, t) {
2938
+ return new sa({
2939
+ type: "enum",
2940
+ entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
2941
+ ...x(t)
2942
+ });
2943
+ }
2944
+ var la = /*@__PURE__*/ r("ZodTransform", (e, t) => {
2945
+ gn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Wr(e, t, n, r), e._zod.parse = (n, r) => {
2946
+ if (r.direction === "backward") throw new a(e.constructor.name);
2947
+ n.addIssue = (r) => {
2948
+ if (typeof r == "string") n.issues.push(E(r, n.value, t));
2949
+ else {
2950
+ let t = r;
2951
+ t.fatal && (t.continue = !1), t.code ??= "custom", t.input ??= n.value, t.inst ??= e, n.issues.push(E(t));
2952
+ }
2953
+ };
2954
+ let i = t.transform(n.value, n);
2955
+ return i instanceof Promise ? i.then((e) => (n.value = e, n.fallback = !0, n)) : (n.value = i, n.fallback = !0, n);
2956
+ };
2957
+ });
2958
+ function ua(e) {
2959
+ return new la({
2960
+ type: "transform",
2961
+ transform: e
2962
+ });
2963
+ }
2964
+ var da = /*@__PURE__*/ r("ZodOptional", (e, t) => {
2965
+ vn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => ni(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2966
+ });
2967
+ function fa(e) {
2968
+ return new da({
2969
+ type: "optional",
2970
+ innerType: e
2971
+ });
2972
+ }
2973
+ var pa = /*@__PURE__*/ r("ZodExactOptional", (e, t) => {
2974
+ yn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => ni(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2975
+ });
2976
+ function ma(e) {
2977
+ return new pa({
2978
+ type: "optional",
2979
+ innerType: e
2980
+ });
2981
+ }
2982
+ var ha = /*@__PURE__*/ r("ZodNullable", (e, t) => {
2983
+ bn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Yr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2984
+ });
2985
+ function ga(e) {
2986
+ return new ha({
2987
+ type: "nullable",
2988
+ innerType: e
2989
+ });
2990
+ }
2991
+ var _a = /*@__PURE__*/ r("ZodDefault", (e, t) => {
2992
+ xn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Zr(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2993
+ });
2994
+ function va(e, t) {
2995
+ return new _a({
2996
+ type: "default",
2997
+ innerType: e,
2998
+ get defaultValue() {
2999
+ return typeof t == "function" ? t() : ae(t);
3000
+ }
3001
+ });
3002
+ }
3003
+ var ya = /*@__PURE__*/ r("ZodPrefault", (e, t) => {
3004
+ Cn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Qr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3005
+ });
3006
+ function ba(e, t) {
3007
+ return new ya({
3008
+ type: "prefault",
3009
+ innerType: e,
3010
+ get defaultValue() {
3011
+ return typeof t == "function" ? t() : ae(t);
3012
+ }
3013
+ });
3014
+ }
3015
+ var xa = /*@__PURE__*/ r("ZodNonOptional", (e, t) => {
3016
+ wn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Xr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3017
+ });
3018
+ function Sa(e, t) {
3019
+ return new xa({
3020
+ type: "nonoptional",
3021
+ innerType: e,
3022
+ ...x(t)
3023
+ });
3024
+ }
3025
+ var Ca = /*@__PURE__*/ r("ZodCatch", (e, t) => {
3026
+ En.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => $r(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
3027
+ });
3028
+ function wa(e, t) {
3029
+ return new Ca({
3030
+ type: "catch",
3031
+ innerType: e,
3032
+ catchValue: typeof t == "function" ? t : () => t
3033
+ });
3034
+ }
3035
+ var Ta = /*@__PURE__*/ r("ZodPipe", (e, t) => {
3036
+ Dn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => ei(e, t, n, r), e.in = t.in, e.out = t.out;
3037
+ });
3038
+ function Ea(e, t) {
3039
+ return new Ta({
3040
+ type: "pipe",
3041
+ in: e,
3042
+ out: t
3043
+ });
3044
+ }
3045
+ var Da = /*@__PURE__*/ r("ZodReadonly", (e, t) => {
3046
+ On.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => ti(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
3047
+ });
3048
+ function Oa(e) {
3049
+ return new Da({
3050
+ type: "readonly",
3051
+ innerType: e
3052
+ });
3053
+ }
3054
+ var ka = /*@__PURE__*/ r("ZodCustom", (e, t) => {
3055
+ An.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ur(e, t, n, r);
3056
+ });
3057
+ function Aa(e, t = {}) {
3058
+ return /* @__PURE__ */ Ar(ka, e, t);
3059
+ }
3060
+ function ja(e, t) {
3061
+ return /* @__PURE__ */ jr(e, t);
3062
+ }
3063
+ //#endregion
3064
+ //#region server/schema.ts
3065
+ var Ma = na({
3066
+ sorts: $(na({
3067
+ columnId: X(),
3068
+ direction: ca(["asc", "desc"])
3069
+ })).optional(),
3070
+ filters: $(na({
3071
+ columnId: X(),
3072
+ operator: ca([
3073
+ "eq",
3074
+ "contains",
3075
+ "gt",
3076
+ "gte",
3077
+ "lt",
3078
+ "lte",
3079
+ "between",
3080
+ "in"
3081
+ ]),
3082
+ value: ia([
3083
+ X(),
3084
+ Gi(),
3085
+ $(ia([X(), Gi()]))
3086
+ ])
3087
+ })).optional(),
3088
+ grouping: $(X()).optional(),
3089
+ reset: Yi().optional(),
3090
+ explanation: X()
3091
+ });
3092
+ //#endregion
3093
+ //#region server/gridAiRoute.ts
3094
+ function Na(e) {
3095
+ return `You are a data grid assistant. The user will describe what they want to see in the grid in natural language, and you must respond with a JSON object that controls sorting, filtering, and grouping.
3096
+
3097
+ Available columns:
3098
+ ${e.map((e) => ` - id="${e.id}" header="${e.header}"${e.filterType ? ` filterType="${e.filterType}"` : ""}`).join("\n")}
3099
+
3100
+ Response format (JSON only — no markdown, no explanation outside the JSON):
3101
+ {
3102
+ "sorts": [{ "columnId": "<id>", "direction": "asc" | "desc" }],
3103
+ "filters": [{ "columnId": "<id>", "operator": "eq" | "contains" | "gt" | "gte" | "lt" | "lte" | "between" | "in", "value": <string | number | array> }],
3104
+ "grouping": ["<columnId>"],
3105
+ "reset": false,
3106
+ "explanation": "<one sentence describing what you did>"
3107
+ }
3108
+
3109
+ Rules:
3110
+ - Only include fields that should change. Omit "sorts", "filters", or "grouping" if you are not changing them.
3111
+ - Set "reset": true to clear all sorts, filters, and grouping.
3112
+ - Only use column ids from the list above. Ignore any column the user mentions that does not exist.
3113
+ - For "select" filterType columns, "operator" must be "eq" or "in".
3114
+ - For "number" or "date" filterType columns, "operator" can be "gt", "gte", "lt", "lte", "between", "eq".
3115
+ - For "text" filterType columns, "operator" must be "contains" or "eq".
3116
+ - "between" requires value to be a two-element array: [min, max].
3117
+ - "in" requires value to be an array of strings or numbers.
3118
+ - Always include a concise "explanation" field.`;
3119
+ }
3120
+ function Pa(e) {
3121
+ return `Current grid state:\n${JSON.stringify(e.currentState, null, 2)}\n\nUser request: ${e.prompt}`;
3122
+ }
3123
+ function Fa() {
3124
+ return process.env.LLM_PROVIDER === "openai" ? new t() : new e();
3125
+ }
3126
+ function Ia(e) {
3127
+ let t = e.match(/```(?:json)?\s*([\s\S]*?)```/);
3128
+ return t ? t[1].trim() : e.trim();
3129
+ }
3130
+ var La = 1e3;
3131
+ async function Ra(e) {
3132
+ if (!e.prompt || typeof e.prompt != "string") throw Error("Invalid request body: prompt is required");
3133
+ if (e.prompt.length > La) throw Error(`Prompt exceeds maximum length of ${La} characters`);
3134
+ if (!Array.isArray(e.columns) || e.columns.length === 0) throw Error("Invalid request body: columns must be a non-empty array");
3135
+ let t = Fa(), n = Na(e.columns), r = Pa(e), i = Ia(await t.complete(n, r)), a;
3136
+ try {
3137
+ a = JSON.parse(i);
3138
+ } catch {
3139
+ throw Error("AI returned an invalid response. Please try again.");
3140
+ }
3141
+ return Ma.parse(a);
3142
+ }
3143
+ //#endregion
3144
+ export { Ra as handleGridAiRequest };