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