suprform 1.0.9 → 1.0.11

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
- import { jsx as ne, Fragment as jr, jsxs as cr } from "react/jsx-runtime";
2
- import F, { createContext as Qr, useContext as Gr, useMemo as We, useImperativeHandle as Fr, cloneElement as He, Children as zr, isValidElement as Kr } from "react";
1
+ import { jsx as ae, Fragment as jr, jsxs as cr } from "react/jsx-runtime";
2
+ import b, { createContext as Qr, useContext as Gr, useMemo as We, useImperativeHandle as Fr, useEffect as zr, cloneElement as He, Children as Kr, isValidElement as Yr } from "react";
3
3
  var ve = (e) => e.type === "checkbox", le = (e) => e instanceof Date, G = (e) => e == null;
4
4
  const br = (e) => typeof e == "object";
5
- var M = (e) => !G(e) && !Array.isArray(e) && br(e) && !le(e), Ar = (e) => M(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Yr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, pr = (e, t) => e.has(Yr(t)), Jr = (e) => {
5
+ var M = (e) => !G(e) && !Array.isArray(e) && br(e) && !le(e), Ar = (e) => M(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Jr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, pr = (e, t) => e.has(Jr(t)), Xr = (e) => {
6
6
  const t = e.constructor && e.constructor.prototype;
7
7
  return M(t) && t.hasOwnProperty("isPrototypeOf");
8
8
  }, ze = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
@@ -12,7 +12,7 @@ function U(e) {
12
12
  if (e instanceof Date)
13
13
  t = new Date(e);
14
14
  else if (!(ze && (e instanceof Blob || s)) && (r || M(e)))
15
- if (t = r ? [] : Object.create(Object.getPrototypeOf(e)), !r && !Jr(e))
15
+ if (t = r ? [] : Object.create(Object.getPrototypeOf(e)), !r && !Xr(e))
16
16
  t = e;
17
17
  else
18
18
  for (const u in e)
@@ -31,14 +31,14 @@ var xe = (e) => /^\w*$/.test(e), T = (e) => e === void 0, Se = (e) => Array.isAr
31
31
  const u = xe(t) ? [t] : Ke(t), i = u.length, l = i - 1;
32
32
  for (; ++s < i; ) {
33
33
  const c = u[s];
34
- let v = r;
34
+ let F = r;
35
35
  if (s !== l) {
36
- const p = e[c];
37
- v = M(p) || Array.isArray(p) ? p : isNaN(+u[s + 1]) ? {} : [];
36
+ const h = e[c];
37
+ F = M(h) || Array.isArray(h) ? h : isNaN(+u[s + 1]) ? {} : [];
38
38
  }
39
39
  if (c === "__proto__" || c === "constructor" || c === "prototype")
40
40
  return;
41
- e[c] = v, e = e[c];
41
+ e[c] = F, e = e[c];
42
42
  }
43
43
  };
44
44
  const be = {
@@ -51,7 +51,7 @@ const be = {
51
51
  onSubmit: "onSubmit",
52
52
  onTouched: "onTouched",
53
53
  all: "all"
54
- }, ae = {
54
+ }, ne = {
55
55
  max: "max",
56
56
  min: "min",
57
57
  maxLength: "maxLength",
@@ -59,11 +59,11 @@ const be = {
59
59
  pattern: "pattern",
60
60
  required: "required",
61
61
  validate: "validate"
62
- }, Ye = F.createContext(null);
62
+ }, Ye = b.createContext(null);
63
63
  Ye.displayName = "HookFormContext";
64
- const _e = () => F.useContext(Ye), Xr = (e) => {
64
+ const _e = () => b.useContext(Ye), Zr = (e) => {
65
65
  const { children: t, ...r } = e;
66
- return F.createElement(Ye.Provider, { value: r }, t);
66
+ return b.createElement(Ye.Provider, { value: r }, t);
67
67
  };
68
68
  var xr = (e, t, r, s = !0) => {
69
69
  const u = {
@@ -78,9 +78,9 @@ var xr = (e, t, r, s = !0) => {
78
78
  });
79
79
  return u;
80
80
  };
81
- const Ee = typeof window < "u" ? F.useLayoutEffect : F.useEffect;
82
- function Zr(e) {
83
- const t = _e(), { control: r = t.control, disabled: s, name: u, exact: i } = e || {}, [l, c] = F.useState(r._formState), v = F.useRef({
81
+ const Ee = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
82
+ function et(e) {
83
+ const t = _e(), { control: r = t.control, disabled: s, name: u, exact: i } = e || {}, [l, c] = b.useState(r._formState), F = b.useRef({
84
84
  isDirty: !1,
85
85
  isLoading: !1,
86
86
  dirtyFields: !1,
@@ -92,17 +92,17 @@ function Zr(e) {
92
92
  });
93
93
  return Ee(() => r._subscribe({
94
94
  name: u,
95
- formState: v.current,
95
+ formState: F.current,
96
96
  exact: i,
97
- callback: (p) => {
97
+ callback: (h) => {
98
98
  !s && c({
99
99
  ...r._formState,
100
- ...p
100
+ ...h
101
101
  });
102
102
  }
103
- }), [u, s, i]), F.useEffect(() => {
104
- v.current.isValid && r._setValid(!0);
105
- }, [r]), F.useMemo(() => xr(l, r, v.current, !1), [l, r]);
103
+ }), [u, s, i]), b.useEffect(() => {
104
+ F.current.isValid && r._setValid(!0);
105
+ }, [r]), b.useMemo(() => xr(l, r, F.current, !1), [l, r]);
106
106
  }
107
107
  var Y = (e) => typeof e == "string", $e = (e, t, r, s, u) => Y(e) ? (s && t.watch.add(e), m(r, e, u)) : Array.isArray(e) ? e.map((i) => (s && t.watch.add(i), m(r, i))) : (s && (t.watchAll = !0), r), qe = (e) => G(e) || !br(e);
108
108
  function ee(e, t, r = /* @__PURE__ */ new WeakSet()) {
@@ -129,25 +129,25 @@ function ee(e, t, r = /* @__PURE__ */ new WeakSet()) {
129
129
  return !0;
130
130
  }
131
131
  function Sr(e) {
132
- const t = _e(), { control: r = t.control, name: s, defaultValue: u, disabled: i, exact: l, compute: c } = e || {}, v = F.useRef(u), p = F.useRef(c), V = F.useRef(void 0), g = F.useRef(r), b = F.useRef(s);
133
- p.current = c;
134
- const [H, I] = F.useState(() => {
135
- const f = r._getWatch(s, v.current);
136
- return p.current ? p.current(f) : f;
137
- }), C = F.useCallback((f) => {
138
- const y = $e(s, r._names, f || r._formValues, !1, v.current);
139
- return p.current ? p.current(y) : y;
140
- }, [r._formValues, r._names, s]), B = F.useCallback((f) => {
132
+ const t = _e(), { control: r = t.control, name: s, defaultValue: u, disabled: i, exact: l, compute: c } = e || {}, F = b.useRef(u), h = b.useRef(c), V = b.useRef(void 0), g = b.useRef(r), A = b.useRef(s);
133
+ h.current = c;
134
+ const [H, I] = b.useState(() => {
135
+ const f = r._getWatch(s, F.current);
136
+ return h.current ? h.current(f) : f;
137
+ }), k = b.useCallback((f) => {
138
+ const y = $e(s, r._names, f || r._formValues, !1, F.current);
139
+ return h.current ? h.current(y) : y;
140
+ }, [r._formValues, r._names, s]), B = b.useCallback((f) => {
141
141
  if (!i) {
142
- const y = $e(s, r._names, f || r._formValues, !1, v.current);
143
- if (p.current) {
144
- const x = p.current(y);
142
+ const y = $e(s, r._names, f || r._formValues, !1, F.current);
143
+ if (h.current) {
144
+ const x = h.current(y);
145
145
  ee(x, V.current) || (I(x), V.current = x);
146
146
  } else
147
147
  I(y);
148
148
  }
149
149
  }, [r._formValues, r._names, i, s]);
150
- Ee(() => ((g.current !== r || !ee(b.current, s)) && (g.current = r, b.current = s, B()), r._subscribe({
150
+ Ee(() => ((g.current !== r || !ee(A.current, s)) && (g.current = r, A.current = s, B()), r._subscribe({
151
151
  name: s,
152
152
  formState: {
153
153
  values: !0
@@ -156,32 +156,32 @@ function Sr(e) {
156
156
  callback: (f) => {
157
157
  B(f.values);
158
158
  }
159
- })), [r, l, s, B]), F.useEffect(() => r._removeUnmounted());
160
- const j = g.current !== r, S = b.current, P = F.useMemo(() => {
159
+ })), [r, l, s, B]), b.useEffect(() => r._removeUnmounted());
160
+ const j = g.current !== r, S = A.current, P = b.useMemo(() => {
161
161
  if (i)
162
162
  return null;
163
163
  const f = !j && !ee(S, s);
164
- return j || f ? C() : null;
165
- }, [i, j, s, S, C]);
164
+ return j || f ? k() : null;
165
+ }, [i, j, s, S, k]);
166
166
  return P !== null ? P : H;
167
167
  }
168
- function et(e) {
169
- const t = _e(), { name: r, disabled: s, control: u = t.control, shouldUnregister: i, defaultValue: l, exact: c = !0 } = e, v = pr(u._names.array, r), p = F.useMemo(() => m(u._formValues, r, m(u._defaultValues, r, l)), [u, r, l]), V = Sr({
168
+ function rt(e) {
169
+ const t = _e(), { name: r, disabled: s, control: u = t.control, shouldUnregister: i, defaultValue: l, exact: c = !0 } = e, F = pr(u._names.array, r), h = b.useMemo(() => m(u._formValues, r, m(u._defaultValues, r, l)), [u, r, l]), V = Sr({
170
170
  control: u,
171
171
  name: r,
172
- defaultValue: p,
172
+ defaultValue: h,
173
173
  exact: c
174
- }), g = Zr({
174
+ }), g = et({
175
175
  control: u,
176
176
  name: r,
177
177
  exact: c
178
- }), b = F.useRef(e), H = F.useRef(void 0), I = F.useRef(u.register(r, {
178
+ }), A = b.useRef(e), H = b.useRef(void 0), I = b.useRef(u.register(r, {
179
179
  ...e.rules,
180
180
  value: V,
181
181
  ...K(e.disabled) ? { disabled: e.disabled } : {}
182
182
  }));
183
- b.current = e;
184
- const C = F.useMemo(() => Object.defineProperties({}, {
183
+ A.current = e;
184
+ const k = b.useMemo(() => Object.defineProperties({}, {
185
185
  invalid: {
186
186
  enumerable: !0,
187
187
  get: () => !!m(g.errors, r)
@@ -202,19 +202,19 @@ function et(e) {
202
202
  enumerable: !0,
203
203
  get: () => m(g.errors, r)
204
204
  }
205
- }), [g, r]), B = F.useCallback((f) => I.current.onChange({
205
+ }), [g, r]), B = b.useCallback((f) => I.current.onChange({
206
206
  target: {
207
207
  value: Ar(f),
208
208
  name: r
209
209
  },
210
210
  type: be.CHANGE
211
- }), [r]), j = F.useCallback(() => I.current.onBlur({
211
+ }), [r]), j = b.useCallback(() => I.current.onBlur({
212
212
  target: {
213
213
  value: m(u._formValues, r),
214
214
  name: r
215
215
  },
216
216
  type: be.BLUR
217
- }), [r, u._formValues]), S = F.useCallback((f) => {
217
+ }), [r, u._formValues]), S = b.useCallback((f) => {
218
218
  const y = m(u._fields, r);
219
219
  y && f && (y._f.ref = {
220
220
  focus: () => f.focus && f.focus(),
@@ -222,7 +222,7 @@ function et(e) {
222
222
  setCustomValidity: (x) => f.setCustomValidity(x),
223
223
  reportValidity: () => f.reportValidity()
224
224
  });
225
- }, [u._fields, r]), P = F.useMemo(() => ({
225
+ }, [u._fields, r]), P = b.useMemo(() => ({
226
226
  name: r,
227
227
  value: V,
228
228
  ...K(s) || g.disabled ? { disabled: g.disabled || s } : {},
@@ -230,36 +230,36 @@ function et(e) {
230
230
  onBlur: j,
231
231
  ref: S
232
232
  }), [r, s, g.disabled, B, j, S, V]);
233
- return F.useEffect(() => {
233
+ return b.useEffect(() => {
234
234
  const f = u._options.shouldUnregister || i, y = H.current;
235
- y && y !== r && !v && u.unregister(y), u.register(r, {
236
- ...b.current.rules,
237
- ...K(b.current.disabled) ? { disabled: b.current.disabled } : {}
235
+ y && y !== r && !F && u.unregister(y), u.register(r, {
236
+ ...A.current.rules,
237
+ ...K(A.current.disabled) ? { disabled: A.current.disabled } : {}
238
238
  });
239
239
  const x = (E, Z) => {
240
240
  const W = m(u._fields, E);
241
241
  W && W._f && (W._f.mount = Z);
242
242
  };
243
243
  if (x(r, !0), f) {
244
- const E = U(m(u._options.defaultValues, r, b.current.defaultValue));
244
+ const E = U(m(u._options.defaultValues, r, A.current.defaultValue));
245
245
  R(u._defaultValues, r, E), T(m(u._formValues, r)) && R(u._formValues, r, E);
246
246
  }
247
- return !v && u.register(r), H.current = r, () => {
248
- (v ? f && !u._state.action : f) ? u.unregister(r) : x(r, !1);
247
+ return !F && u.register(r), H.current = r, () => {
248
+ (F ? f && !u._state.action : f) ? u.unregister(r) : x(r, !1);
249
249
  };
250
- }, [r, u, v, i]), F.useEffect(() => {
250
+ }, [r, u, F, i]), b.useEffect(() => {
251
251
  u._setDisabledField({
252
252
  disabled: s,
253
253
  name: r
254
254
  });
255
- }, [s, r, u]), F.useMemo(() => ({
255
+ }, [s, r, u]), b.useMemo(() => ({
256
256
  field: P,
257
257
  formState: g,
258
- fieldState: C
259
- }), [P, g, C]);
258
+ fieldState: k
259
+ }), [P, g, k]);
260
260
  }
261
- const rt = (e) => e.render(et(e));
262
- var tt = (e, t, r, s, u) => t ? {
261
+ const tt = (e) => e.render(rt(e));
262
+ var st = (e, t, r, s, u) => t ? {
263
263
  ...r[e],
264
264
  types: {
265
265
  ...r[e] && r[e].types ? r[e].types : {},
@@ -302,37 +302,37 @@ var $ = (e) => M(e) && !Object.keys(e).length, Je = (e) => e.type === "file", re
302
302
  return !1;
303
303
  const t = e ? e.ownerDocument : 0;
304
304
  return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
305
- }, wr = (e) => e.type === "select-multiple", Xe = (e) => e.type === "radio", st = (e) => Xe(e) || ve(e), Oe = (e) => Ae(e) && e.isConnected;
306
- function at(e, t) {
305
+ }, wr = (e) => e.type === "select-multiple", Xe = (e) => e.type === "radio", at = (e) => Xe(e) || ve(e), Oe = (e) => Ae(e) && e.isConnected;
306
+ function nt(e, t) {
307
307
  const r = t.slice(0, -1).length;
308
308
  let s = 0;
309
309
  for (; s < r; )
310
310
  e = T(e) ? s++ : e[t[s++]];
311
311
  return e;
312
312
  }
313
- function nt(e) {
313
+ function it(e) {
314
314
  for (const t in e)
315
315
  if (e.hasOwnProperty(t) && !T(e[t]))
316
316
  return !1;
317
317
  return !0;
318
318
  }
319
319
  function L(e, t) {
320
- const r = Array.isArray(t) ? t : xe(t) ? [t] : Ke(t), s = r.length === 1 ? e : at(e, r), u = r.length - 1, i = r[u];
321
- return s && delete s[i], u !== 0 && (M(s) && $(s) || Array.isArray(s) && nt(s)) && L(e, r.slice(0, -1)), e;
320
+ const r = Array.isArray(t) ? t : xe(t) ? [t] : Ke(t), s = r.length === 1 ? e : nt(e, r), u = r.length - 1, i = r[u];
321
+ return s && delete s[i], u !== 0 && (M(s) && $(s) || Array.isArray(s) && it(s)) && L(e, r.slice(0, -1)), e;
322
322
  }
323
- var it = (e) => {
323
+ var ut = (e) => {
324
324
  for (const t in e)
325
325
  if (re(e[t]))
326
326
  return !0;
327
327
  return !1;
328
328
  };
329
- function Cr(e) {
330
- return Array.isArray(e) || M(e) && !it(e);
329
+ function kr(e) {
330
+ return Array.isArray(e) || M(e) && !ut(e);
331
331
  }
332
332
  function je(e, t = {}) {
333
333
  for (const r in e) {
334
334
  const s = e[r];
335
- Cr(s) ? (t[r] = Array.isArray(s) ? [] : {}, je(s, t[r])) : T(s) || (t[r] = !0);
335
+ kr(s) ? (t[r] = Array.isArray(s) ? [] : {}, je(s, t[r])) : T(s) || (t[r] = !0);
336
336
  }
337
337
  return t;
338
338
  }
@@ -340,7 +340,7 @@ function fe(e, t, r) {
340
340
  r || (r = je(t));
341
341
  for (const s in e) {
342
342
  const u = e[s];
343
- if (Cr(u))
343
+ if (kr(u))
344
344
  T(t) || qe(r[s]) ? r[s] = je(u, Array.isArray(u) ? [] : {}) : fe(u, G(t) ? {} : t[s], r[s]);
345
345
  else {
346
346
  const i = t[s];
@@ -353,7 +353,7 @@ const fr = {
353
353
  value: !1,
354
354
  isValid: !1
355
355
  }, yr = { value: !0, isValid: !0 };
356
- var kr = (e) => {
356
+ var Cr = (e) => {
357
357
  if (Array.isArray(e)) {
358
358
  if (e.length > 1) {
359
359
  const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
@@ -376,9 +376,9 @@ var Rr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disab
376
376
  } : t, mr) : mr;
377
377
  function _r(e) {
378
378
  const t = e.ref;
379
- return Je(t) ? t.files : Xe(t) ? Rr(e.refs).value : wr(t) ? [...t.selectedOptions].map(({ value: r }) => r) : ve(t) ? kr(e.refs).value : Dr(T(t.value) ? e.ref.value : t.value, e);
379
+ return Je(t) ? t.files : Xe(t) ? Rr(e.refs).value : wr(t) ? [...t.selectedOptions].map(({ value: r }) => r) : ve(t) ? Cr(e.refs).value : Dr(T(t.value) ? e.ref.value : t.value, e);
380
380
  }
381
- var ut = (e, t, r, s) => {
381
+ var ot = (e, t, r, s) => {
382
382
  const u = {};
383
383
  for (const i of e) {
384
384
  const l = m(t, i);
@@ -398,7 +398,7 @@ var ut = (e, t, r, s) => {
398
398
  isOnTouch: e === X.onTouched
399
399
  });
400
400
  const gr = "AsyncFunction";
401
- var ot = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === gr || M(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === gr)), lt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Qe = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
401
+ var lt = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === gr || M(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === gr)), ct = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Qe = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
402
402
  const me = (e, t, r, s) => {
403
403
  for (const u of r || Object.keys(e)) {
404
404
  const i = m(e, u);
@@ -444,11 +444,11 @@ function hr(e, t, r) {
444
444
  name: r
445
445
  };
446
446
  }
447
- var ct = (e, t, r, s) => {
447
+ var dt = (e, t, r, s) => {
448
448
  r(e);
449
449
  const { name: u, ...i } = e;
450
450
  return $(i) || Object.keys(i).length >= Object.keys(t).length || Object.keys(i).find((l) => t[l] === (!s || X.all));
451
- }, dt = (e, t, r) => !e || !t || e === t || z(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), ft = (e, t, r, s, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(t || e) : (r ? s.isOnBlur : u.isOnBlur) ? !e : (r ? s.isOnChange : u.isOnChange) ? e : !0, yt = (e, t) => !Se(m(e, t)).length && L(e, t), Or = (e, t, r) => {
451
+ }, ft = (e, t, r) => !e || !t || e === t || z(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), yt = (e, t, r, s, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(t || e) : (r ? s.isOnBlur : u.isOnBlur) ? !e : (r ? s.isOnChange : u.isOnChange) ? e : !0, mt = (e, t) => !Se(m(e, t)).length && L(e, t), Or = (e, t, r) => {
452
452
  const s = z(m(e, r));
453
453
  return R(s, "root", t[r]), R(e, r, s), e;
454
454
  };
@@ -464,33 +464,33 @@ var de = (e) => M(e) && !pe(e) ? e : {
464
464
  value: e,
465
465
  message: ""
466
466
  }, Ge = async (e, t, r, s, u, i) => {
467
- const { ref: l, refs: c, required: v, maxLength: p, minLength: V, min: g, max: b, pattern: H, validate: I, name: C, valueAsNumber: B, mount: j } = e._f, S = m(r, C);
468
- if (!j || t.has(C))
467
+ const { ref: l, refs: c, required: F, maxLength: h, minLength: V, min: g, max: A, pattern: H, validate: I, name: k, valueAsNumber: B, mount: j } = e._f, S = m(r, k);
468
+ if (!j || t.has(k))
469
469
  return {};
470
470
  const P = c ? c[0] : l, f = (w) => {
471
471
  u && P.reportValidity && (P.setCustomValidity(K(w) ? "" : w || ""), P.reportValidity());
472
- }, y = {}, x = Xe(l), E = ve(l), Z = x || E, W = (B || Je(l)) && T(l.value) && T(S) || Ae(l) && l.value === "" || S === "" || Array.isArray(S) && !S.length, oe = tt.bind(null, C, s, y), te = (w, D, N, q = ae.maxLength, Q = ae.minLength) => {
472
+ }, y = {}, x = Xe(l), E = ve(l), Z = x || E, W = (B || Je(l)) && T(l.value) && T(S) || Ae(l) && l.value === "" || S === "" || Array.isArray(S) && !S.length, oe = st.bind(null, k, s, y), te = (w, D, N, q = ne.maxLength, Q = ne.minLength) => {
473
473
  const se = w ? D : N;
474
- y[C] = {
474
+ y[k] = {
475
475
  type: w ? q : Q,
476
476
  message: se,
477
477
  ref: l,
478
478
  ...oe(w ? q : Q, se)
479
479
  };
480
480
  };
481
- if (i ? !Array.isArray(S) || !S.length : v && (!Z && (W || G(S)) || K(S) && !S || E && !kr(c).isValid || x && !Rr(c).isValid)) {
482
- const { value: w, message: D } = Y(v) ? { value: !!v, message: v } : de(v);
483
- if (w && (y[C] = {
484
- type: ae.required,
481
+ if (i ? !Array.isArray(S) || !S.length : F && (!Z && (W || G(S)) || K(S) && !S || E && !Cr(c).isValid || x && !Rr(c).isValid)) {
482
+ const { value: w, message: D } = Y(F) ? { value: !!F, message: F } : de(F);
483
+ if (w && (y[k] = {
484
+ type: ne.required,
485
485
  message: D,
486
486
  ref: P,
487
- ...oe(ae.required, D)
487
+ ...oe(ne.required, D)
488
488
  }, !s))
489
489
  return f(D), y;
490
490
  }
491
- if (!W && (!G(g) || !G(b))) {
491
+ if (!W && (!G(g) || !G(A))) {
492
492
  let w, D;
493
- const N = de(b), q = de(g);
493
+ const N = de(A), q = de(g);
494
494
  if (!G(S) && !isNaN(S)) {
495
495
  const Q = l.valueAsNumber || S && +S;
496
496
  G(N.value) || (w = Q > N.value), G(q.value) || (D = Q < q.value);
@@ -498,30 +498,30 @@ var de = (e) => M(e) && !pe(e) ? e : {
498
498
  const Q = l.valueAsDate || new Date(S), se = (Ve) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Ve), ge = l.type == "time", ce = l.type == "week";
499
499
  Y(N.value) && S && (w = ge ? se(S) > se(N.value) : ce ? S > N.value : Q > new Date(N.value)), Y(q.value) && S && (D = ge ? se(S) < se(q.value) : ce ? S < q.value : Q < new Date(q.value));
500
500
  }
501
- if ((w || D) && (te(!!w, N.message, q.message, ae.max, ae.min), !s))
502
- return f(y[C].message), y;
501
+ if ((w || D) && (te(!!w, N.message, q.message, ne.max, ne.min), !s))
502
+ return f(y[k].message), y;
503
503
  }
504
- if ((p || V) && !W && (Y(S) || i && Array.isArray(S))) {
505
- const w = de(p), D = de(V), N = !G(w.value) && S.length > +w.value, q = !G(D.value) && S.length < +D.value;
504
+ if ((h || V) && !W && (Y(S) || i && Array.isArray(S))) {
505
+ const w = de(h), D = de(V), N = !G(w.value) && S.length > +w.value, q = !G(D.value) && S.length < +D.value;
506
506
  if ((N || q) && (te(N, w.message, D.message), !s))
507
- return f(y[C].message), y;
507
+ return f(y[k].message), y;
508
508
  }
509
509
  if (H && !W && Y(S)) {
510
510
  const { value: w, message: D } = de(H);
511
- if (pe(w) && !S.match(w) && (y[C] = {
512
- type: ae.pattern,
511
+ if (pe(w) && !S.match(w) && (y[k] = {
512
+ type: ne.pattern,
513
513
  message: D,
514
514
  ref: l,
515
- ...oe(ae.pattern, D)
515
+ ...oe(ne.pattern, D)
516
516
  }, !s))
517
517
  return f(D), y;
518
518
  }
519
519
  if (I) {
520
520
  if (re(I)) {
521
521
  const w = await I(S, r), D = vr(w, P);
522
- if (D && (y[C] = {
522
+ if (D && (y[k] = {
523
523
  ...D,
524
- ...oe(ae.validate, D.message)
524
+ ...oe(ne.validate, D.message)
525
525
  }, !s))
526
526
  return f(D.message), y;
527
527
  } else if (M(I)) {
@@ -533,9 +533,9 @@ var de = (e) => M(e) && !pe(e) ? e : {
533
533
  N && (w = {
534
534
  ...N,
535
535
  ...oe(D, N.message)
536
- }, f(N.message), s && (y[C] = w));
536
+ }, f(N.message), s && (y[k] = w));
537
537
  }
538
- if (!$(w) && (y[C] = {
538
+ if (!$(w) && (y[k] = {
539
539
  ref: P,
540
540
  ...w
541
541
  }, !s))
@@ -544,14 +544,14 @@ var de = (e) => M(e) && !pe(e) ? e : {
544
544
  }
545
545
  return f(!0), y;
546
546
  };
547
- const mt = {
547
+ const _t = {
548
548
  mode: X.onSubmit,
549
549
  reValidateMode: X.onChange,
550
550
  shouldFocusError: !0
551
551
  };
552
- function _t(e = {}) {
552
+ function gt(e = {}) {
553
553
  let t = {
554
- ...mt,
554
+ ..._t,
555
555
  ...e
556
556
  }, r = {
557
557
  submitCount: 0,
@@ -578,7 +578,7 @@ function _t(e = {}) {
578
578
  unMount: /* @__PURE__ */ new Set(),
579
579
  array: /* @__PURE__ */ new Set(),
580
580
  watch: /* @__PURE__ */ new Set()
581
- }, v, p = 0;
581
+ }, F, h = 0;
582
582
  const V = {
583
583
  isDirty: !1,
584
584
  dirtyFields: !1,
@@ -591,40 +591,40 @@ function _t(e = {}) {
591
591
  let g = {
592
592
  ...V
593
593
  };
594
- const b = {
594
+ const A = {
595
595
  array: dr(),
596
596
  state: dr()
597
597
  }, H = t.criteriaMode === X.all, I = (a) => (n) => {
598
- clearTimeout(p), p = setTimeout(a, n);
599
- }, C = async (a) => {
598
+ clearTimeout(h), h = setTimeout(a, n);
599
+ }, k = async (a) => {
600
600
  if (!t.disabled && (V.isValid || g.isValid || a)) {
601
601
  const n = t.resolver ? $((await E()).errors) : await W(s, !0);
602
- n !== r.isValid && b.state.next({
602
+ n !== r.isValid && A.state.next({
603
603
  isValid: n
604
604
  });
605
605
  }
606
606
  }, B = (a, n) => {
607
607
  !t.disabled && (V.isValidating || V.validatingFields || g.isValidating || g.validatingFields) && ((a || Array.from(c.mount)).forEach((o) => {
608
608
  o && (n ? R(r.validatingFields, o, n) : L(r.validatingFields, o));
609
- }), b.state.next({
609
+ }), A.state.next({
610
610
  validatingFields: r.validatingFields,
611
611
  isValidating: !$(r.validatingFields)
612
612
  }));
613
- }, j = (a, n = [], o, h, _ = !0, d = !0) => {
614
- if (h && o && !t.disabled) {
613
+ }, j = (a, n = [], o, v, _ = !0, d = !0) => {
614
+ if (v && o && !t.disabled) {
615
615
  if (l.action = !0, d && Array.isArray(m(s, a))) {
616
- const A = o(m(s, a), h.argA, h.argB);
617
- _ && R(s, a, A);
616
+ const p = o(m(s, a), v.argA, v.argB);
617
+ _ && R(s, a, p);
618
618
  }
619
619
  if (d && Array.isArray(m(r.errors, a))) {
620
- const A = o(m(r.errors, a), h.argA, h.argB);
621
- _ && R(r.errors, a, A), yt(r.errors, a);
620
+ const p = o(m(r.errors, a), v.argA, v.argB);
621
+ _ && R(r.errors, a, p), mt(r.errors, a);
622
622
  }
623
623
  if ((V.touchedFields || g.touchedFields) && d && Array.isArray(m(r.touchedFields, a))) {
624
- const A = o(m(r.touchedFields, a), h.argA, h.argB);
625
- _ && R(r.touchedFields, a, A);
624
+ const p = o(m(r.touchedFields, a), v.argA, v.argB);
625
+ _ && R(r.touchedFields, a, p);
626
626
  }
627
- (V.dirtyFields || g.dirtyFields) && (r.dirtyFields = fe(u, i)), b.state.next({
627
+ (V.dirtyFields || g.dirtyFields) && (r.dirtyFields = fe(u, i)), A.state.next({
628
628
  name: a,
629
629
  isDirty: te(a, n),
630
630
  dirtyFields: r.dirtyFields,
@@ -634,62 +634,62 @@ function _t(e = {}) {
634
634
  } else
635
635
  R(i, a, n);
636
636
  }, S = (a, n) => {
637
- R(r.errors, a, n), b.state.next({
637
+ R(r.errors, a, n), A.state.next({
638
638
  errors: r.errors
639
639
  });
640
640
  }, P = (a) => {
641
- r.errors = a, b.state.next({
641
+ r.errors = a, A.state.next({
642
642
  errors: r.errors,
643
643
  isValid: !1
644
644
  });
645
- }, f = (a, n, o, h) => {
645
+ }, f = (a, n, o, v) => {
646
646
  const _ = m(s, a);
647
647
  if (_) {
648
648
  const d = m(i, a, T(o) ? m(u, a) : o);
649
- T(d) || h && h.defaultChecked || n ? R(i, a, n ? d : _r(_._f)) : N(a, d), l.mount && !l.action && C();
649
+ T(d) || v && v.defaultChecked || n ? R(i, a, n ? d : _r(_._f)) : N(a, d), l.mount && !l.action && k();
650
650
  }
651
- }, y = (a, n, o, h, _) => {
652
- let d = !1, A = !1;
653
- const k = {
651
+ }, y = (a, n, o, v, _) => {
652
+ let d = !1, p = !1;
653
+ const C = {
654
654
  name: a
655
655
  };
656
656
  if (!t.disabled) {
657
- if (!o || h) {
658
- (V.isDirty || g.isDirty) && (A = r.isDirty, r.isDirty = k.isDirty = te(), d = A !== k.isDirty);
657
+ if (!o || v) {
658
+ (V.isDirty || g.isDirty) && (p = r.isDirty, r.isDirty = C.isDirty = te(), d = p !== C.isDirty);
659
659
  const O = ee(m(u, a), n);
660
- A = !!m(r.dirtyFields, a), O ? L(r.dirtyFields, a) : R(r.dirtyFields, a, !0), k.dirtyFields = r.dirtyFields, d = d || (V.dirtyFields || g.dirtyFields) && A !== !O;
660
+ p = !!m(r.dirtyFields, a), O ? L(r.dirtyFields, a) : R(r.dirtyFields, a, !0), C.dirtyFields = r.dirtyFields, d = d || (V.dirtyFields || g.dirtyFields) && p !== !O;
661
661
  }
662
662
  if (o) {
663
663
  const O = m(r.touchedFields, a);
664
- O || (R(r.touchedFields, a, o), k.touchedFields = r.touchedFields, d = d || (V.touchedFields || g.touchedFields) && O !== o);
664
+ O || (R(r.touchedFields, a, o), C.touchedFields = r.touchedFields, d = d || (V.touchedFields || g.touchedFields) && O !== o);
665
665
  }
666
- d && _ && b.state.next(k);
666
+ d && _ && A.state.next(C);
667
667
  }
668
- return d ? k : {};
669
- }, x = (a, n, o, h) => {
668
+ return d ? C : {};
669
+ }, x = (a, n, o, v) => {
670
670
  const _ = m(r.errors, a), d = (V.isValid || g.isValid) && K(n) && r.isValid !== n;
671
- if (t.delayError && o ? (v = I(() => S(a, o)), v(t.delayError)) : (clearTimeout(p), v = null, o ? R(r.errors, a, o) : L(r.errors, a)), (o ? !ee(_, o) : _) || !$(h) || d) {
672
- const A = {
673
- ...h,
671
+ if (t.delayError && o ? (F = I(() => S(a, o)), F(t.delayError)) : (clearTimeout(h), F = null, o ? R(r.errors, a, o) : L(r.errors, a)), (o ? !ee(_, o) : _) || !$(v) || d) {
672
+ const p = {
673
+ ...v,
674
674
  ...d && K(n) ? { isValid: n } : {},
675
675
  errors: r.errors,
676
676
  name: a
677
677
  };
678
678
  r = {
679
679
  ...r,
680
- ...A
681
- }, b.state.next(A);
680
+ ...p
681
+ }, A.state.next(p);
682
682
  }
683
683
  }, E = async (a) => {
684
684
  B(a, !0);
685
- const n = await t.resolver(i, t.context, ut(a || c.mount, s, t.criteriaMode, t.shouldUseNativeValidation));
685
+ const n = await t.resolver(i, t.context, ot(a || c.mount, s, t.criteriaMode, t.shouldUseNativeValidation));
686
686
  return B(a), n;
687
687
  }, Z = async (a) => {
688
688
  const { errors: n } = await E(a);
689
689
  if (a)
690
690
  for (const o of a) {
691
- const h = m(n, o);
692
- h ? R(r.errors, o, h) : L(r.errors, o);
691
+ const v = m(n, o);
692
+ v ? R(r.errors, o, v) : L(r.errors, o);
693
693
  }
694
694
  else
695
695
  r.errors = n;
@@ -697,19 +697,19 @@ function _t(e = {}) {
697
697
  }, W = async (a, n, o = {
698
698
  valid: !0
699
699
  }) => {
700
- for (const h in a) {
701
- const _ = a[h];
700
+ for (const v in a) {
701
+ const _ = a[v];
702
702
  if (_) {
703
- const { _f: d, ...A } = _;
703
+ const { _f: d, ...p } = _;
704
704
  if (d) {
705
- const k = c.array.has(d.name), O = _._f && ot(_._f);
705
+ const C = c.array.has(d.name), O = _._f && lt(_._f);
706
706
  O && V.validatingFields && B([d.name], !0);
707
- const J = await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation && !n, k);
707
+ const J = await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation && !n, C);
708
708
  if (O && V.validatingFields && B([d.name]), J[d.name] && (o.valid = !1, n))
709
709
  break;
710
- !n && (m(J, d.name) ? k ? Or(r.errors, J, d.name) : R(r.errors, d.name, J[d.name]) : L(r.errors, d.name));
710
+ !n && (m(J, d.name) ? C ? Or(r.errors, J, d.name) : R(r.errors, d.name, J[d.name]) : L(r.errors, d.name));
711
711
  }
712
- !$(A) && await W(A, n, o);
712
+ !$(p) && await W(p, n, o);
713
713
  }
714
714
  }
715
715
  return o.valid;
@@ -722,89 +722,89 @@ function _t(e = {}) {
722
722
  }, te = (a, n) => !t.disabled && (a && n && R(i, a, n), !ee(Ve(), u)), w = (a, n, o) => $e(a, c, {
723
723
  ...l.mount ? i : T(n) ? u : Y(a) ? { [a]: n } : n
724
724
  }, o, n), D = (a) => Se(m(l.mount ? i : u, a, t.shouldUnregister ? m(u, a, []) : [])), N = (a, n, o = {}) => {
725
- const h = m(s, a);
725
+ const v = m(s, a);
726
726
  let _ = n;
727
- if (h) {
728
- const d = h._f;
729
- d && (!d.disabled && R(i, a, Dr(n, d)), _ = Ae(d.ref) && G(n) ? "" : n, wr(d.ref) ? [...d.ref.options].forEach((A) => A.selected = _.includes(A.value)) : d.refs ? ve(d.ref) ? d.refs.forEach((A) => {
730
- (!A.defaultChecked || !A.disabled) && (Array.isArray(_) ? A.checked = !!_.find((k) => k === A.value) : A.checked = _ === A.value || !!_);
731
- }) : d.refs.forEach((A) => A.checked = A.value === _) : Je(d.ref) ? d.ref.value = "" : (d.ref.value = _, d.ref.type || b.state.next({
727
+ if (v) {
728
+ const d = v._f;
729
+ d && (!d.disabled && R(i, a, Dr(n, d)), _ = Ae(d.ref) && G(n) ? "" : n, wr(d.ref) ? [...d.ref.options].forEach((p) => p.selected = _.includes(p.value)) : d.refs ? ve(d.ref) ? d.refs.forEach((p) => {
730
+ (!p.defaultChecked || !p.disabled) && (Array.isArray(_) ? p.checked = !!_.find((C) => C === p.value) : p.checked = _ === p.value || !!_);
731
+ }) : d.refs.forEach((p) => p.checked = p.value === _) : Je(d.ref) ? d.ref.value = "" : (d.ref.value = _, d.ref.type || A.state.next({
732
732
  name: a,
733
733
  values: U(i)
734
734
  })));
735
735
  }
736
736
  (o.shouldDirty || o.shouldTouch) && y(a, _, o.shouldTouch, o.shouldDirty, !0), o.shouldValidate && ce(a);
737
737
  }, q = (a, n, o) => {
738
- for (const h in n) {
739
- if (!n.hasOwnProperty(h))
738
+ for (const v in n) {
739
+ if (!n.hasOwnProperty(v))
740
740
  return;
741
- const _ = n[h], d = a + "." + h, A = m(s, d);
742
- (c.array.has(a) || M(_) || A && !A._f) && !le(_) ? q(d, _, o) : N(d, _, o);
741
+ const _ = n[v], d = a + "." + v, p = m(s, d);
742
+ (c.array.has(a) || M(_) || p && !p._f) && !le(_) ? q(d, _, o) : N(d, _, o);
743
743
  }
744
744
  }, Q = (a, n, o = {}) => {
745
- const h = m(s, a), _ = c.array.has(a), d = U(n);
746
- R(i, a, d), _ ? (b.array.next({
745
+ const v = m(s, a), _ = c.array.has(a), d = U(n);
746
+ R(i, a, d), _ ? (A.array.next({
747
747
  name: a,
748
748
  values: U(i)
749
- }), (V.isDirty || V.dirtyFields || g.isDirty || g.dirtyFields) && o.shouldDirty && b.state.next({
749
+ }), (V.isDirty || V.dirtyFields || g.isDirty || g.dirtyFields) && o.shouldDirty && A.state.next({
750
750
  name: a,
751
751
  dirtyFields: fe(u, i),
752
752
  isDirty: te(a, d)
753
- })) : h && !h._f && !G(d) ? q(a, d, o) : N(a, d, o), Qe(a, c) && b.state.next({ ...r, name: a }), b.state.next({
753
+ })) : v && !v._f && !G(d) ? q(a, d, o) : N(a, d, o), Qe(a, c) && A.state.next({ ...r, name: a }), A.state.next({
754
754
  name: l.mount ? a : void 0,
755
755
  values: U(i)
756
756
  });
757
757
  }, se = async (a) => {
758
758
  l.mount = !0;
759
759
  const n = a.target;
760
- let o = n.name, h = !0;
760
+ let o = n.name, v = !0;
761
761
  const _ = m(s, o), d = (O) => {
762
- h = Number.isNaN(O) || le(O) && isNaN(O.getTime()) || ee(O, m(i, o, O));
763
- }, A = ye(t.mode), k = ye(t.reValidateMode);
762
+ v = Number.isNaN(O) || le(O) && isNaN(O.getTime()) || ee(O, m(i, o, O));
763
+ }, p = ye(t.mode), C = ye(t.reValidateMode);
764
764
  if (_) {
765
765
  let O, J;
766
- const Fe = n.type ? _r(_._f) : Ar(a), ie = a.type === be.BLUR || a.type === be.FOCUS_OUT, Hr = !lt(_._f) && !t.resolver && !m(r.errors, o) && !_._f.deps || ft(ie, m(r.touchedFields, o), r.isSubmitted, k, A), De = Qe(o, c, ie);
767
- R(i, o, Fe), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), v && v(0)) : _._f.onChange && _._f.onChange(a);
766
+ const Fe = n.type ? _r(_._f) : Ar(a), ie = a.type === be.BLUR || a.type === be.FOCUS_OUT, Hr = !ct(_._f) && !t.resolver && !m(r.errors, o) && !_._f.deps || yt(ie, m(r.touchedFields, o), r.isSubmitted, C, p), De = Qe(o, c, ie);
767
+ R(i, o, Fe), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), F && F(0)) : _._f.onChange && _._f.onChange(a);
768
768
  const Re = y(o, Fe, ie), $r = !$(Re) || De;
769
- if (!ie && b.state.next({
769
+ if (!ie && A.state.next({
770
770
  name: o,
771
771
  type: a.type,
772
772
  values: U(i)
773
773
  }), Hr)
774
- return (V.isValid || g.isValid) && (t.mode === "onBlur" ? ie && C() : ie || C()), $r && b.state.next({ name: o, ...De ? {} : Re });
775
- if (!ie && De && b.state.next({ ...r }), t.resolver) {
774
+ return (V.isValid || g.isValid) && (t.mode === "onBlur" ? ie && k() : ie || k()), $r && A.state.next({ name: o, ...De ? {} : Re });
775
+ if (!ie && De && A.state.next({ ...r }), t.resolver) {
776
776
  const { errors: or } = await E([o]);
777
- if (d(Fe), h) {
777
+ if (d(Fe), v) {
778
778
  const qr = hr(r.errors, s, o), lr = hr(or, s, qr.name || o);
779
779
  O = lr.error, o = lr.name, J = $(or);
780
780
  }
781
781
  } else
782
- B([o], !0), O = (await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation))[o], B([o]), d(Fe), h && (O ? J = !1 : (V.isValid || g.isValid) && (J = await W(s, !0)));
783
- h && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ce(_._f.deps), x(o, J, O, Re));
782
+ B([o], !0), O = (await Ge(_, c.disabled, i, H, t.shouldUseNativeValidation))[o], B([o]), d(Fe), v && (O ? J = !1 : (V.isValid || g.isValid) && (J = await W(s, !0)));
783
+ v && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ce(_._f.deps), x(o, J, O, Re));
784
784
  }
785
785
  }, ge = (a, n) => {
786
786
  if (m(r.errors, n) && a.focus)
787
787
  return a.focus(), 1;
788
788
  }, ce = async (a, n = {}) => {
789
- let o, h;
789
+ let o, v;
790
790
  const _ = z(a);
791
791
  if (t.resolver) {
792
792
  const d = await Z(T(a) ? a : _);
793
- o = $(d), h = a ? !_.some((A) => m(d, A)) : o;
794
- } else a ? (h = (await Promise.all(_.map(async (d) => {
795
- const A = m(s, d);
796
- return await W(A && A._f ? { [d]: A } : A);
797
- }))).every(Boolean), !(!h && !r.isValid) && C()) : h = o = await W(s);
798
- return b.state.next({
793
+ o = $(d), v = a ? !_.some((p) => m(d, p)) : o;
794
+ } else a ? (v = (await Promise.all(_.map(async (d) => {
795
+ const p = m(s, d);
796
+ return await W(p && p._f ? { [d]: p } : p);
797
+ }))).every(Boolean), !(!v && !r.isValid) && k()) : v = o = await W(s);
798
+ return A.state.next({
799
799
  ...!Y(a) || (V.isValid || g.isValid) && o !== r.isValid ? {} : { name: a },
800
800
  ...t.resolver || !a ? { isValid: o } : {},
801
801
  errors: r.errors
802
- }), n.shouldFocus && !h && me(s, ge, a ? _ : c.mount), h;
802
+ }), n.shouldFocus && !v && me(s, ge, a ? _ : c.mount), v;
803
803
  }, Ve = (a, n) => {
804
804
  let o = {
805
805
  ...l.mount ? i : u
806
806
  };
807
- return n && (o = Er(n.dirtyFields ? r.dirtyFields : r.touchedFields, o)), T(a) ? o : Y(a) ? m(o, a) : a.map((h) => m(o, h));
807
+ return n && (o = Er(n.dirtyFields ? r.dirtyFields : r.touchedFields, o)), T(a) ? o : Y(a) ? m(o, a) : a.map((v) => m(o, v));
808
808
  }, er = (a, n) => ({
809
809
  invalid: !!m((n || r).errors, a),
810
810
  isDirty: !!m((n || r).dirtyFields, a),
@@ -812,25 +812,25 @@ function _t(e = {}) {
812
812
  isValidating: !!m(r.validatingFields, a),
813
813
  isTouched: !!m((n || r).touchedFields, a)
814
814
  }), Nr = (a) => {
815
- a && z(a).forEach((n) => L(r.errors, n)), b.state.next({
815
+ a && z(a).forEach((n) => L(r.errors, n)), A.state.next({
816
816
  errors: a ? r.errors : {}
817
817
  });
818
818
  }, rr = (a, n, o) => {
819
- const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(r.errors, a) || {}, { ref: d, message: A, type: k, ...O } = _;
819
+ const v = (m(s, a, { _f: {} })._f || {}).ref, _ = m(r.errors, a) || {}, { ref: d, message: p, type: C, ...O } = _;
820
820
  R(r.errors, a, {
821
821
  ...O,
822
822
  ...n,
823
- ref: h
824
- }), b.state.next({
823
+ ref: v
824
+ }), A.state.next({
825
825
  name: a,
826
826
  errors: r.errors,
827
827
  isValid: !1
828
- }), o && o.shouldFocus && h && h.focus && h.focus();
829
- }, Lr = (a, n) => re(a) ? b.state.subscribe({
828
+ }), o && o.shouldFocus && v && v.focus && v.focus();
829
+ }, Lr = (a, n) => re(a) ? A.state.subscribe({
830
830
  next: (o) => "values" in o && a(w(void 0, n), o)
831
- }) : w(a, n, !0), tr = (a) => b.state.subscribe({
831
+ }) : w(a, n, !0), tr = (a) => A.state.subscribe({
832
832
  next: (n) => {
833
- dt(a.name, n.name, a.exact) && ct(n, a.formState || V, Wr, a.reRenderRoot) && a.callback({
833
+ ft(a.name, n.name, a.exact) && dt(n, a.formState || V, Wr, a.reRenderRoot) && a.callback({
834
834
  values: { ...i },
835
835
  ...r,
836
836
  ...n,
@@ -846,17 +846,17 @@ function _t(e = {}) {
846
846
  })), we = (a, n = {}) => {
847
847
  for (const o of a ? z(a) : c.mount)
848
848
  c.mount.delete(o), c.array.delete(o), n.keepValue || (L(s, o), L(i, o)), !n.keepError && L(r.errors, o), !n.keepDirty && L(r.dirtyFields, o), !n.keepTouched && L(r.touchedFields, o), !n.keepIsValidating && L(r.validatingFields, o), !t.shouldUnregister && !n.keepDefaultValue && L(u, o);
849
- b.state.next({
849
+ A.state.next({
850
850
  values: U(i)
851
- }), b.state.next({
851
+ }), A.state.next({
852
852
  ...r,
853
853
  ...n.keepDirty ? { isDirty: te() } : {}
854
- }), !n.keepIsValid && C();
854
+ }), !n.keepIsValid && k();
855
855
  }, sr = ({ disabled: a, name: n }) => {
856
856
  (K(a) && l.mount || a || c.disabled.has(n)) && (a ? c.disabled.add(n) : c.disabled.delete(n));
857
- }, Ce = (a, n = {}) => {
857
+ }, ke = (a, n = {}) => {
858
858
  let o = m(s, a);
859
- const h = K(n.disabled) || K(t.disabled);
859
+ const v = K(n.disabled) || K(t.disabled);
860
860
  return R(s, a, {
861
861
  ...o || {},
862
862
  _f: {
@@ -869,7 +869,7 @@ function _t(e = {}) {
869
869
  disabled: K(n.disabled) ? n.disabled : t.disabled,
870
870
  name: a
871
871
  }) : f(a, !0, n.value), {
872
- ...h ? { disabled: n.disabled || t.disabled } : {},
872
+ ...v ? { disabled: n.disabled || t.disabled } : {},
873
873
  ...t.progressive ? {
874
874
  required: !!n.required,
875
875
  min: he(n.min),
@@ -883,16 +883,16 @@ function _t(e = {}) {
883
883
  onBlur: se,
884
884
  ref: (_) => {
885
885
  if (_) {
886
- Ce(a, n), o = m(s, a);
887
- const d = T(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, A = st(d), k = o._f.refs || [];
888
- if (A ? k.find((O) => O === d) : d === o._f.ref)
886
+ ke(a, n), o = m(s, a);
887
+ const d = T(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, p = at(d), C = o._f.refs || [];
888
+ if (p ? C.find((O) => O === d) : d === o._f.ref)
889
889
  return;
890
890
  R(s, a, {
891
891
  _f: {
892
892
  ...o._f,
893
- ...A ? {
893
+ ...p ? {
894
894
  refs: [
895
- ...k.filter(Oe),
895
+ ...C.filter(Oe),
896
896
  d,
897
897
  ...Array.isArray(m(u, a)) ? [{}] : []
898
898
  ],
@@ -904,64 +904,64 @@ function _t(e = {}) {
904
904
  o = m(s, a, {}), o._f && (o._f.mount = !1), (t.shouldUnregister || n.shouldUnregister) && !(pr(c.array, a) && l.action) && c.unMount.add(a);
905
905
  }
906
906
  };
907
- }, ke = () => t.shouldFocusError && me(s, ge, c.mount), Ir = (a) => {
908
- K(a) && (b.state.next({ disabled: a }), me(s, (n, o) => {
909
- const h = m(s, o);
910
- h && (n.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((_) => {
911
- _.disabled = h._f.disabled || a;
907
+ }, Ce = () => t.shouldFocusError && me(s, ge, c.mount), Ir = (a) => {
908
+ K(a) && (A.state.next({ disabled: a }), me(s, (n, o) => {
909
+ const v = m(s, o);
910
+ v && (n.disabled = v._f.disabled || a, Array.isArray(v._f.refs) && v._f.refs.forEach((_) => {
911
+ _.disabled = v._f.disabled || a;
912
912
  }));
913
913
  }, 0, !1));
914
914
  }, ar = (a, n) => async (o) => {
915
- let h;
915
+ let v;
916
916
  o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
917
917
  let _ = U(i);
918
- if (b.state.next({
918
+ if (A.state.next({
919
919
  isSubmitting: !0
920
920
  }), t.resolver) {
921
- const { errors: d, values: A } = await E();
922
- r.errors = d, _ = U(A);
921
+ const { errors: d, values: p } = await E();
922
+ r.errors = d, _ = U(p);
923
923
  } else
924
924
  await W(s);
925
925
  if (c.disabled.size)
926
926
  for (const d of c.disabled)
927
927
  L(_, d);
928
928
  if (L(r.errors, "root"), $(r.errors)) {
929
- b.state.next({
929
+ A.state.next({
930
930
  errors: {}
931
931
  });
932
932
  try {
933
933
  await a(_, o);
934
934
  } catch (d) {
935
- h = d;
935
+ v = d;
936
936
  }
937
937
  } else
938
- n && await n({ ...r.errors }, o), ke(), setTimeout(ke);
939
- if (b.state.next({
938
+ n && await n({ ...r.errors }, o), Ce(), setTimeout(Ce);
939
+ if (A.state.next({
940
940
  isSubmitted: !0,
941
941
  isSubmitting: !1,
942
- isSubmitSuccessful: $(r.errors) && !h,
942
+ isSubmitSuccessful: $(r.errors) && !v,
943
943
  submitCount: r.submitCount + 1,
944
944
  errors: r.errors
945
- }), h)
946
- throw h;
945
+ }), v)
946
+ throw v;
947
947
  }, Br = (a, n = {}) => {
948
- m(s, a) && (T(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched || L(r.touchedFields, a), n.keepDirty || (L(r.dirtyFields, a), r.isDirty = n.defaultValue ? te(a, U(m(u, a))) : te()), n.keepError || (L(r.errors, a), V.isValid && C()), b.state.next({ ...r }));
948
+ m(s, a) && (T(n.defaultValue) ? Q(a, U(m(u, a))) : (Q(a, n.defaultValue), R(u, a, U(n.defaultValue))), n.keepTouched || L(r.touchedFields, a), n.keepDirty || (L(r.dirtyFields, a), r.isDirty = n.defaultValue ? te(a, U(m(u, a))) : te()), n.keepError || (L(r.errors, a), V.isValid && k()), A.state.next({ ...r }));
949
949
  }, nr = (a, n = {}) => {
950
- const o = a ? U(a) : u, h = U(o), _ = $(a), d = _ ? u : h;
950
+ const o = a ? U(a) : u, v = U(o), _ = $(a), d = _ ? u : v;
951
951
  if (n.keepDefaultValues || (u = o), !n.keepValues) {
952
952
  if (n.keepDirtyValues) {
953
- const A = /* @__PURE__ */ new Set([
953
+ const p = /* @__PURE__ */ new Set([
954
954
  ...c.mount,
955
955
  ...Object.keys(fe(u, i))
956
956
  ]);
957
- for (const k of Array.from(A))
958
- m(r.dirtyFields, k) ? R(d, k, m(i, k)) : Q(k, m(d, k));
957
+ for (const C of Array.from(p))
958
+ m(r.dirtyFields, C) ? R(d, C, m(i, C)) : Q(C, m(d, C));
959
959
  } else {
960
960
  if (ze && T(a))
961
- for (const A of c.mount) {
962
- const k = m(s, A);
963
- if (k && k._f) {
964
- const O = Array.isArray(k._f.refs) ? k._f.refs[0] : k._f.ref;
961
+ for (const p of c.mount) {
962
+ const C = m(s, p);
963
+ if (C && C._f) {
964
+ const O = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
965
965
  if (Ae(O)) {
966
966
  const J = O.closest("form");
967
967
  if (J) {
@@ -972,14 +972,14 @@ function _t(e = {}) {
972
972
  }
973
973
  }
974
974
  if (n.keepFieldsRef)
975
- for (const A of c.mount)
976
- Q(A, m(d, A));
975
+ for (const p of c.mount)
976
+ Q(p, m(d, p));
977
977
  else
978
978
  s = {};
979
979
  }
980
- i = t.shouldUnregister ? n.keepDefaultValues ? U(u) : {} : U(d), b.array.next({
980
+ i = t.shouldUnregister ? n.keepDefaultValues ? U(u) : {} : U(d), A.array.next({
981
981
  values: { ...d }
982
- }), b.state.next({
982
+ }), A.state.next({
983
983
  values: { ...d }
984
984
  });
985
985
  }
@@ -991,7 +991,7 @@ function _t(e = {}) {
991
991
  watch: /* @__PURE__ */ new Set(),
992
992
  watchAll: !1,
993
993
  focus: ""
994
- }, l.mount = !V.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !t.shouldUnregister && !$(d), l.watch = !!t.shouldUnregister, l.action = !1, n.keepErrors || (r.errors = {}), b.state.next({
994
+ }, l.mount = !V.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !t.shouldUnregister && !$(d), l.watch = !!t.shouldUnregister, l.action = !1, n.keepErrors || (r.errors = {}), A.state.next({
995
995
  submitCount: n.keepSubmitCount ? r.submitCount : 0,
996
996
  isDirty: _ ? !1 : n.keepDirty ? r.isDirty : !!(n.keepDefaultValues && !ee(a, u)),
997
997
  isSubmitted: n.keepIsSubmitted ? r.isSubmitted : !1,
@@ -1003,9 +1003,9 @@ function _t(e = {}) {
1003
1003
  defaultValues: u
1004
1004
  });
1005
1005
  }, ir = (a, n) => nr(re(a) ? a(i) : a, n), Pr = (a, n = {}) => {
1006
- const o = m(s, a), h = o && o._f;
1007
- if (h) {
1008
- const _ = h.refs ? h.refs[0] : h.ref;
1006
+ const o = m(s, a), v = o && o._f;
1007
+ if (v) {
1008
+ const _ = v.refs ? v.refs[0] : v.ref;
1009
1009
  _.focus && (_.focus(), n.shouldSelect && re(_.select) && _.select());
1010
1010
  }
1011
1011
  }, Wr = (a) => {
@@ -1015,30 +1015,30 @@ function _t(e = {}) {
1015
1015
  };
1016
1016
  }, ur = {
1017
1017
  control: {
1018
- register: Ce,
1018
+ register: ke,
1019
1019
  unregister: we,
1020
1020
  getFieldState: er,
1021
1021
  handleSubmit: ar,
1022
1022
  setError: rr,
1023
1023
  _subscribe: tr,
1024
1024
  _runSchema: E,
1025
- _focusError: ke,
1025
+ _focusError: Ce,
1026
1026
  _getWatch: w,
1027
1027
  _getDirty: te,
1028
- _setValid: C,
1028
+ _setValid: k,
1029
1029
  _setFieldArray: j,
1030
1030
  _setDisabledField: sr,
1031
1031
  _setErrors: P,
1032
1032
  _getFieldArray: D,
1033
1033
  _reset: nr,
1034
1034
  _resetDefaultValues: () => re(t.defaultValues) && t.defaultValues().then((a) => {
1035
- ir(a, t.resetOptions), b.state.next({
1035
+ ir(a, t.resetOptions), A.state.next({
1036
1036
  isLoading: !1
1037
1037
  });
1038
1038
  }),
1039
1039
  _removeUnmounted: oe,
1040
1040
  _disableForm: Ir,
1041
- _subjects: b,
1041
+ _subjects: A,
1042
1042
  _proxyFormState: V,
1043
1043
  get _fields() {
1044
1044
  return s;
@@ -1076,7 +1076,7 @@ function _t(e = {}) {
1076
1076
  },
1077
1077
  subscribe: Mr,
1078
1078
  trigger: ce,
1079
- register: Ce,
1079
+ register: ke,
1080
1080
  handleSubmit: ar,
1081
1081
  watch: Lr,
1082
1082
  setValue: Q,
@@ -1118,72 +1118,72 @@ var Me = (e, t, r) => Array.isArray(e) ? (T(e[r]) && (e[r] = void 0), e.splice(r
1118
1118
  ...z(t),
1119
1119
  ...z(e)
1120
1120
  ];
1121
- function gt(e, t) {
1121
+ function ht(e, t) {
1122
1122
  let r = 0;
1123
1123
  const s = [...e];
1124
1124
  for (const u of t)
1125
1125
  s.splice(u - r, 1), r++;
1126
1126
  return Se(s).length ? s : [];
1127
1127
  }
1128
- var Be = (e, t) => T(t) ? [] : gt(e, z(t).sort((r, s) => r - s)), Pe = (e, t, r) => {
1128
+ var Be = (e, t) => T(t) ? [] : ht(e, z(t).sort((r, s) => r - s)), Pe = (e, t, r) => {
1129
1129
  [e[t], e[r]] = [e[r], e[t]];
1130
1130
  }, Vr = (e, t, r) => (e[t] = r, e);
1131
- function ht(e) {
1132
- const t = _e(), { control: r = t.control, name: s, keyName: u = "id", shouldUnregister: i, rules: l } = e, [c, v] = F.useState(r._getFieldArray(s)), p = F.useRef(r._getFieldArray(s).map(ue)), V = F.useRef(!1);
1133
- r._names.array.add(s), F.useMemo(() => l && c.length >= 0 && r.register(s, l), [r, s, c.length, l]), Ee(() => r._subjects.array.subscribe({
1131
+ function vt(e) {
1132
+ const t = _e(), { control: r = t.control, name: s, keyName: u = "id", shouldUnregister: i, rules: l } = e, [c, F] = b.useState(r._getFieldArray(s)), h = b.useRef(r._getFieldArray(s).map(ue)), V = b.useRef(!1);
1133
+ r._names.array.add(s), b.useMemo(() => l && c.length >= 0 && r.register(s, l), [r, s, c.length, l]), Ee(() => r._subjects.array.subscribe({
1134
1134
  next: ({ values: f, name: y }) => {
1135
1135
  if (y === s || !y) {
1136
1136
  const x = m(f, s);
1137
- Array.isArray(x) && (v(x), p.current = x.map(ue));
1137
+ Array.isArray(x) && (F(x), h.current = x.map(ue));
1138
1138
  }
1139
1139
  }
1140
1140
  }).unsubscribe, [r, s]);
1141
- const g = F.useCallback((f) => {
1141
+ const g = b.useCallback((f) => {
1142
1142
  V.current = !0, r._setFieldArray(s, f);
1143
- }, [r, s]), b = (f, y) => {
1143
+ }, [r, s]), A = (f, y) => {
1144
1144
  const x = z(U(f)), E = Ue(r._getFieldArray(s), x);
1145
- r._names.focus = Te(s, E.length - 1, y), p.current = Ue(p.current, x.map(ue)), g(E), v(E), r._setFieldArray(s, E, Ue, {
1145
+ r._names.focus = Te(s, E.length - 1, y), h.current = Ue(h.current, x.map(ue)), g(E), F(E), r._setFieldArray(s, E, Ue, {
1146
1146
  argA: Ne(f)
1147
1147
  });
1148
1148
  }, H = (f, y) => {
1149
1149
  const x = z(U(f)), E = Ie(r._getFieldArray(s), x);
1150
- r._names.focus = Te(s, 0, y), p.current = Ie(p.current, x.map(ue)), g(E), v(E), r._setFieldArray(s, E, Ie, {
1150
+ r._names.focus = Te(s, 0, y), h.current = Ie(h.current, x.map(ue)), g(E), F(E), r._setFieldArray(s, E, Ie, {
1151
1151
  argA: Ne(f)
1152
1152
  });
1153
1153
  }, I = (f) => {
1154
1154
  const y = Be(r._getFieldArray(s), f);
1155
- p.current = Be(p.current, f), g(y), v(y), !Array.isArray(m(r._fields, s)) && R(r._fields, s, void 0), r._setFieldArray(s, y, Be, {
1155
+ h.current = Be(h.current, f), g(y), F(y), !Array.isArray(m(r._fields, s)) && R(r._fields, s, void 0), r._setFieldArray(s, y, Be, {
1156
1156
  argA: f
1157
1157
  });
1158
- }, C = (f, y, x) => {
1158
+ }, k = (f, y, x) => {
1159
1159
  const E = z(U(y)), Z = Le(r._getFieldArray(s), f, E);
1160
- r._names.focus = Te(s, f, x), p.current = Le(p.current, f, E.map(ue)), g(Z), v(Z), r._setFieldArray(s, Z, Le, {
1160
+ r._names.focus = Te(s, f, x), h.current = Le(h.current, f, E.map(ue)), g(Z), F(Z), r._setFieldArray(s, Z, Le, {
1161
1161
  argA: f,
1162
1162
  argB: Ne(y)
1163
1163
  });
1164
1164
  }, B = (f, y) => {
1165
1165
  const x = r._getFieldArray(s);
1166
- Pe(x, f, y), Pe(p.current, f, y), g(x), v(x), r._setFieldArray(s, x, Pe, {
1166
+ Pe(x, f, y), Pe(h.current, f, y), g(x), F(x), r._setFieldArray(s, x, Pe, {
1167
1167
  argA: f,
1168
1168
  argB: y
1169
1169
  }, !1);
1170
1170
  }, j = (f, y) => {
1171
1171
  const x = r._getFieldArray(s);
1172
- Me(x, f, y), Me(p.current, f, y), g(x), v(x), r._setFieldArray(s, x, Me, {
1172
+ Me(x, f, y), Me(h.current, f, y), g(x), F(x), r._setFieldArray(s, x, Me, {
1173
1173
  argA: f,
1174
1174
  argB: y
1175
1175
  }, !1);
1176
1176
  }, S = (f, y) => {
1177
1177
  const x = U(y), E = Vr(r._getFieldArray(s), f, x);
1178
- p.current = [...E].map((Z, W) => !Z || W === f ? ue() : p.current[W]), g(E), v([...E]), r._setFieldArray(s, E, Vr, {
1178
+ h.current = [...E].map((Z, W) => !Z || W === f ? ue() : h.current[W]), g(E), F([...E]), r._setFieldArray(s, E, Vr, {
1179
1179
  argA: f,
1180
1180
  argB: x
1181
1181
  }, !0, !1);
1182
1182
  }, P = (f) => {
1183
1183
  const y = z(U(f));
1184
- p.current = y.map(ue), g([...y]), v([...y]), r._setFieldArray(s, [...y], (x) => x, {}, !0, !1);
1184
+ h.current = y.map(ue), g([...y]), F([...y]), r._setFieldArray(s, [...y], (x) => x, {}, !0, !1);
1185
1185
  };
1186
- return F.useEffect(() => {
1186
+ return b.useEffect(() => {
1187
1187
  if (r._state.action = !1, Qe(s, r._names) && r._subjects.state.next({
1188
1188
  ...r._formState
1189
1189
  }), V.current && (!ye(r._options.mode).isOnSubmit || r._formState.isSubmitted) && !ye(r._options.reValidateMode).isOnSubmit)
@@ -1207,29 +1207,29 @@ function ht(e) {
1207
1207
  if (r._names.focus && y.startsWith(r._names.focus) && f.focus)
1208
1208
  return f.focus(), 1;
1209
1209
  }), r._names.focus = "", r._setValid(), V.current = !1;
1210
- }, [c, s, r]), F.useEffect(() => (!m(r._formValues, s) && r._setFieldArray(s), () => {
1210
+ }, [c, s, r]), b.useEffect(() => (!m(r._formValues, s) && r._setFieldArray(s), () => {
1211
1211
  const f = (y, x) => {
1212
1212
  const E = m(r._fields, y);
1213
1213
  E && E._f && (E._f.mount = x);
1214
1214
  };
1215
1215
  r._options.shouldUnregister || i ? r.unregister(s) : f(s, !1);
1216
1216
  }), [s, r, u, i]), {
1217
- swap: F.useCallback(B, [g, s, r]),
1218
- move: F.useCallback(j, [g, s, r]),
1219
- prepend: F.useCallback(H, [g, s, r]),
1220
- append: F.useCallback(b, [g, s, r]),
1221
- remove: F.useCallback(I, [g, s, r]),
1222
- insert: F.useCallback(C, [g, s, r]),
1223
- update: F.useCallback(S, [g, s, r]),
1224
- replace: F.useCallback(P, [g, s, r]),
1225
- fields: F.useMemo(() => c.map((f, y) => ({
1217
+ swap: b.useCallback(B, [g, s, r]),
1218
+ move: b.useCallback(j, [g, s, r]),
1219
+ prepend: b.useCallback(H, [g, s, r]),
1220
+ append: b.useCallback(A, [g, s, r]),
1221
+ remove: b.useCallback(I, [g, s, r]),
1222
+ insert: b.useCallback(k, [g, s, r]),
1223
+ update: b.useCallback(S, [g, s, r]),
1224
+ replace: b.useCallback(P, [g, s, r]),
1225
+ fields: b.useMemo(() => c.map((f, y) => ({
1226
1226
  ...f,
1227
- [u]: p.current[y] || ue()
1227
+ [u]: h.current[y] || ue()
1228
1228
  })), [c, u])
1229
1229
  };
1230
1230
  }
1231
- function vt(e = {}) {
1232
- const t = F.useRef(void 0), r = F.useRef(void 0), [s, u] = F.useState({
1231
+ function Vt(e = {}) {
1232
+ const t = b.useRef(void 0), r = b.useRef(void 0), [s, u] = b.useState({
1233
1233
  isDirty: !1,
1234
1234
  isValidating: !1,
1235
1235
  isLoading: re(e.defaultValues),
@@ -1253,7 +1253,7 @@ function vt(e = {}) {
1253
1253
  formState: s
1254
1254
  }, e.defaultValues && !re(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1255
1255
  else {
1256
- const { formControl: l, ...c } = _t(e);
1256
+ const { formControl: l, ...c } = gt(e);
1257
1257
  t.current = {
1258
1258
  ...c,
1259
1259
  formState: s
@@ -1270,37 +1270,37 @@ function vt(e = {}) {
1270
1270
  ...c,
1271
1271
  isReady: !0
1272
1272
  })), i._formState.isReady = !0, l;
1273
- }, [i]), F.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), F.useEffect(() => {
1273
+ }, [i]), b.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), b.useEffect(() => {
1274
1274
  e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode);
1275
- }, [i, e.mode, e.reValidateMode]), F.useEffect(() => {
1275
+ }, [i, e.mode, e.reValidateMode]), b.useEffect(() => {
1276
1276
  e.errors && (i._setErrors(e.errors), i._focusError());
1277
- }, [i, e.errors]), F.useEffect(() => {
1277
+ }, [i, e.errors]), b.useEffect(() => {
1278
1278
  e.shouldUnregister && i._subjects.state.next({
1279
1279
  values: i._getWatch()
1280
1280
  });
1281
- }, [i, e.shouldUnregister]), F.useEffect(() => {
1281
+ }, [i, e.shouldUnregister]), b.useEffect(() => {
1282
1282
  if (i._proxyFormState.isDirty) {
1283
1283
  const l = i._getDirty();
1284
1284
  l !== s.isDirty && i._subjects.state.next({
1285
1285
  isDirty: l
1286
1286
  });
1287
1287
  }
1288
- }, [i, s.isDirty]), F.useEffect(() => {
1288
+ }, [i, s.isDirty]), b.useEffect(() => {
1289
1289
  var l;
1290
1290
  e.values && !ee(e.values, r.current) ? (i._reset(e.values, {
1291
1291
  keepFieldsRef: !0,
1292
1292
  ...i._options.resetOptions
1293
1293
  }), !((l = i._options.resetOptions) === null || l === void 0) && l.keepIsValid || i._setValid(), r.current = e.values, u((c) => ({ ...c }))) : i._resetDefaultValues();
1294
- }, [i, e.values]), F.useEffect(() => {
1294
+ }, [i, e.values]), b.useEffect(() => {
1295
1295
  i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1296
1296
  }), t.current.formState = xr(s, i), t.current;
1297
1297
  }
1298
- const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ */ ne(Tr.Provider, { value: { showAsterisk: e }, children: t }), Ft = () => {
1298
+ const Tr = Qr(void 0), Ft = ({ showAsterisk: e, children: t }) => /* @__PURE__ */ ae(Tr.Provider, { value: { showAsterisk: e }, children: t }), bt = () => {
1299
1299
  const e = Gr(Tr);
1300
1300
  if (!e)
1301
1301
  throw new Error("useSuprFormContext must be used within a SuprFormProvider");
1302
1302
  return e;
1303
- }, bt = ({
1303
+ }, At = ({
1304
1304
  children: e,
1305
1305
  visibility: t
1306
1306
  }) => {
@@ -1308,8 +1308,8 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1308
1308
  return We(() => {
1309
1309
  if (typeof t == "boolean") return t;
1310
1310
  if (!t || (t == null ? void 0 : t.conditions.length) === 0) return !0;
1311
- const { conditions: l, operator: c } = t, v = s.reduce((V, g, b) => (V[g] = u[b], V), {}), p = l.map((V) => {
1312
- const g = v[V.name];
1311
+ const { conditions: l, operator: c } = t, F = s.reduce((V, g, A) => (V[g] = u[A], V), {}), h = l.map((V) => {
1312
+ const g = F[V.name];
1313
1313
  switch (V.operator) {
1314
1314
  case "EQUALS":
1315
1315
  return g === V.value;
@@ -1335,7 +1335,7 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1335
1335
  return !1;
1336
1336
  }
1337
1337
  });
1338
- return c === "AND" ? p.every(Boolean) : p.some(Boolean);
1338
+ return c === "AND" ? h.every(Boolean) : h.some(Boolean);
1339
1339
  }, [t, s, u, r]) ? e : null;
1340
1340
  }, Ur = ({
1341
1341
  children: e,
@@ -1347,9 +1347,10 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1347
1347
  className: u = "",
1348
1348
  formOptions: i,
1349
1349
  showAsterisk: l,
1350
- ref: c
1350
+ ref: c,
1351
+ onChange: F
1351
1352
  }) => {
1352
- const v = vt({
1353
+ const h = Vt({
1353
1354
  mode: "onSubmit",
1354
1355
  reValidateMode: "onChange",
1355
1356
  shouldFocusError: !0,
@@ -1358,23 +1359,29 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1358
1359
  return Fr(
1359
1360
  c,
1360
1361
  () => ({
1361
- setValue: v.setValue,
1362
- setError: v.setError,
1363
- clearErrors: v.clearErrors,
1364
- getValues: v.getValues,
1365
- reset: v.reset,
1366
- setFocus: v.setFocus,
1367
- resetField: v.resetField,
1368
- trigger: v.trigger,
1369
- unregister: v.unregister,
1370
- watch: v.watch
1362
+ setValue: h.setValue,
1363
+ setError: h.setError,
1364
+ clearErrors: h.clearErrors,
1365
+ getValues: h.getValues,
1366
+ reset: h.reset,
1367
+ setFocus: h.setFocus,
1368
+ resetField: h.resetField,
1369
+ trigger: h.trigger,
1370
+ unregister: h.unregister,
1371
+ watch: h.watch,
1372
+ handleSubmit: h.handleSubmit
1371
1373
  }),
1372
- [v]
1373
- ), /* @__PURE__ */ ne(Vt, { showAsterisk: l, children: /* @__PURE__ */ ne(Xr, { ...v, children: /* @__PURE__ */ ne(
1374
+ [h]
1375
+ ), zr(() => {
1376
+ const V = h.watch((g) => {
1377
+ F == null || F(g);
1378
+ });
1379
+ return () => V.unsubscribe();
1380
+ }, [h.watch]), /* @__PURE__ */ ae(Ft, { showAsterisk: l, children: /* @__PURE__ */ ae(Zr, { ...h, children: /* @__PURE__ */ ae(
1374
1381
  "form",
1375
1382
  {
1376
1383
  noValidate: !0,
1377
- onSubmit: v.handleSubmit(t, r),
1384
+ onSubmit: h.handleSubmit(t, r),
1378
1385
  style: s,
1379
1386
  className: u,
1380
1387
  children: e
@@ -1384,17 +1391,17 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1384
1391
  children: e,
1385
1392
  name: t,
1386
1393
  rules: r,
1387
- className: s,
1394
+ className: s = "",
1388
1395
  label: u,
1389
1396
  id: i,
1390
1397
  disabled: l,
1391
1398
  shouldUnregister: c,
1392
- visibility: v
1399
+ visibility: F
1393
1400
  }) => {
1394
- const { control: p } = _e(), V = e.props.value, { showAsterisk: g } = Ft(), b = e.props.onChange, H = e.props.onBlur, I = We(() => i || crypto.randomUUID(), []), C = /* @__PURE__ */ ne(
1395
- rt,
1401
+ const { control: h } = _e(), V = e.props.value ?? "", { showAsterisk: g } = bt(), A = e.props.onChange, H = e.props.onBlur, I = We(() => i || crypto.randomUUID(), []), k = /* @__PURE__ */ ae(
1402
+ tt,
1396
1403
  {
1397
- control: p,
1404
+ control: h,
1398
1405
  name: t,
1399
1406
  rules: r,
1400
1407
  defaultValue: V,
@@ -1408,7 +1415,7 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1408
1415
  children: [
1409
1416
  u && /* @__PURE__ */ cr("label", { htmlFor: I, className: "controlled-field-label", children: [
1410
1417
  u,
1411
- g && !!r && /* @__PURE__ */ ne("span", { style: { color: "red" }, children: " *" })
1418
+ g && !!r && /* @__PURE__ */ ae("span", { style: { color: "red" }, children: " *" })
1412
1419
  ] }),
1413
1420
  He(e, {
1414
1421
  ...e.props,
@@ -1416,7 +1423,7 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1416
1423
  name: B,
1417
1424
  disabled: l,
1418
1425
  onChange: (...x) => {
1419
- P(...x), b == null || b(...x);
1426
+ P(...x), A == null || A(...x);
1420
1427
  },
1421
1428
  value: S,
1422
1429
  onBlur: (...x) => {
@@ -1424,43 +1431,52 @@ const Tr = Qr(void 0), Vt = ({ showAsterisk: e, children: t }) => /* @__PURE__ *
1424
1431
  },
1425
1432
  ref: f
1426
1433
  }),
1427
- y && /* @__PURE__ */ ne("div", { style: { color: "red", fontSize: 13 }, className: "controlled-field-error", children: y.message })
1434
+ y && /* @__PURE__ */ ae("div", { style: { color: "red", fontSize: 13 }, className: "controlled-field-error", children: y.message })
1428
1435
  ]
1429
1436
  }
1430
1437
  )
1431
1438
  }
1432
1439
  );
1433
- return v ? /* @__PURE__ */ ne(bt, { visibility: v, children: C }) : C;
1434
- }, At = ({ name: e, rules: t, ref: r, children: s }) => {
1435
- const u = ht({
1440
+ return F ? /* @__PURE__ */ ae(At, { visibility: F, children: k }) : k;
1441
+ }, pt = ({ name: e, rules: t, ref: r, children: s }) => {
1442
+ const u = vt({
1436
1443
  name: e,
1437
1444
  rules: t
1438
1445
  });
1439
1446
  Fr(r, () => u, [u]);
1440
- const i = (l, c) => zr.map(l, (v) => {
1441
- if (!Kr(v))
1442
- return v;
1443
- const p = v.props, V = v.type;
1444
- if (((V == null ? void 0 : V.displayName) === "SuprFormControl" || V === Ze || p.name !== void 0 && typeof V != "string") && p.name !== void 0) {
1445
- const b = {
1446
- ...p,
1447
- name: `${c}${p.name}`
1447
+ const i = (l, c) => Kr.map(l, (F) => {
1448
+ if (!Yr(F))
1449
+ return F;
1450
+ const h = F.props, V = F.type;
1451
+ if (((V == null ? void 0 : V.displayName) === "SuprFormControl" || V === Ze || h.name !== void 0 && typeof V != "string") && h.name !== void 0) {
1452
+ const A = {
1453
+ ...h,
1454
+ name: `${c}${h.name}`
1448
1455
  };
1449
- return p.id !== void 0 && (b.id = `${c}${p.id}`), He(v, b);
1456
+ return h.id !== void 0 && (A.id = `${c}${h.id}`), He(F, A);
1450
1457
  }
1451
- return p.children ? He(v, {
1452
- ...p,
1453
- children: i(p.children, c)
1454
- }) : v;
1458
+ return h.children ? He(F, {
1459
+ ...h,
1460
+ children: i(h.children, c)
1461
+ }) : F;
1455
1462
  });
1456
- return /* @__PURE__ */ ne(jr, { children: u.fields.map((l, c) => {
1457
- const v = `${e}.${c}.`;
1458
- return i(s, v);
1463
+ return /* @__PURE__ */ ae(jr, { children: u.fields.map((l, c) => {
1464
+ const F = `${e}.${c}.`;
1465
+ return /* @__PURE__ */ ae(
1466
+ "div",
1467
+ {
1468
+ "data-index": c,
1469
+ style: { display: "contents" },
1470
+ id: "field-array-item",
1471
+ children: i(s, F)
1472
+ },
1473
+ F
1474
+ );
1459
1475
  }) });
1460
1476
  };
1461
1477
  Ze.displayName = "SuprFormControl";
1462
1478
  Ur.Control = Ze;
1463
- Ur.ControlArray = At;
1479
+ Ur.ControlArray = pt;
1464
1480
  export {
1465
1481
  Ur as SuprForm
1466
1482
  };