dsh-budget 0.4.0 → 0.4.2

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/lib/client.js CHANGED
@@ -429,70 +429,14 @@ window.__ModuleLoader__.load({
429
429
  usageCurve: "Usage curve"
430
430
  };
431
431
  //#endregion
432
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
433
- var _a$1;
434
- function $constructor(name, initializer, params) {
435
- function init(inst, def) {
436
- if (!inst._zod) Object.defineProperty(inst, "_zod", {
437
- value: {
438
- def,
439
- constr: _,
440
- traits: /* @__PURE__ */ new Set()
441
- },
442
- enumerable: false
443
- });
444
- if (inst._zod.traits.has(name)) return;
445
- inst._zod.traits.add(name);
446
- initializer(inst, def);
447
- const proto = _.prototype;
448
- const keys = Object.keys(proto);
449
- for (let i = 0; i < keys.length; i++) {
450
- const k = keys[i];
451
- if (!(k in inst)) inst[k] = proto[k].bind(inst);
452
- }
453
- }
454
- const Parent = params?.Parent ?? Object;
455
- class Definition extends Parent {}
456
- Object.defineProperty(Definition, "name", { value: name });
457
- function _(def) {
458
- var _a;
459
- const inst = params?.Parent ? new Definition() : this;
460
- init(inst, def);
461
- (_a = inst._zod).deferred ?? (_a.deferred = []);
462
- for (const fn of inst._zod.deferred) fn();
463
- return inst;
464
- }
465
- Object.defineProperty(_, "init", { value: init });
466
- Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
467
- if (params?.Parent && inst instanceof params.Parent) return true;
468
- return inst?._zod?.traits?.has(name);
469
- } });
470
- Object.defineProperty(_, "name", { value: name });
471
- return _;
472
- }
473
- var $ZodAsyncError = class extends Error {
474
- constructor() {
475
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
476
- }
477
- };
478
- var $ZodEncodeError = class extends Error {
479
- constructor(name) {
480
- super(`Encountered unidirectional transform during encode: ${name}`);
481
- this.name = "ZodEncodeError";
482
- }
483
- };
484
- (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
485
- const globalConfig = globalThis.__zod_globalConfig;
486
- function config(newConfig) {
487
- if (newConfig) Object.assign(globalConfig, newConfig);
488
- return globalConfig;
489
- }
490
- //#endregion
491
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
432
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
492
433
  function getEnumValues(entries) {
493
434
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
494
435
  return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
495
436
  }
437
+ function joinValues(array, separator = "|") {
438
+ return array.map((val) => stringifyPrimitive(val)).join(separator);
439
+ }
496
440
  function jsonStringifyReplacer(_, value) {
497
441
  if (typeof value === "bigint") return value.toString();
498
442
  return value;
@@ -517,28 +461,10 @@ window.__ModuleLoader__.load({
517
461
  function floatSafeRemainder(val, step) {
518
462
  const ratio = val / step;
519
463
  const roundedRatio = Math.round(ratio);
520
- const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
464
+ const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
521
465
  if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
522
466
  return ratio - roundedRatio;
523
467
  }
524
- const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
525
- function defineLazy(object, key, getter) {
526
- let value = void 0;
527
- Object.defineProperty(object, key, {
528
- get() {
529
- if (value === EVALUATING) return;
530
- if (value === void 0) {
531
- value = EVALUATING;
532
- value = getter();
533
- }
534
- return value;
535
- },
536
- set(v) {
537
- Object.defineProperty(object, key, { value: v });
538
- },
539
- configurable: true
540
- });
541
- }
542
468
  function assignProp(target, prop, value) {
543
469
  Object.defineProperty(target, prop, {
544
470
  value,
@@ -620,18 +546,23 @@ window.__ModuleLoader__.load({
620
546
  };
621
547
  return params;
622
548
  }
549
+ function stringifyPrimitive(value) {
550
+ if (typeof value === "bigint") return value.toString() + "n";
551
+ if (typeof value === "string") return `"${value}"`;
552
+ return `${value}`;
553
+ }
623
554
  function optionalKeys(shape) {
624
555
  return Object.keys(shape).filter((k) => {
625
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
556
+ return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
626
557
  });
627
558
  }
628
- const NUMBER_FORMAT_RANGES = {
559
+ const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
629
560
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
630
561
  int32: [-2147483648, 2147483647],
631
562
  uint32: [0, 4294967295],
632
563
  float32: [-34028234663852886e22, 34028234663852886e22],
633
564
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
634
- };
565
+ }))();
635
566
  function pick(schema, mask) {
636
567
  const currDef = schema._zod.def;
637
568
  const checks = currDef.checks;
@@ -639,10 +570,10 @@ window.__ModuleLoader__.load({
639
570
  return clone(schema, mergeDefs(schema._zod.def, {
640
571
  get shape() {
641
572
  const newShape = {};
642
- for (const key in mask) {
643
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
573
+ for (const key of Reflect.ownKeys(mask)) {
574
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
644
575
  if (!mask[key]) continue;
645
- newShape[key] = currDef.shape[key];
576
+ assignProp(newShape, key, currDef.shape[key]);
646
577
  }
647
578
  assignProp(this, "shape", newShape);
648
579
  return newShape;
@@ -657,8 +588,8 @@ window.__ModuleLoader__.load({
657
588
  return clone(schema, mergeDefs(schema._zod.def, {
658
589
  get shape() {
659
590
  const newShape = { ...schema._zod.def.shape };
660
- for (const key in mask) {
661
- if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
591
+ for (const key of Reflect.ownKeys(mask)) {
592
+ if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
662
593
  if (!mask[key]) continue;
663
594
  delete newShape[key];
664
595
  }
@@ -673,7 +604,7 @@ window.__ModuleLoader__.load({
673
604
  const checks = schema._zod.def.checks;
674
605
  if (checks && checks.length > 0) {
675
606
  const existingShape = schema._zod.def.shape;
676
- 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.");
607
+ 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.");
677
608
  }
678
609
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
679
610
  const _shape = {
@@ -696,6 +627,7 @@ window.__ModuleLoader__.load({
696
627
  } }));
697
628
  }
698
629
  function merge(a, b) {
630
+ if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
699
631
  if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
700
632
  return clone(a, mergeDefs(a._zod.def, {
701
633
  get shape() {
@@ -712,22 +644,22 @@ window.__ModuleLoader__.load({
712
644
  checks: b._zod.def.checks ?? []
713
645
  }));
714
646
  }
715
- function partial(Class, schema, mask) {
647
+ function partial(Class, schema, mask, name = "partial") {
716
648
  const checks = schema._zod.def.checks;
717
- if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
649
+ if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
718
650
  return clone(schema, mergeDefs(schema._zod.def, {
719
651
  get shape() {
720
652
  const oldShape = schema._zod.def.shape;
721
653
  const shape = { ...oldShape };
722
- if (mask) for (const key in mask) {
723
- if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
654
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
655
+ if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
724
656
  if (!mask[key]) continue;
725
657
  shape[key] = Class ? new Class({
726
658
  type: "optional",
727
659
  innerType: oldShape[key]
728
660
  }) : oldShape[key];
729
661
  }
730
- else for (const key in oldShape) shape[key] = Class ? new Class({
662
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
731
663
  type: "optional",
732
664
  innerType: oldShape[key]
733
665
  }) : oldShape[key];
@@ -741,15 +673,15 @@ window.__ModuleLoader__.load({
741
673
  return clone(schema, mergeDefs(schema._zod.def, { get shape() {
742
674
  const oldShape = schema._zod.def.shape;
743
675
  const shape = { ...oldShape };
744
- if (mask) for (const key in mask) {
745
- if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
676
+ if (mask) for (const key of Reflect.ownKeys(mask)) {
677
+ if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
746
678
  if (!mask[key]) continue;
747
679
  shape[key] = new Class({
748
680
  type: "nonoptional",
749
681
  innerType: oldShape[key]
750
682
  });
751
683
  }
752
- else for (const key in oldShape) shape[key] = new Class({
684
+ else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
753
685
  type: "nonoptional",
754
686
  innerType: oldShape[key]
755
687
  });
@@ -778,19 +710,54 @@ window.__ModuleLoader__.load({
778
710
  function unwrapMessage(message) {
779
711
  return typeof message === "string" ? message : message?.message;
780
712
  }
713
+ function attachSchema(issues, start, inst) {
714
+ var _a;
715
+ for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
716
+ }
781
717
  function finalizeIssue(iss, ctx, config) {
782
- 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";
783
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
718
+ var _a;
719
+ const traits = iss.inst?._zod?.traits;
720
+ if (traits?.has("$ZodType")) {
721
+ if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
722
+ else iss.schema = iss.inst;
723
+ }
724
+ const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
725
+ 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";
726
+ const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
784
727
  rest.path ?? (rest.path = []);
785
728
  rest.message = message;
786
729
  if (ctx?.reportInput) rest.input = _input;
787
730
  return rest;
788
731
  }
732
+ const highSurrogate = /[\uD800-\uDBFF]/;
733
+ function codePointLength(str) {
734
+ const units = str.length;
735
+ if (!highSurrogate.test(str)) return units;
736
+ let count = units;
737
+ for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
738
+ count--;
739
+ i++;
740
+ }
741
+ return count;
742
+ }
789
743
  function getLengthableOrigin(input) {
790
744
  if (Array.isArray(input)) return "array";
791
745
  if (typeof input === "string") return "string";
792
746
  return "unknown";
793
747
  }
748
+ function parsedType(data) {
749
+ const t = typeof data;
750
+ switch (t) {
751
+ case "number": return Number.isNaN(data) ? "nan" : "number";
752
+ case "object": {
753
+ if (data === null) return "null";
754
+ if (Array.isArray(data)) return "array";
755
+ const obj = data;
756
+ if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
757
+ }
758
+ }
759
+ return t;
760
+ }
794
761
  function issue(...args) {
795
762
  const [iss, input, inst] = args;
796
763
  if (typeof iss === "string") return {
@@ -801,33 +768,330 @@ window.__ModuleLoader__.load({
801
768
  };
802
769
  return { ...iss };
803
770
  }
804
- //#endregion
805
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
806
- const initializer$1 = (inst, def) => {
807
- inst.name = "$ZodError";
808
- Object.defineProperty(inst, "_zod", {
809
- value: inst._zod,
810
- enumerable: false
771
+ /**
772
+ * 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.
773
+ *
774
+ * Call this from a `proto` initializer, which runs once per prototype — never per instance.
775
+ */
776
+ function members(proto, table) {
777
+ for (const key in table) {
778
+ const desc = Object.getOwnPropertyDescriptor(table, key);
779
+ if (desc.get) Object.defineProperty(proto, key, {
780
+ ...desc,
781
+ enumerable: false
782
+ });
783
+ else defineBound(proto, key, desc.value);
784
+ }
785
+ }
786
+ /** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
787
+ function own(inst, key, value, enumerable = true) {
788
+ Object.defineProperty(inst, key, {
789
+ configurable: true,
790
+ writable: true,
791
+ enumerable,
792
+ value
811
793
  });
812
- Object.defineProperty(inst, "issues", {
813
- value: def,
814
- enumerable: false
794
+ return value;
795
+ }
796
+ /** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
797
+ function hide(inst, key, value) {
798
+ return own(inst, key, value, false);
799
+ }
800
+ function defineBound(proto, key, fn) {
801
+ Object.defineProperty(proto, key, {
802
+ configurable: true,
803
+ get() {
804
+ return this == null ? fn : own(this, key, fn.bind(this));
805
+ },
806
+ set(value) {
807
+ own(this, key, value);
808
+ }
815
809
  });
816
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
817
- Object.defineProperty(inst, "toString", {
818
- value: () => inst.message,
819
- enumerable: false
810
+ }
811
+ /** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
812
+ function claim(inst, sentinel) {
813
+ const proto = Object.getPrototypeOf(inst);
814
+ return sentinel in proto ? void 0 : proto;
815
+ }
816
+ let installing;
817
+ let broke = false;
818
+ const breaker = {
819
+ configurable: true,
820
+ get() {
821
+ broke = true;
822
+ }
823
+ };
824
+ /**
825
+ * Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
826
+ * constructor, computed from the internals object itself and cached there on
827
+ * first read. One accessor per constructor rather than one per instance.
828
+ */
829
+ function defineLazyInternal(inst, key, compute) {
830
+ const proto = Object.getPrototypeOf(inst._zod);
831
+ if (key in proto && installing !== inst._zod) {
832
+ installing = void 0;
833
+ return;
834
+ }
835
+ installing = inst._zod;
836
+ Object.defineProperty(proto, key, {
837
+ configurable: true,
838
+ get() {
839
+ Object.defineProperty(this, key, breaker);
840
+ const outer = broke;
841
+ broke = false;
842
+ try {
843
+ const value = compute(this);
844
+ if (broke) delete this[key];
845
+ else Object.defineProperty(this, key, {
846
+ configurable: true,
847
+ writable: true,
848
+ value
849
+ });
850
+ broke = broke || outer;
851
+ return value;
852
+ } catch (err) {
853
+ delete this[key];
854
+ broke = broke || outer;
855
+ throw err;
856
+ }
857
+ },
858
+ set(value) {
859
+ Object.defineProperty(this, key, {
860
+ configurable: true,
861
+ writable: true,
862
+ value
863
+ });
864
+ }
820
865
  });
866
+ }
867
+ /**
868
+ * Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
869
+ * data property. One accessor per constructor rather than one per instance, because an own accessor
870
+ * puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
871
+ */
872
+ function installLazyProp(inst, key, make, enumerable) {
873
+ const proto = claim(inst, key);
874
+ if (!proto) return;
875
+ Object.defineProperty(proto, key, {
876
+ configurable: true,
877
+ get() {
878
+ const desc = {
879
+ configurable: true,
880
+ writable: true,
881
+ enumerable,
882
+ value: void 0
883
+ };
884
+ Object.defineProperty(this, key, desc);
885
+ desc.value = make(this);
886
+ Object.defineProperty(this, key, desc);
887
+ return desc.value;
888
+ },
889
+ set(value) {
890
+ Object.defineProperty(this, key, {
891
+ configurable: true,
892
+ writable: true,
893
+ enumerable,
894
+ value
895
+ });
896
+ }
897
+ });
898
+ }
899
+ /** 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. */
900
+ const CONSTANT_CATCH = "~constantCatch";
901
+ /** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
902
+ function constantCatch(value) {
903
+ const fn = () => value;
904
+ fn[CONSTANT_CATCH] = true;
905
+ return fn;
906
+ }
907
+ //#endregion
908
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
909
+ var _a$1;
910
+ const _zodDesc$1 = {
911
+ value: void 0,
912
+ enumerable: false
913
+ };
914
+ let _E = "captureStackTrace" in Error ? Error : null;
915
+ function newError(Definition) {
916
+ const E = _E;
917
+ if (E) {
918
+ const saved = E.stackTraceLimit;
919
+ if (typeof saved === "number") {
920
+ try {
921
+ E.stackTraceLimit = 0;
922
+ } catch {
923
+ _E = null;
924
+ return new Definition();
925
+ }
926
+ try {
927
+ return new Definition();
928
+ } finally {
929
+ E.stackTraceLimit = saved;
930
+ }
931
+ }
932
+ }
933
+ return new Definition();
934
+ }
935
+ function $constructor(name, initializer, proto, params) {
936
+ const zodProto = {};
937
+ function Internals(def) {
938
+ this.def = def;
939
+ this.constr = _;
940
+ this.traits = /* @__PURE__ */ new Set();
941
+ }
942
+ Internals.prototype = zodProto;
943
+ const protoMembers = proto;
944
+ const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
945
+ function init(inst, def) {
946
+ if (!inst._zod) {
947
+ _zodDesc$1.value = new Internals(def);
948
+ try {
949
+ Object.defineProperty(inst, "_zod", _zodDesc$1);
950
+ } finally {
951
+ _zodDesc$1.value = void 0;
952
+ }
953
+ }
954
+ if (inst._zod.traits.has(name)) return;
955
+ inst._zod.traits.add(name);
956
+ initializer(inst, def);
957
+ if (initialized) {
958
+ const own = Object.getPrototypeOf(inst);
959
+ const ctorProto = inst._zod.constr.prototype;
960
+ let up = own;
961
+ while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
962
+ const target = up ?? own;
963
+ if (!initialized.has(target)) {
964
+ initialized.add(target);
965
+ members(target, protoMembers);
966
+ }
967
+ }
968
+ const proto = _.prototype;
969
+ for (const k in proto) {
970
+ if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
971
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
972
+ }
973
+ }
974
+ const Parent = params?.Parent ?? Object;
975
+ class Definition extends Parent {}
976
+ Object.defineProperty(Definition, "name", { value: name });
977
+ function _(def) {
978
+ const inst = params?.Parent ? newError(Definition) : this;
979
+ init(inst, def);
980
+ const deferred = inst._zod.deferred;
981
+ if (deferred) {
982
+ for (const fn of deferred) fn();
983
+ inst._zod.deferred = void 0;
984
+ }
985
+ const pp = globalThis.__zod_globalConfig?.postProcessor;
986
+ if (pp) pp(inst);
987
+ return inst;
988
+ }
989
+ Object.defineProperty(_, "init", { value: init });
990
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
991
+ if (params?.Parent && inst instanceof params.Parent) return true;
992
+ return inst?._zod?.traits?.has(name);
993
+ } });
994
+ Object.defineProperty(_, "name", { value: name });
995
+ return _;
996
+ }
997
+ var $ZodAsyncError = class extends Error {
998
+ constructor() {
999
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
1000
+ }
1001
+ };
1002
+ var $ZodEncodeError = class extends Error {
1003
+ constructor(name) {
1004
+ super(`Encountered unidirectional transform during encode: ${name}`);
1005
+ this.name = "ZodEncodeError";
1006
+ }
1007
+ };
1008
+ (_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
1009
+ const globalConfig = globalThis.__zod_globalConfig;
1010
+ function config(newConfig) {
1011
+ if (newConfig) Object.assign(globalConfig, newConfig);
1012
+ return globalConfig;
1013
+ }
1014
+ //#endregion
1015
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
1016
+ function _getMessage() {
1017
+ const internals = this._zod;
1018
+ internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
1019
+ return internals.message;
1020
+ }
1021
+ function _setMessage(value) {
1022
+ this._zod.message = value;
1023
+ }
1024
+ const _messageDesc = {
1025
+ get: _getMessage,
1026
+ set: _setMessage,
1027
+ enumerable: true,
1028
+ configurable: true
1029
+ };
1030
+ const _zodDesc = {
1031
+ value: void 0,
1032
+ enumerable: false
1033
+ };
1034
+ const _issuesDesc = {
1035
+ value: void 0,
1036
+ enumerable: false
1037
+ };
1038
+ const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
1039
+ const initializer$1 = (inst, def) => {
1040
+ inst.name = "$ZodError";
1041
+ _zodDesc.value = inst._zod;
1042
+ Object.defineProperty(inst, "_zod", _zodDesc);
1043
+ _issuesDesc.value = def;
1044
+ Object.defineProperty(inst, "issues", _issuesDesc);
1045
+ _zodDesc.value = void 0;
1046
+ _issuesDesc.value = void 0;
1047
+ Object.defineProperty(inst, "message", _messageDesc);
1048
+ const proto = Object.getPrototypeOf(inst);
1049
+ if (!_installedToString.has(proto)) {
1050
+ _installedToString.add(proto);
1051
+ Object.defineProperty(proto, "toString", {
1052
+ configurable: true,
1053
+ enumerable: false,
1054
+ get() {
1055
+ const value = () => this.message;
1056
+ Object.defineProperty(this, "toString", {
1057
+ value,
1058
+ configurable: true,
1059
+ writable: true
1060
+ });
1061
+ return value;
1062
+ },
1063
+ set(value) {
1064
+ Object.defineProperty(this, "toString", {
1065
+ value,
1066
+ configurable: true,
1067
+ writable: true
1068
+ });
1069
+ }
1070
+ });
1071
+ }
821
1072
  };
822
1073
  const $ZodError = $constructor("$ZodError", initializer$1);
823
- const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
1074
+ const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
1075
+ /** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
1076
+ * ("toString", "constructor") would otherwise read through to the prototype, and assigning
1077
+ * "__proto__" would hit the setter instead of creating a key. */
1078
+ function node(obj, key, make) {
1079
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) {
1080
+ if (key === "__proto__") Object.defineProperty(obj, key, {
1081
+ value: make(),
1082
+ writable: true,
1083
+ enumerable: true,
1084
+ configurable: true
1085
+ });
1086
+ else obj[key] = make();
1087
+ }
1088
+ return obj[key];
1089
+ }
824
1090
  function flattenError(error, mapper = (issue) => issue.message) {
825
1091
  const fieldErrors = {};
826
1092
  const formErrors = [];
827
- for (const sub of error.issues) if (sub.path.length > 0) {
828
- fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
829
- fieldErrors[sub.path[0]].push(mapper(sub));
830
- } else formErrors.push(mapper(sub));
1093
+ for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
1094
+ else formErrors.push(mapper(sub));
831
1095
  return {
832
1096
  formErrors,
833
1097
  fieldErrors
@@ -847,12 +1111,21 @@ window.__ModuleLoader__.load({
847
1111
  let i = 0;
848
1112
  while (i < fullpath.length) {
849
1113
  const el = fullpath[i];
850
- if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
851
- else {
852
- curr[el] = curr[el] || { _errors: [] };
853
- curr[el]._errors.push(mapper(issue));
1114
+ const terminal = i === fullpath.length - 1;
1115
+ if (el === "_errors") {
1116
+ if (terminal) curr._errors.push(mapper(issue));
1117
+ i++;
1118
+ continue;
854
1119
  }
855
- curr = curr[el];
1120
+ if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
1121
+ value: { _errors: [] },
1122
+ enumerable: true,
1123
+ writable: true,
1124
+ configurable: true
1125
+ });
1126
+ const node = curr[el];
1127
+ if (terminal) node._errors.push(mapper(issue));
1128
+ curr = node;
856
1129
  i++;
857
1130
  }
858
1131
  }
@@ -862,40 +1135,52 @@ window.__ModuleLoader__.load({
862
1135
  return fieldErrors;
863
1136
  }
864
1137
  //#endregion
865
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
866
- const _parse = (_Err) => (schema, value, _ctx, _params) => {
867
- const ctx = _ctx ? {
868
- ..._ctx,
869
- async: false
870
- } : { async: false };
871
- const result = schema._zod.run({
872
- value,
873
- issues: []
874
- }, ctx);
875
- if (result instanceof Promise) throw new $ZodAsyncError();
876
- if (result.issues.length) {
877
- const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
878
- captureStackTrace(e, _params?.callee);
879
- throw e;
880
- }
881
- return result.value;
1138
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
1139
+ function finalizeParams(callee, params) {
1140
+ return {
1141
+ callee: params?.callee ?? callee,
1142
+ Err: params?.Err
1143
+ };
1144
+ }
1145
+ const _parse = (_Err) => {
1146
+ const fn = (schema, value, _ctx, _params) => {
1147
+ const ctx = _ctx ? {
1148
+ ..._ctx,
1149
+ async: false
1150
+ } : { async: false };
1151
+ const result = schema._zod.run({
1152
+ value,
1153
+ issues: []
1154
+ }, ctx);
1155
+ if (result instanceof Promise) throw new $ZodAsyncError();
1156
+ if (result.issues.length) {
1157
+ const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
1158
+ captureStackTrace(e, _params?.callee ?? fn);
1159
+ throw e;
1160
+ }
1161
+ return result.value;
1162
+ };
1163
+ return fn;
882
1164
  };
883
- const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
884
- const ctx = _ctx ? {
885
- ..._ctx,
886
- async: true
887
- } : { async: true };
888
- let result = schema._zod.run({
889
- value,
890
- issues: []
891
- }, ctx);
892
- if (result instanceof Promise) result = await result;
893
- if (result.issues.length) {
894
- const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
895
- captureStackTrace(e, params?.callee);
896
- throw e;
897
- }
898
- return result.value;
1165
+ const _parseAsync = (_Err) => {
1166
+ const fn = async (schema, value, _ctx, params) => {
1167
+ const ctx = _ctx ? {
1168
+ ..._ctx,
1169
+ async: true
1170
+ } : { async: true };
1171
+ let result = schema._zod.run({
1172
+ value,
1173
+ issues: []
1174
+ }, ctx);
1175
+ if (result instanceof Promise) result = await result;
1176
+ if (result.issues.length) {
1177
+ const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
1178
+ captureStackTrace(e, params?.callee ?? fn);
1179
+ throw e;
1180
+ }
1181
+ return result.value;
1182
+ };
1183
+ return fn;
899
1184
  };
900
1185
  const _safeParse = (_Err) => (schema, value, _ctx) => {
901
1186
  const ctx = _ctx ? {
@@ -935,25 +1220,41 @@ window.__ModuleLoader__.load({
935
1220
  };
936
1221
  };
937
1222
  const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
938
- const _encode = (_Err) => (schema, value, _ctx) => {
939
- const ctx = _ctx ? {
940
- ..._ctx,
941
- direction: "backward"
942
- } : { direction: "backward" };
943
- return _parse(_Err)(schema, value, ctx);
1223
+ const _encode = (_Err) => {
1224
+ const parse = _parse(_Err);
1225
+ const fn = (schema, value, _ctx, _params) => {
1226
+ const ctx = _ctx ? {
1227
+ ..._ctx,
1228
+ direction: "backward"
1229
+ } : { direction: "backward" };
1230
+ return parse(schema, value, ctx, finalizeParams(fn, _params));
1231
+ };
1232
+ return fn;
944
1233
  };
945
- const _decode = (_Err) => (schema, value, _ctx) => {
946
- return _parse(_Err)(schema, value, _ctx);
1234
+ const _decode = (_Err) => {
1235
+ const parse = _parse(_Err);
1236
+ const fn = (schema, value, _ctx, _params) => {
1237
+ return parse(schema, value, _ctx, finalizeParams(fn, _params));
1238
+ };
1239
+ return fn;
947
1240
  };
948
- const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
949
- const ctx = _ctx ? {
950
- ..._ctx,
951
- direction: "backward"
952
- } : { direction: "backward" };
953
- return _parseAsync(_Err)(schema, value, ctx);
1241
+ const _encodeAsync = (_Err) => {
1242
+ const parseAsync = _parseAsync(_Err);
1243
+ const fn = async (schema, value, _ctx, _params) => {
1244
+ const ctx = _ctx ? {
1245
+ ..._ctx,
1246
+ direction: "backward"
1247
+ } : { direction: "backward" };
1248
+ return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
1249
+ };
1250
+ return fn;
954
1251
  };
955
- const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
956
- return _parseAsync(_Err)(schema, value, _ctx);
1252
+ const _decodeAsync = (_Err) => {
1253
+ const parseAsync = _parseAsync(_Err);
1254
+ const fn = async (schema, value, _ctx, _params) => {
1255
+ return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
1256
+ };
1257
+ return fn;
957
1258
  };
958
1259
  const _safeEncode = (_Err) => (schema, value, _ctx) => {
959
1260
  const ctx = _ctx ? {
@@ -976,7 +1277,7 @@ window.__ModuleLoader__.load({
976
1277
  return _safeParseAsync(_Err)(schema, value, _ctx);
977
1278
  };
978
1279
  //#endregion
979
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
1280
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
980
1281
  /**
981
1282
  * @deprecated CUID v1 is deprecated by its authors due to information leakage
982
1283
  * (timestamps embedded in the id). Use {@link cuid2} instead.
@@ -984,12 +1285,15 @@ window.__ModuleLoader__.load({
984
1285
  */
985
1286
  const cuid = /^[cC][0-9a-z]{6,}$/;
986
1287
  const cuid2 = /^[0-9a-z]+$/;
987
- const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
1288
+ const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
988
1289
  const xid = /^[0-9a-vA-V]{20}$/;
989
1290
  const ksuid = /^[A-Za-z0-9]{27}$/;
990
1291
  const nanoid = /^[a-zA-Z0-9_-]{21}$/;
1292
+ function nanoidOfLength(length) {
1293
+ return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
1294
+ }
991
1295
  /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
992
- 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)?)?)$/;
1296
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
993
1297
  /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
994
1298
  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})$/;
995
1299
  /** Returns a regex for validating an RFC 9562/4122 UUID.
@@ -1001,33 +1305,41 @@ window.__ModuleLoader__.load({
1001
1305
  };
1002
1306
  /** Practical email validation */
1003
1307
  const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
1004
- const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1308
+ const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
1005
1309
  function emoji() {
1006
1310
  return new RegExp(_emoji$1, "u");
1007
1311
  }
1008
1312
  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])$/;
1009
1313
  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}|:))$/;
1010
1314
  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])$/;
1011
- 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])$/;
1315
+ 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])$/;
1012
1316
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
1013
1317
  const base64url = /^[A-Za-z0-9_-]*$/;
1014
1318
  const httpProtocol = /^https?$/;
1015
1319
  const e164 = /^\+[1-9]\d{6,14}$/;
1016
1320
  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])))`;
1017
- const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
1321
+ /** Anchors a pattern source. The interpolation lives here rather than at the call site because
1322
+ * esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
1323
+ * will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
1324
+ function anchor(source) {
1325
+ return new RegExp(`^${source}$`);
1326
+ }
1327
+ const date = /*@__PURE__*/ anchor(dateSource);
1018
1328
  function timeSource(args) {
1019
1329
  const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
1020
- 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+)?)?`;
1330
+ 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+)?)?`;
1021
1331
  }
1022
- function time$1(args) {
1332
+ function time(args) {
1023
1333
  return new RegExp(`^${timeSource(args)}$`);
1024
1334
  }
1025
- function datetime$1(args) {
1026
- const time = timeSource({ precision: args.precision });
1335
+ function datetime(args) {
1027
1336
  const opts = ["Z"];
1028
- if (args.local) opts.push("");
1029
1337
  if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
1030
- const timeRegex = `${time}(?:${opts.join("|")})`;
1338
+ const qualified = `${timeSource({
1339
+ precision: args.precision,
1340
+ seconds: true
1341
+ })}(?:${opts.join("|")})`;
1342
+ const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
1031
1343
  return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
1032
1344
  }
1033
1345
  const string$1 = (params) => {
@@ -1040,13 +1352,18 @@ window.__ModuleLoader__.load({
1040
1352
  const lowercase = /^[^A-Z]*$/;
1041
1353
  const uppercase = /^[^a-z]*$/;
1042
1354
  //#endregion
1043
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
1355
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
1044
1356
  const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
1045
1357
  var _a;
1046
1358
  inst._zod ?? (inst._zod = {});
1047
1359
  inst._zod.def = def;
1048
1360
  (_a = inst._zod).onattach ?? (_a.onattach = []);
1049
1361
  });
1362
+ /** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
1363
+ const _whenHasLength = (payload) => {
1364
+ const val = payload.value;
1365
+ return !nullish(val) && val.length !== void 0;
1366
+ };
1050
1367
  const numericOriginMap = {
1051
1368
  number: "number",
1052
1369
  bigint: "bigint",
@@ -1066,7 +1383,7 @@ window.__ModuleLoader__.load({
1066
1383
  inst._zod.check = (payload) => {
1067
1384
  if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
1068
1385
  payload.issues.push({
1069
- origin,
1386
+ origin: numericOriginMap[typeof payload.value] ?? origin,
1070
1387
  code: "too_big",
1071
1388
  maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
1072
1389
  input: payload.value,
@@ -1090,7 +1407,7 @@ window.__ModuleLoader__.load({
1090
1407
  inst._zod.check = (payload) => {
1091
1408
  if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1092
1409
  payload.issues.push({
1093
- origin,
1410
+ origin: numericOriginMap[typeof payload.value] ?? origin,
1094
1411
  code: "too_small",
1095
1412
  minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
1096
1413
  input: payload.value,
@@ -1108,7 +1425,7 @@ window.__ModuleLoader__.load({
1108
1425
  });
1109
1426
  inst._zod.check = (payload) => {
1110
1427
  if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1111
- if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1428
+ if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
1112
1429
  payload.issues.push({
1113
1430
  origin: typeof payload.value,
1114
1431
  code: "not_multiple_of",
@@ -1193,17 +1510,15 @@ window.__ModuleLoader__.load({
1193
1510
  const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
1194
1511
  var _a;
1195
1512
  $ZodCheck.init(inst, def);
1196
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1197
- const val = payload.value;
1198
- return !nullish(val) && val.length !== void 0;
1199
- });
1513
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1200
1514
  inst._zod.onattach.push((inst) => {
1201
1515
  const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1202
1516
  if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1203
1517
  });
1204
1518
  inst._zod.check = (payload) => {
1205
1519
  const input = payload.value;
1206
- if (input.length <= def.maximum) return;
1520
+ const units = input.length;
1521
+ if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
1207
1522
  const origin = getLengthableOrigin(input);
1208
1523
  payload.issues.push({
1209
1524
  origin,
@@ -1219,17 +1534,15 @@ window.__ModuleLoader__.load({
1219
1534
  const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
1220
1535
  var _a;
1221
1536
  $ZodCheck.init(inst, def);
1222
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1223
- const val = payload.value;
1224
- return !nullish(val) && val.length !== void 0;
1225
- });
1537
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1226
1538
  inst._zod.onattach.push((inst) => {
1227
1539
  const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1228
1540
  if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1229
1541
  });
1230
1542
  inst._zod.check = (payload) => {
1231
1543
  const input = payload.value;
1232
- if (input.length >= def.minimum) return;
1544
+ const units = input.length;
1545
+ if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
1233
1546
  const origin = getLengthableOrigin(input);
1234
1547
  payload.issues.push({
1235
1548
  origin,
@@ -1245,10 +1558,7 @@ window.__ModuleLoader__.load({
1245
1558
  const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
1246
1559
  var _a;
1247
1560
  $ZodCheck.init(inst, def);
1248
- (_a = inst._zod.def).when ?? (_a.when = (payload) => {
1249
- const val = payload.value;
1250
- return !nullish(val) && val.length !== void 0;
1251
- });
1561
+ (_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
1252
1562
  inst._zod.onattach.push((inst) => {
1253
1563
  const bag = inst._zod.bag;
1254
1564
  bag.minimum = def.length;
@@ -1257,7 +1567,8 @@ window.__ModuleLoader__.load({
1257
1567
  });
1258
1568
  inst._zod.check = (payload) => {
1259
1569
  const input = payload.value;
1260
- const length = input.length;
1570
+ const units = input.length;
1571
+ const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
1261
1572
  if (length === def.length) return;
1262
1573
  const origin = getLengthableOrigin(input);
1263
1574
  const tooBig = length > def.length;
@@ -1331,7 +1642,7 @@ window.__ModuleLoader__.load({
1331
1642
  const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
1332
1643
  $ZodCheck.init(inst, def);
1333
1644
  const escapedRegex = escapeRegex(def.includes);
1334
- const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1645
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
1335
1646
  def.pattern = pattern;
1336
1647
  inst._zod.onattach.push((inst) => {
1337
1648
  const bag = inst._zod.bag;
@@ -1402,12 +1713,13 @@ window.__ModuleLoader__.load({
1402
1713
  };
1403
1714
  });
1404
1715
  //#endregion
1405
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
1716
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
1406
1717
  var Doc = class {
1407
- constructor(args = []) {
1718
+ constructor(args = [], closed = {}) {
1408
1719
  this.content = [];
1409
1720
  this.indent = 0;
1410
- if (this) this.args = args;
1721
+ this.args = args;
1722
+ this.closed = closed;
1411
1723
  }
1412
1724
  indented(fn) {
1413
1725
  this.indent += 1;
@@ -1427,28 +1739,27 @@ window.__ModuleLoader__.load({
1427
1739
  }
1428
1740
  compile() {
1429
1741
  const F = Function;
1430
- const args = this?.args;
1431
- const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
1432
- return new F(...args, lines.join("\n"));
1742
+ const content = this?.content ?? [``];
1743
+ return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
1433
1744
  }
1434
1745
  };
1435
1746
  //#endregion
1436
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
1747
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
1437
1748
  const version = {
1438
1749
  major: 4,
1439
- minor: 4,
1440
- patch: 3
1750
+ minor: 5,
1751
+ patch: 4
1441
1752
  };
1442
1753
  //#endregion
1443
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
1754
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
1444
1755
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1445
1756
  var _a;
1446
1757
  inst ?? (inst = {});
1447
1758
  inst._zod.def = def;
1448
1759
  inst._zod.bag = inst._zod.bag || {};
1449
1760
  inst._zod.version = version;
1450
- const checks = [...inst._zod.def.checks ?? []];
1451
- if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1761
+ const defChecks = inst._zod.def.checks;
1762
+ const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
1452
1763
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
1453
1764
  if (checks.length === 0) {
1454
1765
  (_a = inst._zod).deferred ?? (_a.deferred = []);
@@ -1457,6 +1768,7 @@ window.__ModuleLoader__.load({
1457
1768
  });
1458
1769
  } else {
1459
1770
  const runChecks = (payload, checks, ctx) => {
1771
+ if (payload.memo) return payload;
1460
1772
  let isAborted = aborted(payload);
1461
1773
  let asyncResult;
1462
1774
  for (const ch of checks) {
@@ -1470,10 +1782,12 @@ window.__ModuleLoader__.load({
1470
1782
  if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
1471
1783
  await _;
1472
1784
  if (payload.issues.length === currLen) return;
1785
+ attachSchema(payload.issues, currLen, inst);
1473
1786
  if (!isAborted) isAborted = aborted(payload, currLen);
1474
1787
  });
1475
1788
  else {
1476
1789
  if (payload.issues.length === currLen) continue;
1790
+ attachSchema(payload.issues, currLen, inst);
1477
1791
  if (!isAborted) isAborted = aborted(payload, currLen);
1478
1792
  }
1479
1793
  }
@@ -1517,19 +1831,29 @@ window.__ModuleLoader__.load({
1517
1831
  return runChecks(result, checks, ctx);
1518
1832
  };
1519
1833
  }
1520
- defineLazy(inst, "~standard", () => ({
1834
+ }, {
1835
+ get "~standard"() {
1836
+ return hide(this, "~standard", standardProps(this));
1837
+ },
1838
+ set "~standard"(value) {
1839
+ own(this, "~standard", value);
1840
+ }
1841
+ });
1842
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
1843
+ const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
1844
+ function standardProps(inst) {
1845
+ return {
1521
1846
  validate: (value) => {
1522
1847
  try {
1523
- const r = safeParse$1(inst, value);
1524
- return r.success ? { value: r.data } : { issues: r.error?.issues };
1848
+ return toStandardResult(safeParse$1(inst, value));
1525
1849
  } catch (_) {
1526
- return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
1850
+ return safeParseAsync$1(inst, value).then(toStandardResult);
1527
1851
  }
1528
1852
  },
1529
1853
  vendor: "zod",
1530
1854
  version: 1
1531
- }));
1532
- });
1855
+ };
1856
+ }
1533
1857
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1534
1858
  $ZodType.init(inst, def);
1535
1859
  inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
@@ -1576,51 +1900,74 @@ window.__ModuleLoader__.load({
1576
1900
  def.pattern ?? (def.pattern = email);
1577
1901
  $ZodStringFormat.init(inst, def);
1578
1902
  });
1903
+ /** 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. */
1904
+ function parseURLObject(trimmed, def) {
1905
+ if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
1906
+ try {
1907
+ return new URL(trimmed);
1908
+ } catch {
1909
+ return 2;
1910
+ }
1911
+ }
1912
+ const asciiTabOrNewline = /[\t\n\r]/g;
1913
+ /** 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. */
1914
+ function stripTabAndNewline(value) {
1915
+ return value.replace(asciiTabOrNewline, "");
1916
+ }
1917
+ function urlHostnameOk(url, hostname) {
1918
+ hostname.lastIndex = 0;
1919
+ return hostname.test(url.hostname);
1920
+ }
1921
+ function urlProtocolOk(url, protocol) {
1922
+ protocol.lastIndex = 0;
1923
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
1924
+ }
1579
1925
  const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
1580
1926
  $ZodStringFormat.init(inst, def);
1581
1927
  inst._zod.check = (payload) => {
1582
1928
  try {
1583
1929
  const trimmed = payload.value.trim();
1584
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
1585
- if (!/^https?:\/\//i.test(trimmed)) {
1586
- payload.issues.push({
1587
- code: "invalid_format",
1588
- format: "url",
1589
- note: "Invalid URL format",
1590
- input: payload.value,
1591
- inst,
1592
- continue: !def.abort
1593
- });
1594
- return;
1595
- }
1596
- }
1597
- const url = new URL(trimmed);
1598
- if (def.hostname) {
1599
- def.hostname.lastIndex = 0;
1600
- if (!def.hostname.test(url.hostname)) payload.issues.push({
1930
+ const url = parseURLObject(trimmed, def);
1931
+ if (url === 1) {
1932
+ payload.issues.push({
1601
1933
  code: "invalid_format",
1602
1934
  format: "url",
1603
- note: "Invalid hostname",
1604
- pattern: def.hostname.source,
1935
+ note: "Invalid URL format",
1605
1936
  input: payload.value,
1606
1937
  inst,
1607
1938
  continue: !def.abort
1608
1939
  });
1940
+ return;
1609
1941
  }
1610
- if (def.protocol) {
1611
- def.protocol.lastIndex = 0;
1612
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1942
+ if (url === 2) {
1943
+ payload.issues.push({
1613
1944
  code: "invalid_format",
1614
1945
  format: "url",
1615
- note: "Invalid protocol",
1616
- pattern: def.protocol.source,
1617
1946
  input: payload.value,
1618
1947
  inst,
1619
1948
  continue: !def.abort
1620
1949
  });
1950
+ return;
1621
1951
  }
1622
- if (def.normalize) payload.value = url.href;
1623
- else payload.value = trimmed;
1952
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
1953
+ code: "invalid_format",
1954
+ format: "url",
1955
+ note: "Invalid hostname",
1956
+ pattern: def.hostname.source,
1957
+ input: payload.value,
1958
+ inst,
1959
+ continue: !def.abort
1960
+ });
1961
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
1962
+ code: "invalid_format",
1963
+ format: "url",
1964
+ note: "Invalid protocol",
1965
+ pattern: def.protocol.source,
1966
+ input: payload.value,
1967
+ inst,
1968
+ continue: !def.abort
1969
+ });
1970
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
1624
1971
  return;
1625
1972
  } catch (_) {
1626
1973
  payload.issues.push({
@@ -1638,7 +1985,8 @@ window.__ModuleLoader__.load({
1638
1985
  $ZodStringFormat.init(inst, def);
1639
1986
  });
1640
1987
  const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
1641
- def.pattern ?? (def.pattern = nanoid);
1988
+ if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
1989
+ def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
1642
1990
  $ZodStringFormat.init(inst, def);
1643
1991
  });
1644
1992
  /**
@@ -1667,19 +2015,25 @@ window.__ModuleLoader__.load({
1667
2015
  $ZodStringFormat.init(inst, def);
1668
2016
  });
1669
2017
  const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
1670
- def.pattern ?? (def.pattern = datetime$1(def));
2018
+ def.pattern ?? (def.pattern = datetime(def));
1671
2019
  $ZodStringFormat.init(inst, def);
2020
+ if (def.local || def.precision === -1) {
2021
+ inst._zod.bag.laxFormat = true;
2022
+ inst._zod.onattach.push((s) => {
2023
+ s._zod.bag.laxFormat = true;
2024
+ });
2025
+ }
1672
2026
  });
1673
2027
  const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
1674
- def.pattern ?? (def.pattern = date$1);
2028
+ def.pattern ?? (def.pattern = date);
1675
2029
  $ZodStringFormat.init(inst, def);
1676
2030
  });
1677
2031
  const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
1678
- def.pattern ?? (def.pattern = time$1(def));
2032
+ def.pattern ?? (def.pattern = time(def));
1679
2033
  $ZodStringFormat.init(inst, def);
1680
2034
  });
1681
2035
  const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
1682
- def.pattern ?? (def.pattern = duration$1);
2036
+ def.pattern ?? (def.pattern = duration);
1683
2037
  $ZodStringFormat.init(inst, def);
1684
2038
  });
1685
2039
  const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
@@ -1687,50 +2041,56 @@ window.__ModuleLoader__.load({
1687
2041
  $ZodStringFormat.init(inst, def);
1688
2042
  inst._zod.bag.format = `ipv4`;
1689
2043
  });
2044
+ /** 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`. */
2045
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
2046
+ function isValidIPv6(value) {
2047
+ if (!ipv6Alphabet.test(value)) return false;
2048
+ try {
2049
+ new URL(`http://[${value}]`);
2050
+ return true;
2051
+ } catch {
2052
+ return false;
2053
+ }
2054
+ }
1690
2055
  const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
1691
2056
  def.pattern ?? (def.pattern = ipv6);
1692
2057
  $ZodStringFormat.init(inst, def);
1693
2058
  inst._zod.bag.format = `ipv6`;
1694
2059
  inst._zod.check = (payload) => {
1695
- try {
1696
- new URL(`http://[${payload.value}]`);
1697
- } catch {
1698
- payload.issues.push({
1699
- code: "invalid_format",
1700
- format: "ipv6",
1701
- input: payload.value,
1702
- inst,
1703
- continue: !def.abort
1704
- });
1705
- }
2060
+ if (!isValidIPv6(payload.value)) payload.issues.push({
2061
+ code: "invalid_format",
2062
+ format: "ipv6",
2063
+ input: payload.value,
2064
+ inst,
2065
+ continue: !def.abort
2066
+ });
1706
2067
  };
1707
2068
  });
1708
2069
  const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
1709
2070
  def.pattern ?? (def.pattern = cidrv4);
1710
2071
  $ZodStringFormat.init(inst, def);
1711
2072
  });
2073
+ function isValidCIDRv6(value) {
2074
+ const parts = value.split("/");
2075
+ if (parts.length !== 2) return false;
2076
+ const [address, prefix] = parts;
2077
+ if (!prefix) return false;
2078
+ const prefixNum = Number(prefix);
2079
+ if (`${prefixNum}` !== prefix) return false;
2080
+ if (prefixNum < 0 || prefixNum > 128) return false;
2081
+ return isValidIPv6(address);
2082
+ }
1712
2083
  const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
1713
2084
  def.pattern ?? (def.pattern = cidrv6);
1714
2085
  $ZodStringFormat.init(inst, def);
1715
2086
  inst._zod.check = (payload) => {
1716
- const parts = payload.value.split("/");
1717
- try {
1718
- if (parts.length !== 2) throw new Error();
1719
- const [address, prefix] = parts;
1720
- if (!prefix) throw new Error();
1721
- const prefixNum = Number(prefix);
1722
- if (`${prefixNum}` !== prefix) throw new Error();
1723
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
1724
- new URL(`http://[${address}]`);
1725
- } catch {
1726
- payload.issues.push({
1727
- code: "invalid_format",
1728
- format: "cidrv6",
1729
- input: payload.value,
1730
- inst,
1731
- continue: !def.abort
1732
- });
1733
- }
2087
+ if (!isValidCIDRv6(payload.value)) payload.issues.push({
2088
+ code: "invalid_format",
2089
+ format: "cidrv6",
2090
+ input: payload.value,
2091
+ inst,
2092
+ continue: !def.abort
2093
+ });
1734
2094
  };
1735
2095
  });
1736
2096
  function isValidBase64(data) {
@@ -1820,7 +2180,7 @@ window.__ModuleLoader__.load({
1820
2180
  } catch (_) {}
1821
2181
  const input = payload.value;
1822
2182
  if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1823
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
2183
+ const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
1824
2184
  payload.issues.push({
1825
2185
  expected: "number",
1826
2186
  code: "invalid_type",
@@ -1875,6 +2235,8 @@ window.__ModuleLoader__.load({
1875
2235
  }
1876
2236
  const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1877
2237
  $ZodType.init(inst, def);
2238
+ const memo = globalConfig.memoizer;
2239
+ memo?.attach(inst);
1878
2240
  inst._zod.parse = (payload, ctx) => {
1879
2241
  const input = payload.value;
1880
2242
  if (!Array.isArray(input)) {
@@ -1886,7 +2248,7 @@ window.__ModuleLoader__.load({
1886
2248
  });
1887
2249
  return payload;
1888
2250
  }
1889
- payload.value = Array(input.length);
2251
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1890
2252
  const proms = [];
1891
2253
  for (let i = 0; i < input.length; i++) {
1892
2254
  const item = input[i];
@@ -1901,13 +2263,15 @@ window.__ModuleLoader__.load({
1901
2263
  return payload;
1902
2264
  };
1903
2265
  });
1904
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
2266
+ function handlePropertyResult(result, final, key, input, optin, optout) {
1905
2267
  const isPresent = key in input;
2268
+ const isOptionalOut = optout === "optional";
2269
+ if (!isPresent && isOptionalOut && optin === "optional") return;
1906
2270
  if (result.issues.length) {
1907
- if (isOptionalIn && isOptionalOut && !isPresent) return;
2271
+ if (optin !== void 0 && isOptionalOut && !isPresent) return;
1908
2272
  final.issues.push(...prefixIssues(key, result.issues));
1909
2273
  }
1910
- if (!isPresent && !isOptionalIn) {
2274
+ if (!isPresent && optin === void 0) {
1911
2275
  if (!result.issues.length) final.issues.push({
1912
2276
  code: "invalid_type",
1913
2277
  expected: "nonoptional",
@@ -1920,13 +2284,18 @@ window.__ModuleLoader__.load({
1920
2284
  if (isPresent) final.value[key] = void 0;
1921
2285
  } else final.value[key] = result.value;
1922
2286
  }
2287
+ const NO_SYMBOL_KEYS = [];
1923
2288
  function normalizeDef(def) {
1924
2289
  const keys = Object.keys(def.shape);
1925
- 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`);
2290
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
2291
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
2292
+ const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
2293
+ 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`);
1926
2294
  const okeys = optionalKeys(def.shape);
1927
2295
  return {
1928
2296
  ...def,
1929
- keys,
2297
+ allKeys,
2298
+ symbolKeys,
1930
2299
  keySet: new Set(keys),
1931
2300
  numKeys: keys.length,
1932
2301
  optionalKeys: new Set(okeys)
@@ -1937,11 +2306,14 @@ window.__ModuleLoader__.load({
1937
2306
  const keySet = def.keySet;
1938
2307
  const _catchall = def.catchall._zod;
1939
2308
  const t = _catchall.def.type;
1940
- const isOptionalIn = _catchall.optin === "optional";
1941
- const isOptionalOut = _catchall.optout === "optional";
2309
+ const optin = _catchall.optin;
2310
+ const optout = _catchall.optout;
1942
2311
  for (const key in input) {
1943
- if (key === "__proto__") continue;
1944
2312
  if (keySet.has(key)) continue;
2313
+ if (key === "__proto__") {
2314
+ if (t === "never") unrecognized.push(key);
2315
+ continue;
2316
+ }
1945
2317
  if (t === "never") {
1946
2318
  unrecognized.push(key);
1947
2319
  continue;
@@ -1950,39 +2322,44 @@ window.__ModuleLoader__.load({
1950
2322
  value: input[key],
1951
2323
  issues: []
1952
2324
  }, ctx);
1953
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
1954
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2325
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2326
+ else handlePropertyResult(r, payload, key, input, optin, optout);
1955
2327
  }
1956
2328
  if (unrecognized.length) payload.issues.push({
1957
2329
  code: "unrecognized_keys",
1958
2330
  keys: unrecognized,
1959
2331
  input,
1960
- inst
2332
+ inst,
2333
+ continue: true
1961
2334
  });
1962
2335
  if (!proms.length) return payload;
1963
2336
  return Promise.all(proms).then(() => {
1964
2337
  return payload;
1965
2338
  });
1966
2339
  }
2340
+ const propShapes = /* @__PURE__ */ new WeakMap();
1967
2341
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1968
2342
  $ZodType.init(inst, def);
1969
2343
  if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1970
2344
  const sh = def.shape;
2345
+ propShapes.set(def, sh);
1971
2346
  Object.defineProperty(def, "shape", { get: () => {
1972
2347
  const newSh = { ...sh };
1973
2348
  Object.defineProperty(def, "shape", { value: newSh });
2349
+ propShapes.set(def, newSh);
1974
2350
  return newSh;
1975
2351
  } });
1976
2352
  }
1977
2353
  const _normalized = cached(() => normalizeDef(def));
1978
- defineLazy(inst._zod, "propValues", () => {
1979
- const shape = def.shape;
2354
+ defineLazyInternal(inst, "propValues", (zod) => {
2355
+ const shape = zod.def.shape;
1980
2356
  const propValues = {};
1981
2357
  for (const key in shape) {
1982
2358
  const field = shape[key]._zod;
1983
2359
  if (field.values) {
1984
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
2360
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
1985
2361
  for (const v of field.values) propValues[key].add(v);
2362
+ if (field.optin !== void 0) propValues[key].add(void 0);
1986
2363
  }
1987
2364
  }
1988
2365
  return propValues;
@@ -1990,6 +2367,8 @@ window.__ModuleLoader__.load({
1990
2367
  const isObject$1 = isObject;
1991
2368
  const catchall = def.catchall;
1992
2369
  let value;
2370
+ const memo = globalConfig.memoizer;
2371
+ memo?.attach(inst);
1993
2372
  inst._zod.parse = (payload, ctx) => {
1994
2373
  value ?? (value = _normalized.value);
1995
2374
  const input = payload.value;
@@ -2002,19 +2381,20 @@ window.__ModuleLoader__.load({
2002
2381
  });
2003
2382
  return payload;
2004
2383
  }
2005
- payload.value = {};
2384
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2006
2385
  const proms = [];
2007
2386
  const shape = value.shape;
2008
- for (const key of value.keys) {
2387
+ for (const key of value.allKeys) {
2388
+ if (key === "__proto__") continue;
2009
2389
  const el = shape[key];
2010
- const isOptionalIn = el._zod.optin === "optional";
2011
- const isOptionalOut = el._zod.optout === "optional";
2390
+ const optin = el._zod.optin;
2391
+ const optout = el._zod.optout;
2012
2392
  const r = el._zod.run({
2013
2393
  value: input[key],
2014
2394
  issues: []
2015
2395
  }, ctx);
2016
- if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
2017
- else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2396
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
2397
+ else handlePropertyResult(r, payload, key, input, optin, optout);
2018
2398
  }
2019
2399
  if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
2020
2400
  return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
@@ -2024,55 +2404,55 @@ window.__ModuleLoader__.load({
2024
2404
  $ZodObject.init(inst, def);
2025
2405
  const superParse = inst._zod.parse;
2026
2406
  const _normalized = cached(() => normalizeDef(def));
2407
+ const memo = globalConfig.memoizer;
2027
2408
  const generateFastpass = (shape) => {
2028
- const doc = new Doc([
2029
- "shape",
2030
- "payload",
2031
- "ctx"
2032
- ]);
2033
2409
  const normalized = _normalized.value;
2034
- const parseStr = (key) => {
2035
- const k = esc(key);
2036
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2037
- };
2410
+ const syms = normalized.symbolKeys;
2411
+ const doc = new Doc(["payload", "ctx"], {
2412
+ shape,
2413
+ inst,
2414
+ memo,
2415
+ syms
2416
+ });
2417
+ const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2418
+ const prefixStr = (id, k) => `
2419
+ for (let i = 0; i < ${id}.issues.length; i++) {
2420
+ const iss = ${id}.issues[i];
2421
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2422
+ payload.issues.push(iss);
2423
+ }`;
2038
2424
  doc.write(`const input = payload.value;`);
2039
2425
  const ids = Object.create(null);
2040
2426
  let counter = 0;
2041
- for (const key of normalized.keys) ids[key] = `key_${counter++}`;
2042
- doc.write(`const newResult = {};`);
2043
- for (const key of normalized.keys) {
2427
+ for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
2428
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2429
+ for (const key of normalized.allKeys) {
2430
+ if (key === "__proto__") continue;
2044
2431
  const id = ids[key];
2045
- const k = esc(key);
2432
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
2433
+ const isPresent = `${k} in input`;
2046
2434
  const schema = shape[key];
2047
- const isOptionalIn = schema?._zod?.optin === "optional";
2435
+ const optin = schema?._zod?.optin;
2436
+ const isOptionalIn = optin !== void 0;
2048
2437
  const isOptionalOut = schema?._zod?.optout === "optional";
2049
- doc.write(`const ${id} = ${parseStr(key)};`);
2050
- if (isOptionalIn && isOptionalOut) doc.write(`
2051
- if (${id}.issues.length) {
2052
- if (${k} in input) {
2053
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2054
- ...iss,
2055
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2056
- })));
2438
+ doc.write(`const ${id} = ${parseStr(k)};`);
2439
+ if (isOptionalIn && isOptionalOut) {
2440
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2441
+ doc.write(`
2442
+ const ${id}_present = ${isPresent};
2443
+ if (!${id}.issues.length || ${id}_present) {
2444
+ if (${id}.issues.length) {${prefixStr(id, k)}
2057
2445
  }
2058
- }
2059
-
2060
- if (${id}.value === undefined) {
2061
- if (${k} in input) {
2062
- newResult[${k}] = undefined;
2446
+
2447
+ if (${assign}) {
2448
+ newResult[${k}] = ${id}.value;
2063
2449
  }
2064
- } else {
2065
- newResult[${k}] = ${id}.value;
2066
2450
  }
2067
-
2451
+
2068
2452
  `);
2069
- else if (!isOptionalIn) doc.write(`
2070
- const ${id}_present = ${k} in input;
2071
- if (${id}.issues.length) {
2072
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2073
- ...iss,
2074
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2075
- })));
2453
+ } else if (!isOptionalIn) doc.write(`
2454
+ const ${id}_present = ${isPresent};
2455
+ if (${id}.issues.length) {${prefixStr(id, k)}
2076
2456
  }
2077
2457
  if (!${id}_present && !${id}.issues.length) {
2078
2458
  payload.issues.push({
@@ -2084,36 +2464,27 @@ window.__ModuleLoader__.load({
2084
2464
  }
2085
2465
 
2086
2466
  if (${id}_present) {
2087
- if (${id}.value === undefined) {
2088
- newResult[${k}] = undefined;
2089
- } else {
2090
- newResult[${k}] = ${id}.value;
2091
- }
2467
+ newResult[${k}] = ${id}.value;
2092
2468
  }
2093
2469
 
2094
2470
  `);
2095
2471
  else doc.write(`
2096
- if (${id}.issues.length) {
2097
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2098
- ...iss,
2099
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2100
- })));
2472
+ if (${id}.issues.length) {${prefixStr(id, k)}
2101
2473
  }
2102
2474
 
2103
2475
  if (${id}.value === undefined) {
2104
- if (${k} in input) {
2476
+ if (${isPresent}) {
2105
2477
  newResult[${k}] = undefined;
2106
2478
  }
2107
2479
  } else {
2108
2480
  newResult[${k}] = ${id}.value;
2109
2481
  }
2110
-
2482
+
2111
2483
  `);
2112
2484
  }
2113
2485
  doc.write(`payload.value = newResult;`);
2114
2486
  doc.write(`return payload;`);
2115
- const fn = doc.compile();
2116
- return (payload, ctx) => fn(shape, payload, ctx);
2487
+ return doc.compile();
2117
2488
  };
2118
2489
  let fastpass;
2119
2490
  const isObject$2 = isObject;
@@ -2162,14 +2533,14 @@ window.__ModuleLoader__.load({
2162
2533
  }
2163
2534
  const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
2164
2535
  $ZodType.init(inst, def);
2165
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
2166
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2167
- defineLazy(inst._zod, "values", () => {
2168
- if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
2536
+ 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);
2537
+ defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
2538
+ defineLazyInternal(inst, "values", (zod) => {
2539
+ if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
2169
2540
  });
2170
- defineLazy(inst._zod, "pattern", () => {
2171
- if (def.options.every((o) => o._zod.pattern)) {
2172
- const patterns = def.options.map((o) => o._zod.pattern);
2541
+ defineLazyInternal(inst, "pattern", (zod) => {
2542
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2543
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
2173
2544
  return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
2174
2545
  }
2175
2546
  });
@@ -2231,7 +2602,9 @@ window.__ModuleLoader__.load({
2231
2602
  ...a,
2232
2603
  ...b
2233
2604
  };
2605
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
2234
2606
  for (const key of sharedKeys) {
2607
+ if (key === "__proto__") continue;
2235
2608
  const sharedValue = mergeValues(a[key], b[key]);
2236
2609
  if (!sharedValue.valid) return {
2237
2610
  valid: false,
@@ -2273,26 +2646,39 @@ window.__ModuleLoader__.load({
2273
2646
  function handleIntersectionResults(result, left, right) {
2274
2647
  const unrecKeys = /* @__PURE__ */ new Map();
2275
2648
  let unrecIssue;
2276
- for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
2277
- unrecIssue ?? (unrecIssue = iss);
2278
- for (const k of iss.keys) {
2649
+ const keyIssues = /* @__PURE__ */ new Map();
2650
+ const collect = (iss, side) => {
2651
+ let keys;
2652
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2653
+ unrecIssue ?? (unrecIssue = iss);
2654
+ keys = iss.keys;
2655
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2656
+ const k = String(iss.path[0]);
2657
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2658
+ keys = [k];
2659
+ } else return false;
2660
+ for (const k of keys) {
2279
2661
  if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2280
- unrecKeys.get(k).l = true;
2662
+ unrecKeys.get(k)[side] = true;
2281
2663
  }
2282
- } else result.issues.push(iss);
2283
- for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
2284
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2285
- unrecKeys.get(k).r = true;
2286
- }
2287
- else result.issues.push(iss);
2664
+ return true;
2665
+ };
2666
+ for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
2667
+ for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
2288
2668
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2289
- if (bothKeys.length && unrecIssue) result.issues.push({
2290
- ...unrecIssue,
2291
- keys: bothKeys
2292
- });
2293
- if (aborted(result)) return result;
2669
+ if (bothKeys.length) {
2670
+ const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
2671
+ if (aggregated.length) result.issues.push({
2672
+ ...unrecIssue,
2673
+ keys: aggregated
2674
+ });
2675
+ for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
2676
+ }
2294
2677
  const merged = mergeValues(left.value, right.value);
2295
- if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2678
+ if (!merged.valid) {
2679
+ if (aborted(result)) return result;
2680
+ throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2681
+ }
2296
2682
  result.value = merged.data;
2297
2683
  return result;
2298
2684
  }
@@ -2301,7 +2687,8 @@ window.__ModuleLoader__.load({
2301
2687
  const values = getEnumValues(def.entries);
2302
2688
  const valuesSet = new Set(values);
2303
2689
  inst._zod.values = valuesSet;
2304
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
2690
+ const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
2691
+ inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
2305
2692
  inst._zod.parse = (payload, _ctx) => {
2306
2693
  const input = payload.value;
2307
2694
  if (valuesSet.has(input)) return payload;
@@ -2316,10 +2703,9 @@ window.__ModuleLoader__.load({
2316
2703
  });
2317
2704
  const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
2318
2705
  $ZodType.init(inst, def);
2319
- if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
2320
2706
  const values = new Set(def.values);
2321
2707
  inst._zod.values = values;
2322
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
2708
+ 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]$");
2323
2709
  inst._zod.parse = (payload, _ctx) => {
2324
2710
  const input = payload.value;
2325
2711
  if (values.has(input)) return payload;
@@ -2335,67 +2721,66 @@ window.__ModuleLoader__.load({
2335
2721
  const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
2336
2722
  $ZodType.init(inst, def);
2337
2723
  inst._zod.optin = "optional";
2724
+ globalConfig.memoizer?.guard(inst);
2338
2725
  inst._zod.parse = (payload, ctx) => {
2339
2726
  if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
2340
2727
  const _out = def.transform(payload.value, payload);
2341
2728
  if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
2342
2729
  payload.value = output;
2343
- payload.fallback = true;
2344
2730
  return payload;
2345
2731
  });
2346
2732
  if (_out instanceof Promise) throw new $ZodAsyncError();
2347
2733
  payload.value = _out;
2348
- payload.fallback = true;
2349
2734
  return payload;
2350
2735
  };
2351
2736
  });
2352
- function handleOptionalResult(result, input) {
2353
- if (input === void 0 && (result.issues.length || result.fallback)) return {
2354
- issues: [],
2355
- value: void 0
2356
- };
2357
- return result;
2737
+ function handleOptionalResult(payload, result) {
2738
+ payload.value = result.issues.length ? void 0 : result.value;
2739
+ return payload;
2358
2740
  }
2359
2741
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2360
2742
  $ZodType.init(inst, def);
2361
- inst._zod.optin = "optional";
2743
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2362
2744
  inst._zod.optout = "optional";
2363
- defineLazy(inst._zod, "values", () => {
2364
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
2745
+ defineLazyInternal(inst, "values", (zod) => {
2746
+ const values = zod.def.innerType._zod.values;
2747
+ return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
2365
2748
  });
2366
- defineLazy(inst._zod, "pattern", () => {
2367
- const pattern = def.innerType._zod.pattern;
2749
+ defineLazyInternal(inst, "pattern", (zod) => {
2750
+ const pattern = zod.def.innerType._zod.pattern;
2368
2751
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2369
2752
  });
2370
2753
  inst._zod.parse = (payload, ctx) => {
2371
- if (def.innerType._zod.optin === "optional") {
2372
- const input = payload.value;
2373
- const result = def.innerType._zod.run(payload, ctx);
2374
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
2375
- return handleOptionalResult(result, input);
2754
+ if (payload.value === void 0) {
2755
+ if (def.innerType._zod.optin !== "defaulted") return payload;
2756
+ const result = def.innerType._zod.run({
2757
+ value: payload.value,
2758
+ issues: []
2759
+ }, ctx);
2760
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
2761
+ return handleOptionalResult(payload, result);
2376
2762
  }
2377
- if (payload.value === void 0) return payload;
2378
2763
  return def.innerType._zod.run(payload, ctx);
2379
2764
  };
2380
2765
  });
2381
2766
  const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
2382
2767
  $ZodOptional.init(inst, def);
2383
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2384
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
2768
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2769
+ defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
2385
2770
  inst._zod.parse = (payload, ctx) => {
2386
2771
  return def.innerType._zod.run(payload, ctx);
2387
2772
  };
2388
2773
  });
2389
2774
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
2390
2775
  $ZodType.init(inst, def);
2391
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
2392
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2393
- defineLazy(inst._zod, "pattern", () => {
2394
- const pattern = def.innerType._zod.pattern;
2776
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
2777
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2778
+ defineLazyInternal(inst, "pattern", (zod) => {
2779
+ const pattern = zod.def.innerType._zod.pattern;
2395
2780
  return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2396
2781
  });
2397
- defineLazy(inst._zod, "values", () => {
2398
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
2782
+ defineLazyInternal(inst, "values", (zod) => {
2783
+ return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
2399
2784
  });
2400
2785
  inst._zod.parse = (payload, ctx) => {
2401
2786
  if (payload.value === null) return payload;
@@ -2404,8 +2789,8 @@ window.__ModuleLoader__.load({
2404
2789
  });
2405
2790
  const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
2406
2791
  $ZodType.init(inst, def);
2407
- inst._zod.optin = "optional";
2408
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2792
+ inst._zod.optin = "defaulted";
2793
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2409
2794
  inst._zod.parse = (payload, ctx) => {
2410
2795
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2411
2796
  if (payload.value === void 0) {
@@ -2426,8 +2811,8 @@ window.__ModuleLoader__.load({
2426
2811
  }
2427
2812
  const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
2428
2813
  $ZodType.init(inst, def);
2429
- inst._zod.optin = "optional";
2430
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2814
+ inst._zod.optin = "defaulted";
2815
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2431
2816
  inst._zod.parse = (payload, ctx) => {
2432
2817
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2433
2818
  if (payload.value === void 0) payload.value = def.defaultValue;
@@ -2436,8 +2821,8 @@ window.__ModuleLoader__.load({
2436
2821
  });
2437
2822
  const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
2438
2823
  $ZodType.init(inst, def);
2439
- defineLazy(inst._zod, "values", () => {
2440
- const v = def.innerType._zod.values;
2824
+ defineLazyInternal(inst, "values", (zod) => {
2825
+ const v = zod.def.innerType._zod.values;
2441
2826
  return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
2442
2827
  });
2443
2828
  inst._zod.parse = (payload, ctx) => {
@@ -2455,46 +2840,41 @@ window.__ModuleLoader__.load({
2455
2840
  });
2456
2841
  return payload;
2457
2842
  }
2843
+ function handleCatchResult(payload, result, def, ctx) {
2844
+ if (!result.issues.length) {
2845
+ payload.value = result.value;
2846
+ if (result.memo) payload.memo = true;
2847
+ return payload;
2848
+ }
2849
+ payload.value = def.catchValue({
2850
+ ...result,
2851
+ value: payload.value,
2852
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2853
+ input: payload.value
2854
+ });
2855
+ return payload;
2856
+ }
2458
2857
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
2459
2858
  $ZodType.init(inst, def);
2460
- inst._zod.optin = "optional";
2461
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
2462
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2859
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
2860
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
2861
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2463
2862
  inst._zod.parse = (payload, ctx) => {
2464
2863
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2465
- const result = def.innerType._zod.run(payload, ctx);
2466
- if (result instanceof Promise) return result.then((result) => {
2467
- payload.value = result.value;
2468
- if (result.issues.length) {
2469
- payload.value = def.catchValue({
2470
- ...payload,
2471
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2472
- input: payload.value
2473
- });
2474
- payload.issues = [];
2475
- payload.fallback = true;
2476
- }
2477
- return payload;
2478
- });
2479
- payload.value = result.value;
2480
- if (result.issues.length) {
2481
- payload.value = def.catchValue({
2482
- ...payload,
2483
- error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
2484
- input: payload.value
2485
- });
2486
- payload.issues = [];
2487
- payload.fallback = true;
2488
- }
2489
- return payload;
2864
+ const result = def.innerType._zod.run({
2865
+ value: payload.value,
2866
+ issues: []
2867
+ }, ctx);
2868
+ if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
2869
+ return handleCatchResult(payload, result, def, ctx);
2490
2870
  };
2491
2871
  });
2492
2872
  const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
2493
2873
  $ZodType.init(inst, def);
2494
- defineLazy(inst._zod, "values", () => def.in._zod.values);
2495
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
2496
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
2497
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
2874
+ defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
2875
+ defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
2876
+ defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
2877
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
2498
2878
  inst._zod.parse = (payload, ctx) => {
2499
2879
  if (ctx.direction === "backward") {
2500
2880
  const right = def.out._zod.run(payload, ctx);
@@ -2507,22 +2887,21 @@ window.__ModuleLoader__.load({
2507
2887
  };
2508
2888
  });
2509
2889
  function handlePipeResult(left, next, ctx) {
2510
- if (left.issues.length) {
2890
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
2511
2891
  left.aborted = true;
2512
2892
  return left;
2513
2893
  }
2514
2894
  return next._zod.run({
2515
2895
  value: left.value,
2516
- issues: left.issues,
2517
- fallback: left.fallback
2896
+ issues: left.issues
2518
2897
  }, ctx);
2519
2898
  }
2520
2899
  const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
2521
2900
  $ZodType.init(inst, def);
2522
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
2523
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
2524
- defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
2525
- defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
2901
+ defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
2902
+ defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
2903
+ defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
2904
+ defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
2526
2905
  inst._zod.parse = (payload, ctx) => {
2527
2906
  if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
2528
2907
  const result = def.innerType._zod.run(payload, ctx);
@@ -2531,37 +2910,362 @@ window.__ModuleLoader__.load({
2531
2910
  };
2532
2911
  });
2533
2912
  function handleReadonlyResult(payload) {
2534
- payload.value = Object.freeze(payload.value);
2913
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
2535
2914
  return payload;
2536
2915
  }
2537
- const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2538
- $ZodCheck.init(inst, def);
2539
- $ZodType.init(inst, def);
2540
- inst._zod.parse = (payload, _) => {
2541
- return payload;
2916
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
2917
+ $ZodCheck.init(inst, def);
2918
+ $ZodType.init(inst, def);
2919
+ inst._zod.parse = (payload, _) => {
2920
+ return payload;
2921
+ };
2922
+ inst._zod.check = (payload) => {
2923
+ const input = payload.value;
2924
+ const r = def.fn(input);
2925
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2926
+ handleRefineResult(r, payload, input, inst);
2927
+ };
2928
+ });
2929
+ function handleRefineResult(result, payload, input, inst) {
2930
+ if (!result) {
2931
+ const _iss = {
2932
+ code: "custom",
2933
+ input,
2934
+ inst,
2935
+ path: [...inst._zod.def.path ?? []],
2936
+ continue: !inst._zod.def.abort
2937
+ };
2938
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2939
+ payload.issues.push(issue(_iss));
2940
+ }
2941
+ }
2942
+ //#endregion
2943
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
2944
+ var $ZodCyclicError = class extends Error {
2945
+ constructor() {
2946
+ super(`Cannot parse a reference cycle that closes through a transform`);
2947
+ this.name = "ZodCyclicError";
2948
+ }
2949
+ };
2950
+ /** Keyed off the context object every schema in one parse call already shares. */
2951
+ const STATE = "~memo";
2952
+ const NO_ISSUES = [];
2953
+ function cloneIssues(issues) {
2954
+ return issues.map((iss) => iss.path ? {
2955
+ ...iss,
2956
+ path: iss.path.slice()
2957
+ } : { ...iss });
2958
+ }
2959
+ const recursive = /*@__PURE__*/ new WeakMap();
2960
+ /** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
2961
+ function isRecursive(inst, stack) {
2962
+ const cached = recursive.get(inst);
2963
+ if (cached !== void 0) return cached;
2964
+ if (stack.has(inst)) return true;
2965
+ stack.add(inst);
2966
+ let result = false;
2967
+ const check = (child) => {
2968
+ if (!result && child?._zod && isRecursive(child, stack)) result = true;
2969
+ };
2970
+ const def = inst._zod.def;
2971
+ switch (def.type) {
2972
+ case "object":
2973
+ for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
2974
+ check(def.catchall);
2975
+ break;
2976
+ case "array":
2977
+ check(def.element);
2978
+ break;
2979
+ case "tuple":
2980
+ for (const el of def.items) check(el);
2981
+ check(def.rest);
2982
+ break;
2983
+ case "record":
2984
+ case "map":
2985
+ check(def.keyType);
2986
+ check(def.valueType);
2987
+ break;
2988
+ case "set":
2989
+ check(def.valueType);
2990
+ break;
2991
+ case "union":
2992
+ for (const el of def.options) check(el);
2993
+ break;
2994
+ case "intersection":
2995
+ check(def.left);
2996
+ check(def.right);
2997
+ break;
2998
+ case "optional":
2999
+ case "nullable":
3000
+ case "default":
3001
+ case "prefault":
3002
+ case "catch":
3003
+ case "readonly":
3004
+ case "nonoptional":
3005
+ case "promise":
3006
+ case "success":
3007
+ check(def.innerType);
3008
+ break;
3009
+ case "pipe":
3010
+ check(def.in);
3011
+ check(def.out);
3012
+ break;
3013
+ case "function":
3014
+ check(def.input);
3015
+ check(def.output);
3016
+ break;
3017
+ case "lazy":
3018
+ check(inst._zod.innerType);
3019
+ break;
3020
+ case "template_literal":
3021
+ case "string":
3022
+ case "number":
3023
+ case "int":
3024
+ case "boolean":
3025
+ case "bigint":
3026
+ case "symbol":
3027
+ case "undefined":
3028
+ case "null":
3029
+ case "void":
3030
+ case "never":
3031
+ case "any":
3032
+ case "unknown":
3033
+ case "date":
3034
+ case "nan":
3035
+ case "enum":
3036
+ case "literal":
3037
+ case "file":
3038
+ case "transform":
3039
+ case "custom": break;
3040
+ default: for (const key in def) {
3041
+ const desc = Object.getOwnPropertyDescriptor(def, key);
3042
+ if (!desc || desc.get) continue;
3043
+ const value = desc.value;
3044
+ if (!value || typeof value !== "object") continue;
3045
+ if (value._zod) check(value);
3046
+ else if (Array.isArray(value)) for (const el of value) check(el);
3047
+ }
3048
+ }
3049
+ stack.delete(inst);
3050
+ recursive.set(inst, result);
3051
+ return result;
3052
+ }
3053
+ function bucketFor(state, inst) {
3054
+ let bucket = state.buckets.get(inst);
3055
+ if (!bucket) {
3056
+ bucket = /* @__PURE__ */ new Map();
3057
+ state.buckets.set(inst, bucket);
3058
+ }
3059
+ return bucket;
3060
+ }
3061
+ let handoff;
3062
+ const open = [];
3063
+ const memo = {
3064
+ alloc(_inst, payload, empty) {
3065
+ const bucket = handoff;
3066
+ if (!bucket) return empty;
3067
+ handoff = void 0;
3068
+ const entry = {
3069
+ value: empty,
3070
+ issues: null
3071
+ };
3072
+ bucket.set(payload.value, entry);
3073
+ open.push(entry);
3074
+ return empty;
3075
+ },
3076
+ guard(inst) {
3077
+ var _a;
3078
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
3079
+ inst._zod.deferred.push(() => {
3080
+ const base = inst._zod.parse;
3081
+ const wrapped = (payload, ctx) => {
3082
+ if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
3083
+ return base(payload, ctx);
3084
+ };
3085
+ inst._zod.parse = wrapped;
3086
+ if (inst._zod.run === base) inst._zod.run = wrapped;
3087
+ });
3088
+ },
3089
+ attach(inst) {
3090
+ var _a;
3091
+ let isRecursiveInst;
3092
+ let lastCtx;
3093
+ let lastBucket;
3094
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
3095
+ inst._zod.deferred.push(() => {
3096
+ const base = inst._zod.parse;
3097
+ const wrapped = (payload, ctx) => {
3098
+ if (isRecursiveInst === void 0) {
3099
+ isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
3100
+ if (!isRecursiveInst) {
3101
+ inst._zod.parse = base;
3102
+ if (inst._zod.run === wrapped) inst._zod.run = base;
3103
+ return base(payload, ctx);
3104
+ }
3105
+ }
3106
+ const input = payload.value;
3107
+ if (input === null || typeof input !== "object") return base(payload, ctx);
3108
+ let state = ctx[STATE];
3109
+ if (!state) {
3110
+ state = {
3111
+ buckets: /* @__PURE__ */ new Map(),
3112
+ backEdges: void 0
3113
+ };
3114
+ ctx[STATE] = state;
3115
+ }
3116
+ let bucket;
3117
+ if (lastCtx === ctx) bucket = lastBucket;
3118
+ else {
3119
+ bucket = bucketFor(state, inst);
3120
+ lastCtx = ctx;
3121
+ lastBucket = bucket;
3122
+ }
3123
+ const hit = bucket.get(input);
3124
+ if (hit) {
3125
+ payload.value = hit.value;
3126
+ if (hit.issues) {
3127
+ if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
3128
+ } else {
3129
+ payload.memo = true;
3130
+ state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
3131
+ state.backEdges.add(hit.value);
3132
+ }
3133
+ return payload;
3134
+ }
3135
+ handoff = bucket;
3136
+ const depth = open.length;
3137
+ const result = base(payload, ctx);
3138
+ handoff = void 0;
3139
+ const entry = open.length > depth ? open.pop() : void 0;
3140
+ if (result instanceof Promise) return result.then((r) => {
3141
+ if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
3142
+ return r;
3143
+ });
3144
+ if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
3145
+ return result;
3146
+ };
3147
+ inst._zod.parse = wrapped;
3148
+ if (inst._zod.run === base) inst._zod.run = wrapped;
3149
+ });
3150
+ }
3151
+ };
3152
+ /** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
3153
+ function memoizer() {
3154
+ return memo;
3155
+ }
3156
+ /** Whether this value is a node a back-edge resolved to before it finished. */
3157
+ function isBackEdge(ctx, value) {
3158
+ const backEdges = ctx[STATE]?.backEdges;
3159
+ return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
3160
+ }
3161
+ //#endregion
3162
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
3163
+ const error = () => {
3164
+ const Sizable = {
3165
+ string: {
3166
+ unit: "characters",
3167
+ verb: "to have"
3168
+ },
3169
+ file: {
3170
+ unit: "bytes",
3171
+ verb: "to have"
3172
+ },
3173
+ array: {
3174
+ unit: "items",
3175
+ verb: "to have"
3176
+ },
3177
+ set: {
3178
+ unit: "items",
3179
+ verb: "to have"
3180
+ },
3181
+ map: {
3182
+ unit: "entries",
3183
+ verb: "to have"
3184
+ }
2542
3185
  };
2543
- inst._zod.check = (payload) => {
2544
- const input = payload.value;
2545
- const r = def.fn(input);
2546
- if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
2547
- handleRefineResult(r, payload, input, inst);
3186
+ function getSizing(origin) {
3187
+ return Sizable[origin] ?? null;
3188
+ }
3189
+ const FormatDictionary = {
3190
+ regex: "input",
3191
+ email: "email address",
3192
+ url: "URL",
3193
+ emoji: "emoji",
3194
+ uuid: "UUID",
3195
+ uuidv4: "UUIDv4",
3196
+ uuidv6: "UUIDv6",
3197
+ nanoid: "nanoid",
3198
+ guid: "GUID",
3199
+ cuid: "cuid",
3200
+ cuid2: "cuid2",
3201
+ ulid: "ULID",
3202
+ xid: "XID",
3203
+ ksuid: "KSUID",
3204
+ datetime: "ISO datetime",
3205
+ date: "ISO date",
3206
+ time: "ISO time",
3207
+ duration: "ISO duration",
3208
+ ipv4: "IPv4 address",
3209
+ ipv6: "IPv6 address",
3210
+ mac: "MAC address",
3211
+ cidrv4: "IPv4 range",
3212
+ cidrv6: "IPv6 range",
3213
+ base64: "base64-encoded string",
3214
+ base64url: "base64url-encoded string",
3215
+ json_string: "JSON string",
3216
+ e164: "E.164 number",
3217
+ credit_card: "credit card number",
3218
+ jwt: "JWT",
3219
+ template_literal: "input"
2548
3220
  };
2549
- });
2550
- function handleRefineResult(result, payload, input, inst) {
2551
- if (!result) {
2552
- const _iss = {
2553
- code: "custom",
2554
- input,
2555
- inst,
2556
- path: [...inst._zod.def.path ?? []],
2557
- continue: !inst._zod.def.abort
2558
- };
2559
- if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2560
- payload.issues.push(issue(_iss));
3221
+ const TypeDictionary = { nan: "NaN" };
3222
+ function getTypeName(type, input) {
3223
+ if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
3224
+ return TypeDictionary[type] ?? type;
2561
3225
  }
3226
+ return (issue) => {
3227
+ switch (issue.code) {
3228
+ case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
3229
+ case "invalid_value":
3230
+ if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
3231
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
3232
+ case "too_big": {
3233
+ const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
3234
+ const sizing = getSizing(issue.origin);
3235
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
3236
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
3237
+ }
3238
+ case "too_small": {
3239
+ const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
3240
+ const sizing = getSizing(issue.origin);
3241
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
3242
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
3243
+ }
3244
+ case "invalid_format": {
3245
+ const _issue = issue;
3246
+ if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
3247
+ if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
3248
+ if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
3249
+ if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
3250
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
3251
+ }
3252
+ case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
3253
+ case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
3254
+ case "invalid_key": return `Invalid key in ${issue.origin}`;
3255
+ case "invalid_union":
3256
+ if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
3257
+ if (issue.inclusive === false) return "Invalid input: more than one option matched";
3258
+ return "Invalid input";
3259
+ case "invalid_element": return `Invalid value in ${issue.origin}`;
3260
+ default: return `Invalid input`;
3261
+ }
3262
+ };
3263
+ };
3264
+ function en_default() {
3265
+ return { localeError: error() };
2562
3266
  }
2563
3267
  //#endregion
2564
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
3268
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
2565
3269
  var _a;
2566
3270
  var $ZodRegistry = class {
2567
3271
  constructor() {
@@ -2608,7 +3312,7 @@ window.__ModuleLoader__.load({
2608
3312
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2609
3313
  const globalRegistry = globalThis.__zod_globalRegistry;
2610
3314
  //#endregion
2611
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
3315
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
2612
3316
  // @__NO_SIDE_EFFECTS__
2613
3317
  function _string(Class, params) {
2614
3318
  return new Class({
@@ -3093,7 +3797,7 @@ window.__ModuleLoader__.load({
3093
3797
  const _issue = issue$2;
3094
3798
  if (_issue.fatal) _issue.continue = false;
3095
3799
  _issue.code ?? (_issue.code = "custom");
3096
- _issue.input ?? (_issue.input = payload.value);
3800
+ if (!("input" in _issue)) _issue.input = payload.value;
3097
3801
  _issue.inst ?? (_issue.inst = ch);
3098
3802
  _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
3099
3803
  payload.issues.push(issue(_issue));
@@ -3113,7 +3817,11 @@ window.__ModuleLoader__.load({
3113
3817
  return ch;
3114
3818
  }
3115
3819
  //#endregion
3116
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
3820
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
3821
+ function assignProps(target, ...sources) {
3822
+ for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
3823
+ return target;
3824
+ }
3117
3825
  function initializeContext(params) {
3118
3826
  let target = params?.target ?? "draft-2020-12";
3119
3827
  if (target === "draft-4") target = "draft-04";
@@ -3127,11 +3835,31 @@ window.__ModuleLoader__.load({
3127
3835
  io: params?.io ?? "output",
3128
3836
  counter: 0,
3129
3837
  seen: /* @__PURE__ */ new Map(),
3838
+ sharedDefsExtractedFor: void 0,
3839
+ sharedEmitDoneFor: void 0,
3130
3840
  cycles: params?.cycles ?? "ref",
3131
3841
  reused: params?.reused ?? "inline",
3842
+ intersections: [],
3843
+ deferred: [],
3132
3844
  external: params?.external ?? void 0
3133
3845
  };
3134
3846
  }
3847
+ /**
3848
+ * Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
3849
+ * `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
3850
+ * custom JSON Schema was written into `json`, in which case the caller must not write its own.
3851
+ */
3852
+ function handleUnrepresentable(schema, ctx, json, params, message) {
3853
+ const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
3854
+ zodSchema: schema,
3855
+ path: params.path,
3856
+ message
3857
+ }) : ctx.unrepresentable;
3858
+ if (result === "any") return false;
3859
+ if (result === void 0 || result === "throw") throw new Error(message);
3860
+ Object.assign(json, result);
3861
+ return true;
3862
+ }
3135
3863
  function process(schema, ctx, _params = {
3136
3864
  path: [],
3137
3865
  schemaPath: []
@@ -3151,6 +3879,8 @@ window.__ModuleLoader__.load({
3151
3879
  path: _params.path
3152
3880
  };
3153
3881
  ctx.seen.set(schema, result);
3882
+ ctx.sharedDefsExtractedFor = void 0;
3883
+ ctx.sharedEmitDoneFor = void 0;
3154
3884
  const overrideSchema = schema._zod.toJSONSchema?.();
3155
3885
  if (overrideSchema) result.schema = overrideSchema;
3156
3886
  else {
@@ -3174,7 +3904,7 @@ window.__ModuleLoader__.load({
3174
3904
  }
3175
3905
  }
3176
3906
  const meta = ctx.metadataRegistry.get(schema);
3177
- if (meta) Object.assign(result.schema, meta);
3907
+ if (meta) assignProps(result.schema, meta);
3178
3908
  if (ctx.io === "input" && isTransforming(schema)) {
3179
3909
  delete result.schema.examples;
3180
3910
  delete result.schema.default;
@@ -3183,9 +3913,13 @@ window.__ModuleLoader__.load({
3183
3913
  delete result.schema._prefault;
3184
3914
  return ctx.seen.get(schema).schema;
3185
3915
  }
3916
+ function encodeJSONPointerSegment(segment) {
3917
+ return segment.replace(/~/g, "~0").replace(/\//g, "~1");
3918
+ }
3186
3919
  function extractDefs(ctx, schema) {
3187
3920
  const root = ctx.seen.get(schema);
3188
3921
  if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
3922
+ if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
3189
3923
  const idToSchema = /* @__PURE__ */ new Map();
3190
3924
  for (const entry of ctx.seen.entries()) {
3191
3925
  const id = ctx.metadataRegistry.get(entry[0])?.id;
@@ -3205,15 +3939,16 @@ window.__ModuleLoader__.load({
3205
3939
  entry[1].defId = id;
3206
3940
  return {
3207
3941
  defId: id,
3208
- ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
3942
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
3209
3943
  };
3210
3944
  }
3211
- if (entry[1] === root) return { ref: "#" };
3212
- const defUriPrefix = `#/${defsSegment}/`;
3945
+ const uriPrefix = `#`;
3946
+ const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
3947
+ if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
3213
3948
  const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
3214
3949
  return {
3215
3950
  defId,
3216
- ref: defUriPrefix + defId
3951
+ ref: defUriPrefix + encodeJSONPointerSegment(defId)
3217
3952
  };
3218
3953
  };
3219
3954
  const extractToDef = (entry) => {
@@ -3260,6 +3995,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3260
3995
  }
3261
3996
  }
3262
3997
  }
3998
+ if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
3999
+ }
4000
+ /** 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. */
4001
+ function compactTypeUnion(schema) {
4002
+ const options = schema.anyOf;
4003
+ if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
4004
+ const types = [];
4005
+ for (const option of options) {
4006
+ if (!option || typeof option !== "object") return;
4007
+ compactTypeUnion(option);
4008
+ const keys = Object.keys(option);
4009
+ if (keys.length !== 1 || keys[0] !== "type") return;
4010
+ const type = option.type;
4011
+ for (const member of Array.isArray(type) ? type : [type]) {
4012
+ if (typeof member !== "string") return;
4013
+ if (!types.includes(member)) types.push(member);
4014
+ }
4015
+ }
4016
+ delete schema.anyOf;
4017
+ schema.type = types.length === 1 ? types[0] : types;
4018
+ }
4019
+ /** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
4020
+ * an annotation like `description` — makes a member unfoldable, so a constraint this does not
4021
+ * understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
4022
+ const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
4023
+ "type",
4024
+ "properties",
4025
+ "required",
4026
+ "additionalProperties"
4027
+ ]);
4028
+ const UNION_KEYS = ["oneOf", "anyOf"];
4029
+ /** 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. */
4030
+ function undeclaredConstraint(member) {
4031
+ const extra = member.additionalProperties;
4032
+ if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
4033
+ return Object.keys(extra).length ? extra : null;
4034
+ }
4035
+ /** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
4036
+ function foldObjects(members) {
4037
+ const objects = [];
4038
+ for (const member of members) {
4039
+ if (typeof member !== "object" || member.type !== "object") return null;
4040
+ for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
4041
+ objects.push(member);
4042
+ }
4043
+ const properties = {};
4044
+ const required = /* @__PURE__ */ new Set();
4045
+ for (const object of objects) {
4046
+ for (const key in object.properties) {
4047
+ if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
4048
+ const parts = [];
4049
+ for (const other of objects) {
4050
+ const part = other.properties?.[key] ?? undeclaredConstraint(other);
4051
+ if (part === null || part === void 0) continue;
4052
+ if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
4053
+ }
4054
+ assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
4055
+ }
4056
+ for (const key of object.required ?? []) required.add(key);
4057
+ }
4058
+ const folded = {
4059
+ type: "object",
4060
+ properties
4061
+ };
4062
+ if (required.size) folded.required = [...required];
4063
+ if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
4064
+ else {
4065
+ const constraints = [];
4066
+ for (const object of objects) {
4067
+ const constraint = undeclaredConstraint(object);
4068
+ if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
4069
+ }
4070
+ if (constraints.length === 1) folded.additionalProperties = constraints[0];
4071
+ else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
4072
+ }
4073
+ return folded;
4074
+ }
4075
+ /** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
4076
+ * closed object members reject each other's keys and the schema validates nothing. Zod's parser
4077
+ * pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
4078
+ * *every* side rejects it — so the emitted schema has to pool them too, and folding the members
4079
+ * into one object is the encoding that says so on every target.
4080
+ *
4081
+ * This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
4082
+ * machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
4083
+ * keeps its reference and its own closedness rather than being inlined as a stale copy. */
4084
+ function foldIntersection(json) {
4085
+ const allOf = json.allOf;
4086
+ if (!Array.isArray(allOf) || allOf.length < 2) return;
4087
+ for (const key of FOLDABLE_KEYS) if (key in json) return;
4088
+ const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
4089
+ let folded = null;
4090
+ if (!unions.length) folded = foldObjects(allOf);
4091
+ else {
4092
+ const union = unions[0];
4093
+ const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
4094
+ if (Object.keys(union).length !== 1) return;
4095
+ const rest = allOf.filter((m) => m !== union);
4096
+ const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
4097
+ if (branches.some((b) => !b)) return;
4098
+ folded = { [keyword]: branches };
4099
+ }
4100
+ if (!folded) return;
4101
+ delete json.allOf;
4102
+ assignProps(json, folded);
3263
4103
  }
3264
4104
  function finalize(ctx, schema) {
3265
4105
  const root = ctx.seen.get(schema);
@@ -3278,8 +4118,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3278
4118
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
3279
4119
  schema.allOf = schema.allOf ?? [];
3280
4120
  schema.allOf.push(refSchema);
3281
- } else Object.assign(schema, refSchema);
3282
- Object.assign(schema, _cached);
4121
+ } else assignProps(schema, refSchema);
4122
+ assignProps(schema, _cached);
3283
4123
  if (zodSchema._zod.parent === ref) for (const key in schema) {
3284
4124
  if (key === "$ref" || key === "allOf") continue;
3285
4125
  if (!(key in _cached)) delete schema[key];
@@ -3307,7 +4147,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3307
4147
  path: seen.path ?? []
3308
4148
  });
3309
4149
  };
3310
- for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
4150
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
4151
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
4152
+ if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
4153
+ for (const rewrite of ctx.deferred) rewrite();
4154
+ if (ctx.intersections.length) {
4155
+ const carriers = /* @__PURE__ */ new Map();
4156
+ for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
4157
+ const allOf = json?.allOf;
4158
+ if (!Array.isArray(allOf)) continue;
4159
+ const existing = carriers.get(allOf);
4160
+ if (existing) existing.push(json);
4161
+ else carriers.set(allOf, [json]);
4162
+ }
4163
+ for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
4164
+ }
4165
+ }
3311
4166
  const result = {};
3312
4167
  if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
3313
4168
  else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
@@ -3318,17 +4173,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3318
4173
  if (!id) throw new Error("Schema is missing an `id` property");
3319
4174
  result.$id = ctx.external.uri(id);
3320
4175
  }
3321
- Object.assign(result, root.def ?? root.schema);
4176
+ assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
3322
4177
  const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
3323
4178
  if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
3324
4179
  const defs = ctx.external?.defs ?? {};
3325
- for (const entry of ctx.seen.entries()) {
4180
+ if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
3326
4181
  const seen = entry[1];
3327
4182
  if (seen.def && seen.defId) {
3328
4183
  if (seen.def.id === seen.defId) delete seen.def.id;
3329
- defs[seen.defId] = seen.def;
4184
+ assignProp(defs, seen.defId, seen.def);
3330
4185
  }
3331
4186
  }
4187
+ if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
3332
4188
  if (ctx.external) {} else if (Object.keys(defs).length > 0) {
3333
4189
  if (ctx.target === "draft-2020-12") result.$defs = defs;
3334
4190
  else result.definitions = defs;
@@ -3360,7 +4216,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3360
4216
  if (def.type === "array") return isTransforming(def.element, ctx);
3361
4217
  if (def.type === "set") return isTransforming(def.valueType, ctx);
3362
4218
  if (def.type === "lazy") return isTransforming(def.getter(), ctx);
3363
- 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);
4219
+ 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);
3364
4220
  if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
3365
4221
  if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
3366
4222
  if (def.type === "pipe") {
@@ -3408,7 +4264,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3408
4264
  return finalize(ctx, schema);
3409
4265
  };
3410
4266
  //#endregion
3411
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
4267
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
3412
4268
  const formatMap = {
3413
4269
  guid: "uuid",
3414
4270
  url: "uri",
@@ -3419,25 +4275,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3419
4275
  const stringProcessor = (schema, ctx, _json, _params) => {
3420
4276
  const json = _json;
3421
4277
  json.type = "string";
3422
- const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
4278
+ const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
3423
4279
  if (typeof minimum === "number") json.minLength = minimum;
3424
4280
  if (typeof maximum === "number") json.maxLength = maximum;
3425
4281
  if (format) {
3426
4282
  json.format = formatMap[format] ?? format;
3427
4283
  if (json.format === "") delete json.format;
3428
- if (format === "time") delete json.format;
4284
+ if (format === "time" || laxFormat) delete json.format;
3429
4285
  }
3430
4286
  if (contentEncoding) json.contentEncoding = contentEncoding;
3431
4287
  if (patterns && patterns.size > 0) {
3432
- const regexes = [...patterns];
3433
- if (regexes.length === 1) json.pattern = regexes[0].source;
3434
- else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
4288
+ const patternList = [...patterns];
4289
+ if (patternList.length === 1) json.pattern = patternList[0].source;
4290
+ else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
3435
4291
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
3436
4292
  pattern: regex.source
3437
4293
  }))];
3438
4294
  }
3439
4295
  };
3440
- const numberProcessor = (schema, ctx, _json, _params) => {
4296
+ const numberProcessor = (schema, ctx, _json, params) => {
3441
4297
  const json = _json;
3442
4298
  const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
3443
4299
  if (typeof format === "string" && format.includes("int")) json.type = "integer";
@@ -3457,7 +4313,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3457
4313
  json.exclusiveMaximum = true;
3458
4314
  } else json.exclusiveMaximum = exclusiveMaximum;
3459
4315
  } else if (typeof maximum === "number") json.maximum = maximum;
3460
- if (typeof multipleOf === "number") json.multipleOf = multipleOf;
4316
+ if (typeof multipleOf === "number") {
4317
+ if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
4318
+ else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
4319
+ }
3461
4320
  };
3462
4321
  const booleanProcessor = (_schema, _ctx, json, _params) => {
3463
4322
  json.type = "boolean";
@@ -3468,18 +4327,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3468
4327
  const enumProcessor = (schema, _ctx, json, _params) => {
3469
4328
  const def = schema._zod.def;
3470
4329
  const values = getEnumValues(def.entries);
4330
+ if (values.length === 0) {
4331
+ json.not = {};
4332
+ return;
4333
+ }
3471
4334
  if (values.every((v) => typeof v === "number")) json.type = "number";
3472
4335
  if (values.every((v) => typeof v === "string")) json.type = "string";
3473
4336
  json.enum = values;
3474
4337
  };
3475
- const literalProcessor = (schema, ctx, json, _params) => {
4338
+ const literalProcessor = (schema, ctx, json, params) => {
3476
4339
  const def = schema._zod.def;
4340
+ if (def.values.length === 0) {
4341
+ json.not = {};
4342
+ return;
4343
+ }
3477
4344
  const vals = [];
3478
4345
  for (const val of def.values) if (val === void 0) {
3479
- if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
4346
+ if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
3480
4347
  } else if (typeof val === "bigint") {
3481
- if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
3482
- else vals.push(Number(val));
4348
+ if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
4349
+ vals.push(Number(val));
3483
4350
  } else vals.push(val);
3484
4351
  if (vals.length === 0) {} else if (vals.length === 1) {
3485
4352
  const val = vals[0];
@@ -3494,11 +4361,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3494
4361
  json.enum = vals;
3495
4362
  }
3496
4363
  };
3497
- const customProcessor = (_schema, ctx, _json, _params) => {
3498
- if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
4364
+ const customProcessor = (schema, ctx, json, params) => {
4365
+ handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
3499
4366
  };
3500
- const transformProcessor = (_schema, ctx, _json, _params) => {
3501
- if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
4367
+ const transformProcessor = (schema, ctx, json, params) => {
4368
+ handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
3502
4369
  };
3503
4370
  const arrayProcessor = (schema, ctx, _json, params) => {
3504
4371
  const json = _json;
@@ -3512,25 +4379,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3512
4379
  path: [...params.path, "items"]
3513
4380
  });
3514
4381
  };
4382
+ function inputOptin(schema) {
4383
+ const def = schema._zod.def;
4384
+ if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
4385
+ if (def.type === "catch") return inputOptin(def.innerType);
4386
+ return schema._zod.optin;
4387
+ }
3515
4388
  const objectProcessor = (schema, ctx, _json, params) => {
3516
4389
  const json = _json;
3517
4390
  const def = schema._zod.def;
4391
+ const shape = def.shape;
4392
+ if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
3518
4393
  json.type = "object";
3519
4394
  json.properties = {};
3520
- const shape = def.shape;
3521
- for (const key in shape) json.properties[key] = process(shape[key], ctx, {
4395
+ for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
3522
4396
  ...params,
3523
4397
  path: [
3524
4398
  ...params.path,
3525
4399
  "properties",
3526
4400
  key
3527
4401
  ]
3528
- });
4402
+ }));
3529
4403
  const allKeys = new Set(Object.keys(shape));
3530
4404
  const requiredKeys = new Set([...allKeys].filter((key) => {
3531
- const v = def.shape[key]._zod;
3532
- if (ctx.io === "input") return v.optin === void 0;
3533
- else return v.optout === void 0;
4405
+ const field = def.shape[key];
4406
+ if (ctx.io === "input") return inputOptin(field) === void 0;
4407
+ else return field._zod.optout === void 0;
3534
4408
  }));
3535
4409
  if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
3536
4410
  if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
@@ -3574,7 +4448,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3574
4448
  ]
3575
4449
  });
3576
4450
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3577
- json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4451
+ const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
4452
+ json.allOf = allOf;
4453
+ ctx.intersections.push(allOf);
3578
4454
  };
3579
4455
  const nullableProcessor = (schema, ctx, json, params) => {
3580
4456
  const def = schema._zod.def;
@@ -3591,19 +4467,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3591
4467
  const seen = ctx.seen.get(schema);
3592
4468
  seen.ref = def.innerType;
3593
4469
  };
4470
+ /** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
4471
+ * A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
4472
+ * unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
4473
+ const UNREPRESENTABLE_DEFAULT = Symbol();
4474
+ function serializeDefaultValue(value, schema, ctx, json, params) {
4475
+ let unrepresentable = false;
4476
+ const serialized = JSON.stringify(value, (_, val) => {
4477
+ if (typeof val !== "bigint") return val;
4478
+ unrepresentable = true;
4479
+ return null;
4480
+ });
4481
+ if (!unrepresentable) return JSON.parse(serialized);
4482
+ handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
4483
+ return UNREPRESENTABLE_DEFAULT;
4484
+ }
3594
4485
  const defaultProcessor = (schema, ctx, json, params) => {
3595
4486
  const def = schema._zod.def;
3596
4487
  process(def.innerType, ctx, params);
3597
4488
  const seen = ctx.seen.get(schema);
3598
4489
  seen.ref = def.innerType;
3599
- json.default = JSON.parse(JSON.stringify(def.defaultValue));
4490
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4491
+ if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
3600
4492
  };
3601
4493
  const prefaultProcessor = (schema, ctx, json, params) => {
3602
4494
  const def = schema._zod.def;
3603
4495
  process(def.innerType, ctx, params);
3604
4496
  const seen = ctx.seen.get(schema);
3605
4497
  seen.ref = def.innerType;
3606
- if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
4498
+ if (ctx.io !== "input") return;
4499
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
4500
+ if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
3607
4501
  };
3608
4502
  const catchProcessor = (schema, ctx, json, params) => {
3609
4503
  const def = schema._zod.def;
@@ -3614,7 +4508,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3614
4508
  try {
3615
4509
  catchValue = def.catchValue(void 0);
3616
4510
  } catch {
3617
- throw new Error("Dynamic catch values are not supported in JSON Schema");
4511
+ handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
4512
+ return;
3618
4513
  }
3619
4514
  json.default = catchValue;
3620
4515
  };
@@ -3640,59 +4535,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3640
4535
  seen.ref = def.innerType;
3641
4536
  };
3642
4537
  //#endregion
3643
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
3644
- const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
3645
- $ZodISODateTime.init(inst, def);
3646
- ZodStringFormat.init(inst, def);
3647
- });
3648
- function datetime(params) {
3649
- return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
3650
- }
3651
- const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
3652
- $ZodISODate.init(inst, def);
3653
- ZodStringFormat.init(inst, def);
3654
- });
3655
- function date(params) {
3656
- return /* @__PURE__ */ _isoDate(ZodISODate, params);
3657
- }
3658
- const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
3659
- $ZodISOTime.init(inst, def);
3660
- ZodStringFormat.init(inst, def);
3661
- });
3662
- function time(params) {
3663
- return /* @__PURE__ */ _isoTime(ZodISOTime, params);
3664
- }
3665
- const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
3666
- $ZodISODuration.init(inst, def);
3667
- ZodStringFormat.init(inst, def);
3668
- });
3669
- function duration(params) {
3670
- return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
4538
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
4539
+ const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
4540
+ function _lazyMethod(proto, key, make) {
4541
+ Object.defineProperty(proto, key, {
4542
+ configurable: true,
4543
+ enumerable: false,
4544
+ get() {
4545
+ const value = make(this);
4546
+ Object.defineProperty(this, key, {
4547
+ value,
4548
+ configurable: true,
4549
+ writable: true
4550
+ });
4551
+ return value;
4552
+ },
4553
+ set(value) {
4554
+ Object.defineProperty(this, key, {
4555
+ value,
4556
+ configurable: true,
4557
+ writable: true
4558
+ });
4559
+ }
4560
+ });
3671
4561
  }
3672
- //#endregion
3673
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
3674
4562
  const initializer = (inst, issues) => {
3675
4563
  $ZodError.init(inst, issues);
3676
4564
  inst.name = "ZodError";
3677
- Object.defineProperties(inst, {
3678
- format: { value: (mapper) => formatError(inst, mapper) },
3679
- flatten: { value: (mapper) => flattenError(inst, mapper) },
3680
- addIssue: { value: (issue) => {
3681
- inst.issues.push(issue);
3682
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3683
- } },
3684
- addIssues: { value: (issues) => {
3685
- inst.issues.push(...issues);
3686
- inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3687
- } },
3688
- isEmpty: { get() {
3689
- return inst.issues.length === 0;
3690
- } }
4565
+ const proto = Object.getPrototypeOf(inst);
4566
+ if (_installedErrorProtos.has(proto)) return;
4567
+ _installedErrorProtos.add(proto);
4568
+ _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
4569
+ _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
4570
+ _lazyMethod(proto, "addIssue", (self) => (issue) => {
4571
+ self.issues.push(issue);
4572
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4573
+ });
4574
+ _lazyMethod(proto, "addIssues", (self) => (issues) => {
4575
+ self.issues.push(...issues);
4576
+ self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
4577
+ });
4578
+ Object.defineProperty(proto, "isEmpty", {
4579
+ configurable: true,
4580
+ enumerable: false,
4581
+ get() {
4582
+ return this.issues.length === 0;
4583
+ }
3691
4584
  });
3692
4585
  };
3693
- const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
4586
+ const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
3694
4587
  //#endregion
3695
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
4588
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
3696
4589
  const parse = /* @__PURE__ */ _parse(ZodRealError);
3697
4590
  const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3698
4591
  const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -3706,167 +4599,175 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3706
4599
  const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3707
4600
  const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3708
4601
  //#endregion
3709
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
3710
- const _installedGroups = /* @__PURE__ */ new WeakMap();
3711
- function _installLazyMethods(inst, group, methods) {
3712
- const proto = Object.getPrototypeOf(inst);
3713
- let installed = _installedGroups.get(proto);
3714
- if (!installed) {
3715
- installed = /* @__PURE__ */ new Set();
3716
- _installedGroups.set(proto, installed);
3717
- }
3718
- if (installed.has(group)) return;
3719
- installed.add(group);
3720
- for (const key in methods) {
3721
- const fn = methods[key];
3722
- Object.defineProperty(proto, key, {
3723
- configurable: true,
3724
- enumerable: false,
3725
- get() {
3726
- const bound = fn.bind(this);
3727
- Object.defineProperty(this, key, {
3728
- configurable: true,
3729
- writable: true,
3730
- enumerable: true,
3731
- value: bound
3732
- });
3733
- return bound;
3734
- },
3735
- set(v) {
3736
- Object.defineProperty(this, key, {
3737
- configurable: true,
3738
- writable: true,
3739
- enumerable: true,
3740
- value: v
3741
- });
3742
- }
3743
- });
3744
- }
4602
+ //#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
4603
+ function _ensureDefaultLocale() {
4604
+ if (!globalConfig.localeError) config(en_default());
4605
+ }
4606
+ function _ensureDefaultMemoizer() {
4607
+ if (!globalConfig.memoizer) config({ memoizer: memoizer() });
3745
4608
  }
3746
4609
  const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
4610
+ _ensureDefaultLocale();
3747
4611
  $ZodType.init(inst, def);
3748
- Object.assign(inst["~standard"], { jsonSchema: {
3749
- input: createStandardJSONSchemaMethod(inst, "input"),
3750
- output: createStandardJSONSchemaMethod(inst, "output")
3751
- } });
3752
- inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3753
4612
  inst.def = def;
3754
4613
  inst.type = def.type;
3755
- Object.defineProperty(inst, "_def", { value: def });
3756
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3757
- inst.safeParse = (data, params) => safeParse(inst, data, params);
3758
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3759
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3760
- inst.spa = inst.safeParseAsync;
3761
- inst.encode = (data, params) => encode(inst, data, params);
3762
- inst.decode = (data, params) => decode(inst, data, params);
3763
- inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3764
- inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3765
- inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3766
- inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3767
- inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3768
- inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3769
- _installLazyMethods(inst, "ZodType", {
3770
- check(...chks) {
3771
- const def = this.def;
3772
- return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
3773
- check: ch,
3774
- def: { check: "custom" },
3775
- onattach: []
3776
- } } : ch)] }), { parent: true });
3777
- },
3778
- with(...chks) {
3779
- return this.check(...chks);
3780
- },
3781
- clone(def, params) {
3782
- return clone(this, def, params);
3783
- },
3784
- brand() {
3785
- return this;
3786
- },
3787
- register(reg, meta) {
3788
- reg.add(this, meta);
3789
- return this;
3790
- },
3791
- refine(check, params) {
3792
- return this.check(refine(check, params));
3793
- },
3794
- superRefine(refinement, params) {
3795
- return this.check(superRefine(refinement, params));
3796
- },
3797
- overwrite(fn) {
3798
- return this.check(/* @__PURE__ */ _overwrite(fn));
3799
- },
3800
- optional() {
3801
- return optional(this);
3802
- },
3803
- exactOptional() {
3804
- return exactOptional(this);
3805
- },
3806
- nullable() {
3807
- return nullable(this);
3808
- },
3809
- nullish() {
3810
- return optional(nullable(this));
3811
- },
3812
- nonoptional(params) {
3813
- return nonoptional(this, params);
3814
- },
3815
- array() {
3816
- return array(this);
3817
- },
3818
- or(arg) {
3819
- return union([this, arg]);
3820
- },
3821
- and(arg) {
3822
- return intersection(this, arg);
3823
- },
3824
- transform(tx) {
3825
- return pipe(this, transform(tx));
3826
- },
3827
- default(d) {
3828
- return _default(this, d);
3829
- },
3830
- prefault(d) {
3831
- return prefault(this, d);
3832
- },
3833
- catch(params) {
3834
- return _catch(this, params);
3835
- },
3836
- pipe(target) {
3837
- return pipe(this, target);
3838
- },
3839
- readonly() {
3840
- return readonly(this);
3841
- },
3842
- describe(description) {
3843
- const cl = this.clone();
3844
- globalRegistry.add(cl, { description });
3845
- return cl;
3846
- },
3847
- meta(...args) {
3848
- if (args.length === 0) return globalRegistry.get(this);
3849
- const cl = this.clone();
3850
- globalRegistry.add(cl, args[0]);
3851
- return cl;
3852
- },
3853
- isOptional() {
3854
- return this.safeParse(void 0).success;
3855
- },
3856
- isNullable() {
3857
- return this.safeParse(null).success;
3858
- },
3859
- apply(fn) {
3860
- return fn(this);
3861
- }
3862
- });
3863
- Object.defineProperty(inst, "description", {
3864
- get() {
3865
- return globalRegistry.get(inst)?.description;
3866
- },
3867
- configurable: true
3868
- });
3869
4614
  return inst;
4615
+ }, {
4616
+ check(...chks) {
4617
+ const def = this.def;
4618
+ return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
4619
+ check: ch,
4620
+ def: { check: "custom" },
4621
+ onattach: []
4622
+ } } : ch)] }), { parent: true });
4623
+ },
4624
+ with(...chks) {
4625
+ return this.check(...chks);
4626
+ },
4627
+ clone(def, params) {
4628
+ return clone(this, def, params);
4629
+ },
4630
+ brand() {
4631
+ return this;
4632
+ },
4633
+ register(reg, meta) {
4634
+ reg.add(this, meta);
4635
+ return this;
4636
+ },
4637
+ refine(check, params) {
4638
+ return this.check(refine(check, params));
4639
+ },
4640
+ superRefine(refinement, params) {
4641
+ return this.check(superRefine(refinement, params));
4642
+ },
4643
+ overwrite(fn) {
4644
+ return this.check(/* @__PURE__ */ _overwrite(fn));
4645
+ },
4646
+ optional() {
4647
+ return optional(this);
4648
+ },
4649
+ exactOptional() {
4650
+ return exactOptional(this);
4651
+ },
4652
+ nullable() {
4653
+ return nullable(this);
4654
+ },
4655
+ nullish() {
4656
+ return optional(nullable(this));
4657
+ },
4658
+ nonoptional(params) {
4659
+ return nonoptional(this, params);
4660
+ },
4661
+ array() {
4662
+ return array(this);
4663
+ },
4664
+ or(arg) {
4665
+ return union([this, arg]);
4666
+ },
4667
+ and(arg) {
4668
+ return intersection(this, arg);
4669
+ },
4670
+ transform(tx) {
4671
+ return pipe(this, transform(tx));
4672
+ },
4673
+ default(d) {
4674
+ return _default(this, d);
4675
+ },
4676
+ prefault(d) {
4677
+ return prefault(this, d);
4678
+ },
4679
+ catch(params) {
4680
+ return _catch(this, params);
4681
+ },
4682
+ pipe(target) {
4683
+ return pipe(this, target);
4684
+ },
4685
+ readonly() {
4686
+ return readonly(this);
4687
+ },
4688
+ describe(description) {
4689
+ const cl = this.clone();
4690
+ globalRegistry.add(cl, { description });
4691
+ return cl;
4692
+ },
4693
+ meta(...args) {
4694
+ if (args.length === 0) return globalRegistry.get(this);
4695
+ const cl = this.clone();
4696
+ globalRegistry.add(cl, args[0]);
4697
+ return cl;
4698
+ },
4699
+ isOptional() {
4700
+ return this.safeParse(void 0).success;
4701
+ },
4702
+ isNullable() {
4703
+ return this.safeParse(null).success;
4704
+ },
4705
+ apply(fn, ...args) {
4706
+ return args.length === 0 ? fn(this) : fn(this, ...args);
4707
+ },
4708
+ get "~standard"() {
4709
+ return hide(this, "~standard", {
4710
+ ...standardProps(this),
4711
+ jsonSchema: {
4712
+ input: createStandardJSONSchemaMethod(this, "input"),
4713
+ output: createStandardJSONSchemaMethod(this, "output")
4714
+ }
4715
+ });
4716
+ },
4717
+ set "~standard"(value) {
4718
+ own(this, "~standard", value);
4719
+ },
4720
+ parse: function _parse(data, params) {
4721
+ return parse(this, data, params, { callee: _parse });
4722
+ },
4723
+ parseAsync: async function _parseAsync(data, params) {
4724
+ return await parseAsync(this, data, params, { callee: _parseAsync });
4725
+ },
4726
+ safeParse(data, params) {
4727
+ return safeParse(this, data, params);
4728
+ },
4729
+ async safeParseAsync(data, params) {
4730
+ return safeParseAsync(this, data, params);
4731
+ },
4732
+ get spa() {
4733
+ return this?.safeParseAsync;
4734
+ },
4735
+ set spa(value) {
4736
+ own(this, "spa", value);
4737
+ },
4738
+ encode: function _encode(data, params) {
4739
+ return encode(this, data, params, { callee: _encode });
4740
+ },
4741
+ decode: function _decode(data, params) {
4742
+ return decode(this, data, params, { callee: _decode });
4743
+ },
4744
+ encodeAsync: async function _encodeAsync(data, params) {
4745
+ return await encodeAsync(this, data, params, { callee: _encodeAsync });
4746
+ },
4747
+ decodeAsync: async function _decodeAsync(data, params) {
4748
+ return await decodeAsync(this, data, params, { callee: _decodeAsync });
4749
+ },
4750
+ safeEncode(data, params) {
4751
+ return safeEncode(this, data, params);
4752
+ },
4753
+ safeDecode(data, params) {
4754
+ return safeDecode(this, data, params);
4755
+ },
4756
+ async safeEncodeAsync(data, params) {
4757
+ return safeEncodeAsync(this, data, params);
4758
+ },
4759
+ async safeDecodeAsync(data, params) {
4760
+ return safeDecodeAsync(this, data, params);
4761
+ },
4762
+ toJSONSchema(params) {
4763
+ return createToJSONSchemaMethod(this, {})(params);
4764
+ },
4765
+ get description() {
4766
+ return globalRegistry.get(this)?.description;
4767
+ },
4768
+ get _def() {
4769
+ return this._zod.def;
4770
+ }
3870
4771
  });
3871
4772
  /** @internal */
3872
4773
  const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
@@ -3877,84 +4778,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3877
4778
  inst.format = bag.format ?? null;
3878
4779
  inst.minLength = bag.minimum ?? null;
3879
4780
  inst.maxLength = bag.maximum ?? null;
3880
- _installLazyMethods(inst, "_ZodString", {
3881
- regex(...args) {
3882
- return this.check(/* @__PURE__ */ _regex(...args));
3883
- },
3884
- includes(...args) {
3885
- return this.check(/* @__PURE__ */ _includes(...args));
3886
- },
3887
- startsWith(...args) {
3888
- return this.check(/* @__PURE__ */ _startsWith(...args));
3889
- },
3890
- endsWith(...args) {
3891
- return this.check(/* @__PURE__ */ _endsWith(...args));
3892
- },
3893
- min(...args) {
3894
- return this.check(/* @__PURE__ */ _minLength(...args));
3895
- },
3896
- max(...args) {
3897
- return this.check(/* @__PURE__ */ _maxLength(...args));
3898
- },
3899
- length(...args) {
3900
- return this.check(/* @__PURE__ */ _length(...args));
3901
- },
3902
- nonempty(...args) {
3903
- return this.check(/* @__PURE__ */ _minLength(1, ...args));
3904
- },
3905
- lowercase(params) {
3906
- return this.check(/* @__PURE__ */ _lowercase(params));
3907
- },
3908
- uppercase(params) {
3909
- return this.check(/* @__PURE__ */ _uppercase(params));
3910
- },
3911
- trim() {
3912
- return this.check(/* @__PURE__ */ _trim());
3913
- },
3914
- normalize(...args) {
3915
- return this.check(/* @__PURE__ */ _normalize(...args));
3916
- },
3917
- toLowerCase() {
3918
- return this.check(/* @__PURE__ */ _toLowerCase());
3919
- },
3920
- toUpperCase() {
3921
- return this.check(/* @__PURE__ */ _toUpperCase());
3922
- },
3923
- slugify() {
3924
- return this.check(/* @__PURE__ */ _slugify());
3925
- }
3926
- });
4781
+ }, {
4782
+ regex(...args) {
4783
+ return this.check(/* @__PURE__ */ _regex(...args));
4784
+ },
4785
+ includes(...args) {
4786
+ return this.check(/* @__PURE__ */ _includes(...args));
4787
+ },
4788
+ startsWith(...args) {
4789
+ return this.check(/* @__PURE__ */ _startsWith(...args));
4790
+ },
4791
+ endsWith(...args) {
4792
+ return this.check(/* @__PURE__ */ _endsWith(...args));
4793
+ },
4794
+ min(...args) {
4795
+ return this.check(/* @__PURE__ */ _minLength(...args));
4796
+ },
4797
+ max(...args) {
4798
+ return this.check(/* @__PURE__ */ _maxLength(...args));
4799
+ },
4800
+ length(...args) {
4801
+ return this.check(/* @__PURE__ */ _length(...args));
4802
+ },
4803
+ nonempty(...args) {
4804
+ return this.check(/* @__PURE__ */ _minLength(1, ...args));
4805
+ },
4806
+ lowercase(params) {
4807
+ return this.check(/* @__PURE__ */ _lowercase(params));
4808
+ },
4809
+ uppercase(params) {
4810
+ return this.check(/* @__PURE__ */ _uppercase(params));
4811
+ },
4812
+ trim() {
4813
+ return this.check(/* @__PURE__ */ _trim());
4814
+ },
4815
+ normalize(...args) {
4816
+ return this.check(/* @__PURE__ */ _normalize(...args));
4817
+ },
4818
+ toLowerCase() {
4819
+ return this.check(/* @__PURE__ */ _toLowerCase());
4820
+ },
4821
+ toUpperCase() {
4822
+ return this.check(/* @__PURE__ */ _toUpperCase());
4823
+ },
4824
+ slugify() {
4825
+ return this.check(/* @__PURE__ */ _slugify());
4826
+ }
3927
4827
  });
3928
4828
  const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
3929
4829
  $ZodString.init(inst, def);
3930
4830
  _ZodString.init(inst, def);
3931
- inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
3932
- inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
3933
- inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
3934
- inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
3935
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3936
- inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
3937
- inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
3938
- inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
3939
- inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
3940
- inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
3941
- inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
3942
- inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
3943
- inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
3944
- inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
3945
- inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
3946
- inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
3947
- inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
3948
- inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
3949
- inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
3950
- inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
3951
- inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
3952
- inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
3953
- inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
3954
- inst.datetime = (params) => inst.check(datetime(params));
3955
- inst.date = (params) => inst.check(date(params));
3956
- inst.time = (params) => inst.check(time(params));
3957
- inst.duration = (params) => inst.check(duration(params));
4831
+ }, {
4832
+ email(params) {
4833
+ return this.check(/* @__PURE__ */ _email(ZodEmail, params));
4834
+ },
4835
+ url(params) {
4836
+ return this.check(/* @__PURE__ */ _url(ZodURL, params));
4837
+ },
4838
+ jwt(params) {
4839
+ return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
4840
+ },
4841
+ emoji(params) {
4842
+ return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
4843
+ },
4844
+ guid(params) {
4845
+ return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
4846
+ },
4847
+ uuid(params) {
4848
+ return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
4849
+ },
4850
+ uuidv4(params) {
4851
+ return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
4852
+ },
4853
+ uuidv6(params) {
4854
+ return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
4855
+ },
4856
+ uuidv7(params) {
4857
+ return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
4858
+ },
4859
+ nanoid(params) {
4860
+ return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
4861
+ },
4862
+ cuid(params) {
4863
+ return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
4864
+ },
4865
+ cuid2(params) {
4866
+ return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
4867
+ },
4868
+ ulid(params) {
4869
+ return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
4870
+ },
4871
+ base64(params) {
4872
+ return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
4873
+ },
4874
+ base64url(params) {
4875
+ return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
4876
+ },
4877
+ xid(params) {
4878
+ return this.check(/* @__PURE__ */ _xid(ZodXID, params));
4879
+ },
4880
+ ksuid(params) {
4881
+ return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
4882
+ },
4883
+ ipv4(params) {
4884
+ return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
4885
+ },
4886
+ ipv6(params) {
4887
+ return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
4888
+ },
4889
+ cidrv4(params) {
4890
+ return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
4891
+ },
4892
+ cidrv6(params) {
4893
+ return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
4894
+ },
4895
+ e164(params) {
4896
+ return this.check(/* @__PURE__ */ _e164(ZodE164, params));
4897
+ },
4898
+ datetime(params) {
4899
+ return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
4900
+ },
4901
+ date(params) {
4902
+ return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
4903
+ },
4904
+ time(params) {
4905
+ return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
4906
+ },
4907
+ duration(params) {
4908
+ return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
4909
+ }
3958
4910
  });
3959
4911
  function string(params) {
3960
4912
  return /* @__PURE__ */ _string(ZodString, params);
@@ -3963,6 +4915,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
3963
4915
  $ZodStringFormat.init(inst, def);
3964
4916
  _ZodString.init(inst, def);
3965
4917
  });
4918
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
4919
+ $ZodISODateTime.init(inst, def);
4920
+ ZodStringFormat.init(inst, def);
4921
+ });
4922
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
4923
+ $ZodISODate.init(inst, def);
4924
+ ZodStringFormat.init(inst, def);
4925
+ });
4926
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
4927
+ $ZodISOTime.init(inst, def);
4928
+ ZodStringFormat.init(inst, def);
4929
+ });
4930
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
4931
+ $ZodISODuration.init(inst, def);
4932
+ ZodStringFormat.init(inst, def);
4933
+ });
3966
4934
  const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
3967
4935
  $ZodEmail.init(inst, def);
3968
4936
  ZodStringFormat.init(inst, def);
@@ -4048,59 +5016,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4048
5016
  $ZodNumber.init(inst, def);
4049
5017
  ZodType.init(inst, def);
4050
5018
  inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
4051
- _installLazyMethods(inst, "ZodNumber", {
4052
- gt(value, params) {
4053
- return this.check(/* @__PURE__ */ _gt(value, params));
4054
- },
4055
- gte(value, params) {
4056
- return this.check(/* @__PURE__ */ _gte(value, params));
4057
- },
4058
- min(value, params) {
4059
- return this.check(/* @__PURE__ */ _gte(value, params));
4060
- },
4061
- lt(value, params) {
4062
- return this.check(/* @__PURE__ */ _lt(value, params));
4063
- },
4064
- lte(value, params) {
4065
- return this.check(/* @__PURE__ */ _lte(value, params));
4066
- },
4067
- max(value, params) {
4068
- return this.check(/* @__PURE__ */ _lte(value, params));
4069
- },
4070
- int(params) {
4071
- return this.check(int(params));
4072
- },
4073
- safe(params) {
4074
- return this.check(int(params));
4075
- },
4076
- positive(params) {
4077
- return this.check(/* @__PURE__ */ _gt(0, params));
4078
- },
4079
- nonnegative(params) {
4080
- return this.check(/* @__PURE__ */ _gte(0, params));
4081
- },
4082
- negative(params) {
4083
- return this.check(/* @__PURE__ */ _lt(0, params));
4084
- },
4085
- nonpositive(params) {
4086
- return this.check(/* @__PURE__ */ _lte(0, params));
4087
- },
4088
- multipleOf(value, params) {
4089
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
4090
- },
4091
- step(value, params) {
4092
- return this.check(/* @__PURE__ */ _multipleOf(value, params));
4093
- },
4094
- finite() {
4095
- return this;
4096
- }
4097
- });
4098
5019
  const bag = inst._zod.bag;
4099
5020
  inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
4100
5021
  inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
4101
5022
  inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
4102
5023
  inst.isFinite = true;
4103
5024
  inst.format = bag.format ?? null;
5025
+ }, {
5026
+ gt(value, params) {
5027
+ return this.check(/* @__PURE__ */ _gt(value, params));
5028
+ },
5029
+ gte(value, params) {
5030
+ return this.check(/* @__PURE__ */ _gte(value, params));
5031
+ },
5032
+ min(value, params) {
5033
+ return this.check(/* @__PURE__ */ _gte(value, params));
5034
+ },
5035
+ lt(value, params) {
5036
+ return this.check(/* @__PURE__ */ _lt(value, params));
5037
+ },
5038
+ lte(value, params) {
5039
+ return this.check(/* @__PURE__ */ _lte(value, params));
5040
+ },
5041
+ max(value, params) {
5042
+ return this.check(/* @__PURE__ */ _lte(value, params));
5043
+ },
5044
+ int(params) {
5045
+ return this.check(int(params));
5046
+ },
5047
+ safe(params) {
5048
+ return this.check(int(params));
5049
+ },
5050
+ positive(params) {
5051
+ return this.check(/* @__PURE__ */ _gt(0, params));
5052
+ },
5053
+ nonnegative(params) {
5054
+ return this.check(/* @__PURE__ */ _gte(0, params));
5055
+ },
5056
+ negative(params) {
5057
+ return this.check(/* @__PURE__ */ _lt(0, params));
5058
+ },
5059
+ nonpositive(params) {
5060
+ return this.check(/* @__PURE__ */ _lte(0, params));
5061
+ },
5062
+ multipleOf(value, params) {
5063
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
5064
+ },
5065
+ step(value, params) {
5066
+ return this.check(/* @__PURE__ */ _multipleOf(value, params));
5067
+ },
5068
+ finite() {
5069
+ return this;
5070
+ }
4104
5071
  });
4105
5072
  function number(params) {
4106
5073
  return /* @__PURE__ */ _number(ZodNumber, params);
@@ -4137,94 +5104,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4137
5104
  return /* @__PURE__ */ _never(ZodNever, params);
4138
5105
  }
4139
5106
  const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
5107
+ _ensureDefaultMemoizer();
4140
5108
  $ZodArray.init(inst, def);
4141
5109
  ZodType.init(inst, def);
4142
5110
  inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
4143
5111
  inst.element = def.element;
4144
- _installLazyMethods(inst, "ZodArray", {
4145
- min(n, params) {
4146
- return this.check(/* @__PURE__ */ _minLength(n, params));
4147
- },
4148
- nonempty(params) {
4149
- return this.check(/* @__PURE__ */ _minLength(1, params));
4150
- },
4151
- max(n, params) {
4152
- return this.check(/* @__PURE__ */ _maxLength(n, params));
4153
- },
4154
- length(n, params) {
4155
- return this.check(/* @__PURE__ */ _length(n, params));
4156
- },
4157
- unwrap() {
4158
- return this.element;
4159
- }
4160
- });
5112
+ }, {
5113
+ min(n, params) {
5114
+ return this.check(/* @__PURE__ */ _minLength(n, params));
5115
+ },
5116
+ nonempty(params) {
5117
+ return this.check(/* @__PURE__ */ _minLength(1, params));
5118
+ },
5119
+ max(n, params) {
5120
+ return this.check(/* @__PURE__ */ _maxLength(n, params));
5121
+ },
5122
+ length(n, params) {
5123
+ return this.check(/* @__PURE__ */ _length(n, params));
5124
+ },
5125
+ unwrap() {
5126
+ return this.element;
5127
+ }
4161
5128
  });
4162
5129
  function array(element, params) {
4163
5130
  return /* @__PURE__ */ _array(ZodArray, element, params);
4164
5131
  }
4165
5132
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
5133
+ _ensureDefaultMemoizer();
4166
5134
  $ZodObjectJIT.init(inst, def);
4167
5135
  ZodType.init(inst, def);
4168
5136
  inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
4169
- defineLazy(inst, "shape", () => {
4170
- return def.shape;
4171
- });
4172
- _installLazyMethods(inst, "ZodObject", {
4173
- keyof() {
4174
- return _enum(Object.keys(this._zod.def.shape));
4175
- },
4176
- catchall(catchall) {
4177
- return this.clone({
4178
- ...this._zod.def,
4179
- catchall
4180
- });
4181
- },
4182
- passthrough() {
4183
- return this.clone({
4184
- ...this._zod.def,
4185
- catchall: unknown()
4186
- });
4187
- },
4188
- loose() {
4189
- return this.clone({
4190
- ...this._zod.def,
4191
- catchall: unknown()
4192
- });
4193
- },
4194
- strict() {
4195
- return this.clone({
4196
- ...this._zod.def,
4197
- catchall: never()
4198
- });
4199
- },
4200
- strip() {
4201
- return this.clone({
4202
- ...this._zod.def,
4203
- catchall: void 0
4204
- });
4205
- },
4206
- extend(incoming) {
4207
- return extend(this, incoming);
4208
- },
4209
- safeExtend(incoming) {
4210
- return safeExtend(this, incoming);
4211
- },
4212
- merge(other) {
4213
- return merge(this, other);
4214
- },
4215
- pick(mask) {
4216
- return pick(this, mask);
4217
- },
4218
- omit(mask) {
4219
- return omit(this, mask);
4220
- },
4221
- partial(...args) {
4222
- return partial(ZodOptional, this, args[0]);
4223
- },
4224
- required(...args) {
4225
- return required(ZodNonOptional, this, args[0]);
4226
- }
4227
- });
5137
+ installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
5138
+ }, {
5139
+ keyof() {
5140
+ return _enum(Object.keys(this._zod.def.shape));
5141
+ },
5142
+ catchall(catchall) {
5143
+ return this.clone({
5144
+ ...this._zod.def,
5145
+ catchall
5146
+ });
5147
+ },
5148
+ passthrough() {
5149
+ return this.clone({
5150
+ ...this._zod.def,
5151
+ catchall: unknown()
5152
+ });
5153
+ },
5154
+ loose() {
5155
+ return this.clone({
5156
+ ...this._zod.def,
5157
+ catchall: unknown()
5158
+ });
5159
+ },
5160
+ strict() {
5161
+ return this.clone({
5162
+ ...this._zod.def,
5163
+ catchall: never()
5164
+ });
5165
+ },
5166
+ strip() {
5167
+ return this.clone({
5168
+ ...this._zod.def,
5169
+ catchall: void 0
5170
+ });
5171
+ },
5172
+ extend(incoming) {
5173
+ return extend(this, incoming);
5174
+ },
5175
+ safeExtend(incoming) {
5176
+ return safeExtend(this, incoming);
5177
+ },
5178
+ merge(other) {
5179
+ return merge(this, other);
5180
+ },
5181
+ pick(mask) {
5182
+ return pick(this, mask);
5183
+ },
5184
+ omit(mask) {
5185
+ return omit(this, mask);
5186
+ },
5187
+ partial(...args) {
5188
+ return partial(ZodOptional, this, args[0]);
5189
+ },
5190
+ exactPartial(...args) {
5191
+ return partial(ZodExactOptional, this, args[0], "exactPartial");
5192
+ },
5193
+ required(...args) {
5194
+ return required(ZodNonOptional, this, args[0]);
5195
+ }
4228
5196
  });
4229
5197
  function object(shape, params) {
4230
5198
  const def = {
@@ -4315,6 +5283,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4315
5283
  });
4316
5284
  }
4317
5285
  const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
5286
+ _ensureDefaultMemoizer();
4318
5287
  $ZodTransform.init(inst, def);
4319
5288
  ZodType.init(inst, def);
4320
5289
  inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
@@ -4326,7 +5295,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4326
5295
  const _issue = issue$1;
4327
5296
  if (_issue.fatal) _issue.continue = false;
4328
5297
  _issue.code ?? (_issue.code = "custom");
4329
- _issue.input ?? (_issue.input = payload.value);
5298
+ if (!("input" in _issue)) _issue.input = payload.value;
4330
5299
  _issue.inst ?? (_issue.inst = inst);
4331
5300
  payload.issues.push(issue(_issue));
4332
5301
  }
@@ -4334,11 +5303,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4334
5303
  const output = def.transform(payload.value, payload);
4335
5304
  if (output instanceof Promise) return output.then((output) => {
4336
5305
  payload.value = output;
4337
- payload.fallback = true;
4338
5306
  return payload;
4339
5307
  });
4340
5308
  payload.value = output;
4341
- payload.fallback = true;
4342
5309
  return payload;
4343
5310
  };
4344
5311
  });
@@ -4439,7 +5406,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4439
5406
  return new ZodCatch({
4440
5407
  type: "catch",
4441
5408
  innerType,
4442
- catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
5409
+ catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
4443
5410
  });
4444
5411
  }
4445
5412
  const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {