autoforma 2.10.2 → 2.11.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.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import k, { useMemo as he, createContext as Wt, useContext as $t, useState as xt, useEffect as Ce, useRef as Et, useImperativeHandle as Yt } from "react";
2
- var De = { exports: {} }, pe = {};
1
+ import S, { useMemo as he, createContext as Wt, useContext as $t, useState as Et, useEffect as Ce, useRef as Yt, useImperativeHandle as qt } from "react";
2
+ var De = { exports: {} }, Ae = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -10,26 +10,26 @@ var De = { exports: {} }, pe = {};
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
  var it;
13
- function qt() {
14
- if (it) return pe;
13
+ function zt() {
14
+ if (it) return Ae;
15
15
  it = 1;
16
16
  var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
17
- function t(n, o, i) {
17
+ function t(n, o, a) {
18
18
  var u = null;
19
- if (i !== void 0 && (u = "" + i), o.key !== void 0 && (u = "" + o.key), "key" in o) {
20
- i = {};
19
+ if (a !== void 0 && (u = "" + a), o.key !== void 0 && (u = "" + o.key), "key" in o) {
20
+ a = {};
21
21
  for (var f in o)
22
- f !== "key" && (i[f] = o[f]);
23
- } else i = o;
24
- return o = i.ref, {
22
+ f !== "key" && (a[f] = o[f]);
23
+ } else a = o;
24
+ return o = a.ref, {
25
25
  $$typeof: e,
26
26
  type: n,
27
27
  key: u,
28
28
  ref: o !== void 0 ? o : null,
29
- props: i
29
+ props: a
30
30
  };
31
31
  }
32
- return pe.Fragment = r, pe.jsx = t, pe.jsxs = t, pe;
32
+ return Ae.Fragment = r, Ae.jsx = t, Ae.jsxs = t, Ae;
33
33
  }
34
34
  var we = {};
35
35
  /**
@@ -41,20 +41,20 @@ var we = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var at;
45
- function zt() {
46
- return at || (at = 1, process.env.NODE_ENV !== "production" && (function() {
44
+ var ot;
45
+ function Ht() {
46
+ return ot || (ot = 1, process.env.NODE_ENV !== "production" && (function() {
47
47
  function e(c) {
48
48
  if (c == null) return null;
49
49
  if (typeof c == "function")
50
50
  return c.$$typeof === ge ? null : c.displayName || c.name || null;
51
51
  if (typeof c == "string") return c;
52
52
  switch (c) {
53
- case W:
53
+ case I:
54
54
  return "Fragment";
55
- case E:
55
+ case g:
56
56
  return "Profiler";
57
- case $:
57
+ case w:
58
58
  return "StrictMode";
59
59
  case K:
60
60
  return "Suspense";
@@ -67,21 +67,21 @@ function zt() {
67
67
  switch (typeof c.tag == "number" && console.error(
68
68
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
69
  ), c.$$typeof) {
70
- case O:
70
+ case T:
71
71
  return "Portal";
72
- case C:
72
+ case P:
73
73
  return c.displayName || "Context";
74
74
  case J:
75
75
  return (c._context.displayName || "Context") + ".Consumer";
76
- case R:
77
- var g = c.render;
78
- return c = c.displayName, c || (c = g.displayName || g.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
76
+ case k:
77
+ var _ = c.render;
78
+ return c = c.displayName, c || (c = _.displayName || _.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
79
79
  case j:
80
- return g = c.displayName || null, g !== null ? g : e(c.type) || "Memo";
80
+ return _ = c.displayName || null, _ !== null ? _ : e(c.type) || "Memo";
81
81
  case G:
82
- g = c._payload, c = c._init;
82
+ _ = c._payload, c = c._init;
83
83
  try {
84
- return e(c(g));
84
+ return e(c(_));
85
85
  } catch {
86
86
  }
87
87
  }
@@ -93,54 +93,54 @@ function zt() {
93
93
  function t(c) {
94
94
  try {
95
95
  r(c);
96
- var g = !1;
96
+ var _ = !1;
97
97
  } catch {
98
- g = !0;
98
+ _ = !0;
99
99
  }
100
- if (g) {
101
- g = console;
102
- var P = g.error, L = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
103
- return P.call(
104
- g,
100
+ if (_) {
101
+ _ = console;
102
+ var N = _.error, M = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
103
+ return N.call(
104
+ _,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- L
106
+ M
107
107
  ), r(c);
108
108
  }
109
109
  }
110
110
  function n(c) {
111
- if (c === W) return "<>";
111
+ if (c === I) return "<>";
112
112
  if (typeof c == "object" && c !== null && c.$$typeof === G)
113
113
  return "<...>";
114
114
  try {
115
- var g = e(c);
116
- return g ? "<" + g + ">" : "<...>";
115
+ var _ = e(c);
116
+ return _ ? "<" + _ + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
121
  function o() {
122
- var c = _.A;
122
+ var c = x.A;
123
123
  return c === null ? null : c.getOwner();
124
124
  }
125
- function i() {
125
+ function a() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
128
  function u(c) {
129
- if (w.call(c, "key")) {
130
- var g = Object.getOwnPropertyDescriptor(c, "key").get;
131
- if (g && g.isReactWarning) return !1;
129
+ if (R.call(c, "key")) {
130
+ var _ = Object.getOwnPropertyDescriptor(c, "key").get;
131
+ if (_ && _.isReactWarning) return !1;
132
132
  }
133
133
  return c.key !== void 0;
134
134
  }
135
- function f(c, g) {
136
- function P() {
135
+ function f(c, _) {
136
+ function N() {
137
137
  ee || (ee = !0, console.error(
138
138
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- g
139
+ _
140
140
  ));
141
141
  }
142
- P.isReactWarning = !0, Object.defineProperty(c, "key", {
143
- get: P,
142
+ N.isReactWarning = !0, Object.defineProperty(c, "key", {
143
+ get: N,
144
144
  configurable: !0
145
145
  });
146
146
  }
@@ -150,15 +150,15 @@ function zt() {
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), c = this.props.ref, c !== void 0 ? c : null;
152
152
  }
153
- function A(c, g, P, L, _e, xe) {
154
- var U = P.ref;
153
+ function A(c, _, N, M, _e, xe) {
154
+ var W = N.ref;
155
155
  return c = {
156
- $$typeof: B,
156
+ $$typeof: U,
157
157
  type: c,
158
- key: g,
159
- props: P,
160
- _owner: L
161
- }, (U !== void 0 ? U : null) !== null ? Object.defineProperty(c, "ref", {
158
+ key: _,
159
+ props: N,
160
+ _owner: M
161
+ }, (W !== void 0 ? W : null) !== null ? Object.defineProperty(c, "ref", {
162
162
  enumerable: !1,
163
163
  get: F
164
164
  }) : Object.defineProperty(c, "ref", { enumerable: !1, value: null }), c._store = {}, Object.defineProperty(c._store, "validated", {
@@ -183,61 +183,61 @@ function zt() {
183
183
  value: xe
184
184
  }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
185
185
  }
186
- function T(c, g, P, L, _e, xe) {
187
- var U = g.children;
188
- if (U !== void 0)
189
- if (L)
190
- if (I(U)) {
191
- for (L = 0; L < U.length; L++)
192
- x(U[L]);
193
- Object.freeze && Object.freeze(U);
186
+ function D(c, _, N, M, _e, xe) {
187
+ var W = _.children;
188
+ if (W !== void 0)
189
+ if (M)
190
+ if (B(W)) {
191
+ for (M = 0; M < W.length; M++)
192
+ E(W[M]);
193
+ Object.freeze && Object.freeze(W);
194
194
  } else
195
195
  console.error(
196
196
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
197
  );
198
- else x(U);
199
- if (w.call(g, "key")) {
200
- U = e(c);
201
- var le = Object.keys(g).filter(function(Ae) {
202
- return Ae !== "key";
198
+ else E(W);
199
+ if (R.call(_, "key")) {
200
+ W = e(c);
201
+ var le = Object.keys(_).filter(function(pe) {
202
+ return pe !== "key";
203
203
  });
204
- L = 0 < le.length ? "{key: someKey, " + le.join(": ..., ") + ": ...}" : "{key: someKey}", ye[U + L] || (le = 0 < le.length ? "{" + le.join(": ..., ") + ": ...}" : "{}", console.error(
204
+ M = 0 < le.length ? "{key: someKey, " + le.join(": ..., ") + ": ...}" : "{key: someKey}", ye[W + M] || (le = 0 < le.length ? "{" + le.join(": ..., ") + ": ...}" : "{}", console.error(
205
205
  `A props object containing a "key" prop is being spread into JSX:
206
206
  let props = %s;
207
207
  <%s {...props} />
208
208
  React keys must be passed directly to JSX without using spread:
209
209
  let props = %s;
210
210
  <%s key={someKey} {...props} />`,
211
- L,
212
- U,
211
+ M,
212
+ W,
213
213
  le,
214
- U
215
- ), ye[U + L] = !0);
214
+ W
215
+ ), ye[W + M] = !0);
216
216
  }
217
- if (U = null, P !== void 0 && (t(P), U = "" + P), u(g) && (t(g.key), U = "" + g.key), "key" in g) {
218
- P = {};
219
- for (var Ee in g)
220
- Ee !== "key" && (P[Ee] = g[Ee]);
221
- } else P = g;
222
- return U && f(
223
- P,
217
+ if (W = null, N !== void 0 && (t(N), W = "" + N), u(_) && (t(_.key), W = "" + _.key), "key" in _) {
218
+ N = {};
219
+ for (var Ee in _)
220
+ Ee !== "key" && (N[Ee] = _[Ee]);
221
+ } else N = _;
222
+ return W && f(
223
+ N,
224
224
  typeof c == "function" ? c.displayName || c.name || "Unknown" : c
225
225
  ), A(
226
226
  c,
227
- U,
228
- P,
227
+ W,
228
+ N,
229
229
  o(),
230
230
  _e,
231
231
  xe
232
232
  );
233
233
  }
234
- function x(c) {
234
+ function E(c) {
235
235
  p(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === G && (c._payload.status === "fulfilled" ? p(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
236
236
  }
237
237
  function p(c) {
238
- return typeof c == "object" && c !== null && c.$$typeof === B;
238
+ return typeof c == "object" && c !== null && c.$$typeof === U;
239
239
  }
240
- var b = k, B = Symbol.for("react.transitional.element"), O = Symbol.for("react.portal"), W = Symbol.for("react.fragment"), $ = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), C = Symbol.for("react.context"), R = Symbol.for("react.forward_ref"), K = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), j = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), X = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), _ = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, w = Object.prototype.hasOwnProperty, I = Array.isArray, Y = console.createTask ? console.createTask : function() {
240
+ var b = S, U = Symbol.for("react.transitional.element"), T = Symbol.for("react.portal"), I = Symbol.for("react.fragment"), w = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), P = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), K = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), j = Symbol.for("react.memo"), G = Symbol.for("react.lazy"), X = Symbol.for("react.activity"), ge = Symbol.for("react.client.reference"), x = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, R = Object.prototype.hasOwnProperty, B = Array.isArray, Y = console.createTask ? console.createTask : function() {
241
241
  return null;
242
242
  };
243
243
  b = {
@@ -247,64 +247,64 @@ React keys must be passed directly to JSX without using spread:
247
247
  };
248
248
  var ee, Z = {}, fe = b.react_stack_bottom_frame.bind(
249
249
  b,
250
- i
251
- )(), de = Y(n(i)), ye = {};
252
- we.Fragment = W, we.jsx = function(c, g, P) {
253
- var L = 1e4 > _.recentlyCreatedOwnerStacks++;
254
- return T(
250
+ a
251
+ )(), de = Y(n(a)), ye = {};
252
+ we.Fragment = I, we.jsx = function(c, _, N) {
253
+ var M = 1e4 > x.recentlyCreatedOwnerStacks++;
254
+ return D(
255
255
  c,
256
- g,
257
- P,
256
+ _,
257
+ N,
258
258
  !1,
259
- L ? Error("react-stack-top-frame") : fe,
260
- L ? Y(n(c)) : de
259
+ M ? Error("react-stack-top-frame") : fe,
260
+ M ? Y(n(c)) : de
261
261
  );
262
- }, we.jsxs = function(c, g, P) {
263
- var L = 1e4 > _.recentlyCreatedOwnerStacks++;
264
- return T(
262
+ }, we.jsxs = function(c, _, N) {
263
+ var M = 1e4 > x.recentlyCreatedOwnerStacks++;
264
+ return D(
265
265
  c,
266
- g,
267
- P,
266
+ _,
267
+ N,
268
268
  !0,
269
- L ? Error("react-stack-top-frame") : fe,
270
- L ? Y(n(c)) : de
269
+ M ? Error("react-stack-top-frame") : fe,
270
+ M ? Y(n(c)) : de
271
271
  );
272
272
  };
273
273
  })()), we;
274
274
  }
275
- var ot;
276
- function Ht() {
277
- return ot || (ot = 1, process.env.NODE_ENV === "production" ? De.exports = qt() : De.exports = zt()), De.exports;
275
+ var lt;
276
+ function Jt() {
277
+ return lt || (lt = 1, process.env.NODE_ENV === "production" ? De.exports = zt() : De.exports = Ht()), De.exports;
278
278
  }
279
- var V = Ht(), Te = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, te = (e) => e == null;
279
+ var V = Jt(), Te = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, te = (e) => e == null;
280
280
  const Vt = (e) => typeof e == "object";
281
- var z = (e) => !te(e) && !Array.isArray(e) && Vt(e) && !ve(e), Jt = (e) => z(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, Gt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Xt = (e, r) => e.has(Gt(r)), Zt = (e) => {
281
+ var z = (e) => !te(e) && !Array.isArray(e) && Vt(e) && !ve(e), Gt = (e) => z(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, Xt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Zt = (e, r) => e.has(Xt(r)), Qt = (e) => {
282
282
  const r = e.constructor && e.constructor.prototype;
283
283
  return z(r) && r.hasOwnProperty("isPrototypeOf");
284
- }, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
284
+ }, He = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
285
285
  function H(e) {
286
286
  if (e instanceof Date)
287
287
  return new Date(e);
288
288
  const r = typeof FileList < "u" && e instanceof FileList;
289
- if (ze && (e instanceof Blob || r))
289
+ if (He && (e instanceof Blob || r))
290
290
  return e;
291
291
  const t = Array.isArray(e);
292
- if (!t && !(z(e) && Zt(e)))
292
+ if (!t && !(z(e) && Qt(e)))
293
293
  return e;
294
294
  const n = t ? [] : Object.create(Object.getPrototypeOf(e));
295
295
  for (const o in e)
296
296
  Object.prototype.hasOwnProperty.call(e, o) && (n[o] = H(e[o]));
297
297
  return n;
298
298
  }
299
- var Ie = (e) => /^\w*$/.test(e), M = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Je = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, r, t) => {
299
+ var Ie = (e) => /^\w*$/.test(e), $ = (e) => e === void 0, Je = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Ge = (e) => Je(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, r, t) => {
300
300
  if (!r || !z(e))
301
301
  return t;
302
- const n = (Ie(r) ? [r] : Je(r)).reduce((o, i) => te(o) ? o : o[i], e);
303
- return M(n) || n === e ? M(e[r]) ? t : e[r] : n;
304
- }, ue = (e) => typeof e == "boolean", ne = (e) => typeof e == "function", N = (e, r, t) => {
302
+ const n = (Ie(r) ? [r] : Ge(r)).reduce((o, a) => te(o) ? o : o[a], e);
303
+ return $(n) || n === e ? $(e[r]) ? t : e[r] : n;
304
+ }, ue = (e) => typeof e == "boolean", ne = (e) => typeof e == "function", L = (e, r, t) => {
305
305
  let n = -1;
306
- const o = Ie(r) ? [r] : Je(r), i = o.length, u = i - 1;
307
- for (; ++n < i; ) {
306
+ const o = Ie(r) ? [r] : Ge(r), a = o.length, u = a - 1;
307
+ for (; ++n < a; ) {
308
308
  const f = o[n];
309
309
  let F = t;
310
310
  if (n !== u) {
@@ -316,10 +316,10 @@ var Ie = (e) => /^\w*$/.test(e), M = (e) => e === void 0, He = (e) => Array.isAr
316
316
  e[f] = F, e = e[f];
317
317
  }
318
318
  };
319
- const lt = {
319
+ const ut = {
320
320
  BLUR: "blur",
321
321
  FOCUS_OUT: "focusout"
322
- }, ie = {
322
+ }, ae = {
323
323
  onBlur: "onBlur",
324
324
  onChange: "onChange",
325
325
  onSubmit: "onSubmit",
@@ -333,29 +333,29 @@ const lt = {
333
333
  pattern: "pattern",
334
334
  required: "required",
335
335
  validate: "validate"
336
- }, Ge = k.createContext(null);
337
- Ge.displayName = "HookFormContext";
338
- const be = () => k.useContext(Ge), Qt = (e) => {
336
+ }, Xe = S.createContext(null);
337
+ Xe.displayName = "HookFormContext";
338
+ const be = () => S.useContext(Xe), Kt = (e) => {
339
339
  const { children: r, ...t } = e;
340
- return k.createElement(Ge.Provider, { value: t }, r);
340
+ return S.createElement(Xe.Provider, { value: t }, r);
341
341
  };
342
- var Kt = (e, r, t, n = !0) => {
342
+ var er = (e, r, t, n = !0) => {
343
343
  const o = {
344
344
  defaultValues: r._defaultValues
345
345
  };
346
- for (const i in e)
347
- Object.defineProperty(o, i, {
346
+ for (const a in e)
347
+ Object.defineProperty(o, a, {
348
348
  get: () => {
349
- const u = i;
350
- return r._proxyFormState[u] !== ie.all && (r._proxyFormState[u] = !n || ie.all), e[u];
349
+ const u = a;
350
+ return r._proxyFormState[u] !== ae.all && (r._proxyFormState[u] = !n || ae.all), e[u];
351
351
  }
352
352
  });
353
353
  return o;
354
354
  };
355
- const Ft = typeof window < "u" ? k.useLayoutEffect : k.useEffect;
356
- var re = (e) => typeof e == "string", $e = (e, r, t, n, o) => re(e) ? (n && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), h(t, i))) : (n && (r.watchAll = !0), t), Ye = (e) => te(e) || !Vt(e);
357
- function ae(e, r, t = /* @__PURE__ */ new WeakSet()) {
358
- if (Ye(e) || Ye(r))
355
+ const Ft = typeof window < "u" ? S.useLayoutEffect : S.useEffect;
356
+ var re = (e) => typeof e == "string", Ye = (e, r, t, n, o) => re(e) ? (n && r.watch.add(e), h(t, e, o)) : Array.isArray(e) ? e.map((a) => (n && r.watch.add(a), h(t, a))) : (n && (r.watchAll = !0), t), qe = (e) => te(e) || !Vt(e);
357
+ function ie(e, r, t = /* @__PURE__ */ new WeakSet()) {
358
+ if (qe(e) || qe(r))
359
359
  return Object.is(e, r);
360
360
  if (ve(e) && ve(r))
361
361
  return e.getTime() === r.getTime();
@@ -365,74 +365,74 @@ function ae(e, r, t = /* @__PURE__ */ new WeakSet()) {
365
365
  if (t.has(e) || t.has(r))
366
366
  return !0;
367
367
  t.add(e), t.add(r);
368
- for (const i of n) {
369
- const u = e[i];
370
- if (!o.includes(i))
368
+ for (const a of n) {
369
+ const u = e[a];
370
+ if (!o.includes(a))
371
371
  return !1;
372
- if (i !== "ref") {
373
- const f = r[i];
374
- if (ve(u) && ve(f) || z(u) && z(f) || Array.isArray(u) && Array.isArray(f) ? !ae(u, f, t) : !Object.is(u, f))
372
+ if (a !== "ref") {
373
+ const f = r[a];
374
+ if (ve(u) && ve(f) || z(u) && z(f) || Array.isArray(u) && Array.isArray(f) ? !ie(u, f, t) : !Object.is(u, f))
375
375
  return !1;
376
376
  }
377
377
  }
378
378
  return !0;
379
379
  }
380
- function At(e) {
381
- const r = be(), { control: t = r.control, name: n, defaultValue: o, disabled: i, exact: u, compute: f } = e || {}, F = k.useRef(o), A = k.useRef(f), T = k.useRef(void 0), x = k.useRef(t), p = k.useRef(n);
380
+ function pt(e) {
381
+ const r = be(), { control: t = r.control, name: n, defaultValue: o, disabled: a, exact: u, compute: f } = e || {}, F = S.useRef(o), A = S.useRef(f), D = S.useRef(void 0), E = S.useRef(t), p = S.useRef(n);
382
382
  A.current = f;
383
- const [b, B] = k.useState(() => {
384
- const C = t._getWatch(n, F.current);
385
- return A.current ? A.current(C) : C;
386
- }), O = k.useCallback((C) => {
387
- const R = $e(n, t._names, C || t._formValues, !1, F.current);
388
- return A.current ? A.current(R) : R;
389
- }, [t._formValues, t._names, n]), W = k.useCallback((C) => {
390
- if (!i) {
391
- const R = $e(n, t._names, C || t._formValues, !1, F.current);
383
+ const [b, U] = S.useState(() => {
384
+ const P = t._getWatch(n, F.current);
385
+ return A.current ? A.current(P) : P;
386
+ }), T = S.useCallback((P) => {
387
+ const k = Ye(n, t._names, P || t._formValues, !1, F.current);
388
+ return A.current ? A.current(k) : k;
389
+ }, [t._formValues, t._names, n]), I = S.useCallback((P) => {
390
+ if (!a) {
391
+ const k = Ye(n, t._names, P || t._formValues, !1, F.current);
392
392
  if (A.current) {
393
- const K = A.current(R);
394
- ae(K, T.current) || (B(K), T.current = K);
393
+ const K = A.current(k);
394
+ ie(K, D.current) || (U(K), D.current = K);
395
395
  } else
396
- B(R);
396
+ U(k);
397
397
  }
398
- }, [t._formValues, t._names, i, n]);
399
- Ft(() => ((x.current !== t || !ae(p.current, n)) && (x.current = t, p.current = n, W()), t._subscribe({
398
+ }, [t._formValues, t._names, a, n]);
399
+ Ft(() => ((E.current !== t || !ie(p.current, n)) && (E.current = t, p.current = n, I()), t._subscribe({
400
400
  name: n,
401
401
  formState: {
402
402
  values: !0
403
403
  },
404
404
  exact: u,
405
- callback: (C) => {
406
- W(C.values);
405
+ callback: (P) => {
406
+ I(P.values);
407
407
  }
408
- })), [t, u, n, W]), k.useEffect(() => t._removeUnmounted());
409
- const $ = x.current !== t, E = p.current, J = k.useMemo(() => {
410
- if (i)
408
+ })), [t, u, n, I]), S.useEffect(() => t._removeUnmounted());
409
+ const w = E.current !== t, g = p.current, J = S.useMemo(() => {
410
+ if (a)
411
411
  return null;
412
- const C = !$ && !ae(E, n);
413
- return $ || C ? O() : null;
414
- }, [i, $, n, E, O]);
412
+ const P = !w && !ie(g, n);
413
+ return w || P ? T() : null;
414
+ }, [a, w, n, g, T]);
415
415
  return J !== null ? J : b;
416
416
  }
417
- var er = (e, r, t, n, o) => r ? {
417
+ var tr = (e, r, t, n, o) => r ? {
418
418
  ...t[e],
419
419
  types: {
420
420
  ...t[e] && t[e].types ? t[e].types : {},
421
421
  [n]: o || !0
422
422
  }
423
- } : {}, ke = (e) => Array.isArray(e) ? e : [e], ut = () => {
423
+ } : {}, ke = (e) => Array.isArray(e) ? e : [e], ct = () => {
424
424
  let e = [];
425
425
  return {
426
426
  get observers() {
427
427
  return e;
428
428
  },
429
429
  next: (o) => {
430
- for (const i of e)
431
- i.next && i.next(o);
430
+ for (const a of e)
431
+ a.next && a.next(o);
432
432
  },
433
433
  subscribe: (o) => (e.push(o), {
434
434
  unsubscribe: () => {
435
- e = e.filter((i) => i !== o);
435
+ e = e.filter((a) => a !== o);
436
436
  }
437
437
  }),
438
438
  unsubscribe: () => {
@@ -440,74 +440,74 @@ var er = (e, r, t, n, o) => r ? {
440
440
  }
441
441
  };
442
442
  };
443
- function pt(e, r) {
443
+ function At(e, r) {
444
444
  const t = {};
445
445
  for (const n in e)
446
446
  if (e.hasOwnProperty(n)) {
447
- const o = e[n], i = r[n];
448
- if (o && z(o) && i) {
449
- const u = pt(o, i);
447
+ const o = e[n], a = r[n];
448
+ if (o && z(o) && a) {
449
+ const u = At(o, a);
450
450
  z(u) && (t[n] = u);
451
- } else e[n] && (t[n] = i);
451
+ } else e[n] && (t[n] = a);
452
452
  }
453
453
  return t;
454
454
  }
455
- var Q = (e) => z(e) && !Object.keys(e).length, Xe = (e) => e.type === "file", je = (e) => {
456
- if (!ze)
455
+ var Q = (e) => z(e) && !Object.keys(e).length, Ze = (e) => e.type === "file", je = (e) => {
456
+ if (!He)
457
457
  return !1;
458
458
  const r = e ? e.ownerDocument : 0;
459
459
  return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
460
- }, wt = (e) => e.type === "select-multiple", Ze = (e) => e.type === "radio", tr = (e) => Ze(e) || Te(e), We = (e) => je(e) && e.isConnected;
461
- function rr(e, r) {
460
+ }, wt = (e) => e.type === "select-multiple", Qe = (e) => e.type === "radio", rr = (e) => Qe(e) || Te(e), We = (e) => je(e) && e.isConnected;
461
+ function sr(e, r) {
462
462
  const t = r.slice(0, -1).length;
463
463
  let n = 0;
464
464
  for (; n < t; )
465
- e = M(e) ? n++ : e[r[n++]];
465
+ e = $(e) ? n++ : e[r[n++]];
466
466
  return e;
467
467
  }
468
- function sr(e) {
468
+ function nr(e) {
469
469
  for (const r in e)
470
- if (e.hasOwnProperty(r) && !M(e[r]))
470
+ if (e.hasOwnProperty(r) && !$(e[r]))
471
471
  return !1;
472
472
  return !0;
473
473
  }
474
474
  function q(e, r) {
475
- const t = Array.isArray(r) ? r : Ie(r) ? [r] : Je(r), n = t.length === 1 ? e : rr(e, t), o = t.length - 1, i = t[o];
476
- return n && delete n[i], o !== 0 && (z(n) && Q(n) || Array.isArray(n) && sr(n)) && q(e, t.slice(0, -1)), e;
475
+ const t = Array.isArray(r) ? r : Ie(r) ? [r] : Ge(r), n = t.length === 1 ? e : sr(e, t), o = t.length - 1, a = t[o];
476
+ return n && delete n[a], o !== 0 && (z(n) && Q(n) || Array.isArray(n) && nr(n)) && q(e, t.slice(0, -1)), e;
477
477
  }
478
- var nr = (e) => {
478
+ var ar = (e) => {
479
479
  for (const r in e)
480
480
  if (ne(e[r]))
481
481
  return !0;
482
482
  return !1;
483
483
  };
484
484
  function Rt(e) {
485
- return Array.isArray(e) || z(e) && !nr(e);
485
+ return Array.isArray(e) || z(e) && !ar(e);
486
486
  }
487
- function qe(e, r = {}) {
487
+ function ze(e, r = {}) {
488
488
  for (const t in e) {
489
489
  const n = e[t];
490
- Rt(n) ? (r[t] = Array.isArray(n) ? [] : {}, qe(n, r[t])) : M(n) || (r[t] = !0);
490
+ Rt(n) ? (r[t] = Array.isArray(n) ? [] : {}, ze(n, r[t])) : $(n) || (r[t] = !0);
491
491
  }
492
492
  return r;
493
493
  }
494
494
  function Fe(e, r, t) {
495
- t || (t = qe(r));
495
+ t || (t = ze(r));
496
496
  for (const n in e) {
497
497
  const o = e[n];
498
498
  if (Rt(o))
499
- M(r) || Ye(t[n]) ? t[n] = qe(o, Array.isArray(o) ? [] : {}) : Fe(o, te(r) ? {} : r[n], t[n]);
499
+ $(r) || qe(t[n]) ? t[n] = ze(o, Array.isArray(o) ? [] : {}) : Fe(o, te(r) ? {} : r[n], t[n]);
500
500
  else {
501
- const i = r[n];
502
- t[n] = !ae(o, i);
501
+ const a = r[n];
502
+ t[n] = !ie(o, a);
503
503
  }
504
504
  }
505
505
  return t;
506
506
  }
507
- const ct = {
507
+ const ft = {
508
508
  value: !1,
509
509
  isValid: !1
510
- }, ft = { value: !0, isValid: !0 };
510
+ }, dt = { value: !0, isValid: !0 };
511
511
  var kt = (e) => {
512
512
  if (Array.isArray(e)) {
513
513
  if (e.length > 1) {
@@ -516,28 +516,28 @@ var kt = (e) => {
516
516
  }
517
517
  return e[0].checked && !e[0].disabled ? (
518
518
  // @ts-expect-error expected to work in the browser
519
- e[0].attributes && !M(e[0].attributes.value) ? M(e[0].value) || e[0].value === "" ? ft : { value: e[0].value, isValid: !0 } : ft
520
- ) : ct;
519
+ e[0].attributes && !$(e[0].attributes.value) ? $(e[0].value) || e[0].value === "" ? dt : { value: e[0].value, isValid: !0 } : dt
520
+ ) : ft;
521
521
  }
522
- return ct;
523
- }, St = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => M(e) ? e : r ? e === "" ? NaN : e && +e : t && re(e) ? new Date(e) : n ? n(e) : e;
524
- const dt = {
522
+ return ft;
523
+ }, St = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => $(e) ? e : r ? e === "" ? NaN : e && +e : t && re(e) ? new Date(e) : n ? n(e) : e;
524
+ const yt = {
525
525
  isValid: !1,
526
526
  value: null
527
527
  };
528
528
  var Tt = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
529
529
  isValid: !0,
530
530
  value: t.value
531
- } : r, dt) : dt;
532
- function yt(e) {
531
+ } : r, yt) : yt;
532
+ function mt(e) {
533
533
  const r = e.ref;
534
- return Xe(r) ? r.files : Ze(r) ? Tt(e.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Te(r) ? kt(e.refs).value : St(M(r.value) ? e.ref.value : r.value, e);
534
+ return Ze(r) ? r.files : Qe(r) ? Tt(e.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : Te(r) ? kt(e.refs).value : St($(r.value) ? e.ref.value : r.value, e);
535
535
  }
536
536
  var ir = (e, r, t, n) => {
537
537
  const o = {};
538
- for (const i of e) {
539
- const u = h(r, i);
540
- u && N(o, i, u._f);
538
+ for (const a of e) {
539
+ const u = h(r, a);
540
+ u && L(o, a, u._f);
541
541
  }
542
542
  return {
543
543
  criteriaMode: t,
@@ -545,20 +545,20 @@ var ir = (e, r, t, n) => {
545
545
  fields: o,
546
546
  shouldUseNativeValidation: n
547
547
  };
548
- }, Pe = (e) => e instanceof RegExp, Re = (e) => M(e) ? e : Pe(e) ? e.source : z(e) ? Pe(e.value) ? e.value.source : e.value : e, mt = (e) => ({
549
- isOnSubmit: !e || e === ie.onSubmit,
550
- isOnBlur: e === ie.onBlur,
551
- isOnChange: e === ie.onChange,
552
- isOnAll: e === ie.all,
553
- isOnTouch: e === ie.onTouched
548
+ }, Pe = (e) => e instanceof RegExp, Re = (e) => $(e) ? e : Pe(e) ? e.source : z(e) ? Pe(e.value) ? e.value.source : e.value : e, ht = (e) => ({
549
+ isOnSubmit: !e || e === ae.onSubmit,
550
+ isOnBlur: e === ae.onBlur,
551
+ isOnChange: e === ae.onChange,
552
+ isOnAll: e === ae.all,
553
+ isOnTouch: e === ae.onTouched
554
554
  });
555
- const ht = "AsyncFunction";
556
- var ar = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === ht || z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === ht)), or = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), vt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
555
+ const vt = "AsyncFunction";
556
+ var or = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === vt || z(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === vt)), lr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), bt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
557
557
  const Se = (e, r, t, n) => {
558
558
  for (const o of t || Object.keys(e)) {
559
- const i = h(e, o);
560
- if (i) {
561
- const { _f: u, ...f } = i;
559
+ const a = h(e, o);
560
+ if (a) {
561
+ const { _f: u, ...f } = a;
562
562
  if (u) {
563
563
  if (u.refs && u.refs[0] && r(u.refs[0], o) && !n)
564
564
  return !0;
@@ -571,7 +571,7 @@ const Se = (e, r, t, n) => {
571
571
  }
572
572
  }
573
573
  };
574
- function bt(e, r, t) {
574
+ function gt(e, r, t) {
575
575
  const n = h(e, t);
576
576
  if (n || Ie(t))
577
577
  return {
@@ -580,17 +580,17 @@ function bt(e, r, t) {
580
580
  };
581
581
  const o = t.split(".");
582
582
  for (; o.length; ) {
583
- const i = o.join("."), u = h(r, i), f = h(e, i);
584
- if (u && !Array.isArray(u) && t !== i)
583
+ const a = o.join("."), u = h(r, a), f = h(e, a);
584
+ if (u && !Array.isArray(u) && t !== a)
585
585
  return { name: t };
586
586
  if (f && f.type)
587
587
  return {
588
- name: i,
588
+ name: a,
589
589
  error: f
590
590
  };
591
591
  if (f && f.root && f.root.type)
592
592
  return {
593
- name: `${i}.root`,
593
+ name: `${a}.root`,
594
594
  error: f.root
595
595
  };
596
596
  o.pop();
@@ -599,15 +599,15 @@ function bt(e, r, t) {
599
599
  name: t
600
600
  };
601
601
  }
602
- var lr = (e, r, t, n) => {
602
+ var ur = (e, r, t, n) => {
603
603
  t(e);
604
- const { name: o, ...i } = e;
605
- return Q(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((u) => r[u] === (!n || ie.all));
606
- }, ur = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), cr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, fr = (e, r) => !He(h(e, r)).length && q(e, r), dr = (e, r, t) => {
604
+ const { name: o, ...a } = e;
605
+ return Q(a) || Object.keys(a).length >= Object.keys(r).length || Object.keys(a).find((u) => r[u] === (!n || ae.all));
606
+ }, cr = (e, r, t) => !e || !r || e === r || ke(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), fr = (e, r, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(r || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, dr = (e, r) => !Je(h(e, r)).length && q(e, r), yr = (e, r, t) => {
607
607
  const n = ke(h(e, t));
608
- return N(n, "root", r[t]), N(e, t, n), e;
608
+ return L(n, "root", r[t]), L(e, t, n), e;
609
609
  };
610
- function gt(e, r, t = "validate") {
610
+ function _t(e, r, t = "validate") {
611
611
  if (re(e) || Array.isArray(e) && e.every(re) || ue(e) && !e)
612
612
  return {
613
613
  type: t,
@@ -618,95 +618,95 @@ function gt(e, r, t = "validate") {
618
618
  var Ve = (e) => z(e) && !Pe(e) ? e : {
619
619
  value: e,
620
620
  message: ""
621
- }, _t = async (e, r, t, n, o, i) => {
622
- const { ref: u, refs: f, required: F, maxLength: A, minLength: T, min: x, max: p, pattern: b, validate: B, name: O, valueAsNumber: W, mount: $ } = e._f, E = h(t, O);
623
- if (!$ || r.has(O))
621
+ }, xt = async (e, r, t, n, o, a) => {
622
+ const { ref: u, refs: f, required: F, maxLength: A, minLength: D, min: E, max: p, pattern: b, validate: U, name: T, valueAsNumber: I, mount: w } = e._f, g = h(t, T);
623
+ if (!w || r.has(T))
624
624
  return {};
625
- const J = f ? f[0] : u, C = (_) => {
626
- o && J.reportValidity && (J.setCustomValidity(ue(_) ? "" : _ || ""), J.reportValidity());
627
- }, R = {}, K = Ze(u), oe = Te(u), j = K || oe, G = (W || Xe(u)) && M(u.value) && M(E) || je(u) && u.value === "" || E === "" || Array.isArray(E) && !E.length, X = er.bind(null, O, n, R), ge = (_, w, I, Y = ce.maxLength, ee = ce.minLength) => {
628
- const Z = _ ? w : I;
629
- R[O] = {
630
- type: _ ? Y : ee,
625
+ const J = f ? f[0] : u, P = (x) => {
626
+ o && J.reportValidity && (J.setCustomValidity(ue(x) ? "" : x || ""), J.reportValidity());
627
+ }, k = {}, K = Qe(u), oe = Te(u), j = K || oe, G = (I || Ze(u)) && $(u.value) && $(g) || je(u) && u.value === "" || g === "" || Array.isArray(g) && !g.length, X = tr.bind(null, T, n, k), ge = (x, R, B, Y = ce.maxLength, ee = ce.minLength) => {
628
+ const Z = x ? R : B;
629
+ k[T] = {
630
+ type: x ? Y : ee,
631
631
  message: Z,
632
632
  ref: u,
633
- ...X(_ ? Y : ee, Z)
633
+ ...X(x ? Y : ee, Z)
634
634
  };
635
635
  };
636
- if (i ? !Array.isArray(E) || !E.length : F && (!j && (G || te(E)) || ue(E) && !E || oe && !kt(f).isValid || K && !Tt(f).isValid)) {
637
- const { value: _, message: w } = re(F) ? { value: !!F, message: F } : Ve(F);
638
- if (_ && (R[O] = {
636
+ if (a ? !Array.isArray(g) || !g.length : F && (!j && (G || te(g)) || ue(g) && !g || oe && !kt(f).isValid || K && !Tt(f).isValid)) {
637
+ const { value: x, message: R } = re(F) ? { value: !!F, message: F } : Ve(F);
638
+ if (x && (k[T] = {
639
639
  type: ce.required,
640
- message: w,
640
+ message: R,
641
641
  ref: J,
642
- ...X(ce.required, w)
642
+ ...X(ce.required, R)
643
643
  }, !n))
644
- return C(w), R;
644
+ return P(R), k;
645
645
  }
646
- if (!G && (!te(x) || !te(p))) {
647
- let _, w;
648
- const I = Ve(p), Y = Ve(x);
649
- if (!te(E) && !isNaN(E)) {
650
- const ee = u.valueAsNumber || E && +E;
651
- te(I.value) || (_ = ee > I.value), te(Y.value) || (w = ee < Y.value);
646
+ if (!G && (!te(E) || !te(p))) {
647
+ let x, R;
648
+ const B = Ve(p), Y = Ve(E);
649
+ if (!te(g) && !isNaN(g)) {
650
+ const ee = u.valueAsNumber || g && +g;
651
+ te(B.value) || (x = ee > B.value), te(Y.value) || (R = ee < Y.value);
652
652
  } else {
653
- const ee = u.valueAsDate || new Date(E), Z = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = u.type == "time", de = u.type == "week";
654
- re(I.value) && E && (_ = fe ? Z(E) > Z(I.value) : de ? E > I.value : ee > new Date(I.value)), re(Y.value) && E && (w = fe ? Z(E) < Z(Y.value) : de ? E < Y.value : ee < new Date(Y.value));
653
+ const ee = u.valueAsDate || new Date(g), Z = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = u.type == "time", de = u.type == "week";
654
+ re(B.value) && g && (x = fe ? Z(g) > Z(B.value) : de ? g > B.value : ee > new Date(B.value)), re(Y.value) && g && (R = fe ? Z(g) < Z(Y.value) : de ? g < Y.value : ee < new Date(Y.value));
655
655
  }
656
- if ((_ || w) && (ge(!!_, I.message, Y.message, ce.max, ce.min), !n))
657
- return C(R[O].message), R;
656
+ if ((x || R) && (ge(!!x, B.message, Y.message, ce.max, ce.min), !n))
657
+ return P(k[T].message), k;
658
658
  }
659
- if ((A || T) && !G && (re(E) || i && Array.isArray(E))) {
660
- const _ = Ve(A), w = Ve(T), I = !te(_.value) && E.length > +_.value, Y = !te(w.value) && E.length < +w.value;
661
- if ((I || Y) && (ge(I, _.message, w.message), !n))
662
- return C(R[O].message), R;
659
+ if ((A || D) && !G && (re(g) || a && Array.isArray(g))) {
660
+ const x = Ve(A), R = Ve(D), B = !te(x.value) && g.length > +x.value, Y = !te(R.value) && g.length < +R.value;
661
+ if ((B || Y) && (ge(B, x.message, R.message), !n))
662
+ return P(k[T].message), k;
663
663
  }
664
- if (b && !G && re(E)) {
665
- const { value: _, message: w } = Ve(b);
666
- if (Pe(_) && !E.match(_) && (R[O] = {
664
+ if (b && !G && re(g)) {
665
+ const { value: x, message: R } = Ve(b);
666
+ if (Pe(x) && !g.match(x) && (k[T] = {
667
667
  type: ce.pattern,
668
- message: w,
668
+ message: R,
669
669
  ref: u,
670
- ...X(ce.pattern, w)
670
+ ...X(ce.pattern, R)
671
671
  }, !n))
672
- return C(w), R;
672
+ return P(R), k;
673
673
  }
674
- if (B) {
675
- if (ne(B)) {
676
- const _ = await B(E, t), w = gt(_, J);
677
- if (w && (R[O] = {
678
- ...w,
679
- ...X(ce.validate, w.message)
674
+ if (U) {
675
+ if (ne(U)) {
676
+ const x = await U(g, t), R = _t(x, J);
677
+ if (R && (k[T] = {
678
+ ...R,
679
+ ...X(ce.validate, R.message)
680
680
  }, !n))
681
- return C(w.message), R;
682
- } else if (z(B)) {
683
- let _ = {};
684
- for (const w in B) {
685
- if (!Q(_) && !n)
681
+ return P(R.message), k;
682
+ } else if (z(U)) {
683
+ let x = {};
684
+ for (const R in U) {
685
+ if (!Q(x) && !n)
686
686
  break;
687
- const I = gt(await B[w](E, t), J, w);
688
- I && (_ = {
689
- ...I,
690
- ...X(w, I.message)
691
- }, C(I.message), n && (R[O] = _));
687
+ const B = _t(await U[R](g, t), J, R);
688
+ B && (x = {
689
+ ...B,
690
+ ...X(R, B.message)
691
+ }, P(B.message), n && (k[T] = x));
692
692
  }
693
- if (!Q(_) && (R[O] = {
693
+ if (!Q(x) && (k[T] = {
694
694
  ref: J,
695
- ..._
695
+ ...x
696
696
  }, !n))
697
- return R;
697
+ return k;
698
698
  }
699
699
  }
700
- return C(!0), R;
700
+ return P(!0), k;
701
701
  };
702
- const yr = {
703
- mode: ie.onSubmit,
704
- reValidateMode: ie.onChange,
702
+ const mr = {
703
+ mode: ae.onSubmit,
704
+ reValidateMode: ae.onChange,
705
705
  shouldFocusError: !0
706
706
  };
707
- function mr(e = {}) {
707
+ function hr(e = {}) {
708
708
  let r = {
709
- ...yr,
709
+ ...mr,
710
710
  ...e
711
711
  }, t = {
712
712
  submitCount: 0,
@@ -723,7 +723,7 @@ function mr(e = {}) {
723
723
  validatingFields: {},
724
724
  errors: r.errors || {},
725
725
  disabled: r.disabled || !1
726
- }, n = {}, o = z(r.defaultValues) || z(r.values) ? H(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : H(o), u = {
726
+ }, n = {}, o = z(r.defaultValues) || z(r.values) ? H(r.defaultValues || r.values) || {} : {}, a = r.shouldUnregister ? {} : H(o), u = {
727
727
  action: !1,
728
728
  mount: !1,
729
729
  watch: !1,
@@ -735,7 +735,7 @@ function mr(e = {}) {
735
735
  array: /* @__PURE__ */ new Set(),
736
736
  watch: /* @__PURE__ */ new Set()
737
737
  }, F, A = 0;
738
- const T = {
738
+ const D = {
739
739
  isDirty: !1,
740
740
  dirtyFields: !1,
741
741
  validatingFields: !1,
@@ -743,93 +743,93 @@ function mr(e = {}) {
743
743
  isValidating: !1,
744
744
  isValid: !1,
745
745
  errors: !1
746
- }, x = {
747
- ...T
746
+ }, E = {
747
+ ...D
748
748
  };
749
749
  let p = {
750
- ...x
750
+ ...E
751
751
  };
752
752
  const b = {
753
- array: ut(),
754
- state: ut()
755
- }, B = r.criteriaMode === ie.all, O = (s) => (a) => {
756
- clearTimeout(A), A = setTimeout(s, a);
757
- }, W = async (s) => {
758
- if (!u.keepIsValid && !r.disabled && (x.isValid || p.isValid || s)) {
759
- let a;
760
- r.resolver ? (a = Q((await j()).errors), $()) : a = await X(n, !0), a !== t.isValid && b.state.next({
761
- isValid: a
753
+ array: ct(),
754
+ state: ct()
755
+ }, U = r.criteriaMode === ae.all, T = (s) => (i) => {
756
+ clearTimeout(A), A = setTimeout(s, i);
757
+ }, I = async (s) => {
758
+ if (!u.keepIsValid && !r.disabled && (E.isValid || p.isValid || s)) {
759
+ let i;
760
+ r.resolver ? (i = Q((await j()).errors), w()) : i = await X(n, !0), i !== t.isValid && b.state.next({
761
+ isValid: i
762
762
  });
763
763
  }
764
- }, $ = (s, a) => {
765
- !r.disabled && (x.isValidating || x.validatingFields || p.isValidating || p.validatingFields) && ((s || Array.from(f.mount)).forEach((l) => {
766
- l && (a ? N(t.validatingFields, l, a) : q(t.validatingFields, l));
764
+ }, w = (s, i) => {
765
+ !r.disabled && (E.isValidating || E.validatingFields || p.isValidating || p.validatingFields) && ((s || Array.from(f.mount)).forEach((l) => {
766
+ l && (i ? L(t.validatingFields, l, i) : q(t.validatingFields, l));
767
767
  }), b.state.next({
768
768
  validatingFields: t.validatingFields,
769
769
  isValidating: !Q(t.validatingFields)
770
770
  }));
771
- }, E = (s, a = [], l, m, y = !0, d = !0) => {
771
+ }, g = (s, i = [], l, m, y = !0, d = !0) => {
772
772
  if (m && l && !r.disabled) {
773
773
  if (u.action = !0, d && Array.isArray(h(n, s))) {
774
774
  const v = l(h(n, s), m.argA, m.argB);
775
- y && N(n, s, v);
775
+ y && L(n, s, v);
776
776
  }
777
777
  if (d && Array.isArray(h(t.errors, s))) {
778
778
  const v = l(h(t.errors, s), m.argA, m.argB);
779
- y && N(t.errors, s, v), fr(t.errors, s);
779
+ y && L(t.errors, s, v), dr(t.errors, s);
780
780
  }
781
- if ((x.touchedFields || p.touchedFields) && d && Array.isArray(h(t.touchedFields, s))) {
781
+ if ((E.touchedFields || p.touchedFields) && d && Array.isArray(h(t.touchedFields, s))) {
782
782
  const v = l(h(t.touchedFields, s), m.argA, m.argB);
783
- y && N(t.touchedFields, s, v);
783
+ y && L(t.touchedFields, s, v);
784
784
  }
785
- (x.dirtyFields || p.dirtyFields) && (t.dirtyFields = Fe(o, i)), b.state.next({
785
+ (E.dirtyFields || p.dirtyFields) && (t.dirtyFields = Fe(o, a)), b.state.next({
786
786
  name: s,
787
- isDirty: _(s, a),
787
+ isDirty: x(s, i),
788
788
  dirtyFields: t.dirtyFields,
789
789
  errors: t.errors,
790
790
  isValid: t.isValid
791
791
  });
792
792
  } else
793
- N(i, s, a);
794
- }, J = (s, a) => {
795
- N(t.errors, s, a), b.state.next({
793
+ L(a, s, i);
794
+ }, J = (s, i) => {
795
+ L(t.errors, s, i), b.state.next({
796
796
  errors: t.errors
797
797
  });
798
- }, C = (s) => {
798
+ }, P = (s) => {
799
799
  t.errors = s, b.state.next({
800
800
  errors: t.errors,
801
801
  isValid: !1
802
802
  });
803
- }, R = (s, a, l, m) => {
803
+ }, k = (s, i, l, m) => {
804
804
  const y = h(n, s);
805
805
  if (y) {
806
- const d = h(i, s, M(l) ? h(o, s) : l);
807
- M(d) || m && m.defaultChecked || a ? N(i, s, a ? d : yt(y._f)) : Y(s, d), u.mount && !u.action && W();
806
+ const d = h(a, s, $(l) ? h(o, s) : l);
807
+ $(d) || m && m.defaultChecked || i ? L(a, s, i ? d : mt(y._f)) : Y(s, d), u.mount && !u.action && I();
808
808
  }
809
- }, K = (s, a, l, m, y) => {
809
+ }, K = (s, i, l, m, y) => {
810
810
  let d = !1, v = !1;
811
- const S = {
811
+ const O = {
812
812
  name: s
813
813
  };
814
814
  if (!r.disabled) {
815
815
  if (!l || m) {
816
- (x.isDirty || p.isDirty) && (v = t.isDirty, t.isDirty = S.isDirty = _(), d = v !== S.isDirty);
817
- const D = ae(h(o, s), a);
818
- v = !!h(t.dirtyFields, s), D ? q(t.dirtyFields, s) : N(t.dirtyFields, s, !0), S.dirtyFields = t.dirtyFields, d = d || (x.dirtyFields || p.dirtyFields) && v !== !D;
816
+ (E.isDirty || p.isDirty) && (v = t.isDirty, t.isDirty = O.isDirty = x(), d = v !== O.isDirty);
817
+ const C = ie(h(o, s), i);
818
+ v = !!h(t.dirtyFields, s), C ? q(t.dirtyFields, s) : L(t.dirtyFields, s, !0), O.dirtyFields = t.dirtyFields, d = d || (E.dirtyFields || p.dirtyFields) && v !== !C;
819
819
  }
820
820
  if (l) {
821
- const D = h(t.touchedFields, s);
822
- D || (N(t.touchedFields, s, l), S.touchedFields = t.touchedFields, d = d || (x.touchedFields || p.touchedFields) && D !== l);
821
+ const C = h(t.touchedFields, s);
822
+ C || (L(t.touchedFields, s, l), O.touchedFields = t.touchedFields, d = d || (E.touchedFields || p.touchedFields) && C !== l);
823
823
  }
824
- d && y && b.state.next(S);
824
+ d && y && b.state.next(O);
825
825
  }
826
- return d ? S : {};
827
- }, oe = (s, a, l, m) => {
828
- const y = h(t.errors, s), d = (x.isValid || p.isValid) && ue(a) && t.isValid !== a;
829
- if (r.delayError && l ? (F = O(() => J(s, l)), F(r.delayError)) : (clearTimeout(A), F = null, l ? N(t.errors, s, l) : q(t.errors, s)), (l ? !ae(y, l) : y) || !Q(m) || d) {
826
+ return d ? O : {};
827
+ }, oe = (s, i, l, m) => {
828
+ const y = h(t.errors, s), d = (E.isValid || p.isValid) && ue(i) && t.isValid !== i;
829
+ if (r.delayError && l ? (F = T(() => J(s, l)), F(r.delayError)) : (clearTimeout(A), F = null, l ? L(t.errors, s, l) : q(t.errors, s)), (l ? !ie(y, l) : y) || !Q(m) || d) {
830
830
  const v = {
831
831
  ...m,
832
- ...d && ue(a) ? { isValid: a } : {},
832
+ ...d && ue(i) ? { isValid: i } : {},
833
833
  errors: t.errors,
834
834
  name: s
835
835
  };
@@ -838,17 +838,17 @@ function mr(e = {}) {
838
838
  ...v
839
839
  }, b.state.next(v);
840
840
  }
841
- }, j = async (s) => ($(s, !0), await r.resolver(i, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), G = async (s) => {
842
- const { errors: a } = await j(s);
843
- if ($(s), s)
841
+ }, j = async (s) => (w(s, !0), await r.resolver(a, r.context, ir(s || f.mount, n, r.criteriaMode, r.shouldUseNativeValidation))), G = async (s) => {
842
+ const { errors: i } = await j(s);
843
+ if (w(s), s)
844
844
  for (const l of s) {
845
- const m = h(a, l);
846
- m ? N(t.errors, l, m) : q(t.errors, l);
845
+ const m = h(i, l);
846
+ m ? L(t.errors, l, m) : q(t.errors, l);
847
847
  }
848
848
  else
849
- t.errors = a;
850
- return a;
851
- }, X = async (s, a, l = {
849
+ t.errors = i;
850
+ return i;
851
+ }, X = async (s, i, l = {
852
852
  valid: !0
853
853
  }) => {
854
854
  for (const m in s) {
@@ -856,227 +856,227 @@ function mr(e = {}) {
856
856
  if (y) {
857
857
  const { _f: d, ...v } = y;
858
858
  if (d) {
859
- const S = f.array.has(d.name), D = y._f && ar(y._f);
860
- D && x.validatingFields && $([d.name], !0);
861
- const se = await _t(y, f.disabled, i, B, r.shouldUseNativeValidation && !a, S);
862
- if (D && x.validatingFields && $([d.name]), se[d.name] && (l.valid = !1, a))
859
+ const O = f.array.has(d.name), C = y._f && or(y._f);
860
+ C && E.validatingFields && w([d.name], !0);
861
+ const se = await xt(y, f.disabled, a, U, r.shouldUseNativeValidation && !i, O);
862
+ if (C && E.validatingFields && w([d.name]), se[d.name] && (l.valid = !1, i))
863
863
  break;
864
- !a && (h(se, d.name) ? S ? dr(t.errors, se, d.name) : N(t.errors, d.name, se[d.name]) : q(t.errors, d.name));
864
+ !i && (h(se, d.name) ? O ? yr(t.errors, se, d.name) : L(t.errors, d.name, se[d.name]) : q(t.errors, d.name));
865
865
  }
866
- !Q(v) && await X(v, a, l);
866
+ !Q(v) && await X(v, i, l);
867
867
  }
868
868
  }
869
869
  return l.valid;
870
870
  }, ge = () => {
871
871
  for (const s of f.unMount) {
872
- const a = h(n, s);
873
- a && (a._f.refs ? a._f.refs.every((l) => !We(l)) : !We(a._f.ref)) && le(s);
872
+ const i = h(n, s);
873
+ i && (i._f.refs ? i._f.refs.every((l) => !We(l)) : !We(i._f.ref)) && le(s);
874
874
  }
875
875
  f.unMount = /* @__PURE__ */ new Set();
876
- }, _ = (s, a) => !r.disabled && (s && a && N(i, s, a), !ae(c(), o)), w = (s, a, l) => $e(s, f, {
877
- ...u.mount ? i : M(a) ? o : re(s) ? { [s]: a } : a
878
- }, l, a), I = (s) => He(h(u.mount ? i : o, s, r.shouldUnregister ? h(o, s, []) : [])), Y = (s, a, l = {}) => {
876
+ }, x = (s, i) => !r.disabled && (s && i && L(a, s, i), !ie(c(), o)), R = (s, i, l) => Ye(s, f, {
877
+ ...u.mount ? a : $(i) ? o : re(s) ? { [s]: i } : i
878
+ }, l, i), B = (s) => Je(h(u.mount ? a : o, s, r.shouldUnregister ? h(o, s, []) : [])), Y = (s, i, l = {}) => {
879
879
  const m = h(n, s);
880
- let y = a;
880
+ let y = i;
881
881
  if (m) {
882
882
  const d = m._f;
883
- d && (!d.disabled && N(i, s, St(a, d)), y = je(d.ref) && te(a) ? "" : a, wt(d.ref) ? [...d.ref.options].forEach((v) => v.selected = y.includes(v.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((v) => {
884
- (!v.defaultChecked || !v.disabled) && (Array.isArray(y) ? v.checked = !!y.find((S) => S === v.value) : v.checked = y === v.value || !!y);
885
- }) : d.refs.forEach((v) => v.checked = v.value === y) : Xe(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || b.state.next({
883
+ d && (!d.disabled && L(a, s, St(i, d)), y = je(d.ref) && te(i) ? "" : i, wt(d.ref) ? [...d.ref.options].forEach((v) => v.selected = y.includes(v.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((v) => {
884
+ (!v.defaultChecked || !v.disabled) && (Array.isArray(y) ? v.checked = !!y.find((O) => O === v.value) : v.checked = y === v.value || !!y);
885
+ }) : d.refs.forEach((v) => v.checked = v.value === y) : Ze(d.ref) ? d.ref.value = "" : (d.ref.value = y, d.ref.type || b.state.next({
886
886
  name: s,
887
- values: H(i)
887
+ values: H(a)
888
888
  })));
889
889
  }
890
890
  (l.shouldDirty || l.shouldTouch) && K(s, y, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(s);
891
- }, ee = (s, a, l) => {
892
- for (const m in a) {
893
- if (!a.hasOwnProperty(m))
891
+ }, ee = (s, i, l) => {
892
+ for (const m in i) {
893
+ if (!i.hasOwnProperty(m))
894
894
  return;
895
- const y = a[m], d = s + "." + m, v = h(n, d);
895
+ const y = i[m], d = s + "." + m, v = h(n, d);
896
896
  (f.array.has(s) || z(y) || v && !v._f) && !ve(y) ? ee(d, y, l) : Y(d, y, l);
897
897
  }
898
- }, Z = (s, a, l = {}) => {
899
- const m = h(n, s), y = f.array.has(s), d = H(a);
900
- N(i, s, d), y ? (b.array.next({
898
+ }, Z = (s, i, l = {}) => {
899
+ const m = h(n, s), y = f.array.has(s), d = H(i);
900
+ L(a, s, d), y ? (b.array.next({
901
901
  name: s,
902
- values: H(i)
903
- }), (x.isDirty || x.dirtyFields || p.isDirty || p.dirtyFields) && l.shouldDirty && b.state.next({
902
+ values: H(a)
903
+ }), (E.isDirty || E.dirtyFields || p.isDirty || p.dirtyFields) && l.shouldDirty && b.state.next({
904
904
  name: s,
905
- dirtyFields: Fe(o, i),
906
- isDirty: _(s, d)
907
- })) : m && !m._f && !te(d) ? ee(s, d, l) : Y(s, d, l), vt(s, f) && b.state.next({ ...t, name: s }), b.state.next({
905
+ dirtyFields: Fe(o, a),
906
+ isDirty: x(s, d)
907
+ })) : m && !m._f && !te(d) ? ee(s, d, l) : Y(s, d, l), bt(s, f) && b.state.next({ ...t, name: s }), b.state.next({
908
908
  name: u.mount ? s : void 0,
909
- values: H(i)
909
+ values: H(a)
910
910
  });
911
911
  }, fe = async (s) => {
912
912
  u.mount = !0;
913
- const a = s.target;
914
- let l = a.name, m = !0;
915
- const y = h(n, l), d = (D) => {
916
- m = Number.isNaN(D) || ve(D) && isNaN(D.getTime()) || ae(D, h(i, l, D));
917
- }, v = mt(r.mode), S = mt(r.reValidateMode);
913
+ const i = s.target;
914
+ let l = i.name, m = !0;
915
+ const y = h(n, l), d = (C) => {
916
+ m = Number.isNaN(C) || ve(C) && isNaN(C.getTime()) || ie(C, h(a, l, C));
917
+ }, v = ht(r.mode), O = ht(r.reValidateMode);
918
918
  if (y) {
919
- let D, se;
920
- const Oe = a.type ? yt(y._f) : Jt(s), me = s.type === lt.BLUR || s.type === lt.FOCUS_OUT, Ut = !or(y._f) && !r.resolver && !h(t.errors, l) && !y._f.deps || cr(me, h(t.touchedFields, l), t.isSubmitted, S, v), Me = vt(l, f, me);
921
- N(i, l, Oe), me ? (!a || !a.readOnly) && (y._f.onBlur && y._f.onBlur(s), F && F(0)) : y._f.onChange && y._f.onChange(s);
919
+ let C, se;
920
+ const Oe = i.type ? mt(y._f) : Gt(s), me = s.type === ut.BLUR || s.type === ut.FOCUS_OUT, Ut = !lr(y._f) && !r.resolver && !h(t.errors, l) && !y._f.deps || fr(me, h(t.touchedFields, l), t.isSubmitted, O, v), Me = bt(l, f, me);
921
+ L(a, l, Oe), me ? (!i || !i.readOnly) && (y._f.onBlur && y._f.onBlur(s), F && F(0)) : y._f.onChange && y._f.onChange(s);
922
922
  const Be = K(l, Oe, me), Mt = !Q(Be) || Me;
923
923
  if (!me && b.state.next({
924
924
  name: l,
925
925
  type: s.type,
926
- values: H(i)
926
+ values: H(a)
927
927
  }), Ut)
928
- return (x.isValid || p.isValid) && (r.mode === "onBlur" ? me && W() : me || W()), Mt && b.state.next({ name: l, ...Me ? {} : Be });
928
+ return (E.isValid || p.isValid) && (r.mode === "onBlur" ? me && I() : me || I()), Mt && b.state.next({ name: l, ...Me ? {} : Be });
929
929
  if (!me && Me && b.state.next({ ...t }), r.resolver) {
930
- const { errors: st } = await j([l]);
931
- if ($([l]), d(Oe), m) {
932
- const Bt = bt(t.errors, n, l), nt = bt(st, n, Bt.name || l);
933
- D = nt.error, l = nt.name, se = Q(st);
930
+ const { errors: nt } = await j([l]);
931
+ if (w([l]), d(Oe), m) {
932
+ const Bt = gt(t.errors, n, l), at = gt(nt, n, Bt.name || l);
933
+ C = at.error, l = at.name, se = Q(nt);
934
934
  }
935
935
  } else
936
- $([l], !0), D = (await _t(y, f.disabled, i, B, r.shouldUseNativeValidation))[l], $([l]), d(Oe), m && (D ? se = !1 : (x.isValid || p.isValid) && (se = await X(n, !0)));
937
- m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && ye(y._f.deps), oe(l, se, D, Be));
936
+ w([l], !0), C = (await xt(y, f.disabled, a, U, r.shouldUseNativeValidation))[l], w([l]), d(Oe), m && (C ? se = !1 : (E.isValid || p.isValid) && (se = await X(n, !0)));
937
+ m && (y._f.deps && (!Array.isArray(y._f.deps) || y._f.deps.length > 0) && ye(y._f.deps), oe(l, se, C, Be));
938
938
  }
939
- }, de = (s, a) => {
940
- if (h(t.errors, a) && s.focus)
939
+ }, de = (s, i) => {
940
+ if (h(t.errors, i) && s.focus)
941
941
  return s.focus(), 1;
942
- }, ye = async (s, a = {}) => {
942
+ }, ye = async (s, i = {}) => {
943
943
  let l, m;
944
944
  const y = ke(s);
945
945
  if (r.resolver) {
946
- const d = await G(M(s) ? s : y);
946
+ const d = await G($(s) ? s : y);
947
947
  l = Q(d), m = s ? !y.some((v) => h(d, v)) : l;
948
948
  } else s ? (m = (await Promise.all(y.map(async (d) => {
949
949
  const v = h(n, d);
950
950
  return await X(v && v._f ? { [d]: v } : v);
951
- }))).every(Boolean), !(!m && !t.isValid) && W()) : m = l = await X(n);
951
+ }))).every(Boolean), !(!m && !t.isValid) && I()) : m = l = await X(n);
952
952
  return b.state.next({
953
- ...!re(s) || (x.isValid || p.isValid) && l !== t.isValid ? {} : { name: s },
953
+ ...!re(s) || (E.isValid || p.isValid) && l !== t.isValid ? {} : { name: s },
954
954
  ...r.resolver || !s ? { isValid: l } : {},
955
955
  errors: t.errors
956
- }), a.shouldFocus && !m && Se(n, de, s ? y : f.mount), m;
957
- }, c = (s, a) => {
956
+ }), i.shouldFocus && !m && Se(n, de, s ? y : f.mount), m;
957
+ }, c = (s, i) => {
958
958
  let l = {
959
- ...u.mount ? i : o
959
+ ...u.mount ? a : o
960
960
  };
961
- return a && (l = pt(a.dirtyFields ? t.dirtyFields : t.touchedFields, l)), M(s) ? l : re(s) ? h(l, s) : s.map((m) => h(l, m));
962
- }, g = (s, a) => ({
963
- invalid: !!h((a || t).errors, s),
964
- isDirty: !!h((a || t).dirtyFields, s),
965
- error: h((a || t).errors, s),
961
+ return i && (l = At(i.dirtyFields ? t.dirtyFields : t.touchedFields, l)), $(s) ? l : re(s) ? h(l, s) : s.map((m) => h(l, m));
962
+ }, _ = (s, i) => ({
963
+ invalid: !!h((i || t).errors, s),
964
+ isDirty: !!h((i || t).dirtyFields, s),
965
+ error: h((i || t).errors, s),
966
966
  isValidating: !!h(t.validatingFields, s),
967
- isTouched: !!h((a || t).touchedFields, s)
968
- }), P = (s) => {
969
- s && ke(s).forEach((a) => q(t.errors, a)), b.state.next({
967
+ isTouched: !!h((i || t).touchedFields, s)
968
+ }), N = (s) => {
969
+ s && ke(s).forEach((i) => q(t.errors, i)), b.state.next({
970
970
  errors: s ? t.errors : {}
971
971
  });
972
- }, L = (s, a, l) => {
973
- const m = (h(n, s, { _f: {} })._f || {}).ref, y = h(t.errors, s) || {}, { ref: d, message: v, type: S, ...D } = y;
974
- N(t.errors, s, {
975
- ...D,
976
- ...a,
972
+ }, M = (s, i, l) => {
973
+ const m = (h(n, s, { _f: {} })._f || {}).ref, y = h(t.errors, s) || {}, { ref: d, message: v, type: O, ...C } = y;
974
+ L(t.errors, s, {
975
+ ...C,
976
+ ...i,
977
977
  ref: m
978
978
  }), b.state.next({
979
979
  name: s,
980
980
  errors: t.errors,
981
981
  isValid: !1
982
982
  }), l && l.shouldFocus && m && m.focus && m.focus();
983
- }, _e = (s, a) => ne(s) ? b.state.subscribe({
984
- next: (l) => "values" in l && s(w(void 0, a), l)
985
- }) : w(s, a, !0), xe = (s) => b.state.subscribe({
986
- next: (a) => {
987
- ur(s.name, a.name, s.exact) && lr(a, s.formState || x, It, s.reRenderRoot) && s.callback({
988
- values: { ...i },
983
+ }, _e = (s, i) => ne(s) ? b.state.subscribe({
984
+ next: (l) => "values" in l && s(R(void 0, i), l)
985
+ }) : R(s, i, !0), xe = (s) => b.state.subscribe({
986
+ next: (i) => {
987
+ cr(s.name, i.name, s.exact) && ur(i, s.formState || E, It, s.reRenderRoot) && s.callback({
988
+ values: { ...a },
989
989
  ...t,
990
- ...a,
990
+ ...i,
991
991
  defaultValues: o
992
992
  });
993
993
  }
994
- }).unsubscribe, U = (s) => (u.mount = !0, p = {
994
+ }).unsubscribe, W = (s) => (u.mount = !0, p = {
995
995
  ...p,
996
996
  ...s.formState
997
997
  }, xe({
998
998
  ...s,
999
999
  formState: {
1000
- ...T,
1000
+ ...D,
1001
1001
  ...s.formState
1002
1002
  }
1003
- })), le = (s, a = {}) => {
1003
+ })), le = (s, i = {}) => {
1004
1004
  for (const l of s ? ke(s) : f.mount)
1005
- f.mount.delete(l), f.array.delete(l), a.keepValue || (q(n, l), q(i, l)), !a.keepError && q(t.errors, l), !a.keepDirty && q(t.dirtyFields, l), !a.keepTouched && q(t.touchedFields, l), !a.keepIsValidating && q(t.validatingFields, l), !r.shouldUnregister && !a.keepDefaultValue && q(o, l);
1005
+ f.mount.delete(l), f.array.delete(l), i.keepValue || (q(n, l), q(a, l)), !i.keepError && q(t.errors, l), !i.keepDirty && q(t.dirtyFields, l), !i.keepTouched && q(t.touchedFields, l), !i.keepIsValidating && q(t.validatingFields, l), !r.shouldUnregister && !i.keepDefaultValue && q(o, l);
1006
1006
  b.state.next({
1007
- values: H(i)
1007
+ values: H(a)
1008
1008
  }), b.state.next({
1009
1009
  ...t,
1010
- ...a.keepDirty ? { isDirty: _() } : {}
1011
- }), !a.keepIsValid && W();
1012
- }, Ee = ({ disabled: s, name: a }) => {
1013
- (ue(s) && u.mount || s || f.disabled.has(a)) && (s ? f.disabled.add(a) : f.disabled.delete(a));
1014
- }, Ae = (s, a = {}) => {
1010
+ ...i.keepDirty ? { isDirty: x() } : {}
1011
+ }), !i.keepIsValid && I();
1012
+ }, Ee = ({ disabled: s, name: i }) => {
1013
+ (ue(s) && u.mount || s || f.disabled.has(i)) && (s ? f.disabled.add(i) : f.disabled.delete(i));
1014
+ }, pe = (s, i = {}) => {
1015
1015
  let l = h(n, s);
1016
- const m = ue(a.disabled) || ue(r.disabled);
1017
- return N(n, s, {
1016
+ const m = ue(i.disabled) || ue(r.disabled);
1017
+ return L(n, s, {
1018
1018
  ...l || {},
1019
1019
  _f: {
1020
1020
  ...l && l._f ? l._f : { ref: { name: s } },
1021
1021
  name: s,
1022
1022
  mount: !0,
1023
- ...a
1023
+ ...i
1024
1024
  }
1025
1025
  }), f.mount.add(s), l ? Ee({
1026
- disabled: ue(a.disabled) ? a.disabled : r.disabled,
1026
+ disabled: ue(i.disabled) ? i.disabled : r.disabled,
1027
1027
  name: s
1028
- }) : R(s, !0, a.value), {
1029
- ...m ? { disabled: a.disabled || r.disabled } : {},
1028
+ }) : k(s, !0, i.value), {
1029
+ ...m ? { disabled: i.disabled || r.disabled } : {},
1030
1030
  ...r.progressive ? {
1031
- required: !!a.required,
1032
- min: Re(a.min),
1033
- max: Re(a.max),
1034
- minLength: Re(a.minLength),
1035
- maxLength: Re(a.maxLength),
1036
- pattern: Re(a.pattern)
1031
+ required: !!i.required,
1032
+ min: Re(i.min),
1033
+ max: Re(i.max),
1034
+ minLength: Re(i.minLength),
1035
+ maxLength: Re(i.maxLength),
1036
+ pattern: Re(i.pattern)
1037
1037
  } : {},
1038
1038
  name: s,
1039
1039
  onChange: fe,
1040
1040
  onBlur: fe,
1041
1041
  ref: (y) => {
1042
1042
  if (y) {
1043
- Ae(s, a), l = h(n, s);
1044
- const d = M(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, v = tr(d), S = l._f.refs || [];
1045
- if (v ? S.find((D) => D === d) : d === l._f.ref)
1043
+ pe(s, i), l = h(n, s);
1044
+ const d = $(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, v = rr(d), O = l._f.refs || [];
1045
+ if (v ? O.find((C) => C === d) : d === l._f.ref)
1046
1046
  return;
1047
- N(n, s, {
1047
+ L(n, s, {
1048
1048
  _f: {
1049
1049
  ...l._f,
1050
1050
  ...v ? {
1051
1051
  refs: [
1052
- ...S.filter(We),
1052
+ ...O.filter(We),
1053
1053
  d,
1054
1054
  ...Array.isArray(h(o, s)) ? [{}] : []
1055
1055
  ],
1056
1056
  ref: { type: d.type, name: s }
1057
1057
  } : { ref: d }
1058
1058
  }
1059
- }), R(s, !1, void 0, d);
1059
+ }), k(s, !1, void 0, d);
1060
1060
  } else
1061
- l = h(n, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || a.shouldUnregister) && !(Xt(f.array, s) && u.action) && f.unMount.add(s);
1061
+ l = h(n, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || i.shouldUnregister) && !(Zt(f.array, s) && u.action) && f.unMount.add(s);
1062
1062
  }
1063
1063
  };
1064
1064
  }, Ue = () => r.shouldFocusError && Se(n, de, f.mount), Pt = (s) => {
1065
- ue(s) && (b.state.next({ disabled: s }), Se(n, (a, l) => {
1065
+ ue(s) && (b.state.next({ disabled: s }), Se(n, (i, l) => {
1066
1066
  const m = h(n, l);
1067
- m && (a.disabled = m._f.disabled || s, Array.isArray(m._f.refs) && m._f.refs.forEach((y) => {
1067
+ m && (i.disabled = m._f.disabled || s, Array.isArray(m._f.refs) && m._f.refs.forEach((y) => {
1068
1068
  y.disabled = m._f.disabled || s;
1069
1069
  }));
1070
1070
  }, 0, !1));
1071
- }, Ke = (s, a) => async (l) => {
1071
+ }, et = (s, i) => async (l) => {
1072
1072
  let m;
1073
1073
  l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
1074
- let y = H(i);
1074
+ let y = H(a);
1075
1075
  if (b.state.next({
1076
1076
  isSubmitting: !0
1077
1077
  }), r.resolver) {
1078
1078
  const { errors: d, values: v } = await j();
1079
- $(), t.errors = d, y = H(v);
1079
+ w(), t.errors = d, y = H(v);
1080
1080
  } else
1081
1081
  await X(n);
1082
1082
  if (f.disabled.size)
@@ -1092,7 +1092,7 @@ function mr(e = {}) {
1092
1092
  m = d;
1093
1093
  }
1094
1094
  } else
1095
- a && await a({ ...t.errors }, l), Ue(), setTimeout(Ue);
1095
+ i && await i({ ...t.errors }, l), Ue(), setTimeout(Ue);
1096
1096
  if (b.state.next({
1097
1097
  isSubmitted: !0,
1098
1098
  isSubmitting: !1,
@@ -1101,26 +1101,26 @@ function mr(e = {}) {
1101
1101
  errors: t.errors
1102
1102
  }), m)
1103
1103
  throw m;
1104
- }, Nt = (s, a = {}) => {
1105
- h(n, s) && (M(a.defaultValue) ? Z(s, H(h(o, s))) : (Z(s, a.defaultValue), N(o, s, H(a.defaultValue))), a.keepTouched || q(t.touchedFields, s), a.keepDirty || (q(t.dirtyFields, s), t.isDirty = a.defaultValue ? _(s, H(h(o, s))) : _()), a.keepError || (q(t.errors, s), x.isValid && W()), b.state.next({ ...t }));
1106
- }, et = (s, a = {}) => {
1104
+ }, Nt = (s, i = {}) => {
1105
+ h(n, s) && ($(i.defaultValue) ? Z(s, H(h(o, s))) : (Z(s, i.defaultValue), L(o, s, H(i.defaultValue))), i.keepTouched || q(t.touchedFields, s), i.keepDirty || (q(t.dirtyFields, s), t.isDirty = i.defaultValue ? x(s, H(h(o, s))) : x()), i.keepError || (q(t.errors, s), E.isValid && I()), b.state.next({ ...t }));
1106
+ }, tt = (s, i = {}) => {
1107
1107
  const l = s ? H(s) : o, m = H(l), y = Q(s), d = y ? o : m;
1108
- if (a.keepDefaultValues || (o = l), !a.keepValues) {
1109
- if (a.keepDirtyValues) {
1108
+ if (i.keepDefaultValues || (o = l), !i.keepValues) {
1109
+ if (i.keepDirtyValues) {
1110
1110
  const v = /* @__PURE__ */ new Set([
1111
1111
  ...f.mount,
1112
- ...Object.keys(Fe(o, i))
1112
+ ...Object.keys(Fe(o, a))
1113
1113
  ]);
1114
- for (const S of Array.from(v))
1115
- h(t.dirtyFields, S) ? N(d, S, h(i, S)) : Z(S, h(d, S));
1114
+ for (const O of Array.from(v))
1115
+ h(t.dirtyFields, O) ? L(d, O, h(a, O)) : Z(O, h(d, O));
1116
1116
  } else {
1117
- if (ze && M(s))
1117
+ if (He && $(s))
1118
1118
  for (const v of f.mount) {
1119
- const S = h(n, v);
1120
- if (S && S._f) {
1121
- const D = Array.isArray(S._f.refs) ? S._f.refs[0] : S._f.ref;
1122
- if (je(D)) {
1123
- const se = D.closest("form");
1119
+ const O = h(n, v);
1120
+ if (O && O._f) {
1121
+ const C = Array.isArray(O._f.refs) ? O._f.refs[0] : O._f.ref;
1122
+ if (je(C)) {
1123
+ const se = C.closest("form");
1124
1124
  if (se) {
1125
1125
  se.reset();
1126
1126
  break;
@@ -1128,43 +1128,43 @@ function mr(e = {}) {
1128
1128
  }
1129
1129
  }
1130
1130
  }
1131
- if (a.keepFieldsRef)
1131
+ if (i.keepFieldsRef)
1132
1132
  for (const v of f.mount)
1133
1133
  Z(v, h(d, v));
1134
1134
  else
1135
1135
  n = {};
1136
1136
  }
1137
- i = r.shouldUnregister ? a.keepDefaultValues ? H(o) : {} : H(d), b.array.next({
1137
+ a = r.shouldUnregister ? i.keepDefaultValues ? H(o) : {} : H(d), b.array.next({
1138
1138
  values: { ...d }
1139
1139
  }), b.state.next({
1140
1140
  values: { ...d }
1141
1141
  });
1142
1142
  }
1143
1143
  f = {
1144
- mount: a.keepDirtyValues ? f.mount : /* @__PURE__ */ new Set(),
1144
+ mount: i.keepDirtyValues ? f.mount : /* @__PURE__ */ new Set(),
1145
1145
  unMount: /* @__PURE__ */ new Set(),
1146
1146
  array: /* @__PURE__ */ new Set(),
1147
1147
  disabled: /* @__PURE__ */ new Set(),
1148
1148
  watch: /* @__PURE__ */ new Set(),
1149
1149
  watchAll: !1,
1150
1150
  focus: ""
1151
- }, u.mount = !x.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !r.shouldUnregister && !Q(d), u.watch = !!r.shouldUnregister, u.keepIsValid = !!a.keepIsValid, u.action = !1, a.keepErrors || (t.errors = {}), b.state.next({
1152
- submitCount: a.keepSubmitCount ? t.submitCount : 0,
1153
- isDirty: y ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ae(s, o)),
1154
- isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
1155
- dirtyFields: y ? {} : a.keepDirtyValues ? a.keepDefaultValues && i ? Fe(o, i) : t.dirtyFields : a.keepDefaultValues && s ? Fe(o, s) : a.keepDirty ? t.dirtyFields : {},
1156
- touchedFields: a.keepTouched ? t.touchedFields : {},
1157
- errors: a.keepErrors ? t.errors : {},
1158
- isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1151
+ }, u.mount = !E.isValid || !!i.keepIsValid || !!i.keepDirtyValues || !r.shouldUnregister && !Q(d), u.watch = !!r.shouldUnregister, u.keepIsValid = !!i.keepIsValid, u.action = !1, i.keepErrors || (t.errors = {}), b.state.next({
1152
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
1153
+ isDirty: y ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !ie(s, o)),
1154
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
1155
+ dirtyFields: y ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? Fe(o, a) : t.dirtyFields : i.keepDefaultValues && s ? Fe(o, s) : i.keepDirty ? t.dirtyFields : {},
1156
+ touchedFields: i.keepTouched ? t.touchedFields : {},
1157
+ errors: i.keepErrors ? t.errors : {},
1158
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1159
1159
  isSubmitting: !1,
1160
1160
  defaultValues: o
1161
1161
  });
1162
- }, tt = (s, a) => et(ne(s) ? s(i) : s, { ...r.resetOptions, ...a }), Lt = (s, a = {}) => {
1162
+ }, rt = (s, i) => tt(ne(s) ? s(a) : s, { ...r.resetOptions, ...i }), Lt = (s, i = {}) => {
1163
1163
  const l = h(n, s), m = l && l._f;
1164
1164
  if (m) {
1165
1165
  const y = m.refs ? m.refs[0] : m.ref;
1166
1166
  y.focus && setTimeout(() => {
1167
- y.focus(), a.shouldSelect && ne(y.select) && y.select();
1167
+ y.focus(), i.shouldSelect && ne(y.select) && y.select();
1168
1168
  });
1169
1169
  }
1170
1170
  }, It = (s) => {
@@ -1172,39 +1172,39 @@ function mr(e = {}) {
1172
1172
  ...t,
1173
1173
  ...s
1174
1174
  };
1175
- }, rt = {
1175
+ }, st = {
1176
1176
  control: {
1177
- register: Ae,
1177
+ register: pe,
1178
1178
  unregister: le,
1179
- getFieldState: g,
1180
- handleSubmit: Ke,
1181
- setError: L,
1179
+ getFieldState: _,
1180
+ handleSubmit: et,
1181
+ setError: M,
1182
1182
  _subscribe: xe,
1183
1183
  _runSchema: j,
1184
- _updateIsValidating: $,
1184
+ _updateIsValidating: w,
1185
1185
  _focusError: Ue,
1186
- _getWatch: w,
1187
- _getDirty: _,
1188
- _setValid: W,
1189
- _setFieldArray: E,
1186
+ _getWatch: R,
1187
+ _getDirty: x,
1188
+ _setValid: I,
1189
+ _setFieldArray: g,
1190
1190
  _setDisabledField: Ee,
1191
- _setErrors: C,
1192
- _getFieldArray: I,
1193
- _reset: et,
1191
+ _setErrors: P,
1192
+ _getFieldArray: B,
1193
+ _reset: tt,
1194
1194
  _resetDefaultValues: () => ne(r.defaultValues) && r.defaultValues().then((s) => {
1195
- tt(s, r.resetOptions), b.state.next({
1195
+ rt(s, r.resetOptions), b.state.next({
1196
1196
  isLoading: !1
1197
1197
  });
1198
1198
  }),
1199
1199
  _removeUnmounted: ge,
1200
1200
  _disableForm: Pt,
1201
1201
  _subjects: b,
1202
- _proxyFormState: x,
1202
+ _proxyFormState: E,
1203
1203
  get _fields() {
1204
1204
  return n;
1205
1205
  },
1206
1206
  get _formValues() {
1207
- return i;
1207
+ return a;
1208
1208
  },
1209
1209
  get _state() {
1210
1210
  return u;
@@ -1234,28 +1234,28 @@ function mr(e = {}) {
1234
1234
  };
1235
1235
  }
1236
1236
  },
1237
- subscribe: U,
1237
+ subscribe: W,
1238
1238
  trigger: ye,
1239
- register: Ae,
1240
- handleSubmit: Ke,
1239
+ register: pe,
1240
+ handleSubmit: et,
1241
1241
  watch: _e,
1242
1242
  setValue: Z,
1243
1243
  getValues: c,
1244
- reset: tt,
1244
+ reset: rt,
1245
1245
  resetField: Nt,
1246
- clearErrors: P,
1246
+ clearErrors: N,
1247
1247
  unregister: le,
1248
- setError: L,
1248
+ setError: M,
1249
1249
  setFocus: Lt,
1250
- getFieldState: g
1250
+ getFieldState: _
1251
1251
  };
1252
1252
  return {
1253
- ...rt,
1254
- formControl: rt
1253
+ ...st,
1254
+ formControl: st
1255
1255
  };
1256
1256
  }
1257
- function hr(e = {}) {
1258
- const r = k.useRef(void 0), t = k.useRef(void 0), [n, o] = k.useState({
1257
+ function vr(e = {}) {
1258
+ const r = S.useRef(void 0), t = S.useRef(void 0), [n, o] = S.useState({
1259
1259
  isDirty: !1,
1260
1260
  isValidating: !1,
1261
1261
  isLoading: ne(e.defaultValues),
@@ -1279,49 +1279,49 @@ function hr(e = {}) {
1279
1279
  formState: n
1280
1280
  }, e.defaultValues && !ne(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1281
1281
  else {
1282
- const { formControl: u, ...f } = mr(e);
1282
+ const { formControl: u, ...f } = hr(e);
1283
1283
  r.current = {
1284
1284
  ...f,
1285
1285
  formState: n
1286
1286
  };
1287
1287
  }
1288
- const i = r.current.control;
1289
- return i._options = e, Ft(() => {
1290
- const u = i._subscribe({
1291
- formState: i._proxyFormState,
1292
- callback: () => o({ ...i._formState }),
1288
+ const a = r.current.control;
1289
+ return a._options = e, Ft(() => {
1290
+ const u = a._subscribe({
1291
+ formState: a._proxyFormState,
1292
+ callback: () => o({ ...a._formState }),
1293
1293
  reRenderRoot: !0
1294
1294
  });
1295
1295
  return o((f) => ({
1296
1296
  ...f,
1297
1297
  isReady: !0
1298
- })), i._formState.isReady = !0, u;
1299
- }, [i]), k.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), k.useEffect(() => {
1300
- e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
1301
- }, [i, e.mode, e.reValidateMode]), k.useEffect(() => {
1302
- e.errors && (i._setErrors(e.errors), i._focusError());
1303
- }, [i, e.errors]), k.useEffect(() => {
1304
- e.shouldUnregister && i._subjects.state.next({
1305
- values: i._getWatch()
1298
+ })), a._formState.isReady = !0, u;
1299
+ }, [a]), S.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), S.useEffect(() => {
1300
+ e.mode && (a._options.mode = e.mode), e.reValidateMode && (a._options.reValidateMode = e.reValidateMode);
1301
+ }, [a, e.mode, e.reValidateMode]), S.useEffect(() => {
1302
+ e.errors && (a._setErrors(e.errors), a._focusError());
1303
+ }, [a, e.errors]), S.useEffect(() => {
1304
+ e.shouldUnregister && a._subjects.state.next({
1305
+ values: a._getWatch()
1306
1306
  });
1307
- }, [i, e.shouldUnregister]), k.useEffect(() => {
1308
- if (i._proxyFormState.isDirty) {
1309
- const u = i._getDirty();
1310
- u !== n.isDirty && i._subjects.state.next({
1307
+ }, [a, e.shouldUnregister]), S.useEffect(() => {
1308
+ if (a._proxyFormState.isDirty) {
1309
+ const u = a._getDirty();
1310
+ u !== n.isDirty && a._subjects.state.next({
1311
1311
  isDirty: u
1312
1312
  });
1313
1313
  }
1314
- }, [i, n.isDirty]), k.useEffect(() => {
1314
+ }, [a, n.isDirty]), S.useEffect(() => {
1315
1315
  var u;
1316
- e.values && !ae(e.values, t.current) ? (i._reset(e.values, {
1316
+ e.values && !ie(e.values, t.current) ? (a._reset(e.values, {
1317
1317
  keepFieldsRef: !0,
1318
- ...i._options.resetOptions
1319
- }), !((u = i._options.resetOptions) === null || u === void 0) && u.keepIsValid || i._setValid(), t.current = e.values, o((f) => ({ ...f }))) : i._resetDefaultValues();
1320
- }, [i, e.values]), k.useEffect(() => {
1321
- i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1322
- }), r.current.formState = Kt(n, i), r.current;
1318
+ ...a._options.resetOptions
1319
+ }), !((u = a._options.resetOptions) === null || u === void 0) && u.keepIsValid || a._setValid(), t.current = e.values, o((f) => ({ ...f }))) : a._resetDefaultValues();
1320
+ }, [a, e.values]), S.useEffect(() => {
1321
+ a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1322
+ }), r.current.formState = er(n, a), r.current;
1323
1323
  }
1324
- const Ot = Wt(null), vr = ({
1324
+ const Ot = Wt(null), br = ({
1325
1325
  children: e,
1326
1326
  layout: r = "vertical",
1327
1327
  uiConfig: t,
@@ -1341,31 +1341,31 @@ const Ot = Wt(null), vr = ({
1341
1341
  if (!e)
1342
1342
  throw new Error("useAutoFormRenderContext must be used within AutoFormRenderContextProvider");
1343
1343
  return e;
1344
- }, br = (e) => {
1344
+ }, gr = (e) => {
1345
1345
  const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name);
1346
1346
  return /* @__PURE__ */ V.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1347
1347
  /* @__PURE__ */ V.jsx("label", { children: r.label }),
1348
1348
  /* @__PURE__ */ V.jsx("input", { type: r.type, ...n, readOnly: r.readonly })
1349
1349
  ] });
1350
- }, gr = (e) => {
1350
+ }, _r = (e) => {
1351
1351
  const { fieldSchema: r } = e, { register: t } = be(), n = t(r.name), o = r.options;
1352
1352
  return /* @__PURE__ */ V.jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
1353
1353
  /* @__PURE__ */ V.jsx("label", { children: r.label }),
1354
- /* @__PURE__ */ V.jsx("select", { ...n, disabled: r.readonly, children: o.map((i) => /* @__PURE__ */ V.jsx("option", { value: i.value, children: i.label }, i.value)) })
1354
+ /* @__PURE__ */ V.jsx("select", { ...n, disabled: r.readonly, children: o.map((a) => /* @__PURE__ */ V.jsx("option", { value: a.value, children: a.label }, a.value)) })
1355
1355
  ] });
1356
1356
  };
1357
- function _r(e, r) {
1357
+ function xr(e, r) {
1358
1358
  const t = {};
1359
1359
  return e.forEach((n, o) => {
1360
- const i = n.split(".");
1360
+ const a = n.split(".");
1361
1361
  let u = t;
1362
- i.forEach((f, F) => {
1363
- const A = F === i.length - 1, T = !isNaN(Number(f));
1364
- A ? u[f] = r[o] : (f in u || (u[f] = T ? [] : {}), u = u[f]);
1362
+ a.forEach((f, F) => {
1363
+ const A = F === a.length - 1, D = !isNaN(Number(f));
1364
+ A ? u[f] = r[o] : (f in u || (u[f] = D ? [] : {}), u = u[f]);
1365
1365
  });
1366
1366
  }), t;
1367
1367
  }
1368
- function xr(e) {
1368
+ function Er(e) {
1369
1369
  switch (e) {
1370
1370
  case "array":
1371
1371
  return [];
@@ -1374,13 +1374,13 @@ function xr(e) {
1374
1374
  return null;
1375
1375
  }
1376
1376
  }
1377
- function Qe(e) {
1377
+ function Ke(e) {
1378
1378
  return e.replace(/\.\d+\./g, ".");
1379
1379
  }
1380
- function Er(e, r) {
1380
+ function Vr(e, r) {
1381
1381
  const t = e.split("."), n = [];
1382
- return t.forEach((o, i) => {
1383
- isNaN(Number(o)) || n.push({ pos: i, value: o });
1382
+ return t.forEach((o, a) => {
1383
+ isNaN(Number(o)) || n.push({ pos: a, value: o });
1384
1384
  }), r.map((o) => {
1385
1385
  const u = [...o.split(".")];
1386
1386
  return n.forEach(({ pos: f, value: F }) => {
@@ -1395,7 +1395,7 @@ function Ne(e, r = {}) {
1395
1395
  const o = n.fields;
1396
1396
  t[n.name] = Ne(o, r == null ? void 0 : r[n.name]);
1397
1397
  } else
1398
- t[n.name] = (r == null ? void 0 : r[n.name]) ?? n.initialValue ?? xr(n.type);
1398
+ t[n.name] = (r == null ? void 0 : r[n.name]) ?? n.initialValue ?? Er(n.type);
1399
1399
  return t;
1400
1400
  }
1401
1401
  function Ct(e) {
@@ -1414,11 +1414,11 @@ function Ct(e) {
1414
1414
  };
1415
1415
  });
1416
1416
  }
1417
- const Vr = k.memo((e) => {
1418
- const { baseName: r, index: t, fields: n } = e, o = k.useMemo(
1419
- () => n.map((i) => ({
1420
- ...i,
1421
- name: `${r}.${t}.${i.name}`
1417
+ const Fr = S.memo((e) => {
1418
+ const { baseName: r, index: t, fields: n } = e, o = S.useMemo(
1419
+ () => n.map((a) => ({
1420
+ ...a,
1421
+ name: `${r}.${t}.${a.name}`
1422
1422
  })),
1423
1423
  [r, t, n]
1424
1424
  );
@@ -1429,25 +1429,25 @@ const Vr = k.memo((e) => {
1429
1429
  ] }),
1430
1430
  /* @__PURE__ */ V.jsx(Le, { schema: o })
1431
1431
  ] });
1432
- }), Fr = (e) => {
1433
- const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = be(), u = At({
1432
+ }), pr = (e) => {
1433
+ const { fieldSchema: r } = e, { control: t, getValues: n, setValue: o } = be(), u = pt({
1434
1434
  control: t,
1435
1435
  name: r.name
1436
1436
  }) ?? [], f = () => {
1437
1437
  const A = n(r.name) || [];
1438
1438
  o(r.name, [...A, Ne(r.fields)]);
1439
1439
  }, F = (A) => {
1440
- const x = (n(r.name) || []).filter((p, b) => b !== A);
1441
- o(r.name, x);
1440
+ const E = (n(r.name) || []).filter((p, b) => b !== A);
1441
+ o(r.name, E);
1442
1442
  };
1443
1443
  return /* @__PURE__ */ V.jsxs("div", { children: [
1444
- u.map((A, T) => /* @__PURE__ */ V.jsxs("div", { children: [
1445
- /* @__PURE__ */ V.jsx(Vr, { baseName: r.name, index: T, fields: r.fields }),
1446
- !r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: () => F(T), children: "Remove" })
1447
- ] }, T)),
1444
+ u.map((A, D) => /* @__PURE__ */ V.jsxs("div", { children: [
1445
+ /* @__PURE__ */ V.jsx(Fr, { baseName: r.name, index: D, fields: r.fields }),
1446
+ !r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: () => F(D), children: "Remove" })
1447
+ ] }, D)),
1448
1448
  !r.readonly && /* @__PURE__ */ V.jsx("button", { type: "button", onClick: f, children: "Add Row" })
1449
1449
  ] });
1450
- }, Ar = k.memo(Fr), pr = (e) => {
1450
+ }, Ar = S.memo(pr), wr = (e) => {
1451
1451
  const { fieldSchema: r } = e;
1452
1452
  let t = he(
1453
1453
  () => r.fields.map((n) => ({
@@ -1458,46 +1458,46 @@ const Vr = k.memo((e) => {
1458
1458
  );
1459
1459
  return /* @__PURE__ */ V.jsx(Le, { schema: t });
1460
1460
  }, jt = ({ fieldSchema: e }) => {
1461
- var A, T;
1462
- const t = Dt().uiConfig, { register: n, control: o } = be(), i = Qe(e.name), u = n(e.name), f = (A = t == null ? void 0 : t.renderersByName) == null ? void 0 : A[i];
1461
+ var A, D;
1462
+ const t = Dt().uiConfig, { register: n, control: o } = be(), a = Ke(e.name), u = n(e.name), f = (A = t == null ? void 0 : t.renderersByName) == null ? void 0 : A[a];
1463
1463
  if (e.visible === !1)
1464
1464
  return null;
1465
1465
  if (f)
1466
1466
  return /* @__PURE__ */ V.jsx(f, { fieldSchema: e, control: o, register: u });
1467
- const F = (T = t == null ? void 0 : t.renderersByType) == null ? void 0 : T[e.type];
1467
+ const F = (D = t == null ? void 0 : t.renderersByType) == null ? void 0 : D[e.type];
1468
1468
  if (F)
1469
1469
  return /* @__PURE__ */ V.jsx(F, { fieldSchema: e, control: o, register: u });
1470
1470
  switch (e.type) {
1471
1471
  case "select":
1472
- return /* @__PURE__ */ V.jsx(gr, { fieldSchema: e });
1472
+ return /* @__PURE__ */ V.jsx(_r, { fieldSchema: e });
1473
1473
  case "array":
1474
1474
  return /* @__PURE__ */ V.jsx(Ar, { fieldSchema: e });
1475
1475
  case "object":
1476
- return /* @__PURE__ */ V.jsx(pr, { fieldSchema: e });
1476
+ return /* @__PURE__ */ V.jsx(wr, { fieldSchema: e });
1477
1477
  case "text":
1478
1478
  case "number":
1479
1479
  case "checkbox":
1480
1480
  case "date":
1481
1481
  case "datetime-local":
1482
1482
  case "time":
1483
- return /* @__PURE__ */ V.jsx(br, { fieldSchema: e });
1483
+ return /* @__PURE__ */ V.jsx(gr, { fieldSchema: e });
1484
1484
  }
1485
- }, wr = ({ fieldSchema: e }) => /* @__PURE__ */ V.jsx(jt, { fieldSchema: e }), Rr = ({ fieldSchema: e }) => {
1485
+ }, Rr = ({ fieldSchema: e }) => /* @__PURE__ */ V.jsx(jt, { fieldSchema: e }), kr = ({ fieldSchema: e }) => {
1486
1486
  const { control: r } = be(), t = Dt(), n = e.dependsOn ?? [], o = he(
1487
- () => Er(e.name, n),
1487
+ () => Vr(e.name, n),
1488
1488
  [e.name, n]
1489
- ), i = At({
1489
+ ), a = pt({
1490
1490
  control: r,
1491
1491
  name: o
1492
- }), [u, f] = xt(e);
1492
+ }), [u, f] = Et(e);
1493
1493
  return Ce(() => {
1494
1494
  if (!n.length) return;
1495
1495
  let F = !1;
1496
1496
  return (async () => {
1497
- var B;
1498
- const T = Qe(e.name), x = _r(o, i ?? []), p = (B = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : B[T];
1497
+ var U;
1498
+ const D = Ke(e.name), E = xr(o, a ?? []), p = (U = t == null ? void 0 : t.updateFieldSchema) == null ? void 0 : U[D];
1499
1499
  if (!p) return;
1500
- const b = await p(e.name, e, x);
1500
+ const b = await p(e.name, e, E);
1501
1501
  !F && b && f({
1502
1502
  ...e,
1503
1503
  ...b
@@ -1505,44 +1505,54 @@ const Vr = k.memo((e) => {
1505
1505
  })(), () => {
1506
1506
  F = !0;
1507
1507
  };
1508
- }, [i]), /* @__PURE__ */ V.jsx(jt, { fieldSchema: u });
1509
- }, kr = (e) => {
1508
+ }, [a]), /* @__PURE__ */ V.jsx(jt, { fieldSchema: u });
1509
+ }, Sr = (e) => {
1510
1510
  var t;
1511
1511
  const { fieldSchema: r } = e;
1512
- return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ V.jsx(Rr, { fieldSchema: r }) : /* @__PURE__ */ V.jsx(wr, { fieldSchema: r });
1513
- }, Sr = (e) => {
1512
+ return (t = r.dependsOn) != null && t.length ? /* @__PURE__ */ V.jsx(kr, { fieldSchema: r }) : /* @__PURE__ */ V.jsx(Rr, { fieldSchema: r });
1513
+ }, Tr = (e) => {
1514
1514
  const { fieldSchema: r } = e;
1515
- return /* @__PURE__ */ V.jsx(kr, { fieldSchema: r });
1516
- }, Le = k.memo((e) => {
1515
+ return /* @__PURE__ */ V.jsx(Sr, { fieldSchema: r });
1516
+ }, Le = S.memo((e) => {
1517
1517
  const { schema: r } = e;
1518
- return r.map((t) => /* @__PURE__ */ V.jsx(Sr, { fieldSchema: t }, t.name));
1518
+ return r.map((t) => /* @__PURE__ */ V.jsx(Tr, { fieldSchema: t }, t.name));
1519
1519
  });
1520
- function Tr(e, r) {
1521
- const t = (i) => /^\d+$/.test(i), n = e.split(".");
1520
+ function $e(e, r) {
1521
+ const t = (a) => /^\d+$/.test(a), n = e.split(".");
1522
1522
  let o = r;
1523
- for (const i of n) {
1523
+ for (const a of n) {
1524
1524
  if (o == null) return;
1525
- const u = t(i) ? Number(i) : i;
1525
+ const u = t(a) ? Number(a) : a;
1526
1526
  o = o[u];
1527
1527
  }
1528
1528
  return o;
1529
1529
  }
1530
1530
  const Or = (e) => {
1531
- const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: i } = be(), u = Et(!0);
1531
+ const { onDirtyChange: r, onValuesChange: t, onFieldChange: n } = e, { formState: o, watch: a, getValues: u, setValue: f, setError: F, clearErrors: A } = be();
1532
1532
  return Ce(() => {
1533
- const f = i((F, { name: A = "" }) => {
1534
- var p;
1535
- t(F);
1536
- const T = Qe(A), x = Tr(A, F);
1537
- (p = n == null ? void 0 : n[T]) == null || p.call(n, A, x, F);
1533
+ const D = a((E, { name: p = "" }) => {
1534
+ const b = E;
1535
+ t == null || t({
1536
+ values: b,
1537
+ setValue: (w, g) => f(w, g),
1538
+ setError: (w, g) => F(w, { type: "manual", message: g }),
1539
+ clearError: (w) => A(w),
1540
+ getValue: (w) => $e(w, u())
1541
+ });
1542
+ const U = Ke(p), T = $e(p, b), I = n == null ? void 0 : n[U];
1543
+ I && I({
1544
+ path: p,
1545
+ value: T,
1546
+ values: b,
1547
+ setValue: (w, g) => f(w, g),
1548
+ setError: (w, g) => F(w, { type: "manual", message: g }),
1549
+ clearError: (w) => A(w),
1550
+ getValue: (w) => $e(w, u())
1551
+ });
1538
1552
  });
1539
- return () => f.unsubscribe();
1540
- }, [i, t]), Ce(() => {
1541
- if (u.current) {
1542
- u.current = !1;
1543
- return;
1544
- }
1545
- r(o.isDirty);
1553
+ return () => D.unsubscribe();
1554
+ }, [a, t, n, u, f, F, A]), Ce(() => {
1555
+ r == null || r(o.isDirty);
1546
1556
  }, [o.isDirty, r]), null;
1547
1557
  }, Dr = ({
1548
1558
  onValuesChange: e,
@@ -1552,7 +1562,7 @@ const Or = (e) => {
1552
1562
  onDirtyChange: r,
1553
1563
  onValuesChange: e,
1554
1564
  onFieldChange: t
1555
- }), null), Pr = k.forwardRef((e, r) => {
1565
+ }), null), Pr = S.forwardRef((e, r) => {
1556
1566
  const {
1557
1567
  schema: t,
1558
1568
  onSubmit: n,
@@ -1560,23 +1570,23 @@ const Or = (e) => {
1560
1570
  renderersByName: {},
1561
1571
  renderersByType: {}
1562
1572
  },
1563
- updateFieldSchema: i = {},
1573
+ updateFieldSchema: a = {},
1564
1574
  layout: u = "vertical",
1565
1575
  values: f = () => ({}),
1566
1576
  hideSubmit: F = !1,
1567
1577
  onDirtyChange: A = () => {
1568
1578
  },
1569
- onValuesChange: T = () => {
1579
+ onValuesChange: D = (j) => {
1570
1580
  },
1571
- resolver: x,
1581
+ resolver: E,
1572
1582
  readonly: p,
1573
1583
  onFieldChange: b = {},
1574
- loadingComponent: B
1575
- } = e, O = hr({
1584
+ loadingComponent: U
1585
+ } = e, T = vr({
1576
1586
  reValidateMode: "onSubmit",
1577
1587
  criteriaMode: "all",
1578
- resolver: x
1579
- }), W = Et(!1), [$, E] = xt(!1), J = he(() => {
1588
+ resolver: E
1589
+ }), I = Yt(!1), [w, g] = Et(!1), J = he(() => {
1580
1590
  let j = t;
1581
1591
  return p && (j = Ct(j)), j;
1582
1592
  }, [p, t]);
@@ -1584,20 +1594,20 @@ const Or = (e) => {
1584
1594
  if (!f) return;
1585
1595
  let j = !1;
1586
1596
  return (async () => {
1587
- if (W.current) return;
1588
- E(!1);
1597
+ if (I.current) return;
1598
+ g(!1);
1589
1599
  const X = await f();
1590
- j || (O.reset(Ne(t, X), {
1600
+ j || (T.reset(Ne(t, X), {
1591
1601
  keepErrors: !0,
1592
1602
  keepDirty: !1,
1593
1603
  keepTouched: !1
1594
- }), W.current = !0, E(!0));
1604
+ }), I.current = !0, g(!0));
1595
1605
  })(), () => {
1596
1606
  j = !0;
1597
1607
  };
1598
- }, [t, f]), Yt(r, () => ({
1608
+ }, [t, f]), qt(r, () => ({
1599
1609
  submit: () => new Promise((j) => {
1600
- O.handleSubmit(
1610
+ T.handleSubmit(
1601
1611
  async (G) => {
1602
1612
  await n(G), j({ success: !0, errors: {} });
1603
1613
  },
@@ -1607,33 +1617,34 @@ const Or = (e) => {
1607
1617
  )();
1608
1618
  }),
1609
1619
  reset: (j) => {
1610
- O.reset(j ? Ne(t, j) : void 0);
1620
+ T.reset(j ? Ne(t, j) : void 0);
1611
1621
  },
1612
- getValues: () => O.getValues(),
1622
+ getValues: () => T.getValues(),
1613
1623
  setValue: (j, G) => {
1614
- O.setValue(j, G);
1624
+ T.setValue(j, G);
1615
1625
  },
1616
- getErrors: () => O.formState.errors
1626
+ getErrors: () => T.formState.errors,
1627
+ formState: () => T.formState
1617
1628
  }));
1618
- const C = F || p, R = he(() => o, [o]), K = he(() => i, [i]), oe = he(
1629
+ const P = F || p, k = he(() => o, [o]), K = he(() => a, [a]), oe = he(
1619
1630
  () => ({
1620
1631
  layout: u,
1621
- uiConfig: R,
1632
+ uiConfig: k,
1622
1633
  updateFieldSchema: K
1623
1634
  }),
1624
- [u, R, K]
1635
+ [u, k, K]
1625
1636
  );
1626
- return $ ? /* @__PURE__ */ V.jsxs(Qt, { ...O, children: [
1637
+ return w ? /* @__PURE__ */ V.jsxs(Kt, { ...T, children: [
1627
1638
  /* @__PURE__ */ V.jsx(
1628
1639
  Dr,
1629
1640
  {
1630
1641
  onDirtyChange: A,
1631
- onValuesChange: T,
1642
+ onValuesChange: D,
1632
1643
  onFieldChange: b
1633
1644
  }
1634
1645
  ),
1635
1646
  /* @__PURE__ */ V.jsxs(
1636
- vr,
1647
+ br,
1637
1648
  {
1638
1649
  layout: oe.layout,
1639
1650
  uiConfig: oe.uiConfig,
@@ -1650,11 +1661,11 @@ const Or = (e) => {
1650
1661
  }
1651
1662
  ),
1652
1663
  u === "custom" && /* @__PURE__ */ V.jsx(Le, { schema: J }),
1653
- !C && /* @__PURE__ */ V.jsx("button", { style: { marginTop: "1rem" }, onClick: O.handleSubmit(n), children: "Submit" })
1664
+ !P && /* @__PURE__ */ V.jsx("button", { style: { marginTop: "1rem" }, onClick: T.handleSubmit(n), children: "Submit" })
1654
1665
  ]
1655
1666
  }
1656
1667
  )
1657
- ] }) : /* @__PURE__ */ V.jsx(V.Fragment, { children: B ?? /* @__PURE__ */ V.jsx(
1668
+ ] }) : /* @__PURE__ */ V.jsx(V.Fragment, { children: U ?? /* @__PURE__ */ V.jsx(
1658
1669
  "div",
1659
1670
  {
1660
1671
  style: {
@@ -1670,10 +1681,10 @@ const Or = (e) => {
1670
1681
  export {
1671
1682
  Pr as AutoForm,
1672
1683
  Le as SchemaRenderer,
1673
- _r as buildNestedPartialValues,
1684
+ xr as buildNestedPartialValues,
1674
1685
  Ne as generateInitialValues,
1675
- xr as getDefaultValueForField,
1686
+ Er as getDefaultValueForField,
1676
1687
  Ct as makeSchemaReadOnly,
1677
- Qe as normalizeFieldPath,
1678
- Er as resolveDependsOnNew
1688
+ Ke as normalizeFieldPath,
1689
+ Vr as resolveDependsOnNew
1679
1690
  };