@harnessio/forms 0.17.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,20 @@
1
- var je = Object.defineProperty;
2
- var Pe = (r, e, t) => e in r ? je(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var N = (r, e, t) => Pe(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { isEmpty as J, set as R, get as T, forOwn as ge, isArray as w, isObject as be, merge as A, isUndefined as L, cloneDeep as M, unset as ve, isPlainObject as xe, isNull as Te, isString as Fe, omitBy as qe, isNil as Ae, capitalize as ke } from "lodash-es";
5
- import De, { createContext as Me, useContext as $e, Component as Ne, memo as Be, useMemo as B, useRef as P, useEffect as j, useCallback as Ze, forwardRef as We, Fragment as Je } from "react";
6
- import { useFormContext as Le, get as Ue, useForm as He, FormProvider as Ge, appendErrors as Ke, useController as Qe } from "react-hook-form";
7
- import { Controller as Xr, Form as Yr, FormProvider as zr, get as et, set as rt, useFieldArray as tt, useForm as nt, useFormContext as st, useFormState as it, useWatch as at } from "react-hook-form";
8
- import * as p from "zod";
9
- import { toNestErrors as Xe } from "@hookform/resolvers";
10
- class Ye extends Error {
1
+ var Dt = Object.defineProperty;
2
+ var Lt = (r, e, t) => e in r ? Dt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var ye = (r, e, t) => Lt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { isEmpty as Ce, set as M, get as E, forOwn as kt, isArray as J, isObject as wt, merge as oe, isUndefined as Oe, cloneDeep as le, unset as Tt, isPlainObject as qt, isNull as Ct, isString as zt, omitBy as Bt, isNil as Ut, capitalize as Wt } from "lodash-es";
5
+ import Jt, { createContext as Ht, useContext as Yt, Component as Gt, memo as Qt, useMemo as ge, useRef as G, useEffect as Y, useCallback as Xt, forwardRef as Kt, Fragment as er } from "react";
6
+ import { useFormContext as tr, get as rr, useForm as nr, FormProvider as sr, appendErrors as ar, useController as ir } from "react-hook-form";
7
+ import { Controller as Pn, Form as $n, FormProvider as Mn, get as Fn, set as Dn, useFieldArray as Ln, useForm as qn, useFormContext as zn, useFormState as Bn, useWatch as Un } from "react-hook-form";
8
+ import { toNestErrors as or } from "@hookform/resolvers";
9
+ class ur extends Error {
11
10
  constructor(e) {
12
11
  super(`Input component '${e}' is already registered.`);
13
12
  }
14
13
  }
15
- class Ce {
14
+ class Ot {
16
15
  constructor(e) {
17
- N(this, "componentBank");
18
- N(this, "allowOverride");
16
+ ye(this, "componentBank");
17
+ ye(this, "allowOverride");
19
18
  this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
20
19
  }
21
20
  /**
@@ -26,11 +25,11 @@ class Ce {
26
25
  */
27
26
  registerComponent(e) {
28
27
  if (!this.allowOverride && this.getComponent(e.internalType))
29
- throw new Ye(e.internalType);
28
+ throw new ur(e.internalType);
30
29
  this.componentBank.set(e.internalType, e);
31
30
  }
32
31
  getComponent(e) {
33
- if (e && !J(e))
32
+ if (e && !Ce(e))
34
33
  return this.componentBank.get(e);
35
34
  }
36
35
  /**
@@ -47,7 +46,7 @@ class Ce {
47
46
  * @returns new input factory
48
47
  */
49
48
  clone() {
50
- const e = new Ce({
49
+ const e = new Ot({
51
50
  allowOverride: this.allowOverride
52
51
  });
53
52
  return this.listRegisteredComponents().forEach((t) => {
@@ -55,57 +54,57 @@ class Ce {
55
54
  }), e;
56
55
  }
57
56
  }
58
- var U = { exports: {} }, x = {};
57
+ var Se = { exports: {} }, K = {};
59
58
  /*
60
59
  object-assign
61
60
  (c) Sindre Sorhus
62
61
  @license MIT
63
62
  */
64
- var H, fe;
65
- function ze() {
66
- if (fe) return H;
67
- fe = 1;
63
+ var Re, et;
64
+ function cr() {
65
+ if (et) return Re;
66
+ et = 1;
68
67
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
69
68
  function n(s) {
70
69
  if (s == null)
71
70
  throw new TypeError("Object.assign cannot be called with null or undefined");
72
71
  return Object(s);
73
72
  }
74
- function o() {
73
+ function a() {
75
74
  try {
76
75
  if (!Object.assign)
77
76
  return !1;
78
77
  var s = new String("abc");
79
78
  if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
80
79
  return !1;
81
- for (var i = {}, a = 0; a < 10; a++)
82
- i["_" + String.fromCharCode(a)] = a;
83
- var c = Object.getOwnPropertyNames(i).map(function(u) {
84
- return i[u];
80
+ for (var i = {}, o = 0; o < 10; o++)
81
+ i["_" + String.fromCharCode(o)] = o;
82
+ var u = Object.getOwnPropertyNames(i).map(function(d) {
83
+ return i[d];
85
84
  });
86
- if (c.join("") !== "0123456789")
85
+ if (u.join("") !== "0123456789")
87
86
  return !1;
88
- var l = {};
89
- return "abcdefghijklmnopqrst".split("").forEach(function(u) {
90
- l[u] = u;
91
- }), Object.keys(Object.assign({}, l)).join("") === "abcdefghijklmnopqrst";
87
+ var c = {};
88
+ return "abcdefghijklmnopqrst".split("").forEach(function(d) {
89
+ c[d] = d;
90
+ }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
92
91
  } catch {
93
92
  return !1;
94
93
  }
95
94
  }
96
- return H = o() ? Object.assign : function(s, i) {
97
- for (var a, c = n(s), l, u = 1; u < arguments.length; u++) {
98
- a = Object(arguments[u]);
99
- for (var d in a)
100
- e.call(a, d) && (c[d] = a[d]);
95
+ return Re = a() ? Object.assign : function(s, i) {
96
+ for (var o, u = n(s), c, d = 1; d < arguments.length; d++) {
97
+ o = Object(arguments[d]);
98
+ for (var y in o)
99
+ e.call(o, y) && (u[y] = o[y]);
101
100
  if (r) {
102
- l = r(a);
103
- for (var f = 0; f < l.length; f++)
104
- t.call(a, l[f]) && (c[l[f]] = a[l[f]]);
101
+ c = r(o);
102
+ for (var h = 0; h < c.length; h++)
103
+ t.call(o, c[h]) && (u[c[h]] = o[c[h]]);
105
104
  }
106
105
  }
107
- return c;
108
- }, H;
106
+ return u;
107
+ }, Re;
109
108
  }
110
109
  /** @license React v17.0.2
111
110
  * react-jsx-runtime.production.min.js
@@ -115,39 +114,39 @@ function ze() {
115
114
  * This source code is licensed under the MIT license found in the
116
115
  * LICENSE file in the root directory of this source tree.
117
116
  */
118
- var le;
119
- function er() {
120
- if (le) return x;
121
- le = 1, ze();
122
- var r = De, e = 60103;
123
- if (x.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
117
+ var tt;
118
+ function dr() {
119
+ if (tt) return K;
120
+ tt = 1, cr();
121
+ var r = Jt, e = 60103;
122
+ if (K.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
123
  var t = Symbol.for;
125
- e = t("react.element"), x.Fragment = t("react.fragment");
124
+ e = t("react.element"), K.Fragment = t("react.fragment");
126
125
  }
127
- var n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
128
- function i(a, c, l) {
129
- var u, d = {}, f = null, m = null;
130
- l !== void 0 && (f = "" + l), c.key !== void 0 && (f = "" + c.key), c.ref !== void 0 && (m = c.ref);
131
- for (u in c) o.call(c, u) && !s.hasOwnProperty(u) && (d[u] = c[u]);
132
- if (a && a.defaultProps) for (u in c = a.defaultProps, c) d[u] === void 0 && (d[u] = c[u]);
133
- return { $$typeof: e, type: a, key: f, ref: m, props: d, _owner: n.current };
126
+ var n = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = Object.prototype.hasOwnProperty, s = { key: !0, ref: !0, __self: !0, __source: !0 };
127
+ function i(o, u, c) {
128
+ var d, y = {}, h = null, v = null;
129
+ c !== void 0 && (h = "" + c), u.key !== void 0 && (h = "" + u.key), u.ref !== void 0 && (v = u.ref);
130
+ for (d in u) a.call(u, d) && !s.hasOwnProperty(d) && (y[d] = u[d]);
131
+ if (o && o.defaultProps) for (d in u = o.defaultProps, u) y[d] === void 0 && (y[d] = u[d]);
132
+ return { $$typeof: e, type: o, key: h, ref: v, props: y, _owner: n.current };
134
133
  }
135
- return x.jsx = i, x.jsxs = i, x;
134
+ return K.jsx = i, K.jsxs = i, K;
136
135
  }
137
- var de;
138
- function rr() {
139
- return de || (de = 1, U.exports = er()), U.exports;
136
+ var rt;
137
+ function lr() {
138
+ return rt || (rt = 1, Se.exports = dr()), Se.exports;
140
139
  }
141
- var g = rr();
142
- const Oe = Me({});
143
- function tr({
140
+ var O = lr();
141
+ const St = Ht({});
142
+ function fr({
144
143
  children: r,
145
144
  metadata: e,
146
145
  inputErrorHandler: t,
147
146
  readonly: n
148
147
  }) {
149
- return /* @__PURE__ */ g.jsx(
150
- Oe.Provider,
148
+ return /* @__PURE__ */ O.jsx(
149
+ St.Provider,
151
150
  {
152
151
  value: {
153
152
  metadata: e,
@@ -158,14 +157,14 @@ function tr({
158
157
  }
159
158
  );
160
159
  }
161
- function nr() {
162
- const r = $e(Oe);
160
+ function hr() {
161
+ const r = Yt(St);
163
162
  return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
164
163
  }
165
- class sr extends Ne {
164
+ class mr extends Gt {
166
165
  constructor() {
167
166
  super(...arguments);
168
- N(this, "state", {
167
+ ye(this, "state", {
169
168
  hasError: !1
170
169
  });
171
170
  }
@@ -175,71 +174,71 @@ class sr extends Ne {
175
174
  componentDidCatch(t, n) {
176
175
  var s, i;
177
176
  console.error(t, n);
178
- const o = new Error(
177
+ const a = new Error(
179
178
  `Form input [${this.props.inputType}] has failed at path [${this.props.path}]. Error: ${t}, Error info: ${n}`
180
179
  );
181
- (i = (s = this.props).inputErrorHandler) == null || i.call(s, o);
180
+ (i = (s = this.props).inputErrorHandler) == null || i.call(s, a);
182
181
  }
183
182
  render() {
184
- return this.state.hasError ? /* @__PURE__ */ g.jsx(g.Fragment, {}) : this.props.children;
183
+ return this.state.hasError ? /* @__PURE__ */ O.jsx(O.Fragment, {}) : this.props.children;
185
184
  }
186
185
  }
187
- const me = ({
186
+ const nt = ({
188
187
  children: r,
189
188
  withoutWrapper: e = !1
190
- }) => e || !r ? r : /* @__PURE__ */ g.jsx("div", { children: r }), ir = Be(function({
189
+ }) => e || !r ? r : /* @__PURE__ */ O.jsx("div", { children: r }), pr = Qt(function({
191
190
  path: e,
192
191
  factory: t,
193
192
  onUpdate: n,
194
- onChange: o,
193
+ onChange: a,
195
194
  initialValues: s,
196
195
  input: i,
197
- withoutWrapper: a = !1
196
+ withoutWrapper: o = !1
198
197
  }) {
199
- var te, ne, se, ie, ae;
200
- const c = Le(), { formState: l } = c, { fixedValues: u = {} } = {}, { metadata: d, readonly: f, inputErrorHandler: m } = nr(), b = t == null ? void 0 : t.getComponent(i.inputType), h = !!(i.isVisible || typeof i.disabled == "function" || typeof ((te = i.validation) == null ? void 0 : te.schema) == "function" || typeof ((ne = i.warning) == null ? void 0 : ne.schema) == "function"), v = !!((se = i.warning) != null && se.schema || (ie = i.validation) != null && ie.schema), y = h ? c.watch() : {}, E = v ? h ? Ue(y, i.path) : c.watch(i.path) : void 0, S = B(() => {
201
- if (!h) return {};
202
- let F = y;
203
- return u && Object.keys(u).forEach(($) => {
204
- const q = u[$];
205
- F = R(F, $, q);
206
- }), F;
207
- }, [h, y, u]), V = !i.isVisible || i.isVisible(S, d), C = f || i.readonly, _ = typeof i.disabled == "function" ? i.disabled(S, d) : i.disabled, O = (ae = i.warning) == null ? void 0 : ae.schema, ee = B(() => {
208
- var ue, ce;
209
- if (!V || typeof O > "u") return;
210
- const F = typeof O == "function" ? O(S, d) : O, { success: $, error: q } = F.safeParse(E), oe = (ce = (ue = q == null ? void 0 : q.errors) == null ? void 0 : ue[0]) == null ? void 0 : ce.message;
211
- return !$ && oe ? oe : void 0;
212
- }, [i.path, E, O, V, d]), re = B(
198
+ var We, Je, He, Ye, Ge;
199
+ const u = tr(), { formState: c } = u, { fixedValues: d = {} } = {}, { metadata: y, readonly: h, inputErrorHandler: v } = hr(), S = t == null ? void 0 : t.getComponent(i.inputType), w = !!(i.isVisible || typeof i.disabled == "function" || typeof ((We = i.validation) == null ? void 0 : We.schema) == "function" || typeof ((Je = i.warning) == null ? void 0 : Je.schema) == "function"), R = !!((He = i.warning) != null && He.schema || (Ye = i.validation) != null && Ye.schema), T = w ? u.watch() : {}, V = R ? w ? rr(T, i.path) : u.watch(i.path) : void 0, Z = ge(() => {
200
+ if (!w) return {};
201
+ let ae = T;
202
+ return d && Object.keys(d).forEach((pe) => {
203
+ const ie = d[pe];
204
+ ae = M(ae, pe, ie);
205
+ }), ae;
206
+ }, [w, T, d]), H = !i.isVisible || i.isVisible(Z, y), j = h || i.readonly, $ = typeof i.disabled == "function" ? i.disabled(Z, y) : i.disabled, I = (Ge = i.warning) == null ? void 0 : Ge.schema, Be = ge(() => {
207
+ var Xe, Ke;
208
+ if (!H || typeof I > "u") return;
209
+ const ae = typeof I == "function" ? I(Z, y) : I, { success: pe, error: ie } = ae.safeParse(V), Qe = (Ke = (Xe = ie == null ? void 0 : ie.errors) == null ? void 0 : Xe[0]) == null ? void 0 : Ke.message;
210
+ return !pe && Qe ? Qe : void 0;
211
+ }, [i.path, V, I, H, y]), Ue = ge(
213
212
  () => ({
214
213
  path: e,
215
214
  key: e,
216
215
  initialValues: s,
217
216
  onUpdate: n,
218
- onChange: o,
217
+ onChange: a,
219
218
  factory: t,
220
- readonly: C,
219
+ readonly: j,
221
220
  input: i,
222
- disabled: _,
223
- warning: ee
221
+ disabled: $,
222
+ warning: Be
224
223
  }),
225
- [t, s, i, o, n, e, C, l.errors, _, ee]
226
- ), Ve = B(() => V ? /* @__PURE__ */ g.jsxs(g.Fragment, { children: [
224
+ [t, s, i, a, n, e, j, c.errors, $, Be]
225
+ ), Ft = ge(() => H ? /* @__PURE__ */ O.jsxs(O.Fragment, { children: [
227
226
  i.before ? i.before : null,
228
- /* @__PURE__ */ g.jsx(sr, { path: e, inputType: i.inputType, inputErrorHandler: m, children: b == null ? void 0 : b.renderComponent(re) }),
227
+ /* @__PURE__ */ O.jsx(mr, { path: e, inputType: i.inputType, inputErrorHandler: v, children: S == null ? void 0 : S.renderComponent(Ue) }),
229
228
  i.after ? i.after : null
230
- ] }) : null, [V, i.before, i.inputType, i.after, e, b, re, l.errors]);
231
- return b ? /* @__PURE__ */ g.jsx(me, { withoutWrapper: a, children: Ve }) : /* @__PURE__ */ g.jsx(me, { withoutWrapper: a, children: /* @__PURE__ */ g.jsxs("p", { children: [
229
+ ] }) : null, [H, i.before, i.inputType, i.after, e, S, Ue, c.errors]);
230
+ return S ? /* @__PURE__ */ O.jsx(nt, { withoutWrapper: o, children: Ft }) : /* @__PURE__ */ O.jsx(nt, { withoutWrapper: o, children: /* @__PURE__ */ O.jsxs("p", { children: [
232
231
  "Input component not found (internal type: ",
233
232
  i.inputType,
234
233
  ")"
235
234
  ] }) });
236
235
  });
237
- class Ir {
236
+ class fn {
238
237
  getType() {
239
238
  return this.internalType;
240
239
  }
241
240
  }
242
- function pe() {
241
+ function st() {
243
242
  return typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback : function(r, e) {
244
243
  const t = Date.now(), n = (e == null ? void 0 : e.timeout) || 1;
245
244
  return setTimeout(function() {
@@ -252,40 +251,40 @@ function pe() {
252
251
  }, n);
253
252
  };
254
253
  }
255
- function he() {
254
+ function at() {
256
255
  return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
257
256
  }
258
- function wr(r) {
257
+ function hn(r) {
259
258
  const {
260
259
  mode: e = "onSubmit",
261
260
  resolver: t,
262
261
  defaultValues: n,
263
- shouldFocusError: o,
262
+ shouldFocusError: a,
264
263
  // validateAfterFirstSubmit,
265
264
  onValuesChange: s,
266
265
  onValidationChange: i,
267
- onSubmit: a,
268
- onInputRenderError: c,
266
+ onSubmit: o,
267
+ onInputRenderError: u,
269
268
  // validate,
270
269
  // validateDebounceInterval,
271
270
  // validationConfig,
272
- metadata: l,
273
- children: u,
271
+ metadata: c,
272
+ children: d,
274
273
  // fixedValues
275
- autoFocusPath: d,
276
- readonly: f
277
- } = r, m = He({
274
+ autoFocusPath: y,
275
+ readonly: h
276
+ } = r, v = nr({
278
277
  mode: e,
279
278
  reValidateMode: "onChange",
280
279
  defaultValues: n,
281
- shouldFocusError: o,
280
+ shouldFocusError: a,
282
281
  resolver: t
283
- }), b = P(!1), h = P(JSON.stringify(n ?? {}));
284
- j(() => {
285
- h.current = JSON.stringify(n ?? {}), m.reset(n, {});
286
- }, [m.reset, n]), j(() => {
287
- const C = pe(), _ = he(), O = C(() => {
288
- m.reset({}, {
282
+ }), S = G(!1), w = G(JSON.stringify(n ?? {}));
283
+ Y(() => {
284
+ w.current = JSON.stringify(n ?? {}), v.reset(n, {});
285
+ }, [v.reset, n]), Y(() => {
286
+ const j = st(), $ = at(), I = j(() => {
287
+ v.reset({}, {
289
288
  keepErrors: !0,
290
289
  keepDirty: !0,
291
290
  keepDirtyValues: !0,
@@ -298,80 +297,2684 @@ function wr(r) {
298
297
  keepSubmitCount: !0
299
298
  });
300
299
  });
301
- return () => _(O);
300
+ return () => $(I);
302
301
  }, []);
303
- const { handleSubmit: v } = m, y = P(s);
304
- j(() => {
305
- y.current = s;
302
+ const { handleSubmit: R } = v, T = G(s);
303
+ Y(() => {
304
+ T.current = s;
306
305
  }, [s]);
307
- const E = P(i);
308
- j(() => {
309
- E.current = i;
306
+ const V = G(i);
307
+ Y(() => {
308
+ V.current = i;
310
309
  }, [i]);
311
- const S = P(!1);
312
- j(() => {
313
- const C = m.watch((_) => {
314
- var O;
315
- S.current || JSON.stringify(_ ?? {}) !== h.current && ((O = y.current) == null || O.call(y, { ..._ }), b.current === !0 && (S.current = !0, m.trigger().finally(() => {
316
- S.current = !1;
310
+ const Z = G(!1);
311
+ Y(() => {
312
+ const j = v.watch(($) => {
313
+ var I;
314
+ Z.current || JSON.stringify($ ?? {}) !== w.current && ((I = T.current) == null || I.call(T, { ...$ }), S.current === !0 && (Z.current = !0, v.trigger().finally(() => {
315
+ Z.current = !1;
317
316
  })));
318
317
  });
319
318
  return () => {
320
- C.unsubscribe();
319
+ j.unsubscribe();
321
320
  };
322
- }, [m]);
323
- const V = P(!0);
324
- return j(() => {
325
- var C;
326
- if (V.current) {
327
- V.current = !1;
321
+ }, [v]);
322
+ const H = G(!0);
323
+ return Y(() => {
324
+ var j;
325
+ if (H.current) {
326
+ H.current = !1;
328
327
  return;
329
328
  }
330
- (C = E.current) == null || C.call(E, { isValid: m.formState.isValid, isSubmitted: m.formState.isSubmitted });
331
- }, [m.formState.isValid, m.formState.isSubmitted]), j(() => {
332
- if (d) {
333
- const C = pe(), _ = he(), O = C(() => {
334
- m.setFocus(d);
329
+ (j = V.current) == null || j.call(V, { isValid: v.formState.isValid, isSubmitted: v.formState.isSubmitted });
330
+ }, [v.formState.isValid, v.formState.isSubmitted]), Y(() => {
331
+ if (y) {
332
+ const j = st(), $ = at(), I = j(() => {
333
+ v.setFocus(y);
335
334
  });
336
- return () => _(O);
335
+ return () => $(I);
337
336
  }
338
- }, [m, d]), /* @__PURE__ */ g.jsx(tr, { metadata: l, readonly: f, inputErrorHandler: c, children: /* @__PURE__ */ g.jsx(Ge, { ...m, children: typeof u == "function" ? u({
339
- ...m,
337
+ }, [v, y]), /* @__PURE__ */ O.jsx(fr, { metadata: c, readonly: h, inputErrorHandler: u, children: /* @__PURE__ */ O.jsx(sr, { ...v, children: typeof d == "function" ? d({
338
+ ...v,
340
339
  submitForm: async () => {
341
- a && (b.current = !0, v((C) => {
342
- a(C);
340
+ o && (S.current = !0, R((j) => {
341
+ o(j);
343
342
  })());
344
343
  }
345
- }) : u }) });
344
+ }) : d }) });
346
345
  }
347
- const Vr = (r) => {
346
+ const mn = (r) => {
348
347
  const e = {}, t = (n) => {
349
- n.forEach((o) => {
350
- const { path: s, default: i, inputs: a } = o;
351
- Array.isArray(a) ? t(a) : T(e, s) === void 0 && R(e, s, i);
348
+ n.forEach((a) => {
349
+ const { path: s, default: i, inputs: o } = a;
350
+ Array.isArray(o) ? t(o) : E(e, s) === void 0 && M(e, s, i);
352
351
  });
353
352
  };
354
353
  return Array.isArray(r.inputs) && t(r.inputs), e;
355
354
  };
356
- function jr(r, e) {
355
+ function pn(r, e) {
357
356
  const t = r.inputs.map((n) => {
358
- const o = ar(e, n.path);
359
- return o || n;
357
+ const a = yr(e, n.path);
358
+ return a || n;
360
359
  });
361
360
  return { ...r, inputs: t };
362
361
  }
363
- function ar(r, e) {
362
+ function yr(r, e) {
364
363
  return r.inputs.find((t) => t.path === e);
365
364
  }
366
- const Ee = "__temp_", Pr = (r) => Ee + r.split(".").join("__");
367
- function or(r) {
365
+ const Rt = "__temp_", yn = (r) => Rt + r.split(".").join("__");
366
+ function gr(r) {
368
367
  const e = { ...r };
369
- return ge(e, (t, n) => {
370
- n.startsWith(Ee) && delete e[n];
368
+ return kt(e, (t, n) => {
369
+ n.startsWith(Rt) && delete e[n];
371
370
  }), e;
372
371
  }
373
- const ur = "Required field";
374
- function k(r) {
372
+ var k;
373
+ (function(r) {
374
+ r.assertEqual = (a) => {
375
+ };
376
+ function e(a) {
377
+ }
378
+ r.assertIs = e;
379
+ function t(a) {
380
+ throw new Error();
381
+ }
382
+ r.assertNever = t, r.arrayToEnum = (a) => {
383
+ const s = {};
384
+ for (const i of a)
385
+ s[i] = i;
386
+ return s;
387
+ }, r.getValidEnumValues = (a) => {
388
+ const s = r.objectKeys(a).filter((o) => typeof a[a[o]] != "number"), i = {};
389
+ for (const o of s)
390
+ i[o] = a[o];
391
+ return r.objectValues(i);
392
+ }, r.objectValues = (a) => r.objectKeys(a).map(function(s) {
393
+ return a[s];
394
+ }), r.objectKeys = typeof Object.keys == "function" ? (a) => Object.keys(a) : (a) => {
395
+ const s = [];
396
+ for (const i in a)
397
+ Object.prototype.hasOwnProperty.call(a, i) && s.push(i);
398
+ return s;
399
+ }, r.find = (a, s) => {
400
+ for (const i of a)
401
+ if (s(i))
402
+ return i;
403
+ }, r.isInteger = typeof Number.isInteger == "function" ? (a) => Number.isInteger(a) : (a) => typeof a == "number" && Number.isFinite(a) && Math.floor(a) === a;
404
+ function n(a, s = " | ") {
405
+ return a.map((i) => typeof i == "string" ? `'${i}'` : i).join(s);
406
+ }
407
+ r.joinValues = n, r.jsonStringifyReplacer = (a, s) => typeof s == "bigint" ? s.toString() : s;
408
+ })(k || (k = {}));
409
+ var it;
410
+ (function(r) {
411
+ r.mergeShapes = (e, t) => ({
412
+ ...e,
413
+ ...t
414
+ // second overwrites first
415
+ });
416
+ })(it || (it = {}));
417
+ const m = k.arrayToEnum([
418
+ "string",
419
+ "nan",
420
+ "number",
421
+ "integer",
422
+ "float",
423
+ "boolean",
424
+ "date",
425
+ "bigint",
426
+ "symbol",
427
+ "function",
428
+ "undefined",
429
+ "null",
430
+ "array",
431
+ "object",
432
+ "unknown",
433
+ "promise",
434
+ "void",
435
+ "never",
436
+ "map",
437
+ "set"
438
+ ]), L = (r) => {
439
+ switch (typeof r) {
440
+ case "undefined":
441
+ return m.undefined;
442
+ case "string":
443
+ return m.string;
444
+ case "number":
445
+ return Number.isNaN(r) ? m.nan : m.number;
446
+ case "boolean":
447
+ return m.boolean;
448
+ case "function":
449
+ return m.function;
450
+ case "bigint":
451
+ return m.bigint;
452
+ case "symbol":
453
+ return m.symbol;
454
+ case "object":
455
+ return Array.isArray(r) ? m.array : r === null ? m.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? m.promise : typeof Map < "u" && r instanceof Map ? m.map : typeof Set < "u" && r instanceof Set ? m.set : typeof Date < "u" && r instanceof Date ? m.date : m.object;
456
+ default:
457
+ return m.unknown;
458
+ }
459
+ }, l = k.arrayToEnum([
460
+ "invalid_type",
461
+ "invalid_literal",
462
+ "custom",
463
+ "invalid_union",
464
+ "invalid_union_discriminator",
465
+ "invalid_enum_value",
466
+ "unrecognized_keys",
467
+ "invalid_arguments",
468
+ "invalid_return_type",
469
+ "invalid_date",
470
+ "invalid_string",
471
+ "too_small",
472
+ "too_big",
473
+ "invalid_intersection_types",
474
+ "not_multiple_of",
475
+ "not_finite"
476
+ ]);
477
+ class F extends Error {
478
+ get errors() {
479
+ return this.issues;
480
+ }
481
+ constructor(e) {
482
+ super(), this.issues = [], this.addIssue = (n) => {
483
+ this.issues = [...this.issues, n];
484
+ }, this.addIssues = (n = []) => {
485
+ this.issues = [...this.issues, ...n];
486
+ };
487
+ const t = new.target.prototype;
488
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
489
+ }
490
+ format(e) {
491
+ const t = e || function(s) {
492
+ return s.message;
493
+ }, n = { _errors: [] }, a = (s) => {
494
+ for (const i of s.issues)
495
+ if (i.code === "invalid_union")
496
+ i.unionErrors.map(a);
497
+ else if (i.code === "invalid_return_type")
498
+ a(i.returnTypeError);
499
+ else if (i.code === "invalid_arguments")
500
+ a(i.argumentsError);
501
+ else if (i.path.length === 0)
502
+ n._errors.push(t(i));
503
+ else {
504
+ let o = n, u = 0;
505
+ for (; u < i.path.length; ) {
506
+ const c = i.path[u];
507
+ u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
508
+ }
509
+ }
510
+ };
511
+ return a(this), n;
512
+ }
513
+ static assert(e) {
514
+ if (!(e instanceof F))
515
+ throw new Error(`Not a ZodError: ${e}`);
516
+ }
517
+ toString() {
518
+ return this.message;
519
+ }
520
+ get message() {
521
+ return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
522
+ }
523
+ get isEmpty() {
524
+ return this.issues.length === 0;
525
+ }
526
+ flatten(e = (t) => t.message) {
527
+ const t = /* @__PURE__ */ Object.create(null), n = [];
528
+ for (const a of this.issues)
529
+ if (a.path.length > 0) {
530
+ const s = a.path[0];
531
+ t[s] = t[s] || [], t[s].push(e(a));
532
+ } else
533
+ n.push(e(a));
534
+ return { formErrors: n, fieldErrors: t };
535
+ }
536
+ get formErrors() {
537
+ return this.flatten();
538
+ }
539
+ }
540
+ F.create = (r) => new F(r);
541
+ const Ie = (r, e) => {
542
+ let t;
543
+ switch (r.code) {
544
+ case l.invalid_type:
545
+ r.received === m.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
546
+ break;
547
+ case l.invalid_literal:
548
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, k.jsonStringifyReplacer)}`;
549
+ break;
550
+ case l.unrecognized_keys:
551
+ t = `Unrecognized key(s) in object: ${k.joinValues(r.keys, ", ")}`;
552
+ break;
553
+ case l.invalid_union:
554
+ t = "Invalid input";
555
+ break;
556
+ case l.invalid_union_discriminator:
557
+ t = `Invalid discriminator value. Expected ${k.joinValues(r.options)}`;
558
+ break;
559
+ case l.invalid_enum_value:
560
+ t = `Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;
561
+ break;
562
+ case l.invalid_arguments:
563
+ t = "Invalid function arguments";
564
+ break;
565
+ case l.invalid_return_type:
566
+ t = "Invalid function return type";
567
+ break;
568
+ case l.invalid_date:
569
+ t = "Invalid date";
570
+ break;
571
+ case l.invalid_string:
572
+ typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : k.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
573
+ break;
574
+ case l.too_small:
575
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "bigint" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
576
+ break;
577
+ case l.too_big:
578
+ r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
579
+ break;
580
+ case l.custom:
581
+ t = "Invalid input";
582
+ break;
583
+ case l.invalid_intersection_types:
584
+ t = "Intersection results could not be merged";
585
+ break;
586
+ case l.not_multiple_of:
587
+ t = `Number must be a multiple of ${r.multipleOf}`;
588
+ break;
589
+ case l.not_finite:
590
+ t = "Number must be finite";
591
+ break;
592
+ default:
593
+ t = e.defaultError, k.assertNever(r);
594
+ }
595
+ return { message: t };
596
+ };
597
+ let _r = Ie;
598
+ function vr() {
599
+ return _r;
600
+ }
601
+ const xr = (r) => {
602
+ const { data: e, path: t, errorMaps: n, issueData: a } = r, s = [...t, ...a.path || []], i = {
603
+ ...a,
604
+ path: s
605
+ };
606
+ if (a.message !== void 0)
607
+ return {
608
+ ...a,
609
+ path: s,
610
+ message: a.message
611
+ };
612
+ let o = "";
613
+ const u = n.filter((c) => !!c).slice().reverse();
614
+ for (const c of u)
615
+ o = c(i, { data: e, defaultError: o }).message;
616
+ return {
617
+ ...a,
618
+ path: s,
619
+ message: o
620
+ };
621
+ };
622
+ function f(r, e) {
623
+ const t = vr(), n = xr({
624
+ issueData: e,
625
+ data: r.data,
626
+ path: r.path,
627
+ errorMaps: [
628
+ r.common.contextualErrorMap,
629
+ // contextual error map is first priority
630
+ r.schemaErrorMap,
631
+ // then schema-bound map if available
632
+ t,
633
+ // then global override map
634
+ t === Ie ? void 0 : Ie
635
+ // then global default map
636
+ ].filter((a) => !!a)
637
+ });
638
+ r.common.issues.push(n);
639
+ }
640
+ class A {
641
+ constructor() {
642
+ this.value = "valid";
643
+ }
644
+ dirty() {
645
+ this.value === "valid" && (this.value = "dirty");
646
+ }
647
+ abort() {
648
+ this.value !== "aborted" && (this.value = "aborted");
649
+ }
650
+ static mergeArray(e, t) {
651
+ const n = [];
652
+ for (const a of t) {
653
+ if (a.status === "aborted")
654
+ return g;
655
+ a.status === "dirty" && e.dirty(), n.push(a.value);
656
+ }
657
+ return { status: e.value, value: n };
658
+ }
659
+ static async mergeObjectAsync(e, t) {
660
+ const n = [];
661
+ for (const a of t) {
662
+ const s = await a.key, i = await a.value;
663
+ n.push({
664
+ key: s,
665
+ value: i
666
+ });
667
+ }
668
+ return A.mergeObjectSync(e, n);
669
+ }
670
+ static mergeObjectSync(e, t) {
671
+ const n = {};
672
+ for (const a of t) {
673
+ const { key: s, value: i } = a;
674
+ if (s.status === "aborted" || i.status === "aborted")
675
+ return g;
676
+ s.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof i.value < "u" || a.alwaysSet) && (n[s.value] = i.value);
677
+ }
678
+ return { status: e.value, value: n };
679
+ }
680
+ }
681
+ const g = Object.freeze({
682
+ status: "aborted"
683
+ }), ue = (r) => ({ status: "dirty", value: r }), N = (r) => ({ status: "valid", value: r }), ot = (r) => r.status === "aborted", ut = (r) => r.status === "dirty", te = (r) => r.status === "valid", xe = (r) => typeof Promise < "u" && r instanceof Promise;
684
+ var p;
685
+ (function(r) {
686
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
687
+ })(p || (p = {}));
688
+ class U {
689
+ constructor(e, t, n, a) {
690
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = a;
691
+ }
692
+ get path() {
693
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
694
+ }
695
+ }
696
+ const ct = (r, e) => {
697
+ if (te(e))
698
+ return { success: !0, data: e.value };
699
+ if (!r.common.issues.length)
700
+ throw new Error("Validation failed but no issues detected.");
701
+ return {
702
+ success: !1,
703
+ get error() {
704
+ if (this._error)
705
+ return this._error;
706
+ const t = new F(r.common.issues);
707
+ return this._error = t, this._error;
708
+ }
709
+ };
710
+ };
711
+ function x(r) {
712
+ if (!r)
713
+ return {};
714
+ const { errorMap: e, invalid_type_error: t, required_error: n, description: a } = r;
715
+ if (e && (t || n))
716
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
717
+ return e ? { errorMap: e, description: a } : { errorMap: (i, o) => {
718
+ const { message: u } = r;
719
+ return i.code === "invalid_enum_value" ? { message: u ?? o.defaultError } : typeof o.data > "u" ? { message: u ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: u ?? t ?? o.defaultError };
720
+ }, description: a };
721
+ }
722
+ class b {
723
+ get description() {
724
+ return this._def.description;
725
+ }
726
+ _getType(e) {
727
+ return L(e.data);
728
+ }
729
+ _getOrReturnCtx(e, t) {
730
+ return t || {
731
+ common: e.parent.common,
732
+ data: e.data,
733
+ parsedType: L(e.data),
734
+ schemaErrorMap: this._def.errorMap,
735
+ path: e.path,
736
+ parent: e.parent
737
+ };
738
+ }
739
+ _processInputParams(e) {
740
+ return {
741
+ status: new A(),
742
+ ctx: {
743
+ common: e.parent.common,
744
+ data: e.data,
745
+ parsedType: L(e.data),
746
+ schemaErrorMap: this._def.errorMap,
747
+ path: e.path,
748
+ parent: e.parent
749
+ }
750
+ };
751
+ }
752
+ _parseSync(e) {
753
+ const t = this._parse(e);
754
+ if (xe(t))
755
+ throw new Error("Synchronous parse encountered promise.");
756
+ return t;
757
+ }
758
+ _parseAsync(e) {
759
+ const t = this._parse(e);
760
+ return Promise.resolve(t);
761
+ }
762
+ parse(e, t) {
763
+ const n = this.safeParse(e, t);
764
+ if (n.success)
765
+ return n.data;
766
+ throw n.error;
767
+ }
768
+ safeParse(e, t) {
769
+ const n = {
770
+ common: {
771
+ issues: [],
772
+ async: (t == null ? void 0 : t.async) ?? !1,
773
+ contextualErrorMap: t == null ? void 0 : t.errorMap
774
+ },
775
+ path: (t == null ? void 0 : t.path) || [],
776
+ schemaErrorMap: this._def.errorMap,
777
+ parent: null,
778
+ data: e,
779
+ parsedType: L(e)
780
+ }, a = this._parseSync({ data: e, path: n.path, parent: n });
781
+ return ct(n, a);
782
+ }
783
+ "~validate"(e) {
784
+ var n, a;
785
+ const t = {
786
+ common: {
787
+ issues: [],
788
+ async: !!this["~standard"].async
789
+ },
790
+ path: [],
791
+ schemaErrorMap: this._def.errorMap,
792
+ parent: null,
793
+ data: e,
794
+ parsedType: L(e)
795
+ };
796
+ if (!this["~standard"].async)
797
+ try {
798
+ const s = this._parseSync({ data: e, path: [], parent: t });
799
+ return te(s) ? {
800
+ value: s.value
801
+ } : {
802
+ issues: t.common.issues
803
+ };
804
+ } catch (s) {
805
+ (a = (n = s == null ? void 0 : s.message) == null ? void 0 : n.toLowerCase()) != null && a.includes("encountered") && (this["~standard"].async = !0), t.common = {
806
+ issues: [],
807
+ async: !0
808
+ };
809
+ }
810
+ return this._parseAsync({ data: e, path: [], parent: t }).then((s) => te(s) ? {
811
+ value: s.value
812
+ } : {
813
+ issues: t.common.issues
814
+ });
815
+ }
816
+ async parseAsync(e, t) {
817
+ const n = await this.safeParseAsync(e, t);
818
+ if (n.success)
819
+ return n.data;
820
+ throw n.error;
821
+ }
822
+ async safeParseAsync(e, t) {
823
+ const n = {
824
+ common: {
825
+ issues: [],
826
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
827
+ async: !0
828
+ },
829
+ path: (t == null ? void 0 : t.path) || [],
830
+ schemaErrorMap: this._def.errorMap,
831
+ parent: null,
832
+ data: e,
833
+ parsedType: L(e)
834
+ }, a = this._parse({ data: e, path: n.path, parent: n }), s = await (xe(a) ? a : Promise.resolve(a));
835
+ return ct(n, s);
836
+ }
837
+ refine(e, t) {
838
+ const n = (a) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(a) : t;
839
+ return this._refinement((a, s) => {
840
+ const i = e(a), o = () => s.addIssue({
841
+ code: l.custom,
842
+ ...n(a)
843
+ });
844
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
845
+ });
846
+ }
847
+ refinement(e, t) {
848
+ return this._refinement((n, a) => e(n) ? !0 : (a.addIssue(typeof t == "function" ? t(n, a) : t), !1));
849
+ }
850
+ _refinement(e) {
851
+ return new ne({
852
+ schema: this,
853
+ typeName: _.ZodEffects,
854
+ effect: { type: "refinement", refinement: e }
855
+ });
856
+ }
857
+ superRefine(e) {
858
+ return this._refinement(e);
859
+ }
860
+ constructor(e) {
861
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
862
+ version: 1,
863
+ vendor: "zod",
864
+ validate: (t) => this["~validate"](t)
865
+ };
866
+ }
867
+ optional() {
868
+ return z.create(this, this._def);
869
+ }
870
+ nullable() {
871
+ return se.create(this, this._def);
872
+ }
873
+ nullish() {
874
+ return this.nullable().optional();
875
+ }
876
+ array() {
877
+ return P.create(this);
878
+ }
879
+ promise() {
880
+ return Te.create(this, this._def);
881
+ }
882
+ or(e) {
883
+ return ke.create([this, e], this._def);
884
+ }
885
+ and(e) {
886
+ return we.create(this, e, this._def);
887
+ }
888
+ transform(e) {
889
+ return new ne({
890
+ ...x(this._def),
891
+ schema: this,
892
+ typeName: _.ZodEffects,
893
+ effect: { type: "transform", transform: e }
894
+ });
895
+ }
896
+ default(e) {
897
+ const t = typeof e == "function" ? e : () => e;
898
+ return new Ze({
899
+ ...x(this._def),
900
+ innerType: this,
901
+ defaultValue: t,
902
+ typeName: _.ZodDefault
903
+ });
904
+ }
905
+ brand() {
906
+ return new zr({
907
+ typeName: _.ZodBranded,
908
+ type: this,
909
+ ...x(this._def)
910
+ });
911
+ }
912
+ catch(e) {
913
+ const t = typeof e == "function" ? e : () => e;
914
+ return new Pe({
915
+ ...x(this._def),
916
+ innerType: this,
917
+ catchValue: t,
918
+ typeName: _.ZodCatch
919
+ });
920
+ }
921
+ describe(e) {
922
+ const t = this.constructor;
923
+ return new t({
924
+ ...this._def,
925
+ description: e
926
+ });
927
+ }
928
+ pipe(e) {
929
+ return Le.create(this, e);
930
+ }
931
+ readonly() {
932
+ return $e.create(this);
933
+ }
934
+ isOptional() {
935
+ return this.safeParse(void 0).success;
936
+ }
937
+ isNullable() {
938
+ return this.safeParse(null).success;
939
+ }
940
+ }
941
+ const br = /^c[^\s-]{8,}$/i, kr = /^[0-9a-z]+$/, wr = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Tr = /^[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, Cr = /^[a-z0-9_-]{21}$/i, Or = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Sr = /^[-+]?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)?)??$/, Rr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Er = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
942
+ let Ee;
943
+ const jr = /^(?:(?: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])$/, Ar = /^(?:(?: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])$/, Ir = /^(([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]))$/, Nr = /^(([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])$/, Vr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zr = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Et = "((\\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])))", Pr = new RegExp(`^${Et}$`);
944
+ function jt(r) {
945
+ let e = "[0-5]\\d";
946
+ r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`);
947
+ const t = r.precision ? "+" : "?";
948
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
949
+ }
950
+ function $r(r) {
951
+ return new RegExp(`^${jt(r)}$`);
952
+ }
953
+ function Mr(r) {
954
+ let e = `${Et}T${jt(r)}`;
955
+ const t = [];
956
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
957
+ }
958
+ function Fr(r, e) {
959
+ return !!((e === "v4" || !e) && jr.test(r) || (e === "v6" || !e) && Ir.test(r));
960
+ }
961
+ function Dr(r, e) {
962
+ if (!Or.test(r))
963
+ return !1;
964
+ try {
965
+ const [t] = r.split(".");
966
+ if (!t)
967
+ return !1;
968
+ const n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), a = JSON.parse(atob(n));
969
+ return !(typeof a != "object" || a === null || "typ" in a && (a == null ? void 0 : a.typ) !== "JWT" || !a.alg || e && a.alg !== e);
970
+ } catch {
971
+ return !1;
972
+ }
973
+ }
974
+ function Lr(r, e) {
975
+ return !!((e === "v4" || !e) && Ar.test(r) || (e === "v6" || !e) && Nr.test(r));
976
+ }
977
+ class q extends b {
978
+ _parse(e) {
979
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== m.string) {
980
+ const s = this._getOrReturnCtx(e);
981
+ return f(s, {
982
+ code: l.invalid_type,
983
+ expected: m.string,
984
+ received: s.parsedType
985
+ }), g;
986
+ }
987
+ const n = new A();
988
+ let a;
989
+ for (const s of this._def.checks)
990
+ if (s.kind === "min")
991
+ e.data.length < s.value && (a = this._getOrReturnCtx(e, a), f(a, {
992
+ code: l.too_small,
993
+ minimum: s.value,
994
+ type: "string",
995
+ inclusive: !0,
996
+ exact: !1,
997
+ message: s.message
998
+ }), n.dirty());
999
+ else if (s.kind === "max")
1000
+ e.data.length > s.value && (a = this._getOrReturnCtx(e, a), f(a, {
1001
+ code: l.too_big,
1002
+ maximum: s.value,
1003
+ type: "string",
1004
+ inclusive: !0,
1005
+ exact: !1,
1006
+ message: s.message
1007
+ }), n.dirty());
1008
+ else if (s.kind === "length") {
1009
+ const i = e.data.length > s.value, o = e.data.length < s.value;
1010
+ (i || o) && (a = this._getOrReturnCtx(e, a), i ? f(a, {
1011
+ code: l.too_big,
1012
+ maximum: s.value,
1013
+ type: "string",
1014
+ inclusive: !0,
1015
+ exact: !0,
1016
+ message: s.message
1017
+ }) : o && f(a, {
1018
+ code: l.too_small,
1019
+ minimum: s.value,
1020
+ type: "string",
1021
+ inclusive: !0,
1022
+ exact: !0,
1023
+ message: s.message
1024
+ }), n.dirty());
1025
+ } else if (s.kind === "email")
1026
+ Rr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1027
+ validation: "email",
1028
+ code: l.invalid_string,
1029
+ message: s.message
1030
+ }), n.dirty());
1031
+ else if (s.kind === "emoji")
1032
+ Ee || (Ee = new RegExp(Er, "u")), Ee.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1033
+ validation: "emoji",
1034
+ code: l.invalid_string,
1035
+ message: s.message
1036
+ }), n.dirty());
1037
+ else if (s.kind === "uuid")
1038
+ Tr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1039
+ validation: "uuid",
1040
+ code: l.invalid_string,
1041
+ message: s.message
1042
+ }), n.dirty());
1043
+ else if (s.kind === "nanoid")
1044
+ Cr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1045
+ validation: "nanoid",
1046
+ code: l.invalid_string,
1047
+ message: s.message
1048
+ }), n.dirty());
1049
+ else if (s.kind === "cuid")
1050
+ br.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1051
+ validation: "cuid",
1052
+ code: l.invalid_string,
1053
+ message: s.message
1054
+ }), n.dirty());
1055
+ else if (s.kind === "cuid2")
1056
+ kr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1057
+ validation: "cuid2",
1058
+ code: l.invalid_string,
1059
+ message: s.message
1060
+ }), n.dirty());
1061
+ else if (s.kind === "ulid")
1062
+ wr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1063
+ validation: "ulid",
1064
+ code: l.invalid_string,
1065
+ message: s.message
1066
+ }), n.dirty());
1067
+ else if (s.kind === "url")
1068
+ try {
1069
+ new URL(e.data);
1070
+ } catch {
1071
+ a = this._getOrReturnCtx(e, a), f(a, {
1072
+ validation: "url",
1073
+ code: l.invalid_string,
1074
+ message: s.message
1075
+ }), n.dirty();
1076
+ }
1077
+ else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1078
+ validation: "regex",
1079
+ code: l.invalid_string,
1080
+ message: s.message
1081
+ }), n.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (a = this._getOrReturnCtx(e, a), f(a, {
1082
+ code: l.invalid_string,
1083
+ validation: { includes: s.value, position: s.position },
1084
+ message: s.message
1085
+ }), n.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (a = this._getOrReturnCtx(e, a), f(a, {
1086
+ code: l.invalid_string,
1087
+ validation: { startsWith: s.value },
1088
+ message: s.message
1089
+ }), n.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (a = this._getOrReturnCtx(e, a), f(a, {
1090
+ code: l.invalid_string,
1091
+ validation: { endsWith: s.value },
1092
+ message: s.message
1093
+ }), n.dirty()) : s.kind === "datetime" ? Mr(s).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1094
+ code: l.invalid_string,
1095
+ validation: "datetime",
1096
+ message: s.message
1097
+ }), n.dirty()) : s.kind === "date" ? Pr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1098
+ code: l.invalid_string,
1099
+ validation: "date",
1100
+ message: s.message
1101
+ }), n.dirty()) : s.kind === "time" ? $r(s).test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1102
+ code: l.invalid_string,
1103
+ validation: "time",
1104
+ message: s.message
1105
+ }), n.dirty()) : s.kind === "duration" ? Sr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1106
+ validation: "duration",
1107
+ code: l.invalid_string,
1108
+ message: s.message
1109
+ }), n.dirty()) : s.kind === "ip" ? Fr(e.data, s.version) || (a = this._getOrReturnCtx(e, a), f(a, {
1110
+ validation: "ip",
1111
+ code: l.invalid_string,
1112
+ message: s.message
1113
+ }), n.dirty()) : s.kind === "jwt" ? Dr(e.data, s.alg) || (a = this._getOrReturnCtx(e, a), f(a, {
1114
+ validation: "jwt",
1115
+ code: l.invalid_string,
1116
+ message: s.message
1117
+ }), n.dirty()) : s.kind === "cidr" ? Lr(e.data, s.version) || (a = this._getOrReturnCtx(e, a), f(a, {
1118
+ validation: "cidr",
1119
+ code: l.invalid_string,
1120
+ message: s.message
1121
+ }), n.dirty()) : s.kind === "base64" ? Vr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1122
+ validation: "base64",
1123
+ code: l.invalid_string,
1124
+ message: s.message
1125
+ }), n.dirty()) : s.kind === "base64url" ? Zr.test(e.data) || (a = this._getOrReturnCtx(e, a), f(a, {
1126
+ validation: "base64url",
1127
+ code: l.invalid_string,
1128
+ message: s.message
1129
+ }), n.dirty()) : k.assertNever(s);
1130
+ return { status: n.value, value: e.data };
1131
+ }
1132
+ _regex(e, t, n) {
1133
+ return this.refinement((a) => e.test(a), {
1134
+ validation: t,
1135
+ code: l.invalid_string,
1136
+ ...p.errToObj(n)
1137
+ });
1138
+ }
1139
+ _addCheck(e) {
1140
+ return new q({
1141
+ ...this._def,
1142
+ checks: [...this._def.checks, e]
1143
+ });
1144
+ }
1145
+ email(e) {
1146
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
1147
+ }
1148
+ url(e) {
1149
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
1150
+ }
1151
+ emoji(e) {
1152
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
1153
+ }
1154
+ uuid(e) {
1155
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
1156
+ }
1157
+ nanoid(e) {
1158
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
1159
+ }
1160
+ cuid(e) {
1161
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
1162
+ }
1163
+ cuid2(e) {
1164
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
1165
+ }
1166
+ ulid(e) {
1167
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
1168
+ }
1169
+ base64(e) {
1170
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
1171
+ }
1172
+ base64url(e) {
1173
+ return this._addCheck({
1174
+ kind: "base64url",
1175
+ ...p.errToObj(e)
1176
+ });
1177
+ }
1178
+ jwt(e) {
1179
+ return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
1180
+ }
1181
+ ip(e) {
1182
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
1183
+ }
1184
+ cidr(e) {
1185
+ return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
1186
+ }
1187
+ datetime(e) {
1188
+ return typeof e == "string" ? this._addCheck({
1189
+ kind: "datetime",
1190
+ precision: null,
1191
+ offset: !1,
1192
+ local: !1,
1193
+ message: e
1194
+ }) : this._addCheck({
1195
+ kind: "datetime",
1196
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1197
+ offset: (e == null ? void 0 : e.offset) ?? !1,
1198
+ local: (e == null ? void 0 : e.local) ?? !1,
1199
+ ...p.errToObj(e == null ? void 0 : e.message)
1200
+ });
1201
+ }
1202
+ date(e) {
1203
+ return this._addCheck({ kind: "date", message: e });
1204
+ }
1205
+ time(e) {
1206
+ return typeof e == "string" ? this._addCheck({
1207
+ kind: "time",
1208
+ precision: null,
1209
+ message: e
1210
+ }) : this._addCheck({
1211
+ kind: "time",
1212
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
1213
+ ...p.errToObj(e == null ? void 0 : e.message)
1214
+ });
1215
+ }
1216
+ duration(e) {
1217
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
1218
+ }
1219
+ regex(e, t) {
1220
+ return this._addCheck({
1221
+ kind: "regex",
1222
+ regex: e,
1223
+ ...p.errToObj(t)
1224
+ });
1225
+ }
1226
+ includes(e, t) {
1227
+ return this._addCheck({
1228
+ kind: "includes",
1229
+ value: e,
1230
+ position: t == null ? void 0 : t.position,
1231
+ ...p.errToObj(t == null ? void 0 : t.message)
1232
+ });
1233
+ }
1234
+ startsWith(e, t) {
1235
+ return this._addCheck({
1236
+ kind: "startsWith",
1237
+ value: e,
1238
+ ...p.errToObj(t)
1239
+ });
1240
+ }
1241
+ endsWith(e, t) {
1242
+ return this._addCheck({
1243
+ kind: "endsWith",
1244
+ value: e,
1245
+ ...p.errToObj(t)
1246
+ });
1247
+ }
1248
+ min(e, t) {
1249
+ return this._addCheck({
1250
+ kind: "min",
1251
+ value: e,
1252
+ ...p.errToObj(t)
1253
+ });
1254
+ }
1255
+ max(e, t) {
1256
+ return this._addCheck({
1257
+ kind: "max",
1258
+ value: e,
1259
+ ...p.errToObj(t)
1260
+ });
1261
+ }
1262
+ length(e, t) {
1263
+ return this._addCheck({
1264
+ kind: "length",
1265
+ value: e,
1266
+ ...p.errToObj(t)
1267
+ });
1268
+ }
1269
+ /**
1270
+ * Equivalent to `.min(1)`
1271
+ */
1272
+ nonempty(e) {
1273
+ return this.min(1, p.errToObj(e));
1274
+ }
1275
+ trim() {
1276
+ return new q({
1277
+ ...this._def,
1278
+ checks: [...this._def.checks, { kind: "trim" }]
1279
+ });
1280
+ }
1281
+ toLowerCase() {
1282
+ return new q({
1283
+ ...this._def,
1284
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1285
+ });
1286
+ }
1287
+ toUpperCase() {
1288
+ return new q({
1289
+ ...this._def,
1290
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1291
+ });
1292
+ }
1293
+ get isDatetime() {
1294
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1295
+ }
1296
+ get isDate() {
1297
+ return !!this._def.checks.find((e) => e.kind === "date");
1298
+ }
1299
+ get isTime() {
1300
+ return !!this._def.checks.find((e) => e.kind === "time");
1301
+ }
1302
+ get isDuration() {
1303
+ return !!this._def.checks.find((e) => e.kind === "duration");
1304
+ }
1305
+ get isEmail() {
1306
+ return !!this._def.checks.find((e) => e.kind === "email");
1307
+ }
1308
+ get isURL() {
1309
+ return !!this._def.checks.find((e) => e.kind === "url");
1310
+ }
1311
+ get isEmoji() {
1312
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1313
+ }
1314
+ get isUUID() {
1315
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1316
+ }
1317
+ get isNANOID() {
1318
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1319
+ }
1320
+ get isCUID() {
1321
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1322
+ }
1323
+ get isCUID2() {
1324
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1325
+ }
1326
+ get isULID() {
1327
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1328
+ }
1329
+ get isIP() {
1330
+ return !!this._def.checks.find((e) => e.kind === "ip");
1331
+ }
1332
+ get isCIDR() {
1333
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1334
+ }
1335
+ get isBase64() {
1336
+ return !!this._def.checks.find((e) => e.kind === "base64");
1337
+ }
1338
+ get isBase64url() {
1339
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1340
+ }
1341
+ get minLength() {
1342
+ let e = null;
1343
+ for (const t of this._def.checks)
1344
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1345
+ return e;
1346
+ }
1347
+ get maxLength() {
1348
+ let e = null;
1349
+ for (const t of this._def.checks)
1350
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1351
+ return e;
1352
+ }
1353
+ }
1354
+ q.create = (r) => new q({
1355
+ checks: [],
1356
+ typeName: _.ZodString,
1357
+ coerce: (r == null ? void 0 : r.coerce) ?? !1,
1358
+ ...x(r)
1359
+ });
1360
+ function qr(r, e) {
1361
+ const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, a = t > n ? t : n, s = Number.parseInt(r.toFixed(a).replace(".", "")), i = Number.parseInt(e.toFixed(a).replace(".", ""));
1362
+ return s % i / 10 ** a;
1363
+ }
1364
+ class fe extends b {
1365
+ constructor() {
1366
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1367
+ }
1368
+ _parse(e) {
1369
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== m.number) {
1370
+ const s = this._getOrReturnCtx(e);
1371
+ return f(s, {
1372
+ code: l.invalid_type,
1373
+ expected: m.number,
1374
+ received: s.parsedType
1375
+ }), g;
1376
+ }
1377
+ let n;
1378
+ const a = new A();
1379
+ for (const s of this._def.checks)
1380
+ s.kind === "int" ? k.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
1381
+ code: l.invalid_type,
1382
+ expected: "integer",
1383
+ received: "float",
1384
+ message: s.message
1385
+ }), a.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1386
+ code: l.too_small,
1387
+ minimum: s.value,
1388
+ type: "number",
1389
+ inclusive: s.inclusive,
1390
+ exact: !1,
1391
+ message: s.message
1392
+ }), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1393
+ code: l.too_big,
1394
+ maximum: s.value,
1395
+ type: "number",
1396
+ inclusive: s.inclusive,
1397
+ exact: !1,
1398
+ message: s.message
1399
+ }), a.dirty()) : s.kind === "multipleOf" ? qr(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n), f(n, {
1400
+ code: l.not_multiple_of,
1401
+ multipleOf: s.value,
1402
+ message: s.message
1403
+ }), a.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
1404
+ code: l.not_finite,
1405
+ message: s.message
1406
+ }), a.dirty()) : k.assertNever(s);
1407
+ return { status: a.value, value: e.data };
1408
+ }
1409
+ gte(e, t) {
1410
+ return this.setLimit("min", e, !0, p.toString(t));
1411
+ }
1412
+ gt(e, t) {
1413
+ return this.setLimit("min", e, !1, p.toString(t));
1414
+ }
1415
+ lte(e, t) {
1416
+ return this.setLimit("max", e, !0, p.toString(t));
1417
+ }
1418
+ lt(e, t) {
1419
+ return this.setLimit("max", e, !1, p.toString(t));
1420
+ }
1421
+ setLimit(e, t, n, a) {
1422
+ return new fe({
1423
+ ...this._def,
1424
+ checks: [
1425
+ ...this._def.checks,
1426
+ {
1427
+ kind: e,
1428
+ value: t,
1429
+ inclusive: n,
1430
+ message: p.toString(a)
1431
+ }
1432
+ ]
1433
+ });
1434
+ }
1435
+ _addCheck(e) {
1436
+ return new fe({
1437
+ ...this._def,
1438
+ checks: [...this._def.checks, e]
1439
+ });
1440
+ }
1441
+ int(e) {
1442
+ return this._addCheck({
1443
+ kind: "int",
1444
+ message: p.toString(e)
1445
+ });
1446
+ }
1447
+ positive(e) {
1448
+ return this._addCheck({
1449
+ kind: "min",
1450
+ value: 0,
1451
+ inclusive: !1,
1452
+ message: p.toString(e)
1453
+ });
1454
+ }
1455
+ negative(e) {
1456
+ return this._addCheck({
1457
+ kind: "max",
1458
+ value: 0,
1459
+ inclusive: !1,
1460
+ message: p.toString(e)
1461
+ });
1462
+ }
1463
+ nonpositive(e) {
1464
+ return this._addCheck({
1465
+ kind: "max",
1466
+ value: 0,
1467
+ inclusive: !0,
1468
+ message: p.toString(e)
1469
+ });
1470
+ }
1471
+ nonnegative(e) {
1472
+ return this._addCheck({
1473
+ kind: "min",
1474
+ value: 0,
1475
+ inclusive: !0,
1476
+ message: p.toString(e)
1477
+ });
1478
+ }
1479
+ multipleOf(e, t) {
1480
+ return this._addCheck({
1481
+ kind: "multipleOf",
1482
+ value: e,
1483
+ message: p.toString(t)
1484
+ });
1485
+ }
1486
+ finite(e) {
1487
+ return this._addCheck({
1488
+ kind: "finite",
1489
+ message: p.toString(e)
1490
+ });
1491
+ }
1492
+ safe(e) {
1493
+ return this._addCheck({
1494
+ kind: "min",
1495
+ inclusive: !0,
1496
+ value: Number.MIN_SAFE_INTEGER,
1497
+ message: p.toString(e)
1498
+ })._addCheck({
1499
+ kind: "max",
1500
+ inclusive: !0,
1501
+ value: Number.MAX_SAFE_INTEGER,
1502
+ message: p.toString(e)
1503
+ });
1504
+ }
1505
+ get minValue() {
1506
+ let e = null;
1507
+ for (const t of this._def.checks)
1508
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1509
+ return e;
1510
+ }
1511
+ get maxValue() {
1512
+ let e = null;
1513
+ for (const t of this._def.checks)
1514
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1515
+ return e;
1516
+ }
1517
+ get isInt() {
1518
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
1519
+ }
1520
+ get isFinite() {
1521
+ let e = null, t = null;
1522
+ for (const n of this._def.checks) {
1523
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
1524
+ return !0;
1525
+ n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1526
+ }
1527
+ return Number.isFinite(t) && Number.isFinite(e);
1528
+ }
1529
+ }
1530
+ fe.create = (r) => new fe({
1531
+ checks: [],
1532
+ typeName: _.ZodNumber,
1533
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1534
+ ...x(r)
1535
+ });
1536
+ class he extends b {
1537
+ constructor() {
1538
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1539
+ }
1540
+ _parse(e) {
1541
+ if (this._def.coerce)
1542
+ try {
1543
+ e.data = BigInt(e.data);
1544
+ } catch {
1545
+ return this._getInvalidInput(e);
1546
+ }
1547
+ if (this._getType(e) !== m.bigint)
1548
+ return this._getInvalidInput(e);
1549
+ let n;
1550
+ const a = new A();
1551
+ for (const s of this._def.checks)
1552
+ s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1553
+ code: l.too_small,
1554
+ type: "bigint",
1555
+ minimum: s.value,
1556
+ inclusive: s.inclusive,
1557
+ message: s.message
1558
+ }), a.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), f(n, {
1559
+ code: l.too_big,
1560
+ type: "bigint",
1561
+ maximum: s.value,
1562
+ inclusive: s.inclusive,
1563
+ message: s.message
1564
+ }), a.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), f(n, {
1565
+ code: l.not_multiple_of,
1566
+ multipleOf: s.value,
1567
+ message: s.message
1568
+ }), a.dirty()) : k.assertNever(s);
1569
+ return { status: a.value, value: e.data };
1570
+ }
1571
+ _getInvalidInput(e) {
1572
+ const t = this._getOrReturnCtx(e);
1573
+ return f(t, {
1574
+ code: l.invalid_type,
1575
+ expected: m.bigint,
1576
+ received: t.parsedType
1577
+ }), g;
1578
+ }
1579
+ gte(e, t) {
1580
+ return this.setLimit("min", e, !0, p.toString(t));
1581
+ }
1582
+ gt(e, t) {
1583
+ return this.setLimit("min", e, !1, p.toString(t));
1584
+ }
1585
+ lte(e, t) {
1586
+ return this.setLimit("max", e, !0, p.toString(t));
1587
+ }
1588
+ lt(e, t) {
1589
+ return this.setLimit("max", e, !1, p.toString(t));
1590
+ }
1591
+ setLimit(e, t, n, a) {
1592
+ return new he({
1593
+ ...this._def,
1594
+ checks: [
1595
+ ...this._def.checks,
1596
+ {
1597
+ kind: e,
1598
+ value: t,
1599
+ inclusive: n,
1600
+ message: p.toString(a)
1601
+ }
1602
+ ]
1603
+ });
1604
+ }
1605
+ _addCheck(e) {
1606
+ return new he({
1607
+ ...this._def,
1608
+ checks: [...this._def.checks, e]
1609
+ });
1610
+ }
1611
+ positive(e) {
1612
+ return this._addCheck({
1613
+ kind: "min",
1614
+ value: BigInt(0),
1615
+ inclusive: !1,
1616
+ message: p.toString(e)
1617
+ });
1618
+ }
1619
+ negative(e) {
1620
+ return this._addCheck({
1621
+ kind: "max",
1622
+ value: BigInt(0),
1623
+ inclusive: !1,
1624
+ message: p.toString(e)
1625
+ });
1626
+ }
1627
+ nonpositive(e) {
1628
+ return this._addCheck({
1629
+ kind: "max",
1630
+ value: BigInt(0),
1631
+ inclusive: !0,
1632
+ message: p.toString(e)
1633
+ });
1634
+ }
1635
+ nonnegative(e) {
1636
+ return this._addCheck({
1637
+ kind: "min",
1638
+ value: BigInt(0),
1639
+ inclusive: !0,
1640
+ message: p.toString(e)
1641
+ });
1642
+ }
1643
+ multipleOf(e, t) {
1644
+ return this._addCheck({
1645
+ kind: "multipleOf",
1646
+ value: e,
1647
+ message: p.toString(t)
1648
+ });
1649
+ }
1650
+ get minValue() {
1651
+ let e = null;
1652
+ for (const t of this._def.checks)
1653
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1654
+ return e;
1655
+ }
1656
+ get maxValue() {
1657
+ let e = null;
1658
+ for (const t of this._def.checks)
1659
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1660
+ return e;
1661
+ }
1662
+ }
1663
+ he.create = (r) => new he({
1664
+ checks: [],
1665
+ typeName: _.ZodBigInt,
1666
+ coerce: (r == null ? void 0 : r.coerce) ?? !1,
1667
+ ...x(r)
1668
+ });
1669
+ class dt extends b {
1670
+ _parse(e) {
1671
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== m.boolean) {
1672
+ const n = this._getOrReturnCtx(e);
1673
+ return f(n, {
1674
+ code: l.invalid_type,
1675
+ expected: m.boolean,
1676
+ received: n.parsedType
1677
+ }), g;
1678
+ }
1679
+ return N(e.data);
1680
+ }
1681
+ }
1682
+ dt.create = (r) => new dt({
1683
+ typeName: _.ZodBoolean,
1684
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1685
+ ...x(r)
1686
+ });
1687
+ class be extends b {
1688
+ _parse(e) {
1689
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== m.date) {
1690
+ const s = this._getOrReturnCtx(e);
1691
+ return f(s, {
1692
+ code: l.invalid_type,
1693
+ expected: m.date,
1694
+ received: s.parsedType
1695
+ }), g;
1696
+ }
1697
+ if (Number.isNaN(e.data.getTime())) {
1698
+ const s = this._getOrReturnCtx(e);
1699
+ return f(s, {
1700
+ code: l.invalid_date
1701
+ }), g;
1702
+ }
1703
+ const n = new A();
1704
+ let a;
1705
+ for (const s of this._def.checks)
1706
+ s.kind === "min" ? e.data.getTime() < s.value && (a = this._getOrReturnCtx(e, a), f(a, {
1707
+ code: l.too_small,
1708
+ message: s.message,
1709
+ inclusive: !0,
1710
+ exact: !1,
1711
+ minimum: s.value,
1712
+ type: "date"
1713
+ }), n.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (a = this._getOrReturnCtx(e, a), f(a, {
1714
+ code: l.too_big,
1715
+ message: s.message,
1716
+ inclusive: !0,
1717
+ exact: !1,
1718
+ maximum: s.value,
1719
+ type: "date"
1720
+ }), n.dirty()) : k.assertNever(s);
1721
+ return {
1722
+ status: n.value,
1723
+ value: new Date(e.data.getTime())
1724
+ };
1725
+ }
1726
+ _addCheck(e) {
1727
+ return new be({
1728
+ ...this._def,
1729
+ checks: [...this._def.checks, e]
1730
+ });
1731
+ }
1732
+ min(e, t) {
1733
+ return this._addCheck({
1734
+ kind: "min",
1735
+ value: e.getTime(),
1736
+ message: p.toString(t)
1737
+ });
1738
+ }
1739
+ max(e, t) {
1740
+ return this._addCheck({
1741
+ kind: "max",
1742
+ value: e.getTime(),
1743
+ message: p.toString(t)
1744
+ });
1745
+ }
1746
+ get minDate() {
1747
+ let e = null;
1748
+ for (const t of this._def.checks)
1749
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1750
+ return e != null ? new Date(e) : null;
1751
+ }
1752
+ get maxDate() {
1753
+ let e = null;
1754
+ for (const t of this._def.checks)
1755
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1756
+ return e != null ? new Date(e) : null;
1757
+ }
1758
+ }
1759
+ be.create = (r) => new be({
1760
+ checks: [],
1761
+ coerce: (r == null ? void 0 : r.coerce) || !1,
1762
+ typeName: _.ZodDate,
1763
+ ...x(r)
1764
+ });
1765
+ class lt extends b {
1766
+ _parse(e) {
1767
+ if (this._getType(e) !== m.symbol) {
1768
+ const n = this._getOrReturnCtx(e);
1769
+ return f(n, {
1770
+ code: l.invalid_type,
1771
+ expected: m.symbol,
1772
+ received: n.parsedType
1773
+ }), g;
1774
+ }
1775
+ return N(e.data);
1776
+ }
1777
+ }
1778
+ lt.create = (r) => new lt({
1779
+ typeName: _.ZodSymbol,
1780
+ ...x(r)
1781
+ });
1782
+ class ft extends b {
1783
+ _parse(e) {
1784
+ if (this._getType(e) !== m.undefined) {
1785
+ const n = this._getOrReturnCtx(e);
1786
+ return f(n, {
1787
+ code: l.invalid_type,
1788
+ expected: m.undefined,
1789
+ received: n.parsedType
1790
+ }), g;
1791
+ }
1792
+ return N(e.data);
1793
+ }
1794
+ }
1795
+ ft.create = (r) => new ft({
1796
+ typeName: _.ZodUndefined,
1797
+ ...x(r)
1798
+ });
1799
+ class ht extends b {
1800
+ _parse(e) {
1801
+ if (this._getType(e) !== m.null) {
1802
+ const n = this._getOrReturnCtx(e);
1803
+ return f(n, {
1804
+ code: l.invalid_type,
1805
+ expected: m.null,
1806
+ received: n.parsedType
1807
+ }), g;
1808
+ }
1809
+ return N(e.data);
1810
+ }
1811
+ }
1812
+ ht.create = (r) => new ht({
1813
+ typeName: _.ZodNull,
1814
+ ...x(r)
1815
+ });
1816
+ class Ne extends b {
1817
+ constructor() {
1818
+ super(...arguments), this._any = !0;
1819
+ }
1820
+ _parse(e) {
1821
+ return N(e.data);
1822
+ }
1823
+ }
1824
+ Ne.create = (r) => new Ne({
1825
+ typeName: _.ZodAny,
1826
+ ...x(r)
1827
+ });
1828
+ class mt extends b {
1829
+ constructor() {
1830
+ super(...arguments), this._unknown = !0;
1831
+ }
1832
+ _parse(e) {
1833
+ return N(e.data);
1834
+ }
1835
+ }
1836
+ mt.create = (r) => new mt({
1837
+ typeName: _.ZodUnknown,
1838
+ ...x(r)
1839
+ });
1840
+ class W extends b {
1841
+ _parse(e) {
1842
+ const t = this._getOrReturnCtx(e);
1843
+ return f(t, {
1844
+ code: l.invalid_type,
1845
+ expected: m.never,
1846
+ received: t.parsedType
1847
+ }), g;
1848
+ }
1849
+ }
1850
+ W.create = (r) => new W({
1851
+ typeName: _.ZodNever,
1852
+ ...x(r)
1853
+ });
1854
+ class pt extends b {
1855
+ _parse(e) {
1856
+ if (this._getType(e) !== m.undefined) {
1857
+ const n = this._getOrReturnCtx(e);
1858
+ return f(n, {
1859
+ code: l.invalid_type,
1860
+ expected: m.void,
1861
+ received: n.parsedType
1862
+ }), g;
1863
+ }
1864
+ return N(e.data);
1865
+ }
1866
+ }
1867
+ pt.create = (r) => new pt({
1868
+ typeName: _.ZodVoid,
1869
+ ...x(r)
1870
+ });
1871
+ class P extends b {
1872
+ _parse(e) {
1873
+ const { ctx: t, status: n } = this._processInputParams(e), a = this._def;
1874
+ if (t.parsedType !== m.array)
1875
+ return f(t, {
1876
+ code: l.invalid_type,
1877
+ expected: m.array,
1878
+ received: t.parsedType
1879
+ }), g;
1880
+ if (a.exactLength !== null) {
1881
+ const i = t.data.length > a.exactLength.value, o = t.data.length < a.exactLength.value;
1882
+ (i || o) && (f(t, {
1883
+ code: i ? l.too_big : l.too_small,
1884
+ minimum: o ? a.exactLength.value : void 0,
1885
+ maximum: i ? a.exactLength.value : void 0,
1886
+ type: "array",
1887
+ inclusive: !0,
1888
+ exact: !0,
1889
+ message: a.exactLength.message
1890
+ }), n.dirty());
1891
+ }
1892
+ if (a.minLength !== null && t.data.length < a.minLength.value && (f(t, {
1893
+ code: l.too_small,
1894
+ minimum: a.minLength.value,
1895
+ type: "array",
1896
+ inclusive: !0,
1897
+ exact: !1,
1898
+ message: a.minLength.message
1899
+ }), n.dirty()), a.maxLength !== null && t.data.length > a.maxLength.value && (f(t, {
1900
+ code: l.too_big,
1901
+ maximum: a.maxLength.value,
1902
+ type: "array",
1903
+ inclusive: !0,
1904
+ exact: !1,
1905
+ message: a.maxLength.message
1906
+ }), n.dirty()), t.common.async)
1907
+ return Promise.all([...t.data].map((i, o) => a.type._parseAsync(new U(t, i, t.path, o)))).then((i) => A.mergeArray(n, i));
1908
+ const s = [...t.data].map((i, o) => a.type._parseSync(new U(t, i, t.path, o)));
1909
+ return A.mergeArray(n, s);
1910
+ }
1911
+ get element() {
1912
+ return this._def.type;
1913
+ }
1914
+ min(e, t) {
1915
+ return new P({
1916
+ ...this._def,
1917
+ minLength: { value: e, message: p.toString(t) }
1918
+ });
1919
+ }
1920
+ max(e, t) {
1921
+ return new P({
1922
+ ...this._def,
1923
+ maxLength: { value: e, message: p.toString(t) }
1924
+ });
1925
+ }
1926
+ length(e, t) {
1927
+ return new P({
1928
+ ...this._def,
1929
+ exactLength: { value: e, message: p.toString(t) }
1930
+ });
1931
+ }
1932
+ nonempty(e) {
1933
+ return this.min(1, e);
1934
+ }
1935
+ }
1936
+ P.create = (r, e) => new P({
1937
+ type: r,
1938
+ minLength: null,
1939
+ maxLength: null,
1940
+ exactLength: null,
1941
+ typeName: _.ZodArray,
1942
+ ...x(e)
1943
+ });
1944
+ function ee(r) {
1945
+ if (r instanceof C) {
1946
+ const e = {};
1947
+ for (const t in r.shape) {
1948
+ const n = r.shape[t];
1949
+ e[t] = z.create(ee(n));
1950
+ }
1951
+ return new C({
1952
+ ...r._def,
1953
+ shape: () => e
1954
+ });
1955
+ } else return r instanceof P ? new P({
1956
+ ...r._def,
1957
+ type: ee(r.element)
1958
+ }) : r instanceof z ? z.create(ee(r.unwrap())) : r instanceof se ? se.create(ee(r.unwrap())) : r instanceof X ? X.create(r.items.map((e) => ee(e))) : r;
1959
+ }
1960
+ class C extends b {
1961
+ constructor() {
1962
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1963
+ }
1964
+ _getCached() {
1965
+ if (this._cached !== null)
1966
+ return this._cached;
1967
+ const e = this._def.shape(), t = k.objectKeys(e);
1968
+ return this._cached = { shape: e, keys: t }, this._cached;
1969
+ }
1970
+ _parse(e) {
1971
+ if (this._getType(e) !== m.object) {
1972
+ const c = this._getOrReturnCtx(e);
1973
+ return f(c, {
1974
+ code: l.invalid_type,
1975
+ expected: m.object,
1976
+ received: c.parsedType
1977
+ }), g;
1978
+ }
1979
+ const { status: n, ctx: a } = this._processInputParams(e), { shape: s, keys: i } = this._getCached(), o = [];
1980
+ if (!(this._def.catchall instanceof W && this._def.unknownKeys === "strip"))
1981
+ for (const c in a.data)
1982
+ i.includes(c) || o.push(c);
1983
+ const u = [];
1984
+ for (const c of i) {
1985
+ const d = s[c], y = a.data[c];
1986
+ u.push({
1987
+ key: { status: "valid", value: c },
1988
+ value: d._parse(new U(a, y, a.path, c)),
1989
+ alwaysSet: c in a.data
1990
+ });
1991
+ }
1992
+ if (this._def.catchall instanceof W) {
1993
+ const c = this._def.unknownKeys;
1994
+ if (c === "passthrough")
1995
+ for (const d of o)
1996
+ u.push({
1997
+ key: { status: "valid", value: d },
1998
+ value: { status: "valid", value: a.data[d] }
1999
+ });
2000
+ else if (c === "strict")
2001
+ o.length > 0 && (f(a, {
2002
+ code: l.unrecognized_keys,
2003
+ keys: o
2004
+ }), n.dirty());
2005
+ else if (c !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
2006
+ } else {
2007
+ const c = this._def.catchall;
2008
+ for (const d of o) {
2009
+ const y = a.data[d];
2010
+ u.push({
2011
+ key: { status: "valid", value: d },
2012
+ value: c._parse(
2013
+ new U(a, y, a.path, d)
2014
+ //, ctx.child(key), value, getParsedType(value)
2015
+ ),
2016
+ alwaysSet: d in a.data
2017
+ });
2018
+ }
2019
+ }
2020
+ return a.common.async ? Promise.resolve().then(async () => {
2021
+ const c = [];
2022
+ for (const d of u) {
2023
+ const y = await d.key, h = await d.value;
2024
+ c.push({
2025
+ key: y,
2026
+ value: h,
2027
+ alwaysSet: d.alwaysSet
2028
+ });
2029
+ }
2030
+ return c;
2031
+ }).then((c) => A.mergeObjectSync(n, c)) : A.mergeObjectSync(n, u);
2032
+ }
2033
+ get shape() {
2034
+ return this._def.shape();
2035
+ }
2036
+ strict(e) {
2037
+ return p.errToObj, new C({
2038
+ ...this._def,
2039
+ unknownKeys: "strict",
2040
+ ...e !== void 0 ? {
2041
+ errorMap: (t, n) => {
2042
+ var s, i;
2043
+ const a = ((i = (s = this._def).errorMap) == null ? void 0 : i.call(s, t, n).message) ?? n.defaultError;
2044
+ return t.code === "unrecognized_keys" ? {
2045
+ message: p.errToObj(e).message ?? a
2046
+ } : {
2047
+ message: a
2048
+ };
2049
+ }
2050
+ } : {}
2051
+ });
2052
+ }
2053
+ strip() {
2054
+ return new C({
2055
+ ...this._def,
2056
+ unknownKeys: "strip"
2057
+ });
2058
+ }
2059
+ passthrough() {
2060
+ return new C({
2061
+ ...this._def,
2062
+ unknownKeys: "passthrough"
2063
+ });
2064
+ }
2065
+ // const AugmentFactory =
2066
+ // <Def extends ZodObjectDef>(def: Def) =>
2067
+ // <Augmentation extends ZodRawShape>(
2068
+ // augmentation: Augmentation
2069
+ // ): ZodObject<
2070
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2071
+ // Def["unknownKeys"],
2072
+ // Def["catchall"]
2073
+ // > => {
2074
+ // return new ZodObject({
2075
+ // ...def,
2076
+ // shape: () => ({
2077
+ // ...def.shape(),
2078
+ // ...augmentation,
2079
+ // }),
2080
+ // }) as any;
2081
+ // };
2082
+ extend(e) {
2083
+ return new C({
2084
+ ...this._def,
2085
+ shape: () => ({
2086
+ ...this._def.shape(),
2087
+ ...e
2088
+ })
2089
+ });
2090
+ }
2091
+ /**
2092
+ * Prior to zod@1.0.12 there was a bug in the
2093
+ * inferred type of merged objects. Please
2094
+ * upgrade if you are experiencing issues.
2095
+ */
2096
+ merge(e) {
2097
+ return new C({
2098
+ unknownKeys: e._def.unknownKeys,
2099
+ catchall: e._def.catchall,
2100
+ shape: () => ({
2101
+ ...this._def.shape(),
2102
+ ...e._def.shape()
2103
+ }),
2104
+ typeName: _.ZodObject
2105
+ });
2106
+ }
2107
+ // merge<
2108
+ // Incoming extends AnyZodObject,
2109
+ // Augmentation extends Incoming["shape"],
2110
+ // NewOutput extends {
2111
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2112
+ // ? Augmentation[k]["_output"]
2113
+ // : k extends keyof Output
2114
+ // ? Output[k]
2115
+ // : never;
2116
+ // },
2117
+ // NewInput extends {
2118
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2119
+ // ? Augmentation[k]["_input"]
2120
+ // : k extends keyof Input
2121
+ // ? Input[k]
2122
+ // : never;
2123
+ // }
2124
+ // >(
2125
+ // merging: Incoming
2126
+ // ): ZodObject<
2127
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2128
+ // Incoming["_def"]["unknownKeys"],
2129
+ // Incoming["_def"]["catchall"],
2130
+ // NewOutput,
2131
+ // NewInput
2132
+ // > {
2133
+ // const merged: any = new ZodObject({
2134
+ // unknownKeys: merging._def.unknownKeys,
2135
+ // catchall: merging._def.catchall,
2136
+ // shape: () =>
2137
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2138
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2139
+ // }) as any;
2140
+ // return merged;
2141
+ // }
2142
+ setKey(e, t) {
2143
+ return this.augment({ [e]: t });
2144
+ }
2145
+ // merge<Incoming extends AnyZodObject>(
2146
+ // merging: Incoming
2147
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2148
+ // ZodObject<
2149
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2150
+ // Incoming["_def"]["unknownKeys"],
2151
+ // Incoming["_def"]["catchall"]
2152
+ // > {
2153
+ // // const mergedShape = objectUtil.mergeShapes(
2154
+ // // this._def.shape(),
2155
+ // // merging._def.shape()
2156
+ // // );
2157
+ // const merged: any = new ZodObject({
2158
+ // unknownKeys: merging._def.unknownKeys,
2159
+ // catchall: merging._def.catchall,
2160
+ // shape: () =>
2161
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2162
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2163
+ // }) as any;
2164
+ // return merged;
2165
+ // }
2166
+ catchall(e) {
2167
+ return new C({
2168
+ ...this._def,
2169
+ catchall: e
2170
+ });
2171
+ }
2172
+ pick(e) {
2173
+ const t = {};
2174
+ for (const n of k.objectKeys(e))
2175
+ e[n] && this.shape[n] && (t[n] = this.shape[n]);
2176
+ return new C({
2177
+ ...this._def,
2178
+ shape: () => t
2179
+ });
2180
+ }
2181
+ omit(e) {
2182
+ const t = {};
2183
+ for (const n of k.objectKeys(this.shape))
2184
+ e[n] || (t[n] = this.shape[n]);
2185
+ return new C({
2186
+ ...this._def,
2187
+ shape: () => t
2188
+ });
2189
+ }
2190
+ /**
2191
+ * @deprecated
2192
+ */
2193
+ deepPartial() {
2194
+ return ee(this);
2195
+ }
2196
+ partial(e) {
2197
+ const t = {};
2198
+ for (const n of k.objectKeys(this.shape)) {
2199
+ const a = this.shape[n];
2200
+ e && !e[n] ? t[n] = a : t[n] = a.optional();
2201
+ }
2202
+ return new C({
2203
+ ...this._def,
2204
+ shape: () => t
2205
+ });
2206
+ }
2207
+ required(e) {
2208
+ const t = {};
2209
+ for (const n of k.objectKeys(this.shape))
2210
+ if (e && !e[n])
2211
+ t[n] = this.shape[n];
2212
+ else {
2213
+ let s = this.shape[n];
2214
+ for (; s instanceof z; )
2215
+ s = s._def.innerType;
2216
+ t[n] = s;
2217
+ }
2218
+ return new C({
2219
+ ...this._def,
2220
+ shape: () => t
2221
+ });
2222
+ }
2223
+ keyof() {
2224
+ return At(k.objectKeys(this.shape));
2225
+ }
2226
+ }
2227
+ C.create = (r, e) => new C({
2228
+ shape: () => r,
2229
+ unknownKeys: "strip",
2230
+ catchall: W.create(),
2231
+ typeName: _.ZodObject,
2232
+ ...x(e)
2233
+ });
2234
+ C.strictCreate = (r, e) => new C({
2235
+ shape: () => r,
2236
+ unknownKeys: "strict",
2237
+ catchall: W.create(),
2238
+ typeName: _.ZodObject,
2239
+ ...x(e)
2240
+ });
2241
+ C.lazycreate = (r, e) => new C({
2242
+ shape: r,
2243
+ unknownKeys: "strip",
2244
+ catchall: W.create(),
2245
+ typeName: _.ZodObject,
2246
+ ...x(e)
2247
+ });
2248
+ class ke extends b {
2249
+ _parse(e) {
2250
+ const { ctx: t } = this._processInputParams(e), n = this._def.options;
2251
+ function a(s) {
2252
+ for (const o of s)
2253
+ if (o.result.status === "valid")
2254
+ return o.result;
2255
+ for (const o of s)
2256
+ if (o.result.status === "dirty")
2257
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
2258
+ const i = s.map((o) => new F(o.ctx.common.issues));
2259
+ return f(t, {
2260
+ code: l.invalid_union,
2261
+ unionErrors: i
2262
+ }), g;
2263
+ }
2264
+ if (t.common.async)
2265
+ return Promise.all(n.map(async (s) => {
2266
+ const i = {
2267
+ ...t,
2268
+ common: {
2269
+ ...t.common,
2270
+ issues: []
2271
+ },
2272
+ parent: null
2273
+ };
2274
+ return {
2275
+ result: await s._parseAsync({
2276
+ data: t.data,
2277
+ path: t.path,
2278
+ parent: i
2279
+ }),
2280
+ ctx: i
2281
+ };
2282
+ })).then(a);
2283
+ {
2284
+ let s;
2285
+ const i = [];
2286
+ for (const u of n) {
2287
+ const c = {
2288
+ ...t,
2289
+ common: {
2290
+ ...t.common,
2291
+ issues: []
2292
+ },
2293
+ parent: null
2294
+ }, d = u._parseSync({
2295
+ data: t.data,
2296
+ path: t.path,
2297
+ parent: c
2298
+ });
2299
+ if (d.status === "valid")
2300
+ return d;
2301
+ d.status === "dirty" && !s && (s = { result: d, ctx: c }), c.common.issues.length && i.push(c.common.issues);
2302
+ }
2303
+ if (s)
2304
+ return t.common.issues.push(...s.ctx.common.issues), s.result;
2305
+ const o = i.map((u) => new F(u));
2306
+ return f(t, {
2307
+ code: l.invalid_union,
2308
+ unionErrors: o
2309
+ }), g;
2310
+ }
2311
+ }
2312
+ get options() {
2313
+ return this._def.options;
2314
+ }
2315
+ }
2316
+ ke.create = (r, e) => new ke({
2317
+ options: r,
2318
+ typeName: _.ZodUnion,
2319
+ ...x(e)
2320
+ });
2321
+ function Ve(r, e) {
2322
+ const t = L(r), n = L(e);
2323
+ if (r === e)
2324
+ return { valid: !0, data: r };
2325
+ if (t === m.object && n === m.object) {
2326
+ const a = k.objectKeys(e), s = k.objectKeys(r).filter((o) => a.indexOf(o) !== -1), i = { ...r, ...e };
2327
+ for (const o of s) {
2328
+ const u = Ve(r[o], e[o]);
2329
+ if (!u.valid)
2330
+ return { valid: !1 };
2331
+ i[o] = u.data;
2332
+ }
2333
+ return { valid: !0, data: i };
2334
+ } else if (t === m.array && n === m.array) {
2335
+ if (r.length !== e.length)
2336
+ return { valid: !1 };
2337
+ const a = [];
2338
+ for (let s = 0; s < r.length; s++) {
2339
+ const i = r[s], o = e[s], u = Ve(i, o);
2340
+ if (!u.valid)
2341
+ return { valid: !1 };
2342
+ a.push(u.data);
2343
+ }
2344
+ return { valid: !0, data: a };
2345
+ } else return t === m.date && n === m.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2346
+ }
2347
+ class we extends b {
2348
+ _parse(e) {
2349
+ const { status: t, ctx: n } = this._processInputParams(e), a = (s, i) => {
2350
+ if (ot(s) || ot(i))
2351
+ return g;
2352
+ const o = Ve(s.value, i.value);
2353
+ return o.valid ? ((ut(s) || ut(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
2354
+ code: l.invalid_intersection_types
2355
+ }), g);
2356
+ };
2357
+ return n.common.async ? Promise.all([
2358
+ this._def.left._parseAsync({
2359
+ data: n.data,
2360
+ path: n.path,
2361
+ parent: n
2362
+ }),
2363
+ this._def.right._parseAsync({
2364
+ data: n.data,
2365
+ path: n.path,
2366
+ parent: n
2367
+ })
2368
+ ]).then(([s, i]) => a(s, i)) : a(this._def.left._parseSync({
2369
+ data: n.data,
2370
+ path: n.path,
2371
+ parent: n
2372
+ }), this._def.right._parseSync({
2373
+ data: n.data,
2374
+ path: n.path,
2375
+ parent: n
2376
+ }));
2377
+ }
2378
+ }
2379
+ we.create = (r, e, t) => new we({
2380
+ left: r,
2381
+ right: e,
2382
+ typeName: _.ZodIntersection,
2383
+ ...x(t)
2384
+ });
2385
+ class X extends b {
2386
+ _parse(e) {
2387
+ const { status: t, ctx: n } = this._processInputParams(e);
2388
+ if (n.parsedType !== m.array)
2389
+ return f(n, {
2390
+ code: l.invalid_type,
2391
+ expected: m.array,
2392
+ received: n.parsedType
2393
+ }), g;
2394
+ if (n.data.length < this._def.items.length)
2395
+ return f(n, {
2396
+ code: l.too_small,
2397
+ minimum: this._def.items.length,
2398
+ inclusive: !0,
2399
+ exact: !1,
2400
+ type: "array"
2401
+ }), g;
2402
+ !this._def.rest && n.data.length > this._def.items.length && (f(n, {
2403
+ code: l.too_big,
2404
+ maximum: this._def.items.length,
2405
+ inclusive: !0,
2406
+ exact: !1,
2407
+ type: "array"
2408
+ }), t.dirty());
2409
+ const s = [...n.data].map((i, o) => {
2410
+ const u = this._def.items[o] || this._def.rest;
2411
+ return u ? u._parse(new U(n, i, n.path, o)) : null;
2412
+ }).filter((i) => !!i);
2413
+ return n.common.async ? Promise.all(s).then((i) => A.mergeArray(t, i)) : A.mergeArray(t, s);
2414
+ }
2415
+ get items() {
2416
+ return this._def.items;
2417
+ }
2418
+ rest(e) {
2419
+ return new X({
2420
+ ...this._def,
2421
+ rest: e
2422
+ });
2423
+ }
2424
+ }
2425
+ X.create = (r, e) => {
2426
+ if (!Array.isArray(r))
2427
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2428
+ return new X({
2429
+ items: r,
2430
+ typeName: _.ZodTuple,
2431
+ rest: null,
2432
+ ...x(e)
2433
+ });
2434
+ };
2435
+ class yt extends b {
2436
+ get keySchema() {
2437
+ return this._def.keyType;
2438
+ }
2439
+ get valueSchema() {
2440
+ return this._def.valueType;
2441
+ }
2442
+ _parse(e) {
2443
+ const { status: t, ctx: n } = this._processInputParams(e);
2444
+ if (n.parsedType !== m.map)
2445
+ return f(n, {
2446
+ code: l.invalid_type,
2447
+ expected: m.map,
2448
+ received: n.parsedType
2449
+ }), g;
2450
+ const a = this._def.keyType, s = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
2451
+ key: a._parse(new U(n, o, n.path, [c, "key"])),
2452
+ value: s._parse(new U(n, u, n.path, [c, "value"]))
2453
+ }));
2454
+ if (n.common.async) {
2455
+ const o = /* @__PURE__ */ new Map();
2456
+ return Promise.resolve().then(async () => {
2457
+ for (const u of i) {
2458
+ const c = await u.key, d = await u.value;
2459
+ if (c.status === "aborted" || d.status === "aborted")
2460
+ return g;
2461
+ (c.status === "dirty" || d.status === "dirty") && t.dirty(), o.set(c.value, d.value);
2462
+ }
2463
+ return { status: t.value, value: o };
2464
+ });
2465
+ } else {
2466
+ const o = /* @__PURE__ */ new Map();
2467
+ for (const u of i) {
2468
+ const c = u.key, d = u.value;
2469
+ if (c.status === "aborted" || d.status === "aborted")
2470
+ return g;
2471
+ (c.status === "dirty" || d.status === "dirty") && t.dirty(), o.set(c.value, d.value);
2472
+ }
2473
+ return { status: t.value, value: o };
2474
+ }
2475
+ }
2476
+ }
2477
+ yt.create = (r, e, t) => new yt({
2478
+ valueType: e,
2479
+ keyType: r,
2480
+ typeName: _.ZodMap,
2481
+ ...x(t)
2482
+ });
2483
+ class me extends b {
2484
+ _parse(e) {
2485
+ const { status: t, ctx: n } = this._processInputParams(e);
2486
+ if (n.parsedType !== m.set)
2487
+ return f(n, {
2488
+ code: l.invalid_type,
2489
+ expected: m.set,
2490
+ received: n.parsedType
2491
+ }), g;
2492
+ const a = this._def;
2493
+ a.minSize !== null && n.data.size < a.minSize.value && (f(n, {
2494
+ code: l.too_small,
2495
+ minimum: a.minSize.value,
2496
+ type: "set",
2497
+ inclusive: !0,
2498
+ exact: !1,
2499
+ message: a.minSize.message
2500
+ }), t.dirty()), a.maxSize !== null && n.data.size > a.maxSize.value && (f(n, {
2501
+ code: l.too_big,
2502
+ maximum: a.maxSize.value,
2503
+ type: "set",
2504
+ inclusive: !0,
2505
+ exact: !1,
2506
+ message: a.maxSize.message
2507
+ }), t.dirty());
2508
+ const s = this._def.valueType;
2509
+ function i(u) {
2510
+ const c = /* @__PURE__ */ new Set();
2511
+ for (const d of u) {
2512
+ if (d.status === "aborted")
2513
+ return g;
2514
+ d.status === "dirty" && t.dirty(), c.add(d.value);
2515
+ }
2516
+ return { status: t.value, value: c };
2517
+ }
2518
+ const o = [...n.data.values()].map((u, c) => s._parse(new U(n, u, n.path, c)));
2519
+ return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2520
+ }
2521
+ min(e, t) {
2522
+ return new me({
2523
+ ...this._def,
2524
+ minSize: { value: e, message: p.toString(t) }
2525
+ });
2526
+ }
2527
+ max(e, t) {
2528
+ return new me({
2529
+ ...this._def,
2530
+ maxSize: { value: e, message: p.toString(t) }
2531
+ });
2532
+ }
2533
+ size(e, t) {
2534
+ return this.min(e, t).max(e, t);
2535
+ }
2536
+ nonempty(e) {
2537
+ return this.min(1, e);
2538
+ }
2539
+ }
2540
+ me.create = (r, e) => new me({
2541
+ valueType: r,
2542
+ minSize: null,
2543
+ maxSize: null,
2544
+ typeName: _.ZodSet,
2545
+ ...x(e)
2546
+ });
2547
+ class gt extends b {
2548
+ get schema() {
2549
+ return this._def.getter();
2550
+ }
2551
+ _parse(e) {
2552
+ const { ctx: t } = this._processInputParams(e);
2553
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2554
+ }
2555
+ }
2556
+ gt.create = (r, e) => new gt({
2557
+ getter: r,
2558
+ typeName: _.ZodLazy,
2559
+ ...x(e)
2560
+ });
2561
+ class _t extends b {
2562
+ _parse(e) {
2563
+ if (e.data !== this._def.value) {
2564
+ const t = this._getOrReturnCtx(e);
2565
+ return f(t, {
2566
+ received: t.data,
2567
+ code: l.invalid_literal,
2568
+ expected: this._def.value
2569
+ }), g;
2570
+ }
2571
+ return { status: "valid", value: e.data };
2572
+ }
2573
+ get value() {
2574
+ return this._def.value;
2575
+ }
2576
+ }
2577
+ _t.create = (r, e) => new _t({
2578
+ value: r,
2579
+ typeName: _.ZodLiteral,
2580
+ ...x(e)
2581
+ });
2582
+ function At(r, e) {
2583
+ return new re({
2584
+ values: r,
2585
+ typeName: _.ZodEnum,
2586
+ ...x(e)
2587
+ });
2588
+ }
2589
+ class re extends b {
2590
+ _parse(e) {
2591
+ if (typeof e.data != "string") {
2592
+ const t = this._getOrReturnCtx(e), n = this._def.values;
2593
+ return f(t, {
2594
+ expected: k.joinValues(n),
2595
+ received: t.parsedType,
2596
+ code: l.invalid_type
2597
+ }), g;
2598
+ }
2599
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2600
+ const t = this._getOrReturnCtx(e), n = this._def.values;
2601
+ return f(t, {
2602
+ received: t.data,
2603
+ code: l.invalid_enum_value,
2604
+ options: n
2605
+ }), g;
2606
+ }
2607
+ return N(e.data);
2608
+ }
2609
+ get options() {
2610
+ return this._def.values;
2611
+ }
2612
+ get enum() {
2613
+ const e = {};
2614
+ for (const t of this._def.values)
2615
+ e[t] = t;
2616
+ return e;
2617
+ }
2618
+ get Values() {
2619
+ const e = {};
2620
+ for (const t of this._def.values)
2621
+ e[t] = t;
2622
+ return e;
2623
+ }
2624
+ get Enum() {
2625
+ const e = {};
2626
+ for (const t of this._def.values)
2627
+ e[t] = t;
2628
+ return e;
2629
+ }
2630
+ extract(e, t = this._def) {
2631
+ return re.create(e, {
2632
+ ...this._def,
2633
+ ...t
2634
+ });
2635
+ }
2636
+ exclude(e, t = this._def) {
2637
+ return re.create(this.options.filter((n) => !e.includes(n)), {
2638
+ ...this._def,
2639
+ ...t
2640
+ });
2641
+ }
2642
+ }
2643
+ re.create = At;
2644
+ class vt extends b {
2645
+ _parse(e) {
2646
+ const t = k.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2647
+ if (n.parsedType !== m.string && n.parsedType !== m.number) {
2648
+ const a = k.objectValues(t);
2649
+ return f(n, {
2650
+ expected: k.joinValues(a),
2651
+ received: n.parsedType,
2652
+ code: l.invalid_type
2653
+ }), g;
2654
+ }
2655
+ if (this._cache || (this._cache = new Set(k.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2656
+ const a = k.objectValues(t);
2657
+ return f(n, {
2658
+ received: n.data,
2659
+ code: l.invalid_enum_value,
2660
+ options: a
2661
+ }), g;
2662
+ }
2663
+ return N(e.data);
2664
+ }
2665
+ get enum() {
2666
+ return this._def.values;
2667
+ }
2668
+ }
2669
+ vt.create = (r, e) => new vt({
2670
+ values: r,
2671
+ typeName: _.ZodNativeEnum,
2672
+ ...x(e)
2673
+ });
2674
+ class Te extends b {
2675
+ unwrap() {
2676
+ return this._def.type;
2677
+ }
2678
+ _parse(e) {
2679
+ const { ctx: t } = this._processInputParams(e);
2680
+ if (t.parsedType !== m.promise && t.common.async === !1)
2681
+ return f(t, {
2682
+ code: l.invalid_type,
2683
+ expected: m.promise,
2684
+ received: t.parsedType
2685
+ }), g;
2686
+ const n = t.parsedType === m.promise ? t.data : Promise.resolve(t.data);
2687
+ return N(n.then((a) => this._def.type.parseAsync(a, {
2688
+ path: t.path,
2689
+ errorMap: t.common.contextualErrorMap
2690
+ })));
2691
+ }
2692
+ }
2693
+ Te.create = (r, e) => new Te({
2694
+ type: r,
2695
+ typeName: _.ZodPromise,
2696
+ ...x(e)
2697
+ });
2698
+ class ne extends b {
2699
+ innerType() {
2700
+ return this._def.schema;
2701
+ }
2702
+ sourceType() {
2703
+ return this._def.schema._def.typeName === _.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2704
+ }
2705
+ _parse(e) {
2706
+ const { status: t, ctx: n } = this._processInputParams(e), a = this._def.effect || null, s = {
2707
+ addIssue: (i) => {
2708
+ f(n, i), i.fatal ? t.abort() : t.dirty();
2709
+ },
2710
+ get path() {
2711
+ return n.path;
2712
+ }
2713
+ };
2714
+ if (s.addIssue = s.addIssue.bind(s), a.type === "preprocess") {
2715
+ const i = a.transform(n.data, s);
2716
+ if (n.common.async)
2717
+ return Promise.resolve(i).then(async (o) => {
2718
+ if (t.value === "aborted")
2719
+ return g;
2720
+ const u = await this._def.schema._parseAsync({
2721
+ data: o,
2722
+ path: n.path,
2723
+ parent: n
2724
+ });
2725
+ return u.status === "aborted" ? g : u.status === "dirty" || t.value === "dirty" ? ue(u.value) : u;
2726
+ });
2727
+ {
2728
+ if (t.value === "aborted")
2729
+ return g;
2730
+ const o = this._def.schema._parseSync({
2731
+ data: i,
2732
+ path: n.path,
2733
+ parent: n
2734
+ });
2735
+ return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? ue(o.value) : o;
2736
+ }
2737
+ }
2738
+ if (a.type === "refinement") {
2739
+ const i = (o) => {
2740
+ const u = a.refinement(o, s);
2741
+ if (n.common.async)
2742
+ return Promise.resolve(u);
2743
+ if (u instanceof Promise)
2744
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2745
+ return o;
2746
+ };
2747
+ if (n.common.async === !1) {
2748
+ const o = this._def.schema._parseSync({
2749
+ data: n.data,
2750
+ path: n.path,
2751
+ parent: n
2752
+ });
2753
+ return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2754
+ } else
2755
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2756
+ }
2757
+ if (a.type === "transform")
2758
+ if (n.common.async === !1) {
2759
+ const i = this._def.schema._parseSync({
2760
+ data: n.data,
2761
+ path: n.path,
2762
+ parent: n
2763
+ });
2764
+ if (!te(i))
2765
+ return g;
2766
+ const o = a.transform(i.value, s);
2767
+ if (o instanceof Promise)
2768
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2769
+ return { status: t.value, value: o };
2770
+ } else
2771
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => te(i) ? Promise.resolve(a.transform(i.value, s)).then((o) => ({
2772
+ status: t.value,
2773
+ value: o
2774
+ })) : g);
2775
+ k.assertNever(a);
2776
+ }
2777
+ }
2778
+ ne.create = (r, e, t) => new ne({
2779
+ schema: r,
2780
+ typeName: _.ZodEffects,
2781
+ effect: e,
2782
+ ...x(t)
2783
+ });
2784
+ ne.createWithPreprocess = (r, e, t) => new ne({
2785
+ schema: e,
2786
+ effect: { type: "preprocess", transform: r },
2787
+ typeName: _.ZodEffects,
2788
+ ...x(t)
2789
+ });
2790
+ class z extends b {
2791
+ _parse(e) {
2792
+ return this._getType(e) === m.undefined ? N(void 0) : this._def.innerType._parse(e);
2793
+ }
2794
+ unwrap() {
2795
+ return this._def.innerType;
2796
+ }
2797
+ }
2798
+ z.create = (r, e) => new z({
2799
+ innerType: r,
2800
+ typeName: _.ZodOptional,
2801
+ ...x(e)
2802
+ });
2803
+ class se extends b {
2804
+ _parse(e) {
2805
+ return this._getType(e) === m.null ? N(null) : this._def.innerType._parse(e);
2806
+ }
2807
+ unwrap() {
2808
+ return this._def.innerType;
2809
+ }
2810
+ }
2811
+ se.create = (r, e) => new se({
2812
+ innerType: r,
2813
+ typeName: _.ZodNullable,
2814
+ ...x(e)
2815
+ });
2816
+ class Ze extends b {
2817
+ _parse(e) {
2818
+ const { ctx: t } = this._processInputParams(e);
2819
+ let n = t.data;
2820
+ return t.parsedType === m.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2821
+ data: n,
2822
+ path: t.path,
2823
+ parent: t
2824
+ });
2825
+ }
2826
+ removeDefault() {
2827
+ return this._def.innerType;
2828
+ }
2829
+ }
2830
+ Ze.create = (r, e) => new Ze({
2831
+ innerType: r,
2832
+ typeName: _.ZodDefault,
2833
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2834
+ ...x(e)
2835
+ });
2836
+ class Pe extends b {
2837
+ _parse(e) {
2838
+ const { ctx: t } = this._processInputParams(e), n = {
2839
+ ...t,
2840
+ common: {
2841
+ ...t.common,
2842
+ issues: []
2843
+ }
2844
+ }, a = this._def.innerType._parse({
2845
+ data: n.data,
2846
+ path: n.path,
2847
+ parent: {
2848
+ ...n
2849
+ }
2850
+ });
2851
+ return xe(a) ? a.then((s) => ({
2852
+ status: "valid",
2853
+ value: s.status === "valid" ? s.value : this._def.catchValue({
2854
+ get error() {
2855
+ return new F(n.common.issues);
2856
+ },
2857
+ input: n.data
2858
+ })
2859
+ })) : {
2860
+ status: "valid",
2861
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2862
+ get error() {
2863
+ return new F(n.common.issues);
2864
+ },
2865
+ input: n.data
2866
+ })
2867
+ };
2868
+ }
2869
+ removeCatch() {
2870
+ return this._def.innerType;
2871
+ }
2872
+ }
2873
+ Pe.create = (r, e) => new Pe({
2874
+ innerType: r,
2875
+ typeName: _.ZodCatch,
2876
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2877
+ ...x(e)
2878
+ });
2879
+ class xt extends b {
2880
+ _parse(e) {
2881
+ if (this._getType(e) !== m.nan) {
2882
+ const n = this._getOrReturnCtx(e);
2883
+ return f(n, {
2884
+ code: l.invalid_type,
2885
+ expected: m.nan,
2886
+ received: n.parsedType
2887
+ }), g;
2888
+ }
2889
+ return { status: "valid", value: e.data };
2890
+ }
2891
+ }
2892
+ xt.create = (r) => new xt({
2893
+ typeName: _.ZodNaN,
2894
+ ...x(r)
2895
+ });
2896
+ class zr extends b {
2897
+ _parse(e) {
2898
+ const { ctx: t } = this._processInputParams(e), n = t.data;
2899
+ return this._def.type._parse({
2900
+ data: n,
2901
+ path: t.path,
2902
+ parent: t
2903
+ });
2904
+ }
2905
+ unwrap() {
2906
+ return this._def.type;
2907
+ }
2908
+ }
2909
+ class Le extends b {
2910
+ _parse(e) {
2911
+ const { status: t, ctx: n } = this._processInputParams(e);
2912
+ if (n.common.async)
2913
+ return (async () => {
2914
+ const s = await this._def.in._parseAsync({
2915
+ data: n.data,
2916
+ path: n.path,
2917
+ parent: n
2918
+ });
2919
+ return s.status === "aborted" ? g : s.status === "dirty" ? (t.dirty(), ue(s.value)) : this._def.out._parseAsync({
2920
+ data: s.value,
2921
+ path: n.path,
2922
+ parent: n
2923
+ });
2924
+ })();
2925
+ {
2926
+ const a = this._def.in._parseSync({
2927
+ data: n.data,
2928
+ path: n.path,
2929
+ parent: n
2930
+ });
2931
+ return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), {
2932
+ status: "dirty",
2933
+ value: a.value
2934
+ }) : this._def.out._parseSync({
2935
+ data: a.value,
2936
+ path: n.path,
2937
+ parent: n
2938
+ });
2939
+ }
2940
+ }
2941
+ static create(e, t) {
2942
+ return new Le({
2943
+ in: e,
2944
+ out: t,
2945
+ typeName: _.ZodPipeline
2946
+ });
2947
+ }
2948
+ }
2949
+ class $e extends b {
2950
+ _parse(e) {
2951
+ const t = this._def.innerType._parse(e), n = (a) => (te(a) && (a.value = Object.freeze(a.value)), a);
2952
+ return xe(t) ? t.then((a) => n(a)) : n(t);
2953
+ }
2954
+ unwrap() {
2955
+ return this._def.innerType;
2956
+ }
2957
+ }
2958
+ $e.create = (r, e) => new $e({
2959
+ innerType: r,
2960
+ typeName: _.ZodReadonly,
2961
+ ...x(e)
2962
+ });
2963
+ var _;
2964
+ (function(r) {
2965
+ r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2966
+ })(_ || (_ = {}));
2967
+ const Br = q.create, B = Ne.create;
2968
+ W.create;
2969
+ const It = P.create, Me = C.create, Nt = ke.create;
2970
+ we.create;
2971
+ const Ur = X.create;
2972
+ re.create;
2973
+ Te.create;
2974
+ z.create;
2975
+ se.create;
2976
+ const Q = g, Wr = "Required field";
2977
+ function ce(r) {
375
2978
  let e;
376
2979
  if (typeof r == "string")
377
2980
  try {
@@ -383,74 +2986,74 @@ function k(r) {
383
2986
  e = r;
384
2987
  if (typeof e == "string")
385
2988
  return e;
386
- if (w(e))
387
- return k(e[0]);
2989
+ if (J(e))
2990
+ return ce(e[0]);
388
2991
  const t = e;
389
- return be(t) && (t != null && t.message) ? e == null ? void 0 : e.message : "Unknown error";
2992
+ return wt(t) && (t != null && t.message) ? e == null ? void 0 : e.message : "Unknown error";
390
2993
  }
391
- function cr(r, e, t) {
2994
+ function Jr(r, e, t) {
392
2995
  let n = {};
393
- if (Z(n, r.inputs, e, t), t != null && t.prefix) {
2996
+ if (_e(n, r.inputs, e, t), t != null && t.prefix) {
394
2997
  const s = t == null ? void 0 : t.prefix.replace(/.$/, "");
395
- n = R({}, s, n);
2998
+ n = M({}, s, n);
396
2999
  }
397
- return p.object(D(n, e, t));
3000
+ return Me(de(n, e, t));
398
3001
  }
399
- function fr(r, e, t) {
400
- const n = Object.keys(r).filter((i) => /^\d+$/.test(i) && !i.startsWith("_")).map((i) => parseInt(i, 10)).sort((i, a) => i - a);
3002
+ function Hr(r, e, t) {
3003
+ const n = Object.keys(r).filter((i) => /^\d+$/.test(i) && !i.startsWith("_")).map((i) => parseInt(i, 10)).sort((i, o) => i - o);
401
3004
  if (n.length === 0) return null;
402
- const o = Math.max(...n), s = [];
403
- for (let i = 0; i <= o; i++)
3005
+ const a = Math.max(...n), s = [];
3006
+ for (let i = 0; i <= a; i++)
404
3007
  if (n.includes(i)) {
405
- const a = r[i], c = D({ item: a }, e, t);
406
- s.push(c.item || p.any().optional());
3008
+ const o = r[i], u = de({ item: o }, e, t);
3009
+ s.push(u.item || B().optional());
407
3010
  } else
408
- s.push(p.any().optional());
409
- return p.tuple(s).rest(p.any()).optional();
3011
+ s.push(B().optional());
3012
+ return Ur(s).rest(B()).optional();
410
3013
  }
411
- function D(r, e, t) {
3014
+ function de(r, e, t) {
412
3015
  const n = {};
413
- return Object.keys(r).forEach((o) => {
3016
+ return Object.keys(r).forEach((a) => {
414
3017
  const {
415
3018
  _requiredOnly: s,
416
3019
  _schemaObj: i,
417
- _input: a,
418
- _isList: c,
419
- _isArrayItem: l,
420
- _isTuple: u,
421
- _schema: d
3020
+ _input: o,
3021
+ _isList: u,
3022
+ _isArrayItem: c,
3023
+ _isTuple: d,
3024
+ _schema: y
422
3025
  /*...nestedSchemaObj*/
423
- } = r[o];
424
- if (u && !c && !l) {
425
- const f = fr(r[o], e, t);
426
- if (f) {
427
- n[o] = f;
3026
+ } = r[a];
3027
+ if (d && !u && !c) {
3028
+ const h = Hr(r[a], e, t);
3029
+ if (h) {
3030
+ n[a] = h;
428
3031
  return;
429
3032
  }
430
3033
  }
431
- if (c && i && a) {
432
- const f = p.object(D(i, e, t)), m = p.union([
433
- p.array(f).optional(),
434
- Se(a, t)
435
- ]), b = ye(d, a, e, t, m);
436
- n[o] = b;
437
- } else if (l && a) {
438
- const f = i != null && i.___array ? D({ ___array: i.___array }, e, t) : { ___array: p.any() }, m = lr(f, a, t), b = ye(d, a, e, t, m);
439
- n[o] = b;
440
- } else if (d && a) {
441
- const f = dr(d, a, e, t);
442
- n[o] = f;
443
- } else s && a ? n[o] = Y(a, t) : n[o] = p.object(D(r[o], e, t)).optional();
3034
+ if (u && i && o) {
3035
+ const h = Me(de(i, e, t)), v = Nt([
3036
+ It(h).optional(),
3037
+ Vt(o, t)
3038
+ ]), S = bt(y, o, e, t, v);
3039
+ n[a] = S;
3040
+ } else if (c && o) {
3041
+ const h = i != null && i.___array ? de({ ___array: i.___array }, e, t) : { ___array: B() }, v = Yr(h, o, t), S = bt(y, o, e, t, v);
3042
+ n[a] = S;
3043
+ } else if (y && o) {
3044
+ const h = Gr(y, o, e, t);
3045
+ n[a] = h;
3046
+ } else s && o ? n[a] = qe(o, t) : n[a] = Me(de(r[a], e, t)).optional();
444
3047
  }), n;
445
3048
  }
446
- function Se(r, e) {
447
- return p.string().superRefine((t, n) => {
448
- var o;
449
- if ((o = e == null ? void 0 : e.validationConfig) != null && o.globalValidation) {
3049
+ function Vt(r, e) {
3050
+ return Br().superRefine((t, n) => {
3051
+ var a;
3052
+ if ((a = e == null ? void 0 : e.validationConfig) != null && a.globalValidation) {
450
3053
  const s = e.validationConfig.globalValidation(t, r, e.metadata);
451
3054
  if (s.error)
452
3055
  return n.addIssue({
453
- code: p.ZodIssueCode.custom,
3056
+ code: l.custom,
454
3057
  message: s.error
455
3058
  }), !1;
456
3059
  if (!s.continue)
@@ -459,116 +3062,116 @@ function Se(r, e) {
459
3062
  return !0;
460
3063
  });
461
3064
  }
462
- function lr(r, e, t) {
463
- return p.union([p.array(r.___array).optional(), Se(e, t)]);
3065
+ function Yr(r, e, t) {
3066
+ return Nt([It(r.___array).optional(), Vt(e, t)]);
464
3067
  }
465
- function dr(r, e, t, n) {
466
- return p.any().optional().superRefine(async (o, s) => {
467
- var a, c;
468
- if (e.required && !(await Y(e, n).safeParseAsync(o)).success)
3068
+ function Gr(r, e, t, n) {
3069
+ return B().optional().superRefine(async (a, s) => {
3070
+ var o, u;
3071
+ if (e.required && !(await qe(e, n).safeParseAsync(a)).success)
469
3072
  return s.addIssue({
470
- code: p.ZodIssueCode.custom,
471
- message: Q(e, n)
472
- }), p.NEVER;
473
- if ((a = n == null ? void 0 : n.validationConfig) != null && a.globalValidation) {
474
- const l = (c = n == null ? void 0 : n.validationConfig) == null ? void 0 : c.globalValidation(o, e, n.metadata);
475
- if (l.error)
3073
+ code: l.custom,
3074
+ message: Fe(e, n)
3075
+ }), Q;
3076
+ if ((o = n == null ? void 0 : n.validationConfig) != null && o.globalValidation) {
3077
+ const c = (u = n == null ? void 0 : n.validationConfig) == null ? void 0 : u.globalValidation(a, e, n.metadata);
3078
+ if (c.error)
476
3079
  return s.addIssue({
477
- code: p.ZodIssueCode.custom,
478
- message: l.error
479
- }), p.NEVER;
480
- if (!l.continue)
3080
+ code: l.custom,
3081
+ message: c.error
3082
+ }), Q;
3083
+ if (!c.continue)
481
3084
  return !0;
482
3085
  }
483
- const i = _e(r, t);
3086
+ const i = Zt(r, t);
484
3087
  if (i) {
485
- const l = await i.safeParseAsync(o);
486
- if (!l.success) {
487
- const u = k(l == null ? void 0 : l.error.message), d = u === "Required" ? Q(e, n) : u;
3088
+ const c = await i.safeParseAsync(a);
3089
+ if (!c.success) {
3090
+ const d = ce(c == null ? void 0 : c.error.message), y = d === "Required" ? Fe(e, n) : d;
488
3091
  s.addIssue({
489
- code: p.ZodIssueCode.custom,
490
- message: d
3092
+ code: l.custom,
3093
+ message: y
491
3094
  });
492
3095
  }
493
3096
  }
494
3097
  });
495
3098
  }
496
- function ye(r, e, t, n, o) {
497
- return p.any().optional().superRefine(async (s, i) => {
498
- var u, d;
499
- const c = await Y(e, n).safeParseAsync(s);
500
- if (e.required && !c.success) {
501
- const f = k(c.error.message);
502
- return i.addIssue({ code: p.ZodIssueCode.custom, message: f, fatal: !0 }), p.NEVER;
503
- }
504
- if (!e.required && !c.success)
505
- return p.NEVER;
506
- if ((u = n == null ? void 0 : n.validationConfig) != null && u.globalValidation) {
507
- const f = (d = n == null ? void 0 : n.validationConfig) == null ? void 0 : d.globalValidation(s, e, n.metadata);
508
- if (f.error)
3099
+ function bt(r, e, t, n, a) {
3100
+ return B().optional().superRefine(async (s, i) => {
3101
+ var d, y;
3102
+ const u = await qe(e, n).safeParseAsync(s);
3103
+ if (e.required && !u.success) {
3104
+ const h = ce(u.error.message);
3105
+ return i.addIssue({ code: l.custom, message: h, fatal: !0 }), Q;
3106
+ }
3107
+ if (!e.required && !u.success)
3108
+ return Q;
3109
+ if ((d = n == null ? void 0 : n.validationConfig) != null && d.globalValidation) {
3110
+ const h = (y = n == null ? void 0 : n.validationConfig) == null ? void 0 : y.globalValidation(s, e, n.metadata);
3111
+ if (h.error)
509
3112
  return i.addIssue({
510
- code: p.ZodIssueCode.custom,
511
- message: k(f.error)
512
- }), p.NEVER;
513
- if (!f.continue)
3113
+ code: l.custom,
3114
+ message: ce(h.error)
3115
+ }), Q;
3116
+ if (!h.continue)
514
3117
  return !0;
515
3118
  }
516
- if (!w(s))
3119
+ if (!J(s))
517
3120
  return i.addIssue({
518
- code: p.ZodIssueCode.custom,
3121
+ code: l.custom,
519
3122
  message: "'Value is not array'"
520
- }), p.NEVER;
521
- const l = _e(r, t);
522
- if (l) {
523
- const f = await l.safeParseAsync(s);
524
- if (!f.success)
3123
+ }), Q;
3124
+ const c = Zt(r, t);
3125
+ if (c) {
3126
+ const h = await c.safeParseAsync(s);
3127
+ if (!h.success)
525
3128
  return i.addIssue({
526
- code: p.ZodIssueCode.custom,
527
- message: k(f.error.message)
528
- }), p.NEVER;
3129
+ code: l.custom,
3130
+ message: ce(h.error.message)
3131
+ }), Q;
529
3132
  }
530
- }).pipe(o ?? p.any());
3133
+ }).pipe(a ?? B());
531
3134
  }
532
- function Z(r, e, t, n, o) {
3135
+ function _e(r, e, t, n, a) {
533
3136
  e.forEach((s) => {
534
- var a, c, l, u, d, f, m;
3137
+ var o, u, c, d, y, h, v;
535
3138
  const i = t;
536
- if (!s.isVisible || (a = s.isVisible) != null && a.call(s, i, n == null ? void 0 : n.metadata)) {
537
- const b = T(r, s.path);
538
- if ((c = s.validation) != null && c.schema ? R(
3139
+ if (!s.isVisible || (o = s.isVisible) != null && o.call(s, i, n == null ? void 0 : n.metadata)) {
3140
+ const S = E(r, s.path);
3141
+ if ((u = s.validation) != null && u.schema ? M(
539
3142
  r,
540
3143
  s.path,
541
- A(b, {
542
- _schema: (l = s.validation) == null ? void 0 : l.schema,
3144
+ oe(S, {
3145
+ _schema: (c = s.validation) == null ? void 0 : c.schema,
543
3146
  _input: s
544
3147
  })
545
- ) : s.required && R(r, s.path, A(b, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, t, n), s.inputType === "list") {
546
- const h = {};
547
- Z(
548
- h,
549
- (d = (u = s.inputConfig) == null ? void 0 : u.inputs) == null ? void 0 : d.map((y) => ({
550
- ...y,
551
- path: y.relativePath
3148
+ ) : s.required && M(r, s.path, oe(S, { _requiredOnly: !0, _input: s })), s.inputs && _e(r, s.inputs, t, n), s.inputType === "list") {
3149
+ const w = {};
3150
+ _e(
3151
+ w,
3152
+ (y = (d = s.inputConfig) == null ? void 0 : d.inputs) == null ? void 0 : y.map((T) => ({
3153
+ ...T,
3154
+ path: T.relativePath
552
3155
  })),
553
3156
  t,
554
3157
  n
555
3158
  );
556
- const v = T(r, s.path);
557
- R(r, s.path, A(v, { _schemaObj: h, _isList: !0, _input: s }));
3159
+ const R = E(r, s.path);
3160
+ M(r, s.path, oe(R, { _schemaObj: w, _isList: !0, _input: s }));
558
3161
  }
559
- if (!((f = s.validation) != null && f.schema) && s.inputType === "array") {
560
- const h = {};
561
- Z(
562
- h,
3162
+ if (!((h = s.validation) != null && h.schema) && s.inputType === "array") {
3163
+ const w = {};
3164
+ _e(
3165
+ w,
563
3166
  [{ ...s.inputConfig.input, path: "___array" }],
564
3167
  t,
565
3168
  n
566
- ), R(
3169
+ ), M(
567
3170
  r,
568
3171
  s.path,
569
- A(b, {
570
- _schemaObj: h,
571
- _schema: (m = s.validation) == null ? void 0 : m.schema,
3172
+ oe(S, {
3173
+ _schemaObj: w,
3174
+ _schema: (v = s.validation) == null ? void 0 : v.schema,
572
3175
  _isArrayItem: !0,
573
3176
  _input: s
574
3177
  })
@@ -576,87 +3179,87 @@ function Z(r, e, t, n, o) {
576
3179
  }
577
3180
  }
578
3181
  }), e.forEach((s) => {
579
- var a;
3182
+ var o;
580
3183
  const i = t;
581
- if ((!s.isVisible || (a = s.isVisible) != null && a.call(s, i, n == null ? void 0 : n.metadata)) && s.path) {
582
- const c = s.path.split(".");
583
- c.forEach((l, u) => {
584
- if (u > 0 && /^\d+$/.test(l)) {
585
- const d = c.slice(0, u).join("."), f = d ? T(r, d) : r;
586
- f && typeof f == "object" && (f._isTuple = !0);
3184
+ if ((!s.isVisible || (o = s.isVisible) != null && o.call(s, i, n == null ? void 0 : n.metadata)) && s.path) {
3185
+ const u = s.path.split(".");
3186
+ u.forEach((c, d) => {
3187
+ if (d > 0 && /^\d+$/.test(c)) {
3188
+ const y = u.slice(0, d).join("."), h = y ? E(r, y) : r;
3189
+ h && typeof h == "object" && (h._isTuple = !0);
587
3190
  }
588
3191
  });
589
3192
  }
590
3193
  });
591
3194
  }
592
- function Q(r, e) {
593
- var t, n, o;
594
- return ((n = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredMessagePerInput) == null ? void 0 : n[r.inputType]) ?? ((o = e == null ? void 0 : e.validationConfig) == null ? void 0 : o.requiredMessage) ?? ur;
3195
+ function Fe(r, e) {
3196
+ var t, n, a;
3197
+ return ((n = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredMessagePerInput) == null ? void 0 : n[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? Wr;
595
3198
  }
596
- function Y(r, e) {
597
- var n, o, s, i, a, c;
598
- if ((o = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredSchemaPerInput) != null && o[r.inputType])
3199
+ function qe(r, e) {
3200
+ var n, a, s, i, o, u;
3201
+ if ((a = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredSchemaPerInput) != null && a[r.inputType])
599
3202
  return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
600
- if ((a = e == null ? void 0 : e.validationConfig) != null && a.requiredSchema)
601
- return (c = e == null ? void 0 : e.validationConfig) == null ? void 0 : c.requiredSchema;
602
- const t = Q(r, e);
603
- return p.any().optional().superRefine((l, u) => {
604
- typeof l == "object" && J(l) && u.addIssue({
605
- code: p.ZodIssueCode.custom,
3203
+ if ((o = e == null ? void 0 : e.validationConfig) != null && o.requiredSchema)
3204
+ return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
3205
+ const t = Fe(r, e);
3206
+ return B().optional().superRefine((c, d) => {
3207
+ typeof c == "object" && Ce(c) && d.addIssue({
3208
+ code: l.custom,
606
3209
  message: t
607
- }), (L(l) || l === "") && u.addIssue({
608
- code: p.ZodIssueCode.custom,
3210
+ }), (Oe(c) || c === "") && d.addIssue({
3211
+ code: l.custom,
609
3212
  message: t
610
3213
  });
611
3214
  });
612
3215
  }
613
- function _e(r, e) {
614
- if (r instanceof p.ZodType)
3216
+ function Zt(r, e) {
3217
+ if (r instanceof b)
615
3218
  return r;
616
3219
  if (typeof r == "function")
617
3220
  return r(e);
618
3221
  }
619
- const mr = (r) => Array.isArray(r == null ? void 0 : r.errors), pr = (r, e) => {
3222
+ const Qr = (r) => Array.isArray(r == null ? void 0 : r.errors), Xr = (r, e) => {
620
3223
  const t = {};
621
3224
  for (; r.length; ) {
622
- const n = r[0], { code: o, message: s, path: i } = n, a = i.join(".");
623
- if (!t[a])
3225
+ const n = r[0], { code: a, message: s, path: i } = n, o = i.join(".");
3226
+ if (!t[o])
624
3227
  if ("unionErrors" in n) {
625
- const c = n.unionErrors[0].errors[0];
626
- t[a] = {
627
- message: c.message,
628
- type: c.code
3228
+ const u = n.unionErrors[0].errors[0];
3229
+ t[o] = {
3230
+ message: u.message,
3231
+ type: u.code
629
3232
  };
630
3233
  } else
631
- t[a] = { message: s, type: o };
632
- "unionErrors" in n && n.unionErrors.forEach((c) => c.errors.forEach((l) => r.push(l)));
3234
+ t[o] = { message: s, type: a };
3235
+ "unionErrors" in n && n.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
633
3236
  {
634
- const c = t[a].types, l = c && c[n.code];
635
- t[a] = Ke(
636
- a,
3237
+ const u = t[o].types, c = u && u[n.code];
3238
+ t[o] = ar(
3239
+ o,
637
3240
  e,
638
3241
  t,
639
- o,
640
- l ? [].concat(l, n.message) : n.message
3242
+ a,
3243
+ c ? [].concat(c, n.message) : n.message
641
3244
  );
642
3245
  }
643
3246
  r.shift();
644
3247
  }
645
3248
  return t;
646
3249
  };
647
- function xr(r, e) {
648
- return Ze(
649
- async (t, n, o) => {
3250
+ function gn(r, e) {
3251
+ return Xt(
3252
+ async (t, n, a) => {
650
3253
  try {
651
- return await cr(r, t, e).parseAsync(t), {
3254
+ return await Jr(r, t, e).parseAsync(t), {
652
3255
  values: t,
653
3256
  errors: {}
654
3257
  };
655
3258
  } catch (s) {
656
- if (mr(s))
3259
+ if (Qr(s))
657
3260
  return {
658
3261
  values: {},
659
- errors: Xe(pr(s.errors, !0), o)
3262
+ errors: or(Xr(s.errors, !0), a)
660
3263
  };
661
3264
  throw s;
662
3265
  }
@@ -664,346 +3267,346 @@ function xr(r, e) {
664
3267
  [r, e]
665
3268
  );
666
3269
  }
667
- const G = (r, e) => r.level !== e.level ? r.level - e.level : r.isPrimitive ? 1 : -1, K = (r, e) => r.level !== e.level ? e.level - r.level : r.isPrimitive ? -1 : 1;
668
- function W(r, e, t) {
669
- T(r, e) === void 0 && t === void 0 || R(r, e, t);
670
- }
671
- function hr(r, e) {
672
- const t = M(r), n = e.filter((a) => a.inputPriority === "early"), o = e.filter((a) => a.inputPriority === "normal"), s = e.filter((a) => a.inputPriority === "late");
673
- return n.sort(G), o.sort(G), s.sort(G), [...n, ...o, ...s].forEach((a) => {
674
- if (a.inputTransform) {
675
- const c = w(a.inputTransform) ? a.inputTransform : [a.inputTransform];
676
- let l;
677
- const u = a.path.split(".");
678
- if (u.length > 1) {
679
- const d = u.slice(0, -1).join("."), f = T(t, d);
680
- typeof f == "string" || typeof f == "number" || typeof f == "boolean" ? l = void 0 : l = T(t, a.path);
3270
+ const je = (r, e) => r.level !== e.level ? r.level - e.level : r.isPrimitive ? 1 : -1, Ae = (r, e) => r.level !== e.level ? e.level - r.level : r.isPrimitive ? -1 : 1;
3271
+ function ve(r, e, t) {
3272
+ E(r, e) === void 0 && t === void 0 || M(r, e, t);
3273
+ }
3274
+ function Kr(r, e) {
3275
+ const t = le(r), n = e.filter((o) => o.inputPriority === "early"), a = e.filter((o) => o.inputPriority === "normal"), s = e.filter((o) => o.inputPriority === "late");
3276
+ return n.sort(je), a.sort(je), s.sort(je), [...n, ...a, ...s].forEach((o) => {
3277
+ if (o.inputTransform) {
3278
+ const u = J(o.inputTransform) ? o.inputTransform : [o.inputTransform];
3279
+ let c;
3280
+ const d = o.path.split(".");
3281
+ if (d.length > 1) {
3282
+ const y = d.slice(0, -1).join("."), h = E(t, y);
3283
+ typeof h == "string" || typeof h == "number" || typeof h == "boolean" ? c = void 0 : c = E(t, o.path);
681
3284
  } else
682
- l = T(t, a.path);
683
- c.forEach((d) => {
684
- const f = d(l, t);
685
- f && (l = f.value, W(t, f.path ?? a.path, f.value));
3285
+ c = E(t, o.path);
3286
+ u.forEach((y) => {
3287
+ const h = y(c, t);
3288
+ h && (c = h.value, ve(t, h.path ?? o.path, h.value));
686
3289
  });
687
3290
  }
688
3291
  }), t;
689
3292
  }
690
- function yr(r, e, t) {
691
- const n = e.filter((u) => u.outputPriority === "early"), o = e.filter((u) => u.outputPriority === "normal"), s = e.filter((u) => u.outputPriority === "late");
692
- n.sort(K), o.sort(K), s.sort(K);
693
- const i = [...n, ...o, ...s], a = [];
694
- let c = {};
695
- t || (c = M(r));
696
- const l = M(r);
697
- return i.forEach((u) => {
698
- if (u.outputTransform) {
699
- const d = w(u.outputTransform) ? u.outputTransform : [u.outputTransform];
700
- let f = T(l, u.path);
701
- d.forEach((m) => {
702
- const b = T(c, u.path), h = m(f, l, b, c);
703
- if (h)
704
- if (f = h.value, h.path) {
705
- if (h.merge) {
706
- const v = T(c, h.path);
707
- let y;
708
- v ? y = A({}, v, h.value) : y = h.value, W(c, h.path, y);
3293
+ function en(r, e, t) {
3294
+ const n = e.filter((d) => d.outputPriority === "early"), a = e.filter((d) => d.outputPriority === "normal"), s = e.filter((d) => d.outputPriority === "late");
3295
+ n.sort(Ae), a.sort(Ae), s.sort(Ae);
3296
+ const i = [...n, ...a, ...s], o = [];
3297
+ let u = {};
3298
+ t || (u = le(r));
3299
+ const c = le(r);
3300
+ return i.forEach((d) => {
3301
+ if (d.outputTransform) {
3302
+ const y = J(d.outputTransform) ? d.outputTransform : [d.outputTransform];
3303
+ let h = E(c, d.path);
3304
+ y.forEach((v) => {
3305
+ const S = E(u, d.path), w = v(h, c, S, u);
3306
+ if (w)
3307
+ if (h = w.value, w.path) {
3308
+ if (w.merge) {
3309
+ const R = E(u, w.path);
3310
+ let T;
3311
+ R ? T = oe({}, R, w.value) : T = w.value, ve(u, w.path, T);
709
3312
  } else
710
- W(c, h.path, h.value);
711
- h.unset && a.push(u.path);
3313
+ ve(u, w.path, w.value);
3314
+ w.unset && o.push(d.path);
712
3315
  } else
713
- W(c, u.path, h.value);
3316
+ ve(u, d.path, w.value);
714
3317
  });
715
3318
  }
716
- }), a.forEach((u) => {
717
- ve(c, u);
718
- }), c;
3319
+ }), o.forEach((d) => {
3320
+ Tt(u, d);
3321
+ }), u;
719
3322
  }
720
- function z(r) {
721
- return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...z(n.inputs)] : [...t, n], []);
3323
+ function ze(r) {
3324
+ return r.reduce((t, n) => Array.isArray(n.inputs) ? [...t, n, ...ze(n.inputs)] : [...t, n], []);
722
3325
  }
723
- const gr = (r) => {
3326
+ const tn = (r) => {
724
3327
  if (r !== void 0)
725
3328
  return { value: r };
726
- }, br = (r) => {
3329
+ }, rn = (r) => {
727
3330
  if (r !== void 0)
728
3331
  return { value: r };
729
3332
  };
730
- function Re(r, e) {
731
- return z(r.inputs).reduce((o, s) => {
732
- var f, m;
733
- const i = s.inputType === "text" || s.inputType === "boolean" || s.inputType === "number" || s.inputType === "textarea" || s.inputType === "select", a = !!s.inputTransform, c = !!s.outputTransform, l = Array.isArray(s.inputs) && s.inputs.length > 0, u = s.inputType === "list" || s.inputType === "array";
734
- return a || c ? o.push({
3333
+ function Pt(r, e) {
3334
+ return ze(r.inputs).reduce((a, s) => {
3335
+ var h, v;
3336
+ const i = s.inputType === "text" || s.inputType === "boolean" || s.inputType === "number" || s.inputType === "textarea" || s.inputType === "select", o = !!s.inputTransform, u = !!s.outputTransform, c = Array.isArray(s.inputs) && s.inputs.length > 0, d = s.inputType === "list" || s.inputType === "array";
3337
+ return o || u ? a.push({
735
3338
  path: s.path,
736
3339
  inputTransform: s.inputTransform,
737
3340
  outputTransform: s.outputTransform,
738
3341
  level: s.path.split(".").length,
739
3342
  isPrimitive: i,
740
- inputPriority: ((f = s.transformerPriority) == null ? void 0 : f.input) ?? "normal",
741
- outputPriority: ((m = s.transformerPriority) == null ? void 0 : m.output) ?? "normal"
742
- }) : e && !(l || u) && o.push({
3343
+ inputPriority: ((h = s.transformerPriority) == null ? void 0 : h.input) ?? "normal",
3344
+ outputPriority: ((v = s.transformerPriority) == null ? void 0 : v.output) ?? "normal"
3345
+ }) : e && !(c || d) && a.push({
743
3346
  path: s.path,
744
- inputTransform: gr,
745
- outputTransform: br,
3347
+ inputTransform: tn,
3348
+ outputTransform: rn,
746
3349
  level: s.path.split(".").length,
747
3350
  isPrimitive: i,
748
3351
  inputPriority: "normal",
749
3352
  outputPriority: "normal"
750
- }), o;
3353
+ }), a;
751
3354
  }, []);
752
3355
  }
753
- function vr(r, e, t, n = {}) {
754
- const { preserve: o } = n, s = z(r.inputs), i = M(e);
755
- return s.forEach((a) => {
756
- o && o.includes(a.path) || a.isVisible && !a.isVisible(e, t) && ve(i, a.path);
3356
+ function nn(r, e, t, n = {}) {
3357
+ const { preserve: a } = n, s = ze(r.inputs), i = le(e);
3358
+ return s.forEach((o) => {
3359
+ a && a.includes(o.path) || o.isVisible && !o.isVisible(e, t) && Tt(i, o.path);
757
3360
  }), i;
758
3361
  }
759
- function Fr(r, e) {
760
- const t = Re(e);
761
- return hr(r, t);
3362
+ function _n(r, e) {
3363
+ const t = Pt(e);
3364
+ return Kr(r, t);
762
3365
  }
763
- function qr(r, e, t, n = {}) {
764
- const o = n.cleanOutput, s = Re(e, o);
765
- let i = vr(e, r, t, n);
766
- return i = yr(i, s, n.cleanOutput), i = or(i), i;
3366
+ function vn(r, e, t, n = {}) {
3367
+ const a = n.cleanOutput, s = Pt(e, a);
3368
+ let i = nn(e, r, t, n);
3369
+ return i = en(i, s, n.cleanOutput), i = gr(i), i;
767
3370
  }
768
- function Ar(r) {
3371
+ function xn(r) {
769
3372
  const e = {}, t = (n) => {
770
- n.forEach((o) => {
771
- const { default: s, path: i, inputs: a } = o;
772
- Array.isArray(a) ? t(a) : s !== void 0 && R(e, i, s);
3373
+ n.forEach((a) => {
3374
+ const { default: s, path: i, inputs: o } = a;
3375
+ Array.isArray(o) ? t(o) : s !== void 0 && M(e, i, s);
773
3376
  });
774
3377
  };
775
3378
  return Array.isArray(r.inputs) && t(r.inputs), e;
776
3379
  }
777
- function kr() {
3380
+ function bn() {
778
3381
  return function(r, e) {
779
3382
  if (!(typeof r > "u"))
780
- return !r || !xe(r) ? { value: r } : {
3383
+ return !r || !qt(r) ? { value: r } : {
781
3384
  value: Object.getOwnPropertyNames(r).map((t) => ({ key: t, value: r[t] }))
782
3385
  };
783
3386
  };
784
3387
  }
785
- function Dr(r) {
3388
+ function kn(r) {
786
3389
  return function(e) {
787
3390
  if (typeof e > "u") return;
788
- if (!e || !w(e)) return { value: e };
3391
+ if (!e || !J(e)) return { value: e };
789
3392
  const t = {
790
- value: e.reduce((n, o) => ({
3393
+ value: e.reduce((n, a) => ({
791
3394
  ...n,
792
- [o.key]: r != null && r.assignKeyToValue ? o.key : o.value ?? (r == null ? void 0 : r.fallbackValue)
3395
+ [a.key]: r != null && r.assignKeyToValue ? a.key : a.value ?? (r == null ? void 0 : r.fallbackValue)
793
3396
  }), {})
794
3397
  };
795
3398
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
796
3399
  };
797
3400
  }
798
- function Mr() {
3401
+ function wn() {
799
3402
  return function(r) {
800
3403
  if (!(typeof r > "u"))
801
- return w(r) && J(r) ? { value: void 0 } : { value: r };
3404
+ return J(r) && Ce(r) ? { value: void 0 } : { value: r };
802
3405
  };
803
3406
  }
804
- function $r(r, e) {
805
- return function(t, n, o, s) {
3407
+ function Tn(r, e) {
3408
+ return function(t, n, a, s) {
806
3409
  let i;
807
- if (r ? i = T(e && s ? s : n, r) : i = e ? o : t, !(typeof i > "u")) {
808
- if (Te(i)) return { value: void 0, path: r };
809
- if (be(i)) {
810
- const a = we(M(i));
811
- return Object.getOwnPropertyNames(a).length === 0 ? { value: void 0, path: r } : void 0;
3410
+ if (r ? i = E(e && s ? s : n, r) : i = e ? a : t, !(typeof i > "u")) {
3411
+ if (Ct(i)) return { value: void 0, path: r };
3412
+ if (wt(i)) {
3413
+ const o = Mt(le(i));
3414
+ return Object.getOwnPropertyNames(o).length === 0 ? { value: void 0, path: r } : void 0;
812
3415
  }
813
3416
  return { value: i, path: r };
814
3417
  }
815
3418
  };
816
3419
  }
817
- function Nr() {
3420
+ function Cn() {
818
3421
  return function(r) {
819
3422
  if (!(typeof r > "u"))
820
- return Fe(r) && J(r) ? { value: void 0 } : { value: r };
3423
+ return zt(r) && Ce(r) ? { value: void 0 } : { value: r };
821
3424
  };
822
3425
  }
823
- function Br(r) {
3426
+ function On(r) {
824
3427
  return function(e, t) {
825
- const n = T(t, r);
3428
+ const n = E(t, r);
826
3429
  if (typeof n == "string")
827
3430
  return { value: n };
828
3431
  if (!(typeof n == "number" || typeof n == "boolean") && e !== void 0)
829
3432
  return { value: e };
830
3433
  };
831
3434
  }
832
- function Zr(r) {
833
- return function(e, t, n, o) {
3435
+ function Sn(r) {
3436
+ return function(e, t, n, a) {
834
3437
  if (typeof e > "u") return;
835
3438
  if (!e) return { value: e };
836
- const s = T(o || t, r);
3439
+ const s = E(a || t, r);
837
3440
  if (typeof s == "object") {
838
- const i = we(s);
3441
+ const i = Mt(s);
839
3442
  if (Object.getOwnPropertyNames(i).length === 1)
840
3443
  return { value: e, path: r };
841
3444
  }
842
3445
  return { value: e };
843
3446
  };
844
3447
  }
845
- function Wr(r) {
3448
+ function Rn(r) {
846
3449
  return function(e, t) {
847
- const n = T(t, r);
3450
+ const n = E(t, r);
848
3451
  if (typeof n == "string")
849
3452
  return { value: [n] };
850
3453
  if (!(typeof n == "number" || typeof n == "boolean") && e !== void 0)
851
3454
  return { value: e };
852
3455
  };
853
3456
  }
854
- function Jr(r, e) {
3457
+ function En(r, e) {
855
3458
  return function(t, n) {
856
3459
  if (typeof t > "u") return;
857
3460
  if (!t) return { value: t };
858
- const o = T(n, r);
859
- if (w(o)) {
860
- if (o.length === 1)
861
- return { value: o[0], path: r };
862
- if (o.length === 0 && e != null && e.unsetIfEmpty)
3461
+ const a = E(n, r);
3462
+ if (J(a)) {
3463
+ if (a.length === 1)
3464
+ return { value: a[0], path: r };
3465
+ if (a.length === 0 && e != null && e.unsetIfEmpty)
863
3466
  return { value: void 0, path: r };
864
3467
  }
865
3468
  return { value: t };
866
3469
  };
867
3470
  }
868
- function Ie(r) {
869
- return Ae(r) ? !0 : w(r) ? r.length === 0 : typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !Ie(r[e])) : L(r);
3471
+ function $t(r) {
3472
+ return Ut(r) ? !0 : J(r) ? r.length === 0 : typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !$t(r[e])) : Oe(r);
870
3473
  }
871
- function we(r) {
872
- return qe(r, (e) => typeof e == "object" ? Ie(e) : L(e));
3474
+ function Mt(r) {
3475
+ return Bt(r, (e) => typeof e == "object" ? $t(e) : Oe(e));
873
3476
  }
874
- function X(r) {
875
- const { items: e, className: t, withoutWrapper: n = !0, ...o } = r, s = e.map((i) => /* @__PURE__ */ g.jsx(ir, { input: i, path: i.path, ...o }, `${i.inputType}_${i.path}`));
876
- return n ? /* @__PURE__ */ g.jsx(g.Fragment, { children: s }) : /* @__PURE__ */ g.jsx("div", { className: t, children: s });
3477
+ function De(r) {
3478
+ const { items: e, className: t, withoutWrapper: n = !0, ...a } = r, s = e.map((i) => /* @__PURE__ */ O.jsx(pr, { input: i, path: i.path, ...a }, `${i.inputType}_${i.path}`));
3479
+ return n ? /* @__PURE__ */ O.jsx(O.Fragment, { children: s }) : /* @__PURE__ */ O.jsx("div", { className: t, children: s });
877
3480
  }
878
- X.displayName = "RenderInputs";
879
- const Tr = We((r, e) => {
880
- const { inputs: t, className: n, factory: o, withoutWrapper: s } = r;
881
- return s ? /* @__PURE__ */ g.jsxs(Je, { children: [
3481
+ De.displayName = "RenderInputs";
3482
+ const sn = Kt((r, e) => {
3483
+ const { inputs: t, className: n, factory: a, withoutWrapper: s } = r;
3484
+ return s ? /* @__PURE__ */ O.jsxs(er, { children: [
882
3485
  t.hero,
883
- /* @__PURE__ */ g.jsx(X, { items: t.inputs, factory: o })
884
- ] }) : /* @__PURE__ */ g.jsxs("div", { className: n, ref: e, children: [
3486
+ /* @__PURE__ */ O.jsx(De, { items: t.inputs, factory: a })
3487
+ ] }) : /* @__PURE__ */ O.jsxs("div", { className: n, ref: e, children: [
885
3488
  t.hero,
886
- /* @__PURE__ */ g.jsx(X, { items: t.inputs, factory: o })
3489
+ /* @__PURE__ */ O.jsx(De, { items: t.inputs, factory: a })
887
3490
  ] });
888
3491
  });
889
- Tr.displayName = "RenderForm";
890
- function Lr(r) {
3492
+ sn.displayName = "RenderForm";
3493
+ function jn(r) {
891
3494
  let e = !0;
892
- return ge(r, (t) => {
893
- e = e && (t === "" || Te(t) || L(t));
3495
+ return kt(r, (t) => {
3496
+ e = e && (t === "" || Ct(t) || Oe(t));
894
3497
  }), e;
895
3498
  }
896
- const Ur = (r = "") => ke(r.split("_").join(" ")), Cr = (r, e = 2, t, n = 1e3) => {
897
- let o = !1;
3499
+ const An = (r = "") => Wt(r.split("_").join(" ")), an = (r, e = 2, t, n = 1e3) => {
3500
+ let a = !1;
898
3501
  const s = () => {
899
3502
  requestAnimationFrame(() => {
900
- o || (e -= 1, e <= 0 ? r() : s());
3503
+ a || (e -= 1, e <= 0 ? r() : s());
901
3504
  });
902
3505
  };
903
3506
  return t && Date.now() - t <= n ? (r(), () => {
904
3507
  }) : (s(), () => {
905
- o = !0;
3508
+ a = !0;
906
3509
  });
907
3510
  };
908
- function Hr(r, e) {
3511
+ function In(r, e) {
909
3512
  return {
910
3513
  ...r,
911
- inputs: r.inputs.map((t) => I(t, e))
3514
+ inputs: r.inputs.map((t) => D(t, e))
912
3515
  };
913
3516
  }
914
- function I(r, e) {
915
- var c, l, u;
916
- const { override: t, ...n } = r, o = e && t ? t[e] : void 0, { inputConfig: s, ...i } = o || {}, a = o ? { ...n, ...i } : n;
917
- if ((n.inputConfig || s) && (a.inputConfig = { ...n.inputConfig, ...s }), a.inputs && (a.inputs = a.inputs.map((d) => I(d, e))), a.inputType === "list" && a.inputConfig) {
918
- const d = ((c = n.inputConfig) == null ? void 0 : c.inputs) || [], f = (s == null ? void 0 : s.inputs) || [];
919
- if (d.length > 0 || f.length > 0) {
920
- const m = Math.max(d.length, f.length);
921
- a.inputConfig.inputs = Array.from({ length: m }, (b, h) => {
922
- var E;
923
- const v = d[h], y = f[h];
924
- if (!v && y) return I(y, e);
925
- if (v && !y) return I(v, e);
926
- if (v && y) {
927
- const S = v.override ? { ...v.override } : {};
928
- return e && y && (S[e] = (E = v.override) != null && E[e] ? { ...v.override[e], ...y } : y), I({ ...v, override: S }, e);
3517
+ function D(r, e) {
3518
+ var u, c, d;
3519
+ const { override: t, ...n } = r, a = e && t ? t[e] : void 0, { inputConfig: s, ...i } = a || {}, o = a ? { ...n, ...i } : n;
3520
+ if ((n.inputConfig || s) && (o.inputConfig = { ...n.inputConfig, ...s }), o.inputs && (o.inputs = o.inputs.map((y) => D(y, e))), o.inputType === "list" && o.inputConfig) {
3521
+ const y = ((u = n.inputConfig) == null ? void 0 : u.inputs) || [], h = (s == null ? void 0 : s.inputs) || [];
3522
+ if (y.length > 0 || h.length > 0) {
3523
+ const v = Math.max(y.length, h.length);
3524
+ o.inputConfig.inputs = Array.from({ length: v }, (S, w) => {
3525
+ var V;
3526
+ const R = y[w], T = h[w];
3527
+ if (!R && T) return D(T, e);
3528
+ if (R && !T) return D(R, e);
3529
+ if (R && T) {
3530
+ const Z = R.override ? { ...R.override } : {};
3531
+ return e && T && (Z[e] = (V = R.override) != null && V[e] ? { ...R.override[e], ...T } : T), D({ ...R, override: Z }, e);
929
3532
  }
930
3533
  }).filter(Boolean);
931
- } else a.inputConfig.inputs && (a.inputConfig.inputs = a.inputConfig.inputs.map(
932
- (m) => I(m, e)
3534
+ } else o.inputConfig.inputs && (o.inputConfig.inputs = o.inputConfig.inputs.map(
3535
+ (v) => D(v, e)
933
3536
  ));
934
3537
  }
935
- if (a.inputType === "array" && a.inputConfig) {
936
- const d = (l = n.inputConfig) == null ? void 0 : l.input, f = s == null ? void 0 : s.input;
937
- if (d && f) {
938
- const m = d.override ? { ...d.override } : {};
939
- e && f && (m[e] = (u = d.override) != null && u[e] ? { ...d.override[e], ...f } : f), a.inputConfig.input = I(
940
- { ...d, override: m },
3538
+ if (o.inputType === "array" && o.inputConfig) {
3539
+ const y = (c = n.inputConfig) == null ? void 0 : c.input, h = s == null ? void 0 : s.input;
3540
+ if (y && h) {
3541
+ const v = y.override ? { ...y.override } : {};
3542
+ e && h && (v[e] = (d = y.override) != null && d[e] ? { ...y.override[e], ...h } : h), o.inputConfig.input = D(
3543
+ { ...y, override: v },
941
3544
  e
942
3545
  );
943
- } else a.inputConfig.input && (a.inputConfig.input = I(a.inputConfig.input, e));
3546
+ } else o.inputConfig.input && (o.inputConfig.input = D(o.inputConfig.input, e));
944
3547
  }
945
- return a;
3548
+ return o;
946
3549
  }
947
- function Gr(r) {
3550
+ function Nn(r) {
948
3551
  const {
949
3552
  field: { onBlur: e, ...t },
950
3553
  ...n
951
- } = Qe(r), o = P(Date.now());
3554
+ } = ir(r), a = G(Date.now());
952
3555
  return {
953
3556
  ...n,
954
3557
  field: {
955
3558
  ...t,
956
- onBlur: Cr(e, 2, o.current)
3559
+ onBlur: an(e, 2, a.current)
957
3560
  }
958
3561
  };
959
3562
  }
960
3563
  export {
961
- Xr as Controller,
962
- Yr as Form,
963
- zr as FormProvider,
964
- Ir as InputComponent,
965
- ir as InputComponentRenderer,
966
- Ce as InputFactory,
967
- Ye as InputOverrideError,
968
- Tr as RenderForm,
969
- X as RenderInputs,
970
- wr as RootForm,
971
- Cr as afterFrames,
972
- Hr as applyFormOverrides,
973
- I as applyInputOverride,
974
- Dr as arrayToObjectOutputTransformer,
975
- Ar as collectDefaultValues,
976
- Fr as convertDataToFormModel,
977
- qr as convertFormModelToData,
978
- Ur as generateReadableLabel,
979
- et as get,
980
- Vr as getDefaultValuesFromFormDefinition,
981
- Pr as getTemporaryPath,
982
- Re as getTransformers,
983
- cr as getValidationSchema,
984
- hr as inputTransformValues,
985
- Lr as isChildrenEmpty,
986
- kr as objectToArrayInputTransformer,
987
- yr as outputTransformValues,
988
- jr as overrideFormDefinition,
989
- k as processValidationParseResponse,
990
- or as removeTemporaryFieldsValue,
991
- rt as set,
992
- Wr as shorthandArrayInputTransformer,
993
- Jr as shorthandArrayOutputTransformer,
994
- Br as shorthandObjectInputTransformer,
995
- Zr as shorthandObjectOutputTransformer,
996
- Mr as unsetEmptyArrayOutputTransformer,
997
- $r as unsetEmptyObjectOutputTransformer,
998
- Nr as unsetEmptyStringOutputTransformer,
999
- vr as unsetHiddenInputsValues,
1000
- Gr as useController,
1001
- tt as useFieldArray,
1002
- nt as useForm,
1003
- st as useFormContext,
1004
- it as useFormState,
1005
- nr as useRootFormContext,
1006
- at as useWatch,
1007
- xr as useZodValidationResolver
3564
+ Pn as Controller,
3565
+ $n as Form,
3566
+ Mn as FormProvider,
3567
+ fn as InputComponent,
3568
+ pr as InputComponentRenderer,
3569
+ Ot as InputFactory,
3570
+ ur as InputOverrideError,
3571
+ sn as RenderForm,
3572
+ De as RenderInputs,
3573
+ hn as RootForm,
3574
+ an as afterFrames,
3575
+ In as applyFormOverrides,
3576
+ D as applyInputOverride,
3577
+ kn as arrayToObjectOutputTransformer,
3578
+ xn as collectDefaultValues,
3579
+ _n as convertDataToFormModel,
3580
+ vn as convertFormModelToData,
3581
+ An as generateReadableLabel,
3582
+ Fn as get,
3583
+ mn as getDefaultValuesFromFormDefinition,
3584
+ yn as getTemporaryPath,
3585
+ Pt as getTransformers,
3586
+ Jr as getValidationSchema,
3587
+ Kr as inputTransformValues,
3588
+ jn as isChildrenEmpty,
3589
+ bn as objectToArrayInputTransformer,
3590
+ en as outputTransformValues,
3591
+ pn as overrideFormDefinition,
3592
+ ce as processValidationParseResponse,
3593
+ gr as removeTemporaryFieldsValue,
3594
+ Dn as set,
3595
+ Rn as shorthandArrayInputTransformer,
3596
+ En as shorthandArrayOutputTransformer,
3597
+ On as shorthandObjectInputTransformer,
3598
+ Sn as shorthandObjectOutputTransformer,
3599
+ wn as unsetEmptyArrayOutputTransformer,
3600
+ Tn as unsetEmptyObjectOutputTransformer,
3601
+ Cn as unsetEmptyStringOutputTransformer,
3602
+ nn as unsetHiddenInputsValues,
3603
+ Nn as useController,
3604
+ Ln as useFieldArray,
3605
+ qn as useForm,
3606
+ zn as useFormContext,
3607
+ Bn as useFormState,
3608
+ hr as useRootFormContext,
3609
+ Un as useWatch,
3610
+ gn as useZodValidationResolver
1008
3611
  };
1009
3612
  //# sourceMappingURL=index.js.map