@scbt-ecom/ui 0.79.0 → 0.79.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import * as ne from "react";
2
- import x, { useCallback as $e, useSyncExternalStore as ze } from "react";
2
+ import A, { useCallback as ze, useSyncExternalStore as Ge } from "react";
3
3
  import { i as Ot } from "./isClient-C9aZtt2Q.js";
4
- const Ge = () => !1, or = () => {
5
- const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t = $e(
4
+ const Ye = () => !1, or = () => {
5
+ const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t = ze(
6
6
  (u) => {
7
7
  const d = globalThis.matchMedia(e);
8
8
  return d.addEventListener("change", u), () => {
@@ -10,7 +10,7 @@ const Ge = () => !1, or = () => {
10
10
  };
11
11
  },
12
12
  [e]
13
- ), i = $e(
13
+ ), i = ze(
14
14
  (u) => {
15
15
  const d = globalThis.matchMedia(r);
16
16
  return d.addEventListener("change", u), () => {
@@ -20,8 +20,8 @@ const Ge = () => !1, or = () => {
20
20
  [r]
21
21
  ), a = () => globalThis.matchMedia(e).matches, o = () => globalThis.matchMedia(r).matches;
22
22
  return {
23
- isMobile: ze(t, a, Ge),
24
- isDesktop: ze(i, o, Ge)
23
+ isMobile: Ge(t, a, Ye),
24
+ isDesktop: Ge(i, o, Ye)
25
25
  };
26
26
  }, lr = (e, r) => {
27
27
  const t = (i) => {
@@ -35,12 +35,12 @@ const Ge = () => !1, or = () => {
35
35
  };
36
36
  }, [e, r]);
37
37
  };
38
- var ye = (e) => e.type === "checkbox", ie = (e) => e instanceof Date, B = (e) => e == null;
38
+ var ye = (e) => e.type === "checkbox", ie = (e) => e instanceof Date, P = (e) => e == null;
39
39
  const lt = (e) => typeof e == "object";
40
- var M = (e) => !B(e) && !Array.isArray(e) && lt(e) && !ie(e), ut = (e) => M(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ct = (e, r) => e.has(Rt(r)), Ut = (e) => {
40
+ var L = (e) => !P(e) && !Array.isArray(e) && lt(e) && !ie(e), ut = (e) => L(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ct = (e, r) => e.has(Rt(r)), Ut = (e) => {
41
41
  const r = e.constructor && e.constructor.prototype;
42
- return M(r) && r.hasOwnProperty("isPrototypeOf");
43
- }, Te = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
42
+ return L(r) && r.hasOwnProperty("isPrototypeOf");
43
+ }, Me = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
44
44
  function U(e) {
45
45
  let r;
46
46
  const t = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
@@ -48,7 +48,7 @@ function U(e) {
48
48
  r = new Date(e);
49
49
  else if (e instanceof Set)
50
50
  r = new Set(e);
51
- else if (!(Te && (e instanceof Blob || i)) && (t || M(e)))
51
+ else if (!(Me && (e instanceof Blob || i)) && (t || L(e)))
52
52
  if (r = t ? [] : {}, !t && !Ut(e))
53
53
  r = e;
54
54
  else
@@ -58,27 +58,27 @@ function U(e) {
58
58
  return e;
59
59
  return r;
60
60
  }
61
- var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], T = (e) => e === void 0, y = (e, r, t) => {
62
- if (!r || !M(e))
61
+ var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], M = (e) => e === void 0, y = (e, r, t) => {
62
+ if (!r || !L(e))
63
63
  return t;
64
- const i = Ae(r.split(/[,[\].]+?/)).reduce((a, o) => B(a) ? a : a[o], e);
65
- return T(i) || i === e ? T(e[r]) ? t : e[r] : i;
66
- }, W = (e) => typeof e == "boolean", Me = (e) => /^\w*$/.test(e), dt = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), F = (e, r, t) => {
64
+ const i = Ae(r.split(/[,[\].]+?/)).reduce((a, o) => P(a) ? a : a[o], e);
65
+ return M(i) || i === e ? M(e[r]) ? t : e[r] : i;
66
+ }, W = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), dt = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), F = (e, r, t) => {
67
67
  let i = -1;
68
- const a = Me(r) ? [r] : dt(r), o = a.length, u = o - 1;
68
+ const a = Le(r) ? [r] : dt(r), o = a.length, u = o - 1;
69
69
  for (; ++i < o; ) {
70
70
  const d = a[i];
71
71
  let v = t;
72
72
  if (i !== u) {
73
- const E = e[d];
74
- v = M(E) || Array.isArray(E) ? E : isNaN(+a[i + 1]) ? {} : [];
73
+ const D = e[d];
74
+ v = L(D) || Array.isArray(D) ? D : isNaN(+a[i + 1]) ? {} : [];
75
75
  }
76
76
  if (d === "__proto__" || d === "constructor" || d === "prototype")
77
77
  return;
78
78
  e[d] = v, e = e[d];
79
79
  }
80
80
  };
81
- const me = {
81
+ const _e = {
82
82
  BLUR: "blur",
83
83
  FOCUS_OUT: "focusout",
84
84
  CHANGE: "change"
@@ -96,9 +96,9 @@ const me = {
96
96
  pattern: "pattern",
97
97
  required: "required",
98
98
  validate: "validate"
99
- }, ft = x.createContext(null), Le = () => x.useContext(ft), ur = (e) => {
99
+ }, ft = A.createContext(null), Oe = () => A.useContext(ft), ur = (e) => {
100
100
  const { children: r, ...t } = e;
101
- return x.createElement(ft.Provider, { value: t }, r);
101
+ return A.createElement(ft.Provider, { value: t }, r);
102
102
  };
103
103
  var yt = (e, r, t, i = !0) => {
104
104
  const a = {
@@ -113,9 +113,9 @@ var yt = (e, r, t, i = !0) => {
113
113
  });
114
114
  return a;
115
115
  };
116
- const Oe = typeof window < "u" ? ne.useLayoutEffect : ne.useEffect;
116
+ const Re = typeof window < "u" ? ne.useLayoutEffect : ne.useEffect;
117
117
  function Nt(e) {
118
- const r = Le(), { control: t = r.control, disabled: i, name: a, exact: o } = e || {}, [u, d] = x.useState(t._formState), v = x.useRef({
118
+ const r = Oe(), { control: t = r.control, disabled: i, name: a, exact: o } = e || {}, [u, d] = A.useState(t._formState), v = A.useRef({
119
119
  isDirty: !1,
120
120
  isLoading: !1,
121
121
  dirtyFields: !1,
@@ -125,34 +125,34 @@ function Nt(e) {
125
125
  isValid: !1,
126
126
  errors: !1
127
127
  });
128
- return Oe(() => t._subscribe({
128
+ return Re(() => t._subscribe({
129
129
  name: a,
130
130
  formState: v.current,
131
131
  exact: o,
132
- callback: (E) => {
132
+ callback: (D) => {
133
133
  !i && d({
134
134
  ...t._formState,
135
- ...E
135
+ ...D
136
136
  });
137
137
  }
138
- }), [a, i, o]), x.useEffect(() => {
138
+ }), [a, i, o]), A.useEffect(() => {
139
139
  v.current.isValid && t._setValid(!0);
140
- }, [t]), x.useMemo(() => yt(u, t, v.current, !1), [u, t]);
140
+ }, [t]), A.useMemo(() => yt(u, t, v.current, !1), [u, t]);
141
141
  }
142
- var Y = (e) => typeof e == "string", ht = (e, r, t, i, a) => Y(e) ? (i && r.watch.add(e), y(t, e, a)) : Array.isArray(e) ? e.map((o) => (i && r.watch.add(o), y(t, o))) : (i && (r.watchAll = !0), t);
142
+ var $ = (e) => typeof e == "string", ht = (e, r, t, i, a) => $(e) ? (i && r.watch.add(e), y(t, e, a)) : Array.isArray(e) ? e.map((o) => (i && r.watch.add(o), y(t, o))) : (i && (r.watchAll = !0), t);
143
143
  function Pt(e) {
144
- const r = Le(), { control: t = r.control, name: i, defaultValue: a, disabled: o, exact: u } = e || {}, d = x.useRef(a), [v, E] = x.useState(t._getWatch(i, d.current));
145
- return Oe(() => t._subscribe({
144
+ const r = Oe(), { control: t = r.control, name: i, defaultValue: a, disabled: o, exact: u } = e || {}, d = A.useRef(a), [v, D] = A.useState(t._getWatch(i, d.current));
145
+ return Re(() => t._subscribe({
146
146
  name: i,
147
147
  formState: {
148
148
  values: !0
149
149
  },
150
150
  exact: u,
151
- callback: (V) => !o && E(ht(i, t._names, V.values || t._formValues, !1, d.current))
152
- }), [i, t, o, u]), x.useEffect(() => t._removeUnmounted()), v;
151
+ callback: (V) => !o && D(ht(i, t._names, V.values || t._formValues, !1, d.current))
152
+ }), [i, t, o, u]), A.useEffect(() => t._removeUnmounted()), v;
153
153
  }
154
154
  function cr(e) {
155
- const r = Le(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u = ct(a._names.array, t), d = Pt({
155
+ const r = Oe(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u = ct(a._names.array, t), d = Pt({
156
156
  control: a,
157
157
  name: t,
158
158
  defaultValue: y(a._formValues, t, y(a._defaultValues, t, e.defaultValue)),
@@ -161,11 +161,11 @@ function cr(e) {
161
161
  control: a,
162
162
  name: t,
163
163
  exact: !0
164
- }), E = x.useRef(e), V = x.useRef(a.register(t, {
164
+ }), D = A.useRef(e), V = A.useRef(a.register(t, {
165
165
  ...e.rules,
166
166
  value: d,
167
167
  ...W(e.disabled) ? { disabled: e.disabled } : {}
168
- })), S = x.useMemo(() => Object.defineProperties({}, {
168
+ })), S = A.useMemo(() => Object.defineProperties({}, {
169
169
  invalid: {
170
170
  enumerable: !0,
171
171
  get: () => !!y(v.errors, t)
@@ -186,27 +186,27 @@ function cr(e) {
186
186
  enumerable: !0,
187
187
  get: () => y(v.errors, t)
188
188
  }
189
- }), [v, t]), b = x.useCallback((L) => V.current.onChange({
189
+ }), [v, t]), b = A.useCallback((C) => V.current.onChange({
190
190
  target: {
191
- value: ut(L),
191
+ value: ut(C),
192
192
  name: t
193
193
  },
194
- type: me.CHANGE
195
- }), [t]), Z = x.useCallback(() => V.current.onBlur({
194
+ type: _e.CHANGE
195
+ }), [t]), Z = A.useCallback(() => V.current.onBlur({
196
196
  target: {
197
197
  value: y(a._formValues, t),
198
198
  name: t
199
199
  },
200
- type: me.BLUR
201
- }), [t, a._formValues]), H = x.useCallback((L) => {
200
+ type: _e.BLUR
201
+ }), [t, a._formValues]), H = A.useCallback((C) => {
202
202
  const J = y(a._fields, t);
203
- J && L && (J._f.ref = {
204
- focus: () => L.focus(),
205
- select: () => L.select(),
206
- setCustomValidity: (m) => L.setCustomValidity(m),
207
- reportValidity: () => L.reportValidity()
203
+ J && C && (J._f.ref = {
204
+ focus: () => C.focus && C.focus(),
205
+ select: () => C.select && C.select(),
206
+ setCustomValidity: (_) => C.setCustomValidity(_),
207
+ reportValidity: () => C.reportValidity()
208
208
  });
209
- }, [a._fields, t]), k = x.useMemo(() => ({
209
+ }, [a._fields, t]), k = A.useMemo(() => ({
210
210
  name: t,
211
211
  value: d,
212
212
  ...W(i) || v.disabled ? { disabled: v.disabled || i } : {},
@@ -214,29 +214,29 @@ function cr(e) {
214
214
  onBlur: Z,
215
215
  ref: H
216
216
  }), [t, i, v.disabled, b, Z, H, d]);
217
- return x.useEffect(() => {
218
- const L = a._options.shouldUnregister || o;
217
+ return A.useEffect(() => {
218
+ const C = a._options.shouldUnregister || o;
219
219
  a.register(t, {
220
- ...E.current.rules,
221
- ...W(E.current.disabled) ? { disabled: E.current.disabled } : {}
220
+ ...D.current.rules,
221
+ ...W(D.current.disabled) ? { disabled: D.current.disabled } : {}
222
222
  });
223
- const J = (m, j) => {
224
- const p = y(a._fields, m);
223
+ const J = (_, j) => {
224
+ const p = y(a._fields, _);
225
225
  p && p._f && (p._f.mount = j);
226
226
  };
227
- if (J(t, !0), L) {
228
- const m = U(y(a._options.defaultValues, t));
229
- F(a._defaultValues, t, m), T(y(a._formValues, t)) && F(a._formValues, t, m);
227
+ if (J(t, !0), C) {
228
+ const _ = U(y(a._options.defaultValues, t));
229
+ F(a._defaultValues, t, _), M(y(a._formValues, t)) && F(a._formValues, t, _);
230
230
  }
231
231
  return !u && a.register(t), () => {
232
- (u ? L && !a._state.action : L) ? a.unregister(t) : J(t, !1);
232
+ (u ? C && !a._state.action : C) ? a.unregister(t) : J(t, !1);
233
233
  };
234
- }, [t, a, u, o]), x.useEffect(() => {
234
+ }, [t, a, u, o]), A.useEffect(() => {
235
235
  a._setDisabledField({
236
236
  disabled: i,
237
237
  name: t
238
238
  });
239
- }, [i, t, a]), x.useMemo(() => ({
239
+ }, [i, t, a]), A.useMemo(() => ({
240
240
  field: k,
241
241
  formState: v,
242
242
  fieldState: S
@@ -248,7 +248,7 @@ var gt = (e, r, t, i, a) => r ? {
248
248
  ...t[e] && t[e].types ? t[e].types : {},
249
249
  [i]: a || !0
250
250
  }
251
- } : {}, de = (e) => Array.isArray(e) ? e : [e], Ye = () => {
251
+ } : {}, de = (e) => Array.isArray(e) ? e : [e], $e = () => {
252
252
  let e = [];
253
253
  return {
254
254
  get observers() {
@@ -267,9 +267,9 @@ var gt = (e, r, t, i, a) => r ? {
267
267
  e = [];
268
268
  }
269
269
  };
270
- }, Ce = (e) => B(e) || !lt(e);
270
+ }, Te = (e) => P(e) || !lt(e);
271
271
  function re(e, r) {
272
- if (Ce(e) || Ce(r))
272
+ if (Te(e) || Te(r))
273
273
  return e === r;
274
274
  if (ie(e) && ie(r))
275
275
  return e.getTime() === r.getTime();
@@ -282,61 +282,61 @@ function re(e, r) {
282
282
  return !1;
283
283
  if (a !== "ref") {
284
284
  const u = r[a];
285
- if (ie(o) && ie(u) || M(o) && M(u) || Array.isArray(o) && Array.isArray(u) ? !re(o, u) : o !== u)
285
+ if (ie(o) && ie(u) || L(o) && L(u) || Array.isArray(o) && Array.isArray(u) ? !re(o, u) : o !== u)
286
286
  return !1;
287
287
  }
288
288
  }
289
289
  return !0;
290
290
  }
291
- var P = (e) => M(e) && !Object.keys(e).length, Re = (e) => e.type === "file", $ = (e) => typeof e == "function", _e = (e) => {
292
- if (!Te)
291
+ var I = (e) => L(e) && !Object.keys(e).length, Ue = (e) => e.type === "file", z = (e) => typeof e == "function", me = (e) => {
292
+ if (!Me)
293
293
  return !1;
294
294
  const r = e ? e.ownerDocument : 0;
295
295
  return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
296
- }, vt = (e) => e.type === "select-multiple", Ue = (e) => e.type === "radio", Bt = (e) => Ue(e) || ye(e), ke = (e) => _e(e) && e.isConnected;
297
- function pt(e, r) {
296
+ }, vt = (e) => e.type === "select-multiple", Ne = (e) => e.type === "radio", pt = (e) => Ne(e) || ye(e), Ce = (e) => me(e) && e.isConnected;
297
+ function Bt(e, r) {
298
298
  const t = r.slice(0, -1).length;
299
299
  let i = 0;
300
300
  for (; i < t; )
301
- e = T(e) ? i++ : e[r[i++]];
301
+ e = M(e) ? i++ : e[r[i++]];
302
302
  return e;
303
303
  }
304
304
  function It(e) {
305
305
  for (const r in e)
306
- if (e.hasOwnProperty(r) && !T(e[r]))
306
+ if (e.hasOwnProperty(r) && !M(e[r]))
307
307
  return !1;
308
308
  return !0;
309
309
  }
310
310
  function R(e, r) {
311
- const t = Array.isArray(r) ? r : Me(r) ? [r] : dt(r), i = t.length === 1 ? e : pt(e, t), a = t.length - 1, o = t[a];
312
- return i && delete i[o], a !== 0 && (M(i) && P(i) || Array.isArray(i) && It(i)) && R(e, t.slice(0, -1)), e;
311
+ const t = Array.isArray(r) ? r : Le(r) ? [r] : dt(r), i = t.length === 1 ? e : Bt(e, t), a = t.length - 1, o = t[a];
312
+ return i && delete i[o], a !== 0 && (L(i) && I(i) || Array.isArray(i) && It(i)) && R(e, t.slice(0, -1)), e;
313
313
  }
314
314
  var bt = (e) => {
315
315
  for (const r in e)
316
- if ($(e[r]))
316
+ if (z(e[r]))
317
317
  return !0;
318
318
  return !1;
319
319
  };
320
320
  function Ve(e, r = {}) {
321
321
  const t = Array.isArray(e);
322
- if (M(e) || t)
322
+ if (L(e) || t)
323
323
  for (const i in e)
324
- Array.isArray(e[i]) || M(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, Ve(e[i], r[i])) : B(e[i]) || (r[i] = !0);
324
+ Array.isArray(e[i]) || L(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, Ve(e[i], r[i])) : P(e[i]) || (r[i] = !0);
325
325
  return r;
326
326
  }
327
- function mt(e, r, t) {
327
+ function _t(e, r, t) {
328
328
  const i = Array.isArray(e);
329
- if (M(e) || i)
329
+ if (L(e) || i)
330
330
  for (const a in e)
331
- Array.isArray(e[a]) || M(e[a]) && !bt(e[a]) ? T(r) || Ce(t[a]) ? t[a] = Array.isArray(e[a]) ? Ve(e[a], []) : { ...Ve(e[a]) } : mt(e[a], B(r) ? {} : r[a], t[a]) : t[a] = !re(e[a], r[a]);
331
+ Array.isArray(e[a]) || L(e[a]) && !bt(e[a]) ? M(r) || Te(t[a]) ? t[a] = Array.isArray(e[a]) ? Ve(e[a], []) : { ...Ve(e[a]) } : _t(e[a], P(r) ? {} : r[a], t[a]) : t[a] = !re(e[a], r[a]);
332
332
  return t;
333
333
  }
334
- var ue = (e, r) => mt(e, r, Ve(r));
334
+ var ue = (e, r) => _t(e, r, Ve(r));
335
335
  const Je = {
336
336
  value: !1,
337
337
  isValid: !1
338
338
  }, Xe = { value: !0, isValid: !0 };
339
- var _t = (e) => {
339
+ var mt = (e) => {
340
340
  if (Array.isArray(e)) {
341
341
  if (e.length > 1) {
342
342
  const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
@@ -344,11 +344,11 @@ var _t = (e) => {
344
344
  }
345
345
  return e[0].checked && !e[0].disabled ? (
346
346
  // @ts-expect-error expected to work in the browser
347
- e[0].attributes && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ? Xe : { value: e[0].value, isValid: !0 } : Xe
347
+ e[0].attributes && !M(e[0].attributes.value) ? M(e[0].value) || e[0].value === "" ? Xe : { value: e[0].value, isValid: !0 } : Xe
348
348
  ) : Je;
349
349
  }
350
350
  return Je;
351
- }, Vt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) => T(e) ? e : r ? e === "" ? NaN : e && +e : t && Y(e) ? new Date(e) : i ? i(e) : e;
351
+ }, Vt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) => M(e) ? e : r ? e === "" ? NaN : e && +e : t && $(e) ? new Date(e) : i ? i(e) : e;
352
352
  const Ze = {
353
353
  isValid: !1,
354
354
  value: null
@@ -359,7 +359,7 @@ var Ft = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disab
359
359
  } : r, Ze) : Ze;
360
360
  function et(e) {
361
361
  const r = e.ref;
362
- return Re(r) ? r.files : Ue(r) ? Ft(e.refs).value : vt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ye(r) ? _t(e.refs).value : Vt(T(r.value) ? e.ref.value : r.value, e);
362
+ return Ue(r) ? r.files : Ne(r) ? Ft(e.refs).value : vt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ye(r) ? mt(e.refs).value : Vt(M(r.value) ? e.ref.value : r.value, e);
363
363
  }
364
364
  var Wt = (e, r, t, i) => {
365
365
  const a = {};
@@ -373,7 +373,7 @@ var Wt = (e, r, t, i) => {
373
373
  fields: a,
374
374
  shouldUseNativeValidation: i
375
375
  };
376
- }, Fe = (e) => e instanceof RegExp, ce = (e) => T(e) ? e : Fe(e) ? e.source : M(e) ? Fe(e.value) ? e.value.source : e.value : e, tt = (e) => ({
376
+ }, Fe = (e) => e instanceof RegExp, ce = (e) => M(e) ? e : Fe(e) ? e.source : L(e) ? Fe(e.value) ? e.value.source : e.value : e, tt = (e) => ({
377
377
  isOnSubmit: !e || e === Q.onSubmit,
378
378
  isOnBlur: e === Q.onBlur,
379
379
  isOnChange: e === Q.onChange,
@@ -381,7 +381,7 @@ var Wt = (e, r, t, i) => {
381
381
  isOnTouch: e === Q.onTouched
382
382
  });
383
383
  const rt = "AsyncFunction";
384
- var qt = (e) => !!e && !!e.validate && !!($(e.validate) && e.validate.constructor.name === rt || M(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === rt)), Ht = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), st = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
384
+ var qt = (e) => !!e && !!e.validate && !!(z(e.validate) && e.validate.constructor.name === rt || L(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === rt)), Ht = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), st = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
385
385
  const fe = (e, r, t, i) => {
386
386
  for (const a of t || Object.keys(e)) {
387
387
  const o = y(e, a);
@@ -394,14 +394,14 @@ const fe = (e, r, t, i) => {
394
394
  return !0;
395
395
  if (fe(d, r))
396
396
  break;
397
- } else if (M(d) && fe(d, r))
397
+ } else if (L(d) && fe(d, r))
398
398
  break;
399
399
  }
400
400
  }
401
401
  };
402
402
  function it(e, r, t) {
403
403
  const i = y(e, t);
404
- if (i || Me(t))
404
+ if (i || Le(t))
405
405
  return {
406
406
  error: i,
407
407
  name: t
@@ -416,6 +416,11 @@ function it(e, r, t) {
416
416
  name: o,
417
417
  error: d
418
418
  };
419
+ if (d && d.root && d.root.type)
420
+ return {
421
+ name: `${o}.root`,
422
+ error: d.root
423
+ };
419
424
  a.pop();
420
425
  }
421
426
  return {
@@ -425,11 +430,11 @@ function it(e, r, t) {
425
430
  var jt = (e, r, t, i) => {
426
431
  t(e);
427
432
  const { name: a, ...o } = e;
428
- return P(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
429
- }, Kt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Qt = (e, r, t, i, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? i.isOnBlur : a.isOnBlur) ? !e : (t ? i.isOnChange : a.isOnChange) ? e : !0, $t = (e, r) => !Ae(y(e, r)).length && R(e, r), zt = (e, r, t) => {
433
+ return I(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
434
+ }, Kt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Qt = (e, r, t, i, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? i.isOnBlur : a.isOnBlur) ? !e : (t ? i.isOnChange : a.isOnChange) ? e : !0, zt = (e, r) => !Ae(y(e, r)).length && R(e, r), Gt = (e, r, t) => {
430
435
  const i = de(y(e, t));
431
436
  return F(i, "root", r[t]), F(e, t, i), e;
432
- }, be = (e) => Y(e);
437
+ }, be = (e) => $(e);
433
438
  function nt(e, r, t = "validate") {
434
439
  if (be(e) || Array.isArray(e) && e.every(be) || W(e) && !e)
435
440
  return {
@@ -438,104 +443,104 @@ function nt(e, r, t = "validate") {
438
443
  ref: r
439
444
  };
440
445
  }
441
- var oe = (e) => M(e) && !Fe(e) ? e : {
446
+ var oe = (e) => L(e) && !Fe(e) ? e : {
442
447
  value: e,
443
448
  message: ""
444
449
  }, at = async (e, r, t, i, a, o) => {
445
- const { ref: u, refs: d, required: v, maxLength: E, minLength: V, min: S, max: b, pattern: Z, validate: H, name: k, valueAsNumber: L, mount: J } = e._f, m = y(t, k);
450
+ const { ref: u, refs: d, required: v, maxLength: D, minLength: V, min: S, max: b, pattern: Z, validate: H, name: k, valueAsNumber: C, mount: J } = e._f, _ = y(t, k);
446
451
  if (!J || r.has(k))
447
452
  return {};
448
- const j = d ? d[0] : u, p = (_) => {
449
- a && j.reportValidity && (j.setCustomValidity(W(_) ? "" : _ || ""), j.reportValidity());
450
- }, O = {}, he = Ue(u), ee = ye(u), xe = he || ee, K = (L || Re(u)) && T(u.value) && T(m) || _e(u) && u.value === "" || m === "" || Array.isArray(m) && !m.length, se = gt.bind(null, k, i, O), z = (_, w, C, N = X.maxLength, I = X.minLength) => {
451
- const G = _ ? w : C;
453
+ const j = d ? d[0] : u, p = (m) => {
454
+ a && j.reportValidity && (j.setCustomValidity(W(m) ? "" : m || ""), j.reportValidity());
455
+ }, O = {}, he = Ne(u), ee = ye(u), xe = he || ee, K = (C || Ue(u)) && M(u.value) && M(_) || me(u) && u.value === "" || _ === "" || Array.isArray(_) && !_.length, se = gt.bind(null, k, i, O), G = (m, E, T, N = X.maxLength, B = X.minLength) => {
456
+ const Y = m ? E : T;
452
457
  O[k] = {
453
- type: _ ? N : I,
454
- message: G,
458
+ type: m ? N : B,
459
+ message: Y,
455
460
  ref: u,
456
- ...se(_ ? N : I, G)
461
+ ...se(m ? N : B, Y)
457
462
  };
458
463
  };
459
- if (o ? !Array.isArray(m) || !m.length : v && (!xe && (K || B(m)) || W(m) && !m || ee && !_t(d).isValid || he && !Ft(d).isValid)) {
460
- const { value: _, message: w } = be(v) ? { value: !!v, message: v } : oe(v);
461
- if (_ && (O[k] = {
464
+ if (o ? !Array.isArray(_) || !_.length : v && (!xe && (K || P(_)) || W(_) && !_ || ee && !mt(d).isValid || he && !Ft(d).isValid)) {
465
+ const { value: m, message: E } = be(v) ? { value: !!v, message: v } : oe(v);
466
+ if (m && (O[k] = {
462
467
  type: X.required,
463
- message: w,
468
+ message: E,
464
469
  ref: j,
465
- ...se(X.required, w)
470
+ ...se(X.required, E)
466
471
  }, !i))
467
- return p(w), O;
472
+ return p(E), O;
468
473
  }
469
- if (!K && (!B(S) || !B(b))) {
470
- let _, w;
471
- const C = oe(b), N = oe(S);
472
- if (!B(m) && !isNaN(m)) {
473
- const I = u.valueAsNumber || m && +m;
474
- B(C.value) || (_ = I > C.value), B(N.value) || (w = I < N.value);
474
+ if (!K && (!P(S) || !P(b))) {
475
+ let m, E;
476
+ const T = oe(b), N = oe(S);
477
+ if (!P(_) && !isNaN(_)) {
478
+ const B = u.valueAsNumber || _ && +_;
479
+ P(T.value) || (m = B > T.value), P(N.value) || (E = B < N.value);
475
480
  } else {
476
- const I = u.valueAsDate || new Date(m), G = (ge) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ge), le = u.type == "time", ae = u.type == "week";
477
- Y(C.value) && m && (_ = le ? G(m) > G(C.value) : ae ? m > C.value : I > new Date(C.value)), Y(N.value) && m && (w = le ? G(m) < G(N.value) : ae ? m < N.value : I < new Date(N.value));
481
+ const B = u.valueAsDate || new Date(_), Y = (ge) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ge), le = u.type == "time", ae = u.type == "week";
482
+ $(T.value) && _ && (m = le ? Y(_) > Y(T.value) : ae ? _ > T.value : B > new Date(T.value)), $(N.value) && _ && (E = le ? Y(_) < Y(N.value) : ae ? _ < N.value : B < new Date(N.value));
478
483
  }
479
- if ((_ || w) && (z(!!_, C.message, N.message, X.max, X.min), !i))
484
+ if ((m || E) && (G(!!m, T.message, N.message, X.max, X.min), !i))
480
485
  return p(O[k].message), O;
481
486
  }
482
- if ((E || V) && !K && (Y(m) || o && Array.isArray(m))) {
483
- const _ = oe(E), w = oe(V), C = !B(_.value) && m.length > +_.value, N = !B(w.value) && m.length < +w.value;
484
- if ((C || N) && (z(C, _.message, w.message), !i))
487
+ if ((D || V) && !K && ($(_) || o && Array.isArray(_))) {
488
+ const m = oe(D), E = oe(V), T = !P(m.value) && _.length > +m.value, N = !P(E.value) && _.length < +E.value;
489
+ if ((T || N) && (G(T, m.message, E.message), !i))
485
490
  return p(O[k].message), O;
486
491
  }
487
- if (Z && !K && Y(m)) {
488
- const { value: _, message: w } = oe(Z);
489
- if (Fe(_) && !m.match(_) && (O[k] = {
492
+ if (Z && !K && $(_)) {
493
+ const { value: m, message: E } = oe(Z);
494
+ if (Fe(m) && !_.match(m) && (O[k] = {
490
495
  type: X.pattern,
491
- message: w,
496
+ message: E,
492
497
  ref: u,
493
- ...se(X.pattern, w)
498
+ ...se(X.pattern, E)
494
499
  }, !i))
495
- return p(w), O;
500
+ return p(E), O;
496
501
  }
497
502
  if (H) {
498
- if ($(H)) {
499
- const _ = await H(m, t), w = nt(_, j);
500
- if (w && (O[k] = {
501
- ...w,
502
- ...se(X.validate, w.message)
503
+ if (z(H)) {
504
+ const m = await H(_, t), E = nt(m, j);
505
+ if (E && (O[k] = {
506
+ ...E,
507
+ ...se(X.validate, E.message)
503
508
  }, !i))
504
- return p(w.message), O;
505
- } else if (M(H)) {
506
- let _ = {};
507
- for (const w in H) {
508
- if (!P(_) && !i)
509
+ return p(E.message), O;
510
+ } else if (L(H)) {
511
+ let m = {};
512
+ for (const E in H) {
513
+ if (!I(m) && !i)
509
514
  break;
510
- const C = nt(await H[w](m, t), j, w);
511
- C && (_ = {
512
- ...C,
513
- ...se(w, C.message)
514
- }, p(C.message), i && (O[k] = _));
515
+ const T = nt(await H[E](_, t), j, E);
516
+ T && (m = {
517
+ ...T,
518
+ ...se(E, T.message)
519
+ }, p(T.message), i && (O[k] = m));
515
520
  }
516
- if (!P(_) && (O[k] = {
521
+ if (!I(m) && (O[k] = {
517
522
  ref: j,
518
- ..._
523
+ ...m
519
524
  }, !i))
520
525
  return O;
521
526
  }
522
527
  }
523
528
  return p(!0), O;
524
529
  };
525
- const Gt = {
530
+ const Yt = {
526
531
  mode: Q.onSubmit,
527
532
  reValidateMode: Q.onChange,
528
533
  shouldFocusError: !0
529
534
  };
530
- function Yt(e = {}) {
535
+ function $t(e = {}) {
531
536
  let r = {
532
- ...Gt,
537
+ ...Yt,
533
538
  ...e
534
539
  }, t = {
535
540
  submitCount: 0,
536
541
  isDirty: !1,
537
542
  isReady: !1,
538
- isLoading: $(r.defaultValues),
543
+ isLoading: z(r.defaultValues),
539
544
  isValidating: !1,
540
545
  isSubmitted: !1,
541
546
  isSubmitting: !1,
@@ -548,7 +553,7 @@ function Yt(e = {}) {
548
553
  disabled: r.disabled || !1
549
554
  };
550
555
  const i = {};
551
- let a = M(r.defaultValues) || M(r.values) ? U(r.defaultValues || r.values) || {} : {}, o = r.shouldUnregister ? {} : U(a), u = {
556
+ let a = L(r.defaultValues) || L(r.values) ? U(r.defaultValues || r.values) || {} : {}, o = r.shouldUnregister ? {} : U(a), u = {
552
557
  action: !1,
553
558
  mount: !1,
554
559
  watch: !1
@@ -558,7 +563,7 @@ function Yt(e = {}) {
558
563
  unMount: /* @__PURE__ */ new Set(),
559
564
  array: /* @__PURE__ */ new Set(),
560
565
  watch: /* @__PURE__ */ new Set()
561
- }, v, E = 0;
566
+ }, v, D = 0;
562
567
  const V = {
563
568
  isDirty: !1,
564
569
  dirtyFields: !1,
@@ -572,23 +577,23 @@ function Yt(e = {}) {
572
577
  ...V
573
578
  };
574
579
  const b = {
575
- array: Ye(),
576
- state: Ye()
580
+ array: $e(),
581
+ state: $e()
577
582
  }, Z = r.criteriaMode === Q.all, H = (s) => (n) => {
578
- clearTimeout(E), E = setTimeout(s, n);
583
+ clearTimeout(D), D = setTimeout(s, n);
579
584
  }, k = async (s) => {
580
585
  if (!r.disabled && (V.isValid || S.isValid || s)) {
581
- const n = r.resolver ? P((await ee()).errors) : await K(i, !0);
586
+ const n = r.resolver ? I((await ee()).errors) : await K(i, !0);
582
587
  n !== t.isValid && b.state.next({
583
588
  isValid: n
584
589
  });
585
590
  }
586
- }, L = (s, n) => {
591
+ }, C = (s, n) => {
587
592
  !r.disabled && (V.isValidating || V.validatingFields || S.isValidating || S.validatingFields) && ((s || Array.from(d.mount)).forEach((l) => {
588
593
  l && (n ? F(t.validatingFields, l, n) : R(t.validatingFields, l));
589
594
  }), b.state.next({
590
595
  validatingFields: t.validatingFields,
591
- isValidating: !P(t.validatingFields)
596
+ isValidating: !I(t.validatingFields)
592
597
  }));
593
598
  }, J = (s, n = [], l, h, f = !0, c = !0) => {
594
599
  if (h && l && !r.disabled) {
@@ -598,7 +603,7 @@ function Yt(e = {}) {
598
603
  }
599
604
  if (c && Array.isArray(y(t.errors, s))) {
600
605
  const g = l(y(t.errors, s), h.argA, h.argB);
601
- f && F(t.errors, s, g), $t(t.errors, s);
606
+ f && F(t.errors, s, g), zt(t.errors, s);
602
607
  }
603
608
  if ((V.touchedFields || S.touchedFields) && c && Array.isArray(y(t.touchedFields, s))) {
604
609
  const g = l(y(t.touchedFields, s), h.argA, h.argB);
@@ -606,14 +611,14 @@ function Yt(e = {}) {
606
611
  }
607
612
  (V.dirtyFields || S.dirtyFields) && (t.dirtyFields = ue(a, o)), b.state.next({
608
613
  name: s,
609
- isDirty: z(s, n),
614
+ isDirty: G(s, n),
610
615
  dirtyFields: t.dirtyFields,
611
616
  errors: t.errors,
612
617
  isValid: t.isValid
613
618
  });
614
619
  } else
615
620
  F(o, s, n);
616
- }, m = (s, n) => {
621
+ }, _ = (s, n) => {
617
622
  F(t.errors, s, n), b.state.next({
618
623
  errors: t.errors
619
624
  });
@@ -625,30 +630,30 @@ function Yt(e = {}) {
625
630
  }, p = (s, n, l, h) => {
626
631
  const f = y(i, s);
627
632
  if (f) {
628
- const c = y(o, s, T(l) ? y(a, s) : l);
629
- T(c) || h && h.defaultChecked || n ? F(o, s, n ? c : et(f._f)) : C(s, c), u.mount && k();
633
+ const c = y(o, s, M(l) ? y(a, s) : l);
634
+ M(c) || h && h.defaultChecked || n ? F(o, s, n ? c : et(f._f)) : T(s, c), u.mount && k();
630
635
  }
631
636
  }, O = (s, n, l, h, f) => {
632
637
  let c = !1, g = !1;
633
- const A = {
638
+ const x = {
634
639
  name: s
635
640
  };
636
641
  if (!r.disabled) {
637
642
  if (!l || h) {
638
- (V.isDirty || S.isDirty) && (g = t.isDirty, t.isDirty = A.isDirty = z(), c = g !== A.isDirty);
639
- const D = re(y(a, s), n);
640
- g = !!y(t.dirtyFields, s), D ? R(t.dirtyFields, s) : F(t.dirtyFields, s, !0), A.dirtyFields = t.dirtyFields, c = c || (V.dirtyFields || S.dirtyFields) && g !== !D;
643
+ (V.isDirty || S.isDirty) && (g = t.isDirty, t.isDirty = x.isDirty = G(), c = g !== x.isDirty);
644
+ const w = re(y(a, s), n);
645
+ g = !!y(t.dirtyFields, s), w ? R(t.dirtyFields, s) : F(t.dirtyFields, s, !0), x.dirtyFields = t.dirtyFields, c = c || (V.dirtyFields || S.dirtyFields) && g !== !w;
641
646
  }
642
647
  if (l) {
643
- const D = y(t.touchedFields, s);
644
- D || (F(t.touchedFields, s, l), A.touchedFields = t.touchedFields, c = c || (V.touchedFields || S.touchedFields) && D !== l);
648
+ const w = y(t.touchedFields, s);
649
+ w || (F(t.touchedFields, s, l), x.touchedFields = t.touchedFields, c = c || (V.touchedFields || S.touchedFields) && w !== l);
645
650
  }
646
- c && f && b.state.next(A);
651
+ c && f && b.state.next(x);
647
652
  }
648
- return c ? A : {};
653
+ return c ? x : {};
649
654
  }, he = (s, n, l, h) => {
650
655
  const f = y(t.errors, s), c = (V.isValid || S.isValid) && W(n) && t.isValid !== n;
651
- if (r.delayError && l ? (v = H(() => m(s, l)), v(r.delayError)) : (clearTimeout(E), v = null, l ? F(t.errors, s, l) : R(t.errors, s)), (l ? !re(f, l) : f) || !P(h) || c) {
656
+ if (r.delayError && l ? (v = H(() => _(s, l)), v(r.delayError)) : (clearTimeout(D), v = null, l ? F(t.errors, s, l) : R(t.errors, s)), (l ? !re(f, l) : f) || !I(h) || c) {
652
657
  const g = {
653
658
  ...h,
654
659
  ...c && W(n) ? { isValid: n } : {},
@@ -661,9 +666,9 @@ function Yt(e = {}) {
661
666
  }, b.state.next(g);
662
667
  }
663
668
  }, ee = async (s) => {
664
- L(s, !0);
669
+ C(s, !0);
665
670
  const n = await r.resolver(o, r.context, Wt(s || d.mount, i, r.criteriaMode, r.shouldUseNativeValidation));
666
- return L(s), n;
671
+ return C(s), n;
667
672
  }, xe = async (s) => {
668
673
  const { errors: n } = await ee(s);
669
674
  if (s)
@@ -682,33 +687,33 @@ function Yt(e = {}) {
682
687
  if (f) {
683
688
  const { _f: c, ...g } = f;
684
689
  if (c) {
685
- const A = d.array.has(c.name), D = f._f && qt(f._f);
686
- D && V.validatingFields && L([h], !0);
687
- const q = await at(f, d.disabled, o, Z, r.shouldUseNativeValidation && !n, A);
688
- if (D && V.validatingFields && L([h]), q[c.name] && (l.valid = !1, n))
690
+ const x = d.array.has(c.name), w = f._f && qt(f._f);
691
+ w && V.validatingFields && C([h], !0);
692
+ const q = await at(f, d.disabled, o, Z, r.shouldUseNativeValidation && !n, x);
693
+ if (w && V.validatingFields && C([h]), q[c.name] && (l.valid = !1, n))
689
694
  break;
690
- !n && (y(q, c.name) ? A ? zt(t.errors, q, c.name) : F(t.errors, c.name, q[c.name]) : R(t.errors, c.name));
695
+ !n && (y(q, c.name) ? x ? Gt(t.errors, q, c.name) : F(t.errors, c.name, q[c.name]) : R(t.errors, c.name));
691
696
  }
692
- !P(g) && await K(g, n, l);
697
+ !I(g) && await K(g, n, l);
693
698
  }
694
699
  }
695
700
  return l.valid;
696
701
  }, se = () => {
697
702
  for (const s of d.unMount) {
698
703
  const n = y(i, s);
699
- n && (n._f.refs ? n._f.refs.every((l) => !ke(l)) : !ke(n._f.ref)) && we(s);
704
+ n && (n._f.refs ? n._f.refs.every((l) => !Ce(l)) : !Ce(n._f.ref)) && Ee(s);
700
705
  }
701
706
  d.unMount = /* @__PURE__ */ new Set();
702
- }, z = (s, n) => !r.disabled && (s && n && F(o, s, n), !re(ge(), a)), _ = (s, n, l) => ht(s, d, {
703
- ...u.mount ? o : T(n) ? a : Y(s) ? { [s]: n } : n
704
- }, l, n), w = (s) => Ae(y(u.mount ? o : a, s, r.shouldUnregister ? y(a, s, []) : [])), C = (s, n, l = {}) => {
707
+ }, G = (s, n) => !r.disabled && (s && n && F(o, s, n), !re(ge(), a)), m = (s, n, l) => ht(s, d, {
708
+ ...u.mount ? o : M(n) ? a : $(s) ? { [s]: n } : n
709
+ }, l, n), E = (s) => Ae(y(u.mount ? o : a, s, r.shouldUnregister ? y(a, s, []) : [])), T = (s, n, l = {}) => {
705
710
  const h = y(i, s);
706
711
  let f = n;
707
712
  if (h) {
708
713
  const c = h._f;
709
- c && (!c.disabled && F(o, s, Vt(n, c)), f = _e(c.ref) && B(n) ? "" : n, vt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = f.includes(g.value)) : c.refs ? ye(c.ref) ? c.refs.forEach((g) => {
710
- (!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((A) => A === g.value) : g.checked = f === g.value || !!f);
711
- }) : c.refs.forEach((g) => g.checked = g.value === f) : Re(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || b.state.next({
714
+ c && (!c.disabled && F(o, s, Vt(n, c)), f = me(c.ref) && P(n) ? "" : n, vt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = f.includes(g.value)) : c.refs ? ye(c.ref) ? c.refs.forEach((g) => {
715
+ (!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((x) => x === g.value) : g.checked = f === g.value || !!f);
716
+ }) : c.refs.forEach((g) => g.checked = g.value === f) : Ue(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || b.state.next({
712
717
  name: s,
713
718
  values: U(o)
714
719
  })));
@@ -718,10 +723,10 @@ function Yt(e = {}) {
718
723
  for (const h in n) {
719
724
  if (!n.hasOwnProperty(h))
720
725
  return;
721
- const f = n[h], c = `${s}.${h}`, g = y(i, c);
722
- (d.array.has(s) || M(f) || g && !g._f) && !ie(f) ? N(c, f, l) : C(c, f, l);
726
+ const f = n[h], c = s + "." + h, g = y(i, c);
727
+ (d.array.has(s) || L(f) || g && !g._f) && !ie(f) ? N(c, f, l) : T(c, f, l);
723
728
  }
724
- }, I = (s, n, l = {}) => {
729
+ }, B = (s, n, l = {}) => {
725
730
  const h = y(i, s), f = d.array.has(s), c = U(n);
726
731
  F(o, s, c), f ? (b.array.next({
727
732
  name: s,
@@ -729,38 +734,38 @@ function Yt(e = {}) {
729
734
  }), (V.isDirty || V.dirtyFields || S.isDirty || S.dirtyFields) && l.shouldDirty && b.state.next({
730
735
  name: s,
731
736
  dirtyFields: ue(a, o),
732
- isDirty: z(s, c)
733
- })) : h && !h._f && !B(c) ? N(s, c, l) : C(s, c, l), st(s, d) && b.state.next({ ...t }), b.state.next({
737
+ isDirty: G(s, c)
738
+ })) : h && !h._f && !P(c) ? N(s, c, l) : T(s, c, l), st(s, d) && b.state.next({ ...t }), b.state.next({
734
739
  name: u.mount ? s : void 0,
735
740
  values: U(o)
736
741
  });
737
- }, G = async (s) => {
742
+ }, Y = async (s) => {
738
743
  u.mount = !0;
739
744
  const n = s.target;
740
745
  let l = n.name, h = !0;
741
- const f = y(i, l), c = (D) => {
742
- h = Number.isNaN(D) || ie(D) && isNaN(D.getTime()) || re(D, y(o, l, D));
743
- }, g = tt(r.mode), A = tt(r.reValidateMode);
746
+ const f = y(i, l), c = (w) => {
747
+ h = Number.isNaN(w) || ie(w) && isNaN(w.getTime()) || re(w, y(o, l, w));
748
+ }, g = tt(r.mode), x = tt(r.reValidateMode);
744
749
  if (f) {
745
- let D, q;
746
- const ve = n.type ? et(f._f) : ut(s), te = s.type === me.BLUR || s.type === me.FOCUS_OUT, Tt = !Ht(f._f) && !r.resolver && !y(t.errors, l) && !f._f.deps || Qt(te, y(t.touchedFields, l), t.isSubmitted, A, g), Ee = st(l, d, te);
750
+ let w, q;
751
+ const ve = n.type ? et(f._f) : ut(s), te = s.type === _e.BLUR || s.type === _e.FOCUS_OUT, Tt = !Ht(f._f) && !r.resolver && !y(t.errors, l) && !f._f.deps || Qt(te, y(t.touchedFields, l), t.isSubmitted, x, g), Se = st(l, d, te);
747
752
  F(o, l, ve), te ? (f._f.onBlur && f._f.onBlur(s), v && v(0)) : f._f.onChange && f._f.onChange(s);
748
- const Se = O(l, ve, te), Mt = !P(Se) || Ee;
753
+ const ke = O(l, ve, te), Mt = !I(ke) || Se;
749
754
  if (!te && b.state.next({
750
755
  name: l,
751
756
  type: s.type,
752
757
  values: U(o)
753
758
  }), Tt)
754
- return (V.isValid || S.isValid) && (r.mode === "onBlur" ? te && k() : te || k()), Mt && b.state.next({ name: l, ...Ee ? {} : Se });
755
- if (!te && Ee && b.state.next({ ...t }), r.resolver) {
759
+ return (V.isValid || S.isValid) && (r.mode === "onBlur" ? te && k() : te || k()), Mt && b.state.next({ name: l, ...Se ? {} : ke });
760
+ if (!te && Se && b.state.next({ ...t }), r.resolver) {
756
761
  const { errors: Ke } = await ee([l]);
757
762
  if (c(ve), h) {
758
763
  const Lt = it(t.errors, i, l), Qe = it(Ke, i, Lt.name || l);
759
- D = Qe.error, l = Qe.name, q = P(Ke);
764
+ w = Qe.error, l = Qe.name, q = I(Ke);
760
765
  }
761
766
  } else
762
- L([l], !0), D = (await at(f, d.disabled, o, Z, r.shouldUseNativeValidation))[l], L([l]), c(ve), h && (D ? q = !1 : (V.isValid || S.isValid) && (q = await K(i, !0)));
763
- h && (f._f.deps && ae(f._f.deps), he(l, q, D, Se));
767
+ C([l], !0), w = (await at(f, d.disabled, o, Z, r.shouldUseNativeValidation))[l], C([l]), c(ve), h && (w ? q = !1 : (V.isValid || S.isValid) && (q = await K(i, !0)));
768
+ h && (f._f.deps && ae(f._f.deps), he(l, q, w, ke));
764
769
  }
765
770
  }, le = (s, n) => {
766
771
  if (y(t.errors, n) && s.focus)
@@ -769,14 +774,14 @@ function Yt(e = {}) {
769
774
  let l, h;
770
775
  const f = de(s);
771
776
  if (r.resolver) {
772
- const c = await xe(T(s) ? s : f);
773
- l = P(c), h = s ? !f.some((g) => y(c, g)) : l;
777
+ const c = await xe(M(s) ? s : f);
778
+ l = I(c), h = s ? !f.some((g) => y(c, g)) : l;
774
779
  } else s ? (h = (await Promise.all(f.map(async (c) => {
775
780
  const g = y(i, c);
776
781
  return await K(g && g._f ? { [c]: g } : g);
777
782
  }))).every(Boolean), !(!h && !t.isValid) && k()) : h = l = await K(i);
778
783
  return b.state.next({
779
- ...!Y(s) || (V.isValid || S.isValid) && l !== t.isValid ? {} : { name: s },
784
+ ...!$(s) || (V.isValid || S.isValid) && l !== t.isValid ? {} : { name: s },
780
785
  ...r.resolver || !s ? { isValid: l } : {},
781
786
  errors: t.errors
782
787
  }), n.shouldFocus && !h && fe(i, le, s ? f : d.mount), h;
@@ -784,8 +789,8 @@ function Yt(e = {}) {
784
789
  const n = {
785
790
  ...u.mount ? o : a
786
791
  };
787
- return T(s) ? n : Y(s) ? y(n, s) : s.map((l) => y(n, l));
788
- }, Ne = (s, n) => ({
792
+ return M(s) ? n : $(s) ? y(n, s) : s.map((l) => y(n, l));
793
+ }, Pe = (s, n) => ({
789
794
  invalid: !!y((n || t).errors, s),
790
795
  isDirty: !!y((n || t).dirtyFields, s),
791
796
  error: y((n || t).errors, s),
@@ -795,10 +800,10 @@ function Yt(e = {}) {
795
800
  s && de(s).forEach((n) => R(t.errors, n)), b.state.next({
796
801
  errors: s ? t.errors : {}
797
802
  });
798
- }, Pe = (s, n, l) => {
799
- const h = (y(i, s, { _f: {} })._f || {}).ref, f = y(t.errors, s) || {}, { ref: c, message: g, type: A, ...D } = f;
803
+ }, pe = (s, n, l) => {
804
+ const h = (y(i, s, { _f: {} })._f || {}).ref, f = y(t.errors, s) || {}, { ref: c, message: g, type: x, ...w } = f;
800
805
  F(t.errors, s, {
801
- ...D,
806
+ ...w,
802
807
  ...n,
803
808
  ref: h
804
809
  }), b.state.next({
@@ -806,9 +811,9 @@ function Yt(e = {}) {
806
811
  errors: t.errors,
807
812
  isValid: !1
808
813
  }), l && l.shouldFocus && h && h.focus && h.focus();
809
- }, wt = (s, n) => $(s) ? b.state.subscribe({
810
- next: (l) => s(_(void 0, n), l)
811
- }) : _(s, n, !0), Be = (s) => b.state.subscribe({
814
+ }, Et = (s, n) => z(s) ? b.state.subscribe({
815
+ next: (l) => s(m(void 0, n), l)
816
+ }) : m(s, n, !0), Be = (s) => b.state.subscribe({
812
817
  next: (n) => {
813
818
  Kt(s.name, n.name, s.exact) && jt(n, s.formState || V, Ct, s.reRenderRoot) && s.callback({
814
819
  values: { ...o },
@@ -816,24 +821,24 @@ function Yt(e = {}) {
816
821
  ...n
817
822
  });
818
823
  }
819
- }).unsubscribe, Dt = (s) => (u.mount = !0, S = {
824
+ }).unsubscribe, wt = (s) => (u.mount = !0, S = {
820
825
  ...S,
821
826
  ...s.formState
822
827
  }, Be({
823
828
  ...s,
824
829
  formState: S
825
- })), we = (s, n = {}) => {
830
+ })), Ee = (s, n = {}) => {
826
831
  for (const l of s ? de(s) : d.mount)
827
832
  d.mount.delete(l), d.array.delete(l), n.keepValue || (R(i, l), R(o, l)), !n.keepError && R(t.errors, l), !n.keepDirty && R(t.dirtyFields, l), !n.keepTouched && R(t.touchedFields, l), !n.keepIsValidating && R(t.validatingFields, l), !r.shouldUnregister && !n.keepDefaultValue && R(a, l);
828
833
  b.state.next({
829
834
  values: U(o)
830
835
  }), b.state.next({
831
836
  ...t,
832
- ...n.keepDirty ? { isDirty: z() } : {}
837
+ ...n.keepDirty ? { isDirty: G() } : {}
833
838
  }), !n.keepIsValid && k();
834
- }, pe = ({ disabled: s, name: n }) => {
839
+ }, Ie = ({ disabled: s, name: n }) => {
835
840
  (W(s) && u.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n));
836
- }, De = (s, n = {}) => {
841
+ }, we = (s, n = {}) => {
837
842
  let l = y(i, s);
838
843
  const h = W(n.disabled) || W(r.disabled);
839
844
  return F(i, s, {
@@ -844,7 +849,7 @@ function Yt(e = {}) {
844
849
  mount: !0,
845
850
  ...n
846
851
  }
847
- }), d.mount.add(s), l ? pe({
852
+ }), d.mount.add(s), l ? Ie({
848
853
  disabled: W(n.disabled) ? n.disabled : r.disabled,
849
854
  name: s
850
855
  }) : p(s, !0, n.value), {
@@ -858,20 +863,20 @@ function Yt(e = {}) {
858
863
  pattern: ce(n.pattern)
859
864
  } : {},
860
865
  name: s,
861
- onChange: G,
862
- onBlur: G,
866
+ onChange: Y,
867
+ onBlur: Y,
863
868
  ref: (f) => {
864
869
  if (f) {
865
- De(s, n), l = y(i, s);
866
- const c = T(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Bt(c), A = l._f.refs || [];
867
- if (g ? A.find((D) => D === c) : c === l._f.ref)
870
+ we(s, n), l = y(i, s);
871
+ const c = M(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = pt(c), x = l._f.refs || [];
872
+ if (g ? x.find((w) => w === c) : c === l._f.ref)
868
873
  return;
869
874
  F(i, s, {
870
875
  _f: {
871
876
  ...l._f,
872
877
  ...g ? {
873
878
  refs: [
874
- ...A.filter(ke),
879
+ ...x.filter(Ce),
875
880
  c,
876
881
  ...Array.isArray(y(a, s)) ? [{}] : []
877
882
  ],
@@ -883,7 +888,7 @@ function Yt(e = {}) {
883
888
  l = y(i, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(ct(d.array, s) && u.action) && d.unMount.add(s);
884
889
  }
885
890
  };
886
- }, Ie = () => r.shouldFocusError && fe(i, le, d.mount), Et = (s) => {
891
+ }, De = () => r.shouldFocusError && fe(i, le, d.mount), Dt = (s) => {
887
892
  W(s) && (b.state.next({ disabled: s }), fe(i, (n, l) => {
888
893
  const h = y(i, l);
889
894
  h && (n.disabled = h._f.disabled || s, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
@@ -904,7 +909,7 @@ function Yt(e = {}) {
904
909
  if (d.disabled.size)
905
910
  for (const c of d.disabled)
906
911
  F(f, c, void 0);
907
- if (R(t.errors, "root"), P(t.errors)) {
912
+ if (R(t.errors, "root"), I(t.errors)) {
908
913
  b.state.next({
909
914
  errors: {}
910
915
  });
@@ -914,35 +919,35 @@ function Yt(e = {}) {
914
919
  h = c;
915
920
  }
916
921
  } else
917
- n && await n({ ...t.errors }, l), Ie(), setTimeout(Ie);
922
+ n && await n({ ...t.errors }, l), De(), setTimeout(De);
918
923
  if (b.state.next({
919
924
  isSubmitted: !0,
920
925
  isSubmitting: !1,
921
- isSubmitSuccessful: P(t.errors) && !h,
926
+ isSubmitSuccessful: I(t.errors) && !h,
922
927
  submitCount: t.submitCount + 1,
923
928
  errors: t.errors
924
929
  }), h)
925
930
  throw h;
926
931
  }, St = (s, n = {}) => {
927
- y(i, s) && (T(n.defaultValue) ? I(s, U(y(a, s))) : (I(s, n.defaultValue), F(a, s, U(n.defaultValue))), n.keepTouched || R(t.touchedFields, s), n.keepDirty || (R(t.dirtyFields, s), t.isDirty = n.defaultValue ? z(s, U(y(a, s))) : z()), n.keepError || (R(t.errors, s), V.isValid && k()), b.state.next({ ...t }));
932
+ y(i, s) && (M(n.defaultValue) ? B(s, U(y(a, s))) : (B(s, n.defaultValue), F(a, s, U(n.defaultValue))), n.keepTouched || R(t.touchedFields, s), n.keepDirty || (R(t.dirtyFields, s), t.isDirty = n.defaultValue ? G(s, U(y(a, s))) : G()), n.keepError || (R(t.errors, s), V.isValid && k()), b.state.next({ ...t }));
928
933
  }, qe = (s, n = {}) => {
929
- const l = s ? U(s) : a, h = U(l), f = P(s), c = f ? a : h;
934
+ const l = s ? U(s) : a, h = U(l), f = I(s), c = f ? a : h;
930
935
  if (n.keepDefaultValues || (a = l), !n.keepValues) {
931
936
  if (n.keepDirtyValues) {
932
937
  const g = /* @__PURE__ */ new Set([
933
938
  ...d.mount,
934
939
  ...Object.keys(ue(a, o))
935
940
  ]);
936
- for (const A of Array.from(g))
937
- y(t.dirtyFields, A) ? F(c, A, y(o, A)) : I(A, y(c, A));
941
+ for (const x of Array.from(g))
942
+ y(t.dirtyFields, x) ? F(c, x, y(o, x)) : B(x, y(c, x));
938
943
  } else {
939
- if (Te && T(s))
944
+ if (Me && M(s))
940
945
  for (const g of d.mount) {
941
- const A = y(i, g);
942
- if (A && A._f) {
943
- const D = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
944
- if (_e(D)) {
945
- const q = D.closest("form");
946
+ const x = y(i, g);
947
+ if (x && x._f) {
948
+ const w = Array.isArray(x._f.refs) ? x._f.refs[0] : x._f.ref;
949
+ if (me(w)) {
950
+ const q = w.closest("form");
946
951
  if (q) {
947
952
  q.reset();
948
953
  break;
@@ -951,7 +956,7 @@ function Yt(e = {}) {
951
956
  }
952
957
  }
953
958
  for (const g of d.mount)
954
- I(g, y(c, g));
959
+ B(g, y(c, g));
955
960
  }
956
961
  o = U(c), b.array.next({
957
962
  values: { ...c }
@@ -977,11 +982,11 @@ function Yt(e = {}) {
977
982
  isSubmitSuccessful: n.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
978
983
  isSubmitting: !1
979
984
  });
980
- }, He = (s, n) => qe($(s) ? s(o) : s, n), kt = (s, n = {}) => {
985
+ }, He = (s, n) => qe(z(s) ? s(o) : s, n), kt = (s, n = {}) => {
981
986
  const l = y(i, s), h = l && l._f;
982
987
  if (h) {
983
988
  const f = h.refs ? h.refs[0] : h.ref;
984
- f.focus && (f.focus(), n.shouldSelect && $(f.select) && f.select());
989
+ f.focus && (f.focus(), n.shouldSelect && z(f.select) && f.select());
985
990
  }
986
991
  }, Ct = (s) => {
987
992
  t = {
@@ -990,28 +995,29 @@ function Yt(e = {}) {
990
995
  };
991
996
  }, je = {
992
997
  control: {
993
- register: De,
994
- unregister: we,
995
- getFieldState: Ne,
998
+ register: we,
999
+ unregister: Ee,
1000
+ getFieldState: Pe,
996
1001
  handleSubmit: We,
997
- setError: Pe,
1002
+ setError: pe,
998
1003
  _subscribe: Be,
999
1004
  _runSchema: ee,
1000
- _getWatch: _,
1001
- _getDirty: z,
1005
+ _focusError: De,
1006
+ _getWatch: m,
1007
+ _getDirty: G,
1002
1008
  _setValid: k,
1003
1009
  _setFieldArray: J,
1004
- _setDisabledField: pe,
1010
+ _setDisabledField: Ie,
1005
1011
  _setErrors: j,
1006
- _getFieldArray: w,
1012
+ _getFieldArray: E,
1007
1013
  _reset: qe,
1008
- _resetDefaultValues: () => $(r.defaultValues) && r.defaultValues().then((s) => {
1014
+ _resetDefaultValues: () => z(r.defaultValues) && r.defaultValues().then((s) => {
1009
1015
  He(s, r.resetOptions), b.state.next({
1010
1016
  isLoading: !1
1011
1017
  });
1012
1018
  }),
1013
1019
  _removeUnmounted: se,
1014
- _disableForm: Et,
1020
+ _disableForm: Dt,
1015
1021
  _subjects: b,
1016
1022
  _proxyFormState: V,
1017
1023
  get _fields() {
@@ -1048,20 +1054,20 @@ function Yt(e = {}) {
1048
1054
  };
1049
1055
  }
1050
1056
  },
1051
- subscribe: Dt,
1057
+ subscribe: wt,
1052
1058
  trigger: ae,
1053
- register: De,
1059
+ register: we,
1054
1060
  handleSubmit: We,
1055
- watch: wt,
1056
- setValue: I,
1061
+ watch: Et,
1062
+ setValue: B,
1057
1063
  getValues: ge,
1058
1064
  reset: He,
1059
1065
  resetField: St,
1060
1066
  clearErrors: xt,
1061
- unregister: we,
1062
- setError: Pe,
1067
+ unregister: Ee,
1068
+ setError: pe,
1063
1069
  setFocus: kt,
1064
- getFieldState: Ne
1070
+ getFieldState: Pe
1065
1071
  };
1066
1072
  return {
1067
1073
  ...je,
@@ -1069,10 +1075,10 @@ function Yt(e = {}) {
1069
1075
  };
1070
1076
  }
1071
1077
  function Jt(e = {}) {
1072
- const r = x.useRef(void 0), t = x.useRef(void 0), [i, a] = x.useState({
1078
+ const r = A.useRef(void 0), t = A.useRef(void 0), [i, a] = A.useState({
1073
1079
  isDirty: !1,
1074
1080
  isValidating: !1,
1075
- isLoading: $(e.defaultValues),
1081
+ isLoading: z(e.defaultValues),
1076
1082
  isSubmitted: !1,
1077
1083
  isSubmitting: !1,
1078
1084
  isSubmitSuccessful: !1,
@@ -1084,14 +1090,14 @@ function Jt(e = {}) {
1084
1090
  errors: e.errors || {},
1085
1091
  disabled: e.disabled || !1,
1086
1092
  isReady: !1,
1087
- defaultValues: $(e.defaultValues) ? void 0 : e.defaultValues
1093
+ defaultValues: z(e.defaultValues) ? void 0 : e.defaultValues
1088
1094
  });
1089
1095
  r.current || (r.current = {
1090
- ...e.formControl ? e.formControl : Yt(e),
1096
+ ...e.formControl ? e.formControl : $t(e),
1091
1097
  formState: i
1092
- }, e.formControl && e.defaultValues && !$(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
1098
+ }, e.formControl && e.defaultValues && !z(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
1093
1099
  const o = r.current.control;
1094
- return o._options = e, Oe(() => {
1100
+ return o._options = e, Re(() => {
1095
1101
  const u = o._subscribe({
1096
1102
  formState: o._proxyFormState,
1097
1103
  callback: () => a({ ...o._formState }),
@@ -1101,22 +1107,24 @@ function Jt(e = {}) {
1101
1107
  ...d,
1102
1108
  isReady: !0
1103
1109
  })), o._formState.isReady = !0, u;
1104
- }, [o]), x.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), x.useEffect(() => {
1105
- e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !P(e.errors) && o._setErrors(e.errors);
1106
- }, [o, e.errors, e.mode, e.reValidateMode]), x.useEffect(() => {
1110
+ }, [o]), A.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), A.useEffect(() => {
1111
+ e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode);
1112
+ }, [o, e.mode, e.reValidateMode]), A.useEffect(() => {
1113
+ e.errors && (o._setErrors(e.errors), o._focusError());
1114
+ }, [o, e.errors]), A.useEffect(() => {
1107
1115
  e.shouldUnregister && o._subjects.state.next({
1108
1116
  values: o._getWatch()
1109
1117
  });
1110
- }, [o, e.shouldUnregister]), x.useEffect(() => {
1118
+ }, [o, e.shouldUnregister]), A.useEffect(() => {
1111
1119
  if (o._proxyFormState.isDirty) {
1112
1120
  const u = o._getDirty();
1113
1121
  u !== i.isDirty && o._subjects.state.next({
1114
1122
  isDirty: u
1115
1123
  });
1116
1124
  }
1117
- }, [o, i.isDirty]), x.useEffect(() => {
1125
+ }, [o, i.isDirty]), A.useEffect(() => {
1118
1126
  e.values && !re(e.values, t.current) ? (o._reset(e.values, o._options.resetOptions), t.current = e.values, a((u) => ({ ...u }))) : o._resetDefaultValues();
1119
- }, [o, e.values]), x.useEffect(() => {
1127
+ }, [o, e.values]), A.useEffect(() => {
1120
1128
  o._state.mount || (o._setValid(), o._state.mount = !0), o._state.watch && (o._state.watch = !1, o._subjects.state.next({ ...o._formState })), o._removeUnmounted();
1121
1129
  }), r.current.formState = yt(i, o), r.current;
1122
1130
  }
@@ -1154,8 +1162,8 @@ var er = function(e, r) {
1154
1162
  return e.push(S);
1155
1163
  });
1156
1164
  }), r) {
1157
- var v = t[u].types, E = v && v[i.code];
1158
- t[u] = gt(u, r, t, a, E ? [].concat(E, i.message) : i.message);
1165
+ var v = t[u].types, D = v && v[i.code];
1166
+ t[u] = gt(u, r, t, a, D ? [].concat(D, i.message) : i.message);
1159
1167
  }
1160
1168
  e.shift();
1161
1169
  }
@@ -1165,11 +1173,11 @@ var er = function(e, r) {
1165
1173
  try {
1166
1174
  return Promise.resolve(function(u, d) {
1167
1175
  try {
1168
- var v = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](i, r)).then(function(E) {
1169
- return o.shouldUseNativeValidation && At({}, o), { errors: {}, values: t.raw ? i : E };
1176
+ var v = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](i, r)).then(function(D) {
1177
+ return o.shouldUseNativeValidation && At({}, o), { errors: {}, values: t.raw ? i : D };
1170
1178
  });
1171
- } catch (E) {
1172
- return d(E);
1179
+ } catch (D) {
1180
+ return d(D);
1173
1181
  }
1174
1182
  return v && v.then ? v.then(void 0, d) : v;
1175
1183
  }(0, function(u) {
@@ -1204,9 +1212,9 @@ export {
1204
1212
  sr as c,
1205
1213
  rr as d,
1206
1214
  fr as e,
1207
- Le as f,
1215
+ Oe as f,
1208
1216
  Pt as g,
1209
1217
  cr as h,
1210
1218
  or as u
1211
1219
  };
1212
- //# sourceMappingURL=useDebounce-DcKs_mq9.js.map
1220
+ //# sourceMappingURL=useDebounce-maGDilFr.js.map