@lssm/app.cli-database 0.0.0-canary-20251221193616 → 0.0.0-canary-20251223010757

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.
@@ -1,4486 +0,0 @@
1
- //#region ../../libs/schema/dist/index.js
2
- var c8 = Object.defineProperty;
3
- var U6 = (J, X) => {
4
- for (var Y in X) c8(J, Y, {
5
- get: X[Y],
6
- enumerable: !0,
7
- configurable: !0,
8
- set: (W) => X[Y] = () => W
9
- });
10
- };
11
- function u(J, X) {
12
- if (!Boolean(J)) throw Error(X);
13
- }
14
- function _0(J) {
15
- return typeof J == "object" && J !== null;
16
- }
17
- function I6(J, X) {
18
- if (!Boolean(J)) throw Error(X != null ? X : "Unexpected invariant triggered.");
19
- }
20
- var y8 = /\r\n|[\n\r]/g;
21
- function W0(J, X) {
22
- let Y = 0, W = 1;
23
- for (let q of J.body.matchAll(y8)) {
24
- if (typeof q.index === "number" || I6(!1), q.index >= X) break;
25
- Y = q.index + q[0].length, W += 1;
26
- }
27
- return {
28
- line: W,
29
- column: X + 1 - Y
30
- };
31
- }
32
- function X4(J) {
33
- return b0(J.source, W0(J.source, J.start));
34
- }
35
- function b0(J, X) {
36
- let Y = J.locationOffset.column - 1, W = "".padStart(Y) + J.body, q = X.line - 1, H = J.locationOffset.line - 1, B = X.line + H, Q = X.line === 1 ? Y : 0, G = X.column + Q, z = `${J.name}:${B}:${G}
37
- `, I = W.split(/\r\n|[\n\r]/g), w = I[q];
38
- if (w.length > 120) {
39
- let M = Math.floor(G / 80), P = G % 80, N = [];
40
- for (let _ = 0; _ < w.length; _ += 80) N.push(w.slice(_, _ + 80));
41
- return z + w6([
42
- [`${B} |`, N[0]],
43
- ...N.slice(1, M + 1).map((_) => ["|", _]),
44
- ["|", "^".padStart(P)],
45
- ["|", N[M + 1]]
46
- ]);
47
- }
48
- return z + w6([
49
- [`${B - 1} |`, I[q - 1]],
50
- [`${B} |`, w],
51
- ["|", "^".padStart(G)],
52
- [`${B + 1} |`, I[q + 1]]
53
- ]);
54
- }
55
- function w6(J) {
56
- let X = J.filter(([W, q]) => q !== void 0), Y = Math.max(...X.map(([W]) => W.length));
57
- return X.map(([W, q]) => W.padStart(Y) + (q ? " " + q : "")).join(`
58
- `);
59
- }
60
- function m8(J) {
61
- let X = J[0];
62
- if (X == null || "kind" in X || "length" in X) return {
63
- nodes: X,
64
- source: J[1],
65
- positions: J[2],
66
- path: J[3],
67
- originalError: J[4],
68
- extensions: J[5]
69
- };
70
- return X;
71
- }
72
- var h = class h extends Error {
73
- constructor(J, ...X) {
74
- var Y, W, q;
75
- let { nodes: H, source: B, positions: Q, path: G, originalError: z, extensions: I } = m8(X);
76
- super(J);
77
- this.name = "GraphQLError", this.path = G !== null && G !== void 0 ? G : void 0, this.originalError = z !== null && z !== void 0 ? z : void 0, this.nodes = D6(Array.isArray(H) ? H : H ? [H] : void 0);
78
- let w = D6((Y = this.nodes) === null || Y === void 0 ? void 0 : Y.map((P) => P.loc).filter((P) => P != null));
79
- this.source = B !== null && B !== void 0 ? B : w === null || w === void 0 ? void 0 : (W = w[0]) === null || W === void 0 ? void 0 : W.source, this.positions = Q !== null && Q !== void 0 ? Q : w === null || w === void 0 ? void 0 : w.map((P) => P.start), this.locations = Q && B ? Q.map((P) => W0(B, P)) : w === null || w === void 0 ? void 0 : w.map((P) => W0(P.source, P.start));
80
- let M = _0(z === null || z === void 0 ? void 0 : z.extensions) ? z === null || z === void 0 ? void 0 : z.extensions : void 0;
81
- if (this.extensions = (q = I !== null && I !== void 0 ? I : M) !== null && q !== void 0 ? q : Object.create(null), Object.defineProperties(this, {
82
- message: {
83
- writable: !0,
84
- enumerable: !0
85
- },
86
- name: { enumerable: !1 },
87
- nodes: { enumerable: !1 },
88
- source: { enumerable: !1 },
89
- positions: { enumerable: !1 },
90
- originalError: { enumerable: !1 }
91
- }), z !== null && z !== void 0 && z.stack) Object.defineProperty(this, "stack", {
92
- value: z.stack,
93
- writable: !0,
94
- configurable: !0
95
- });
96
- else if (Error.captureStackTrace) Error.captureStackTrace(this, h);
97
- else Object.defineProperty(this, "stack", {
98
- value: Error().stack,
99
- writable: !0,
100
- configurable: !0
101
- });
102
- }
103
- get [Symbol.toStringTag]() {
104
- return "GraphQLError";
105
- }
106
- toString() {
107
- let J = this.message;
108
- if (this.nodes) {
109
- for (let X of this.nodes) if (X.loc) J += `
110
-
111
- ` + X4(X.loc);
112
- } else if (this.source && this.locations) for (let X of this.locations) J += `
113
-
114
- ` + b0(this.source, X);
115
- return J;
116
- }
117
- toJSON() {
118
- let J = { message: this.message };
119
- if (this.locations != null) J.locations = this.locations;
120
- if (this.path != null) J.path = this.path;
121
- if (this.extensions != null && Object.keys(this.extensions).length > 0) J.extensions = this.extensions;
122
- return J;
123
- }
124
- };
125
- function D6(J) {
126
- return J === void 0 || J.length === 0 ? void 0 : J;
127
- }
128
- var W4 = {
129
- Name: [],
130
- Document: ["definitions"],
131
- OperationDefinition: [
132
- "description",
133
- "name",
134
- "variableDefinitions",
135
- "directives",
136
- "selectionSet"
137
- ],
138
- VariableDefinition: [
139
- "description",
140
- "variable",
141
- "type",
142
- "defaultValue",
143
- "directives"
144
- ],
145
- Variable: ["name"],
146
- SelectionSet: ["selections"],
147
- Field: [
148
- "alias",
149
- "name",
150
- "arguments",
151
- "directives",
152
- "selectionSet"
153
- ],
154
- Argument: ["name", "value"],
155
- FragmentSpread: ["name", "directives"],
156
- InlineFragment: [
157
- "typeCondition",
158
- "directives",
159
- "selectionSet"
160
- ],
161
- FragmentDefinition: [
162
- "description",
163
- "name",
164
- "variableDefinitions",
165
- "typeCondition",
166
- "directives",
167
- "selectionSet"
168
- ],
169
- IntValue: [],
170
- FloatValue: [],
171
- StringValue: [],
172
- BooleanValue: [],
173
- NullValue: [],
174
- EnumValue: [],
175
- ListValue: ["values"],
176
- ObjectValue: ["fields"],
177
- ObjectField: ["name", "value"],
178
- Directive: ["name", "arguments"],
179
- NamedType: ["name"],
180
- ListType: ["type"],
181
- NonNullType: ["type"],
182
- SchemaDefinition: [
183
- "description",
184
- "directives",
185
- "operationTypes"
186
- ],
187
- OperationTypeDefinition: ["type"],
188
- ScalarTypeDefinition: [
189
- "description",
190
- "name",
191
- "directives"
192
- ],
193
- ObjectTypeDefinition: [
194
- "description",
195
- "name",
196
- "interfaces",
197
- "directives",
198
- "fields"
199
- ],
200
- FieldDefinition: [
201
- "description",
202
- "name",
203
- "arguments",
204
- "type",
205
- "directives"
206
- ],
207
- InputValueDefinition: [
208
- "description",
209
- "name",
210
- "type",
211
- "defaultValue",
212
- "directives"
213
- ],
214
- InterfaceTypeDefinition: [
215
- "description",
216
- "name",
217
- "interfaces",
218
- "directives",
219
- "fields"
220
- ],
221
- UnionTypeDefinition: [
222
- "description",
223
- "name",
224
- "directives",
225
- "types"
226
- ],
227
- EnumTypeDefinition: [
228
- "description",
229
- "name",
230
- "directives",
231
- "values"
232
- ],
233
- EnumValueDefinition: [
234
- "description",
235
- "name",
236
- "directives"
237
- ],
238
- InputObjectTypeDefinition: [
239
- "description",
240
- "name",
241
- "directives",
242
- "fields"
243
- ],
244
- DirectiveDefinition: [
245
- "description",
246
- "name",
247
- "arguments",
248
- "locations"
249
- ],
250
- SchemaExtension: ["directives", "operationTypes"],
251
- ScalarTypeExtension: ["name", "directives"],
252
- ObjectTypeExtension: [
253
- "name",
254
- "interfaces",
255
- "directives",
256
- "fields"
257
- ],
258
- InterfaceTypeExtension: [
259
- "name",
260
- "interfaces",
261
- "directives",
262
- "fields"
263
- ],
264
- UnionTypeExtension: [
265
- "name",
266
- "directives",
267
- "types"
268
- ],
269
- EnumTypeExtension: [
270
- "name",
271
- "directives",
272
- "values"
273
- ],
274
- InputObjectTypeExtension: [
275
- "name",
276
- "directives",
277
- "fields"
278
- ],
279
- TypeCoordinate: ["name"],
280
- MemberCoordinate: ["name", "memberName"],
281
- ArgumentCoordinate: [
282
- "name",
283
- "fieldName",
284
- "argumentName"
285
- ],
286
- DirectiveCoordinate: ["name"],
287
- DirectiveArgumentCoordinate: ["name", "argumentName"]
288
- }, f8 = new Set(Object.keys(W4));
289
- function q4(J) {
290
- let X = J === null || J === void 0 ? void 0 : J.kind;
291
- return typeof X === "string" && f8.has(X);
292
- }
293
- var Y4;
294
- (function(J) {
295
- J.QUERY = "query", J.MUTATION = "mutation", J.SUBSCRIPTION = "subscription";
296
- })(Y4 || (Y4 = {}));
297
- var K;
298
- (function(J) {
299
- J.NAME = "Name", J.DOCUMENT = "Document", J.OPERATION_DEFINITION = "OperationDefinition", J.VARIABLE_DEFINITION = "VariableDefinition", J.SELECTION_SET = "SelectionSet", J.FIELD = "Field", J.ARGUMENT = "Argument", J.FRAGMENT_SPREAD = "FragmentSpread", J.INLINE_FRAGMENT = "InlineFragment", J.FRAGMENT_DEFINITION = "FragmentDefinition", J.VARIABLE = "Variable", J.INT = "IntValue", J.FLOAT = "FloatValue", J.STRING = "StringValue", J.BOOLEAN = "BooleanValue", J.NULL = "NullValue", J.ENUM = "EnumValue", J.LIST = "ListValue", J.OBJECT = "ObjectValue", J.OBJECT_FIELD = "ObjectField", J.DIRECTIVE = "Directive", J.NAMED_TYPE = "NamedType", J.LIST_TYPE = "ListType", J.NON_NULL_TYPE = "NonNullType", J.SCHEMA_DEFINITION = "SchemaDefinition", J.OPERATION_TYPE_DEFINITION = "OperationTypeDefinition", J.SCALAR_TYPE_DEFINITION = "ScalarTypeDefinition", J.OBJECT_TYPE_DEFINITION = "ObjectTypeDefinition", J.FIELD_DEFINITION = "FieldDefinition", J.INPUT_VALUE_DEFINITION = "InputValueDefinition", J.INTERFACE_TYPE_DEFINITION = "InterfaceTypeDefinition", J.UNION_TYPE_DEFINITION = "UnionTypeDefinition", J.ENUM_TYPE_DEFINITION = "EnumTypeDefinition", J.ENUM_VALUE_DEFINITION = "EnumValueDefinition", J.INPUT_OBJECT_TYPE_DEFINITION = "InputObjectTypeDefinition", J.DIRECTIVE_DEFINITION = "DirectiveDefinition", J.SCHEMA_EXTENSION = "SchemaExtension", J.SCALAR_TYPE_EXTENSION = "ScalarTypeExtension", J.OBJECT_TYPE_EXTENSION = "ObjectTypeExtension", J.INTERFACE_TYPE_EXTENSION = "InterfaceTypeExtension", J.UNION_TYPE_EXTENSION = "UnionTypeExtension", J.ENUM_TYPE_EXTENSION = "EnumTypeExtension", J.INPUT_OBJECT_TYPE_EXTENSION = "InputObjectTypeExtension", J.TYPE_COORDINATE = "TypeCoordinate", J.MEMBER_COORDINATE = "MemberCoordinate", J.ARGUMENT_COORDINATE = "ArgumentCoordinate", J.DIRECTIVE_COORDINATE = "DirectiveCoordinate", J.DIRECTIVE_ARGUMENT_COORDINATE = "DirectiveArgumentCoordinate";
300
- })(K || (K = {}));
301
- function H4(J) {
302
- return J === 9 || J === 32;
303
- }
304
- function o8(J) {
305
- return J >= 48 && J <= 57;
306
- }
307
- function P6(J) {
308
- return J >= 97 && J <= 122 || J >= 65 && J <= 90;
309
- }
310
- function O6(J) {
311
- return P6(J) || J === 95;
312
- }
313
- function M6(J) {
314
- return P6(J) || o8(J) || J === 95;
315
- }
316
- function A6(J, X) {
317
- let Y = J.replace(/"""/g, "\\\"\"\""), W = Y.split(/\r\n|[\n\r]/g), q = W.length === 1, H = W.length > 1 && W.slice(1).every((P) => P.length === 0 || H4(P.charCodeAt(0))), B = Y.endsWith("\\\"\"\""), Q = J.endsWith("\"") && !B, G = J.endsWith("\\"), z = Q || G, I = !(X !== null && X !== void 0 && X.minimize) && (!q || J.length > 70 || z || H || B), w = "", M = q && H4(J.charCodeAt(0));
318
- if (I && !M || H) w += `
319
- `;
320
- if (w += Y, I || z) w += `
321
- `;
322
- return "\"\"\"" + w + "\"\"\"";
323
- }
324
- function e(J) {
325
- return C0(J, []);
326
- }
327
- function C0(J, X) {
328
- switch (typeof J) {
329
- case "string": return JSON.stringify(J);
330
- case "function": return J.name ? `[function ${J.name}]` : "[function]";
331
- case "object": return r8(J, X);
332
- default: return String(J);
333
- }
334
- }
335
- function r8(J, X) {
336
- if (J === null) return "null";
337
- if (X.includes(J)) return "[Circular]";
338
- let Y = [...X, J];
339
- if (l8(J)) {
340
- let W = J.toJSON();
341
- if (W !== J) return typeof W === "string" ? W : C0(W, Y);
342
- } else if (Array.isArray(J)) return d8(J, Y);
343
- return p8(J, Y);
344
- }
345
- function l8(J) {
346
- return typeof J.toJSON === "function";
347
- }
348
- function p8(J, X) {
349
- let Y = Object.entries(J);
350
- if (Y.length === 0) return "{}";
351
- if (X.length > 2) return "[" + n8(J) + "]";
352
- return "{ " + Y.map(([q, H]) => q + ": " + C0(H, X)).join(", ") + " }";
353
- }
354
- function d8(J, X) {
355
- if (J.length === 0) return "[]";
356
- if (X.length > 2) return "[Array]";
357
- let Y = Math.min(10, J.length), W = J.length - Y, q = [];
358
- for (let H = 0; H < Y; ++H) q.push(C0(J[H], X));
359
- if (W === 1) q.push("... 1 more item");
360
- else if (W > 1) q.push(`... ${W} more items`);
361
- return "[" + q.join(", ") + "]";
362
- }
363
- function n8(J) {
364
- let X = Object.prototype.toString.call(J).replace(/^\[object /, "").replace(/]$/, "");
365
- if (X === "Object" && typeof J.constructor === "function") {
366
- let Y = J.constructor.name;
367
- if (typeof Y === "string" && Y !== "") return Y;
368
- }
369
- return X;
370
- }
371
- function F6(J, X) {
372
- let [Y, W] = X ? [J, X] : [void 0, J], q = " Did you mean ";
373
- if (Y) q += Y + " ";
374
- let H = W.map((G) => `"${G}"`);
375
- switch (H.length) {
376
- case 0: return "";
377
- case 1: return q + H[0] + "?";
378
- case 2: return q + H[0] + " or " + H[1] + "?";
379
- }
380
- let B = H.slice(0, 5), Q = B.pop();
381
- return q + B.join(", ") + ", or " + Q + "?";
382
- }
383
- function B4(J) {
384
- return J;
385
- }
386
- function E6(J, X) {
387
- let Y = Object.create(null);
388
- for (let W of J) Y[X(W)] = W;
389
- return Y;
390
- }
391
- function k0(J, X, Y) {
392
- let W = Object.create(null);
393
- for (let q of J) W[X(q)] = Y(q);
394
- return W;
395
- }
396
- function $6(J, X) {
397
- let Y = 0, W = 0;
398
- while (Y < J.length && W < X.length) {
399
- let q = J.charCodeAt(Y), H = X.charCodeAt(W);
400
- if (T0(q) && T0(H)) {
401
- let B = 0;
402
- do
403
- ++Y, B = B * 10 + q - Q4, q = J.charCodeAt(Y);
404
- while (T0(q) && B > 0);
405
- let Q = 0;
406
- do
407
- ++W, Q = Q * 10 + H - Q4, H = X.charCodeAt(W);
408
- while (T0(H) && Q > 0);
409
- if (B < Q) return -1;
410
- if (B > Q) return 1;
411
- } else {
412
- if (q < H) return -1;
413
- if (q > H) return 1;
414
- ++Y, ++W;
415
- }
416
- }
417
- return J.length - X.length;
418
- }
419
- var Q4 = 48, i8 = 57;
420
- function T0(J) {
421
- return !isNaN(J) && Q4 <= J && J <= i8;
422
- }
423
- function V6(J, X) {
424
- let Y = Object.create(null), W = new R6(J), q = Math.floor(J.length * .4) + 1;
425
- for (let H of X) {
426
- let B = W.measure(H, q);
427
- if (B !== void 0) Y[H] = B;
428
- }
429
- return Object.keys(Y).sort((H, B) => {
430
- let Q = Y[H] - Y[B];
431
- return Q !== 0 ? Q : $6(H, B);
432
- });
433
- }
434
- var R6 = class {
435
- constructor(J) {
436
- this._input = J, this._inputLowerCase = J.toLowerCase(), this._inputArray = K6(this._inputLowerCase), this._rows = [
437
- Array(J.length + 1).fill(0),
438
- Array(J.length + 1).fill(0),
439
- Array(J.length + 1).fill(0)
440
- ];
441
- }
442
- measure(J, X) {
443
- if (this._input === J) return 0;
444
- let Y = J.toLowerCase();
445
- if (this._inputLowerCase === Y) return 1;
446
- let W = K6(Y), q = this._inputArray;
447
- if (W.length < q.length) {
448
- let z = W;
449
- W = q, q = z;
450
- }
451
- let H = W.length, B = q.length;
452
- if (H - B > X) return;
453
- let Q = this._rows;
454
- for (let z = 0; z <= B; z++) Q[0][z] = z;
455
- for (let z = 1; z <= H; z++) {
456
- let I = Q[(z - 1) % 3], w = Q[z % 3], M = w[0] = z;
457
- for (let P = 1; P <= B; P++) {
458
- let N = W[z - 1] === q[P - 1] ? 0 : 1, _ = Math.min(I[P] + 1, w[P - 1] + 1, I[P - 1] + N);
459
- if (z > 1 && P > 1 && W[z - 1] === q[P - 2] && W[z - 2] === q[P - 1]) {
460
- let d = Q[(z - 2) % 3][P - 2];
461
- _ = Math.min(_, d + 1);
462
- }
463
- if (_ < M) M = _;
464
- w[P] = _;
465
- }
466
- if (M > X) return;
467
- }
468
- let G = Q[H % 3][B];
469
- return G <= X ? G : void 0;
470
- }
471
- };
472
- function K6(J) {
473
- let X = J.length, Y = Array(X);
474
- for (let W = 0; W < X; ++W) Y[W] = J.charCodeAt(W);
475
- return Y;
476
- }
477
- function j0(J) {
478
- if (J == null) return Object.create(null);
479
- if (Object.getPrototypeOf(J) === null) return J;
480
- let X = Object.create(null);
481
- for (let [Y, W] of Object.entries(J)) X[Y] = W;
482
- return X;
483
- }
484
- function N6(J) {
485
- return `"${J.replace(t8, a8)}"`;
486
- }
487
- var t8 = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g;
488
- function a8(J) {
489
- return s8[J.charCodeAt(0)];
490
- }
491
- var s8 = [
492
- "\\u0000",
493
- "\\u0001",
494
- "\\u0002",
495
- "\\u0003",
496
- "\\u0004",
497
- "\\u0005",
498
- "\\u0006",
499
- "\\u0007",
500
- "\\b",
501
- "\\t",
502
- "\\n",
503
- "\\u000B",
504
- "\\f",
505
- "\\r",
506
- "\\u000E",
507
- "\\u000F",
508
- "\\u0010",
509
- "\\u0011",
510
- "\\u0012",
511
- "\\u0013",
512
- "\\u0014",
513
- "\\u0015",
514
- "\\u0016",
515
- "\\u0017",
516
- "\\u0018",
517
- "\\u0019",
518
- "\\u001A",
519
- "\\u001B",
520
- "\\u001C",
521
- "\\u001D",
522
- "\\u001E",
523
- "\\u001F",
524
- "",
525
- "",
526
- "\\\"",
527
- "",
528
- "",
529
- "",
530
- "",
531
- "",
532
- "",
533
- "",
534
- "",
535
- "",
536
- "",
537
- "",
538
- "",
539
- "",
540
- "",
541
- "",
542
- "",
543
- "",
544
- "",
545
- "",
546
- "",
547
- "",
548
- "",
549
- "",
550
- "",
551
- "",
552
- "",
553
- "",
554
- "",
555
- "",
556
- "",
557
- "",
558
- "",
559
- "",
560
- "",
561
- "",
562
- "",
563
- "",
564
- "",
565
- "",
566
- "",
567
- "",
568
- "",
569
- "",
570
- "",
571
- "",
572
- "",
573
- "",
574
- "",
575
- "",
576
- "",
577
- "",
578
- "",
579
- "",
580
- "",
581
- "",
582
- "",
583
- "",
584
- "\\\\",
585
- "",
586
- "",
587
- "",
588
- "",
589
- "",
590
- "",
591
- "",
592
- "",
593
- "",
594
- "",
595
- "",
596
- "",
597
- "",
598
- "",
599
- "",
600
- "",
601
- "",
602
- "",
603
- "",
604
- "",
605
- "",
606
- "",
607
- "",
608
- "",
609
- "",
610
- "",
611
- "",
612
- "",
613
- "",
614
- "",
615
- "",
616
- "",
617
- "",
618
- "",
619
- "\\u007F",
620
- "\\u0080",
621
- "\\u0081",
622
- "\\u0082",
623
- "\\u0083",
624
- "\\u0084",
625
- "\\u0085",
626
- "\\u0086",
627
- "\\u0087",
628
- "\\u0088",
629
- "\\u0089",
630
- "\\u008A",
631
- "\\u008B",
632
- "\\u008C",
633
- "\\u008D",
634
- "\\u008E",
635
- "\\u008F",
636
- "\\u0090",
637
- "\\u0091",
638
- "\\u0092",
639
- "\\u0093",
640
- "\\u0094",
641
- "\\u0095",
642
- "\\u0096",
643
- "\\u0097",
644
- "\\u0098",
645
- "\\u0099",
646
- "\\u009A",
647
- "\\u009B",
648
- "\\u009C",
649
- "\\u009D",
650
- "\\u009E",
651
- "\\u009F"
652
- ];
653
- var S6 = Object.freeze({});
654
- function z4(J, X, Y = W4) {
655
- let W = /* @__PURE__ */ new Map();
656
- for (let g of Object.values(K)) W.set(g, L6(X, g));
657
- let q = void 0, H = Array.isArray(J), B = [J], Q = -1, G = [], z = J, I = void 0, w = void 0, M = [], P = [];
658
- do {
659
- Q++;
660
- let g = Q === B.length, Z0 = g && G.length !== 0;
661
- if (g) {
662
- if (I = P.length === 0 ? void 0 : M[M.length - 1], z = w, w = P.pop(), Z0) if (H) {
663
- z = z.slice();
664
- let C = 0;
665
- for (let [o, z6] of G) {
666
- let G6 = o - C;
667
- if (z6 === null) z.splice(G6, 1), C++;
668
- else z[G6] = z6;
669
- }
670
- } else {
671
- z = { ...z };
672
- for (let [C, o] of G) z[C] = o;
673
- }
674
- Q = q.index, B = q.keys, G = q.edits, H = q.inArray, q = q.prev;
675
- } else if (w) {
676
- if (I = H ? Q : B[Q], z = w[I], z === null || z === void 0) continue;
677
- M.push(I);
678
- }
679
- let k;
680
- if (!Array.isArray(z)) {
681
- var N, _;
682
- q4(z) || u(!1, `Invalid AST Node: ${e(z)}.`);
683
- let C = g ? (N = W.get(z.kind)) === null || N === void 0 ? void 0 : N.leave : (_ = W.get(z.kind)) === null || _ === void 0 ? void 0 : _.enter;
684
- if (k = C === null || C === void 0 ? void 0 : C.call(X, z, I, w, M, P), k === S6) break;
685
- if (k === !1) {
686
- if (!g) {
687
- M.pop();
688
- continue;
689
- }
690
- } else if (k !== void 0) {
691
- if (G.push([I, k]), !g) if (q4(k)) z = k;
692
- else {
693
- M.pop();
694
- continue;
695
- }
696
- }
697
- }
698
- if (k === void 0 && Z0) G.push([I, z]);
699
- if (g) M.pop();
700
- else {
701
- var d;
702
- if (q = {
703
- inArray: H,
704
- index: Q,
705
- keys: B,
706
- edits: G,
707
- prev: q
708
- }, H = Array.isArray(z), B = H ? z : (d = Y[z.kind]) !== null && d !== void 0 ? d : [], Q = -1, G = [], w) P.push(w);
709
- w = z;
710
- }
711
- } while (q !== void 0);
712
- if (G.length !== 0) return G[G.length - 1][1];
713
- return J;
714
- }
715
- function L6(J, X) {
716
- let Y = J[X];
717
- if (typeof Y === "object") return Y;
718
- else if (typeof Y === "function") return {
719
- enter: Y,
720
- leave: void 0
721
- };
722
- return {
723
- enter: J.enter,
724
- leave: J.leave
725
- };
726
- }
727
- function x0(J) {
728
- return z4(J, J9);
729
- }
730
- var e8 = 80, J9 = {
731
- Name: { leave: (J) => J.value },
732
- Variable: { leave: (J) => "$" + J.name },
733
- Document: { leave: (J) => D(J.definitions, `
734
-
735
- `) },
736
- OperationDefinition: { leave(J) {
737
- let X = G4(J.variableDefinitions) ? A(`(
738
- `, D(J.variableDefinitions, `
739
- `), `
740
- )`) : A("(", D(J.variableDefinitions, ", "), ")"), Y = A("", J.description, `
741
- `) + D([
742
- J.operation,
743
- D([J.name, X]),
744
- D(J.directives, " ")
745
- ], " ");
746
- return (Y === "query" ? "" : Y + " ") + J.selectionSet;
747
- } },
748
- VariableDefinition: { leave: ({ variable: J, type: X, defaultValue: Y, directives: W, description: q }) => A("", q, `
749
- `) + J + ": " + X + A(" = ", Y) + A(" ", D(W, " ")) },
750
- SelectionSet: { leave: ({ selections: J }) => c(J) },
751
- Field: { leave({ alias: J, name: X, arguments: Y, directives: W, selectionSet: q }) {
752
- let H = A("", J, ": ") + X, B = H + A("(", D(Y, ", "), ")");
753
- if (B.length > e8) B = H + A(`(
754
- `, h0(D(Y, `
755
- `)), `
756
- )`);
757
- return D([
758
- B,
759
- D(W, " "),
760
- q
761
- ], " ");
762
- } },
763
- Argument: { leave: ({ name: J, value: X }) => J + ": " + X },
764
- FragmentSpread: { leave: ({ name: J, directives: X }) => "..." + J + A(" ", D(X, " ")) },
765
- InlineFragment: { leave: ({ typeCondition: J, directives: X, selectionSet: Y }) => D([
766
- "...",
767
- A("on ", J),
768
- D(X, " "),
769
- Y
770
- ], " ") },
771
- FragmentDefinition: { leave: ({ name: J, typeCondition: X, variableDefinitions: Y, directives: W, selectionSet: q, description: H }) => A("", H, `
772
- `) + `fragment ${J}${A("(", D(Y, ", "), ")")} on ${X} ${A("", D(W, " "), " ")}` + q },
773
- IntValue: { leave: ({ value: J }) => J },
774
- FloatValue: { leave: ({ value: J }) => J },
775
- StringValue: { leave: ({ value: J, block: X }) => X ? A6(J) : N6(J) },
776
- BooleanValue: { leave: ({ value: J }) => J ? "true" : "false" },
777
- NullValue: { leave: () => "null" },
778
- EnumValue: { leave: ({ value: J }) => J },
779
- ListValue: { leave: ({ values: J }) => "[" + D(J, ", ") + "]" },
780
- ObjectValue: { leave: ({ fields: J }) => "{" + D(J, ", ") + "}" },
781
- ObjectField: { leave: ({ name: J, value: X }) => J + ": " + X },
782
- Directive: { leave: ({ name: J, arguments: X }) => "@" + J + A("(", D(X, ", "), ")") },
783
- NamedType: { leave: ({ name: J }) => J },
784
- ListType: { leave: ({ type: J }) => "[" + J + "]" },
785
- NonNullType: { leave: ({ type: J }) => J + "!" },
786
- SchemaDefinition: { leave: ({ description: J, directives: X, operationTypes: Y }) => A("", J, `
787
- `) + D([
788
- "schema",
789
- D(X, " "),
790
- c(Y)
791
- ], " ") },
792
- OperationTypeDefinition: { leave: ({ operation: J, type: X }) => J + ": " + X },
793
- ScalarTypeDefinition: { leave: ({ description: J, name: X, directives: Y }) => A("", J, `
794
- `) + D([
795
- "scalar",
796
- X,
797
- D(Y, " ")
798
- ], " ") },
799
- ObjectTypeDefinition: { leave: ({ description: J, name: X, interfaces: Y, directives: W, fields: q }) => A("", J, `
800
- `) + D([
801
- "type",
802
- X,
803
- A("implements ", D(Y, " & ")),
804
- D(W, " "),
805
- c(q)
806
- ], " ") },
807
- FieldDefinition: { leave: ({ description: J, name: X, arguments: Y, type: W, directives: q }) => A("", J, `
808
- `) + X + (G4(Y) ? A(`(
809
- `, h0(D(Y, `
810
- `)), `
811
- )`) : A("(", D(Y, ", "), ")")) + ": " + W + A(" ", D(q, " ")) },
812
- InputValueDefinition: { leave: ({ description: J, name: X, type: Y, defaultValue: W, directives: q }) => A("", J, `
813
- `) + D([
814
- X + ": " + Y,
815
- A("= ", W),
816
- D(q, " ")
817
- ], " ") },
818
- InterfaceTypeDefinition: { leave: ({ description: J, name: X, interfaces: Y, directives: W, fields: q }) => A("", J, `
819
- `) + D([
820
- "interface",
821
- X,
822
- A("implements ", D(Y, " & ")),
823
- D(W, " "),
824
- c(q)
825
- ], " ") },
826
- UnionTypeDefinition: { leave: ({ description: J, name: X, directives: Y, types: W }) => A("", J, `
827
- `) + D([
828
- "union",
829
- X,
830
- D(Y, " "),
831
- A("= ", D(W, " | "))
832
- ], " ") },
833
- EnumTypeDefinition: { leave: ({ description: J, name: X, directives: Y, values: W }) => A("", J, `
834
- `) + D([
835
- "enum",
836
- X,
837
- D(Y, " "),
838
- c(W)
839
- ], " ") },
840
- EnumValueDefinition: { leave: ({ description: J, name: X, directives: Y }) => A("", J, `
841
- `) + D([X, D(Y, " ")], " ") },
842
- InputObjectTypeDefinition: { leave: ({ description: J, name: X, directives: Y, fields: W }) => A("", J, `
843
- `) + D([
844
- "input",
845
- X,
846
- D(Y, " "),
847
- c(W)
848
- ], " ") },
849
- DirectiveDefinition: { leave: ({ description: J, name: X, arguments: Y, repeatable: W, locations: q }) => A("", J, `
850
- `) + "directive @" + X + (G4(Y) ? A(`(
851
- `, h0(D(Y, `
852
- `)), `
853
- )`) : A("(", D(Y, ", "), ")")) + (W ? " repeatable" : "") + " on " + D(q, " | ") },
854
- SchemaExtension: { leave: ({ directives: J, operationTypes: X }) => D([
855
- "extend schema",
856
- D(J, " "),
857
- c(X)
858
- ], " ") },
859
- ScalarTypeExtension: { leave: ({ name: J, directives: X }) => D([
860
- "extend scalar",
861
- J,
862
- D(X, " ")
863
- ], " ") },
864
- ObjectTypeExtension: { leave: ({ name: J, interfaces: X, directives: Y, fields: W }) => D([
865
- "extend type",
866
- J,
867
- A("implements ", D(X, " & ")),
868
- D(Y, " "),
869
- c(W)
870
- ], " ") },
871
- InterfaceTypeExtension: { leave: ({ name: J, interfaces: X, directives: Y, fields: W }) => D([
872
- "extend interface",
873
- J,
874
- A("implements ", D(X, " & ")),
875
- D(Y, " "),
876
- c(W)
877
- ], " ") },
878
- UnionTypeExtension: { leave: ({ name: J, directives: X, types: Y }) => D([
879
- "extend union",
880
- J,
881
- D(X, " "),
882
- A("= ", D(Y, " | "))
883
- ], " ") },
884
- EnumTypeExtension: { leave: ({ name: J, directives: X, values: Y }) => D([
885
- "extend enum",
886
- J,
887
- D(X, " "),
888
- c(Y)
889
- ], " ") },
890
- InputObjectTypeExtension: { leave: ({ name: J, directives: X, fields: Y }) => D([
891
- "extend input",
892
- J,
893
- D(X, " "),
894
- c(Y)
895
- ], " ") },
896
- TypeCoordinate: { leave: ({ name: J }) => J },
897
- MemberCoordinate: { leave: ({ name: J, memberName: X }) => D([J, A(".", X)]) },
898
- ArgumentCoordinate: { leave: ({ name: J, fieldName: X, argumentName: Y }) => D([
899
- J,
900
- A(".", X),
901
- A("(", Y, ":)")
902
- ]) },
903
- DirectiveCoordinate: { leave: ({ name: J }) => D(["@", J]) },
904
- DirectiveArgumentCoordinate: { leave: ({ name: J, argumentName: X }) => D([
905
- "@",
906
- J,
907
- A("(", X, ":)")
908
- ]) }
909
- };
910
- function D(J, X = "") {
911
- var Y;
912
- return (Y = J === null || J === void 0 ? void 0 : J.filter((W) => W).join(X)) !== null && Y !== void 0 ? Y : "";
913
- }
914
- function c(J) {
915
- return A(`{
916
- `, h0(D(J, `
917
- `)), `
918
- }`);
919
- }
920
- function A(J, X, Y = "") {
921
- return X != null && X !== "" ? J + X + Y : "";
922
- }
923
- function h0(J) {
924
- return A(" ", J.replace(/\n/g, `
925
- `));
926
- }
927
- function G4(J) {
928
- var X;
929
- return (X = J === null || J === void 0 ? void 0 : J.some((Y) => Y.includes(`
930
- `))) !== null && X !== void 0 ? X : !1;
931
- }
932
- function v0(J, X) {
933
- switch (J.kind) {
934
- case K.NULL: return null;
935
- case K.INT: return parseInt(J.value, 10);
936
- case K.FLOAT: return parseFloat(J.value);
937
- case K.STRING:
938
- case K.ENUM:
939
- case K.BOOLEAN: return J.value;
940
- case K.LIST: return J.values.map((Y) => v0(Y, X));
941
- case K.OBJECT: return k0(J.fields, (Y) => Y.name.value, (Y) => v0(Y.value, X));
942
- case K.VARIABLE: return X === null || X === void 0 ? void 0 : X[J.name.value];
943
- }
944
- }
945
- function w0(J) {
946
- if (J ?? u(!1, "Must provide name."), typeof J === "string" || u(!1, "Expected name to be a string."), J.length === 0) throw new h("Expected name to be a non-empty string.");
947
- for (let X = 1; X < J.length; ++X) if (!M6(J.charCodeAt(X))) throw new h(`Names must only contain [_a-zA-Z0-9] but "${J}" does not.`);
948
- if (!O6(J.charCodeAt(0))) throw new h(`Names must start with [_a-zA-Z] but "${J}" does not.`);
949
- return J;
950
- }
951
- function U4(J) {
952
- if (J === "true" || J === "false" || J === "null") throw new h(`Enum values cannot be named: ${J}`);
953
- return w0(J);
954
- }
955
- var D0 = class {
956
- constructor(J) {
957
- var X, Y, W, q;
958
- let H = (X = J.parseValue) !== null && X !== void 0 ? X : B4;
959
- if (this.name = w0(J.name), this.description = J.description, this.specifiedByURL = J.specifiedByURL, this.serialize = (Y = J.serialize) !== null && Y !== void 0 ? Y : B4, this.parseValue = H, this.parseLiteral = (W = J.parseLiteral) !== null && W !== void 0 ? W : (B, Q) => H(v0(B, Q)), this.extensions = j0(J.extensions), this.astNode = J.astNode, this.extensionASTNodes = (q = J.extensionASTNodes) !== null && q !== void 0 ? q : [], J.specifiedByURL == null || typeof J.specifiedByURL === "string" || u(!1, `${this.name} must provide "specifiedByURL" as a string, but got: ${e(J.specifiedByURL)}.`), J.serialize == null || typeof J.serialize === "function" || u(!1, `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`), J.parseLiteral) typeof J.parseValue === "function" && typeof J.parseLiteral === "function" || u(!1, `${this.name} must provide both "parseValue" and "parseLiteral" functions.`);
960
- }
961
- get [Symbol.toStringTag]() {
962
- return "GraphQLScalarType";
963
- }
964
- toConfig() {
965
- return {
966
- name: this.name,
967
- description: this.description,
968
- specifiedByURL: this.specifiedByURL,
969
- serialize: this.serialize,
970
- parseValue: this.parseValue,
971
- parseLiteral: this.parseLiteral,
972
- extensions: this.extensions,
973
- astNode: this.astNode,
974
- extensionASTNodes: this.extensionASTNodes
975
- };
976
- }
977
- toString() {
978
- return this.name;
979
- }
980
- toJSON() {
981
- return this.toString();
982
- }
983
- };
984
- function Z6(J) {
985
- return _0(J) && !Array.isArray(J);
986
- }
987
- var P0 = class {
988
- constructor(J) {
989
- var X;
990
- this.name = w0(J.name), this.description = J.description, this.extensions = j0(J.extensions), this.astNode = J.astNode, this.extensionASTNodes = (X = J.extensionASTNodes) !== null && X !== void 0 ? X : [], this._values = typeof J.values === "function" ? J.values : _6(this.name, J.values), this._valueLookup = null, this._nameLookup = null;
991
- }
992
- get [Symbol.toStringTag]() {
993
- return "GraphQLEnumType";
994
- }
995
- getValues() {
996
- if (typeof this._values === "function") this._values = _6(this.name, this._values());
997
- return this._values;
998
- }
999
- getValue(J) {
1000
- if (this._nameLookup === null) this._nameLookup = E6(this.getValues(), (X) => X.name);
1001
- return this._nameLookup[J];
1002
- }
1003
- serialize(J) {
1004
- if (this._valueLookup === null) this._valueLookup = new Map(this.getValues().map((Y) => [Y.value, Y]));
1005
- let X = this._valueLookup.get(J);
1006
- if (X === void 0) throw new h(`Enum "${this.name}" cannot represent value: ${e(J)}`);
1007
- return X.name;
1008
- }
1009
- parseValue(J) {
1010
- if (typeof J !== "string") {
1011
- let Y = e(J);
1012
- throw new h(`Enum "${this.name}" cannot represent non-string value: ${Y}.` + g0(this, Y));
1013
- }
1014
- let X = this.getValue(J);
1015
- if (X == null) throw new h(`Value "${J}" does not exist in "${this.name}" enum.` + g0(this, J));
1016
- return X.value;
1017
- }
1018
- parseLiteral(J, X) {
1019
- if (J.kind !== K.ENUM) {
1020
- let W = x0(J);
1021
- throw new h(`Enum "${this.name}" cannot represent non-enum value: ${W}.` + g0(this, W), { nodes: J });
1022
- }
1023
- let Y = this.getValue(J.value);
1024
- if (Y == null) {
1025
- let W = x0(J);
1026
- throw new h(`Value "${W}" does not exist in "${this.name}" enum.` + g0(this, W), { nodes: J });
1027
- }
1028
- return Y.value;
1029
- }
1030
- toConfig() {
1031
- let J = k0(this.getValues(), (X) => X.name, (X) => ({
1032
- description: X.description,
1033
- value: X.value,
1034
- deprecationReason: X.deprecationReason,
1035
- extensions: X.extensions,
1036
- astNode: X.astNode
1037
- }));
1038
- return {
1039
- name: this.name,
1040
- description: this.description,
1041
- values: J,
1042
- extensions: this.extensions,
1043
- astNode: this.astNode,
1044
- extensionASTNodes: this.extensionASTNodes
1045
- };
1046
- }
1047
- toString() {
1048
- return this.name;
1049
- }
1050
- toJSON() {
1051
- return this.toString();
1052
- }
1053
- };
1054
- function g0(J, X) {
1055
- return F6("the enum value", V6(X, J.getValues().map((q) => q.name)));
1056
- }
1057
- function _6(J, X) {
1058
- return Z6(X) || u(!1, `${J} values must be an object with value names as keys.`), Object.entries(X).map(([Y, W]) => {
1059
- return Z6(W) || u(!1, `${J}.${Y} must refer to an object with a "value" key representing an internal value but got: ${e(W)}.`), {
1060
- name: U4(Y),
1061
- description: W.description,
1062
- value: W.value !== void 0 ? W.value : Y,
1063
- deprecationReason: W.deprecationReason,
1064
- extensions: j0(W.extensions),
1065
- astNode: W.astNode
1066
- };
1067
- });
1068
- }
1069
- Object.freeze({ status: "aborted" });
1070
- function U(J, X, Y) {
1071
- function W(Q, G) {
1072
- if (!Q._zod) Object.defineProperty(Q, "_zod", {
1073
- value: {
1074
- def: G,
1075
- constr: B,
1076
- traits: /* @__PURE__ */ new Set()
1077
- },
1078
- enumerable: !1
1079
- });
1080
- if (Q._zod.traits.has(J)) return;
1081
- Q._zod.traits.add(J), X(Q, G);
1082
- let z = B.prototype, I = Object.keys(z);
1083
- for (let w = 0; w < I.length; w++) {
1084
- let M = I[w];
1085
- if (!(M in Q)) Q[M] = z[M].bind(Q);
1086
- }
1087
- }
1088
- let q = Y?.Parent ?? Object;
1089
- class H extends q {}
1090
- Object.defineProperty(H, "name", { value: J });
1091
- function B(Q) {
1092
- var G;
1093
- let z = Y?.Parent ? new H() : this;
1094
- W(z, Q), (G = z._zod).deferred ?? (G.deferred = []);
1095
- for (let I of z._zod.deferred) I();
1096
- return z;
1097
- }
1098
- return Object.defineProperty(B, "init", { value: W }), Object.defineProperty(B, Symbol.hasInstance, { value: (Q) => {
1099
- if (Y?.Parent && Q instanceof Y.Parent) return !0;
1100
- return Q?._zod?.traits?.has(J);
1101
- } }), Object.defineProperty(B, "name", { value: J }), B;
1102
- }
1103
- var r = class extends Error {
1104
- constructor() {
1105
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
1106
- }
1107
- };
1108
- var O0 = class extends Error {
1109
- constructor(J) {
1110
- super(`Encountered unidirectional transform during encode: ${J}`);
1111
- this.name = "ZodEncodeError";
1112
- }
1113
- };
1114
- var u0 = {};
1115
- function v(J) {
1116
- if (J) Object.assign(u0, J);
1117
- return u0;
1118
- }
1119
- var F = {};
1120
- U6(F, {
1121
- unwrapMessage: () => M0,
1122
- uint8ArrayToHex: () => AX,
1123
- uint8ArrayToBase64url: () => OX,
1124
- uint8ArrayToBase64: () => x6,
1125
- stringifyPrimitive: () => f0,
1126
- slugify: () => D4,
1127
- shallowClone: () => C6,
1128
- safeExtend: () => GX,
1129
- required: () => wX,
1130
- randomString: () => YX,
1131
- propertyKeyTypes: () => O4,
1132
- promiseAllObject: () => XX,
1133
- primitiveTypes: () => k6,
1134
- prefixIssues: () => l,
1135
- pick: () => BX,
1136
- partial: () => IX,
1137
- optionalKeys: () => M4,
1138
- omit: () => QX,
1139
- objectClone: () => s9,
1140
- numKeys: () => WX,
1141
- nullish: () => E0,
1142
- normalizeParams: () => O,
1143
- mergeDefs: () => i,
1144
- merge: () => UX,
1145
- jsonStringifyReplacer: () => H0,
1146
- joinValues: () => c0,
1147
- issue: () => B0,
1148
- isPlainObject: () => t,
1149
- isObject: () => q0,
1150
- hexToUint8Array: () => MX,
1151
- getSizableOrigin: () => j6,
1152
- getParsedType: () => qX,
1153
- getLengthableOrigin: () => K0,
1154
- getEnumValues: () => A0,
1155
- getElementAtPath: () => JX,
1156
- floatSafeRemainder: () => w4,
1157
- finalizeIssue: () => m,
1158
- extend: () => zX,
1159
- escapeRegex: () => J0,
1160
- esc: () => y0,
1161
- defineLazy: () => E,
1162
- createTransparentProxy: () => HX,
1163
- cloneDef: () => e9,
1164
- clone: () => y,
1165
- cleanRegex: () => $0,
1166
- cleanEnum: () => DX,
1167
- captureStackTrace: () => m0,
1168
- cached: () => F0,
1169
- base64urlToUint8Array: () => PX,
1170
- base64ToUint8Array: () => h6,
1171
- assignProp: () => n,
1172
- assertNotEqual: () => n9,
1173
- assertNever: () => t9,
1174
- assertIs: () => i9,
1175
- assertEqual: () => d9,
1176
- assert: () => a9,
1177
- allowsEval: () => P4,
1178
- aborted: () => a,
1179
- NUMBER_FORMAT_RANGES: () => A4,
1180
- Class: () => v6,
1181
- BIGINT_FORMAT_RANGES: () => T6
1182
- });
1183
- function d9(J) {
1184
- return J;
1185
- }
1186
- function n9(J) {
1187
- return J;
1188
- }
1189
- function i9(J) {}
1190
- function t9(J) {
1191
- throw Error("Unexpected value in exhaustive check");
1192
- }
1193
- function a9(J) {}
1194
- function A0(J) {
1195
- let X = Object.values(J).filter((W) => typeof W === "number");
1196
- return Object.entries(J).filter(([W, q]) => X.indexOf(+W) === -1).map(([W, q]) => q);
1197
- }
1198
- function c0(J, X = "|") {
1199
- return J.map((Y) => f0(Y)).join(X);
1200
- }
1201
- function H0(J, X) {
1202
- if (typeof X === "bigint") return X.toString();
1203
- return X;
1204
- }
1205
- function F0(J) {
1206
- return { get value() {
1207
- {
1208
- let Y = J();
1209
- return Object.defineProperty(this, "value", { value: Y }), Y;
1210
- }
1211
- throw Error("cached value already set");
1212
- } };
1213
- }
1214
- function E0(J) {
1215
- return J === null || J === void 0;
1216
- }
1217
- function $0(J) {
1218
- let X = J.startsWith("^") ? 1 : 0, Y = J.endsWith("$") ? J.length - 1 : J.length;
1219
- return J.slice(X, Y);
1220
- }
1221
- function w4(J, X) {
1222
- let Y = (J.toString().split(".")[1] || "").length, W = X.toString(), q = (W.split(".")[1] || "").length;
1223
- if (q === 0 && /\d?e-\d?/.test(W)) {
1224
- let G = W.match(/\d?e-(\d?)/);
1225
- if (G?.[1]) q = Number.parseInt(G[1]);
1226
- }
1227
- let H = Y > q ? Y : q;
1228
- return Number.parseInt(J.toFixed(H).replace(".", "")) % Number.parseInt(X.toFixed(H).replace(".", "")) / 10 ** H;
1229
- }
1230
- var b6 = Symbol("evaluating");
1231
- function E(J, X, Y) {
1232
- let W = void 0;
1233
- Object.defineProperty(J, X, {
1234
- get() {
1235
- if (W === b6) return;
1236
- if (W === void 0) W = b6, W = Y();
1237
- return W;
1238
- },
1239
- set(q) {
1240
- Object.defineProperty(J, X, { value: q });
1241
- },
1242
- configurable: !0
1243
- });
1244
- }
1245
- function s9(J) {
1246
- return Object.create(Object.getPrototypeOf(J), Object.getOwnPropertyDescriptors(J));
1247
- }
1248
- function n(J, X, Y) {
1249
- Object.defineProperty(J, X, {
1250
- value: Y,
1251
- writable: !0,
1252
- enumerable: !0,
1253
- configurable: !0
1254
- });
1255
- }
1256
- function i(...J) {
1257
- let X = {};
1258
- for (let Y of J) {
1259
- let W = Object.getOwnPropertyDescriptors(Y);
1260
- Object.assign(X, W);
1261
- }
1262
- return Object.defineProperties({}, X);
1263
- }
1264
- function e9(J) {
1265
- return i(J._zod.def);
1266
- }
1267
- function JX(J, X) {
1268
- if (!X) return J;
1269
- return X.reduce((Y, W) => Y?.[W], J);
1270
- }
1271
- function XX(J) {
1272
- let X = Object.keys(J), Y = X.map((W) => J[W]);
1273
- return Promise.all(Y).then((W) => {
1274
- let q = {};
1275
- for (let H = 0; H < X.length; H++) q[X[H]] = W[H];
1276
- return q;
1277
- });
1278
- }
1279
- function YX(J = 10) {
1280
- let Y = "";
1281
- for (let W = 0; W < J; W++) Y += "abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random() * 26)];
1282
- return Y;
1283
- }
1284
- function y0(J) {
1285
- return JSON.stringify(J);
1286
- }
1287
- function D4(J) {
1288
- return J.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
1289
- }
1290
- var m0 = "captureStackTrace" in Error ? Error.captureStackTrace : (...J) => {};
1291
- function q0(J) {
1292
- return typeof J === "object" && J !== null && !Array.isArray(J);
1293
- }
1294
- var P4 = F0(() => {
1295
- if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
1296
- try {
1297
- return new Function(""), !0;
1298
- } catch (J) {
1299
- return !1;
1300
- }
1301
- });
1302
- function t(J) {
1303
- if (q0(J) === !1) return !1;
1304
- let X = J.constructor;
1305
- if (X === void 0) return !0;
1306
- if (typeof X !== "function") return !0;
1307
- let Y = X.prototype;
1308
- if (q0(Y) === !1) return !1;
1309
- if (Object.prototype.hasOwnProperty.call(Y, "isPrototypeOf") === !1) return !1;
1310
- return !0;
1311
- }
1312
- function C6(J) {
1313
- if (t(J)) return { ...J };
1314
- if (Array.isArray(J)) return [...J];
1315
- return J;
1316
- }
1317
- function WX(J) {
1318
- let X = 0;
1319
- for (let Y in J) if (Object.prototype.hasOwnProperty.call(J, Y)) X++;
1320
- return X;
1321
- }
1322
- var qX = (J) => {
1323
- let X = typeof J;
1324
- switch (X) {
1325
- case "undefined": return "undefined";
1326
- case "string": return "string";
1327
- case "number": return Number.isNaN(J) ? "nan" : "number";
1328
- case "boolean": return "boolean";
1329
- case "function": return "function";
1330
- case "bigint": return "bigint";
1331
- case "symbol": return "symbol";
1332
- case "object":
1333
- if (Array.isArray(J)) return "array";
1334
- if (J === null) return "null";
1335
- if (J.then && typeof J.then === "function" && J.catch && typeof J.catch === "function") return "promise";
1336
- if (typeof Map < "u" && J instanceof Map) return "map";
1337
- if (typeof Set < "u" && J instanceof Set) return "set";
1338
- if (typeof Date < "u" && J instanceof Date) return "date";
1339
- if (typeof File < "u" && J instanceof File) return "file";
1340
- return "object";
1341
- default: throw Error(`Unknown data type: ${X}`);
1342
- }
1343
- }, O4 = new Set([
1344
- "string",
1345
- "number",
1346
- "symbol"
1347
- ]), k6 = new Set([
1348
- "string",
1349
- "number",
1350
- "bigint",
1351
- "boolean",
1352
- "symbol",
1353
- "undefined"
1354
- ]);
1355
- function J0(J) {
1356
- return J.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1357
- }
1358
- function y(J, X, Y) {
1359
- let W = new J._zod.constr(X ?? J._zod.def);
1360
- if (!X || Y?.parent) W._zod.parent = J;
1361
- return W;
1362
- }
1363
- function O(J) {
1364
- let X = J;
1365
- if (!X) return {};
1366
- if (typeof X === "string") return { error: () => X };
1367
- if (X?.message !== void 0) {
1368
- if (X?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
1369
- X.error = X.message;
1370
- }
1371
- if (delete X.message, typeof X.error === "string") return {
1372
- ...X,
1373
- error: () => X.error
1374
- };
1375
- return X;
1376
- }
1377
- function HX(J) {
1378
- let X;
1379
- return new Proxy({}, {
1380
- get(Y, W, q) {
1381
- return X ?? (X = J()), Reflect.get(X, W, q);
1382
- },
1383
- set(Y, W, q, H) {
1384
- return X ?? (X = J()), Reflect.set(X, W, q, H);
1385
- },
1386
- has(Y, W) {
1387
- return X ?? (X = J()), Reflect.has(X, W);
1388
- },
1389
- deleteProperty(Y, W) {
1390
- return X ?? (X = J()), Reflect.deleteProperty(X, W);
1391
- },
1392
- ownKeys(Y) {
1393
- return X ?? (X = J()), Reflect.ownKeys(X);
1394
- },
1395
- getOwnPropertyDescriptor(Y, W) {
1396
- return X ?? (X = J()), Reflect.getOwnPropertyDescriptor(X, W);
1397
- },
1398
- defineProperty(Y, W, q) {
1399
- return X ?? (X = J()), Reflect.defineProperty(X, W, q);
1400
- }
1401
- });
1402
- }
1403
- function f0(J) {
1404
- if (typeof J === "bigint") return J.toString() + "n";
1405
- if (typeof J === "string") return `"${J}"`;
1406
- return `${J}`;
1407
- }
1408
- function M4(J) {
1409
- return Object.keys(J).filter((X) => {
1410
- return J[X]._zod.optin === "optional" && J[X]._zod.optout === "optional";
1411
- });
1412
- }
1413
- var A4 = {
1414
- safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
1415
- int32: [-2147483648, 2147483647],
1416
- uint32: [0, 4294967295],
1417
- float32: [-34028234663852886e22, 34028234663852886e22],
1418
- float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
1419
- }, T6 = {
1420
- int64: [BigInt("-9223372036854775808"), BigInt("9223372036854775807")],
1421
- uint64: [BigInt(0), BigInt("18446744073709551615")]
1422
- };
1423
- function BX(J, X) {
1424
- let Y = J._zod.def;
1425
- return y(J, i(J._zod.def, {
1426
- get shape() {
1427
- let q = {};
1428
- for (let H in X) {
1429
- if (!(H in Y.shape)) throw Error(`Unrecognized key: "${H}"`);
1430
- if (!X[H]) continue;
1431
- q[H] = Y.shape[H];
1432
- }
1433
- return n(this, "shape", q), q;
1434
- },
1435
- checks: []
1436
- }));
1437
- }
1438
- function QX(J, X) {
1439
- let Y = J._zod.def;
1440
- return y(J, i(J._zod.def, {
1441
- get shape() {
1442
- let q = { ...J._zod.def.shape };
1443
- for (let H in X) {
1444
- if (!(H in Y.shape)) throw Error(`Unrecognized key: "${H}"`);
1445
- if (!X[H]) continue;
1446
- delete q[H];
1447
- }
1448
- return n(this, "shape", q), q;
1449
- },
1450
- checks: []
1451
- }));
1452
- }
1453
- function zX(J, X) {
1454
- if (!t(X)) throw Error("Invalid input to extend: expected a plain object");
1455
- let Y = J._zod.def.checks;
1456
- if (Y && Y.length > 0) throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
1457
- return y(J, i(J._zod.def, {
1458
- get shape() {
1459
- let H = {
1460
- ...J._zod.def.shape,
1461
- ...X
1462
- };
1463
- return n(this, "shape", H), H;
1464
- },
1465
- checks: []
1466
- }));
1467
- }
1468
- function GX(J, X) {
1469
- if (!t(X)) throw Error("Invalid input to safeExtend: expected a plain object");
1470
- return y(J, {
1471
- ...J._zod.def,
1472
- get shape() {
1473
- let W = {
1474
- ...J._zod.def.shape,
1475
- ...X
1476
- };
1477
- return n(this, "shape", W), W;
1478
- },
1479
- checks: J._zod.def.checks
1480
- });
1481
- }
1482
- function UX(J, X) {
1483
- return y(J, i(J._zod.def, {
1484
- get shape() {
1485
- let W = {
1486
- ...J._zod.def.shape,
1487
- ...X._zod.def.shape
1488
- };
1489
- return n(this, "shape", W), W;
1490
- },
1491
- get catchall() {
1492
- return X._zod.def.catchall;
1493
- },
1494
- checks: []
1495
- }));
1496
- }
1497
- function IX(J, X, Y) {
1498
- return y(X, i(X._zod.def, {
1499
- get shape() {
1500
- let q = X._zod.def.shape, H = { ...q };
1501
- if (Y) for (let B in Y) {
1502
- if (!(B in q)) throw Error(`Unrecognized key: "${B}"`);
1503
- if (!Y[B]) continue;
1504
- H[B] = J ? new J({
1505
- type: "optional",
1506
- innerType: q[B]
1507
- }) : q[B];
1508
- }
1509
- else for (let B in q) H[B] = J ? new J({
1510
- type: "optional",
1511
- innerType: q[B]
1512
- }) : q[B];
1513
- return n(this, "shape", H), H;
1514
- },
1515
- checks: []
1516
- }));
1517
- }
1518
- function wX(J, X, Y) {
1519
- return y(X, i(X._zod.def, {
1520
- get shape() {
1521
- let q = X._zod.def.shape, H = { ...q };
1522
- if (Y) for (let B in Y) {
1523
- if (!(B in H)) throw Error(`Unrecognized key: "${B}"`);
1524
- if (!Y[B]) continue;
1525
- H[B] = new J({
1526
- type: "nonoptional",
1527
- innerType: q[B]
1528
- });
1529
- }
1530
- else for (let B in q) H[B] = new J({
1531
- type: "nonoptional",
1532
- innerType: q[B]
1533
- });
1534
- return n(this, "shape", H), H;
1535
- },
1536
- checks: []
1537
- }));
1538
- }
1539
- function a(J, X = 0) {
1540
- if (J.aborted === !0) return !0;
1541
- for (let Y = X; Y < J.issues.length; Y++) if (J.issues[Y]?.continue !== !0) return !0;
1542
- return !1;
1543
- }
1544
- function l(J, X) {
1545
- return X.map((Y) => {
1546
- var W;
1547
- return (W = Y).path ?? (W.path = []), Y.path.unshift(J), Y;
1548
- });
1549
- }
1550
- function M0(J) {
1551
- return typeof J === "string" ? J : J?.message;
1552
- }
1553
- function m(J, X, Y) {
1554
- let W = {
1555
- ...J,
1556
- path: J.path ?? []
1557
- };
1558
- if (!J.message) W.message = M0(J.inst?._zod.def?.error?.(J)) ?? M0(X?.error?.(J)) ?? M0(Y.customError?.(J)) ?? M0(Y.localeError?.(J)) ?? "Invalid input";
1559
- if (delete W.inst, delete W.continue, !X?.reportInput) delete W.input;
1560
- return W;
1561
- }
1562
- function j6(J) {
1563
- if (J instanceof Set) return "set";
1564
- if (J instanceof Map) return "map";
1565
- if (J instanceof File) return "file";
1566
- return "unknown";
1567
- }
1568
- function K0(J) {
1569
- if (Array.isArray(J)) return "array";
1570
- if (typeof J === "string") return "string";
1571
- return "unknown";
1572
- }
1573
- function B0(...J) {
1574
- let [X, Y, W] = J;
1575
- if (typeof X === "string") return {
1576
- message: X,
1577
- code: "custom",
1578
- input: Y,
1579
- inst: W
1580
- };
1581
- return { ...X };
1582
- }
1583
- function DX(J) {
1584
- return Object.entries(J).filter(([X, Y]) => {
1585
- return Number.isNaN(Number.parseInt(X, 10));
1586
- }).map((X) => X[1]);
1587
- }
1588
- function h6(J) {
1589
- let X = atob(J), Y = new Uint8Array(X.length);
1590
- for (let W = 0; W < X.length; W++) Y[W] = X.charCodeAt(W);
1591
- return Y;
1592
- }
1593
- function x6(J) {
1594
- let X = "";
1595
- for (let Y = 0; Y < J.length; Y++) X += String.fromCharCode(J[Y]);
1596
- return btoa(X);
1597
- }
1598
- function PX(J) {
1599
- let X = J.replace(/-/g, "+").replace(/_/g, "/");
1600
- return h6(X + "=".repeat((4 - X.length % 4) % 4));
1601
- }
1602
- function OX(J) {
1603
- return x6(J).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
1604
- }
1605
- function MX(J) {
1606
- let X = J.replace(/^0x/, "");
1607
- if (X.length % 2 !== 0) throw Error("Invalid hex string length");
1608
- let Y = new Uint8Array(X.length / 2);
1609
- for (let W = 0; W < X.length; W += 2) Y[W / 2] = Number.parseInt(X.slice(W, W + 2), 16);
1610
- return Y;
1611
- }
1612
- function AX(J) {
1613
- return Array.from(J).map((X) => X.toString(16).padStart(2, "0")).join("");
1614
- }
1615
- var v6 = class {
1616
- constructor(...J) {}
1617
- };
1618
- var g6 = (J, X) => {
1619
- J.name = "$ZodError", Object.defineProperty(J, "_zod", {
1620
- value: J._zod,
1621
- enumerable: !1
1622
- }), Object.defineProperty(J, "issues", {
1623
- value: X,
1624
- enumerable: !1
1625
- }), J.message = JSON.stringify(X, H0, 2), Object.defineProperty(J, "toString", {
1626
- value: () => J.message,
1627
- enumerable: !1
1628
- });
1629
- }, o0 = U("$ZodError", g6), F4 = U("$ZodError", g6, { Parent: Error });
1630
- function u6(J, X = (Y$1) => Y$1.message) {
1631
- let Y = {}, W = [];
1632
- for (let q of J.issues) if (q.path.length > 0) Y[q.path[0]] = Y[q.path[0]] || [], Y[q.path[0]].push(X(q));
1633
- else W.push(X(q));
1634
- return {
1635
- formErrors: W,
1636
- fieldErrors: Y
1637
- };
1638
- }
1639
- function c6(J, X = (Y$1) => Y$1.message) {
1640
- let Y = { _errors: [] }, W = (q) => {
1641
- for (let H of q.issues) if (H.code === "invalid_union" && H.errors.length) H.errors.map((B) => W({ issues: B }));
1642
- else if (H.code === "invalid_key") W({ issues: H.issues });
1643
- else if (H.code === "invalid_element") W({ issues: H.issues });
1644
- else if (H.path.length === 0) Y._errors.push(X(H));
1645
- else {
1646
- let B = Y, Q = 0;
1647
- while (Q < H.path.length) {
1648
- let G = H.path[Q];
1649
- if (Q !== H.path.length - 1) B[G] = B[G] || { _errors: [] };
1650
- else B[G] = B[G] || { _errors: [] }, B[G]._errors.push(X(H));
1651
- B = B[G], Q++;
1652
- }
1653
- }
1654
- };
1655
- return W(J), Y;
1656
- }
1657
- var r0 = (J) => (X, Y, W, q) => {
1658
- let H = W ? Object.assign(W, { async: !1 }) : { async: !1 }, B = X._zod.run({
1659
- value: Y,
1660
- issues: []
1661
- }, H);
1662
- if (B instanceof Promise) throw new r();
1663
- if (B.issues.length) {
1664
- let Q = new (q?.Err ?? J)(B.issues.map((G) => m(G, H, v())));
1665
- throw m0(Q, q?.callee), Q;
1666
- }
1667
- return B.value;
1668
- };
1669
- var l0 = (J) => async (X, Y, W, q) => {
1670
- let H = W ? Object.assign(W, { async: !0 }) : { async: !0 }, B = X._zod.run({
1671
- value: Y,
1672
- issues: []
1673
- }, H);
1674
- if (B instanceof Promise) B = await B;
1675
- if (B.issues.length) {
1676
- let Q = new (q?.Err ?? J)(B.issues.map((G) => m(G, H, v())));
1677
- throw m0(Q, q?.callee), Q;
1678
- }
1679
- return B.value;
1680
- };
1681
- var V0 = (J) => (X, Y, W) => {
1682
- let q = W ? {
1683
- ...W,
1684
- async: !1
1685
- } : { async: !1 }, H = X._zod.run({
1686
- value: Y,
1687
- issues: []
1688
- }, q);
1689
- if (H instanceof Promise) throw new r();
1690
- return H.issues.length ? {
1691
- success: !1,
1692
- error: new (J ?? o0)(H.issues.map((B) => m(B, q, v())))
1693
- } : {
1694
- success: !0,
1695
- data: H.value
1696
- };
1697
- }, y6 = V0(F4), R0 = (J) => async (X, Y, W) => {
1698
- let q = W ? Object.assign(W, { async: !0 }) : { async: !0 }, H = X._zod.run({
1699
- value: Y,
1700
- issues: []
1701
- }, q);
1702
- if (H instanceof Promise) H = await H;
1703
- return H.issues.length ? {
1704
- success: !1,
1705
- error: new J(H.issues.map((B) => m(B, q, v())))
1706
- } : {
1707
- success: !0,
1708
- data: H.value
1709
- };
1710
- }, m6 = R0(F4), f6 = (J) => (X, Y, W) => {
1711
- let q = W ? Object.assign(W, { direction: "backward" }) : { direction: "backward" };
1712
- return r0(J)(X, Y, q);
1713
- };
1714
- var o6 = (J) => (X, Y, W) => {
1715
- return r0(J)(X, Y, W);
1716
- };
1717
- var r6 = (J) => async (X, Y, W) => {
1718
- let q = W ? Object.assign(W, { direction: "backward" }) : { direction: "backward" };
1719
- return l0(J)(X, Y, q);
1720
- };
1721
- var l6 = (J) => async (X, Y, W) => {
1722
- return l0(J)(X, Y, W);
1723
- };
1724
- var p6 = (J) => (X, Y, W) => {
1725
- let q = W ? Object.assign(W, { direction: "backward" }) : { direction: "backward" };
1726
- return V0(J)(X, Y, q);
1727
- };
1728
- var d6 = (J) => (X, Y, W) => {
1729
- return V0(J)(X, Y, W);
1730
- };
1731
- var n6 = (J) => async (X, Y, W) => {
1732
- let q = W ? Object.assign(W, { direction: "backward" }) : { direction: "backward" };
1733
- return R0(J)(X, Y, q);
1734
- };
1735
- var i6 = (J) => async (X, Y, W) => {
1736
- return R0(J)(X, Y, W);
1737
- };
1738
- var t6 = /^[cC][^\s-]{8,}$/, a6 = /^[0-9a-z]+$/, s6 = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, e6 = /^[0-9a-vA-V]{20}$/, J1 = /^[A-Za-z0-9]{27}$/, X1 = /^[a-zA-Z0-9_-]{21}$/, Y1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
1739
- var W1 = /^([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})$/, E4 = (J) => {
1740
- if (!J) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
1741
- return /* @__PURE__ */ new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${J}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
1742
- };
1743
- var q1 = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1744
- var EX = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1745
- function H1() {
1746
- return new RegExp(EX, "u");
1747
- }
1748
- var B1 = /^(?:(?: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])$/, Q1 = /^(([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}|:))$/;
1749
- var z1 = /^((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])$/, G1 = /^(([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])$/, U1 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, $4 = /^[A-Za-z0-9_-]*$/;
1750
- var I1 = /^\+(?:[0-9]){6,14}[0-9]$/, w1 = "(?:(?:\\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])))", D1 = /* @__PURE__ */ new RegExp(`^${w1}$`);
1751
- function P1(J) {
1752
- return typeof J.precision === "number" ? J.precision === -1 ? "(?:[01]\\d|2[0-3]):[0-5]\\d" : J.precision === 0 ? "(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d" : `(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${J.precision}}` : "(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?";
1753
- }
1754
- function O1(J) {
1755
- return /* @__PURE__ */ new RegExp(`^${P1(J)}$`);
1756
- }
1757
- function M1(J) {
1758
- let X = P1({ precision: J.precision }), Y = ["Z"];
1759
- if (J.local) Y.push("");
1760
- if (J.offset) Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
1761
- let W = `${X}(?:${Y.join("|")})`;
1762
- return /* @__PURE__ */ new RegExp(`^${w1}T(?:${W})$`);
1763
- }
1764
- var A1 = (J) => {
1765
- let X = J ? `[\\s\\S]{${J?.minimum ?? 0},${J?.maximum ?? ""}}` : "[\\s\\S]*";
1766
- return /* @__PURE__ */ new RegExp(`^${X}$`);
1767
- }, F1 = /^-?\d+n?$/, E1 = /^-?\d+$/, $1 = /^-?\d+(?:\.\d+)?/, K1 = /^(?:true|false)$/i;
1768
- var V1 = /^[^A-Z]*$/, R1 = /^[^a-z]*$/;
1769
- var T = U("$ZodCheck", (J, X) => {
1770
- var Y;
1771
- J._zod ?? (J._zod = {}), J._zod.def = X, (Y = J._zod).onattach ?? (Y.onattach = []);
1772
- }), N1 = {
1773
- number: "number",
1774
- bigint: "bigint",
1775
- object: "date"
1776
- }, K4 = U("$ZodCheckLessThan", (J, X) => {
1777
- T.init(J, X);
1778
- let Y = N1[typeof X.value];
1779
- J._zod.onattach.push((W) => {
1780
- let q = W._zod.bag, H = (X.inclusive ? q.maximum : q.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
1781
- if (X.value < H) if (X.inclusive) q.maximum = X.value;
1782
- else q.exclusiveMaximum = X.value;
1783
- }), J._zod.check = (W) => {
1784
- if (X.inclusive ? W.value <= X.value : W.value < X.value) return;
1785
- W.issues.push({
1786
- origin: Y,
1787
- code: "too_big",
1788
- maximum: X.value,
1789
- input: W.value,
1790
- inclusive: X.inclusive,
1791
- inst: J,
1792
- continue: !X.abort
1793
- });
1794
- };
1795
- }), V4 = U("$ZodCheckGreaterThan", (J, X) => {
1796
- T.init(J, X);
1797
- let Y = N1[typeof X.value];
1798
- J._zod.onattach.push((W) => {
1799
- let q = W._zod.bag, H = (X.inclusive ? q.minimum : q.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
1800
- if (X.value > H) if (X.inclusive) q.minimum = X.value;
1801
- else q.exclusiveMinimum = X.value;
1802
- }), J._zod.check = (W) => {
1803
- if (X.inclusive ? W.value >= X.value : W.value > X.value) return;
1804
- W.issues.push({
1805
- origin: Y,
1806
- code: "too_small",
1807
- minimum: X.value,
1808
- input: W.value,
1809
- inclusive: X.inclusive,
1810
- inst: J,
1811
- continue: !X.abort
1812
- });
1813
- };
1814
- }), S1 = U("$ZodCheckMultipleOf", (J, X) => {
1815
- T.init(J, X), J._zod.onattach.push((Y) => {
1816
- var W;
1817
- (W = Y._zod.bag).multipleOf ?? (W.multipleOf = X.value);
1818
- }), J._zod.check = (Y) => {
1819
- if (typeof Y.value !== typeof X.value) throw Error("Cannot mix number and bigint in multiple_of check.");
1820
- if (typeof Y.value === "bigint" ? Y.value % X.value === BigInt(0) : w4(Y.value, X.value) === 0) return;
1821
- Y.issues.push({
1822
- origin: typeof Y.value,
1823
- code: "not_multiple_of",
1824
- divisor: X.value,
1825
- input: Y.value,
1826
- inst: J,
1827
- continue: !X.abort
1828
- });
1829
- };
1830
- }), L1 = U("$ZodCheckNumberFormat", (J, X) => {
1831
- T.init(J, X), X.format = X.format || "float64";
1832
- let Y = X.format?.includes("int"), W = Y ? "int" : "number", [q, H] = A4[X.format];
1833
- J._zod.onattach.push((B) => {
1834
- let Q = B._zod.bag;
1835
- if (Q.format = X.format, Q.minimum = q, Q.maximum = H, Y) Q.pattern = E1;
1836
- }), J._zod.check = (B) => {
1837
- let Q = B.value;
1838
- if (Y) {
1839
- if (!Number.isInteger(Q)) {
1840
- B.issues.push({
1841
- expected: W,
1842
- format: X.format,
1843
- code: "invalid_type",
1844
- continue: !1,
1845
- input: Q,
1846
- inst: J
1847
- });
1848
- return;
1849
- }
1850
- if (!Number.isSafeInteger(Q)) {
1851
- if (Q > 0) B.issues.push({
1852
- input: Q,
1853
- code: "too_big",
1854
- maximum: Number.MAX_SAFE_INTEGER,
1855
- note: "Integers must be within the safe integer range.",
1856
- inst: J,
1857
- origin: W,
1858
- continue: !X.abort
1859
- });
1860
- else B.issues.push({
1861
- input: Q,
1862
- code: "too_small",
1863
- minimum: Number.MIN_SAFE_INTEGER,
1864
- note: "Integers must be within the safe integer range.",
1865
- inst: J,
1866
- origin: W,
1867
- continue: !X.abort
1868
- });
1869
- return;
1870
- }
1871
- }
1872
- if (Q < q) B.issues.push({
1873
- origin: "number",
1874
- input: Q,
1875
- code: "too_small",
1876
- minimum: q,
1877
- inclusive: !0,
1878
- inst: J,
1879
- continue: !X.abort
1880
- });
1881
- if (Q > H) B.issues.push({
1882
- origin: "number",
1883
- input: Q,
1884
- code: "too_big",
1885
- maximum: H,
1886
- inst: J
1887
- });
1888
- };
1889
- });
1890
- var Z1 = U("$ZodCheckMaxLength", (J, X) => {
1891
- var Y;
1892
- T.init(J, X), (Y = J._zod.def).when ?? (Y.when = (W) => {
1893
- let q = W.value;
1894
- return !E0(q) && q.length !== void 0;
1895
- }), J._zod.onattach.push((W) => {
1896
- let q = W._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1897
- if (X.maximum < q) W._zod.bag.maximum = X.maximum;
1898
- }), J._zod.check = (W) => {
1899
- let q = W.value;
1900
- if (q.length <= X.maximum) return;
1901
- let B = K0(q);
1902
- W.issues.push({
1903
- origin: B,
1904
- code: "too_big",
1905
- maximum: X.maximum,
1906
- inclusive: !0,
1907
- input: q,
1908
- inst: J,
1909
- continue: !X.abort
1910
- });
1911
- };
1912
- }), _1 = U("$ZodCheckMinLength", (J, X) => {
1913
- var Y;
1914
- T.init(J, X), (Y = J._zod.def).when ?? (Y.when = (W) => {
1915
- let q = W.value;
1916
- return !E0(q) && q.length !== void 0;
1917
- }), J._zod.onattach.push((W) => {
1918
- let q = W._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1919
- if (X.minimum > q) W._zod.bag.minimum = X.minimum;
1920
- }), J._zod.check = (W) => {
1921
- let q = W.value;
1922
- if (q.length >= X.minimum) return;
1923
- let B = K0(q);
1924
- W.issues.push({
1925
- origin: B,
1926
- code: "too_small",
1927
- minimum: X.minimum,
1928
- inclusive: !0,
1929
- input: q,
1930
- inst: J,
1931
- continue: !X.abort
1932
- });
1933
- };
1934
- }), b1 = U("$ZodCheckLengthEquals", (J, X) => {
1935
- var Y;
1936
- T.init(J, X), (Y = J._zod.def).when ?? (Y.when = (W) => {
1937
- let q = W.value;
1938
- return !E0(q) && q.length !== void 0;
1939
- }), J._zod.onattach.push((W) => {
1940
- let q = W._zod.bag;
1941
- q.minimum = X.length, q.maximum = X.length, q.length = X.length;
1942
- }), J._zod.check = (W) => {
1943
- let q = W.value, H = q.length;
1944
- if (H === X.length) return;
1945
- let B = K0(q), Q = H > X.length;
1946
- W.issues.push({
1947
- origin: B,
1948
- ...Q ? {
1949
- code: "too_big",
1950
- maximum: X.length
1951
- } : {
1952
- code: "too_small",
1953
- minimum: X.length
1954
- },
1955
- inclusive: !0,
1956
- exact: !0,
1957
- input: W.value,
1958
- inst: J,
1959
- continue: !X.abort
1960
- });
1961
- };
1962
- }), N0 = U("$ZodCheckStringFormat", (J, X) => {
1963
- var Y, W;
1964
- if (T.init(J, X), J._zod.onattach.push((q) => {
1965
- let H = q._zod.bag;
1966
- if (H.format = X.format, X.pattern) H.patterns ?? (H.patterns = /* @__PURE__ */ new Set()), H.patterns.add(X.pattern);
1967
- }), X.pattern) (Y = J._zod).check ?? (Y.check = (q) => {
1968
- if (X.pattern.lastIndex = 0, X.pattern.test(q.value)) return;
1969
- q.issues.push({
1970
- origin: "string",
1971
- code: "invalid_format",
1972
- format: X.format,
1973
- input: q.value,
1974
- ...X.pattern ? { pattern: X.pattern.toString() } : {},
1975
- inst: J,
1976
- continue: !X.abort
1977
- });
1978
- });
1979
- else (W = J._zod).check ?? (W.check = () => {});
1980
- }), C1 = U("$ZodCheckRegex", (J, X) => {
1981
- N0.init(J, X), J._zod.check = (Y) => {
1982
- if (X.pattern.lastIndex = 0, X.pattern.test(Y.value)) return;
1983
- Y.issues.push({
1984
- origin: "string",
1985
- code: "invalid_format",
1986
- format: "regex",
1987
- input: Y.value,
1988
- pattern: X.pattern.toString(),
1989
- inst: J,
1990
- continue: !X.abort
1991
- });
1992
- };
1993
- }), k1 = U("$ZodCheckLowerCase", (J, X) => {
1994
- X.pattern ?? (X.pattern = V1), N0.init(J, X);
1995
- }), T1 = U("$ZodCheckUpperCase", (J, X) => {
1996
- X.pattern ?? (X.pattern = R1), N0.init(J, X);
1997
- }), j1 = U("$ZodCheckIncludes", (J, X) => {
1998
- T.init(J, X);
1999
- let Y = J0(X.includes), W = new RegExp(typeof X.position === "number" ? `^.{${X.position}}${Y}` : Y);
2000
- X.pattern = W, J._zod.onattach.push((q) => {
2001
- let H = q._zod.bag;
2002
- H.patterns ?? (H.patterns = /* @__PURE__ */ new Set()), H.patterns.add(W);
2003
- }), J._zod.check = (q) => {
2004
- if (q.value.includes(X.includes, X.position)) return;
2005
- q.issues.push({
2006
- origin: "string",
2007
- code: "invalid_format",
2008
- format: "includes",
2009
- includes: X.includes,
2010
- input: q.value,
2011
- inst: J,
2012
- continue: !X.abort
2013
- });
2014
- };
2015
- }), h1 = U("$ZodCheckStartsWith", (J, X) => {
2016
- T.init(J, X);
2017
- let Y = /* @__PURE__ */ new RegExp(`^${J0(X.prefix)}.*`);
2018
- X.pattern ?? (X.pattern = Y), J._zod.onattach.push((W) => {
2019
- let q = W._zod.bag;
2020
- q.patterns ?? (q.patterns = /* @__PURE__ */ new Set()), q.patterns.add(Y);
2021
- }), J._zod.check = (W) => {
2022
- if (W.value.startsWith(X.prefix)) return;
2023
- W.issues.push({
2024
- origin: "string",
2025
- code: "invalid_format",
2026
- format: "starts_with",
2027
- prefix: X.prefix,
2028
- input: W.value,
2029
- inst: J,
2030
- continue: !X.abort
2031
- });
2032
- };
2033
- }), x1 = U("$ZodCheckEndsWith", (J, X) => {
2034
- T.init(J, X);
2035
- let Y = /* @__PURE__ */ new RegExp(`.*${J0(X.suffix)}$`);
2036
- X.pattern ?? (X.pattern = Y), J._zod.onattach.push((W) => {
2037
- let q = W._zod.bag;
2038
- q.patterns ?? (q.patterns = /* @__PURE__ */ new Set()), q.patterns.add(Y);
2039
- }), J._zod.check = (W) => {
2040
- if (W.value.endsWith(X.suffix)) return;
2041
- W.issues.push({
2042
- origin: "string",
2043
- code: "invalid_format",
2044
- format: "ends_with",
2045
- suffix: X.suffix,
2046
- input: W.value,
2047
- inst: J,
2048
- continue: !X.abort
2049
- });
2050
- };
2051
- });
2052
- var v1 = U("$ZodCheckOverwrite", (J, X) => {
2053
- T.init(J, X), J._zod.check = (Y) => {
2054
- Y.value = X.tx(Y.value);
2055
- };
2056
- });
2057
- var R4 = class {
2058
- constructor(J = []) {
2059
- if (this.content = [], this.indent = 0, this) this.args = J;
2060
- }
2061
- indented(J) {
2062
- this.indent += 1, J(this), this.indent -= 1;
2063
- }
2064
- write(J) {
2065
- if (typeof J === "function") {
2066
- J(this, { execution: "sync" }), J(this, { execution: "async" });
2067
- return;
2068
- }
2069
- let Y = J.split(`
2070
- `).filter((H) => H), W = Math.min(...Y.map((H) => H.length - H.trimStart().length)), q = Y.map((H) => H.slice(W)).map((H) => " ".repeat(this.indent * 2) + H);
2071
- for (let H of q) this.content.push(H);
2072
- }
2073
- compile() {
2074
- let J = Function, X = this?.args, W = [...(this?.content ?? [""]).map((q) => ` ${q}`)];
2075
- return new J(...X, W.join(`
2076
- `));
2077
- }
2078
- };
2079
- var u1 = {
2080
- major: 4,
2081
- minor: 2,
2082
- patch: 1
2083
- };
2084
- var $ = U("$ZodType", (J, X) => {
2085
- var Y;
2086
- J ?? (J = {}), J._zod.def = X, J._zod.bag = J._zod.bag || {}, J._zod.version = u1;
2087
- let W = [...J._zod.def.checks ?? []];
2088
- if (J._zod.traits.has("$ZodCheck")) W.unshift(J);
2089
- for (let q of W) for (let H of q._zod.onattach) H(J);
2090
- if (W.length === 0) (Y = J._zod).deferred ?? (Y.deferred = []), J._zod.deferred?.push(() => {
2091
- J._zod.run = J._zod.parse;
2092
- });
2093
- else {
2094
- let q = (B, Q, G) => {
2095
- let z = a(B), I;
2096
- for (let w of Q) {
2097
- if (w._zod.def.when) {
2098
- if (!w._zod.def.when(B)) continue;
2099
- } else if (z) continue;
2100
- let M = B.issues.length, P = w._zod.check(B);
2101
- if (P instanceof Promise && G?.async === !1) throw new r();
2102
- if (I || P instanceof Promise) I = (I ?? Promise.resolve()).then(async () => {
2103
- if (await P, B.issues.length === M) return;
2104
- if (!z) z = a(B, M);
2105
- });
2106
- else {
2107
- if (B.issues.length === M) continue;
2108
- if (!z) z = a(B, M);
2109
- }
2110
- }
2111
- if (I) return I.then(() => {
2112
- return B;
2113
- });
2114
- return B;
2115
- }, H = (B, Q, G) => {
2116
- if (a(B)) return B.aborted = !0, B;
2117
- let z = q(Q, W, G);
2118
- if (z instanceof Promise) {
2119
- if (G.async === !1) throw new r();
2120
- return z.then((I) => J._zod.parse(I, G));
2121
- }
2122
- return J._zod.parse(z, G);
2123
- };
2124
- J._zod.run = (B, Q) => {
2125
- if (Q.skipChecks) return J._zod.parse(B, Q);
2126
- if (Q.direction === "backward") {
2127
- let z = J._zod.parse({
2128
- value: B.value,
2129
- issues: []
2130
- }, {
2131
- ...Q,
2132
- skipChecks: !0
2133
- });
2134
- if (z instanceof Promise) return z.then((I) => {
2135
- return H(I, B, Q);
2136
- });
2137
- return H(z, B, Q);
2138
- }
2139
- let G = J._zod.parse(B, Q);
2140
- if (G instanceof Promise) {
2141
- if (Q.async === !1) throw new r();
2142
- return G.then((z) => q(z, W, Q));
2143
- }
2144
- return q(G, W, Q);
2145
- };
2146
- }
2147
- J["~standard"] = {
2148
- validate: (q) => {
2149
- try {
2150
- let H = y6(J, q);
2151
- return H.success ? { value: H.data } : { issues: H.error?.issues };
2152
- } catch (H) {
2153
- return m6(J, q).then((B) => B.success ? { value: B.data } : { issues: B.error?.issues });
2154
- }
2155
- },
2156
- vendor: "zod",
2157
- version: 1
2158
- };
2159
- }), i0 = U("$ZodString", (J, X) => {
2160
- $.init(J, X), J._zod.pattern = [...J?._zod.bag?.patterns ?? []].pop() ?? A1(J._zod.bag), J._zod.parse = (Y, W) => {
2161
- if (X.coerce) try {
2162
- Y.value = String(Y.value);
2163
- } catch (q) {}
2164
- if (typeof Y.value === "string") return Y;
2165
- return Y.issues.push({
2166
- expected: "string",
2167
- code: "invalid_type",
2168
- input: Y.value,
2169
- inst: J
2170
- }), Y;
2171
- };
2172
- }), V = U("$ZodStringFormat", (J, X) => {
2173
- N0.init(J, X), i0.init(J, X);
2174
- }), d1 = U("$ZodGUID", (J, X) => {
2175
- X.pattern ?? (X.pattern = W1), V.init(J, X);
2176
- }), n1 = U("$ZodUUID", (J, X) => {
2177
- if (X.version) {
2178
- let W = {
2179
- v1: 1,
2180
- v2: 2,
2181
- v3: 3,
2182
- v4: 4,
2183
- v5: 5,
2184
- v6: 6,
2185
- v7: 7,
2186
- v8: 8
2187
- }[X.version];
2188
- if (W === void 0) throw Error(`Invalid UUID version: "${X.version}"`);
2189
- X.pattern ?? (X.pattern = E4(W));
2190
- } else X.pattern ?? (X.pattern = E4());
2191
- V.init(J, X);
2192
- }), i1 = U("$ZodEmail", (J, X) => {
2193
- X.pattern ?? (X.pattern = q1), V.init(J, X);
2194
- }), t1 = U("$ZodURL", (J, X) => {
2195
- V.init(J, X), J._zod.check = (Y) => {
2196
- try {
2197
- let W = Y.value.trim(), q = new URL(W);
2198
- if (X.hostname) {
2199
- if (X.hostname.lastIndex = 0, !X.hostname.test(q.hostname)) Y.issues.push({
2200
- code: "invalid_format",
2201
- format: "url",
2202
- note: "Invalid hostname",
2203
- pattern: X.hostname.source,
2204
- input: Y.value,
2205
- inst: J,
2206
- continue: !X.abort
2207
- });
2208
- }
2209
- if (X.protocol) {
2210
- if (X.protocol.lastIndex = 0, !X.protocol.test(q.protocol.endsWith(":") ? q.protocol.slice(0, -1) : q.protocol)) Y.issues.push({
2211
- code: "invalid_format",
2212
- format: "url",
2213
- note: "Invalid protocol",
2214
- pattern: X.protocol.source,
2215
- input: Y.value,
2216
- inst: J,
2217
- continue: !X.abort
2218
- });
2219
- }
2220
- if (X.normalize) Y.value = q.href;
2221
- else Y.value = W;
2222
- return;
2223
- } catch (W) {
2224
- Y.issues.push({
2225
- code: "invalid_format",
2226
- format: "url",
2227
- input: Y.value,
2228
- inst: J,
2229
- continue: !X.abort
2230
- });
2231
- }
2232
- };
2233
- }), a1 = U("$ZodEmoji", (J, X) => {
2234
- X.pattern ?? (X.pattern = H1()), V.init(J, X);
2235
- }), s1 = U("$ZodNanoID", (J, X) => {
2236
- X.pattern ?? (X.pattern = X1), V.init(J, X);
2237
- }), e1 = U("$ZodCUID", (J, X) => {
2238
- X.pattern ?? (X.pattern = t6), V.init(J, X);
2239
- }), JJ = U("$ZodCUID2", (J, X) => {
2240
- X.pattern ?? (X.pattern = a6), V.init(J, X);
2241
- }), XJ = U("$ZodULID", (J, X) => {
2242
- X.pattern ?? (X.pattern = s6), V.init(J, X);
2243
- }), YJ = U("$ZodXID", (J, X) => {
2244
- X.pattern ?? (X.pattern = e6), V.init(J, X);
2245
- }), WJ = U("$ZodKSUID", (J, X) => {
2246
- X.pattern ?? (X.pattern = J1), V.init(J, X);
2247
- }), qJ = U("$ZodISODateTime", (J, X) => {
2248
- X.pattern ?? (X.pattern = M1(X)), V.init(J, X);
2249
- }), HJ = U("$ZodISODate", (J, X) => {
2250
- X.pattern ?? (X.pattern = D1), V.init(J, X);
2251
- }), BJ = U("$ZodISOTime", (J, X) => {
2252
- X.pattern ?? (X.pattern = O1(X)), V.init(J, X);
2253
- }), QJ = U("$ZodISODuration", (J, X) => {
2254
- X.pattern ?? (X.pattern = Y1), V.init(J, X);
2255
- }), zJ = U("$ZodIPv4", (J, X) => {
2256
- X.pattern ?? (X.pattern = B1), V.init(J, X), J._zod.bag.format = "ipv4";
2257
- }), GJ = U("$ZodIPv6", (J, X) => {
2258
- X.pattern ?? (X.pattern = Q1), V.init(J, X), J._zod.bag.format = "ipv6", J._zod.check = (Y) => {
2259
- try {
2260
- new URL(`http://[${Y.value}]`);
2261
- } catch {
2262
- Y.issues.push({
2263
- code: "invalid_format",
2264
- format: "ipv6",
2265
- input: Y.value,
2266
- inst: J,
2267
- continue: !X.abort
2268
- });
2269
- }
2270
- };
2271
- });
2272
- var UJ = U("$ZodCIDRv4", (J, X) => {
2273
- X.pattern ?? (X.pattern = z1), V.init(J, X);
2274
- }), IJ = U("$ZodCIDRv6", (J, X) => {
2275
- X.pattern ?? (X.pattern = G1), V.init(J, X), J._zod.check = (Y) => {
2276
- let W = Y.value.split("/");
2277
- try {
2278
- if (W.length !== 2) throw Error();
2279
- let [q, H] = W;
2280
- if (!H) throw Error();
2281
- let B = Number(H);
2282
- if (`${B}` !== H) throw Error();
2283
- if (B < 0 || B > 128) throw Error();
2284
- new URL(`http://[${q}]`);
2285
- } catch {
2286
- Y.issues.push({
2287
- code: "invalid_format",
2288
- format: "cidrv6",
2289
- input: Y.value,
2290
- inst: J,
2291
- continue: !X.abort
2292
- });
2293
- }
2294
- };
2295
- });
2296
- function wJ(J) {
2297
- if (J === "") return !0;
2298
- if (J.length % 4 !== 0) return !1;
2299
- try {
2300
- return atob(J), !0;
2301
- } catch {
2302
- return !1;
2303
- }
2304
- }
2305
- var DJ = U("$ZodBase64", (J, X) => {
2306
- X.pattern ?? (X.pattern = U1), V.init(J, X), J._zod.bag.contentEncoding = "base64", J._zod.check = (Y) => {
2307
- if (wJ(Y.value)) return;
2308
- Y.issues.push({
2309
- code: "invalid_format",
2310
- format: "base64",
2311
- input: Y.value,
2312
- inst: J,
2313
- continue: !X.abort
2314
- });
2315
- };
2316
- });
2317
- function $X(J) {
2318
- if (!$4.test(J)) return !1;
2319
- let X = J.replace(/[-_]/g, (W) => W === "-" ? "+" : "/");
2320
- return wJ(X.padEnd(Math.ceil(X.length / 4) * 4, "="));
2321
- }
2322
- var PJ = U("$ZodBase64URL", (J, X) => {
2323
- X.pattern ?? (X.pattern = $4), V.init(J, X), J._zod.bag.contentEncoding = "base64url", J._zod.check = (Y) => {
2324
- if ($X(Y.value)) return;
2325
- Y.issues.push({
2326
- code: "invalid_format",
2327
- format: "base64url",
2328
- input: Y.value,
2329
- inst: J,
2330
- continue: !X.abort
2331
- });
2332
- };
2333
- }), OJ = U("$ZodE164", (J, X) => {
2334
- X.pattern ?? (X.pattern = I1), V.init(J, X);
2335
- });
2336
- function KX(J, X = null) {
2337
- try {
2338
- let Y = J.split(".");
2339
- if (Y.length !== 3) return !1;
2340
- let [W] = Y;
2341
- if (!W) return !1;
2342
- let q = JSON.parse(atob(W));
2343
- if ("typ" in q && q?.typ !== "JWT") return !1;
2344
- if (!q.alg) return !1;
2345
- if (X && (!("alg" in q) || q.alg !== X)) return !1;
2346
- return !0;
2347
- } catch {
2348
- return !1;
2349
- }
2350
- }
2351
- var MJ = U("$ZodJWT", (J, X) => {
2352
- V.init(J, X), J._zod.check = (Y) => {
2353
- if (KX(Y.value, X.alg)) return;
2354
- Y.issues.push({
2355
- code: "invalid_format",
2356
- format: "jwt",
2357
- input: Y.value,
2358
- inst: J,
2359
- continue: !X.abort
2360
- });
2361
- };
2362
- });
2363
- var S4 = U("$ZodNumber", (J, X) => {
2364
- $.init(J, X), J._zod.pattern = J._zod.bag.pattern ?? $1, J._zod.parse = (Y, W) => {
2365
- if (X.coerce) try {
2366
- Y.value = Number(Y.value);
2367
- } catch (B) {}
2368
- let q = Y.value;
2369
- if (typeof q === "number" && !Number.isNaN(q) && Number.isFinite(q)) return Y;
2370
- let H = typeof q === "number" ? Number.isNaN(q) ? "NaN" : !Number.isFinite(q) ? "Infinity" : void 0 : void 0;
2371
- return Y.issues.push({
2372
- expected: "number",
2373
- code: "invalid_type",
2374
- input: q,
2375
- inst: J,
2376
- ...H ? { received: H } : {}
2377
- }), Y;
2378
- };
2379
- }), AJ = U("$ZodNumberFormat", (J, X) => {
2380
- L1.init(J, X), S4.init(J, X);
2381
- }), FJ = U("$ZodBoolean", (J, X) => {
2382
- $.init(J, X), J._zod.pattern = K1, J._zod.parse = (Y, W) => {
2383
- if (X.coerce) try {
2384
- Y.value = Boolean(Y.value);
2385
- } catch (H) {}
2386
- let q = Y.value;
2387
- if (typeof q === "boolean") return Y;
2388
- return Y.issues.push({
2389
- expected: "boolean",
2390
- code: "invalid_type",
2391
- input: q,
2392
- inst: J
2393
- }), Y;
2394
- };
2395
- }), EJ = U("$ZodBigInt", (J, X) => {
2396
- $.init(J, X), J._zod.pattern = F1, J._zod.parse = (Y, W) => {
2397
- if (X.coerce) try {
2398
- Y.value = BigInt(Y.value);
2399
- } catch (q) {}
2400
- if (typeof Y.value === "bigint") return Y;
2401
- return Y.issues.push({
2402
- expected: "bigint",
2403
- code: "invalid_type",
2404
- input: Y.value,
2405
- inst: J
2406
- }), Y;
2407
- };
2408
- });
2409
- var $J = U("$ZodAny", (J, X) => {
2410
- $.init(J, X), J._zod.parse = (Y) => Y;
2411
- }), KJ = U("$ZodUnknown", (J, X) => {
2412
- $.init(J, X), J._zod.parse = (Y) => Y;
2413
- }), VJ = U("$ZodNever", (J, X) => {
2414
- $.init(J, X), J._zod.parse = (Y, W) => {
2415
- return Y.issues.push({
2416
- expected: "never",
2417
- code: "invalid_type",
2418
- input: Y.value,
2419
- inst: J
2420
- }), Y;
2421
- };
2422
- });
2423
- var RJ = U("$ZodDate", (J, X) => {
2424
- $.init(J, X), J._zod.parse = (Y, W) => {
2425
- if (X.coerce) try {
2426
- Y.value = new Date(Y.value);
2427
- } catch (Q) {}
2428
- let q = Y.value, H = q instanceof Date;
2429
- if (H && !Number.isNaN(q.getTime())) return Y;
2430
- return Y.issues.push({
2431
- expected: "date",
2432
- code: "invalid_type",
2433
- input: q,
2434
- ...H ? { received: "Invalid Date" } : {},
2435
- inst: J
2436
- }), Y;
2437
- };
2438
- });
2439
- function c1(J, X, Y) {
2440
- if (J.issues.length) X.issues.push(...l(Y, J.issues));
2441
- X.value[Y] = J.value;
2442
- }
2443
- var NJ = U("$ZodArray", (J, X) => {
2444
- $.init(J, X), J._zod.parse = (Y, W) => {
2445
- let q = Y.value;
2446
- if (!Array.isArray(q)) return Y.issues.push({
2447
- expected: "array",
2448
- code: "invalid_type",
2449
- input: q,
2450
- inst: J
2451
- }), Y;
2452
- Y.value = Array(q.length);
2453
- let H = [];
2454
- for (let B = 0; B < q.length; B++) {
2455
- let Q = q[B], G = X.element._zod.run({
2456
- value: Q,
2457
- issues: []
2458
- }, W);
2459
- if (G instanceof Promise) H.push(G.then((z) => c1(z, Y, B)));
2460
- else c1(G, Y, B);
2461
- }
2462
- if (H.length) return Promise.all(H).then(() => Y);
2463
- return Y;
2464
- };
2465
- });
2466
- function n0(J, X, Y, W) {
2467
- if (J.issues.length) X.issues.push(...l(Y, J.issues));
2468
- if (J.value === void 0) {
2469
- if (Y in W) X.value[Y] = void 0;
2470
- } else X.value[Y] = J.value;
2471
- }
2472
- function SJ(J) {
2473
- let X = Object.keys(J.shape);
2474
- for (let W of X) if (!J.shape?.[W]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${W}": expected a Zod schema`);
2475
- let Y = M4(J.shape);
2476
- return {
2477
- ...J,
2478
- keys: X,
2479
- keySet: new Set(X),
2480
- numKeys: X.length,
2481
- optionalKeys: new Set(Y)
2482
- };
2483
- }
2484
- function LJ(J, X, Y, W, q, H) {
2485
- let B = [], Q = q.keySet, G = q.catchall._zod, z = G.def.type;
2486
- for (let I in X) {
2487
- if (Q.has(I)) continue;
2488
- if (z === "never") {
2489
- B.push(I);
2490
- continue;
2491
- }
2492
- let w = G.run({
2493
- value: X[I],
2494
- issues: []
2495
- }, W);
2496
- if (w instanceof Promise) J.push(w.then((M) => n0(M, Y, I, X)));
2497
- else n0(w, Y, I, X);
2498
- }
2499
- if (B.length) Y.issues.push({
2500
- code: "unrecognized_keys",
2501
- keys: B,
2502
- input: X,
2503
- inst: H
2504
- });
2505
- if (!J.length) return Y;
2506
- return Promise.all(J).then(() => {
2507
- return Y;
2508
- });
2509
- }
2510
- var VX = U("$ZodObject", (J, X) => {
2511
- if ($.init(J, X), !Object.getOwnPropertyDescriptor(X, "shape")?.get) {
2512
- let Q = X.shape;
2513
- Object.defineProperty(X, "shape", { get: () => {
2514
- let G = { ...Q };
2515
- return Object.defineProperty(X, "shape", { value: G }), G;
2516
- } });
2517
- }
2518
- let W = F0(() => SJ(X));
2519
- E(J._zod, "propValues", () => {
2520
- let Q = X.shape, G = {};
2521
- for (let z in Q) {
2522
- let I = Q[z]._zod;
2523
- if (I.values) {
2524
- G[z] ?? (G[z] = /* @__PURE__ */ new Set());
2525
- for (let w of I.values) G[z].add(w);
2526
- }
2527
- }
2528
- return G;
2529
- });
2530
- let q = q0, H = X.catchall, B;
2531
- J._zod.parse = (Q, G) => {
2532
- B ?? (B = W.value);
2533
- let z = Q.value;
2534
- if (!q(z)) return Q.issues.push({
2535
- expected: "object",
2536
- code: "invalid_type",
2537
- input: z,
2538
- inst: J
2539
- }), Q;
2540
- Q.value = {};
2541
- let I = [], w = B.shape;
2542
- for (let M of B.keys) {
2543
- let N = w[M]._zod.run({
2544
- value: z[M],
2545
- issues: []
2546
- }, G);
2547
- if (N instanceof Promise) I.push(N.then((_) => n0(_, Q, M, z)));
2548
- else n0(N, Q, M, z);
2549
- }
2550
- if (!H) return I.length ? Promise.all(I).then(() => Q) : Q;
2551
- return LJ(I, z, Q, G, W.value, J);
2552
- };
2553
- }), ZJ = U("$ZodObjectJIT", (J, X) => {
2554
- VX.init(J, X);
2555
- let Y = J._zod.parse, W = F0(() => SJ(X)), q = (M) => {
2556
- let P = new R4([
2557
- "shape",
2558
- "payload",
2559
- "ctx"
2560
- ]), N = W.value, _ = (k) => {
2561
- let C = y0(k);
2562
- return `shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`;
2563
- };
2564
- P.write("const input = payload.value;");
2565
- let d = Object.create(null), g = 0;
2566
- for (let k of N.keys) d[k] = `key_${g++}`;
2567
- P.write("const newResult = {};");
2568
- for (let k of N.keys) {
2569
- let C = d[k], o = y0(k);
2570
- P.write(`const ${C} = ${_(k)};`), P.write(`
2571
- if (${C}.issues.length) {
2572
- payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
2573
- ...iss,
2574
- path: iss.path ? [${o}, ...iss.path] : [${o}]
2575
- })));
2576
- }
2577
-
2578
-
2579
- if (${C}.value === undefined) {
2580
- if (${o} in input) {
2581
- newResult[${o}] = undefined;
2582
- }
2583
- } else {
2584
- newResult[${o}] = ${C}.value;
2585
- }
2586
-
2587
- `);
2588
- }
2589
- P.write("payload.value = newResult;"), P.write("return payload;");
2590
- let Z0 = P.compile();
2591
- return (k, C) => Z0(M, k, C);
2592
- }, H, B = q0, Q = !u0.jitless, z = Q && P4.value, I = X.catchall, w;
2593
- J._zod.parse = (M, P) => {
2594
- w ?? (w = W.value);
2595
- let N = M.value;
2596
- if (!B(N)) return M.issues.push({
2597
- expected: "object",
2598
- code: "invalid_type",
2599
- input: N,
2600
- inst: J
2601
- }), M;
2602
- if (Q && z && P?.async === !1 && P.jitless !== !0) {
2603
- if (!H) H = q(X.shape);
2604
- if (M = H(M, P), !I) return M;
2605
- return LJ([], N, M, P, w, J);
2606
- }
2607
- return Y(M, P);
2608
- };
2609
- });
2610
- function y1(J, X, Y, W) {
2611
- for (let H of J) if (H.issues.length === 0) return X.value = H.value, X;
2612
- let q = J.filter((H) => !a(H));
2613
- if (q.length === 1) return X.value = q[0].value, q[0];
2614
- return X.issues.push({
2615
- code: "invalid_union",
2616
- input: X.value,
2617
- inst: Y,
2618
- errors: J.map((H) => H.issues.map((B) => m(B, W, v())))
2619
- }), X;
2620
- }
2621
- var _J = U("$ZodUnion", (J, X) => {
2622
- $.init(J, X), E(J._zod, "optin", () => X.options.some((q) => q._zod.optin === "optional") ? "optional" : void 0), E(J._zod, "optout", () => X.options.some((q) => q._zod.optout === "optional") ? "optional" : void 0), E(J._zod, "values", () => {
2623
- if (X.options.every((q) => q._zod.values)) return new Set(X.options.flatMap((q) => Array.from(q._zod.values)));
2624
- }), E(J._zod, "pattern", () => {
2625
- if (X.options.every((q) => q._zod.pattern)) {
2626
- let q = X.options.map((H) => H._zod.pattern);
2627
- return /* @__PURE__ */ new RegExp(`^(${q.map((H) => $0(H.source)).join("|")})$`);
2628
- }
2629
- });
2630
- let Y = X.options.length === 1, W = X.options[0]._zod.run;
2631
- J._zod.parse = (q, H) => {
2632
- if (Y) return W(q, H);
2633
- let B = !1, Q = [];
2634
- for (let G of X.options) {
2635
- let z = G._zod.run({
2636
- value: q.value,
2637
- issues: []
2638
- }, H);
2639
- if (z instanceof Promise) Q.push(z), B = !0;
2640
- else {
2641
- if (z.issues.length === 0) return z;
2642
- Q.push(z);
2643
- }
2644
- }
2645
- if (!B) return y1(Q, q, J, H);
2646
- return Promise.all(Q).then((G) => {
2647
- return y1(G, q, J, H);
2648
- });
2649
- };
2650
- });
2651
- var bJ = U("$ZodIntersection", (J, X) => {
2652
- $.init(J, X), J._zod.parse = (Y, W) => {
2653
- let q = Y.value, H = X.left._zod.run({
2654
- value: q,
2655
- issues: []
2656
- }, W), B = X.right._zod.run({
2657
- value: q,
2658
- issues: []
2659
- }, W);
2660
- if (H instanceof Promise || B instanceof Promise) return Promise.all([H, B]).then(([G, z]) => {
2661
- return m1(Y, G, z);
2662
- });
2663
- return m1(Y, H, B);
2664
- };
2665
- });
2666
- function N4(J, X) {
2667
- if (J === X) return {
2668
- valid: !0,
2669
- data: J
2670
- };
2671
- if (J instanceof Date && X instanceof Date && +J === +X) return {
2672
- valid: !0,
2673
- data: J
2674
- };
2675
- if (t(J) && t(X)) {
2676
- let Y = Object.keys(X), W = Object.keys(J).filter((H) => Y.indexOf(H) !== -1), q = {
2677
- ...J,
2678
- ...X
2679
- };
2680
- for (let H of W) {
2681
- let B = N4(J[H], X[H]);
2682
- if (!B.valid) return {
2683
- valid: !1,
2684
- mergeErrorPath: [H, ...B.mergeErrorPath]
2685
- };
2686
- q[H] = B.data;
2687
- }
2688
- return {
2689
- valid: !0,
2690
- data: q
2691
- };
2692
- }
2693
- if (Array.isArray(J) && Array.isArray(X)) {
2694
- if (J.length !== X.length) return {
2695
- valid: !1,
2696
- mergeErrorPath: []
2697
- };
2698
- let Y = [];
2699
- for (let W = 0; W < J.length; W++) {
2700
- let q = J[W], H = X[W], B = N4(q, H);
2701
- if (!B.valid) return {
2702
- valid: !1,
2703
- mergeErrorPath: [W, ...B.mergeErrorPath]
2704
- };
2705
- Y.push(B.data);
2706
- }
2707
- return {
2708
- valid: !0,
2709
- data: Y
2710
- };
2711
- }
2712
- return {
2713
- valid: !1,
2714
- mergeErrorPath: []
2715
- };
2716
- }
2717
- function m1(J, X, Y) {
2718
- if (X.issues.length) J.issues.push(...X.issues);
2719
- if (Y.issues.length) J.issues.push(...Y.issues);
2720
- if (a(J)) return J;
2721
- let W = N4(X.value, Y.value);
2722
- if (!W.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);
2723
- return J.value = W.data, J;
2724
- }
2725
- var CJ = U("$ZodRecord", (J, X) => {
2726
- $.init(J, X), J._zod.parse = (Y, W) => {
2727
- let q = Y.value;
2728
- if (!t(q)) return Y.issues.push({
2729
- expected: "record",
2730
- code: "invalid_type",
2731
- input: q,
2732
- inst: J
2733
- }), Y;
2734
- let H = [], B = X.keyType._zod.values;
2735
- if (B) {
2736
- Y.value = {};
2737
- let Q = /* @__PURE__ */ new Set();
2738
- for (let z of B) if (typeof z === "string" || typeof z === "number" || typeof z === "symbol") {
2739
- Q.add(typeof z === "number" ? z.toString() : z);
2740
- let I = X.valueType._zod.run({
2741
- value: q[z],
2742
- issues: []
2743
- }, W);
2744
- if (I instanceof Promise) H.push(I.then((w) => {
2745
- if (w.issues.length) Y.issues.push(...l(z, w.issues));
2746
- Y.value[z] = w.value;
2747
- }));
2748
- else {
2749
- if (I.issues.length) Y.issues.push(...l(z, I.issues));
2750
- Y.value[z] = I.value;
2751
- }
2752
- }
2753
- let G;
2754
- for (let z in q) if (!Q.has(z)) G = G ?? [], G.push(z);
2755
- if (G && G.length > 0) Y.issues.push({
2756
- code: "unrecognized_keys",
2757
- input: q,
2758
- inst: J,
2759
- keys: G
2760
- });
2761
- } else {
2762
- Y.value = {};
2763
- for (let Q of Reflect.ownKeys(q)) {
2764
- if (Q === "__proto__") continue;
2765
- let G = X.keyType._zod.run({
2766
- value: Q,
2767
- issues: []
2768
- }, W);
2769
- if (G instanceof Promise) throw Error("Async schemas not supported in object keys currently");
2770
- if (G.issues.length) {
2771
- if (X.mode === "loose") Y.value[Q] = q[Q];
2772
- else Y.issues.push({
2773
- code: "invalid_key",
2774
- origin: "record",
2775
- issues: G.issues.map((I) => m(I, W, v())),
2776
- input: Q,
2777
- path: [Q],
2778
- inst: J
2779
- });
2780
- continue;
2781
- }
2782
- let z = X.valueType._zod.run({
2783
- value: q[Q],
2784
- issues: []
2785
- }, W);
2786
- if (z instanceof Promise) H.push(z.then((I) => {
2787
- if (I.issues.length) Y.issues.push(...l(Q, I.issues));
2788
- Y.value[G.value] = I.value;
2789
- }));
2790
- else {
2791
- if (z.issues.length) Y.issues.push(...l(Q, z.issues));
2792
- Y.value[G.value] = z.value;
2793
- }
2794
- }
2795
- }
2796
- if (H.length) return Promise.all(H).then(() => Y);
2797
- return Y;
2798
- };
2799
- });
2800
- var kJ = U("$ZodEnum", (J, X) => {
2801
- $.init(J, X);
2802
- let Y = A0(X.entries), W = new Set(Y);
2803
- J._zod.values = W, J._zod.pattern = /* @__PURE__ */ new RegExp(`^(${Y.filter((q) => O4.has(typeof q)).map((q) => typeof q === "string" ? J0(q) : q.toString()).join("|")})$`), J._zod.parse = (q, H) => {
2804
- let B = q.value;
2805
- if (W.has(B)) return q;
2806
- return q.issues.push({
2807
- code: "invalid_value",
2808
- values: Y,
2809
- input: B,
2810
- inst: J
2811
- }), q;
2812
- };
2813
- });
2814
- var TJ = U("$ZodTransform", (J, X) => {
2815
- $.init(J, X), J._zod.parse = (Y, W) => {
2816
- if (W.direction === "backward") throw new O0(J.constructor.name);
2817
- let q = X.transform(Y.value, Y);
2818
- if (W.async) return (q instanceof Promise ? q : Promise.resolve(q)).then((B) => {
2819
- return Y.value = B, Y;
2820
- });
2821
- if (q instanceof Promise) throw new r();
2822
- return Y.value = q, Y;
2823
- };
2824
- });
2825
- function f1(J, X) {
2826
- if (J.issues.length && X === void 0) return {
2827
- issues: [],
2828
- value: void 0
2829
- };
2830
- return J;
2831
- }
2832
- var jJ = U("$ZodOptional", (J, X) => {
2833
- $.init(J, X), J._zod.optin = "optional", J._zod.optout = "optional", E(J._zod, "values", () => {
2834
- return X.innerType._zod.values ? new Set([...X.innerType._zod.values, void 0]) : void 0;
2835
- }), E(J._zod, "pattern", () => {
2836
- let Y = X.innerType._zod.pattern;
2837
- return Y ? /* @__PURE__ */ new RegExp(`^(${$0(Y.source)})?$`) : void 0;
2838
- }), J._zod.parse = (Y, W) => {
2839
- if (X.innerType._zod.optin === "optional") {
2840
- let q = X.innerType._zod.run(Y, W);
2841
- if (q instanceof Promise) return q.then((H) => f1(H, Y.value));
2842
- return f1(q, Y.value);
2843
- }
2844
- if (Y.value === void 0) return Y;
2845
- return X.innerType._zod.run(Y, W);
2846
- };
2847
- }), hJ = U("$ZodNullable", (J, X) => {
2848
- $.init(J, X), E(J._zod, "optin", () => X.innerType._zod.optin), E(J._zod, "optout", () => X.innerType._zod.optout), E(J._zod, "pattern", () => {
2849
- let Y = X.innerType._zod.pattern;
2850
- return Y ? /* @__PURE__ */ new RegExp(`^(${$0(Y.source)}|null)$`) : void 0;
2851
- }), E(J._zod, "values", () => {
2852
- return X.innerType._zod.values ? new Set([...X.innerType._zod.values, null]) : void 0;
2853
- }), J._zod.parse = (Y, W) => {
2854
- if (Y.value === null) return Y;
2855
- return X.innerType._zod.run(Y, W);
2856
- };
2857
- }), xJ = U("$ZodDefault", (J, X) => {
2858
- $.init(J, X), J._zod.optin = "optional", E(J._zod, "values", () => X.innerType._zod.values), J._zod.parse = (Y, W) => {
2859
- if (W.direction === "backward") return X.innerType._zod.run(Y, W);
2860
- if (Y.value === void 0) return Y.value = X.defaultValue, Y;
2861
- let q = X.innerType._zod.run(Y, W);
2862
- if (q instanceof Promise) return q.then((H) => o1(H, X));
2863
- return o1(q, X);
2864
- };
2865
- });
2866
- function o1(J, X) {
2867
- if (J.value === void 0) J.value = X.defaultValue;
2868
- return J;
2869
- }
2870
- var vJ = U("$ZodPrefault", (J, X) => {
2871
- $.init(J, X), J._zod.optin = "optional", E(J._zod, "values", () => X.innerType._zod.values), J._zod.parse = (Y, W) => {
2872
- if (W.direction === "backward") return X.innerType._zod.run(Y, W);
2873
- if (Y.value === void 0) Y.value = X.defaultValue;
2874
- return X.innerType._zod.run(Y, W);
2875
- };
2876
- }), gJ = U("$ZodNonOptional", (J, X) => {
2877
- $.init(J, X), E(J._zod, "values", () => {
2878
- let Y = X.innerType._zod.values;
2879
- return Y ? new Set([...Y].filter((W) => W !== void 0)) : void 0;
2880
- }), J._zod.parse = (Y, W) => {
2881
- let q = X.innerType._zod.run(Y, W);
2882
- if (q instanceof Promise) return q.then((H) => r1(H, J));
2883
- return r1(q, J);
2884
- };
2885
- });
2886
- function r1(J, X) {
2887
- if (!J.issues.length && J.value === void 0) J.issues.push({
2888
- code: "invalid_type",
2889
- expected: "nonoptional",
2890
- input: J.value,
2891
- inst: X
2892
- });
2893
- return J;
2894
- }
2895
- var uJ = U("$ZodCatch", (J, X) => {
2896
- $.init(J, X), E(J._zod, "optin", () => X.innerType._zod.optin), E(J._zod, "optout", () => X.innerType._zod.optout), E(J._zod, "values", () => X.innerType._zod.values), J._zod.parse = (Y, W) => {
2897
- if (W.direction === "backward") return X.innerType._zod.run(Y, W);
2898
- let q = X.innerType._zod.run(Y, W);
2899
- if (q instanceof Promise) return q.then((H) => {
2900
- if (Y.value = H.value, H.issues.length) Y.value = X.catchValue({
2901
- ...Y,
2902
- error: { issues: H.issues.map((B) => m(B, W, v())) },
2903
- input: Y.value
2904
- }), Y.issues = [];
2905
- return Y;
2906
- });
2907
- if (Y.value = q.value, q.issues.length) Y.value = X.catchValue({
2908
- ...Y,
2909
- error: { issues: q.issues.map((H) => m(H, W, v())) },
2910
- input: Y.value
2911
- }), Y.issues = [];
2912
- return Y;
2913
- };
2914
- });
2915
- var cJ = U("$ZodPipe", (J, X) => {
2916
- $.init(J, X), E(J._zod, "values", () => X.in._zod.values), E(J._zod, "optin", () => X.in._zod.optin), E(J._zod, "optout", () => X.out._zod.optout), E(J._zod, "propValues", () => X.in._zod.propValues), J._zod.parse = (Y, W) => {
2917
- if (W.direction === "backward") {
2918
- let H = X.out._zod.run(Y, W);
2919
- if (H instanceof Promise) return H.then((B) => d0(B, X.in, W));
2920
- return d0(H, X.in, W);
2921
- }
2922
- let q = X.in._zod.run(Y, W);
2923
- if (q instanceof Promise) return q.then((H) => d0(H, X.out, W));
2924
- return d0(q, X.out, W);
2925
- };
2926
- });
2927
- function d0(J, X, Y) {
2928
- if (J.issues.length) return J.aborted = !0, J;
2929
- return X._zod.run({
2930
- value: J.value,
2931
- issues: J.issues
2932
- }, Y);
2933
- }
2934
- var yJ = U("$ZodReadonly", (J, X) => {
2935
- $.init(J, X), E(J._zod, "propValues", () => X.innerType._zod.propValues), E(J._zod, "values", () => X.innerType._zod.values), E(J._zod, "optin", () => X.innerType?._zod?.optin), E(J._zod, "optout", () => X.innerType?._zod?.optout), J._zod.parse = (Y, W) => {
2936
- if (W.direction === "backward") return X.innerType._zod.run(Y, W);
2937
- let q = X.innerType._zod.run(Y, W);
2938
- if (q instanceof Promise) return q.then(l1);
2939
- return l1(q);
2940
- };
2941
- });
2942
- function l1(J) {
2943
- return J.value = Object.freeze(J.value), J;
2944
- }
2945
- var mJ = U("$ZodCustom", (J, X) => {
2946
- T.init(J, X), $.init(J, X), J._zod.parse = (Y, W) => {
2947
- return Y;
2948
- }, J._zod.check = (Y) => {
2949
- let W = Y.value, q = X.fn(W);
2950
- if (q instanceof Promise) return q.then((H) => p1(H, Y, W, J));
2951
- p1(q, Y, W, J);
2952
- };
2953
- });
2954
- function p1(J, X, Y, W) {
2955
- if (!J) {
2956
- let q = {
2957
- code: "custom",
2958
- input: Y,
2959
- inst: W,
2960
- path: [...W._zod.def.path ?? []],
2961
- continue: !W._zod.def.abort
2962
- };
2963
- if (W._zod.def.params) q.params = W._zod.def.params;
2964
- X.issues.push(B0(q));
2965
- }
2966
- }
2967
- var RX = (J) => {
2968
- let X = typeof J;
2969
- switch (X) {
2970
- case "number": return Number.isNaN(J) ? "NaN" : "number";
2971
- case "object":
2972
- if (Array.isArray(J)) return "array";
2973
- if (J === null) return "null";
2974
- if (Object.getPrototypeOf(J) !== Object.prototype && J.constructor) return J.constructor.name;
2975
- }
2976
- return X;
2977
- }, NX = () => {
2978
- let J = {
2979
- string: {
2980
- unit: "characters",
2981
- verb: "to have"
2982
- },
2983
- file: {
2984
- unit: "bytes",
2985
- verb: "to have"
2986
- },
2987
- array: {
2988
- unit: "items",
2989
- verb: "to have"
2990
- },
2991
- set: {
2992
- unit: "items",
2993
- verb: "to have"
2994
- }
2995
- };
2996
- function X(W) {
2997
- return J[W] ?? null;
2998
- }
2999
- let Y = {
3000
- regex: "input",
3001
- email: "email address",
3002
- url: "URL",
3003
- emoji: "emoji",
3004
- uuid: "UUID",
3005
- uuidv4: "UUIDv4",
3006
- uuidv6: "UUIDv6",
3007
- nanoid: "nanoid",
3008
- guid: "GUID",
3009
- cuid: "cuid",
3010
- cuid2: "cuid2",
3011
- ulid: "ULID",
3012
- xid: "XID",
3013
- ksuid: "KSUID",
3014
- datetime: "ISO datetime",
3015
- date: "ISO date",
3016
- time: "ISO time",
3017
- duration: "ISO duration",
3018
- ipv4: "IPv4 address",
3019
- ipv6: "IPv6 address",
3020
- mac: "MAC address",
3021
- cidrv4: "IPv4 range",
3022
- cidrv6: "IPv6 range",
3023
- base64: "base64-encoded string",
3024
- base64url: "base64url-encoded string",
3025
- json_string: "JSON string",
3026
- e164: "E.164 number",
3027
- jwt: "JWT",
3028
- template_literal: "input"
3029
- };
3030
- return (W) => {
3031
- switch (W.code) {
3032
- case "invalid_type": return `Invalid input: expected ${W.expected}, received ${RX(W.input)}`;
3033
- case "invalid_value":
3034
- if (W.values.length === 1) return `Invalid input: expected ${f0(W.values[0])}`;
3035
- return `Invalid option: expected one of ${c0(W.values, "|")}`;
3036
- case "too_big": {
3037
- let q = W.inclusive ? "<=" : "<", H = X(W.origin);
3038
- if (H) return `Too big: expected ${W.origin ?? "value"} to have ${q}${W.maximum.toString()} ${H.unit ?? "elements"}`;
3039
- return `Too big: expected ${W.origin ?? "value"} to be ${q}${W.maximum.toString()}`;
3040
- }
3041
- case "too_small": {
3042
- let q = W.inclusive ? ">=" : ">", H = X(W.origin);
3043
- if (H) return `Too small: expected ${W.origin} to have ${q}${W.minimum.toString()} ${H.unit}`;
3044
- return `Too small: expected ${W.origin} to be ${q}${W.minimum.toString()}`;
3045
- }
3046
- case "invalid_format": {
3047
- let q = W;
3048
- if (q.format === "starts_with") return `Invalid string: must start with "${q.prefix}"`;
3049
- if (q.format === "ends_with") return `Invalid string: must end with "${q.suffix}"`;
3050
- if (q.format === "includes") return `Invalid string: must include "${q.includes}"`;
3051
- if (q.format === "regex") return `Invalid string: must match pattern ${q.pattern}`;
3052
- return `Invalid ${Y[q.format] ?? W.format}`;
3053
- }
3054
- case "not_multiple_of": return `Invalid number: must be a multiple of ${W.divisor}`;
3055
- case "unrecognized_keys": return `Unrecognized key${W.keys.length > 1 ? "s" : ""}: ${c0(W.keys, ", ")}`;
3056
- case "invalid_key": return `Invalid key in ${W.origin}`;
3057
- case "invalid_union": return "Invalid input";
3058
- case "invalid_element": return `Invalid value in ${W.origin}`;
3059
- default: return "Invalid input";
3060
- }
3061
- };
3062
- };
3063
- function L4() {
3064
- return { localeError: NX() };
3065
- }
3066
- var fJ;
3067
- var oJ = class {
3068
- constructor() {
3069
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
3070
- }
3071
- add(J, ...X) {
3072
- let Y = X[0];
3073
- if (this._map.set(J, Y), Y && typeof Y === "object" && "id" in Y) {
3074
- if (this._idmap.has(Y.id)) throw Error(`ID ${Y.id} already exists in the registry`);
3075
- this._idmap.set(Y.id, J);
3076
- }
3077
- return this;
3078
- }
3079
- clear() {
3080
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
3081
- }
3082
- remove(J) {
3083
- let X = this._map.get(J);
3084
- if (X && typeof X === "object" && "id" in X) this._idmap.delete(X.id);
3085
- return this._map.delete(J), this;
3086
- }
3087
- get(J) {
3088
- let X = J._zod.parent;
3089
- if (X) {
3090
- let Y = { ...this.get(X) ?? {} };
3091
- delete Y.id;
3092
- let W = {
3093
- ...Y,
3094
- ...this._map.get(J)
3095
- };
3096
- return Object.keys(W).length ? W : void 0;
3097
- }
3098
- return this._map.get(J);
3099
- }
3100
- has(J) {
3101
- return this._map.has(J);
3102
- }
3103
- };
3104
- function SX() {
3105
- return new oJ();
3106
- }
3107
- (fJ = globalThis).__zod_globalRegistry ?? (fJ.__zod_globalRegistry = SX());
3108
- var X0 = globalThis.__zod_globalRegistry;
3109
- function lJ(J, X) {
3110
- return new J({
3111
- type: "string",
3112
- coerce: !0,
3113
- ...O(X)
3114
- });
3115
- }
3116
- function Z4(J, X) {
3117
- return new J({
3118
- type: "string",
3119
- format: "email",
3120
- check: "string_format",
3121
- abort: !1,
3122
- ...O(X)
3123
- });
3124
- }
3125
- function _4(J, X) {
3126
- return new J({
3127
- type: "string",
3128
- format: "guid",
3129
- check: "string_format",
3130
- abort: !1,
3131
- ...O(X)
3132
- });
3133
- }
3134
- function pJ(J, X) {
3135
- return new J({
3136
- type: "string",
3137
- format: "uuid",
3138
- check: "string_format",
3139
- abort: !1,
3140
- ...O(X)
3141
- });
3142
- }
3143
- function dJ(J, X) {
3144
- return new J({
3145
- type: "string",
3146
- format: "uuid",
3147
- check: "string_format",
3148
- abort: !1,
3149
- version: "v4",
3150
- ...O(X)
3151
- });
3152
- }
3153
- function nJ(J, X) {
3154
- return new J({
3155
- type: "string",
3156
- format: "uuid",
3157
- check: "string_format",
3158
- abort: !1,
3159
- version: "v6",
3160
- ...O(X)
3161
- });
3162
- }
3163
- function iJ(J, X) {
3164
- return new J({
3165
- type: "string",
3166
- format: "uuid",
3167
- check: "string_format",
3168
- abort: !1,
3169
- version: "v7",
3170
- ...O(X)
3171
- });
3172
- }
3173
- function b4(J, X) {
3174
- return new J({
3175
- type: "string",
3176
- format: "url",
3177
- check: "string_format",
3178
- abort: !1,
3179
- ...O(X)
3180
- });
3181
- }
3182
- function tJ(J, X) {
3183
- return new J({
3184
- type: "string",
3185
- format: "emoji",
3186
- check: "string_format",
3187
- abort: !1,
3188
- ...O(X)
3189
- });
3190
- }
3191
- function aJ(J, X) {
3192
- return new J({
3193
- type: "string",
3194
- format: "nanoid",
3195
- check: "string_format",
3196
- abort: !1,
3197
- ...O(X)
3198
- });
3199
- }
3200
- function sJ(J, X) {
3201
- return new J({
3202
- type: "string",
3203
- format: "cuid",
3204
- check: "string_format",
3205
- abort: !1,
3206
- ...O(X)
3207
- });
3208
- }
3209
- function eJ(J, X) {
3210
- return new J({
3211
- type: "string",
3212
- format: "cuid2",
3213
- check: "string_format",
3214
- abort: !1,
3215
- ...O(X)
3216
- });
3217
- }
3218
- function J2(J, X) {
3219
- return new J({
3220
- type: "string",
3221
- format: "ulid",
3222
- check: "string_format",
3223
- abort: !1,
3224
- ...O(X)
3225
- });
3226
- }
3227
- function X2(J, X) {
3228
- return new J({
3229
- type: "string",
3230
- format: "xid",
3231
- check: "string_format",
3232
- abort: !1,
3233
- ...O(X)
3234
- });
3235
- }
3236
- function Y2(J, X) {
3237
- return new J({
3238
- type: "string",
3239
- format: "ksuid",
3240
- check: "string_format",
3241
- abort: !1,
3242
- ...O(X)
3243
- });
3244
- }
3245
- function W2(J, X) {
3246
- return new J({
3247
- type: "string",
3248
- format: "ipv4",
3249
- check: "string_format",
3250
- abort: !1,
3251
- ...O(X)
3252
- });
3253
- }
3254
- function q2(J, X) {
3255
- return new J({
3256
- type: "string",
3257
- format: "ipv6",
3258
- check: "string_format",
3259
- abort: !1,
3260
- ...O(X)
3261
- });
3262
- }
3263
- function H2(J, X) {
3264
- return new J({
3265
- type: "string",
3266
- format: "cidrv4",
3267
- check: "string_format",
3268
- abort: !1,
3269
- ...O(X)
3270
- });
3271
- }
3272
- function B2(J, X) {
3273
- return new J({
3274
- type: "string",
3275
- format: "cidrv6",
3276
- check: "string_format",
3277
- abort: !1,
3278
- ...O(X)
3279
- });
3280
- }
3281
- function Q2(J, X) {
3282
- return new J({
3283
- type: "string",
3284
- format: "base64",
3285
- check: "string_format",
3286
- abort: !1,
3287
- ...O(X)
3288
- });
3289
- }
3290
- function z2(J, X) {
3291
- return new J({
3292
- type: "string",
3293
- format: "base64url",
3294
- check: "string_format",
3295
- abort: !1,
3296
- ...O(X)
3297
- });
3298
- }
3299
- function G2(J, X) {
3300
- return new J({
3301
- type: "string",
3302
- format: "e164",
3303
- check: "string_format",
3304
- abort: !1,
3305
- ...O(X)
3306
- });
3307
- }
3308
- function U2(J, X) {
3309
- return new J({
3310
- type: "string",
3311
- format: "jwt",
3312
- check: "string_format",
3313
- abort: !1,
3314
- ...O(X)
3315
- });
3316
- }
3317
- function I2(J, X) {
3318
- return new J({
3319
- type: "string",
3320
- format: "datetime",
3321
- check: "string_format",
3322
- offset: !1,
3323
- local: !1,
3324
- precision: null,
3325
- ...O(X)
3326
- });
3327
- }
3328
- function w2(J, X) {
3329
- return new J({
3330
- type: "string",
3331
- format: "date",
3332
- check: "string_format",
3333
- ...O(X)
3334
- });
3335
- }
3336
- function D2(J, X) {
3337
- return new J({
3338
- type: "string",
3339
- format: "time",
3340
- check: "string_format",
3341
- precision: null,
3342
- ...O(X)
3343
- });
3344
- }
3345
- function P2(J, X) {
3346
- return new J({
3347
- type: "string",
3348
- format: "duration",
3349
- check: "string_format",
3350
- ...O(X)
3351
- });
3352
- }
3353
- function M2(J, X) {
3354
- return new J({
3355
- type: "number",
3356
- coerce: !0,
3357
- checks: [],
3358
- ...O(X)
3359
- });
3360
- }
3361
- function A2(J, X) {
3362
- return new J({
3363
- type: "number",
3364
- check: "number_format",
3365
- abort: !1,
3366
- format: "safeint",
3367
- ...O(X)
3368
- });
3369
- }
3370
- function E2(J, X) {
3371
- return new J({
3372
- type: "boolean",
3373
- coerce: !0,
3374
- ...O(X)
3375
- });
3376
- }
3377
- function $2(J, X) {
3378
- return new J({
3379
- type: "bigint",
3380
- coerce: !0,
3381
- ...O(X)
3382
- });
3383
- }
3384
- function V2(J) {
3385
- return new J({ type: "unknown" });
3386
- }
3387
- function R2(J, X) {
3388
- return new J({
3389
- type: "never",
3390
- ...O(X)
3391
- });
3392
- }
3393
- function S2(J, X) {
3394
- return new J({
3395
- type: "date",
3396
- coerce: !0,
3397
- ...O(X)
3398
- });
3399
- }
3400
- function Q0(J, X) {
3401
- return new K4({
3402
- check: "less_than",
3403
- ...O(X),
3404
- value: J,
3405
- inclusive: !1
3406
- });
3407
- }
3408
- function p(J, X) {
3409
- return new K4({
3410
- check: "less_than",
3411
- ...O(X),
3412
- value: J,
3413
- inclusive: !0
3414
- });
3415
- }
3416
- function z0(J, X) {
3417
- return new V4({
3418
- check: "greater_than",
3419
- ...O(X),
3420
- value: J,
3421
- inclusive: !1
3422
- });
3423
- }
3424
- function f(J, X) {
3425
- return new V4({
3426
- check: "greater_than",
3427
- ...O(X),
3428
- value: J,
3429
- inclusive: !0
3430
- });
3431
- }
3432
- function S0(J, X) {
3433
- return new S1({
3434
- check: "multiple_of",
3435
- ...O(X),
3436
- value: J
3437
- });
3438
- }
3439
- function t0(J, X) {
3440
- return new Z1({
3441
- check: "max_length",
3442
- ...O(X),
3443
- maximum: J
3444
- });
3445
- }
3446
- function G0(J, X) {
3447
- return new _1({
3448
- check: "min_length",
3449
- ...O(X),
3450
- minimum: J
3451
- });
3452
- }
3453
- function a0(J, X) {
3454
- return new b1({
3455
- check: "length_equals",
3456
- ...O(X),
3457
- length: J
3458
- });
3459
- }
3460
- function C4(J, X) {
3461
- return new C1({
3462
- check: "string_format",
3463
- format: "regex",
3464
- ...O(X),
3465
- pattern: J
3466
- });
3467
- }
3468
- function k4(J) {
3469
- return new k1({
3470
- check: "string_format",
3471
- format: "lowercase",
3472
- ...O(J)
3473
- });
3474
- }
3475
- function T4(J) {
3476
- return new T1({
3477
- check: "string_format",
3478
- format: "uppercase",
3479
- ...O(J)
3480
- });
3481
- }
3482
- function j4(J, X) {
3483
- return new j1({
3484
- check: "string_format",
3485
- format: "includes",
3486
- ...O(X),
3487
- includes: J
3488
- });
3489
- }
3490
- function h4(J, X) {
3491
- return new h1({
3492
- check: "string_format",
3493
- format: "starts_with",
3494
- ...O(X),
3495
- prefix: J
3496
- });
3497
- }
3498
- function x4(J, X) {
3499
- return new x1({
3500
- check: "string_format",
3501
- format: "ends_with",
3502
- ...O(X),
3503
- suffix: J
3504
- });
3505
- }
3506
- function s(J) {
3507
- return new v1({
3508
- check: "overwrite",
3509
- tx: J
3510
- });
3511
- }
3512
- function v4(J) {
3513
- return s((X) => X.normalize(J));
3514
- }
3515
- function g4() {
3516
- return s((J) => J.trim());
3517
- }
3518
- function u4() {
3519
- return s((J) => J.toLowerCase());
3520
- }
3521
- function c4() {
3522
- return s((J) => J.toUpperCase());
3523
- }
3524
- function y4() {
3525
- return s((J) => D4(J));
3526
- }
3527
- function L2(J, X, Y) {
3528
- return new J({
3529
- type: "array",
3530
- element: X,
3531
- ...O(Y)
3532
- });
3533
- }
3534
- function Z2(J, X, Y) {
3535
- return new J({
3536
- type: "custom",
3537
- check: "custom",
3538
- fn: X,
3539
- ...O(Y)
3540
- });
3541
- }
3542
- function _2(J) {
3543
- let X = LX((Y) => {
3544
- return Y.addIssue = (W) => {
3545
- if (typeof W === "string") Y.issues.push(B0(W, Y.value, X._zod.def));
3546
- else {
3547
- let q = W;
3548
- if (q.fatal) q.continue = !1;
3549
- q.code ?? (q.code = "custom"), q.input ?? (q.input = Y.value), q.inst ?? (q.inst = X), q.continue ?? (q.continue = !X._zod.def.abort), Y.issues.push(B0(q));
3550
- }
3551
- }, J(Y.value, Y);
3552
- });
3553
- return X;
3554
- }
3555
- function LX(J, X) {
3556
- let Y = new T({
3557
- check: "custom",
3558
- ...O(X)
3559
- });
3560
- return Y._zod.check = J, Y;
3561
- }
3562
- function m4(J) {
3563
- let X = J?.target ?? "draft-2020-12";
3564
- if (X === "draft-4") X = "draft-04";
3565
- if (X === "draft-7") X = "draft-07";
3566
- return {
3567
- processors: J.processors ?? {},
3568
- metadataRegistry: J?.metadata ?? X0,
3569
- target: X,
3570
- unrepresentable: J?.unrepresentable ?? "throw",
3571
- override: J?.override ?? (() => {}),
3572
- io: J?.io ?? "output",
3573
- counter: 0,
3574
- seen: /* @__PURE__ */ new Map(),
3575
- cycles: J?.cycles ?? "ref",
3576
- reused: J?.reused ?? "inline",
3577
- external: J?.external ?? void 0
3578
- };
3579
- }
3580
- function b(J, X, Y = {
3581
- path: [],
3582
- schemaPath: []
3583
- }) {
3584
- var W;
3585
- let q = J._zod.def, H = X.seen.get(J);
3586
- if (H) {
3587
- if (H.count++, Y.schemaPath.includes(J)) H.cycle = Y.path;
3588
- return H.schema;
3589
- }
3590
- let B = {
3591
- schema: {},
3592
- count: 1,
3593
- cycle: void 0,
3594
- path: Y.path
3595
- };
3596
- X.seen.set(J, B);
3597
- let Q = J._zod.toJSONSchema?.();
3598
- if (Q) B.schema = Q;
3599
- else {
3600
- let I = {
3601
- ...Y,
3602
- schemaPath: [...Y.schemaPath, J],
3603
- path: Y.path
3604
- }, w = J._zod.parent;
3605
- if (w) B.ref = w, b(w, X, I), X.seen.get(w).isParent = !0;
3606
- else if (J._zod.processJSONSchema) J._zod.processJSONSchema(X, B.schema, I);
3607
- else {
3608
- let M = B.schema, P = X.processors[q.type];
3609
- if (!P) throw Error(`[toJSONSchema]: Non-representable type encountered: ${q.type}`);
3610
- P(J, X, M, I);
3611
- }
3612
- }
3613
- let G = X.metadataRegistry.get(J);
3614
- if (G) Object.assign(B.schema, G);
3615
- if (X.io === "input" && j(J)) delete B.schema.examples, delete B.schema.default;
3616
- if (X.io === "input" && B.schema._prefault) (W = B.schema).default ?? (W.default = B.schema._prefault);
3617
- return delete B.schema._prefault, X.seen.get(J).schema;
3618
- }
3619
- function f4(J, X) {
3620
- let Y = J.seen.get(X);
3621
- if (!Y) throw Error("Unprocessed schema. This is a bug in Zod.");
3622
- let W = (H) => {
3623
- let B = J.target === "draft-2020-12" ? "$defs" : "definitions";
3624
- if (J.external) {
3625
- let I = J.external.registry.get(H[0])?.id, w = J.external.uri ?? ((P) => P);
3626
- if (I) return { ref: w(I) };
3627
- let M = H[1].defId ?? H[1].schema.id ?? `schema${J.counter++}`;
3628
- return H[1].defId = M, {
3629
- defId: M,
3630
- ref: `${w("__shared")}#/${B}/${M}`
3631
- };
3632
- }
3633
- if (H[1] === Y) return { ref: "#" };
3634
- let G = `#/${B}/`, z = H[1].schema.id ?? `__schema${J.counter++}`;
3635
- return {
3636
- defId: z,
3637
- ref: G + z
3638
- };
3639
- }, q = (H) => {
3640
- if (H[1].schema.$ref) return;
3641
- let B = H[1], { ref: Q, defId: G } = W(H);
3642
- if (B.def = { ...B.schema }, G) B.defId = G;
3643
- let z = B.schema;
3644
- for (let I in z) delete z[I];
3645
- z.$ref = Q;
3646
- };
3647
- if (J.cycles === "throw") for (let H of J.seen.entries()) {
3648
- let B = H[1];
3649
- if (B.cycle) throw Error(`Cycle detected: #/${B.cycle?.join("/")}/<root>
3650
-
3651
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
3652
- }
3653
- for (let H of J.seen.entries()) {
3654
- let B = H[1];
3655
- if (X === H[0]) {
3656
- q(H);
3657
- continue;
3658
- }
3659
- if (J.external) {
3660
- let G = J.external.registry.get(H[0])?.id;
3661
- if (X !== H[0] && G) {
3662
- q(H);
3663
- continue;
3664
- }
3665
- }
3666
- if (J.metadataRegistry.get(H[0])?.id) {
3667
- q(H);
3668
- continue;
3669
- }
3670
- if (B.cycle) {
3671
- q(H);
3672
- continue;
3673
- }
3674
- if (B.count > 1) {
3675
- if (J.reused === "ref") {
3676
- q(H);
3677
- continue;
3678
- }
3679
- }
3680
- }
3681
- }
3682
- function o4(J, X) {
3683
- let Y = J.seen.get(X);
3684
- if (!Y) throw Error("Unprocessed schema. This is a bug in Zod.");
3685
- let W = (B) => {
3686
- let Q = J.seen.get(B), G = Q.def ?? Q.schema, z = { ...G };
3687
- if (Q.ref === null) return;
3688
- let I = Q.ref;
3689
- if (Q.ref = null, I) {
3690
- W(I);
3691
- let w = J.seen.get(I).schema;
3692
- if (w.$ref && (J.target === "draft-07" || J.target === "draft-04" || J.target === "openapi-3.0")) G.allOf = G.allOf ?? [], G.allOf.push(w);
3693
- else Object.assign(G, w), Object.assign(G, z);
3694
- }
3695
- if (!Q.isParent) J.override({
3696
- zodSchema: B,
3697
- jsonSchema: G,
3698
- path: Q.path ?? []
3699
- });
3700
- };
3701
- for (let B of [...J.seen.entries()].reverse()) W(B[0]);
3702
- let q = {};
3703
- if (J.target === "draft-2020-12") q.$schema = "https://json-schema.org/draft/2020-12/schema";
3704
- else if (J.target === "draft-07") q.$schema = "http://json-schema.org/draft-07/schema#";
3705
- else if (J.target === "draft-04") q.$schema = "http://json-schema.org/draft-04/schema#";
3706
- else if (J.target === "openapi-3.0");
3707
- if (J.external?.uri) {
3708
- let B = J.external.registry.get(X)?.id;
3709
- if (!B) throw Error("Schema is missing an `id` property");
3710
- q.$id = J.external.uri(B);
3711
- }
3712
- Object.assign(q, Y.def ?? Y.schema);
3713
- let H = J.external?.defs ?? {};
3714
- for (let B of J.seen.entries()) {
3715
- let Q = B[1];
3716
- if (Q.def && Q.defId) H[Q.defId] = Q.def;
3717
- }
3718
- if (J.external);
3719
- else if (Object.keys(H).length > 0) if (J.target === "draft-2020-12") q.$defs = H;
3720
- else q.definitions = H;
3721
- try {
3722
- let B = JSON.parse(JSON.stringify(q));
3723
- return Object.defineProperty(B, "~standard", {
3724
- value: {
3725
- ...X["~standard"],
3726
- jsonSchema: {
3727
- input: L0(X, "input"),
3728
- output: L0(X, "output")
3729
- }
3730
- },
3731
- enumerable: !1,
3732
- writable: !1
3733
- }), B;
3734
- } catch (B) {
3735
- throw Error("Error converting schema to JSON.");
3736
- }
3737
- }
3738
- function j(J, X) {
3739
- let Y = X ?? { seen: /* @__PURE__ */ new Set() };
3740
- if (Y.seen.has(J)) return !1;
3741
- Y.seen.add(J);
3742
- let W = J._zod.def;
3743
- if (W.type === "transform") return !0;
3744
- if (W.type === "array") return j(W.element, Y);
3745
- if (W.type === "set") return j(W.valueType, Y);
3746
- if (W.type === "lazy") return j(W.getter(), Y);
3747
- if (W.type === "promise" || W.type === "optional" || W.type === "nonoptional" || W.type === "nullable" || W.type === "readonly" || W.type === "default" || W.type === "prefault") return j(W.innerType, Y);
3748
- if (W.type === "intersection") return j(W.left, Y) || j(W.right, Y);
3749
- if (W.type === "record" || W.type === "map") return j(W.keyType, Y) || j(W.valueType, Y);
3750
- if (W.type === "pipe") return j(W.in, Y) || j(W.out, Y);
3751
- if (W.type === "object") {
3752
- for (let q in W.shape) if (j(W.shape[q], Y)) return !0;
3753
- return !1;
3754
- }
3755
- if (W.type === "union") {
3756
- for (let q of W.options) if (j(q, Y)) return !0;
3757
- return !1;
3758
- }
3759
- if (W.type === "tuple") {
3760
- for (let q of W.items) if (j(q, Y)) return !0;
3761
- if (W.rest && j(W.rest, Y)) return !0;
3762
- return !1;
3763
- }
3764
- return !1;
3765
- }
3766
- var b2 = (J, X = {}) => (Y) => {
3767
- let W = m4({
3768
- ...Y,
3769
- processors: X
3770
- });
3771
- return b(J, W), f4(W, J), o4(W, J);
3772
- }, L0 = (J, X) => (Y) => {
3773
- let { libraryOptions: W, target: q } = Y ?? {}, H = m4({
3774
- ...W ?? {},
3775
- target: q,
3776
- io: X,
3777
- processors: {}
3778
- });
3779
- return b(J, H), f4(H, J), o4(H, J);
3780
- };
3781
- var ZX = {
3782
- guid: "uuid",
3783
- url: "uri",
3784
- datetime: "date-time",
3785
- json_string: "json-string",
3786
- regex: ""
3787
- }, C2 = (J, X, Y, W) => {
3788
- let q = Y;
3789
- q.type = "string";
3790
- let { minimum: H, maximum: B, format: Q, patterns: G, contentEncoding: z } = J._zod.bag;
3791
- if (typeof H === "number") q.minLength = H;
3792
- if (typeof B === "number") q.maxLength = B;
3793
- if (Q) {
3794
- if (q.format = ZX[Q] ?? Q, q.format === "") delete q.format;
3795
- }
3796
- if (z) q.contentEncoding = z;
3797
- if (G && G.size > 0) {
3798
- let I = [...G];
3799
- if (I.length === 1) q.pattern = I[0].source;
3800
- else if (I.length > 1) q.allOf = [...I.map((w) => ({
3801
- ...X.target === "draft-07" || X.target === "draft-04" || X.target === "openapi-3.0" ? { type: "string" } : {},
3802
- pattern: w.source
3803
- }))];
3804
- }
3805
- }, k2 = (J, X, Y, W) => {
3806
- let q = Y, { minimum: H, maximum: B, format: Q, multipleOf: G, exclusiveMaximum: z, exclusiveMinimum: I } = J._zod.bag;
3807
- if (typeof Q === "string" && Q.includes("int")) q.type = "integer";
3808
- else q.type = "number";
3809
- if (typeof I === "number") if (X.target === "draft-04" || X.target === "openapi-3.0") q.minimum = I, q.exclusiveMinimum = !0;
3810
- else q.exclusiveMinimum = I;
3811
- if (typeof H === "number") {
3812
- if (q.minimum = H, typeof I === "number" && X.target !== "draft-04") if (I >= H) delete q.minimum;
3813
- else delete q.exclusiveMinimum;
3814
- }
3815
- if (typeof z === "number") if (X.target === "draft-04" || X.target === "openapi-3.0") q.maximum = z, q.exclusiveMaximum = !0;
3816
- else q.exclusiveMaximum = z;
3817
- if (typeof B === "number") {
3818
- if (q.maximum = B, typeof z === "number" && X.target !== "draft-04") if (z <= B) delete q.maximum;
3819
- else delete q.exclusiveMaximum;
3820
- }
3821
- if (typeof G === "number") q.multipleOf = G;
3822
- }, T2 = (J, X, Y, W) => {
3823
- Y.type = "boolean";
3824
- }, j2 = (J, X, Y, W) => {
3825
- if (X.unrepresentable === "throw") throw Error("BigInt cannot be represented in JSON Schema");
3826
- };
3827
- var h2 = (J, X, Y, W) => {
3828
- Y.not = {};
3829
- }, x2 = (J, X, Y, W) => {}, v2 = (J, X, Y, W) => {}, g2 = (J, X, Y, W) => {
3830
- if (X.unrepresentable === "throw") throw Error("Date cannot be represented in JSON Schema");
3831
- }, u2 = (J, X, Y, W) => {
3832
- let q = J._zod.def, H = A0(q.entries);
3833
- if (H.every((B) => typeof B === "number")) Y.type = "number";
3834
- if (H.every((B) => typeof B === "string")) Y.type = "string";
3835
- Y.enum = H;
3836
- };
3837
- var c2 = (J, X, Y, W) => {
3838
- if (X.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
3839
- };
3840
- var y2 = (J, X, Y, W) => {
3841
- if (X.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
3842
- };
3843
- var m2 = (J, X, Y, W) => {
3844
- let q = Y, H = J._zod.def, { minimum: B, maximum: Q } = J._zod.bag;
3845
- if (typeof B === "number") q.minItems = B;
3846
- if (typeof Q === "number") q.maxItems = Q;
3847
- q.type = "array", q.items = b(H.element, X, {
3848
- ...W,
3849
- path: [...W.path, "items"]
3850
- });
3851
- }, f2 = (J, X, Y, W) => {
3852
- let q = Y, H = J._zod.def;
3853
- q.type = "object", q.properties = {};
3854
- let B = H.shape;
3855
- for (let z in B) q.properties[z] = b(B[z], X, {
3856
- ...W,
3857
- path: [
3858
- ...W.path,
3859
- "properties",
3860
- z
3861
- ]
3862
- });
3863
- let Q = new Set(Object.keys(B)), G = new Set([...Q].filter((z) => {
3864
- let I = H.shape[z]._zod;
3865
- if (X.io === "input") return I.optin === void 0;
3866
- else return I.optout === void 0;
3867
- }));
3868
- if (G.size > 0) q.required = Array.from(G);
3869
- if (H.catchall?._zod.def.type === "never") q.additionalProperties = !1;
3870
- else if (!H.catchall) {
3871
- if (X.io === "output") q.additionalProperties = !1;
3872
- } else if (H.catchall) q.additionalProperties = b(H.catchall, X, {
3873
- ...W,
3874
- path: [...W.path, "additionalProperties"]
3875
- });
3876
- }, o2 = (J, X, Y, W) => {
3877
- let q = J._zod.def, H = q.inclusive === !1, B = q.options.map((Q, G) => b(Q, X, {
3878
- ...W,
3879
- path: [
3880
- ...W.path,
3881
- H ? "oneOf" : "anyOf",
3882
- G
3883
- ]
3884
- }));
3885
- if (H) Y.oneOf = B;
3886
- else Y.anyOf = B;
3887
- }, r2 = (J, X, Y, W) => {
3888
- let q = J._zod.def, H = b(q.left, X, {
3889
- ...W,
3890
- path: [
3891
- ...W.path,
3892
- "allOf",
3893
- 0
3894
- ]
3895
- }), B = b(q.right, X, {
3896
- ...W,
3897
- path: [
3898
- ...W.path,
3899
- "allOf",
3900
- 1
3901
- ]
3902
- }), Q = (z) => "allOf" in z && Object.keys(z).length === 1;
3903
- Y.allOf = [...Q(H) ? H.allOf : [H], ...Q(B) ? B.allOf : [B]];
3904
- };
3905
- var l2 = (J, X, Y, W) => {
3906
- let q = Y, H = J._zod.def;
3907
- if (q.type = "object", X.target === "draft-07" || X.target === "draft-2020-12") q.propertyNames = b(H.keyType, X, {
3908
- ...W,
3909
- path: [...W.path, "propertyNames"]
3910
- });
3911
- q.additionalProperties = b(H.valueType, X, {
3912
- ...W,
3913
- path: [...W.path, "additionalProperties"]
3914
- });
3915
- }, p2 = (J, X, Y, W) => {
3916
- let q = J._zod.def, H = b(q.innerType, X, W), B = X.seen.get(J);
3917
- if (X.target === "openapi-3.0") B.ref = q.innerType, Y.nullable = !0;
3918
- else Y.anyOf = [H, { type: "null" }];
3919
- }, d2 = (J, X, Y, W) => {
3920
- let q = J._zod.def;
3921
- b(q.innerType, X, W);
3922
- let H = X.seen.get(J);
3923
- H.ref = q.innerType;
3924
- }, n2 = (J, X, Y, W) => {
3925
- let q = J._zod.def;
3926
- b(q.innerType, X, W);
3927
- let H = X.seen.get(J);
3928
- H.ref = q.innerType, Y.default = JSON.parse(JSON.stringify(q.defaultValue));
3929
- }, i2 = (J, X, Y, W) => {
3930
- let q = J._zod.def;
3931
- b(q.innerType, X, W);
3932
- let H = X.seen.get(J);
3933
- if (H.ref = q.innerType, X.io === "input") Y._prefault = JSON.parse(JSON.stringify(q.defaultValue));
3934
- }, t2 = (J, X, Y, W) => {
3935
- let q = J._zod.def;
3936
- b(q.innerType, X, W);
3937
- let H = X.seen.get(J);
3938
- H.ref = q.innerType;
3939
- let B;
3940
- try {
3941
- B = q.catchValue(void 0);
3942
- } catch {
3943
- throw Error("Dynamic catch values are not supported in JSON Schema");
3944
- }
3945
- Y.default = B;
3946
- }, a2 = (J, X, Y, W) => {
3947
- let q = J._zod.def, H = X.io === "input" ? q.in._zod.def.type === "transform" ? q.out : q.in : q.out;
3948
- b(H, X, W);
3949
- let B = X.seen.get(J);
3950
- B.ref = H;
3951
- }, s2 = (J, X, Y, W) => {
3952
- let q = J._zod.def;
3953
- b(q.innerType, X, W);
3954
- let H = X.seen.get(J);
3955
- H.ref = q.innerType, Y.readOnly = !0;
3956
- };
3957
- var e2 = (J, X, Y, W) => {
3958
- let q = J._zod.def;
3959
- b(q.innerType, X, W);
3960
- let H = X.seen.get(J);
3961
- H.ref = q.innerType;
3962
- };
3963
- var xX = U("ZodISODateTime", (J, X) => {
3964
- qJ.init(J, X), S.init(J, X);
3965
- });
3966
- function J8(J) {
3967
- return I2(xX, J);
3968
- }
3969
- var vX = U("ZodISODate", (J, X) => {
3970
- HJ.init(J, X), S.init(J, X);
3971
- });
3972
- function X8(J) {
3973
- return w2(vX, J);
3974
- }
3975
- var gX = U("ZodISOTime", (J, X) => {
3976
- BJ.init(J, X), S.init(J, X);
3977
- });
3978
- function Y8(J) {
3979
- return D2(gX, J);
3980
- }
3981
- var uX = U("ZodISODuration", (J, X) => {
3982
- QJ.init(J, X), S.init(J, X);
3983
- });
3984
- function W8(J) {
3985
- return P2(uX, J);
3986
- }
3987
- var B8 = (J, X) => {
3988
- o0.init(J, X), J.name = "ZodError", Object.defineProperties(J, {
3989
- format: { value: (Y) => c6(J, Y) },
3990
- flatten: { value: (Y) => u6(J, Y) },
3991
- addIssue: { value: (Y) => {
3992
- J.issues.push(Y), J.message = JSON.stringify(J.issues, H0, 2);
3993
- } },
3994
- addIssues: { value: (Y) => {
3995
- J.issues.push(...Y), J.message = JSON.stringify(J.issues, H0, 2);
3996
- } },
3997
- isEmpty: { get() {
3998
- return J.issues.length === 0;
3999
- } }
4000
- });
4001
- };
4002
- U("ZodError", B8);
4003
- var x = U("ZodError", B8, { Parent: Error });
4004
- var Q8 = r0(x), z8 = l0(x), G8 = V0(x), U8 = R0(x), I8 = f6(x), w8 = o6(x), D8 = r6(x), P8 = l6(x), O8 = p6(x), M8 = d6(x), A8 = n6(x), F8 = i6(x);
4005
- var L = U("ZodType", (J, X) => {
4006
- return $.init(J, X), Object.assign(J["~standard"], { jsonSchema: {
4007
- input: L0(J, "input"),
4008
- output: L0(J, "output")
4009
- } }), J.toJSONSchema = b2(J, {}), J.def = X, J.type = X.type, Object.defineProperty(J, "_def", { value: X }), J.check = (...Y) => {
4010
- return J.clone(F.mergeDefs(X, { checks: [...X.checks ?? [], ...Y.map((W) => typeof W === "function" ? { _zod: {
4011
- check: W,
4012
- def: { check: "custom" },
4013
- onattach: []
4014
- } } : W)] }));
4015
- }, J.clone = (Y, W) => y(J, Y, W), J.brand = () => J, J.register = (Y, W) => {
4016
- return Y.add(J, W), J;
4017
- }, J.parse = (Y, W) => Q8(J, Y, W, { callee: J.parse }), J.safeParse = (Y, W) => G8(J, Y, W), J.parseAsync = async (Y, W) => z8(J, Y, W, { callee: J.parseAsync }), J.safeParseAsync = async (Y, W) => U8(J, Y, W), J.spa = J.safeParseAsync, J.encode = (Y, W) => I8(J, Y, W), J.decode = (Y, W) => w8(J, Y, W), J.encodeAsync = async (Y, W) => D8(J, Y, W), J.decodeAsync = async (Y, W) => P8(J, Y, W), J.safeEncode = (Y, W) => O8(J, Y, W), J.safeDecode = (Y, W) => M8(J, Y, W), J.safeEncodeAsync = async (Y, W) => A8(J, Y, W), J.safeDecodeAsync = async (Y, W) => F8(J, Y, W), J.refine = (Y, W) => J.check(ZY(Y, W)), J.superRefine = (Y) => J.check(_Y(Y)), J.overwrite = (Y) => J.check(s(Y)), J.optional = () => V8(J), J.nullable = () => R8(J), J.nullish = () => V8(R8(J)), J.nonoptional = (Y) => $Y(J, Y), J.array = () => i4(J), J.or = (Y) => GY([J, Y]), J.and = (Y) => IY(J, Y), J.transform = (Y) => N8(J, PY(Y)), J.default = (Y) => AY(J, Y), J.prefault = (Y) => EY(J, Y), J.catch = (Y) => VY(J, Y), J.pipe = (Y) => N8(J, Y), J.readonly = () => SY(J), J.describe = (Y) => {
4018
- let W = J.clone();
4019
- return X0.add(W, { description: Y }), W;
4020
- }, Object.defineProperty(J, "description", {
4021
- get() {
4022
- return X0.get(J)?.description;
4023
- },
4024
- configurable: !0
4025
- }), J.meta = (...Y) => {
4026
- if (Y.length === 0) return X0.get(J);
4027
- let W = J.clone();
4028
- return X0.add(W, Y[0]), W;
4029
- }, J.isOptional = () => J.safeParse(void 0).success, J.isNullable = () => J.safeParse(null).success, J;
4030
- }), S8 = U("_ZodString", (J, X) => {
4031
- i0.init(J, X), L.init(J, X), J._zod.processJSONSchema = (W, q, H) => C2(J, W, q, H);
4032
- let Y = J._zod.bag;
4033
- J.format = Y.format ?? null, J.minLength = Y.minimum ?? null, J.maxLength = Y.maximum ?? null, J.regex = (...W) => J.check(C4(...W)), J.includes = (...W) => J.check(j4(...W)), J.startsWith = (...W) => J.check(h4(...W)), J.endsWith = (...W) => J.check(x4(...W)), J.min = (...W) => J.check(G0(...W)), J.max = (...W) => J.check(t0(...W)), J.length = (...W) => J.check(a0(...W)), J.nonempty = (...W) => J.check(G0(1, ...W)), J.lowercase = (W) => J.check(k4(W)), J.uppercase = (W) => J.check(T4(W)), J.trim = () => J.check(g4()), J.normalize = (...W) => J.check(v4(...W)), J.toLowerCase = () => J.check(u4()), J.toUpperCase = () => J.check(c4()), J.slugify = () => J.check(y4());
4034
- }), l4 = U("ZodString", (J, X) => {
4035
- i0.init(J, X), S8.init(J, X), J.email = (Y) => J.check(Z4(L8, Y)), J.url = (Y) => J.check(b4(_8, Y)), J.jwt = (Y) => J.check(U2(JY, Y)), J.emoji = (Y) => J.check(tJ(yX, Y)), J.guid = (Y) => J.check(_4(E8, Y)), J.uuid = (Y) => J.check(pJ(s0, Y)), J.uuidv4 = (Y) => J.check(dJ(s0, Y)), J.uuidv6 = (Y) => J.check(nJ(s0, Y)), J.uuidv7 = (Y) => J.check(iJ(s0, Y)), J.nanoid = (Y) => J.check(aJ(mX, Y)), J.guid = (Y) => J.check(_4(E8, Y)), J.cuid = (Y) => J.check(sJ(fX, Y)), J.cuid2 = (Y) => J.check(eJ(oX, Y)), J.ulid = (Y) => J.check(J2(rX, Y)), J.base64 = (Y) => J.check(Q2(aX, Y)), J.base64url = (Y) => J.check(z2(sX, Y)), J.xid = (Y) => J.check(X2(lX, Y)), J.ksuid = (Y) => J.check(Y2(pX, Y)), J.ipv4 = (Y) => J.check(W2(dX, Y)), J.ipv6 = (Y) => J.check(q2(nX, Y)), J.cidrv4 = (Y) => J.check(H2(iX, Y)), J.cidrv6 = (Y) => J.check(B2(tX, Y)), J.e164 = (Y) => J.check(G2(eX, Y)), J.datetime = (Y) => J.check(J8(Y)), J.date = (Y) => J.check(X8(Y)), J.time = (Y) => J.check(Y8(Y)), J.duration = (Y) => J.check(W8(Y));
4036
- });
4037
- var S = U("ZodStringFormat", (J, X) => {
4038
- V.init(J, X), S8.init(J, X);
4039
- }), L8 = U("ZodEmail", (J, X) => {
4040
- i1.init(J, X), S.init(J, X);
4041
- });
4042
- var E8 = U("ZodGUID", (J, X) => {
4043
- d1.init(J, X), S.init(J, X);
4044
- });
4045
- var s0 = U("ZodUUID", (J, X) => {
4046
- n1.init(J, X), S.init(J, X);
4047
- });
4048
- var _8 = U("ZodURL", (J, X) => {
4049
- t1.init(J, X), S.init(J, X);
4050
- });
4051
- var yX = U("ZodEmoji", (J, X) => {
4052
- a1.init(J, X), S.init(J, X);
4053
- });
4054
- var mX = U("ZodNanoID", (J, X) => {
4055
- s1.init(J, X), S.init(J, X);
4056
- });
4057
- var fX = U("ZodCUID", (J, X) => {
4058
- e1.init(J, X), S.init(J, X);
4059
- });
4060
- var oX = U("ZodCUID2", (J, X) => {
4061
- JJ.init(J, X), S.init(J, X);
4062
- });
4063
- var rX = U("ZodULID", (J, X) => {
4064
- XJ.init(J, X), S.init(J, X);
4065
- });
4066
- var lX = U("ZodXID", (J, X) => {
4067
- YJ.init(J, X), S.init(J, X);
4068
- });
4069
- var pX = U("ZodKSUID", (J, X) => {
4070
- WJ.init(J, X), S.init(J, X);
4071
- });
4072
- var dX = U("ZodIPv4", (J, X) => {
4073
- zJ.init(J, X), S.init(J, X);
4074
- });
4075
- var nX = U("ZodIPv6", (J, X) => {
4076
- GJ.init(J, X), S.init(J, X);
4077
- });
4078
- var iX = U("ZodCIDRv4", (J, X) => {
4079
- UJ.init(J, X), S.init(J, X);
4080
- });
4081
- var tX = U("ZodCIDRv6", (J, X) => {
4082
- IJ.init(J, X), S.init(J, X);
4083
- });
4084
- var aX = U("ZodBase64", (J, X) => {
4085
- DJ.init(J, X), S.init(J, X);
4086
- });
4087
- var sX = U("ZodBase64URL", (J, X) => {
4088
- PJ.init(J, X), S.init(J, X);
4089
- });
4090
- var eX = U("ZodE164", (J, X) => {
4091
- OJ.init(J, X), S.init(J, X);
4092
- });
4093
- var JY = U("ZodJWT", (J, X) => {
4094
- MJ.init(J, X), S.init(J, X);
4095
- });
4096
- var e0 = U("ZodNumber", (J, X) => {
4097
- S4.init(J, X), L.init(J, X), J._zod.processJSONSchema = (W, q, H) => k2(J, W, q, H), J.gt = (W, q) => J.check(z0(W, q)), J.gte = (W, q) => J.check(f(W, q)), J.min = (W, q) => J.check(f(W, q)), J.lt = (W, q) => J.check(Q0(W, q)), J.lte = (W, q) => J.check(p(W, q)), J.max = (W, q) => J.check(p(W, q)), J.int = (W) => J.check($8(W)), J.safe = (W) => J.check($8(W)), J.positive = (W) => J.check(z0(0, W)), J.nonnegative = (W) => J.check(f(0, W)), J.negative = (W) => J.check(Q0(0, W)), J.nonpositive = (W) => J.check(p(0, W)), J.multipleOf = (W, q) => J.check(S0(W, q)), J.step = (W, q) => J.check(S0(W, q)), J.finite = () => J;
4098
- let Y = J._zod.bag;
4099
- J.minValue = Math.max(Y.minimum ?? Number.NEGATIVE_INFINITY, Y.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, J.maxValue = Math.min(Y.maximum ?? Number.POSITIVE_INFINITY, Y.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, J.isInt = (Y.format ?? "").includes("int") || Number.isSafeInteger(Y.multipleOf ?? .5), J.isFinite = !0, J.format = Y.format ?? null;
4100
- });
4101
- var XY = U("ZodNumberFormat", (J, X) => {
4102
- AJ.init(J, X), e0.init(J, X);
4103
- });
4104
- function $8(J) {
4105
- return A2(XY, J);
4106
- }
4107
- var p4 = U("ZodBoolean", (J, X) => {
4108
- FJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => T2(J, Y, W, q);
4109
- });
4110
- var k8 = U("ZodBigInt", (J, X) => {
4111
- EJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (W, q, H) => j2(J, W, q, H), J.gte = (W, q) => J.check(f(W, q)), J.min = (W, q) => J.check(f(W, q)), J.gt = (W, q) => J.check(z0(W, q)), J.gte = (W, q) => J.check(f(W, q)), J.min = (W, q) => J.check(f(W, q)), J.lt = (W, q) => J.check(Q0(W, q)), J.lte = (W, q) => J.check(p(W, q)), J.max = (W, q) => J.check(p(W, q)), J.positive = (W) => J.check(z0(BigInt(0), W)), J.negative = (W) => J.check(Q0(BigInt(0), W)), J.nonpositive = (W) => J.check(p(BigInt(0), W)), J.nonnegative = (W) => J.check(f(BigInt(0), W)), J.multipleOf = (W, q) => J.check(S0(W, q));
4112
- let Y = J._zod.bag;
4113
- J.minValue = Y.minimum ?? null, J.maxValue = Y.maximum ?? null, J.format = Y.format ?? null;
4114
- });
4115
- var YY = U("ZodAny", (J, X) => {
4116
- $J.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => x2(J, Y, W, q);
4117
- });
4118
- var WY = U("ZodUnknown", (J, X) => {
4119
- KJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => v2(J, Y, W, q);
4120
- });
4121
- function K8() {
4122
- return V2(WY);
4123
- }
4124
- var qY = U("ZodNever", (J, X) => {
4125
- VJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => h2(J, Y, W, q);
4126
- });
4127
- function HY(J) {
4128
- return R2(qY, J);
4129
- }
4130
- var d4 = U("ZodDate", (J, X) => {
4131
- RJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (W, q, H) => g2(J, W, q, H), J.min = (W, q) => J.check(f(W, q)), J.max = (W, q) => J.check(p(W, q));
4132
- let Y = J._zod.bag;
4133
- J.minDate = Y.minimum ? new Date(Y.minimum) : null, J.maxDate = Y.maximum ? new Date(Y.maximum) : null;
4134
- });
4135
- var BY = U("ZodArray", (J, X) => {
4136
- NJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => m2(J, Y, W, q), J.element = X.element, J.min = (Y, W) => J.check(G0(Y, W)), J.nonempty = (Y) => J.check(G0(1, Y)), J.max = (Y, W) => J.check(t0(Y, W)), J.length = (Y, W) => J.check(a0(Y, W)), J.unwrap = () => J.element;
4137
- });
4138
- function i4(J, X) {
4139
- return L2(BY, J, X);
4140
- }
4141
- var QY = U("ZodObject", (J, X) => {
4142
- ZJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => f2(J, Y, W, q), F.defineLazy(J, "shape", () => {
4143
- return X.shape;
4144
- }), J.keyof = () => a4(Object.keys(J._zod.def.shape)), J.catchall = (Y) => J.clone({
4145
- ...J._zod.def,
4146
- catchall: Y
4147
- }), J.passthrough = () => J.clone({
4148
- ...J._zod.def,
4149
- catchall: K8()
4150
- }), J.loose = () => J.clone({
4151
- ...J._zod.def,
4152
- catchall: K8()
4153
- }), J.strict = () => J.clone({
4154
- ...J._zod.def,
4155
- catchall: HY()
4156
- }), J.strip = () => J.clone({
4157
- ...J._zod.def,
4158
- catchall: void 0
4159
- }), J.extend = (Y) => {
4160
- return F.extend(J, Y);
4161
- }, J.safeExtend = (Y) => {
4162
- return F.safeExtend(J, Y);
4163
- }, J.merge = (Y) => F.merge(J, Y), J.pick = (Y) => F.pick(J, Y), J.omit = (Y) => F.omit(J, Y), J.partial = (...Y) => F.partial(j8, J, Y[0]), J.required = (...Y) => F.required(h8, J, Y[0]);
4164
- });
4165
- var zY = U("ZodUnion", (J, X) => {
4166
- _J.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => o2(J, Y, W, q), J.options = X.options;
4167
- });
4168
- function GY(J, X) {
4169
- return new zY({
4170
- type: "union",
4171
- options: J,
4172
- ...F.normalizeParams(X)
4173
- });
4174
- }
4175
- var UY = U("ZodIntersection", (J, X) => {
4176
- bJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => r2(J, Y, W, q);
4177
- });
4178
- function IY(J, X) {
4179
- return new UY({
4180
- type: "intersection",
4181
- left: J,
4182
- right: X
4183
- });
4184
- }
4185
- var wY = U("ZodRecord", (J, X) => {
4186
- CJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => l2(J, Y, W, q), J.keyType = X.keyType, J.valueType = X.valueType;
4187
- });
4188
- var r4 = U("ZodEnum", (J, X) => {
4189
- kJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (W, q, H) => u2(J, W, q, H), J.enum = X.entries, J.options = Object.values(X.entries);
4190
- let Y = new Set(Object.keys(X.entries));
4191
- J.extract = (W, q) => {
4192
- let H = {};
4193
- for (let B of W) if (Y.has(B)) H[B] = X.entries[B];
4194
- else throw Error(`Key ${B} not found in enum`);
4195
- return new r4({
4196
- ...X,
4197
- checks: [],
4198
- ...F.normalizeParams(q),
4199
- entries: H
4200
- });
4201
- }, J.exclude = (W, q) => {
4202
- let H = { ...X.entries };
4203
- for (let B of W) if (Y.has(B)) delete H[B];
4204
- else throw Error(`Key ${B} not found in enum`);
4205
- return new r4({
4206
- ...X,
4207
- checks: [],
4208
- ...F.normalizeParams(q),
4209
- entries: H
4210
- });
4211
- };
4212
- });
4213
- function a4(J, X) {
4214
- return new r4({
4215
- type: "enum",
4216
- entries: Array.isArray(J) ? Object.fromEntries(J.map((W) => [W, W])) : J,
4217
- ...F.normalizeParams(X)
4218
- });
4219
- }
4220
- var DY = U("ZodTransform", (J, X) => {
4221
- TJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => y2(J, Y, W, q), J._zod.parse = (Y, W) => {
4222
- if (W.direction === "backward") throw new O0(J.constructor.name);
4223
- Y.addIssue = (H) => {
4224
- if (typeof H === "string") Y.issues.push(F.issue(H, Y.value, X));
4225
- else {
4226
- let B = H;
4227
- if (B.fatal) B.continue = !1;
4228
- B.code ?? (B.code = "custom"), B.input ?? (B.input = Y.value), B.inst ?? (B.inst = J), Y.issues.push(F.issue(B));
4229
- }
4230
- };
4231
- let q = X.transform(Y.value, Y);
4232
- if (q instanceof Promise) return q.then((H) => {
4233
- return Y.value = H, Y;
4234
- });
4235
- return Y.value = q, Y;
4236
- };
4237
- });
4238
- function PY(J) {
4239
- return new DY({
4240
- type: "transform",
4241
- transform: J
4242
- });
4243
- }
4244
- var j8 = U("ZodOptional", (J, X) => {
4245
- jJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => e2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType;
4246
- });
4247
- function V8(J) {
4248
- return new j8({
4249
- type: "optional",
4250
- innerType: J
4251
- });
4252
- }
4253
- var OY = U("ZodNullable", (J, X) => {
4254
- hJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => p2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType;
4255
- });
4256
- function R8(J) {
4257
- return new OY({
4258
- type: "nullable",
4259
- innerType: J
4260
- });
4261
- }
4262
- var MY = U("ZodDefault", (J, X) => {
4263
- xJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => n2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType, J.removeDefault = J.unwrap;
4264
- });
4265
- function AY(J, X) {
4266
- return new MY({
4267
- type: "default",
4268
- innerType: J,
4269
- get defaultValue() {
4270
- return typeof X === "function" ? X() : F.shallowClone(X);
4271
- }
4272
- });
4273
- }
4274
- var FY = U("ZodPrefault", (J, X) => {
4275
- vJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => i2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType;
4276
- });
4277
- function EY(J, X) {
4278
- return new FY({
4279
- type: "prefault",
4280
- innerType: J,
4281
- get defaultValue() {
4282
- return typeof X === "function" ? X() : F.shallowClone(X);
4283
- }
4284
- });
4285
- }
4286
- var h8 = U("ZodNonOptional", (J, X) => {
4287
- gJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => d2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType;
4288
- });
4289
- function $Y(J, X) {
4290
- return new h8({
4291
- type: "nonoptional",
4292
- innerType: J,
4293
- ...F.normalizeParams(X)
4294
- });
4295
- }
4296
- var KY = U("ZodCatch", (J, X) => {
4297
- uJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => t2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType, J.removeCatch = J.unwrap;
4298
- });
4299
- function VY(J, X) {
4300
- return new KY({
4301
- type: "catch",
4302
- innerType: J,
4303
- catchValue: typeof X === "function" ? X : () => X
4304
- });
4305
- }
4306
- var RY = U("ZodPipe", (J, X) => {
4307
- cJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => a2(J, Y, W, q), J.in = X.in, J.out = X.out;
4308
- });
4309
- function N8(J, X) {
4310
- return new RY({
4311
- type: "pipe",
4312
- in: J,
4313
- out: X
4314
- });
4315
- }
4316
- var NY = U("ZodReadonly", (J, X) => {
4317
- yJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => s2(J, Y, W, q), J.unwrap = () => J._zod.def.innerType;
4318
- });
4319
- function SY(J) {
4320
- return new NY({
4321
- type: "readonly",
4322
- innerType: J
4323
- });
4324
- }
4325
- var LY = U("ZodCustom", (J, X) => {
4326
- mJ.init(J, X), L.init(J, X), J._zod.processJSONSchema = (Y, W, q) => c2(J, Y, W, q);
4327
- });
4328
- function ZY(J, X = {}) {
4329
- return Z2(LY, J, X);
4330
- }
4331
- function _Y(J) {
4332
- return _2(J);
4333
- }
4334
- var I0 = {};
4335
- U6(I0, {
4336
- string: () => bY,
4337
- number: () => CY,
4338
- date: () => jY,
4339
- boolean: () => kY,
4340
- bigint: () => TY
4341
- });
4342
- function bY(J) {
4343
- return lJ(l4, J);
4344
- }
4345
- function CY(J) {
4346
- return M2(e0, J);
4347
- }
4348
- function kY(J) {
4349
- return E2(p4, J);
4350
- }
4351
- function TY(J) {
4352
- return $2(k8, J);
4353
- }
4354
- function jY(J) {
4355
- return S2(d4, J);
4356
- }
4357
- v(L4());
4358
- function hY(J, X = {}) {
4359
- let { provider: Y = "postgresql", clientOutput: W = "../../src/generated/prisma", includePothos: q = !0, pothosOutput: H = "../../src/generated/pothos-types.ts" } = X, B = [], Q = /* @__PURE__ */ new Set();
4360
- J.forEach((I) => {
4361
- if (I.schema) Q.add(I.schema);
4362
- });
4363
- let G = Q.size > 0 ? Array.from(Q) : ["public"];
4364
- if (B.push("datasource db {"), B.push(` provider = "${Y}"`), Q.size > 0) B.push(` schemas = [${G.map((I) => `"${I}"`).join(", ")}]`);
4365
- if (B.push("}"), B.push(""), B.push("generator client {"), B.push(" provider = \"prisma-client\""), B.push(` output = "${W}"`), B.push(""), B.push(" engineType = \"client\""), B.push(" runtime = \"bun\""), B.push(" moduleFormat = \"esm\""), B.push(" generatedFileExtension = \"ts\""), B.push(" importFileExtension = \"ts\""), B.push("}"), B.push(""), q) B.push("generator pothos {"), B.push(" provider = \"prisma-pothos-types\""), B.push(" clientOutput = \"./prisma\""), B.push(` output = "${H}"`), B.push(" generateDatamodel = true"), B.push(" documentation = false"), B.push("}"), B.push("");
4366
- let z = /* @__PURE__ */ new Map();
4367
- return J.forEach((I) => {
4368
- I.enums?.forEach((w) => {
4369
- if (!z.has(w.name)) z.set(w.name, w);
4370
- }), Object.values(I.fields).forEach((w) => {
4371
- if (w.kind === "enum" && w.values && !z.has(w.enumName)) z.set(w.enumName, {
4372
- name: w.enumName,
4373
- values: w.values,
4374
- schema: I.schema
4375
- });
4376
- });
4377
- }), z.forEach((I) => {
4378
- B.push(...g8(I)), B.push("");
4379
- }), J.forEach((I) => {
4380
- B.push(...u8(I)), B.push("");
4381
- }), B.join(`
4382
- `);
4383
- }
4384
- function g8(J) {
4385
- let X = [];
4386
- if (J.description) X.push(`/// ${J.description}`);
4387
- if (X.push(`enum ${J.name} {`), J.values.forEach((Y) => {
4388
- X.push(` ${Y}`);
4389
- }), X.push(""), J.schema) X.push(` @@schema("${J.schema}")`);
4390
- return X.push("}"), X;
4391
- }
4392
- function u8(J) {
4393
- let X = [];
4394
- if (J.description) X.push(`/// ${J.description}`);
4395
- if (X.push(`model ${J.name} {`), Object.entries(J.fields).forEach(([Y, W]) => {
4396
- let q = xY(Y, W);
4397
- if (W.description) X.push(` /// ${W.description}`);
4398
- X.push(` ${q}`);
4399
- }), J.indexes && J.indexes.length > 0) X.push(""), J.indexes.forEach((Y) => {
4400
- X.push(` ${cY(Y)}`);
4401
- });
4402
- if (J.map) X.push(` @@map("${J.map}")`);
4403
- if (J.schema) X.push(` @@schema("${J.schema}")`);
4404
- return X.push("}"), X;
4405
- }
4406
- function xY(J, X) {
4407
- if (X.kind === "scalar") return vY(J, X);
4408
- else if (X.kind === "enum") return gY(J, X);
4409
- else if (X.kind === "relation") return uY(J, X);
4410
- throw Error(`Unknown field kind: ${X.kind}`);
4411
- }
4412
- function vY(J, X) {
4413
- let Y = [J], W = X.type;
4414
- if (X.isArray) W += "[]";
4415
- if (X.isOptional) W += "?";
4416
- Y.push(W);
4417
- let q = [];
4418
- if (X.isId) q.push("@id");
4419
- if (X.default !== void 0) if (typeof X.default === "string" && X.default.includes("(")) q.push(`@default(${X.default})`);
4420
- else if (typeof X.default === "boolean") q.push(`@default(${X.default})`);
4421
- else if (typeof X.default === "number") q.push(`@default(${X.default})`);
4422
- else q.push(`@default("${X.default}")`);
4423
- if (X.updatedAt) q.push("@updatedAt");
4424
- if (X.isUnique) q.push("@unique");
4425
- if (X.map) q.push(`@map("${X.map}")`);
4426
- if (X.dbType) q.push(`@db.${X.dbType}`);
4427
- if (q.length > 0) Y.push(q.join(" "));
4428
- return Y.join(" ");
4429
- }
4430
- function gY(J, X) {
4431
- let Y = [J], W = X.enumName;
4432
- if (X.isArray) W += "[]";
4433
- if (X.isOptional) W += "?";
4434
- Y.push(W);
4435
- let q = [];
4436
- if (X.default !== void 0) q.push(`@default(${X.default})`);
4437
- if (X.isUnique) q.push("@unique");
4438
- if (X.map) q.push(`@map("${X.map}")`);
4439
- if (q.length > 0) Y.push(q.join(" "));
4440
- return Y.join(" ");
4441
- }
4442
- function uY(J, X) {
4443
- let Y = [J], W = X.target;
4444
- if (X.type === "hasMany") W += "[]";
4445
- if (X.type === "hasOne") W += "?";
4446
- Y.push(W);
4447
- let q = [];
4448
- if (X.name) q.push(`name: "${X.name}"`);
4449
- if (X.fields && X.fields.length > 0) q.push(`fields: [${X.fields.join(", ")}]`);
4450
- if (X.references && X.references.length > 0) q.push(`references: [${X.references.join(", ")}]`);
4451
- if (X.onDelete) q.push(`onDelete: ${X.onDelete}`);
4452
- if (X.onUpdate) q.push(`onUpdate: ${X.onUpdate}`);
4453
- if (q.length > 0) Y.push(`@relation(${q.join(", ")})`);
4454
- return Y.join(" ");
4455
- }
4456
- function cY(J) {
4457
- let X = J.fields.join(", "), Y = [];
4458
- if (J.unique) Y.push(`@@unique([${X}]`);
4459
- else Y.push(`@@index([${X}]`);
4460
- let W = [];
4461
- if (J.name) W.push(`name: "${J.name}"`);
4462
- if (J.type) W.push(`type: ${J.type}`);
4463
- if (W.length > 0) Y[0] += `, ${W.join(", ")}`;
4464
- return Y[0] += ")", Y.join("");
4465
- }
4466
- function k5(J, X = {}) {
4467
- let Y = [], W = /* @__PURE__ */ new Map();
4468
- if (J.forEach((q) => {
4469
- q.entities.forEach((H) => {
4470
- Y.push({
4471
- ...H,
4472
- module: q.moduleId
4473
- });
4474
- }), q.enums?.forEach((H) => {
4475
- if (!W.has(H.name)) W.set(H.name, H);
4476
- });
4477
- }), Y[0] && W.size > 0) Y[0] = {
4478
- ...Y[0],
4479
- enums: [...Y[0].enums ?? [], ...W.values()]
4480
- };
4481
- return hY(Y, X);
4482
- }
4483
-
4484
- //#endregion
4485
- export { k5 as composeModuleSchemas };
4486
- //# sourceMappingURL=index.mjs.map