@rpcbase/server 0.594.0 → 0.595.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/convertHeifToWebp-BT1n72DQ.js +148 -0
  2. package/dist/convertHeifToWebp-BT1n72DQ.js.map +1 -0
  3. package/dist/email-Co1GNjlT.js +7204 -0
  4. package/dist/email-Co1GNjlT.js.map +1 -0
  5. package/dist/handler-BqlcQ9sE.js +245 -0
  6. package/dist/handler-BqlcQ9sE.js.map +1 -0
  7. package/dist/handler-C92_gJkX.js +743 -0
  8. package/dist/handler-C92_gJkX.js.map +1 -0
  9. package/dist/handler-CapJTGzc.js +795 -0
  10. package/dist/handler-CapJTGzc.js.map +1 -0
  11. package/dist/handler-Fk-5fOSm.js +119 -0
  12. package/dist/handler-Fk-5fOSm.js.map +1 -0
  13. package/dist/htmlTemplate.d.ts +16 -0
  14. package/dist/htmlTemplate.d.ts.map +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +5140 -5286
  18. package/dist/index.js.map +1 -1
  19. package/dist/notifications.js +273 -382
  20. package/dist/notifications.js.map +1 -1
  21. package/dist/postProcessors-iffHvje4.js +89 -0
  22. package/dist/postProcessors-iffHvje4.js.map +1 -0
  23. package/dist/queryWindow-DP8zD0lb.js +555 -0
  24. package/dist/queryWindow-DP8zD0lb.js.map +1 -0
  25. package/dist/render_resend-B1SSQ4f7.js +7 -0
  26. package/dist/render_resend-B1SSQ4f7.js.map +1 -0
  27. package/dist/rts/index.js +990 -1207
  28. package/dist/rts/index.js.map +1 -1
  29. package/dist/schemas-B2fUvgYo.js +4151 -0
  30. package/dist/schemas-B2fUvgYo.js.map +1 -0
  31. package/dist/shared-DfrVDSp0.js +79 -0
  32. package/dist/shared-DfrVDSp0.js.map +1 -0
  33. package/dist/ssrMiddleware.d.ts +7 -3
  34. package/dist/ssrMiddleware.d.ts.map +1 -1
  35. package/dist/uploads/worker.js +139 -168
  36. package/dist/uploads/worker.js.map +1 -1
  37. package/dist/uploads.js +12 -22
  38. package/dist/uploads.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/convertHeifToWebp-C-DGXZ2k.js +0 -169
  41. package/dist/convertHeifToWebp-C-DGXZ2k.js.map +0 -1
  42. package/dist/email-BCf24GmK.js +0 -8071
  43. package/dist/email-BCf24GmK.js.map +0 -1
  44. package/dist/handler-BqoKvylN.js +0 -147
  45. package/dist/handler-BqoKvylN.js.map +0 -1
  46. package/dist/handler-CUOJ51-w.js +0 -903
  47. package/dist/handler-CUOJ51-w.js.map +0 -1
  48. package/dist/handler-D-XdgeG_.js +0 -986
  49. package/dist/handler-D-XdgeG_.js.map +0 -1
  50. package/dist/handler-F0gFTzvh.js +0 -275
  51. package/dist/handler-F0gFTzvh.js.map +0 -1
  52. package/dist/postProcessors-D27fGZP0.js +0 -107
  53. package/dist/postProcessors-D27fGZP0.js.map +0 -1
  54. package/dist/queryWindow-Cdr7K-S1.js +0 -714
  55. package/dist/queryWindow-Cdr7K-S1.js.map +0 -1
  56. package/dist/render_resend_false-MiC__Smr.js +0 -6
  57. package/dist/render_resend_false-MiC__Smr.js.map +0 -1
  58. package/dist/schemas-Drf83ni9.js +0 -4517
  59. package/dist/schemas-Drf83ni9.js.map +0 -1
  60. package/dist/shared-CJrm9Wjp.js +0 -104
  61. package/dist/shared-CJrm9Wjp.js.map +0 -1
@@ -0,0 +1,4151 @@
1
+ //#region ../../node_modules/zod/v4/core/core.js
2
+ var _a$1;
3
+ function $constructor(name, initializer, params) {
4
+ function init(inst, def) {
5
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
6
+ value: {
7
+ def,
8
+ constr: _,
9
+ traits: /* @__PURE__ */ new Set()
10
+ },
11
+ enumerable: false
12
+ });
13
+ if (inst._zod.traits.has(name)) return;
14
+ inst._zod.traits.add(name);
15
+ initializer(inst, def);
16
+ const proto = _.prototype;
17
+ const keys = Object.keys(proto);
18
+ for (let i = 0; i < keys.length; i++) {
19
+ const k = keys[i];
20
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
21
+ }
22
+ }
23
+ const Parent = params?.Parent ?? Object;
24
+ class Definition extends Parent {}
25
+ Object.defineProperty(Definition, "name", { value: name });
26
+ function _(def) {
27
+ var _a;
28
+ const inst = params?.Parent ? new Definition() : this;
29
+ init(inst, def);
30
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
31
+ for (const fn of inst._zod.deferred) fn();
32
+ return inst;
33
+ }
34
+ Object.defineProperty(_, "init", { value: init });
35
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
36
+ if (params?.Parent && inst instanceof params.Parent) return true;
37
+ return inst?._zod?.traits?.has(name);
38
+ } });
39
+ Object.defineProperty(_, "name", { value: name });
40
+ return _;
41
+ }
42
+ var $ZodAsyncError = class extends Error {
43
+ constructor() {
44
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
45
+ }
46
+ };
47
+ var $ZodEncodeError = class extends Error {
48
+ constructor(name) {
49
+ super(`Encountered unidirectional transform during encode: ${name}`);
50
+ this.name = "ZodEncodeError";
51
+ }
52
+ };
53
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
54
+ var globalConfig = globalThis.__zod_globalConfig;
55
+ function config(newConfig) {
56
+ if (newConfig) Object.assign(globalConfig, newConfig);
57
+ return globalConfig;
58
+ }
59
+ //#endregion
60
+ //#region ../../node_modules/zod/v4/core/util.js
61
+ function getEnumValues(entries) {
62
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
63
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
64
+ }
65
+ function jsonStringifyReplacer(_, value) {
66
+ if (typeof value === "bigint") return value.toString();
67
+ return value;
68
+ }
69
+ function cached(getter) {
70
+ return { get value() {
71
+ {
72
+ const value = getter();
73
+ Object.defineProperty(this, "value", { value });
74
+ return value;
75
+ }
76
+ throw new Error("cached value already set");
77
+ } };
78
+ }
79
+ function nullish(input) {
80
+ return input === null || input === void 0;
81
+ }
82
+ function cleanRegex(source) {
83
+ const start = source.startsWith("^") ? 1 : 0;
84
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
85
+ return source.slice(start, end);
86
+ }
87
+ function floatSafeRemainder(val, step) {
88
+ const ratio = val / step;
89
+ const roundedRatio = Math.round(ratio);
90
+ const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
91
+ if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
92
+ return ratio - roundedRatio;
93
+ }
94
+ var EVALUATING = /* @__PURE__*/ Symbol("evaluating");
95
+ function defineLazy(object, key, getter) {
96
+ let value = void 0;
97
+ Object.defineProperty(object, key, {
98
+ get() {
99
+ if (value === EVALUATING) return;
100
+ if (value === void 0) {
101
+ value = EVALUATING;
102
+ value = getter();
103
+ }
104
+ return value;
105
+ },
106
+ set(v) {
107
+ Object.defineProperty(object, key, { value: v });
108
+ },
109
+ configurable: true
110
+ });
111
+ }
112
+ function assignProp(target, prop, value) {
113
+ Object.defineProperty(target, prop, {
114
+ value,
115
+ writable: true,
116
+ enumerable: true,
117
+ configurable: true
118
+ });
119
+ }
120
+ function mergeDefs(...defs) {
121
+ const mergedDescriptors = {};
122
+ for (const def of defs) {
123
+ const descriptors = Object.getOwnPropertyDescriptors(def);
124
+ Object.assign(mergedDescriptors, descriptors);
125
+ }
126
+ return Object.defineProperties({}, mergedDescriptors);
127
+ }
128
+ function esc(str) {
129
+ return JSON.stringify(str);
130
+ }
131
+ function slugify(input) {
132
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
133
+ }
134
+ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
135
+ function isObject(data) {
136
+ return typeof data === "object" && data !== null && !Array.isArray(data);
137
+ }
138
+ var allowsEval = /* @__PURE__*/ cached(() => {
139
+ if (globalConfig.jitless) return false;
140
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
141
+ try {
142
+ new Function("");
143
+ return true;
144
+ } catch (_) {
145
+ return false;
146
+ }
147
+ });
148
+ function isPlainObject(o) {
149
+ if (isObject(o) === false) return false;
150
+ const ctor = o.constructor;
151
+ if (ctor === void 0) return true;
152
+ if (typeof ctor !== "function") return true;
153
+ const prot = ctor.prototype;
154
+ if (isObject(prot) === false) return false;
155
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
156
+ return true;
157
+ }
158
+ function shallowClone(o) {
159
+ if (isPlainObject(o)) return { ...o };
160
+ if (Array.isArray(o)) return [...o];
161
+ if (o instanceof Map) return new Map(o);
162
+ if (o instanceof Set) return new Set(o);
163
+ return o;
164
+ }
165
+ var propertyKeyTypes = /* @__PURE__*/ new Set([
166
+ "string",
167
+ "number",
168
+ "symbol"
169
+ ]);
170
+ function escapeRegex(str) {
171
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
172
+ }
173
+ function clone(inst, def, params) {
174
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
175
+ if (!def || params?.parent) cl._zod.parent = inst;
176
+ return cl;
177
+ }
178
+ function normalizeParams(_params) {
179
+ const params = _params;
180
+ if (!params) return {};
181
+ if (typeof params === "string") return { error: () => params };
182
+ if (params?.message !== void 0) {
183
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
184
+ params.error = params.message;
185
+ }
186
+ delete params.message;
187
+ if (typeof params.error === "string") return {
188
+ ...params,
189
+ error: () => params.error
190
+ };
191
+ return params;
192
+ }
193
+ function optionalKeys(shape) {
194
+ return Object.keys(shape).filter((k) => {
195
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
196
+ });
197
+ }
198
+ var NUMBER_FORMAT_RANGES = {
199
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
200
+ int32: [-2147483648, 2147483647],
201
+ uint32: [0, 4294967295],
202
+ float32: [-34028234663852886e22, 34028234663852886e22],
203
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
204
+ };
205
+ function pick(schema, mask) {
206
+ const currDef = schema._zod.def;
207
+ const checks = currDef.checks;
208
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
209
+ return clone(schema, mergeDefs(schema._zod.def, {
210
+ get shape() {
211
+ const newShape = {};
212
+ for (const key in mask) {
213
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
214
+ if (!mask[key]) continue;
215
+ newShape[key] = currDef.shape[key];
216
+ }
217
+ assignProp(this, "shape", newShape);
218
+ return newShape;
219
+ },
220
+ checks: []
221
+ }));
222
+ }
223
+ function omit(schema, mask) {
224
+ const currDef = schema._zod.def;
225
+ const checks = currDef.checks;
226
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
227
+ return clone(schema, mergeDefs(schema._zod.def, {
228
+ get shape() {
229
+ const newShape = { ...schema._zod.def.shape };
230
+ for (const key in mask) {
231
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
232
+ if (!mask[key]) continue;
233
+ delete newShape[key];
234
+ }
235
+ assignProp(this, "shape", newShape);
236
+ return newShape;
237
+ },
238
+ checks: []
239
+ }));
240
+ }
241
+ function extend(schema, shape) {
242
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
243
+ const checks = schema._zod.def.checks;
244
+ if (checks && checks.length > 0) {
245
+ const existingShape = schema._zod.def.shape;
246
+ for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
247
+ }
248
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
249
+ const _shape = {
250
+ ...schema._zod.def.shape,
251
+ ...shape
252
+ };
253
+ assignProp(this, "shape", _shape);
254
+ return _shape;
255
+ } }));
256
+ }
257
+ function safeExtend(schema, shape) {
258
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
259
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
260
+ const _shape = {
261
+ ...schema._zod.def.shape,
262
+ ...shape
263
+ };
264
+ assignProp(this, "shape", _shape);
265
+ return _shape;
266
+ } }));
267
+ }
268
+ function merge(a, b) {
269
+ if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
270
+ return clone(a, mergeDefs(a._zod.def, {
271
+ get shape() {
272
+ const _shape = {
273
+ ...a._zod.def.shape,
274
+ ...b._zod.def.shape
275
+ };
276
+ assignProp(this, "shape", _shape);
277
+ return _shape;
278
+ },
279
+ get catchall() {
280
+ return b._zod.def.catchall;
281
+ },
282
+ checks: b._zod.def.checks ?? []
283
+ }));
284
+ }
285
+ function partial(Class, schema, mask) {
286
+ const checks = schema._zod.def.checks;
287
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
288
+ return clone(schema, mergeDefs(schema._zod.def, {
289
+ get shape() {
290
+ const oldShape = schema._zod.def.shape;
291
+ const shape = { ...oldShape };
292
+ if (mask) for (const key in mask) {
293
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
294
+ if (!mask[key]) continue;
295
+ shape[key] = Class ? new Class({
296
+ type: "optional",
297
+ innerType: oldShape[key]
298
+ }) : oldShape[key];
299
+ }
300
+ else for (const key in oldShape) shape[key] = Class ? new Class({
301
+ type: "optional",
302
+ innerType: oldShape[key]
303
+ }) : oldShape[key];
304
+ assignProp(this, "shape", shape);
305
+ return shape;
306
+ },
307
+ checks: []
308
+ }));
309
+ }
310
+ function required(Class, schema, mask) {
311
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
312
+ const oldShape = schema._zod.def.shape;
313
+ const shape = { ...oldShape };
314
+ if (mask) for (const key in mask) {
315
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
316
+ if (!mask[key]) continue;
317
+ shape[key] = new Class({
318
+ type: "nonoptional",
319
+ innerType: oldShape[key]
320
+ });
321
+ }
322
+ else for (const key in oldShape) shape[key] = new Class({
323
+ type: "nonoptional",
324
+ innerType: oldShape[key]
325
+ });
326
+ assignProp(this, "shape", shape);
327
+ return shape;
328
+ } }));
329
+ }
330
+ function aborted(x, startIndex = 0) {
331
+ if (x.aborted === true) return true;
332
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
333
+ return false;
334
+ }
335
+ function explicitlyAborted(x, startIndex = 0) {
336
+ if (x.aborted === true) return true;
337
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
338
+ return false;
339
+ }
340
+ function prefixIssues(path, issues) {
341
+ return issues.map((iss) => {
342
+ var _a;
343
+ (_a = iss).path ?? (_a.path = []);
344
+ iss.path.unshift(path);
345
+ return iss;
346
+ });
347
+ }
348
+ function unwrapMessage(message) {
349
+ return typeof message === "string" ? message : message?.message;
350
+ }
351
+ function finalizeIssue(iss, ctx, config) {
352
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
353
+ const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
354
+ rest.path ?? (rest.path = []);
355
+ rest.message = message;
356
+ if (ctx?.reportInput) rest.input = _input;
357
+ return rest;
358
+ }
359
+ function getLengthableOrigin(input) {
360
+ if (Array.isArray(input)) return "array";
361
+ if (typeof input === "string") return "string";
362
+ return "unknown";
363
+ }
364
+ function issue(...args) {
365
+ const [iss, input, inst] = args;
366
+ if (typeof iss === "string") return {
367
+ message: iss,
368
+ code: "custom",
369
+ input,
370
+ inst
371
+ };
372
+ return { ...iss };
373
+ }
374
+ //#endregion
375
+ //#region ../../node_modules/zod/v4/core/errors.js
376
+ var initializer$1 = (inst, def) => {
377
+ inst.name = "$ZodError";
378
+ Object.defineProperty(inst, "_zod", {
379
+ value: inst._zod,
380
+ enumerable: false
381
+ });
382
+ Object.defineProperty(inst, "issues", {
383
+ value: def,
384
+ enumerable: false
385
+ });
386
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
387
+ Object.defineProperty(inst, "toString", {
388
+ value: () => inst.message,
389
+ enumerable: false
390
+ });
391
+ };
392
+ var $ZodError = $constructor("$ZodError", initializer$1);
393
+ var $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
394
+ function flattenError(error, mapper = (issue) => issue.message) {
395
+ const fieldErrors = {};
396
+ const formErrors = [];
397
+ for (const sub of error.issues) if (sub.path.length > 0) {
398
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
399
+ fieldErrors[sub.path[0]].push(mapper(sub));
400
+ } else formErrors.push(mapper(sub));
401
+ return {
402
+ formErrors,
403
+ fieldErrors
404
+ };
405
+ }
406
+ function formatError(error, mapper = (issue) => issue.message) {
407
+ const fieldErrors = { _errors: [] };
408
+ const processError = (error, path = []) => {
409
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
410
+ else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
411
+ else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
412
+ else {
413
+ const fullpath = [...path, ...issue.path];
414
+ if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
415
+ else {
416
+ let curr = fieldErrors;
417
+ let i = 0;
418
+ while (i < fullpath.length) {
419
+ const el = fullpath[i];
420
+ if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
421
+ else {
422
+ curr[el] = curr[el] || { _errors: [] };
423
+ curr[el]._errors.push(mapper(issue));
424
+ }
425
+ curr = curr[el];
426
+ i++;
427
+ }
428
+ }
429
+ }
430
+ };
431
+ processError(error);
432
+ return fieldErrors;
433
+ }
434
+ //#endregion
435
+ //#region ../../node_modules/zod/v4/core/parse.js
436
+ var _parse = (_Err) => (schema, value, _ctx, _params) => {
437
+ const ctx = _ctx ? {
438
+ ..._ctx,
439
+ async: false
440
+ } : { async: false };
441
+ const result = schema._zod.run({
442
+ value,
443
+ issues: []
444
+ }, ctx);
445
+ if (result instanceof Promise) throw new $ZodAsyncError();
446
+ if (result.issues.length) {
447
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
448
+ captureStackTrace(e, _params?.callee);
449
+ throw e;
450
+ }
451
+ return result.value;
452
+ };
453
+ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
454
+ const ctx = _ctx ? {
455
+ ..._ctx,
456
+ async: true
457
+ } : { async: true };
458
+ let result = schema._zod.run({
459
+ value,
460
+ issues: []
461
+ }, ctx);
462
+ if (result instanceof Promise) result = await result;
463
+ if (result.issues.length) {
464
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
465
+ captureStackTrace(e, params?.callee);
466
+ throw e;
467
+ }
468
+ return result.value;
469
+ };
470
+ var _safeParse = (_Err) => (schema, value, _ctx) => {
471
+ const ctx = _ctx ? {
472
+ ..._ctx,
473
+ async: false
474
+ } : { async: false };
475
+ const result = schema._zod.run({
476
+ value,
477
+ issues: []
478
+ }, ctx);
479
+ if (result instanceof Promise) throw new $ZodAsyncError();
480
+ return result.issues.length ? {
481
+ success: false,
482
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
483
+ } : {
484
+ success: true,
485
+ data: result.value
486
+ };
487
+ };
488
+ var safeParse$1 = /* @__PURE__*/ _safeParse($ZodRealError);
489
+ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
490
+ const ctx = _ctx ? {
491
+ ..._ctx,
492
+ async: true
493
+ } : { async: true };
494
+ let result = schema._zod.run({
495
+ value,
496
+ issues: []
497
+ }, ctx);
498
+ if (result instanceof Promise) result = await result;
499
+ return result.issues.length ? {
500
+ success: false,
501
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
502
+ } : {
503
+ success: true,
504
+ data: result.value
505
+ };
506
+ };
507
+ var safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
508
+ var _encode = (_Err) => (schema, value, _ctx) => {
509
+ const ctx = _ctx ? {
510
+ ..._ctx,
511
+ direction: "backward"
512
+ } : { direction: "backward" };
513
+ return _parse(_Err)(schema, value, ctx);
514
+ };
515
+ var _decode = (_Err) => (schema, value, _ctx) => {
516
+ return _parse(_Err)(schema, value, _ctx);
517
+ };
518
+ var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
519
+ const ctx = _ctx ? {
520
+ ..._ctx,
521
+ direction: "backward"
522
+ } : { direction: "backward" };
523
+ return _parseAsync(_Err)(schema, value, ctx);
524
+ };
525
+ var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
526
+ return _parseAsync(_Err)(schema, value, _ctx);
527
+ };
528
+ var _safeEncode = (_Err) => (schema, value, _ctx) => {
529
+ const ctx = _ctx ? {
530
+ ..._ctx,
531
+ direction: "backward"
532
+ } : { direction: "backward" };
533
+ return _safeParse(_Err)(schema, value, ctx);
534
+ };
535
+ var _safeDecode = (_Err) => (schema, value, _ctx) => {
536
+ return _safeParse(_Err)(schema, value, _ctx);
537
+ };
538
+ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
539
+ const ctx = _ctx ? {
540
+ ..._ctx,
541
+ direction: "backward"
542
+ } : { direction: "backward" };
543
+ return _safeParseAsync(_Err)(schema, value, ctx);
544
+ };
545
+ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
546
+ return _safeParseAsync(_Err)(schema, value, _ctx);
547
+ };
548
+ //#endregion
549
+ //#region ../../node_modules/zod/v4/core/regexes.js
550
+ /**
551
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
552
+ * (timestamps embedded in the id). Use {@link cuid2} instead.
553
+ * See https://github.com/paralleldrive/cuid.
554
+ */
555
+ var cuid = /^[cC][0-9a-z]{6,}$/;
556
+ var cuid2 = /^[0-9a-z]+$/;
557
+ var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
558
+ var xid = /^[0-9a-vA-V]{20}$/;
559
+ var ksuid = /^[A-Za-z0-9]{27}$/;
560
+ var nanoid = /^[a-zA-Z0-9_-]{21}$/;
561
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
562
+ var duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
563
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
564
+ var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
565
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
566
+ *
567
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
568
+ var uuid = (version) => {
569
+ if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
570
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
571
+ };
572
+ /** Practical email validation */
573
+ var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
574
+ var _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
575
+ function emoji() {
576
+ return new RegExp(_emoji$1, "u");
577
+ }
578
+ var ipv4 = /^(?:(?: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])$/;
579
+ var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
580
+ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
581
+ var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
582
+ var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
583
+ var base64url = /^[A-Za-z0-9_-]*$/;
584
+ var httpProtocol = /^https?$/;
585
+ var e164 = /^\+[1-9]\d{6,14}$/;
586
+ var dateSource = `(?:(?:\\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])))`;
587
+ var date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
588
+ function timeSource(args) {
589
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
590
+ return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
591
+ }
592
+ function time$1(args) {
593
+ return new RegExp(`^${timeSource(args)}$`);
594
+ }
595
+ function datetime$1(args) {
596
+ const time = timeSource({ precision: args.precision });
597
+ const opts = ["Z"];
598
+ if (args.local) opts.push("");
599
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
600
+ const timeRegex = `${time}(?:${opts.join("|")})`;
601
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
602
+ }
603
+ var string$1 = (params) => {
604
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
605
+ return new RegExp(`^${regex}$`);
606
+ };
607
+ var integer = /^-?\d+$/;
608
+ var number$1 = /^-?\d+(?:\.\d+)?$/;
609
+ var boolean$1 = /^(?:true|false)$/i;
610
+ var lowercase = /^[^A-Z]*$/;
611
+ var uppercase = /^[^a-z]*$/;
612
+ //#endregion
613
+ //#region ../../node_modules/zod/v4/core/checks.js
614
+ var $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
615
+ var _a;
616
+ inst._zod ?? (inst._zod = {});
617
+ inst._zod.def = def;
618
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
619
+ });
620
+ var numericOriginMap = {
621
+ number: "number",
622
+ bigint: "bigint",
623
+ object: "date"
624
+ };
625
+ var $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
626
+ $ZodCheck.init(inst, def);
627
+ const origin = numericOriginMap[typeof def.value];
628
+ inst._zod.onattach.push((inst) => {
629
+ const bag = inst._zod.bag;
630
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
631
+ if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
632
+ else bag.exclusiveMaximum = def.value;
633
+ });
634
+ inst._zod.check = (payload) => {
635
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
636
+ payload.issues.push({
637
+ origin,
638
+ code: "too_big",
639
+ maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
640
+ input: payload.value,
641
+ inclusive: def.inclusive,
642
+ inst,
643
+ continue: !def.abort
644
+ });
645
+ };
646
+ });
647
+ var $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
648
+ $ZodCheck.init(inst, def);
649
+ const origin = numericOriginMap[typeof def.value];
650
+ inst._zod.onattach.push((inst) => {
651
+ const bag = inst._zod.bag;
652
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
653
+ if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
654
+ else bag.exclusiveMinimum = def.value;
655
+ });
656
+ inst._zod.check = (payload) => {
657
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
658
+ payload.issues.push({
659
+ origin,
660
+ code: "too_small",
661
+ minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
662
+ input: payload.value,
663
+ inclusive: def.inclusive,
664
+ inst,
665
+ continue: !def.abort
666
+ });
667
+ };
668
+ });
669
+ var $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
670
+ $ZodCheck.init(inst, def);
671
+ inst._zod.onattach.push((inst) => {
672
+ var _a;
673
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
674
+ });
675
+ inst._zod.check = (payload) => {
676
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
677
+ if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
678
+ payload.issues.push({
679
+ origin: typeof payload.value,
680
+ code: "not_multiple_of",
681
+ divisor: def.value,
682
+ input: payload.value,
683
+ inst,
684
+ continue: !def.abort
685
+ });
686
+ };
687
+ });
688
+ var $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def) => {
689
+ $ZodCheck.init(inst, def);
690
+ def.format = def.format || "float64";
691
+ const isInt = def.format?.includes("int");
692
+ const origin = isInt ? "int" : "number";
693
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
694
+ inst._zod.onattach.push((inst) => {
695
+ const bag = inst._zod.bag;
696
+ bag.format = def.format;
697
+ bag.minimum = minimum;
698
+ bag.maximum = maximum;
699
+ if (isInt) bag.pattern = integer;
700
+ });
701
+ inst._zod.check = (payload) => {
702
+ const input = payload.value;
703
+ if (isInt) {
704
+ if (!Number.isInteger(input)) {
705
+ payload.issues.push({
706
+ expected: origin,
707
+ format: def.format,
708
+ code: "invalid_type",
709
+ continue: false,
710
+ input,
711
+ inst
712
+ });
713
+ return;
714
+ }
715
+ if (!Number.isSafeInteger(input)) {
716
+ if (input > 0) payload.issues.push({
717
+ input,
718
+ code: "too_big",
719
+ maximum: Number.MAX_SAFE_INTEGER,
720
+ note: "Integers must be within the safe integer range.",
721
+ inst,
722
+ origin,
723
+ inclusive: true,
724
+ continue: !def.abort
725
+ });
726
+ else payload.issues.push({
727
+ input,
728
+ code: "too_small",
729
+ minimum: Number.MIN_SAFE_INTEGER,
730
+ note: "Integers must be within the safe integer range.",
731
+ inst,
732
+ origin,
733
+ inclusive: true,
734
+ continue: !def.abort
735
+ });
736
+ return;
737
+ }
738
+ }
739
+ if (input < minimum) payload.issues.push({
740
+ origin: "number",
741
+ input,
742
+ code: "too_small",
743
+ minimum,
744
+ inclusive: true,
745
+ inst,
746
+ continue: !def.abort
747
+ });
748
+ if (input > maximum) payload.issues.push({
749
+ origin: "number",
750
+ input,
751
+ code: "too_big",
752
+ maximum,
753
+ inclusive: true,
754
+ inst,
755
+ continue: !def.abort
756
+ });
757
+ };
758
+ });
759
+ var $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
760
+ var _a;
761
+ $ZodCheck.init(inst, def);
762
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
763
+ const val = payload.value;
764
+ return !nullish(val) && val.length !== void 0;
765
+ });
766
+ inst._zod.onattach.push((inst) => {
767
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
768
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
769
+ });
770
+ inst._zod.check = (payload) => {
771
+ const input = payload.value;
772
+ if (input.length <= def.maximum) return;
773
+ const origin = getLengthableOrigin(input);
774
+ payload.issues.push({
775
+ origin,
776
+ code: "too_big",
777
+ maximum: def.maximum,
778
+ inclusive: true,
779
+ input,
780
+ inst,
781
+ continue: !def.abort
782
+ });
783
+ };
784
+ });
785
+ var $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
786
+ var _a;
787
+ $ZodCheck.init(inst, def);
788
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
789
+ const val = payload.value;
790
+ return !nullish(val) && val.length !== void 0;
791
+ });
792
+ inst._zod.onattach.push((inst) => {
793
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
794
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
795
+ });
796
+ inst._zod.check = (payload) => {
797
+ const input = payload.value;
798
+ if (input.length >= def.minimum) return;
799
+ const origin = getLengthableOrigin(input);
800
+ payload.issues.push({
801
+ origin,
802
+ code: "too_small",
803
+ minimum: def.minimum,
804
+ inclusive: true,
805
+ input,
806
+ inst,
807
+ continue: !def.abort
808
+ });
809
+ };
810
+ });
811
+ var $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
812
+ var _a;
813
+ $ZodCheck.init(inst, def);
814
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
815
+ const val = payload.value;
816
+ return !nullish(val) && val.length !== void 0;
817
+ });
818
+ inst._zod.onattach.push((inst) => {
819
+ const bag = inst._zod.bag;
820
+ bag.minimum = def.length;
821
+ bag.maximum = def.length;
822
+ bag.length = def.length;
823
+ });
824
+ inst._zod.check = (payload) => {
825
+ const input = payload.value;
826
+ const length = input.length;
827
+ if (length === def.length) return;
828
+ const origin = getLengthableOrigin(input);
829
+ const tooBig = length > def.length;
830
+ payload.issues.push({
831
+ origin,
832
+ ...tooBig ? {
833
+ code: "too_big",
834
+ maximum: def.length
835
+ } : {
836
+ code: "too_small",
837
+ minimum: def.length
838
+ },
839
+ inclusive: true,
840
+ exact: true,
841
+ input: payload.value,
842
+ inst,
843
+ continue: !def.abort
844
+ });
845
+ };
846
+ });
847
+ var $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
848
+ var _a, _b;
849
+ $ZodCheck.init(inst, def);
850
+ inst._zod.onattach.push((inst) => {
851
+ const bag = inst._zod.bag;
852
+ bag.format = def.format;
853
+ if (def.pattern) {
854
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
855
+ bag.patterns.add(def.pattern);
856
+ }
857
+ });
858
+ if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
859
+ def.pattern.lastIndex = 0;
860
+ if (def.pattern.test(payload.value)) return;
861
+ payload.issues.push({
862
+ origin: "string",
863
+ code: "invalid_format",
864
+ format: def.format,
865
+ input: payload.value,
866
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
867
+ inst,
868
+ continue: !def.abort
869
+ });
870
+ });
871
+ else (_b = inst._zod).check ?? (_b.check = () => {});
872
+ });
873
+ var $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def) => {
874
+ $ZodCheckStringFormat.init(inst, def);
875
+ inst._zod.check = (payload) => {
876
+ def.pattern.lastIndex = 0;
877
+ if (def.pattern.test(payload.value)) return;
878
+ payload.issues.push({
879
+ origin: "string",
880
+ code: "invalid_format",
881
+ format: "regex",
882
+ input: payload.value,
883
+ pattern: def.pattern.toString(),
884
+ inst,
885
+ continue: !def.abort
886
+ });
887
+ };
888
+ });
889
+ var $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def) => {
890
+ def.pattern ?? (def.pattern = lowercase);
891
+ $ZodCheckStringFormat.init(inst, def);
892
+ });
893
+ var $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def) => {
894
+ def.pattern ?? (def.pattern = uppercase);
895
+ $ZodCheckStringFormat.init(inst, def);
896
+ });
897
+ var $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
898
+ $ZodCheck.init(inst, def);
899
+ const escapedRegex = escapeRegex(def.includes);
900
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
901
+ def.pattern = pattern;
902
+ inst._zod.onattach.push((inst) => {
903
+ const bag = inst._zod.bag;
904
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
905
+ bag.patterns.add(pattern);
906
+ });
907
+ inst._zod.check = (payload) => {
908
+ if (payload.value.includes(def.includes, def.position)) return;
909
+ payload.issues.push({
910
+ origin: "string",
911
+ code: "invalid_format",
912
+ format: "includes",
913
+ includes: def.includes,
914
+ input: payload.value,
915
+ inst,
916
+ continue: !def.abort
917
+ });
918
+ };
919
+ });
920
+ var $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def) => {
921
+ $ZodCheck.init(inst, def);
922
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
923
+ def.pattern ?? (def.pattern = pattern);
924
+ inst._zod.onattach.push((inst) => {
925
+ const bag = inst._zod.bag;
926
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
927
+ bag.patterns.add(pattern);
928
+ });
929
+ inst._zod.check = (payload) => {
930
+ if (payload.value.startsWith(def.prefix)) return;
931
+ payload.issues.push({
932
+ origin: "string",
933
+ code: "invalid_format",
934
+ format: "starts_with",
935
+ prefix: def.prefix,
936
+ input: payload.value,
937
+ inst,
938
+ continue: !def.abort
939
+ });
940
+ };
941
+ });
942
+ var $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def) => {
943
+ $ZodCheck.init(inst, def);
944
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
945
+ def.pattern ?? (def.pattern = pattern);
946
+ inst._zod.onattach.push((inst) => {
947
+ const bag = inst._zod.bag;
948
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
949
+ bag.patterns.add(pattern);
950
+ });
951
+ inst._zod.check = (payload) => {
952
+ if (payload.value.endsWith(def.suffix)) return;
953
+ payload.issues.push({
954
+ origin: "string",
955
+ code: "invalid_format",
956
+ format: "ends_with",
957
+ suffix: def.suffix,
958
+ input: payload.value,
959
+ inst,
960
+ continue: !def.abort
961
+ });
962
+ };
963
+ });
964
+ var $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def) => {
965
+ $ZodCheck.init(inst, def);
966
+ inst._zod.check = (payload) => {
967
+ payload.value = def.tx(payload.value);
968
+ };
969
+ });
970
+ //#endregion
971
+ //#region ../../node_modules/zod/v4/core/doc.js
972
+ var Doc = class {
973
+ constructor(args = []) {
974
+ this.content = [];
975
+ this.indent = 0;
976
+ if (this) this.args = args;
977
+ }
978
+ indented(fn) {
979
+ this.indent += 1;
980
+ fn(this);
981
+ this.indent -= 1;
982
+ }
983
+ write(arg) {
984
+ if (typeof arg === "function") {
985
+ arg(this, { execution: "sync" });
986
+ arg(this, { execution: "async" });
987
+ return;
988
+ }
989
+ const lines = arg.split("\n").filter((x) => x);
990
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
991
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
992
+ for (const line of dedented) this.content.push(line);
993
+ }
994
+ compile() {
995
+ const F = Function;
996
+ const args = this?.args;
997
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
998
+ return new F(...args, lines.join("\n"));
999
+ }
1000
+ };
1001
+ //#endregion
1002
+ //#region ../../node_modules/zod/v4/core/versions.js
1003
+ var version = {
1004
+ major: 4,
1005
+ minor: 4,
1006
+ patch: 3
1007
+ };
1008
+ //#endregion
1009
+ //#region ../../node_modules/zod/v4/core/schemas.js
1010
+ var $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1011
+ var _a;
1012
+ inst ?? (inst = {});
1013
+ inst._zod.def = def;
1014
+ inst._zod.bag = inst._zod.bag || {};
1015
+ inst._zod.version = version;
1016
+ const checks = [...inst._zod.def.checks ?? []];
1017
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1018
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1019
+ if (checks.length === 0) {
1020
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1021
+ inst._zod.deferred?.push(() => {
1022
+ inst._zod.run = inst._zod.parse;
1023
+ });
1024
+ } else {
1025
+ const runChecks = (payload, checks, ctx) => {
1026
+ let isAborted = aborted(payload);
1027
+ let asyncResult;
1028
+ for (const ch of checks) {
1029
+ if (ch._zod.def.when) {
1030
+ if (explicitlyAborted(payload)) continue;
1031
+ if (!ch._zod.def.when(payload)) continue;
1032
+ } else if (isAborted) continue;
1033
+ const currLen = payload.issues.length;
1034
+ const _ = ch._zod.check(payload);
1035
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1036
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1037
+ await _;
1038
+ if (payload.issues.length === currLen) return;
1039
+ if (!isAborted) isAborted = aborted(payload, currLen);
1040
+ });
1041
+ else {
1042
+ if (payload.issues.length === currLen) continue;
1043
+ if (!isAborted) isAborted = aborted(payload, currLen);
1044
+ }
1045
+ }
1046
+ if (asyncResult) return asyncResult.then(() => {
1047
+ return payload;
1048
+ });
1049
+ return payload;
1050
+ };
1051
+ const handleCanaryResult = (canary, payload, ctx) => {
1052
+ if (aborted(canary)) {
1053
+ canary.aborted = true;
1054
+ return canary;
1055
+ }
1056
+ const checkResult = runChecks(payload, checks, ctx);
1057
+ if (checkResult instanceof Promise) {
1058
+ if (ctx.async === false) throw new $ZodAsyncError();
1059
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
1060
+ }
1061
+ return inst._zod.parse(checkResult, ctx);
1062
+ };
1063
+ inst._zod.run = (payload, ctx) => {
1064
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1065
+ if (ctx.direction === "backward") {
1066
+ const canary = inst._zod.parse({
1067
+ value: payload.value,
1068
+ issues: []
1069
+ }, {
1070
+ ...ctx,
1071
+ skipChecks: true
1072
+ });
1073
+ if (canary instanceof Promise) return canary.then((canary) => {
1074
+ return handleCanaryResult(canary, payload, ctx);
1075
+ });
1076
+ return handleCanaryResult(canary, payload, ctx);
1077
+ }
1078
+ const result = inst._zod.parse(payload, ctx);
1079
+ if (result instanceof Promise) {
1080
+ if (ctx.async === false) throw new $ZodAsyncError();
1081
+ return result.then((result) => runChecks(result, checks, ctx));
1082
+ }
1083
+ return runChecks(result, checks, ctx);
1084
+ };
1085
+ }
1086
+ defineLazy(inst, "~standard", () => ({
1087
+ validate: (value) => {
1088
+ try {
1089
+ const r = safeParse$1(inst, value);
1090
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
1091
+ } catch (_) {
1092
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1093
+ }
1094
+ },
1095
+ vendor: "zod",
1096
+ version: 1
1097
+ }));
1098
+ });
1099
+ var $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1100
+ $ZodType.init(inst, def);
1101
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
1102
+ inst._zod.parse = (payload, _) => {
1103
+ if (def.coerce) try {
1104
+ payload.value = String(payload.value);
1105
+ } catch (_) {}
1106
+ if (typeof payload.value === "string") return payload;
1107
+ payload.issues.push({
1108
+ expected: "string",
1109
+ code: "invalid_type",
1110
+ input: payload.value,
1111
+ inst
1112
+ });
1113
+ return payload;
1114
+ };
1115
+ });
1116
+ var $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def) => {
1117
+ $ZodCheckStringFormat.init(inst, def);
1118
+ $ZodString.init(inst, def);
1119
+ });
1120
+ var $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def) => {
1121
+ def.pattern ?? (def.pattern = guid);
1122
+ $ZodStringFormat.init(inst, def);
1123
+ });
1124
+ var $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def) => {
1125
+ if (def.version) {
1126
+ const v = {
1127
+ v1: 1,
1128
+ v2: 2,
1129
+ v3: 3,
1130
+ v4: 4,
1131
+ v5: 5,
1132
+ v6: 6,
1133
+ v7: 7,
1134
+ v8: 8
1135
+ }[def.version];
1136
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
1137
+ def.pattern ?? (def.pattern = uuid(v));
1138
+ } else def.pattern ?? (def.pattern = uuid());
1139
+ $ZodStringFormat.init(inst, def);
1140
+ });
1141
+ var $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
1142
+ def.pattern ?? (def.pattern = email);
1143
+ $ZodStringFormat.init(inst, def);
1144
+ });
1145
+ var $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1146
+ $ZodStringFormat.init(inst, def);
1147
+ inst._zod.check = (payload) => {
1148
+ try {
1149
+ const trimmed = payload.value.trim();
1150
+ if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1151
+ if (!/^https?:\/\//i.test(trimmed)) {
1152
+ payload.issues.push({
1153
+ code: "invalid_format",
1154
+ format: "url",
1155
+ note: "Invalid URL format",
1156
+ input: payload.value,
1157
+ inst,
1158
+ continue: !def.abort
1159
+ });
1160
+ return;
1161
+ }
1162
+ }
1163
+ const url = new URL(trimmed);
1164
+ if (def.hostname) {
1165
+ def.hostname.lastIndex = 0;
1166
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1167
+ code: "invalid_format",
1168
+ format: "url",
1169
+ note: "Invalid hostname",
1170
+ pattern: def.hostname.source,
1171
+ input: payload.value,
1172
+ inst,
1173
+ continue: !def.abort
1174
+ });
1175
+ }
1176
+ if (def.protocol) {
1177
+ def.protocol.lastIndex = 0;
1178
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1179
+ code: "invalid_format",
1180
+ format: "url",
1181
+ note: "Invalid protocol",
1182
+ pattern: def.protocol.source,
1183
+ input: payload.value,
1184
+ inst,
1185
+ continue: !def.abort
1186
+ });
1187
+ }
1188
+ if (def.normalize) payload.value = url.href;
1189
+ else payload.value = trimmed;
1190
+ return;
1191
+ } catch (_) {
1192
+ payload.issues.push({
1193
+ code: "invalid_format",
1194
+ format: "url",
1195
+ input: payload.value,
1196
+ inst,
1197
+ continue: !def.abort
1198
+ });
1199
+ }
1200
+ };
1201
+ });
1202
+ var $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
1203
+ def.pattern ?? (def.pattern = emoji());
1204
+ $ZodStringFormat.init(inst, def);
1205
+ });
1206
+ var $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1207
+ def.pattern ?? (def.pattern = nanoid);
1208
+ $ZodStringFormat.init(inst, def);
1209
+ });
1210
+ /**
1211
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
1212
+ * (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
1213
+ * See https://github.com/paralleldrive/cuid.
1214
+ */
1215
+ var $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def) => {
1216
+ def.pattern ?? (def.pattern = cuid);
1217
+ $ZodStringFormat.init(inst, def);
1218
+ });
1219
+ var $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def) => {
1220
+ def.pattern ?? (def.pattern = cuid2);
1221
+ $ZodStringFormat.init(inst, def);
1222
+ });
1223
+ var $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def) => {
1224
+ def.pattern ?? (def.pattern = ulid);
1225
+ $ZodStringFormat.init(inst, def);
1226
+ });
1227
+ var $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def) => {
1228
+ def.pattern ?? (def.pattern = xid);
1229
+ $ZodStringFormat.init(inst, def);
1230
+ });
1231
+ var $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1232
+ def.pattern ?? (def.pattern = ksuid);
1233
+ $ZodStringFormat.init(inst, def);
1234
+ });
1235
+ var $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1236
+ def.pattern ?? (def.pattern = datetime$1(def));
1237
+ $ZodStringFormat.init(inst, def);
1238
+ });
1239
+ var $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1240
+ def.pattern ?? (def.pattern = date$1);
1241
+ $ZodStringFormat.init(inst, def);
1242
+ });
1243
+ var $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1244
+ def.pattern ?? (def.pattern = time$1(def));
1245
+ $ZodStringFormat.init(inst, def);
1246
+ });
1247
+ var $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1248
+ def.pattern ?? (def.pattern = duration$1);
1249
+ $ZodStringFormat.init(inst, def);
1250
+ });
1251
+ var $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1252
+ def.pattern ?? (def.pattern = ipv4);
1253
+ $ZodStringFormat.init(inst, def);
1254
+ inst._zod.bag.format = `ipv4`;
1255
+ });
1256
+ var $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1257
+ def.pattern ?? (def.pattern = ipv6);
1258
+ $ZodStringFormat.init(inst, def);
1259
+ inst._zod.bag.format = `ipv6`;
1260
+ inst._zod.check = (payload) => {
1261
+ try {
1262
+ new URL(`http://[${payload.value}]`);
1263
+ } catch {
1264
+ payload.issues.push({
1265
+ code: "invalid_format",
1266
+ format: "ipv6",
1267
+ input: payload.value,
1268
+ inst,
1269
+ continue: !def.abort
1270
+ });
1271
+ }
1272
+ };
1273
+ });
1274
+ var $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1275
+ def.pattern ?? (def.pattern = cidrv4);
1276
+ $ZodStringFormat.init(inst, def);
1277
+ });
1278
+ var $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1279
+ def.pattern ?? (def.pattern = cidrv6);
1280
+ $ZodStringFormat.init(inst, def);
1281
+ inst._zod.check = (payload) => {
1282
+ const parts = payload.value.split("/");
1283
+ try {
1284
+ if (parts.length !== 2) throw new Error();
1285
+ const [address, prefix] = parts;
1286
+ if (!prefix) throw new Error();
1287
+ const prefixNum = Number(prefix);
1288
+ if (`${prefixNum}` !== prefix) throw new Error();
1289
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1290
+ new URL(`http://[${address}]`);
1291
+ } catch {
1292
+ payload.issues.push({
1293
+ code: "invalid_format",
1294
+ format: "cidrv6",
1295
+ input: payload.value,
1296
+ inst,
1297
+ continue: !def.abort
1298
+ });
1299
+ }
1300
+ };
1301
+ });
1302
+ function isValidBase64(data) {
1303
+ if (data === "") return true;
1304
+ if (/\s/.test(data)) return false;
1305
+ if (data.length % 4 !== 0) return false;
1306
+ try {
1307
+ atob(data);
1308
+ return true;
1309
+ } catch {
1310
+ return false;
1311
+ }
1312
+ }
1313
+ var $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
1314
+ def.pattern ?? (def.pattern = base64);
1315
+ $ZodStringFormat.init(inst, def);
1316
+ inst._zod.bag.contentEncoding = "base64";
1317
+ inst._zod.check = (payload) => {
1318
+ if (isValidBase64(payload.value)) return;
1319
+ payload.issues.push({
1320
+ code: "invalid_format",
1321
+ format: "base64",
1322
+ input: payload.value,
1323
+ inst,
1324
+ continue: !def.abort
1325
+ });
1326
+ };
1327
+ });
1328
+ function isValidBase64URL(data) {
1329
+ if (!base64url.test(data)) return false;
1330
+ const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1331
+ return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
1332
+ }
1333
+ var $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
1334
+ def.pattern ?? (def.pattern = base64url);
1335
+ $ZodStringFormat.init(inst, def);
1336
+ inst._zod.bag.contentEncoding = "base64url";
1337
+ inst._zod.check = (payload) => {
1338
+ if (isValidBase64URL(payload.value)) return;
1339
+ payload.issues.push({
1340
+ code: "invalid_format",
1341
+ format: "base64url",
1342
+ input: payload.value,
1343
+ inst,
1344
+ continue: !def.abort
1345
+ });
1346
+ };
1347
+ });
1348
+ var $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def) => {
1349
+ def.pattern ?? (def.pattern = e164);
1350
+ $ZodStringFormat.init(inst, def);
1351
+ });
1352
+ function isValidJWT(token, algorithm = null) {
1353
+ try {
1354
+ const tokensParts = token.split(".");
1355
+ if (tokensParts.length !== 3) return false;
1356
+ const [header] = tokensParts;
1357
+ if (!header) return false;
1358
+ const parsedHeader = JSON.parse(atob(header));
1359
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1360
+ if (!parsedHeader.alg) return false;
1361
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1362
+ return true;
1363
+ } catch {
1364
+ return false;
1365
+ }
1366
+ }
1367
+ var $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
1368
+ $ZodStringFormat.init(inst, def);
1369
+ inst._zod.check = (payload) => {
1370
+ if (isValidJWT(payload.value, def.alg)) return;
1371
+ payload.issues.push({
1372
+ code: "invalid_format",
1373
+ format: "jwt",
1374
+ input: payload.value,
1375
+ inst,
1376
+ continue: !def.abort
1377
+ });
1378
+ };
1379
+ });
1380
+ var $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
1381
+ $ZodType.init(inst, def);
1382
+ inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
1383
+ inst._zod.parse = (payload, _ctx) => {
1384
+ if (def.coerce) try {
1385
+ payload.value = Number(payload.value);
1386
+ } catch (_) {}
1387
+ const input = payload.value;
1388
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1389
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
1390
+ payload.issues.push({
1391
+ expected: "number",
1392
+ code: "invalid_type",
1393
+ input,
1394
+ inst,
1395
+ ...received ? { received } : {}
1396
+ });
1397
+ return payload;
1398
+ };
1399
+ });
1400
+ var $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumberFormat", (inst, def) => {
1401
+ $ZodCheckNumberFormat.init(inst, def);
1402
+ $ZodNumber.init(inst, def);
1403
+ });
1404
+ var $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def) => {
1405
+ $ZodType.init(inst, def);
1406
+ inst._zod.pattern = boolean$1;
1407
+ inst._zod.parse = (payload, _ctx) => {
1408
+ if (def.coerce) try {
1409
+ payload.value = Boolean(payload.value);
1410
+ } catch (_) {}
1411
+ const input = payload.value;
1412
+ if (typeof input === "boolean") return payload;
1413
+ payload.issues.push({
1414
+ expected: "boolean",
1415
+ code: "invalid_type",
1416
+ input,
1417
+ inst
1418
+ });
1419
+ return payload;
1420
+ };
1421
+ });
1422
+ var $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def) => {
1423
+ $ZodType.init(inst, def);
1424
+ inst._zod.parse = (payload) => payload;
1425
+ });
1426
+ var $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def) => {
1427
+ $ZodType.init(inst, def);
1428
+ inst._zod.parse = (payload, _ctx) => {
1429
+ payload.issues.push({
1430
+ expected: "never",
1431
+ code: "invalid_type",
1432
+ input: payload.value,
1433
+ inst
1434
+ });
1435
+ return payload;
1436
+ };
1437
+ });
1438
+ function handleArrayResult(result, final, index) {
1439
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1440
+ final.value[index] = result.value;
1441
+ }
1442
+ var $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1443
+ $ZodType.init(inst, def);
1444
+ inst._zod.parse = (payload, ctx) => {
1445
+ const input = payload.value;
1446
+ if (!Array.isArray(input)) {
1447
+ payload.issues.push({
1448
+ expected: "array",
1449
+ code: "invalid_type",
1450
+ input,
1451
+ inst
1452
+ });
1453
+ return payload;
1454
+ }
1455
+ payload.value = Array(input.length);
1456
+ const proms = [];
1457
+ for (let i = 0; i < input.length; i++) {
1458
+ const item = input[i];
1459
+ const result = def.element._zod.run({
1460
+ value: item,
1461
+ issues: []
1462
+ }, ctx);
1463
+ if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1464
+ else handleArrayResult(result, payload, i);
1465
+ }
1466
+ if (proms.length) return Promise.all(proms).then(() => payload);
1467
+ return payload;
1468
+ };
1469
+ });
1470
+ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1471
+ const isPresent = key in input;
1472
+ if (result.issues.length) {
1473
+ if (isOptionalIn && isOptionalOut && !isPresent) return;
1474
+ final.issues.push(...prefixIssues(key, result.issues));
1475
+ }
1476
+ if (!isPresent && !isOptionalIn) {
1477
+ if (!result.issues.length) final.issues.push({
1478
+ code: "invalid_type",
1479
+ expected: "nonoptional",
1480
+ input: void 0,
1481
+ path: [key]
1482
+ });
1483
+ return;
1484
+ }
1485
+ if (result.value === void 0) {
1486
+ if (isPresent) final.value[key] = void 0;
1487
+ } else final.value[key] = result.value;
1488
+ }
1489
+ function normalizeDef(def) {
1490
+ const keys = Object.keys(def.shape);
1491
+ for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1492
+ const okeys = optionalKeys(def.shape);
1493
+ return {
1494
+ ...def,
1495
+ keys,
1496
+ keySet: new Set(keys),
1497
+ numKeys: keys.length,
1498
+ optionalKeys: new Set(okeys)
1499
+ };
1500
+ }
1501
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1502
+ const unrecognized = [];
1503
+ const keySet = def.keySet;
1504
+ const _catchall = def.catchall._zod;
1505
+ const t = _catchall.def.type;
1506
+ const isOptionalIn = _catchall.optin === "optional";
1507
+ const isOptionalOut = _catchall.optout === "optional";
1508
+ for (const key in input) {
1509
+ if (key === "__proto__") continue;
1510
+ if (keySet.has(key)) continue;
1511
+ if (t === "never") {
1512
+ unrecognized.push(key);
1513
+ continue;
1514
+ }
1515
+ const r = _catchall.run({
1516
+ value: input[key],
1517
+ issues: []
1518
+ }, ctx);
1519
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1520
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1521
+ }
1522
+ if (unrecognized.length) payload.issues.push({
1523
+ code: "unrecognized_keys",
1524
+ keys: unrecognized,
1525
+ input,
1526
+ inst
1527
+ });
1528
+ if (!proms.length) return payload;
1529
+ return Promise.all(proms).then(() => {
1530
+ return payload;
1531
+ });
1532
+ }
1533
+ var $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1534
+ $ZodType.init(inst, def);
1535
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1536
+ const sh = def.shape;
1537
+ Object.defineProperty(def, "shape", { get: () => {
1538
+ const newSh = { ...sh };
1539
+ Object.defineProperty(def, "shape", { value: newSh });
1540
+ return newSh;
1541
+ } });
1542
+ }
1543
+ const _normalized = cached(() => normalizeDef(def));
1544
+ defineLazy(inst._zod, "propValues", () => {
1545
+ const shape = def.shape;
1546
+ const propValues = {};
1547
+ for (const key in shape) {
1548
+ const field = shape[key]._zod;
1549
+ if (field.values) {
1550
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1551
+ for (const v of field.values) propValues[key].add(v);
1552
+ }
1553
+ }
1554
+ return propValues;
1555
+ });
1556
+ const isObject$2 = isObject;
1557
+ const catchall = def.catchall;
1558
+ let value;
1559
+ inst._zod.parse = (payload, ctx) => {
1560
+ value ?? (value = _normalized.value);
1561
+ const input = payload.value;
1562
+ if (!isObject$2(input)) {
1563
+ payload.issues.push({
1564
+ expected: "object",
1565
+ code: "invalid_type",
1566
+ input,
1567
+ inst
1568
+ });
1569
+ return payload;
1570
+ }
1571
+ payload.value = {};
1572
+ const proms = [];
1573
+ const shape = value.shape;
1574
+ for (const key of value.keys) {
1575
+ const el = shape[key];
1576
+ const isOptionalIn = el._zod.optin === "optional";
1577
+ const isOptionalOut = el._zod.optout === "optional";
1578
+ const r = el._zod.run({
1579
+ value: input[key],
1580
+ issues: []
1581
+ }, ctx);
1582
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1583
+ else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1584
+ }
1585
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1586
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1587
+ };
1588
+ });
1589
+ var $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
1590
+ $ZodObject.init(inst, def);
1591
+ const superParse = inst._zod.parse;
1592
+ const _normalized = cached(() => normalizeDef(def));
1593
+ const generateFastpass = (shape) => {
1594
+ const doc = new Doc([
1595
+ "shape",
1596
+ "payload",
1597
+ "ctx"
1598
+ ]);
1599
+ const normalized = _normalized.value;
1600
+ const parseStr = (key) => {
1601
+ const k = esc(key);
1602
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1603
+ };
1604
+ doc.write(`const input = payload.value;`);
1605
+ const ids = Object.create(null);
1606
+ let counter = 0;
1607
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1608
+ doc.write(`const newResult = {};`);
1609
+ for (const key of normalized.keys) {
1610
+ const id = ids[key];
1611
+ const k = esc(key);
1612
+ const schema = shape[key];
1613
+ const isOptionalIn = schema?._zod?.optin === "optional";
1614
+ const isOptionalOut = schema?._zod?.optout === "optional";
1615
+ doc.write(`const ${id} = ${parseStr(key)};`);
1616
+ if (isOptionalIn && isOptionalOut) doc.write(`
1617
+ if (${id}.issues.length) {
1618
+ if (${k} in input) {
1619
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1620
+ ...iss,
1621
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1622
+ })));
1623
+ }
1624
+ }
1625
+
1626
+ if (${id}.value === undefined) {
1627
+ if (${k} in input) {
1628
+ newResult[${k}] = undefined;
1629
+ }
1630
+ } else {
1631
+ newResult[${k}] = ${id}.value;
1632
+ }
1633
+
1634
+ `);
1635
+ else if (!isOptionalIn) doc.write(`
1636
+ const ${id}_present = ${k} in input;
1637
+ if (${id}.issues.length) {
1638
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1639
+ ...iss,
1640
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1641
+ })));
1642
+ }
1643
+ if (!${id}_present && !${id}.issues.length) {
1644
+ payload.issues.push({
1645
+ code: "invalid_type",
1646
+ expected: "nonoptional",
1647
+ input: undefined,
1648
+ path: [${k}]
1649
+ });
1650
+ }
1651
+
1652
+ if (${id}_present) {
1653
+ if (${id}.value === undefined) {
1654
+ newResult[${k}] = undefined;
1655
+ } else {
1656
+ newResult[${k}] = ${id}.value;
1657
+ }
1658
+ }
1659
+
1660
+ `);
1661
+ else doc.write(`
1662
+ if (${id}.issues.length) {
1663
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1664
+ ...iss,
1665
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1666
+ })));
1667
+ }
1668
+
1669
+ if (${id}.value === undefined) {
1670
+ if (${k} in input) {
1671
+ newResult[${k}] = undefined;
1672
+ }
1673
+ } else {
1674
+ newResult[${k}] = ${id}.value;
1675
+ }
1676
+
1677
+ `);
1678
+ }
1679
+ doc.write(`payload.value = newResult;`);
1680
+ doc.write(`return payload;`);
1681
+ const fn = doc.compile();
1682
+ return (payload, ctx) => fn(shape, payload, ctx);
1683
+ };
1684
+ let fastpass;
1685
+ const isObject$1 = isObject;
1686
+ const jit = !globalConfig.jitless;
1687
+ const fastEnabled = jit && allowsEval.value;
1688
+ const catchall = def.catchall;
1689
+ let value;
1690
+ inst._zod.parse = (payload, ctx) => {
1691
+ value ?? (value = _normalized.value);
1692
+ const input = payload.value;
1693
+ if (!isObject$1(input)) {
1694
+ payload.issues.push({
1695
+ expected: "object",
1696
+ code: "invalid_type",
1697
+ input,
1698
+ inst
1699
+ });
1700
+ return payload;
1701
+ }
1702
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1703
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1704
+ payload = fastpass(payload, ctx);
1705
+ if (!catchall) return payload;
1706
+ return handleCatchall([], input, payload, ctx, value, inst);
1707
+ }
1708
+ return superParse(payload, ctx);
1709
+ };
1710
+ });
1711
+ function handleUnionResults(results, final, inst, ctx) {
1712
+ for (const result of results) if (result.issues.length === 0) {
1713
+ final.value = result.value;
1714
+ return final;
1715
+ }
1716
+ const nonaborted = results.filter((r) => !aborted(r));
1717
+ if (nonaborted.length === 1) {
1718
+ final.value = nonaborted[0].value;
1719
+ return nonaborted[0];
1720
+ }
1721
+ final.issues.push({
1722
+ code: "invalid_union",
1723
+ input: final.value,
1724
+ inst,
1725
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1726
+ });
1727
+ return final;
1728
+ }
1729
+ var $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1730
+ $ZodType.init(inst, def);
1731
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1732
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1733
+ defineLazy(inst._zod, "values", () => {
1734
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1735
+ });
1736
+ defineLazy(inst._zod, "pattern", () => {
1737
+ if (def.options.every((o) => o._zod.pattern)) {
1738
+ const patterns = def.options.map((o) => o._zod.pattern);
1739
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1740
+ }
1741
+ });
1742
+ const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1743
+ inst._zod.parse = (payload, ctx) => {
1744
+ if (first) return first(payload, ctx);
1745
+ let async = false;
1746
+ const results = [];
1747
+ for (const option of def.options) {
1748
+ const result = option._zod.run({
1749
+ value: payload.value,
1750
+ issues: []
1751
+ }, ctx);
1752
+ if (result instanceof Promise) {
1753
+ results.push(result);
1754
+ async = true;
1755
+ } else {
1756
+ if (result.issues.length === 0) return result;
1757
+ results.push(result);
1758
+ }
1759
+ }
1760
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1761
+ return Promise.all(results).then((results) => {
1762
+ return handleUnionResults(results, payload, inst, ctx);
1763
+ });
1764
+ };
1765
+ });
1766
+ var $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
1767
+ $ZodType.init(inst, def);
1768
+ inst._zod.parse = (payload, ctx) => {
1769
+ const input = payload.value;
1770
+ const left = def.left._zod.run({
1771
+ value: input,
1772
+ issues: []
1773
+ }, ctx);
1774
+ const right = def.right._zod.run({
1775
+ value: input,
1776
+ issues: []
1777
+ }, ctx);
1778
+ if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
1779
+ return handleIntersectionResults(payload, left, right);
1780
+ });
1781
+ return handleIntersectionResults(payload, left, right);
1782
+ };
1783
+ });
1784
+ function mergeValues(a, b) {
1785
+ if (a === b) return {
1786
+ valid: true,
1787
+ data: a
1788
+ };
1789
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1790
+ valid: true,
1791
+ data: a
1792
+ };
1793
+ if (isPlainObject(a) && isPlainObject(b)) {
1794
+ const bKeys = Object.keys(b);
1795
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1796
+ const newObj = {
1797
+ ...a,
1798
+ ...b
1799
+ };
1800
+ for (const key of sharedKeys) {
1801
+ const sharedValue = mergeValues(a[key], b[key]);
1802
+ if (!sharedValue.valid) return {
1803
+ valid: false,
1804
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1805
+ };
1806
+ newObj[key] = sharedValue.data;
1807
+ }
1808
+ return {
1809
+ valid: true,
1810
+ data: newObj
1811
+ };
1812
+ }
1813
+ if (Array.isArray(a) && Array.isArray(b)) {
1814
+ if (a.length !== b.length) return {
1815
+ valid: false,
1816
+ mergeErrorPath: []
1817
+ };
1818
+ const newArray = [];
1819
+ for (let index = 0; index < a.length; index++) {
1820
+ const itemA = a[index];
1821
+ const itemB = b[index];
1822
+ const sharedValue = mergeValues(itemA, itemB);
1823
+ if (!sharedValue.valid) return {
1824
+ valid: false,
1825
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1826
+ };
1827
+ newArray.push(sharedValue.data);
1828
+ }
1829
+ return {
1830
+ valid: true,
1831
+ data: newArray
1832
+ };
1833
+ }
1834
+ return {
1835
+ valid: false,
1836
+ mergeErrorPath: []
1837
+ };
1838
+ }
1839
+ function handleIntersectionResults(result, left, right) {
1840
+ const unrecKeys = /* @__PURE__ */ new Map();
1841
+ let unrecIssue;
1842
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1843
+ unrecIssue ?? (unrecIssue = iss);
1844
+ for (const k of iss.keys) {
1845
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1846
+ unrecKeys.get(k).l = true;
1847
+ }
1848
+ } else result.issues.push(iss);
1849
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1850
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1851
+ unrecKeys.get(k).r = true;
1852
+ }
1853
+ else result.issues.push(iss);
1854
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1855
+ if (bothKeys.length && unrecIssue) result.issues.push({
1856
+ ...unrecIssue,
1857
+ keys: bothKeys
1858
+ });
1859
+ if (aborted(result)) return result;
1860
+ const merged = mergeValues(left.value, right.value);
1861
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1862
+ result.value = merged.data;
1863
+ return result;
1864
+ }
1865
+ var $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
1866
+ $ZodType.init(inst, def);
1867
+ inst._zod.parse = (payload, ctx) => {
1868
+ const input = payload.value;
1869
+ if (!isPlainObject(input)) {
1870
+ payload.issues.push({
1871
+ expected: "record",
1872
+ code: "invalid_type",
1873
+ input,
1874
+ inst
1875
+ });
1876
+ return payload;
1877
+ }
1878
+ const proms = [];
1879
+ const values = def.keyType._zod.values;
1880
+ if (values) {
1881
+ payload.value = {};
1882
+ const recordKeys = /* @__PURE__ */ new Set();
1883
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1884
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1885
+ const keyResult = def.keyType._zod.run({
1886
+ value: key,
1887
+ issues: []
1888
+ }, ctx);
1889
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1890
+ if (keyResult.issues.length) {
1891
+ payload.issues.push({
1892
+ code: "invalid_key",
1893
+ origin: "record",
1894
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1895
+ input: key,
1896
+ path: [key],
1897
+ inst
1898
+ });
1899
+ continue;
1900
+ }
1901
+ const outKey = keyResult.value;
1902
+ const result = def.valueType._zod.run({
1903
+ value: input[key],
1904
+ issues: []
1905
+ }, ctx);
1906
+ if (result instanceof Promise) proms.push(result.then((result) => {
1907
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1908
+ payload.value[outKey] = result.value;
1909
+ }));
1910
+ else {
1911
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1912
+ payload.value[outKey] = result.value;
1913
+ }
1914
+ }
1915
+ let unrecognized;
1916
+ for (const key in input) if (!recordKeys.has(key)) {
1917
+ unrecognized = unrecognized ?? [];
1918
+ unrecognized.push(key);
1919
+ }
1920
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
1921
+ code: "unrecognized_keys",
1922
+ input,
1923
+ inst,
1924
+ keys: unrecognized
1925
+ });
1926
+ } else {
1927
+ payload.value = {};
1928
+ for (const key of Reflect.ownKeys(input)) {
1929
+ if (key === "__proto__") continue;
1930
+ if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
1931
+ let keyResult = def.keyType._zod.run({
1932
+ value: key,
1933
+ issues: []
1934
+ }, ctx);
1935
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1936
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
1937
+ const retryResult = def.keyType._zod.run({
1938
+ value: Number(key),
1939
+ issues: []
1940
+ }, ctx);
1941
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1942
+ if (retryResult.issues.length === 0) keyResult = retryResult;
1943
+ }
1944
+ if (keyResult.issues.length) {
1945
+ if (def.mode === "loose") payload.value[key] = input[key];
1946
+ else payload.issues.push({
1947
+ code: "invalid_key",
1948
+ origin: "record",
1949
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1950
+ input: key,
1951
+ path: [key],
1952
+ inst
1953
+ });
1954
+ continue;
1955
+ }
1956
+ const result = def.valueType._zod.run({
1957
+ value: input[key],
1958
+ issues: []
1959
+ }, ctx);
1960
+ if (result instanceof Promise) proms.push(result.then((result) => {
1961
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1962
+ payload.value[keyResult.value] = result.value;
1963
+ }));
1964
+ else {
1965
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1966
+ payload.value[keyResult.value] = result.value;
1967
+ }
1968
+ }
1969
+ }
1970
+ if (proms.length) return Promise.all(proms).then(() => payload);
1971
+ return payload;
1972
+ };
1973
+ });
1974
+ var $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1975
+ $ZodType.init(inst, def);
1976
+ const values = getEnumValues(def.entries);
1977
+ const valuesSet = new Set(values);
1978
+ inst._zod.values = valuesSet;
1979
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1980
+ inst._zod.parse = (payload, _ctx) => {
1981
+ const input = payload.value;
1982
+ if (valuesSet.has(input)) return payload;
1983
+ payload.issues.push({
1984
+ code: "invalid_value",
1985
+ values,
1986
+ input,
1987
+ inst
1988
+ });
1989
+ return payload;
1990
+ };
1991
+ });
1992
+ var $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1993
+ $ZodType.init(inst, def);
1994
+ inst._zod.optin = "optional";
1995
+ inst._zod.parse = (payload, ctx) => {
1996
+ if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1997
+ const _out = def.transform(payload.value, payload);
1998
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1999
+ payload.value = output;
2000
+ payload.fallback = true;
2001
+ return payload;
2002
+ });
2003
+ if (_out instanceof Promise) throw new $ZodAsyncError();
2004
+ payload.value = _out;
2005
+ payload.fallback = true;
2006
+ return payload;
2007
+ };
2008
+ });
2009
+ function handleOptionalResult(result, input) {
2010
+ if (input === void 0 && (result.issues.length || result.fallback)) return {
2011
+ issues: [],
2012
+ value: void 0
2013
+ };
2014
+ return result;
2015
+ }
2016
+ var $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2017
+ $ZodType.init(inst, def);
2018
+ inst._zod.optin = "optional";
2019
+ inst._zod.optout = "optional";
2020
+ defineLazy(inst._zod, "values", () => {
2021
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2022
+ });
2023
+ defineLazy(inst._zod, "pattern", () => {
2024
+ const pattern = def.innerType._zod.pattern;
2025
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2026
+ });
2027
+ inst._zod.parse = (payload, ctx) => {
2028
+ if (def.innerType._zod.optin === "optional") {
2029
+ const input = payload.value;
2030
+ const result = def.innerType._zod.run(payload, ctx);
2031
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
2032
+ return handleOptionalResult(result, input);
2033
+ }
2034
+ if (payload.value === void 0) return payload;
2035
+ return def.innerType._zod.run(payload, ctx);
2036
+ };
2037
+ });
2038
+ var $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2039
+ $ZodOptional.init(inst, def);
2040
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2041
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2042
+ inst._zod.parse = (payload, ctx) => {
2043
+ return def.innerType._zod.run(payload, ctx);
2044
+ };
2045
+ });
2046
+ var $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2047
+ $ZodType.init(inst, def);
2048
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2049
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2050
+ defineLazy(inst._zod, "pattern", () => {
2051
+ const pattern = def.innerType._zod.pattern;
2052
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2053
+ });
2054
+ defineLazy(inst._zod, "values", () => {
2055
+ return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2056
+ });
2057
+ inst._zod.parse = (payload, ctx) => {
2058
+ if (payload.value === null) return payload;
2059
+ return def.innerType._zod.run(payload, ctx);
2060
+ };
2061
+ });
2062
+ var $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
2063
+ $ZodType.init(inst, def);
2064
+ inst._zod.optin = "optional";
2065
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2066
+ inst._zod.parse = (payload, ctx) => {
2067
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2068
+ if (payload.value === void 0) {
2069
+ payload.value = def.defaultValue;
2070
+ /**
2071
+ * $ZodDefault returns the default value immediately in forward direction.
2072
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
2073
+ return payload;
2074
+ }
2075
+ const result = def.innerType._zod.run(payload, ctx);
2076
+ if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
2077
+ return handleDefaultResult(result, def);
2078
+ };
2079
+ });
2080
+ function handleDefaultResult(payload, def) {
2081
+ if (payload.value === void 0) payload.value = def.defaultValue;
2082
+ return payload;
2083
+ }
2084
+ var $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2085
+ $ZodType.init(inst, def);
2086
+ inst._zod.optin = "optional";
2087
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2088
+ inst._zod.parse = (payload, ctx) => {
2089
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2090
+ if (payload.value === void 0) payload.value = def.defaultValue;
2091
+ return def.innerType._zod.run(payload, ctx);
2092
+ };
2093
+ });
2094
+ var $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2095
+ $ZodType.init(inst, def);
2096
+ defineLazy(inst._zod, "values", () => {
2097
+ const v = def.innerType._zod.values;
2098
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2099
+ });
2100
+ inst._zod.parse = (payload, ctx) => {
2101
+ const result = def.innerType._zod.run(payload, ctx);
2102
+ if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
2103
+ return handleNonOptionalResult(result, inst);
2104
+ };
2105
+ });
2106
+ function handleNonOptionalResult(payload, inst) {
2107
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
2108
+ code: "invalid_type",
2109
+ expected: "nonoptional",
2110
+ input: payload.value,
2111
+ inst
2112
+ });
2113
+ return payload;
2114
+ }
2115
+ var $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2116
+ $ZodType.init(inst, def);
2117
+ inst._zod.optin = "optional";
2118
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2119
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2120
+ inst._zod.parse = (payload, ctx) => {
2121
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2122
+ const result = def.innerType._zod.run(payload, ctx);
2123
+ if (result instanceof Promise) return result.then((result) => {
2124
+ payload.value = result.value;
2125
+ if (result.issues.length) {
2126
+ payload.value = def.catchValue({
2127
+ ...payload,
2128
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2129
+ input: payload.value
2130
+ });
2131
+ payload.issues = [];
2132
+ payload.fallback = true;
2133
+ }
2134
+ return payload;
2135
+ });
2136
+ payload.value = result.value;
2137
+ if (result.issues.length) {
2138
+ payload.value = def.catchValue({
2139
+ ...payload,
2140
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2141
+ input: payload.value
2142
+ });
2143
+ payload.issues = [];
2144
+ payload.fallback = true;
2145
+ }
2146
+ return payload;
2147
+ };
2148
+ });
2149
+ var $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2150
+ $ZodType.init(inst, def);
2151
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
2152
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2153
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2154
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2155
+ inst._zod.parse = (payload, ctx) => {
2156
+ if (ctx.direction === "backward") {
2157
+ const right = def.out._zod.run(payload, ctx);
2158
+ if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
2159
+ return handlePipeResult(right, def.in, ctx);
2160
+ }
2161
+ const left = def.in._zod.run(payload, ctx);
2162
+ if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
2163
+ return handlePipeResult(left, def.out, ctx);
2164
+ };
2165
+ });
2166
+ function handlePipeResult(left, next, ctx) {
2167
+ if (left.issues.length) {
2168
+ left.aborted = true;
2169
+ return left;
2170
+ }
2171
+ return next._zod.run({
2172
+ value: left.value,
2173
+ issues: left.issues,
2174
+ fallback: left.fallback
2175
+ }, ctx);
2176
+ }
2177
+ var $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2178
+ $ZodType.init(inst, def);
2179
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2180
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2181
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2182
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2183
+ inst._zod.parse = (payload, ctx) => {
2184
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2185
+ const result = def.innerType._zod.run(payload, ctx);
2186
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
2187
+ return handleReadonlyResult(result);
2188
+ };
2189
+ });
2190
+ function handleReadonlyResult(payload) {
2191
+ payload.value = Object.freeze(payload.value);
2192
+ return payload;
2193
+ }
2194
+ var $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2195
+ $ZodCheck.init(inst, def);
2196
+ $ZodType.init(inst, def);
2197
+ inst._zod.parse = (payload, _) => {
2198
+ return payload;
2199
+ };
2200
+ inst._zod.check = (payload) => {
2201
+ const input = payload.value;
2202
+ const r = def.fn(input);
2203
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2204
+ handleRefineResult(r, payload, input, inst);
2205
+ };
2206
+ });
2207
+ function handleRefineResult(result, payload, input, inst) {
2208
+ if (!result) {
2209
+ const _iss = {
2210
+ code: "custom",
2211
+ input,
2212
+ inst,
2213
+ path: [...inst._zod.def.path ?? []],
2214
+ continue: !inst._zod.def.abort
2215
+ };
2216
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2217
+ payload.issues.push(issue(_iss));
2218
+ }
2219
+ }
2220
+ //#endregion
2221
+ //#region ../../node_modules/zod/v4/core/registries.js
2222
+ var _a;
2223
+ var $ZodRegistry = class {
2224
+ constructor() {
2225
+ this._map = /* @__PURE__ */ new WeakMap();
2226
+ this._idmap = /* @__PURE__ */ new Map();
2227
+ }
2228
+ add(schema, ..._meta) {
2229
+ const meta = _meta[0];
2230
+ this._map.set(schema, meta);
2231
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
2232
+ return this;
2233
+ }
2234
+ clear() {
2235
+ this._map = /* @__PURE__ */ new WeakMap();
2236
+ this._idmap = /* @__PURE__ */ new Map();
2237
+ return this;
2238
+ }
2239
+ remove(schema) {
2240
+ const meta = this._map.get(schema);
2241
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
2242
+ this._map.delete(schema);
2243
+ return this;
2244
+ }
2245
+ get(schema) {
2246
+ const p = schema._zod.parent;
2247
+ if (p) {
2248
+ const pm = { ...this.get(p) ?? {} };
2249
+ delete pm.id;
2250
+ const f = {
2251
+ ...pm,
2252
+ ...this._map.get(schema)
2253
+ };
2254
+ return Object.keys(f).length ? f : void 0;
2255
+ }
2256
+ return this._map.get(schema);
2257
+ }
2258
+ has(schema) {
2259
+ return this._map.has(schema);
2260
+ }
2261
+ };
2262
+ function registry() {
2263
+ return new $ZodRegistry();
2264
+ }
2265
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2266
+ var globalRegistry = globalThis.__zod_globalRegistry;
2267
+ //#endregion
2268
+ //#region ../../node_modules/zod/v4/core/api.js
2269
+ // @__NO_SIDE_EFFECTS__
2270
+ function _string(Class, params) {
2271
+ return new Class({
2272
+ type: "string",
2273
+ ...normalizeParams(params)
2274
+ });
2275
+ }
2276
+ // @__NO_SIDE_EFFECTS__
2277
+ function _email(Class, params) {
2278
+ return new Class({
2279
+ type: "string",
2280
+ format: "email",
2281
+ check: "string_format",
2282
+ abort: false,
2283
+ ...normalizeParams(params)
2284
+ });
2285
+ }
2286
+ // @__NO_SIDE_EFFECTS__
2287
+ function _guid(Class, params) {
2288
+ return new Class({
2289
+ type: "string",
2290
+ format: "guid",
2291
+ check: "string_format",
2292
+ abort: false,
2293
+ ...normalizeParams(params)
2294
+ });
2295
+ }
2296
+ // @__NO_SIDE_EFFECTS__
2297
+ function _uuid(Class, params) {
2298
+ return new Class({
2299
+ type: "string",
2300
+ format: "uuid",
2301
+ check: "string_format",
2302
+ abort: false,
2303
+ ...normalizeParams(params)
2304
+ });
2305
+ }
2306
+ // @__NO_SIDE_EFFECTS__
2307
+ function _uuidv4(Class, params) {
2308
+ return new Class({
2309
+ type: "string",
2310
+ format: "uuid",
2311
+ check: "string_format",
2312
+ abort: false,
2313
+ version: "v4",
2314
+ ...normalizeParams(params)
2315
+ });
2316
+ }
2317
+ // @__NO_SIDE_EFFECTS__
2318
+ function _uuidv6(Class, params) {
2319
+ return new Class({
2320
+ type: "string",
2321
+ format: "uuid",
2322
+ check: "string_format",
2323
+ abort: false,
2324
+ version: "v6",
2325
+ ...normalizeParams(params)
2326
+ });
2327
+ }
2328
+ // @__NO_SIDE_EFFECTS__
2329
+ function _uuidv7(Class, params) {
2330
+ return new Class({
2331
+ type: "string",
2332
+ format: "uuid",
2333
+ check: "string_format",
2334
+ abort: false,
2335
+ version: "v7",
2336
+ ...normalizeParams(params)
2337
+ });
2338
+ }
2339
+ // @__NO_SIDE_EFFECTS__
2340
+ function _url(Class, params) {
2341
+ return new Class({
2342
+ type: "string",
2343
+ format: "url",
2344
+ check: "string_format",
2345
+ abort: false,
2346
+ ...normalizeParams(params)
2347
+ });
2348
+ }
2349
+ // @__NO_SIDE_EFFECTS__
2350
+ function _emoji(Class, params) {
2351
+ return new Class({
2352
+ type: "string",
2353
+ format: "emoji",
2354
+ check: "string_format",
2355
+ abort: false,
2356
+ ...normalizeParams(params)
2357
+ });
2358
+ }
2359
+ // @__NO_SIDE_EFFECTS__
2360
+ function _nanoid(Class, params) {
2361
+ return new Class({
2362
+ type: "string",
2363
+ format: "nanoid",
2364
+ check: "string_format",
2365
+ abort: false,
2366
+ ...normalizeParams(params)
2367
+ });
2368
+ }
2369
+ /**
2370
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
2371
+ * (timestamps embedded in the id). Use {@link _cuid2} instead.
2372
+ * See https://github.com/paralleldrive/cuid.
2373
+ */
2374
+ // @__NO_SIDE_EFFECTS__
2375
+ function _cuid(Class, params) {
2376
+ return new Class({
2377
+ type: "string",
2378
+ format: "cuid",
2379
+ check: "string_format",
2380
+ abort: false,
2381
+ ...normalizeParams(params)
2382
+ });
2383
+ }
2384
+ // @__NO_SIDE_EFFECTS__
2385
+ function _cuid2(Class, params) {
2386
+ return new Class({
2387
+ type: "string",
2388
+ format: "cuid2",
2389
+ check: "string_format",
2390
+ abort: false,
2391
+ ...normalizeParams(params)
2392
+ });
2393
+ }
2394
+ // @__NO_SIDE_EFFECTS__
2395
+ function _ulid(Class, params) {
2396
+ return new Class({
2397
+ type: "string",
2398
+ format: "ulid",
2399
+ check: "string_format",
2400
+ abort: false,
2401
+ ...normalizeParams(params)
2402
+ });
2403
+ }
2404
+ // @__NO_SIDE_EFFECTS__
2405
+ function _xid(Class, params) {
2406
+ return new Class({
2407
+ type: "string",
2408
+ format: "xid",
2409
+ check: "string_format",
2410
+ abort: false,
2411
+ ...normalizeParams(params)
2412
+ });
2413
+ }
2414
+ // @__NO_SIDE_EFFECTS__
2415
+ function _ksuid(Class, params) {
2416
+ return new Class({
2417
+ type: "string",
2418
+ format: "ksuid",
2419
+ check: "string_format",
2420
+ abort: false,
2421
+ ...normalizeParams(params)
2422
+ });
2423
+ }
2424
+ // @__NO_SIDE_EFFECTS__
2425
+ function _ipv4(Class, params) {
2426
+ return new Class({
2427
+ type: "string",
2428
+ format: "ipv4",
2429
+ check: "string_format",
2430
+ abort: false,
2431
+ ...normalizeParams(params)
2432
+ });
2433
+ }
2434
+ // @__NO_SIDE_EFFECTS__
2435
+ function _ipv6(Class, params) {
2436
+ return new Class({
2437
+ type: "string",
2438
+ format: "ipv6",
2439
+ check: "string_format",
2440
+ abort: false,
2441
+ ...normalizeParams(params)
2442
+ });
2443
+ }
2444
+ // @__NO_SIDE_EFFECTS__
2445
+ function _cidrv4(Class, params) {
2446
+ return new Class({
2447
+ type: "string",
2448
+ format: "cidrv4",
2449
+ check: "string_format",
2450
+ abort: false,
2451
+ ...normalizeParams(params)
2452
+ });
2453
+ }
2454
+ // @__NO_SIDE_EFFECTS__
2455
+ function _cidrv6(Class, params) {
2456
+ return new Class({
2457
+ type: "string",
2458
+ format: "cidrv6",
2459
+ check: "string_format",
2460
+ abort: false,
2461
+ ...normalizeParams(params)
2462
+ });
2463
+ }
2464
+ // @__NO_SIDE_EFFECTS__
2465
+ function _base64(Class, params) {
2466
+ return new Class({
2467
+ type: "string",
2468
+ format: "base64",
2469
+ check: "string_format",
2470
+ abort: false,
2471
+ ...normalizeParams(params)
2472
+ });
2473
+ }
2474
+ // @__NO_SIDE_EFFECTS__
2475
+ function _base64url(Class, params) {
2476
+ return new Class({
2477
+ type: "string",
2478
+ format: "base64url",
2479
+ check: "string_format",
2480
+ abort: false,
2481
+ ...normalizeParams(params)
2482
+ });
2483
+ }
2484
+ // @__NO_SIDE_EFFECTS__
2485
+ function _e164(Class, params) {
2486
+ return new Class({
2487
+ type: "string",
2488
+ format: "e164",
2489
+ check: "string_format",
2490
+ abort: false,
2491
+ ...normalizeParams(params)
2492
+ });
2493
+ }
2494
+ // @__NO_SIDE_EFFECTS__
2495
+ function _jwt(Class, params) {
2496
+ return new Class({
2497
+ type: "string",
2498
+ format: "jwt",
2499
+ check: "string_format",
2500
+ abort: false,
2501
+ ...normalizeParams(params)
2502
+ });
2503
+ }
2504
+ // @__NO_SIDE_EFFECTS__
2505
+ function _isoDateTime(Class, params) {
2506
+ return new Class({
2507
+ type: "string",
2508
+ format: "datetime",
2509
+ check: "string_format",
2510
+ offset: false,
2511
+ local: false,
2512
+ precision: null,
2513
+ ...normalizeParams(params)
2514
+ });
2515
+ }
2516
+ // @__NO_SIDE_EFFECTS__
2517
+ function _isoDate(Class, params) {
2518
+ return new Class({
2519
+ type: "string",
2520
+ format: "date",
2521
+ check: "string_format",
2522
+ ...normalizeParams(params)
2523
+ });
2524
+ }
2525
+ // @__NO_SIDE_EFFECTS__
2526
+ function _isoTime(Class, params) {
2527
+ return new Class({
2528
+ type: "string",
2529
+ format: "time",
2530
+ check: "string_format",
2531
+ precision: null,
2532
+ ...normalizeParams(params)
2533
+ });
2534
+ }
2535
+ // @__NO_SIDE_EFFECTS__
2536
+ function _isoDuration(Class, params) {
2537
+ return new Class({
2538
+ type: "string",
2539
+ format: "duration",
2540
+ check: "string_format",
2541
+ ...normalizeParams(params)
2542
+ });
2543
+ }
2544
+ // @__NO_SIDE_EFFECTS__
2545
+ function _number(Class, params) {
2546
+ return new Class({
2547
+ type: "number",
2548
+ checks: [],
2549
+ ...normalizeParams(params)
2550
+ });
2551
+ }
2552
+ // @__NO_SIDE_EFFECTS__
2553
+ function _int(Class, params) {
2554
+ return new Class({
2555
+ type: "number",
2556
+ check: "number_format",
2557
+ abort: false,
2558
+ format: "safeint",
2559
+ ...normalizeParams(params)
2560
+ });
2561
+ }
2562
+ // @__NO_SIDE_EFFECTS__
2563
+ function _boolean(Class, params) {
2564
+ return new Class({
2565
+ type: "boolean",
2566
+ ...normalizeParams(params)
2567
+ });
2568
+ }
2569
+ // @__NO_SIDE_EFFECTS__
2570
+ function _unknown(Class) {
2571
+ return new Class({ type: "unknown" });
2572
+ }
2573
+ // @__NO_SIDE_EFFECTS__
2574
+ function _never(Class, params) {
2575
+ return new Class({
2576
+ type: "never",
2577
+ ...normalizeParams(params)
2578
+ });
2579
+ }
2580
+ // @__NO_SIDE_EFFECTS__
2581
+ function _lt(value, params) {
2582
+ return new $ZodCheckLessThan({
2583
+ check: "less_than",
2584
+ ...normalizeParams(params),
2585
+ value,
2586
+ inclusive: false
2587
+ });
2588
+ }
2589
+ // @__NO_SIDE_EFFECTS__
2590
+ function _lte(value, params) {
2591
+ return new $ZodCheckLessThan({
2592
+ check: "less_than",
2593
+ ...normalizeParams(params),
2594
+ value,
2595
+ inclusive: true
2596
+ });
2597
+ }
2598
+ // @__NO_SIDE_EFFECTS__
2599
+ function _gt(value, params) {
2600
+ return new $ZodCheckGreaterThan({
2601
+ check: "greater_than",
2602
+ ...normalizeParams(params),
2603
+ value,
2604
+ inclusive: false
2605
+ });
2606
+ }
2607
+ // @__NO_SIDE_EFFECTS__
2608
+ function _gte(value, params) {
2609
+ return new $ZodCheckGreaterThan({
2610
+ check: "greater_than",
2611
+ ...normalizeParams(params),
2612
+ value,
2613
+ inclusive: true
2614
+ });
2615
+ }
2616
+ // @__NO_SIDE_EFFECTS__
2617
+ function _multipleOf(value, params) {
2618
+ return new $ZodCheckMultipleOf({
2619
+ check: "multiple_of",
2620
+ ...normalizeParams(params),
2621
+ value
2622
+ });
2623
+ }
2624
+ // @__NO_SIDE_EFFECTS__
2625
+ function _maxLength(maximum, params) {
2626
+ return new $ZodCheckMaxLength({
2627
+ check: "max_length",
2628
+ ...normalizeParams(params),
2629
+ maximum
2630
+ });
2631
+ }
2632
+ // @__NO_SIDE_EFFECTS__
2633
+ function _minLength(minimum, params) {
2634
+ return new $ZodCheckMinLength({
2635
+ check: "min_length",
2636
+ ...normalizeParams(params),
2637
+ minimum
2638
+ });
2639
+ }
2640
+ // @__NO_SIDE_EFFECTS__
2641
+ function _length(length, params) {
2642
+ return new $ZodCheckLengthEquals({
2643
+ check: "length_equals",
2644
+ ...normalizeParams(params),
2645
+ length
2646
+ });
2647
+ }
2648
+ // @__NO_SIDE_EFFECTS__
2649
+ function _regex(pattern, params) {
2650
+ return new $ZodCheckRegex({
2651
+ check: "string_format",
2652
+ format: "regex",
2653
+ ...normalizeParams(params),
2654
+ pattern
2655
+ });
2656
+ }
2657
+ // @__NO_SIDE_EFFECTS__
2658
+ function _lowercase(params) {
2659
+ return new $ZodCheckLowerCase({
2660
+ check: "string_format",
2661
+ format: "lowercase",
2662
+ ...normalizeParams(params)
2663
+ });
2664
+ }
2665
+ // @__NO_SIDE_EFFECTS__
2666
+ function _uppercase(params) {
2667
+ return new $ZodCheckUpperCase({
2668
+ check: "string_format",
2669
+ format: "uppercase",
2670
+ ...normalizeParams(params)
2671
+ });
2672
+ }
2673
+ // @__NO_SIDE_EFFECTS__
2674
+ function _includes(includes, params) {
2675
+ return new $ZodCheckIncludes({
2676
+ check: "string_format",
2677
+ format: "includes",
2678
+ ...normalizeParams(params),
2679
+ includes
2680
+ });
2681
+ }
2682
+ // @__NO_SIDE_EFFECTS__
2683
+ function _startsWith(prefix, params) {
2684
+ return new $ZodCheckStartsWith({
2685
+ check: "string_format",
2686
+ format: "starts_with",
2687
+ ...normalizeParams(params),
2688
+ prefix
2689
+ });
2690
+ }
2691
+ // @__NO_SIDE_EFFECTS__
2692
+ function _endsWith(suffix, params) {
2693
+ return new $ZodCheckEndsWith({
2694
+ check: "string_format",
2695
+ format: "ends_with",
2696
+ ...normalizeParams(params),
2697
+ suffix
2698
+ });
2699
+ }
2700
+ // @__NO_SIDE_EFFECTS__
2701
+ function _overwrite(tx) {
2702
+ return new $ZodCheckOverwrite({
2703
+ check: "overwrite",
2704
+ tx
2705
+ });
2706
+ }
2707
+ // @__NO_SIDE_EFFECTS__
2708
+ function _normalize(form) {
2709
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
2710
+ }
2711
+ // @__NO_SIDE_EFFECTS__
2712
+ function _trim() {
2713
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
2714
+ }
2715
+ // @__NO_SIDE_EFFECTS__
2716
+ function _toLowerCase() {
2717
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
2718
+ }
2719
+ // @__NO_SIDE_EFFECTS__
2720
+ function _toUpperCase() {
2721
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
2722
+ }
2723
+ // @__NO_SIDE_EFFECTS__
2724
+ function _slugify() {
2725
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
2726
+ }
2727
+ // @__NO_SIDE_EFFECTS__
2728
+ function _array(Class, element, params) {
2729
+ return new Class({
2730
+ type: "array",
2731
+ element,
2732
+ ...normalizeParams(params)
2733
+ });
2734
+ }
2735
+ // @__NO_SIDE_EFFECTS__
2736
+ function _refine(Class, fn, _params) {
2737
+ return new Class({
2738
+ type: "custom",
2739
+ check: "custom",
2740
+ fn,
2741
+ ...normalizeParams(_params)
2742
+ });
2743
+ }
2744
+ // @__NO_SIDE_EFFECTS__
2745
+ function _superRefine(fn, params) {
2746
+ const ch = /* @__PURE__ */ _check((payload) => {
2747
+ payload.addIssue = (issue$2) => {
2748
+ if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
2749
+ else {
2750
+ const _issue = issue$2;
2751
+ if (_issue.fatal) _issue.continue = false;
2752
+ _issue.code ?? (_issue.code = "custom");
2753
+ _issue.input ?? (_issue.input = payload.value);
2754
+ _issue.inst ?? (_issue.inst = ch);
2755
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2756
+ payload.issues.push(issue(_issue));
2757
+ }
2758
+ };
2759
+ return fn(payload.value, payload);
2760
+ }, params);
2761
+ return ch;
2762
+ }
2763
+ // @__NO_SIDE_EFFECTS__
2764
+ function _check(fn, params) {
2765
+ const ch = new $ZodCheck({
2766
+ check: "custom",
2767
+ ...normalizeParams(params)
2768
+ });
2769
+ ch._zod.check = fn;
2770
+ return ch;
2771
+ }
2772
+ //#endregion
2773
+ //#region ../../node_modules/zod/v4/core/to-json-schema.js
2774
+ function initializeContext(params) {
2775
+ let target = params?.target ?? "draft-2020-12";
2776
+ if (target === "draft-4") target = "draft-04";
2777
+ if (target === "draft-7") target = "draft-07";
2778
+ return {
2779
+ processors: params.processors ?? {},
2780
+ metadataRegistry: params?.metadata ?? globalRegistry,
2781
+ target,
2782
+ unrepresentable: params?.unrepresentable ?? "throw",
2783
+ override: params?.override ?? (() => {}),
2784
+ io: params?.io ?? "output",
2785
+ counter: 0,
2786
+ seen: /* @__PURE__ */ new Map(),
2787
+ cycles: params?.cycles ?? "ref",
2788
+ reused: params?.reused ?? "inline",
2789
+ external: params?.external ?? void 0
2790
+ };
2791
+ }
2792
+ function process(schema, ctx, _params = {
2793
+ path: [],
2794
+ schemaPath: []
2795
+ }) {
2796
+ var _a;
2797
+ const def = schema._zod.def;
2798
+ const seen = ctx.seen.get(schema);
2799
+ if (seen) {
2800
+ seen.count++;
2801
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2802
+ return seen.schema;
2803
+ }
2804
+ const result = {
2805
+ schema: {},
2806
+ count: 1,
2807
+ cycle: void 0,
2808
+ path: _params.path
2809
+ };
2810
+ ctx.seen.set(schema, result);
2811
+ const overrideSchema = schema._zod.toJSONSchema?.();
2812
+ if (overrideSchema) result.schema = overrideSchema;
2813
+ else {
2814
+ const params = {
2815
+ ..._params,
2816
+ schemaPath: [..._params.schemaPath, schema],
2817
+ path: _params.path
2818
+ };
2819
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2820
+ else {
2821
+ const _json = result.schema;
2822
+ const processor = ctx.processors[def.type];
2823
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2824
+ processor(schema, ctx, _json, params);
2825
+ }
2826
+ const parent = schema._zod.parent;
2827
+ if (parent) {
2828
+ if (!result.ref) result.ref = parent;
2829
+ process(parent, ctx, params);
2830
+ ctx.seen.get(parent).isParent = true;
2831
+ }
2832
+ }
2833
+ const meta = ctx.metadataRegistry.get(schema);
2834
+ if (meta) Object.assign(result.schema, meta);
2835
+ if (ctx.io === "input" && isTransforming(schema)) {
2836
+ delete result.schema.examples;
2837
+ delete result.schema.default;
2838
+ }
2839
+ if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
2840
+ delete result.schema._prefault;
2841
+ return ctx.seen.get(schema).schema;
2842
+ }
2843
+ function extractDefs(ctx, schema) {
2844
+ const root = ctx.seen.get(schema);
2845
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2846
+ const idToSchema = /* @__PURE__ */ new Map();
2847
+ for (const entry of ctx.seen.entries()) {
2848
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2849
+ if (id) {
2850
+ const existing = idToSchema.get(id);
2851
+ if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2852
+ idToSchema.set(id, entry[0]);
2853
+ }
2854
+ }
2855
+ const makeURI = (entry) => {
2856
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2857
+ if (ctx.external) {
2858
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2859
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
2860
+ if (externalId) return { ref: uriGenerator(externalId) };
2861
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2862
+ entry[1].defId = id;
2863
+ return {
2864
+ defId: id,
2865
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2866
+ };
2867
+ }
2868
+ if (entry[1] === root) return { ref: "#" };
2869
+ const defUriPrefix = `#/${defsSegment}/`;
2870
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2871
+ return {
2872
+ defId,
2873
+ ref: defUriPrefix + defId
2874
+ };
2875
+ };
2876
+ const extractToDef = (entry) => {
2877
+ if (entry[1].schema.$ref) return;
2878
+ const seen = entry[1];
2879
+ const { ref, defId } = makeURI(entry);
2880
+ seen.def = { ...seen.schema };
2881
+ if (defId) seen.defId = defId;
2882
+ const schema = seen.schema;
2883
+ for (const key in schema) delete schema[key];
2884
+ schema.$ref = ref;
2885
+ };
2886
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
2887
+ const seen = entry[1];
2888
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
2889
+
2890
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2891
+ }
2892
+ for (const entry of ctx.seen.entries()) {
2893
+ const seen = entry[1];
2894
+ if (schema === entry[0]) {
2895
+ extractToDef(entry);
2896
+ continue;
2897
+ }
2898
+ if (ctx.external) {
2899
+ const ext = ctx.external.registry.get(entry[0])?.id;
2900
+ if (schema !== entry[0] && ext) {
2901
+ extractToDef(entry);
2902
+ continue;
2903
+ }
2904
+ }
2905
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
2906
+ extractToDef(entry);
2907
+ continue;
2908
+ }
2909
+ if (seen.cycle) {
2910
+ extractToDef(entry);
2911
+ continue;
2912
+ }
2913
+ if (seen.count > 1) {
2914
+ if (ctx.reused === "ref") {
2915
+ extractToDef(entry);
2916
+ continue;
2917
+ }
2918
+ }
2919
+ }
2920
+ }
2921
+ function finalize(ctx, schema) {
2922
+ const root = ctx.seen.get(schema);
2923
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2924
+ const flattenRef = (zodSchema) => {
2925
+ const seen = ctx.seen.get(zodSchema);
2926
+ if (seen.ref === null) return;
2927
+ const schema = seen.def ?? seen.schema;
2928
+ const _cached = { ...schema };
2929
+ const ref = seen.ref;
2930
+ seen.ref = null;
2931
+ if (ref) {
2932
+ flattenRef(ref);
2933
+ const refSeen = ctx.seen.get(ref);
2934
+ const refSchema = refSeen.schema;
2935
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2936
+ schema.allOf = schema.allOf ?? [];
2937
+ schema.allOf.push(refSchema);
2938
+ } else Object.assign(schema, refSchema);
2939
+ Object.assign(schema, _cached);
2940
+ if (zodSchema._zod.parent === ref) for (const key in schema) {
2941
+ if (key === "$ref" || key === "allOf") continue;
2942
+ if (!(key in _cached)) delete schema[key];
2943
+ }
2944
+ if (refSchema.$ref && refSeen.def) for (const key in schema) {
2945
+ if (key === "$ref" || key === "allOf") continue;
2946
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
2947
+ }
2948
+ }
2949
+ const parent = zodSchema._zod.parent;
2950
+ if (parent && parent !== ref) {
2951
+ flattenRef(parent);
2952
+ const parentSeen = ctx.seen.get(parent);
2953
+ if (parentSeen?.schema.$ref) {
2954
+ schema.$ref = parentSeen.schema.$ref;
2955
+ if (parentSeen.def) for (const key in schema) {
2956
+ if (key === "$ref" || key === "allOf") continue;
2957
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
2958
+ }
2959
+ }
2960
+ }
2961
+ ctx.override({
2962
+ zodSchema,
2963
+ jsonSchema: schema,
2964
+ path: seen.path ?? []
2965
+ });
2966
+ };
2967
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
2968
+ const result = {};
2969
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2970
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
2971
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
2972
+ else if (ctx.target === "openapi-3.0") {}
2973
+ if (ctx.external?.uri) {
2974
+ const id = ctx.external.registry.get(schema)?.id;
2975
+ if (!id) throw new Error("Schema is missing an `id` property");
2976
+ result.$id = ctx.external.uri(id);
2977
+ }
2978
+ Object.assign(result, root.def ?? root.schema);
2979
+ const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
2980
+ if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
2981
+ const defs = ctx.external?.defs ?? {};
2982
+ for (const entry of ctx.seen.entries()) {
2983
+ const seen = entry[1];
2984
+ if (seen.def && seen.defId) {
2985
+ if (seen.def.id === seen.defId) delete seen.def.id;
2986
+ defs[seen.defId] = seen.def;
2987
+ }
2988
+ }
2989
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2990
+ else result.definitions = defs;
2991
+ try {
2992
+ const finalized = JSON.parse(JSON.stringify(result));
2993
+ Object.defineProperty(finalized, "~standard", {
2994
+ value: {
2995
+ ...schema["~standard"],
2996
+ jsonSchema: {
2997
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
2998
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
2999
+ }
3000
+ },
3001
+ enumerable: false,
3002
+ writable: false
3003
+ });
3004
+ return finalized;
3005
+ } catch (_err) {
3006
+ throw new Error("Error converting schema to JSON.");
3007
+ }
3008
+ }
3009
+ function isTransforming(_schema, _ctx) {
3010
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
3011
+ if (ctx.seen.has(_schema)) return false;
3012
+ ctx.seen.add(_schema);
3013
+ const def = _schema._zod.def;
3014
+ if (def.type === "transform") return true;
3015
+ if (def.type === "array") return isTransforming(def.element, ctx);
3016
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
3017
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
3018
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
3019
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
3020
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3021
+ if (def.type === "pipe") {
3022
+ if (_schema._zod.traits.has("$ZodCodec")) return true;
3023
+ return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
3024
+ }
3025
+ if (def.type === "object") {
3026
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
3027
+ return false;
3028
+ }
3029
+ if (def.type === "union") {
3030
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
3031
+ return false;
3032
+ }
3033
+ if (def.type === "tuple") {
3034
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
3035
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
3036
+ return false;
3037
+ }
3038
+ return false;
3039
+ }
3040
+ /**
3041
+ * Creates a toJSONSchema method for a schema instance.
3042
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
3043
+ */
3044
+ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
3045
+ const ctx = initializeContext({
3046
+ ...params,
3047
+ processors
3048
+ });
3049
+ process(schema, ctx);
3050
+ extractDefs(ctx, schema);
3051
+ return finalize(ctx, schema);
3052
+ };
3053
+ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
3054
+ const { libraryOptions, target } = params ?? {};
3055
+ const ctx = initializeContext({
3056
+ ...libraryOptions ?? {},
3057
+ target,
3058
+ io,
3059
+ processors
3060
+ });
3061
+ process(schema, ctx);
3062
+ extractDefs(ctx, schema);
3063
+ return finalize(ctx, schema);
3064
+ };
3065
+ //#endregion
3066
+ //#region ../../node_modules/zod/v4/core/json-schema-processors.js
3067
+ var formatMap = {
3068
+ guid: "uuid",
3069
+ url: "uri",
3070
+ datetime: "date-time",
3071
+ json_string: "json-string",
3072
+ regex: ""
3073
+ };
3074
+ var stringProcessor = (schema, ctx, _json, _params) => {
3075
+ const json = _json;
3076
+ json.type = "string";
3077
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
3078
+ if (typeof minimum === "number") json.minLength = minimum;
3079
+ if (typeof maximum === "number") json.maxLength = maximum;
3080
+ if (format) {
3081
+ json.format = formatMap[format] ?? format;
3082
+ if (json.format === "") delete json.format;
3083
+ if (format === "time") delete json.format;
3084
+ }
3085
+ if (contentEncoding) json.contentEncoding = contentEncoding;
3086
+ if (patterns && patterns.size > 0) {
3087
+ const regexes = [...patterns];
3088
+ if (regexes.length === 1) json.pattern = regexes[0].source;
3089
+ else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
3090
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3091
+ pattern: regex.source
3092
+ }))];
3093
+ }
3094
+ };
3095
+ var numberProcessor = (schema, ctx, _json, _params) => {
3096
+ const json = _json;
3097
+ const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3098
+ if (typeof format === "string" && format.includes("int")) json.type = "integer";
3099
+ else json.type = "number";
3100
+ const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
3101
+ const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
3102
+ const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
3103
+ if (exMin) if (legacy) {
3104
+ json.minimum = exclusiveMinimum;
3105
+ json.exclusiveMinimum = true;
3106
+ } else json.exclusiveMinimum = exclusiveMinimum;
3107
+ else if (typeof minimum === "number") json.minimum = minimum;
3108
+ if (exMax) if (legacy) {
3109
+ json.maximum = exclusiveMaximum;
3110
+ json.exclusiveMaximum = true;
3111
+ } else json.exclusiveMaximum = exclusiveMaximum;
3112
+ else if (typeof maximum === "number") json.maximum = maximum;
3113
+ if (typeof multipleOf === "number") json.multipleOf = multipleOf;
3114
+ };
3115
+ var booleanProcessor = (_schema, _ctx, json, _params) => {
3116
+ json.type = "boolean";
3117
+ };
3118
+ var neverProcessor = (_schema, _ctx, json, _params) => {
3119
+ json.not = {};
3120
+ };
3121
+ var enumProcessor = (schema, _ctx, json, _params) => {
3122
+ const def = schema._zod.def;
3123
+ const values = getEnumValues(def.entries);
3124
+ if (values.every((v) => typeof v === "number")) json.type = "number";
3125
+ if (values.every((v) => typeof v === "string")) json.type = "string";
3126
+ json.enum = values;
3127
+ };
3128
+ var customProcessor = (_schema, ctx, _json, _params) => {
3129
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3130
+ };
3131
+ var transformProcessor = (_schema, ctx, _json, _params) => {
3132
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
3133
+ };
3134
+ var arrayProcessor = (schema, ctx, _json, params) => {
3135
+ const json = _json;
3136
+ const def = schema._zod.def;
3137
+ const { minimum, maximum } = schema._zod.bag;
3138
+ if (typeof minimum === "number") json.minItems = minimum;
3139
+ if (typeof maximum === "number") json.maxItems = maximum;
3140
+ json.type = "array";
3141
+ json.items = process(def.element, ctx, {
3142
+ ...params,
3143
+ path: [...params.path, "items"]
3144
+ });
3145
+ };
3146
+ var objectProcessor = (schema, ctx, _json, params) => {
3147
+ const json = _json;
3148
+ const def = schema._zod.def;
3149
+ json.type = "object";
3150
+ json.properties = {};
3151
+ const shape = def.shape;
3152
+ for (const key in shape) json.properties[key] = process(shape[key], ctx, {
3153
+ ...params,
3154
+ path: [
3155
+ ...params.path,
3156
+ "properties",
3157
+ key
3158
+ ]
3159
+ });
3160
+ const allKeys = new Set(Object.keys(shape));
3161
+ const requiredKeys = new Set([...allKeys].filter((key) => {
3162
+ const v = def.shape[key]._zod;
3163
+ if (ctx.io === "input") return v.optin === void 0;
3164
+ else return v.optout === void 0;
3165
+ }));
3166
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3167
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
3168
+ else if (!def.catchall) {
3169
+ if (ctx.io === "output") json.additionalProperties = false;
3170
+ } else if (def.catchall) json.additionalProperties = process(def.catchall, ctx, {
3171
+ ...params,
3172
+ path: [...params.path, "additionalProperties"]
3173
+ });
3174
+ };
3175
+ var unionProcessor = (schema, ctx, json, params) => {
3176
+ const def = schema._zod.def;
3177
+ const isExclusive = def.inclusive === false;
3178
+ const options = def.options.map((x, i) => process(x, ctx, {
3179
+ ...params,
3180
+ path: [
3181
+ ...params.path,
3182
+ isExclusive ? "oneOf" : "anyOf",
3183
+ i
3184
+ ]
3185
+ }));
3186
+ if (isExclusive) json.oneOf = options;
3187
+ else json.anyOf = options;
3188
+ };
3189
+ var intersectionProcessor = (schema, ctx, json, params) => {
3190
+ const def = schema._zod.def;
3191
+ const a = process(def.left, ctx, {
3192
+ ...params,
3193
+ path: [
3194
+ ...params.path,
3195
+ "allOf",
3196
+ 0
3197
+ ]
3198
+ });
3199
+ const b = process(def.right, ctx, {
3200
+ ...params,
3201
+ path: [
3202
+ ...params.path,
3203
+ "allOf",
3204
+ 1
3205
+ ]
3206
+ });
3207
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3208
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3209
+ };
3210
+ var recordProcessor = (schema, ctx, _json, params) => {
3211
+ const json = _json;
3212
+ const def = schema._zod.def;
3213
+ json.type = "object";
3214
+ const keyType = def.keyType;
3215
+ const patterns = keyType._zod.bag?.patterns;
3216
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
3217
+ const valueSchema = process(def.valueType, ctx, {
3218
+ ...params,
3219
+ path: [
3220
+ ...params.path,
3221
+ "patternProperties",
3222
+ "*"
3223
+ ]
3224
+ });
3225
+ json.patternProperties = {};
3226
+ for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
3227
+ } else {
3228
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process(def.keyType, ctx, {
3229
+ ...params,
3230
+ path: [...params.path, "propertyNames"]
3231
+ });
3232
+ json.additionalProperties = process(def.valueType, ctx, {
3233
+ ...params,
3234
+ path: [...params.path, "additionalProperties"]
3235
+ });
3236
+ }
3237
+ const keyValues = keyType._zod.values;
3238
+ if (keyValues) {
3239
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
3240
+ if (validKeyValues.length > 0) json.required = validKeyValues;
3241
+ }
3242
+ };
3243
+ var nullableProcessor = (schema, ctx, json, params) => {
3244
+ const def = schema._zod.def;
3245
+ const inner = process(def.innerType, ctx, params);
3246
+ const seen = ctx.seen.get(schema);
3247
+ if (ctx.target === "openapi-3.0") {
3248
+ seen.ref = def.innerType;
3249
+ json.nullable = true;
3250
+ } else json.anyOf = [inner, { type: "null" }];
3251
+ };
3252
+ var nonoptionalProcessor = (schema, ctx, _json, params) => {
3253
+ const def = schema._zod.def;
3254
+ process(def.innerType, ctx, params);
3255
+ const seen = ctx.seen.get(schema);
3256
+ seen.ref = def.innerType;
3257
+ };
3258
+ var defaultProcessor = (schema, ctx, json, params) => {
3259
+ const def = schema._zod.def;
3260
+ process(def.innerType, ctx, params);
3261
+ const seen = ctx.seen.get(schema);
3262
+ seen.ref = def.innerType;
3263
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
3264
+ };
3265
+ var prefaultProcessor = (schema, ctx, json, params) => {
3266
+ const def = schema._zod.def;
3267
+ process(def.innerType, ctx, params);
3268
+ const seen = ctx.seen.get(schema);
3269
+ seen.ref = def.innerType;
3270
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
3271
+ };
3272
+ var catchProcessor = (schema, ctx, json, params) => {
3273
+ const def = schema._zod.def;
3274
+ process(def.innerType, ctx, params);
3275
+ const seen = ctx.seen.get(schema);
3276
+ seen.ref = def.innerType;
3277
+ let catchValue;
3278
+ try {
3279
+ catchValue = def.catchValue(void 0);
3280
+ } catch {
3281
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
3282
+ }
3283
+ json.default = catchValue;
3284
+ };
3285
+ var pipeProcessor = (schema, ctx, _json, params) => {
3286
+ const def = schema._zod.def;
3287
+ const inIsTransform = def.in._zod.traits.has("$ZodTransform");
3288
+ const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
3289
+ process(innerType, ctx, params);
3290
+ const seen = ctx.seen.get(schema);
3291
+ seen.ref = innerType;
3292
+ };
3293
+ var readonlyProcessor = (schema, ctx, json, params) => {
3294
+ const def = schema._zod.def;
3295
+ process(def.innerType, ctx, params);
3296
+ const seen = ctx.seen.get(schema);
3297
+ seen.ref = def.innerType;
3298
+ json.readOnly = true;
3299
+ };
3300
+ var optionalProcessor = (schema, ctx, _json, params) => {
3301
+ const def = schema._zod.def;
3302
+ process(def.innerType, ctx, params);
3303
+ const seen = ctx.seen.get(schema);
3304
+ seen.ref = def.innerType;
3305
+ };
3306
+ //#endregion
3307
+ //#region ../../node_modules/zod/v4/classic/iso.js
3308
+ var ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3309
+ $ZodISODateTime.init(inst, def);
3310
+ ZodStringFormat.init(inst, def);
3311
+ });
3312
+ function datetime(params) {
3313
+ return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3314
+ }
3315
+ var ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3316
+ $ZodISODate.init(inst, def);
3317
+ ZodStringFormat.init(inst, def);
3318
+ });
3319
+ function date(params) {
3320
+ return /* @__PURE__ */ _isoDate(ZodISODate, params);
3321
+ }
3322
+ var ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3323
+ $ZodISOTime.init(inst, def);
3324
+ ZodStringFormat.init(inst, def);
3325
+ });
3326
+ function time(params) {
3327
+ return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3328
+ }
3329
+ var ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3330
+ $ZodISODuration.init(inst, def);
3331
+ ZodStringFormat.init(inst, def);
3332
+ });
3333
+ function duration(params) {
3334
+ return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3335
+ }
3336
+ //#endregion
3337
+ //#region ../../node_modules/zod/v4/classic/errors.js
3338
+ var initializer = (inst, issues) => {
3339
+ $ZodError.init(inst, issues);
3340
+ inst.name = "ZodError";
3341
+ Object.defineProperties(inst, {
3342
+ format: { value: (mapper) => formatError(inst, mapper) },
3343
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
3344
+ addIssue: { value: (issue) => {
3345
+ inst.issues.push(issue);
3346
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3347
+ } },
3348
+ addIssues: { value: (issues) => {
3349
+ inst.issues.push(...issues);
3350
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3351
+ } },
3352
+ isEmpty: { get() {
3353
+ return inst.issues.length === 0;
3354
+ } }
3355
+ });
3356
+ };
3357
+ var ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
3358
+ //#endregion
3359
+ //#region ../../node_modules/zod/v4/classic/parse.js
3360
+ var parse = /* @__PURE__ */ _parse(ZodRealError);
3361
+ var parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3362
+ var safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
3363
+ var safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
3364
+ var encode = /* @__PURE__ */ _encode(ZodRealError);
3365
+ var decode = /* @__PURE__ */ _decode(ZodRealError);
3366
+ var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
3367
+ var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
3368
+ var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3369
+ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3370
+ var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3371
+ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3372
+ //#endregion
3373
+ //#region ../../node_modules/zod/v4/classic/schemas.js
3374
+ var _installedGroups = /* @__PURE__ */ new WeakMap();
3375
+ function _installLazyMethods(inst, group, methods) {
3376
+ const proto = Object.getPrototypeOf(inst);
3377
+ let installed = _installedGroups.get(proto);
3378
+ if (!installed) {
3379
+ installed = /* @__PURE__ */ new Set();
3380
+ _installedGroups.set(proto, installed);
3381
+ }
3382
+ if (installed.has(group)) return;
3383
+ installed.add(group);
3384
+ for (const key in methods) {
3385
+ const fn = methods[key];
3386
+ Object.defineProperty(proto, key, {
3387
+ configurable: true,
3388
+ enumerable: false,
3389
+ get() {
3390
+ const bound = fn.bind(this);
3391
+ Object.defineProperty(this, key, {
3392
+ configurable: true,
3393
+ writable: true,
3394
+ enumerable: true,
3395
+ value: bound
3396
+ });
3397
+ return bound;
3398
+ },
3399
+ set(v) {
3400
+ Object.defineProperty(this, key, {
3401
+ configurable: true,
3402
+ writable: true,
3403
+ enumerable: true,
3404
+ value: v
3405
+ });
3406
+ }
3407
+ });
3408
+ }
3409
+ }
3410
+ var ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3411
+ $ZodType.init(inst, def);
3412
+ Object.assign(inst["~standard"], { jsonSchema: {
3413
+ input: createStandardJSONSchemaMethod(inst, "input"),
3414
+ output: createStandardJSONSchemaMethod(inst, "output")
3415
+ } });
3416
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3417
+ inst.def = def;
3418
+ inst.type = def.type;
3419
+ Object.defineProperty(inst, "_def", { value: def });
3420
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3421
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
3422
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3423
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3424
+ inst.spa = inst.safeParseAsync;
3425
+ inst.encode = (data, params) => encode(inst, data, params);
3426
+ inst.decode = (data, params) => decode(inst, data, params);
3427
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3428
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3429
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3430
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3431
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3432
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3433
+ _installLazyMethods(inst, "ZodType", {
3434
+ check(...chks) {
3435
+ const def = this.def;
3436
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3437
+ check: ch,
3438
+ def: { check: "custom" },
3439
+ onattach: []
3440
+ } } : ch)] }), { parent: true });
3441
+ },
3442
+ with(...chks) {
3443
+ return this.check(...chks);
3444
+ },
3445
+ clone(def, params) {
3446
+ return clone(this, def, params);
3447
+ },
3448
+ brand() {
3449
+ return this;
3450
+ },
3451
+ register(reg, meta) {
3452
+ reg.add(this, meta);
3453
+ return this;
3454
+ },
3455
+ refine(check, params) {
3456
+ return this.check(refine(check, params));
3457
+ },
3458
+ superRefine(refinement, params) {
3459
+ return this.check(superRefine(refinement, params));
3460
+ },
3461
+ overwrite(fn) {
3462
+ return this.check(/* @__PURE__ */ _overwrite(fn));
3463
+ },
3464
+ optional() {
3465
+ return optional(this);
3466
+ },
3467
+ exactOptional() {
3468
+ return exactOptional(this);
3469
+ },
3470
+ nullable() {
3471
+ return nullable(this);
3472
+ },
3473
+ nullish() {
3474
+ return optional(nullable(this));
3475
+ },
3476
+ nonoptional(params) {
3477
+ return nonoptional(this, params);
3478
+ },
3479
+ array() {
3480
+ return array(this);
3481
+ },
3482
+ or(arg) {
3483
+ return union([this, arg]);
3484
+ },
3485
+ and(arg) {
3486
+ return intersection(this, arg);
3487
+ },
3488
+ transform(tx) {
3489
+ return pipe(this, transform(tx));
3490
+ },
3491
+ default(d) {
3492
+ return _default(this, d);
3493
+ },
3494
+ prefault(d) {
3495
+ return prefault(this, d);
3496
+ },
3497
+ catch(params) {
3498
+ return _catch(this, params);
3499
+ },
3500
+ pipe(target) {
3501
+ return pipe(this, target);
3502
+ },
3503
+ readonly() {
3504
+ return readonly(this);
3505
+ },
3506
+ describe(description) {
3507
+ const cl = this.clone();
3508
+ globalRegistry.add(cl, { description });
3509
+ return cl;
3510
+ },
3511
+ meta(...args) {
3512
+ if (args.length === 0) return globalRegistry.get(this);
3513
+ const cl = this.clone();
3514
+ globalRegistry.add(cl, args[0]);
3515
+ return cl;
3516
+ },
3517
+ isOptional() {
3518
+ return this.safeParse(void 0).success;
3519
+ },
3520
+ isNullable() {
3521
+ return this.safeParse(null).success;
3522
+ },
3523
+ apply(fn) {
3524
+ return fn(this);
3525
+ }
3526
+ });
3527
+ Object.defineProperty(inst, "description", {
3528
+ get() {
3529
+ return globalRegistry.get(inst)?.description;
3530
+ },
3531
+ configurable: true
3532
+ });
3533
+ return inst;
3534
+ });
3535
+ /** @internal */
3536
+ var _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3537
+ $ZodString.init(inst, def);
3538
+ ZodType.init(inst, def);
3539
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
3540
+ const bag = inst._zod.bag;
3541
+ inst.format = bag.format ?? null;
3542
+ inst.minLength = bag.minimum ?? null;
3543
+ inst.maxLength = bag.maximum ?? null;
3544
+ _installLazyMethods(inst, "_ZodString", {
3545
+ regex(...args) {
3546
+ return this.check(/* @__PURE__ */ _regex(...args));
3547
+ },
3548
+ includes(...args) {
3549
+ return this.check(/* @__PURE__ */ _includes(...args));
3550
+ },
3551
+ startsWith(...args) {
3552
+ return this.check(/* @__PURE__ */ _startsWith(...args));
3553
+ },
3554
+ endsWith(...args) {
3555
+ return this.check(/* @__PURE__ */ _endsWith(...args));
3556
+ },
3557
+ min(...args) {
3558
+ return this.check(/* @__PURE__ */ _minLength(...args));
3559
+ },
3560
+ max(...args) {
3561
+ return this.check(/* @__PURE__ */ _maxLength(...args));
3562
+ },
3563
+ length(...args) {
3564
+ return this.check(/* @__PURE__ */ _length(...args));
3565
+ },
3566
+ nonempty(...args) {
3567
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
3568
+ },
3569
+ lowercase(params) {
3570
+ return this.check(/* @__PURE__ */ _lowercase(params));
3571
+ },
3572
+ uppercase(params) {
3573
+ return this.check(/* @__PURE__ */ _uppercase(params));
3574
+ },
3575
+ trim() {
3576
+ return this.check(/* @__PURE__ */ _trim());
3577
+ },
3578
+ normalize(...args) {
3579
+ return this.check(/* @__PURE__ */ _normalize(...args));
3580
+ },
3581
+ toLowerCase() {
3582
+ return this.check(/* @__PURE__ */ _toLowerCase());
3583
+ },
3584
+ toUpperCase() {
3585
+ return this.check(/* @__PURE__ */ _toUpperCase());
3586
+ },
3587
+ slugify() {
3588
+ return this.check(/* @__PURE__ */ _slugify());
3589
+ }
3590
+ });
3591
+ });
3592
+ var ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3593
+ $ZodString.init(inst, def);
3594
+ _ZodString.init(inst, def);
3595
+ inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3596
+ inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3597
+ inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3598
+ inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3599
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3600
+ inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3601
+ inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3602
+ inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3603
+ inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3604
+ inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3605
+ inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3606
+ inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3607
+ inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3608
+ inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3609
+ inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3610
+ inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3611
+ inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3612
+ inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3613
+ inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3614
+ inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3615
+ inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3616
+ inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3617
+ inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3618
+ inst.datetime = (params) => inst.check(datetime(params));
3619
+ inst.date = (params) => inst.check(date(params));
3620
+ inst.time = (params) => inst.check(time(params));
3621
+ inst.duration = (params) => inst.check(duration(params));
3622
+ });
3623
+ function string(params) {
3624
+ return /* @__PURE__ */ _string(ZodString, params);
3625
+ }
3626
+ var ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def) => {
3627
+ $ZodStringFormat.init(inst, def);
3628
+ _ZodString.init(inst, def);
3629
+ });
3630
+ var ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3631
+ $ZodEmail.init(inst, def);
3632
+ ZodStringFormat.init(inst, def);
3633
+ });
3634
+ var ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def) => {
3635
+ $ZodGUID.init(inst, def);
3636
+ ZodStringFormat.init(inst, def);
3637
+ });
3638
+ var ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def) => {
3639
+ $ZodUUID.init(inst, def);
3640
+ ZodStringFormat.init(inst, def);
3641
+ });
3642
+ var ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def) => {
3643
+ $ZodURL.init(inst, def);
3644
+ ZodStringFormat.init(inst, def);
3645
+ });
3646
+ var ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def) => {
3647
+ $ZodEmoji.init(inst, def);
3648
+ ZodStringFormat.init(inst, def);
3649
+ });
3650
+ var ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def) => {
3651
+ $ZodNanoID.init(inst, def);
3652
+ ZodStringFormat.init(inst, def);
3653
+ });
3654
+ /**
3655
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
3656
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
3657
+ * See https://github.com/paralleldrive/cuid.
3658
+ */
3659
+ var ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def) => {
3660
+ $ZodCUID.init(inst, def);
3661
+ ZodStringFormat.init(inst, def);
3662
+ });
3663
+ var ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def) => {
3664
+ $ZodCUID2.init(inst, def);
3665
+ ZodStringFormat.init(inst, def);
3666
+ });
3667
+ var ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def) => {
3668
+ $ZodULID.init(inst, def);
3669
+ ZodStringFormat.init(inst, def);
3670
+ });
3671
+ var ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def) => {
3672
+ $ZodXID.init(inst, def);
3673
+ ZodStringFormat.init(inst, def);
3674
+ });
3675
+ var ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def) => {
3676
+ $ZodKSUID.init(inst, def);
3677
+ ZodStringFormat.init(inst, def);
3678
+ });
3679
+ var ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def) => {
3680
+ $ZodIPv4.init(inst, def);
3681
+ ZodStringFormat.init(inst, def);
3682
+ });
3683
+ var ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def) => {
3684
+ $ZodIPv6.init(inst, def);
3685
+ ZodStringFormat.init(inst, def);
3686
+ });
3687
+ var ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def) => {
3688
+ $ZodCIDRv4.init(inst, def);
3689
+ ZodStringFormat.init(inst, def);
3690
+ });
3691
+ var ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def) => {
3692
+ $ZodCIDRv6.init(inst, def);
3693
+ ZodStringFormat.init(inst, def);
3694
+ });
3695
+ var ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def) => {
3696
+ $ZodBase64.init(inst, def);
3697
+ ZodStringFormat.init(inst, def);
3698
+ });
3699
+ var ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def) => {
3700
+ $ZodBase64URL.init(inst, def);
3701
+ ZodStringFormat.init(inst, def);
3702
+ });
3703
+ var ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def) => {
3704
+ $ZodE164.init(inst, def);
3705
+ ZodStringFormat.init(inst, def);
3706
+ });
3707
+ var ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
3708
+ $ZodJWT.init(inst, def);
3709
+ ZodStringFormat.init(inst, def);
3710
+ });
3711
+ var ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
3712
+ $ZodNumber.init(inst, def);
3713
+ ZodType.init(inst, def);
3714
+ inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
3715
+ _installLazyMethods(inst, "ZodNumber", {
3716
+ gt(value, params) {
3717
+ return this.check(/* @__PURE__ */ _gt(value, params));
3718
+ },
3719
+ gte(value, params) {
3720
+ return this.check(/* @__PURE__ */ _gte(value, params));
3721
+ },
3722
+ min(value, params) {
3723
+ return this.check(/* @__PURE__ */ _gte(value, params));
3724
+ },
3725
+ lt(value, params) {
3726
+ return this.check(/* @__PURE__ */ _lt(value, params));
3727
+ },
3728
+ lte(value, params) {
3729
+ return this.check(/* @__PURE__ */ _lte(value, params));
3730
+ },
3731
+ max(value, params) {
3732
+ return this.check(/* @__PURE__ */ _lte(value, params));
3733
+ },
3734
+ int(params) {
3735
+ return this.check(int(params));
3736
+ },
3737
+ safe(params) {
3738
+ return this.check(int(params));
3739
+ },
3740
+ positive(params) {
3741
+ return this.check(/* @__PURE__ */ _gt(0, params));
3742
+ },
3743
+ nonnegative(params) {
3744
+ return this.check(/* @__PURE__ */ _gte(0, params));
3745
+ },
3746
+ negative(params) {
3747
+ return this.check(/* @__PURE__ */ _lt(0, params));
3748
+ },
3749
+ nonpositive(params) {
3750
+ return this.check(/* @__PURE__ */ _lte(0, params));
3751
+ },
3752
+ multipleOf(value, params) {
3753
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3754
+ },
3755
+ step(value, params) {
3756
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
3757
+ },
3758
+ finite() {
3759
+ return this;
3760
+ }
3761
+ });
3762
+ const bag = inst._zod.bag;
3763
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3764
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3765
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
3766
+ inst.isFinite = true;
3767
+ inst.format = bag.format ?? null;
3768
+ });
3769
+ function number(params) {
3770
+ return /* @__PURE__ */ _number(ZodNumber, params);
3771
+ }
3772
+ var ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
3773
+ $ZodNumberFormat.init(inst, def);
3774
+ ZodNumber.init(inst, def);
3775
+ });
3776
+ function int(params) {
3777
+ return /* @__PURE__ */ _int(ZodNumberFormat, params);
3778
+ }
3779
+ var ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def) => {
3780
+ $ZodBoolean.init(inst, def);
3781
+ ZodType.init(inst, def);
3782
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
3783
+ });
3784
+ function boolean(params) {
3785
+ return /* @__PURE__ */ _boolean(ZodBoolean, params);
3786
+ }
3787
+ var ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def) => {
3788
+ $ZodUnknown.init(inst, def);
3789
+ ZodType.init(inst, def);
3790
+ inst._zod.processJSONSchema = (ctx, json, params) => void 0;
3791
+ });
3792
+ function unknown() {
3793
+ return /* @__PURE__ */ _unknown(ZodUnknown);
3794
+ }
3795
+ var ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def) => {
3796
+ $ZodNever.init(inst, def);
3797
+ ZodType.init(inst, def);
3798
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
3799
+ });
3800
+ function never(params) {
3801
+ return /* @__PURE__ */ _never(ZodNever, params);
3802
+ }
3803
+ var ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
3804
+ $ZodArray.init(inst, def);
3805
+ ZodType.init(inst, def);
3806
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3807
+ inst.element = def.element;
3808
+ _installLazyMethods(inst, "ZodArray", {
3809
+ min(n, params) {
3810
+ return this.check(/* @__PURE__ */ _minLength(n, params));
3811
+ },
3812
+ nonempty(params) {
3813
+ return this.check(/* @__PURE__ */ _minLength(1, params));
3814
+ },
3815
+ max(n, params) {
3816
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
3817
+ },
3818
+ length(n, params) {
3819
+ return this.check(/* @__PURE__ */ _length(n, params));
3820
+ },
3821
+ unwrap() {
3822
+ return this.element;
3823
+ }
3824
+ });
3825
+ });
3826
+ function array(element, params) {
3827
+ return /* @__PURE__ */ _array(ZodArray, element, params);
3828
+ }
3829
+ var ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
3830
+ $ZodObjectJIT.init(inst, def);
3831
+ ZodType.init(inst, def);
3832
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3833
+ defineLazy(inst, "shape", () => {
3834
+ return def.shape;
3835
+ });
3836
+ _installLazyMethods(inst, "ZodObject", {
3837
+ keyof() {
3838
+ return _enum(Object.keys(this._zod.def.shape));
3839
+ },
3840
+ catchall(catchall) {
3841
+ return this.clone({
3842
+ ...this._zod.def,
3843
+ catchall
3844
+ });
3845
+ },
3846
+ passthrough() {
3847
+ return this.clone({
3848
+ ...this._zod.def,
3849
+ catchall: unknown()
3850
+ });
3851
+ },
3852
+ loose() {
3853
+ return this.clone({
3854
+ ...this._zod.def,
3855
+ catchall: unknown()
3856
+ });
3857
+ },
3858
+ strict() {
3859
+ return this.clone({
3860
+ ...this._zod.def,
3861
+ catchall: never()
3862
+ });
3863
+ },
3864
+ strip() {
3865
+ return this.clone({
3866
+ ...this._zod.def,
3867
+ catchall: void 0
3868
+ });
3869
+ },
3870
+ extend(incoming) {
3871
+ return extend(this, incoming);
3872
+ },
3873
+ safeExtend(incoming) {
3874
+ return safeExtend(this, incoming);
3875
+ },
3876
+ merge(other) {
3877
+ return merge(this, other);
3878
+ },
3879
+ pick(mask) {
3880
+ return pick(this, mask);
3881
+ },
3882
+ omit(mask) {
3883
+ return omit(this, mask);
3884
+ },
3885
+ partial(...args) {
3886
+ return partial(ZodOptional, this, args[0]);
3887
+ },
3888
+ required(...args) {
3889
+ return required(ZodNonOptional, this, args[0]);
3890
+ }
3891
+ });
3892
+ });
3893
+ function object(shape, params) {
3894
+ return new ZodObject({
3895
+ type: "object",
3896
+ shape: shape ?? {},
3897
+ ...normalizeParams(params)
3898
+ });
3899
+ }
3900
+ var ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def) => {
3901
+ $ZodUnion.init(inst, def);
3902
+ ZodType.init(inst, def);
3903
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
3904
+ inst.options = def.options;
3905
+ });
3906
+ function union(options, params) {
3907
+ return new ZodUnion({
3908
+ type: "union",
3909
+ options,
3910
+ ...normalizeParams(params)
3911
+ });
3912
+ }
3913
+ var ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
3914
+ $ZodIntersection.init(inst, def);
3915
+ ZodType.init(inst, def);
3916
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
3917
+ });
3918
+ function intersection(left, right) {
3919
+ return new ZodIntersection({
3920
+ type: "intersection",
3921
+ left,
3922
+ right
3923
+ });
3924
+ }
3925
+ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
3926
+ $ZodRecord.init(inst, def);
3927
+ ZodType.init(inst, def);
3928
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
3929
+ inst.keyType = def.keyType;
3930
+ inst.valueType = def.valueType;
3931
+ });
3932
+ function record(keyType, valueType, params) {
3933
+ if (!valueType || !valueType._zod) return new ZodRecord({
3934
+ type: "record",
3935
+ keyType: string(),
3936
+ valueType: keyType,
3937
+ ...normalizeParams(valueType)
3938
+ });
3939
+ return new ZodRecord({
3940
+ type: "record",
3941
+ keyType,
3942
+ valueType,
3943
+ ...normalizeParams(params)
3944
+ });
3945
+ }
3946
+ var ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
3947
+ $ZodEnum.init(inst, def);
3948
+ ZodType.init(inst, def);
3949
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
3950
+ inst.enum = def.entries;
3951
+ inst.options = Object.values(def.entries);
3952
+ const keys = new Set(Object.keys(def.entries));
3953
+ inst.extract = (values, params) => {
3954
+ const newEntries = {};
3955
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
3956
+ else throw new Error(`Key ${value} not found in enum`);
3957
+ return new ZodEnum({
3958
+ ...def,
3959
+ checks: [],
3960
+ ...normalizeParams(params),
3961
+ entries: newEntries
3962
+ });
3963
+ };
3964
+ inst.exclude = (values, params) => {
3965
+ const newEntries = { ...def.entries };
3966
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
3967
+ else throw new Error(`Key ${value} not found in enum`);
3968
+ return new ZodEnum({
3969
+ ...def,
3970
+ checks: [],
3971
+ ...normalizeParams(params),
3972
+ entries: newEntries
3973
+ });
3974
+ };
3975
+ });
3976
+ function _enum(values, params) {
3977
+ return new ZodEnum({
3978
+ type: "enum",
3979
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
3980
+ ...normalizeParams(params)
3981
+ });
3982
+ }
3983
+ var ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3984
+ $ZodTransform.init(inst, def);
3985
+ ZodType.init(inst, def);
3986
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
3987
+ inst._zod.parse = (payload, _ctx) => {
3988
+ if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
3989
+ payload.addIssue = (issue$1) => {
3990
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
3991
+ else {
3992
+ const _issue = issue$1;
3993
+ if (_issue.fatal) _issue.continue = false;
3994
+ _issue.code ?? (_issue.code = "custom");
3995
+ _issue.input ?? (_issue.input = payload.value);
3996
+ _issue.inst ?? (_issue.inst = inst);
3997
+ payload.issues.push(issue(_issue));
3998
+ }
3999
+ };
4000
+ const output = def.transform(payload.value, payload);
4001
+ if (output instanceof Promise) return output.then((output) => {
4002
+ payload.value = output;
4003
+ payload.fallback = true;
4004
+ return payload;
4005
+ });
4006
+ payload.value = output;
4007
+ payload.fallback = true;
4008
+ return payload;
4009
+ };
4010
+ });
4011
+ function transform(fn) {
4012
+ return new ZodTransform({
4013
+ type: "transform",
4014
+ transform: fn
4015
+ });
4016
+ }
4017
+ var ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def) => {
4018
+ $ZodOptional.init(inst, def);
4019
+ ZodType.init(inst, def);
4020
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
4021
+ inst.unwrap = () => inst._zod.def.innerType;
4022
+ });
4023
+ function optional(innerType) {
4024
+ return new ZodOptional({
4025
+ type: "optional",
4026
+ innerType
4027
+ });
4028
+ }
4029
+ var ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
4030
+ $ZodExactOptional.init(inst, def);
4031
+ ZodType.init(inst, def);
4032
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
4033
+ inst.unwrap = () => inst._zod.def.innerType;
4034
+ });
4035
+ function exactOptional(innerType) {
4036
+ return new ZodExactOptional({
4037
+ type: "optional",
4038
+ innerType
4039
+ });
4040
+ }
4041
+ var ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
4042
+ $ZodNullable.init(inst, def);
4043
+ ZodType.init(inst, def);
4044
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
4045
+ inst.unwrap = () => inst._zod.def.innerType;
4046
+ });
4047
+ function nullable(innerType) {
4048
+ return new ZodNullable({
4049
+ type: "nullable",
4050
+ innerType
4051
+ });
4052
+ }
4053
+ var ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def) => {
4054
+ $ZodDefault.init(inst, def);
4055
+ ZodType.init(inst, def);
4056
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
4057
+ inst.unwrap = () => inst._zod.def.innerType;
4058
+ inst.removeDefault = inst.unwrap;
4059
+ });
4060
+ function _default(innerType, defaultValue) {
4061
+ return new ZodDefault({
4062
+ type: "default",
4063
+ innerType,
4064
+ get defaultValue() {
4065
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
4066
+ }
4067
+ });
4068
+ }
4069
+ var ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def) => {
4070
+ $ZodPrefault.init(inst, def);
4071
+ ZodType.init(inst, def);
4072
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
4073
+ inst.unwrap = () => inst._zod.def.innerType;
4074
+ });
4075
+ function prefault(innerType, defaultValue) {
4076
+ return new ZodPrefault({
4077
+ type: "prefault",
4078
+ innerType,
4079
+ get defaultValue() {
4080
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
4081
+ }
4082
+ });
4083
+ }
4084
+ var ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def) => {
4085
+ $ZodNonOptional.init(inst, def);
4086
+ ZodType.init(inst, def);
4087
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
4088
+ inst.unwrap = () => inst._zod.def.innerType;
4089
+ });
4090
+ function nonoptional(innerType, params) {
4091
+ return new ZodNonOptional({
4092
+ type: "nonoptional",
4093
+ innerType,
4094
+ ...normalizeParams(params)
4095
+ });
4096
+ }
4097
+ var ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def) => {
4098
+ $ZodCatch.init(inst, def);
4099
+ ZodType.init(inst, def);
4100
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
4101
+ inst.unwrap = () => inst._zod.def.innerType;
4102
+ inst.removeCatch = inst.unwrap;
4103
+ });
4104
+ function _catch(innerType, catchValue) {
4105
+ return new ZodCatch({
4106
+ type: "catch",
4107
+ innerType,
4108
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
4109
+ });
4110
+ }
4111
+ var ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
4112
+ $ZodPipe.init(inst, def);
4113
+ ZodType.init(inst, def);
4114
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
4115
+ inst.in = def.in;
4116
+ inst.out = def.out;
4117
+ });
4118
+ function pipe(in_, out) {
4119
+ return new ZodPipe({
4120
+ type: "pipe",
4121
+ in: in_,
4122
+ out
4123
+ });
4124
+ }
4125
+ var ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
4126
+ $ZodReadonly.init(inst, def);
4127
+ ZodType.init(inst, def);
4128
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
4129
+ inst.unwrap = () => inst._zod.def.innerType;
4130
+ });
4131
+ function readonly(innerType) {
4132
+ return new ZodReadonly({
4133
+ type: "readonly",
4134
+ innerType
4135
+ });
4136
+ }
4137
+ var ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
4138
+ $ZodCustom.init(inst, def);
4139
+ ZodType.init(inst, def);
4140
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
4141
+ });
4142
+ function refine(fn, _params = {}) {
4143
+ return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
4144
+ }
4145
+ function superRefine(fn, params) {
4146
+ return /* @__PURE__ */ _superRefine(fn, params);
4147
+ }
4148
+ //#endregion
4149
+ export { object as a, unknown as c, number as i, array as n, record as o, boolean as r, string as s, _enum as t };
4150
+
4151
+ //# sourceMappingURL=schemas-B2fUvgYo.js.map