dgz-ui-shared 1.1.19 → 1.1.21

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.
Files changed (82) hide show
  1. package/dist/{Actions-1AyyAnYT.js → Actions-CKVu3P3q.js} +6 -6
  2. package/dist/Actions-uGf1oq7E.cjs +1 -0
  3. package/dist/{DateRangePicker-kaBfJaKY.cjs → DateRangePicker-C1c1mofH.cjs} +3 -3
  4. package/dist/{DateRangePicker-D57HSCpq.js → DateRangePicker-DFsQ10c7.js} +5 -5
  5. package/dist/{ExportData-dSwR1N1v.js → ExportData-1xS2UAoq.js} +6 -6
  6. package/dist/ExportData-ApStkEWC.cjs +1 -0
  7. package/dist/{FilterWrapper-DeQRSTAc.js → FilterWrapper-Dk18nVPy.js} +31 -31
  8. package/dist/{FilterWrapper-B6p9fJWb.cjs → FilterWrapper-DvNjUQih.cjs} +5 -5
  9. package/dist/{MyInput-BzXWiSVj.cjs → MyInput-9MnlVZ4h.cjs} +1 -1
  10. package/dist/{MyInput-CkiPA3UG.js → MyInput-B-QCpehg.js} +57 -57
  11. package/dist/{MyLimitSelect-DHyIJawN.cjs → MyLimitSelect-BU1FClXt.cjs} +2 -2
  12. package/dist/{MyLimitSelect-XMVeSEqs.js → MyLimitSelect-D5ZWDY-s.js} +13 -13
  13. package/dist/{MySelect-Bmw1Krye.js → MySelect-C5uWRVJh.js} +7 -7
  14. package/dist/MySelect-DNK997Bi.cjs +1 -0
  15. package/dist/{button-2punbuN6-BBVynxVj.cjs → button-CdZDBhmr-3yMPCRDo.cjs} +1 -1
  16. package/dist/{button-2punbuN6-Bxlf8sMg.js → button-CdZDBhmr-BT_j3ig5.js} +7 -7
  17. package/dist/{chevron-right-HWBijj-I-Bdcofm_0.cjs → chevron-right-HWBijj-I-CZBu0GKg.cjs} +1 -1
  18. package/dist/{chevron-right-HWBijj-I-Bkp_tbGM.js → chevron-right-HWBijj-I-DsFUufdU.js} +1 -1
  19. package/dist/components/actions/index.cjs.js +1 -1
  20. package/dist/components/actions/index.es.js +1 -1
  21. package/dist/components/confirm/index.cjs.js +1 -1
  22. package/dist/components/confirm/index.es.js +1 -1
  23. package/dist/components/datatable/index.cjs.js +5 -5
  24. package/dist/components/datatable/index.es.js +204 -201
  25. package/dist/components/datepicker/index.cjs.js +1 -1
  26. package/dist/components/datepicker/index.es.js +1 -1
  27. package/dist/components/export/index.cjs.js +1 -1
  28. package/dist/components/export/index.es.js +1 -1
  29. package/dist/components/filters/index.cjs.js +1 -1
  30. package/dist/components/filters/index.es.js +6 -6
  31. package/dist/components/form/index.cjs.js +2 -2
  32. package/dist/components/form/index.es.js +33 -33
  33. package/dist/components/modal/index.cjs.js +2 -2
  34. package/dist/components/modal/index.es.js +7 -7
  35. package/dist/components/pagination/index.cjs.js +1 -1
  36. package/dist/components/pagination/index.es.js +1 -1
  37. package/dist/components/theme/index.cjs.js +3 -3
  38. package/dist/components/theme/index.es.js +4 -4
  39. package/dist/components/tooltip/index.cjs.js +1 -1
  40. package/dist/components/tooltip/index.es.js +44 -44
  41. package/dist/{createLucideIcon-B950nf2d-Brk4LIHH.js → createLucideIcon-B950nf2d-9wLYOF5y.js} +1 -1
  42. package/dist/{createLucideIcon-B950nf2d-BaIaB_Fz.cjs → createLucideIcon-B950nf2d-DrrWmvZU.cjs} +4 -4
  43. package/dist/dropdown-menu-TWRSm6RK-DQ03CnVw.cjs +1 -0
  44. package/dist/{dropdown-menu-lArmcWbC-jIg7CHSO.js → dropdown-menu-TWRSm6RK-D_FJpI4C.js} +83 -83
  45. package/dist/hooks/index.cjs.js +1 -1
  46. package/dist/hooks/index.es.js +2 -2
  47. package/dist/{index-CiR6yUKf-BEMUeikM.js → index-BL59b1Bz-C9bJE_xn.js} +90 -90
  48. package/dist/{index-CiR6yUKf-B1h5S0LB.cjs → index-BL59b1Bz-COeLljOH.cjs} +4 -4
  49. package/dist/{index-DUK8Bn0m-Clp83x2_.js → index-C4qYhCZt-BZQduTld.js} +29 -29
  50. package/dist/index-C4qYhCZt-DWBiWQ93.cjs +5 -0
  51. package/dist/index-CbK6da4c-QXbo5Vgb.cjs +1 -0
  52. package/dist/{index-Dp0y0FJw-B42jTfO0.js → index-CbK6da4c-d_6FdYZH.js} +1 -1
  53. package/dist/{index-GjjxAtgk-Dl4JPPHK.js → index-Cths1nBq-BUfZy21E.js} +71 -71
  54. package/dist/index-Cths1nBq-DzDn15YE.cjs +11 -0
  55. package/dist/{index-CMHo7s91-D6S6dZoG.cjs → index-ZsCkaYy6-Bjyf2SZs.cjs} +1 -1
  56. package/dist/{index-CMHo7s91-BRFfxKgJ.js → index-ZsCkaYy6-Cw9HUeiu.js} +1 -1
  57. package/dist/index.esm-CQEA7FC8.js +1007 -0
  58. package/dist/index.esm-TI7V1a5F.cjs +1 -0
  59. package/dist/{input-mask-Chc-UIWX-Br4gXX2T.js → input-mask-DBLFIvhN-BBxoZxnd.js} +3738 -3687
  60. package/dist/input-mask-DBLFIvhN-C_0RAR2l.cjs +190 -0
  61. package/dist/{popover-Dvg-QyCn-CJ3lAD8Q.js → popover-OZcfKDD9-C2PVWPLS.js} +17 -17
  62. package/dist/popover-OZcfKDD9-KUWOsIOs.cjs +1 -0
  63. package/dist/{react-select-CKazfTiF-1EhjhhlL.js → react-select-DVPHHTAP-D2u3DqGr.js} +2 -2
  64. package/dist/{react-select-CKazfTiF-Bb-Uf4tM.cjs → react-select-DVPHHTAP-DKDInFsM.cjs} +9 -9
  65. package/dist/types/components/datatable/DataTable.d.ts +1 -1
  66. package/dist/types/components/datatable/DataTable.d.ts.map +1 -1
  67. package/dist/{unstyled-4GbbDand.cjs → unstyled-BFCMBSGZ.cjs} +2 -2
  68. package/dist/{unstyled-Cmnf9U5U.js → unstyled-BMbrfzye.js} +42 -42
  69. package/dist/{useFilter-CiORTEHP.cjs → useFilter-Cwz8oftI.cjs} +1 -1
  70. package/dist/{useFilter-DMpxv27U.js → useFilter-DJunNBm2.js} +1 -1
  71. package/package.json +2 -2
  72. package/dist/Actions-Dg5LYo56.cjs +0 -1
  73. package/dist/ExportData-DUuHYzA-.cjs +0 -1
  74. package/dist/MySelect-lSICw49W.cjs +0 -1
  75. package/dist/dropdown-menu-lArmcWbC-DCwGoXng.cjs +0 -1
  76. package/dist/index-DUK8Bn0m-BIulOZIQ.cjs +0 -5
  77. package/dist/index-Dp0y0FJw-DVwS4FcV.cjs +0 -1
  78. package/dist/index-GjjxAtgk-DaxZek3n.cjs +0 -11
  79. package/dist/index.esm-CpcLzfLZ.cjs +0 -1
  80. package/dist/index.esm-lbl2HgR1.js +0 -970
  81. package/dist/input-mask-Chc-UIWX-DimBl_dd.cjs +0 -190
  82. package/dist/popover-Dvg-QyCn-Dr2o9oAG.cjs +0 -1
@@ -0,0 +1,1007 @@
1
+ import B from "react";
2
+ var de = (e) => e.type === "checkbox", re = (e) => e instanceof Date, I = (e) => e == null;
3
+ const tt = (e) => typeof e == "object";
4
+ var S = (e) => !I(e) && !Array.isArray(e) && tt(e) && !re(e), _t = (e) => S(e) && e.target ? de(e.target) ? e.target.checked : e.target.value : e, Vt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ft = (e, s) => e.has(Vt(s)), At = (e) => {
5
+ const s = e.constructor && e.constructor.prototype;
6
+ return S(s) && s.hasOwnProperty("isPrototypeOf");
7
+ }, Se = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function C(e) {
9
+ let s;
10
+ const r = Array.isArray(e), a = typeof FileList < "u" ? e instanceof FileList : !1;
11
+ if (e instanceof Date)
12
+ s = new Date(e);
13
+ else if (!(Se && (e instanceof Blob || a)) && (r || S(e)))
14
+ if (s = r ? [] : Object.create(Object.getPrototypeOf(e)), !r && !At(e))
15
+ s = e;
16
+ else
17
+ for (const u in e)
18
+ e.hasOwnProperty(u) && (s[u] = C(e[u]));
19
+ else
20
+ return e;
21
+ return s;
22
+ }
23
+ var be = (e) => /^\w*$/.test(e), D = (e) => e === void 0, Oe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Te = (e) => Oe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, s, r) => {
24
+ if (!s || !S(e))
25
+ return r;
26
+ const a = (be(s) ? [s] : Te(s)).reduce((u, n) => I(u) ? u : u[n], e);
27
+ return D(a) || a === e ? D(e[s]) ? r : e[s] : a;
28
+ }, Y = (e) => typeof e == "boolean", m = (e, s, r) => {
29
+ let a = -1;
30
+ const u = be(s) ? [s] : Te(s), n = u.length, d = n - 1;
31
+ for (; ++a < n; ) {
32
+ const y = u[a];
33
+ let U = r;
34
+ if (a !== d) {
35
+ const p = e[y];
36
+ U = S(p) || Array.isArray(p) ? p : isNaN(+u[a + 1]) ? {} : [];
37
+ }
38
+ if (y === "__proto__" || y === "constructor" || y === "prototype")
39
+ return;
40
+ e[y] = U, e = e[y];
41
+ }
42
+ };
43
+ const pe = {
44
+ BLUR: "blur",
45
+ FOCUS_OUT: "focusout"
46
+ }, W = {
47
+ onBlur: "onBlur",
48
+ onChange: "onChange",
49
+ onSubmit: "onSubmit",
50
+ onTouched: "onTouched",
51
+ all: "all"
52
+ }, J = {
53
+ max: "max",
54
+ min: "min",
55
+ maxLength: "maxLength",
56
+ minLength: "minLength",
57
+ pattern: "pattern",
58
+ required: "required",
59
+ validate: "validate"
60
+ }, xt = B.createContext(null);
61
+ xt.displayName = "HookFormContext";
62
+ var mt = (e, s, r, a = !0) => {
63
+ const u = {
64
+ defaultValues: s._defaultValues
65
+ };
66
+ for (const n in e)
67
+ Object.defineProperty(u, n, {
68
+ get: () => {
69
+ const d = n;
70
+ return s._proxyFormState[d] !== W.all && (s._proxyFormState[d] = !a || W.all), e[d];
71
+ }
72
+ });
73
+ return u;
74
+ };
75
+ const wt = typeof window < "u" ? B.useLayoutEffect : B.useEffect;
76
+ var N = (e) => typeof e == "string", Dt = (e, s, r, a, u) => N(e) ? (a && s.watch.add(e), h(r, e, u)) : Array.isArray(e) ? e.map((n) => (a && s.watch.add(n), h(r, n))) : (a && (s.watchAll = !0), r), ke = (e) => I(e) || !tt(e);
77
+ function ee(e, s, r = /* @__PURE__ */ new WeakSet()) {
78
+ if (ke(e) || ke(s))
79
+ return Object.is(e, s);
80
+ if (re(e) && re(s))
81
+ return e.getTime() === s.getTime();
82
+ const a = Object.keys(e), u = Object.keys(s);
83
+ if (a.length !== u.length)
84
+ return !1;
85
+ if (r.has(e) || r.has(s))
86
+ return !0;
87
+ r.add(e), r.add(s);
88
+ for (const n of a) {
89
+ const d = e[n];
90
+ if (!u.includes(n))
91
+ return !1;
92
+ if (n !== "ref") {
93
+ const y = s[n];
94
+ if (re(d) && re(y) || S(d) && S(y) || Array.isArray(d) && Array.isArray(y) ? !ee(d, y, r) : !Object.is(d, y))
95
+ return !1;
96
+ }
97
+ }
98
+ return !0;
99
+ }
100
+ var kt = (e, s, r, a, u) => s ? {
101
+ ...r[e],
102
+ types: {
103
+ ...r[e] && r[e].types ? r[e].types : {},
104
+ [a]: u || !0
105
+ }
106
+ } : {}, oe = (e) => Array.isArray(e) ? e : [e], $e = () => {
107
+ let e = [];
108
+ return {
109
+ get observers() {
110
+ return e;
111
+ },
112
+ next: (u) => {
113
+ for (const n of e)
114
+ n.next && n.next(u);
115
+ },
116
+ subscribe: (u) => (e.push(u), {
117
+ unsubscribe: () => {
118
+ e = e.filter((n) => n !== u);
119
+ }
120
+ }),
121
+ unsubscribe: () => {
122
+ e = [];
123
+ }
124
+ };
125
+ };
126
+ function rt(e, s) {
127
+ const r = {};
128
+ for (const a in e)
129
+ if (e.hasOwnProperty(a)) {
130
+ const u = e[a], n = s[a];
131
+ if (u && S(u) && n) {
132
+ const d = rt(u, n);
133
+ S(d) && (r[a] = d);
134
+ } else e[a] && (r[a] = n);
135
+ }
136
+ return r;
137
+ }
138
+ var R = (e) => S(e) && !Object.keys(e).length, Ce = (e) => e.type === "file", H = (e) => typeof e == "function", ge = (e) => {
139
+ if (!Se)
140
+ return !1;
141
+ const s = e ? e.ownerDocument : 0;
142
+ return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
143
+ }, st = (e) => e.type === "select-multiple", Le = (e) => e.type === "radio", Et = (e) => Le(e) || de(e), De = (e) => ge(e) && e.isConnected;
144
+ function St(e, s) {
145
+ const r = s.slice(0, -1).length;
146
+ let a = 0;
147
+ for (; a < r; )
148
+ e = D(e) ? a++ : e[s[a++]];
149
+ return e;
150
+ }
151
+ function Ot(e) {
152
+ for (const s in e)
153
+ if (e.hasOwnProperty(s) && !D(e[s]))
154
+ return !1;
155
+ return !0;
156
+ }
157
+ function E(e, s) {
158
+ const r = Array.isArray(s) ? s : be(s) ? [s] : Te(s), a = r.length === 1 ? e : St(e, r), u = r.length - 1, n = r[u];
159
+ return a && delete a[n], u !== 0 && (S(a) && R(a) || Array.isArray(a) && Ot(a)) && E(e, r.slice(0, -1)), e;
160
+ }
161
+ var Tt = (e) => {
162
+ for (const s in e)
163
+ if (H(e[s]))
164
+ return !0;
165
+ return !1;
166
+ };
167
+ function it(e) {
168
+ return Array.isArray(e) || S(e) && !Tt(e);
169
+ }
170
+ function Ee(e, s = {}) {
171
+ for (const r in e) {
172
+ const a = e[r];
173
+ it(a) ? (s[r] = Array.isArray(a) ? [] : {}, Ee(a, s[r])) : D(a) || (s[r] = !0);
174
+ }
175
+ return s;
176
+ }
177
+ function ae(e, s, r) {
178
+ r || (r = Ee(s));
179
+ for (const a in e) {
180
+ const u = e[a];
181
+ if (it(u))
182
+ D(s) || ke(r[a]) ? r[a] = Ee(u, Array.isArray(u) ? [] : {}) : ae(u, I(s) ? {} : s[a], r[a]);
183
+ else {
184
+ const n = s[a];
185
+ r[a] = !ee(u, n);
186
+ }
187
+ }
188
+ return r;
189
+ }
190
+ const Ke = {
191
+ value: !1,
192
+ isValid: !1
193
+ }, ze = { value: !0, isValid: !0 };
194
+ var at = (e) => {
195
+ if (Array.isArray(e)) {
196
+ if (e.length > 1) {
197
+ const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
198
+ return { value: s, isValid: !!s.length };
199
+ }
200
+ return e[0].checked && !e[0].disabled ? (
201
+ // @ts-expect-error expected to work in the browser
202
+ e[0].attributes && !D(e[0].attributes.value) ? D(e[0].value) || e[0].value === "" ? ze : { value: e[0].value, isValid: !0 } : ze
203
+ ) : Ke;
204
+ }
205
+ return Ke;
206
+ }, lt = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: a }) => D(e) ? e : s ? e === "" ? NaN : e && +e : r && N(e) ? new Date(e) : a ? a(e) : e;
207
+ const Ye = {
208
+ isValid: !1,
209
+ value: null
210
+ };
211
+ var nt = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disabled ? {
212
+ isValid: !0,
213
+ value: r.value
214
+ } : s, Ye) : Ye;
215
+ function je(e) {
216
+ const s = e.ref;
217
+ return Ce(s) ? s.files : Le(s) ? nt(e.refs).value : st(s) ? [...s.selectedOptions].map(({ value: r }) => r) : de(s) ? at(e.refs).value : lt(D(s.value) ? e.ref.value : s.value, e);
218
+ }
219
+ var Ct = (e, s, r, a) => {
220
+ const u = {};
221
+ for (const n of e) {
222
+ const d = h(s, n);
223
+ d && m(u, n, d._f);
224
+ }
225
+ return {
226
+ criteriaMode: r,
227
+ names: [...e],
228
+ fields: u,
229
+ shouldUseNativeValidation: a
230
+ };
231
+ }, ve = (e) => e instanceof RegExp, ue = (e) => D(e) ? e : ve(e) ? e.source : S(e) ? ve(e.value) ? e.value.source : e.value : e, Je = (e) => ({
232
+ isOnSubmit: !e || e === W.onSubmit,
233
+ isOnBlur: e === W.onBlur,
234
+ isOnChange: e === W.onChange,
235
+ isOnAll: e === W.all,
236
+ isOnTouch: e === W.onTouched
237
+ });
238
+ const Qe = "AsyncFunction";
239
+ var Lt = (e) => !!e && !!e.validate && !!(H(e.validate) && e.validate.constructor.name === Qe || S(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === Qe)), Rt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Xe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((a) => e.startsWith(a) && /^\.\w+/.test(e.slice(a.length))));
240
+ const fe = (e, s, r, a) => {
241
+ for (const u of r || Object.keys(e)) {
242
+ const n = h(e, u);
243
+ if (n) {
244
+ const { _f: d, ...y } = n;
245
+ if (d) {
246
+ if (d.refs && d.refs[0] && s(d.refs[0], u) && !a)
247
+ return !0;
248
+ if (d.ref && s(d.ref, d.name) && !a)
249
+ return !0;
250
+ if (fe(y, s))
251
+ break;
252
+ } else if (S(y) && fe(y, s))
253
+ break;
254
+ }
255
+ }
256
+ };
257
+ function Ze(e, s, r) {
258
+ const a = h(e, r);
259
+ if (a || be(r))
260
+ return {
261
+ error: a,
262
+ name: r
263
+ };
264
+ const u = r.split(".");
265
+ for (; u.length; ) {
266
+ const n = u.join("."), d = h(s, n), y = h(e, n);
267
+ if (d && !Array.isArray(d) && r !== n)
268
+ return { name: r };
269
+ if (y && y.type)
270
+ return {
271
+ name: n,
272
+ error: y
273
+ };
274
+ if (y && y.root && y.root.type)
275
+ return {
276
+ name: `${n}.root`,
277
+ error: y.root
278
+ };
279
+ u.pop();
280
+ }
281
+ return {
282
+ name: r
283
+ };
284
+ }
285
+ var Ut = (e, s, r, a) => {
286
+ r(e);
287
+ const { name: u, ...n } = e;
288
+ return R(n) || Object.keys(n).length >= Object.keys(s).length || Object.keys(n).find((d) => s[d] === (!a || W.all));
289
+ }, Mt = (e, s, r) => !e || !s || e === s || oe(e).some((a) => a && (r ? a === s : a.startsWith(s) || s.startsWith(a))), It = (e, s, r, a, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? a.isOnBlur : u.isOnBlur) ? !e : (r ? a.isOnChange : u.isOnChange) ? e : !0, Bt = (e, s) => !Oe(h(e, s)).length && E(e, s), Nt = (e, s, r) => {
290
+ const a = oe(h(e, r));
291
+ return m(a, "root", s[r]), m(e, r, a), e;
292
+ };
293
+ function Ge(e, s, r = "validate") {
294
+ if (N(e) || Array.isArray(e) && e.every(N) || Y(e) && !e)
295
+ return {
296
+ type: r,
297
+ message: N(e) ? e : "",
298
+ ref: s
299
+ };
300
+ }
301
+ var ie = (e) => S(e) && !ve(e) ? e : {
302
+ value: e,
303
+ message: ""
304
+ }, et = async (e, s, r, a, u, n) => {
305
+ const { ref: d, refs: y, required: U, maxLength: p, minLength: x, min: k, max: v, pattern: le, validate: Q, name: O, valueAsNumber: X, mount: _e } = e._f, _ = h(r, O);
306
+ if (!_e || s.has(O))
307
+ return {};
308
+ const j = y ? y[0] : d, $ = (b) => {
309
+ u && j.reportValidity && (j.setCustomValidity(Y(b) ? "" : b || ""), j.reportValidity());
310
+ }, T = {}, ce = Le(d), Z = de(d), Ve = ce || Z, q = (X || Ce(d)) && D(d.value) && D(_) || ge(d) && d.value === "" || _ === "" || Array.isArray(_) && !_.length, te = kt.bind(null, O, a, T), K = (b, F, w, L = J.maxLength, M = J.minLength) => {
311
+ const z = b ? F : w;
312
+ T[O] = {
313
+ type: b ? L : M,
314
+ message: z,
315
+ ref: d,
316
+ ...te(b ? L : M, z)
317
+ };
318
+ };
319
+ if (n ? !Array.isArray(_) || !_.length : U && (!Ve && (q || I(_)) || Y(_) && !_ || Z && !at(y).isValid || ce && !nt(y).isValid)) {
320
+ const { value: b, message: F } = N(U) ? { value: !!U, message: U } : ie(U);
321
+ if (b && (T[O] = {
322
+ type: J.required,
323
+ message: F,
324
+ ref: j,
325
+ ...te(J.required, F)
326
+ }, !a))
327
+ return $(F), T;
328
+ }
329
+ if (!q && (!I(k) || !I(v))) {
330
+ let b, F;
331
+ const w = ie(v), L = ie(k);
332
+ if (!I(_) && !isNaN(_)) {
333
+ const M = d.valueAsNumber || _ && +_;
334
+ I(w.value) || (b = M > w.value), I(L.value) || (F = M < L.value);
335
+ } else {
336
+ const M = d.valueAsDate || new Date(_), z = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), ne = d.type == "time", se = d.type == "week";
337
+ N(w.value) && _ && (b = ne ? z(_) > z(w.value) : se ? _ > w.value : M > new Date(w.value)), N(L.value) && _ && (F = ne ? z(_) < z(L.value) : se ? _ < L.value : M < new Date(L.value));
338
+ }
339
+ if ((b || F) && (K(!!b, w.message, L.message, J.max, J.min), !a))
340
+ return $(T[O].message), T;
341
+ }
342
+ if ((p || x) && !q && (N(_) || n && Array.isArray(_))) {
343
+ const b = ie(p), F = ie(x), w = !I(b.value) && _.length > +b.value, L = !I(F.value) && _.length < +F.value;
344
+ if ((w || L) && (K(w, b.message, F.message), !a))
345
+ return $(T[O].message), T;
346
+ }
347
+ if (le && !q && N(_)) {
348
+ const { value: b, message: F } = ie(le);
349
+ if (ve(b) && !_.match(b) && (T[O] = {
350
+ type: J.pattern,
351
+ message: F,
352
+ ref: d,
353
+ ...te(J.pattern, F)
354
+ }, !a))
355
+ return $(F), T;
356
+ }
357
+ if (Q) {
358
+ if (H(Q)) {
359
+ const b = await Q(_, r), F = Ge(b, j);
360
+ if (F && (T[O] = {
361
+ ...F,
362
+ ...te(J.validate, F.message)
363
+ }, !a))
364
+ return $(F.message), T;
365
+ } else if (S(Q)) {
366
+ let b = {};
367
+ for (const F in Q) {
368
+ if (!R(b) && !a)
369
+ break;
370
+ const w = Ge(await Q[F](_, r), j, F);
371
+ w && (b = {
372
+ ...w,
373
+ ...te(F, w.message)
374
+ }, $(w.message), a && (T[O] = b));
375
+ }
376
+ if (!R(b) && (T[O] = {
377
+ ref: j,
378
+ ...b
379
+ }, !a))
380
+ return T;
381
+ }
382
+ }
383
+ return $(!0), T;
384
+ };
385
+ const Pt = {
386
+ mode: W.onSubmit,
387
+ reValidateMode: W.onChange,
388
+ shouldFocusError: !0
389
+ };
390
+ function qt(e = {}) {
391
+ let s = {
392
+ ...Pt,
393
+ ...e
394
+ }, r = {
395
+ submitCount: 0,
396
+ isDirty: !1,
397
+ isReady: !1,
398
+ isLoading: H(s.defaultValues),
399
+ isValidating: !1,
400
+ isSubmitted: !1,
401
+ isSubmitting: !1,
402
+ isSubmitSuccessful: !1,
403
+ isValid: !1,
404
+ touchedFields: {},
405
+ dirtyFields: {},
406
+ validatingFields: {},
407
+ errors: s.errors || {},
408
+ disabled: s.disabled || !1
409
+ }, a = {}, u = S(s.defaultValues) || S(s.values) ? C(s.defaultValues || s.values) || {} : {}, n = s.shouldUnregister ? {} : C(u), d = {
410
+ action: !1,
411
+ mount: !1,
412
+ watch: !1
413
+ }, y = {
414
+ mount: /* @__PURE__ */ new Set(),
415
+ disabled: /* @__PURE__ */ new Set(),
416
+ unMount: /* @__PURE__ */ new Set(),
417
+ array: /* @__PURE__ */ new Set(),
418
+ watch: /* @__PURE__ */ new Set()
419
+ }, U, p = 0;
420
+ const x = {
421
+ isDirty: !1,
422
+ dirtyFields: !1,
423
+ validatingFields: !1,
424
+ touchedFields: !1,
425
+ isValidating: !1,
426
+ isValid: !1,
427
+ errors: !1
428
+ };
429
+ let k = {
430
+ ...x
431
+ };
432
+ const v = {
433
+ array: $e(),
434
+ state: $e()
435
+ }, le = s.criteriaMode === W.all, Q = (t) => (i) => {
436
+ clearTimeout(p), p = setTimeout(t, i);
437
+ }, O = async (t) => {
438
+ if (!s.disabled && (x.isValid || k.isValid || t)) {
439
+ const i = s.resolver ? R((await Z()).errors) : await q(a, !0);
440
+ i !== r.isValid && v.state.next({
441
+ isValid: i
442
+ });
443
+ }
444
+ }, X = (t, i) => {
445
+ !s.disabled && (x.isValidating || x.validatingFields || k.isValidating || k.validatingFields) && ((t || Array.from(y.mount)).forEach((l) => {
446
+ l && (i ? m(r.validatingFields, l, i) : E(r.validatingFields, l));
447
+ }), v.state.next({
448
+ validatingFields: r.validatingFields,
449
+ isValidating: !R(r.validatingFields)
450
+ }));
451
+ }, _e = (t, i = [], l, c, f = !0, o = !0) => {
452
+ if (c && l && !s.disabled) {
453
+ if (d.action = !0, o && Array.isArray(h(a, t))) {
454
+ const g = l(h(a, t), c.argA, c.argB);
455
+ f && m(a, t, g);
456
+ }
457
+ if (o && Array.isArray(h(r.errors, t))) {
458
+ const g = l(h(r.errors, t), c.argA, c.argB);
459
+ f && m(r.errors, t, g), Bt(r.errors, t);
460
+ }
461
+ if ((x.touchedFields || k.touchedFields) && o && Array.isArray(h(r.touchedFields, t))) {
462
+ const g = l(h(r.touchedFields, t), c.argA, c.argB);
463
+ f && m(r.touchedFields, t, g);
464
+ }
465
+ (x.dirtyFields || k.dirtyFields) && (r.dirtyFields = ae(u, n)), v.state.next({
466
+ name: t,
467
+ isDirty: K(t, i),
468
+ dirtyFields: r.dirtyFields,
469
+ errors: r.errors,
470
+ isValid: r.isValid
471
+ });
472
+ } else
473
+ m(n, t, i);
474
+ }, _ = (t, i) => {
475
+ m(r.errors, t, i), v.state.next({
476
+ errors: r.errors
477
+ });
478
+ }, j = (t) => {
479
+ r.errors = t, v.state.next({
480
+ errors: r.errors,
481
+ isValid: !1
482
+ });
483
+ }, $ = (t, i, l, c) => {
484
+ const f = h(a, t);
485
+ if (f) {
486
+ const o = h(n, t, D(l) ? h(u, t) : l);
487
+ D(o) || c && c.defaultChecked || i ? m(n, t, i ? o : je(f._f)) : w(t, o), d.mount && !d.action && O();
488
+ }
489
+ }, T = (t, i, l, c, f) => {
490
+ let o = !1, g = !1;
491
+ const V = {
492
+ name: t
493
+ };
494
+ if (!s.disabled) {
495
+ if (!l || c) {
496
+ (x.isDirty || k.isDirty) && (g = r.isDirty, r.isDirty = V.isDirty = K(), o = g !== V.isDirty);
497
+ const A = ee(h(u, t), i);
498
+ g = !!h(r.dirtyFields, t), A ? E(r.dirtyFields, t) : m(r.dirtyFields, t, !0), V.dirtyFields = r.dirtyFields, o = o || (x.dirtyFields || k.dirtyFields) && g !== !A;
499
+ }
500
+ if (l) {
501
+ const A = h(r.touchedFields, t);
502
+ A || (m(r.touchedFields, t, l), V.touchedFields = r.touchedFields, o = o || (x.touchedFields || k.touchedFields) && A !== l);
503
+ }
504
+ o && f && v.state.next(V);
505
+ }
506
+ return o ? V : {};
507
+ }, ce = (t, i, l, c) => {
508
+ const f = h(r.errors, t), o = (x.isValid || k.isValid) && Y(i) && r.isValid !== i;
509
+ if (s.delayError && l ? (U = Q(() => _(t, l)), U(s.delayError)) : (clearTimeout(p), U = null, l ? m(r.errors, t, l) : E(r.errors, t)), (l ? !ee(f, l) : f) || !R(c) || o) {
510
+ const g = {
511
+ ...c,
512
+ ...o && Y(i) ? { isValid: i } : {},
513
+ errors: r.errors,
514
+ name: t
515
+ };
516
+ r = {
517
+ ...r,
518
+ ...g
519
+ }, v.state.next(g);
520
+ }
521
+ }, Z = async (t) => {
522
+ X(t, !0);
523
+ const i = await s.resolver(n, s.context, Ct(t || y.mount, a, s.criteriaMode, s.shouldUseNativeValidation));
524
+ return X(t), i;
525
+ }, Ve = async (t) => {
526
+ const { errors: i } = await Z(t);
527
+ if (t)
528
+ for (const l of t) {
529
+ const c = h(i, l);
530
+ c ? m(r.errors, l, c) : E(r.errors, l);
531
+ }
532
+ else
533
+ r.errors = i;
534
+ return i;
535
+ }, q = async (t, i, l = {
536
+ valid: !0
537
+ }) => {
538
+ for (const c in t) {
539
+ const f = t[c];
540
+ if (f) {
541
+ const { _f: o, ...g } = f;
542
+ if (o) {
543
+ const V = y.array.has(o.name), A = f._f && Lt(f._f);
544
+ A && x.validatingFields && X([o.name], !0);
545
+ const P = await et(f, y.disabled, n, le, s.shouldUseNativeValidation && !i, V);
546
+ if (A && x.validatingFields && X([o.name]), P[o.name] && (l.valid = !1, i))
547
+ break;
548
+ !i && (h(P, o.name) ? V ? Nt(r.errors, P, o.name) : m(r.errors, o.name, P[o.name]) : E(r.errors, o.name));
549
+ }
550
+ !R(g) && await q(g, i, l);
551
+ }
552
+ }
553
+ return l.valid;
554
+ }, te = () => {
555
+ for (const t of y.unMount) {
556
+ const i = h(a, t);
557
+ i && (i._f.refs ? i._f.refs.every((l) => !De(l)) : !De(i._f.ref)) && Fe(t);
558
+ }
559
+ y.unMount = /* @__PURE__ */ new Set();
560
+ }, K = (t, i) => !s.disabled && (t && i && m(n, t, i), !ee(ye(), u)), b = (t, i, l) => Dt(t, y, {
561
+ ...d.mount ? n : D(i) ? u : N(t) ? { [t]: i } : i
562
+ }, l, i), F = (t) => Oe(h(d.mount ? n : u, t, s.shouldUnregister ? h(u, t, []) : [])), w = (t, i, l = {}) => {
563
+ const c = h(a, t);
564
+ let f = i;
565
+ if (c) {
566
+ const o = c._f;
567
+ o && (!o.disabled && m(n, t, lt(i, o)), f = ge(o.ref) && I(i) ? "" : i, st(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? de(o.ref) ? o.refs.forEach((g) => {
568
+ (!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((V) => V === g.value) : g.checked = f === g.value || !!f);
569
+ }) : o.refs.forEach((g) => g.checked = g.value === f) : Ce(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || v.state.next({
570
+ name: t,
571
+ values: C(n)
572
+ })));
573
+ }
574
+ (l.shouldDirty || l.shouldTouch) && T(t, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && se(t);
575
+ }, L = (t, i, l) => {
576
+ for (const c in i) {
577
+ if (!i.hasOwnProperty(c))
578
+ return;
579
+ const f = i[c], o = t + "." + c, g = h(a, o);
580
+ (y.array.has(t) || S(f) || g && !g._f) && !re(f) ? L(o, f, l) : w(o, f, l);
581
+ }
582
+ }, M = (t, i, l = {}) => {
583
+ const c = h(a, t), f = y.array.has(t), o = C(i);
584
+ m(n, t, o), f ? (v.array.next({
585
+ name: t,
586
+ values: C(n)
587
+ }), (x.isDirty || x.dirtyFields || k.isDirty || k.dirtyFields) && l.shouldDirty && v.state.next({
588
+ name: t,
589
+ dirtyFields: ae(u, n),
590
+ isDirty: K(t, o)
591
+ })) : c && !c._f && !I(o) ? L(t, o, l) : w(t, o, l), Xe(t, y) && v.state.next({ ...r, name: t }), v.state.next({
592
+ name: d.mount ? t : void 0,
593
+ values: C(n)
594
+ });
595
+ }, z = async (t) => {
596
+ d.mount = !0;
597
+ const i = t.target;
598
+ let l = i.name, c = !0;
599
+ const f = h(a, l), o = (A) => {
600
+ c = Number.isNaN(A) || re(A) && isNaN(A.getTime()) || ee(A, h(n, l, A));
601
+ }, g = Je(s.mode), V = Je(s.reValidateMode);
602
+ if (f) {
603
+ let A, P;
604
+ const he = i.type ? je(f._f) : _t(t), G = t.type === pe.BLUR || t.type === pe.FOCUS_OUT, gt = !Rt(f._f) && !s.resolver && !h(r.errors, l) && !f._f.deps || It(G, h(r.touchedFields, l), r.isSubmitted, V, g), me = Xe(l, y, G);
605
+ m(n, l, he), G ? (!i || !i.readOnly) && (f._f.onBlur && f._f.onBlur(t), U && U(0)) : f._f.onChange && f._f.onChange(t);
606
+ const we = T(l, he, G), vt = !R(we) || me;
607
+ if (!G && v.state.next({
608
+ name: l,
609
+ type: t.type,
610
+ values: C(n)
611
+ }), gt)
612
+ return (x.isValid || k.isValid) && (s.mode === "onBlur" ? G && O() : G || O()), vt && v.state.next({ name: l, ...me ? {} : we });
613
+ if (!G && me && v.state.next({ ...r }), s.resolver) {
614
+ const { errors: We } = await Z([l]);
615
+ if (o(he), c) {
616
+ const bt = Ze(r.errors, a, l), He = Ze(We, a, bt.name || l);
617
+ A = He.error, l = He.name, P = R(We);
618
+ }
619
+ } else
620
+ X([l], !0), A = (await et(f, y.disabled, n, le, s.shouldUseNativeValidation))[l], X([l]), o(he), c && (A ? P = !1 : (x.isValid || k.isValid) && (P = await q(a, !0)));
621
+ c && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && se(f._f.deps), ce(l, P, A, we));
622
+ }
623
+ }, ne = (t, i) => {
624
+ if (h(r.errors, i) && t.focus)
625
+ return t.focus(), 1;
626
+ }, se = async (t, i = {}) => {
627
+ let l, c;
628
+ const f = oe(t);
629
+ if (s.resolver) {
630
+ const o = await Ve(D(t) ? t : f);
631
+ l = R(o), c = t ? !f.some((g) => h(o, g)) : l;
632
+ } else t ? (c = (await Promise.all(f.map(async (o) => {
633
+ const g = h(a, o);
634
+ return await q(g && g._f ? { [o]: g } : g);
635
+ }))).every(Boolean), !(!c && !r.isValid) && O()) : c = l = await q(a);
636
+ return v.state.next({
637
+ ...!N(t) || (x.isValid || k.isValid) && l !== r.isValid ? {} : { name: t },
638
+ ...s.resolver || !t ? { isValid: l } : {},
639
+ errors: r.errors
640
+ }), i.shouldFocus && !c && fe(a, ne, t ? f : y.mount), c;
641
+ }, ye = (t, i) => {
642
+ let l = {
643
+ ...d.mount ? n : u
644
+ };
645
+ return i && (l = rt(i.dirtyFields ? r.dirtyFields : r.touchedFields, l)), D(t) ? l : N(t) ? h(l, t) : t.map((c) => h(l, c));
646
+ }, Re = (t, i) => ({
647
+ invalid: !!h((i || r).errors, t),
648
+ isDirty: !!h((i || r).dirtyFields, t),
649
+ error: h((i || r).errors, t),
650
+ isValidating: !!h(r.validatingFields, t),
651
+ isTouched: !!h((i || r).touchedFields, t)
652
+ }), ut = (t) => {
653
+ t && oe(t).forEach((i) => E(r.errors, i)), v.state.next({
654
+ errors: t ? r.errors : {}
655
+ });
656
+ }, Ue = (t, i, l) => {
657
+ const c = (h(a, t, { _f: {} })._f || {}).ref, f = h(r.errors, t) || {}, { ref: o, message: g, type: V, ...A } = f;
658
+ m(r.errors, t, {
659
+ ...A,
660
+ ...i,
661
+ ref: c
662
+ }), v.state.next({
663
+ name: t,
664
+ errors: r.errors,
665
+ isValid: !1
666
+ }), l && l.shouldFocus && c && c.focus && c.focus();
667
+ }, ot = (t, i) => H(t) ? v.state.subscribe({
668
+ next: (l) => "values" in l && t(b(void 0, i), l)
669
+ }) : b(t, i, !0), Me = (t) => v.state.subscribe({
670
+ next: (i) => {
671
+ Mt(t.name, i.name, t.exact) && Ut(i, t.formState || x, ht, t.reRenderRoot) && t.callback({
672
+ values: { ...n },
673
+ ...r,
674
+ ...i,
675
+ defaultValues: u
676
+ });
677
+ }
678
+ }).unsubscribe, ft = (t) => (d.mount = !0, k = {
679
+ ...k,
680
+ ...t.formState
681
+ }, Me({
682
+ ...t,
683
+ formState: k
684
+ })), Fe = (t, i = {}) => {
685
+ for (const l of t ? oe(t) : y.mount)
686
+ y.mount.delete(l), y.array.delete(l), i.keepValue || (E(a, l), E(n, l)), !i.keepError && E(r.errors, l), !i.keepDirty && E(r.dirtyFields, l), !i.keepTouched && E(r.touchedFields, l), !i.keepIsValidating && E(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && E(u, l);
687
+ v.state.next({
688
+ values: C(n)
689
+ }), v.state.next({
690
+ ...r,
691
+ ...i.keepDirty ? { isDirty: K() } : {}
692
+ }), !i.keepIsValid && O();
693
+ }, Ie = ({ disabled: t, name: i }) => {
694
+ (Y(t) && d.mount || t || y.disabled.has(i)) && (t ? y.disabled.add(i) : y.disabled.delete(i));
695
+ }, Ae = (t, i = {}) => {
696
+ let l = h(a, t);
697
+ const c = Y(i.disabled) || Y(s.disabled);
698
+ return m(a, t, {
699
+ ...l || {},
700
+ _f: {
701
+ ...l && l._f ? l._f : { ref: { name: t } },
702
+ name: t,
703
+ mount: !0,
704
+ ...i
705
+ }
706
+ }), y.mount.add(t), l ? Ie({
707
+ disabled: Y(i.disabled) ? i.disabled : s.disabled,
708
+ name: t
709
+ }) : $(t, !0, i.value), {
710
+ ...c ? { disabled: i.disabled || s.disabled } : {},
711
+ ...s.progressive ? {
712
+ required: !!i.required,
713
+ min: ue(i.min),
714
+ max: ue(i.max),
715
+ minLength: ue(i.minLength),
716
+ maxLength: ue(i.maxLength),
717
+ pattern: ue(i.pattern)
718
+ } : {},
719
+ name: t,
720
+ onChange: z,
721
+ onBlur: z,
722
+ ref: (f) => {
723
+ if (f) {
724
+ Ae(t, i), l = h(a, t);
725
+ const o = D(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Et(o), V = l._f.refs || [];
726
+ if (g ? V.find((A) => A === o) : o === l._f.ref)
727
+ return;
728
+ m(a, t, {
729
+ _f: {
730
+ ...l._f,
731
+ ...g ? {
732
+ refs: [
733
+ ...V.filter(De),
734
+ o,
735
+ ...Array.isArray(h(u, t)) ? [{}] : []
736
+ ],
737
+ ref: { type: o.type, name: t }
738
+ } : { ref: o }
739
+ }
740
+ }), $(t, !1, void 0, o);
741
+ } else
742
+ l = h(a, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Ft(y.array, t) && d.action) && y.unMount.add(t);
743
+ }
744
+ };
745
+ }, xe = () => s.shouldFocusError && fe(a, ne, y.mount), dt = (t) => {
746
+ Y(t) && (v.state.next({ disabled: t }), fe(a, (i, l) => {
747
+ const c = h(a, l);
748
+ c && (i.disabled = c._f.disabled || t, Array.isArray(c._f.refs) && c._f.refs.forEach((f) => {
749
+ f.disabled = c._f.disabled || t;
750
+ }));
751
+ }, 0, !1));
752
+ }, Be = (t, i) => async (l) => {
753
+ let c;
754
+ l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
755
+ let f = C(n);
756
+ if (v.state.next({
757
+ isSubmitting: !0
758
+ }), s.resolver) {
759
+ const { errors: o, values: g } = await Z();
760
+ r.errors = o, f = C(g);
761
+ } else
762
+ await q(a);
763
+ if (y.disabled.size)
764
+ for (const o of y.disabled)
765
+ E(f, o);
766
+ if (E(r.errors, "root"), R(r.errors)) {
767
+ v.state.next({
768
+ errors: {}
769
+ });
770
+ try {
771
+ await t(f, l);
772
+ } catch (o) {
773
+ c = o;
774
+ }
775
+ } else
776
+ i && await i({ ...r.errors }, l), xe(), setTimeout(xe);
777
+ if (v.state.next({
778
+ isSubmitted: !0,
779
+ isSubmitting: !1,
780
+ isSubmitSuccessful: R(r.errors) && !c,
781
+ submitCount: r.submitCount + 1,
782
+ errors: r.errors
783
+ }), c)
784
+ throw c;
785
+ }, ct = (t, i = {}) => {
786
+ h(a, t) && (D(i.defaultValue) ? M(t, C(h(u, t))) : (M(t, i.defaultValue), m(u, t, C(i.defaultValue))), i.keepTouched || E(r.touchedFields, t), i.keepDirty || (E(r.dirtyFields, t), r.isDirty = i.defaultValue ? K(t, C(h(u, t))) : K()), i.keepError || (E(r.errors, t), x.isValid && O()), v.state.next({ ...r }));
787
+ }, Ne = (t, i = {}) => {
788
+ const l = t ? C(t) : u, c = C(l), f = R(t), o = f ? u : c;
789
+ if (i.keepDefaultValues || (u = l), !i.keepValues) {
790
+ if (i.keepDirtyValues) {
791
+ const g = /* @__PURE__ */ new Set([
792
+ ...y.mount,
793
+ ...Object.keys(ae(u, n))
794
+ ]);
795
+ for (const V of Array.from(g))
796
+ h(r.dirtyFields, V) ? m(o, V, h(n, V)) : M(V, h(o, V));
797
+ } else {
798
+ if (Se && D(t))
799
+ for (const g of y.mount) {
800
+ const V = h(a, g);
801
+ if (V && V._f) {
802
+ const A = Array.isArray(V._f.refs) ? V._f.refs[0] : V._f.ref;
803
+ if (ge(A)) {
804
+ const P = A.closest("form");
805
+ if (P) {
806
+ P.reset();
807
+ break;
808
+ }
809
+ }
810
+ }
811
+ }
812
+ if (i.keepFieldsRef)
813
+ for (const g of y.mount)
814
+ M(g, h(o, g));
815
+ else
816
+ a = {};
817
+ }
818
+ n = s.shouldUnregister ? i.keepDefaultValues ? C(u) : {} : C(o), v.array.next({
819
+ values: { ...o }
820
+ }), v.state.next({
821
+ values: { ...o }
822
+ });
823
+ }
824
+ y = {
825
+ mount: i.keepDirtyValues ? y.mount : /* @__PURE__ */ new Set(),
826
+ unMount: /* @__PURE__ */ new Set(),
827
+ array: /* @__PURE__ */ new Set(),
828
+ disabled: /* @__PURE__ */ new Set(),
829
+ watch: /* @__PURE__ */ new Set(),
830
+ watchAll: !1,
831
+ focus: ""
832
+ }, d.mount = !x.isValid || !!i.keepIsValid || !!i.keepDirtyValues || !s.shouldUnregister && !R(o), d.watch = !!s.shouldUnregister, d.action = !1, i.keepErrors || (r.errors = {}), v.state.next({
833
+ submitCount: i.keepSubmitCount ? r.submitCount : 0,
834
+ isDirty: f ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !ee(t, u)),
835
+ isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
836
+ dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && n ? ae(u, n) : r.dirtyFields : i.keepDefaultValues && t ? ae(u, t) : i.keepDirty ? r.dirtyFields : {},
837
+ touchedFields: i.keepTouched ? r.touchedFields : {},
838
+ errors: i.keepErrors ? r.errors : {},
839
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
840
+ isSubmitting: !1,
841
+ defaultValues: u
842
+ });
843
+ }, Pe = (t, i) => Ne(H(t) ? t(n) : t, i), yt = (t, i = {}) => {
844
+ const l = h(a, t), c = l && l._f;
845
+ if (c) {
846
+ const f = c.refs ? c.refs[0] : c.ref;
847
+ f.focus && (f.focus(), i.shouldSelect && H(f.select) && f.select());
848
+ }
849
+ }, ht = (t) => {
850
+ r = {
851
+ ...r,
852
+ ...t
853
+ };
854
+ }, qe = {
855
+ control: {
856
+ register: Ae,
857
+ unregister: Fe,
858
+ getFieldState: Re,
859
+ handleSubmit: Be,
860
+ setError: Ue,
861
+ _subscribe: Me,
862
+ _runSchema: Z,
863
+ _focusError: xe,
864
+ _getWatch: b,
865
+ _getDirty: K,
866
+ _setValid: O,
867
+ _setFieldArray: _e,
868
+ _setDisabledField: Ie,
869
+ _setErrors: j,
870
+ _getFieldArray: F,
871
+ _reset: Ne,
872
+ _resetDefaultValues: () => H(s.defaultValues) && s.defaultValues().then((t) => {
873
+ Pe(t, s.resetOptions), v.state.next({
874
+ isLoading: !1
875
+ });
876
+ }),
877
+ _removeUnmounted: te,
878
+ _disableForm: dt,
879
+ _subjects: v,
880
+ _proxyFormState: x,
881
+ get _fields() {
882
+ return a;
883
+ },
884
+ get _formValues() {
885
+ return n;
886
+ },
887
+ get _state() {
888
+ return d;
889
+ },
890
+ set _state(t) {
891
+ d = t;
892
+ },
893
+ get _defaultValues() {
894
+ return u;
895
+ },
896
+ get _names() {
897
+ return y;
898
+ },
899
+ set _names(t) {
900
+ y = t;
901
+ },
902
+ get _formState() {
903
+ return r;
904
+ },
905
+ get _options() {
906
+ return s;
907
+ },
908
+ set _options(t) {
909
+ s = {
910
+ ...s,
911
+ ...t
912
+ };
913
+ }
914
+ },
915
+ subscribe: ft,
916
+ trigger: se,
917
+ register: Ae,
918
+ handleSubmit: Be,
919
+ watch: ot,
920
+ setValue: M,
921
+ getValues: ye,
922
+ reset: Pe,
923
+ resetField: ct,
924
+ clearErrors: ut,
925
+ unregister: Fe,
926
+ setError: Ue,
927
+ setFocus: yt,
928
+ getFieldState: Re
929
+ };
930
+ return {
931
+ ...qe,
932
+ formControl: qe
933
+ };
934
+ }
935
+ function pt(e = {}) {
936
+ const s = B.useRef(void 0), r = B.useRef(void 0), [a, u] = B.useState({
937
+ isDirty: !1,
938
+ isValidating: !1,
939
+ isLoading: H(e.defaultValues),
940
+ isSubmitted: !1,
941
+ isSubmitting: !1,
942
+ isSubmitSuccessful: !1,
943
+ isValid: !1,
944
+ submitCount: 0,
945
+ dirtyFields: {},
946
+ touchedFields: {},
947
+ validatingFields: {},
948
+ errors: e.errors || {},
949
+ disabled: e.disabled || !1,
950
+ isReady: !1,
951
+ defaultValues: H(e.defaultValues) ? void 0 : e.defaultValues
952
+ });
953
+ if (!s.current)
954
+ if (e.formControl)
955
+ s.current = {
956
+ ...e.formControl,
957
+ formState: a
958
+ }, e.defaultValues && !H(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
959
+ else {
960
+ const { formControl: d, ...y } = qt(e);
961
+ s.current = {
962
+ ...y,
963
+ formState: a
964
+ };
965
+ }
966
+ const n = s.current.control;
967
+ return n._options = e, wt(() => {
968
+ const d = n._subscribe({
969
+ formState: n._proxyFormState,
970
+ callback: () => u({ ...n._formState }),
971
+ reRenderRoot: !0
972
+ });
973
+ return u((y) => ({
974
+ ...y,
975
+ isReady: !0
976
+ })), n._formState.isReady = !0, d;
977
+ }, [n]), B.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), B.useEffect(() => {
978
+ e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
979
+ }, [n, e.mode, e.reValidateMode]), B.useEffect(() => {
980
+ e.errors && (n._setErrors(e.errors), n._focusError());
981
+ }, [n, e.errors]), B.useEffect(() => {
982
+ e.shouldUnregister && n._subjects.state.next({
983
+ values: n._getWatch()
984
+ });
985
+ }, [n, e.shouldUnregister]), B.useEffect(() => {
986
+ if (n._proxyFormState.isDirty) {
987
+ const d = n._getDirty();
988
+ d !== a.isDirty && n._subjects.state.next({
989
+ isDirty: d
990
+ });
991
+ }
992
+ }, [n, a.isDirty]), B.useEffect(() => {
993
+ var d;
994
+ e.values && !ee(e.values, r.current) ? (n._reset(e.values, {
995
+ keepFieldsRef: !0,
996
+ ...n._options.resetOptions
997
+ }), !((d = n._options.resetOptions) === null || d === void 0) && d.keepIsValid || n._setValid(), r.current = e.values, u((y) => ({ ...y }))) : n._resetDefaultValues();
998
+ }, [n, e.values]), B.useEffect(() => {
999
+ n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
1000
+ }), s.current.formState = mt(a, n), s.current;
1001
+ }
1002
+ export {
1003
+ kt as a,
1004
+ h as g,
1005
+ m as s,
1006
+ pt as u
1007
+ };