@alienplatform/bindings 3.3.18 → 3.3.19

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.
package/dist/loader.js CHANGED
@@ -3,70 +3,14 @@ import { AlienError, BindingNotFoundError, defineError } from "@alienplatform/co
3
3
  import { existsSync } from "node:fs";
4
4
  import { dirname, join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
7
- var _a$1;
8
- function $constructor(name, initializer, params) {
9
- function init(inst, def) {
10
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
11
- value: {
12
- def,
13
- constr: _,
14
- traits: /* @__PURE__ */ new Set()
15
- },
16
- enumerable: false
17
- });
18
- if (inst._zod.traits.has(name)) return;
19
- inst._zod.traits.add(name);
20
- initializer(inst, def);
21
- const proto = _.prototype;
22
- const keys = Object.keys(proto);
23
- for (let i = 0; i < keys.length; i++) {
24
- const k = keys[i];
25
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
26
- }
27
- }
28
- const Parent = params?.Parent ?? Object;
29
- class Definition extends Parent {}
30
- Object.defineProperty(Definition, "name", { value: name });
31
- function _(def) {
32
- var _a;
33
- const inst = params?.Parent ? new Definition() : this;
34
- init(inst, def);
35
- (_a = inst._zod).deferred ?? (_a.deferred = []);
36
- for (const fn of inst._zod.deferred) fn();
37
- return inst;
38
- }
39
- Object.defineProperty(_, "init", { value: init });
40
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
41
- if (params?.Parent && inst instanceof params.Parent) return true;
42
- return inst?._zod?.traits?.has(name);
43
- } });
44
- Object.defineProperty(_, "name", { value: name });
45
- return _;
46
- }
47
- var $ZodAsyncError = class extends Error {
48
- constructor() {
49
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
50
- }
51
- };
52
- var $ZodEncodeError = class extends Error {
53
- constructor(name) {
54
- super(`Encountered unidirectional transform during encode: ${name}`);
55
- this.name = "ZodEncodeError";
56
- }
57
- };
58
- (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
59
- const globalConfig = globalThis.__zod_globalConfig;
60
- function config(newConfig) {
61
- if (newConfig) Object.assign(globalConfig, newConfig);
62
- return globalConfig;
63
- }
64
- //#endregion
65
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
6
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/util.js
66
7
  function getEnumValues(entries) {
67
8
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
68
9
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
69
10
  }
11
+ function joinValues(array, separator = "|") {
12
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
13
+ }
70
14
  function jsonStringifyReplacer(_, value) {
71
15
  if (typeof value === "bigint") return value.toString();
72
16
  return value;
@@ -88,24 +32,6 @@ function cleanRegex(source) {
88
32
  const end = source.endsWith("$") ? source.length - 1 : source.length;
89
33
  return source.slice(start, end);
90
34
  }
91
- const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
92
- function defineLazy(object, key, getter) {
93
- let value = void 0;
94
- Object.defineProperty(object, key, {
95
- get() {
96
- if (value === EVALUATING) return;
97
- if (value === void 0) {
98
- value = EVALUATING;
99
- value = getter();
100
- }
101
- return value;
102
- },
103
- set(v) {
104
- Object.defineProperty(object, key, { value: v });
105
- },
106
- configurable: true
107
- });
108
- }
109
35
  function assignProp(target, prop, value) {
110
36
  Object.defineProperty(target, prop, {
111
37
  value,
@@ -187,12 +113,16 @@ function normalizeParams(_params) {
187
113
  };
188
114
  return params;
189
115
  }
116
+ function stringifyPrimitive(value) {
117
+ if (typeof value === "bigint") return value.toString() + "n";
118
+ if (typeof value === "string") return `"${value}"`;
119
+ return `${value}`;
120
+ }
190
121
  function optionalKeys(shape) {
191
122
  return Object.keys(shape).filter((k) => {
192
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
123
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
193
124
  });
194
125
  }
195
- Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, -Number.MAX_VALUE, Number.MAX_VALUE;
196
126
  function pick(schema, mask) {
197
127
  const currDef = schema._zod.def;
198
128
  const checks = currDef.checks;
@@ -200,10 +130,10 @@ function pick(schema, mask) {
200
130
  return clone(schema, mergeDefs(schema._zod.def, {
201
131
  get shape() {
202
132
  const newShape = {};
203
- for (const key in mask) {
204
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
133
+ for (const key of Reflect.ownKeys(mask)) {
134
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
205
135
  if (!mask[key]) continue;
206
- newShape[key] = currDef.shape[key];
136
+ assignProp(newShape, key, currDef.shape[key]);
207
137
  }
208
138
  assignProp(this, "shape", newShape);
209
139
  return newShape;
@@ -218,8 +148,8 @@ function omit(schema, mask) {
218
148
  return clone(schema, mergeDefs(schema._zod.def, {
219
149
  get shape() {
220
150
  const newShape = { ...schema._zod.def.shape };
221
- for (const key in mask) {
222
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
151
+ for (const key of Reflect.ownKeys(mask)) {
152
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
223
153
  if (!mask[key]) continue;
224
154
  delete newShape[key];
225
155
  }
@@ -234,7 +164,7 @@ function extend(schema, shape) {
234
164
  const checks = schema._zod.def.checks;
235
165
  if (checks && checks.length > 0) {
236
166
  const existingShape = schema._zod.def.shape;
237
- 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.");
167
+ for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
238
168
  }
239
169
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
240
170
  const _shape = {
@@ -257,6 +187,7 @@ function safeExtend(schema, shape) {
257
187
  } }));
258
188
  }
259
189
  function merge(a, b) {
190
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
260
191
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
261
192
  return clone(a, mergeDefs(a._zod.def, {
262
193
  get shape() {
@@ -273,22 +204,22 @@ function merge(a, b) {
273
204
  checks: b._zod.def.checks ?? []
274
205
  }));
275
206
  }
276
- function partial(Class, schema, mask) {
207
+ function partial(Class, schema, mask, name = "partial") {
277
208
  const checks = schema._zod.def.checks;
278
- if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
209
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
279
210
  return clone(schema, mergeDefs(schema._zod.def, {
280
211
  get shape() {
281
212
  const oldShape = schema._zod.def.shape;
282
213
  const shape = { ...oldShape };
283
- if (mask) for (const key in mask) {
284
- if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
214
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
215
+ if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
285
216
  if (!mask[key]) continue;
286
217
  shape[key] = Class ? new Class({
287
218
  type: "optional",
288
219
  innerType: oldShape[key]
289
220
  }) : oldShape[key];
290
221
  }
291
- else for (const key in oldShape) shape[key] = Class ? new Class({
222
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
292
223
  type: "optional",
293
224
  innerType: oldShape[key]
294
225
  }) : oldShape[key];
@@ -302,15 +233,15 @@ function required(Class, schema, mask) {
302
233
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
303
234
  const oldShape = schema._zod.def.shape;
304
235
  const shape = { ...oldShape };
305
- if (mask) for (const key in mask) {
306
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
236
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
237
+ if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
307
238
  if (!mask[key]) continue;
308
239
  shape[key] = new Class({
309
240
  type: "nonoptional",
310
241
  innerType: oldShape[key]
311
242
  });
312
243
  }
313
- else for (const key in oldShape) shape[key] = new Class({
244
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
314
245
  type: "nonoptional",
315
246
  innerType: oldShape[key]
316
247
  });
@@ -339,19 +270,54 @@ function prefixIssues(path, issues) {
339
270
  function unwrapMessage(message) {
340
271
  return typeof message === "string" ? message : message?.message;
341
272
  }
273
+ function attachSchema(issues, start, inst) {
274
+ var _a;
275
+ for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
276
+ }
342
277
  function finalizeIssue(iss, ctx, config) {
343
- 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";
344
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
278
+ var _a;
279
+ const traits = iss.inst?._zod?.traits;
280
+ if (traits?.has("$ZodType")) {
281
+ if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
282
+ else iss.schema = iss.inst;
283
+ }
284
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
285
+ const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
286
+ const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
345
287
  rest.path ?? (rest.path = []);
346
288
  rest.message = message;
347
289
  if (ctx?.reportInput) rest.input = _input;
348
290
  return rest;
349
291
  }
292
+ const highSurrogate = /[\uD800-\uDBFF]/;
293
+ function codePointLength(str) {
294
+ const units = str.length;
295
+ if (!highSurrogate.test(str)) return units;
296
+ let count = units;
297
+ for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
298
+ count--;
299
+ i++;
300
+ }
301
+ return count;
302
+ }
350
303
  function getLengthableOrigin(input) {
351
304
  if (Array.isArray(input)) return "array";
352
305
  if (typeof input === "string") return "string";
353
306
  return "unknown";
354
307
  }
308
+ function parsedType(data) {
309
+ const t = typeof data;
310
+ switch (t) {
311
+ case "number": return Number.isNaN(data) ? "nan" : "number";
312
+ case "object": {
313
+ if (data === null) return "null";
314
+ if (Array.isArray(data)) return "array";
315
+ const obj = data;
316
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
317
+ }
318
+ }
319
+ return t;
320
+ }
355
321
  function issue(...args) {
356
322
  const [iss, input, inst] = args;
357
323
  if (typeof iss === "string") return {
@@ -362,33 +328,330 @@ function issue(...args) {
362
328
  };
363
329
  return { ...iss };
364
330
  }
365
- //#endregion
366
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
367
- const initializer$1 = (inst, def) => {
368
- inst.name = "$ZodError";
369
- Object.defineProperty(inst, "_zod", {
370
- value: inst._zod,
371
- enumerable: false
331
+ /**
332
+ * Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
333
+ *
334
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
335
+ */
336
+ function members(proto, table) {
337
+ for (const key in table) {
338
+ const desc = Object.getOwnPropertyDescriptor(table, key);
339
+ if (desc.get) Object.defineProperty(proto, key, {
340
+ ...desc,
341
+ enumerable: false
342
+ });
343
+ else defineBound(proto, key, desc.value);
344
+ }
345
+ }
346
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
347
+ function own(inst, key, value, enumerable = true) {
348
+ Object.defineProperty(inst, key, {
349
+ configurable: true,
350
+ writable: true,
351
+ enumerable,
352
+ value
372
353
  });
373
- Object.defineProperty(inst, "issues", {
374
- value: def,
375
- enumerable: false
354
+ return value;
355
+ }
356
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
357
+ function hide(inst, key, value) {
358
+ return own(inst, key, value, false);
359
+ }
360
+ function defineBound(proto, key, fn) {
361
+ Object.defineProperty(proto, key, {
362
+ configurable: true,
363
+ get() {
364
+ return this == null ? fn : own(this, key, fn.bind(this));
365
+ },
366
+ set(value) {
367
+ own(this, key, value);
368
+ }
376
369
  });
377
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
378
- Object.defineProperty(inst, "toString", {
379
- value: () => inst.message,
380
- enumerable: false
370
+ }
371
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
372
+ function claim(inst, sentinel) {
373
+ const proto = Object.getPrototypeOf(inst);
374
+ return sentinel in proto ? void 0 : proto;
375
+ }
376
+ let installing;
377
+ let broke = false;
378
+ const breaker = {
379
+ configurable: true,
380
+ get() {
381
+ broke = true;
382
+ }
383
+ };
384
+ /**
385
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
386
+ * constructor, computed from the internals object itself and cached there on
387
+ * first read. One accessor per constructor rather than one per instance.
388
+ */
389
+ function defineLazyInternal(inst, key, compute) {
390
+ const proto = Object.getPrototypeOf(inst._zod);
391
+ if (key in proto && installing !== inst._zod) {
392
+ installing = void 0;
393
+ return;
394
+ }
395
+ installing = inst._zod;
396
+ Object.defineProperty(proto, key, {
397
+ configurable: true,
398
+ get() {
399
+ Object.defineProperty(this, key, breaker);
400
+ const outer = broke;
401
+ broke = false;
402
+ try {
403
+ const value = compute(this);
404
+ if (broke) delete this[key];
405
+ else Object.defineProperty(this, key, {
406
+ configurable: true,
407
+ writable: true,
408
+ value
409
+ });
410
+ broke = broke || outer;
411
+ return value;
412
+ } catch (err) {
413
+ delete this[key];
414
+ broke = broke || outer;
415
+ throw err;
416
+ }
417
+ },
418
+ set(value) {
419
+ Object.defineProperty(this, key, {
420
+ configurable: true,
421
+ writable: true,
422
+ value
423
+ });
424
+ }
381
425
  });
426
+ }
427
+ /**
428
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
429
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
430
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
431
+ */
432
+ function installLazyProp(inst, key, make, enumerable) {
433
+ const proto = claim(inst, key);
434
+ if (!proto) return;
435
+ Object.defineProperty(proto, key, {
436
+ configurable: true,
437
+ get() {
438
+ const desc = {
439
+ configurable: true,
440
+ writable: true,
441
+ enumerable,
442
+ value: void 0
443
+ };
444
+ Object.defineProperty(this, key, desc);
445
+ desc.value = make(this);
446
+ Object.defineProperty(this, key, desc);
447
+ return desc.value;
448
+ },
449
+ set(value) {
450
+ Object.defineProperty(this, key, {
451
+ configurable: true,
452
+ writable: true,
453
+ enumerable,
454
+ value
455
+ });
456
+ }
457
+ });
458
+ }
459
+ /** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
460
+ const CONSTANT_CATCH = "~constantCatch";
461
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
462
+ function constantCatch(value) {
463
+ const fn = () => value;
464
+ fn[CONSTANT_CATCH] = true;
465
+ return fn;
466
+ }
467
+ //#endregion
468
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/core.js
469
+ var _a$1;
470
+ const _zodDesc$1 = {
471
+ value: void 0,
472
+ enumerable: false
473
+ };
474
+ let _E = "captureStackTrace" in Error ? Error : null;
475
+ function newError(Definition) {
476
+ const E = _E;
477
+ if (E) {
478
+ const saved = E.stackTraceLimit;
479
+ if (typeof saved === "number") {
480
+ try {
481
+ E.stackTraceLimit = 0;
482
+ } catch {
483
+ _E = null;
484
+ return new Definition();
485
+ }
486
+ try {
487
+ return new Definition();
488
+ } finally {
489
+ E.stackTraceLimit = saved;
490
+ }
491
+ }
492
+ }
493
+ return new Definition();
494
+ }
495
+ function $constructor(name, initializer, proto, params) {
496
+ const zodProto = {};
497
+ function Internals(def) {
498
+ this.def = def;
499
+ this.constr = _;
500
+ this.traits = /* @__PURE__ */ new Set();
501
+ }
502
+ Internals.prototype = zodProto;
503
+ const protoMembers = proto;
504
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
505
+ function init(inst, def) {
506
+ if (!inst._zod) {
507
+ _zodDesc$1.value = new Internals(def);
508
+ try {
509
+ Object.defineProperty(inst, "_zod", _zodDesc$1);
510
+ } finally {
511
+ _zodDesc$1.value = void 0;
512
+ }
513
+ }
514
+ if (inst._zod.traits.has(name)) return;
515
+ inst._zod.traits.add(name);
516
+ initializer(inst, def);
517
+ if (initialized) {
518
+ const own = Object.getPrototypeOf(inst);
519
+ const ctorProto = inst._zod.constr.prototype;
520
+ let up = own;
521
+ while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
522
+ const target = up ?? own;
523
+ if (!initialized.has(target)) {
524
+ initialized.add(target);
525
+ members(target, protoMembers);
526
+ }
527
+ }
528
+ const proto = _.prototype;
529
+ for (const k in proto) {
530
+ if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
531
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
532
+ }
533
+ }
534
+ const Parent = params?.Parent ?? Object;
535
+ class Definition extends Parent {}
536
+ Object.defineProperty(Definition, "name", { value: name });
537
+ function _(def) {
538
+ const inst = params?.Parent ? newError(Definition) : this;
539
+ init(inst, def);
540
+ const deferred = inst._zod.deferred;
541
+ if (deferred) {
542
+ for (const fn of deferred) fn();
543
+ inst._zod.deferred = void 0;
544
+ }
545
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
546
+ if (pp) pp(inst);
547
+ return inst;
548
+ }
549
+ Object.defineProperty(_, "init", { value: init });
550
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
551
+ if (params?.Parent && inst instanceof params.Parent) return true;
552
+ return inst?._zod?.traits?.has(name);
553
+ } });
554
+ Object.defineProperty(_, "name", { value: name });
555
+ return _;
556
+ }
557
+ var $ZodAsyncError = class extends Error {
558
+ constructor() {
559
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
560
+ }
561
+ };
562
+ var $ZodEncodeError = class extends Error {
563
+ constructor(name) {
564
+ super(`Encountered unidirectional transform during encode: ${name}`);
565
+ this.name = "ZodEncodeError";
566
+ }
567
+ };
568
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
569
+ const globalConfig = globalThis.__zod_globalConfig;
570
+ function config(newConfig) {
571
+ if (newConfig) Object.assign(globalConfig, newConfig);
572
+ return globalConfig;
573
+ }
574
+ //#endregion
575
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/errors.js
576
+ function _getMessage() {
577
+ const internals = this._zod;
578
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
579
+ return internals.message;
580
+ }
581
+ function _setMessage(value) {
582
+ this._zod.message = value;
583
+ }
584
+ const _messageDesc = {
585
+ get: _getMessage,
586
+ set: _setMessage,
587
+ enumerable: true,
588
+ configurable: true
589
+ };
590
+ const _zodDesc = {
591
+ value: void 0,
592
+ enumerable: false
593
+ };
594
+ const _issuesDesc = {
595
+ value: void 0,
596
+ enumerable: false
597
+ };
598
+ const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
599
+ const initializer$1 = (inst, def) => {
600
+ inst.name = "$ZodError";
601
+ _zodDesc.value = inst._zod;
602
+ Object.defineProperty(inst, "_zod", _zodDesc);
603
+ _issuesDesc.value = def;
604
+ Object.defineProperty(inst, "issues", _issuesDesc);
605
+ _zodDesc.value = void 0;
606
+ _issuesDesc.value = void 0;
607
+ Object.defineProperty(inst, "message", _messageDesc);
608
+ const proto = Object.getPrototypeOf(inst);
609
+ if (!_installedToString.has(proto)) {
610
+ _installedToString.add(proto);
611
+ Object.defineProperty(proto, "toString", {
612
+ configurable: true,
613
+ enumerable: false,
614
+ get() {
615
+ const value = () => this.message;
616
+ Object.defineProperty(this, "toString", {
617
+ value,
618
+ configurable: true,
619
+ writable: true
620
+ });
621
+ return value;
622
+ },
623
+ set(value) {
624
+ Object.defineProperty(this, "toString", {
625
+ value,
626
+ configurable: true,
627
+ writable: true
628
+ });
629
+ }
630
+ });
631
+ }
382
632
  };
383
633
  const $ZodError = $constructor("$ZodError", initializer$1);
384
- const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
634
+ const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
635
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
636
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
637
+ * "__proto__" would hit the setter instead of creating a key. */
638
+ function node(obj, key, make) {
639
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
640
+ if (key === "__proto__") Object.defineProperty(obj, key, {
641
+ value: make(),
642
+ writable: true,
643
+ enumerable: true,
644
+ configurable: true
645
+ });
646
+ else obj[key] = make();
647
+ }
648
+ return obj[key];
649
+ }
385
650
  function flattenError(error, mapper = (issue) => issue.message) {
386
651
  const fieldErrors = {};
387
652
  const formErrors = [];
388
- for (const sub of error.issues) if (sub.path.length > 0) {
389
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
390
- fieldErrors[sub.path[0]].push(mapper(sub));
391
- } else formErrors.push(mapper(sub));
653
+ for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
654
+ else formErrors.push(mapper(sub));
392
655
  return {
393
656
  formErrors,
394
657
  fieldErrors
@@ -408,12 +671,21 @@ function formatError(error, mapper = (issue) => issue.message) {
408
671
  let i = 0;
409
672
  while (i < fullpath.length) {
410
673
  const el = fullpath[i];
411
- if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
412
- else {
413
- curr[el] = curr[el] || { _errors: [] };
414
- curr[el]._errors.push(mapper(issue));
674
+ const terminal = i === fullpath.length - 1;
675
+ if (el === "_errors") {
676
+ if (terminal) curr._errors.push(mapper(issue));
677
+ i++;
678
+ continue;
415
679
  }
416
- curr = curr[el];
680
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
681
+ value: { _errors: [] },
682
+ enumerable: true,
683
+ writable: true,
684
+ configurable: true
685
+ });
686
+ const node = curr[el];
687
+ if (terminal) node._errors.push(mapper(issue));
688
+ curr = node;
417
689
  i++;
418
690
  }
419
691
  }
@@ -423,40 +695,52 @@ function formatError(error, mapper = (issue) => issue.message) {
423
695
  return fieldErrors;
424
696
  }
425
697
  //#endregion
426
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
427
- const _parse = (_Err) => (schema, value, _ctx, _params) => {
428
- const ctx = _ctx ? {
429
- ..._ctx,
430
- async: false
431
- } : { async: false };
432
- const result = schema._zod.run({
433
- value,
434
- issues: []
435
- }, ctx);
436
- if (result instanceof Promise) throw new $ZodAsyncError();
437
- if (result.issues.length) {
438
- const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
439
- captureStackTrace(e, _params?.callee);
440
- throw e;
441
- }
442
- return result.value;
698
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/parse.js
699
+ function finalizeParams(callee, params) {
700
+ return {
701
+ callee: params?.callee ?? callee,
702
+ Err: params?.Err
703
+ };
704
+ }
705
+ const _parse = (_Err) => {
706
+ const fn = (schema, value, _ctx, _params) => {
707
+ const ctx = _ctx ? {
708
+ ..._ctx,
709
+ async: false
710
+ } : { async: false };
711
+ const result = schema._zod.run({
712
+ value,
713
+ issues: []
714
+ }, ctx);
715
+ if (result instanceof Promise) throw new $ZodAsyncError();
716
+ if (result.issues.length) {
717
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
718
+ captureStackTrace(e, _params?.callee ?? fn);
719
+ throw e;
720
+ }
721
+ return result.value;
722
+ };
723
+ return fn;
443
724
  };
444
- const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
445
- const ctx = _ctx ? {
446
- ..._ctx,
447
- async: true
448
- } : { async: true };
449
- let result = schema._zod.run({
450
- value,
451
- issues: []
452
- }, ctx);
453
- if (result instanceof Promise) result = await result;
454
- if (result.issues.length) {
455
- const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
456
- captureStackTrace(e, params?.callee);
457
- throw e;
458
- }
459
- return result.value;
725
+ const _parseAsync = (_Err) => {
726
+ const fn = async (schema, value, _ctx, params) => {
727
+ const ctx = _ctx ? {
728
+ ..._ctx,
729
+ async: true
730
+ } : { async: true };
731
+ let result = schema._zod.run({
732
+ value,
733
+ issues: []
734
+ }, ctx);
735
+ if (result instanceof Promise) result = await result;
736
+ if (result.issues.length) {
737
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
738
+ captureStackTrace(e, params?.callee ?? fn);
739
+ throw e;
740
+ }
741
+ return result.value;
742
+ };
743
+ return fn;
460
744
  };
461
745
  const _safeParse = (_Err) => (schema, value, _ctx) => {
462
746
  const ctx = _ctx ? {
@@ -496,25 +780,41 @@ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
496
780
  };
497
781
  };
498
782
  const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
499
- const _encode = (_Err) => (schema, value, _ctx) => {
500
- const ctx = _ctx ? {
501
- ..._ctx,
502
- direction: "backward"
503
- } : { direction: "backward" };
504
- return _parse(_Err)(schema, value, ctx);
783
+ const _encode = (_Err) => {
784
+ const parse = _parse(_Err);
785
+ const fn = (schema, value, _ctx, _params) => {
786
+ const ctx = _ctx ? {
787
+ ..._ctx,
788
+ direction: "backward"
789
+ } : { direction: "backward" };
790
+ return parse(schema, value, ctx, finalizeParams(fn, _params));
791
+ };
792
+ return fn;
505
793
  };
506
- const _decode = (_Err) => (schema, value, _ctx) => {
507
- return _parse(_Err)(schema, value, _ctx);
794
+ const _decode = (_Err) => {
795
+ const parse = _parse(_Err);
796
+ const fn = (schema, value, _ctx, _params) => {
797
+ return parse(schema, value, _ctx, finalizeParams(fn, _params));
798
+ };
799
+ return fn;
508
800
  };
509
- const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
510
- const ctx = _ctx ? {
511
- ..._ctx,
512
- direction: "backward"
513
- } : { direction: "backward" };
514
- return _parseAsync(_Err)(schema, value, ctx);
801
+ const _encodeAsync = (_Err) => {
802
+ const parseAsync = _parseAsync(_Err);
803
+ const fn = async (schema, value, _ctx, _params) => {
804
+ const ctx = _ctx ? {
805
+ ..._ctx,
806
+ direction: "backward"
807
+ } : { direction: "backward" };
808
+ return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
809
+ };
810
+ return fn;
515
811
  };
516
- const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
517
- return _parseAsync(_Err)(schema, value, _ctx);
812
+ const _decodeAsync = (_Err) => {
813
+ const parseAsync = _parseAsync(_Err);
814
+ const fn = async (schema, value, _ctx, _params) => {
815
+ return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
816
+ };
817
+ return fn;
518
818
  };
519
819
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
520
820
  const ctx = _ctx ? {
@@ -537,7 +837,7 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
537
837
  return _safeParseAsync(_Err)(schema, value, _ctx);
538
838
  };
539
839
  //#endregion
540
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
840
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/regexes.js
541
841
  /**
542
842
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
543
843
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -545,12 +845,15 @@ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
545
845
  */
546
846
  const cuid = /^[cC][0-9a-z]{6,}$/;
547
847
  const cuid2 = /^[0-9a-z]+$/;
548
- const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
848
+ const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
549
849
  const xid = /^[0-9a-vA-V]{20}$/;
550
850
  const ksuid = /^[A-Za-z0-9]{27}$/;
551
851
  const nanoid = /^[a-zA-Z0-9_-]{21}$/;
852
+ function nanoidOfLength(length) {
853
+ return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
854
+ }
552
855
  /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
553
- 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)?)?)$/;
856
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
554
857
  /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
555
858
  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})$/;
556
859
  /** Returns a regex for validating an RFC 9562/4122 UUID.
@@ -562,33 +865,41 @@ const uuid = (version) => {
562
865
  };
563
866
  /** Practical email validation */
564
867
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
565
- const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
868
+ const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
566
869
  function emoji() {
567
870
  return new RegExp(_emoji$1, "u");
568
871
  }
569
872
  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])$/;
570
873
  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}|:))$/;
571
874
  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])$/;
572
- 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])$/;
875
+ const cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
573
876
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
574
877
  const base64url = /^[A-Za-z0-9_-]*$/;
575
878
  const httpProtocol = /^https?$/;
576
879
  const e164 = /^\+[1-9]\d{6,14}$/;
577
880
  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])))`;
578
- const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
881
+ /** Anchors a pattern source. The interpolation lives here rather than at the call site because
882
+ * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
883
+ * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
884
+ function anchor(source) {
885
+ return new RegExp(`^${source}$`);
886
+ }
887
+ const date = /*@__PURE__*/ anchor(dateSource);
579
888
  function timeSource(args) {
580
889
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
581
- 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+)?)?`;
890
+ return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
582
891
  }
583
- function time$1(args) {
892
+ function time(args) {
584
893
  return new RegExp(`^${timeSource(args)}$`);
585
894
  }
586
- function datetime$1(args) {
587
- const time = timeSource({ precision: args.precision });
895
+ function datetime(args) {
588
896
  const opts = ["Z"];
589
- if (args.local) opts.push("");
590
897
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
591
- const timeRegex = `${time}(?:${opts.join("|")})`;
898
+ const qualified = `${timeSource({
899
+ precision: args.precision,
900
+ seconds: true
901
+ })}(?:${opts.join("|")})`;
902
+ const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
592
903
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
593
904
  }
594
905
  const string$1 = (params) => {
@@ -598,27 +909,30 @@ const string$1 = (params) => {
598
909
  const lowercase = /^[^A-Z]*$/;
599
910
  const uppercase = /^[^a-z]*$/;
600
911
  //#endregion
601
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
912
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/checks.js
602
913
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
603
914
  var _a;
604
915
  inst._zod ?? (inst._zod = {});
605
916
  inst._zod.def = def;
606
917
  (_a = inst._zod).onattach ?? (_a.onattach = []);
607
918
  });
919
+ /** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
920
+ const _whenHasLength = (payload) => {
921
+ const val = payload.value;
922
+ return !nullish(val) && val.length !== void 0;
923
+ };
608
924
  const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
609
925
  var _a;
610
926
  $ZodCheck.init(inst, def);
611
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
612
- const val = payload.value;
613
- return !nullish(val) && val.length !== void 0;
614
- });
927
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
615
928
  inst._zod.onattach.push((inst) => {
616
929
  const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
617
930
  if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
618
931
  });
619
932
  inst._zod.check = (payload) => {
620
933
  const input = payload.value;
621
- if (input.length <= def.maximum) return;
934
+ const units = input.length;
935
+ if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
622
936
  const origin = getLengthableOrigin(input);
623
937
  payload.issues.push({
624
938
  origin,
@@ -634,17 +948,15 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
634
948
  const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
635
949
  var _a;
636
950
  $ZodCheck.init(inst, def);
637
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
638
- const val = payload.value;
639
- return !nullish(val) && val.length !== void 0;
640
- });
951
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
641
952
  inst._zod.onattach.push((inst) => {
642
953
  const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
643
954
  if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
644
955
  });
645
956
  inst._zod.check = (payload) => {
646
957
  const input = payload.value;
647
- if (input.length >= def.minimum) return;
958
+ const units = input.length;
959
+ if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
648
960
  const origin = getLengthableOrigin(input);
649
961
  payload.issues.push({
650
962
  origin,
@@ -660,10 +972,7 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
660
972
  const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
661
973
  var _a;
662
974
  $ZodCheck.init(inst, def);
663
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
664
- const val = payload.value;
665
- return !nullish(val) && val.length !== void 0;
666
- });
975
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
667
976
  inst._zod.onattach.push((inst) => {
668
977
  const bag = inst._zod.bag;
669
978
  bag.minimum = def.length;
@@ -672,7 +981,8 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
672
981
  });
673
982
  inst._zod.check = (payload) => {
674
983
  const input = payload.value;
675
- const length = input.length;
984
+ const units = input.length;
985
+ const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
676
986
  if (length === def.length) return;
677
987
  const origin = getLengthableOrigin(input);
678
988
  const tooBig = length > def.length;
@@ -746,7 +1056,7 @@ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (ins
746
1056
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
747
1057
  $ZodCheck.init(inst, def);
748
1058
  const escapedRegex = escapeRegex(def.includes);
749
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1059
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
750
1060
  def.pattern = pattern;
751
1061
  inst._zod.onattach.push((inst) => {
752
1062
  const bag = inst._zod.bag;
@@ -817,12 +1127,13 @@ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (ins
817
1127
  };
818
1128
  });
819
1129
  //#endregion
820
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
1130
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/doc.js
821
1131
  var Doc = class {
822
- constructor(args = []) {
1132
+ constructor(args = [], closed = {}) {
823
1133
  this.content = [];
824
1134
  this.indent = 0;
825
- if (this) this.args = args;
1135
+ this.args = args;
1136
+ this.closed = closed;
826
1137
  }
827
1138
  indented(fn) {
828
1139
  this.indent += 1;
@@ -842,28 +1153,27 @@ var Doc = class {
842
1153
  }
843
1154
  compile() {
844
1155
  const F = Function;
845
- const args = this?.args;
846
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
847
- return new F(...args, lines.join("\n"));
1156
+ const content = this?.content ?? [``];
1157
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
848
1158
  }
849
1159
  };
850
1160
  //#endregion
851
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1161
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/versions.js
852
1162
  const version = {
853
1163
  major: 4,
854
- minor: 4,
855
- patch: 3
1164
+ minor: 5,
1165
+ patch: 2
856
1166
  };
857
1167
  //#endregion
858
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1168
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/schemas.js
859
1169
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
860
1170
  var _a;
861
1171
  inst ?? (inst = {});
862
1172
  inst._zod.def = def;
863
1173
  inst._zod.bag = inst._zod.bag || {};
864
1174
  inst._zod.version = version;
865
- const checks = [...inst._zod.def.checks ?? []];
866
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1175
+ const defChecks = inst._zod.def.checks;
1176
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
867
1177
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
868
1178
  if (checks.length === 0) {
869
1179
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -872,6 +1182,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
872
1182
  });
873
1183
  } else {
874
1184
  const runChecks = (payload, checks, ctx) => {
1185
+ if (payload.memo) return payload;
875
1186
  let isAborted = aborted(payload);
876
1187
  let asyncResult;
877
1188
  for (const ch of checks) {
@@ -885,10 +1196,12 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
885
1196
  if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
886
1197
  await _;
887
1198
  if (payload.issues.length === currLen) return;
1199
+ attachSchema(payload.issues, currLen, inst);
888
1200
  if (!isAborted) isAborted = aborted(payload, currLen);
889
1201
  });
890
1202
  else {
891
1203
  if (payload.issues.length === currLen) continue;
1204
+ attachSchema(payload.issues, currLen, inst);
892
1205
  if (!isAborted) isAborted = aborted(payload, currLen);
893
1206
  }
894
1207
  }
@@ -932,19 +1245,29 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
932
1245
  return runChecks(result, checks, ctx);
933
1246
  };
934
1247
  }
935
- defineLazy(inst, "~standard", () => ({
1248
+ }, {
1249
+ get "~standard"() {
1250
+ return hide(this, "~standard", standardProps(this));
1251
+ },
1252
+ set "~standard"(value) {
1253
+ own(this, "~standard", value);
1254
+ }
1255
+ });
1256
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1257
+ const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1258
+ function standardProps(inst) {
1259
+ return {
936
1260
  validate: (value) => {
937
1261
  try {
938
- const r = safeParse$1(inst, value);
939
- return r.success ? { value: r.data } : { issues: r.error?.issues };
1262
+ return toStandardResult(safeParse$1(inst, value));
940
1263
  } catch (_) {
941
- return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1264
+ return safeParseAsync$1(inst, value).then(toStandardResult);
942
1265
  }
943
1266
  },
944
1267
  vendor: "zod",
945
1268
  version: 1
946
- }));
947
- });
1269
+ };
1270
+ }
948
1271
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
949
1272
  $ZodType.init(inst, def);
950
1273
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
@@ -991,51 +1314,74 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
991
1314
  def.pattern ?? (def.pattern = email);
992
1315
  $ZodStringFormat.init(inst, def);
993
1316
  });
1317
+ /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
1318
+ function parseURLObject(trimmed, def) {
1319
+ if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1320
+ try {
1321
+ return new URL(trimmed);
1322
+ } catch {
1323
+ return 2;
1324
+ }
1325
+ }
1326
+ const asciiTabOrNewline = /[\t\n\r]/g;
1327
+ /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
1328
+ function stripTabAndNewline(value) {
1329
+ return value.replace(asciiTabOrNewline, "");
1330
+ }
1331
+ function urlHostnameOk(url, hostname) {
1332
+ hostname.lastIndex = 0;
1333
+ return hostname.test(url.hostname);
1334
+ }
1335
+ function urlProtocolOk(url, protocol) {
1336
+ protocol.lastIndex = 0;
1337
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
1338
+ }
994
1339
  const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
995
1340
  $ZodStringFormat.init(inst, def);
996
1341
  inst._zod.check = (payload) => {
997
1342
  try {
998
1343
  const trimmed = payload.value.trim();
999
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1000
- if (!/^https?:\/\//i.test(trimmed)) {
1001
- payload.issues.push({
1002
- code: "invalid_format",
1003
- format: "url",
1004
- note: "Invalid URL format",
1005
- input: payload.value,
1006
- inst,
1007
- continue: !def.abort
1008
- });
1009
- return;
1010
- }
1011
- }
1012
- const url = new URL(trimmed);
1013
- if (def.hostname) {
1014
- def.hostname.lastIndex = 0;
1015
- if (!def.hostname.test(url.hostname)) payload.issues.push({
1344
+ const url = parseURLObject(trimmed, def);
1345
+ if (url === 1) {
1346
+ payload.issues.push({
1016
1347
  code: "invalid_format",
1017
1348
  format: "url",
1018
- note: "Invalid hostname",
1019
- pattern: def.hostname.source,
1349
+ note: "Invalid URL format",
1020
1350
  input: payload.value,
1021
1351
  inst,
1022
1352
  continue: !def.abort
1023
1353
  });
1354
+ return;
1024
1355
  }
1025
- if (def.protocol) {
1026
- def.protocol.lastIndex = 0;
1027
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1356
+ if (url === 2) {
1357
+ payload.issues.push({
1028
1358
  code: "invalid_format",
1029
1359
  format: "url",
1030
- note: "Invalid protocol",
1031
- pattern: def.protocol.source,
1032
1360
  input: payload.value,
1033
1361
  inst,
1034
1362
  continue: !def.abort
1035
1363
  });
1364
+ return;
1036
1365
  }
1037
- if (def.normalize) payload.value = url.href;
1038
- else payload.value = trimmed;
1366
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1367
+ code: "invalid_format",
1368
+ format: "url",
1369
+ note: "Invalid hostname",
1370
+ pattern: def.hostname.source,
1371
+ input: payload.value,
1372
+ inst,
1373
+ continue: !def.abort
1374
+ });
1375
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
1376
+ code: "invalid_format",
1377
+ format: "url",
1378
+ note: "Invalid protocol",
1379
+ pattern: def.protocol.source,
1380
+ input: payload.value,
1381
+ inst,
1382
+ continue: !def.abort
1383
+ });
1384
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
1039
1385
  return;
1040
1386
  } catch (_) {
1041
1387
  payload.issues.push({
@@ -1053,7 +1399,8 @@ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def) => {
1053
1399
  $ZodStringFormat.init(inst, def);
1054
1400
  });
1055
1401
  const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1056
- def.pattern ?? (def.pattern = nanoid);
1402
+ if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
1403
+ def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
1057
1404
  $ZodStringFormat.init(inst, def);
1058
1405
  });
1059
1406
  /**
@@ -1082,19 +1429,25 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
1082
1429
  $ZodStringFormat.init(inst, def);
1083
1430
  });
1084
1431
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1085
- def.pattern ?? (def.pattern = datetime$1(def));
1432
+ def.pattern ?? (def.pattern = datetime(def));
1086
1433
  $ZodStringFormat.init(inst, def);
1434
+ if (def.local || def.precision === -1) {
1435
+ inst._zod.bag.laxFormat = true;
1436
+ inst._zod.onattach.push((s) => {
1437
+ s._zod.bag.laxFormat = true;
1438
+ });
1439
+ }
1087
1440
  });
1088
1441
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1089
- def.pattern ?? (def.pattern = date$1);
1442
+ def.pattern ?? (def.pattern = date);
1090
1443
  $ZodStringFormat.init(inst, def);
1091
1444
  });
1092
1445
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1093
- def.pattern ?? (def.pattern = time$1(def));
1446
+ def.pattern ?? (def.pattern = time(def));
1094
1447
  $ZodStringFormat.init(inst, def);
1095
1448
  });
1096
1449
  const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1097
- def.pattern ?? (def.pattern = duration$1);
1450
+ def.pattern ?? (def.pattern = duration);
1098
1451
  $ZodStringFormat.init(inst, def);
1099
1452
  });
1100
1453
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
@@ -1102,50 +1455,56 @@ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
1102
1455
  $ZodStringFormat.init(inst, def);
1103
1456
  inst._zod.bag.format = `ipv4`;
1104
1457
  });
1458
+ /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
1459
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
1460
+ function isValidIPv6(value) {
1461
+ if (!ipv6Alphabet.test(value)) return false;
1462
+ try {
1463
+ new URL(`http://[${value}]`);
1464
+ return true;
1465
+ } catch {
1466
+ return false;
1467
+ }
1468
+ }
1105
1469
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1106
1470
  def.pattern ?? (def.pattern = ipv6);
1107
1471
  $ZodStringFormat.init(inst, def);
1108
1472
  inst._zod.bag.format = `ipv6`;
1109
1473
  inst._zod.check = (payload) => {
1110
- try {
1111
- new URL(`http://[${payload.value}]`);
1112
- } catch {
1113
- payload.issues.push({
1114
- code: "invalid_format",
1115
- format: "ipv6",
1116
- input: payload.value,
1117
- inst,
1118
- continue: !def.abort
1119
- });
1120
- }
1474
+ if (!isValidIPv6(payload.value)) payload.issues.push({
1475
+ code: "invalid_format",
1476
+ format: "ipv6",
1477
+ input: payload.value,
1478
+ inst,
1479
+ continue: !def.abort
1480
+ });
1121
1481
  };
1122
1482
  });
1123
1483
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1124
1484
  def.pattern ?? (def.pattern = cidrv4);
1125
1485
  $ZodStringFormat.init(inst, def);
1126
1486
  });
1487
+ function isValidCIDRv6(value) {
1488
+ const parts = value.split("/");
1489
+ if (parts.length !== 2) return false;
1490
+ const [address, prefix] = parts;
1491
+ if (!prefix) return false;
1492
+ const prefixNum = Number(prefix);
1493
+ if (`${prefixNum}` !== prefix) return false;
1494
+ if (prefixNum < 0 || prefixNum > 128) return false;
1495
+ return isValidIPv6(address);
1496
+ }
1127
1497
  const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1128
1498
  def.pattern ?? (def.pattern = cidrv6);
1129
1499
  $ZodStringFormat.init(inst, def);
1130
1500
  inst._zod.check = (payload) => {
1131
- const parts = payload.value.split("/");
1132
- try {
1133
- if (parts.length !== 2) throw new Error();
1134
- const [address, prefix] = parts;
1135
- if (!prefix) throw new Error();
1136
- const prefixNum = Number(prefix);
1137
- if (`${prefixNum}` !== prefix) throw new Error();
1138
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
1139
- new URL(`http://[${address}]`);
1140
- } catch {
1141
- payload.issues.push({
1142
- code: "invalid_format",
1143
- format: "cidrv6",
1144
- input: payload.value,
1145
- inst,
1146
- continue: !def.abort
1147
- });
1148
- }
1501
+ if (!isValidCIDRv6(payload.value)) payload.issues.push({
1502
+ code: "invalid_format",
1503
+ format: "cidrv6",
1504
+ input: payload.value,
1505
+ inst,
1506
+ continue: !def.abort
1507
+ });
1149
1508
  };
1150
1509
  });
1151
1510
  function isValidBase64(data) {
@@ -1248,6 +1607,8 @@ function handleArrayResult(result, final, index) {
1248
1607
  }
1249
1608
  const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1250
1609
  $ZodType.init(inst, def);
1610
+ const memo = globalConfig.memoizer;
1611
+ memo?.attach(inst);
1251
1612
  inst._zod.parse = (payload, ctx) => {
1252
1613
  const input = payload.value;
1253
1614
  if (!Array.isArray(input)) {
@@ -1259,7 +1620,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1259
1620
  });
1260
1621
  return payload;
1261
1622
  }
1262
- payload.value = Array(input.length);
1623
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1263
1624
  const proms = [];
1264
1625
  for (let i = 0; i < input.length; i++) {
1265
1626
  const item = input[i];
@@ -1274,13 +1635,15 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1274
1635
  return payload;
1275
1636
  };
1276
1637
  });
1277
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
1638
+ function handlePropertyResult(result, final, key, input, optin, optout) {
1278
1639
  const isPresent = key in input;
1640
+ const isOptionalOut = optout === "optional";
1641
+ if (!isPresent && isOptionalOut && optin === "optional") return;
1279
1642
  if (result.issues.length) {
1280
- if (isOptionalIn && isOptionalOut && !isPresent) return;
1643
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
1281
1644
  final.issues.push(...prefixIssues(key, result.issues));
1282
1645
  }
1283
- if (!isPresent && !isOptionalIn) {
1646
+ if (!isPresent && optin === void 0) {
1284
1647
  if (!result.issues.length) final.issues.push({
1285
1648
  code: "invalid_type",
1286
1649
  expected: "nonoptional",
@@ -1293,13 +1656,18 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
1293
1656
  if (isPresent) final.value[key] = void 0;
1294
1657
  } else final.value[key] = result.value;
1295
1658
  }
1659
+ const NO_SYMBOL_KEYS = [];
1296
1660
  function normalizeDef(def) {
1297
1661
  const keys = Object.keys(def.shape);
1298
- 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`);
1662
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
1663
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
1664
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
1665
+ for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
1299
1666
  const okeys = optionalKeys(def.shape);
1300
1667
  return {
1301
1668
  ...def,
1302
- keys,
1669
+ allKeys,
1670
+ symbolKeys,
1303
1671
  keySet: new Set(keys),
1304
1672
  numKeys: keys.length,
1305
1673
  optionalKeys: new Set(okeys)
@@ -1310,11 +1678,14 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1310
1678
  const keySet = def.keySet;
1311
1679
  const _catchall = def.catchall._zod;
1312
1680
  const t = _catchall.def.type;
1313
- const isOptionalIn = _catchall.optin === "optional";
1314
- const isOptionalOut = _catchall.optout === "optional";
1681
+ const optin = _catchall.optin;
1682
+ const optout = _catchall.optout;
1315
1683
  for (const key in input) {
1316
- if (key === "__proto__") continue;
1317
1684
  if (keySet.has(key)) continue;
1685
+ if (key === "__proto__") {
1686
+ if (t === "never") unrecognized.push(key);
1687
+ continue;
1688
+ }
1318
1689
  if (t === "never") {
1319
1690
  unrecognized.push(key);
1320
1691
  continue;
@@ -1323,39 +1694,44 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1323
1694
  value: input[key],
1324
1695
  issues: []
1325
1696
  }, ctx);
1326
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1327
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1697
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1698
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1328
1699
  }
1329
1700
  if (unrecognized.length) payload.issues.push({
1330
1701
  code: "unrecognized_keys",
1331
1702
  keys: unrecognized,
1332
1703
  input,
1333
- inst
1704
+ inst,
1705
+ continue: true
1334
1706
  });
1335
1707
  if (!proms.length) return payload;
1336
1708
  return Promise.all(proms).then(() => {
1337
1709
  return payload;
1338
1710
  });
1339
1711
  }
1712
+ const propShapes = /* @__PURE__ */ new WeakMap();
1340
1713
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1341
1714
  $ZodType.init(inst, def);
1342
1715
  if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1343
1716
  const sh = def.shape;
1717
+ propShapes.set(def, sh);
1344
1718
  Object.defineProperty(def, "shape", { get: () => {
1345
1719
  const newSh = { ...sh };
1346
1720
  Object.defineProperty(def, "shape", { value: newSh });
1721
+ propShapes.set(def, newSh);
1347
1722
  return newSh;
1348
1723
  } });
1349
1724
  }
1350
1725
  const _normalized = cached$1(() => normalizeDef(def));
1351
- defineLazy(inst._zod, "propValues", () => {
1352
- const shape = def.shape;
1726
+ defineLazyInternal(inst, "propValues", (zod) => {
1727
+ const shape = zod.def.shape;
1353
1728
  const propValues = {};
1354
1729
  for (const key in shape) {
1355
1730
  const field = shape[key]._zod;
1356
1731
  if (field.values) {
1357
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1732
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
1358
1733
  for (const v of field.values) propValues[key].add(v);
1734
+ if (field.optin !== void 0) propValues[key].add(void 0);
1359
1735
  }
1360
1736
  }
1361
1737
  return propValues;
@@ -1363,6 +1739,8 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1363
1739
  const isObject$1 = isObject;
1364
1740
  const catchall = def.catchall;
1365
1741
  let value;
1742
+ const memo = globalConfig.memoizer;
1743
+ memo?.attach(inst);
1366
1744
  inst._zod.parse = (payload, ctx) => {
1367
1745
  value ?? (value = _normalized.value);
1368
1746
  const input = payload.value;
@@ -1375,19 +1753,20 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1375
1753
  });
1376
1754
  return payload;
1377
1755
  }
1378
- payload.value = {};
1756
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1379
1757
  const proms = [];
1380
1758
  const shape = value.shape;
1381
- for (const key of value.keys) {
1759
+ for (const key of value.allKeys) {
1760
+ if (key === "__proto__") continue;
1382
1761
  const el = shape[key];
1383
- const isOptionalIn = el._zod.optin === "optional";
1384
- const isOptionalOut = el._zod.optout === "optional";
1762
+ const optin = el._zod.optin;
1763
+ const optout = el._zod.optout;
1385
1764
  const r = el._zod.run({
1386
1765
  value: input[key],
1387
1766
  issues: []
1388
1767
  }, ctx);
1389
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1390
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1768
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1769
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1391
1770
  }
1392
1771
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1393
1772
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -1397,55 +1776,55 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1397
1776
  $ZodObject.init(inst, def);
1398
1777
  const superParse = inst._zod.parse;
1399
1778
  const _normalized = cached$1(() => normalizeDef(def));
1779
+ const memo = globalConfig.memoizer;
1400
1780
  const generateFastpass = (shape) => {
1401
- const doc = new Doc([
1402
- "shape",
1403
- "payload",
1404
- "ctx"
1405
- ]);
1406
1781
  const normalized = _normalized.value;
1407
- const parseStr = (key) => {
1408
- const k = esc(key);
1409
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1410
- };
1782
+ const syms = normalized.symbolKeys;
1783
+ const doc = new Doc(["payload", "ctx"], {
1784
+ shape,
1785
+ inst,
1786
+ memo,
1787
+ syms
1788
+ });
1789
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1790
+ const prefixStr = (id, k) => `
1791
+ for (let i = 0; i < ${id}.issues.length; i++) {
1792
+ const iss = ${id}.issues[i];
1793
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
1794
+ payload.issues.push(iss);
1795
+ }`;
1411
1796
  doc.write(`const input = payload.value;`);
1412
1797
  const ids = Object.create(null);
1413
1798
  let counter = 0;
1414
- for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1415
- doc.write(`const newResult = {};`);
1416
- for (const key of normalized.keys) {
1799
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
1800
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
1801
+ for (const key of normalized.allKeys) {
1802
+ if (key === "__proto__") continue;
1417
1803
  const id = ids[key];
1418
- const k = esc(key);
1804
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
1805
+ const isPresent = `${k} in input`;
1419
1806
  const schema = shape[key];
1420
- const isOptionalIn = schema?._zod?.optin === "optional";
1807
+ const optin = schema?._zod?.optin;
1808
+ const isOptionalIn = optin !== void 0;
1421
1809
  const isOptionalOut = schema?._zod?.optout === "optional";
1422
- doc.write(`const ${id} = ${parseStr(key)};`);
1423
- if (isOptionalIn && isOptionalOut) doc.write(`
1424
- if (${id}.issues.length) {
1425
- if (${k} in input) {
1426
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1427
- ...iss,
1428
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1429
- })));
1810
+ doc.write(`const ${id} = ${parseStr(k)};`);
1811
+ if (isOptionalIn && isOptionalOut) {
1812
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
1813
+ doc.write(`
1814
+ const ${id}_present = ${isPresent};
1815
+ if (!${id}.issues.length || ${id}_present) {
1816
+ if (${id}.issues.length) {${prefixStr(id, k)}
1430
1817
  }
1431
- }
1432
-
1433
- if (${id}.value === undefined) {
1434
- if (${k} in input) {
1435
- newResult[${k}] = undefined;
1818
+
1819
+ if (${assign}) {
1820
+ newResult[${k}] = ${id}.value;
1436
1821
  }
1437
- } else {
1438
- newResult[${k}] = ${id}.value;
1439
1822
  }
1440
-
1823
+
1441
1824
  `);
1442
- else if (!isOptionalIn) doc.write(`
1443
- const ${id}_present = ${k} in input;
1444
- if (${id}.issues.length) {
1445
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1446
- ...iss,
1447
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1448
- })));
1825
+ } else if (!isOptionalIn) doc.write(`
1826
+ const ${id}_present = ${isPresent};
1827
+ if (${id}.issues.length) {${prefixStr(id, k)}
1449
1828
  }
1450
1829
  if (!${id}_present && !${id}.issues.length) {
1451
1830
  payload.issues.push({
@@ -1457,36 +1836,27 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1457
1836
  }
1458
1837
 
1459
1838
  if (${id}_present) {
1460
- if (${id}.value === undefined) {
1461
- newResult[${k}] = undefined;
1462
- } else {
1463
- newResult[${k}] = ${id}.value;
1464
- }
1839
+ newResult[${k}] = ${id}.value;
1465
1840
  }
1466
1841
 
1467
1842
  `);
1468
1843
  else doc.write(`
1469
- if (${id}.issues.length) {
1470
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1471
- ...iss,
1472
- path: iss.path ? [${k}, ...iss.path] : [${k}]
1473
- })));
1844
+ if (${id}.issues.length) {${prefixStr(id, k)}
1474
1845
  }
1475
1846
 
1476
1847
  if (${id}.value === undefined) {
1477
- if (${k} in input) {
1848
+ if (${isPresent}) {
1478
1849
  newResult[${k}] = undefined;
1479
1850
  }
1480
1851
  } else {
1481
1852
  newResult[${k}] = ${id}.value;
1482
1853
  }
1483
-
1854
+
1484
1855
  `);
1485
1856
  }
1486
1857
  doc.write(`payload.value = newResult;`);
1487
1858
  doc.write(`return payload;`);
1488
- const fn = doc.compile();
1489
- return (payload, ctx) => fn(shape, payload, ctx);
1859
+ return doc.compile();
1490
1860
  };
1491
1861
  let fastpass;
1492
1862
  const isObject$2 = isObject;
@@ -1535,14 +1905,14 @@ function handleUnionResults(results, final, inst, ctx) {
1535
1905
  }
1536
1906
  const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
1537
1907
  $ZodType.init(inst, def);
1538
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1539
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1540
- defineLazy(inst._zod, "values", () => {
1541
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1908
+ defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
1909
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1910
+ defineLazyInternal(inst, "values", (zod) => {
1911
+ if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
1542
1912
  });
1543
- defineLazy(inst._zod, "pattern", () => {
1544
- if (def.options.every((o) => o._zod.pattern)) {
1545
- const patterns = def.options.map((o) => o._zod.pattern);
1913
+ defineLazyInternal(inst, "pattern", (zod) => {
1914
+ if (zod.def.options.every((o) => o._zod.pattern)) {
1915
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
1546
1916
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1547
1917
  }
1548
1918
  });
@@ -1574,18 +1944,22 @@ const $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnio
1574
1944
  def.inclusive = false;
1575
1945
  $ZodUnion.init(inst, def);
1576
1946
  const _super = inst._zod.parse;
1577
- defineLazy(inst._zod, "propValues", () => {
1947
+ defineLazyInternal(inst, "propValues", (zod) => {
1578
1948
  const propValues = {};
1579
- for (const option of def.options) {
1949
+ for (const option of zod.def.options) {
1580
1950
  const pv = option._zod.propValues;
1581
- if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1951
+ if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
1582
1952
  for (const [k, v] of Object.entries(pv)) {
1583
- if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
1953
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
1584
1954
  for (const val of v) propValues[k].add(val);
1585
1955
  }
1586
1956
  }
1587
1957
  return propValues;
1588
1958
  });
1959
+ def.options.forEach((option, i) => {
1960
+ const propShape = propShapes.get(option._zod.def);
1961
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
1962
+ });
1589
1963
  const disc = cached$1(() => {
1590
1964
  const opts = def.options;
1591
1965
  const map = /* @__PURE__ */ new Map();
@@ -1660,7 +2034,9 @@ function mergeValues(a, b) {
1660
2034
  ...a,
1661
2035
  ...b
1662
2036
  };
2037
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
1663
2038
  for (const key of sharedKeys) {
2039
+ if (key === "__proto__") continue;
1664
2040
  const sharedValue = mergeValues(a[key], b[key]);
1665
2041
  if (!sharedValue.valid) return {
1666
2042
  valid: false,
@@ -1702,26 +2078,39 @@ function mergeValues(a, b) {
1702
2078
  function handleIntersectionResults(result, left, right) {
1703
2079
  const unrecKeys = /* @__PURE__ */ new Map();
1704
2080
  let unrecIssue;
1705
- for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1706
- unrecIssue ?? (unrecIssue = iss);
1707
- for (const k of iss.keys) {
2081
+ const keyIssues = /* @__PURE__ */ new Map();
2082
+ const collect = (iss, side) => {
2083
+ let keys;
2084
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2085
+ unrecIssue ?? (unrecIssue = iss);
2086
+ keys = iss.keys;
2087
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2088
+ const k = String(iss.path[0]);
2089
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2090
+ keys = [k];
2091
+ } else return false;
2092
+ for (const k of keys) {
1708
2093
  if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1709
- unrecKeys.get(k).l = true;
2094
+ unrecKeys.get(k)[side] = true;
1710
2095
  }
1711
- } else result.issues.push(iss);
1712
- for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1713
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1714
- unrecKeys.get(k).r = true;
1715
- }
1716
- else result.issues.push(iss);
2096
+ return true;
2097
+ };
2098
+ for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
2099
+ for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
1717
2100
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1718
- if (bothKeys.length && unrecIssue) result.issues.push({
1719
- ...unrecIssue,
1720
- keys: bothKeys
1721
- });
1722
- if (aborted(result)) return result;
2101
+ if (bothKeys.length) {
2102
+ const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
2103
+ if (aggregated.length) result.issues.push({
2104
+ ...unrecIssue,
2105
+ keys: aggregated
2106
+ });
2107
+ for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
2108
+ }
1723
2109
  const merged = mergeValues(left.value, right.value);
1724
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2110
+ if (!merged.valid) {
2111
+ if (aborted(result)) return result;
2112
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2113
+ }
1725
2114
  result.value = merged.data;
1726
2115
  return result;
1727
2116
  }
@@ -1730,7 +2119,8 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1730
2119
  const values = getEnumValues(def.entries);
1731
2120
  const valuesSet = new Set(values);
1732
2121
  inst._zod.values = valuesSet;
1733
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2122
+ const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2123
+ inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
1734
2124
  inst._zod.parse = (payload, _ctx) => {
1735
2125
  const input = payload.value;
1736
2126
  if (valuesSet.has(input)) return payload;
@@ -1745,10 +2135,9 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1745
2135
  });
1746
2136
  const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1747
2137
  $ZodType.init(inst, def);
1748
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
1749
2138
  const values = new Set(def.values);
1750
2139
  inst._zod.values = values;
1751
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
2140
+ inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
1752
2141
  inst._zod.parse = (payload, _ctx) => {
1753
2142
  const input = payload.value;
1754
2143
  if (values.has(input)) return payload;
@@ -1764,67 +2153,66 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
1764
2153
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
1765
2154
  $ZodType.init(inst, def);
1766
2155
  inst._zod.optin = "optional";
2156
+ globalConfig.memoizer?.guard(inst);
1767
2157
  inst._zod.parse = (payload, ctx) => {
1768
2158
  if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1769
2159
  const _out = def.transform(payload.value, payload);
1770
2160
  if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1771
2161
  payload.value = output;
1772
- payload.fallback = true;
1773
2162
  return payload;
1774
2163
  });
1775
2164
  if (_out instanceof Promise) throw new $ZodAsyncError();
1776
2165
  payload.value = _out;
1777
- payload.fallback = true;
1778
2166
  return payload;
1779
2167
  };
1780
2168
  });
1781
- function handleOptionalResult(result, input) {
1782
- if (input === void 0 && (result.issues.length || result.fallback)) return {
1783
- issues: [],
1784
- value: void 0
1785
- };
1786
- return result;
2169
+ function handleOptionalResult(payload, result) {
2170
+ payload.value = result.issues.length ? void 0 : result.value;
2171
+ return payload;
1787
2172
  }
1788
2173
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
1789
2174
  $ZodType.init(inst, def);
1790
- inst._zod.optin = "optional";
2175
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
1791
2176
  inst._zod.optout = "optional";
1792
- defineLazy(inst._zod, "values", () => {
1793
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2177
+ defineLazyInternal(inst, "values", (zod) => {
2178
+ const values = zod.def.innerType._zod.values;
2179
+ return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
1794
2180
  });
1795
- defineLazy(inst._zod, "pattern", () => {
1796
- const pattern = def.innerType._zod.pattern;
2181
+ defineLazyInternal(inst, "pattern", (zod) => {
2182
+ const pattern = zod.def.innerType._zod.pattern;
1797
2183
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1798
2184
  });
1799
2185
  inst._zod.parse = (payload, ctx) => {
1800
- if (def.innerType._zod.optin === "optional") {
1801
- const input = payload.value;
1802
- const result = def.innerType._zod.run(payload, ctx);
1803
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
1804
- return handleOptionalResult(result, input);
2186
+ if (payload.value === void 0) {
2187
+ if (def.innerType._zod.optin !== "defaulted") return payload;
2188
+ const result = def.innerType._zod.run({
2189
+ value: payload.value,
2190
+ issues: []
2191
+ }, ctx);
2192
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
2193
+ return handleOptionalResult(payload, result);
1805
2194
  }
1806
- if (payload.value === void 0) return payload;
1807
2195
  return def.innerType._zod.run(payload, ctx);
1808
2196
  };
1809
2197
  });
1810
2198
  const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
1811
2199
  $ZodOptional.init(inst, def);
1812
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1813
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2200
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2201
+ defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
1814
2202
  inst._zod.parse = (payload, ctx) => {
1815
2203
  return def.innerType._zod.run(payload, ctx);
1816
2204
  };
1817
2205
  });
1818
2206
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1819
2207
  $ZodType.init(inst, def);
1820
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1821
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1822
- defineLazy(inst._zod, "pattern", () => {
1823
- const pattern = def.innerType._zod.pattern;
2208
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
2209
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2210
+ defineLazyInternal(inst, "pattern", (zod) => {
2211
+ const pattern = zod.def.innerType._zod.pattern;
1824
2212
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1825
2213
  });
1826
- defineLazy(inst._zod, "values", () => {
1827
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2214
+ defineLazyInternal(inst, "values", (zod) => {
2215
+ return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
1828
2216
  });
1829
2217
  inst._zod.parse = (payload, ctx) => {
1830
2218
  if (payload.value === null) return payload;
@@ -1833,8 +2221,8 @@ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1833
2221
  });
1834
2222
  const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
1835
2223
  $ZodType.init(inst, def);
1836
- inst._zod.optin = "optional";
1837
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2224
+ inst._zod.optin = "defaulted";
2225
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
1838
2226
  inst._zod.parse = (payload, ctx) => {
1839
2227
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1840
2228
  if (payload.value === void 0) {
@@ -1855,8 +2243,8 @@ function handleDefaultResult(payload, def) {
1855
2243
  }
1856
2244
  const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
1857
2245
  $ZodType.init(inst, def);
1858
- inst._zod.optin = "optional";
1859
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2246
+ inst._zod.optin = "defaulted";
2247
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
1860
2248
  inst._zod.parse = (payload, ctx) => {
1861
2249
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1862
2250
  if (payload.value === void 0) payload.value = def.defaultValue;
@@ -1865,8 +2253,8 @@ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
1865
2253
  });
1866
2254
  const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
1867
2255
  $ZodType.init(inst, def);
1868
- defineLazy(inst._zod, "values", () => {
1869
- const v = def.innerType._zod.values;
2256
+ defineLazyInternal(inst, "values", (zod) => {
2257
+ const v = zod.def.innerType._zod.values;
1870
2258
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1871
2259
  });
1872
2260
  inst._zod.parse = (payload, ctx) => {
@@ -1884,46 +2272,41 @@ function handleNonOptionalResult(payload, inst) {
1884
2272
  });
1885
2273
  return payload;
1886
2274
  }
2275
+ function handleCatchResult(payload, result, def, ctx) {
2276
+ if (!result.issues.length) {
2277
+ payload.value = result.value;
2278
+ if (result.memo) payload.memo = true;
2279
+ return payload;
2280
+ }
2281
+ payload.value = def.catchValue({
2282
+ ...result,
2283
+ value: payload.value,
2284
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2285
+ input: payload.value
2286
+ });
2287
+ return payload;
2288
+ }
1887
2289
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
1888
2290
  $ZodType.init(inst, def);
1889
- inst._zod.optin = "optional";
1890
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1891
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2291
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2292
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2293
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
1892
2294
  inst._zod.parse = (payload, ctx) => {
1893
2295
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1894
- const result = def.innerType._zod.run(payload, ctx);
1895
- if (result instanceof Promise) return result.then((result) => {
1896
- payload.value = result.value;
1897
- if (result.issues.length) {
1898
- payload.value = def.catchValue({
1899
- ...payload,
1900
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1901
- input: payload.value
1902
- });
1903
- payload.issues = [];
1904
- payload.fallback = true;
1905
- }
1906
- return payload;
1907
- });
1908
- payload.value = result.value;
1909
- if (result.issues.length) {
1910
- payload.value = def.catchValue({
1911
- ...payload,
1912
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1913
- input: payload.value
1914
- });
1915
- payload.issues = [];
1916
- payload.fallback = true;
1917
- }
1918
- return payload;
2296
+ const result = def.innerType._zod.run({
2297
+ value: payload.value,
2298
+ issues: []
2299
+ }, ctx);
2300
+ if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
2301
+ return handleCatchResult(payload, result, def, ctx);
1919
2302
  };
1920
2303
  });
1921
2304
  const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
1922
2305
  $ZodType.init(inst, def);
1923
- defineLazy(inst._zod, "values", () => def.in._zod.values);
1924
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1925
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1926
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2306
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
2307
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
2308
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
2309
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
1927
2310
  inst._zod.parse = (payload, ctx) => {
1928
2311
  if (ctx.direction === "backward") {
1929
2312
  const right = def.out._zod.run(payload, ctx);
@@ -1936,22 +2319,21 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
1936
2319
  };
1937
2320
  });
1938
2321
  function handlePipeResult(left, next, ctx) {
1939
- if (left.issues.length) {
2322
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
1940
2323
  left.aborted = true;
1941
2324
  return left;
1942
2325
  }
1943
2326
  return next._zod.run({
1944
2327
  value: left.value,
1945
- issues: left.issues,
1946
- fallback: left.fallback
2328
+ issues: left.issues
1947
2329
  }, ctx);
1948
2330
  }
1949
2331
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
1950
2332
  $ZodType.init(inst, def);
1951
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1952
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1953
- defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1954
- defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2333
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
2334
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2335
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
2336
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
1955
2337
  inst._zod.parse = (payload, ctx) => {
1956
2338
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1957
2339
  const result = def.innerType._zod.run(payload, ctx);
@@ -1960,7 +2342,7 @@ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
1960
2342
  };
1961
2343
  });
1962
2344
  function handleReadonlyResult(payload) {
1963
- payload.value = Object.freeze(payload.value);
2345
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
1964
2346
  return payload;
1965
2347
  }
1966
2348
  const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
@@ -1990,7 +2372,265 @@ function handleRefineResult(result, payload, input, inst) {
1990
2372
  }
1991
2373
  }
1992
2374
  //#endregion
1993
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
2375
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/memoizer.js
2376
+ var $ZodCyclicError = class extends Error {
2377
+ constructor() {
2378
+ super(`Cannot parse a reference cycle that closes through a transform`);
2379
+ this.name = "ZodCyclicError";
2380
+ }
2381
+ };
2382
+ /** Keyed off the context object every schema in one parse call already shares. */
2383
+ const STATE = "~memo";
2384
+ const NO_ISSUES = [];
2385
+ function cloneIssues(issues) {
2386
+ return issues.map((iss) => iss.path ? {
2387
+ ...iss,
2388
+ path: iss.path.slice()
2389
+ } : { ...iss });
2390
+ }
2391
+ const recursive = /*@__PURE__*/ new WeakMap();
2392
+ /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2393
+ function isRecursive(inst, stack) {
2394
+ const cached = recursive.get(inst);
2395
+ if (cached !== void 0) return cached;
2396
+ if (stack.has(inst)) return true;
2397
+ stack.add(inst);
2398
+ let result = false;
2399
+ const check = (child) => {
2400
+ if (!result && child?._zod && isRecursive(child, stack)) result = true;
2401
+ };
2402
+ const def = inst._zod.def;
2403
+ if (def.type === "lazy") check(inst._zod.innerType);
2404
+ else {
2405
+ const shape = def.shape;
2406
+ if (shape) for (const key of Reflect.ownKeys(shape)) check(shape[key]);
2407
+ for (const key in def) {
2408
+ const value = def[key];
2409
+ if (!value || typeof value !== "object") continue;
2410
+ if (value._zod) check(value);
2411
+ else if (Array.isArray(value)) for (const el of value) check(el);
2412
+ }
2413
+ }
2414
+ stack.delete(inst);
2415
+ recursive.set(inst, result);
2416
+ return result;
2417
+ }
2418
+ function bucketFor(state, inst) {
2419
+ let bucket = state.buckets.get(inst);
2420
+ if (!bucket) {
2421
+ bucket = /* @__PURE__ */ new Map();
2422
+ state.buckets.set(inst, bucket);
2423
+ }
2424
+ return bucket;
2425
+ }
2426
+ let handoff;
2427
+ const open = [];
2428
+ const memo = {
2429
+ alloc(_inst, payload, empty) {
2430
+ const bucket = handoff;
2431
+ if (!bucket) return empty;
2432
+ handoff = void 0;
2433
+ const entry = {
2434
+ value: empty,
2435
+ issues: null
2436
+ };
2437
+ bucket.set(payload.value, entry);
2438
+ open.push(entry);
2439
+ return empty;
2440
+ },
2441
+ guard(inst) {
2442
+ var _a;
2443
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2444
+ inst._zod.deferred.push(() => {
2445
+ const base = inst._zod.parse;
2446
+ const wrapped = (payload, ctx) => {
2447
+ if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
2448
+ return base(payload, ctx);
2449
+ };
2450
+ inst._zod.parse = wrapped;
2451
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2452
+ });
2453
+ },
2454
+ attach(inst) {
2455
+ var _a;
2456
+ let isRecursiveInst;
2457
+ let lastCtx;
2458
+ let lastBucket;
2459
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
2460
+ inst._zod.deferred.push(() => {
2461
+ const base = inst._zod.parse;
2462
+ const wrapped = (payload, ctx) => {
2463
+ if (isRecursiveInst === void 0) {
2464
+ isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
2465
+ if (!isRecursiveInst) {
2466
+ inst._zod.parse = base;
2467
+ if (inst._zod.run === wrapped) inst._zod.run = base;
2468
+ return base(payload, ctx);
2469
+ }
2470
+ }
2471
+ const input = payload.value;
2472
+ if (input === null || typeof input !== "object") return base(payload, ctx);
2473
+ let state = ctx[STATE];
2474
+ if (!state) {
2475
+ state = {
2476
+ buckets: /* @__PURE__ */ new Map(),
2477
+ backEdges: void 0
2478
+ };
2479
+ ctx[STATE] = state;
2480
+ }
2481
+ let bucket;
2482
+ if (lastCtx === ctx) bucket = lastBucket;
2483
+ else {
2484
+ bucket = bucketFor(state, inst);
2485
+ lastCtx = ctx;
2486
+ lastBucket = bucket;
2487
+ }
2488
+ const hit = bucket.get(input);
2489
+ if (hit) {
2490
+ payload.value = hit.value;
2491
+ if (hit.issues) {
2492
+ if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
2493
+ } else {
2494
+ payload.memo = true;
2495
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
2496
+ state.backEdges.add(hit.value);
2497
+ }
2498
+ return payload;
2499
+ }
2500
+ handoff = bucket;
2501
+ const depth = open.length;
2502
+ const result = base(payload, ctx);
2503
+ handoff = void 0;
2504
+ const entry = open.length > depth ? open.pop() : void 0;
2505
+ if (result instanceof Promise) return result.then((r) => {
2506
+ if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
2507
+ return r;
2508
+ });
2509
+ if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
2510
+ return result;
2511
+ };
2512
+ inst._zod.parse = wrapped;
2513
+ if (inst._zod.run === base) inst._zod.run = wrapped;
2514
+ });
2515
+ }
2516
+ };
2517
+ /** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
2518
+ function memoizer() {
2519
+ return memo;
2520
+ }
2521
+ /** Whether this value is a node a back-edge resolved to before it finished. */
2522
+ function isBackEdge(ctx, value) {
2523
+ const backEdges = ctx[STATE]?.backEdges;
2524
+ return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
2525
+ }
2526
+ //#endregion
2527
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/locales/en.js
2528
+ const error = () => {
2529
+ const Sizable = {
2530
+ string: {
2531
+ unit: "characters",
2532
+ verb: "to have"
2533
+ },
2534
+ file: {
2535
+ unit: "bytes",
2536
+ verb: "to have"
2537
+ },
2538
+ array: {
2539
+ unit: "items",
2540
+ verb: "to have"
2541
+ },
2542
+ set: {
2543
+ unit: "items",
2544
+ verb: "to have"
2545
+ },
2546
+ map: {
2547
+ unit: "entries",
2548
+ verb: "to have"
2549
+ }
2550
+ };
2551
+ function getSizing(origin) {
2552
+ return Sizable[origin] ?? null;
2553
+ }
2554
+ const FormatDictionary = {
2555
+ regex: "input",
2556
+ email: "email address",
2557
+ url: "URL",
2558
+ emoji: "emoji",
2559
+ uuid: "UUID",
2560
+ uuidv4: "UUIDv4",
2561
+ uuidv6: "UUIDv6",
2562
+ nanoid: "nanoid",
2563
+ guid: "GUID",
2564
+ cuid: "cuid",
2565
+ cuid2: "cuid2",
2566
+ ulid: "ULID",
2567
+ xid: "XID",
2568
+ ksuid: "KSUID",
2569
+ datetime: "ISO datetime",
2570
+ date: "ISO date",
2571
+ time: "ISO time",
2572
+ duration: "ISO duration",
2573
+ ipv4: "IPv4 address",
2574
+ ipv6: "IPv6 address",
2575
+ mac: "MAC address",
2576
+ cidrv4: "IPv4 range",
2577
+ cidrv6: "IPv6 range",
2578
+ base64: "base64-encoded string",
2579
+ base64url: "base64url-encoded string",
2580
+ json_string: "JSON string",
2581
+ e164: "E.164 number",
2582
+ credit_card: "credit card number",
2583
+ jwt: "JWT",
2584
+ template_literal: "input"
2585
+ };
2586
+ const TypeDictionary = { nan: "NaN" };
2587
+ function getTypeName(type, input) {
2588
+ if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
2589
+ return TypeDictionary[type] ?? type;
2590
+ }
2591
+ return (issue) => {
2592
+ switch (issue.code) {
2593
+ case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
2594
+ case "invalid_value":
2595
+ if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
2596
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
2597
+ case "too_big": {
2598
+ const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
2599
+ const sizing = getSizing(issue.origin);
2600
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
2601
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
2602
+ }
2603
+ case "too_small": {
2604
+ const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
2605
+ const sizing = getSizing(issue.origin);
2606
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
2607
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
2608
+ }
2609
+ case "invalid_format": {
2610
+ const _issue = issue;
2611
+ if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
2612
+ if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
2613
+ if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
2614
+ if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
2615
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
2616
+ }
2617
+ case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
2618
+ case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
2619
+ case "invalid_key": return `Invalid key in ${issue.origin}`;
2620
+ case "invalid_union":
2621
+ if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
2622
+ if (issue.inclusive === false) return "Invalid input: more than one option matched";
2623
+ return "Invalid input";
2624
+ case "invalid_element": return `Invalid value in ${issue.origin}`;
2625
+ default: return `Invalid input`;
2626
+ }
2627
+ };
2628
+ };
2629
+ function en_default() {
2630
+ return { localeError: error() };
2631
+ }
2632
+ //#endregion
2633
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/registries.js
1994
2634
  var _a;
1995
2635
  var $ZodRegistry = class {
1996
2636
  constructor() {
@@ -2037,7 +2677,7 @@ function registry() {
2037
2677
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2038
2678
  const globalRegistry = globalThis.__zod_globalRegistry;
2039
2679
  //#endregion
2040
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
2680
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/api.js
2041
2681
  // @__NO_SIDE_EFFECTS__
2042
2682
  function _string(Class, params) {
2043
2683
  return new Class({
@@ -2453,7 +3093,7 @@ function _superRefine(fn, params) {
2453
3093
  const _issue = issue$2;
2454
3094
  if (_issue.fatal) _issue.continue = false;
2455
3095
  _issue.code ?? (_issue.code = "custom");
2456
- _issue.input ?? (_issue.input = payload.value);
3096
+ if (!("input" in _issue)) _issue.input = payload.value;
2457
3097
  _issue.inst ?? (_issue.inst = ch);
2458
3098
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2459
3099
  payload.issues.push(issue(_issue));
@@ -2473,7 +3113,11 @@ function _check(fn, params) {
2473
3113
  return ch;
2474
3114
  }
2475
3115
  //#endregion
2476
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
3116
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/to-json-schema.js
3117
+ function assignProps(target, ...sources) {
3118
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3119
+ return target;
3120
+ }
2477
3121
  function initializeContext(params) {
2478
3122
  let target = params?.target ?? "draft-2020-12";
2479
3123
  if (target === "draft-4") target = "draft-04";
@@ -2487,11 +3131,30 @@ function initializeContext(params) {
2487
3131
  io: params?.io ?? "output",
2488
3132
  counter: 0,
2489
3133
  seen: /* @__PURE__ */ new Map(),
3134
+ sharedDefsExtractedFor: void 0,
3135
+ sharedEmitDoneFor: void 0,
2490
3136
  cycles: params?.cycles ?? "ref",
2491
3137
  reused: params?.reused ?? "inline",
3138
+ intersections: [],
2492
3139
  external: params?.external ?? void 0
2493
3140
  };
2494
3141
  }
3142
+ /**
3143
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
3144
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
3145
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
3146
+ */
3147
+ function handleUnrepresentable(schema, ctx, json, params, message) {
3148
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
3149
+ zodSchema: schema,
3150
+ path: params.path,
3151
+ message
3152
+ }) : ctx.unrepresentable;
3153
+ if (result === "any") return false;
3154
+ if (result === void 0 || result === "throw") throw new Error(message);
3155
+ Object.assign(json, result);
3156
+ return true;
3157
+ }
2495
3158
  function process$1(schema, ctx, _params = {
2496
3159
  path: [],
2497
3160
  schemaPath: []
@@ -2511,6 +3174,8 @@ function process$1(schema, ctx, _params = {
2511
3174
  path: _params.path
2512
3175
  };
2513
3176
  ctx.seen.set(schema, result);
3177
+ ctx.sharedDefsExtractedFor = void 0;
3178
+ ctx.sharedEmitDoneFor = void 0;
2514
3179
  const overrideSchema = schema._zod.toJSONSchema?.();
2515
3180
  if (overrideSchema) result.schema = overrideSchema;
2516
3181
  else {
@@ -2534,7 +3199,7 @@ function process$1(schema, ctx, _params = {
2534
3199
  }
2535
3200
  }
2536
3201
  const meta = ctx.metadataRegistry.get(schema);
2537
- if (meta) Object.assign(result.schema, meta);
3202
+ if (meta) assignProps(result.schema, meta);
2538
3203
  if (ctx.io === "input" && isTransforming(schema)) {
2539
3204
  delete result.schema.examples;
2540
3205
  delete result.schema.default;
@@ -2543,9 +3208,13 @@ function process$1(schema, ctx, _params = {
2543
3208
  delete result.schema._prefault;
2544
3209
  return ctx.seen.get(schema).schema;
2545
3210
  }
3211
+ function encodeJSONPointerSegment(segment) {
3212
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
3213
+ }
2546
3214
  function extractDefs(ctx, schema) {
2547
3215
  const root = ctx.seen.get(schema);
2548
3216
  if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3217
+ if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
2549
3218
  const idToSchema = /* @__PURE__ */ new Map();
2550
3219
  for (const entry of ctx.seen.entries()) {
2551
3220
  const id = ctx.metadataRegistry.get(entry[0])?.id;
@@ -2565,15 +3234,16 @@ function extractDefs(ctx, schema) {
2565
3234
  entry[1].defId = id;
2566
3235
  return {
2567
3236
  defId: id,
2568
- ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
3237
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
2569
3238
  };
2570
3239
  }
2571
- if (entry[1] === root) return { ref: "#" };
2572
- const defUriPrefix = `#/${defsSegment}/`;
3240
+ const uriPrefix = `#`;
3241
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3242
+ if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
2573
3243
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2574
3244
  return {
2575
3245
  defId,
2576
- ref: defUriPrefix + defId
3246
+ ref: defUriPrefix + encodeJSONPointerSegment(defId)
2577
3247
  };
2578
3248
  };
2579
3249
  const extractToDef = (entry) => {
@@ -2620,6 +3290,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
2620
3290
  }
2621
3291
  }
2622
3292
  }
3293
+ if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
3294
+ }
3295
+ /** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
3296
+ function compactTypeUnion(schema) {
3297
+ const options = schema.anyOf;
3298
+ if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
3299
+ const types = [];
3300
+ for (const option of options) {
3301
+ if (!option || typeof option !== "object") return;
3302
+ compactTypeUnion(option);
3303
+ const keys = Object.keys(option);
3304
+ if (keys.length !== 1 || keys[0] !== "type") return;
3305
+ const type = option.type;
3306
+ for (const member of Array.isArray(type) ? type : [type]) {
3307
+ if (typeof member !== "string") return;
3308
+ if (!types.includes(member)) types.push(member);
3309
+ }
3310
+ }
3311
+ delete schema.anyOf;
3312
+ schema.type = types.length === 1 ? types[0] : types;
3313
+ }
3314
+ /** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
3315
+ * an annotation like `description` — makes a member unfoldable, so a constraint this does not
3316
+ * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
3317
+ const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
3318
+ "type",
3319
+ "properties",
3320
+ "required",
3321
+ "additionalProperties"
3322
+ ]);
3323
+ const UNION_KEYS = ["oneOf", "anyOf"];
3324
+ /** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
3325
+ function undeclaredConstraint(member) {
3326
+ const extra = member.additionalProperties;
3327
+ if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
3328
+ return Object.keys(extra).length ? extra : null;
3329
+ }
3330
+ /** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
3331
+ function foldObjects(members) {
3332
+ const objects = [];
3333
+ for (const member of members) {
3334
+ if (typeof member !== "object" || member.type !== "object") return null;
3335
+ for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
3336
+ objects.push(member);
3337
+ }
3338
+ const properties = {};
3339
+ const required = /* @__PURE__ */ new Set();
3340
+ for (const object of objects) {
3341
+ for (const key in object.properties) {
3342
+ if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
3343
+ const parts = [];
3344
+ for (const other of objects) {
3345
+ const part = other.properties?.[key] ?? undeclaredConstraint(other);
3346
+ if (part === null || part === void 0) continue;
3347
+ if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
3348
+ }
3349
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
3350
+ }
3351
+ for (const key of object.required ?? []) required.add(key);
3352
+ }
3353
+ const folded = {
3354
+ type: "object",
3355
+ properties
3356
+ };
3357
+ if (required.size) folded.required = [...required];
3358
+ if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
3359
+ else {
3360
+ const constraints = [];
3361
+ for (const object of objects) {
3362
+ const constraint = undeclaredConstraint(object);
3363
+ if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
3364
+ }
3365
+ if (constraints.length === 1) folded.additionalProperties = constraints[0];
3366
+ else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
3367
+ }
3368
+ return folded;
3369
+ }
3370
+ /** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
3371
+ * closed object members reject each other's keys and the schema validates nothing. Zod's parser
3372
+ * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
3373
+ * *every* side rejects it — so the emitted schema has to pool them too, and folding the members
3374
+ * into one object is the encoding that says so on every target.
3375
+ *
3376
+ * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
3377
+ * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
3378
+ * keeps its reference and its own closedness rather than being inlined as a stale copy. */
3379
+ function foldIntersection(json) {
3380
+ const allOf = json.allOf;
3381
+ if (!Array.isArray(allOf) || allOf.length < 2) return;
3382
+ for (const key of FOLDABLE_KEYS) if (key in json) return;
3383
+ const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
3384
+ let folded = null;
3385
+ if (!unions.length) folded = foldObjects(allOf);
3386
+ else {
3387
+ const union = unions[0];
3388
+ const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
3389
+ if (Object.keys(union).length !== 1) return;
3390
+ const rest = allOf.filter((m) => m !== union);
3391
+ const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
3392
+ if (branches.some((b) => !b)) return;
3393
+ folded = { [keyword]: branches };
3394
+ }
3395
+ if (!folded) return;
3396
+ delete json.allOf;
3397
+ assignProps(json, folded);
2623
3398
  }
2624
3399
  function finalize(ctx, schema) {
2625
3400
  const root = ctx.seen.get(schema);
@@ -2638,8 +3413,8 @@ function finalize(ctx, schema) {
2638
3413
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2639
3414
  schema.allOf = schema.allOf ?? [];
2640
3415
  schema.allOf.push(refSchema);
2641
- } else Object.assign(schema, refSchema);
2642
- Object.assign(schema, _cached);
3416
+ } else assignProps(schema, refSchema);
3417
+ assignProps(schema, _cached);
2643
3418
  if (zodSchema._zod.parent === ref) for (const key in schema) {
2644
3419
  if (key === "$ref" || key === "allOf") continue;
2645
3420
  if (!(key in _cached)) delete schema[key];
@@ -2667,7 +3442,21 @@ function finalize(ctx, schema) {
2667
3442
  path: seen.path ?? []
2668
3443
  });
2669
3444
  };
2670
- for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3445
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
3446
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
3447
+ if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
3448
+ if (ctx.intersections.length) {
3449
+ const carriers = /* @__PURE__ */ new Map();
3450
+ for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
3451
+ const allOf = json?.allOf;
3452
+ if (!Array.isArray(allOf)) continue;
3453
+ const existing = carriers.get(allOf);
3454
+ if (existing) existing.push(json);
3455
+ else carriers.set(allOf, [json]);
3456
+ }
3457
+ for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
3458
+ }
3459
+ }
2671
3460
  const result = {};
2672
3461
  if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2673
3462
  else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
@@ -2678,17 +3467,18 @@ function finalize(ctx, schema) {
2678
3467
  if (!id) throw new Error("Schema is missing an `id` property");
2679
3468
  result.$id = ctx.external.uri(id);
2680
3469
  }
2681
- Object.assign(result, root.def ?? root.schema);
3470
+ assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
2682
3471
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
2683
3472
  if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
2684
3473
  const defs = ctx.external?.defs ?? {};
2685
- for (const entry of ctx.seen.entries()) {
3474
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
2686
3475
  const seen = entry[1];
2687
3476
  if (seen.def && seen.defId) {
2688
3477
  if (seen.def.id === seen.defId) delete seen.def.id;
2689
- defs[seen.defId] = seen.def;
3478
+ assignProp(defs, seen.defId, seen.def);
2690
3479
  }
2691
3480
  }
3481
+ if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
2692
3482
  if (ctx.external) {} else if (Object.keys(defs).length > 0) {
2693
3483
  if (ctx.target === "draft-2020-12") result.$defs = defs;
2694
3484
  else result.definitions = defs;
@@ -2720,7 +3510,7 @@ function isTransforming(_schema, _ctx) {
2720
3510
  if (def.type === "array") return isTransforming(def.element, ctx);
2721
3511
  if (def.type === "set") return isTransforming(def.valueType, ctx);
2722
3512
  if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2723
- 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);
3513
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx);
2724
3514
  if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2725
3515
  if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2726
3516
  if (def.type === "pipe") {
@@ -2768,7 +3558,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
2768
3558
  return finalize(ctx, schema);
2769
3559
  };
2770
3560
  //#endregion
2771
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
3561
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/core/json-schema-processors.js
2772
3562
  const formatMap = {
2773
3563
  guid: "uuid",
2774
3564
  url: "uri",
@@ -2779,13 +3569,13 @@ const formatMap = {
2779
3569
  const stringProcessor = (schema, ctx, _json, _params) => {
2780
3570
  const json = _json;
2781
3571
  json.type = "string";
2782
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
3572
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
2783
3573
  if (typeof minimum === "number") json.minLength = minimum;
2784
3574
  if (typeof maximum === "number") json.maxLength = maximum;
2785
3575
  if (format) {
2786
3576
  json.format = formatMap[format] ?? format;
2787
3577
  if (json.format === "") delete json.format;
2788
- if (format === "time") delete json.format;
3578
+ if (format === "time" || laxFormat) delete json.format;
2789
3579
  }
2790
3580
  if (contentEncoding) json.contentEncoding = contentEncoding;
2791
3581
  if (patterns && patterns.size > 0) {
@@ -2803,18 +3593,26 @@ const neverProcessor = (_schema, _ctx, json, _params) => {
2803
3593
  const enumProcessor = (schema, _ctx, json, _params) => {
2804
3594
  const def = schema._zod.def;
2805
3595
  const values = getEnumValues(def.entries);
3596
+ if (values.length === 0) {
3597
+ json.not = {};
3598
+ return;
3599
+ }
2806
3600
  if (values.every((v) => typeof v === "number")) json.type = "number";
2807
3601
  if (values.every((v) => typeof v === "string")) json.type = "string";
2808
3602
  json.enum = values;
2809
3603
  };
2810
- const literalProcessor = (schema, ctx, json, _params) => {
3604
+ const literalProcessor = (schema, ctx, json, params) => {
2811
3605
  const def = schema._zod.def;
3606
+ if (def.values.length === 0) {
3607
+ json.not = {};
3608
+ return;
3609
+ }
2812
3610
  const vals = [];
2813
3611
  for (const val of def.values) if (val === void 0) {
2814
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
3612
+ if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
2815
3613
  } else if (typeof val === "bigint") {
2816
- if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
2817
- else vals.push(Number(val));
3614
+ if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
3615
+ vals.push(Number(val));
2818
3616
  } else vals.push(val);
2819
3617
  if (vals.length === 0) {} else if (vals.length === 1) {
2820
3618
  const val = vals[0];
@@ -2829,11 +3627,11 @@ const literalProcessor = (schema, ctx, json, _params) => {
2829
3627
  json.enum = vals;
2830
3628
  }
2831
3629
  };
2832
- const customProcessor = (_schema, ctx, _json, _params) => {
2833
- if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
3630
+ const customProcessor = (schema, ctx, json, params) => {
3631
+ handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
2834
3632
  };
2835
- const transformProcessor = (_schema, ctx, _json, _params) => {
2836
- if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
3633
+ const transformProcessor = (schema, ctx, json, params) => {
3634
+ handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
2837
3635
  };
2838
3636
  const arrayProcessor = (schema, ctx, _json, params) => {
2839
3637
  const json = _json;
@@ -2847,25 +3645,32 @@ const arrayProcessor = (schema, ctx, _json, params) => {
2847
3645
  path: [...params.path, "items"]
2848
3646
  });
2849
3647
  };
3648
+ function inputOptin(schema) {
3649
+ const def = schema._zod.def;
3650
+ if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
3651
+ if (def.type === "catch") return inputOptin(def.innerType);
3652
+ return schema._zod.optin;
3653
+ }
2850
3654
  const objectProcessor = (schema, ctx, _json, params) => {
2851
3655
  const json = _json;
2852
3656
  const def = schema._zod.def;
3657
+ const shape = def.shape;
3658
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
2853
3659
  json.type = "object";
2854
3660
  json.properties = {};
2855
- const shape = def.shape;
2856
- for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
3661
+ for (const key in shape) assignProp(json.properties, key, process$1(shape[key], ctx, {
2857
3662
  ...params,
2858
3663
  path: [
2859
3664
  ...params.path,
2860
3665
  "properties",
2861
3666
  key
2862
3667
  ]
2863
- });
3668
+ }));
2864
3669
  const allKeys = new Set(Object.keys(shape));
2865
3670
  const requiredKeys = new Set([...allKeys].filter((key) => {
2866
- const v = def.shape[key]._zod;
2867
- if (ctx.io === "input") return v.optin === void 0;
2868
- else return v.optout === void 0;
3671
+ const field = def.shape[key];
3672
+ if (ctx.io === "input") return inputOptin(field) === void 0;
3673
+ else return field._zod.optout === void 0;
2869
3674
  }));
2870
3675
  if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
2871
3676
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
@@ -2909,7 +3714,9 @@ const intersectionProcessor = (schema, ctx, json, params) => {
2909
3714
  ]
2910
3715
  });
2911
3716
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
2912
- json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3717
+ const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3718
+ json.allOf = allOf;
3719
+ ctx.intersections.push(allOf);
2913
3720
  };
2914
3721
  const nullableProcessor = (schema, ctx, json, params) => {
2915
3722
  const def = schema._zod.def;
@@ -2926,19 +3733,37 @@ const nonoptionalProcessor = (schema, ctx, _json, params) => {
2926
3733
  const seen = ctx.seen.get(schema);
2927
3734
  seen.ref = def.innerType;
2928
3735
  };
3736
+ /** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
3737
+ * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
3738
+ * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
3739
+ const UNREPRESENTABLE_DEFAULT = Symbol();
3740
+ function serializeDefaultValue(value, schema, ctx, json, params) {
3741
+ let unrepresentable = false;
3742
+ const serialized = JSON.stringify(value, (_, val) => {
3743
+ if (typeof val !== "bigint") return val;
3744
+ unrepresentable = true;
3745
+ return null;
3746
+ });
3747
+ if (!unrepresentable) return JSON.parse(serialized);
3748
+ handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
3749
+ return UNREPRESENTABLE_DEFAULT;
3750
+ }
2929
3751
  const defaultProcessor = (schema, ctx, json, params) => {
2930
3752
  const def = schema._zod.def;
2931
3753
  process$1(def.innerType, ctx, params);
2932
3754
  const seen = ctx.seen.get(schema);
2933
3755
  seen.ref = def.innerType;
2934
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
3756
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
3757
+ if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
2935
3758
  };
2936
3759
  const prefaultProcessor = (schema, ctx, json, params) => {
2937
3760
  const def = schema._zod.def;
2938
3761
  process$1(def.innerType, ctx, params);
2939
3762
  const seen = ctx.seen.get(schema);
2940
3763
  seen.ref = def.innerType;
2941
- if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
3764
+ if (ctx.io !== "input") return;
3765
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
3766
+ if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
2942
3767
  };
2943
3768
  const catchProcessor = (schema, ctx, json, params) => {
2944
3769
  const def = schema._zod.def;
@@ -2949,7 +3774,8 @@ const catchProcessor = (schema, ctx, json, params) => {
2949
3774
  try {
2950
3775
  catchValue = def.catchValue(void 0);
2951
3776
  } catch {
2952
- throw new Error("Dynamic catch values are not supported in JSON Schema");
3777
+ handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
3778
+ return;
2953
3779
  }
2954
3780
  json.default = catchValue;
2955
3781
  };
@@ -2975,59 +3801,57 @@ const optionalProcessor = (schema, ctx, _json, params) => {
2975
3801
  seen.ref = def.innerType;
2976
3802
  };
2977
3803
  //#endregion
2978
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
2979
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
2980
- $ZodISODateTime.init(inst, def);
2981
- ZodStringFormat.init(inst, def);
2982
- });
2983
- function datetime(params) {
2984
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
2985
- }
2986
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
2987
- $ZodISODate.init(inst, def);
2988
- ZodStringFormat.init(inst, def);
2989
- });
2990
- function date(params) {
2991
- return /* @__PURE__ */ _isoDate(ZodISODate, params);
2992
- }
2993
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
2994
- $ZodISOTime.init(inst, def);
2995
- ZodStringFormat.init(inst, def);
2996
- });
2997
- function time(params) {
2998
- return /* @__PURE__ */ _isoTime(ZodISOTime, params);
2999
- }
3000
- const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3001
- $ZodISODuration.init(inst, def);
3002
- ZodStringFormat.init(inst, def);
3003
- });
3004
- function duration(params) {
3005
- return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
3804
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/errors.js
3805
+ const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
3806
+ function _lazyMethod(proto, key, make) {
3807
+ Object.defineProperty(proto, key, {
3808
+ configurable: true,
3809
+ enumerable: false,
3810
+ get() {
3811
+ const value = make(this);
3812
+ Object.defineProperty(this, key, {
3813
+ value,
3814
+ configurable: true,
3815
+ writable: true
3816
+ });
3817
+ return value;
3818
+ },
3819
+ set(value) {
3820
+ Object.defineProperty(this, key, {
3821
+ value,
3822
+ configurable: true,
3823
+ writable: true
3824
+ });
3825
+ }
3826
+ });
3006
3827
  }
3007
- //#endregion
3008
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3009
3828
  const initializer = (inst, issues) => {
3010
3829
  $ZodError.init(inst, issues);
3011
3830
  inst.name = "ZodError";
3012
- Object.defineProperties(inst, {
3013
- format: { value: (mapper) => formatError(inst, mapper) },
3014
- flatten: { value: (mapper) => flattenError(inst, mapper) },
3015
- addIssue: { value: (issue) => {
3016
- inst.issues.push(issue);
3017
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3018
- } },
3019
- addIssues: { value: (issues) => {
3020
- inst.issues.push(...issues);
3021
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3022
- } },
3023
- isEmpty: { get() {
3024
- return inst.issues.length === 0;
3025
- } }
3831
+ const proto = Object.getPrototypeOf(inst);
3832
+ if (_installedErrorProtos.has(proto)) return;
3833
+ _installedErrorProtos.add(proto);
3834
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
3835
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
3836
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
3837
+ self.issues.push(issue);
3838
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
3839
+ });
3840
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
3841
+ self.issues.push(...issues);
3842
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
3843
+ });
3844
+ Object.defineProperty(proto, "isEmpty", {
3845
+ configurable: true,
3846
+ enumerable: false,
3847
+ get() {
3848
+ return this.issues.length === 0;
3849
+ }
3026
3850
  });
3027
3851
  };
3028
- const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
3852
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
3029
3853
  //#endregion
3030
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
3854
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/parse.js
3031
3855
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3032
3856
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3033
3857
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3041,167 +3865,175 @@ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3041
3865
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3042
3866
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3043
3867
  //#endregion
3044
- //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3045
- const _installedGroups = /* @__PURE__ */ new WeakMap();
3046
- function _installLazyMethods(inst, group, methods) {
3047
- const proto = Object.getPrototypeOf(inst);
3048
- let installed = _installedGroups.get(proto);
3049
- if (!installed) {
3050
- installed = /* @__PURE__ */ new Set();
3051
- _installedGroups.set(proto, installed);
3052
- }
3053
- if (installed.has(group)) return;
3054
- installed.add(group);
3055
- for (const key in methods) {
3056
- const fn = methods[key];
3057
- Object.defineProperty(proto, key, {
3058
- configurable: true,
3059
- enumerable: false,
3060
- get() {
3061
- const bound = fn.bind(this);
3062
- Object.defineProperty(this, key, {
3063
- configurable: true,
3064
- writable: true,
3065
- enumerable: true,
3066
- value: bound
3067
- });
3068
- return bound;
3069
- },
3070
- set(v) {
3071
- Object.defineProperty(this, key, {
3072
- configurable: true,
3073
- writable: true,
3074
- enumerable: true,
3075
- value: v
3076
- });
3077
- }
3078
- });
3079
- }
3868
+ //#region ../../node_modules/.pnpm/zod@4.5.2/node_modules/zod/v4/classic/schemas.js
3869
+ function _ensureDefaultLocale() {
3870
+ if (!globalConfig.localeError) config(en_default());
3871
+ }
3872
+ function _ensureDefaultMemoizer() {
3873
+ if (!globalConfig.memoizer) config({ memoizer: memoizer() });
3080
3874
  }
3081
3875
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3876
+ _ensureDefaultLocale();
3082
3877
  $ZodType.init(inst, def);
3083
- Object.assign(inst["~standard"], { jsonSchema: {
3084
- input: createStandardJSONSchemaMethod(inst, "input"),
3085
- output: createStandardJSONSchemaMethod(inst, "output")
3086
- } });
3087
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3088
3878
  inst.def = def;
3089
3879
  inst.type = def.type;
3090
- Object.defineProperty(inst, "_def", { value: def });
3091
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3092
- inst.safeParse = (data, params) => safeParse(inst, data, params);
3093
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3094
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3095
- inst.spa = inst.safeParseAsync;
3096
- inst.encode = (data, params) => encode(inst, data, params);
3097
- inst.decode = (data, params) => decode(inst, data, params);
3098
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3099
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3100
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3101
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3102
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3103
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3104
- _installLazyMethods(inst, "ZodType", {
3105
- check(...chks) {
3106
- const def = this.def;
3107
- return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3108
- check: ch,
3109
- def: { check: "custom" },
3110
- onattach: []
3111
- } } : ch)] }), { parent: true });
3112
- },
3113
- with(...chks) {
3114
- return this.check(...chks);
3115
- },
3116
- clone(def, params) {
3117
- return clone(this, def, params);
3118
- },
3119
- brand() {
3120
- return this;
3121
- },
3122
- register(reg, meta) {
3123
- reg.add(this, meta);
3124
- return this;
3125
- },
3126
- refine(check, params) {
3127
- return this.check(refine(check, params));
3128
- },
3129
- superRefine(refinement, params) {
3130
- return this.check(superRefine(refinement, params));
3131
- },
3132
- overwrite(fn) {
3133
- return this.check(/* @__PURE__ */ _overwrite(fn));
3134
- },
3135
- optional() {
3136
- return optional(this);
3137
- },
3138
- exactOptional() {
3139
- return exactOptional(this);
3140
- },
3141
- nullable() {
3142
- return nullable(this);
3143
- },
3144
- nullish() {
3145
- return optional(nullable(this));
3146
- },
3147
- nonoptional(params) {
3148
- return nonoptional(this, params);
3149
- },
3150
- array() {
3151
- return array(this);
3152
- },
3153
- or(arg) {
3154
- return union([this, arg]);
3155
- },
3156
- and(arg) {
3157
- return intersection(this, arg);
3158
- },
3159
- transform(tx) {
3160
- return pipe(this, transform(tx));
3161
- },
3162
- default(d) {
3163
- return _default(this, d);
3164
- },
3165
- prefault(d) {
3166
- return prefault(this, d);
3167
- },
3168
- catch(params) {
3169
- return _catch(this, params);
3170
- },
3171
- pipe(target) {
3172
- return pipe(this, target);
3173
- },
3174
- readonly() {
3175
- return readonly(this);
3176
- },
3177
- describe(description) {
3178
- const cl = this.clone();
3179
- globalRegistry.add(cl, { description });
3180
- return cl;
3181
- },
3182
- meta(...args) {
3183
- if (args.length === 0) return globalRegistry.get(this);
3184
- const cl = this.clone();
3185
- globalRegistry.add(cl, args[0]);
3186
- return cl;
3187
- },
3188
- isOptional() {
3189
- return this.safeParse(void 0).success;
3190
- },
3191
- isNullable() {
3192
- return this.safeParse(null).success;
3193
- },
3194
- apply(fn) {
3195
- return fn(this);
3196
- }
3197
- });
3198
- Object.defineProperty(inst, "description", {
3199
- get() {
3200
- return globalRegistry.get(inst)?.description;
3201
- },
3202
- configurable: true
3203
- });
3204
3880
  return inst;
3881
+ }, {
3882
+ check(...chks) {
3883
+ const def = this.def;
3884
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3885
+ check: ch,
3886
+ def: { check: "custom" },
3887
+ onattach: []
3888
+ } } : ch)] }), { parent: true });
3889
+ },
3890
+ with(...chks) {
3891
+ return this.check(...chks);
3892
+ },
3893
+ clone(def, params) {
3894
+ return clone(this, def, params);
3895
+ },
3896
+ brand() {
3897
+ return this;
3898
+ },
3899
+ register(reg, meta) {
3900
+ reg.add(this, meta);
3901
+ return this;
3902
+ },
3903
+ refine(check, params) {
3904
+ return this.check(refine(check, params));
3905
+ },
3906
+ superRefine(refinement, params) {
3907
+ return this.check(superRefine(refinement, params));
3908
+ },
3909
+ overwrite(fn) {
3910
+ return this.check(/* @__PURE__ */ _overwrite(fn));
3911
+ },
3912
+ optional() {
3913
+ return optional(this);
3914
+ },
3915
+ exactOptional() {
3916
+ return exactOptional(this);
3917
+ },
3918
+ nullable() {
3919
+ return nullable(this);
3920
+ },
3921
+ nullish() {
3922
+ return optional(nullable(this));
3923
+ },
3924
+ nonoptional(params) {
3925
+ return nonoptional(this, params);
3926
+ },
3927
+ array() {
3928
+ return array(this);
3929
+ },
3930
+ or(arg) {
3931
+ return union([this, arg]);
3932
+ },
3933
+ and(arg) {
3934
+ return intersection(this, arg);
3935
+ },
3936
+ transform(tx) {
3937
+ return pipe(this, transform(tx));
3938
+ },
3939
+ default(d) {
3940
+ return _default(this, d);
3941
+ },
3942
+ prefault(d) {
3943
+ return prefault(this, d);
3944
+ },
3945
+ catch(params) {
3946
+ return _catch(this, params);
3947
+ },
3948
+ pipe(target) {
3949
+ return pipe(this, target);
3950
+ },
3951
+ readonly() {
3952
+ return readonly(this);
3953
+ },
3954
+ describe(description) {
3955
+ const cl = this.clone();
3956
+ globalRegistry.add(cl, { description });
3957
+ return cl;
3958
+ },
3959
+ meta(...args) {
3960
+ if (args.length === 0) return globalRegistry.get(this);
3961
+ const cl = this.clone();
3962
+ globalRegistry.add(cl, args[0]);
3963
+ return cl;
3964
+ },
3965
+ isOptional() {
3966
+ return this.safeParse(void 0).success;
3967
+ },
3968
+ isNullable() {
3969
+ return this.safeParse(null).success;
3970
+ },
3971
+ apply(fn, ...args) {
3972
+ return args.length === 0 ? fn(this) : fn(this, ...args);
3973
+ },
3974
+ get "~standard"() {
3975
+ return hide(this, "~standard", {
3976
+ ...standardProps(this),
3977
+ jsonSchema: {
3978
+ input: createStandardJSONSchemaMethod(this, "input"),
3979
+ output: createStandardJSONSchemaMethod(this, "output")
3980
+ }
3981
+ });
3982
+ },
3983
+ set "~standard"(value) {
3984
+ own(this, "~standard", value);
3985
+ },
3986
+ parse: function _parse(data, params) {
3987
+ return parse(this, data, params, { callee: _parse });
3988
+ },
3989
+ parseAsync: async function _parseAsync(data, params) {
3990
+ return await parseAsync(this, data, params, { callee: _parseAsync });
3991
+ },
3992
+ safeParse(data, params) {
3993
+ return safeParse(this, data, params);
3994
+ },
3995
+ async safeParseAsync(data, params) {
3996
+ return safeParseAsync(this, data, params);
3997
+ },
3998
+ get spa() {
3999
+ return this?.safeParseAsync;
4000
+ },
4001
+ set spa(value) {
4002
+ own(this, "spa", value);
4003
+ },
4004
+ encode: function _encode(data, params) {
4005
+ return encode(this, data, params, { callee: _encode });
4006
+ },
4007
+ decode: function _decode(data, params) {
4008
+ return decode(this, data, params, { callee: _decode });
4009
+ },
4010
+ encodeAsync: async function _encodeAsync(data, params) {
4011
+ return await encodeAsync(this, data, params, { callee: _encodeAsync });
4012
+ },
4013
+ decodeAsync: async function _decodeAsync(data, params) {
4014
+ return await decodeAsync(this, data, params, { callee: _decodeAsync });
4015
+ },
4016
+ safeEncode(data, params) {
4017
+ return safeEncode(this, data, params);
4018
+ },
4019
+ safeDecode(data, params) {
4020
+ return safeDecode(this, data, params);
4021
+ },
4022
+ async safeEncodeAsync(data, params) {
4023
+ return safeEncodeAsync(this, data, params);
4024
+ },
4025
+ async safeDecodeAsync(data, params) {
4026
+ return safeDecodeAsync(this, data, params);
4027
+ },
4028
+ toJSONSchema(params) {
4029
+ return createToJSONSchemaMethod(this, {})(params);
4030
+ },
4031
+ get description() {
4032
+ return globalRegistry.get(this)?.description;
4033
+ },
4034
+ get _def() {
4035
+ return this._zod.def;
4036
+ }
3205
4037
  });
3206
4038
  /** @internal */
3207
4039
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
@@ -3212,84 +4044,135 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
3212
4044
  inst.format = bag.format ?? null;
3213
4045
  inst.minLength = bag.minimum ?? null;
3214
4046
  inst.maxLength = bag.maximum ?? null;
3215
- _installLazyMethods(inst, "_ZodString", {
3216
- regex(...args) {
3217
- return this.check(/* @__PURE__ */ _regex(...args));
3218
- },
3219
- includes(...args) {
3220
- return this.check(/* @__PURE__ */ _includes(...args));
3221
- },
3222
- startsWith(...args) {
3223
- return this.check(/* @__PURE__ */ _startsWith(...args));
3224
- },
3225
- endsWith(...args) {
3226
- return this.check(/* @__PURE__ */ _endsWith(...args));
3227
- },
3228
- min(...args) {
3229
- return this.check(/* @__PURE__ */ _minLength(...args));
3230
- },
3231
- max(...args) {
3232
- return this.check(/* @__PURE__ */ _maxLength(...args));
3233
- },
3234
- length(...args) {
3235
- return this.check(/* @__PURE__ */ _length(...args));
3236
- },
3237
- nonempty(...args) {
3238
- return this.check(/* @__PURE__ */ _minLength(1, ...args));
3239
- },
3240
- lowercase(params) {
3241
- return this.check(/* @__PURE__ */ _lowercase(params));
3242
- },
3243
- uppercase(params) {
3244
- return this.check(/* @__PURE__ */ _uppercase(params));
3245
- },
3246
- trim() {
3247
- return this.check(/* @__PURE__ */ _trim());
3248
- },
3249
- normalize(...args) {
3250
- return this.check(/* @__PURE__ */ _normalize(...args));
3251
- },
3252
- toLowerCase() {
3253
- return this.check(/* @__PURE__ */ _toLowerCase());
3254
- },
3255
- toUpperCase() {
3256
- return this.check(/* @__PURE__ */ _toUpperCase());
3257
- },
3258
- slugify() {
3259
- return this.check(/* @__PURE__ */ _slugify());
3260
- }
3261
- });
4047
+ }, {
4048
+ regex(...args) {
4049
+ return this.check(/* @__PURE__ */ _regex(...args));
4050
+ },
4051
+ includes(...args) {
4052
+ return this.check(/* @__PURE__ */ _includes(...args));
4053
+ },
4054
+ startsWith(...args) {
4055
+ return this.check(/* @__PURE__ */ _startsWith(...args));
4056
+ },
4057
+ endsWith(...args) {
4058
+ return this.check(/* @__PURE__ */ _endsWith(...args));
4059
+ },
4060
+ min(...args) {
4061
+ return this.check(/* @__PURE__ */ _minLength(...args));
4062
+ },
4063
+ max(...args) {
4064
+ return this.check(/* @__PURE__ */ _maxLength(...args));
4065
+ },
4066
+ length(...args) {
4067
+ return this.check(/* @__PURE__ */ _length(...args));
4068
+ },
4069
+ nonempty(...args) {
4070
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
4071
+ },
4072
+ lowercase(params) {
4073
+ return this.check(/* @__PURE__ */ _lowercase(params));
4074
+ },
4075
+ uppercase(params) {
4076
+ return this.check(/* @__PURE__ */ _uppercase(params));
4077
+ },
4078
+ trim() {
4079
+ return this.check(/* @__PURE__ */ _trim());
4080
+ },
4081
+ normalize(...args) {
4082
+ return this.check(/* @__PURE__ */ _normalize(...args));
4083
+ },
4084
+ toLowerCase() {
4085
+ return this.check(/* @__PURE__ */ _toLowerCase());
4086
+ },
4087
+ toUpperCase() {
4088
+ return this.check(/* @__PURE__ */ _toUpperCase());
4089
+ },
4090
+ slugify() {
4091
+ return this.check(/* @__PURE__ */ _slugify());
4092
+ }
3262
4093
  });
3263
4094
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3264
4095
  $ZodString.init(inst, def);
3265
4096
  _ZodString.init(inst, def);
3266
- inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3267
- inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3268
- inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3269
- inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3270
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3271
- inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3272
- inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3273
- inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3274
- inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3275
- inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3276
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3277
- inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3278
- inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3279
- inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3280
- inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3281
- inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3282
- inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3283
- inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3284
- inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3285
- inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3286
- inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3287
- inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3288
- inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3289
- inst.datetime = (params) => inst.check(datetime(params));
3290
- inst.date = (params) => inst.check(date(params));
3291
- inst.time = (params) => inst.check(time(params));
3292
- inst.duration = (params) => inst.check(duration(params));
4097
+ }, {
4098
+ email(params) {
4099
+ return this.check(/* @__PURE__ */ _email(ZodEmail, params));
4100
+ },
4101
+ url(params) {
4102
+ return this.check(/* @__PURE__ */ _url(ZodURL, params));
4103
+ },
4104
+ jwt(params) {
4105
+ return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
4106
+ },
4107
+ emoji(params) {
4108
+ return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
4109
+ },
4110
+ guid(params) {
4111
+ return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
4112
+ },
4113
+ uuid(params) {
4114
+ return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
4115
+ },
4116
+ uuidv4(params) {
4117
+ return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
4118
+ },
4119
+ uuidv6(params) {
4120
+ return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
4121
+ },
4122
+ uuidv7(params) {
4123
+ return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
4124
+ },
4125
+ nanoid(params) {
4126
+ return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
4127
+ },
4128
+ cuid(params) {
4129
+ return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
4130
+ },
4131
+ cuid2(params) {
4132
+ return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
4133
+ },
4134
+ ulid(params) {
4135
+ return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
4136
+ },
4137
+ base64(params) {
4138
+ return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
4139
+ },
4140
+ base64url(params) {
4141
+ return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
4142
+ },
4143
+ xid(params) {
4144
+ return this.check(/* @__PURE__ */ _xid(ZodXID, params));
4145
+ },
4146
+ ksuid(params) {
4147
+ return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
4148
+ },
4149
+ ipv4(params) {
4150
+ return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
4151
+ },
4152
+ ipv6(params) {
4153
+ return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
4154
+ },
4155
+ cidrv4(params) {
4156
+ return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
4157
+ },
4158
+ cidrv6(params) {
4159
+ return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
4160
+ },
4161
+ e164(params) {
4162
+ return this.check(/* @__PURE__ */ _e164(ZodE164, params));
4163
+ },
4164
+ datetime(params) {
4165
+ return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
4166
+ },
4167
+ date(params) {
4168
+ return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
4169
+ },
4170
+ time(params) {
4171
+ return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
4172
+ },
4173
+ duration(params) {
4174
+ return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
4175
+ }
3293
4176
  });
3294
4177
  function string(params) {
3295
4178
  return /* @__PURE__ */ _string(ZodString, params);
@@ -3298,6 +4181,22 @@ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def
3298
4181
  $ZodStringFormat.init(inst, def);
3299
4182
  _ZodString.init(inst, def);
3300
4183
  });
4184
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4185
+ $ZodISODateTime.init(inst, def);
4186
+ ZodStringFormat.init(inst, def);
4187
+ });
4188
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4189
+ $ZodISODate.init(inst, def);
4190
+ ZodStringFormat.init(inst, def);
4191
+ });
4192
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4193
+ $ZodISOTime.init(inst, def);
4194
+ ZodStringFormat.init(inst, def);
4195
+ });
4196
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
4197
+ $ZodISODuration.init(inst, def);
4198
+ ZodStringFormat.init(inst, def);
4199
+ });
3301
4200
  const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3302
4201
  $ZodEmail.init(inst, def);
3303
4202
  ZodStringFormat.init(inst, def);
@@ -3399,94 +4298,95 @@ function never(params) {
3399
4298
  return /* @__PURE__ */ _never(ZodNever, params);
3400
4299
  }
3401
4300
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
4301
+ _ensureDefaultMemoizer();
3402
4302
  $ZodArray.init(inst, def);
3403
4303
  ZodType.init(inst, def);
3404
4304
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3405
4305
  inst.element = def.element;
3406
- _installLazyMethods(inst, "ZodArray", {
3407
- min(n, params) {
3408
- return this.check(/* @__PURE__ */ _minLength(n, params));
3409
- },
3410
- nonempty(params) {
3411
- return this.check(/* @__PURE__ */ _minLength(1, params));
3412
- },
3413
- max(n, params) {
3414
- return this.check(/* @__PURE__ */ _maxLength(n, params));
3415
- },
3416
- length(n, params) {
3417
- return this.check(/* @__PURE__ */ _length(n, params));
3418
- },
3419
- unwrap() {
3420
- return this.element;
3421
- }
3422
- });
4306
+ }, {
4307
+ min(n, params) {
4308
+ return this.check(/* @__PURE__ */ _minLength(n, params));
4309
+ },
4310
+ nonempty(params) {
4311
+ return this.check(/* @__PURE__ */ _minLength(1, params));
4312
+ },
4313
+ max(n, params) {
4314
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
4315
+ },
4316
+ length(n, params) {
4317
+ return this.check(/* @__PURE__ */ _length(n, params));
4318
+ },
4319
+ unwrap() {
4320
+ return this.element;
4321
+ }
3423
4322
  });
3424
4323
  function array(element, params) {
3425
4324
  return /* @__PURE__ */ _array(ZodArray, element, params);
3426
4325
  }
3427
4326
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4327
+ _ensureDefaultMemoizer();
3428
4328
  $ZodObjectJIT.init(inst, def);
3429
4329
  ZodType.init(inst, def);
3430
4330
  inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3431
- defineLazy(inst, "shape", () => {
3432
- return def.shape;
3433
- });
3434
- _installLazyMethods(inst, "ZodObject", {
3435
- keyof() {
3436
- return _enum(Object.keys(this._zod.def.shape));
3437
- },
3438
- catchall(catchall) {
3439
- return this.clone({
3440
- ...this._zod.def,
3441
- catchall
3442
- });
3443
- },
3444
- passthrough() {
3445
- return this.clone({
3446
- ...this._zod.def,
3447
- catchall: unknown()
3448
- });
3449
- },
3450
- loose() {
3451
- return this.clone({
3452
- ...this._zod.def,
3453
- catchall: unknown()
3454
- });
3455
- },
3456
- strict() {
3457
- return this.clone({
3458
- ...this._zod.def,
3459
- catchall: never()
3460
- });
3461
- },
3462
- strip() {
3463
- return this.clone({
3464
- ...this._zod.def,
3465
- catchall: void 0
3466
- });
3467
- },
3468
- extend(incoming) {
3469
- return extend(this, incoming);
3470
- },
3471
- safeExtend(incoming) {
3472
- return safeExtend(this, incoming);
3473
- },
3474
- merge(other) {
3475
- return merge(this, other);
3476
- },
3477
- pick(mask) {
3478
- return pick(this, mask);
3479
- },
3480
- omit(mask) {
3481
- return omit(this, mask);
3482
- },
3483
- partial(...args) {
3484
- return partial(ZodOptional, this, args[0]);
3485
- },
3486
- required(...args) {
3487
- return required(ZodNonOptional, this, args[0]);
3488
- }
3489
- });
4331
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
4332
+ }, {
4333
+ keyof() {
4334
+ return _enum(Object.keys(this._zod.def.shape));
4335
+ },
4336
+ catchall(catchall) {
4337
+ return this.clone({
4338
+ ...this._zod.def,
4339
+ catchall
4340
+ });
4341
+ },
4342
+ passthrough() {
4343
+ return this.clone({
4344
+ ...this._zod.def,
4345
+ catchall: unknown()
4346
+ });
4347
+ },
4348
+ loose() {
4349
+ return this.clone({
4350
+ ...this._zod.def,
4351
+ catchall: unknown()
4352
+ });
4353
+ },
4354
+ strict() {
4355
+ return this.clone({
4356
+ ...this._zod.def,
4357
+ catchall: never()
4358
+ });
4359
+ },
4360
+ strip() {
4361
+ return this.clone({
4362
+ ...this._zod.def,
4363
+ catchall: void 0
4364
+ });
4365
+ },
4366
+ extend(incoming) {
4367
+ return extend(this, incoming);
4368
+ },
4369
+ safeExtend(incoming) {
4370
+ return safeExtend(this, incoming);
4371
+ },
4372
+ merge(other) {
4373
+ return merge(this, other);
4374
+ },
4375
+ pick(mask) {
4376
+ return pick(this, mask);
4377
+ },
4378
+ omit(mask) {
4379
+ return omit(this, mask);
4380
+ },
4381
+ partial(...args) {
4382
+ return partial(ZodOptional, this, args[0]);
4383
+ },
4384
+ exactPartial(...args) {
4385
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
4386
+ },
4387
+ required(...args) {
4388
+ return required(ZodNonOptional, this, args[0]);
4389
+ }
3490
4390
  });
3491
4391
  function object(shape, params) {
3492
4392
  const def = {
@@ -3589,6 +4489,7 @@ function literal(value, params) {
3589
4489
  });
3590
4490
  }
3591
4491
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
4492
+ _ensureDefaultMemoizer();
3592
4493
  $ZodTransform.init(inst, def);
3593
4494
  ZodType.init(inst, def);
3594
4495
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
@@ -3600,7 +4501,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3600
4501
  const _issue = issue$1;
3601
4502
  if (_issue.fatal) _issue.continue = false;
3602
4503
  _issue.code ?? (_issue.code = "custom");
3603
- _issue.input ?? (_issue.input = payload.value);
4504
+ if (!("input" in _issue)) _issue.input = payload.value;
3604
4505
  _issue.inst ?? (_issue.inst = inst);
3605
4506
  payload.issues.push(issue(_issue));
3606
4507
  }
@@ -3608,11 +4509,9 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
3608
4509
  const output = def.transform(payload.value, payload);
3609
4510
  if (output instanceof Promise) return output.then((output) => {
3610
4511
  payload.value = output;
3611
- payload.fallback = true;
3612
4512
  return payload;
3613
4513
  });
3614
4514
  payload.value = output;
3615
- payload.fallback = true;
3616
4515
  return payload;
3617
4516
  };
3618
4517
  });
@@ -3713,7 +4612,7 @@ function _catch(innerType, catchValue) {
3713
4612
  return new ZodCatch({
3714
4613
  type: "catch",
3715
4614
  innerType,
3716
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
4615
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
3717
4616
  });
3718
4617
  }
3719
4618
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
@@ -4476,4 +5375,4 @@ function loadAddon() {
4476
5375
  throw new Error(`Cannot load the @alienplatform/bindings native addon for '${triple}'. Install the '${pkg}' prebuild, or build it locally with \`napi build --platform\` in crates/alien-bindings-node, or set ALIEN_BINDINGS_ADDON_PATH to a built .node file.`);
4477
5376
  }
4478
5377
  //#endregion
4479
- export { object as _, createRemoteSandboxFactory as a, datetime as b, BindingNotConfiguredError as c, UnknownPostgresSslModeError as d, UnknownSandboxValueError as f, literal as g, discriminatedUnion as h, createRemoteKeyFactory as i, BindingNotFoundError as l, unwrapNapiError as m, registerEmbeddedAddon as n, createRemoteStorageFactory as o, defineError as p, createFactories as r, AlienError as s, loadAddon as t, InvalidPostgresTlsConfigError as u, string as v, url as y };
5378
+ export { literal as _, createRemoteSandboxFactory as a, url as b, BindingNotConfiguredError as c, UnknownPostgresSslModeError as d, UnknownSandboxValueError as f, discriminatedUnion as g, ZodISODateTime as h, createRemoteKeyFactory as i, BindingNotFoundError as l, unwrapNapiError as m, registerEmbeddedAddon as n, createRemoteStorageFactory as o, defineError as p, createFactories as r, AlienError as s, loadAddon as t, InvalidPostgresTlsConfigError as u, object as v, _isoDateTime as x, string as y };