@harnessio/forms 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- var ye = Object.defineProperty;
2
- var ge = (r, e, n) => e in r ? ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
- var x = (r, e, n) => ge(r, typeof e != "symbol" ? e + "" : e, n);
4
- import { isEmpty as V, cloneDeep as A, set as g, get as E, forOwn as ne, isArray as j, isObject as se, merge as F, isUndefined as k, unset as ae, pick as be, isNull as oe, omitBy as ue, isNil as ve, isString as Ee, capitalize as _e } from "lodash-es";
5
- import Te, { createContext as Re, useContext as Se, Component as Oe, useMemo as M, useRef as Z, useEffect as C, useCallback as je, forwardRef as Ce, Fragment as Ie } from "react";
6
- import { useFormContext as Ve, get as we, useForm as xe, FormProvider as Fe, appendErrors as Pe, useController as qe } from "react-hook-form";
7
- export * from "react-hook-form";
1
+ var Ce = Object.defineProperty;
2
+ var we = (r, e, n) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var A = (r, e, n) => we(r, typeof e != "symbol" ? e + "" : e, n);
4
+ import { isEmpty as q, set as b, get as E, forOwn as me, isArray as w, isObject as he, merge as N, isUndefined as B, cloneDeep as H, unset as pe, pick as Ie, isNull as ye, omitBy as ge, isNil as Oe, isString as je, capitalize as Ve } from "lodash-es";
5
+ import xe, { createContext as Fe, useContext as Pe, Component as qe, memo as ke, useMemo as D, useRef as M, useEffect as F, useCallback as Ae, forwardRef as Ne, Fragment as De } from "react";
6
+ import { useFormContext as Me, get as $e, useForm as Ze, FormProvider as Be, appendErrors as Je, useController as Ue } from "react-hook-form";
7
+ import { Controller as Br, Form as Jr, FormProvider as Ur, get as Wr, set as Lr, useFieldArray as Hr, useForm as Gr, useFormContext as Kr, useFormState as Qr, useWatch as Xr } from "react-hook-form";
8
8
  import * as l from "zod";
9
- import { toNestErrors as Ae } from "@hookform/resolvers";
10
- class ke extends Error {
9
+ import { toNestErrors as We } from "@hookform/resolvers";
10
+ class Le extends Error {
11
11
  constructor(e) {
12
12
  super(`Input component '${e}' is already registered.`);
13
13
  }
14
14
  }
15
- class ie {
15
+ class be {
16
16
  constructor(e) {
17
- x(this, "componentBank");
18
- x(this, "allowOverride");
17
+ A(this, "componentBank");
18
+ A(this, "allowOverride");
19
19
  this.allowOverride = (e == null ? void 0 : e.allowOverride) ?? !1, this.componentBank = /* @__PURE__ */ new Map();
20
20
  }
21
21
  /**
@@ -26,11 +26,11 @@ class ie {
26
26
  */
27
27
  registerComponent(e) {
28
28
  if (!this.allowOverride && this.getComponent(e.internalType))
29
- throw new ke(e.internalType);
29
+ throw new Le(e.internalType);
30
30
  this.componentBank.set(e.internalType, e);
31
31
  }
32
32
  getComponent(e) {
33
- if (e && !V(e))
33
+ if (e && !q(e))
34
34
  return this.componentBank.get(e);
35
35
  }
36
36
  /**
@@ -47,7 +47,7 @@ class ie {
47
47
  * @returns new input factory
48
48
  */
49
49
  clone() {
50
- const e = new ie({
50
+ const e = new be({
51
51
  allowOverride: this.allowOverride
52
52
  });
53
53
  return this.listRegisteredComponents().forEach((n) => {
@@ -55,16 +55,16 @@ class ie {
55
55
  }), e;
56
56
  }
57
57
  }
58
- var $ = { exports: {} }, O = {};
58
+ var J = { exports: {} }, C = {};
59
59
  /*
60
60
  object-assign
61
61
  (c) Sindre Sorhus
62
62
  @license MIT
63
63
  */
64
- var B, X;
65
- function Ne() {
66
- if (X) return B;
67
- X = 1;
64
+ var U, oe;
65
+ function He() {
66
+ if (oe) return U;
67
+ oe = 1;
68
68
  var r = Object.getOwnPropertySymbols, e = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
69
69
  function t(s) {
70
70
  if (s == null)
@@ -78,34 +78,34 @@ function Ne() {
78
78
  var s = new String("abc");
79
79
  if (s[5] = "de", Object.getOwnPropertyNames(s)[0] === "5")
80
80
  return !1;
81
- for (var i = {}, o = 0; o < 10; o++)
82
- i["_" + String.fromCharCode(o)] = o;
83
- var u = Object.getOwnPropertyNames(i).map(function(f) {
84
- return i[f];
81
+ for (var o = {}, u = 0; u < 10; u++)
82
+ o["_" + String.fromCharCode(u)] = u;
83
+ var i = Object.getOwnPropertyNames(o).map(function(c) {
84
+ return o[c];
85
85
  });
86
- if (u.join("") !== "0123456789")
86
+ if (i.join("") !== "0123456789")
87
87
  return !1;
88
- var c = {};
89
- return "abcdefghijklmnopqrst".split("").forEach(function(f) {
90
- c[f] = f;
91
- }), Object.keys(Object.assign({}, c)).join("") === "abcdefghijklmnopqrst";
88
+ var f = {};
89
+ return "abcdefghijklmnopqrst".split("").forEach(function(c) {
90
+ f[c] = c;
91
+ }), Object.keys(Object.assign({}, f)).join("") === "abcdefghijklmnopqrst";
92
92
  } catch {
93
93
  return !1;
94
94
  }
95
95
  }
96
- return B = a() ? Object.assign : function(s, i) {
97
- for (var o, u = t(s), c, f = 1; f < arguments.length; f++) {
98
- o = Object(arguments[f]);
99
- for (var m in o)
100
- e.call(o, m) && (u[m] = o[m]);
96
+ return U = a() ? Object.assign : function(s, o) {
97
+ for (var u, i = t(s), f, c = 1; c < arguments.length; c++) {
98
+ u = Object(arguments[c]);
99
+ for (var m in u)
100
+ e.call(u, m) && (i[m] = u[m]);
101
101
  if (r) {
102
- c = r(o);
103
- for (var d = 0; d < c.length; d++)
104
- n.call(o, c[d]) && (u[c[d]] = o[c[d]]);
102
+ f = r(u);
103
+ for (var d = 0; d < f.length; d++)
104
+ n.call(u, f[d]) && (i[f[d]] = u[f[d]]);
105
105
  }
106
106
  }
107
- return u;
108
- }, B;
107
+ return i;
108
+ }, U;
109
109
  }
110
110
  /** @license React v17.0.2
111
111
  * react-jsx-runtime.production.min.js
@@ -115,39 +115,39 @@ function Ne() {
115
115
  * This source code is licensed under the MIT license found in the
116
116
  * LICENSE file in the root directory of this source tree.
117
117
  */
118
- var Y;
119
- function De() {
120
- if (Y) return O;
121
- Y = 1, Ne();
122
- var r = Te, e = 60103;
123
- if (O.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
118
+ var ue;
119
+ function Ge() {
120
+ if (ue) return C;
121
+ ue = 1, He();
122
+ var r = xe, e = 60103;
123
+ if (C.Fragment = 60107, typeof Symbol == "function" && Symbol.for) {
124
124
  var n = Symbol.for;
125
- e = n("react.element"), O.Fragment = n("react.fragment");
125
+ e = n("react.element"), C.Fragment = n("react.fragment");
126
126
  }
127
127
  var t = 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 };
128
- function i(o, u, c) {
129
- var f, m = {}, d = null, h = null;
130
- c !== void 0 && (d = "" + c), u.key !== void 0 && (d = "" + u.key), u.ref !== void 0 && (h = u.ref);
131
- for (f in u) a.call(u, f) && !s.hasOwnProperty(f) && (m[f] = u[f]);
132
- if (o && o.defaultProps) for (f in u = o.defaultProps, u) m[f] === void 0 && (m[f] = u[f]);
133
- return { $$typeof: e, type: o, key: d, ref: h, props: m, _owner: t.current };
128
+ function o(u, i, f) {
129
+ var c, m = {}, d = null, h = null;
130
+ f !== void 0 && (d = "" + f), i.key !== void 0 && (d = "" + i.key), i.ref !== void 0 && (h = i.ref);
131
+ for (c in i) a.call(i, c) && !s.hasOwnProperty(c) && (m[c] = i[c]);
132
+ if (u && u.defaultProps) for (c in i = u.defaultProps, i) m[c] === void 0 && (m[c] = i[c]);
133
+ return { $$typeof: e, type: u, key: d, ref: h, props: m, _owner: t.current };
134
134
  }
135
- return O.jsx = i, O.jsxs = i, O;
135
+ return C.jsx = o, C.jsxs = o, C;
136
136
  }
137
- var z;
138
- function Me() {
139
- return z || (z = 1, $.exports = De()), $.exports;
137
+ var ie;
138
+ function Ke() {
139
+ return ie || (ie = 1, J.exports = Ge()), J.exports;
140
140
  }
141
- var p = Me();
142
- const ce = Re({});
143
- function Ze({
141
+ var p = Ke();
142
+ const ve = Fe({});
143
+ function Qe({
144
144
  children: r,
145
145
  metadata: e,
146
146
  inputErrorHandler: n,
147
147
  readonly: t
148
148
  }) {
149
149
  return /* @__PURE__ */ p.jsx(
150
- ce.Provider,
150
+ ve.Provider,
151
151
  {
152
152
  value: {
153
153
  metadata: e,
@@ -158,89 +158,104 @@ function Ze({
158
158
  }
159
159
  );
160
160
  }
161
- function $e() {
162
- const r = Se(ce);
161
+ function Xe() {
162
+ const r = Pe(ve);
163
163
  return r || console.warn("useRootFormContext must be used within RootFormProvider"), r;
164
164
  }
165
- class Be extends Oe {
165
+ class Ye extends qe {
166
166
  constructor() {
167
167
  super(...arguments);
168
- x(this, "state", {
168
+ A(this, "state", {
169
169
  hasError: !1
170
170
  });
171
171
  }
172
172
  static getDerivedStateFromError() {
173
173
  return { hasError: !0 };
174
174
  }
175
- componentDidCatch() {
176
- const n = new Error(`Form input [${this.props.inputType}] has failed at path [${this.props.path}].`);
177
- this.props.inputErrorHandler ? this.props.inputErrorHandler(n) : console.error(n);
175
+ componentDidCatch(n, t) {
176
+ var s, o;
177
+ console.error(n, t);
178
+ const a = new Error(
179
+ `Form input [${this.props.inputType}] has failed at path [${this.props.path}]. Error: ${n}, Error info: ${t}`
180
+ );
181
+ (o = (s = this.props).inputErrorHandler) == null || o.call(s, a);
178
182
  }
179
183
  render() {
180
184
  return this.state.hasError ? /* @__PURE__ */ p.jsx(p.Fragment, {}) : this.props.children;
181
185
  }
182
186
  }
183
- const ee = ({
187
+ const ce = ({
184
188
  children: r,
185
189
  withoutWrapper: e = !1
186
- }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r });
187
- function Je({
188
- path: r,
189
- factory: e,
190
- onUpdate: n,
191
- onChange: t,
192
- initialValues: a,
193
- input: s,
194
- withoutWrapper: i = !1
190
+ }) => e || !r ? r : /* @__PURE__ */ p.jsx("div", { children: r }), ze = ke(function({
191
+ path: e,
192
+ factory: n,
193
+ onUpdate: t,
194
+ onChange: a,
195
+ initialValues: s,
196
+ input: o,
197
+ withoutWrapper: u = !1
195
198
  }) {
196
- var H;
197
- const { formState: o, watch: u } = Ve(), {
198
- fixedValues: c = {}
199
- /*getValuesWithDependencies*/
200
- } = {}, { metadata: f, readonly: m, inputErrorHandler: d } = $e(), h = e == null ? void 0 : e.getComponent(s.inputType), b = u(), y = A(b);
201
- c && Object.keys(c).forEach((w) => {
202
- const N = c[w];
203
- g(y, w, N);
204
- });
205
- const _ = !s.isVisible || s.isVisible(y, f);
206
- let T, S;
207
- _ && (T = m || s.readonly, S = typeof s.disabled == "function" ? s.disabled(y, f) : s.disabled);
208
- const R = (H = s.warning) == null ? void 0 : H.schema, v = M(() => {
209
- var K, Q;
210
- if (!_ || typeof R > "u") return;
211
- const w = we(b, s.path), N = typeof R == "function" ? R(y) : R, { success: pe, error: D } = N.safeParse(w), G = (Q = (K = D == null ? void 0 : D.errors) == null ? void 0 : K[0]) == null ? void 0 : Q.message;
212
- return !pe && G ? G : void 0;
213
- }, [s.path, b, R, _]), W = M(
199
+ var Y, z, ee, re, te;
200
+ const i = Me(), { formState: f } = i, { fixedValues: c = {} } = {}, { metadata: m, readonly: d, inputErrorHandler: h } = Xe(), y = n == null ? void 0 : n.getComponent(o.inputType), g = !!(o.isVisible || typeof o.disabled == "function" || typeof ((Y = o.validation) == null ? void 0 : Y.schema) == "function" || typeof ((z = o.warning) == null ? void 0 : z.schema) == "function"), I = !!((ee = o.warning) != null && ee.schema || (re = o.validation) != null && re.schema), R = g ? i.watch() : {}, O = I ? g ? $e(R, o.path) : i.watch(o.path) : void 0, T = D(() => {
201
+ if (!g) return {};
202
+ let V = R;
203
+ return c && Object.keys(c).forEach((k) => {
204
+ const x = c[k];
205
+ V = b(V, k, x);
206
+ }), V;
207
+ }, [g, R, c]), v = !o.isVisible || o.isVisible(T, m), _ = d || o.readonly, S = typeof o.disabled == "function" ? o.disabled(T, m) : o.disabled, j = (te = o.warning) == null ? void 0 : te.schema, Q = D(() => {
208
+ var se, ae;
209
+ if (!v || typeof j > "u") return;
210
+ const V = typeof j == "function" ? j(T) : j, { success: k, error: x } = V.safeParse(O), ne = (ae = (se = x == null ? void 0 : x.errors) == null ? void 0 : se[0]) == null ? void 0 : ae.message;
211
+ return !k && ne ? ne : void 0;
212
+ }, [o.path, O, j, v]), X = D(
214
213
  () => ({
215
- path: r,
216
- key: r,
217
- initialValues: a,
218
- onUpdate: n,
219
- onChange: t,
220
- factory: e,
221
- readonly: T,
222
- input: s,
214
+ path: e,
215
+ key: e,
216
+ initialValues: s,
217
+ onUpdate: t,
218
+ onChange: a,
219
+ factory: n,
220
+ readonly: _,
221
+ input: o,
223
222
  disabled: S,
224
- warning: v
223
+ warning: Q
225
224
  }),
226
- [e, a, s, t, n, r, T, o.errors, S, v]
227
- ), he = M(() => _ ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
228
- s.before ? s.before : null,
229
- /* @__PURE__ */ p.jsx(Be, { path: r, inputType: s.inputType, inputErrorHandler: d, children: h == null ? void 0 : h.renderComponent(W) }),
230
- s.after ? s.after : null
231
- ] }) : null, [_, s.before, s.inputType, s.after, r, h, W, o.errors]);
232
- return h ? /* @__PURE__ */ p.jsx(ee, { withoutWrapper: i, children: he }) : /* @__PURE__ */ p.jsx(ee, { withoutWrapper: i, children: /* @__PURE__ */ p.jsxs("p", { children: [
225
+ [n, s, o, a, t, e, _, f.errors, S, Q]
226
+ ), Se = D(() => v ? /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
227
+ o.before ? o.before : null,
228
+ /* @__PURE__ */ p.jsx(Ye, { path: e, inputType: o.inputType, inputErrorHandler: h, children: y == null ? void 0 : y.renderComponent(X) }),
229
+ o.after ? o.after : null
230
+ ] }) : null, [v, o.before, o.inputType, o.after, e, y, X, f.errors]);
231
+ return y ? /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: Se }) : /* @__PURE__ */ p.jsx(ce, { withoutWrapper: u, children: /* @__PURE__ */ p.jsxs("p", { children: [
233
232
  "Input component not found (internal type: ",
234
- s.inputType,
233
+ o.inputType,
235
234
  ")"
236
235
  ] }) });
237
- }
238
- class cr {
236
+ });
237
+ class vr {
239
238
  getType() {
240
239
  return this.internalType;
241
240
  }
242
241
  }
243
- function fr(r) {
242
+ function fe() {
243
+ return typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback : function(r, e) {
244
+ const n = Date.now(), t = (e == null ? void 0 : e.timeout) || 1;
245
+ return setTimeout(function() {
246
+ r({
247
+ didTimeout: !1,
248
+ timeRemaining: function() {
249
+ return Math.max(0, 50 - (Date.now() - n));
250
+ }
251
+ });
252
+ }, t);
253
+ };
254
+ }
255
+ function le() {
256
+ return typeof window < "u" && "cancelIdleCallback" in window ? window.cancelIdleCallback : clearTimeout;
257
+ }
258
+ function Er(r) {
244
259
  const {
245
260
  mode: e = "onSubmit",
246
261
  resolver: n,
@@ -248,28 +263,28 @@ function fr(r) {
248
263
  shouldFocusError: a,
249
264
  // validateAfterFirstSubmit,
250
265
  onValuesChange: s,
251
- onValidationChange: i,
252
- onSubmit: o,
253
- onInputRenderError: u,
266
+ onValidationChange: o,
267
+ onSubmit: u,
268
+ onInputRenderError: i,
254
269
  // validate,
255
270
  // validateDebounceInterval,
256
271
  // validationConfig,
257
- metadata: c,
258
- children: f,
272
+ metadata: f,
273
+ children: c,
259
274
  // fixedValues
260
275
  autoFocusPath: m,
261
276
  readonly: d
262
- } = r, h = xe({
277
+ } = r, h = Ze({
263
278
  mode: e ?? "onSubmit",
264
279
  reValidateMode: "onChange",
265
280
  defaultValues: t,
266
281
  shouldFocusError: a,
267
282
  resolver: n
268
- }), b = Z(!1);
269
- C(() => {
283
+ }), y = M(!1);
284
+ F(() => {
270
285
  h.reset(t, {});
271
- }, [h.reset, t]), C(() => {
272
- const v = requestIdleCallback(() => {
286
+ }, [h.reset, t]), F(() => {
287
+ const v = fe(), _ = le(), S = v(() => {
273
288
  h.reset({}, {
274
289
  keepErrors: !0,
275
290
  keepDirty: !0,
@@ -283,155 +298,157 @@ function fr(r) {
283
298
  keepSubmitCount: !0
284
299
  });
285
300
  });
286
- return () => cancelIdleCallback(v);
301
+ return () => _(S);
287
302
  }, []);
288
- const { getValues: y, handleSubmit: _ } = h, T = y(), S = Z(!0);
289
- C(() => {
290
- if (S.current) {
291
- S.current = !1;
303
+ const { getValues: g, handleSubmit: I } = h, R = g(), O = M(!0);
304
+ F(() => {
305
+ if (O.current) {
306
+ O.current = !1;
292
307
  return;
293
308
  }
294
- s == null || s({ ...T }), b.current === !0 && h.trigger();
295
- }, [JSON.stringify(T)]);
296
- const R = Z(!0);
297
- return C(() => {
298
- if (R.current) {
299
- R.current = !1;
309
+ s == null || s({ ...R }), y.current === !0 && h.trigger();
310
+ }, [JSON.stringify(R)]);
311
+ const T = M(!0);
312
+ return F(() => {
313
+ if (T.current) {
314
+ T.current = !1;
300
315
  return;
301
316
  }
302
- i == null || i({ isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
303
- }, [h.formState.isValid, h.formState.isSubmitted]), C(() => {
304
- if (m)
305
- if ("requestIdleCallback" in window) {
306
- const v = requestIdleCallback(() => {
307
- h.setFocus(m);
308
- });
309
- return () => cancelIdleCallback(v);
310
- } else {
311
- const v = setTimeout(() => {
312
- h.setFocus(m);
313
- }, 100);
314
- return () => clearTimeout(v);
315
- }
316
- }, [h]), /* @__PURE__ */ p.jsx(Ze, { metadata: c, readonly: d, inputErrorHandler: u, children: /* @__PURE__ */ p.jsx(Fe, { ...h, children: typeof f == "function" ? f({
317
+ o == null || o({ isValid: h.formState.isValid, isSubmitted: h.formState.isSubmitted });
318
+ }, [h.formState.isValid, h.formState.isSubmitted]), F(() => {
319
+ if (m) {
320
+ const v = fe(), _ = le(), S = v(() => {
321
+ h.setFocus(m);
322
+ });
323
+ return () => _(S);
324
+ }
325
+ }, [h]), /* @__PURE__ */ p.jsx(Qe, { metadata: f, readonly: d, inputErrorHandler: i, children: /* @__PURE__ */ p.jsx(Be, { ...h, children: typeof c == "function" ? c({
317
326
  ...h,
318
327
  submitForm: async () => {
319
- o && (b.current = !0, _((v) => {
320
- o(v);
328
+ u && (y.current = !0, I((v) => {
329
+ u(v);
321
330
  })());
322
331
  }
323
- }) : f }) });
332
+ }) : c }) });
324
333
  }
325
- const lr = (r) => {
334
+ const Rr = (r) => {
326
335
  const e = {}, n = (t) => {
327
336
  t.forEach((a) => {
328
- const { path: s, default: i, inputType: o, inputs: u } = a;
329
- (o === "group" || o === "accordion") && Array.isArray(u) ? n(u) : E(e, s) === void 0 && g(e, s, i);
337
+ const { path: s, default: o, inputType: u, inputs: i } = a;
338
+ (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : E(e, s) === void 0 && b(e, s, o);
330
339
  });
331
340
  };
332
341
  return Array.isArray(r.inputs) && n(r.inputs), e;
333
342
  };
334
- function dr(r, e) {
343
+ function Tr(r, e) {
335
344
  const n = r.inputs.map((t) => {
336
- const a = Ue(e, t.path);
345
+ const a = er(e, t.path);
337
346
  return a || t;
338
347
  });
339
348
  return { ...r, inputs: n };
340
349
  }
341
- function Ue(r, e) {
350
+ function er(r, e) {
342
351
  return r.inputs.find((n) => n.path === e);
343
352
  }
344
- const fe = "__temp_", mr = (r) => fe + r.split(".").join("__");
345
- function Le(r) {
353
+ const Ee = "__temp_", _r = (r) => Ee + r.split(".").join("__");
354
+ function rr(r) {
346
355
  const e = { ...r };
347
- return ne(e, (n, t) => {
348
- t.startsWith(fe) && delete e[t];
356
+ return me(e, (n, t) => {
357
+ t.startsWith(Ee) && delete e[t];
349
358
  }), e;
350
359
  }
351
- const We = "Required field";
352
- function I(r) {
353
- const e = typeof r == "string" ? JSON.parse(r) : r;
360
+ const tr = "Required field";
361
+ function P(r) {
362
+ let e;
363
+ if (typeof r == "string")
364
+ try {
365
+ e = JSON.parse(r);
366
+ } catch {
367
+ e = r;
368
+ }
369
+ else
370
+ e = r;
354
371
  if (typeof e == "string")
355
372
  return e;
356
- if (j(e))
357
- return I(e[0]);
373
+ if (w(e))
374
+ return P(e[0]);
358
375
  const n = e;
359
- return se(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
376
+ return he(n) && (n != null && n.message) ? e == null ? void 0 : e.message : "Unknown error";
360
377
  }
361
- function He(r, e, n) {
378
+ function nr(r, e, n) {
362
379
  let t = {};
363
- if (q(t, r.inputs, e, n), n != null && n.prefix) {
380
+ if (Z(t, r.inputs, e, n), n != null && n.prefix) {
364
381
  const s = n == null ? void 0 : n.prefix.replace(/.$/, "");
365
- t = g({}, s, t);
382
+ t = b({}, s, t);
366
383
  }
367
- return l.object(P(t, e, n));
384
+ return l.object($(t, e, n));
368
385
  }
369
- function P(r, e, n) {
386
+ function $(r, e, n) {
370
387
  const t = {};
371
388
  return Object.keys(r).forEach((a) => {
372
389
  const {
373
390
  _requiredOnly: s,
374
- _schemaObj: i,
375
- _input: o,
376
- _isList: u,
377
- _isArrayItem: c,
378
- _schema: f
391
+ _schemaObj: o,
392
+ _input: u,
393
+ _isList: i,
394
+ _isArrayItem: f,
395
+ _schema: c
379
396
  /*...nestedSchemaObj*/
380
397
  } = r[a];
381
- if (u && i && o) {
382
- const m = l.array(l.object(P(i, e, n))).optional(), d = re(f, o, e, n, m);
398
+ if (i && o && u) {
399
+ const m = l.array(l.object($(o, e, n))).optional(), d = de(c, u, e, n, m);
383
400
  t[a] = d;
384
- } else if (c && o) {
385
- const m = i != null && i.___array ? P({ ___array: i.___array }, e, n) : { ___array: l.any() }, d = Ge(m, o, n), h = re(f, o, e, n, d);
401
+ } else if (f && u) {
402
+ const m = o != null && o.___array ? $({ ___array: o.___array }, e, n) : { ___array: l.any() }, d = sr(m, u, n), h = de(c, u, e, n, d);
386
403
  t[a] = h;
387
- } else if (f && o) {
388
- const m = Ke(f, o, e, n);
404
+ } else if (c && u) {
405
+ const m = ar(c, u, e, n);
389
406
  t[a] = m;
390
- } else s && o ? t[a] = U(o, n) : t[a] = l.object(P(r[a], e, n)).optional();
407
+ } else s && u ? t[a] = G(u, n) : t[a] = l.object($(r[a], e, n)).optional();
391
408
  }), t;
392
409
  }
393
- function Ge(r, e, n) {
410
+ function sr(r, e, n) {
394
411
  return l.union([
395
412
  l.array(r.___array).optional(),
396
413
  l.string().superRefine((t, a) => {
397
414
  var s;
398
415
  if ((s = n == null ? void 0 : n.validationConfig) != null && s.globalValidation) {
399
- const i = n.validationConfig.globalValidation(t, e, n.metadata);
400
- if (i.error)
416
+ const o = n.validationConfig.globalValidation(t, e, n.metadata);
417
+ if (o.error)
401
418
  return a.addIssue({
402
419
  code: l.ZodIssueCode.custom,
403
- message: i.error
420
+ message: o.error
404
421
  }), !1;
405
- if (!i.continue)
422
+ if (!o.continue)
406
423
  return !0;
407
424
  }
408
425
  return !0;
409
426
  })
410
427
  ]);
411
428
  }
412
- function Ke(r, e, n, t) {
429
+ function ar(r, e, n, t) {
413
430
  return l.any().optional().superRefine(async (a, s) => {
414
- var o, u;
415
- if (e.required && !(await U(e, t).safeParseAsync(a)).success)
431
+ var u, i;
432
+ if (e.required && !(await G(e, t).safeParseAsync(a)).success)
416
433
  return s.addIssue({
417
434
  code: l.ZodIssueCode.custom,
418
- message: J(e, t)
435
+ message: W(e, t)
419
436
  }), l.NEVER;
420
- if ((o = t == null ? void 0 : t.validationConfig) != null && o.globalValidation) {
421
- const c = (u = t == null ? void 0 : t.validationConfig) == null ? void 0 : u.globalValidation(a, e, t.metadata);
422
- if (c.error)
437
+ if ((u = t == null ? void 0 : t.validationConfig) != null && u.globalValidation) {
438
+ const f = (i = t == null ? void 0 : t.validationConfig) == null ? void 0 : i.globalValidation(a, e, t.metadata);
439
+ if (f.error)
423
440
  return s.addIssue({
424
441
  code: l.ZodIssueCode.custom,
425
- message: c.error
442
+ message: f.error
426
443
  }), l.NEVER;
427
- if (!c.continue)
444
+ if (!f.continue)
428
445
  return !0;
429
446
  }
430
- const i = le(r, n);
431
- if (i) {
432
- const c = await i.safeParseAsync(a);
433
- if (!c.success) {
434
- const f = I(c == null ? void 0 : c.error.message), m = f === "Required" ? J(e, t) : f;
447
+ const o = Re(r, n);
448
+ if (o) {
449
+ const f = await o.safeParseAsync(a);
450
+ if (!f.success) {
451
+ const c = P(f == null ? void 0 : f.error.message), m = c === "Required" ? W(e, t) : c;
435
452
  s.addIssue({
436
453
  code: l.ZodIssueCode.custom,
437
454
  message: m
@@ -440,81 +457,81 @@ function Ke(r, e, n, t) {
440
457
  }
441
458
  });
442
459
  }
443
- function re(r, e, n, t, a) {
444
- return l.any().optional().superRefine(async (s, i) => {
445
- var f, m;
446
- const u = await U(e, t).safeParseAsync(s);
447
- if (e.required && !u.success) {
448
- const d = I(u.error.message);
449
- return i.addIssue({ code: l.ZodIssueCode.custom, message: d, fatal: !0 }), l.NEVER;
460
+ function de(r, e, n, t, a) {
461
+ return l.any().optional().superRefine(async (s, o) => {
462
+ var c, m;
463
+ const i = await G(e, t).safeParseAsync(s);
464
+ if (e.required && !i.success) {
465
+ const d = P(i.error.message);
466
+ return o.addIssue({ code: l.ZodIssueCode.custom, message: d, fatal: !0 }), l.NEVER;
450
467
  }
451
- if (!e.required && !u.success)
468
+ if (!e.required && !i.success)
452
469
  return l.NEVER;
453
- if ((f = t == null ? void 0 : t.validationConfig) != null && f.globalValidation) {
470
+ if ((c = t == null ? void 0 : t.validationConfig) != null && c.globalValidation) {
454
471
  const d = (m = t == null ? void 0 : t.validationConfig) == null ? void 0 : m.globalValidation(s, e, t.metadata);
455
472
  if (d.error)
456
- return i.addIssue({
473
+ return o.addIssue({
457
474
  code: l.ZodIssueCode.custom,
458
- message: I(d.error)
475
+ message: P(d.error)
459
476
  }), l.NEVER;
460
477
  if (!d.continue)
461
478
  return l.NEVER;
462
479
  }
463
- if (!j(s))
464
- return i.addIssue({
480
+ if (!w(s))
481
+ return o.addIssue({
465
482
  code: l.ZodIssueCode.custom,
466
483
  message: "'Value is not array'"
467
484
  }), l.NEVER;
468
- const c = le(r, n);
469
- if (c) {
470
- const d = await c.safeParseAsync(s);
485
+ const f = Re(r, n);
486
+ if (f) {
487
+ const d = await f.safeParseAsync(s);
471
488
  if (!d.success)
472
- return i.addIssue({
489
+ return o.addIssue({
473
490
  code: l.ZodIssueCode.custom,
474
- message: I(d.error.message)
491
+ message: P(d.error.message)
475
492
  }), l.NEVER;
476
493
  }
477
494
  }).pipe(a ?? l.any());
478
495
  }
479
- function q(r, e, n, t, a) {
496
+ function Z(r, e, n, t, a) {
480
497
  e.forEach((s) => {
481
- var o, u, c, f, m, d, h;
482
- const i = n;
483
- if (!s.isVisible || (o = s.isVisible) != null && o.call(s, i, t == null ? void 0 : t.metadata)) {
484
- const b = E(r, s.path);
485
- if ((u = s.validation) != null && u.schema ? g(
498
+ var u, i, f, c, m, d, h;
499
+ const o = n;
500
+ if (!s.isVisible || (u = s.isVisible) != null && u.call(s, o, t == null ? void 0 : t.metadata)) {
501
+ const y = E(r, s.path);
502
+ if ((i = s.validation) != null && i.schema ? b(
486
503
  r,
487
504
  s.path,
488
- F(b, {
489
- _schema: (c = s.validation) == null ? void 0 : c.schema,
505
+ N(y, {
506
+ _schema: (f = s.validation) == null ? void 0 : f.schema,
490
507
  _input: s
491
508
  })
492
- ) : s.required && g(r, s.path, F(b, { _requiredOnly: !0, _input: s })), s.inputs && q(r, s.inputs, n, t), s.inputType === "list") {
493
- const y = {};
494
- q(
495
- y,
496
- (m = (f = s.inputConfig) == null ? void 0 : f.inputs) == null ? void 0 : m.map((T) => ({
497
- ...T,
498
- path: T.relativePath
509
+ ) : s.required && b(r, s.path, N(y, { _requiredOnly: !0, _input: s })), s.inputs && Z(r, s.inputs, n, t), s.inputType === "list") {
510
+ const g = {};
511
+ Z(
512
+ g,
513
+ (m = (c = s.inputConfig) == null ? void 0 : c.inputs) == null ? void 0 : m.map((R) => ({
514
+ ...R,
515
+ path: R.relativePath
499
516
  })),
500
517
  n,
501
518
  t
502
519
  );
503
- const _ = E(r, s.path);
504
- g(r, s.path, F(_, { _schemaObj: y, _isList: !0, _input: s }));
520
+ const I = E(r, s.path);
521
+ b(r, s.path, N(I, { _schemaObj: g, _isList: !0, _input: s }));
505
522
  }
506
523
  if (!((d = s.validation) != null && d.schema) && s.inputType === "array") {
507
- const y = {};
508
- q(
509
- y,
524
+ const g = {};
525
+ Z(
526
+ g,
510
527
  [{ ...s.inputConfig.input, path: "___array" }],
511
528
  n,
512
529
  t
513
- ), g(
530
+ ), b(
514
531
  r,
515
532
  s.path,
516
- F(b, {
517
- _schemaObj: y,
533
+ N(y, {
534
+ _schemaObj: g,
518
535
  _schema: (h = s.validation) == null ? void 0 : h.schema,
519
536
  _isArrayItem: !0,
520
537
  _input: s
@@ -524,141 +541,140 @@ function q(r, e, n, t, a) {
524
541
  }
525
542
  });
526
543
  }
527
- function J(r, e) {
544
+ function W(r, e) {
528
545
  var n, t, a;
529
- return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? We;
546
+ return ((t = (n = e == null ? void 0 : e.validationConfig) == null ? void 0 : n.requiredMessagePerInput) == null ? void 0 : t[r.inputType]) ?? ((a = e == null ? void 0 : e.validationConfig) == null ? void 0 : a.requiredMessage) ?? tr;
530
547
  }
531
- function U(r, e) {
532
- var t, a, s, i, o, u;
548
+ function G(r, e) {
549
+ var t, a, s, o, u, i;
533
550
  if ((a = (t = e == null ? void 0 : e.validationConfig) == null ? void 0 : t.requiredSchemaPerInput) != null && a[r.inputType])
534
- return (i = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : i[r.inputType];
535
- if ((o = e == null ? void 0 : e.validationConfig) != null && o.requiredSchema)
536
- return (u = e == null ? void 0 : e.validationConfig) == null ? void 0 : u.requiredSchema;
537
- const n = J(r, e);
538
- return l.any().optional().superRefine((c, f) => {
539
- typeof c == "object" && V(c) && f.addIssue({
551
+ return (o = (s = e == null ? void 0 : e.validationConfig) == null ? void 0 : s.requiredSchemaPerInput) == null ? void 0 : o[r.inputType];
552
+ if ((u = e == null ? void 0 : e.validationConfig) != null && u.requiredSchema)
553
+ return (i = e == null ? void 0 : e.validationConfig) == null ? void 0 : i.requiredSchema;
554
+ const n = W(r, e);
555
+ return l.any().optional().superRefine((f, c) => {
556
+ typeof f == "object" && q(f) && c.addIssue({
540
557
  code: l.ZodIssueCode.custom,
541
558
  message: n
542
- }), (k(c) || c === "") && f.addIssue({
559
+ }), (B(f) || f === "") && c.addIssue({
543
560
  code: l.ZodIssueCode.custom,
544
561
  message: n
545
562
  });
546
563
  });
547
564
  }
548
- function le(r, e) {
565
+ function Re(r, e) {
549
566
  if (r instanceof l.ZodType)
550
567
  return r;
551
568
  if (typeof r == "function")
552
569
  return r(e);
553
570
  }
554
- const Qe = (r) => Array.isArray(r == null ? void 0 : r.errors), Xe = (r, e) => {
571
+ const or = (r) => Array.isArray(r == null ? void 0 : r.errors), ur = (r, e) => {
555
572
  const n = {};
556
573
  for (; r.length; ) {
557
- const t = r[0], { code: a, message: s, path: i } = t, o = i.join(".");
558
- if (!n[o])
574
+ const t = r[0], { code: a, message: s, path: o } = t, u = o.join(".");
575
+ if (!n[u])
559
576
  if ("unionErrors" in t) {
560
- const u = t.unionErrors[0].errors[0];
561
- n[o] = {
562
- message: u.message,
563
- type: u.code
577
+ const i = t.unionErrors[0].errors[0];
578
+ n[u] = {
579
+ message: i.message,
580
+ type: i.code
564
581
  };
565
582
  } else
566
- n[o] = { message: s, type: a };
567
- "unionErrors" in t && t.unionErrors.forEach((u) => u.errors.forEach((c) => r.push(c)));
583
+ n[u] = { message: s, type: a };
584
+ "unionErrors" in t && t.unionErrors.forEach((i) => i.errors.forEach((f) => r.push(f)));
568
585
  {
569
- const u = n[o].types, c = u && u[t.code];
570
- n[o] = Pe(
571
- o,
586
+ const i = n[u].types, f = i && i[t.code];
587
+ n[u] = Je(
588
+ u,
572
589
  e,
573
590
  n,
574
591
  a,
575
- c ? [].concat(c, t.message) : t.message
592
+ f ? [].concat(f, t.message) : t.message
576
593
  );
577
594
  }
578
595
  r.shift();
579
596
  }
580
597
  return n;
581
598
  };
582
- function hr(r, e) {
583
- return je(
599
+ function Sr(r, e) {
600
+ return Ae(
584
601
  async (n, t, a) => {
585
602
  try {
586
- return await He(r, n, e).parseAsync(n), {
603
+ return await nr(r, n, e).parseAsync(n), {
587
604
  values: n,
588
- // TODO: check this - values does not contains all data
589
605
  errors: {}
590
606
  };
591
607
  } catch (s) {
592
- if (Qe(s))
608
+ if (or(s))
593
609
  return {
594
610
  values: {},
595
- errors: Ae(Xe(s.errors, !0), a)
611
+ errors: We(ur(s.errors, !0), a)
596
612
  };
597
613
  throw s;
598
614
  }
599
615
  },
600
- [r]
616
+ [r, e]
601
617
  );
602
618
  }
603
- function Ye(r, e) {
604
- const n = A(r);
619
+ function ir(r, e) {
620
+ const n = H(r);
605
621
  return e.forEach((t) => {
606
- t.inputTransform && (j(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
607
- const i = E(n, t.path), o = s(i, n);
608
- o && g(n, o.path ?? t.path, o.value);
622
+ t.inputTransform && (w(t.inputTransform) ? t.inputTransform : [t.inputTransform]).forEach((s) => {
623
+ const o = E(n, t.path), u = s(o, n);
624
+ u && b(n, u.path ?? t.path, u.value);
609
625
  });
610
626
  }), n;
611
627
  }
612
- function ze(r, e) {
613
- const n = [], t = A(r);
628
+ function cr(r, e) {
629
+ const n = [], t = H(r);
614
630
  return e.forEach((a) => {
615
- a.outputTransform && (j(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((i) => {
616
- const o = E(t, a.path), u = i(o, t);
617
- u && (u.path ? (g(t, u.path, u.value), u.unset && n.push(a.path)) : g(t, a.path, u.value));
631
+ a.outputTransform && (w(a.outputTransform) ? a.outputTransform : [a.outputTransform]).forEach((o) => {
632
+ const u = E(t, a.path), i = o(u, t);
633
+ i && (i.path ? (b(t, i.path, i.value), i.unset && n.push(a.path)) : b(t, a.path, i.value));
618
634
  });
619
635
  }), n.forEach((a) => {
620
- ae(t, a);
636
+ pe(t, a);
621
637
  }), t;
622
638
  }
623
- function L(r) {
624
- return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...L(t.inputs)] : [...n, t], []);
639
+ function K(r) {
640
+ return r.reduce((n, t) => (t.inputType === "group" || t.inputType === "accordion") && t.inputs ? [...n, t, ...K(t.inputs)] : [...n, t], []);
625
641
  }
626
- function de(r) {
627
- const n = L(r.inputs).reduce((t, a) => {
642
+ function Te(r) {
643
+ const n = K(r.inputs).reduce((t, a) => {
628
644
  const s = a.inputType === "text" || a.inputType === "boolean" || a.inputType === "number" || a.inputType === "textarea" || a.inputType === "select";
629
645
  return (a.inputTransform || a.outputTransform) && t.push({
630
- ...be(a, "path", "inputTransform", "outputTransform"),
646
+ ...Ie(a, "path", "inputTransform", "outputTransform"),
631
647
  level: a.path.split(".").length,
632
648
  isPrimitive: s
633
649
  }), t;
634
650
  }, []);
635
651
  return n.sort((t, a) => t.level === a.level ? t.isPrimitive ? 1 : -1 : t.level > a.level ? -1 : 1), n;
636
652
  }
637
- function er(r, e, n, t = {}) {
638
- const { preserve: a } = t, s = L(r.inputs), i = A(e);
639
- return s.forEach((o) => {
640
- a && a.includes(o.path) || o.isVisible && !o.isVisible(e, n) && ae(i, o.path);
641
- }), i;
653
+ function fr(r, e, n, t = {}) {
654
+ const { preserve: a } = t, s = K(r.inputs), o = H(e);
655
+ return s.forEach((u) => {
656
+ a && a.includes(u.path) || u.isVisible && !u.isVisible(e, n) && pe(o, u.path);
657
+ }), o;
642
658
  }
643
- function pr(r, e) {
644
- const n = de(e);
645
- return Ye(r, n);
659
+ function Cr(r, e) {
660
+ const n = Te(e);
661
+ return ir(r, n);
646
662
  }
647
- function yr(r, e, n, t = {}) {
648
- const a = de(e);
649
- let s = er(e, r, n, t);
650
- return s = ze(s, a), s = Le(s), s;
663
+ function wr(r, e, n, t = {}) {
664
+ const a = Te(e);
665
+ let s = fr(e, r, n, t);
666
+ return s = cr(s, a), s = rr(s), s;
651
667
  }
652
- function gr(r) {
668
+ function Ir(r) {
653
669
  const e = {}, n = (t) => {
654
670
  t.forEach((a) => {
655
- const { default: s, path: i, inputType: o, inputs: u } = a;
656
- (o === "group" || o === "accordion") && Array.isArray(u) ? n(u) : s !== void 0 && g(e, i, s);
671
+ const { default: s, path: o, inputType: u, inputs: i } = a;
672
+ (u === "group" || u === "accordion") && Array.isArray(i) ? n(i) : s !== void 0 && b(e, o, s);
657
673
  });
658
674
  };
659
675
  return Array.isArray(r.inputs) && n(r.inputs), e;
660
676
  }
661
- function br() {
677
+ function Or() {
662
678
  return function(r, e) {
663
679
  if (!(typeof r > "u"))
664
680
  return r ? {
@@ -666,7 +682,7 @@ function br() {
666
682
  } : { value: r };
667
683
  };
668
684
  }
669
- function vr(r) {
685
+ function jr(r) {
670
686
  return function(e, n) {
671
687
  if (typeof e > "u") return;
672
688
  if (!e) return { value: e };
@@ -679,64 +695,64 @@ function vr(r) {
679
695
  return r != null && r.unsetIfEmpty && Object.getOwnPropertyNames(t.value).length === 0 ? { value: void 0 } : t;
680
696
  };
681
697
  }
682
- function Er() {
698
+ function Vr() {
683
699
  return function(r, e) {
684
700
  if (!(typeof r > "u"))
685
- return j(r) && V(r) ? { value: void 0 } : { value: r };
701
+ return w(r) && q(r) ? { value: void 0 } : { value: r };
686
702
  };
687
703
  }
688
- function _r(r) {
704
+ function xr(r) {
689
705
  return function(e, n) {
690
706
  const t = r ? E(n, r) : e;
691
707
  if (!(typeof t > "u")) {
692
- if (oe(t)) return { value: void 0, path: r };
693
- if (se(t)) {
694
- const a = ue(t, ve);
695
- if (V(a))
708
+ if (ye(t)) return { value: void 0, path: r };
709
+ if (he(t)) {
710
+ const a = ge(t, Oe);
711
+ if (q(a))
696
712
  return { value: void 0, path: r };
697
713
  }
698
714
  return { value: t, path: r };
699
715
  }
700
716
  };
701
717
  }
702
- function Tr() {
718
+ function Fr() {
703
719
  return function(r, e) {
704
720
  if (!(typeof r > "u"))
705
- return Ee(r) && V(r) ? { value: void 0 } : { value: r };
721
+ return je(r) && q(r) ? { value: void 0 } : { value: r };
706
722
  };
707
723
  }
708
- function Rr(r) {
724
+ function Pr(r) {
709
725
  return function(e, n) {
710
726
  const t = E(n, r);
711
727
  return typeof t == "string" ? { value: t } : { value: e };
712
728
  };
713
729
  }
714
- function Sr(r) {
730
+ function qr(r) {
715
731
  return function(e, n) {
716
732
  if (typeof e > "u") return;
717
733
  if (!e) return { value: e };
718
734
  const t = E(n, r);
719
735
  if (typeof t == "object") {
720
- const a = rr(t);
736
+ const a = lr(t);
721
737
  if (Object.getOwnPropertyNames(a).length === 1)
722
738
  return { value: e, path: r };
723
739
  }
724
740
  return { value: e };
725
741
  };
726
742
  }
727
- function Or(r) {
743
+ function kr(r) {
728
744
  return function(e, n) {
729
745
  if (typeof e > "u") return;
730
746
  const t = E(n, r);
731
747
  return typeof t == "string" ? { value: [t] } : { value: e };
732
748
  };
733
749
  }
734
- function jr(r, e) {
750
+ function Ar(r, e) {
735
751
  return function(n, t) {
736
752
  if (typeof n > "u") return;
737
753
  if (!n) return { value: n };
738
754
  const a = E(t, r);
739
- if (j(a)) {
755
+ if (w(a)) {
740
756
  if (a.length === 1)
741
757
  return { value: a[0], path: r };
742
758
  if (a.length === 0 && e != null && e.unsetIfEmpty)
@@ -745,100 +761,112 @@ function jr(r, e) {
745
761
  return { value: n };
746
762
  };
747
763
  }
748
- function me(r) {
749
- return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !me(r[e])) : k(r);
764
+ function _e(r) {
765
+ return typeof r == "object" ? !Object.getOwnPropertyNames(r).some((e) => !_e(r[e])) : B(r);
750
766
  }
751
- function rr(r) {
752
- return ue(r, (e) => typeof e == "object" ? me(e) : k(e));
767
+ function lr(r) {
768
+ return ge(r, (e) => typeof e == "object" ? _e(e) : B(e));
753
769
  }
754
- function te(r) {
770
+ function L(r) {
755
771
  const { items: e, ...n } = r;
756
772
  return /* @__PURE__ */ p.jsx(p.Fragment, { children: e.map((t) => /* @__PURE__ */ p.jsx(
757
- Je,
773
+ ze,
758
774
  {
759
775
  input: t,
760
776
  path: t.path,
761
777
  ...n
762
778
  },
763
- `${t.inputType}_${t.path}_${t.label}`
779
+ `${t.inputType}_${t.path}`
764
780
  )) });
765
781
  }
766
- const tr = Ce((r, e) => {
782
+ L.displayName = "RenderInputs";
783
+ const dr = Ne((r, e) => {
767
784
  const { inputs: n, className: t, factory: a, withoutWrapper: s } = r;
768
- return s ? /* @__PURE__ */ p.jsxs(Ie, { children: [
785
+ return s ? /* @__PURE__ */ p.jsxs(De, { children: [
769
786
  n.hero,
770
- /* @__PURE__ */ p.jsx(te, { items: n.inputs, factory: a, withoutWrapper: s })
787
+ /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
771
788
  ] }) : /* @__PURE__ */ p.jsxs("div", { className: t, ref: e, children: [
772
789
  n.hero,
773
- /* @__PURE__ */ p.jsx(te, { items: n.inputs, factory: a, withoutWrapper: s })
790
+ /* @__PURE__ */ p.jsx(L, { items: n.inputs, factory: a, withoutWrapper: s })
774
791
  ] });
775
792
  });
776
- tr.displayName = "RenderForm";
777
- function Cr(r) {
793
+ dr.displayName = "RenderForm";
794
+ function Nr(r) {
778
795
  let e = !0;
779
- return ne(r, (n) => {
780
- e = e && (n === "" || oe(n) || k(n));
796
+ return me(r, (n) => {
797
+ e = e && (n === "" || ye(n) || B(n));
781
798
  }), e;
782
799
  }
783
- const Ir = (r = "") => _e(r.split("_").join(" ")), nr = (r, e = 2) => {
784
- let n = !1;
785
- const t = () => {
800
+ const Dr = (r = "") => Ve(r.split("_").join(" ")), mr = (r, e = 2, n, t = 1e3) => {
801
+ let a = !1;
802
+ const s = () => {
786
803
  requestAnimationFrame(() => {
787
- n || (e -= 1, e <= 0 ? r() : t());
804
+ a || (e -= 1, e <= 0 ? r() : s());
788
805
  });
789
806
  };
790
- return t(), () => {
791
- n = !0;
792
- };
807
+ return n && Date.now() - n <= t ? (r(), () => {
808
+ }) : (s(), () => {
809
+ a = !0;
810
+ });
793
811
  };
794
- function Vr(r) {
812
+ function Mr(r) {
795
813
  const {
796
814
  field: { onBlur: e, ...n },
797
815
  ...t
798
- } = qe(r);
816
+ } = Ue(r), a = M(Date.now());
799
817
  return {
800
818
  ...t,
801
819
  field: {
802
820
  ...n,
803
- onBlur: nr(e)
821
+ onBlur: mr(e, 2, a.current)
804
822
  }
805
823
  };
806
824
  }
807
825
  export {
808
- cr as InputComponent,
809
- Je as InputComponentRenderer,
810
- ie as InputFactory,
811
- ke as InputOverrideError,
812
- tr as RenderForm,
813
- te as RenderInputs,
814
- fr as RootForm,
815
- nr as afterFrames,
816
- vr as arrayToObjectOutputTransformer,
817
- gr as collectDefaultValues,
818
- pr as convertDataToFormModel,
819
- yr as convertFormModelToData,
820
- Ir as generateReadableLabel,
821
- lr as getDefaultValuesFromFormDefinition,
822
- mr as getTemporaryPath,
823
- de as getTransformers,
824
- He as getValidationSchema,
825
- Ye as inputTransformValues,
826
- Cr as isChildrenEmpty,
827
- br as objectToArrayInputTransformer,
828
- ze as outputTransformValues,
829
- dr as overrideFormDefinition,
830
- I as processValidationParseResponse,
831
- Le as removeTemporaryFieldsValue,
832
- Or as shorthandArrayInputTransformer,
833
- jr as shorthandArrayOutputTransformer,
834
- Rr as shorthandObjectInputTransformer,
835
- Sr as shorthandObjectOutputTransformer,
836
- Er as unsetEmptyArrayOutputTransformer,
837
- _r as unsetEmptyObjectOutputTransformer,
838
- Tr as unsetEmptyStringOutputTransformer,
839
- er as unsetHiddenInputsValues,
840
- Vr as useController,
841
- $e as useRootFormContext,
842
- hr as useZodValidationResolver
826
+ Br as Controller,
827
+ Jr as Form,
828
+ Ur as FormProvider,
829
+ vr as InputComponent,
830
+ ze as InputComponentRenderer,
831
+ be as InputFactory,
832
+ Le as InputOverrideError,
833
+ dr as RenderForm,
834
+ L as RenderInputs,
835
+ Er as RootForm,
836
+ mr as afterFrames,
837
+ jr as arrayToObjectOutputTransformer,
838
+ Ir as collectDefaultValues,
839
+ Cr as convertDataToFormModel,
840
+ wr as convertFormModelToData,
841
+ Dr as generateReadableLabel,
842
+ Wr as get,
843
+ Rr as getDefaultValuesFromFormDefinition,
844
+ _r as getTemporaryPath,
845
+ Te as getTransformers,
846
+ nr as getValidationSchema,
847
+ ir as inputTransformValues,
848
+ Nr as isChildrenEmpty,
849
+ Or as objectToArrayInputTransformer,
850
+ cr as outputTransformValues,
851
+ Tr as overrideFormDefinition,
852
+ P as processValidationParseResponse,
853
+ rr as removeTemporaryFieldsValue,
854
+ Lr as set,
855
+ kr as shorthandArrayInputTransformer,
856
+ Ar as shorthandArrayOutputTransformer,
857
+ Pr as shorthandObjectInputTransformer,
858
+ qr as shorthandObjectOutputTransformer,
859
+ Vr as unsetEmptyArrayOutputTransformer,
860
+ xr as unsetEmptyObjectOutputTransformer,
861
+ Fr as unsetEmptyStringOutputTransformer,
862
+ fr as unsetHiddenInputsValues,
863
+ Mr as useController,
864
+ Hr as useFieldArray,
865
+ Gr as useForm,
866
+ Kr as useFormContext,
867
+ Qr as useFormState,
868
+ Xe as useRootFormContext,
869
+ Xr as useWatch,
870
+ Sr as useZodValidationResolver
843
871
  };
844
872
  //# sourceMappingURL=index.js.map