@keystrokehq/cli 0.0.106 → 0.0.108

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