@reserendipity/dsh-superagent 0.0.0-stage → 0.1.0

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