suprform 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import { jsx as te, jsxs as Ne, Fragment as Qt } from "react/jsx-runtime";
2
- import F, { createContext as zt, useContext as Jt, useMemo as ye, cloneElement as Ae, useImperativeHandle as At, Children as Kt, isValidElement as Yt, useEffect as Xt } from "react";
3
- var ve = (t) => t.type === "checkbox", oe = (t) => t instanceof Date, Q = (t) => t == null;
2
+ import V, { createContext as zt, useContext as Jt, useMemo as me, cloneElement as Ae, useImperativeHandle as At, Children as Kt, isValidElement as Yt, useEffect as Xt } from "react";
3
+ var Ve = (t) => t.type === "checkbox", le = (t) => t instanceof Date, J = (t) => t == null;
4
4
  const pt = (t) => typeof t == "object";
5
- var H = (t) => !Q(t) && !Array.isArray(t) && pt(t) && !oe(t), xt = (t) => H(t) && t.target ? ve(t.target) ? t.target.checked : t.target.value : t, Zt = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, St = (t, r) => t.has(Zt(r)), er = (t) => {
5
+ var W = (t) => !J(t) && !Array.isArray(t) && pt(t) && !le(t), xt = (t) => W(t) && t.target ? Ve(t.target) ? t.target.checked : t.target.value : t, Zt = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, St = (t, r) => t.has(Zt(r)), er = (t) => {
6
6
  const r = t.constructor && t.constructor.prototype;
7
- return H(r) && r.hasOwnProperty("isPrototypeOf");
7
+ return W(r) && r.hasOwnProperty("isPrototypeOf");
8
8
  }, Je = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
9
9
  function M(t) {
10
10
  if (t instanceof Date)
@@ -13,27 +13,27 @@ function M(t) {
13
13
  if (Je && (t instanceof Blob || r))
14
14
  return t;
15
15
  const e = Array.isArray(t);
16
- if (!e && !(H(t) && er(t)))
16
+ if (!e && !(W(t) && er(t)))
17
17
  return t;
18
18
  const s = e ? [] : Object.create(Object.getPrototypeOf(t));
19
- for (const u in t)
20
- Object.prototype.hasOwnProperty.call(t, u) && (s[u] = M(t[u]));
19
+ for (const o in t)
20
+ Object.prototype.hasOwnProperty.call(t, o) && (s[o] = M(t[o]));
21
21
  return s;
22
22
  }
23
- var Ee = (t) => /^\w*$/.test(t), L = (t) => t === void 0, we = (t) => Array.isArray(t) ? t.filter(Boolean) : [], Ke = (t) => we(t.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (t, r, e) => {
24
- if (!r || !H(t))
23
+ var Ee = (t) => /^\w*$/.test(t), U = (t) => t === void 0, we = (t) => Array.isArray(t) ? t.filter(Boolean) : [], Ke = (t) => we(t.replace(/["|']|\]/g, "").split(/\.|\[/)), m = (t, r, e) => {
24
+ if (!r || !W(t))
25
25
  return e;
26
- const s = (Ee(r) ? [r] : Ke(r)).reduce((u, i) => Q(u) ? u : u[i], t);
27
- return L(s) || s === t ? L(t[r]) ? e : t[r] : s;
28
- }, Y = (t) => typeof t == "boolean", G = (t) => typeof t == "function", T = (t, r, e) => {
26
+ const s = (Ee(r) ? [r] : Ke(r)).reduce((o, i) => J(o) ? o : o[i], t);
27
+ return U(s) || s === t ? U(t[r]) ? e : t[r] : s;
28
+ }, X = (t) => typeof t == "boolean", z = (t) => typeof t == "function", T = (t, r, e) => {
29
29
  let s = -1;
30
- const u = Ee(r) ? [r] : Ke(r), i = u.length, c = i - 1;
30
+ const o = Ee(r) ? [r] : Ke(r), i = o.length, c = i - 1;
31
31
  for (; ++s < i; ) {
32
- const l = u[s];
32
+ const l = o[s];
33
33
  let v = e;
34
34
  if (s !== c) {
35
- const V = t[l];
36
- v = H(V) || Array.isArray(V) ? V : isNaN(+u[s + 1]) ? {} : [];
35
+ const b = t[l];
36
+ v = W(b) || Array.isArray(b) ? b : isNaN(+o[s + 1]) ? {} : [];
37
37
  }
38
38
  if (l === "__proto__" || l === "constructor" || l === "prototype")
39
39
  return;
@@ -50,7 +50,7 @@ const pe = {
50
50
  onSubmit: "onSubmit",
51
51
  onTouched: "onTouched",
52
52
  all: "all"
53
- }, ne = {
53
+ }, ie = {
54
54
  max: "max",
55
55
  min: "min",
56
56
  maxLength: "maxLength",
@@ -58,28 +58,28 @@ const pe = {
58
58
  pattern: "pattern",
59
59
  required: "required",
60
60
  validate: "validate"
61
- }, Ye = F.createContext(null);
61
+ }, Ye = V.createContext(null);
62
62
  Ye.displayName = "HookFormContext";
63
- const Ve = () => F.useContext(Ye), tr = (t) => {
63
+ const Fe = () => V.useContext(Ye), tr = (t) => {
64
64
  const { children: r, ...e } = t;
65
- return F.createElement(Ye.Provider, { value: e }, r);
65
+ return V.createElement(Ye.Provider, { value: e }, r);
66
66
  };
67
67
  var Et = (t, r, e, s = !0) => {
68
- const u = {
68
+ const o = {
69
69
  defaultValues: r._defaultValues
70
70
  };
71
71
  for (const i in t)
72
- Object.defineProperty(u, i, {
72
+ Object.defineProperty(o, i, {
73
73
  get: () => {
74
74
  const c = i;
75
75
  return r._proxyFormState[c] !== re.all && (r._proxyFormState[c] = !s || re.all), e && (e[c] = !0), t[c];
76
76
  }
77
77
  });
78
- return u;
78
+ return o;
79
79
  };
80
- const ke = typeof window < "u" ? F.useLayoutEffect : F.useEffect;
80
+ const Ce = typeof window < "u" ? V.useLayoutEffect : V.useEffect;
81
81
  function rr(t) {
82
- const r = Ve(), { control: e = r.control, disabled: s, name: u, exact: i } = t || {}, [c, l] = F.useState(e._formState), v = F.useRef({
82
+ const r = Fe(), { control: e = r.control, disabled: s, name: o, exact: i } = t || {}, [c, l] = V.useState(e._formState), v = V.useRef({
83
83
  isDirty: !1,
84
84
  isLoading: !1,
85
85
  dirtyFields: !1,
@@ -89,64 +89,64 @@ function rr(t) {
89
89
  isValid: !1,
90
90
  errors: !1
91
91
  });
92
- return ke(() => e._subscribe({
93
- name: u,
92
+ return Ce(() => e._subscribe({
93
+ name: o,
94
94
  formState: v.current,
95
95
  exact: i,
96
- callback: (V) => {
96
+ callback: (b) => {
97
97
  !s && l({
98
98
  ...e._formState,
99
- ...V
99
+ ...b
100
100
  });
101
101
  }
102
- }), [u, s, i]), F.useEffect(() => {
102
+ }), [o, s, i]), V.useEffect(() => {
103
103
  v.current.isValid && e._setValid(!0);
104
- }, [e]), F.useMemo(() => Et(c, e, v.current, !1), [c, e]);
104
+ }, [e]), V.useMemo(() => Et(c, e, v.current, !1), [c, e]);
105
105
  }
106
- var X = (t) => typeof t == "string", qe = (t, r, e, s, u) => X(t) ? (s && r.watch.add(t), m(e, t, u)) : Array.isArray(t) ? t.map((i) => (s && r.watch.add(i), m(e, i))) : (s && (r.watchAll = !0), e), je = (t) => Q(t) || !pt(t);
106
+ var Z = (t) => typeof t == "string", qe = (t, r, e, s, o) => Z(t) ? (s && r.watch.add(t), m(e, t, o)) : Array.isArray(t) ? t.map((i) => (s && r.watch.add(i), m(e, i))) : (s && (r.watchAll = !0), e), je = (t) => J(t) || !pt(t);
107
107
  function ae(t, r, e = /* @__PURE__ */ new WeakSet()) {
108
108
  if (je(t) || je(r))
109
109
  return Object.is(t, r);
110
- if (oe(t) && oe(r))
110
+ if (le(t) && le(r))
111
111
  return t.getTime() === r.getTime();
112
- const s = Object.keys(t), u = Object.keys(r);
113
- if (s.length !== u.length)
112
+ const s = Object.keys(t), o = Object.keys(r);
113
+ if (s.length !== o.length)
114
114
  return !1;
115
115
  if (e.has(t) || e.has(r))
116
116
  return !0;
117
117
  e.add(t), e.add(r);
118
118
  for (const i of s) {
119
119
  const c = t[i];
120
- if (!u.includes(i))
120
+ if (!o.includes(i))
121
121
  return !1;
122
122
  if (i !== "ref") {
123
123
  const l = r[i];
124
- if (oe(c) && oe(l) || H(c) && H(l) || Array.isArray(c) && Array.isArray(l) ? !ae(c, l, e) : !Object.is(c, l))
124
+ if (le(c) && le(l) || W(c) && W(l) || Array.isArray(c) && Array.isArray(l) ? !ae(c, l, e) : !Object.is(c, l))
125
125
  return !1;
126
126
  }
127
127
  }
128
128
  return !0;
129
129
  }
130
130
  function Xe(t) {
131
- const r = Ve(), { control: e = r.control, name: s, defaultValue: u, disabled: i, exact: c, compute: l } = t || {}, v = F.useRef(u), V = F.useRef(l), C = F.useRef(void 0), g = F.useRef(e), S = F.useRef(s);
132
- V.current = l;
133
- const [p, I] = F.useState(() => {
131
+ const r = Fe(), { control: e = r.control, name: s, defaultValue: o, disabled: i, exact: c, compute: l } = t || {}, v = V.useRef(o), b = V.useRef(l), w = V.useRef(void 0), g = V.useRef(e), S = V.useRef(s);
132
+ b.current = l;
133
+ const [p, I] = V.useState(() => {
134
134
  const f = e._getWatch(s, v.current);
135
- return V.current ? V.current(f) : f;
136
- }), R = F.useCallback((f) => {
135
+ return b.current ? b.current(f) : f;
136
+ }), R = V.useCallback((f) => {
137
137
  const d = qe(s, e._names, f || e._formValues, !1, v.current);
138
- return V.current ? V.current(d) : d;
139
- }, [e._formValues, e._names, s]), O = F.useCallback((f) => {
138
+ return b.current ? b.current(d) : d;
139
+ }, [e._formValues, e._names, s]), O = V.useCallback((f) => {
140
140
  if (!i) {
141
141
  const d = qe(s, e._names, f || e._formValues, !1, v.current);
142
- if (V.current) {
143
- const A = V.current(d);
144
- ae(A, C.current) || (I(A), C.current = A);
142
+ if (b.current) {
143
+ const A = b.current(d);
144
+ ae(A, w.current) || (I(A), w.current = A);
145
145
  } else
146
146
  I(d);
147
147
  }
148
148
  }, [e._formValues, e._names, i, s]);
149
- ke(() => ((g.current !== e || !ae(S.current, s)) && (g.current = e, S.current = s, O()), e._subscribe({
149
+ Ce(() => ((g.current !== e || !ae(S.current, s)) && (g.current = e, S.current = s, O()), e._subscribe({
150
150
  name: s,
151
151
  formState: {
152
152
  values: !0
@@ -155,32 +155,32 @@ function Xe(t) {
155
155
  callback: (f) => {
156
156
  O(f.values);
157
157
  }
158
- })), [e, c, s, O]), F.useEffect(() => e._removeUnmounted());
159
- const U = g.current !== e, x = S.current, B = F.useMemo(() => {
158
+ })), [e, c, s, O]), V.useEffect(() => e._removeUnmounted());
159
+ const N = g.current !== e, x = S.current, B = V.useMemo(() => {
160
160
  if (i)
161
161
  return null;
162
- const f = !U && !ae(x, s);
163
- return U || f ? R() : null;
164
- }, [i, U, s, x, R]);
162
+ const f = !N && !ae(x, s);
163
+ return N || f ? R() : null;
164
+ }, [i, N, s, x, R]);
165
165
  return B !== null ? B : p;
166
166
  }
167
167
  function sr(t) {
168
- const r = Ve(), { name: e, disabled: s, control: u = r.control, shouldUnregister: i, defaultValue: c, exact: l = !0 } = t, v = St(u._names.array, e), V = F.useMemo(() => m(u._formValues, e, m(u._defaultValues, e, c)), [u, e, c]), C = Xe({
169
- control: u,
168
+ const r = Fe(), { name: e, disabled: s, control: o = r.control, shouldUnregister: i, defaultValue: c, exact: l = !0 } = t, v = St(o._names.array, e), b = V.useMemo(() => m(o._formValues, e, m(o._defaultValues, e, c)), [o, e, c]), w = Xe({
169
+ control: o,
170
170
  name: e,
171
- defaultValue: V,
171
+ defaultValue: b,
172
172
  exact: l
173
173
  }), g = rr({
174
- control: u,
174
+ control: o,
175
175
  name: e,
176
176
  exact: l
177
- }), S = F.useRef(t), p = F.useRef(void 0), I = F.useRef(u.register(e, {
177
+ }), S = V.useRef(t), p = V.useRef(void 0), I = V.useRef(o.register(e, {
178
178
  ...t.rules,
179
- value: C,
180
- ...Y(t.disabled) ? { disabled: t.disabled } : {}
179
+ value: w,
180
+ ...X(t.disabled) ? { disabled: t.disabled } : {}
181
181
  }));
182
182
  S.current = t;
183
- const R = F.useMemo(() => Object.defineProperties({}, {
183
+ const R = V.useMemo(() => Object.defineProperties({}, {
184
184
  invalid: {
185
185
  enumerable: !0,
186
186
  get: () => !!m(g.errors, e)
@@ -201,82 +201,82 @@ function sr(t) {
201
201
  enumerable: !0,
202
202
  get: () => m(g.errors, e)
203
203
  }
204
- }), [g, e]), O = F.useCallback((f) => I.current.onChange({
204
+ }), [g, e]), O = V.useCallback((f) => I.current.onChange({
205
205
  target: {
206
206
  value: xt(f),
207
207
  name: e
208
208
  },
209
209
  type: pe.CHANGE
210
- }), [e]), U = F.useCallback(() => I.current.onBlur({
210
+ }), [e]), N = V.useCallback(() => I.current.onBlur({
211
211
  target: {
212
- value: m(u._formValues, e),
212
+ value: m(o._formValues, e),
213
213
  name: e
214
214
  },
215
215
  type: pe.BLUR
216
- }), [e, u._formValues]), x = F.useCallback((f) => {
217
- const d = m(u._fields, e);
216
+ }), [e, o._formValues]), x = V.useCallback((f) => {
217
+ const d = m(o._fields, e);
218
218
  d && d._f && f && (d._f.ref = {
219
- focus: () => G(f.focus) && f.focus(),
220
- select: () => G(f.select) && f.select(),
221
- setCustomValidity: (A) => G(f.setCustomValidity) && f.setCustomValidity(A),
222
- reportValidity: () => G(f.reportValidity) && f.reportValidity()
219
+ focus: () => z(f.focus) && f.focus(),
220
+ select: () => z(f.select) && f.select(),
221
+ setCustomValidity: (A) => z(f.setCustomValidity) && f.setCustomValidity(A),
222
+ reportValidity: () => z(f.reportValidity) && f.reportValidity()
223
223
  });
224
- }, [u._fields, e]), B = F.useMemo(() => ({
224
+ }, [o._fields, e]), B = V.useMemo(() => ({
225
225
  name: e,
226
- value: C,
227
- ...Y(s) || g.disabled ? { disabled: g.disabled || s } : {},
226
+ value: w,
227
+ ...X(s) || g.disabled ? { disabled: g.disabled || s } : {},
228
228
  onChange: O,
229
- onBlur: U,
229
+ onBlur: N,
230
230
  ref: x
231
- }), [e, s, g.disabled, O, U, x, C]);
232
- return F.useEffect(() => {
233
- const f = u._options.shouldUnregister || i, d = p.current;
234
- d && d !== e && !v && u.unregister(d), u.register(e, {
231
+ }), [e, s, g.disabled, O, N, x, w]);
232
+ return V.useEffect(() => {
233
+ const f = o._options.shouldUnregister || i, d = p.current;
234
+ d && d !== e && !v && o.unregister(d), o.register(e, {
235
235
  ...S.current.rules,
236
- ...Y(S.current.disabled) ? { disabled: S.current.disabled } : {}
236
+ ...X(S.current.disabled) ? { disabled: S.current.disabled } : {}
237
237
  });
238
- const A = (w, W) => {
239
- const J = m(u._fields, w);
240
- J && J._f && (J._f.mount = W);
238
+ const A = (C, $) => {
239
+ const q = m(o._fields, C);
240
+ q && q._f && (q._f.mount = $);
241
241
  };
242
242
  if (A(e, !0), f) {
243
- const w = M(m(u._options.defaultValues, e, S.current.defaultValue));
244
- T(u._defaultValues, e, w), L(m(u._formValues, e)) && T(u._formValues, e, w);
243
+ const C = M(m(o._options.defaultValues, e, S.current.defaultValue));
244
+ T(o._defaultValues, e, C), U(m(o._formValues, e)) && T(o._formValues, e, C);
245
245
  }
246
- return !v && u.register(e), p.current = e, () => {
247
- (v ? f && !u._state.action : f) ? u.unregister(e) : A(e, !1);
246
+ return !v && o.register(e), p.current = e, () => {
247
+ (v ? f && !o._state.action : f) ? o.unregister(e) : A(e, !1);
248
248
  };
249
- }, [e, u, v, i]), F.useEffect(() => {
250
- u._setDisabledField({
249
+ }, [e, o, v, i]), V.useEffect(() => {
250
+ o._setDisabledField({
251
251
  disabled: s,
252
252
  name: e
253
253
  });
254
- }, [s, e, u]), F.useMemo(() => ({
254
+ }, [s, e, o]), V.useMemo(() => ({
255
255
  field: B,
256
256
  formState: g,
257
257
  fieldState: R
258
258
  }), [B, g, R]);
259
259
  }
260
260
  const ar = (t) => t.render(sr(t));
261
- var nr = (t, r, e, s, u) => r ? {
261
+ var nr = (t, r, e, s, o) => r ? {
262
262
  ...e[t],
263
263
  types: {
264
264
  ...e[t] && e[t].types ? e[t].types : {},
265
- [s]: u || !0
265
+ [s]: o || !0
266
266
  }
267
- } : {}, z = (t) => Array.isArray(t) ? t : [t], yt = () => {
267
+ } : {}, K = (t) => Array.isArray(t) ? t : [t], yt = () => {
268
268
  let t = [];
269
269
  return {
270
270
  get observers() {
271
271
  return t;
272
272
  },
273
- next: (u) => {
273
+ next: (o) => {
274
274
  for (const i of t)
275
- i.next && i.next(u);
275
+ i.next && i.next(o);
276
276
  },
277
- subscribe: (u) => (t.push(u), {
277
+ subscribe: (o) => (t.push(o), {
278
278
  unsubscribe: () => {
279
- t = t.filter((i) => i !== u);
279
+ t = t.filter((i) => i !== o);
280
280
  }
281
281
  }),
282
282
  unsubscribe: () => {
@@ -288,62 +288,62 @@ function wt(t, r) {
288
288
  const e = {};
289
289
  for (const s in t)
290
290
  if (t.hasOwnProperty(s)) {
291
- const u = t[s], i = r[s];
292
- if (u && H(u) && i) {
293
- const c = wt(u, i);
294
- H(c) && (e[s] = c);
291
+ const o = t[s], i = r[s];
292
+ if (o && W(o) && i) {
293
+ const c = wt(o, i);
294
+ W(c) && (e[s] = c);
295
295
  } else t[s] && (e[s] = i);
296
296
  }
297
297
  return e;
298
298
  }
299
- var j = (t) => H(t) && !Object.keys(t).length, Ze = (t) => t.type === "file", xe = (t) => {
299
+ var Q = (t) => W(t) && !Object.keys(t).length, Ze = (t) => t.type === "file", xe = (t) => {
300
300
  if (!Je)
301
301
  return !1;
302
302
  const r = t ? t.ownerDocument : 0;
303
303
  return t instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
304
- }, kt = (t) => t.type === "select-multiple", et = (t) => t.type === "radio", ir = (t) => et(t) || ve(t), Le = (t) => xe(t) && t.isConnected;
305
- function ur(t, r) {
304
+ }, Ct = (t) => t.type === "select-multiple", et = (t) => t.type === "radio", ir = (t) => et(t) || Ve(t), Le = (t) => xe(t) && t.isConnected;
305
+ function or(t, r) {
306
306
  const e = r.slice(0, -1).length;
307
307
  let s = 0;
308
308
  for (; s < e; )
309
- t = L(t) ? s++ : t[r[s++]];
309
+ t = U(t) ? s++ : t[r[s++]];
310
310
  return t;
311
311
  }
312
- function or(t) {
312
+ function ur(t) {
313
313
  for (const r in t)
314
- if (t.hasOwnProperty(r) && !L(t[r]))
314
+ if (t.hasOwnProperty(r) && !U(t[r]))
315
315
  return !1;
316
316
  return !0;
317
317
  }
318
318
  function P(t, r) {
319
- const e = Array.isArray(r) ? r : Ee(r) ? [r] : Ke(r), s = e.length === 1 ? t : ur(t, e), u = e.length - 1, i = e[u];
320
- return s && delete s[i], u !== 0 && (H(s) && j(s) || Array.isArray(s) && or(s)) && P(t, e.slice(0, -1)), t;
319
+ const e = Array.isArray(r) ? r : Ee(r) ? [r] : Ke(r), s = e.length === 1 ? t : or(t, e), o = e.length - 1, i = e[o];
320
+ return s && delete s[i], o !== 0 && (W(s) && Q(s) || Array.isArray(s) && ur(s)) && P(t, e.slice(0, -1)), t;
321
321
  }
322
322
  var lr = (t) => {
323
323
  for (const r in t)
324
- if (G(t[r]))
324
+ if (z(t[r]))
325
325
  return !0;
326
326
  return !1;
327
327
  };
328
- function Ct(t) {
329
- return Array.isArray(t) || H(t) && !lr(t);
328
+ function kt(t) {
329
+ return Array.isArray(t) || W(t) && !lr(t);
330
330
  }
331
331
  function Ge(t, r = {}) {
332
332
  for (const e in t) {
333
333
  const s = t[e];
334
- Ct(s) ? (r[e] = Array.isArray(s) ? [] : {}, Ge(s, r[e])) : L(s) || (r[e] = !0);
334
+ kt(s) ? (r[e] = Array.isArray(s) ? [] : {}, Ge(s, r[e])) : U(s) || (r[e] = !0);
335
335
  }
336
336
  return r;
337
337
  }
338
- function ce(t, r, e) {
338
+ function de(t, r, e) {
339
339
  e || (e = Ge(r));
340
340
  for (const s in t) {
341
- const u = t[s];
342
- if (Ct(u))
343
- L(r) || je(e[s]) ? e[s] = Ge(u, Array.isArray(u) ? [] : {}) : ce(u, Q(r) ? {} : r[s], e[s]);
341
+ const o = t[s];
342
+ if (kt(o))
343
+ U(r) || je(e[s]) ? e[s] = Ge(o, Array.isArray(o) ? [] : {}) : de(o, J(r) ? {} : r[s], e[s]);
344
344
  else {
345
345
  const i = r[s];
346
- e[s] = !ae(u, i);
346
+ e[s] = !ae(o, i);
347
347
  }
348
348
  }
349
349
  return e;
@@ -360,11 +360,11 @@ var Dt = (t) => {
360
360
  }
361
361
  return t[0].checked && !t[0].disabled ? (
362
362
  // @ts-expect-error expected to work in the browser
363
- t[0].attributes && !L(t[0].attributes.value) ? L(t[0].value) || t[0].value === "" ? _t : { value: t[0].value, isValid: !0 } : _t
363
+ t[0].attributes && !U(t[0].attributes.value) ? U(t[0].value) || t[0].value === "" ? _t : { value: t[0].value, isValid: !0 } : _t
364
364
  ) : mt;
365
365
  }
366
366
  return mt;
367
- }, Ot = (t, { valueAsNumber: r, valueAsDate: e, setValueAs: s }) => L(t) ? t : r ? t === "" ? NaN : t && +t : e && X(t) ? new Date(t) : s ? s(t) : t;
367
+ }, Ot = (t, { valueAsNumber: r, valueAsDate: e, setValueAs: s }) => U(t) ? t : r ? t === "" ? NaN : t && +t : e && Z(t) ? new Date(t) : s ? s(t) : t;
368
368
  const gt = {
369
369
  isValid: !1,
370
370
  value: null
@@ -375,21 +375,21 @@ var Tt = (t) => Array.isArray(t) ? t.reduce((r, e) => e && e.checked && !e.disab
375
375
  } : r, gt) : gt;
376
376
  function ht(t) {
377
377
  const r = t.ref;
378
- return Ze(r) ? r.files : et(r) ? Tt(t.refs).value : kt(r) ? [...r.selectedOptions].map(({ value: e }) => e) : ve(r) ? Dt(t.refs).value : Ot(L(r.value) ? t.ref.value : r.value, t);
378
+ return Ze(r) ? r.files : et(r) ? Tt(t.refs).value : Ct(r) ? [...r.selectedOptions].map(({ value: e }) => e) : Ve(r) ? Dt(t.refs).value : Ot(U(r.value) ? t.ref.value : r.value, t);
379
379
  }
380
380
  var cr = (t, r, e, s) => {
381
- const u = {};
381
+ const o = {};
382
382
  for (const i of t) {
383
383
  const c = m(r, i);
384
- c && T(u, i, c._f);
384
+ c && T(o, i, c._f);
385
385
  }
386
386
  return {
387
387
  criteriaMode: e,
388
388
  names: [...t],
389
- fields: u,
389
+ fields: o,
390
390
  shouldUseNativeValidation: s
391
391
  };
392
- }, Se = (t) => t instanceof RegExp, he = (t) => L(t) ? t : Se(t) ? t.source : H(t) ? Se(t.value) ? t.value.source : t.value : t, de = (t) => ({
392
+ }, Se = (t) => t instanceof RegExp, ve = (t) => U(t) ? t : Se(t) ? t.source : W(t) ? Se(t.value) ? t.value.source : t.value : t, fe = (t) => ({
393
393
  isOnSubmit: !t || t === re.onSubmit,
394
394
  isOnBlur: t === re.onBlur,
395
395
  isOnChange: t === re.onChange,
@@ -397,20 +397,20 @@ var cr = (t, r, e, s) => {
397
397
  isOnTouch: t === re.onTouched
398
398
  });
399
399
  const vt = "AsyncFunction";
400
- var dr = (t) => !!t && !!t.validate && !!(G(t.validate) && t.validate.constructor.name === vt || H(t.validate) && Object.values(t.validate).find((r) => r.constructor.name === vt)), fr = (t) => t.mount && (t.required || t.min || t.max || t.maxLength || t.minLength || t.pattern || t.validate), Qe = (t, r, e) => !e && (r.watchAll || r.watch.has(t) || [...r.watch].some((s) => t.startsWith(s) && /^\.\w+/.test(t.slice(s.length))));
401
- const fe = (t, r, e, s) => {
402
- for (const u of e || Object.keys(t)) {
403
- const i = m(t, u);
400
+ var dr = (t) => !!t && !!t.validate && !!(z(t.validate) && t.validate.constructor.name === vt || W(t.validate) && Object.values(t.validate).find((r) => r.constructor.name === vt)), fr = (t) => t.mount && (t.required || t.min || t.max || t.maxLength || t.minLength || t.pattern || t.validate), Qe = (t, r, e) => !e && (r.watchAll || r.watch.has(t) || [...r.watch].some((s) => t.startsWith(s) && /^\.\w+/.test(t.slice(s.length))));
401
+ const ye = (t, r, e, s) => {
402
+ for (const o of e || Object.keys(t)) {
403
+ const i = m(t, o);
404
404
  if (i) {
405
405
  const { _f: c, ...l } = i;
406
406
  if (c) {
407
- if (c.refs && c.refs[0] && r(c.refs[0], u) && !s)
407
+ if (c.refs && c.refs[0] && r(c.refs[0], o) && !s)
408
408
  return !0;
409
409
  if (c.ref && r(c.ref, c.name) && !s)
410
410
  return !0;
411
- if (fe(l, r))
411
+ if (ye(l, r))
412
412
  break;
413
- } else if (H(l) && fe(l, r))
413
+ } else if (W(l) && ye(l, r))
414
414
  break;
415
415
  }
416
416
  }
@@ -422,9 +422,9 @@ function Vt(t, r, e) {
422
422
  error: s,
423
423
  name: e
424
424
  };
425
- const u = e.split(".");
426
- for (; u.length; ) {
427
- const i = u.join("."), c = m(r, i), l = m(t, i);
425
+ const o = e.split(".");
426
+ for (; o.length; ) {
427
+ const i = o.join("."), c = m(r, i), l = m(t, i);
428
428
  if (c && !Array.isArray(c) && e !== i)
429
429
  return { name: e };
430
430
  if (l && l.type)
@@ -437,7 +437,7 @@ function Vt(t, r, e) {
437
437
  name: `${i}.root`,
438
438
  error: l.root
439
439
  };
440
- u.pop();
440
+ o.pop();
441
441
  }
442
442
  return {
443
443
  name: e
@@ -445,96 +445,96 @@ function Vt(t, r, e) {
445
445
  }
446
446
  var yr = (t, r, e, s) => {
447
447
  e(t);
448
- const { name: u, ...i } = t;
449
- return j(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((c) => r[c] === (!s || re.all));
450
- }, mr = (t, r, e) => !t || !r || t === r || z(t).some((s) => s && (e ? s === r : s.startsWith(r) || r.startsWith(s))), _r = (t, r, e, s, u) => u.isOnAll ? !1 : !e && u.isOnTouch ? !(r || t) : (e ? s.isOnBlur : u.isOnBlur) ? !t : (e ? s.isOnChange : u.isOnChange) ? t : !0, gr = (t, r) => !we(m(t, r)).length && P(t, r), Rt = (t, r, e) => {
451
- const s = z(m(t, e));
448
+ const { name: o, ...i } = t;
449
+ return Q(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((c) => r[c] === (!s || re.all));
450
+ }, mr = (t, r, e) => !t || !r || t === r || K(t).some((s) => s && (e ? s === r : s.startsWith(r) || r.startsWith(s))), _r = (t, r, e, s, o) => o.isOnAll ? !1 : !e && o.isOnTouch ? !(r || t) : (e ? s.isOnBlur : o.isOnBlur) ? !t : (e ? s.isOnChange : o.isOnChange) ? t : !0, gr = (t, r) => !we(m(t, r)).length && P(t, r), Rt = (t, r, e) => {
451
+ const s = K(m(t, e));
452
452
  return T(s, "root", r[e]), T(t, e, s), t;
453
453
  };
454
454
  function Ft(t, r, e = "validate") {
455
- if (X(t) || Array.isArray(t) && t.every(X) || Y(t) && !t)
455
+ if (Z(t) || Array.isArray(t) && t.every(Z) || X(t) && !t)
456
456
  return {
457
457
  type: e,
458
- message: X(t) ? t : "",
458
+ message: Z(t) ? t : "",
459
459
  ref: r
460
460
  };
461
461
  }
462
- var le = (t) => H(t) && !Se(t) ? t : {
462
+ var ce = (t) => W(t) && !Se(t) ? t : {
463
463
  value: t,
464
464
  message: ""
465
- }, ze = async (t, r, e, s, u, i) => {
466
- const { ref: c, refs: l, required: v, maxLength: V, minLength: C, min: g, max: S, pattern: p, validate: I, name: R, valueAsNumber: O, mount: U } = t._f, x = m(e, R);
467
- if (!U || r.has(R))
465
+ }, ze = async (t, r, e, s, o, i) => {
466
+ const { ref: c, refs: l, required: v, maxLength: b, minLength: w, min: g, max: S, pattern: p, validate: I, name: R, valueAsNumber: O, mount: N } = t._f, x = m(e, R);
467
+ if (!N || r.has(R))
468
468
  return {};
469
469
  const B = l ? l[0] : c, f = (E) => {
470
- u && B.reportValidity && (B.setCustomValidity(Y(E) ? "" : E || ""), B.reportValidity());
471
- }, d = {}, A = et(c), w = ve(c), W = A || w, J = (O || Ze(c)) && L(c.value) && L(x) || xe(c) && c.value === "" || x === "" || Array.isArray(x) && !x.length, Z = nr.bind(null, R, s, d), Fe = (E, k, $, q = ne.maxLength, se = ne.minLength) => {
472
- const K = E ? k : $;
470
+ o && B.reportValidity && (B.setCustomValidity(X(E) ? "" : E || ""), B.reportValidity());
471
+ }, d = {}, A = et(c), C = Ve(c), $ = A || C, q = (O || Ze(c)) && U(c.value) && U(x) || xe(c) && c.value === "" || x === "" || Array.isArray(x) && !x.length, j = nr.bind(null, R, s, d), ne = (E, k, H, G = ie.maxLength, se = ie.minLength) => {
472
+ const Y = E ? k : H;
473
473
  d[R] = {
474
- type: E ? q : se,
475
- message: K,
474
+ type: E ? G : se,
475
+ message: Y,
476
476
  ref: c,
477
- ...Z(E ? q : se, K)
477
+ ...j(E ? G : se, Y)
478
478
  };
479
479
  };
480
- if (i ? !Array.isArray(x) || !x.length : v && (!W && (J || Q(x)) || Y(x) && !x || w && !Dt(l).isValid || A && !Tt(l).isValid)) {
481
- const { value: E, message: k } = X(v) ? { value: !!v, message: v } : le(v);
480
+ if (i ? !Array.isArray(x) || !x.length : v && (!$ && (q || J(x)) || X(x) && !x || C && !Dt(l).isValid || A && !Tt(l).isValid)) {
481
+ const { value: E, message: k } = Z(v) ? { value: !!v, message: v } : ce(v);
482
482
  if (E && (d[R] = {
483
- type: ne.required,
483
+ type: ie.required,
484
484
  message: k,
485
485
  ref: B,
486
- ...Z(ne.required, k)
486
+ ...j(ie.required, k)
487
487
  }, !s))
488
488
  return f(k), d;
489
489
  }
490
- if (!J && (!Q(g) || !Q(S))) {
490
+ if (!q && (!J(g) || !J(S))) {
491
491
  let E, k;
492
- const $ = le(S), q = le(g);
493
- if (!Q(x) && !isNaN(x)) {
492
+ const H = ce(S), G = ce(g);
493
+ if (!J(x) && !isNaN(x)) {
494
494
  const se = c.valueAsNumber || x && +x;
495
- Q($.value) || (E = se > $.value), Q(q.value) || (k = se < q.value);
495
+ J(H.value) || (E = se > H.value), J(G.value) || (k = se < G.value);
496
496
  } else {
497
- const se = c.valueAsDate || new Date(x), K = (ge) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ge), me = c.type == "time", _e = c.type == "week";
498
- X($.value) && x && (E = me ? K(x) > K($.value) : _e ? x > $.value : se > new Date($.value)), X(q.value) && x && (k = me ? K(x) < K(q.value) : _e ? x < q.value : se < new Date(q.value));
497
+ const se = c.valueAsDate || new Date(x), Y = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he), _e = c.type == "time", ge = c.type == "week";
498
+ Z(H.value) && x && (E = _e ? Y(x) > Y(H.value) : ge ? x > H.value : se > new Date(H.value)), Z(G.value) && x && (k = _e ? Y(x) < Y(G.value) : ge ? x < G.value : se < new Date(G.value));
499
499
  }
500
- if ((E || k) && (Fe(!!E, $.message, q.message, ne.max, ne.min), !s))
500
+ if ((E || k) && (ne(!!E, H.message, G.message, ie.max, ie.min), !s))
501
501
  return f(d[R].message), d;
502
502
  }
503
- if ((V || C) && !J && (X(x) || i && Array.isArray(x))) {
504
- const E = le(V), k = le(C), $ = !Q(E.value) && x.length > +E.value, q = !Q(k.value) && x.length < +k.value;
505
- if (($ || q) && (Fe($, E.message, k.message), !s))
503
+ if ((b || w) && !q && (Z(x) || i && Array.isArray(x))) {
504
+ const E = ce(b), k = ce(w), H = !J(E.value) && x.length > +E.value, G = !J(k.value) && x.length < +k.value;
505
+ if ((H || G) && (ne(H, E.message, k.message), !s))
506
506
  return f(d[R].message), d;
507
507
  }
508
- if (p && !J && X(x)) {
509
- const { value: E, message: k } = le(p);
508
+ if (p && !q && Z(x)) {
509
+ const { value: E, message: k } = ce(p);
510
510
  if (Se(E) && !x.match(E) && (d[R] = {
511
- type: ne.pattern,
511
+ type: ie.pattern,
512
512
  message: k,
513
513
  ref: c,
514
- ...Z(ne.pattern, k)
514
+ ...j(ie.pattern, k)
515
515
  }, !s))
516
516
  return f(k), d;
517
517
  }
518
518
  if (I) {
519
- if (G(I)) {
519
+ if (z(I)) {
520
520
  const E = await I(x, e), k = Ft(E, B);
521
521
  if (k && (d[R] = {
522
522
  ...k,
523
- ...Z(ne.validate, k.message)
523
+ ...j(ie.validate, k.message)
524
524
  }, !s))
525
525
  return f(k.message), d;
526
- } else if (H(I)) {
526
+ } else if (W(I)) {
527
527
  let E = {};
528
528
  for (const k in I) {
529
- if (!j(E) && !s)
529
+ if (!Q(E) && !s)
530
530
  break;
531
- const $ = Ft(await I[k](x, e), B, k);
532
- $ && (E = {
533
- ...$,
534
- ...Z(k, $.message)
535
- }, f($.message), s && (d[R] = E));
531
+ const H = Ft(await I[k](x, e), B, k);
532
+ H && (E = {
533
+ ...H,
534
+ ...j(k, H.message)
535
+ }, f(H.message), s && (d[R] = E));
536
536
  }
537
- if (!j(E) && (d[R] = {
537
+ if (!Q(E) && (d[R] = {
538
538
  ref: B,
539
539
  ...E
540
540
  }, !s))
@@ -556,7 +556,7 @@ function vr(t = {}) {
556
556
  submitCount: 0,
557
557
  isDirty: !1,
558
558
  isReady: !1,
559
- isLoading: G(r.defaultValues),
559
+ isLoading: z(r.defaultValues),
560
560
  isValidating: !1,
561
561
  isSubmitted: !1,
562
562
  isSubmitting: !1,
@@ -567,7 +567,7 @@ function vr(t = {}) {
567
567
  validatingFields: {},
568
568
  errors: r.errors || {},
569
569
  disabled: r.disabled || !1
570
- }, s = {}, u = H(r.defaultValues) || H(r.values) ? M(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : M(u), c = {
570
+ }, s = {}, o = W(r.defaultValues) || W(r.values) ? M(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : M(o), c = {
571
571
  action: !1,
572
572
  mount: !1,
573
573
  watch: !1,
@@ -578,8 +578,8 @@ function vr(t = {}) {
578
578
  unMount: /* @__PURE__ */ new Set(),
579
579
  array: /* @__PURE__ */ new Set(),
580
580
  watch: /* @__PURE__ */ new Set()
581
- }, v, V = 0;
582
- const C = {
581
+ }, v, b = 0;
582
+ const w = {
583
583
  isDirty: !1,
584
584
  dirtyFields: !1,
585
585
  validatingFields: !1,
@@ -588,7 +588,7 @@ function vr(t = {}) {
588
588
  isValid: !1,
589
589
  errors: !1
590
590
  }, g = {
591
- ...C
591
+ ...w
592
592
  };
593
593
  let S = {
594
594
  ...g
@@ -597,36 +597,36 @@ function vr(t = {}) {
597
597
  array: yt(),
598
598
  state: yt()
599
599
  }, I = r.criteriaMode === re.all, R = (a) => (n) => {
600
- clearTimeout(V), V = setTimeout(a, n);
600
+ clearTimeout(b), b = setTimeout(a, n);
601
601
  }, O = async (a) => {
602
602
  if (!c.keepIsValid && !r.disabled && (g.isValid || S.isValid || a)) {
603
603
  let n;
604
- r.resolver ? (n = j((await W()).errors), U()) : n = await Z(s, !0), n !== e.isValid && p.state.next({
604
+ r.resolver ? (n = Q((await $()).errors), N()) : n = await j(s, !0), n !== e.isValid && p.state.next({
605
605
  isValid: n
606
606
  });
607
607
  }
608
- }, U = (a, n) => {
609
- !r.disabled && (g.isValidating || g.validatingFields || S.isValidating || S.validatingFields) && ((a || Array.from(l.mount)).forEach((o) => {
610
- o && (n ? T(e.validatingFields, o, n) : P(e.validatingFields, o));
608
+ }, N = (a, n) => {
609
+ !r.disabled && (g.isValidating || g.validatingFields || S.isValidating || S.validatingFields) && ((a || Array.from(l.mount)).forEach((u) => {
610
+ u && (n ? T(e.validatingFields, u, n) : P(e.validatingFields, u));
611
611
  }), p.state.next({
612
612
  validatingFields: e.validatingFields,
613
- isValidating: !j(e.validatingFields)
613
+ isValidating: !Q(e.validatingFields)
614
614
  }));
615
- }, x = (a, n = [], o, h, _ = !0, y = !0) => {
616
- if (h && o && !r.disabled) {
615
+ }, x = (a, n = [], u, h, _ = !0, y = !0) => {
616
+ if (h && u && !r.disabled) {
617
617
  if (c.action = !0, y && Array.isArray(m(s, a))) {
618
- const b = o(m(s, a), h.argA, h.argB);
619
- _ && T(s, a, b);
618
+ const F = u(m(s, a), h.argA, h.argB);
619
+ _ && T(s, a, F);
620
620
  }
621
621
  if (y && Array.isArray(m(e.errors, a))) {
622
- const b = o(m(e.errors, a), h.argA, h.argB);
623
- _ && T(e.errors, a, b), gr(e.errors, a);
622
+ const F = u(m(e.errors, a), h.argA, h.argB);
623
+ _ && T(e.errors, a, F), gr(e.errors, a);
624
624
  }
625
625
  if ((g.touchedFields || S.touchedFields) && y && Array.isArray(m(e.touchedFields, a))) {
626
- const b = o(m(e.touchedFields, a), h.argA, h.argB);
627
- _ && T(e.touchedFields, a, b);
626
+ const F = u(m(e.touchedFields, a), h.argA, h.argB);
627
+ _ && T(e.touchedFields, a, F);
628
628
  }
629
- (g.dirtyFields || S.dirtyFields) && (e.dirtyFields = ce(u, i)), p.state.next({
629
+ (g.dirtyFields || S.dirtyFields) && (e.dirtyFields = de(o, i)), p.state.next({
630
630
  name: a,
631
631
  isDirty: E(a, n),
632
632
  dirtyFields: e.dirtyFields,
@@ -644,165 +644,165 @@ function vr(t = {}) {
644
644
  errors: e.errors,
645
645
  isValid: !1
646
646
  });
647
- }, d = (a, n, o, h) => {
647
+ }, d = (a, n, u, h) => {
648
648
  const _ = m(s, a);
649
649
  if (_) {
650
- const y = m(i, a, L(o) ? m(u, a) : o);
651
- L(y) || h && h.defaultChecked || n ? T(i, a, n ? y : ht(_._f)) : q(a, y), c.mount && !c.action && O();
650
+ const y = m(i, a, U(u) ? m(o, a) : u);
651
+ U(y) || h && h.defaultChecked || n ? T(i, a, n ? y : ht(_._f)) : G(a, y), c.mount && !c.action && O();
652
652
  }
653
- }, A = (a, n, o, h, _) => {
654
- let y = !1, b = !1;
653
+ }, A = (a, n, u, h, _) => {
654
+ let y = !1, F = !1;
655
655
  const D = {
656
656
  name: a
657
657
  };
658
658
  if (!r.disabled) {
659
- if (!o || h) {
660
- (g.isDirty || S.isDirty) && (b = e.isDirty, e.isDirty = D.isDirty = E(), y = b !== D.isDirty);
661
- const N = ae(m(u, a), n);
662
- b = !!m(e.dirtyFields, a), N ? P(e.dirtyFields, a) : T(e.dirtyFields, a, !0), D.dirtyFields = e.dirtyFields, y = y || (g.dirtyFields || S.dirtyFields) && b !== !N;
659
+ if (!u || h) {
660
+ (g.isDirty || S.isDirty) && (F = e.isDirty, e.isDirty = D.isDirty = E(), y = F !== D.isDirty);
661
+ const L = ae(m(o, a), n);
662
+ F = !!m(e.dirtyFields, a), L ? P(e.dirtyFields, a) : T(e.dirtyFields, a, !0), D.dirtyFields = e.dirtyFields, y = y || (g.dirtyFields || S.dirtyFields) && F !== !L;
663
663
  }
664
- if (o) {
665
- const N = m(e.touchedFields, a);
666
- N || (T(e.touchedFields, a, o), D.touchedFields = e.touchedFields, y = y || (g.touchedFields || S.touchedFields) && N !== o);
664
+ if (u) {
665
+ const L = m(e.touchedFields, a);
666
+ L || (T(e.touchedFields, a, u), D.touchedFields = e.touchedFields, y = y || (g.touchedFields || S.touchedFields) && L !== u);
667
667
  }
668
668
  y && _ && p.state.next(D);
669
669
  }
670
670
  return y ? D : {};
671
- }, w = (a, n, o, h) => {
672
- const _ = m(e.errors, a), y = (g.isValid || S.isValid) && Y(n) && e.isValid !== n;
673
- if (r.delayError && o ? (v = R(() => B(a, o)), v(r.delayError)) : (clearTimeout(V), v = null, o ? T(e.errors, a, o) : P(e.errors, a)), (o ? !ae(_, o) : _) || !j(h) || y) {
674
- const b = {
671
+ }, C = (a, n, u, h) => {
672
+ const _ = m(e.errors, a), y = (g.isValid || S.isValid) && X(n) && e.isValid !== n;
673
+ if (r.delayError && u ? (v = R(() => B(a, u)), v(r.delayError)) : (clearTimeout(b), v = null, u ? T(e.errors, a, u) : P(e.errors, a)), (u ? !ae(_, u) : _) || !Q(h) || y) {
674
+ const F = {
675
675
  ...h,
676
- ...y && Y(n) ? { isValid: n } : {},
676
+ ...y && X(n) ? { isValid: n } : {},
677
677
  errors: e.errors,
678
678
  name: a
679
679
  };
680
680
  e = {
681
681
  ...e,
682
- ...b
683
- }, p.state.next(b);
682
+ ...F
683
+ }, p.state.next(F);
684
684
  }
685
- }, W = async (a) => (U(a, !0), await r.resolver(i, r.context, cr(a || l.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), J = async (a) => {
686
- const { errors: n } = await W(a);
687
- if (U(a), a)
688
- for (const o of a) {
689
- const h = m(n, o);
690
- h ? T(e.errors, o, h) : P(e.errors, o);
685
+ }, $ = async (a) => (N(a, !0), await r.resolver(i, r.context, cr(a || l.mount, s, r.criteriaMode, r.shouldUseNativeValidation))), q = async (a) => {
686
+ const { errors: n } = await $(a);
687
+ if (N(a), a)
688
+ for (const u of a) {
689
+ const h = m(n, u);
690
+ h ? T(e.errors, u, h) : P(e.errors, u);
691
691
  }
692
692
  else
693
693
  e.errors = n;
694
694
  return n;
695
- }, Z = async (a, n, o = {
695
+ }, j = async (a, n, u = {
696
696
  valid: !0
697
697
  }) => {
698
698
  for (const h in a) {
699
699
  const _ = a[h];
700
700
  if (_) {
701
- const { _f: y, ...b } = _;
701
+ const { _f: y, ...F } = _;
702
702
  if (y) {
703
- const D = l.array.has(y.name), N = _._f && dr(_._f);
704
- N && g.validatingFields && U([y.name], !0);
703
+ const D = l.array.has(y.name), L = _._f && dr(_._f);
704
+ L && g.validatingFields && N([y.name], !0);
705
705
  const ee = await ze(_, l.disabled, i, I, r.shouldUseNativeValidation && !n, D);
706
- if (N && g.validatingFields && U([y.name]), ee[y.name] && (o.valid = !1, n))
706
+ if (L && g.validatingFields && N([y.name]), ee[y.name] && (u.valid = !1, n))
707
707
  break;
708
708
  !n && (m(ee, y.name) ? D ? Rt(e.errors, ee, y.name) : T(e.errors, y.name, ee[y.name]) : P(e.errors, y.name));
709
709
  }
710
- !j(b) && await Z(b, n, o);
710
+ !Q(F) && await j(F, n, u);
711
711
  }
712
712
  }
713
- return o.valid;
714
- }, Fe = () => {
713
+ return u.valid;
714
+ }, ne = () => {
715
715
  for (const a of l.unMount) {
716
716
  const n = m(s, a);
717
- n && (n._f.refs ? n._f.refs.every((o) => !Le(o)) : !Le(n._f.ref)) && Ce(a);
717
+ n && (n._f.refs ? n._f.refs.every((u) => !Le(u)) : !Le(n._f.ref)) && ke(a);
718
718
  }
719
719
  l.unMount = /* @__PURE__ */ new Set();
720
- }, E = (a, n) => !r.disabled && (a && n && T(i, a, n), !ae(rt(), u)), k = (a, n, o) => qe(a, l, {
721
- ...c.mount ? i : L(n) ? u : X(a) ? { [a]: n } : n
722
- }, o, n), $ = (a) => we(m(c.mount ? i : u, a, r.shouldUnregister ? m(u, a, []) : [])), q = (a, n, o = {}) => {
720
+ }, E = (a, n) => !r.disabled && (a && n && T(i, a, n), !ae(rt(), o)), k = (a, n, u) => qe(a, l, {
721
+ ...c.mount ? i : U(n) ? o : Z(a) ? { [a]: n } : n
722
+ }, u, n), H = (a) => we(m(c.mount ? i : o, a, r.shouldUnregister ? m(o, a, []) : [])), G = (a, n, u = {}) => {
723
723
  const h = m(s, a);
724
724
  let _ = n;
725
725
  if (h) {
726
726
  const y = h._f;
727
- y && (!y.disabled && T(i, a, Ot(n, y)), _ = xe(y.ref) && Q(n) ? "" : n, kt(y.ref) ? [...y.ref.options].forEach((b) => b.selected = _.includes(b.value)) : y.refs ? ve(y.ref) ? y.refs.forEach((b) => {
728
- (!b.defaultChecked || !b.disabled) && (Array.isArray(_) ? b.checked = !!_.find((D) => D === b.value) : b.checked = _ === b.value || !!_);
729
- }) : y.refs.forEach((b) => b.checked = b.value === _) : Ze(y.ref) ? y.ref.value = "" : (y.ref.value = _, y.ref.type || p.state.next({
727
+ y && (!y.disabled && T(i, a, Ot(n, y)), _ = xe(y.ref) && J(n) ? "" : n, Ct(y.ref) ? [...y.ref.options].forEach((F) => F.selected = _.includes(F.value)) : y.refs ? Ve(y.ref) ? y.refs.forEach((F) => {
728
+ (!F.defaultChecked || !F.disabled) && (Array.isArray(_) ? F.checked = !!_.find((D) => D === F.value) : F.checked = _ === F.value || !!_);
729
+ }) : y.refs.forEach((F) => F.checked = F.value === _) : Ze(y.ref) ? y.ref.value = "" : (y.ref.value = _, y.ref.type || p.state.next({
730
730
  name: a,
731
731
  values: M(i)
732
732
  })));
733
733
  }
734
- (o.shouldDirty || o.shouldTouch) && A(a, _, o.shouldTouch, o.shouldDirty, !0), o.shouldValidate && ge(a);
735
- }, se = (a, n, o) => {
734
+ (u.shouldDirty || u.shouldTouch) && A(a, _, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && he(a);
735
+ }, se = (a, n, u) => {
736
736
  for (const h in n) {
737
737
  if (!n.hasOwnProperty(h))
738
738
  return;
739
- const _ = n[h], y = a + "." + h, b = m(s, y);
740
- (l.array.has(a) || H(_) || b && !b._f) && !oe(_) ? se(y, _, o) : q(y, _, o);
739
+ const _ = n[h], y = a + "." + h, F = m(s, y);
740
+ (l.array.has(a) || W(_) || F && !F._f) && !le(_) ? se(y, _, u) : G(y, _, u);
741
741
  }
742
- }, K = (a, n, o = {}) => {
742
+ }, Y = (a, n, u = {}) => {
743
743
  const h = m(s, a), _ = l.array.has(a), y = M(n);
744
744
  T(i, a, y), _ ? (p.array.next({
745
745
  name: a,
746
746
  values: M(i)
747
- }), (g.isDirty || g.dirtyFields || S.isDirty || S.dirtyFields) && o.shouldDirty && p.state.next({
747
+ }), (g.isDirty || g.dirtyFields || S.isDirty || S.dirtyFields) && u.shouldDirty && p.state.next({
748
748
  name: a,
749
- dirtyFields: ce(u, i),
749
+ dirtyFields: de(o, i),
750
750
  isDirty: E(a, y)
751
- })) : h && !h._f && !Q(y) ? se(a, y, o) : q(a, y, o), Qe(a, l) && p.state.next({ ...e, name: a }), p.state.next({
751
+ })) : h && !h._f && !J(y) ? se(a, y, u) : G(a, y, u), Qe(a, l) && p.state.next({ ...e, name: a }), p.state.next({
752
752
  name: c.mount ? a : void 0,
753
753
  values: M(i)
754
754
  });
755
- }, me = async (a) => {
755
+ }, _e = async (a) => {
756
756
  c.mount = !0;
757
757
  const n = a.target;
758
- let o = n.name, h = !0;
759
- const _ = m(s, o), y = (N) => {
760
- h = Number.isNaN(N) || oe(N) && isNaN(N.getTime()) || ae(N, m(i, o, N));
761
- }, b = de(r.mode), D = de(r.reValidateMode);
758
+ let u = n.name, h = !0;
759
+ const _ = m(s, u), y = (L) => {
760
+ h = Number.isNaN(L) || le(L) && isNaN(L.getTime()) || ae(L, m(i, u, L));
761
+ }, F = fe(r.mode), D = fe(r.reValidateMode);
762
762
  if (_) {
763
- let N, ee;
764
- const be = n.type ? ht(_._f) : xt(a), ie = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, qt = !fr(_._f) && !r.resolver && !m(e.errors, o) && !_._f.deps || _r(ie, m(e.touchedFields, o), e.isSubmitted, D, b), Te = Qe(o, l, ie);
765
- T(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), v && v(0)) : _._f.onChange && _._f.onChange(a);
766
- const Re = A(o, be, ie), jt = !j(Re) || Te;
767
- if (!ie && p.state.next({
768
- name: o,
763
+ let L, ee;
764
+ const be = n.type ? ht(_._f) : xt(a), oe = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, qt = !fr(_._f) && !r.resolver && !m(e.errors, u) && !_._f.deps || _r(oe, m(e.touchedFields, u), e.isSubmitted, D, F), Te = Qe(u, l, oe);
765
+ T(i, u, be), oe ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), v && v(0)) : _._f.onChange && _._f.onChange(a);
766
+ const Re = A(u, be, oe), jt = !Q(Re) || Te;
767
+ if (!oe && p.state.next({
768
+ name: u,
769
769
  type: a.type,
770
770
  values: M(i)
771
771
  }), qt)
772
- return (g.isValid || S.isValid) && (r.mode === "onBlur" ? ie && O() : ie || O()), jt && p.state.next({ name: o, ...Te ? {} : Re });
773
- if (!ie && Te && p.state.next({ ...e }), r.resolver) {
774
- const { errors: dt } = await W([o]);
775
- if (U([o]), y(be), h) {
776
- const Gt = Vt(e.errors, s, o), ft = Vt(dt, s, Gt.name || o);
777
- N = ft.error, o = ft.name, ee = j(dt);
772
+ return (g.isValid || S.isValid) && (r.mode === "onBlur" ? oe && O() : oe || O()), jt && p.state.next({ name: u, ...Te ? {} : Re });
773
+ if (!oe && Te && p.state.next({ ...e }), r.resolver) {
774
+ const { errors: dt } = await $([u]);
775
+ if (N([u]), y(be), h) {
776
+ const Gt = Vt(e.errors, s, u), ft = Vt(dt, s, Gt.name || u);
777
+ L = ft.error, u = ft.name, ee = Q(dt);
778
778
  }
779
779
  } else
780
- U([o], !0), N = (await ze(_, l.disabled, i, I, r.shouldUseNativeValidation))[o], U([o]), y(be), h && (N ? ee = !1 : (g.isValid || S.isValid) && (ee = await Z(s, !0)));
781
- h && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && ge(_._f.deps), w(o, ee, N, Re));
780
+ N([u], !0), L = (await ze(_, l.disabled, i, I, r.shouldUseNativeValidation))[u], N([u]), y(be), h && (L ? ee = !1 : (g.isValid || S.isValid) && (ee = await j(s, !0)));
781
+ h && (_._f.deps && (!Array.isArray(_._f.deps) || _._f.deps.length > 0) && he(_._f.deps), C(u, ee, L, Re));
782
782
  }
783
- }, _e = (a, n) => {
783
+ }, ge = (a, n) => {
784
784
  if (m(e.errors, n) && a.focus)
785
785
  return a.focus(), 1;
786
- }, ge = async (a, n = {}) => {
787
- let o, h;
788
- const _ = z(a);
786
+ }, he = async (a, n = {}) => {
787
+ let u, h;
788
+ const _ = K(a);
789
789
  if (r.resolver) {
790
- const y = await J(L(a) ? a : _);
791
- o = j(y), h = a ? !_.some((b) => m(y, b)) : o;
790
+ const y = await q(U(a) ? a : _);
791
+ u = Q(y), h = a ? !_.some((F) => m(y, F)) : u;
792
792
  } else a ? (h = (await Promise.all(_.map(async (y) => {
793
- const b = m(s, y);
794
- return await Z(b && b._f ? { [y]: b } : b);
795
- }))).every(Boolean), !(!h && !e.isValid) && O()) : h = o = await Z(s);
793
+ const F = m(s, y);
794
+ return await j(F && F._f ? { [y]: F } : F);
795
+ }))).every(Boolean), !(!h && !e.isValid) && O()) : h = u = await j(s);
796
796
  return p.state.next({
797
- ...!X(a) || (g.isValid || S.isValid) && o !== e.isValid ? {} : { name: a },
798
- ...r.resolver || !a ? { isValid: o } : {},
797
+ ...!Z(a) || (g.isValid || S.isValid) && u !== e.isValid ? {} : { name: a },
798
+ ...r.resolver || !a ? { isValid: u } : {},
799
799
  errors: e.errors
800
- }), n.shouldFocus && !h && fe(s, _e, a ? _ : l.mount), h;
800
+ }), n.shouldFocus && !h && ye(s, ge, a ? _ : l.mount), h;
801
801
  }, rt = (a, n) => {
802
- let o = {
803
- ...c.mount ? i : u
802
+ let u = {
803
+ ...c.mount ? i : o
804
804
  };
805
- return n && (o = wt(n.dirtyFields ? e.dirtyFields : e.touchedFields, o)), L(a) ? o : X(a) ? m(o, a) : a.map((h) => m(o, h));
805
+ return n && (u = wt(n.dirtyFields ? e.dirtyFields : e.touchedFields, u)), U(a) ? u : Z(a) ? m(u, a) : a.map((h) => m(u, h));
806
806
  }, st = (a, n) => ({
807
807
  invalid: !!m((n || e).errors, a),
808
808
  isDirty: !!m((n || e).dirtyFields, a),
@@ -810,29 +810,29 @@ function vr(t = {}) {
810
810
  isValidating: !!m(e.validatingFields, a),
811
811
  isTouched: !!m((n || e).touchedFields, a)
812
812
  }), Mt = (a) => {
813
- a && z(a).forEach((n) => P(e.errors, n)), p.state.next({
813
+ a && K(a).forEach((n) => P(e.errors, n)), p.state.next({
814
814
  errors: a ? e.errors : {}
815
815
  });
816
- }, at = (a, n, o) => {
817
- const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: b, type: D, ...N } = _;
816
+ }, at = (a, n, u) => {
817
+ const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: F, type: D, ...L } = _;
818
818
  T(e.errors, a, {
819
- ...N,
819
+ ...L,
820
820
  ...n,
821
821
  ref: h
822
822
  }), p.state.next({
823
823
  name: a,
824
824
  errors: e.errors,
825
825
  isValid: !1
826
- }), o && o.shouldFocus && h && h.focus && h.focus();
827
- }, It = (a, n) => G(a) ? p.state.subscribe({
828
- next: (o) => "values" in o && a(k(void 0, n), o)
826
+ }), u && u.shouldFocus && h && h.focus && h.focus();
827
+ }, It = (a, n) => z(a) ? p.state.subscribe({
828
+ next: (u) => "values" in u && a(k(void 0, n), u)
829
829
  }) : k(a, n, !0), nt = (a) => p.state.subscribe({
830
830
  next: (n) => {
831
831
  mr(a.name, n.name, a.exact) && yr(n, a.formState || g, $t, a.reRenderRoot) && a.callback({
832
832
  values: { ...i },
833
833
  ...e,
834
834
  ...n,
835
- defaultValues: u
835
+ defaultValues: o
836
836
  });
837
837
  }
838
838
  }).unsubscribe, Bt = (a) => (c.mount = !0, S = {
@@ -841,12 +841,12 @@ function vr(t = {}) {
841
841
  }, nt({
842
842
  ...a,
843
843
  formState: {
844
- ...C,
844
+ ...w,
845
845
  ...a.formState
846
846
  }
847
- })), Ce = (a, n = {}) => {
848
- for (const o of a ? z(a) : l.mount)
849
- l.mount.delete(o), l.array.delete(o), n.keepValue || (P(s, o), P(i, o)), !n.keepError && P(e.errors, o), !n.keepDirty && P(e.dirtyFields, o), !n.keepTouched && P(e.touchedFields, o), !n.keepIsValidating && P(e.validatingFields, o), !r.shouldUnregister && !n.keepDefaultValue && P(u, o);
847
+ })), ke = (a, n = {}) => {
848
+ for (const u of a ? K(a) : l.mount)
849
+ l.mount.delete(u), l.array.delete(u), n.keepValue || (P(s, u), P(i, u)), !n.keepError && P(e.errors, u), !n.keepDirty && P(e.dirtyFields, u), !n.keepTouched && P(e.touchedFields, u), !n.keepIsValidating && P(e.validatingFields, u), !r.shouldUnregister && !n.keepDefaultValue && P(o, u);
850
850
  p.state.next({
851
851
  values: M(i)
852
852
  }), p.state.next({
@@ -854,117 +854,117 @@ function vr(t = {}) {
854
854
  ...n.keepDirty ? { isDirty: E() } : {}
855
855
  }), !n.keepIsValid && O();
856
856
  }, it = ({ disabled: a, name: n }) => {
857
- (Y(a) && c.mount || a || l.disabled.has(n)) && (a ? l.disabled.add(n) : l.disabled.delete(n));
857
+ (X(a) && c.mount || a || l.disabled.has(n)) && (a ? l.disabled.add(n) : l.disabled.delete(n));
858
858
  }, De = (a, n = {}) => {
859
- let o = m(s, a);
860
- const h = Y(n.disabled) || Y(r.disabled);
859
+ let u = m(s, a);
860
+ const h = X(n.disabled) || X(r.disabled);
861
861
  return T(s, a, {
862
- ...o || {},
862
+ ...u || {},
863
863
  _f: {
864
- ...o && o._f ? o._f : { ref: { name: a } },
864
+ ...u && u._f ? u._f : { ref: { name: a } },
865
865
  name: a,
866
866
  mount: !0,
867
867
  ...n
868
868
  }
869
- }), l.mount.add(a), o ? it({
870
- disabled: Y(n.disabled) ? n.disabled : r.disabled,
869
+ }), l.mount.add(a), u ? it({
870
+ disabled: X(n.disabled) ? n.disabled : r.disabled,
871
871
  name: a
872
872
  }) : d(a, !0, n.value), {
873
873
  ...h ? { disabled: n.disabled || r.disabled } : {},
874
874
  ...r.progressive ? {
875
875
  required: !!n.required,
876
- min: he(n.min),
877
- max: he(n.max),
878
- minLength: he(n.minLength),
879
- maxLength: he(n.maxLength),
880
- pattern: he(n.pattern)
876
+ min: ve(n.min),
877
+ max: ve(n.max),
878
+ minLength: ve(n.minLength),
879
+ maxLength: ve(n.maxLength),
880
+ pattern: ve(n.pattern)
881
881
  } : {},
882
882
  name: a,
883
- onChange: me,
884
- onBlur: me,
883
+ onChange: _e,
884
+ onBlur: _e,
885
885
  ref: (_) => {
886
886
  if (_) {
887
- De(a, n), o = m(s, a);
888
- const y = L(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, b = ir(y), D = o._f.refs || [];
889
- if (b ? D.find((N) => N === y) : y === o._f.ref)
887
+ De(a, n), u = m(s, a);
888
+ const y = U(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, F = ir(y), D = u._f.refs || [];
889
+ if (F ? D.find((L) => L === y) : y === u._f.ref)
890
890
  return;
891
891
  T(s, a, {
892
892
  _f: {
893
- ...o._f,
894
- ...b ? {
893
+ ...u._f,
894
+ ...F ? {
895
895
  refs: [
896
896
  ...D.filter(Le),
897
897
  y,
898
- ...Array.isArray(m(u, a)) ? [{}] : []
898
+ ...Array.isArray(m(o, a)) ? [{}] : []
899
899
  ],
900
900
  ref: { type: y.type, name: a }
901
901
  } : { ref: y }
902
902
  }
903
903
  }), d(a, !1, void 0, y);
904
904
  } else
905
- o = m(s, a, {}), o._f && (o._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(St(l.array, a) && c.action) && l.unMount.add(a);
905
+ u = m(s, a, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(St(l.array, a) && c.action) && l.unMount.add(a);
906
906
  }
907
907
  };
908
- }, Oe = () => r.shouldFocusError && fe(s, _e, l.mount), Pt = (a) => {
909
- Y(a) && (p.state.next({ disabled: a }), fe(s, (n, o) => {
910
- const h = m(s, o);
908
+ }, Oe = () => r.shouldFocusError && ye(s, ge, l.mount), Pt = (a) => {
909
+ X(a) && (p.state.next({ disabled: a }), ye(s, (n, u) => {
910
+ const h = m(s, u);
911
911
  h && (n.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((_) => {
912
912
  _.disabled = h._f.disabled || a;
913
913
  }));
914
914
  }, 0, !1));
915
- }, ut = (a, n) => async (o) => {
915
+ }, ot = (a, n) => async (u) => {
916
916
  let h;
917
- o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
917
+ u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
918
918
  let _ = M(i);
919
919
  if (p.state.next({
920
920
  isSubmitting: !0
921
921
  }), r.resolver) {
922
- const { errors: y, values: b } = await W();
923
- U(), e.errors = y, _ = M(b);
922
+ const { errors: y, values: F } = await $();
923
+ N(), e.errors = y, _ = M(F);
924
924
  } else
925
- await Z(s);
925
+ await j(s);
926
926
  if (l.disabled.size)
927
927
  for (const y of l.disabled)
928
928
  P(_, y);
929
- if (P(e.errors, "root"), j(e.errors)) {
929
+ if (P(e.errors, "root"), Q(e.errors)) {
930
930
  p.state.next({
931
931
  errors: {}
932
932
  });
933
933
  try {
934
- await a(_, o);
934
+ await a(_, u);
935
935
  } catch (y) {
936
936
  h = y;
937
937
  }
938
938
  } else
939
- n && await n({ ...e.errors }, o), Oe(), setTimeout(Oe);
939
+ n && await n({ ...e.errors }, u), Oe(), setTimeout(Oe);
940
940
  if (p.state.next({
941
941
  isSubmitted: !0,
942
942
  isSubmitting: !1,
943
- isSubmitSuccessful: j(e.errors) && !h,
943
+ isSubmitSuccessful: Q(e.errors) && !h,
944
944
  submitCount: e.submitCount + 1,
945
945
  errors: e.errors
946
946
  }), h)
947
947
  throw h;
948
948
  }, Wt = (a, n = {}) => {
949
- m(s, a) && (L(n.defaultValue) ? K(a, M(m(u, a))) : (K(a, n.defaultValue), T(u, a, M(n.defaultValue))), n.keepTouched || P(e.touchedFields, a), n.keepDirty || (P(e.dirtyFields, a), e.isDirty = n.defaultValue ? E(a, M(m(u, a))) : E()), n.keepError || (P(e.errors, a), g.isValid && O()), p.state.next({ ...e }));
950
- }, ot = (a, n = {}) => {
951
- const o = a ? M(a) : u, h = M(o), _ = j(a), y = _ ? u : h;
952
- if (n.keepDefaultValues || (u = o), !n.keepValues) {
949
+ m(s, a) && (U(n.defaultValue) ? Y(a, M(m(o, a))) : (Y(a, n.defaultValue), T(o, a, M(n.defaultValue))), n.keepTouched || P(e.touchedFields, a), n.keepDirty || (P(e.dirtyFields, a), e.isDirty = n.defaultValue ? E(a, M(m(o, a))) : E()), n.keepError || (P(e.errors, a), g.isValid && O()), p.state.next({ ...e }));
950
+ }, ut = (a, n = {}) => {
951
+ const u = a ? M(a) : o, h = M(u), _ = Q(a), y = _ ? o : h;
952
+ if (n.keepDefaultValues || (o = u), !n.keepValues) {
953
953
  if (n.keepDirtyValues) {
954
- const b = /* @__PURE__ */ new Set([
954
+ const F = /* @__PURE__ */ new Set([
955
955
  ...l.mount,
956
- ...Object.keys(ce(u, i))
956
+ ...Object.keys(de(o, i))
957
957
  ]);
958
- for (const D of Array.from(b))
959
- m(e.dirtyFields, D) ? T(y, D, m(i, D)) : K(D, m(y, D));
958
+ for (const D of Array.from(F))
959
+ m(e.dirtyFields, D) ? T(y, D, m(i, D)) : Y(D, m(y, D));
960
960
  } else {
961
- if (Je && L(a))
962
- for (const b of l.mount) {
963
- const D = m(s, b);
961
+ if (Je && U(a))
962
+ for (const F of l.mount) {
963
+ const D = m(s, F);
964
964
  if (D && D._f) {
965
- const N = Array.isArray(D._f.refs) ? D._f.refs[0] : D._f.ref;
966
- if (xe(N)) {
967
- const ee = N.closest("form");
965
+ const L = Array.isArray(D._f.refs) ? D._f.refs[0] : D._f.ref;
966
+ if (xe(L)) {
967
+ const ee = L.closest("form");
968
968
  if (ee) {
969
969
  ee.reset();
970
970
  break;
@@ -973,12 +973,12 @@ function vr(t = {}) {
973
973
  }
974
974
  }
975
975
  if (n.keepFieldsRef)
976
- for (const b of l.mount)
977
- K(b, m(y, b));
976
+ for (const F of l.mount)
977
+ Y(F, m(y, F));
978
978
  else
979
979
  s = {};
980
980
  }
981
- i = r.shouldUnregister ? n.keepDefaultValues ? M(u) : {} : M(y), p.array.next({
981
+ i = r.shouldUnregister ? n.keepDefaultValues ? M(o) : {} : M(y), p.array.next({
982
982
  values: { ...y }
983
983
  }), p.state.next({
984
984
  values: { ...y }
@@ -992,23 +992,23 @@ function vr(t = {}) {
992
992
  watch: /* @__PURE__ */ new Set(),
993
993
  watchAll: !1,
994
994
  focus: ""
995
- }, c.mount = !g.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !r.shouldUnregister && !j(y), c.watch = !!r.shouldUnregister, c.keepIsValid = !!n.keepIsValid, c.action = !1, n.keepErrors || (e.errors = {}), p.state.next({
995
+ }, c.mount = !g.isValid || !!n.keepIsValid || !!n.keepDirtyValues || !r.shouldUnregister && !Q(y), c.watch = !!r.shouldUnregister, c.keepIsValid = !!n.keepIsValid, c.action = !1, n.keepErrors || (e.errors = {}), p.state.next({
996
996
  submitCount: n.keepSubmitCount ? e.submitCount : 0,
997
- isDirty: _ ? !1 : n.keepDirty ? e.isDirty : !!(n.keepDefaultValues && !ae(a, u)),
997
+ isDirty: _ ? !1 : n.keepDirty ? e.isDirty : !!(n.keepDefaultValues && !ae(a, o)),
998
998
  isSubmitted: n.keepIsSubmitted ? e.isSubmitted : !1,
999
- dirtyFields: _ ? {} : n.keepDirtyValues ? n.keepDefaultValues && i ? ce(u, i) : e.dirtyFields : n.keepDefaultValues && a ? ce(u, a) : n.keepDirty ? e.dirtyFields : {},
999
+ dirtyFields: _ ? {} : n.keepDirtyValues ? n.keepDefaultValues && i ? de(o, i) : e.dirtyFields : n.keepDefaultValues && a ? de(o, a) : n.keepDirty ? e.dirtyFields : {},
1000
1000
  touchedFields: n.keepTouched ? e.touchedFields : {},
1001
1001
  errors: n.keepErrors ? e.errors : {},
1002
1002
  isSubmitSuccessful: n.keepIsSubmitSuccessful ? e.isSubmitSuccessful : !1,
1003
1003
  isSubmitting: !1,
1004
- defaultValues: u
1004
+ defaultValues: o
1005
1005
  });
1006
- }, lt = (a, n) => ot(G(a) ? a(i) : a, { ...r.resetOptions, ...n }), Ht = (a, n = {}) => {
1007
- const o = m(s, a), h = o && o._f;
1006
+ }, lt = (a, n) => ut(z(a) ? a(i) : a, { ...r.resetOptions, ...n }), Ht = (a, n = {}) => {
1007
+ const u = m(s, a), h = u && u._f;
1008
1008
  if (h) {
1009
1009
  const _ = h.refs ? h.refs[0] : h.ref;
1010
1010
  _.focus && setTimeout(() => {
1011
- _.focus(), n.shouldSelect && G(_.select) && _.select();
1011
+ _.focus(), n.shouldSelect && z(_.select) && _.select();
1012
1012
  });
1013
1013
  }
1014
1014
  }, $t = (a) => {
@@ -1019,13 +1019,13 @@ function vr(t = {}) {
1019
1019
  }, ct = {
1020
1020
  control: {
1021
1021
  register: De,
1022
- unregister: Ce,
1022
+ unregister: ke,
1023
1023
  getFieldState: st,
1024
- handleSubmit: ut,
1024
+ handleSubmit: ot,
1025
1025
  setError: at,
1026
1026
  _subscribe: nt,
1027
- _runSchema: W,
1028
- _updateIsValidating: U,
1027
+ _runSchema: $,
1028
+ _updateIsValidating: N,
1029
1029
  _focusError: Oe,
1030
1030
  _getWatch: k,
1031
1031
  _getDirty: E,
@@ -1033,14 +1033,14 @@ function vr(t = {}) {
1033
1033
  _setFieldArray: x,
1034
1034
  _setDisabledField: it,
1035
1035
  _setErrors: f,
1036
- _getFieldArray: $,
1037
- _reset: ot,
1038
- _resetDefaultValues: () => G(r.defaultValues) && r.defaultValues().then((a) => {
1036
+ _getFieldArray: H,
1037
+ _reset: ut,
1038
+ _resetDefaultValues: () => z(r.defaultValues) && r.defaultValues().then((a) => {
1039
1039
  lt(a, r.resetOptions), p.state.next({
1040
1040
  isLoading: !1
1041
1041
  });
1042
1042
  }),
1043
- _removeUnmounted: Fe,
1043
+ _removeUnmounted: ne,
1044
1044
  _disableForm: Pt,
1045
1045
  _subjects: p,
1046
1046
  _proxyFormState: g,
@@ -1057,7 +1057,7 @@ function vr(t = {}) {
1057
1057
  c = a;
1058
1058
  },
1059
1059
  get _defaultValues() {
1060
- return u;
1060
+ return o;
1061
1061
  },
1062
1062
  get _names() {
1063
1063
  return l;
@@ -1079,16 +1079,16 @@ function vr(t = {}) {
1079
1079
  }
1080
1080
  },
1081
1081
  subscribe: Bt,
1082
- trigger: ge,
1082
+ trigger: he,
1083
1083
  register: De,
1084
- handleSubmit: ut,
1084
+ handleSubmit: ot,
1085
1085
  watch: It,
1086
- setValue: K,
1086
+ setValue: Y,
1087
1087
  getValues: rt,
1088
1088
  reset: lt,
1089
1089
  resetField: Wt,
1090
1090
  clearErrors: Mt,
1091
- unregister: Ce,
1091
+ unregister: ke,
1092
1092
  setError: at,
1093
1093
  setFocus: Ht,
1094
1094
  getFieldState: st
@@ -1106,91 +1106,91 @@ var ue = () => {
1106
1106
  const e = (Math.random() * 16 + t) % 16 | 0;
1107
1107
  return (r == "x" ? e : e & 3 | 8).toString(16);
1108
1108
  });
1109
- }, Ue = (t, r, e = {}) => e.shouldFocus || L(e.shouldFocus) ? e.focusName || `${t}.${L(e.focusIndex) ? r : e.focusIndex}.` : "", Me = (t, r) => [
1109
+ }, Ue = (t, r, e = {}) => e.shouldFocus || U(e.shouldFocus) ? e.focusName || `${t}.${U(e.focusIndex) ? r : e.focusIndex}.` : "", Me = (t, r) => [
1110
1110
  ...t,
1111
- ...z(r)
1111
+ ...K(r)
1112
1112
  ], Ie = (t) => Array.isArray(t) ? t.map(() => {
1113
1113
  }) : void 0;
1114
1114
  function Be(t, r, e) {
1115
1115
  return [
1116
1116
  ...t.slice(0, r),
1117
- ...z(e),
1117
+ ...K(e),
1118
1118
  ...t.slice(r)
1119
1119
  ];
1120
1120
  }
1121
- var Pe = (t, r, e) => Array.isArray(t) ? (L(t[e]) && (t[e] = void 0), t.splice(e, 0, t.splice(r, 1)[0]), t) : [], We = (t, r) => [
1122
- ...z(r),
1123
- ...z(t)
1121
+ var Pe = (t, r, e) => Array.isArray(t) ? (U(t[e]) && (t[e] = void 0), t.splice(e, 0, t.splice(r, 1)[0]), t) : [], We = (t, r) => [
1122
+ ...K(r),
1123
+ ...K(t)
1124
1124
  ];
1125
1125
  function Vr(t, r) {
1126
1126
  let e = 0;
1127
1127
  const s = [...t];
1128
- for (const u of r)
1129
- s.splice(u - e, 1), e++;
1128
+ for (const o of r)
1129
+ s.splice(o - e, 1), e++;
1130
1130
  return we(s).length ? s : [];
1131
1131
  }
1132
- var He = (t, r) => L(r) ? [] : Vr(t, z(r).sort((e, s) => e - s)), $e = (t, r, e) => {
1132
+ var He = (t, r) => U(r) ? [] : Vr(t, K(r).sort((e, s) => e - s)), $e = (t, r, e) => {
1133
1133
  [t[r], t[e]] = [t[e], t[r]];
1134
1134
  }, bt = (t, r, e) => (t[r] = e, t);
1135
1135
  function Fr(t) {
1136
- const r = Ve(), { control: e = r.control, name: s, keyName: u = "id", shouldUnregister: i, rules: c } = t, [l, v] = F.useState(e._getFieldArray(s)), V = F.useRef(e._getFieldArray(s).map(ue)), C = F.useRef(!1);
1137
- e._names.array.add(s), F.useMemo(() => c && l.length >= 0 && e.register(s, c), [e, s, l.length, c]), ke(() => e._subjects.array.subscribe({
1136
+ const r = Fe(), { control: e = r.control, name: s, keyName: o = "id", shouldUnregister: i, rules: c } = t, [l, v] = V.useState(e._getFieldArray(s)), b = V.useRef(e._getFieldArray(s).map(ue)), w = V.useRef(!1);
1137
+ e._names.array.add(s), V.useMemo(() => c && l.length >= 0 && e.register(s, c), [e, s, l.length, c]), Ce(() => e._subjects.array.subscribe({
1138
1138
  next: ({ values: f, name: d }) => {
1139
1139
  if (d === s || !d) {
1140
1140
  const A = m(f, s);
1141
- Array.isArray(A) && (v(A), V.current = A.map(ue));
1141
+ Array.isArray(A) && (v(A), b.current = A.map(ue));
1142
1142
  }
1143
1143
  }
1144
1144
  }).unsubscribe, [e, s]);
1145
- const g = F.useCallback((f) => {
1146
- C.current = !0, e._setFieldArray(s, f);
1145
+ const g = V.useCallback((f) => {
1146
+ w.current = !0, e._setFieldArray(s, f);
1147
1147
  }, [e, s]), S = (f, d) => {
1148
- const A = z(M(f)), w = Me(e._getFieldArray(s), A);
1149
- e._names.focus = Ue(s, w.length - 1, d), V.current = Me(V.current, A.map(ue)), g(w), v(w), e._setFieldArray(s, w, Me, {
1148
+ const A = K(M(f)), C = Me(e._getFieldArray(s), A);
1149
+ e._names.focus = Ue(s, C.length - 1, d), b.current = Me(b.current, A.map(ue)), g(C), v(C), e._setFieldArray(s, C, Me, {
1150
1150
  argA: Ie(f)
1151
1151
  });
1152
1152
  }, p = (f, d) => {
1153
- const A = z(M(f)), w = We(e._getFieldArray(s), A);
1154
- e._names.focus = Ue(s, 0, d), V.current = We(V.current, A.map(ue)), g(w), v(w), e._setFieldArray(s, w, We, {
1153
+ const A = K(M(f)), C = We(e._getFieldArray(s), A);
1154
+ e._names.focus = Ue(s, 0, d), b.current = We(b.current, A.map(ue)), g(C), v(C), e._setFieldArray(s, C, We, {
1155
1155
  argA: Ie(f)
1156
1156
  });
1157
1157
  }, I = (f) => {
1158
1158
  const d = He(e._getFieldArray(s), f);
1159
- V.current = He(V.current, f), g(d), v(d), !Array.isArray(m(e._fields, s)) && T(e._fields, s, void 0), e._setFieldArray(s, d, He, {
1159
+ b.current = He(b.current, f), g(d), v(d), !Array.isArray(m(e._fields, s)) && T(e._fields, s, void 0), e._setFieldArray(s, d, He, {
1160
1160
  argA: f
1161
1161
  });
1162
1162
  }, R = (f, d, A) => {
1163
- const w = z(M(d)), W = Be(e._getFieldArray(s), f, w);
1164
- e._names.focus = Ue(s, f, A), V.current = Be(V.current, f, w.map(ue)), g(W), v(W), e._setFieldArray(s, W, Be, {
1163
+ const C = K(M(d)), $ = Be(e._getFieldArray(s), f, C);
1164
+ e._names.focus = Ue(s, f, A), b.current = Be(b.current, f, C.map(ue)), g($), v($), e._setFieldArray(s, $, Be, {
1165
1165
  argA: f,
1166
1166
  argB: Ie(d)
1167
1167
  });
1168
1168
  }, O = (f, d) => {
1169
1169
  const A = e._getFieldArray(s);
1170
- $e(A, f, d), $e(V.current, f, d), g(A), v(A), e._setFieldArray(s, A, $e, {
1170
+ $e(A, f, d), $e(b.current, f, d), g(A), v(A), e._setFieldArray(s, A, $e, {
1171
1171
  argA: f,
1172
1172
  argB: d
1173
1173
  }, !1);
1174
- }, U = (f, d) => {
1174
+ }, N = (f, d) => {
1175
1175
  const A = e._getFieldArray(s);
1176
- Pe(A, f, d), Pe(V.current, f, d), g(A), v(A), e._setFieldArray(s, A, Pe, {
1176
+ Pe(A, f, d), Pe(b.current, f, d), g(A), v(A), e._setFieldArray(s, A, Pe, {
1177
1177
  argA: f,
1178
1178
  argB: d
1179
1179
  }, !1);
1180
1180
  }, x = (f, d) => {
1181
- const A = M(d), w = bt(e._getFieldArray(s), f, A);
1182
- V.current = [...w].map((W, J) => !W || J === f ? ue() : V.current[J]), g(w), v([...w]), e._setFieldArray(s, w, bt, {
1181
+ const A = M(d), C = bt(e._getFieldArray(s), f, A);
1182
+ b.current = [...C].map(($, q) => !$ || q === f ? ue() : b.current[q]), g(C), v([...C]), e._setFieldArray(s, C, bt, {
1183
1183
  argA: f,
1184
1184
  argB: A
1185
1185
  }, !0, !1);
1186
1186
  }, B = (f) => {
1187
- const d = z(M(f));
1188
- V.current = d.map(ue), g([...d]), v([...d]), e._setFieldArray(s, [...d], (A) => A, {}, !0, !1);
1187
+ const d = K(M(f));
1188
+ b.current = d.map(ue), g([...d]), v([...d]), e._setFieldArray(s, [...d], (A) => A, {}, !0, !1);
1189
1189
  };
1190
- return F.useEffect(() => {
1190
+ return V.useEffect(() => {
1191
1191
  if (e._state.action = !1, Qe(s, e._names) && e._subjects.state.next({
1192
1192
  ...e._formState
1193
- }), C.current && (!de(e._options.mode).isOnSubmit || e._formState.isSubmitted) && !de(e._options.reValidateMode).isOnSubmit)
1193
+ }), w.current && (!fe(e._options.mode).isOnSubmit || e._formState.isSubmitted) && !fe(e._options.reValidateMode).isOnSubmit)
1194
1194
  if (e._options.resolver)
1195
1195
  e._runSchema([s]).then((f) => {
1196
1196
  e._updateIsValidating([s]);
@@ -1201,43 +1201,43 @@ function Fr(t) {
1201
1201
  });
1202
1202
  else {
1203
1203
  const f = m(e._fields, s);
1204
- f && f._f && !(de(e._options.reValidateMode).isOnSubmit && de(e._options.mode).isOnSubmit) && ze(f, e._names.disabled, e._formValues, e._options.criteriaMode === re.all, e._options.shouldUseNativeValidation, !0).then((d) => !j(d) && e._subjects.state.next({
1204
+ f && f._f && !(fe(e._options.reValidateMode).isOnSubmit && fe(e._options.mode).isOnSubmit) && ze(f, e._names.disabled, e._formValues, e._options.criteriaMode === re.all, e._options.shouldUseNativeValidation, !0).then((d) => !Q(d) && e._subjects.state.next({
1205
1205
  errors: Rt(e._formState.errors, d, s)
1206
1206
  }));
1207
1207
  }
1208
1208
  e._subjects.state.next({
1209
1209
  name: s,
1210
1210
  values: M(e._formValues)
1211
- }), e._names.focus && fe(e._fields, (f, d) => {
1211
+ }), e._names.focus && ye(e._fields, (f, d) => {
1212
1212
  if (e._names.focus && d.startsWith(e._names.focus) && f.focus)
1213
1213
  return f.focus(), 1;
1214
- }), e._names.focus = "", e._setValid(), C.current = !1;
1215
- }, [l, s, e]), F.useEffect(() => (!m(e._formValues, s) && e._setFieldArray(s), () => {
1214
+ }), e._names.focus = "", e._setValid(), w.current = !1;
1215
+ }, [l, s, e]), V.useEffect(() => (!m(e._formValues, s) && e._setFieldArray(s), () => {
1216
1216
  const f = (d, A) => {
1217
- const w = m(e._fields, d);
1218
- w && w._f && (w._f.mount = A);
1217
+ const C = m(e._fields, d);
1218
+ C && C._f && (C._f.mount = A);
1219
1219
  };
1220
1220
  e._options.shouldUnregister || i ? e.unregister(s) : f(s, !1);
1221
- }), [s, e, u, i]), {
1222
- swap: F.useCallback(O, [g, s, e]),
1223
- move: F.useCallback(U, [g, s, e]),
1224
- prepend: F.useCallback(p, [g, s, e]),
1225
- append: F.useCallback(S, [g, s, e]),
1226
- remove: F.useCallback(I, [g, s, e]),
1227
- insert: F.useCallback(R, [g, s, e]),
1228
- update: F.useCallback(x, [g, s, e]),
1229
- replace: F.useCallback(B, [g, s, e]),
1230
- fields: F.useMemo(() => l.map((f, d) => ({
1221
+ }), [s, e, o, i]), {
1222
+ swap: V.useCallback(O, [g, s, e]),
1223
+ move: V.useCallback(N, [g, s, e]),
1224
+ prepend: V.useCallback(p, [g, s, e]),
1225
+ append: V.useCallback(S, [g, s, e]),
1226
+ remove: V.useCallback(I, [g, s, e]),
1227
+ insert: V.useCallback(R, [g, s, e]),
1228
+ update: V.useCallback(x, [g, s, e]),
1229
+ replace: V.useCallback(B, [g, s, e]),
1230
+ fields: V.useMemo(() => l.map((f, d) => ({
1231
1231
  ...f,
1232
- [u]: V.current[d] || ue()
1233
- })), [l, u])
1232
+ [o]: b.current[d] || ue()
1233
+ })), [l, o])
1234
1234
  };
1235
1235
  }
1236
1236
  function br(t = {}) {
1237
- const r = F.useRef(void 0), e = F.useRef(void 0), [s, u] = F.useState({
1237
+ const r = V.useRef(void 0), e = V.useRef(void 0), [s, o] = V.useState({
1238
1238
  isDirty: !1,
1239
1239
  isValidating: !1,
1240
- isLoading: G(t.defaultValues),
1240
+ isLoading: z(t.defaultValues),
1241
1241
  isSubmitted: !1,
1242
1242
  isSubmitting: !1,
1243
1243
  isSubmitSuccessful: !1,
@@ -1249,14 +1249,14 @@ function br(t = {}) {
1249
1249
  errors: t.errors || {},
1250
1250
  disabled: t.disabled || !1,
1251
1251
  isReady: !1,
1252
- defaultValues: G(t.defaultValues) ? void 0 : t.defaultValues
1252
+ defaultValues: z(t.defaultValues) ? void 0 : t.defaultValues
1253
1253
  });
1254
1254
  if (!r.current)
1255
1255
  if (t.formControl)
1256
1256
  r.current = {
1257
1257
  ...t.formControl,
1258
1258
  formState: s
1259
- }, t.defaultValues && !G(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1259
+ }, t.defaultValues && !z(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1260
1260
  else {
1261
1261
  const { formControl: c, ...l } = vr(t);
1262
1262
  r.current = {
@@ -1265,38 +1265,38 @@ function br(t = {}) {
1265
1265
  };
1266
1266
  }
1267
1267
  const i = r.current.control;
1268
- return i._options = t, ke(() => {
1268
+ return i._options = t, Ce(() => {
1269
1269
  const c = i._subscribe({
1270
1270
  formState: i._proxyFormState,
1271
- callback: () => u({ ...i._formState }),
1271
+ callback: () => o({ ...i._formState }),
1272
1272
  reRenderRoot: !0
1273
1273
  });
1274
- return u((l) => ({
1274
+ return o((l) => ({
1275
1275
  ...l,
1276
1276
  isReady: !0
1277
1277
  })), i._formState.isReady = !0, c;
1278
- }, [i]), F.useEffect(() => i._disableForm(t.disabled), [i, t.disabled]), F.useEffect(() => {
1278
+ }, [i]), V.useEffect(() => i._disableForm(t.disabled), [i, t.disabled]), V.useEffect(() => {
1279
1279
  t.mode && (i._options.mode = t.mode), t.reValidateMode && (i._options.reValidateMode = t.reValidateMode);
1280
- }, [i, t.mode, t.reValidateMode]), F.useEffect(() => {
1280
+ }, [i, t.mode, t.reValidateMode]), V.useEffect(() => {
1281
1281
  t.errors && (i._setErrors(t.errors), i._focusError());
1282
- }, [i, t.errors]), F.useEffect(() => {
1282
+ }, [i, t.errors]), V.useEffect(() => {
1283
1283
  t.shouldUnregister && i._subjects.state.next({
1284
1284
  values: i._getWatch()
1285
1285
  });
1286
- }, [i, t.shouldUnregister]), F.useEffect(() => {
1286
+ }, [i, t.shouldUnregister]), V.useEffect(() => {
1287
1287
  if (i._proxyFormState.isDirty) {
1288
1288
  const c = i._getDirty();
1289
1289
  c !== s.isDirty && i._subjects.state.next({
1290
1290
  isDirty: c
1291
1291
  });
1292
1292
  }
1293
- }, [i, s.isDirty]), F.useEffect(() => {
1293
+ }, [i, s.isDirty]), V.useEffect(() => {
1294
1294
  var c;
1295
1295
  t.values && !ae(t.values, e.current) ? (i._reset(t.values, {
1296
1296
  keepFieldsRef: !0,
1297
1297
  ...i._options.resetOptions
1298
- }), !((c = i._options.resetOptions) === null || c === void 0) && c.keepIsValid || i._setValid(), e.current = t.values, u((l) => ({ ...l }))) : i._resetDefaultValues();
1299
- }, [i, t.values]), F.useEffect(() => {
1298
+ }), !((c = i._options.resetOptions) === null || c === void 0) && c.keepIsValid || i._setValid(), e.current = t.values, o((l) => ({ ...l }))) : i._resetDefaultValues();
1299
+ }, [i, t.values]), V.useEffect(() => {
1300
1300
  i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1301
1301
  }), r.current.formState = Et(s, i), r.current;
1302
1302
  }
@@ -1307,7 +1307,7 @@ const Nt = zt(void 0), Ar = ({ showAsterisk: t, children: r }) => /* @__PURE__ *
1307
1307
  return t;
1308
1308
  };
1309
1309
  function Lt(t, r, e) {
1310
- const { conditions: s, operator: u } = e, i = t.reduce((l, v, V) => (l[v] = r[V], l), {}), c = s.map((l) => {
1310
+ const { conditions: s, operator: o } = e, i = t.reduce((l, v, b) => (l[v] = r[b], l), {}), c = s.map((l) => {
1311
1311
  const v = i[l.name];
1312
1312
  switch (l.operator) {
1313
1313
  case "EQUALS":
@@ -1334,92 +1334,98 @@ function Lt(t, r, e) {
1334
1334
  return !1;
1335
1335
  }
1336
1336
  });
1337
- return u === "AND" ? c.every(Boolean) : c.some(Boolean);
1337
+ return o === "AND" ? c.every(Boolean) : c.some(Boolean);
1338
1338
  }
1339
1339
  const xr = ({
1340
1340
  children: t,
1341
1341
  visibility: r
1342
1342
  }) => {
1343
- const e = ye(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Xe({ name: e });
1344
- return ye(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Lt(e, s, r), [r, e, s]) ? t : null;
1343
+ const e = me(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Xe({ name: e });
1344
+ return me(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Lt(e, s, r), [r, e, s]) ? t : null;
1345
1345
  }, Sr = ({
1346
1346
  children: t,
1347
1347
  disabled: r
1348
1348
  }) => {
1349
- const e = ye(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Xe({ name: e }), u = ye(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !1 : Lt(e, s, r), [r, e, s]);
1350
- return Ae(t, { ...t.props, disabled: u });
1349
+ const e = me(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Xe({ name: e }), o = me(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !1 : Lt(e, s, r), [r, e, s]);
1350
+ return Ae(t, { ...t.props, disabled: o });
1351
1351
  }, tt = ({
1352
1352
  children: t,
1353
1353
  name: r,
1354
1354
  rules: e,
1355
1355
  className: s = "",
1356
- label: u,
1356
+ label: o,
1357
1357
  id: i,
1358
- disabled: c,
1359
- shouldUnregister: l,
1360
- visibility: v,
1361
- description: V
1358
+ value: c,
1359
+ disabled: l,
1360
+ shouldUnregister: v,
1361
+ visibility: b,
1362
+ description: w
1362
1363
  }) => {
1363
- const { control: C } = Ve(), g = t.props.value ?? "", { showAsterisk: S } = pr(), p = t.props.onChange, I = t.props.onBlur, R = ye(() => i || crypto.randomUUID(), []), O = ye(() => {
1364
- if (V)
1365
- return typeof V == "string" ? { position: "LABEL_BOTTOM", text: V } : V;
1366
- }, [V]);
1367
- return /* @__PURE__ */ te(xr, { visibility: v, children: /* @__PURE__ */ te(Sr, { disabled: c, children: /* @__PURE__ */ te(
1364
+ const { control: g } = Fe(), S = typeof t == "function", p = S ? c ?? "" : t.props.value ?? "", { showAsterisk: I } = pr(), R = me(() => i || crypto.randomUUID(), []), O = me(() => {
1365
+ if (w)
1366
+ return typeof w == "string" ? { position: "LABEL_BOTTOM", text: w } : w;
1367
+ }, [w]);
1368
+ return /* @__PURE__ */ te(xr, { visibility: b, children: /* @__PURE__ */ te(Sr, { disabled: l, children: /* @__PURE__ */ te(
1368
1369
  ar,
1369
1370
  {
1370
- control: C,
1371
+ control: g,
1371
1372
  name: r,
1372
1373
  rules: e,
1373
- defaultValue: g,
1374
- shouldUnregister: l,
1375
- render: ({
1376
- field: { name: U, onBlur: x, value: B, onChange: f, ref: d, disabled: A },
1377
- fieldState: { error: w }
1378
- }) => /* @__PURE__ */ Ne(
1379
- "div",
1380
- {
1381
- className: `controlled-field ${s}`,
1382
- style: { display: "flex", flexDirection: "column", gap: "5px" },
1383
- children: [
1384
- /* @__PURE__ */ Ne(
1385
- "div",
1386
- {
1387
- className: "controlled-field-description",
1388
- style: {
1389
- display: "inline-flex",
1390
- ...O && {
1391
- gap: "2px",
1392
- alignItems: "center",
1393
- flexDirection: O.position === "LABEL_RIGHT" ? "row" : "column"
1394
- }
1374
+ defaultValue: p,
1375
+ shouldUnregister: v,
1376
+ render: (N) => {
1377
+ const {
1378
+ field: { name: x, onBlur: B, value: f, onChange: d, ref: A, disabled: C },
1379
+ fieldState: { error: $ }
1380
+ } = N;
1381
+ return /* @__PURE__ */ Ne(
1382
+ "div",
1383
+ {
1384
+ className: `controlled-field ${s}`,
1385
+ style: { display: "flex", flexDirection: "column", gap: "5px" },
1386
+ children: [
1387
+ /* @__PURE__ */ Ne(
1388
+ "div",
1389
+ {
1390
+ className: "controlled-field-description",
1391
+ style: {
1392
+ display: "inline-flex",
1393
+ ...O && {
1394
+ gap: "2px",
1395
+ alignItems: "center",
1396
+ flexDirection: O.position === "LABEL_RIGHT" ? "row" : "column"
1397
+ }
1398
+ },
1399
+ children: [
1400
+ o && /* @__PURE__ */ Ne("label", { htmlFor: R, className: "controlled-field-label", children: [
1401
+ o,
1402
+ I && !!e && /* @__PURE__ */ te("span", { style: { color: "red" }, children: " *" })
1403
+ ] }),
1404
+ O && O.position !== "CONTROL_BOTTOM" && /* @__PURE__ */ te("span", { style: { color: "#a1a1a1", fontSize: 12 }, children: O.text })
1405
+ ]
1406
+ }
1407
+ ),
1408
+ S ? t(N) : Ae(t, {
1409
+ ...t.props,
1410
+ id: R,
1411
+ name: x,
1412
+ disabled: C,
1413
+ onChange: (...q) => {
1414
+ var j, ne;
1415
+ d(...q), (ne = (j = t.props).onChange) == null || ne.call(j, ...q);
1395
1416
  },
1396
- children: [
1397
- u && /* @__PURE__ */ Ne("label", { htmlFor: R, className: "controlled-field-label", children: [
1398
- u,
1399
- S && !!e && /* @__PURE__ */ te("span", { style: { color: "red" }, children: " *" })
1400
- ] }),
1401
- O && O.position !== "CONTROL_BOTTOM" && /* @__PURE__ */ te("span", { style: { color: "#a1a1a1", fontSize: 12 }, children: O.text })
1402
- ]
1403
- }
1404
- ),
1405
- Ae(t, {
1406
- ...t.props,
1407
- id: R,
1408
- name: U,
1409
- disabled: A,
1410
- onChange: (...W) => {
1411
- f(...W), p == null || p(...W);
1412
- },
1413
- value: B,
1414
- onBlur: (...W) => {
1415
- x(), I == null || I(...W);
1416
- },
1417
- ref: d
1418
- }),
1419
- w && /* @__PURE__ */ te("div", { style: { color: "red", fontSize: 13 }, className: "controlled-field-error", children: w.message })
1420
- ]
1421
- }
1422
- )
1417
+ value: f,
1418
+ onBlur: (...q) => {
1419
+ var j, ne;
1420
+ B(), (ne = (j = t.props).onBlur) == null || ne.call(j, ...q);
1421
+ },
1422
+ ref: A
1423
+ }),
1424
+ $ && /* @__PURE__ */ te("div", { style: { color: "red", fontSize: 13 }, className: "controlled-field-error", children: $.message })
1425
+ ]
1426
+ }
1427
+ );
1428
+ }
1423
1429
  }
1424
1430
  ) }) });
1425
1431
  };
@@ -1429,7 +1435,7 @@ const Er = ({
1429
1435
  rules: r,
1430
1436
  ref: e,
1431
1437
  children: s,
1432
- visibility: u,
1438
+ visibility: o,
1433
1439
  disabled: i
1434
1440
  }) => {
1435
1441
  const c = Fr({
@@ -1437,48 +1443,48 @@ const Er = ({
1437
1443
  rules: r
1438
1444
  });
1439
1445
  At(e, () => c, [JSON.stringify(c)]);
1440
- const l = (v, V) => Kt.map(v, (C) => {
1446
+ const l = (v, b) => Kt.map(v, (w) => {
1441
1447
  var I, R;
1442
- if (!Yt(C))
1443
- return C;
1444
- const g = C.props, S = C.type;
1448
+ if (!Yt(w))
1449
+ return w;
1450
+ const g = w.props, S = w.type;
1445
1451
  if (((S == null ? void 0 : S.displayName) === "SuprFormControl" || S === tt || g.name !== void 0 && typeof S != "string") && g.name !== void 0) {
1446
- const O = u ? u[g.name] : void 0, U = O ? {
1452
+ const O = o ? o[g.name] : void 0, N = O ? {
1447
1453
  ...O,
1448
1454
  conditions: ((I = O.conditions) == null ? void 0 : I.map((d) => ({
1449
1455
  ...d,
1450
- name: `${V}${d.name}`
1456
+ name: `${b}${d.name}`
1451
1457
  }))) || []
1452
1458
  } : void 0, x = i ? i[g.name] : void 0, B = x ? {
1453
1459
  ...x,
1454
1460
  conditions: ((R = x.conditions) == null ? void 0 : R.map((d) => ({
1455
1461
  ...d,
1456
- name: `${V}${d.name}`
1462
+ name: `${b}${d.name}`
1457
1463
  }))) || []
1458
1464
  } : void 0, f = {
1459
1465
  ...g,
1460
- name: `${V}${g.name}`,
1461
- visibility: U,
1466
+ name: `${b}${g.name}`,
1467
+ visibility: N,
1462
1468
  disabled: B
1463
1469
  };
1464
- return g.id !== void 0 && (f.id = `${V}${g.id}`), Ae(C, f);
1470
+ return g.id !== void 0 && (f.id = `${b}${g.id}`), Ae(w, f);
1465
1471
  }
1466
- return g.children ? Ae(C, {
1472
+ return g.children ? Ae(w, {
1467
1473
  ...g,
1468
- children: l(g.children, V)
1469
- }) : C;
1474
+ children: l(g.children, b)
1475
+ }) : w;
1470
1476
  });
1471
- return /* @__PURE__ */ te(Qt, { children: c.fields.map((v, V) => {
1472
- const C = `${t}.${V}.`;
1477
+ return /* @__PURE__ */ te(Qt, { children: c.fields.map((v, b) => {
1478
+ const w = `${t}.${b}.`;
1473
1479
  return /* @__PURE__ */ te(
1474
1480
  "div",
1475
1481
  {
1476
- "data-index": V,
1482
+ "data-index": b,
1477
1483
  style: { display: "contents" },
1478
1484
  id: "field-array-item",
1479
- children: l(s, C)
1485
+ children: l(s, w)
1480
1486
  },
1481
- C
1487
+ w
1482
1488
  );
1483
1489
  }) });
1484
1490
  }, Ut = ({
@@ -1486,7 +1492,7 @@ const Er = ({
1486
1492
  style: r = {},
1487
1493
  className: e = "",
1488
1494
  formOptions: s,
1489
- showAsterisk: u,
1495
+ showAsterisk: o,
1490
1496
  ref: i,
1491
1497
  onChange: c
1492
1498
  }) => {
@@ -1514,11 +1520,11 @@ const Er = ({
1514
1520
  }),
1515
1521
  [JSON.stringify(l)]
1516
1522
  ), Xt(() => {
1517
- const v = l.watch((V) => {
1518
- c == null || c(V);
1523
+ const v = l.watch((b) => {
1524
+ c == null || c(b);
1519
1525
  });
1520
1526
  return () => v.unsubscribe();
1521
- }, [l.watch]), /* @__PURE__ */ te(Ar, { showAsterisk: u, children: /* @__PURE__ */ te(tr, { ...l, children: /* @__PURE__ */ te("div", { style: r, className: e, children: t }) }) });
1527
+ }, [l.watch]), /* @__PURE__ */ te(Ar, { showAsterisk: o, children: /* @__PURE__ */ te(tr, { ...l, children: /* @__PURE__ */ te("div", { style: r, className: e, children: t }) }) });
1522
1528
  };
1523
1529
  Ut.Control = tt;
1524
1530
  Ut.ControlArray = Er;