@kbve/droid 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +5 -1
  3. package/assets/canvas-worker-DbsoY2Xv.js +5 -0
  4. package/assets/db-worker-CjXS52DQ.js +14 -0
  5. package/assets/ws-worker-FssAQgaD.js +5 -0
  6. package/droid.cjs.js +1 -1
  7. package/droid.es.js +1 -1
  8. package/index-DSyyyiLP.js +3034 -0
  9. package/main-BYzQVPCs.js +1455 -0
  10. package/package.json +8 -2
  11. package/src/index.ts +3 -0
  12. package/src/lib/droid.spec.ts +26 -0
  13. package/src/lib/droid.ts +5 -0
  14. package/src/lib/mod/mod-manager.ts +72 -0
  15. package/src/lib/mod/mod-urls.ts +3 -0
  16. package/src/lib/mod/module/bento/mod-bento.worker.ts +128 -0
  17. package/src/lib/mod/module/phaser/mod-phaser.ts +0 -0
  18. package/src/lib/mod/module/supabase/mod-supabase.spec.ts +30 -0
  19. package/src/lib/mod/module/supabase/mod-supabase.worker.ts +59 -0
  20. package/src/lib/types/bento.ts +80 -0
  21. package/src/lib/types/discord.ts +40 -0
  22. package/src/lib/types/event-types.ts +35 -0
  23. package/src/lib/types/jedi.ts +66 -0
  24. package/src/lib/types/modules.ts +46 -0
  25. package/src/lib/types/panel-types.ts +18 -0
  26. package/src/lib/types/supabase-esm.d.ts +4 -0
  27. package/src/lib/workers/canvas-worker.ts +107 -0
  28. package/src/lib/workers/data.ts +215 -0
  29. package/src/lib/workers/db-worker.ts +203 -0
  30. package/src/lib/workers/events.ts +52 -0
  31. package/src/lib/workers/flexbuilder.ts +6 -0
  32. package/src/lib/workers/init.ts +40 -0
  33. package/src/lib/workers/main.ts +356 -0
  34. package/src/lib/workers/tools.ts +60 -0
  35. package/src/lib/workers/ws-worker.ts +73 -0
  36. package/src/setup-vitest.ts +2 -0
  37. package/src/types.d.ts +31 -0
@@ -0,0 +1,3034 @@
1
+ async function ss(s) {
2
+ const { main: e } = await import("./main-BYzQVPCs.js");
3
+ return await e(), { initialized: !0 };
4
+ }
5
+ var _;
6
+ (function(s) {
7
+ s.assertEqual = (n) => n;
8
+ function e(n) {
9
+ }
10
+ s.assertIs = e;
11
+ function t(n) {
12
+ throw new Error();
13
+ }
14
+ s.assertNever = t, s.arrayToEnum = (n) => {
15
+ const a = {};
16
+ for (const i of n)
17
+ a[i] = i;
18
+ return a;
19
+ }, s.getValidEnumValues = (n) => {
20
+ const a = s.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {};
21
+ for (const o of a)
22
+ i[o] = n[o];
23
+ return s.objectValues(i);
24
+ }, s.objectValues = (n) => s.objectKeys(n).map(function(a) {
25
+ return n[a];
26
+ }), s.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => {
27
+ const a = [];
28
+ for (const i in n)
29
+ Object.prototype.hasOwnProperty.call(n, i) && a.push(i);
30
+ return a;
31
+ }, s.find = (n, a) => {
32
+ for (const i of n)
33
+ if (a(i))
34
+ return i;
35
+ }, s.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && isFinite(n) && Math.floor(n) === n;
36
+ function r(n, a = " | ") {
37
+ return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
38
+ }
39
+ s.joinValues = r, s.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
40
+ })(_ || (_ = {}));
41
+ var xe;
42
+ (function(s) {
43
+ s.mergeShapes = (e, t) => ({
44
+ ...e,
45
+ ...t
46
+ // second overwrites first
47
+ });
48
+ })(xe || (xe = {}));
49
+ const f = _.arrayToEnum([
50
+ "string",
51
+ "nan",
52
+ "number",
53
+ "integer",
54
+ "float",
55
+ "boolean",
56
+ "date",
57
+ "bigint",
58
+ "symbol",
59
+ "function",
60
+ "undefined",
61
+ "null",
62
+ "array",
63
+ "object",
64
+ "unknown",
65
+ "promise",
66
+ "void",
67
+ "never",
68
+ "map",
69
+ "set"
70
+ ]), O = (s) => {
71
+ switch (typeof s) {
72
+ case "undefined":
73
+ return f.undefined;
74
+ case "string":
75
+ return f.string;
76
+ case "number":
77
+ return isNaN(s) ? f.nan : f.number;
78
+ case "boolean":
79
+ return f.boolean;
80
+ case "function":
81
+ return f.function;
82
+ case "bigint":
83
+ return f.bigint;
84
+ case "symbol":
85
+ return f.symbol;
86
+ case "object":
87
+ return Array.isArray(s) ? f.array : s === null ? f.null : s.then && typeof s.then == "function" && s.catch && typeof s.catch == "function" ? f.promise : typeof Map < "u" && s instanceof Map ? f.map : typeof Set < "u" && s instanceof Set ? f.set : typeof Date < "u" && s instanceof Date ? f.date : f.object;
88
+ default:
89
+ return f.unknown;
90
+ }
91
+ }, d = _.arrayToEnum([
92
+ "invalid_type",
93
+ "invalid_literal",
94
+ "custom",
95
+ "invalid_union",
96
+ "invalid_union_discriminator",
97
+ "invalid_enum_value",
98
+ "unrecognized_keys",
99
+ "invalid_arguments",
100
+ "invalid_return_type",
101
+ "invalid_date",
102
+ "invalid_string",
103
+ "too_small",
104
+ "too_big",
105
+ "invalid_intersection_types",
106
+ "not_multiple_of",
107
+ "not_finite"
108
+ ]), Be = (s) => JSON.stringify(s, null, 2).replace(/"([^"]+)":/g, "$1:");
109
+ class Z extends Error {
110
+ get errors() {
111
+ return this.issues;
112
+ }
113
+ constructor(e) {
114
+ super(), this.issues = [], this.addIssue = (r) => {
115
+ this.issues = [...this.issues, r];
116
+ }, this.addIssues = (r = []) => {
117
+ this.issues = [...this.issues, ...r];
118
+ };
119
+ const t = new.target.prototype;
120
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
121
+ }
122
+ format(e) {
123
+ const t = e || function(a) {
124
+ return a.message;
125
+ }, r = { _errors: [] }, n = (a) => {
126
+ for (const i of a.issues)
127
+ if (i.code === "invalid_union")
128
+ i.unionErrors.map(n);
129
+ else if (i.code === "invalid_return_type")
130
+ n(i.returnTypeError);
131
+ else if (i.code === "invalid_arguments")
132
+ n(i.argumentsError);
133
+ else if (i.path.length === 0)
134
+ r._errors.push(t(i));
135
+ else {
136
+ let o = r, u = 0;
137
+ for (; u < i.path.length; ) {
138
+ const c = i.path[u];
139
+ u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
140
+ }
141
+ }
142
+ };
143
+ return n(this), r;
144
+ }
145
+ static assert(e) {
146
+ if (!(e instanceof Z))
147
+ throw new Error(`Not a ZodError: ${e}`);
148
+ }
149
+ toString() {
150
+ return this.message;
151
+ }
152
+ get message() {
153
+ return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
154
+ }
155
+ get isEmpty() {
156
+ return this.issues.length === 0;
157
+ }
158
+ flatten(e = (t) => t.message) {
159
+ const t = {}, r = [];
160
+ for (const n of this.issues)
161
+ n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : r.push(e(n));
162
+ return { formErrors: r, fieldErrors: t };
163
+ }
164
+ get formErrors() {
165
+ return this.flatten();
166
+ }
167
+ }
168
+ Z.create = (s) => new Z(s);
169
+ const Y = (s, e) => {
170
+ let t;
171
+ switch (s.code) {
172
+ case d.invalid_type:
173
+ s.received === f.undefined ? t = "Required" : t = `Expected ${s.expected}, received ${s.received}`;
174
+ break;
175
+ case d.invalid_literal:
176
+ t = `Invalid literal value, expected ${JSON.stringify(s.expected, _.jsonStringifyReplacer)}`;
177
+ break;
178
+ case d.unrecognized_keys:
179
+ t = `Unrecognized key(s) in object: ${_.joinValues(s.keys, ", ")}`;
180
+ break;
181
+ case d.invalid_union:
182
+ t = "Invalid input";
183
+ break;
184
+ case d.invalid_union_discriminator:
185
+ t = `Invalid discriminator value. Expected ${_.joinValues(s.options)}`;
186
+ break;
187
+ case d.invalid_enum_value:
188
+ t = `Invalid enum value. Expected ${_.joinValues(s.options)}, received '${s.received}'`;
189
+ break;
190
+ case d.invalid_arguments:
191
+ t = "Invalid function arguments";
192
+ break;
193
+ case d.invalid_return_type:
194
+ t = "Invalid function return type";
195
+ break;
196
+ case d.invalid_date:
197
+ t = "Invalid date";
198
+ break;
199
+ case d.invalid_string:
200
+ typeof s.validation == "object" ? "includes" in s.validation ? (t = `Invalid input: must include "${s.validation.includes}"`, typeof s.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${s.validation.position}`)) : "startsWith" in s.validation ? t = `Invalid input: must start with "${s.validation.startsWith}"` : "endsWith" in s.validation ? t = `Invalid input: must end with "${s.validation.endsWith}"` : _.assertNever(s.validation) : s.validation !== "regex" ? t = `Invalid ${s.validation}` : t = "Invalid";
201
+ break;
202
+ case d.too_small:
203
+ s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "more than"} ${s.minimum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at least" : "over"} ${s.minimum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${s.minimum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly equal to " : s.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(s.minimum))}` : t = "Invalid input";
204
+ break;
205
+ case d.too_big:
206
+ s.type === "array" ? t = `Array must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "less than"} ${s.maximum} element(s)` : s.type === "string" ? t = `String must contain ${s.exact ? "exactly" : s.inclusive ? "at most" : "under"} ${s.maximum} character(s)` : s.type === "number" ? t = `Number must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "bigint" ? t = `BigInt must be ${s.exact ? "exactly" : s.inclusive ? "less than or equal to" : "less than"} ${s.maximum}` : s.type === "date" ? t = `Date must be ${s.exact ? "exactly" : s.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(s.maximum))}` : t = "Invalid input";
207
+ break;
208
+ case d.custom:
209
+ t = "Invalid input";
210
+ break;
211
+ case d.invalid_intersection_types:
212
+ t = "Intersection results could not be merged";
213
+ break;
214
+ case d.not_multiple_of:
215
+ t = `Number must be a multiple of ${s.multipleOf}`;
216
+ break;
217
+ case d.not_finite:
218
+ t = "Number must be finite";
219
+ break;
220
+ default:
221
+ t = e.defaultError, _.assertNever(s);
222
+ }
223
+ return { message: t };
224
+ };
225
+ let Ie = Y;
226
+ function Fe(s) {
227
+ Ie = s;
228
+ }
229
+ function fe() {
230
+ return Ie;
231
+ }
232
+ const he = (s) => {
233
+ const { data: e, path: t, errorMaps: r, issueData: n } = s, a = [...t, ...n.path || []], i = {
234
+ ...n,
235
+ path: a
236
+ };
237
+ if (n.message !== void 0)
238
+ return {
239
+ ...n,
240
+ path: a,
241
+ message: n.message
242
+ };
243
+ let o = "";
244
+ const u = r.filter((c) => !!c).slice().reverse();
245
+ for (const c of u)
246
+ o = c(i, { data: e, defaultError: o }).message;
247
+ return {
248
+ ...n,
249
+ path: a,
250
+ message: o
251
+ };
252
+ }, ze = [];
253
+ function l(s, e) {
254
+ const t = fe(), r = he({
255
+ issueData: e,
256
+ data: s.data,
257
+ path: s.path,
258
+ errorMaps: [
259
+ s.common.contextualErrorMap,
260
+ // contextual error map is first priority
261
+ s.schemaErrorMap,
262
+ // then schema-bound map if available
263
+ t,
264
+ // then global override map
265
+ t === Y ? void 0 : Y
266
+ // then global default map
267
+ ].filter((n) => !!n)
268
+ });
269
+ s.common.issues.push(r);
270
+ }
271
+ class x {
272
+ constructor() {
273
+ this.value = "valid";
274
+ }
275
+ dirty() {
276
+ this.value === "valid" && (this.value = "dirty");
277
+ }
278
+ abort() {
279
+ this.value !== "aborted" && (this.value = "aborted");
280
+ }
281
+ static mergeArray(e, t) {
282
+ const r = [];
283
+ for (const n of t) {
284
+ if (n.status === "aborted")
285
+ return g;
286
+ n.status === "dirty" && e.dirty(), r.push(n.value);
287
+ }
288
+ return { status: e.value, value: r };
289
+ }
290
+ static async mergeObjectAsync(e, t) {
291
+ const r = [];
292
+ for (const n of t) {
293
+ const a = await n.key, i = await n.value;
294
+ r.push({
295
+ key: a,
296
+ value: i
297
+ });
298
+ }
299
+ return x.mergeObjectSync(e, r);
300
+ }
301
+ static mergeObjectSync(e, t) {
302
+ const r = {};
303
+ for (const n of t) {
304
+ const { key: a, value: i } = n;
305
+ if (a.status === "aborted" || i.status === "aborted")
306
+ return g;
307
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || n.alwaysSet) && (r[a.value] = i.value);
308
+ }
309
+ return { status: e.value, value: r };
310
+ }
311
+ }
312
+ const g = Object.freeze({
313
+ status: "aborted"
314
+ }), U = (s) => ({ status: "dirty", value: s }), w = (s) => ({ status: "valid", value: s }), Ce = (s) => s.status === "aborted", we = (s) => s.status === "dirty", L = (s) => s.status === "valid", K = (s) => typeof Promise < "u" && s instanceof Promise;
315
+ function pe(s, e, t, r) {
316
+ if (typeof e == "function" ? s !== e || !0 : !e.has(s)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
317
+ return e.get(s);
318
+ }
319
+ function Ne(s, e, t, r, n) {
320
+ if (typeof e == "function" ? s !== e || !0 : !e.has(s)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
321
+ return e.set(s, t), t;
322
+ }
323
+ var h;
324
+ (function(s) {
325
+ s.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, s.toString = (e) => typeof e == "string" ? e : e?.message;
326
+ })(h || (h = {}));
327
+ var $, D;
328
+ class J {
329
+ constructor(e, t, r, n) {
330
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = n;
331
+ }
332
+ get path() {
333
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
334
+ }
335
+ }
336
+ const Re = (s, e) => {
337
+ if (L(e))
338
+ return { success: !0, data: e.value };
339
+ if (!s.common.issues.length)
340
+ throw new Error("Validation failed but no issues detected.");
341
+ return {
342
+ success: !1,
343
+ get error() {
344
+ if (this._error)
345
+ return this._error;
346
+ const t = new Z(s.common.issues);
347
+ return this._error = t, this._error;
348
+ }
349
+ };
350
+ };
351
+ function y(s) {
352
+ if (!s)
353
+ return {};
354
+ const { errorMap: e, invalid_type_error: t, required_error: r, description: n } = s;
355
+ if (e && (t || r))
356
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
357
+ return e ? { errorMap: e, description: n } : { errorMap: (i, o) => {
358
+ var u, c;
359
+ const { message: p } = s;
360
+ return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ?? r) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = p ?? t) !== null && c !== void 0 ? c : o.defaultError };
361
+ }, description: n };
362
+ }
363
+ class v {
364
+ get description() {
365
+ return this._def.description;
366
+ }
367
+ _getType(e) {
368
+ return O(e.data);
369
+ }
370
+ _getOrReturnCtx(e, t) {
371
+ return t || {
372
+ common: e.parent.common,
373
+ data: e.data,
374
+ parsedType: O(e.data),
375
+ schemaErrorMap: this._def.errorMap,
376
+ path: e.path,
377
+ parent: e.parent
378
+ };
379
+ }
380
+ _processInputParams(e) {
381
+ return {
382
+ status: new x(),
383
+ ctx: {
384
+ common: e.parent.common,
385
+ data: e.data,
386
+ parsedType: O(e.data),
387
+ schemaErrorMap: this._def.errorMap,
388
+ path: e.path,
389
+ parent: e.parent
390
+ }
391
+ };
392
+ }
393
+ _parseSync(e) {
394
+ const t = this._parse(e);
395
+ if (K(t))
396
+ throw new Error("Synchronous parse encountered promise.");
397
+ return t;
398
+ }
399
+ _parseAsync(e) {
400
+ const t = this._parse(e);
401
+ return Promise.resolve(t);
402
+ }
403
+ parse(e, t) {
404
+ const r = this.safeParse(e, t);
405
+ if (r.success)
406
+ return r.data;
407
+ throw r.error;
408
+ }
409
+ safeParse(e, t) {
410
+ var r;
411
+ const n = {
412
+ common: {
413
+ issues: [],
414
+ async: (r = t?.async) !== null && r !== void 0 ? r : !1,
415
+ contextualErrorMap: t?.errorMap
416
+ },
417
+ path: t?.path || [],
418
+ schemaErrorMap: this._def.errorMap,
419
+ parent: null,
420
+ data: e,
421
+ parsedType: O(e)
422
+ }, a = this._parseSync({ data: e, path: n.path, parent: n });
423
+ return Re(n, a);
424
+ }
425
+ "~validate"(e) {
426
+ var t, r;
427
+ const n = {
428
+ common: {
429
+ issues: [],
430
+ async: !!this["~standard"].async
431
+ },
432
+ path: [],
433
+ schemaErrorMap: this._def.errorMap,
434
+ parent: null,
435
+ data: e,
436
+ parsedType: O(e)
437
+ };
438
+ if (!this["~standard"].async)
439
+ try {
440
+ const a = this._parseSync({ data: e, path: [], parent: n });
441
+ return L(a) ? {
442
+ value: a.value
443
+ } : {
444
+ issues: n.common.issues
445
+ };
446
+ } catch (a) {
447
+ !((r = (t = a?.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || r === void 0) && r.includes("encountered") && (this["~standard"].async = !0), n.common = {
448
+ issues: [],
449
+ async: !0
450
+ };
451
+ }
452
+ return this._parseAsync({ data: e, path: [], parent: n }).then((a) => L(a) ? {
453
+ value: a.value
454
+ } : {
455
+ issues: n.common.issues
456
+ });
457
+ }
458
+ async parseAsync(e, t) {
459
+ const r = await this.safeParseAsync(e, t);
460
+ if (r.success)
461
+ return r.data;
462
+ throw r.error;
463
+ }
464
+ async safeParseAsync(e, t) {
465
+ const r = {
466
+ common: {
467
+ issues: [],
468
+ contextualErrorMap: t?.errorMap,
469
+ async: !0
470
+ },
471
+ path: t?.path || [],
472
+ schemaErrorMap: this._def.errorMap,
473
+ parent: null,
474
+ data: e,
475
+ parsedType: O(e)
476
+ }, n = this._parse({ data: e, path: r.path, parent: r }), a = await (K(n) ? n : Promise.resolve(n));
477
+ return Re(r, a);
478
+ }
479
+ refine(e, t) {
480
+ const r = (n) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(n) : t;
481
+ return this._refinement((n, a) => {
482
+ const i = e(n), o = () => a.addIssue({
483
+ code: d.custom,
484
+ ...r(n)
485
+ });
486
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
487
+ });
488
+ }
489
+ refinement(e, t) {
490
+ return this._refinement((r, n) => e(r) ? !0 : (n.addIssue(typeof t == "function" ? t(r, n) : t), !1));
491
+ }
492
+ _refinement(e) {
493
+ return new S({
494
+ schema: this,
495
+ typeName: m.ZodEffects,
496
+ effect: { type: "refinement", refinement: e }
497
+ });
498
+ }
499
+ superRefine(e) {
500
+ return this._refinement(e);
501
+ }
502
+ constructor(e) {
503
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
504
+ version: 1,
505
+ vendor: "zod",
506
+ validate: (t) => this["~validate"](t)
507
+ };
508
+ }
509
+ optional() {
510
+ return A.create(this, this._def);
511
+ }
512
+ nullable() {
513
+ return W.create(this, this._def);
514
+ }
515
+ nullish() {
516
+ return this.nullable().optional();
517
+ }
518
+ array() {
519
+ return R.create(this);
520
+ }
521
+ promise() {
522
+ return X.create(this, this._def);
523
+ }
524
+ or(e) {
525
+ return te.create([this, e], this._def);
526
+ }
527
+ and(e) {
528
+ return se.create(this, e, this._def);
529
+ }
530
+ transform(e) {
531
+ return new S({
532
+ ...y(this._def),
533
+ schema: this,
534
+ typeName: m.ZodEffects,
535
+ effect: { type: "transform", transform: e }
536
+ });
537
+ }
538
+ default(e) {
539
+ const t = typeof e == "function" ? e : () => e;
540
+ return new oe({
541
+ ...y(this._def),
542
+ innerType: this,
543
+ defaultValue: t,
544
+ typeName: m.ZodDefault
545
+ });
546
+ }
547
+ brand() {
548
+ return new Te({
549
+ typeName: m.ZodBranded,
550
+ type: this,
551
+ ...y(this._def)
552
+ });
553
+ }
554
+ catch(e) {
555
+ const t = typeof e == "function" ? e : () => e;
556
+ return new de({
557
+ ...y(this._def),
558
+ innerType: this,
559
+ catchValue: t,
560
+ typeName: m.ZodCatch
561
+ });
562
+ }
563
+ describe(e) {
564
+ const t = this.constructor;
565
+ return new t({
566
+ ...this._def,
567
+ description: e
568
+ });
569
+ }
570
+ pipe(e) {
571
+ return le.create(this, e);
572
+ }
573
+ readonly() {
574
+ return ce.create(this);
575
+ }
576
+ isOptional() {
577
+ return this.safeParse(void 0).success;
578
+ }
579
+ isNullable() {
580
+ return this.safeParse(null).success;
581
+ }
582
+ }
583
+ const Ue = /^c[^\s-]{8,}$/i, Me = /^[0-9a-z]+$/, Ye = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Pe = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, Xe = /^[a-z0-9_-]{21}$/i, $e = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, De = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ke = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, He = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
584
+ let ke;
585
+ const qe = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, et = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, tt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, st = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, rt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, nt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Oe = "((\\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])))", at = new RegExp(`^${Oe}$`);
586
+ function Ee(s) {
587
+ let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
588
+ return s.precision ? e = `${e}\\.\\d{${s.precision}}` : s.precision == null && (e = `${e}(\\.\\d+)?`), e;
589
+ }
590
+ function it(s) {
591
+ return new RegExp(`^${Ee(s)}$`);
592
+ }
593
+ function Ve(s) {
594
+ let e = `${Oe}T${Ee(s)}`;
595
+ const t = [];
596
+ return t.push(s.local ? "Z?" : "Z"), s.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
597
+ }
598
+ function ot(s, e) {
599
+ return !!((e === "v4" || !e) && qe.test(s) || (e === "v6" || !e) && tt.test(s));
600
+ }
601
+ function dt(s, e) {
602
+ if (!$e.test(s))
603
+ return !1;
604
+ try {
605
+ const [t] = s.split("."), r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), n = JSON.parse(atob(r));
606
+ return !(typeof n != "object" || n === null || !n.typ || !n.alg || e && n.alg !== e);
607
+ } catch {
608
+ return !1;
609
+ }
610
+ }
611
+ function ct(s, e) {
612
+ return !!((e === "v4" || !e) && et.test(s) || (e === "v6" || !e) && st.test(s));
613
+ }
614
+ class T extends v {
615
+ _parse(e) {
616
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
617
+ const a = this._getOrReturnCtx(e);
618
+ return l(a, {
619
+ code: d.invalid_type,
620
+ expected: f.string,
621
+ received: a.parsedType
622
+ }), g;
623
+ }
624
+ const r = new x();
625
+ let n;
626
+ for (const a of this._def.checks)
627
+ if (a.kind === "min")
628
+ e.data.length < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
629
+ code: d.too_small,
630
+ minimum: a.value,
631
+ type: "string",
632
+ inclusive: !0,
633
+ exact: !1,
634
+ message: a.message
635
+ }), r.dirty());
636
+ else if (a.kind === "max")
637
+ e.data.length > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
638
+ code: d.too_big,
639
+ maximum: a.value,
640
+ type: "string",
641
+ inclusive: !0,
642
+ exact: !1,
643
+ message: a.message
644
+ }), r.dirty());
645
+ else if (a.kind === "length") {
646
+ const i = e.data.length > a.value, o = e.data.length < a.value;
647
+ (i || o) && (n = this._getOrReturnCtx(e, n), i ? l(n, {
648
+ code: d.too_big,
649
+ maximum: a.value,
650
+ type: "string",
651
+ inclusive: !0,
652
+ exact: !0,
653
+ message: a.message
654
+ }) : o && l(n, {
655
+ code: d.too_small,
656
+ minimum: a.value,
657
+ type: "string",
658
+ inclusive: !0,
659
+ exact: !0,
660
+ message: a.message
661
+ }), r.dirty());
662
+ } else if (a.kind === "email")
663
+ Ke.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
664
+ validation: "email",
665
+ code: d.invalid_string,
666
+ message: a.message
667
+ }), r.dirty());
668
+ else if (a.kind === "emoji")
669
+ ke || (ke = new RegExp(He, "u")), ke.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
670
+ validation: "emoji",
671
+ code: d.invalid_string,
672
+ message: a.message
673
+ }), r.dirty());
674
+ else if (a.kind === "uuid")
675
+ Pe.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
676
+ validation: "uuid",
677
+ code: d.invalid_string,
678
+ message: a.message
679
+ }), r.dirty());
680
+ else if (a.kind === "nanoid")
681
+ Xe.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
682
+ validation: "nanoid",
683
+ code: d.invalid_string,
684
+ message: a.message
685
+ }), r.dirty());
686
+ else if (a.kind === "cuid")
687
+ Ue.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
688
+ validation: "cuid",
689
+ code: d.invalid_string,
690
+ message: a.message
691
+ }), r.dirty());
692
+ else if (a.kind === "cuid2")
693
+ Me.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
694
+ validation: "cuid2",
695
+ code: d.invalid_string,
696
+ message: a.message
697
+ }), r.dirty());
698
+ else if (a.kind === "ulid")
699
+ Ye.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
700
+ validation: "ulid",
701
+ code: d.invalid_string,
702
+ message: a.message
703
+ }), r.dirty());
704
+ else if (a.kind === "url")
705
+ try {
706
+ new URL(e.data);
707
+ } catch {
708
+ n = this._getOrReturnCtx(e, n), l(n, {
709
+ validation: "url",
710
+ code: d.invalid_string,
711
+ message: a.message
712
+ }), r.dirty();
713
+ }
714
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
715
+ validation: "regex",
716
+ code: d.invalid_string,
717
+ message: a.message
718
+ }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (n = this._getOrReturnCtx(e, n), l(n, {
719
+ code: d.invalid_string,
720
+ validation: { includes: a.value, position: a.position },
721
+ message: a.message
722
+ }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
723
+ code: d.invalid_string,
724
+ validation: { startsWith: a.value },
725
+ message: a.message
726
+ }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (n = this._getOrReturnCtx(e, n), l(n, {
727
+ code: d.invalid_string,
728
+ validation: { endsWith: a.value },
729
+ message: a.message
730
+ }), r.dirty()) : a.kind === "datetime" ? Ve(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
731
+ code: d.invalid_string,
732
+ validation: "datetime",
733
+ message: a.message
734
+ }), r.dirty()) : a.kind === "date" ? at.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
735
+ code: d.invalid_string,
736
+ validation: "date",
737
+ message: a.message
738
+ }), r.dirty()) : a.kind === "time" ? it(a).test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
739
+ code: d.invalid_string,
740
+ validation: "time",
741
+ message: a.message
742
+ }), r.dirty()) : a.kind === "duration" ? De.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
743
+ validation: "duration",
744
+ code: d.invalid_string,
745
+ message: a.message
746
+ }), r.dirty()) : a.kind === "ip" ? ot(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
747
+ validation: "ip",
748
+ code: d.invalid_string,
749
+ message: a.message
750
+ }), r.dirty()) : a.kind === "jwt" ? dt(e.data, a.alg) || (n = this._getOrReturnCtx(e, n), l(n, {
751
+ validation: "jwt",
752
+ code: d.invalid_string,
753
+ message: a.message
754
+ }), r.dirty()) : a.kind === "cidr" ? ct(e.data, a.version) || (n = this._getOrReturnCtx(e, n), l(n, {
755
+ validation: "cidr",
756
+ code: d.invalid_string,
757
+ message: a.message
758
+ }), r.dirty()) : a.kind === "base64" ? rt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
759
+ validation: "base64",
760
+ code: d.invalid_string,
761
+ message: a.message
762
+ }), r.dirty()) : a.kind === "base64url" ? nt.test(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
763
+ validation: "base64url",
764
+ code: d.invalid_string,
765
+ message: a.message
766
+ }), r.dirty()) : _.assertNever(a);
767
+ return { status: r.value, value: e.data };
768
+ }
769
+ _regex(e, t, r) {
770
+ return this.refinement((n) => e.test(n), {
771
+ validation: t,
772
+ code: d.invalid_string,
773
+ ...h.errToObj(r)
774
+ });
775
+ }
776
+ _addCheck(e) {
777
+ return new T({
778
+ ...this._def,
779
+ checks: [...this._def.checks, e]
780
+ });
781
+ }
782
+ email(e) {
783
+ return this._addCheck({ kind: "email", ...h.errToObj(e) });
784
+ }
785
+ url(e) {
786
+ return this._addCheck({ kind: "url", ...h.errToObj(e) });
787
+ }
788
+ emoji(e) {
789
+ return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
790
+ }
791
+ uuid(e) {
792
+ return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
793
+ }
794
+ nanoid(e) {
795
+ return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
796
+ }
797
+ cuid(e) {
798
+ return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
799
+ }
800
+ cuid2(e) {
801
+ return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
802
+ }
803
+ ulid(e) {
804
+ return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
805
+ }
806
+ base64(e) {
807
+ return this._addCheck({ kind: "base64", ...h.errToObj(e) });
808
+ }
809
+ base64url(e) {
810
+ return this._addCheck({
811
+ kind: "base64url",
812
+ ...h.errToObj(e)
813
+ });
814
+ }
815
+ jwt(e) {
816
+ return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
817
+ }
818
+ ip(e) {
819
+ return this._addCheck({ kind: "ip", ...h.errToObj(e) });
820
+ }
821
+ cidr(e) {
822
+ return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
823
+ }
824
+ datetime(e) {
825
+ var t, r;
826
+ return typeof e == "string" ? this._addCheck({
827
+ kind: "datetime",
828
+ precision: null,
829
+ offset: !1,
830
+ local: !1,
831
+ message: e
832
+ }) : this._addCheck({
833
+ kind: "datetime",
834
+ precision: typeof e?.precision > "u" ? null : e?.precision,
835
+ offset: (t = e?.offset) !== null && t !== void 0 ? t : !1,
836
+ local: (r = e?.local) !== null && r !== void 0 ? r : !1,
837
+ ...h.errToObj(e?.message)
838
+ });
839
+ }
840
+ date(e) {
841
+ return this._addCheck({ kind: "date", message: e });
842
+ }
843
+ time(e) {
844
+ return typeof e == "string" ? this._addCheck({
845
+ kind: "time",
846
+ precision: null,
847
+ message: e
848
+ }) : this._addCheck({
849
+ kind: "time",
850
+ precision: typeof e?.precision > "u" ? null : e?.precision,
851
+ ...h.errToObj(e?.message)
852
+ });
853
+ }
854
+ duration(e) {
855
+ return this._addCheck({ kind: "duration", ...h.errToObj(e) });
856
+ }
857
+ regex(e, t) {
858
+ return this._addCheck({
859
+ kind: "regex",
860
+ regex: e,
861
+ ...h.errToObj(t)
862
+ });
863
+ }
864
+ includes(e, t) {
865
+ return this._addCheck({
866
+ kind: "includes",
867
+ value: e,
868
+ position: t?.position,
869
+ ...h.errToObj(t?.message)
870
+ });
871
+ }
872
+ startsWith(e, t) {
873
+ return this._addCheck({
874
+ kind: "startsWith",
875
+ value: e,
876
+ ...h.errToObj(t)
877
+ });
878
+ }
879
+ endsWith(e, t) {
880
+ return this._addCheck({
881
+ kind: "endsWith",
882
+ value: e,
883
+ ...h.errToObj(t)
884
+ });
885
+ }
886
+ min(e, t) {
887
+ return this._addCheck({
888
+ kind: "min",
889
+ value: e,
890
+ ...h.errToObj(t)
891
+ });
892
+ }
893
+ max(e, t) {
894
+ return this._addCheck({
895
+ kind: "max",
896
+ value: e,
897
+ ...h.errToObj(t)
898
+ });
899
+ }
900
+ length(e, t) {
901
+ return this._addCheck({
902
+ kind: "length",
903
+ value: e,
904
+ ...h.errToObj(t)
905
+ });
906
+ }
907
+ /**
908
+ * Equivalent to `.min(1)`
909
+ */
910
+ nonempty(e) {
911
+ return this.min(1, h.errToObj(e));
912
+ }
913
+ trim() {
914
+ return new T({
915
+ ...this._def,
916
+ checks: [...this._def.checks, { kind: "trim" }]
917
+ });
918
+ }
919
+ toLowerCase() {
920
+ return new T({
921
+ ...this._def,
922
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
923
+ });
924
+ }
925
+ toUpperCase() {
926
+ return new T({
927
+ ...this._def,
928
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
929
+ });
930
+ }
931
+ get isDatetime() {
932
+ return !!this._def.checks.find((e) => e.kind === "datetime");
933
+ }
934
+ get isDate() {
935
+ return !!this._def.checks.find((e) => e.kind === "date");
936
+ }
937
+ get isTime() {
938
+ return !!this._def.checks.find((e) => e.kind === "time");
939
+ }
940
+ get isDuration() {
941
+ return !!this._def.checks.find((e) => e.kind === "duration");
942
+ }
943
+ get isEmail() {
944
+ return !!this._def.checks.find((e) => e.kind === "email");
945
+ }
946
+ get isURL() {
947
+ return !!this._def.checks.find((e) => e.kind === "url");
948
+ }
949
+ get isEmoji() {
950
+ return !!this._def.checks.find((e) => e.kind === "emoji");
951
+ }
952
+ get isUUID() {
953
+ return !!this._def.checks.find((e) => e.kind === "uuid");
954
+ }
955
+ get isNANOID() {
956
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
957
+ }
958
+ get isCUID() {
959
+ return !!this._def.checks.find((e) => e.kind === "cuid");
960
+ }
961
+ get isCUID2() {
962
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
963
+ }
964
+ get isULID() {
965
+ return !!this._def.checks.find((e) => e.kind === "ulid");
966
+ }
967
+ get isIP() {
968
+ return !!this._def.checks.find((e) => e.kind === "ip");
969
+ }
970
+ get isCIDR() {
971
+ return !!this._def.checks.find((e) => e.kind === "cidr");
972
+ }
973
+ get isBase64() {
974
+ return !!this._def.checks.find((e) => e.kind === "base64");
975
+ }
976
+ get isBase64url() {
977
+ return !!this._def.checks.find((e) => e.kind === "base64url");
978
+ }
979
+ get minLength() {
980
+ let e = null;
981
+ for (const t of this._def.checks)
982
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
983
+ return e;
984
+ }
985
+ get maxLength() {
986
+ let e = null;
987
+ for (const t of this._def.checks)
988
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
989
+ return e;
990
+ }
991
+ }
992
+ T.create = (s) => {
993
+ var e;
994
+ return new T({
995
+ checks: [],
996
+ typeName: m.ZodString,
997
+ coerce: (e = s?.coerce) !== null && e !== void 0 ? e : !1,
998
+ ...y(s)
999
+ });
1000
+ };
1001
+ function lt(s, e) {
1002
+ const t = (s.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, n = t > r ? t : r, a = parseInt(s.toFixed(n).replace(".", "")), i = parseInt(e.toFixed(n).replace(".", ""));
1003
+ return a % i / Math.pow(10, n);
1004
+ }
1005
+ class V extends v {
1006
+ constructor() {
1007
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1008
+ }
1009
+ _parse(e) {
1010
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1011
+ const a = this._getOrReturnCtx(e);
1012
+ return l(a, {
1013
+ code: d.invalid_type,
1014
+ expected: f.number,
1015
+ received: a.parsedType
1016
+ }), g;
1017
+ }
1018
+ let r;
1019
+ const n = new x();
1020
+ for (const a of this._def.checks)
1021
+ a.kind === "int" ? _.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1022
+ code: d.invalid_type,
1023
+ expected: "integer",
1024
+ received: "float",
1025
+ message: a.message
1026
+ }), n.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1027
+ code: d.too_small,
1028
+ minimum: a.value,
1029
+ type: "number",
1030
+ inclusive: a.inclusive,
1031
+ exact: !1,
1032
+ message: a.message
1033
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1034
+ code: d.too_big,
1035
+ maximum: a.value,
1036
+ type: "number",
1037
+ inclusive: a.inclusive,
1038
+ exact: !1,
1039
+ message: a.message
1040
+ }), n.dirty()) : a.kind === "multipleOf" ? lt(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), l(r, {
1041
+ code: d.not_multiple_of,
1042
+ multipleOf: a.value,
1043
+ message: a.message
1044
+ }), n.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
1045
+ code: d.not_finite,
1046
+ message: a.message
1047
+ }), n.dirty()) : _.assertNever(a);
1048
+ return { status: n.value, value: e.data };
1049
+ }
1050
+ gte(e, t) {
1051
+ return this.setLimit("min", e, !0, h.toString(t));
1052
+ }
1053
+ gt(e, t) {
1054
+ return this.setLimit("min", e, !1, h.toString(t));
1055
+ }
1056
+ lte(e, t) {
1057
+ return this.setLimit("max", e, !0, h.toString(t));
1058
+ }
1059
+ lt(e, t) {
1060
+ return this.setLimit("max", e, !1, h.toString(t));
1061
+ }
1062
+ setLimit(e, t, r, n) {
1063
+ return new V({
1064
+ ...this._def,
1065
+ checks: [
1066
+ ...this._def.checks,
1067
+ {
1068
+ kind: e,
1069
+ value: t,
1070
+ inclusive: r,
1071
+ message: h.toString(n)
1072
+ }
1073
+ ]
1074
+ });
1075
+ }
1076
+ _addCheck(e) {
1077
+ return new V({
1078
+ ...this._def,
1079
+ checks: [...this._def.checks, e]
1080
+ });
1081
+ }
1082
+ int(e) {
1083
+ return this._addCheck({
1084
+ kind: "int",
1085
+ message: h.toString(e)
1086
+ });
1087
+ }
1088
+ positive(e) {
1089
+ return this._addCheck({
1090
+ kind: "min",
1091
+ value: 0,
1092
+ inclusive: !1,
1093
+ message: h.toString(e)
1094
+ });
1095
+ }
1096
+ negative(e) {
1097
+ return this._addCheck({
1098
+ kind: "max",
1099
+ value: 0,
1100
+ inclusive: !1,
1101
+ message: h.toString(e)
1102
+ });
1103
+ }
1104
+ nonpositive(e) {
1105
+ return this._addCheck({
1106
+ kind: "max",
1107
+ value: 0,
1108
+ inclusive: !0,
1109
+ message: h.toString(e)
1110
+ });
1111
+ }
1112
+ nonnegative(e) {
1113
+ return this._addCheck({
1114
+ kind: "min",
1115
+ value: 0,
1116
+ inclusive: !0,
1117
+ message: h.toString(e)
1118
+ });
1119
+ }
1120
+ multipleOf(e, t) {
1121
+ return this._addCheck({
1122
+ kind: "multipleOf",
1123
+ value: e,
1124
+ message: h.toString(t)
1125
+ });
1126
+ }
1127
+ finite(e) {
1128
+ return this._addCheck({
1129
+ kind: "finite",
1130
+ message: h.toString(e)
1131
+ });
1132
+ }
1133
+ safe(e) {
1134
+ return this._addCheck({
1135
+ kind: "min",
1136
+ inclusive: !0,
1137
+ value: Number.MIN_SAFE_INTEGER,
1138
+ message: h.toString(e)
1139
+ })._addCheck({
1140
+ kind: "max",
1141
+ inclusive: !0,
1142
+ value: Number.MAX_SAFE_INTEGER,
1143
+ message: h.toString(e)
1144
+ });
1145
+ }
1146
+ get minValue() {
1147
+ let e = null;
1148
+ for (const t of this._def.checks)
1149
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1150
+ return e;
1151
+ }
1152
+ get maxValue() {
1153
+ let e = null;
1154
+ for (const t of this._def.checks)
1155
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1156
+ return e;
1157
+ }
1158
+ get isInt() {
1159
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
1160
+ }
1161
+ get isFinite() {
1162
+ let e = null, t = null;
1163
+ for (const r of this._def.checks) {
1164
+ if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1165
+ return !0;
1166
+ r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1167
+ }
1168
+ return Number.isFinite(t) && Number.isFinite(e);
1169
+ }
1170
+ }
1171
+ V.create = (s) => new V({
1172
+ checks: [],
1173
+ typeName: m.ZodNumber,
1174
+ coerce: s?.coerce || !1,
1175
+ ...y(s)
1176
+ });
1177
+ class j extends v {
1178
+ constructor() {
1179
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1180
+ }
1181
+ _parse(e) {
1182
+ if (this._def.coerce)
1183
+ try {
1184
+ e.data = BigInt(e.data);
1185
+ } catch {
1186
+ return this._getInvalidInput(e);
1187
+ }
1188
+ if (this._getType(e) !== f.bigint)
1189
+ return this._getInvalidInput(e);
1190
+ let r;
1191
+ const n = new x();
1192
+ for (const a of this._def.checks)
1193
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1194
+ code: d.too_small,
1195
+ type: "bigint",
1196
+ minimum: a.value,
1197
+ inclusive: a.inclusive,
1198
+ message: a.message
1199
+ }), n.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), l(r, {
1200
+ code: d.too_big,
1201
+ type: "bigint",
1202
+ maximum: a.value,
1203
+ inclusive: a.inclusive,
1204
+ message: a.message
1205
+ }), n.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), l(r, {
1206
+ code: d.not_multiple_of,
1207
+ multipleOf: a.value,
1208
+ message: a.message
1209
+ }), n.dirty()) : _.assertNever(a);
1210
+ return { status: n.value, value: e.data };
1211
+ }
1212
+ _getInvalidInput(e) {
1213
+ const t = this._getOrReturnCtx(e);
1214
+ return l(t, {
1215
+ code: d.invalid_type,
1216
+ expected: f.bigint,
1217
+ received: t.parsedType
1218
+ }), g;
1219
+ }
1220
+ gte(e, t) {
1221
+ return this.setLimit("min", e, !0, h.toString(t));
1222
+ }
1223
+ gt(e, t) {
1224
+ return this.setLimit("min", e, !1, h.toString(t));
1225
+ }
1226
+ lte(e, t) {
1227
+ return this.setLimit("max", e, !0, h.toString(t));
1228
+ }
1229
+ lt(e, t) {
1230
+ return this.setLimit("max", e, !1, h.toString(t));
1231
+ }
1232
+ setLimit(e, t, r, n) {
1233
+ return new j({
1234
+ ...this._def,
1235
+ checks: [
1236
+ ...this._def.checks,
1237
+ {
1238
+ kind: e,
1239
+ value: t,
1240
+ inclusive: r,
1241
+ message: h.toString(n)
1242
+ }
1243
+ ]
1244
+ });
1245
+ }
1246
+ _addCheck(e) {
1247
+ return new j({
1248
+ ...this._def,
1249
+ checks: [...this._def.checks, e]
1250
+ });
1251
+ }
1252
+ positive(e) {
1253
+ return this._addCheck({
1254
+ kind: "min",
1255
+ value: BigInt(0),
1256
+ inclusive: !1,
1257
+ message: h.toString(e)
1258
+ });
1259
+ }
1260
+ negative(e) {
1261
+ return this._addCheck({
1262
+ kind: "max",
1263
+ value: BigInt(0),
1264
+ inclusive: !1,
1265
+ message: h.toString(e)
1266
+ });
1267
+ }
1268
+ nonpositive(e) {
1269
+ return this._addCheck({
1270
+ kind: "max",
1271
+ value: BigInt(0),
1272
+ inclusive: !0,
1273
+ message: h.toString(e)
1274
+ });
1275
+ }
1276
+ nonnegative(e) {
1277
+ return this._addCheck({
1278
+ kind: "min",
1279
+ value: BigInt(0),
1280
+ inclusive: !0,
1281
+ message: h.toString(e)
1282
+ });
1283
+ }
1284
+ multipleOf(e, t) {
1285
+ return this._addCheck({
1286
+ kind: "multipleOf",
1287
+ value: e,
1288
+ message: h.toString(t)
1289
+ });
1290
+ }
1291
+ get minValue() {
1292
+ let e = null;
1293
+ for (const t of this._def.checks)
1294
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1295
+ return e;
1296
+ }
1297
+ get maxValue() {
1298
+ let e = null;
1299
+ for (const t of this._def.checks)
1300
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1301
+ return e;
1302
+ }
1303
+ }
1304
+ j.create = (s) => {
1305
+ var e;
1306
+ return new j({
1307
+ checks: [],
1308
+ typeName: m.ZodBigInt,
1309
+ coerce: (e = s?.coerce) !== null && e !== void 0 ? e : !1,
1310
+ ...y(s)
1311
+ });
1312
+ };
1313
+ class H extends v {
1314
+ _parse(e) {
1315
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1316
+ const r = this._getOrReturnCtx(e);
1317
+ return l(r, {
1318
+ code: d.invalid_type,
1319
+ expected: f.boolean,
1320
+ received: r.parsedType
1321
+ }), g;
1322
+ }
1323
+ return w(e.data);
1324
+ }
1325
+ }
1326
+ H.create = (s) => new H({
1327
+ typeName: m.ZodBoolean,
1328
+ coerce: s?.coerce || !1,
1329
+ ...y(s)
1330
+ });
1331
+ class B extends v {
1332
+ _parse(e) {
1333
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1334
+ const a = this._getOrReturnCtx(e);
1335
+ return l(a, {
1336
+ code: d.invalid_type,
1337
+ expected: f.date,
1338
+ received: a.parsedType
1339
+ }), g;
1340
+ }
1341
+ if (isNaN(e.data.getTime())) {
1342
+ const a = this._getOrReturnCtx(e);
1343
+ return l(a, {
1344
+ code: d.invalid_date
1345
+ }), g;
1346
+ }
1347
+ const r = new x();
1348
+ let n;
1349
+ for (const a of this._def.checks)
1350
+ a.kind === "min" ? e.data.getTime() < a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1351
+ code: d.too_small,
1352
+ message: a.message,
1353
+ inclusive: !0,
1354
+ exact: !1,
1355
+ minimum: a.value,
1356
+ type: "date"
1357
+ }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (n = this._getOrReturnCtx(e, n), l(n, {
1358
+ code: d.too_big,
1359
+ message: a.message,
1360
+ inclusive: !0,
1361
+ exact: !1,
1362
+ maximum: a.value,
1363
+ type: "date"
1364
+ }), r.dirty()) : _.assertNever(a);
1365
+ return {
1366
+ status: r.value,
1367
+ value: new Date(e.data.getTime())
1368
+ };
1369
+ }
1370
+ _addCheck(e) {
1371
+ return new B({
1372
+ ...this._def,
1373
+ checks: [...this._def.checks, e]
1374
+ });
1375
+ }
1376
+ min(e, t) {
1377
+ return this._addCheck({
1378
+ kind: "min",
1379
+ value: e.getTime(),
1380
+ message: h.toString(t)
1381
+ });
1382
+ }
1383
+ max(e, t) {
1384
+ return this._addCheck({
1385
+ kind: "max",
1386
+ value: e.getTime(),
1387
+ message: h.toString(t)
1388
+ });
1389
+ }
1390
+ get minDate() {
1391
+ let e = null;
1392
+ for (const t of this._def.checks)
1393
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1394
+ return e != null ? new Date(e) : null;
1395
+ }
1396
+ get maxDate() {
1397
+ let e = null;
1398
+ for (const t of this._def.checks)
1399
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1400
+ return e != null ? new Date(e) : null;
1401
+ }
1402
+ }
1403
+ B.create = (s) => new B({
1404
+ checks: [],
1405
+ coerce: s?.coerce || !1,
1406
+ typeName: m.ZodDate,
1407
+ ...y(s)
1408
+ });
1409
+ class me extends v {
1410
+ _parse(e) {
1411
+ if (this._getType(e) !== f.symbol) {
1412
+ const r = this._getOrReturnCtx(e);
1413
+ return l(r, {
1414
+ code: d.invalid_type,
1415
+ expected: f.symbol,
1416
+ received: r.parsedType
1417
+ }), g;
1418
+ }
1419
+ return w(e.data);
1420
+ }
1421
+ }
1422
+ me.create = (s) => new me({
1423
+ typeName: m.ZodSymbol,
1424
+ ...y(s)
1425
+ });
1426
+ class q extends v {
1427
+ _parse(e) {
1428
+ if (this._getType(e) !== f.undefined) {
1429
+ const r = this._getOrReturnCtx(e);
1430
+ return l(r, {
1431
+ code: d.invalid_type,
1432
+ expected: f.undefined,
1433
+ received: r.parsedType
1434
+ }), g;
1435
+ }
1436
+ return w(e.data);
1437
+ }
1438
+ }
1439
+ q.create = (s) => new q({
1440
+ typeName: m.ZodUndefined,
1441
+ ...y(s)
1442
+ });
1443
+ class ee extends v {
1444
+ _parse(e) {
1445
+ if (this._getType(e) !== f.null) {
1446
+ const r = this._getOrReturnCtx(e);
1447
+ return l(r, {
1448
+ code: d.invalid_type,
1449
+ expected: f.null,
1450
+ received: r.parsedType
1451
+ }), g;
1452
+ }
1453
+ return w(e.data);
1454
+ }
1455
+ }
1456
+ ee.create = (s) => new ee({
1457
+ typeName: m.ZodNull,
1458
+ ...y(s)
1459
+ });
1460
+ class P extends v {
1461
+ constructor() {
1462
+ super(...arguments), this._any = !0;
1463
+ }
1464
+ _parse(e) {
1465
+ return w(e.data);
1466
+ }
1467
+ }
1468
+ P.create = (s) => new P({
1469
+ typeName: m.ZodAny,
1470
+ ...y(s)
1471
+ });
1472
+ class G extends v {
1473
+ constructor() {
1474
+ super(...arguments), this._unknown = !0;
1475
+ }
1476
+ _parse(e) {
1477
+ return w(e.data);
1478
+ }
1479
+ }
1480
+ G.create = (s) => new G({
1481
+ typeName: m.ZodUnknown,
1482
+ ...y(s)
1483
+ });
1484
+ class E extends v {
1485
+ _parse(e) {
1486
+ const t = this._getOrReturnCtx(e);
1487
+ return l(t, {
1488
+ code: d.invalid_type,
1489
+ expected: f.never,
1490
+ received: t.parsedType
1491
+ }), g;
1492
+ }
1493
+ }
1494
+ E.create = (s) => new E({
1495
+ typeName: m.ZodNever,
1496
+ ...y(s)
1497
+ });
1498
+ class ge extends v {
1499
+ _parse(e) {
1500
+ if (this._getType(e) !== f.undefined) {
1501
+ const r = this._getOrReturnCtx(e);
1502
+ return l(r, {
1503
+ code: d.invalid_type,
1504
+ expected: f.void,
1505
+ received: r.parsedType
1506
+ }), g;
1507
+ }
1508
+ return w(e.data);
1509
+ }
1510
+ }
1511
+ ge.create = (s) => new ge({
1512
+ typeName: m.ZodVoid,
1513
+ ...y(s)
1514
+ });
1515
+ class R extends v {
1516
+ _parse(e) {
1517
+ const { ctx: t, status: r } = this._processInputParams(e), n = this._def;
1518
+ if (t.parsedType !== f.array)
1519
+ return l(t, {
1520
+ code: d.invalid_type,
1521
+ expected: f.array,
1522
+ received: t.parsedType
1523
+ }), g;
1524
+ if (n.exactLength !== null) {
1525
+ const i = t.data.length > n.exactLength.value, o = t.data.length < n.exactLength.value;
1526
+ (i || o) && (l(t, {
1527
+ code: i ? d.too_big : d.too_small,
1528
+ minimum: o ? n.exactLength.value : void 0,
1529
+ maximum: i ? n.exactLength.value : void 0,
1530
+ type: "array",
1531
+ inclusive: !0,
1532
+ exact: !0,
1533
+ message: n.exactLength.message
1534
+ }), r.dirty());
1535
+ }
1536
+ if (n.minLength !== null && t.data.length < n.minLength.value && (l(t, {
1537
+ code: d.too_small,
1538
+ minimum: n.minLength.value,
1539
+ type: "array",
1540
+ inclusive: !0,
1541
+ exact: !1,
1542
+ message: n.minLength.message
1543
+ }), r.dirty()), n.maxLength !== null && t.data.length > n.maxLength.value && (l(t, {
1544
+ code: d.too_big,
1545
+ maximum: n.maxLength.value,
1546
+ type: "array",
1547
+ inclusive: !0,
1548
+ exact: !1,
1549
+ message: n.maxLength.message
1550
+ }), r.dirty()), t.common.async)
1551
+ return Promise.all([...t.data].map((i, o) => n.type._parseAsync(new J(t, i, t.path, o)))).then((i) => x.mergeArray(r, i));
1552
+ const a = [...t.data].map((i, o) => n.type._parseSync(new J(t, i, t.path, o)));
1553
+ return x.mergeArray(r, a);
1554
+ }
1555
+ get element() {
1556
+ return this._def.type;
1557
+ }
1558
+ min(e, t) {
1559
+ return new R({
1560
+ ...this._def,
1561
+ minLength: { value: e, message: h.toString(t) }
1562
+ });
1563
+ }
1564
+ max(e, t) {
1565
+ return new R({
1566
+ ...this._def,
1567
+ maxLength: { value: e, message: h.toString(t) }
1568
+ });
1569
+ }
1570
+ length(e, t) {
1571
+ return new R({
1572
+ ...this._def,
1573
+ exactLength: { value: e, message: h.toString(t) }
1574
+ });
1575
+ }
1576
+ nonempty(e) {
1577
+ return this.min(1, e);
1578
+ }
1579
+ }
1580
+ R.create = (s, e) => new R({
1581
+ type: s,
1582
+ minLength: null,
1583
+ maxLength: null,
1584
+ exactLength: null,
1585
+ typeName: m.ZodArray,
1586
+ ...y(e)
1587
+ });
1588
+ function z(s) {
1589
+ if (s instanceof k) {
1590
+ const e = {};
1591
+ for (const t in s.shape) {
1592
+ const r = s.shape[t];
1593
+ e[t] = A.create(z(r));
1594
+ }
1595
+ return new k({
1596
+ ...s._def,
1597
+ shape: () => e
1598
+ });
1599
+ } else return s instanceof R ? new R({
1600
+ ...s._def,
1601
+ type: z(s.element)
1602
+ }) : s instanceof A ? A.create(z(s.unwrap())) : s instanceof W ? W.create(z(s.unwrap())) : s instanceof I ? I.create(s.items.map((e) => z(e))) : s;
1603
+ }
1604
+ class k extends v {
1605
+ constructor() {
1606
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1607
+ }
1608
+ _getCached() {
1609
+ if (this._cached !== null)
1610
+ return this._cached;
1611
+ const e = this._def.shape(), t = _.objectKeys(e);
1612
+ return this._cached = { shape: e, keys: t };
1613
+ }
1614
+ _parse(e) {
1615
+ if (this._getType(e) !== f.object) {
1616
+ const c = this._getOrReturnCtx(e);
1617
+ return l(c, {
1618
+ code: d.invalid_type,
1619
+ expected: f.object,
1620
+ received: c.parsedType
1621
+ }), g;
1622
+ }
1623
+ const { status: r, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1624
+ if (!(this._def.catchall instanceof E && this._def.unknownKeys === "strip"))
1625
+ for (const c in n.data)
1626
+ i.includes(c) || o.push(c);
1627
+ const u = [];
1628
+ for (const c of i) {
1629
+ const p = a[c], C = n.data[c];
1630
+ u.push({
1631
+ key: { status: "valid", value: c },
1632
+ value: p._parse(new J(n, C, n.path, c)),
1633
+ alwaysSet: c in n.data
1634
+ });
1635
+ }
1636
+ if (this._def.catchall instanceof E) {
1637
+ const c = this._def.unknownKeys;
1638
+ if (c === "passthrough")
1639
+ for (const p of o)
1640
+ u.push({
1641
+ key: { status: "valid", value: p },
1642
+ value: { status: "valid", value: n.data[p] }
1643
+ });
1644
+ else if (c === "strict")
1645
+ o.length > 0 && (l(n, {
1646
+ code: d.unrecognized_keys,
1647
+ keys: o
1648
+ }), r.dirty());
1649
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1650
+ } else {
1651
+ const c = this._def.catchall;
1652
+ for (const p of o) {
1653
+ const C = n.data[p];
1654
+ u.push({
1655
+ key: { status: "valid", value: p },
1656
+ value: c._parse(
1657
+ new J(n, C, n.path, p)
1658
+ //, ctx.child(key), value, getParsedType(value)
1659
+ ),
1660
+ alwaysSet: p in n.data
1661
+ });
1662
+ }
1663
+ }
1664
+ return n.common.async ? Promise.resolve().then(async () => {
1665
+ const c = [];
1666
+ for (const p of u) {
1667
+ const C = await p.key, ue = await p.value;
1668
+ c.push({
1669
+ key: C,
1670
+ value: ue,
1671
+ alwaysSet: p.alwaysSet
1672
+ });
1673
+ }
1674
+ return c;
1675
+ }).then((c) => x.mergeObjectSync(r, c)) : x.mergeObjectSync(r, u);
1676
+ }
1677
+ get shape() {
1678
+ return this._def.shape();
1679
+ }
1680
+ strict(e) {
1681
+ return h.errToObj, new k({
1682
+ ...this._def,
1683
+ unknownKeys: "strict",
1684
+ ...e !== void 0 ? {
1685
+ errorMap: (t, r) => {
1686
+ var n, a, i, o;
1687
+ const u = (i = (a = (n = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(n, t, r).message) !== null && i !== void 0 ? i : r.defaultError;
1688
+ return t.code === "unrecognized_keys" ? {
1689
+ message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
1690
+ } : {
1691
+ message: u
1692
+ };
1693
+ }
1694
+ } : {}
1695
+ });
1696
+ }
1697
+ strip() {
1698
+ return new k({
1699
+ ...this._def,
1700
+ unknownKeys: "strip"
1701
+ });
1702
+ }
1703
+ passthrough() {
1704
+ return new k({
1705
+ ...this._def,
1706
+ unknownKeys: "passthrough"
1707
+ });
1708
+ }
1709
+ // const AugmentFactory =
1710
+ // <Def extends ZodObjectDef>(def: Def) =>
1711
+ // <Augmentation extends ZodRawShape>(
1712
+ // augmentation: Augmentation
1713
+ // ): ZodObject<
1714
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1715
+ // Def["unknownKeys"],
1716
+ // Def["catchall"]
1717
+ // > => {
1718
+ // return new ZodObject({
1719
+ // ...def,
1720
+ // shape: () => ({
1721
+ // ...def.shape(),
1722
+ // ...augmentation,
1723
+ // }),
1724
+ // }) as any;
1725
+ // };
1726
+ extend(e) {
1727
+ return new k({
1728
+ ...this._def,
1729
+ shape: () => ({
1730
+ ...this._def.shape(),
1731
+ ...e
1732
+ })
1733
+ });
1734
+ }
1735
+ /**
1736
+ * Prior to zod@1.0.12 there was a bug in the
1737
+ * inferred type of merged objects. Please
1738
+ * upgrade if you are experiencing issues.
1739
+ */
1740
+ merge(e) {
1741
+ return new k({
1742
+ unknownKeys: e._def.unknownKeys,
1743
+ catchall: e._def.catchall,
1744
+ shape: () => ({
1745
+ ...this._def.shape(),
1746
+ ...e._def.shape()
1747
+ }),
1748
+ typeName: m.ZodObject
1749
+ });
1750
+ }
1751
+ // merge<
1752
+ // Incoming extends AnyZodObject,
1753
+ // Augmentation extends Incoming["shape"],
1754
+ // NewOutput extends {
1755
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1756
+ // ? Augmentation[k]["_output"]
1757
+ // : k extends keyof Output
1758
+ // ? Output[k]
1759
+ // : never;
1760
+ // },
1761
+ // NewInput extends {
1762
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1763
+ // ? Augmentation[k]["_input"]
1764
+ // : k extends keyof Input
1765
+ // ? Input[k]
1766
+ // : never;
1767
+ // }
1768
+ // >(
1769
+ // merging: Incoming
1770
+ // ): ZodObject<
1771
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1772
+ // Incoming["_def"]["unknownKeys"],
1773
+ // Incoming["_def"]["catchall"],
1774
+ // NewOutput,
1775
+ // NewInput
1776
+ // > {
1777
+ // const merged: any = new ZodObject({
1778
+ // unknownKeys: merging._def.unknownKeys,
1779
+ // catchall: merging._def.catchall,
1780
+ // shape: () =>
1781
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1782
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1783
+ // }) as any;
1784
+ // return merged;
1785
+ // }
1786
+ setKey(e, t) {
1787
+ return this.augment({ [e]: t });
1788
+ }
1789
+ // merge<Incoming extends AnyZodObject>(
1790
+ // merging: Incoming
1791
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1792
+ // ZodObject<
1793
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1794
+ // Incoming["_def"]["unknownKeys"],
1795
+ // Incoming["_def"]["catchall"]
1796
+ // > {
1797
+ // // const mergedShape = objectUtil.mergeShapes(
1798
+ // // this._def.shape(),
1799
+ // // merging._def.shape()
1800
+ // // );
1801
+ // const merged: any = new ZodObject({
1802
+ // unknownKeys: merging._def.unknownKeys,
1803
+ // catchall: merging._def.catchall,
1804
+ // shape: () =>
1805
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1806
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1807
+ // }) as any;
1808
+ // return merged;
1809
+ // }
1810
+ catchall(e) {
1811
+ return new k({
1812
+ ...this._def,
1813
+ catchall: e
1814
+ });
1815
+ }
1816
+ pick(e) {
1817
+ const t = {};
1818
+ return _.objectKeys(e).forEach((r) => {
1819
+ e[r] && this.shape[r] && (t[r] = this.shape[r]);
1820
+ }), new k({
1821
+ ...this._def,
1822
+ shape: () => t
1823
+ });
1824
+ }
1825
+ omit(e) {
1826
+ const t = {};
1827
+ return _.objectKeys(this.shape).forEach((r) => {
1828
+ e[r] || (t[r] = this.shape[r]);
1829
+ }), new k({
1830
+ ...this._def,
1831
+ shape: () => t
1832
+ });
1833
+ }
1834
+ /**
1835
+ * @deprecated
1836
+ */
1837
+ deepPartial() {
1838
+ return z(this);
1839
+ }
1840
+ partial(e) {
1841
+ const t = {};
1842
+ return _.objectKeys(this.shape).forEach((r) => {
1843
+ const n = this.shape[r];
1844
+ e && !e[r] ? t[r] = n : t[r] = n.optional();
1845
+ }), new k({
1846
+ ...this._def,
1847
+ shape: () => t
1848
+ });
1849
+ }
1850
+ required(e) {
1851
+ const t = {};
1852
+ return _.objectKeys(this.shape).forEach((r) => {
1853
+ if (e && !e[r])
1854
+ t[r] = this.shape[r];
1855
+ else {
1856
+ let a = this.shape[r];
1857
+ for (; a instanceof A; )
1858
+ a = a._def.innerType;
1859
+ t[r] = a;
1860
+ }
1861
+ }), new k({
1862
+ ...this._def,
1863
+ shape: () => t
1864
+ });
1865
+ }
1866
+ keyof() {
1867
+ return je(_.objectKeys(this.shape));
1868
+ }
1869
+ }
1870
+ k.create = (s, e) => new k({
1871
+ shape: () => s,
1872
+ unknownKeys: "strip",
1873
+ catchall: E.create(),
1874
+ typeName: m.ZodObject,
1875
+ ...y(e)
1876
+ });
1877
+ k.strictCreate = (s, e) => new k({
1878
+ shape: () => s,
1879
+ unknownKeys: "strict",
1880
+ catchall: E.create(),
1881
+ typeName: m.ZodObject,
1882
+ ...y(e)
1883
+ });
1884
+ k.lazycreate = (s, e) => new k({
1885
+ shape: s,
1886
+ unknownKeys: "strip",
1887
+ catchall: E.create(),
1888
+ typeName: m.ZodObject,
1889
+ ...y(e)
1890
+ });
1891
+ class te extends v {
1892
+ _parse(e) {
1893
+ const { ctx: t } = this._processInputParams(e), r = this._def.options;
1894
+ function n(a) {
1895
+ for (const o of a)
1896
+ if (o.result.status === "valid")
1897
+ return o.result;
1898
+ for (const o of a)
1899
+ if (o.result.status === "dirty")
1900
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
1901
+ const i = a.map((o) => new Z(o.ctx.common.issues));
1902
+ return l(t, {
1903
+ code: d.invalid_union,
1904
+ unionErrors: i
1905
+ }), g;
1906
+ }
1907
+ if (t.common.async)
1908
+ return Promise.all(r.map(async (a) => {
1909
+ const i = {
1910
+ ...t,
1911
+ common: {
1912
+ ...t.common,
1913
+ issues: []
1914
+ },
1915
+ parent: null
1916
+ };
1917
+ return {
1918
+ result: await a._parseAsync({
1919
+ data: t.data,
1920
+ path: t.path,
1921
+ parent: i
1922
+ }),
1923
+ ctx: i
1924
+ };
1925
+ })).then(n);
1926
+ {
1927
+ let a;
1928
+ const i = [];
1929
+ for (const u of r) {
1930
+ const c = {
1931
+ ...t,
1932
+ common: {
1933
+ ...t.common,
1934
+ issues: []
1935
+ },
1936
+ parent: null
1937
+ }, p = u._parseSync({
1938
+ data: t.data,
1939
+ path: t.path,
1940
+ parent: c
1941
+ });
1942
+ if (p.status === "valid")
1943
+ return p;
1944
+ p.status === "dirty" && !a && (a = { result: p, ctx: c }), c.common.issues.length && i.push(c.common.issues);
1945
+ }
1946
+ if (a)
1947
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
1948
+ const o = i.map((u) => new Z(u));
1949
+ return l(t, {
1950
+ code: d.invalid_union,
1951
+ unionErrors: o
1952
+ }), g;
1953
+ }
1954
+ }
1955
+ get options() {
1956
+ return this._def.options;
1957
+ }
1958
+ }
1959
+ te.create = (s, e) => new te({
1960
+ options: s,
1961
+ typeName: m.ZodUnion,
1962
+ ...y(e)
1963
+ });
1964
+ const N = (s) => s instanceof ne ? N(s.schema) : s instanceof S ? N(s.innerType()) : s instanceof ae ? [s.value] : s instanceof Q ? s.options : s instanceof ie ? _.objectValues(s.enum) : s instanceof oe ? N(s._def.innerType) : s instanceof q ? [void 0] : s instanceof ee ? [null] : s instanceof A ? [void 0, ...N(s.unwrap())] : s instanceof W ? [null, ...N(s.unwrap())] : s instanceof Te || s instanceof ce ? N(s.unwrap()) : s instanceof de ? N(s._def.innerType) : [];
1965
+ class _e extends v {
1966
+ _parse(e) {
1967
+ const { ctx: t } = this._processInputParams(e);
1968
+ if (t.parsedType !== f.object)
1969
+ return l(t, {
1970
+ code: d.invalid_type,
1971
+ expected: f.object,
1972
+ received: t.parsedType
1973
+ }), g;
1974
+ const r = this.discriminator, n = t.data[r], a = this.optionsMap.get(n);
1975
+ return a ? t.common.async ? a._parseAsync({
1976
+ data: t.data,
1977
+ path: t.path,
1978
+ parent: t
1979
+ }) : a._parseSync({
1980
+ data: t.data,
1981
+ path: t.path,
1982
+ parent: t
1983
+ }) : (l(t, {
1984
+ code: d.invalid_union_discriminator,
1985
+ options: Array.from(this.optionsMap.keys()),
1986
+ path: [r]
1987
+ }), g);
1988
+ }
1989
+ get discriminator() {
1990
+ return this._def.discriminator;
1991
+ }
1992
+ get options() {
1993
+ return this._def.options;
1994
+ }
1995
+ get optionsMap() {
1996
+ return this._def.optionsMap;
1997
+ }
1998
+ /**
1999
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2000
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2001
+ * have a different value for each object in the union.
2002
+ * @param discriminator the name of the discriminator property
2003
+ * @param types an array of object schemas
2004
+ * @param params
2005
+ */
2006
+ static create(e, t, r) {
2007
+ const n = /* @__PURE__ */ new Map();
2008
+ for (const a of t) {
2009
+ const i = N(a.shape[e]);
2010
+ if (!i.length)
2011
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2012
+ for (const o of i) {
2013
+ if (n.has(o))
2014
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2015
+ n.set(o, a);
2016
+ }
2017
+ }
2018
+ return new _e({
2019
+ typeName: m.ZodDiscriminatedUnion,
2020
+ discriminator: e,
2021
+ options: t,
2022
+ optionsMap: n,
2023
+ ...y(r)
2024
+ });
2025
+ }
2026
+ }
2027
+ function Ze(s, e) {
2028
+ const t = O(s), r = O(e);
2029
+ if (s === e)
2030
+ return { valid: !0, data: s };
2031
+ if (t === f.object && r === f.object) {
2032
+ const n = _.objectKeys(e), a = _.objectKeys(s).filter((o) => n.indexOf(o) !== -1), i = { ...s, ...e };
2033
+ for (const o of a) {
2034
+ const u = Ze(s[o], e[o]);
2035
+ if (!u.valid)
2036
+ return { valid: !1 };
2037
+ i[o] = u.data;
2038
+ }
2039
+ return { valid: !0, data: i };
2040
+ } else if (t === f.array && r === f.array) {
2041
+ if (s.length !== e.length)
2042
+ return { valid: !1 };
2043
+ const n = [];
2044
+ for (let a = 0; a < s.length; a++) {
2045
+ const i = s[a], o = e[a], u = Ze(i, o);
2046
+ if (!u.valid)
2047
+ return { valid: !1 };
2048
+ n.push(u.data);
2049
+ }
2050
+ return { valid: !0, data: n };
2051
+ } else return t === f.date && r === f.date && +s == +e ? { valid: !0, data: s } : { valid: !1 };
2052
+ }
2053
+ class se extends v {
2054
+ _parse(e) {
2055
+ const { status: t, ctx: r } = this._processInputParams(e), n = (a, i) => {
2056
+ if (Ce(a) || Ce(i))
2057
+ return g;
2058
+ const o = Ze(a.value, i.value);
2059
+ return o.valid ? ((we(a) || we(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(r, {
2060
+ code: d.invalid_intersection_types
2061
+ }), g);
2062
+ };
2063
+ return r.common.async ? Promise.all([
2064
+ this._def.left._parseAsync({
2065
+ data: r.data,
2066
+ path: r.path,
2067
+ parent: r
2068
+ }),
2069
+ this._def.right._parseAsync({
2070
+ data: r.data,
2071
+ path: r.path,
2072
+ parent: r
2073
+ })
2074
+ ]).then(([a, i]) => n(a, i)) : n(this._def.left._parseSync({
2075
+ data: r.data,
2076
+ path: r.path,
2077
+ parent: r
2078
+ }), this._def.right._parseSync({
2079
+ data: r.data,
2080
+ path: r.path,
2081
+ parent: r
2082
+ }));
2083
+ }
2084
+ }
2085
+ se.create = (s, e, t) => new se({
2086
+ left: s,
2087
+ right: e,
2088
+ typeName: m.ZodIntersection,
2089
+ ...y(t)
2090
+ });
2091
+ class I extends v {
2092
+ _parse(e) {
2093
+ const { status: t, ctx: r } = this._processInputParams(e);
2094
+ if (r.parsedType !== f.array)
2095
+ return l(r, {
2096
+ code: d.invalid_type,
2097
+ expected: f.array,
2098
+ received: r.parsedType
2099
+ }), g;
2100
+ if (r.data.length < this._def.items.length)
2101
+ return l(r, {
2102
+ code: d.too_small,
2103
+ minimum: this._def.items.length,
2104
+ inclusive: !0,
2105
+ exact: !1,
2106
+ type: "array"
2107
+ }), g;
2108
+ !this._def.rest && r.data.length > this._def.items.length && (l(r, {
2109
+ code: d.too_big,
2110
+ maximum: this._def.items.length,
2111
+ inclusive: !0,
2112
+ exact: !1,
2113
+ type: "array"
2114
+ }), t.dirty());
2115
+ const a = [...r.data].map((i, o) => {
2116
+ const u = this._def.items[o] || this._def.rest;
2117
+ return u ? u._parse(new J(r, i, r.path, o)) : null;
2118
+ }).filter((i) => !!i);
2119
+ return r.common.async ? Promise.all(a).then((i) => x.mergeArray(t, i)) : x.mergeArray(t, a);
2120
+ }
2121
+ get items() {
2122
+ return this._def.items;
2123
+ }
2124
+ rest(e) {
2125
+ return new I({
2126
+ ...this._def,
2127
+ rest: e
2128
+ });
2129
+ }
2130
+ }
2131
+ I.create = (s, e) => {
2132
+ if (!Array.isArray(s))
2133
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2134
+ return new I({
2135
+ items: s,
2136
+ typeName: m.ZodTuple,
2137
+ rest: null,
2138
+ ...y(e)
2139
+ });
2140
+ };
2141
+ class re extends v {
2142
+ get keySchema() {
2143
+ return this._def.keyType;
2144
+ }
2145
+ get valueSchema() {
2146
+ return this._def.valueType;
2147
+ }
2148
+ _parse(e) {
2149
+ const { status: t, ctx: r } = this._processInputParams(e);
2150
+ if (r.parsedType !== f.object)
2151
+ return l(r, {
2152
+ code: d.invalid_type,
2153
+ expected: f.object,
2154
+ received: r.parsedType
2155
+ }), g;
2156
+ const n = [], a = this._def.keyType, i = this._def.valueType;
2157
+ for (const o in r.data)
2158
+ n.push({
2159
+ key: a._parse(new J(r, o, r.path, o)),
2160
+ value: i._parse(new J(r, r.data[o], r.path, o)),
2161
+ alwaysSet: o in r.data
2162
+ });
2163
+ return r.common.async ? x.mergeObjectAsync(t, n) : x.mergeObjectSync(t, n);
2164
+ }
2165
+ get element() {
2166
+ return this._def.valueType;
2167
+ }
2168
+ static create(e, t, r) {
2169
+ return t instanceof v ? new re({
2170
+ keyType: e,
2171
+ valueType: t,
2172
+ typeName: m.ZodRecord,
2173
+ ...y(r)
2174
+ }) : new re({
2175
+ keyType: T.create(),
2176
+ valueType: e,
2177
+ typeName: m.ZodRecord,
2178
+ ...y(t)
2179
+ });
2180
+ }
2181
+ }
2182
+ class ye extends v {
2183
+ get keySchema() {
2184
+ return this._def.keyType;
2185
+ }
2186
+ get valueSchema() {
2187
+ return this._def.valueType;
2188
+ }
2189
+ _parse(e) {
2190
+ const { status: t, ctx: r } = this._processInputParams(e);
2191
+ if (r.parsedType !== f.map)
2192
+ return l(r, {
2193
+ code: d.invalid_type,
2194
+ expected: f.map,
2195
+ received: r.parsedType
2196
+ }), g;
2197
+ const n = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, u], c) => ({
2198
+ key: n._parse(new J(r, o, r.path, [c, "key"])),
2199
+ value: a._parse(new J(r, u, r.path, [c, "value"]))
2200
+ }));
2201
+ if (r.common.async) {
2202
+ const o = /* @__PURE__ */ new Map();
2203
+ return Promise.resolve().then(async () => {
2204
+ for (const u of i) {
2205
+ const c = await u.key, p = await u.value;
2206
+ if (c.status === "aborted" || p.status === "aborted")
2207
+ return g;
2208
+ (c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
2209
+ }
2210
+ return { status: t.value, value: o };
2211
+ });
2212
+ } else {
2213
+ const o = /* @__PURE__ */ new Map();
2214
+ for (const u of i) {
2215
+ const c = u.key, p = u.value;
2216
+ if (c.status === "aborted" || p.status === "aborted")
2217
+ return g;
2218
+ (c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
2219
+ }
2220
+ return { status: t.value, value: o };
2221
+ }
2222
+ }
2223
+ }
2224
+ ye.create = (s, e, t) => new ye({
2225
+ valueType: e,
2226
+ keyType: s,
2227
+ typeName: m.ZodMap,
2228
+ ...y(t)
2229
+ });
2230
+ class F extends v {
2231
+ _parse(e) {
2232
+ const { status: t, ctx: r } = this._processInputParams(e);
2233
+ if (r.parsedType !== f.set)
2234
+ return l(r, {
2235
+ code: d.invalid_type,
2236
+ expected: f.set,
2237
+ received: r.parsedType
2238
+ }), g;
2239
+ const n = this._def;
2240
+ n.minSize !== null && r.data.size < n.minSize.value && (l(r, {
2241
+ code: d.too_small,
2242
+ minimum: n.minSize.value,
2243
+ type: "set",
2244
+ inclusive: !0,
2245
+ exact: !1,
2246
+ message: n.minSize.message
2247
+ }), t.dirty()), n.maxSize !== null && r.data.size > n.maxSize.value && (l(r, {
2248
+ code: d.too_big,
2249
+ maximum: n.maxSize.value,
2250
+ type: "set",
2251
+ inclusive: !0,
2252
+ exact: !1,
2253
+ message: n.maxSize.message
2254
+ }), t.dirty());
2255
+ const a = this._def.valueType;
2256
+ function i(u) {
2257
+ const c = /* @__PURE__ */ new Set();
2258
+ for (const p of u) {
2259
+ if (p.status === "aborted")
2260
+ return g;
2261
+ p.status === "dirty" && t.dirty(), c.add(p.value);
2262
+ }
2263
+ return { status: t.value, value: c };
2264
+ }
2265
+ const o = [...r.data.values()].map((u, c) => a._parse(new J(r, u, r.path, c)));
2266
+ return r.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2267
+ }
2268
+ min(e, t) {
2269
+ return new F({
2270
+ ...this._def,
2271
+ minSize: { value: e, message: h.toString(t) }
2272
+ });
2273
+ }
2274
+ max(e, t) {
2275
+ return new F({
2276
+ ...this._def,
2277
+ maxSize: { value: e, message: h.toString(t) }
2278
+ });
2279
+ }
2280
+ size(e, t) {
2281
+ return this.min(e, t).max(e, t);
2282
+ }
2283
+ nonempty(e) {
2284
+ return this.min(1, e);
2285
+ }
2286
+ }
2287
+ F.create = (s, e) => new F({
2288
+ valueType: s,
2289
+ minSize: null,
2290
+ maxSize: null,
2291
+ typeName: m.ZodSet,
2292
+ ...y(e)
2293
+ });
2294
+ class M extends v {
2295
+ constructor() {
2296
+ super(...arguments), this.validate = this.implement;
2297
+ }
2298
+ _parse(e) {
2299
+ const { ctx: t } = this._processInputParams(e);
2300
+ if (t.parsedType !== f.function)
2301
+ return l(t, {
2302
+ code: d.invalid_type,
2303
+ expected: f.function,
2304
+ received: t.parsedType
2305
+ }), g;
2306
+ function r(o, u) {
2307
+ return he({
2308
+ data: o,
2309
+ path: t.path,
2310
+ errorMaps: [
2311
+ t.common.contextualErrorMap,
2312
+ t.schemaErrorMap,
2313
+ fe(),
2314
+ Y
2315
+ ].filter((c) => !!c),
2316
+ issueData: {
2317
+ code: d.invalid_arguments,
2318
+ argumentsError: u
2319
+ }
2320
+ });
2321
+ }
2322
+ function n(o, u) {
2323
+ return he({
2324
+ data: o,
2325
+ path: t.path,
2326
+ errorMaps: [
2327
+ t.common.contextualErrorMap,
2328
+ t.schemaErrorMap,
2329
+ fe(),
2330
+ Y
2331
+ ].filter((c) => !!c),
2332
+ issueData: {
2333
+ code: d.invalid_return_type,
2334
+ returnTypeError: u
2335
+ }
2336
+ });
2337
+ }
2338
+ const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2339
+ if (this._def.returns instanceof X) {
2340
+ const o = this;
2341
+ return w(async function(...u) {
2342
+ const c = new Z([]), p = await o._def.args.parseAsync(u, a).catch((be) => {
2343
+ throw c.addIssue(r(u, be)), c;
2344
+ }), C = await Reflect.apply(i, this, p);
2345
+ return await o._def.returns._def.type.parseAsync(C, a).catch((be) => {
2346
+ throw c.addIssue(n(C, be)), c;
2347
+ });
2348
+ });
2349
+ } else {
2350
+ const o = this;
2351
+ return w(function(...u) {
2352
+ const c = o._def.args.safeParse(u, a);
2353
+ if (!c.success)
2354
+ throw new Z([r(u, c.error)]);
2355
+ const p = Reflect.apply(i, this, c.data), C = o._def.returns.safeParse(p, a);
2356
+ if (!C.success)
2357
+ throw new Z([n(p, C.error)]);
2358
+ return C.data;
2359
+ });
2360
+ }
2361
+ }
2362
+ parameters() {
2363
+ return this._def.args;
2364
+ }
2365
+ returnType() {
2366
+ return this._def.returns;
2367
+ }
2368
+ args(...e) {
2369
+ return new M({
2370
+ ...this._def,
2371
+ args: I.create(e).rest(G.create())
2372
+ });
2373
+ }
2374
+ returns(e) {
2375
+ return new M({
2376
+ ...this._def,
2377
+ returns: e
2378
+ });
2379
+ }
2380
+ implement(e) {
2381
+ return this.parse(e);
2382
+ }
2383
+ strictImplement(e) {
2384
+ return this.parse(e);
2385
+ }
2386
+ static create(e, t, r) {
2387
+ return new M({
2388
+ args: e || I.create([]).rest(G.create()),
2389
+ returns: t || G.create(),
2390
+ typeName: m.ZodFunction,
2391
+ ...y(r)
2392
+ });
2393
+ }
2394
+ }
2395
+ class ne extends v {
2396
+ get schema() {
2397
+ return this._def.getter();
2398
+ }
2399
+ _parse(e) {
2400
+ const { ctx: t } = this._processInputParams(e);
2401
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2402
+ }
2403
+ }
2404
+ ne.create = (s, e) => new ne({
2405
+ getter: s,
2406
+ typeName: m.ZodLazy,
2407
+ ...y(e)
2408
+ });
2409
+ class ae extends v {
2410
+ _parse(e) {
2411
+ if (e.data !== this._def.value) {
2412
+ const t = this._getOrReturnCtx(e);
2413
+ return l(t, {
2414
+ received: t.data,
2415
+ code: d.invalid_literal,
2416
+ expected: this._def.value
2417
+ }), g;
2418
+ }
2419
+ return { status: "valid", value: e.data };
2420
+ }
2421
+ get value() {
2422
+ return this._def.value;
2423
+ }
2424
+ }
2425
+ ae.create = (s, e) => new ae({
2426
+ value: s,
2427
+ typeName: m.ZodLiteral,
2428
+ ...y(e)
2429
+ });
2430
+ function je(s, e) {
2431
+ return new Q({
2432
+ values: s,
2433
+ typeName: m.ZodEnum,
2434
+ ...y(e)
2435
+ });
2436
+ }
2437
+ class Q extends v {
2438
+ constructor() {
2439
+ super(...arguments), $.set(this, void 0);
2440
+ }
2441
+ _parse(e) {
2442
+ if (typeof e.data != "string") {
2443
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2444
+ return l(t, {
2445
+ expected: _.joinValues(r),
2446
+ received: t.parsedType,
2447
+ code: d.invalid_type
2448
+ }), g;
2449
+ }
2450
+ if (pe(this, $) || Ne(this, $, new Set(this._def.values)), !pe(this, $).has(e.data)) {
2451
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2452
+ return l(t, {
2453
+ received: t.data,
2454
+ code: d.invalid_enum_value,
2455
+ options: r
2456
+ }), g;
2457
+ }
2458
+ return w(e.data);
2459
+ }
2460
+ get options() {
2461
+ return this._def.values;
2462
+ }
2463
+ get enum() {
2464
+ const e = {};
2465
+ for (const t of this._def.values)
2466
+ e[t] = t;
2467
+ return e;
2468
+ }
2469
+ get Values() {
2470
+ const e = {};
2471
+ for (const t of this._def.values)
2472
+ e[t] = t;
2473
+ return e;
2474
+ }
2475
+ get Enum() {
2476
+ const e = {};
2477
+ for (const t of this._def.values)
2478
+ e[t] = t;
2479
+ return e;
2480
+ }
2481
+ extract(e, t = this._def) {
2482
+ return Q.create(e, {
2483
+ ...this._def,
2484
+ ...t
2485
+ });
2486
+ }
2487
+ exclude(e, t = this._def) {
2488
+ return Q.create(this.options.filter((r) => !e.includes(r)), {
2489
+ ...this._def,
2490
+ ...t
2491
+ });
2492
+ }
2493
+ }
2494
+ $ = /* @__PURE__ */ new WeakMap();
2495
+ Q.create = je;
2496
+ class ie extends v {
2497
+ constructor() {
2498
+ super(...arguments), D.set(this, void 0);
2499
+ }
2500
+ _parse(e) {
2501
+ const t = _.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2502
+ if (r.parsedType !== f.string && r.parsedType !== f.number) {
2503
+ const n = _.objectValues(t);
2504
+ return l(r, {
2505
+ expected: _.joinValues(n),
2506
+ received: r.parsedType,
2507
+ code: d.invalid_type
2508
+ }), g;
2509
+ }
2510
+ if (pe(this, D) || Ne(this, D, new Set(_.getValidEnumValues(this._def.values))), !pe(this, D).has(e.data)) {
2511
+ const n = _.objectValues(t);
2512
+ return l(r, {
2513
+ received: r.data,
2514
+ code: d.invalid_enum_value,
2515
+ options: n
2516
+ }), g;
2517
+ }
2518
+ return w(e.data);
2519
+ }
2520
+ get enum() {
2521
+ return this._def.values;
2522
+ }
2523
+ }
2524
+ D = /* @__PURE__ */ new WeakMap();
2525
+ ie.create = (s, e) => new ie({
2526
+ values: s,
2527
+ typeName: m.ZodNativeEnum,
2528
+ ...y(e)
2529
+ });
2530
+ class X extends v {
2531
+ unwrap() {
2532
+ return this._def.type;
2533
+ }
2534
+ _parse(e) {
2535
+ const { ctx: t } = this._processInputParams(e);
2536
+ if (t.parsedType !== f.promise && t.common.async === !1)
2537
+ return l(t, {
2538
+ code: d.invalid_type,
2539
+ expected: f.promise,
2540
+ received: t.parsedType
2541
+ }), g;
2542
+ const r = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2543
+ return w(r.then((n) => this._def.type.parseAsync(n, {
2544
+ path: t.path,
2545
+ errorMap: t.common.contextualErrorMap
2546
+ })));
2547
+ }
2548
+ }
2549
+ X.create = (s, e) => new X({
2550
+ type: s,
2551
+ typeName: m.ZodPromise,
2552
+ ...y(e)
2553
+ });
2554
+ class S extends v {
2555
+ innerType() {
2556
+ return this._def.schema;
2557
+ }
2558
+ sourceType() {
2559
+ return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2560
+ }
2561
+ _parse(e) {
2562
+ const { status: t, ctx: r } = this._processInputParams(e), n = this._def.effect || null, a = {
2563
+ addIssue: (i) => {
2564
+ l(r, i), i.fatal ? t.abort() : t.dirty();
2565
+ },
2566
+ get path() {
2567
+ return r.path;
2568
+ }
2569
+ };
2570
+ if (a.addIssue = a.addIssue.bind(a), n.type === "preprocess") {
2571
+ const i = n.transform(r.data, a);
2572
+ if (r.common.async)
2573
+ return Promise.resolve(i).then(async (o) => {
2574
+ if (t.value === "aborted")
2575
+ return g;
2576
+ const u = await this._def.schema._parseAsync({
2577
+ data: o,
2578
+ path: r.path,
2579
+ parent: r
2580
+ });
2581
+ return u.status === "aborted" ? g : u.status === "dirty" || t.value === "dirty" ? U(u.value) : u;
2582
+ });
2583
+ {
2584
+ if (t.value === "aborted")
2585
+ return g;
2586
+ const o = this._def.schema._parseSync({
2587
+ data: i,
2588
+ path: r.path,
2589
+ parent: r
2590
+ });
2591
+ return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? U(o.value) : o;
2592
+ }
2593
+ }
2594
+ if (n.type === "refinement") {
2595
+ const i = (o) => {
2596
+ const u = n.refinement(o, a);
2597
+ if (r.common.async)
2598
+ return Promise.resolve(u);
2599
+ if (u instanceof Promise)
2600
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2601
+ return o;
2602
+ };
2603
+ if (r.common.async === !1) {
2604
+ const o = this._def.schema._parseSync({
2605
+ data: r.data,
2606
+ path: r.path,
2607
+ parent: r
2608
+ });
2609
+ return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2610
+ } else
2611
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2612
+ }
2613
+ if (n.type === "transform")
2614
+ if (r.common.async === !1) {
2615
+ const i = this._def.schema._parseSync({
2616
+ data: r.data,
2617
+ path: r.path,
2618
+ parent: r
2619
+ });
2620
+ if (!L(i))
2621
+ return i;
2622
+ const o = n.transform(i.value, a);
2623
+ if (o instanceof Promise)
2624
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2625
+ return { status: t.value, value: o };
2626
+ } else
2627
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => L(i) ? Promise.resolve(n.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2628
+ _.assertNever(n);
2629
+ }
2630
+ }
2631
+ S.create = (s, e, t) => new S({
2632
+ schema: s,
2633
+ typeName: m.ZodEffects,
2634
+ effect: e,
2635
+ ...y(t)
2636
+ });
2637
+ S.createWithPreprocess = (s, e, t) => new S({
2638
+ schema: e,
2639
+ effect: { type: "preprocess", transform: s },
2640
+ typeName: m.ZodEffects,
2641
+ ...y(t)
2642
+ });
2643
+ class A extends v {
2644
+ _parse(e) {
2645
+ return this._getType(e) === f.undefined ? w(void 0) : this._def.innerType._parse(e);
2646
+ }
2647
+ unwrap() {
2648
+ return this._def.innerType;
2649
+ }
2650
+ }
2651
+ A.create = (s, e) => new A({
2652
+ innerType: s,
2653
+ typeName: m.ZodOptional,
2654
+ ...y(e)
2655
+ });
2656
+ class W extends v {
2657
+ _parse(e) {
2658
+ return this._getType(e) === f.null ? w(null) : this._def.innerType._parse(e);
2659
+ }
2660
+ unwrap() {
2661
+ return this._def.innerType;
2662
+ }
2663
+ }
2664
+ W.create = (s, e) => new W({
2665
+ innerType: s,
2666
+ typeName: m.ZodNullable,
2667
+ ...y(e)
2668
+ });
2669
+ class oe extends v {
2670
+ _parse(e) {
2671
+ const { ctx: t } = this._processInputParams(e);
2672
+ let r = t.data;
2673
+ return t.parsedType === f.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2674
+ data: r,
2675
+ path: t.path,
2676
+ parent: t
2677
+ });
2678
+ }
2679
+ removeDefault() {
2680
+ return this._def.innerType;
2681
+ }
2682
+ }
2683
+ oe.create = (s, e) => new oe({
2684
+ innerType: s,
2685
+ typeName: m.ZodDefault,
2686
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2687
+ ...y(e)
2688
+ });
2689
+ class de extends v {
2690
+ _parse(e) {
2691
+ const { ctx: t } = this._processInputParams(e), r = {
2692
+ ...t,
2693
+ common: {
2694
+ ...t.common,
2695
+ issues: []
2696
+ }
2697
+ }, n = this._def.innerType._parse({
2698
+ data: r.data,
2699
+ path: r.path,
2700
+ parent: {
2701
+ ...r
2702
+ }
2703
+ });
2704
+ return K(n) ? n.then((a) => ({
2705
+ status: "valid",
2706
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2707
+ get error() {
2708
+ return new Z(r.common.issues);
2709
+ },
2710
+ input: r.data
2711
+ })
2712
+ })) : {
2713
+ status: "valid",
2714
+ value: n.status === "valid" ? n.value : this._def.catchValue({
2715
+ get error() {
2716
+ return new Z(r.common.issues);
2717
+ },
2718
+ input: r.data
2719
+ })
2720
+ };
2721
+ }
2722
+ removeCatch() {
2723
+ return this._def.innerType;
2724
+ }
2725
+ }
2726
+ de.create = (s, e) => new de({
2727
+ innerType: s,
2728
+ typeName: m.ZodCatch,
2729
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2730
+ ...y(e)
2731
+ });
2732
+ class ve extends v {
2733
+ _parse(e) {
2734
+ if (this._getType(e) !== f.nan) {
2735
+ const r = this._getOrReturnCtx(e);
2736
+ return l(r, {
2737
+ code: d.invalid_type,
2738
+ expected: f.nan,
2739
+ received: r.parsedType
2740
+ }), g;
2741
+ }
2742
+ return { status: "valid", value: e.data };
2743
+ }
2744
+ }
2745
+ ve.create = (s) => new ve({
2746
+ typeName: m.ZodNaN,
2747
+ ...y(s)
2748
+ });
2749
+ const ut = Symbol("zod_brand");
2750
+ class Te extends v {
2751
+ _parse(e) {
2752
+ const { ctx: t } = this._processInputParams(e), r = t.data;
2753
+ return this._def.type._parse({
2754
+ data: r,
2755
+ path: t.path,
2756
+ parent: t
2757
+ });
2758
+ }
2759
+ unwrap() {
2760
+ return this._def.type;
2761
+ }
2762
+ }
2763
+ class le extends v {
2764
+ _parse(e) {
2765
+ const { status: t, ctx: r } = this._processInputParams(e);
2766
+ if (r.common.async)
2767
+ return (async () => {
2768
+ const a = await this._def.in._parseAsync({
2769
+ data: r.data,
2770
+ path: r.path,
2771
+ parent: r
2772
+ });
2773
+ return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), U(a.value)) : this._def.out._parseAsync({
2774
+ data: a.value,
2775
+ path: r.path,
2776
+ parent: r
2777
+ });
2778
+ })();
2779
+ {
2780
+ const n = this._def.in._parseSync({
2781
+ data: r.data,
2782
+ path: r.path,
2783
+ parent: r
2784
+ });
2785
+ return n.status === "aborted" ? g : n.status === "dirty" ? (t.dirty(), {
2786
+ status: "dirty",
2787
+ value: n.value
2788
+ }) : this._def.out._parseSync({
2789
+ data: n.value,
2790
+ path: r.path,
2791
+ parent: r
2792
+ });
2793
+ }
2794
+ }
2795
+ static create(e, t) {
2796
+ return new le({
2797
+ in: e,
2798
+ out: t,
2799
+ typeName: m.ZodPipeline
2800
+ });
2801
+ }
2802
+ }
2803
+ class ce extends v {
2804
+ _parse(e) {
2805
+ const t = this._def.innerType._parse(e), r = (n) => (L(n) && (n.value = Object.freeze(n.value)), n);
2806
+ return K(t) ? t.then((n) => r(n)) : r(t);
2807
+ }
2808
+ unwrap() {
2809
+ return this._def.innerType;
2810
+ }
2811
+ }
2812
+ ce.create = (s, e) => new ce({
2813
+ innerType: s,
2814
+ typeName: m.ZodReadonly,
2815
+ ...y(e)
2816
+ });
2817
+ function Se(s, e) {
2818
+ const t = typeof s == "function" ? s(e) : typeof s == "string" ? { message: s } : s;
2819
+ return typeof t == "string" ? { message: t } : t;
2820
+ }
2821
+ function Qe(s, e = {}, t) {
2822
+ return s ? P.create().superRefine((r, n) => {
2823
+ var a, i;
2824
+ const o = s(r);
2825
+ if (o instanceof Promise)
2826
+ return o.then((u) => {
2827
+ var c, p;
2828
+ if (!u) {
2829
+ const C = Se(e, r), ue = (p = (c = C.fatal) !== null && c !== void 0 ? c : t) !== null && p !== void 0 ? p : !0;
2830
+ n.addIssue({ code: "custom", ...C, fatal: ue });
2831
+ }
2832
+ });
2833
+ if (!o) {
2834
+ const u = Se(e, r), c = (i = (a = u.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
2835
+ n.addIssue({ code: "custom", ...u, fatal: c });
2836
+ }
2837
+ }) : P.create();
2838
+ }
2839
+ const ft = {
2840
+ object: k.lazycreate
2841
+ };
2842
+ var m;
2843
+ (function(s) {
2844
+ s.ZodString = "ZodString", s.ZodNumber = "ZodNumber", s.ZodNaN = "ZodNaN", s.ZodBigInt = "ZodBigInt", s.ZodBoolean = "ZodBoolean", s.ZodDate = "ZodDate", s.ZodSymbol = "ZodSymbol", s.ZodUndefined = "ZodUndefined", s.ZodNull = "ZodNull", s.ZodAny = "ZodAny", s.ZodUnknown = "ZodUnknown", s.ZodNever = "ZodNever", s.ZodVoid = "ZodVoid", s.ZodArray = "ZodArray", s.ZodObject = "ZodObject", s.ZodUnion = "ZodUnion", s.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", s.ZodIntersection = "ZodIntersection", s.ZodTuple = "ZodTuple", s.ZodRecord = "ZodRecord", s.ZodMap = "ZodMap", s.ZodSet = "ZodSet", s.ZodFunction = "ZodFunction", s.ZodLazy = "ZodLazy", s.ZodLiteral = "ZodLiteral", s.ZodEnum = "ZodEnum", s.ZodEffects = "ZodEffects", s.ZodNativeEnum = "ZodNativeEnum", s.ZodOptional = "ZodOptional", s.ZodNullable = "ZodNullable", s.ZodDefault = "ZodDefault", s.ZodCatch = "ZodCatch", s.ZodPromise = "ZodPromise", s.ZodBranded = "ZodBranded", s.ZodPipeline = "ZodPipeline", s.ZodReadonly = "ZodReadonly";
2845
+ })(m || (m = {}));
2846
+ const ht = (s, e = {
2847
+ message: `Input not instance of ${s.name}`
2848
+ }) => Qe((t) => t instanceof s, e), We = T.create, Ge = V.create, pt = ve.create, mt = j.create, Le = H.create, gt = B.create, yt = me.create, vt = q.create, _t = ee.create, bt = P.create, kt = G.create, xt = E.create, Ct = ge.create, wt = R.create, Zt = k.create, Tt = k.strictCreate, Rt = te.create, St = _e.create, At = se.create, Jt = I.create, It = re.create, Nt = ye.create, Ot = F.create, Et = M.create, Vt = ne.create, jt = ae.create, Qt = Q.create, Wt = ie.create, Gt = X.create, Ae = S.create, Lt = A.create, Bt = W.create, Ft = S.createWithPreprocess, zt = le.create, Ut = () => We().optional(), Mt = () => Ge().optional(), Yt = () => Le().optional(), Pt = {
2849
+ string: (s) => T.create({ ...s, coerce: !0 }),
2850
+ number: (s) => V.create({ ...s, coerce: !0 }),
2851
+ boolean: (s) => H.create({
2852
+ ...s,
2853
+ coerce: !0
2854
+ }),
2855
+ bigint: (s) => j.create({ ...s, coerce: !0 }),
2856
+ date: (s) => B.create({ ...s, coerce: !0 })
2857
+ }, Xt = g;
2858
+ var b = /* @__PURE__ */ Object.freeze({
2859
+ __proto__: null,
2860
+ defaultErrorMap: Y,
2861
+ setErrorMap: Fe,
2862
+ getErrorMap: fe,
2863
+ makeIssue: he,
2864
+ EMPTY_PATH: ze,
2865
+ addIssueToContext: l,
2866
+ ParseStatus: x,
2867
+ INVALID: g,
2868
+ DIRTY: U,
2869
+ OK: w,
2870
+ isAborted: Ce,
2871
+ isDirty: we,
2872
+ isValid: L,
2873
+ isAsync: K,
2874
+ get util() {
2875
+ return _;
2876
+ },
2877
+ get objectUtil() {
2878
+ return xe;
2879
+ },
2880
+ ZodParsedType: f,
2881
+ getParsedType: O,
2882
+ ZodType: v,
2883
+ datetimeRegex: Ve,
2884
+ ZodString: T,
2885
+ ZodNumber: V,
2886
+ ZodBigInt: j,
2887
+ ZodBoolean: H,
2888
+ ZodDate: B,
2889
+ ZodSymbol: me,
2890
+ ZodUndefined: q,
2891
+ ZodNull: ee,
2892
+ ZodAny: P,
2893
+ ZodUnknown: G,
2894
+ ZodNever: E,
2895
+ ZodVoid: ge,
2896
+ ZodArray: R,
2897
+ ZodObject: k,
2898
+ ZodUnion: te,
2899
+ ZodDiscriminatedUnion: _e,
2900
+ ZodIntersection: se,
2901
+ ZodTuple: I,
2902
+ ZodRecord: re,
2903
+ ZodMap: ye,
2904
+ ZodSet: F,
2905
+ ZodFunction: M,
2906
+ ZodLazy: ne,
2907
+ ZodLiteral: ae,
2908
+ ZodEnum: Q,
2909
+ ZodNativeEnum: ie,
2910
+ ZodPromise: X,
2911
+ ZodEffects: S,
2912
+ ZodTransformer: S,
2913
+ ZodOptional: A,
2914
+ ZodNullable: W,
2915
+ ZodDefault: oe,
2916
+ ZodCatch: de,
2917
+ ZodNaN: ve,
2918
+ BRAND: ut,
2919
+ ZodBranded: Te,
2920
+ ZodPipeline: le,
2921
+ ZodReadonly: ce,
2922
+ custom: Qe,
2923
+ Schema: v,
2924
+ ZodSchema: v,
2925
+ late: ft,
2926
+ get ZodFirstPartyTypeKind() {
2927
+ return m;
2928
+ },
2929
+ coerce: Pt,
2930
+ any: bt,
2931
+ array: wt,
2932
+ bigint: mt,
2933
+ boolean: Le,
2934
+ date: gt,
2935
+ discriminatedUnion: St,
2936
+ effect: Ae,
2937
+ enum: Qt,
2938
+ function: Et,
2939
+ instanceof: ht,
2940
+ intersection: At,
2941
+ lazy: Vt,
2942
+ literal: jt,
2943
+ map: Nt,
2944
+ nan: pt,
2945
+ nativeEnum: Wt,
2946
+ never: xt,
2947
+ null: _t,
2948
+ nullable: Bt,
2949
+ number: Ge,
2950
+ object: Zt,
2951
+ oboolean: Yt,
2952
+ onumber: Mt,
2953
+ optional: Lt,
2954
+ ostring: Ut,
2955
+ pipeline: zt,
2956
+ preprocess: Ft,
2957
+ promise: Gt,
2958
+ record: It,
2959
+ set: Ot,
2960
+ strictObject: Tt,
2961
+ string: We,
2962
+ symbol: yt,
2963
+ transformer: Ae,
2964
+ tuple: Jt,
2965
+ undefined: vt,
2966
+ union: Rt,
2967
+ unknown: kt,
2968
+ void: Ct,
2969
+ NEVER: Xt,
2970
+ ZodIssueCode: d,
2971
+ quotelessJson: Be,
2972
+ ZodError: Z
2973
+ });
2974
+ const $t = ["default", "minimal", "image-heavy"], Dt = ["fade-in", "slide-up", "none"], Kt = ["_self", "_blank", "_parent", "_top"], Ht = ["button", "link", "region", "article"], qt = ["default", "success", "warning", "error"], Je = /^[a-z]+-(100|200|300|400|500|600|700|800|900)$/, es = /^(?:(?:[a-z]+:)?(col|row)-span-\d+\s*)+$/, ts = /^01[0-9A-HJKMNP-TV-Z]{24}$/, rs = b.object({
2975
+ id: b.string().regex(ts, "Invalid ULID format").optional(),
2976
+ title: b.string().min(1, "Title is required"),
2977
+ subtitle: b.string().optional(),
2978
+ description: b.string().optional(),
2979
+ span: b.string().regex(es, "Invalid span format (e.g., col-span-2, row-span-1)").optional(),
2980
+ primaryColor: b.string().regex(Je, "Invalid Tailwind color format (e.g., blue-500)"),
2981
+ secondaryColor: b.string().regex(Je, "Invalid Tailwind color format (e.g., blue-500)"),
2982
+ icon: b.string().optional(),
2983
+ backgroundImage: b.string().url().optional(),
2984
+ onclick: b.string().optional(),
2985
+ href: b.string().url().optional(),
2986
+ target: b.enum(Kt).optional(),
2987
+ ariaLabel: b.string().optional(),
2988
+ role: b.enum(Ht).optional(),
2989
+ variant: b.enum($t).optional(),
2990
+ animation: b.enum(Dt).optional(),
2991
+ badge: b.string().optional(),
2992
+ badgeType: b.enum(qt).optional(),
2993
+ priority: b.number().int().min(0).optional(),
2994
+ tooltip: b.string().optional(),
2995
+ disabled: b.boolean().optional(),
2996
+ meta: b.record(b.any()).optional(),
2997
+ dataset: b.record(b.string()).optional(),
2998
+ className: b.string().optional()
2999
+ }).refine(
3000
+ (s) => !s.href || s.href && s.target,
3001
+ { message: "target is required when href is provided", path: ["target"] }
3002
+ ).refine(
3003
+ (s) => !s.badgeType || s.badge && s.badge.length > 0,
3004
+ { message: "badge must be provided if badgeType is set", path: ["badge"] }
3005
+ ), ns = {
3006
+ default: { base: "p-4 flex flex-col justify-between" },
3007
+ minimal: { base: "p-2 bg-opacity-30 backdrop-blur-sm", hover: "bg-opacity-50" },
3008
+ "image-heavy": { base: "p-0 overflow-hidden", hover: "scale-105" }
3009
+ }, as = {
3010
+ "fade-in": "animate-fade-in",
3011
+ "slide-up": "animate-slide-up",
3012
+ none: ""
3013
+ }, is = {
3014
+ default: "bg-white/30 text-white",
3015
+ success: "bg-green-500/80 text-white",
3016
+ warning: "bg-yellow-500/80 text-black",
3017
+ error: "bg-red-500/80 text-white"
3018
+ }, os = {
3019
+ bento: new URL("data:video/mp2t;base64,aW1wb3J0IHsgZXhwb3NlIH0gZnJvbSAnY29tbGluayc7CmltcG9ydCB0eXBlIHsgQmFzZU1vZEFQSSwgVmlydHVhbE5vZGUgfSBmcm9tICcuLi8uLi8uLi90eXBlcy9tb2R1bGVzJzsKaW1wb3J0IHsKCUJlbnRvVGlsZVNjaGVtYSwKCXR5cGUgQmVudG9UaWxlLAoJQkVOVE9fQkFER0VfQ0xBU1NfTUFQLAoJQkVOVE9fQU5JTUFUSU9OX0NMQVNTX01BUCwKCUJFTlRPX1ZBUklBTlRfQ0xBU1NfTUFQLAp9IGZyb20gJy4uLy4uLy4uL3R5cGVzL2JlbnRvJzsKCmxldCBlbWl0VG9NYWluOiAoKG1zZzogYW55KSA9PiB2b2lkKSB8IHVuZGVmaW5lZDsKCmZ1bmN0aW9uIGNyZWF0ZVZOb2RlRnJvbVRpbGUodGlsZTogQmVudG9UaWxlKTogVmlydHVhbE5vZGUgewoJY29uc3QgdmFyaWFudCA9IHRpbGUudmFyaWFudCA/PyAnZGVmYXVsdCc7Cgljb25zdCBhbmltYXRpb25DbGFzcyA9IHRpbGUuYW5pbWF0aW9uCgkJPyBCRU5UT19BTklNQVRJT05fQ0xBU1NfTUFQW3RpbGUuYW5pbWF0aW9uXQoJCTogJyc7Cgljb25zdCB2YXJpYW50QmFzZSA9IEJFTlRPX1ZBUklBTlRfQ0xBU1NfTUFQW3ZhcmlhbnRdPy5iYXNlID8/ICcnOwoJY29uc3QgdmFyaWFudEhvdmVyID0gQkVOVE9fVkFSSUFOVF9DTEFTU19NQVBbdmFyaWFudF0/LmhvdmVyID8/ICcnOwoKCWNvbnN0IHJvb3RDbGFzc2VzID0gWwoJCSdiZW50by1pdGVtJywKCQknY29sLXNwYW4tMScsCgkJJ3Jvdy1zcGFuLTEnLAoJCXRpbGUuc3BhbiA/PyAnbWQ6Y29sLXNwYW4tMiBtZDpyb3ctc3Bhbi0xJywKCQknYmctZ3JhZGllbnQtdG8tYnInLAoJCXRpbGUucHJpbWFyeUNvbG9yID8gYGZyb20tJHt0aWxlLnByaW1hcnlDb2xvcn1gIDogJycsCgkJdGlsZS5zZWNvbmRhcnlDb2xvciA/IGB0by0ke3RpbGUuc2Vjb25kYXJ5Q29sb3J9YCA6ICcnLAoJCSdyb3VuZGVkLTJ4bCBvdmVyZmxvdy1oaWRkZW4gc2hhZG93LTJ4bCcsCgkJdmFyaWFudEJhc2UsCgkJdmFyaWFudEhvdmVyID8gYGhvdmVyOiR7dmFyaWFudEhvdmVyfWAgOiAnJywKCQlhbmltYXRpb25DbGFzcywKCQl0aWxlLmNsYXNzTmFtZSA/PyAnJywKCV0KCQkuZmlsdGVyKEJvb2xlYW4pCgkJLmpvaW4oJyAnKTsKCgljb25zdCBkYXRhc2V0QXR0cnMgPSB0aWxlLmRhdGFzZXQKCQk/IE9iamVjdC5mcm9tRW50cmllcygKCQkJCU9iamVjdC5lbnRyaWVzKHRpbGUuZGF0YXNldCkubWFwKChbaywgdl0pID0+IFtgZGF0YS0ke2t9YCwgdl0pLAoJCQkpCgkJOiB7fTsKCgljb25zdCB3cmFwcGVyOiBWaXJ0dWFsTm9kZSA9IHsKCQl0YWc6IHRpbGUuaHJlZiA/ICdhJyA6ICdkaXYnLAoJCWNsYXNzOiByb290Q2xhc3NlcywKCQlhdHRyczogewoJCQkuLi4odGlsZS5ocmVmCgkJCQk/IHsgaHJlZjogdGlsZS5ocmVmLCB0YXJnZXQ6IHRpbGUudGFyZ2V0ID8/ICdfc2VsZicgfQoJCQkJOiB7fSksCgkJCS4uLih0aWxlLm9uY2xpY2sgPyB7IG9uY2xpY2s6IHRpbGUub25jbGljayB9IDoge30pLAoJCQkuLi4odGlsZS5hcmlhTGFiZWwgPyB7ICdhcmlhLWxhYmVsJzogdGlsZS5hcmlhTGFiZWwgfSA6IHt9KSwKCQkJLi4uKHRpbGUucm9sZSA/IHsgcm9sZTogdGlsZS5yb2xlIH0gOiB7fSksCgkJCS4uLmRhdGFzZXRBdHRycywKCQl9LAoJCWNoaWxkcmVuOiBbCgkJCXRpbGUuYmFkZ2UgJiYgewoJCQkJdGFnOiAnc3BhbicsCgkJCQljbGFzczogYGFic29sdXRlIHRvcC0yIHJpZ2h0LTIgcHgtMiBweS0xIHRleHQteHMgcm91bmRlZCB6LTEwICR7QkVOVE9fQkFER0VfQ0xBU1NfTUFQW3RpbGUuYmFkZ2VUeXBlID8/ICdkZWZhdWx0J119YCwKCQkJCWNoaWxkcmVuOiBbdGlsZS5iYWRnZV0sCgkJCX0sCgkJCXsKCQkJCXRhZzogJ2RpdicsCgkJCQljbGFzczogJ3AtNCBmbGV4IGZsZXgtY29sIGp1c3RpZnktYmV0d2VlbiBoLWZ1bGwnLAoJCQkJY2hpbGRyZW46IFsKCQkJCQl7CgkJCQkJCXRhZzogJ2RpdicsCgkJCQkJCWNsYXNzOiAnZmxleCBpdGVtcy1jZW50ZXIgZ2FwLTMnLAoJCQkJCQljaGlsZHJlbjogWwoJCQkJCQkJdGlsZS5pY29uICYmIHsKCQkJCQkJCQl0YWc6ICdkaXYnLAoJCQkJCQkJCWNsYXNzOiAndGV4dC0yeGwgYmctd2hpdGUvMjAgcm91bmRlZC1mdWxsIHAtMiB0ZXh0LXdoaXRlJywKCQkJCQkJCQljaGlsZHJlbjogW3RpbGUuaWNvbl0sCgkJCQkJCQl9LAoJCQkJCQkJewoJCQkJCQkJCXRhZzogJ2gzJywKCQkJCQkJCQljbGFzczogJ3RleHQtd2hpdGUgdGV4dC1sZyBmb250LWJvbGQnLAoJCQkJCQkJCWNoaWxkcmVuOiBbdGlsZS50aXRsZV0sCgkJCQkJCQl9LAoJCQkJCQldLmZpbHRlcihCb29sZWFuKSBhcyBWaXJ0dWFsTm9kZVtdLAoJCQkJCX0sCgkJCQkJdGlsZS5zdWJ0aXRsZSAmJiB7CgkJCQkJCXRhZzogJ3AnLAoJCQkJCQljbGFzczogJ3RleHQtc20gdGV4dC13aGl0ZS84MCBtdC0yJywKCQkJCQkJY2hpbGRyZW46IFt0aWxlLnN1YnRpdGxlXSwKCQkJCQl9LAoJCQkJCXRpbGUuZGVzY3JpcHRpb24gJiYgewoJCQkJCQl0YWc6ICdwJywKCQkJCQkJY2xhc3M6ICd0ZXh0LXhzIHRleHQtd2hpdGUvNjAgbXQtMScsCgkJCQkJCWNoaWxkcmVuOiBbdGlsZS5kZXNjcmlwdGlvbl0sCgkJCQkJfSwKCQkJCV0uZmlsdGVyKEJvb2xlYW4pIGFzIFZpcnR1YWxOb2RlW10sCgkJCX0sCgkJXS5maWx0ZXIoQm9vbGVhbikgYXMgVmlydHVhbE5vZGVbXSwKCX07CgoJcmV0dXJuIHdyYXBwZXI7Cn0KCmNvbnN0IGFwaTogQmFzZU1vZEFQSSA9IHsKCWFzeW5jIGdldE1ldGEoKSB7CgkJcmV0dXJuIHsKCQkJbmFtZTogJ2JlbnRvJywKCQkJdmVyc2lvbjogJzAuMS4wJywKCQl9OwoJfSwKCglhc3luYyBpbml0KGNvbnRleHQpIHsKCQllbWl0VG9NYWluID0gY29udGV4dD8uZW1pdEZyb21Xb3JrZXI7Cgl9LAoKCWFzeW5jIHJ1bihkYXRhOiB1bmtub3duKSB7CgkJaWYgKCFlbWl0VG9NYWluKSB7CgkJCWNvbnNvbGUud2FybignW21vZC1iZW50b10gZW1pdEZyb21Xb3JrZXIgbm90IGRlZmluZWQnKTsKCQkJcmV0dXJuOwoJCX0KCgkJdHJ5IHsKCQkJY29uc3QgdGlsZSA9IEJlbnRvVGlsZVNjaGVtYS5wYXJzZShkYXRhKTsKCQkJY29uc3Qgdm5vZGUgPSBjcmVhdGVWTm9kZUZyb21UaWxlKHRpbGUpOwoJCQllbWl0VG9NYWluKHsgdHlwZTogJ2luamVjdFZOb2RlJywgdm5vZGUgfSk7CgkJfSBjYXRjaCAoZXJyKSB7CgkJCWNvbnNvbGUuZXJyb3IoJ1ttb2QtYmVudG9dIEludmFsaWQgQmVudG9UaWxlIGRhdGE6JywgZXJyKTsKCQl9Cgl9LAp9OwoKZXhwb3NlKGFwaSk7Cg==", import.meta.url).href
3020
+ };
3021
+ export {
3022
+ $t as B,
3023
+ Dt as a,
3024
+ Kt as b,
3025
+ Ht as c,
3026
+ ss as d,
3027
+ qt as e,
3028
+ rs as f,
3029
+ ns as g,
3030
+ as as h,
3031
+ is as i,
3032
+ os as m,
3033
+ b as z
3034
+ };