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