@4pm/cli 1.2.7 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +4272 -246
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3746,10 +3746,10 @@ var require_react_production_min = __commonJS({
3746
3746
  var w = /* @__PURE__ */ Symbol.for("react.suspense");
3747
3747
  var x = /* @__PURE__ */ Symbol.for("react.memo");
3748
3748
  var y = /* @__PURE__ */ Symbol.for("react.lazy");
3749
- var z8 = Symbol.iterator;
3749
+ var z = Symbol.iterator;
3750
3750
  function A(a) {
3751
3751
  if (null === a || "object" !== typeof a) return null;
3752
- a = z8 && a[z8] || a["@@iterator"];
3752
+ a = z && a[z] || a["@@iterator"];
3753
3753
  return "function" === typeof a ? a : null;
3754
3754
  }
3755
3755
  var B = { isMounted: function() {
@@ -4911,7 +4911,7 @@ var require_react_development = __commonJS({
4911
4911
  _status: Uninitialized,
4912
4912
  _result: ctor
4913
4913
  };
4914
- var lazyType = {
4914
+ var lazyType2 = {
4915
4915
  $$typeof: REACT_LAZY_TYPE,
4916
4916
  _payload: payload,
4917
4917
  _init: lazyInitializer
@@ -4919,7 +4919,7 @@ var require_react_development = __commonJS({
4919
4919
  {
4920
4920
  var defaultProps;
4921
4921
  var propTypes;
4922
- Object.defineProperties(lazyType, {
4922
+ Object.defineProperties(lazyType2, {
4923
4923
  defaultProps: {
4924
4924
  configurable: true,
4925
4925
  get: function() {
@@ -4928,7 +4928,7 @@ var require_react_development = __commonJS({
4928
4928
  set: function(newDefaultProps) {
4929
4929
  error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
4930
4930
  defaultProps = newDefaultProps;
4931
- Object.defineProperty(lazyType, "defaultProps", {
4931
+ Object.defineProperty(lazyType2, "defaultProps", {
4932
4932
  enumerable: true
4933
4933
  });
4934
4934
  }
@@ -4941,14 +4941,14 @@ var require_react_development = __commonJS({
4941
4941
  set: function(newPropTypes) {
4942
4942
  error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
4943
4943
  propTypes = newPropTypes;
4944
- Object.defineProperty(lazyType, "propTypes", {
4944
+ Object.defineProperty(lazyType2, "propTypes", {
4945
4945
  enumerable: true
4946
4946
  });
4947
4947
  }
4948
4948
  }
4949
4949
  });
4950
4950
  }
4951
- return lazyType;
4951
+ return lazyType2;
4952
4952
  }
4953
4953
  function forwardRef2(render2) {
4954
4954
  {
@@ -6141,7 +6141,7 @@ var require_scheduler_production_min = __commonJS({
6141
6141
  var u = 1;
6142
6142
  var v = null;
6143
6143
  var y = 3;
6144
- var z8 = false;
6144
+ var z = false;
6145
6145
  var A = false;
6146
6146
  var B = false;
6147
6147
  var D = "function" === typeof setTimeout ? setTimeout : null;
@@ -6168,7 +6168,7 @@ var require_scheduler_production_min = __commonJS({
6168
6168
  function J(a, b) {
6169
6169
  A = false;
6170
6170
  B && (B = false, E(L), L = -1);
6171
- z8 = true;
6171
+ z = true;
6172
6172
  var c = y;
6173
6173
  try {
6174
6174
  G(b);
@@ -6192,7 +6192,7 @@ var require_scheduler_production_min = __commonJS({
6192
6192
  }
6193
6193
  return w;
6194
6194
  } finally {
6195
- v = null, y = c, z8 = false;
6195
+ v = null, y = c, z = false;
6196
6196
  }
6197
6197
  }
6198
6198
  var N = false;
@@ -6249,7 +6249,7 @@ var require_scheduler_production_min = __commonJS({
6249
6249
  a.callback = null;
6250
6250
  };
6251
6251
  exports.unstable_continueExecution = function() {
6252
- A || z8 || (A = true, I(J));
6252
+ A || z || (A = true, I(J));
6253
6253
  };
6254
6254
  exports.unstable_forceFrameRate = function(a) {
6255
6255
  0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P = 0 < a ? Math.floor(1e3 / a) : 5;
@@ -6322,7 +6322,7 @@ var require_scheduler_production_min = __commonJS({
6322
6322
  }
6323
6323
  e = c + e;
6324
6324
  a = { id: u++, callback: b, priorityLevel: a, startTime: c, expirationTime: e, sortIndex: -1 };
6325
- c > d ? (a.sortIndex = c, f(t, a), null === h(r) && a === h(t) && (B ? (E(L), L = -1) : B = true, K(H, c - d))) : (a.sortIndex = e, f(r, a), A || z8 || (A = true, I(J)));
6325
+ c > d ? (a.sortIndex = c, f(t, a), null === h(r) && a === h(t) && (B ? (E(L), L = -1) : B = true, K(H, c - d))) : (a.sortIndex = e, f(r, a), A || z || (A = true, I(J)));
6326
6326
  return a;
6327
6327
  };
6328
6328
  exports.unstable_shouldYield = M;
@@ -7101,7 +7101,7 @@ var require_react_reconciler_production_min = __commonJS({
7101
7101
  gc[hc] = a.current;
7102
7102
  a.current = b;
7103
7103
  }
7104
- var jc = {}, x = ic(jc), z8 = ic(false), kc = jc;
7104
+ var jc = {}, x = ic(jc), z = ic(false), kc = jc;
7105
7105
  function mc(a, b) {
7106
7106
  var c = a.type.contextTypes;
7107
7107
  if (!c) return jc;
@@ -7117,13 +7117,13 @@ var require_react_reconciler_production_min = __commonJS({
7117
7117
  return null !== a && void 0 !== a;
7118
7118
  }
7119
7119
  function nc() {
7120
- q(z8);
7120
+ q(z);
7121
7121
  q(x);
7122
7122
  }
7123
7123
  function oc(a, b, c) {
7124
7124
  if (x.current !== jc) throw Error(n(168));
7125
7125
  v(x, b);
7126
- v(z8, c);
7126
+ v(z, c);
7127
7127
  }
7128
7128
  function pc(a, b, c) {
7129
7129
  var d = a.stateNode;
@@ -7137,14 +7137,14 @@ var require_react_reconciler_production_min = __commonJS({
7137
7137
  a = (a = a.stateNode) && a.__reactInternalMemoizedMergedChildContext || jc;
7138
7138
  kc = x.current;
7139
7139
  v(x, a);
7140
- v(z8, z8.current);
7140
+ v(z, z.current);
7141
7141
  return true;
7142
7142
  }
7143
7143
  function rc(a, b, c) {
7144
7144
  var d = a.stateNode;
7145
7145
  if (!d) throw Error(n(169));
7146
- c ? (a = pc(a, b, kc), d.__reactInternalMemoizedMergedChildContext = a, q(z8), q(x), v(x, a)) : q(z8);
7147
- v(z8, c);
7146
+ c ? (a = pc(a, b, kc), d.__reactInternalMemoizedMergedChildContext = a, q(z), q(x), v(x, a)) : q(z);
7147
+ v(z, c);
7148
7148
  }
7149
7149
  var tc = Math.clz32 ? Math.clz32 : sc, uc = Math.log, vc = Math.LN2;
7150
7150
  function sc(a) {
@@ -8742,7 +8742,7 @@ var require_react_reconciler_production_min = __commonJS({
8742
8742
  g.state = p;
8743
8743
  ke(b, d, g, e);
8744
8744
  k = b.memoizedState;
8745
- h !== d || p !== k || z8.current || de ? ("function" === typeof m && (yf(b, c, m, d), k = b.memoizedState), (h = de || Af(b, c, h, d, p, k, l)) ? (r || "function" !== typeof g.UNSAFE_componentWillMount && "function" !== typeof g.componentWillMount || ("function" === typeof g.componentWillMount && g.componentWillMount(), "function" === typeof g.UNSAFE_componentWillMount && g.UNSAFE_componentWillMount()), "function" === typeof g.componentDidMount && (b.flags |= 4194308)) : ("function" === typeof g.componentDidMount && (b.flags |= 4194308), b.memoizedProps = d, b.memoizedState = k), g.props = d, g.state = k, g.context = l, d = h) : ("function" === typeof g.componentDidMount && (b.flags |= 4194308), d = false);
8745
+ h !== d || p !== k || z.current || de ? ("function" === typeof m && (yf(b, c, m, d), k = b.memoizedState), (h = de || Af(b, c, h, d, p, k, l)) ? (r || "function" !== typeof g.UNSAFE_componentWillMount && "function" !== typeof g.componentWillMount || ("function" === typeof g.componentWillMount && g.componentWillMount(), "function" === typeof g.UNSAFE_componentWillMount && g.UNSAFE_componentWillMount()), "function" === typeof g.componentDidMount && (b.flags |= 4194308)) : ("function" === typeof g.componentDidMount && (b.flags |= 4194308), b.memoizedProps = d, b.memoizedState = k), g.props = d, g.state = k, g.context = l, d = h) : ("function" === typeof g.componentDidMount && (b.flags |= 4194308), d = false);
8746
8746
  } else {
8747
8747
  g = b.stateNode;
8748
8748
  fe(a, b);
@@ -8760,7 +8760,7 @@ var require_react_reconciler_production_min = __commonJS({
8760
8760
  g.state = p;
8761
8761
  ke(b, d, g, e);
8762
8762
  var w = b.memoizedState;
8763
- h !== r || p !== w || z8.current || de ? ("function" === typeof B && (yf(b, c, B, d), w = b.memoizedState), (l = de || Af(b, c, l, d, p, w, k) || false) ? (m || "function" !== typeof g.UNSAFE_componentWillUpdate && "function" !== typeof g.componentWillUpdate || ("function" === typeof g.componentWillUpdate && g.componentWillUpdate(d, w, k), "function" === typeof g.UNSAFE_componentWillUpdate && g.UNSAFE_componentWillUpdate(d, w, k)), "function" === typeof g.componentDidUpdate && (b.flags |= 4), "function" === typeof g.getSnapshotBeforeUpdate && (b.flags |= 1024)) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 1024), b.memoizedProps = d, b.memoizedState = w), g.props = d, g.state = w, g.context = k, d = l) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 1024), d = false);
8763
+ h !== r || p !== w || z.current || de ? ("function" === typeof B && (yf(b, c, B, d), w = b.memoizedState), (l = de || Af(b, c, l, d, p, w, k) || false) ? (m || "function" !== typeof g.UNSAFE_componentWillUpdate && "function" !== typeof g.componentWillUpdate || ("function" === typeof g.componentWillUpdate && g.componentWillUpdate(d, w, k), "function" === typeof g.UNSAFE_componentWillUpdate && g.UNSAFE_componentWillUpdate(d, w, k)), "function" === typeof g.componentDidUpdate && (b.flags |= 4), "function" === typeof g.getSnapshotBeforeUpdate && (b.flags |= 1024)) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 1024), b.memoizedProps = d, b.memoizedState = w), g.props = d, g.state = w, g.context = k, d = l) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 1024), d = false);
8764
8764
  }
8765
8765
  return dg(a, b, c, d, f, e);
8766
8766
  }
@@ -9229,7 +9229,7 @@ var require_react_reconciler_production_min = __commonJS({
9229
9229
  case 3:
9230
9230
  c = b.stateNode;
9231
9231
  te();
9232
- q(z8);
9232
+ q(z);
9233
9233
  q(x);
9234
9234
  ye();
9235
9235
  c.pendingContext && (c.context = c.pendingContext, c.pendingContext = null);
@@ -9372,7 +9372,7 @@ var require_react_reconciler_production_min = __commonJS({
9372
9372
  case 1:
9373
9373
  return A(b.type) && nc(), a = b.flags, a & 65536 ? (b.flags = a & -65537 | 128, b) : null;
9374
9374
  case 3:
9375
- return te(), q(z8), q(x), ye(), a = b.flags, 0 !== (a & 65536) && 0 === (a & 128) ? (b.flags = a & -65537 | 128, b) : null;
9375
+ return te(), q(z), q(x), ye(), a = b.flags, 0 !== (a & 65536) && 0 === (a & 128) ? (b.flags = a & -65537 | 128, b) : null;
9376
9376
  case 5:
9377
9377
  return ve(b), null;
9378
9378
  case 13:
@@ -10427,7 +10427,7 @@ var require_react_reconciler_production_min = __commonJS({
10427
10427
  break;
10428
10428
  case 3:
10429
10429
  te();
10430
- q(z8);
10430
+ q(z);
10431
10431
  q(x);
10432
10432
  ye();
10433
10433
  break;
@@ -10904,7 +10904,7 @@ var require_react_reconciler_production_min = __commonJS({
10904
10904
  }
10905
10905
  var ai;
10906
10906
  ai = function(a, b, c) {
10907
- if (null !== a) if (a.memoizedProps !== b.pendingProps || z8.current) G = true;
10907
+ if (null !== a) if (a.memoizedProps !== b.pendingProps || z.current) G = true;
10908
10908
  else {
10909
10909
  if (0 === (a.lanes & c) && 0 === (b.flags & 128)) return G = false, sg(a, b, c);
10910
10910
  G = 0 !== (a.flags & 131072) ? true : false;
@@ -11013,7 +11013,7 @@ var require_react_reconciler_production_min = __commonJS({
11013
11013
  g = e.value;
11014
11014
  Vd(b, d, g);
11015
11015
  if (null !== f) if (Vc(f.value, g)) {
11016
- if (f.children === e.children && !z8.current) {
11016
+ if (f.children === e.children && !z.current) {
11017
11017
  b = Tf(a, b, c);
11018
11018
  break a;
11019
11019
  }
@@ -14777,9 +14777,9 @@ var require_react_reconciler_development = __commonJS({
14777
14777
  error("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.");
14778
14778
  }
14779
14779
  }
14780
- function resolveLazy(lazyType) {
14781
- var payload = lazyType._payload;
14782
- var init = lazyType._init;
14780
+ function resolveLazy(lazyType2) {
14781
+ var payload = lazyType2._payload;
14782
+ var init = lazyType2._init;
14783
14783
  return init(payload);
14784
14784
  }
14785
14785
  function ChildReconciler(shouldTrackSideEffects) {
@@ -18496,11 +18496,11 @@ var require_react_reconciler_development = __commonJS({
18496
18496
  var contextType = ctor.contextType;
18497
18497
  {
18498
18498
  if ("contextType" in ctor) {
18499
- var isValid = (
18499
+ var isValid2 = (
18500
18500
  // Allow null for conditional declaration
18501
18501
  contextType === null || contextType !== void 0 && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === void 0
18502
18502
  );
18503
- if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
18503
+ if (!isValid2 && !didWarnAboutInvalidateContextType.has(ctor)) {
18504
18504
  didWarnAboutInvalidateContextType.add(ctor);
18505
18505
  var addendum = "";
18506
18506
  if (contextType === void 0) {
@@ -28310,8 +28310,6 @@ function defaultProfileConfig() {
28310
28310
  { provider: "codex", profile: ".codex", args: [], model: "" }
28311
28311
  ],
28312
28312
  aiFailoverMode: "remember",
28313
- // Default to the fully-isolated posture (ADR-0199) — auth lives inside the sandbox.
28314
- aiCredentialMode: "in-container",
28315
28313
  autoUpdate: true,
28316
28314
  commandHistoryUploadMinutes: 10,
28317
28315
  autoClearIdleMinutes: 10
@@ -28789,66 +28787,4105 @@ var WsChannel = {
28789
28787
  MACHINE_STATUS: "machine.status"
28790
28788
  };
28791
28789
 
28790
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
28791
+ var external_exports = {};
28792
+ __export(external_exports, {
28793
+ BRAND: () => BRAND,
28794
+ DIRTY: () => DIRTY,
28795
+ EMPTY_PATH: () => EMPTY_PATH,
28796
+ INVALID: () => INVALID,
28797
+ NEVER: () => NEVER,
28798
+ OK: () => OK,
28799
+ ParseStatus: () => ParseStatus,
28800
+ Schema: () => ZodType,
28801
+ ZodAny: () => ZodAny,
28802
+ ZodArray: () => ZodArray,
28803
+ ZodBigInt: () => ZodBigInt,
28804
+ ZodBoolean: () => ZodBoolean,
28805
+ ZodBranded: () => ZodBranded,
28806
+ ZodCatch: () => ZodCatch,
28807
+ ZodDate: () => ZodDate,
28808
+ ZodDefault: () => ZodDefault,
28809
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
28810
+ ZodEffects: () => ZodEffects,
28811
+ ZodEnum: () => ZodEnum,
28812
+ ZodError: () => ZodError,
28813
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
28814
+ ZodFunction: () => ZodFunction,
28815
+ ZodIntersection: () => ZodIntersection,
28816
+ ZodIssueCode: () => ZodIssueCode,
28817
+ ZodLazy: () => ZodLazy,
28818
+ ZodLiteral: () => ZodLiteral,
28819
+ ZodMap: () => ZodMap,
28820
+ ZodNaN: () => ZodNaN,
28821
+ ZodNativeEnum: () => ZodNativeEnum,
28822
+ ZodNever: () => ZodNever,
28823
+ ZodNull: () => ZodNull,
28824
+ ZodNullable: () => ZodNullable,
28825
+ ZodNumber: () => ZodNumber,
28826
+ ZodObject: () => ZodObject,
28827
+ ZodOptional: () => ZodOptional,
28828
+ ZodParsedType: () => ZodParsedType,
28829
+ ZodPipeline: () => ZodPipeline,
28830
+ ZodPromise: () => ZodPromise,
28831
+ ZodReadonly: () => ZodReadonly,
28832
+ ZodRecord: () => ZodRecord,
28833
+ ZodSchema: () => ZodType,
28834
+ ZodSet: () => ZodSet,
28835
+ ZodString: () => ZodString,
28836
+ ZodSymbol: () => ZodSymbol,
28837
+ ZodTransformer: () => ZodEffects,
28838
+ ZodTuple: () => ZodTuple,
28839
+ ZodType: () => ZodType,
28840
+ ZodUndefined: () => ZodUndefined,
28841
+ ZodUnion: () => ZodUnion,
28842
+ ZodUnknown: () => ZodUnknown,
28843
+ ZodVoid: () => ZodVoid,
28844
+ addIssueToContext: () => addIssueToContext,
28845
+ any: () => anyType,
28846
+ array: () => arrayType,
28847
+ bigint: () => bigIntType,
28848
+ boolean: () => booleanType,
28849
+ coerce: () => coerce,
28850
+ custom: () => custom,
28851
+ date: () => dateType,
28852
+ datetimeRegex: () => datetimeRegex,
28853
+ defaultErrorMap: () => en_default,
28854
+ discriminatedUnion: () => discriminatedUnionType,
28855
+ effect: () => effectsType,
28856
+ enum: () => enumType,
28857
+ function: () => functionType,
28858
+ getErrorMap: () => getErrorMap,
28859
+ getParsedType: () => getParsedType,
28860
+ instanceof: () => instanceOfType,
28861
+ intersection: () => intersectionType,
28862
+ isAborted: () => isAborted,
28863
+ isAsync: () => isAsync,
28864
+ isDirty: () => isDirty,
28865
+ isValid: () => isValid,
28866
+ late: () => late,
28867
+ lazy: () => lazyType,
28868
+ literal: () => literalType,
28869
+ makeIssue: () => makeIssue,
28870
+ map: () => mapType,
28871
+ nan: () => nanType,
28872
+ nativeEnum: () => nativeEnumType,
28873
+ never: () => neverType,
28874
+ null: () => nullType,
28875
+ nullable: () => nullableType,
28876
+ number: () => numberType,
28877
+ object: () => objectType,
28878
+ objectUtil: () => objectUtil,
28879
+ oboolean: () => oboolean,
28880
+ onumber: () => onumber,
28881
+ optional: () => optionalType,
28882
+ ostring: () => ostring,
28883
+ pipeline: () => pipelineType,
28884
+ preprocess: () => preprocessType,
28885
+ promise: () => promiseType,
28886
+ quotelessJson: () => quotelessJson,
28887
+ record: () => recordType,
28888
+ set: () => setType,
28889
+ setErrorMap: () => setErrorMap,
28890
+ strictObject: () => strictObjectType,
28891
+ string: () => stringType,
28892
+ symbol: () => symbolType,
28893
+ transformer: () => effectsType,
28894
+ tuple: () => tupleType,
28895
+ undefined: () => undefinedType,
28896
+ union: () => unionType,
28897
+ unknown: () => unknownType,
28898
+ util: () => util,
28899
+ void: () => voidType
28900
+ });
28901
+
28902
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
28903
+ var util;
28904
+ (function(util2) {
28905
+ util2.assertEqual = (_) => {
28906
+ };
28907
+ function assertIs(_arg) {
28908
+ }
28909
+ util2.assertIs = assertIs;
28910
+ function assertNever(_x) {
28911
+ throw new Error();
28912
+ }
28913
+ util2.assertNever = assertNever;
28914
+ util2.arrayToEnum = (items) => {
28915
+ const obj = {};
28916
+ for (const item of items) {
28917
+ obj[item] = item;
28918
+ }
28919
+ return obj;
28920
+ };
28921
+ util2.getValidEnumValues = (obj) => {
28922
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
28923
+ const filtered = {};
28924
+ for (const k of validKeys) {
28925
+ filtered[k] = obj[k];
28926
+ }
28927
+ return util2.objectValues(filtered);
28928
+ };
28929
+ util2.objectValues = (obj) => {
28930
+ return util2.objectKeys(obj).map(function(e) {
28931
+ return obj[e];
28932
+ });
28933
+ };
28934
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
28935
+ const keys = [];
28936
+ for (const key in object) {
28937
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
28938
+ keys.push(key);
28939
+ }
28940
+ }
28941
+ return keys;
28942
+ };
28943
+ util2.find = (arr, checker) => {
28944
+ for (const item of arr) {
28945
+ if (checker(item))
28946
+ return item;
28947
+ }
28948
+ return void 0;
28949
+ };
28950
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
28951
+ function joinValues(array, separator = " | ") {
28952
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
28953
+ }
28954
+ util2.joinValues = joinValues;
28955
+ util2.jsonStringifyReplacer = (_, value) => {
28956
+ if (typeof value === "bigint") {
28957
+ return value.toString();
28958
+ }
28959
+ return value;
28960
+ };
28961
+ })(util || (util = {}));
28962
+ var objectUtil;
28963
+ (function(objectUtil2) {
28964
+ objectUtil2.mergeShapes = (first, second) => {
28965
+ return {
28966
+ ...first,
28967
+ ...second
28968
+ // second overwrites first
28969
+ };
28970
+ };
28971
+ })(objectUtil || (objectUtil = {}));
28972
+ var ZodParsedType = util.arrayToEnum([
28973
+ "string",
28974
+ "nan",
28975
+ "number",
28976
+ "integer",
28977
+ "float",
28978
+ "boolean",
28979
+ "date",
28980
+ "bigint",
28981
+ "symbol",
28982
+ "function",
28983
+ "undefined",
28984
+ "null",
28985
+ "array",
28986
+ "object",
28987
+ "unknown",
28988
+ "promise",
28989
+ "void",
28990
+ "never",
28991
+ "map",
28992
+ "set"
28993
+ ]);
28994
+ var getParsedType = (data) => {
28995
+ const t = typeof data;
28996
+ switch (t) {
28997
+ case "undefined":
28998
+ return ZodParsedType.undefined;
28999
+ case "string":
29000
+ return ZodParsedType.string;
29001
+ case "number":
29002
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
29003
+ case "boolean":
29004
+ return ZodParsedType.boolean;
29005
+ case "function":
29006
+ return ZodParsedType.function;
29007
+ case "bigint":
29008
+ return ZodParsedType.bigint;
29009
+ case "symbol":
29010
+ return ZodParsedType.symbol;
29011
+ case "object":
29012
+ if (Array.isArray(data)) {
29013
+ return ZodParsedType.array;
29014
+ }
29015
+ if (data === null) {
29016
+ return ZodParsedType.null;
29017
+ }
29018
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
29019
+ return ZodParsedType.promise;
29020
+ }
29021
+ if (typeof Map !== "undefined" && data instanceof Map) {
29022
+ return ZodParsedType.map;
29023
+ }
29024
+ if (typeof Set !== "undefined" && data instanceof Set) {
29025
+ return ZodParsedType.set;
29026
+ }
29027
+ if (typeof Date !== "undefined" && data instanceof Date) {
29028
+ return ZodParsedType.date;
29029
+ }
29030
+ return ZodParsedType.object;
29031
+ default:
29032
+ return ZodParsedType.unknown;
29033
+ }
29034
+ };
29035
+
29036
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js
29037
+ var ZodIssueCode = util.arrayToEnum([
29038
+ "invalid_type",
29039
+ "invalid_literal",
29040
+ "custom",
29041
+ "invalid_union",
29042
+ "invalid_union_discriminator",
29043
+ "invalid_enum_value",
29044
+ "unrecognized_keys",
29045
+ "invalid_arguments",
29046
+ "invalid_return_type",
29047
+ "invalid_date",
29048
+ "invalid_string",
29049
+ "too_small",
29050
+ "too_big",
29051
+ "invalid_intersection_types",
29052
+ "not_multiple_of",
29053
+ "not_finite"
29054
+ ]);
29055
+ var quotelessJson = (obj) => {
29056
+ const json = JSON.stringify(obj, null, 2);
29057
+ return json.replace(/"([^"]+)":/g, "$1:");
29058
+ };
29059
+ var ZodError = class _ZodError extends Error {
29060
+ get errors() {
29061
+ return this.issues;
29062
+ }
29063
+ constructor(issues) {
29064
+ super();
29065
+ this.issues = [];
29066
+ this.addIssue = (sub) => {
29067
+ this.issues = [...this.issues, sub];
29068
+ };
29069
+ this.addIssues = (subs = []) => {
29070
+ this.issues = [...this.issues, ...subs];
29071
+ };
29072
+ const actualProto = new.target.prototype;
29073
+ if (Object.setPrototypeOf) {
29074
+ Object.setPrototypeOf(this, actualProto);
29075
+ } else {
29076
+ this.__proto__ = actualProto;
29077
+ }
29078
+ this.name = "ZodError";
29079
+ this.issues = issues;
29080
+ }
29081
+ format(_mapper) {
29082
+ const mapper = _mapper || function(issue) {
29083
+ return issue.message;
29084
+ };
29085
+ const fieldErrors = { _errors: [] };
29086
+ const processError = (error) => {
29087
+ for (const issue of error.issues) {
29088
+ if (issue.code === "invalid_union") {
29089
+ issue.unionErrors.map(processError);
29090
+ } else if (issue.code === "invalid_return_type") {
29091
+ processError(issue.returnTypeError);
29092
+ } else if (issue.code === "invalid_arguments") {
29093
+ processError(issue.argumentsError);
29094
+ } else if (issue.path.length === 0) {
29095
+ fieldErrors._errors.push(mapper(issue));
29096
+ } else {
29097
+ let curr = fieldErrors;
29098
+ let i = 0;
29099
+ while (i < issue.path.length) {
29100
+ const el = issue.path[i];
29101
+ const terminal = i === issue.path.length - 1;
29102
+ if (!terminal) {
29103
+ curr[el] = curr[el] || { _errors: [] };
29104
+ } else {
29105
+ curr[el] = curr[el] || { _errors: [] };
29106
+ curr[el]._errors.push(mapper(issue));
29107
+ }
29108
+ curr = curr[el];
29109
+ i++;
29110
+ }
29111
+ }
29112
+ }
29113
+ };
29114
+ processError(this);
29115
+ return fieldErrors;
29116
+ }
29117
+ static assert(value) {
29118
+ if (!(value instanceof _ZodError)) {
29119
+ throw new Error(`Not a ZodError: ${value}`);
29120
+ }
29121
+ }
29122
+ toString() {
29123
+ return this.message;
29124
+ }
29125
+ get message() {
29126
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
29127
+ }
29128
+ get isEmpty() {
29129
+ return this.issues.length === 0;
29130
+ }
29131
+ flatten(mapper = (issue) => issue.message) {
29132
+ const fieldErrors = {};
29133
+ const formErrors = [];
29134
+ for (const sub of this.issues) {
29135
+ if (sub.path.length > 0) {
29136
+ const firstEl = sub.path[0];
29137
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
29138
+ fieldErrors[firstEl].push(mapper(sub));
29139
+ } else {
29140
+ formErrors.push(mapper(sub));
29141
+ }
29142
+ }
29143
+ return { formErrors, fieldErrors };
29144
+ }
29145
+ get formErrors() {
29146
+ return this.flatten();
29147
+ }
29148
+ };
29149
+ ZodError.create = (issues) => {
29150
+ const error = new ZodError(issues);
29151
+ return error;
29152
+ };
29153
+
29154
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js
29155
+ var errorMap = (issue, _ctx) => {
29156
+ let message;
29157
+ switch (issue.code) {
29158
+ case ZodIssueCode.invalid_type:
29159
+ if (issue.received === ZodParsedType.undefined) {
29160
+ message = "Required";
29161
+ } else {
29162
+ message = `Expected ${issue.expected}, received ${issue.received}`;
29163
+ }
29164
+ break;
29165
+ case ZodIssueCode.invalid_literal:
29166
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
29167
+ break;
29168
+ case ZodIssueCode.unrecognized_keys:
29169
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
29170
+ break;
29171
+ case ZodIssueCode.invalid_union:
29172
+ message = `Invalid input`;
29173
+ break;
29174
+ case ZodIssueCode.invalid_union_discriminator:
29175
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
29176
+ break;
29177
+ case ZodIssueCode.invalid_enum_value:
29178
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
29179
+ break;
29180
+ case ZodIssueCode.invalid_arguments:
29181
+ message = `Invalid function arguments`;
29182
+ break;
29183
+ case ZodIssueCode.invalid_return_type:
29184
+ message = `Invalid function return type`;
29185
+ break;
29186
+ case ZodIssueCode.invalid_date:
29187
+ message = `Invalid date`;
29188
+ break;
29189
+ case ZodIssueCode.invalid_string:
29190
+ if (typeof issue.validation === "object") {
29191
+ if ("includes" in issue.validation) {
29192
+ message = `Invalid input: must include "${issue.validation.includes}"`;
29193
+ if (typeof issue.validation.position === "number") {
29194
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
29195
+ }
29196
+ } else if ("startsWith" in issue.validation) {
29197
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
29198
+ } else if ("endsWith" in issue.validation) {
29199
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
29200
+ } else {
29201
+ util.assertNever(issue.validation);
29202
+ }
29203
+ } else if (issue.validation !== "regex") {
29204
+ message = `Invalid ${issue.validation}`;
29205
+ } else {
29206
+ message = "Invalid";
29207
+ }
29208
+ break;
29209
+ case ZodIssueCode.too_small:
29210
+ if (issue.type === "array")
29211
+ message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
29212
+ else if (issue.type === "string")
29213
+ message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
29214
+ else if (issue.type === "number")
29215
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
29216
+ else if (issue.type === "bigint")
29217
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
29218
+ else if (issue.type === "date")
29219
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
29220
+ else
29221
+ message = "Invalid input";
29222
+ break;
29223
+ case ZodIssueCode.too_big:
29224
+ if (issue.type === "array")
29225
+ message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
29226
+ else if (issue.type === "string")
29227
+ message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
29228
+ else if (issue.type === "number")
29229
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
29230
+ else if (issue.type === "bigint")
29231
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
29232
+ else if (issue.type === "date")
29233
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
29234
+ else
29235
+ message = "Invalid input";
29236
+ break;
29237
+ case ZodIssueCode.custom:
29238
+ message = `Invalid input`;
29239
+ break;
29240
+ case ZodIssueCode.invalid_intersection_types:
29241
+ message = `Intersection results could not be merged`;
29242
+ break;
29243
+ case ZodIssueCode.not_multiple_of:
29244
+ message = `Number must be a multiple of ${issue.multipleOf}`;
29245
+ break;
29246
+ case ZodIssueCode.not_finite:
29247
+ message = "Number must be finite";
29248
+ break;
29249
+ default:
29250
+ message = _ctx.defaultError;
29251
+ util.assertNever(issue);
29252
+ }
29253
+ return { message };
29254
+ };
29255
+ var en_default = errorMap;
29256
+
29257
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js
29258
+ var overrideErrorMap = en_default;
29259
+ function setErrorMap(map) {
29260
+ overrideErrorMap = map;
29261
+ }
29262
+ function getErrorMap() {
29263
+ return overrideErrorMap;
29264
+ }
29265
+
29266
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
29267
+ var makeIssue = (params) => {
29268
+ const { data, path, errorMaps, issueData } = params;
29269
+ const fullPath = [...path, ...issueData.path || []];
29270
+ const fullIssue = {
29271
+ ...issueData,
29272
+ path: fullPath
29273
+ };
29274
+ if (issueData.message !== void 0) {
29275
+ return {
29276
+ ...issueData,
29277
+ path: fullPath,
29278
+ message: issueData.message
29279
+ };
29280
+ }
29281
+ let errorMessage = "";
29282
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
29283
+ for (const map of maps) {
29284
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
29285
+ }
29286
+ return {
29287
+ ...issueData,
29288
+ path: fullPath,
29289
+ message: errorMessage
29290
+ };
29291
+ };
29292
+ var EMPTY_PATH = [];
29293
+ function addIssueToContext(ctx, issueData) {
29294
+ const overrideMap = getErrorMap();
29295
+ const issue = makeIssue({
29296
+ issueData,
29297
+ data: ctx.data,
29298
+ path: ctx.path,
29299
+ errorMaps: [
29300
+ ctx.common.contextualErrorMap,
29301
+ // contextual error map is first priority
29302
+ ctx.schemaErrorMap,
29303
+ // then schema-bound map if available
29304
+ overrideMap,
29305
+ // then global override map
29306
+ overrideMap === en_default ? void 0 : en_default
29307
+ // then global default map
29308
+ ].filter((x) => !!x)
29309
+ });
29310
+ ctx.common.issues.push(issue);
29311
+ }
29312
+ var ParseStatus = class _ParseStatus {
29313
+ constructor() {
29314
+ this.value = "valid";
29315
+ }
29316
+ dirty() {
29317
+ if (this.value === "valid")
29318
+ this.value = "dirty";
29319
+ }
29320
+ abort() {
29321
+ if (this.value !== "aborted")
29322
+ this.value = "aborted";
29323
+ }
29324
+ static mergeArray(status, results) {
29325
+ const arrayValue = [];
29326
+ for (const s of results) {
29327
+ if (s.status === "aborted")
29328
+ return INVALID;
29329
+ if (s.status === "dirty")
29330
+ status.dirty();
29331
+ arrayValue.push(s.value);
29332
+ }
29333
+ return { status: status.value, value: arrayValue };
29334
+ }
29335
+ static async mergeObjectAsync(status, pairs) {
29336
+ const syncPairs = [];
29337
+ for (const pair of pairs) {
29338
+ const key = await pair.key;
29339
+ const value = await pair.value;
29340
+ syncPairs.push({
29341
+ key,
29342
+ value
29343
+ });
29344
+ }
29345
+ return _ParseStatus.mergeObjectSync(status, syncPairs);
29346
+ }
29347
+ static mergeObjectSync(status, pairs) {
29348
+ const finalObject = {};
29349
+ for (const pair of pairs) {
29350
+ const { key, value } = pair;
29351
+ if (key.status === "aborted")
29352
+ return INVALID;
29353
+ if (value.status === "aborted")
29354
+ return INVALID;
29355
+ if (key.status === "dirty")
29356
+ status.dirty();
29357
+ if (value.status === "dirty")
29358
+ status.dirty();
29359
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
29360
+ finalObject[key.value] = value.value;
29361
+ }
29362
+ }
29363
+ return { status: status.value, value: finalObject };
29364
+ }
29365
+ };
29366
+ var INVALID = Object.freeze({
29367
+ status: "aborted"
29368
+ });
29369
+ var DIRTY = (value) => ({ status: "dirty", value });
29370
+ var OK = (value) => ({ status: "valid", value });
29371
+ var isAborted = (x) => x.status === "aborted";
29372
+ var isDirty = (x) => x.status === "dirty";
29373
+ var isValid = (x) => x.status === "valid";
29374
+ var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
29375
+
29376
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
29377
+ var errorUtil;
29378
+ (function(errorUtil2) {
29379
+ errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
29380
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
29381
+ })(errorUtil || (errorUtil = {}));
29382
+
29383
+ // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
29384
+ var ParseInputLazyPath = class {
29385
+ constructor(parent, value, path, key) {
29386
+ this._cachedPath = [];
29387
+ this.parent = parent;
29388
+ this.data = value;
29389
+ this._path = path;
29390
+ this._key = key;
29391
+ }
29392
+ get path() {
29393
+ if (!this._cachedPath.length) {
29394
+ if (Array.isArray(this._key)) {
29395
+ this._cachedPath.push(...this._path, ...this._key);
29396
+ } else {
29397
+ this._cachedPath.push(...this._path, this._key);
29398
+ }
29399
+ }
29400
+ return this._cachedPath;
29401
+ }
29402
+ };
29403
+ var handleResult = (ctx, result) => {
29404
+ if (isValid(result)) {
29405
+ return { success: true, data: result.value };
29406
+ } else {
29407
+ if (!ctx.common.issues.length) {
29408
+ throw new Error("Validation failed but no issues detected.");
29409
+ }
29410
+ return {
29411
+ success: false,
29412
+ get error() {
29413
+ if (this._error)
29414
+ return this._error;
29415
+ const error = new ZodError(ctx.common.issues);
29416
+ this._error = error;
29417
+ return this._error;
29418
+ }
29419
+ };
29420
+ }
29421
+ };
29422
+ function processCreateParams(params) {
29423
+ if (!params)
29424
+ return {};
29425
+ const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
29426
+ if (errorMap2 && (invalid_type_error || required_error)) {
29427
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
29428
+ }
29429
+ if (errorMap2)
29430
+ return { errorMap: errorMap2, description };
29431
+ const customMap = (iss, ctx) => {
29432
+ const { message } = params;
29433
+ if (iss.code === "invalid_enum_value") {
29434
+ return { message: message ?? ctx.defaultError };
29435
+ }
29436
+ if (typeof ctx.data === "undefined") {
29437
+ return { message: message ?? required_error ?? ctx.defaultError };
29438
+ }
29439
+ if (iss.code !== "invalid_type")
29440
+ return { message: ctx.defaultError };
29441
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
29442
+ };
29443
+ return { errorMap: customMap, description };
29444
+ }
29445
+ var ZodType = class {
29446
+ get description() {
29447
+ return this._def.description;
29448
+ }
29449
+ _getType(input) {
29450
+ return getParsedType(input.data);
29451
+ }
29452
+ _getOrReturnCtx(input, ctx) {
29453
+ return ctx || {
29454
+ common: input.parent.common,
29455
+ data: input.data,
29456
+ parsedType: getParsedType(input.data),
29457
+ schemaErrorMap: this._def.errorMap,
29458
+ path: input.path,
29459
+ parent: input.parent
29460
+ };
29461
+ }
29462
+ _processInputParams(input) {
29463
+ return {
29464
+ status: new ParseStatus(),
29465
+ ctx: {
29466
+ common: input.parent.common,
29467
+ data: input.data,
29468
+ parsedType: getParsedType(input.data),
29469
+ schemaErrorMap: this._def.errorMap,
29470
+ path: input.path,
29471
+ parent: input.parent
29472
+ }
29473
+ };
29474
+ }
29475
+ _parseSync(input) {
29476
+ const result = this._parse(input);
29477
+ if (isAsync(result)) {
29478
+ throw new Error("Synchronous parse encountered promise.");
29479
+ }
29480
+ return result;
29481
+ }
29482
+ _parseAsync(input) {
29483
+ const result = this._parse(input);
29484
+ return Promise.resolve(result);
29485
+ }
29486
+ parse(data, params) {
29487
+ const result = this.safeParse(data, params);
29488
+ if (result.success)
29489
+ return result.data;
29490
+ throw result.error;
29491
+ }
29492
+ safeParse(data, params) {
29493
+ const ctx = {
29494
+ common: {
29495
+ issues: [],
29496
+ async: params?.async ?? false,
29497
+ contextualErrorMap: params?.errorMap
29498
+ },
29499
+ path: params?.path || [],
29500
+ schemaErrorMap: this._def.errorMap,
29501
+ parent: null,
29502
+ data,
29503
+ parsedType: getParsedType(data)
29504
+ };
29505
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
29506
+ return handleResult(ctx, result);
29507
+ }
29508
+ "~validate"(data) {
29509
+ const ctx = {
29510
+ common: {
29511
+ issues: [],
29512
+ async: !!this["~standard"].async
29513
+ },
29514
+ path: [],
29515
+ schemaErrorMap: this._def.errorMap,
29516
+ parent: null,
29517
+ data,
29518
+ parsedType: getParsedType(data)
29519
+ };
29520
+ if (!this["~standard"].async) {
29521
+ try {
29522
+ const result = this._parseSync({ data, path: [], parent: ctx });
29523
+ return isValid(result) ? {
29524
+ value: result.value
29525
+ } : {
29526
+ issues: ctx.common.issues
29527
+ };
29528
+ } catch (err) {
29529
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
29530
+ this["~standard"].async = true;
29531
+ }
29532
+ ctx.common = {
29533
+ issues: [],
29534
+ async: true
29535
+ };
29536
+ }
29537
+ }
29538
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
29539
+ value: result.value
29540
+ } : {
29541
+ issues: ctx.common.issues
29542
+ });
29543
+ }
29544
+ async parseAsync(data, params) {
29545
+ const result = await this.safeParseAsync(data, params);
29546
+ if (result.success)
29547
+ return result.data;
29548
+ throw result.error;
29549
+ }
29550
+ async safeParseAsync(data, params) {
29551
+ const ctx = {
29552
+ common: {
29553
+ issues: [],
29554
+ contextualErrorMap: params?.errorMap,
29555
+ async: true
29556
+ },
29557
+ path: params?.path || [],
29558
+ schemaErrorMap: this._def.errorMap,
29559
+ parent: null,
29560
+ data,
29561
+ parsedType: getParsedType(data)
29562
+ };
29563
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
29564
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
29565
+ return handleResult(ctx, result);
29566
+ }
29567
+ refine(check, message) {
29568
+ const getIssueProperties = (val) => {
29569
+ if (typeof message === "string" || typeof message === "undefined") {
29570
+ return { message };
29571
+ } else if (typeof message === "function") {
29572
+ return message(val);
29573
+ } else {
29574
+ return message;
29575
+ }
29576
+ };
29577
+ return this._refinement((val, ctx) => {
29578
+ const result = check(val);
29579
+ const setError = () => ctx.addIssue({
29580
+ code: ZodIssueCode.custom,
29581
+ ...getIssueProperties(val)
29582
+ });
29583
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
29584
+ return result.then((data) => {
29585
+ if (!data) {
29586
+ setError();
29587
+ return false;
29588
+ } else {
29589
+ return true;
29590
+ }
29591
+ });
29592
+ }
29593
+ if (!result) {
29594
+ setError();
29595
+ return false;
29596
+ } else {
29597
+ return true;
29598
+ }
29599
+ });
29600
+ }
29601
+ refinement(check, refinementData) {
29602
+ return this._refinement((val, ctx) => {
29603
+ if (!check(val)) {
29604
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
29605
+ return false;
29606
+ } else {
29607
+ return true;
29608
+ }
29609
+ });
29610
+ }
29611
+ _refinement(refinement) {
29612
+ return new ZodEffects({
29613
+ schema: this,
29614
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
29615
+ effect: { type: "refinement", refinement }
29616
+ });
29617
+ }
29618
+ superRefine(refinement) {
29619
+ return this._refinement(refinement);
29620
+ }
29621
+ constructor(def) {
29622
+ this.spa = this.safeParseAsync;
29623
+ this._def = def;
29624
+ this.parse = this.parse.bind(this);
29625
+ this.safeParse = this.safeParse.bind(this);
29626
+ this.parseAsync = this.parseAsync.bind(this);
29627
+ this.safeParseAsync = this.safeParseAsync.bind(this);
29628
+ this.spa = this.spa.bind(this);
29629
+ this.refine = this.refine.bind(this);
29630
+ this.refinement = this.refinement.bind(this);
29631
+ this.superRefine = this.superRefine.bind(this);
29632
+ this.optional = this.optional.bind(this);
29633
+ this.nullable = this.nullable.bind(this);
29634
+ this.nullish = this.nullish.bind(this);
29635
+ this.array = this.array.bind(this);
29636
+ this.promise = this.promise.bind(this);
29637
+ this.or = this.or.bind(this);
29638
+ this.and = this.and.bind(this);
29639
+ this.transform = this.transform.bind(this);
29640
+ this.brand = this.brand.bind(this);
29641
+ this.default = this.default.bind(this);
29642
+ this.catch = this.catch.bind(this);
29643
+ this.describe = this.describe.bind(this);
29644
+ this.pipe = this.pipe.bind(this);
29645
+ this.readonly = this.readonly.bind(this);
29646
+ this.isNullable = this.isNullable.bind(this);
29647
+ this.isOptional = this.isOptional.bind(this);
29648
+ this["~standard"] = {
29649
+ version: 1,
29650
+ vendor: "zod",
29651
+ validate: (data) => this["~validate"](data)
29652
+ };
29653
+ }
29654
+ optional() {
29655
+ return ZodOptional.create(this, this._def);
29656
+ }
29657
+ nullable() {
29658
+ return ZodNullable.create(this, this._def);
29659
+ }
29660
+ nullish() {
29661
+ return this.nullable().optional();
29662
+ }
29663
+ array() {
29664
+ return ZodArray.create(this);
29665
+ }
29666
+ promise() {
29667
+ return ZodPromise.create(this, this._def);
29668
+ }
29669
+ or(option) {
29670
+ return ZodUnion.create([this, option], this._def);
29671
+ }
29672
+ and(incoming) {
29673
+ return ZodIntersection.create(this, incoming, this._def);
29674
+ }
29675
+ transform(transform) {
29676
+ return new ZodEffects({
29677
+ ...processCreateParams(this._def),
29678
+ schema: this,
29679
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
29680
+ effect: { type: "transform", transform }
29681
+ });
29682
+ }
29683
+ default(def) {
29684
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
29685
+ return new ZodDefault({
29686
+ ...processCreateParams(this._def),
29687
+ innerType: this,
29688
+ defaultValue: defaultValueFunc,
29689
+ typeName: ZodFirstPartyTypeKind.ZodDefault
29690
+ });
29691
+ }
29692
+ brand() {
29693
+ return new ZodBranded({
29694
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
29695
+ type: this,
29696
+ ...processCreateParams(this._def)
29697
+ });
29698
+ }
29699
+ catch(def) {
29700
+ const catchValueFunc = typeof def === "function" ? def : () => def;
29701
+ return new ZodCatch({
29702
+ ...processCreateParams(this._def),
29703
+ innerType: this,
29704
+ catchValue: catchValueFunc,
29705
+ typeName: ZodFirstPartyTypeKind.ZodCatch
29706
+ });
29707
+ }
29708
+ describe(description) {
29709
+ const This = this.constructor;
29710
+ return new This({
29711
+ ...this._def,
29712
+ description
29713
+ });
29714
+ }
29715
+ pipe(target) {
29716
+ return ZodPipeline.create(this, target);
29717
+ }
29718
+ readonly() {
29719
+ return ZodReadonly.create(this);
29720
+ }
29721
+ isOptional() {
29722
+ return this.safeParse(void 0).success;
29723
+ }
29724
+ isNullable() {
29725
+ return this.safeParse(null).success;
29726
+ }
29727
+ };
29728
+ var cuidRegex = /^c[^\s-]{8,}$/i;
29729
+ var cuid2Regex = /^[0-9a-z]+$/;
29730
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
29731
+ var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
29732
+ var nanoidRegex = /^[a-z0-9_-]{21}$/i;
29733
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
29734
+ var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
29735
+ var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
29736
+ var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
29737
+ var emojiRegex;
29738
+ var ipv4Regex = /^(?:(?: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])$/;
29739
+ var ipv4CidrRegex = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
29740
+ var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
29741
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
29742
+ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
29743
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
29744
+ var dateRegexSource = `((\\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])))`;
29745
+ var dateRegex = new RegExp(`^${dateRegexSource}$`);
29746
+ function timeRegexSource(args) {
29747
+ let secondsRegexSource = `[0-5]\\d`;
29748
+ if (args.precision) {
29749
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
29750
+ } else if (args.precision == null) {
29751
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
29752
+ }
29753
+ const secondsQuantifier = args.precision ? "+" : "?";
29754
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
29755
+ }
29756
+ function timeRegex(args) {
29757
+ return new RegExp(`^${timeRegexSource(args)}$`);
29758
+ }
29759
+ function datetimeRegex(args) {
29760
+ let regex2 = `${dateRegexSource}T${timeRegexSource(args)}`;
29761
+ const opts = [];
29762
+ opts.push(args.local ? `Z?` : `Z`);
29763
+ if (args.offset)
29764
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
29765
+ regex2 = `${regex2}(${opts.join("|")})`;
29766
+ return new RegExp(`^${regex2}$`);
29767
+ }
29768
+ function isValidIP(ip, version) {
29769
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
29770
+ return true;
29771
+ }
29772
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
29773
+ return true;
29774
+ }
29775
+ return false;
29776
+ }
29777
+ function isValidJWT(jwt, alg) {
29778
+ if (!jwtRegex.test(jwt))
29779
+ return false;
29780
+ try {
29781
+ const [header] = jwt.split(".");
29782
+ if (!header)
29783
+ return false;
29784
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
29785
+ const decoded = JSON.parse(atob(base64));
29786
+ if (typeof decoded !== "object" || decoded === null)
29787
+ return false;
29788
+ if ("typ" in decoded && decoded?.typ !== "JWT")
29789
+ return false;
29790
+ if (!decoded.alg)
29791
+ return false;
29792
+ if (alg && decoded.alg !== alg)
29793
+ return false;
29794
+ return true;
29795
+ } catch {
29796
+ return false;
29797
+ }
29798
+ }
29799
+ function isValidCidr(ip, version) {
29800
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
29801
+ return true;
29802
+ }
29803
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
29804
+ return true;
29805
+ }
29806
+ return false;
29807
+ }
29808
+ var ZodString = class _ZodString extends ZodType {
29809
+ _parse(input) {
29810
+ if (this._def.coerce) {
29811
+ input.data = String(input.data);
29812
+ }
29813
+ const parsedType = this._getType(input);
29814
+ if (parsedType !== ZodParsedType.string) {
29815
+ const ctx2 = this._getOrReturnCtx(input);
29816
+ addIssueToContext(ctx2, {
29817
+ code: ZodIssueCode.invalid_type,
29818
+ expected: ZodParsedType.string,
29819
+ received: ctx2.parsedType
29820
+ });
29821
+ return INVALID;
29822
+ }
29823
+ const status = new ParseStatus();
29824
+ let ctx = void 0;
29825
+ for (const check of this._def.checks) {
29826
+ if (check.kind === "min") {
29827
+ if (input.data.length < check.value) {
29828
+ ctx = this._getOrReturnCtx(input, ctx);
29829
+ addIssueToContext(ctx, {
29830
+ code: ZodIssueCode.too_small,
29831
+ minimum: check.value,
29832
+ type: "string",
29833
+ inclusive: true,
29834
+ exact: false,
29835
+ message: check.message
29836
+ });
29837
+ status.dirty();
29838
+ }
29839
+ } else if (check.kind === "max") {
29840
+ if (input.data.length > check.value) {
29841
+ ctx = this._getOrReturnCtx(input, ctx);
29842
+ addIssueToContext(ctx, {
29843
+ code: ZodIssueCode.too_big,
29844
+ maximum: check.value,
29845
+ type: "string",
29846
+ inclusive: true,
29847
+ exact: false,
29848
+ message: check.message
29849
+ });
29850
+ status.dirty();
29851
+ }
29852
+ } else if (check.kind === "length") {
29853
+ const tooBig = input.data.length > check.value;
29854
+ const tooSmall = input.data.length < check.value;
29855
+ if (tooBig || tooSmall) {
29856
+ ctx = this._getOrReturnCtx(input, ctx);
29857
+ if (tooBig) {
29858
+ addIssueToContext(ctx, {
29859
+ code: ZodIssueCode.too_big,
29860
+ maximum: check.value,
29861
+ type: "string",
29862
+ inclusive: true,
29863
+ exact: true,
29864
+ message: check.message
29865
+ });
29866
+ } else if (tooSmall) {
29867
+ addIssueToContext(ctx, {
29868
+ code: ZodIssueCode.too_small,
29869
+ minimum: check.value,
29870
+ type: "string",
29871
+ inclusive: true,
29872
+ exact: true,
29873
+ message: check.message
29874
+ });
29875
+ }
29876
+ status.dirty();
29877
+ }
29878
+ } else if (check.kind === "email") {
29879
+ if (!emailRegex.test(input.data)) {
29880
+ ctx = this._getOrReturnCtx(input, ctx);
29881
+ addIssueToContext(ctx, {
29882
+ validation: "email",
29883
+ code: ZodIssueCode.invalid_string,
29884
+ message: check.message
29885
+ });
29886
+ status.dirty();
29887
+ }
29888
+ } else if (check.kind === "emoji") {
29889
+ if (!emojiRegex) {
29890
+ emojiRegex = new RegExp(_emojiRegex, "u");
29891
+ }
29892
+ if (!emojiRegex.test(input.data)) {
29893
+ ctx = this._getOrReturnCtx(input, ctx);
29894
+ addIssueToContext(ctx, {
29895
+ validation: "emoji",
29896
+ code: ZodIssueCode.invalid_string,
29897
+ message: check.message
29898
+ });
29899
+ status.dirty();
29900
+ }
29901
+ } else if (check.kind === "uuid") {
29902
+ if (!uuidRegex.test(input.data)) {
29903
+ ctx = this._getOrReturnCtx(input, ctx);
29904
+ addIssueToContext(ctx, {
29905
+ validation: "uuid",
29906
+ code: ZodIssueCode.invalid_string,
29907
+ message: check.message
29908
+ });
29909
+ status.dirty();
29910
+ }
29911
+ } else if (check.kind === "nanoid") {
29912
+ if (!nanoidRegex.test(input.data)) {
29913
+ ctx = this._getOrReturnCtx(input, ctx);
29914
+ addIssueToContext(ctx, {
29915
+ validation: "nanoid",
29916
+ code: ZodIssueCode.invalid_string,
29917
+ message: check.message
29918
+ });
29919
+ status.dirty();
29920
+ }
29921
+ } else if (check.kind === "cuid") {
29922
+ if (!cuidRegex.test(input.data)) {
29923
+ ctx = this._getOrReturnCtx(input, ctx);
29924
+ addIssueToContext(ctx, {
29925
+ validation: "cuid",
29926
+ code: ZodIssueCode.invalid_string,
29927
+ message: check.message
29928
+ });
29929
+ status.dirty();
29930
+ }
29931
+ } else if (check.kind === "cuid2") {
29932
+ if (!cuid2Regex.test(input.data)) {
29933
+ ctx = this._getOrReturnCtx(input, ctx);
29934
+ addIssueToContext(ctx, {
29935
+ validation: "cuid2",
29936
+ code: ZodIssueCode.invalid_string,
29937
+ message: check.message
29938
+ });
29939
+ status.dirty();
29940
+ }
29941
+ } else if (check.kind === "ulid") {
29942
+ if (!ulidRegex.test(input.data)) {
29943
+ ctx = this._getOrReturnCtx(input, ctx);
29944
+ addIssueToContext(ctx, {
29945
+ validation: "ulid",
29946
+ code: ZodIssueCode.invalid_string,
29947
+ message: check.message
29948
+ });
29949
+ status.dirty();
29950
+ }
29951
+ } else if (check.kind === "url") {
29952
+ try {
29953
+ new URL(input.data);
29954
+ } catch {
29955
+ ctx = this._getOrReturnCtx(input, ctx);
29956
+ addIssueToContext(ctx, {
29957
+ validation: "url",
29958
+ code: ZodIssueCode.invalid_string,
29959
+ message: check.message
29960
+ });
29961
+ status.dirty();
29962
+ }
29963
+ } else if (check.kind === "regex") {
29964
+ check.regex.lastIndex = 0;
29965
+ const testResult = check.regex.test(input.data);
29966
+ if (!testResult) {
29967
+ ctx = this._getOrReturnCtx(input, ctx);
29968
+ addIssueToContext(ctx, {
29969
+ validation: "regex",
29970
+ code: ZodIssueCode.invalid_string,
29971
+ message: check.message
29972
+ });
29973
+ status.dirty();
29974
+ }
29975
+ } else if (check.kind === "trim") {
29976
+ input.data = input.data.trim();
29977
+ } else if (check.kind === "includes") {
29978
+ if (!input.data.includes(check.value, check.position)) {
29979
+ ctx = this._getOrReturnCtx(input, ctx);
29980
+ addIssueToContext(ctx, {
29981
+ code: ZodIssueCode.invalid_string,
29982
+ validation: { includes: check.value, position: check.position },
29983
+ message: check.message
29984
+ });
29985
+ status.dirty();
29986
+ }
29987
+ } else if (check.kind === "toLowerCase") {
29988
+ input.data = input.data.toLowerCase();
29989
+ } else if (check.kind === "toUpperCase") {
29990
+ input.data = input.data.toUpperCase();
29991
+ } else if (check.kind === "startsWith") {
29992
+ if (!input.data.startsWith(check.value)) {
29993
+ ctx = this._getOrReturnCtx(input, ctx);
29994
+ addIssueToContext(ctx, {
29995
+ code: ZodIssueCode.invalid_string,
29996
+ validation: { startsWith: check.value },
29997
+ message: check.message
29998
+ });
29999
+ status.dirty();
30000
+ }
30001
+ } else if (check.kind === "endsWith") {
30002
+ if (!input.data.endsWith(check.value)) {
30003
+ ctx = this._getOrReturnCtx(input, ctx);
30004
+ addIssueToContext(ctx, {
30005
+ code: ZodIssueCode.invalid_string,
30006
+ validation: { endsWith: check.value },
30007
+ message: check.message
30008
+ });
30009
+ status.dirty();
30010
+ }
30011
+ } else if (check.kind === "datetime") {
30012
+ const regex2 = datetimeRegex(check);
30013
+ if (!regex2.test(input.data)) {
30014
+ ctx = this._getOrReturnCtx(input, ctx);
30015
+ addIssueToContext(ctx, {
30016
+ code: ZodIssueCode.invalid_string,
30017
+ validation: "datetime",
30018
+ message: check.message
30019
+ });
30020
+ status.dirty();
30021
+ }
30022
+ } else if (check.kind === "date") {
30023
+ const regex2 = dateRegex;
30024
+ if (!regex2.test(input.data)) {
30025
+ ctx = this._getOrReturnCtx(input, ctx);
30026
+ addIssueToContext(ctx, {
30027
+ code: ZodIssueCode.invalid_string,
30028
+ validation: "date",
30029
+ message: check.message
30030
+ });
30031
+ status.dirty();
30032
+ }
30033
+ } else if (check.kind === "time") {
30034
+ const regex2 = timeRegex(check);
30035
+ if (!regex2.test(input.data)) {
30036
+ ctx = this._getOrReturnCtx(input, ctx);
30037
+ addIssueToContext(ctx, {
30038
+ code: ZodIssueCode.invalid_string,
30039
+ validation: "time",
30040
+ message: check.message
30041
+ });
30042
+ status.dirty();
30043
+ }
30044
+ } else if (check.kind === "duration") {
30045
+ if (!durationRegex.test(input.data)) {
30046
+ ctx = this._getOrReturnCtx(input, ctx);
30047
+ addIssueToContext(ctx, {
30048
+ validation: "duration",
30049
+ code: ZodIssueCode.invalid_string,
30050
+ message: check.message
30051
+ });
30052
+ status.dirty();
30053
+ }
30054
+ } else if (check.kind === "ip") {
30055
+ if (!isValidIP(input.data, check.version)) {
30056
+ ctx = this._getOrReturnCtx(input, ctx);
30057
+ addIssueToContext(ctx, {
30058
+ validation: "ip",
30059
+ code: ZodIssueCode.invalid_string,
30060
+ message: check.message
30061
+ });
30062
+ status.dirty();
30063
+ }
30064
+ } else if (check.kind === "jwt") {
30065
+ if (!isValidJWT(input.data, check.alg)) {
30066
+ ctx = this._getOrReturnCtx(input, ctx);
30067
+ addIssueToContext(ctx, {
30068
+ validation: "jwt",
30069
+ code: ZodIssueCode.invalid_string,
30070
+ message: check.message
30071
+ });
30072
+ status.dirty();
30073
+ }
30074
+ } else if (check.kind === "cidr") {
30075
+ if (!isValidCidr(input.data, check.version)) {
30076
+ ctx = this._getOrReturnCtx(input, ctx);
30077
+ addIssueToContext(ctx, {
30078
+ validation: "cidr",
30079
+ code: ZodIssueCode.invalid_string,
30080
+ message: check.message
30081
+ });
30082
+ status.dirty();
30083
+ }
30084
+ } else if (check.kind === "base64") {
30085
+ if (!base64Regex.test(input.data)) {
30086
+ ctx = this._getOrReturnCtx(input, ctx);
30087
+ addIssueToContext(ctx, {
30088
+ validation: "base64",
30089
+ code: ZodIssueCode.invalid_string,
30090
+ message: check.message
30091
+ });
30092
+ status.dirty();
30093
+ }
30094
+ } else if (check.kind === "base64url") {
30095
+ if (!base64urlRegex.test(input.data)) {
30096
+ ctx = this._getOrReturnCtx(input, ctx);
30097
+ addIssueToContext(ctx, {
30098
+ validation: "base64url",
30099
+ code: ZodIssueCode.invalid_string,
30100
+ message: check.message
30101
+ });
30102
+ status.dirty();
30103
+ }
30104
+ } else {
30105
+ util.assertNever(check);
30106
+ }
30107
+ }
30108
+ return { status: status.value, value: input.data };
30109
+ }
30110
+ _regex(regex2, validation, message) {
30111
+ return this.refinement((data) => regex2.test(data), {
30112
+ validation,
30113
+ code: ZodIssueCode.invalid_string,
30114
+ ...errorUtil.errToObj(message)
30115
+ });
30116
+ }
30117
+ _addCheck(check) {
30118
+ return new _ZodString({
30119
+ ...this._def,
30120
+ checks: [...this._def.checks, check]
30121
+ });
30122
+ }
30123
+ email(message) {
30124
+ return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
30125
+ }
30126
+ url(message) {
30127
+ return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
30128
+ }
30129
+ emoji(message) {
30130
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
30131
+ }
30132
+ uuid(message) {
30133
+ return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
30134
+ }
30135
+ nanoid(message) {
30136
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
30137
+ }
30138
+ cuid(message) {
30139
+ return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
30140
+ }
30141
+ cuid2(message) {
30142
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
30143
+ }
30144
+ ulid(message) {
30145
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
30146
+ }
30147
+ base64(message) {
30148
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
30149
+ }
30150
+ base64url(message) {
30151
+ return this._addCheck({
30152
+ kind: "base64url",
30153
+ ...errorUtil.errToObj(message)
30154
+ });
30155
+ }
30156
+ jwt(options) {
30157
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
30158
+ }
30159
+ ip(options) {
30160
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
30161
+ }
30162
+ cidr(options) {
30163
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
30164
+ }
30165
+ datetime(options) {
30166
+ if (typeof options === "string") {
30167
+ return this._addCheck({
30168
+ kind: "datetime",
30169
+ precision: null,
30170
+ offset: false,
30171
+ local: false,
30172
+ message: options
30173
+ });
30174
+ }
30175
+ return this._addCheck({
30176
+ kind: "datetime",
30177
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
30178
+ offset: options?.offset ?? false,
30179
+ local: options?.local ?? false,
30180
+ ...errorUtil.errToObj(options?.message)
30181
+ });
30182
+ }
30183
+ date(message) {
30184
+ return this._addCheck({ kind: "date", message });
30185
+ }
30186
+ time(options) {
30187
+ if (typeof options === "string") {
30188
+ return this._addCheck({
30189
+ kind: "time",
30190
+ precision: null,
30191
+ message: options
30192
+ });
30193
+ }
30194
+ return this._addCheck({
30195
+ kind: "time",
30196
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
30197
+ ...errorUtil.errToObj(options?.message)
30198
+ });
30199
+ }
30200
+ duration(message) {
30201
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
30202
+ }
30203
+ regex(regex2, message) {
30204
+ return this._addCheck({
30205
+ kind: "regex",
30206
+ regex: regex2,
30207
+ ...errorUtil.errToObj(message)
30208
+ });
30209
+ }
30210
+ includes(value, options) {
30211
+ return this._addCheck({
30212
+ kind: "includes",
30213
+ value,
30214
+ position: options?.position,
30215
+ ...errorUtil.errToObj(options?.message)
30216
+ });
30217
+ }
30218
+ startsWith(value, message) {
30219
+ return this._addCheck({
30220
+ kind: "startsWith",
30221
+ value,
30222
+ ...errorUtil.errToObj(message)
30223
+ });
30224
+ }
30225
+ endsWith(value, message) {
30226
+ return this._addCheck({
30227
+ kind: "endsWith",
30228
+ value,
30229
+ ...errorUtil.errToObj(message)
30230
+ });
30231
+ }
30232
+ min(minLength, message) {
30233
+ return this._addCheck({
30234
+ kind: "min",
30235
+ value: minLength,
30236
+ ...errorUtil.errToObj(message)
30237
+ });
30238
+ }
30239
+ max(maxLength, message) {
30240
+ return this._addCheck({
30241
+ kind: "max",
30242
+ value: maxLength,
30243
+ ...errorUtil.errToObj(message)
30244
+ });
30245
+ }
30246
+ length(len, message) {
30247
+ return this._addCheck({
30248
+ kind: "length",
30249
+ value: len,
30250
+ ...errorUtil.errToObj(message)
30251
+ });
30252
+ }
30253
+ /**
30254
+ * Equivalent to `.min(1)`
30255
+ */
30256
+ nonempty(message) {
30257
+ return this.min(1, errorUtil.errToObj(message));
30258
+ }
30259
+ trim() {
30260
+ return new _ZodString({
30261
+ ...this._def,
30262
+ checks: [...this._def.checks, { kind: "trim" }]
30263
+ });
30264
+ }
30265
+ toLowerCase() {
30266
+ return new _ZodString({
30267
+ ...this._def,
30268
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
30269
+ });
30270
+ }
30271
+ toUpperCase() {
30272
+ return new _ZodString({
30273
+ ...this._def,
30274
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
30275
+ });
30276
+ }
30277
+ get isDatetime() {
30278
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
30279
+ }
30280
+ get isDate() {
30281
+ return !!this._def.checks.find((ch) => ch.kind === "date");
30282
+ }
30283
+ get isTime() {
30284
+ return !!this._def.checks.find((ch) => ch.kind === "time");
30285
+ }
30286
+ get isDuration() {
30287
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
30288
+ }
30289
+ get isEmail() {
30290
+ return !!this._def.checks.find((ch) => ch.kind === "email");
30291
+ }
30292
+ get isURL() {
30293
+ return !!this._def.checks.find((ch) => ch.kind === "url");
30294
+ }
30295
+ get isEmoji() {
30296
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
30297
+ }
30298
+ get isUUID() {
30299
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
30300
+ }
30301
+ get isNANOID() {
30302
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
30303
+ }
30304
+ get isCUID() {
30305
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
30306
+ }
30307
+ get isCUID2() {
30308
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
30309
+ }
30310
+ get isULID() {
30311
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
30312
+ }
30313
+ get isIP() {
30314
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
30315
+ }
30316
+ get isCIDR() {
30317
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
30318
+ }
30319
+ get isBase64() {
30320
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
30321
+ }
30322
+ get isBase64url() {
30323
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
30324
+ }
30325
+ get minLength() {
30326
+ let min = null;
30327
+ for (const ch of this._def.checks) {
30328
+ if (ch.kind === "min") {
30329
+ if (min === null || ch.value > min)
30330
+ min = ch.value;
30331
+ }
30332
+ }
30333
+ return min;
30334
+ }
30335
+ get maxLength() {
30336
+ let max = null;
30337
+ for (const ch of this._def.checks) {
30338
+ if (ch.kind === "max") {
30339
+ if (max === null || ch.value < max)
30340
+ max = ch.value;
30341
+ }
30342
+ }
30343
+ return max;
30344
+ }
30345
+ };
30346
+ ZodString.create = (params) => {
30347
+ return new ZodString({
30348
+ checks: [],
30349
+ typeName: ZodFirstPartyTypeKind.ZodString,
30350
+ coerce: params?.coerce ?? false,
30351
+ ...processCreateParams(params)
30352
+ });
30353
+ };
30354
+ function floatSafeRemainder(val, step) {
30355
+ const valDecCount = (val.toString().split(".")[1] || "").length;
30356
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
30357
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
30358
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
30359
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
30360
+ return valInt % stepInt / 10 ** decCount;
30361
+ }
30362
+ var ZodNumber = class _ZodNumber extends ZodType {
30363
+ constructor() {
30364
+ super(...arguments);
30365
+ this.min = this.gte;
30366
+ this.max = this.lte;
30367
+ this.step = this.multipleOf;
30368
+ }
30369
+ _parse(input) {
30370
+ if (this._def.coerce) {
30371
+ input.data = Number(input.data);
30372
+ }
30373
+ const parsedType = this._getType(input);
30374
+ if (parsedType !== ZodParsedType.number) {
30375
+ const ctx2 = this._getOrReturnCtx(input);
30376
+ addIssueToContext(ctx2, {
30377
+ code: ZodIssueCode.invalid_type,
30378
+ expected: ZodParsedType.number,
30379
+ received: ctx2.parsedType
30380
+ });
30381
+ return INVALID;
30382
+ }
30383
+ let ctx = void 0;
30384
+ const status = new ParseStatus();
30385
+ for (const check of this._def.checks) {
30386
+ if (check.kind === "int") {
30387
+ if (!util.isInteger(input.data)) {
30388
+ ctx = this._getOrReturnCtx(input, ctx);
30389
+ addIssueToContext(ctx, {
30390
+ code: ZodIssueCode.invalid_type,
30391
+ expected: "integer",
30392
+ received: "float",
30393
+ message: check.message
30394
+ });
30395
+ status.dirty();
30396
+ }
30397
+ } else if (check.kind === "min") {
30398
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
30399
+ if (tooSmall) {
30400
+ ctx = this._getOrReturnCtx(input, ctx);
30401
+ addIssueToContext(ctx, {
30402
+ code: ZodIssueCode.too_small,
30403
+ minimum: check.value,
30404
+ type: "number",
30405
+ inclusive: check.inclusive,
30406
+ exact: false,
30407
+ message: check.message
30408
+ });
30409
+ status.dirty();
30410
+ }
30411
+ } else if (check.kind === "max") {
30412
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
30413
+ if (tooBig) {
30414
+ ctx = this._getOrReturnCtx(input, ctx);
30415
+ addIssueToContext(ctx, {
30416
+ code: ZodIssueCode.too_big,
30417
+ maximum: check.value,
30418
+ type: "number",
30419
+ inclusive: check.inclusive,
30420
+ exact: false,
30421
+ message: check.message
30422
+ });
30423
+ status.dirty();
30424
+ }
30425
+ } else if (check.kind === "multipleOf") {
30426
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
30427
+ ctx = this._getOrReturnCtx(input, ctx);
30428
+ addIssueToContext(ctx, {
30429
+ code: ZodIssueCode.not_multiple_of,
30430
+ multipleOf: check.value,
30431
+ message: check.message
30432
+ });
30433
+ status.dirty();
30434
+ }
30435
+ } else if (check.kind === "finite") {
30436
+ if (!Number.isFinite(input.data)) {
30437
+ ctx = this._getOrReturnCtx(input, ctx);
30438
+ addIssueToContext(ctx, {
30439
+ code: ZodIssueCode.not_finite,
30440
+ message: check.message
30441
+ });
30442
+ status.dirty();
30443
+ }
30444
+ } else {
30445
+ util.assertNever(check);
30446
+ }
30447
+ }
30448
+ return { status: status.value, value: input.data };
30449
+ }
30450
+ gte(value, message) {
30451
+ return this.setLimit("min", value, true, errorUtil.toString(message));
30452
+ }
30453
+ gt(value, message) {
30454
+ return this.setLimit("min", value, false, errorUtil.toString(message));
30455
+ }
30456
+ lte(value, message) {
30457
+ return this.setLimit("max", value, true, errorUtil.toString(message));
30458
+ }
30459
+ lt(value, message) {
30460
+ return this.setLimit("max", value, false, errorUtil.toString(message));
30461
+ }
30462
+ setLimit(kind, value, inclusive, message) {
30463
+ return new _ZodNumber({
30464
+ ...this._def,
30465
+ checks: [
30466
+ ...this._def.checks,
30467
+ {
30468
+ kind,
30469
+ value,
30470
+ inclusive,
30471
+ message: errorUtil.toString(message)
30472
+ }
30473
+ ]
30474
+ });
30475
+ }
30476
+ _addCheck(check) {
30477
+ return new _ZodNumber({
30478
+ ...this._def,
30479
+ checks: [...this._def.checks, check]
30480
+ });
30481
+ }
30482
+ int(message) {
30483
+ return this._addCheck({
30484
+ kind: "int",
30485
+ message: errorUtil.toString(message)
30486
+ });
30487
+ }
30488
+ positive(message) {
30489
+ return this._addCheck({
30490
+ kind: "min",
30491
+ value: 0,
30492
+ inclusive: false,
30493
+ message: errorUtil.toString(message)
30494
+ });
30495
+ }
30496
+ negative(message) {
30497
+ return this._addCheck({
30498
+ kind: "max",
30499
+ value: 0,
30500
+ inclusive: false,
30501
+ message: errorUtil.toString(message)
30502
+ });
30503
+ }
30504
+ nonpositive(message) {
30505
+ return this._addCheck({
30506
+ kind: "max",
30507
+ value: 0,
30508
+ inclusive: true,
30509
+ message: errorUtil.toString(message)
30510
+ });
30511
+ }
30512
+ nonnegative(message) {
30513
+ return this._addCheck({
30514
+ kind: "min",
30515
+ value: 0,
30516
+ inclusive: true,
30517
+ message: errorUtil.toString(message)
30518
+ });
30519
+ }
30520
+ multipleOf(value, message) {
30521
+ return this._addCheck({
30522
+ kind: "multipleOf",
30523
+ value,
30524
+ message: errorUtil.toString(message)
30525
+ });
30526
+ }
30527
+ finite(message) {
30528
+ return this._addCheck({
30529
+ kind: "finite",
30530
+ message: errorUtil.toString(message)
30531
+ });
30532
+ }
30533
+ safe(message) {
30534
+ return this._addCheck({
30535
+ kind: "min",
30536
+ inclusive: true,
30537
+ value: Number.MIN_SAFE_INTEGER,
30538
+ message: errorUtil.toString(message)
30539
+ })._addCheck({
30540
+ kind: "max",
30541
+ inclusive: true,
30542
+ value: Number.MAX_SAFE_INTEGER,
30543
+ message: errorUtil.toString(message)
30544
+ });
30545
+ }
30546
+ get minValue() {
30547
+ let min = null;
30548
+ for (const ch of this._def.checks) {
30549
+ if (ch.kind === "min") {
30550
+ if (min === null || ch.value > min)
30551
+ min = ch.value;
30552
+ }
30553
+ }
30554
+ return min;
30555
+ }
30556
+ get maxValue() {
30557
+ let max = null;
30558
+ for (const ch of this._def.checks) {
30559
+ if (ch.kind === "max") {
30560
+ if (max === null || ch.value < max)
30561
+ max = ch.value;
30562
+ }
30563
+ }
30564
+ return max;
30565
+ }
30566
+ get isInt() {
30567
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
30568
+ }
30569
+ get isFinite() {
30570
+ let max = null;
30571
+ let min = null;
30572
+ for (const ch of this._def.checks) {
30573
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
30574
+ return true;
30575
+ } else if (ch.kind === "min") {
30576
+ if (min === null || ch.value > min)
30577
+ min = ch.value;
30578
+ } else if (ch.kind === "max") {
30579
+ if (max === null || ch.value < max)
30580
+ max = ch.value;
30581
+ }
30582
+ }
30583
+ return Number.isFinite(min) && Number.isFinite(max);
30584
+ }
30585
+ };
30586
+ ZodNumber.create = (params) => {
30587
+ return new ZodNumber({
30588
+ checks: [],
30589
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
30590
+ coerce: params?.coerce || false,
30591
+ ...processCreateParams(params)
30592
+ });
30593
+ };
30594
+ var ZodBigInt = class _ZodBigInt extends ZodType {
30595
+ constructor() {
30596
+ super(...arguments);
30597
+ this.min = this.gte;
30598
+ this.max = this.lte;
30599
+ }
30600
+ _parse(input) {
30601
+ if (this._def.coerce) {
30602
+ try {
30603
+ input.data = BigInt(input.data);
30604
+ } catch {
30605
+ return this._getInvalidInput(input);
30606
+ }
30607
+ }
30608
+ const parsedType = this._getType(input);
30609
+ if (parsedType !== ZodParsedType.bigint) {
30610
+ return this._getInvalidInput(input);
30611
+ }
30612
+ let ctx = void 0;
30613
+ const status = new ParseStatus();
30614
+ for (const check of this._def.checks) {
30615
+ if (check.kind === "min") {
30616
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
30617
+ if (tooSmall) {
30618
+ ctx = this._getOrReturnCtx(input, ctx);
30619
+ addIssueToContext(ctx, {
30620
+ code: ZodIssueCode.too_small,
30621
+ type: "bigint",
30622
+ minimum: check.value,
30623
+ inclusive: check.inclusive,
30624
+ message: check.message
30625
+ });
30626
+ status.dirty();
30627
+ }
30628
+ } else if (check.kind === "max") {
30629
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
30630
+ if (tooBig) {
30631
+ ctx = this._getOrReturnCtx(input, ctx);
30632
+ addIssueToContext(ctx, {
30633
+ code: ZodIssueCode.too_big,
30634
+ type: "bigint",
30635
+ maximum: check.value,
30636
+ inclusive: check.inclusive,
30637
+ message: check.message
30638
+ });
30639
+ status.dirty();
30640
+ }
30641
+ } else if (check.kind === "multipleOf") {
30642
+ if (input.data % check.value !== BigInt(0)) {
30643
+ ctx = this._getOrReturnCtx(input, ctx);
30644
+ addIssueToContext(ctx, {
30645
+ code: ZodIssueCode.not_multiple_of,
30646
+ multipleOf: check.value,
30647
+ message: check.message
30648
+ });
30649
+ status.dirty();
30650
+ }
30651
+ } else {
30652
+ util.assertNever(check);
30653
+ }
30654
+ }
30655
+ return { status: status.value, value: input.data };
30656
+ }
30657
+ _getInvalidInput(input) {
30658
+ const ctx = this._getOrReturnCtx(input);
30659
+ addIssueToContext(ctx, {
30660
+ code: ZodIssueCode.invalid_type,
30661
+ expected: ZodParsedType.bigint,
30662
+ received: ctx.parsedType
30663
+ });
30664
+ return INVALID;
30665
+ }
30666
+ gte(value, message) {
30667
+ return this.setLimit("min", value, true, errorUtil.toString(message));
30668
+ }
30669
+ gt(value, message) {
30670
+ return this.setLimit("min", value, false, errorUtil.toString(message));
30671
+ }
30672
+ lte(value, message) {
30673
+ return this.setLimit("max", value, true, errorUtil.toString(message));
30674
+ }
30675
+ lt(value, message) {
30676
+ return this.setLimit("max", value, false, errorUtil.toString(message));
30677
+ }
30678
+ setLimit(kind, value, inclusive, message) {
30679
+ return new _ZodBigInt({
30680
+ ...this._def,
30681
+ checks: [
30682
+ ...this._def.checks,
30683
+ {
30684
+ kind,
30685
+ value,
30686
+ inclusive,
30687
+ message: errorUtil.toString(message)
30688
+ }
30689
+ ]
30690
+ });
30691
+ }
30692
+ _addCheck(check) {
30693
+ return new _ZodBigInt({
30694
+ ...this._def,
30695
+ checks: [...this._def.checks, check]
30696
+ });
30697
+ }
30698
+ positive(message) {
30699
+ return this._addCheck({
30700
+ kind: "min",
30701
+ value: BigInt(0),
30702
+ inclusive: false,
30703
+ message: errorUtil.toString(message)
30704
+ });
30705
+ }
30706
+ negative(message) {
30707
+ return this._addCheck({
30708
+ kind: "max",
30709
+ value: BigInt(0),
30710
+ inclusive: false,
30711
+ message: errorUtil.toString(message)
30712
+ });
30713
+ }
30714
+ nonpositive(message) {
30715
+ return this._addCheck({
30716
+ kind: "max",
30717
+ value: BigInt(0),
30718
+ inclusive: true,
30719
+ message: errorUtil.toString(message)
30720
+ });
30721
+ }
30722
+ nonnegative(message) {
30723
+ return this._addCheck({
30724
+ kind: "min",
30725
+ value: BigInt(0),
30726
+ inclusive: true,
30727
+ message: errorUtil.toString(message)
30728
+ });
30729
+ }
30730
+ multipleOf(value, message) {
30731
+ return this._addCheck({
30732
+ kind: "multipleOf",
30733
+ value,
30734
+ message: errorUtil.toString(message)
30735
+ });
30736
+ }
30737
+ get minValue() {
30738
+ let min = null;
30739
+ for (const ch of this._def.checks) {
30740
+ if (ch.kind === "min") {
30741
+ if (min === null || ch.value > min)
30742
+ min = ch.value;
30743
+ }
30744
+ }
30745
+ return min;
30746
+ }
30747
+ get maxValue() {
30748
+ let max = null;
30749
+ for (const ch of this._def.checks) {
30750
+ if (ch.kind === "max") {
30751
+ if (max === null || ch.value < max)
30752
+ max = ch.value;
30753
+ }
30754
+ }
30755
+ return max;
30756
+ }
30757
+ };
30758
+ ZodBigInt.create = (params) => {
30759
+ return new ZodBigInt({
30760
+ checks: [],
30761
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
30762
+ coerce: params?.coerce ?? false,
30763
+ ...processCreateParams(params)
30764
+ });
30765
+ };
30766
+ var ZodBoolean = class extends ZodType {
30767
+ _parse(input) {
30768
+ if (this._def.coerce) {
30769
+ input.data = Boolean(input.data);
30770
+ }
30771
+ const parsedType = this._getType(input);
30772
+ if (parsedType !== ZodParsedType.boolean) {
30773
+ const ctx = this._getOrReturnCtx(input);
30774
+ addIssueToContext(ctx, {
30775
+ code: ZodIssueCode.invalid_type,
30776
+ expected: ZodParsedType.boolean,
30777
+ received: ctx.parsedType
30778
+ });
30779
+ return INVALID;
30780
+ }
30781
+ return OK(input.data);
30782
+ }
30783
+ };
30784
+ ZodBoolean.create = (params) => {
30785
+ return new ZodBoolean({
30786
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
30787
+ coerce: params?.coerce || false,
30788
+ ...processCreateParams(params)
30789
+ });
30790
+ };
30791
+ var ZodDate = class _ZodDate extends ZodType {
30792
+ _parse(input) {
30793
+ if (this._def.coerce) {
30794
+ input.data = new Date(input.data);
30795
+ }
30796
+ const parsedType = this._getType(input);
30797
+ if (parsedType !== ZodParsedType.date) {
30798
+ const ctx2 = this._getOrReturnCtx(input);
30799
+ addIssueToContext(ctx2, {
30800
+ code: ZodIssueCode.invalid_type,
30801
+ expected: ZodParsedType.date,
30802
+ received: ctx2.parsedType
30803
+ });
30804
+ return INVALID;
30805
+ }
30806
+ if (Number.isNaN(input.data.getTime())) {
30807
+ const ctx2 = this._getOrReturnCtx(input);
30808
+ addIssueToContext(ctx2, {
30809
+ code: ZodIssueCode.invalid_date
30810
+ });
30811
+ return INVALID;
30812
+ }
30813
+ const status = new ParseStatus();
30814
+ let ctx = void 0;
30815
+ for (const check of this._def.checks) {
30816
+ if (check.kind === "min") {
30817
+ if (input.data.getTime() < check.value) {
30818
+ ctx = this._getOrReturnCtx(input, ctx);
30819
+ addIssueToContext(ctx, {
30820
+ code: ZodIssueCode.too_small,
30821
+ message: check.message,
30822
+ inclusive: true,
30823
+ exact: false,
30824
+ minimum: check.value,
30825
+ type: "date"
30826
+ });
30827
+ status.dirty();
30828
+ }
30829
+ } else if (check.kind === "max") {
30830
+ if (input.data.getTime() > check.value) {
30831
+ ctx = this._getOrReturnCtx(input, ctx);
30832
+ addIssueToContext(ctx, {
30833
+ code: ZodIssueCode.too_big,
30834
+ message: check.message,
30835
+ inclusive: true,
30836
+ exact: false,
30837
+ maximum: check.value,
30838
+ type: "date"
30839
+ });
30840
+ status.dirty();
30841
+ }
30842
+ } else {
30843
+ util.assertNever(check);
30844
+ }
30845
+ }
30846
+ return {
30847
+ status: status.value,
30848
+ value: new Date(input.data.getTime())
30849
+ };
30850
+ }
30851
+ _addCheck(check) {
30852
+ return new _ZodDate({
30853
+ ...this._def,
30854
+ checks: [...this._def.checks, check]
30855
+ });
30856
+ }
30857
+ min(minDate, message) {
30858
+ return this._addCheck({
30859
+ kind: "min",
30860
+ value: minDate.getTime(),
30861
+ message: errorUtil.toString(message)
30862
+ });
30863
+ }
30864
+ max(maxDate, message) {
30865
+ return this._addCheck({
30866
+ kind: "max",
30867
+ value: maxDate.getTime(),
30868
+ message: errorUtil.toString(message)
30869
+ });
30870
+ }
30871
+ get minDate() {
30872
+ let min = null;
30873
+ for (const ch of this._def.checks) {
30874
+ if (ch.kind === "min") {
30875
+ if (min === null || ch.value > min)
30876
+ min = ch.value;
30877
+ }
30878
+ }
30879
+ return min != null ? new Date(min) : null;
30880
+ }
30881
+ get maxDate() {
30882
+ let max = null;
30883
+ for (const ch of this._def.checks) {
30884
+ if (ch.kind === "max") {
30885
+ if (max === null || ch.value < max)
30886
+ max = ch.value;
30887
+ }
30888
+ }
30889
+ return max != null ? new Date(max) : null;
30890
+ }
30891
+ };
30892
+ ZodDate.create = (params) => {
30893
+ return new ZodDate({
30894
+ checks: [],
30895
+ coerce: params?.coerce || false,
30896
+ typeName: ZodFirstPartyTypeKind.ZodDate,
30897
+ ...processCreateParams(params)
30898
+ });
30899
+ };
30900
+ var ZodSymbol = class extends ZodType {
30901
+ _parse(input) {
30902
+ const parsedType = this._getType(input);
30903
+ if (parsedType !== ZodParsedType.symbol) {
30904
+ const ctx = this._getOrReturnCtx(input);
30905
+ addIssueToContext(ctx, {
30906
+ code: ZodIssueCode.invalid_type,
30907
+ expected: ZodParsedType.symbol,
30908
+ received: ctx.parsedType
30909
+ });
30910
+ return INVALID;
30911
+ }
30912
+ return OK(input.data);
30913
+ }
30914
+ };
30915
+ ZodSymbol.create = (params) => {
30916
+ return new ZodSymbol({
30917
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
30918
+ ...processCreateParams(params)
30919
+ });
30920
+ };
30921
+ var ZodUndefined = class extends ZodType {
30922
+ _parse(input) {
30923
+ const parsedType = this._getType(input);
30924
+ if (parsedType !== ZodParsedType.undefined) {
30925
+ const ctx = this._getOrReturnCtx(input);
30926
+ addIssueToContext(ctx, {
30927
+ code: ZodIssueCode.invalid_type,
30928
+ expected: ZodParsedType.undefined,
30929
+ received: ctx.parsedType
30930
+ });
30931
+ return INVALID;
30932
+ }
30933
+ return OK(input.data);
30934
+ }
30935
+ };
30936
+ ZodUndefined.create = (params) => {
30937
+ return new ZodUndefined({
30938
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
30939
+ ...processCreateParams(params)
30940
+ });
30941
+ };
30942
+ var ZodNull = class extends ZodType {
30943
+ _parse(input) {
30944
+ const parsedType = this._getType(input);
30945
+ if (parsedType !== ZodParsedType.null) {
30946
+ const ctx = this._getOrReturnCtx(input);
30947
+ addIssueToContext(ctx, {
30948
+ code: ZodIssueCode.invalid_type,
30949
+ expected: ZodParsedType.null,
30950
+ received: ctx.parsedType
30951
+ });
30952
+ return INVALID;
30953
+ }
30954
+ return OK(input.data);
30955
+ }
30956
+ };
30957
+ ZodNull.create = (params) => {
30958
+ return new ZodNull({
30959
+ typeName: ZodFirstPartyTypeKind.ZodNull,
30960
+ ...processCreateParams(params)
30961
+ });
30962
+ };
30963
+ var ZodAny = class extends ZodType {
30964
+ constructor() {
30965
+ super(...arguments);
30966
+ this._any = true;
30967
+ }
30968
+ _parse(input) {
30969
+ return OK(input.data);
30970
+ }
30971
+ };
30972
+ ZodAny.create = (params) => {
30973
+ return new ZodAny({
30974
+ typeName: ZodFirstPartyTypeKind.ZodAny,
30975
+ ...processCreateParams(params)
30976
+ });
30977
+ };
30978
+ var ZodUnknown = class extends ZodType {
30979
+ constructor() {
30980
+ super(...arguments);
30981
+ this._unknown = true;
30982
+ }
30983
+ _parse(input) {
30984
+ return OK(input.data);
30985
+ }
30986
+ };
30987
+ ZodUnknown.create = (params) => {
30988
+ return new ZodUnknown({
30989
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
30990
+ ...processCreateParams(params)
30991
+ });
30992
+ };
30993
+ var ZodNever = class extends ZodType {
30994
+ _parse(input) {
30995
+ const ctx = this._getOrReturnCtx(input);
30996
+ addIssueToContext(ctx, {
30997
+ code: ZodIssueCode.invalid_type,
30998
+ expected: ZodParsedType.never,
30999
+ received: ctx.parsedType
31000
+ });
31001
+ return INVALID;
31002
+ }
31003
+ };
31004
+ ZodNever.create = (params) => {
31005
+ return new ZodNever({
31006
+ typeName: ZodFirstPartyTypeKind.ZodNever,
31007
+ ...processCreateParams(params)
31008
+ });
31009
+ };
31010
+ var ZodVoid = class extends ZodType {
31011
+ _parse(input) {
31012
+ const parsedType = this._getType(input);
31013
+ if (parsedType !== ZodParsedType.undefined) {
31014
+ const ctx = this._getOrReturnCtx(input);
31015
+ addIssueToContext(ctx, {
31016
+ code: ZodIssueCode.invalid_type,
31017
+ expected: ZodParsedType.void,
31018
+ received: ctx.parsedType
31019
+ });
31020
+ return INVALID;
31021
+ }
31022
+ return OK(input.data);
31023
+ }
31024
+ };
31025
+ ZodVoid.create = (params) => {
31026
+ return new ZodVoid({
31027
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
31028
+ ...processCreateParams(params)
31029
+ });
31030
+ };
31031
+ var ZodArray = class _ZodArray extends ZodType {
31032
+ _parse(input) {
31033
+ const { ctx, status } = this._processInputParams(input);
31034
+ const def = this._def;
31035
+ if (ctx.parsedType !== ZodParsedType.array) {
31036
+ addIssueToContext(ctx, {
31037
+ code: ZodIssueCode.invalid_type,
31038
+ expected: ZodParsedType.array,
31039
+ received: ctx.parsedType
31040
+ });
31041
+ return INVALID;
31042
+ }
31043
+ if (def.exactLength !== null) {
31044
+ const tooBig = ctx.data.length > def.exactLength.value;
31045
+ const tooSmall = ctx.data.length < def.exactLength.value;
31046
+ if (tooBig || tooSmall) {
31047
+ addIssueToContext(ctx, {
31048
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
31049
+ minimum: tooSmall ? def.exactLength.value : void 0,
31050
+ maximum: tooBig ? def.exactLength.value : void 0,
31051
+ type: "array",
31052
+ inclusive: true,
31053
+ exact: true,
31054
+ message: def.exactLength.message
31055
+ });
31056
+ status.dirty();
31057
+ }
31058
+ }
31059
+ if (def.minLength !== null) {
31060
+ if (ctx.data.length < def.minLength.value) {
31061
+ addIssueToContext(ctx, {
31062
+ code: ZodIssueCode.too_small,
31063
+ minimum: def.minLength.value,
31064
+ type: "array",
31065
+ inclusive: true,
31066
+ exact: false,
31067
+ message: def.minLength.message
31068
+ });
31069
+ status.dirty();
31070
+ }
31071
+ }
31072
+ if (def.maxLength !== null) {
31073
+ if (ctx.data.length > def.maxLength.value) {
31074
+ addIssueToContext(ctx, {
31075
+ code: ZodIssueCode.too_big,
31076
+ maximum: def.maxLength.value,
31077
+ type: "array",
31078
+ inclusive: true,
31079
+ exact: false,
31080
+ message: def.maxLength.message
31081
+ });
31082
+ status.dirty();
31083
+ }
31084
+ }
31085
+ if (ctx.common.async) {
31086
+ return Promise.all([...ctx.data].map((item, i) => {
31087
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
31088
+ })).then((result2) => {
31089
+ return ParseStatus.mergeArray(status, result2);
31090
+ });
31091
+ }
31092
+ const result = [...ctx.data].map((item, i) => {
31093
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
31094
+ });
31095
+ return ParseStatus.mergeArray(status, result);
31096
+ }
31097
+ get element() {
31098
+ return this._def.type;
31099
+ }
31100
+ min(minLength, message) {
31101
+ return new _ZodArray({
31102
+ ...this._def,
31103
+ minLength: { value: minLength, message: errorUtil.toString(message) }
31104
+ });
31105
+ }
31106
+ max(maxLength, message) {
31107
+ return new _ZodArray({
31108
+ ...this._def,
31109
+ maxLength: { value: maxLength, message: errorUtil.toString(message) }
31110
+ });
31111
+ }
31112
+ length(len, message) {
31113
+ return new _ZodArray({
31114
+ ...this._def,
31115
+ exactLength: { value: len, message: errorUtil.toString(message) }
31116
+ });
31117
+ }
31118
+ nonempty(message) {
31119
+ return this.min(1, message);
31120
+ }
31121
+ };
31122
+ ZodArray.create = (schema, params) => {
31123
+ return new ZodArray({
31124
+ type: schema,
31125
+ minLength: null,
31126
+ maxLength: null,
31127
+ exactLength: null,
31128
+ typeName: ZodFirstPartyTypeKind.ZodArray,
31129
+ ...processCreateParams(params)
31130
+ });
31131
+ };
31132
+ function deepPartialify(schema) {
31133
+ if (schema instanceof ZodObject) {
31134
+ const newShape = {};
31135
+ for (const key in schema.shape) {
31136
+ const fieldSchema = schema.shape[key];
31137
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
31138
+ }
31139
+ return new ZodObject({
31140
+ ...schema._def,
31141
+ shape: () => newShape
31142
+ });
31143
+ } else if (schema instanceof ZodArray) {
31144
+ return new ZodArray({
31145
+ ...schema._def,
31146
+ type: deepPartialify(schema.element)
31147
+ });
31148
+ } else if (schema instanceof ZodOptional) {
31149
+ return ZodOptional.create(deepPartialify(schema.unwrap()));
31150
+ } else if (schema instanceof ZodNullable) {
31151
+ return ZodNullable.create(deepPartialify(schema.unwrap()));
31152
+ } else if (schema instanceof ZodTuple) {
31153
+ return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
31154
+ } else {
31155
+ return schema;
31156
+ }
31157
+ }
31158
+ var ZodObject = class _ZodObject extends ZodType {
31159
+ constructor() {
31160
+ super(...arguments);
31161
+ this._cached = null;
31162
+ this.nonstrict = this.passthrough;
31163
+ this.augment = this.extend;
31164
+ }
31165
+ _getCached() {
31166
+ if (this._cached !== null)
31167
+ return this._cached;
31168
+ const shape = this._def.shape();
31169
+ const keys = util.objectKeys(shape);
31170
+ this._cached = { shape, keys };
31171
+ return this._cached;
31172
+ }
31173
+ _parse(input) {
31174
+ const parsedType = this._getType(input);
31175
+ if (parsedType !== ZodParsedType.object) {
31176
+ const ctx2 = this._getOrReturnCtx(input);
31177
+ addIssueToContext(ctx2, {
31178
+ code: ZodIssueCode.invalid_type,
31179
+ expected: ZodParsedType.object,
31180
+ received: ctx2.parsedType
31181
+ });
31182
+ return INVALID;
31183
+ }
31184
+ const { status, ctx } = this._processInputParams(input);
31185
+ const { shape, keys: shapeKeys } = this._getCached();
31186
+ const extraKeys = [];
31187
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
31188
+ for (const key in ctx.data) {
31189
+ if (!shapeKeys.includes(key)) {
31190
+ extraKeys.push(key);
31191
+ }
31192
+ }
31193
+ }
31194
+ const pairs = [];
31195
+ for (const key of shapeKeys) {
31196
+ const keyValidator = shape[key];
31197
+ const value = ctx.data[key];
31198
+ pairs.push({
31199
+ key: { status: "valid", value: key },
31200
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
31201
+ alwaysSet: key in ctx.data
31202
+ });
31203
+ }
31204
+ if (this._def.catchall instanceof ZodNever) {
31205
+ const unknownKeys = this._def.unknownKeys;
31206
+ if (unknownKeys === "passthrough") {
31207
+ for (const key of extraKeys) {
31208
+ pairs.push({
31209
+ key: { status: "valid", value: key },
31210
+ value: { status: "valid", value: ctx.data[key] }
31211
+ });
31212
+ }
31213
+ } else if (unknownKeys === "strict") {
31214
+ if (extraKeys.length > 0) {
31215
+ addIssueToContext(ctx, {
31216
+ code: ZodIssueCode.unrecognized_keys,
31217
+ keys: extraKeys
31218
+ });
31219
+ status.dirty();
31220
+ }
31221
+ } else if (unknownKeys === "strip") {
31222
+ } else {
31223
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
31224
+ }
31225
+ } else {
31226
+ const catchall = this._def.catchall;
31227
+ for (const key of extraKeys) {
31228
+ const value = ctx.data[key];
31229
+ pairs.push({
31230
+ key: { status: "valid", value: key },
31231
+ value: catchall._parse(
31232
+ new ParseInputLazyPath(ctx, value, ctx.path, key)
31233
+ //, ctx.child(key), value, getParsedType(value)
31234
+ ),
31235
+ alwaysSet: key in ctx.data
31236
+ });
31237
+ }
31238
+ }
31239
+ if (ctx.common.async) {
31240
+ return Promise.resolve().then(async () => {
31241
+ const syncPairs = [];
31242
+ for (const pair of pairs) {
31243
+ const key = await pair.key;
31244
+ const value = await pair.value;
31245
+ syncPairs.push({
31246
+ key,
31247
+ value,
31248
+ alwaysSet: pair.alwaysSet
31249
+ });
31250
+ }
31251
+ return syncPairs;
31252
+ }).then((syncPairs) => {
31253
+ return ParseStatus.mergeObjectSync(status, syncPairs);
31254
+ });
31255
+ } else {
31256
+ return ParseStatus.mergeObjectSync(status, pairs);
31257
+ }
31258
+ }
31259
+ get shape() {
31260
+ return this._def.shape();
31261
+ }
31262
+ strict(message) {
31263
+ errorUtil.errToObj;
31264
+ return new _ZodObject({
31265
+ ...this._def,
31266
+ unknownKeys: "strict",
31267
+ ...message !== void 0 ? {
31268
+ errorMap: (issue, ctx) => {
31269
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
31270
+ if (issue.code === "unrecognized_keys")
31271
+ return {
31272
+ message: errorUtil.errToObj(message).message ?? defaultError
31273
+ };
31274
+ return {
31275
+ message: defaultError
31276
+ };
31277
+ }
31278
+ } : {}
31279
+ });
31280
+ }
31281
+ strip() {
31282
+ return new _ZodObject({
31283
+ ...this._def,
31284
+ unknownKeys: "strip"
31285
+ });
31286
+ }
31287
+ passthrough() {
31288
+ return new _ZodObject({
31289
+ ...this._def,
31290
+ unknownKeys: "passthrough"
31291
+ });
31292
+ }
31293
+ // const AugmentFactory =
31294
+ // <Def extends ZodObjectDef>(def: Def) =>
31295
+ // <Augmentation extends ZodRawShape>(
31296
+ // augmentation: Augmentation
31297
+ // ): ZodObject<
31298
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
31299
+ // Def["unknownKeys"],
31300
+ // Def["catchall"]
31301
+ // > => {
31302
+ // return new ZodObject({
31303
+ // ...def,
31304
+ // shape: () => ({
31305
+ // ...def.shape(),
31306
+ // ...augmentation,
31307
+ // }),
31308
+ // }) as any;
31309
+ // };
31310
+ extend(augmentation) {
31311
+ return new _ZodObject({
31312
+ ...this._def,
31313
+ shape: () => ({
31314
+ ...this._def.shape(),
31315
+ ...augmentation
31316
+ })
31317
+ });
31318
+ }
31319
+ /**
31320
+ * Prior to zod@1.0.12 there was a bug in the
31321
+ * inferred type of merged objects. Please
31322
+ * upgrade if you are experiencing issues.
31323
+ */
31324
+ merge(merging) {
31325
+ const merged = new _ZodObject({
31326
+ unknownKeys: merging._def.unknownKeys,
31327
+ catchall: merging._def.catchall,
31328
+ shape: () => ({
31329
+ ...this._def.shape(),
31330
+ ...merging._def.shape()
31331
+ }),
31332
+ typeName: ZodFirstPartyTypeKind.ZodObject
31333
+ });
31334
+ return merged;
31335
+ }
31336
+ // merge<
31337
+ // Incoming extends AnyZodObject,
31338
+ // Augmentation extends Incoming["shape"],
31339
+ // NewOutput extends {
31340
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
31341
+ // ? Augmentation[k]["_output"]
31342
+ // : k extends keyof Output
31343
+ // ? Output[k]
31344
+ // : never;
31345
+ // },
31346
+ // NewInput extends {
31347
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
31348
+ // ? Augmentation[k]["_input"]
31349
+ // : k extends keyof Input
31350
+ // ? Input[k]
31351
+ // : never;
31352
+ // }
31353
+ // >(
31354
+ // merging: Incoming
31355
+ // ): ZodObject<
31356
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
31357
+ // Incoming["_def"]["unknownKeys"],
31358
+ // Incoming["_def"]["catchall"],
31359
+ // NewOutput,
31360
+ // NewInput
31361
+ // > {
31362
+ // const merged: any = new ZodObject({
31363
+ // unknownKeys: merging._def.unknownKeys,
31364
+ // catchall: merging._def.catchall,
31365
+ // shape: () =>
31366
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
31367
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
31368
+ // }) as any;
31369
+ // return merged;
31370
+ // }
31371
+ setKey(key, schema) {
31372
+ return this.augment({ [key]: schema });
31373
+ }
31374
+ // merge<Incoming extends AnyZodObject>(
31375
+ // merging: Incoming
31376
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
31377
+ // ZodObject<
31378
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
31379
+ // Incoming["_def"]["unknownKeys"],
31380
+ // Incoming["_def"]["catchall"]
31381
+ // > {
31382
+ // // const mergedShape = objectUtil.mergeShapes(
31383
+ // // this._def.shape(),
31384
+ // // merging._def.shape()
31385
+ // // );
31386
+ // const merged: any = new ZodObject({
31387
+ // unknownKeys: merging._def.unknownKeys,
31388
+ // catchall: merging._def.catchall,
31389
+ // shape: () =>
31390
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
31391
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
31392
+ // }) as any;
31393
+ // return merged;
31394
+ // }
31395
+ catchall(index) {
31396
+ return new _ZodObject({
31397
+ ...this._def,
31398
+ catchall: index
31399
+ });
31400
+ }
31401
+ pick(mask) {
31402
+ const shape = {};
31403
+ for (const key of util.objectKeys(mask)) {
31404
+ if (mask[key] && this.shape[key]) {
31405
+ shape[key] = this.shape[key];
31406
+ }
31407
+ }
31408
+ return new _ZodObject({
31409
+ ...this._def,
31410
+ shape: () => shape
31411
+ });
31412
+ }
31413
+ omit(mask) {
31414
+ const shape = {};
31415
+ for (const key of util.objectKeys(this.shape)) {
31416
+ if (!mask[key]) {
31417
+ shape[key] = this.shape[key];
31418
+ }
31419
+ }
31420
+ return new _ZodObject({
31421
+ ...this._def,
31422
+ shape: () => shape
31423
+ });
31424
+ }
31425
+ /**
31426
+ * @deprecated
31427
+ */
31428
+ deepPartial() {
31429
+ return deepPartialify(this);
31430
+ }
31431
+ partial(mask) {
31432
+ const newShape = {};
31433
+ for (const key of util.objectKeys(this.shape)) {
31434
+ const fieldSchema = this.shape[key];
31435
+ if (mask && !mask[key]) {
31436
+ newShape[key] = fieldSchema;
31437
+ } else {
31438
+ newShape[key] = fieldSchema.optional();
31439
+ }
31440
+ }
31441
+ return new _ZodObject({
31442
+ ...this._def,
31443
+ shape: () => newShape
31444
+ });
31445
+ }
31446
+ required(mask) {
31447
+ const newShape = {};
31448
+ for (const key of util.objectKeys(this.shape)) {
31449
+ if (mask && !mask[key]) {
31450
+ newShape[key] = this.shape[key];
31451
+ } else {
31452
+ const fieldSchema = this.shape[key];
31453
+ let newField = fieldSchema;
31454
+ while (newField instanceof ZodOptional) {
31455
+ newField = newField._def.innerType;
31456
+ }
31457
+ newShape[key] = newField;
31458
+ }
31459
+ }
31460
+ return new _ZodObject({
31461
+ ...this._def,
31462
+ shape: () => newShape
31463
+ });
31464
+ }
31465
+ keyof() {
31466
+ return createZodEnum(util.objectKeys(this.shape));
31467
+ }
31468
+ };
31469
+ ZodObject.create = (shape, params) => {
31470
+ return new ZodObject({
31471
+ shape: () => shape,
31472
+ unknownKeys: "strip",
31473
+ catchall: ZodNever.create(),
31474
+ typeName: ZodFirstPartyTypeKind.ZodObject,
31475
+ ...processCreateParams(params)
31476
+ });
31477
+ };
31478
+ ZodObject.strictCreate = (shape, params) => {
31479
+ return new ZodObject({
31480
+ shape: () => shape,
31481
+ unknownKeys: "strict",
31482
+ catchall: ZodNever.create(),
31483
+ typeName: ZodFirstPartyTypeKind.ZodObject,
31484
+ ...processCreateParams(params)
31485
+ });
31486
+ };
31487
+ ZodObject.lazycreate = (shape, params) => {
31488
+ return new ZodObject({
31489
+ shape,
31490
+ unknownKeys: "strip",
31491
+ catchall: ZodNever.create(),
31492
+ typeName: ZodFirstPartyTypeKind.ZodObject,
31493
+ ...processCreateParams(params)
31494
+ });
31495
+ };
31496
+ var ZodUnion = class extends ZodType {
31497
+ _parse(input) {
31498
+ const { ctx } = this._processInputParams(input);
31499
+ const options = this._def.options;
31500
+ function handleResults(results) {
31501
+ for (const result of results) {
31502
+ if (result.result.status === "valid") {
31503
+ return result.result;
31504
+ }
31505
+ }
31506
+ for (const result of results) {
31507
+ if (result.result.status === "dirty") {
31508
+ ctx.common.issues.push(...result.ctx.common.issues);
31509
+ return result.result;
31510
+ }
31511
+ }
31512
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
31513
+ addIssueToContext(ctx, {
31514
+ code: ZodIssueCode.invalid_union,
31515
+ unionErrors
31516
+ });
31517
+ return INVALID;
31518
+ }
31519
+ if (ctx.common.async) {
31520
+ return Promise.all(options.map(async (option) => {
31521
+ const childCtx = {
31522
+ ...ctx,
31523
+ common: {
31524
+ ...ctx.common,
31525
+ issues: []
31526
+ },
31527
+ parent: null
31528
+ };
31529
+ return {
31530
+ result: await option._parseAsync({
31531
+ data: ctx.data,
31532
+ path: ctx.path,
31533
+ parent: childCtx
31534
+ }),
31535
+ ctx: childCtx
31536
+ };
31537
+ })).then(handleResults);
31538
+ } else {
31539
+ let dirty = void 0;
31540
+ const issues = [];
31541
+ for (const option of options) {
31542
+ const childCtx = {
31543
+ ...ctx,
31544
+ common: {
31545
+ ...ctx.common,
31546
+ issues: []
31547
+ },
31548
+ parent: null
31549
+ };
31550
+ const result = option._parseSync({
31551
+ data: ctx.data,
31552
+ path: ctx.path,
31553
+ parent: childCtx
31554
+ });
31555
+ if (result.status === "valid") {
31556
+ return result;
31557
+ } else if (result.status === "dirty" && !dirty) {
31558
+ dirty = { result, ctx: childCtx };
31559
+ }
31560
+ if (childCtx.common.issues.length) {
31561
+ issues.push(childCtx.common.issues);
31562
+ }
31563
+ }
31564
+ if (dirty) {
31565
+ ctx.common.issues.push(...dirty.ctx.common.issues);
31566
+ return dirty.result;
31567
+ }
31568
+ const unionErrors = issues.map((issues2) => new ZodError(issues2));
31569
+ addIssueToContext(ctx, {
31570
+ code: ZodIssueCode.invalid_union,
31571
+ unionErrors
31572
+ });
31573
+ return INVALID;
31574
+ }
31575
+ }
31576
+ get options() {
31577
+ return this._def.options;
31578
+ }
31579
+ };
31580
+ ZodUnion.create = (types, params) => {
31581
+ return new ZodUnion({
31582
+ options: types,
31583
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
31584
+ ...processCreateParams(params)
31585
+ });
31586
+ };
31587
+ var getDiscriminator = (type) => {
31588
+ if (type instanceof ZodLazy) {
31589
+ return getDiscriminator(type.schema);
31590
+ } else if (type instanceof ZodEffects) {
31591
+ return getDiscriminator(type.innerType());
31592
+ } else if (type instanceof ZodLiteral) {
31593
+ return [type.value];
31594
+ } else if (type instanceof ZodEnum) {
31595
+ return type.options;
31596
+ } else if (type instanceof ZodNativeEnum) {
31597
+ return util.objectValues(type.enum);
31598
+ } else if (type instanceof ZodDefault) {
31599
+ return getDiscriminator(type._def.innerType);
31600
+ } else if (type instanceof ZodUndefined) {
31601
+ return [void 0];
31602
+ } else if (type instanceof ZodNull) {
31603
+ return [null];
31604
+ } else if (type instanceof ZodOptional) {
31605
+ return [void 0, ...getDiscriminator(type.unwrap())];
31606
+ } else if (type instanceof ZodNullable) {
31607
+ return [null, ...getDiscriminator(type.unwrap())];
31608
+ } else if (type instanceof ZodBranded) {
31609
+ return getDiscriminator(type.unwrap());
31610
+ } else if (type instanceof ZodReadonly) {
31611
+ return getDiscriminator(type.unwrap());
31612
+ } else if (type instanceof ZodCatch) {
31613
+ return getDiscriminator(type._def.innerType);
31614
+ } else {
31615
+ return [];
31616
+ }
31617
+ };
31618
+ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
31619
+ _parse(input) {
31620
+ const { ctx } = this._processInputParams(input);
31621
+ if (ctx.parsedType !== ZodParsedType.object) {
31622
+ addIssueToContext(ctx, {
31623
+ code: ZodIssueCode.invalid_type,
31624
+ expected: ZodParsedType.object,
31625
+ received: ctx.parsedType
31626
+ });
31627
+ return INVALID;
31628
+ }
31629
+ const discriminator = this.discriminator;
31630
+ const discriminatorValue = ctx.data[discriminator];
31631
+ const option = this.optionsMap.get(discriminatorValue);
31632
+ if (!option) {
31633
+ addIssueToContext(ctx, {
31634
+ code: ZodIssueCode.invalid_union_discriminator,
31635
+ options: Array.from(this.optionsMap.keys()),
31636
+ path: [discriminator]
31637
+ });
31638
+ return INVALID;
31639
+ }
31640
+ if (ctx.common.async) {
31641
+ return option._parseAsync({
31642
+ data: ctx.data,
31643
+ path: ctx.path,
31644
+ parent: ctx
31645
+ });
31646
+ } else {
31647
+ return option._parseSync({
31648
+ data: ctx.data,
31649
+ path: ctx.path,
31650
+ parent: ctx
31651
+ });
31652
+ }
31653
+ }
31654
+ get discriminator() {
31655
+ return this._def.discriminator;
31656
+ }
31657
+ get options() {
31658
+ return this._def.options;
31659
+ }
31660
+ get optionsMap() {
31661
+ return this._def.optionsMap;
31662
+ }
31663
+ /**
31664
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
31665
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
31666
+ * have a different value for each object in the union.
31667
+ * @param discriminator the name of the discriminator property
31668
+ * @param types an array of object schemas
31669
+ * @param params
31670
+ */
31671
+ static create(discriminator, options, params) {
31672
+ const optionsMap = /* @__PURE__ */ new Map();
31673
+ for (const type of options) {
31674
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
31675
+ if (!discriminatorValues.length) {
31676
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
31677
+ }
31678
+ for (const value of discriminatorValues) {
31679
+ if (optionsMap.has(value)) {
31680
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
31681
+ }
31682
+ optionsMap.set(value, type);
31683
+ }
31684
+ }
31685
+ return new _ZodDiscriminatedUnion({
31686
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
31687
+ discriminator,
31688
+ options,
31689
+ optionsMap,
31690
+ ...processCreateParams(params)
31691
+ });
31692
+ }
31693
+ };
31694
+ function mergeValues(a, b) {
31695
+ const aType = getParsedType(a);
31696
+ const bType = getParsedType(b);
31697
+ if (a === b) {
31698
+ return { valid: true, data: a };
31699
+ } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
31700
+ const bKeys = util.objectKeys(b);
31701
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
31702
+ const newObj = { ...a, ...b };
31703
+ for (const key of sharedKeys) {
31704
+ const sharedValue = mergeValues(a[key], b[key]);
31705
+ if (!sharedValue.valid) {
31706
+ return { valid: false };
31707
+ }
31708
+ newObj[key] = sharedValue.data;
31709
+ }
31710
+ return { valid: true, data: newObj };
31711
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
31712
+ if (a.length !== b.length) {
31713
+ return { valid: false };
31714
+ }
31715
+ const newArray = [];
31716
+ for (let index = 0; index < a.length; index++) {
31717
+ const itemA = a[index];
31718
+ const itemB = b[index];
31719
+ const sharedValue = mergeValues(itemA, itemB);
31720
+ if (!sharedValue.valid) {
31721
+ return { valid: false };
31722
+ }
31723
+ newArray.push(sharedValue.data);
31724
+ }
31725
+ return { valid: true, data: newArray };
31726
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
31727
+ return { valid: true, data: a };
31728
+ } else {
31729
+ return { valid: false };
31730
+ }
31731
+ }
31732
+ var ZodIntersection = class extends ZodType {
31733
+ _parse(input) {
31734
+ const { status, ctx } = this._processInputParams(input);
31735
+ const handleParsed = (parsedLeft, parsedRight) => {
31736
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) {
31737
+ return INVALID;
31738
+ }
31739
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
31740
+ if (!merged.valid) {
31741
+ addIssueToContext(ctx, {
31742
+ code: ZodIssueCode.invalid_intersection_types
31743
+ });
31744
+ return INVALID;
31745
+ }
31746
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) {
31747
+ status.dirty();
31748
+ }
31749
+ return { status: status.value, value: merged.data };
31750
+ };
31751
+ if (ctx.common.async) {
31752
+ return Promise.all([
31753
+ this._def.left._parseAsync({
31754
+ data: ctx.data,
31755
+ path: ctx.path,
31756
+ parent: ctx
31757
+ }),
31758
+ this._def.right._parseAsync({
31759
+ data: ctx.data,
31760
+ path: ctx.path,
31761
+ parent: ctx
31762
+ })
31763
+ ]).then(([left, right]) => handleParsed(left, right));
31764
+ } else {
31765
+ return handleParsed(this._def.left._parseSync({
31766
+ data: ctx.data,
31767
+ path: ctx.path,
31768
+ parent: ctx
31769
+ }), this._def.right._parseSync({
31770
+ data: ctx.data,
31771
+ path: ctx.path,
31772
+ parent: ctx
31773
+ }));
31774
+ }
31775
+ }
31776
+ };
31777
+ ZodIntersection.create = (left, right, params) => {
31778
+ return new ZodIntersection({
31779
+ left,
31780
+ right,
31781
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
31782
+ ...processCreateParams(params)
31783
+ });
31784
+ };
31785
+ var ZodTuple = class _ZodTuple extends ZodType {
31786
+ _parse(input) {
31787
+ const { status, ctx } = this._processInputParams(input);
31788
+ if (ctx.parsedType !== ZodParsedType.array) {
31789
+ addIssueToContext(ctx, {
31790
+ code: ZodIssueCode.invalid_type,
31791
+ expected: ZodParsedType.array,
31792
+ received: ctx.parsedType
31793
+ });
31794
+ return INVALID;
31795
+ }
31796
+ if (ctx.data.length < this._def.items.length) {
31797
+ addIssueToContext(ctx, {
31798
+ code: ZodIssueCode.too_small,
31799
+ minimum: this._def.items.length,
31800
+ inclusive: true,
31801
+ exact: false,
31802
+ type: "array"
31803
+ });
31804
+ return INVALID;
31805
+ }
31806
+ const rest = this._def.rest;
31807
+ if (!rest && ctx.data.length > this._def.items.length) {
31808
+ addIssueToContext(ctx, {
31809
+ code: ZodIssueCode.too_big,
31810
+ maximum: this._def.items.length,
31811
+ inclusive: true,
31812
+ exact: false,
31813
+ type: "array"
31814
+ });
31815
+ status.dirty();
31816
+ }
31817
+ const items = [...ctx.data].map((item, itemIndex) => {
31818
+ const schema = this._def.items[itemIndex] || this._def.rest;
31819
+ if (!schema)
31820
+ return null;
31821
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
31822
+ }).filter((x) => !!x);
31823
+ if (ctx.common.async) {
31824
+ return Promise.all(items).then((results) => {
31825
+ return ParseStatus.mergeArray(status, results);
31826
+ });
31827
+ } else {
31828
+ return ParseStatus.mergeArray(status, items);
31829
+ }
31830
+ }
31831
+ get items() {
31832
+ return this._def.items;
31833
+ }
31834
+ rest(rest) {
31835
+ return new _ZodTuple({
31836
+ ...this._def,
31837
+ rest
31838
+ });
31839
+ }
31840
+ };
31841
+ ZodTuple.create = (schemas, params) => {
31842
+ if (!Array.isArray(schemas)) {
31843
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
31844
+ }
31845
+ return new ZodTuple({
31846
+ items: schemas,
31847
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
31848
+ rest: null,
31849
+ ...processCreateParams(params)
31850
+ });
31851
+ };
31852
+ var ZodRecord = class _ZodRecord extends ZodType {
31853
+ get keySchema() {
31854
+ return this._def.keyType;
31855
+ }
31856
+ get valueSchema() {
31857
+ return this._def.valueType;
31858
+ }
31859
+ _parse(input) {
31860
+ const { status, ctx } = this._processInputParams(input);
31861
+ if (ctx.parsedType !== ZodParsedType.object) {
31862
+ addIssueToContext(ctx, {
31863
+ code: ZodIssueCode.invalid_type,
31864
+ expected: ZodParsedType.object,
31865
+ received: ctx.parsedType
31866
+ });
31867
+ return INVALID;
31868
+ }
31869
+ const pairs = [];
31870
+ const keyType = this._def.keyType;
31871
+ const valueType = this._def.valueType;
31872
+ for (const key in ctx.data) {
31873
+ pairs.push({
31874
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
31875
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
31876
+ alwaysSet: key in ctx.data
31877
+ });
31878
+ }
31879
+ if (ctx.common.async) {
31880
+ return ParseStatus.mergeObjectAsync(status, pairs);
31881
+ } else {
31882
+ return ParseStatus.mergeObjectSync(status, pairs);
31883
+ }
31884
+ }
31885
+ get element() {
31886
+ return this._def.valueType;
31887
+ }
31888
+ static create(first, second, third) {
31889
+ if (second instanceof ZodType) {
31890
+ return new _ZodRecord({
31891
+ keyType: first,
31892
+ valueType: second,
31893
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
31894
+ ...processCreateParams(third)
31895
+ });
31896
+ }
31897
+ return new _ZodRecord({
31898
+ keyType: ZodString.create(),
31899
+ valueType: first,
31900
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
31901
+ ...processCreateParams(second)
31902
+ });
31903
+ }
31904
+ };
31905
+ var ZodMap = class extends ZodType {
31906
+ get keySchema() {
31907
+ return this._def.keyType;
31908
+ }
31909
+ get valueSchema() {
31910
+ return this._def.valueType;
31911
+ }
31912
+ _parse(input) {
31913
+ const { status, ctx } = this._processInputParams(input);
31914
+ if (ctx.parsedType !== ZodParsedType.map) {
31915
+ addIssueToContext(ctx, {
31916
+ code: ZodIssueCode.invalid_type,
31917
+ expected: ZodParsedType.map,
31918
+ received: ctx.parsedType
31919
+ });
31920
+ return INVALID;
31921
+ }
31922
+ const keyType = this._def.keyType;
31923
+ const valueType = this._def.valueType;
31924
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
31925
+ return {
31926
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
31927
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
31928
+ };
31929
+ });
31930
+ if (ctx.common.async) {
31931
+ const finalMap = /* @__PURE__ */ new Map();
31932
+ return Promise.resolve().then(async () => {
31933
+ for (const pair of pairs) {
31934
+ const key = await pair.key;
31935
+ const value = await pair.value;
31936
+ if (key.status === "aborted" || value.status === "aborted") {
31937
+ return INVALID;
31938
+ }
31939
+ if (key.status === "dirty" || value.status === "dirty") {
31940
+ status.dirty();
31941
+ }
31942
+ finalMap.set(key.value, value.value);
31943
+ }
31944
+ return { status: status.value, value: finalMap };
31945
+ });
31946
+ } else {
31947
+ const finalMap = /* @__PURE__ */ new Map();
31948
+ for (const pair of pairs) {
31949
+ const key = pair.key;
31950
+ const value = pair.value;
31951
+ if (key.status === "aborted" || value.status === "aborted") {
31952
+ return INVALID;
31953
+ }
31954
+ if (key.status === "dirty" || value.status === "dirty") {
31955
+ status.dirty();
31956
+ }
31957
+ finalMap.set(key.value, value.value);
31958
+ }
31959
+ return { status: status.value, value: finalMap };
31960
+ }
31961
+ }
31962
+ };
31963
+ ZodMap.create = (keyType, valueType, params) => {
31964
+ return new ZodMap({
31965
+ valueType,
31966
+ keyType,
31967
+ typeName: ZodFirstPartyTypeKind.ZodMap,
31968
+ ...processCreateParams(params)
31969
+ });
31970
+ };
31971
+ var ZodSet = class _ZodSet extends ZodType {
31972
+ _parse(input) {
31973
+ const { status, ctx } = this._processInputParams(input);
31974
+ if (ctx.parsedType !== ZodParsedType.set) {
31975
+ addIssueToContext(ctx, {
31976
+ code: ZodIssueCode.invalid_type,
31977
+ expected: ZodParsedType.set,
31978
+ received: ctx.parsedType
31979
+ });
31980
+ return INVALID;
31981
+ }
31982
+ const def = this._def;
31983
+ if (def.minSize !== null) {
31984
+ if (ctx.data.size < def.minSize.value) {
31985
+ addIssueToContext(ctx, {
31986
+ code: ZodIssueCode.too_small,
31987
+ minimum: def.minSize.value,
31988
+ type: "set",
31989
+ inclusive: true,
31990
+ exact: false,
31991
+ message: def.minSize.message
31992
+ });
31993
+ status.dirty();
31994
+ }
31995
+ }
31996
+ if (def.maxSize !== null) {
31997
+ if (ctx.data.size > def.maxSize.value) {
31998
+ addIssueToContext(ctx, {
31999
+ code: ZodIssueCode.too_big,
32000
+ maximum: def.maxSize.value,
32001
+ type: "set",
32002
+ inclusive: true,
32003
+ exact: false,
32004
+ message: def.maxSize.message
32005
+ });
32006
+ status.dirty();
32007
+ }
32008
+ }
32009
+ const valueType = this._def.valueType;
32010
+ function finalizeSet(elements2) {
32011
+ const parsedSet = /* @__PURE__ */ new Set();
32012
+ for (const element of elements2) {
32013
+ if (element.status === "aborted")
32014
+ return INVALID;
32015
+ if (element.status === "dirty")
32016
+ status.dirty();
32017
+ parsedSet.add(element.value);
32018
+ }
32019
+ return { status: status.value, value: parsedSet };
32020
+ }
32021
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
32022
+ if (ctx.common.async) {
32023
+ return Promise.all(elements).then((elements2) => finalizeSet(elements2));
32024
+ } else {
32025
+ return finalizeSet(elements);
32026
+ }
32027
+ }
32028
+ min(minSize, message) {
32029
+ return new _ZodSet({
32030
+ ...this._def,
32031
+ minSize: { value: minSize, message: errorUtil.toString(message) }
32032
+ });
32033
+ }
32034
+ max(maxSize, message) {
32035
+ return new _ZodSet({
32036
+ ...this._def,
32037
+ maxSize: { value: maxSize, message: errorUtil.toString(message) }
32038
+ });
32039
+ }
32040
+ size(size, message) {
32041
+ return this.min(size, message).max(size, message);
32042
+ }
32043
+ nonempty(message) {
32044
+ return this.min(1, message);
32045
+ }
32046
+ };
32047
+ ZodSet.create = (valueType, params) => {
32048
+ return new ZodSet({
32049
+ valueType,
32050
+ minSize: null,
32051
+ maxSize: null,
32052
+ typeName: ZodFirstPartyTypeKind.ZodSet,
32053
+ ...processCreateParams(params)
32054
+ });
32055
+ };
32056
+ var ZodFunction = class _ZodFunction extends ZodType {
32057
+ constructor() {
32058
+ super(...arguments);
32059
+ this.validate = this.implement;
32060
+ }
32061
+ _parse(input) {
32062
+ const { ctx } = this._processInputParams(input);
32063
+ if (ctx.parsedType !== ZodParsedType.function) {
32064
+ addIssueToContext(ctx, {
32065
+ code: ZodIssueCode.invalid_type,
32066
+ expected: ZodParsedType.function,
32067
+ received: ctx.parsedType
32068
+ });
32069
+ return INVALID;
32070
+ }
32071
+ function makeArgsIssue(args, error) {
32072
+ return makeIssue({
32073
+ data: args,
32074
+ path: ctx.path,
32075
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
32076
+ issueData: {
32077
+ code: ZodIssueCode.invalid_arguments,
32078
+ argumentsError: error
32079
+ }
32080
+ });
32081
+ }
32082
+ function makeReturnsIssue(returns, error) {
32083
+ return makeIssue({
32084
+ data: returns,
32085
+ path: ctx.path,
32086
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
32087
+ issueData: {
32088
+ code: ZodIssueCode.invalid_return_type,
32089
+ returnTypeError: error
32090
+ }
32091
+ });
32092
+ }
32093
+ const params = { errorMap: ctx.common.contextualErrorMap };
32094
+ const fn = ctx.data;
32095
+ if (this._def.returns instanceof ZodPromise) {
32096
+ const me = this;
32097
+ return OK(async function(...args) {
32098
+ const error = new ZodError([]);
32099
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
32100
+ error.addIssue(makeArgsIssue(args, e));
32101
+ throw error;
32102
+ });
32103
+ const result = await Reflect.apply(fn, this, parsedArgs);
32104
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
32105
+ error.addIssue(makeReturnsIssue(result, e));
32106
+ throw error;
32107
+ });
32108
+ return parsedReturns;
32109
+ });
32110
+ } else {
32111
+ const me = this;
32112
+ return OK(function(...args) {
32113
+ const parsedArgs = me._def.args.safeParse(args, params);
32114
+ if (!parsedArgs.success) {
32115
+ throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
32116
+ }
32117
+ const result = Reflect.apply(fn, this, parsedArgs.data);
32118
+ const parsedReturns = me._def.returns.safeParse(result, params);
32119
+ if (!parsedReturns.success) {
32120
+ throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
32121
+ }
32122
+ return parsedReturns.data;
32123
+ });
32124
+ }
32125
+ }
32126
+ parameters() {
32127
+ return this._def.args;
32128
+ }
32129
+ returnType() {
32130
+ return this._def.returns;
32131
+ }
32132
+ args(...items) {
32133
+ return new _ZodFunction({
32134
+ ...this._def,
32135
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
32136
+ });
32137
+ }
32138
+ returns(returnType) {
32139
+ return new _ZodFunction({
32140
+ ...this._def,
32141
+ returns: returnType
32142
+ });
32143
+ }
32144
+ implement(func) {
32145
+ const validatedFunc = this.parse(func);
32146
+ return validatedFunc;
32147
+ }
32148
+ strictImplement(func) {
32149
+ const validatedFunc = this.parse(func);
32150
+ return validatedFunc;
32151
+ }
32152
+ static create(args, returns, params) {
32153
+ return new _ZodFunction({
32154
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
32155
+ returns: returns || ZodUnknown.create(),
32156
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
32157
+ ...processCreateParams(params)
32158
+ });
32159
+ }
32160
+ };
32161
+ var ZodLazy = class extends ZodType {
32162
+ get schema() {
32163
+ return this._def.getter();
32164
+ }
32165
+ _parse(input) {
32166
+ const { ctx } = this._processInputParams(input);
32167
+ const lazySchema = this._def.getter();
32168
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
32169
+ }
32170
+ };
32171
+ ZodLazy.create = (getter, params) => {
32172
+ return new ZodLazy({
32173
+ getter,
32174
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
32175
+ ...processCreateParams(params)
32176
+ });
32177
+ };
32178
+ var ZodLiteral = class extends ZodType {
32179
+ _parse(input) {
32180
+ if (input.data !== this._def.value) {
32181
+ const ctx = this._getOrReturnCtx(input);
32182
+ addIssueToContext(ctx, {
32183
+ received: ctx.data,
32184
+ code: ZodIssueCode.invalid_literal,
32185
+ expected: this._def.value
32186
+ });
32187
+ return INVALID;
32188
+ }
32189
+ return { status: "valid", value: input.data };
32190
+ }
32191
+ get value() {
32192
+ return this._def.value;
32193
+ }
32194
+ };
32195
+ ZodLiteral.create = (value, params) => {
32196
+ return new ZodLiteral({
32197
+ value,
32198
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
32199
+ ...processCreateParams(params)
32200
+ });
32201
+ };
32202
+ function createZodEnum(values, params) {
32203
+ return new ZodEnum({
32204
+ values,
32205
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
32206
+ ...processCreateParams(params)
32207
+ });
32208
+ }
32209
+ var ZodEnum = class _ZodEnum extends ZodType {
32210
+ _parse(input) {
32211
+ if (typeof input.data !== "string") {
32212
+ const ctx = this._getOrReturnCtx(input);
32213
+ const expectedValues = this._def.values;
32214
+ addIssueToContext(ctx, {
32215
+ expected: util.joinValues(expectedValues),
32216
+ received: ctx.parsedType,
32217
+ code: ZodIssueCode.invalid_type
32218
+ });
32219
+ return INVALID;
32220
+ }
32221
+ if (!this._cache) {
32222
+ this._cache = new Set(this._def.values);
32223
+ }
32224
+ if (!this._cache.has(input.data)) {
32225
+ const ctx = this._getOrReturnCtx(input);
32226
+ const expectedValues = this._def.values;
32227
+ addIssueToContext(ctx, {
32228
+ received: ctx.data,
32229
+ code: ZodIssueCode.invalid_enum_value,
32230
+ options: expectedValues
32231
+ });
32232
+ return INVALID;
32233
+ }
32234
+ return OK(input.data);
32235
+ }
32236
+ get options() {
32237
+ return this._def.values;
32238
+ }
32239
+ get enum() {
32240
+ const enumValues = {};
32241
+ for (const val of this._def.values) {
32242
+ enumValues[val] = val;
32243
+ }
32244
+ return enumValues;
32245
+ }
32246
+ get Values() {
32247
+ const enumValues = {};
32248
+ for (const val of this._def.values) {
32249
+ enumValues[val] = val;
32250
+ }
32251
+ return enumValues;
32252
+ }
32253
+ get Enum() {
32254
+ const enumValues = {};
32255
+ for (const val of this._def.values) {
32256
+ enumValues[val] = val;
32257
+ }
32258
+ return enumValues;
32259
+ }
32260
+ extract(values, newDef = this._def) {
32261
+ return _ZodEnum.create(values, {
32262
+ ...this._def,
32263
+ ...newDef
32264
+ });
32265
+ }
32266
+ exclude(values, newDef = this._def) {
32267
+ return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
32268
+ ...this._def,
32269
+ ...newDef
32270
+ });
32271
+ }
32272
+ };
32273
+ ZodEnum.create = createZodEnum;
32274
+ var ZodNativeEnum = class extends ZodType {
32275
+ _parse(input) {
32276
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
32277
+ const ctx = this._getOrReturnCtx(input);
32278
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
32279
+ const expectedValues = util.objectValues(nativeEnumValues);
32280
+ addIssueToContext(ctx, {
32281
+ expected: util.joinValues(expectedValues),
32282
+ received: ctx.parsedType,
32283
+ code: ZodIssueCode.invalid_type
32284
+ });
32285
+ return INVALID;
32286
+ }
32287
+ if (!this._cache) {
32288
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
32289
+ }
32290
+ if (!this._cache.has(input.data)) {
32291
+ const expectedValues = util.objectValues(nativeEnumValues);
32292
+ addIssueToContext(ctx, {
32293
+ received: ctx.data,
32294
+ code: ZodIssueCode.invalid_enum_value,
32295
+ options: expectedValues
32296
+ });
32297
+ return INVALID;
32298
+ }
32299
+ return OK(input.data);
32300
+ }
32301
+ get enum() {
32302
+ return this._def.values;
32303
+ }
32304
+ };
32305
+ ZodNativeEnum.create = (values, params) => {
32306
+ return new ZodNativeEnum({
32307
+ values,
32308
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
32309
+ ...processCreateParams(params)
32310
+ });
32311
+ };
32312
+ var ZodPromise = class extends ZodType {
32313
+ unwrap() {
32314
+ return this._def.type;
32315
+ }
32316
+ _parse(input) {
32317
+ const { ctx } = this._processInputParams(input);
32318
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
32319
+ addIssueToContext(ctx, {
32320
+ code: ZodIssueCode.invalid_type,
32321
+ expected: ZodParsedType.promise,
32322
+ received: ctx.parsedType
32323
+ });
32324
+ return INVALID;
32325
+ }
32326
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
32327
+ return OK(promisified.then((data) => {
32328
+ return this._def.type.parseAsync(data, {
32329
+ path: ctx.path,
32330
+ errorMap: ctx.common.contextualErrorMap
32331
+ });
32332
+ }));
32333
+ }
32334
+ };
32335
+ ZodPromise.create = (schema, params) => {
32336
+ return new ZodPromise({
32337
+ type: schema,
32338
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
32339
+ ...processCreateParams(params)
32340
+ });
32341
+ };
32342
+ var ZodEffects = class extends ZodType {
32343
+ innerType() {
32344
+ return this._def.schema;
32345
+ }
32346
+ sourceType() {
32347
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
32348
+ }
32349
+ _parse(input) {
32350
+ const { status, ctx } = this._processInputParams(input);
32351
+ const effect = this._def.effect || null;
32352
+ const checkCtx = {
32353
+ addIssue: (arg) => {
32354
+ addIssueToContext(ctx, arg);
32355
+ if (arg.fatal) {
32356
+ status.abort();
32357
+ } else {
32358
+ status.dirty();
32359
+ }
32360
+ },
32361
+ get path() {
32362
+ return ctx.path;
32363
+ }
32364
+ };
32365
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
32366
+ if (effect.type === "preprocess") {
32367
+ const processed = effect.transform(ctx.data, checkCtx);
32368
+ if (ctx.common.async) {
32369
+ return Promise.resolve(processed).then(async (processed2) => {
32370
+ if (status.value === "aborted")
32371
+ return INVALID;
32372
+ const result = await this._def.schema._parseAsync({
32373
+ data: processed2,
32374
+ path: ctx.path,
32375
+ parent: ctx
32376
+ });
32377
+ if (result.status === "aborted")
32378
+ return INVALID;
32379
+ if (result.status === "dirty")
32380
+ return DIRTY(result.value);
32381
+ if (status.value === "dirty")
32382
+ return DIRTY(result.value);
32383
+ return result;
32384
+ });
32385
+ } else {
32386
+ if (status.value === "aborted")
32387
+ return INVALID;
32388
+ const result = this._def.schema._parseSync({
32389
+ data: processed,
32390
+ path: ctx.path,
32391
+ parent: ctx
32392
+ });
32393
+ if (result.status === "aborted")
32394
+ return INVALID;
32395
+ if (result.status === "dirty")
32396
+ return DIRTY(result.value);
32397
+ if (status.value === "dirty")
32398
+ return DIRTY(result.value);
32399
+ return result;
32400
+ }
32401
+ }
32402
+ if (effect.type === "refinement") {
32403
+ const executeRefinement = (acc) => {
32404
+ const result = effect.refinement(acc, checkCtx);
32405
+ if (ctx.common.async) {
32406
+ return Promise.resolve(result);
32407
+ }
32408
+ if (result instanceof Promise) {
32409
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
32410
+ }
32411
+ return acc;
32412
+ };
32413
+ if (ctx.common.async === false) {
32414
+ const inner = this._def.schema._parseSync({
32415
+ data: ctx.data,
32416
+ path: ctx.path,
32417
+ parent: ctx
32418
+ });
32419
+ if (inner.status === "aborted")
32420
+ return INVALID;
32421
+ if (inner.status === "dirty")
32422
+ status.dirty();
32423
+ executeRefinement(inner.value);
32424
+ return { status: status.value, value: inner.value };
32425
+ } else {
32426
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
32427
+ if (inner.status === "aborted")
32428
+ return INVALID;
32429
+ if (inner.status === "dirty")
32430
+ status.dirty();
32431
+ return executeRefinement(inner.value).then(() => {
32432
+ return { status: status.value, value: inner.value };
32433
+ });
32434
+ });
32435
+ }
32436
+ }
32437
+ if (effect.type === "transform") {
32438
+ if (ctx.common.async === false) {
32439
+ const base = this._def.schema._parseSync({
32440
+ data: ctx.data,
32441
+ path: ctx.path,
32442
+ parent: ctx
32443
+ });
32444
+ if (!isValid(base))
32445
+ return INVALID;
32446
+ const result = effect.transform(base.value, checkCtx);
32447
+ if (result instanceof Promise) {
32448
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
32449
+ }
32450
+ return { status: status.value, value: result };
32451
+ } else {
32452
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
32453
+ if (!isValid(base))
32454
+ return INVALID;
32455
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
32456
+ status: status.value,
32457
+ value: result
32458
+ }));
32459
+ });
32460
+ }
32461
+ }
32462
+ util.assertNever(effect);
32463
+ }
32464
+ };
32465
+ ZodEffects.create = (schema, effect, params) => {
32466
+ return new ZodEffects({
32467
+ schema,
32468
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
32469
+ effect,
32470
+ ...processCreateParams(params)
32471
+ });
32472
+ };
32473
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
32474
+ return new ZodEffects({
32475
+ schema,
32476
+ effect: { type: "preprocess", transform: preprocess },
32477
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
32478
+ ...processCreateParams(params)
32479
+ });
32480
+ };
32481
+ var ZodOptional = class extends ZodType {
32482
+ _parse(input) {
32483
+ const parsedType = this._getType(input);
32484
+ if (parsedType === ZodParsedType.undefined) {
32485
+ return OK(void 0);
32486
+ }
32487
+ return this._def.innerType._parse(input);
32488
+ }
32489
+ unwrap() {
32490
+ return this._def.innerType;
32491
+ }
32492
+ };
32493
+ ZodOptional.create = (type, params) => {
32494
+ return new ZodOptional({
32495
+ innerType: type,
32496
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
32497
+ ...processCreateParams(params)
32498
+ });
32499
+ };
32500
+ var ZodNullable = class extends ZodType {
32501
+ _parse(input) {
32502
+ const parsedType = this._getType(input);
32503
+ if (parsedType === ZodParsedType.null) {
32504
+ return OK(null);
32505
+ }
32506
+ return this._def.innerType._parse(input);
32507
+ }
32508
+ unwrap() {
32509
+ return this._def.innerType;
32510
+ }
32511
+ };
32512
+ ZodNullable.create = (type, params) => {
32513
+ return new ZodNullable({
32514
+ innerType: type,
32515
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
32516
+ ...processCreateParams(params)
32517
+ });
32518
+ };
32519
+ var ZodDefault = class extends ZodType {
32520
+ _parse(input) {
32521
+ const { ctx } = this._processInputParams(input);
32522
+ let data = ctx.data;
32523
+ if (ctx.parsedType === ZodParsedType.undefined) {
32524
+ data = this._def.defaultValue();
32525
+ }
32526
+ return this._def.innerType._parse({
32527
+ data,
32528
+ path: ctx.path,
32529
+ parent: ctx
32530
+ });
32531
+ }
32532
+ removeDefault() {
32533
+ return this._def.innerType;
32534
+ }
32535
+ };
32536
+ ZodDefault.create = (type, params) => {
32537
+ return new ZodDefault({
32538
+ innerType: type,
32539
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
32540
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
32541
+ ...processCreateParams(params)
32542
+ });
32543
+ };
32544
+ var ZodCatch = class extends ZodType {
32545
+ _parse(input) {
32546
+ const { ctx } = this._processInputParams(input);
32547
+ const newCtx = {
32548
+ ...ctx,
32549
+ common: {
32550
+ ...ctx.common,
32551
+ issues: []
32552
+ }
32553
+ };
32554
+ const result = this._def.innerType._parse({
32555
+ data: newCtx.data,
32556
+ path: newCtx.path,
32557
+ parent: {
32558
+ ...newCtx
32559
+ }
32560
+ });
32561
+ if (isAsync(result)) {
32562
+ return result.then((result2) => {
32563
+ return {
32564
+ status: "valid",
32565
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
32566
+ get error() {
32567
+ return new ZodError(newCtx.common.issues);
32568
+ },
32569
+ input: newCtx.data
32570
+ })
32571
+ };
32572
+ });
32573
+ } else {
32574
+ return {
32575
+ status: "valid",
32576
+ value: result.status === "valid" ? result.value : this._def.catchValue({
32577
+ get error() {
32578
+ return new ZodError(newCtx.common.issues);
32579
+ },
32580
+ input: newCtx.data
32581
+ })
32582
+ };
32583
+ }
32584
+ }
32585
+ removeCatch() {
32586
+ return this._def.innerType;
32587
+ }
32588
+ };
32589
+ ZodCatch.create = (type, params) => {
32590
+ return new ZodCatch({
32591
+ innerType: type,
32592
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
32593
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
32594
+ ...processCreateParams(params)
32595
+ });
32596
+ };
32597
+ var ZodNaN = class extends ZodType {
32598
+ _parse(input) {
32599
+ const parsedType = this._getType(input);
32600
+ if (parsedType !== ZodParsedType.nan) {
32601
+ const ctx = this._getOrReturnCtx(input);
32602
+ addIssueToContext(ctx, {
32603
+ code: ZodIssueCode.invalid_type,
32604
+ expected: ZodParsedType.nan,
32605
+ received: ctx.parsedType
32606
+ });
32607
+ return INVALID;
32608
+ }
32609
+ return { status: "valid", value: input.data };
32610
+ }
32611
+ };
32612
+ ZodNaN.create = (params) => {
32613
+ return new ZodNaN({
32614
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
32615
+ ...processCreateParams(params)
32616
+ });
32617
+ };
32618
+ var BRAND = /* @__PURE__ */ Symbol("zod_brand");
32619
+ var ZodBranded = class extends ZodType {
32620
+ _parse(input) {
32621
+ const { ctx } = this._processInputParams(input);
32622
+ const data = ctx.data;
32623
+ return this._def.type._parse({
32624
+ data,
32625
+ path: ctx.path,
32626
+ parent: ctx
32627
+ });
32628
+ }
32629
+ unwrap() {
32630
+ return this._def.type;
32631
+ }
32632
+ };
32633
+ var ZodPipeline = class _ZodPipeline extends ZodType {
32634
+ _parse(input) {
32635
+ const { status, ctx } = this._processInputParams(input);
32636
+ if (ctx.common.async) {
32637
+ const handleAsync = async () => {
32638
+ const inResult = await this._def.in._parseAsync({
32639
+ data: ctx.data,
32640
+ path: ctx.path,
32641
+ parent: ctx
32642
+ });
32643
+ if (inResult.status === "aborted")
32644
+ return INVALID;
32645
+ if (inResult.status === "dirty") {
32646
+ status.dirty();
32647
+ return DIRTY(inResult.value);
32648
+ } else {
32649
+ return this._def.out._parseAsync({
32650
+ data: inResult.value,
32651
+ path: ctx.path,
32652
+ parent: ctx
32653
+ });
32654
+ }
32655
+ };
32656
+ return handleAsync();
32657
+ } else {
32658
+ const inResult = this._def.in._parseSync({
32659
+ data: ctx.data,
32660
+ path: ctx.path,
32661
+ parent: ctx
32662
+ });
32663
+ if (inResult.status === "aborted")
32664
+ return INVALID;
32665
+ if (inResult.status === "dirty") {
32666
+ status.dirty();
32667
+ return {
32668
+ status: "dirty",
32669
+ value: inResult.value
32670
+ };
32671
+ } else {
32672
+ return this._def.out._parseSync({
32673
+ data: inResult.value,
32674
+ path: ctx.path,
32675
+ parent: ctx
32676
+ });
32677
+ }
32678
+ }
32679
+ }
32680
+ static create(a, b) {
32681
+ return new _ZodPipeline({
32682
+ in: a,
32683
+ out: b,
32684
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
32685
+ });
32686
+ }
32687
+ };
32688
+ var ZodReadonly = class extends ZodType {
32689
+ _parse(input) {
32690
+ const result = this._def.innerType._parse(input);
32691
+ const freeze = (data) => {
32692
+ if (isValid(data)) {
32693
+ data.value = Object.freeze(data.value);
32694
+ }
32695
+ return data;
32696
+ };
32697
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
32698
+ }
32699
+ unwrap() {
32700
+ return this._def.innerType;
32701
+ }
32702
+ };
32703
+ ZodReadonly.create = (type, params) => {
32704
+ return new ZodReadonly({
32705
+ innerType: type,
32706
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
32707
+ ...processCreateParams(params)
32708
+ });
32709
+ };
32710
+ function cleanParams(params, data) {
32711
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
32712
+ const p2 = typeof p === "string" ? { message: p } : p;
32713
+ return p2;
32714
+ }
32715
+ function custom(check, _params = {}, fatal) {
32716
+ if (check)
32717
+ return ZodAny.create().superRefine((data, ctx) => {
32718
+ const r = check(data);
32719
+ if (r instanceof Promise) {
32720
+ return r.then((r2) => {
32721
+ if (!r2) {
32722
+ const params = cleanParams(_params, data);
32723
+ const _fatal = params.fatal ?? fatal ?? true;
32724
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
32725
+ }
32726
+ });
32727
+ }
32728
+ if (!r) {
32729
+ const params = cleanParams(_params, data);
32730
+ const _fatal = params.fatal ?? fatal ?? true;
32731
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
32732
+ }
32733
+ return;
32734
+ });
32735
+ return ZodAny.create();
32736
+ }
32737
+ var late = {
32738
+ object: ZodObject.lazycreate
32739
+ };
32740
+ var ZodFirstPartyTypeKind;
32741
+ (function(ZodFirstPartyTypeKind2) {
32742
+ ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
32743
+ ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
32744
+ ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
32745
+ ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
32746
+ ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
32747
+ ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
32748
+ ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
32749
+ ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
32750
+ ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
32751
+ ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
32752
+ ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
32753
+ ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
32754
+ ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
32755
+ ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
32756
+ ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
32757
+ ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
32758
+ ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
32759
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
32760
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
32761
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
32762
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
32763
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
32764
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
32765
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
32766
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
32767
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
32768
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
32769
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
32770
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
32771
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
32772
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
32773
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
32774
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
32775
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
32776
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
32777
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
32778
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
32779
+ var instanceOfType = (cls, params = {
32780
+ message: `Input not instance of ${cls.name}`
32781
+ }) => custom((data) => data instanceof cls, params);
32782
+ var stringType = ZodString.create;
32783
+ var numberType = ZodNumber.create;
32784
+ var nanType = ZodNaN.create;
32785
+ var bigIntType = ZodBigInt.create;
32786
+ var booleanType = ZodBoolean.create;
32787
+ var dateType = ZodDate.create;
32788
+ var symbolType = ZodSymbol.create;
32789
+ var undefinedType = ZodUndefined.create;
32790
+ var nullType = ZodNull.create;
32791
+ var anyType = ZodAny.create;
32792
+ var unknownType = ZodUnknown.create;
32793
+ var neverType = ZodNever.create;
32794
+ var voidType = ZodVoid.create;
32795
+ var arrayType = ZodArray.create;
32796
+ var objectType = ZodObject.create;
32797
+ var strictObjectType = ZodObject.strictCreate;
32798
+ var unionType = ZodUnion.create;
32799
+ var discriminatedUnionType = ZodDiscriminatedUnion.create;
32800
+ var intersectionType = ZodIntersection.create;
32801
+ var tupleType = ZodTuple.create;
32802
+ var recordType = ZodRecord.create;
32803
+ var mapType = ZodMap.create;
32804
+ var setType = ZodSet.create;
32805
+ var functionType = ZodFunction.create;
32806
+ var lazyType = ZodLazy.create;
32807
+ var literalType = ZodLiteral.create;
32808
+ var enumType = ZodEnum.create;
32809
+ var nativeEnumType = ZodNativeEnum.create;
32810
+ var promiseType = ZodPromise.create;
32811
+ var effectsType = ZodEffects.create;
32812
+ var optionalType = ZodOptional.create;
32813
+ var nullableType = ZodNullable.create;
32814
+ var preprocessType = ZodEffects.createWithPreprocess;
32815
+ var pipelineType = ZodPipeline.create;
32816
+ var ostring = () => stringType().optional();
32817
+ var onumber = () => numberType().optional();
32818
+ var oboolean = () => booleanType().optional();
32819
+ var coerce = {
32820
+ string: ((arg) => ZodString.create({ ...arg, coerce: true })),
32821
+ number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
32822
+ boolean: ((arg) => ZodBoolean.create({
32823
+ ...arg,
32824
+ coerce: true
32825
+ })),
32826
+ bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
32827
+ date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
32828
+ };
32829
+ var NEVER = INVALID;
32830
+
28792
32831
  // vendor/@4pm/dto/base.ts
28793
- import { z } from "zod";
28794
- var baseRequestSchema = z.object({
28795
- page: z.coerce.number().int().min(1).default(1),
28796
- size: z.coerce.number().int().min(1).max(100).default(20),
28797
- search: z.string().max(200).optional(),
28798
- sort: z.string().max(50).optional(),
28799
- order: z.enum(["asc", "desc"]).default("desc")
32832
+ var baseRequestSchema = external_exports.object({
32833
+ page: external_exports.coerce.number().int().min(1).default(1),
32834
+ size: external_exports.coerce.number().int().min(1).max(100).default(20),
32835
+ search: external_exports.string().max(200).optional(),
32836
+ sort: external_exports.string().max(50).optional(),
32837
+ order: external_exports.enum(["asc", "desc"]).default("desc")
28800
32838
  });
28801
- var pinnedFilterSchema = z.enum(["true", "false"]).transform((v) => v === "true").optional();
28802
- var deletedFilterSchema = z.enum(["true", "false"]).transform((v) => v === "true").optional();
32839
+ var pinnedFilterSchema = external_exports.enum(["true", "false"]).transform((v) => v === "true").optional();
32840
+ var deletedFilterSchema = external_exports.enum(["true", "false"]).transform((v) => v === "true").optional();
28803
32841
 
28804
32842
  // vendor/@4pm/dto/command.ts
28805
- import { z as z2 } from "zod";
28806
32843
  var COMMAND_MAX_LEN = 8e3;
28807
32844
  var AI_PROMPT_MAX_LEN = 2e5;
28808
- var dispatchCommandRequestSchema = z2.object({
28809
- projectId: z2.string().uuid(),
32845
+ var dispatchCommandRequestSchema = external_exports.object({
32846
+ projectId: external_exports.string().uuid(),
28810
32847
  // Target cli. Required unless `pick` is set — with `pick:"idle"` the server chooses the
28811
32848
  // target from the project's pool, so the client omits it (ADR-0171).
28812
- machineLinkId: z2.string().uuid().optional(),
32849
+ machineLinkId: external_exports.string().uuid().optional(),
28813
32850
  /**
28814
32851
  * Server-side idle-cli pick (ADR-0171): `"idle"` ⇒ omit `machineLinkId` and let the server
28815
32852
  * select + atomically claim an idle cli from the project's pool (machine-users + org
28816
32853
  * orchestrator). Used by the wizard's AI ops so parallel suggests spread across the pool
28817
32854
  * without double-booking a busy cli; no idle cli ⇒ `ALL_CLIS_BUSY`.
28818
32855
  */
28819
- pick: z2.enum(["idle"]).optional(),
32856
+ pick: external_exports.enum(["idle"]).optional(),
28820
32857
  // In AI mode `command` carries the raw prompt (can be long — the spec-assist prompts
28821
32858
  // embed the whole self-describing spec envelope, ADR-0106), else an executable name.
28822
- command: z2.string().min(1).max(AI_PROMPT_MAX_LEN),
28823
- args: z2.array(z2.string().max(1e3)).max(50).optional(),
32859
+ command: external_exports.string().min(1).max(AI_PROMPT_MAX_LEN),
32860
+ args: external_exports.array(external_exports.string().max(1e3)).max(50).optional(),
28824
32861
  /**
28825
32862
  * AI prompt mode: run `command` as a prompt through the cli's AI CLI (profile
28826
32863
  * failover) instead of spawning it verbatim (mirrors a locally-typed prompt).
28827
32864
  */
28828
- ai: z2.boolean().optional(),
32865
+ ai: external_exports.boolean().optional(),
28829
32866
  /**
28830
32867
  * Short human label shown to OTHER tabs watching this cli's activity feed (ADR-0101):
28831
32868
  * e.g. "AI review" so the Console shows a friendly line instead of the raw prompt.
28832
32869
  */
28833
- label: z2.string().max(120).optional(),
32870
+ label: external_exports.string().max(120).optional(),
28834
32871
  /**
28835
32872
  * Git tab (ADR-0151): when set, `command` is a `git`/`gh`/`glab` command run on the
28836
32873
  * worker for the Git tab. The server routes the permission to `project.git` (`read`) /
28837
32874
  * `project.git_write` (`write`) instead of `command.execute`, and validates `command`
28838
32875
  * against the git allowlist (`isGitCommandAllowed`). Absent ⇒ normal console dispatch.
28839
32876
  */
28840
- gitOp: z2.enum(["read", "write"]).optional()
32877
+ gitOp: external_exports.enum(["read", "write"]).optional()
28841
32878
  }).superRefine((v, ctx) => {
28842
32879
  if (v.machineLinkId == null === (v.pick == null)) {
28843
32880
  ctx.addIssue({
28844
- code: z2.ZodIssueCode.custom,
32881
+ code: external_exports.ZodIssueCode.custom,
28845
32882
  path: ["machineLinkId"],
28846
32883
  message: "Provide exactly one of machineLinkId or pick."
28847
32884
  });
28848
32885
  }
28849
32886
  if (!v.ai && v.command.length > COMMAND_MAX_LEN) {
28850
32887
  ctx.addIssue({
28851
- code: z2.ZodIssueCode.too_big,
32888
+ code: external_exports.ZodIssueCode.too_big,
28852
32889
  maximum: COMMAND_MAX_LEN,
28853
32890
  type: "string",
28854
32891
  inclusive: true,
@@ -28858,160 +32895,152 @@ var dispatchCommandRequestSchema = z2.object({
28858
32895
  }
28859
32896
  });
28860
32897
  var listCommandsQuerySchema = baseRequestSchema.extend({
28861
- projectId: z2.string().uuid(),
32898
+ projectId: external_exports.string().uuid(),
28862
32899
  // Optional search filters (command-0005): `search` (from BaseRequest) matches the command
28863
32900
  // text/status; `from`/`to` are an inclusive `YYYY-MM-DD` date range over `startedAt`.
28864
- from: z2.string().optional(),
28865
- to: z2.string().optional()
32901
+ from: external_exports.string().optional(),
32902
+ to: external_exports.string().optional()
28866
32903
  });
28867
32904
 
28868
- // vendor/@4pm/dto/machine.ts
28869
- import { z as z4 } from "zod";
28870
-
28871
32905
  // vendor/@4pm/validation/schemas.ts
28872
- import { z as z3 } from "zod";
28873
- var passwordSchema = z3.string().min(8, "password: at least 8 characters").max(32, "password: at most 32 characters").regex(/[a-zA-Z]/, "password: needs at least 1 letter").regex(/[0-9]/, "password: needs at least 1 digit");
28874
- var usernameSchema = z3.string().min(3).max(32).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, "username: invalid characters");
28875
- var emailSchema = z3.string().email().max(254).toLowerCase();
28876
- var phoneSchema = z3.string().regex(/^\+?[0-9]{8,15}$/, "phone: invalid format");
32906
+ var passwordSchema = external_exports.string().min(8, "password: at least 8 characters").max(32, "password: at most 32 characters").regex(/[a-zA-Z]/, "password: needs at least 1 letter").regex(/[0-9]/, "password: needs at least 1 digit");
32907
+ var usernameSchema = external_exports.string().min(3).max(32).regex(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/, "username: invalid characters");
32908
+ var emailSchema = external_exports.string().email().max(254).toLowerCase();
32909
+ var phoneSchema = external_exports.string().regex(/^\+?[0-9]{8,15}$/, "phone: invalid format");
28877
32910
  var IPV4_CIDR_RE = /^((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])(\/(3[0-2]|[12]?[0-9]))?$/;
28878
32911
  var IPV6_LAX_RE = /^[0-9a-fA-F:]{2,45}(\/(12[0-8]|1[01][0-9]|[1-9]?[0-9]))?$/;
28879
- var ipCidrSchema = z3.string().refine((v) => IPV4_CIDR_RE.test(v) || IPV6_LAX_RE.test(v), {
32912
+ var ipCidrSchema = external_exports.string().refine((v) => IPV4_CIDR_RE.test(v) || IPV6_LAX_RE.test(v), {
28880
32913
  message: "ipAllowlist: invalid IP/CIDR"
28881
32914
  });
28882
- var ipAllowlistSchema = z3.array(ipCidrSchema).max(50).default([]);
28883
- var hexTokenSchema = z3.string().regex(/^[0-9a-f]{64}$/, "token: invalid format");
32915
+ var ipAllowlistSchema = external_exports.array(ipCidrSchema).max(50).default([]);
32916
+ var hexTokenSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, "token: invalid format");
28884
32917
 
28885
32918
  // vendor/@4pm/dto/machine.ts
28886
- var pairRequestSchema = z4.object({
32919
+ var pairRequestSchema = external_exports.object({
28887
32920
  hashcode1: hexTokenSchema,
28888
- userId: z4.string().uuid().optional()
32921
+ userId: external_exports.string().uuid().optional()
28889
32922
  });
28890
- var confirmRequestSchema = z4.object({
32923
+ var confirmRequestSchema = external_exports.object({
28891
32924
  hashcode2: hexTokenSchema,
28892
- fingerprint: z4.string().max(200).optional(),
28893
- hostname: z4.string().max(200).optional()
32925
+ fingerprint: external_exports.string().max(200).optional(),
32926
+ hostname: external_exports.string().max(200).optional()
28894
32927
  });
28895
- var wsTokenRequestSchema = z4.object({
32928
+ var wsTokenRequestSchema = external_exports.object({
28896
32929
  hashcode3: hexTokenSchema
28897
32930
  });
28898
- var pairTokenRequestSchema = z4.object({
28899
- token: z4.string().min(16).max(200),
28900
- fingerprint: z4.string().max(200).optional(),
28901
- hostname: z4.string().max(200).optional()
32931
+ var pairTokenRequestSchema = external_exports.object({
32932
+ token: external_exports.string().min(16).max(200),
32933
+ fingerprint: external_exports.string().max(200).optional(),
32934
+ hostname: external_exports.string().max(200).optional()
28902
32935
  });
28903
- var issueProvisioningTokenRequestSchema = z4.object({
28904
- machineLinkId: z4.string().uuid(),
32936
+ var issueProvisioningTokenRequestSchema = external_exports.object({
32937
+ machineLinkId: external_exports.string().uuid(),
28905
32938
  /** TTL seconds (0/absent ⇒ a default short TTL applied server-side). */
28906
- ttlSec: z4.number().int().min(0).max(2592e3).optional()
32939
+ ttlSec: external_exports.number().int().min(0).max(2592e3).optional()
28907
32940
  });
28908
32941
  var listWorkersQuerySchema = baseRequestSchema.extend({
28909
- status: z4.enum(["online", "offline"]).optional()
32942
+ status: external_exports.enum(["online", "offline"]).optional()
28910
32943
  });
28911
- var updateWorkerRequestSchema = z4.object({
28912
- name: z4.string().min(1).max(100).optional()
32944
+ var updateWorkerRequestSchema = external_exports.object({
32945
+ name: external_exports.string().min(1).max(100).optional()
28913
32946
  });
28914
- var putPhysicProjectRequestSchema = z4.object({
28915
- projectId: z4.string().uuid(),
32947
+ var putPhysicProjectRequestSchema = external_exports.object({
32948
+ projectId: external_exports.string().uuid(),
28916
32949
  /** null/empty ⇒ pending — the folder is finalized in wizard step 2. */
28917
- path: z4.string().min(1).max(500).nullable().optional(),
28918
- name: z4.string().max(100).optional()
32950
+ path: external_exports.string().min(1).max(500).nullable().optional(),
32951
+ name: external_exports.string().max(100).optional()
28919
32952
  });
28920
- var patchPhysicProjectRequestSchema = z4.object({
28921
- name: z4.string().min(1).max(100).optional(),
28922
- projectId: z4.string().uuid().optional(),
28923
- isAutonomous: z4.boolean().optional(),
28924
- disabled: z4.boolean().optional()
32953
+ var patchPhysicProjectRequestSchema = external_exports.object({
32954
+ name: external_exports.string().min(1).max(100).optional(),
32955
+ projectId: external_exports.string().uuid().optional(),
32956
+ isAutonomous: external_exports.boolean().optional(),
32957
+ disabled: external_exports.boolean().optional()
28925
32958
  });
28926
32959
  var listMachineLinksQuerySchema = baseRequestSchema.extend({
28927
- status: z4.string().max(20).optional()
32960
+ status: external_exports.string().max(20).optional()
28928
32961
  });
28929
- var updateMachineLinkRequestSchema = z4.object({
28930
- hashcode3ExpiresAt: z4.string().datetime().nullable()
32962
+ var updateMachineLinkRequestSchema = external_exports.object({
32963
+ hashcode3ExpiresAt: external_exports.string().datetime().nullable()
28931
32964
  });
28932
- var configWriteRequestSchema = z4.object({
28933
- config: z4.string().max(256 * 1024)
32965
+ var configWriteRequestSchema = external_exports.object({
32966
+ config: external_exports.string().max(256 * 1024)
28934
32967
  });
28935
32968
  var FILE_WRITE_MAX_BYTES = 2 * 1024 * 1024;
28936
- var fsWriteRequestSchema = z4.object({
32969
+ var fsWriteRequestSchema = external_exports.object({
28937
32970
  /** Path relative to the physic-project root; a `..` escaping the root is rejected on the cli. */
28938
- path: z4.string().min(1).max(1024),
32971
+ path: external_exports.string().min(1).max(1024),
28939
32972
  /** Full new UTF-8 content (replaces the file wholesale). */
28940
- content: z4.string().max(FILE_WRITE_MAX_BYTES)
32973
+ content: external_exports.string().max(FILE_WRITE_MAX_BYTES)
28941
32974
  });
28942
- var autonomousWriteRequestSchema = z4.discriminatedUnion("kind", [
28943
- z4.object({ kind: z4.literal("settings"), settings: z4.string().max(64 * 1024) }),
28944
- z4.object({ kind: z4.literal("approvals"), taskId: z4.string().min(1).max(64), approved: z4.boolean() }),
28945
- z4.object({ kind: z4.literal("userTodo"), content: z4.string().min(1).max(16 * 1024) }),
28946
- z4.object({ kind: z4.literal("cron"), action: z4.enum(["install", "uninstall"]) })
32975
+ var autonomousWriteRequestSchema = external_exports.discriminatedUnion("kind", [
32976
+ external_exports.object({ kind: external_exports.literal("settings"), settings: external_exports.string().max(64 * 1024) }),
32977
+ external_exports.object({ kind: external_exports.literal("approvals"), taskId: external_exports.string().min(1).max(64), approved: external_exports.boolean() }),
32978
+ external_exports.object({ kind: external_exports.literal("userTodo"), content: external_exports.string().min(1).max(16 * 1024) }),
32979
+ external_exports.object({ kind: external_exports.literal("cron"), action: external_exports.enum(["install", "uninstall"]) })
28947
32980
  ]);
28948
- var autonomousLogsQuerySchema = z4.object({
28949
- date: z4.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
32981
+ var autonomousLogsQuerySchema = external_exports.object({
32982
+ date: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
28950
32983
  });
28951
- var agentNameSchema = z4.string().min(1).max(64).regex(/^[\w.-]+$/);
28952
- var agentReadQuerySchema = z4.object({
28953
- kind: z4.enum(["subagent", "skill"]),
32984
+ var agentNameSchema = external_exports.string().min(1).max(64).regex(/^[\w.-]+$/);
32985
+ var agentReadQuerySchema = external_exports.object({
32986
+ kind: external_exports.enum(["subagent", "skill"]),
28954
32987
  name: agentNameSchema
28955
32988
  });
28956
- var ragInstallRequestSchema = z4.object({
28957
- model: z4.string().min(1).max(200)
32989
+ var ragInstallRequestSchema = external_exports.object({
32990
+ model: external_exports.string().min(1).max(200)
28958
32991
  });
28959
- var ragQueryQuerySchema = z4.object({
28960
- q: z4.string().min(1).max(2e3),
28961
- k: z4.coerce.number().int().min(1).max(20).optional()
32992
+ var ragQueryQuerySchema = external_exports.object({
32993
+ q: external_exports.string().min(1).max(2e3),
32994
+ k: external_exports.coerce.number().int().min(1).max(20).optional()
28962
32995
  });
28963
- var graphBuildQuerySchema = z4.object({
28964
- mode: z4.enum(["docs", "code"])
32996
+ var graphBuildQuerySchema = external_exports.object({
32997
+ mode: external_exports.enum(["docs", "code"])
28965
32998
  });
28966
- var secretKeySchema = z4.string().min(1).max(128).regex(/^[\w.-]+$/);
28967
- var secretsWriteRequestSchema = z4.discriminatedUnion("kind", [
28968
- z4.object({ kind: z4.literal("security"), content: z4.string().max(128 * 1024) }),
28969
- z4.object({ kind: z4.literal("placeholder"), content: z4.string().max(128 * 1024) }),
28970
- z4.object({ kind: z4.literal("secret"), key: secretKeySchema, value: z4.string().max(8192) }),
28971
- z4.object({ kind: z4.literal("secretDelete"), key: secretKeySchema })
32999
+ var secretKeySchema = external_exports.string().min(1).max(128).regex(/^[\w.-]+$/);
33000
+ var secretsWriteRequestSchema = external_exports.discriminatedUnion("kind", [
33001
+ external_exports.object({ kind: external_exports.literal("security"), content: external_exports.string().max(128 * 1024) }),
33002
+ external_exports.object({ kind: external_exports.literal("placeholder"), content: external_exports.string().max(128 * 1024) }),
33003
+ external_exports.object({ kind: external_exports.literal("secret"), key: secretKeySchema, value: external_exports.string().max(8192) }),
33004
+ external_exports.object({ kind: external_exports.literal("secretDelete"), key: secretKeySchema })
28972
33005
  ]);
28973
- var agentWriteRequestSchema = z4.object({
28974
- kind: z4.enum(["subagent", "skill"]),
33006
+ var agentWriteRequestSchema = external_exports.object({
33007
+ kind: external_exports.enum(["subagent", "skill"]),
28975
33008
  name: agentNameSchema,
28976
- action: z4.enum(["write", "delete"]),
28977
- content: z4.string().max(128 * 1024).optional()
33009
+ action: external_exports.enum(["write", "delete"]),
33010
+ content: external_exports.string().max(128 * 1024).optional()
28978
33011
  }).superRefine((v, ctx) => {
28979
33012
  if (v.action === "write" && (v.content === void 0 || v.content.length === 0)) {
28980
- ctx.addIssue({ code: z4.ZodIssueCode.custom, path: ["content"], message: "content is required for write" });
33013
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["content"], message: "content is required for write" });
28981
33014
  }
28982
33015
  });
28983
- var toolRuleSchema = z4.string().min(1).max(500);
28984
- var agentToolsPermissionsSchema = z4.object({
28985
- defaultMode: z4.enum(["default", "acceptEdits", "plan", "bypassPermissions"]),
28986
- allow: z4.array(toolRuleSchema).max(500),
28987
- ask: z4.array(toolRuleSchema).max(500),
28988
- deny: z4.array(toolRuleSchema).max(500)
33016
+ var toolRuleSchema = external_exports.string().min(1).max(500);
33017
+ var agentToolsPermissionsSchema = external_exports.object({
33018
+ defaultMode: external_exports.enum(["default", "acceptEdits", "plan", "bypassPermissions"]),
33019
+ allow: external_exports.array(toolRuleSchema).max(500),
33020
+ ask: external_exports.array(toolRuleSchema).max(500),
33021
+ deny: external_exports.array(toolRuleSchema).max(500)
28989
33022
  });
28990
- var agentToolsReadQuerySchema = z4.object({
28991
- scope: z4.enum(["shared", "local"])
33023
+ var agentToolsReadQuerySchema = external_exports.object({
33024
+ scope: external_exports.enum(["shared", "local"])
28992
33025
  });
28993
- var agentToolsWriteRequestSchema = z4.object({
28994
- scope: z4.enum(["shared", "local"]),
33026
+ var agentToolsWriteRequestSchema = external_exports.object({
33027
+ scope: external_exports.enum(["shared", "local"]),
28995
33028
  permissions: agentToolsPermissionsSchema
28996
33029
  });
28997
33030
 
28998
33031
  // vendor/@4pm/dto/org.ts
28999
- import { z as z5 } from "zod";
29000
33032
  var CLI_SETTINGS_BOUNDS = {
29001
33033
  reconnectMaxBackoffSec: { min: 5, max: 60 },
29002
33034
  autoUpdateHour: { min: 0, max: 23 }
29003
33035
  };
29004
- var orgAliasSchema = z5.string().regex(/^([a-z0-9-]{3,40})?$/, "alias must be 3\u201340 chars of a\u2013z, 0\u20139, -");
29005
- var updateOrgRequestSchema = z5.object({
29006
- name: z5.string().min(1).max(100).optional(),
33036
+ var orgAliasSchema = external_exports.string().regex(/^([a-z0-9-]{3,40})?$/, "alias must be 3\u201340 chars of a\u2013z, 0\u20139, -");
33037
+ var updateOrgRequestSchema = external_exports.object({
33038
+ name: external_exports.string().min(1).max(100).optional(),
29007
33039
  // ADMIN-only login alias (ADR-0111); empty string clears it.
29008
33040
  alias: orgAliasSchema.optional(),
29009
- settings: z5.record(z5.unknown()).optional()
33041
+ settings: external_exports.record(external_exports.unknown()).optional()
29010
33042
  });
29011
33043
 
29012
- // vendor/@4pm/dto/project.ts
29013
- import { z as z6 } from "zod";
29014
-
29015
33044
  // vendor/@4pm/dto/template.ts
29016
33045
  var TEMPLATE_KINDS = ["report", "est", "wbs", "proposal", "feasibility"];
29017
33046
 
@@ -29021,16 +33050,16 @@ var listProjectsQuerySchema = baseRequestSchema.extend({
29021
33050
  /** ADMIN-only Trash: list soft-deleted projects (ADR-0109). */
29022
33051
  deleted: deletedFilterSchema
29023
33052
  });
29024
- var recentProjectsQuerySchema = z6.object({
29025
- limit: z6.coerce.number().int().min(1).max(20).default(5)
33053
+ var recentProjectsQuerySchema = external_exports.object({
33054
+ limit: external_exports.coerce.number().int().min(1).max(20).default(5)
29026
33055
  });
29027
- var createProjectRequestSchema = z6.object({
29028
- name: z6.string().min(1).max(100),
29029
- description: z6.string().max(2e3).optional(),
29030
- machineUserId: z6.string().uuid().optional()
33056
+ var createProjectRequestSchema = external_exports.object({
33057
+ name: external_exports.string().min(1).max(100),
33058
+ description: external_exports.string().max(2e3).optional(),
33059
+ machineUserId: external_exports.string().uuid().optional()
29031
33060
  });
29032
- var copyProjectRequestSchema = z6.object({
29033
- name: z6.string().min(1).max(100)
33061
+ var copyProjectRequestSchema = external_exports.object({
33062
+ name: external_exports.string().min(1).max(100)
29034
33063
  });
29035
33064
  var DEFAULT_OUTBOUND_RULES = {
29036
33065
  secret: [
@@ -29054,96 +33083,96 @@ function compileRulePattern(entry) {
29054
33083
  if (literal) return new RegExp(literal[1] ?? "", literal[2] ?? "");
29055
33084
  return new RegExp(entry.trim());
29056
33085
  }
29057
- var updateProjectRequestSchema = z6.object({
29058
- name: z6.string().min(1).max(100).optional(),
29059
- description: z6.string().max(2e3).optional(),
33086
+ var updateProjectRequestSchema = external_exports.object({
33087
+ name: external_exports.string().min(1).max(100).optional(),
33088
+ description: external_exports.string().max(2e3).optional(),
29060
33089
  // Mid-tier IP allowlist (ADR-0050) — PM(manage)/ADMIN only; must fall within org.
29061
33090
  ipAllowlist: ipAllowlistSchema.optional(),
29062
33091
  // Messenger retention in days (0 = keep forever) — manager only (ADR-0078).
29063
- messengerRetentionDays: z6.number().int().min(0).max(3650).optional(),
33092
+ messengerRetentionDays: external_exports.number().int().min(0).max(3650).optional(),
29064
33093
  // Project settings (ADR-0081) — key-level shallow-merge; `tokens` clamped on read.
29065
- settings: z6.record(z6.unknown()).optional(),
33094
+ settings: external_exports.record(external_exports.unknown()).optional(),
29066
33095
  // Identity ↔ spec sync (ADR-0148): the Settings tab edits the spec basic group
29067
33096
  // (id = spec slug, name, desc). The server merges these into `spec` (READY) or
29068
33097
  // `specDraft` (DRAFT) so the Content → Spec tab / wizard stays consistent.
29069
- specBasic: z6.object({
29070
- id: z6.string().max(200),
29071
- name: z6.string().max(100),
29072
- desc: z6.string().max(2e3)
33098
+ specBasic: external_exports.object({
33099
+ id: external_exports.string().max(200),
33100
+ name: external_exports.string().max(100),
33101
+ desc: external_exports.string().max(2e3)
29073
33102
  }).partial().optional()
29074
33103
  });
29075
33104
  var MEMO_MAX_LENGTH = 65536;
29076
- var putMemoRequestSchema = z6.object({
29077
- content: z6.string().max(MEMO_MAX_LENGTH)
33105
+ var putMemoRequestSchema = external_exports.object({
33106
+ content: external_exports.string().max(MEMO_MAX_LENGTH)
29078
33107
  });
29079
33108
  var MEMO_ITEM_MAX_LENGTH = 2e3;
29080
- var createMemoItemSchema = z6.object({
29081
- content: z6.string().trim().min(1).max(MEMO_ITEM_MAX_LENGTH)
33109
+ var createMemoItemSchema = external_exports.object({
33110
+ content: external_exports.string().trim().min(1).max(MEMO_ITEM_MAX_LENGTH)
29082
33111
  });
29083
- var updateMemoItemSchema = z6.object({
29084
- content: z6.string().trim().min(1).max(MEMO_ITEM_MAX_LENGTH).optional(),
29085
- done: z6.boolean().optional()
33112
+ var updateMemoItemSchema = external_exports.object({
33113
+ content: external_exports.string().trim().min(1).max(MEMO_ITEM_MAX_LENGTH).optional(),
33114
+ done: external_exports.boolean().optional()
29086
33115
  }).refine((v) => v.content !== void 0 || v.done !== void 0, {
29087
33116
  message: "content or done required"
29088
33117
  });
29089
33118
  var HTTP_JSON_BODY_LIMIT_BYTES = 2 * 1048576;
29090
- var putSpecDraftRequestSchema = z6.object({
29091
- spec: z6.record(z6.unknown()),
29092
- specVersion: z6.number().int().positive().optional()
33119
+ var putSpecDraftRequestSchema = external_exports.object({
33120
+ spec: external_exports.record(external_exports.unknown()),
33121
+ specVersion: external_exports.number().int().positive().optional()
29093
33122
  });
29094
- var putProjectSpecRequestSchema = z6.object({
29095
- spec: z6.record(z6.unknown())
33123
+ var putProjectSpecRequestSchema = external_exports.object({
33124
+ spec: external_exports.record(external_exports.unknown())
29096
33125
  });
29097
33126
  var ARTIFACT_MAX_BYTES = 512 * 1024;
29098
- var listArtifactsQuerySchema = z6.object({
29099
- kind: z6.enum(TEMPLATE_KINDS).optional()
33127
+ var listArtifactsQuerySchema = external_exports.object({
33128
+ kind: external_exports.enum(TEMPLATE_KINDS).optional()
29100
33129
  });
29101
- var createArtifactRequestSchema = z6.object({
29102
- kind: z6.enum(TEMPLATE_KINDS),
29103
- content: z6.string().min(1).max(ARTIFACT_MAX_BYTES)
33130
+ var createArtifactRequestSchema = external_exports.object({
33131
+ kind: external_exports.enum(TEMPLATE_KINDS),
33132
+ content: external_exports.string().min(1).max(ARTIFACT_MAX_BYTES)
29104
33133
  });
29105
33134
  var GIT_URL_RE = /^(https?:\/\/|git@[^\s:]+:|ssh:\/\/).+/i;
29106
- var repoSpecSchema = z6.object({
33135
+ var repoSpecSchema = external_exports.object({
29107
33136
  /** Role label (e.g. "docs" / "web" / "server") — descriptive, not constrained. */
29108
- role: z6.string().max(60).optional().default(""),
33137
+ role: external_exports.string().max(60).optional().default(""),
29109
33138
  /** Free-form description of what this repo holds (optional). */
29110
- desc: z6.string().max(500).optional().default(""),
33139
+ desc: external_exports.string().max(500).optional().default(""),
29111
33140
  /** Exactly one repo of the project is the primary. */
29112
- primary: z6.boolean().optional().default(false),
33141
+ primary: external_exports.boolean().optional().default(false),
29113
33142
  /** Clone url — `https` or `ssh` (required; ADR-0172). */
29114
- url: z6.string().max(500).regex(GIT_URL_RE, "must be an https or ssh git url"),
33143
+ url: external_exports.string().max(500).regex(GIT_URL_RE, "must be an https or ssh git url"),
29115
33144
  /** Sub-repo subfolder under the target root (empty ⇒ derived from role/name). */
29116
- subdir: z6.string().max(120).optional().default("")
33145
+ subdir: external_exports.string().max(120).optional().default("")
29117
33146
  });
29118
33147
  function repoName(url) {
29119
33148
  const last = (url || "").trim().replace(/\/+$/, "").split(/[/:]/).pop() ?? "";
29120
33149
  return last.replace(/\.git$/i, "");
29121
33150
  }
29122
- var specFieldEnvelopeSchema = z6.object({
29123
- id: z6.string().min(1),
29124
- name: z6.string().optional().default(""),
29125
- description: z6.string().optional().default(""),
29126
- type: z6.string().optional().default("text"),
29127
- options: z6.array(z6.string()).optional(),
29128
- value: z6.union([z6.string(), z6.array(z6.string())]).optional().default("")
33151
+ var specFieldEnvelopeSchema = external_exports.object({
33152
+ id: external_exports.string().min(1),
33153
+ name: external_exports.string().optional().default(""),
33154
+ description: external_exports.string().optional().default(""),
33155
+ type: external_exports.string().optional().default("text"),
33156
+ options: external_exports.array(external_exports.string()).optional(),
33157
+ value: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional().default("")
29129
33158
  });
29130
- var subagentSpecSchema = z6.object({
29131
- name: z6.string().max(120).optional().default(""),
29132
- description: z6.string().max(2e3).optional().default("")
33159
+ var subagentSpecSchema = external_exports.object({
33160
+ name: external_exports.string().max(120).optional().default(""),
33161
+ description: external_exports.string().max(2e3).optional().default("")
29133
33162
  });
29134
- var projectSpecSchema = z6.object({
29135
- specVersion: z6.number().int().positive(),
29136
- fields: z6.array(specFieldEnvelopeSchema),
29137
- repos: z6.array(repoSpecSchema).optional().default([]),
29138
- subagents: z6.array(subagentSpecSchema).optional().default([]),
29139
- meta: z6.record(z6.unknown()).optional()
33163
+ var projectSpecSchema = external_exports.object({
33164
+ specVersion: external_exports.number().int().positive(),
33165
+ fields: external_exports.array(specFieldEnvelopeSchema),
33166
+ repos: external_exports.array(repoSpecSchema).optional().default([]),
33167
+ subagents: external_exports.array(subagentSpecSchema).optional().default([]),
33168
+ meta: external_exports.record(external_exports.unknown()).optional()
29140
33169
  }).superRefine((v, ctx) => {
29141
33170
  const byId = new Map(v.fields.map((f) => [f.id, f.value]));
29142
33171
  for (const key of ["id", "name"]) {
29143
33172
  const val = byId.get(key);
29144
33173
  if (typeof val !== "string" || val.trim() === "") {
29145
33174
  ctx.addIssue({
29146
- code: z6.ZodIssueCode.custom,
33175
+ code: external_exports.ZodIssueCode.custom,
29147
33176
  path: ["fields"],
29148
33177
  message: `the "${key}" field is required`
29149
33178
  });
@@ -29153,25 +33182,25 @@ var projectSpecSchema = z6.object({
29153
33182
  const primaries = v.repos.filter((r) => r.primary).length;
29154
33183
  if (primaries !== 1) {
29155
33184
  ctx.addIssue({
29156
- code: z6.ZodIssueCode.custom,
33185
+ code: external_exports.ZodIssueCode.custom,
29157
33186
  path: ["repos"],
29158
33187
  message: "exactly one primary repo is required"
29159
33188
  });
29160
33189
  }
29161
33190
  }
29162
33191
  });
29163
- var createFromSpecRequestSchema = z6.object({
29164
- projectId: z6.string().uuid(),
33192
+ var createFromSpecRequestSchema = external_exports.object({
33193
+ projectId: external_exports.string().uuid(),
29165
33194
  spec: projectSpecSchema
29166
33195
  });
29167
- var addRepoRequestSchema = z6.object({
29168
- projectId: z6.string().uuid(),
29169
- repos: z6.array(repoSpecSchema).min(1)
33196
+ var addRepoRequestSchema = external_exports.object({
33197
+ projectId: external_exports.string().uuid(),
33198
+ repos: external_exports.array(repoSpecSchema).min(1)
29170
33199
  }).superRefine((v, ctx) => {
29171
33200
  const primaries = v.repos.filter((r) => r.primary).length;
29172
33201
  if (primaries !== 1) {
29173
33202
  ctx.addIssue({
29174
- code: z6.ZodIssueCode.custom,
33203
+ code: external_exports.ZodIssueCode.custom,
29175
33204
  path: ["repos"],
29176
33205
  message: "Exactly one repo must be primary"
29177
33206
  });
@@ -29179,28 +33208,27 @@ var addRepoRequestSchema = z6.object({
29179
33208
  });
29180
33209
 
29181
33210
  // vendor/@4pm/dto/user.ts
29182
- import { z as z7 } from "zod";
29183
33211
  var AVATAR_MAX_BYTES = 2 * 1024 * 1024;
29184
33212
  var USAGE_ALERT_METRICS = ["session5h", "weekly", "monthlyTokens"];
29185
- var usageAlertRuleSchema = z7.object({
29186
- id: z7.string().min(1).max(64),
29187
- metric: z7.enum(USAGE_ALERT_METRICS),
29188
- threshold: z7.number().int().min(1),
29189
- email: z7.union([emailSchema, z7.literal("")]).optional(),
29190
- enabled: z7.boolean().default(true)
33213
+ var usageAlertRuleSchema = external_exports.object({
33214
+ id: external_exports.string().min(1).max(64),
33215
+ metric: external_exports.enum(USAGE_ALERT_METRICS),
33216
+ threshold: external_exports.number().int().min(1),
33217
+ email: external_exports.union([emailSchema, external_exports.literal("")]).optional(),
33218
+ enabled: external_exports.boolean().default(true)
29191
33219
  });
29192
- var userAlertsSchema = z7.object({
29193
- rules: z7.array(usageAlertRuleSchema).max(20).default([])
33220
+ var userAlertsSchema = external_exports.object({
33221
+ rules: external_exports.array(usageAlertRuleSchema).max(20).default([])
29194
33222
  });
29195
- var rolesSchema = z7.array(z7.enum(ALL_ROLES)).min(1).refine((roles) => isValidRoleSet(roles), {
33223
+ var rolesSchema = external_exports.array(external_exports.enum(ALL_ROLES)).min(1).refine((roles) => isValidRoleSet(roles), {
29196
33224
  message: "ADMIN/MACHINE cannot be combined with other roles"
29197
33225
  });
29198
33226
  var listUsersQuerySchema = baseRequestSchema.extend({
29199
- role: z7.enum(ALL_ROLES).optional(),
33227
+ role: external_exports.enum(ALL_ROLES).optional(),
29200
33228
  /** ADMIN-only Trash: list soft-deleted users (ADR-0109). */
29201
33229
  deleted: deletedFilterSchema
29202
33230
  });
29203
- var createUserRequestSchema = z7.object({
33231
+ var createUserRequestSchema = external_exports.object({
29204
33232
  username: usernameSchema,
29205
33233
  password: passwordSchema,
29206
33234
  // optional — allowed only when the org enables it (ADR-0039); enforced server-side
@@ -29209,31 +33237,36 @@ var createUserRequestSchema = z7.object({
29209
33237
  phone: phoneSchema.optional(),
29210
33238
  ipAllowlist: ipAllowlistSchema.optional()
29211
33239
  });
29212
- var updateUserRequestSchema = z7.object({
33240
+ var updateUserRequestSchema = external_exports.object({
29213
33241
  email: emailSchema.optional(),
29214
33242
  phone: phoneSchema.nullable().optional(),
29215
33243
  roles: rolesSchema.optional(),
29216
33244
  ipAllowlist: ipAllowlistSchema.optional(),
33245
+ // Friendly display name (ADR-0200) — shown instead of the immutable username; blank ⇒ cleared.
33246
+ aliasName: external_exports.string().trim().max(60).nullable().optional(),
29217
33247
  // Usage-alert rules (ADR-0110) — manager-only, like the IP allowlist.
29218
33248
  alerts: userAlertsSchema.optional(),
29219
33249
  // cli data retention days (ADR-0115) — manager-only; capped at the plan's retentionDays.
29220
- cliRetentionDays: z7.number().int().min(0).max(3650).optional()
33250
+ cliRetentionDays: external_exports.number().int().min(0).max(3650).optional()
29221
33251
  });
29222
- var setUserPasswordRequestSchema = z7.object({
33252
+ var setUserPasswordRequestSchema = external_exports.object({
29223
33253
  password: passwordSchema
29224
33254
  });
29225
- var contactChangeRequestSchema = z7.object({
33255
+ var contactChangeRequestSchema = external_exports.object({
29226
33256
  email: emailSchema.optional(),
29227
33257
  phone: phoneSchema.optional()
29228
33258
  }).refine((v) => Boolean(v.email) !== Boolean(v.phone), {
29229
33259
  message: "exactly one of email or phone is required",
29230
33260
  path: ["email"]
29231
33261
  });
29232
- var contactChangeVerifySchema = z7.object({
29233
- otp: z7.string().min(4).max(10)
33262
+ var contactChangeVerifySchema = external_exports.object({
33263
+ otp: external_exports.string().min(4).max(10)
33264
+ });
33265
+ var contactChangeConfirmSchema = external_exports.object({
33266
+ token: external_exports.string().min(1)
29234
33267
  });
29235
- var contactChangeConfirmSchema = z7.object({
29236
- token: z7.string().min(1)
33268
+ var activityHeartbeatSchema = external_exports.object({
33269
+ projectId: external_exports.string().uuid().optional()
29237
33270
  });
29238
33271
 
29239
33272
  // vendor/@4pm/ws/batcher.ts
@@ -33208,8 +37241,8 @@ var WsClient = class {
33208
37241
  profileUnderSessionPressure(config, cmd, workingDir) {
33209
37242
  const threshold = config.sessionSwitchPct ?? 0;
33210
37243
  if (threshold <= 0 || cmd !== "claude") return null;
33211
- const util = this.usageSnapshot?.session.utilizationPct ?? 0;
33212
- if (util < threshold) return null;
37244
+ const util2 = this.usageSnapshot?.session.utilizationPct ?? 0;
37245
+ if (util2 < threshold) return null;
33213
37246
  const dirs = claudeHomeDirs(config);
33214
37247
  if (dirs.length < 2) return null;
33215
37248
  const currentIndex = workingDir ? dirs.indexOf(workingDir) : -1;
@@ -33225,8 +37258,8 @@ var WsClient = class {
33225
37258
  credentialUnderSessionPressure(config, workingCred) {
33226
37259
  const threshold = config.sessionSwitchPct ?? 0;
33227
37260
  if (threshold <= 0) return null;
33228
- const util = this.usageSnapshot?.session.utilizationPct ?? 0;
33229
- if (util < threshold) return null;
37261
+ const util2 = this.usageSnapshot?.session.utilizationPct ?? 0;
37262
+ if (util2 < threshold) return null;
33230
37263
  const keys = claudeCredentialKeys(config);
33231
37264
  if (keys.length < 2) return null;
33232
37265
  const currentIndex = workingCred ? keys.indexOf(workingCred) : -1;
@@ -34471,7 +38504,7 @@ var loadYoga = (() => {
34471
38504
  var noExitRuntime = h.noExitRuntime || true;
34472
38505
  "object" != typeof WebAssembly && x("no native wasm support detected");
34473
38506
  var fa, ha = false;
34474
- function z8(a, b, c) {
38507
+ function z(a, b, c) {
34475
38508
  c = b + c;
34476
38509
  for (var d = ""; !(b >= c); ) {
34477
38510
  var e = a[b++];
@@ -35121,7 +39154,7 @@ var loadYoga = (() => {
35121
39154
  return b;
35122
39155
  }, Jb = {
35123
39156
  l: function(a, b, c, d) {
35124
- x("Assertion failed: " + (a ? z8(A, a) : "") + ", at: " + [b ? b ? z8(A, b) : "" : "unknown filename", c, d ? d ? z8(A, d) : "" : "unknown function"]);
39157
+ x("Assertion failed: " + (a ? z(A, a) : "") + ", at: " + [b ? b ? z(A, b) : "" : "unknown filename", c, d ? d ? z(A, d) : "" : "unknown function"]);
35125
39158
  },
35126
39159
  q: function(a, b, c) {
35127
39160
  a = N(a);
@@ -35374,7 +39407,7 @@ var loadYoga = (() => {
35374
39407
  if (c) for (var g = f, k = 0; k <= e; ++k) {
35375
39408
  var m = f + k;
35376
39409
  if (k == e || 0 == A[m]) {
35377
- g = g ? z8(A, g, m - g) : "";
39410
+ g = g ? z(A, g, m - g) : "";
35378
39411
  if (void 0 === l) var l = g;
35379
39412
  else l += String.fromCharCode(0), l += g;
35380
39413
  g = m + 1;
@@ -35571,7 +39604,7 @@ var loadYoga = (() => {
35571
39604
  b += 8;
35572
39605
  for (var m = 0; m < k; m++) {
35573
39606
  var l = A[g + m], n = Fb[a];
35574
- 0 === l || 10 === l ? ((1 === a ? ea : v)(z8(n, 0)), n.length = 0) : n.push(l);
39607
+ 0 === l || 10 === l ? ((1 === a ? ea : v)(z(n, 0)), n.length = 0) : n.push(l);
35575
39608
  }
35576
39609
  e += k;
35577
39610
  }
@@ -39952,10 +43985,8 @@ var CONFIG_KEYS = [
39952
43985
  "physicPath",
39953
43986
  "commandHistoryUploadMinutes",
39954
43987
  "autoUpdate",
39955
- "aiEnv",
39956
- "aiCredentialMode"
43988
+ "aiEnv"
39957
43989
  ];
39958
- var AI_CREDENTIAL_MODES = ["in-container", "host-mounted", "host-cli"];
39959
43990
  function configPath(profileDir2) {
39960
43991
  return join29(profileDir2, "config.json");
39961
43992
  }
@@ -39987,11 +44018,6 @@ function parseConfigAssignment(key, valueTokens) {
39987
44018
  } catch {
39988
44019
  return { error: `aiEnv must be JSON, e.g. {"KEY":"val"}.` };
39989
44020
  }
39990
- case "aiCredentialMode":
39991
- if (!AI_CREDENTIAL_MODES.includes(value)) {
39992
- return { error: `Use ${AI_CREDENTIAL_MODES.join("|")}, not "${value}".` };
39993
- }
39994
- return { patch: { aiCredentialMode: value } };
39995
44021
  default:
39996
44022
  return { error: `Unknown key "${key}". Allowed: ${CONFIG_KEYS.join(", ")}.` };
39997
44023
  }