@tekmidian/pai 0.1.0

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