react-simple-formkit 2.2.6 → 2.2.7

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,5 +1,5 @@
1
- import we, { createContext as Te, useContext as _e, useEffect as de, useState as ie, useRef as V, useCallback as b, useMemo as le, useLayoutEffect as be } from "react";
2
- var ae = { exports: {} }, ee = {};
1
+ import Te, { createContext as _e, useContext as ke, useEffect as de, useState as oe, useRef as x, useCallback as d, useMemo as le, useLayoutEffect as be } from "react";
2
+ var ne = { exports: {} }, G = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -10,16 +10,16 @@ var ae = { exports: {} }, ee = {};
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
12
  var he;
13
- function ke() {
14
- if (he) return ee;
13
+ function Ae() {
14
+ if (he) return G;
15
15
  he = 1;
16
- var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
17
- function i(l, h, E) {
16
+ var t = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
17
+ function a(l, h, E) {
18
18
  var g = null;
19
19
  if (E !== void 0 && (g = "" + E), h.key !== void 0 && (g = "" + h.key), "key" in h) {
20
20
  E = {};
21
- for (var m in h)
22
- m !== "key" && (E[m] = h[m]);
21
+ for (var v in h)
22
+ v !== "key" && (E[v] = h[v]);
23
23
  } else E = h;
24
24
  return h = E.ref, {
25
25
  $$typeof: t,
@@ -29,9 +29,9 @@ function ke() {
29
29
  props: E
30
30
  };
31
31
  }
32
- return ee.Fragment = n, ee.jsx = i, ee.jsxs = i, ee;
32
+ return G.Fragment = s, G.jsx = a, G.jsxs = a, G;
33
33
  }
34
- var re = {};
34
+ var H = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -42,25 +42,25 @@ var re = {};
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
44
  var Ee;
45
- function Ae() {
45
+ function Oe() {
46
46
  return Ee || (Ee = 1, process.env.NODE_ENV !== "production" && function() {
47
47
  function t(e) {
48
48
  if (e == null) return null;
49
49
  if (typeof e == "function")
50
- return e.$$typeof === $ ? null : e.displayName || e.name || null;
50
+ return e.$$typeof === L ? null : e.displayName || e.name || null;
51
51
  if (typeof e == "string") return e;
52
52
  switch (e) {
53
- case F:
53
+ case p:
54
54
  return "Fragment";
55
- case x:
55
+ case N:
56
56
  return "Profiler";
57
57
  case C:
58
58
  return "StrictMode";
59
- case ne:
59
+ case ce:
60
60
  return "Suspense";
61
- case oe:
61
+ case ae:
62
62
  return "SuspenseList";
63
- case H:
63
+ case Z:
64
64
  return "Activity";
65
65
  }
66
66
  if (typeof e == "object")
@@ -69,51 +69,51 @@ function Ae() {
69
69
  ), e.$$typeof) {
70
70
  case o:
71
71
  return "Portal";
72
- case G:
72
+ case I:
73
73
  return (e.displayName || "Context") + ".Provider";
74
- case z:
74
+ case B:
75
75
  return (e._context.displayName || "Context") + ".Consumer";
76
- case se:
77
- var a = e.render;
78
- return e = e.displayName, e || (e = a.displayName || a.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
76
  case ue:
80
- return a = e.displayName || null, a !== null ? a : t(e.type) || "Memo";
77
+ var i = e.render;
78
+ return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
+ case ie:
80
+ return i = e.displayName || null, i !== null ? i : t(e.type) || "Memo";
81
81
  case P:
82
- a = e._payload, e = e._init;
82
+ i = e._payload, e = e._init;
83
83
  try {
84
- return t(e(a));
84
+ return t(e(i));
85
85
  } catch {
86
86
  }
87
87
  }
88
88
  return null;
89
89
  }
90
- function n(e) {
90
+ function s(e) {
91
91
  return "" + e;
92
92
  }
93
- function i(e) {
93
+ function a(e) {
94
94
  try {
95
- n(e);
96
- var a = !1;
95
+ s(e);
96
+ var i = !1;
97
97
  } catch {
98
- a = !0;
98
+ i = !0;
99
99
  }
100
- if (a) {
101
- a = console;
102
- var R = a.error, T = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
- return R.call(
104
- a,
100
+ if (i) {
101
+ i = console;
102
+ var S = i.error, T = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
+ return S.call(
104
+ i,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
106
  T
107
- ), n(e);
107
+ ), s(e);
108
108
  }
109
109
  }
110
110
  function l(e) {
111
- if (e === F) return "<>";
111
+ if (e === p) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === P)
113
113
  return "<...>";
114
114
  try {
115
- var a = t(e);
116
- return a ? "<" + a + ">" : "<...>";
115
+ var i = t(e);
116
+ return i ? "<" + i + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
@@ -126,40 +126,40 @@ function Ae() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
128
  function g(e) {
129
- if (M.call(e, "key")) {
130
- var a = Object.getOwnPropertyDescriptor(e, "key").get;
131
- if (a && a.isReactWarning) return !1;
129
+ if (U.call(e, "key")) {
130
+ var i = Object.getOwnPropertyDescriptor(e, "key").get;
131
+ if (i && i.isReactWarning) return !1;
132
132
  }
133
133
  return e.key !== void 0;
134
134
  }
135
- function m(e, a) {
136
- function R() {
137
- X || (X = !0, console.error(
135
+ function v(e, i) {
136
+ function S() {
137
+ K || (K = !0, console.error(
138
138
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
- a
139
+ i
140
140
  ));
141
141
  }
142
- R.isReactWarning = !0, Object.defineProperty(e, "key", {
143
- get: R,
142
+ S.isReactWarning = !0, Object.defineProperty(e, "key", {
143
+ get: S,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function v() {
147
+ function R() {
148
148
  var e = t(this.type);
149
- return Z[e] || (Z[e] = !0, console.error(
149
+ return ee[e] || (ee[e] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
151
  )), e = this.props.ref, e !== void 0 ? e : null;
152
152
  }
153
- function y(e, a, R, T, j, A, I, L) {
154
- return R = A.ref, e = {
155
- $$typeof: c,
153
+ function F(e, i, S, T, j, O, J, z) {
154
+ return S = O.ref, e = {
155
+ $$typeof: u,
156
156
  type: e,
157
- key: a,
158
- props: A,
157
+ key: i,
158
+ props: O,
159
159
  _owner: j
160
- }, (R !== void 0 ? R : null) !== null ? Object.defineProperty(e, "ref", {
160
+ }, (S !== void 0 ? S : null) !== null ? Object.defineProperty(e, "ref", {
161
161
  enumerable: !1,
162
- get: v
162
+ get: R
163
163
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
@@ -174,33 +174,33 @@ function Ae() {
174
174
  configurable: !1,
175
175
  enumerable: !1,
176
176
  writable: !0,
177
- value: I
177
+ value: J
178
178
  }), Object.defineProperty(e, "_debugTask", {
179
179
  configurable: !1,
180
180
  enumerable: !1,
181
181
  writable: !0,
182
- value: L
182
+ value: z
183
183
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
184
184
  }
185
- function f(e, a, R, T, j, A, I, L) {
186
- var _ = a.children;
185
+ function f(e, i, S, T, j, O, J, z) {
186
+ var _ = i.children;
187
187
  if (_ !== void 0)
188
188
  if (T)
189
- if (Y(_)) {
189
+ if (Q(_)) {
190
190
  for (T = 0; T < _.length; T++)
191
- d(_[T]);
191
+ b(_[T]);
192
192
  Object.freeze && Object.freeze(_);
193
193
  } else
194
194
  console.error(
195
195
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
196
196
  );
197
- else d(_);
198
- if (M.call(a, "key")) {
197
+ else b(_);
198
+ if (U.call(i, "key")) {
199
199
  _ = t(e);
200
- var D = Object.keys(a).filter(function(ce) {
201
- return ce !== "key";
200
+ var V = Object.keys(i).filter(function(se) {
201
+ return se !== "key";
202
202
  });
203
- T = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", K[_ + T] || (D = 0 < D.length ? "{" + D.join(": ..., ") + ": ...}" : "{}", console.error(
203
+ T = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", te[_ + T] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
204
204
  `A props object containing a "key" prop is being spread into JSX:
205
205
  let props = %s;
206
206
  <%s {...props} />
@@ -209,193 +209,192 @@ React keys must be passed directly to JSX without using spread:
209
209
  <%s key={someKey} {...props} />`,
210
210
  T,
211
211
  _,
212
- D,
212
+ V,
213
213
  _
214
- ), K[_ + T] = !0);
214
+ ), te[_ + T] = !0);
215
215
  }
216
- if (_ = null, R !== void 0 && (i(R), _ = "" + R), g(a) && (i(a.key), _ = "" + a.key), "key" in a) {
217
- R = {};
218
- for (var N in a)
219
- N !== "key" && (R[N] = a[N]);
220
- } else R = a;
221
- return _ && m(
222
- R,
216
+ if (_ = null, S !== void 0 && (a(S), _ = "" + S), g(i) && (a(i.key), _ = "" + i.key), "key" in i) {
217
+ S = {};
218
+ for (var D in i)
219
+ D !== "key" && (S[D] = i[D]);
220
+ } else S = i;
221
+ return _ && v(
222
+ S,
223
223
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
224
- ), y(
224
+ ), F(
225
225
  e,
226
226
  _,
227
- A,
227
+ O,
228
228
  j,
229
229
  h(),
230
- R,
231
- I,
232
- L
230
+ S,
231
+ J,
232
+ z
233
233
  );
234
234
  }
235
- function d(e) {
236
- typeof e == "object" && e !== null && e.$$typeof === c && e._store && (e._store.validated = 1);
235
+ function b(e) {
236
+ typeof e == "object" && e !== null && e.$$typeof === u && e._store && (e._store.validated = 1);
237
237
  }
238
- var u = we, c = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), F = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), G = Symbol.for("react.context"), se = Symbol.for("react.forward_ref"), ne = Symbol.for("react.suspense"), oe = Symbol.for("react.suspense_list"), ue = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), $ = Symbol.for("react.client.reference"), W = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, M = Object.prototype.hasOwnProperty, Y = Array.isArray, B = console.createTask ? console.createTask : function() {
238
+ var c = Te, u = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), C = Symbol.for("react.strict_mode"), N = Symbol.for("react.profiler"), B = Symbol.for("react.consumer"), I = Symbol.for("react.context"), ue = Symbol.for("react.forward_ref"), ce = Symbol.for("react.suspense"), ae = Symbol.for("react.suspense_list"), ie = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), L = Symbol.for("react.client.reference"), W = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, Q = Array.isArray, q = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
- u = {
241
+ c = {
242
242
  "react-stack-bottom-frame": function(e) {
243
243
  return e();
244
244
  }
245
245
  };
246
- var X, Z = {}, Q = u["react-stack-bottom-frame"].bind(
247
- u,
246
+ var K, ee = {}, re = c["react-stack-bottom-frame"].bind(
247
+ c,
248
248
  E
249
- )(), w = B(l(E)), K = {};
250
- re.Fragment = F, re.jsx = function(e, a, R, T, j) {
251
- var A = 1e4 > W.recentlyCreatedOwnerStacks++;
249
+ )(), k = q(l(E)), te = {};
250
+ H.Fragment = p, H.jsx = function(e, i, S, T, j) {
251
+ var O = 1e4 > W.recentlyCreatedOwnerStacks++;
252
252
  return f(
253
253
  e,
254
- a,
255
- R,
254
+ i,
255
+ S,
256
256
  !1,
257
257
  T,
258
258
  j,
259
- A ? Error("react-stack-top-frame") : Q,
260
- A ? B(l(e)) : w
259
+ O ? Error("react-stack-top-frame") : re,
260
+ O ? q(l(e)) : k
261
261
  );
262
- }, re.jsxs = function(e, a, R, T, j) {
263
- var A = 1e4 > W.recentlyCreatedOwnerStacks++;
262
+ }, H.jsxs = function(e, i, S, T, j) {
263
+ var O = 1e4 > W.recentlyCreatedOwnerStacks++;
264
264
  return f(
265
265
  e,
266
- a,
267
- R,
266
+ i,
267
+ S,
268
268
  !0,
269
269
  T,
270
270
  j,
271
- A ? Error("react-stack-top-frame") : Q,
272
- A ? B(l(e)) : w
271
+ O ? Error("react-stack-top-frame") : re,
272
+ O ? q(l(e)) : k
273
273
  );
274
274
  };
275
- }()), re;
275
+ }()), H;
276
276
  }
277
277
  var ge;
278
- function Oe() {
279
- return ge || (ge = 1, process.env.NODE_ENV === "production" ? ae.exports = ke() : ae.exports = Ae()), ae.exports;
278
+ function Ce() {
279
+ return ge || (ge = 1, process.env.NODE_ENV === "production" ? ne.exports = Ae() : ne.exports = Oe()), ne.exports;
280
280
  }
281
- var me = Oe();
282
- const p = () => {
283
- }, pe = Te({
281
+ var me = Ce();
282
+ const y = () => {
283
+ }, pe = _e({
284
284
  ref: null,
285
- watch: p,
285
+ watch: y,
286
286
  actions: {
287
- reset: p,
288
- resetField: p,
289
- setValue: p,
290
- getValues: p,
291
- getErrors: p,
292
- getFieldStates: p,
293
- getFormStates: p,
294
- setError: p,
295
- clearError: p,
296
- clearErrors: p,
297
- checkValidity: p,
298
- getNumberFields: p,
299
- getFieldValidity: p,
300
- getDefaultValues: p,
301
- setFieldState: p,
302
- resetFieldState: p,
303
- getControlledFields: p
287
+ reset: y,
288
+ resetField: y,
289
+ setValue: y,
290
+ getValues: y,
291
+ getErrors: y,
292
+ getFieldStates: y,
293
+ getFormStates: y,
294
+ setError: y,
295
+ clearError: y,
296
+ clearErrors: y,
297
+ checkValidity: y,
298
+ getNumberFields: y,
299
+ getFieldValidity: y,
300
+ getDefaultValues: y,
301
+ setFieldState: y,
302
+ resetFieldState: y,
303
+ getControlledFields: y
304
304
  },
305
- registerController: p,
306
- registerHookWatcher: p,
307
- lastReloadedAt: p,
308
- loadFormValues: p,
309
- getWatchValue: p,
305
+ registerController: y,
306
+ registerHookWatcher: y,
307
+ lastReloadedAt: y,
308
+ loadFormValues: y,
309
+ getWatchValue: y,
310
310
  channels: {}
311
- }), ye = () => _e(pe), Le = ({
311
+ }), ye = () => ke(pe), Ue = ({
312
312
  id: t,
313
- control: n,
314
- method: i,
313
+ control: s,
314
+ method: a,
315
315
  action: l,
316
316
  children: h,
317
317
  onSubmit: E = () => {
318
318
  },
319
319
  onInput: g = () => {
320
320
  },
321
- onChange: m = () => {
321
+ onChange: v = () => {
322
322
  },
323
- onBlur: v = () => {
323
+ onBlur: R = () => {
324
324
  },
325
- onReset: y = () => {
325
+ onReset: F = () => {
326
326
  },
327
327
  numberFields: f = [],
328
- className: d,
329
- ...u
328
+ className: b,
329
+ ...c
330
330
  }) => (de(() => {
331
- const c = n.channels.subscribe("onChange", m), o = n.channels.subscribe("onBlur", v);
331
+ const u = s.channels.subscribe("onChange", v), o = s.channels.subscribe("onBlur", R);
332
332
  return () => {
333
- c(), o();
333
+ u(), o();
334
334
  };
335
- }, [n.lastReloadedAt]), /* @__PURE__ */ me.jsx(pe.Provider, { value: n, children: /* @__PURE__ */ me.jsx(
335
+ }, [s.lastReloadedAt]), /* @__PURE__ */ me.jsx(pe.Provider, { value: s, children: /* @__PURE__ */ me.jsx(
336
336
  "form",
337
337
  {
338
338
  id: t,
339
- ref: n.ref,
339
+ ref: (u) => {
340
+ s.ref && (s.ref.current = u, u && s.initForm());
341
+ },
340
342
  action: l,
341
- method: i,
342
- className: d,
343
+ method: a,
344
+ className: b,
343
345
  onInput: g,
344
- onSubmit: (c) => {
345
- i || c.preventDefault();
346
- const o = n.loadFormValues();
346
+ onSubmit: (u) => {
347
+ a || u.preventDefault();
348
+ const o = s.loadFormValues();
347
349
  E(o);
348
350
  },
349
- onChange: (c) => {
350
- const o = c.target.name;
351
- !o || n.actions.getControlledFields().has(o) || n.actions.setValue(o, c.target.value);
351
+ onChange: (u) => {
352
+ const o = u.target.name;
353
+ !o || s.actions.getControlledFields().has(o) || s.actions.setValue(o, u.target.value);
352
354
  },
353
- onBlur: (c) => {
354
- const o = c.target.name;
355
- if (!o || n.actions.getControlledFields().has(o)) return;
356
- const F = c.target.value;
357
- n.channels.publish("onBlur", o, F, n.actions.getValues());
355
+ onBlur: (u) => {
356
+ const o = u.target.name;
357
+ if (!o || s.actions.getControlledFields().has(o)) return;
358
+ const p = u.target.value;
359
+ s.channels.publish("onBlur", o, p, s.actions.getValues());
358
360
  },
359
- onReset: (c) => {
360
- n.actions.reset(), y(c);
361
+ onReset: (u) => {
362
+ s.actions.reset(), F(u);
361
363
  },
362
- ...u,
364
+ ...c,
363
365
  children: h
364
366
  },
365
- n.lastReloadedAt
366
- ) })), Ce = ({ control: t, name: n, compute: i }) => {
367
- const { getWatchValue: l, registerHookWatcher: h } = t || ye(), E = l({ name: n, compute: i }), [g, m] = ie(E);
368
- return de(() => {
369
- const v = h({ name: n, compute: i, value: g, setValue: m });
370
- return () => v.forEach((y) => y());
371
- }, []), g;
372
- }, Pe = ({ name: t, defaultValue: n }) => {
373
- const { actions: i, registerController: l, channels: h } = ye(), E = V(), g = i.getDefaultValues()[t] || n || "", [m, v] = ie(g), y = Ce({ name: `fieldStates.${t}` }), f = b(
374
- (u, { shouldDirty: c = !0, shouldOnChange: o = !0 } = {}) => {
375
- var C, x;
376
- let F = u;
377
- (C = u == null ? void 0 : u.target) != null && C.value && (F = u.target.value), (x = u == null ? void 0 : u.target) != null && x.checked && (F = u.target.checked + ""), v(F), i.setValue(t, F, { shouldDirty: c, shouldOnChange: o });
367
+ s.lastReloadedAt
368
+ ) })), Pe = ({ control: t, name: s, compute: a }) => {
369
+ const { getWatchValue: l, registerHookWatcher: h } = t || ye(), E = l({ name: s, compute: a }), [g, v] = oe(E);
370
+ return de(() => h({ name: s, compute: a, value: g, setValue: v }), []), g;
371
+ }, je = ({ name: t, defaultValue: s }) => {
372
+ const { actions: a, registerController: l, channels: h } = ye(), E = x(), g = a.getDefaultValues()[t] || s || "", [v, R] = oe(g), F = Pe({ name: `fieldStates.${t}` }), f = d(
373
+ (c, { shouldDirty: u = !0, shouldOnChange: o = !0 } = {}) => {
374
+ var C, N;
375
+ let p = c;
376
+ (C = c == null ? void 0 : c.target) != null && C.value && (p = c.target.value), (N = c == null ? void 0 : c.target) != null && N.checked && (p = c.target.checked + ""), R(p), a.setValue(t, p, { shouldDirty: u, shouldOnChange: o });
378
377
  },
379
- [i.setValue]
380
- ), d = b((u) => {
381
- const c = i.getValues(), o = u ?? c[t];
382
- h.publish("onBlur", t, o, c);
378
+ [a.setValue]
379
+ ), b = d((c) => {
380
+ const u = a.getValues(), o = c ?? u[t];
381
+ h.publish("onBlur", t, o, u);
383
382
  }, []);
384
- return de(() => l(t, v), []), { ref: E, name: t, defaultValue: g, value: m, onChange: f, onBlur: d, fieldState: y };
385
- }, Ue = ({
383
+ return de(() => l(t, R), []), { ref: E, name: t, defaultValue: g, value: v, onChange: f, onBlur: b, fieldState: F };
384
+ }, qe = ({
386
385
  name: t,
387
- defaultValue: n,
388
- render: i = ({ ref: l, name: h, defaultValue: E, value: g, onChange: m, onBlur: v, fieldState: y }) => null
386
+ defaultValue: s,
387
+ render: a = ({ ref: l, name: h, defaultValue: E, value: g, onChange: v, onBlur: R, fieldState: F }) => null
389
388
  }) => {
390
- const l = Pe({ name: t, defaultValue: n });
391
- return i(l);
392
- }, je = ["errors", "fieldStates", "formState"], te = (t = {}, n = "") => n.split(".").reduce((i, l) => i && i[l] !== void 0 ? i[l] : void 0, t), ve = (t = {}, n = "", i) => {
389
+ const l = je({ name: t, defaultValue: s });
390
+ return a(l);
391
+ }, xe = ["errors", "fieldStates", "formState"], X = (t = {}, s = "") => s.split(".").reduce((a, l) => a && a[l] !== void 0 ? a[l] : void 0, t), ve = (t = {}, s = "", a) => {
393
392
  let l = t;
394
- const h = n.split(".");
393
+ const h = s.split(".");
395
394
  return h.forEach((E, g) => {
396
- g < h.length - 1 && (l[E] || (l[E] = {}), g === h.length - 2 && (l[E] = { ...l[E] }), l = l[E]), l[E] = i;
395
+ g < h.length - 1 && (l[E] || (l[E] = {}), g === h.length - 2 && (l[E] = { ...l[E] }), l = l[E]), l[E] = a;
397
396
  }), t;
398
- }, J = (t) => je.some((n) => t.startsWith(n)) ? t : "values." + t, xe = [
397
+ }, Y = (t) => xe.some((s) => t.startsWith(s)) ? t : "values." + t, Ne = [
399
398
  "badInput",
400
399
  "customError",
401
400
  "patternMismatch",
@@ -408,10 +407,10 @@ const p = () => {
408
407
  "valueMissing"
409
408
  ], Re = (t) => {
410
409
  typeof t.setCustomValidity == "function" && t.setCustomValidity("");
411
- let n = t.validity, i = xe.find((l) => n[l]);
412
- if (i) return { type: i, message: t.validationMessage };
410
+ let s = t.validity, a = Ne.find((l) => s[l]);
411
+ if (a) return { type: a, message: t.validationMessage };
413
412
  };
414
- class Ne {
413
+ class Ve {
415
414
  constructor() {
416
415
  this.events = /* @__PURE__ */ new Map(), this.watchEvents = /* @__PURE__ */ new Map();
417
416
  }
@@ -421,124 +420,121 @@ class Ne {
421
420
  getEvents() {
422
421
  return this.events;
423
422
  }
424
- subscribe(n, i) {
425
- return this.events.has(n) || this.events.set(n, /* @__PURE__ */ new Set()), this.events.get(n).add(i), () => {
423
+ subscribe(s, a) {
424
+ return this.events.has(s) || this.events.set(s, /* @__PURE__ */ new Set()), this.events.get(s).add(a), () => {
426
425
  var l;
427
- return (l = this.events.get(n)) == null ? void 0 : l.delete(i);
426
+ return (l = this.events.get(s)) == null ? void 0 : l.delete(a);
428
427
  };
429
428
  }
430
- subscribeWatch(n, i) {
431
- this.watchEvents.has(n) || (this.watchEvents.set(n, /* @__PURE__ */ new Set()), this.watchEvents.get(n).add(i));
429
+ subscribeWatch(s, a) {
430
+ this.watchEvents.has(s) || (this.watchEvents.set(s, /* @__PURE__ */ new Set()), this.watchEvents.get(s).add(a));
432
431
  }
433
- publish(n, ...i) {
432
+ publish(s, ...a) {
434
433
  this.events.forEach((l, h) => {
435
- n.includes(h) && l.forEach((E) => E(...i));
434
+ s.includes(h) && l.forEach((E) => E(...a));
436
435
  }), this.watchEvents.forEach((l, h) => {
437
- n.includes(h) && l.forEach((E) => E(...i));
436
+ s.includes(h) && l.forEach((E) => E(...a));
438
437
  });
439
438
  }
440
439
  reset() {
441
440
  this.events.clear(), this.watchEvents.clear();
442
441
  }
443
442
  }
444
- const Ve = () => {
445
- const t = V(new Ne()), n = b((m, ...v) => {
446
- t.current.publish(m, ...v);
447
- }, []), i = b((m, v) => t.current.subscribe(m, v), []), l = b((m, v) => {
448
- t.current.subscribeWatch(m, v);
449
- }, []), h = b(() => t.current.getEvents(), []), E = b(() => t.current.getWatchEvents(), []), g = b(() => {
443
+ const De = () => {
444
+ const t = x(new Ve()), s = d((v, ...R) => {
445
+ t.current.publish(v, ...R);
446
+ }, []), a = d((v, R) => t.current.subscribe(v, R), []), l = d((v, R) => {
447
+ t.current.subscribeWatch(v, R);
448
+ }, []), h = d(() => t.current.getEvents(), []), E = d(() => t.current.getWatchEvents(), []), g = d(() => {
450
449
  t.current.reset();
451
450
  }, []);
452
- return { publish: n, subscribe: i, reset: g, getEvents: h, subscribeWatch: l, getWatchEvents: E };
453
- }, De = () => {
454
- const [t, n] = ie(), i = b(() => n((/* @__PURE__ */ new Date()).toString()), []);
455
- return [t, i];
451
+ return { publish: s, subscribe: a, reset: g, getEvents: h, subscribeWatch: l, getWatchEvents: E };
456
452
  }, We = () => {
457
- const [, t] = ie({});
458
- return b(() => t({}), []);
459
- }, $e = ({ channels: t, getValues: n, getErrors: i, getFieldStates: l, getFormState: h }) => {
460
- const E = We(), g = b(({ name: f, compute: d }) => {
461
- if (typeof d == "function") return d(n());
453
+ const [t, s] = oe(), a = d(() => s((/* @__PURE__ */ new Date()).toString()), []);
454
+ return [t, a];
455
+ }, $e = () => {
456
+ const [, t] = oe({});
457
+ return d(() => t({}), []);
458
+ }, Me = ({ channels: t, getValues: s, getErrors: a, getFieldStates: l, getFormState: h }) => {
459
+ const E = $e(), g = d(({ name: f, compute: b }) => {
460
+ if (typeof b == "function") return b(s());
462
461
  if (Array.isArray(f)) {
463
- const u = {};
464
- return f.forEach((c) => {
465
- u[c] = g({ name: c });
466
- }), u;
462
+ const c = {};
463
+ return f.forEach((u) => {
464
+ c[u] = g({ name: u });
465
+ }), c;
467
466
  }
468
- return te(
467
+ return X(
469
468
  {
470
- ...n(),
471
- errors: { ...i() },
469
+ ...s(),
470
+ errors: { ...a() },
472
471
  formState: { ...h() },
473
472
  fieldStates: { ...l() }
474
473
  },
475
474
  f
476
475
  );
477
- }, []), m = b((f) => {
476
+ }, []), v = d((f) => {
478
477
  if (!f)
479
- return t.subscribeWatch("values", () => E()), n();
478
+ return t.subscribeWatch("values", () => E()), s();
480
479
  if (typeof f == "string") {
481
- const d = J(f);
482
- return t.subscribeWatch(d, () => E()), g({ name: f });
480
+ const b = Y(f);
481
+ return t.subscribeWatch(b, () => E()), g({ name: f });
483
482
  }
484
483
  if (Array.isArray(f)) {
485
- const d = {};
486
- return f.forEach((u) => {
487
- const c = J(u);
488
- t.subscribeWatch(c, () => E()), d[u] = g({ name: u });
489
- }), { ...d };
484
+ const b = {};
485
+ return f.forEach((c) => {
486
+ const u = Y(c);
487
+ t.subscribeWatch(u, () => E()), b[c] = g({ name: c });
488
+ }), { ...b };
490
489
  }
491
490
  throw new Error("Parameters of watch must be string or array of string");
492
- }, []), v = b(({ name: f, compute: d, setValue: u }) => {
493
- if (typeof d == "function")
494
- return [t.subscribe("values", () => {
495
- const o = g({ compute: d });
496
- u(o);
497
- })];
491
+ }, []), R = d(({ name: f, compute: b, setValue: c }) => {
492
+ if (typeof b == "function")
493
+ return t.subscribe("values", () => {
494
+ const o = g({ compute: b });
495
+ c(o);
496
+ });
498
497
  if (!f)
499
- return [t.subscribe("values", () => {
500
- u(n());
501
- })];
498
+ return t.subscribe("values", () => {
499
+ c(s());
500
+ });
502
501
  if (typeof f == "string") {
503
- const c = J(f);
504
- return [t.subscribe(c, () => {
505
- const F = g({ name: f });
506
- u(F);
507
- })];
502
+ const u = Y(f);
503
+ return t.subscribe(u, () => {
504
+ const p = g({ name: f });
505
+ c(p);
506
+ });
508
507
  }
509
508
  if (Array.isArray(f)) {
510
- const c = g({ name: f }), o = [];
511
- return f.forEach((F) => {
512
- const C = J(F), x = t.subscribe(C, () => {
513
- const z = g({ name: F });
514
- c[F] = z, u({ ...c });
509
+ const u = g({ name: f }), o = [];
510
+ return f.forEach((p) => {
511
+ const C = Y(p), N = t.subscribe(C, () => {
512
+ const B = g({ name: p });
513
+ u[p] = B, c({ ...u });
515
514
  });
516
- o.push(x);
517
- }), o;
515
+ o.push(N);
516
+ }), () => o.forEach((p) => p());
518
517
  }
519
518
  throw new Error("Parameters of name must be string or array of string or compute must be a function");
520
- }, []), y = b(
521
- (f, d) => {
522
- if (!f)
523
- return t.subscribe("values", d);
524
- if (typeof f == "string") {
525
- const u = J(f);
526
- return t.subscribe(u, d);
527
- }
528
- if (Array.isArray(f)) {
529
- const u = {}, c = [];
530
- return f.forEach((o) => {
531
- const F = J(o), C = t.subscribe(F, () => {
532
- u[o] = g({ name: o }), d({ ...u });
533
- });
534
- c.push(C);
535
- }), c;
536
- }
537
- throw new Error("Parameters of name must be string or array of string");
538
- },
539
- [t]
540
- );
541
- return { watch: m, registerHookWatcher: v, getWatchValue: g, subscribe: y };
519
+ }, []), F = d((f, b) => {
520
+ if (!f)
521
+ return t.subscribe("values", b);
522
+ if (typeof f == "string") {
523
+ const c = Y(f);
524
+ return t.subscribe(c, b);
525
+ }
526
+ if (Array.isArray(f)) {
527
+ const c = {}, u = [];
528
+ return f.forEach((o) => {
529
+ const p = Y(o), C = t.subscribe(p, () => {
530
+ c[o] = g({ name: o }), b({ ...c });
531
+ });
532
+ u.push(C);
533
+ }), () => u.forEach((o) => o());
534
+ }
535
+ throw new Error("Parameters of name must be string or array of string");
536
+ }, []);
537
+ return { watch: v, registerHookWatcher: R, getWatchValue: g, subscribe: F };
542
538
  }, Se = {
543
539
  lastReset: null,
544
540
  isDirty: !1,
@@ -546,199 +542,151 @@ const Ve = () => {
546
542
  errorFields: [],
547
543
  dirtyFields: [],
548
544
  touchedFields: []
549
- }, fe = { isDirty: !1, isTouched: !1, error: null }, Me = [], Ye = {}, qe = ({
550
- numberFields: t = Me,
551
- defaultValues: n = Ye,
552
- shouldUnRegister: i = !1,
545
+ }, fe = { isDirty: !1, isTouched: !1, error: null }, Ye = [], Be = {}, Je = ({
546
+ numberFields: t = Ye,
547
+ defaultValues: s = Be,
548
+ shouldUnRegister: a = !1,
553
549
  shouldConvertNumber: l = !1
554
550
  } = {}) => {
555
- const [h, E] = De(), g = V(), m = V(t), v = V(/* @__PURE__ */ new Map()), y = V({}), f = V({}), d = V({ ...Se }), u = V({ ...n }), c = V({ ...n }), o = Ve(), F = b((r) => {
556
- f.current = Object.keys(c.current).reduce((s, S) => ({
557
- ...s,
558
- [S]: { ...r ? {} : f.current[S] || {}, ...fe }
551
+ const [h, E] = We(), g = x(), v = x(t), R = x(/* @__PURE__ */ new Map()), F = x({}), f = x({}), b = x({ ...Se }), c = x({ ...s }), u = x({ ...s }), o = De(), p = d((r) => {
552
+ f.current = Object.keys(u.current).reduce((n, m) => ({
553
+ ...n,
554
+ [m]: { ...r ? {} : f.current[m] || {}, ...fe }
559
555
  }), {});
560
- }, []), C = b(
561
- (r = {}, { clearCustomFormStates: s = !1, clearCustomFieldStates: S = !1 } = {}) => {
562
- c.current = { ...c.current, ...r }, u.current = { ...c.current }, v.current.forEach((k, U) => {
563
- k(c.current[U]);
564
- }), y.current = {}, d.current = { ...s ? {} : d.current, ...Se }, m.current = t, v.current = /* @__PURE__ */ new Map(), o.reset(), F(S), t.length > 0 && (l = !0), E();
556
+ }, []), C = d(
557
+ (r = {}, { clearCustomFormStates: n = !1, clearCustomFieldStates: m = !1 } = {}) => {
558
+ u.current = { ...u.current, ...r }, c.current = { ...u.current }, R.current.forEach((w, $) => {
559
+ w(u.current[$]);
560
+ }), F.current = {}, b.current = { ...n ? {} : b.current, ...Se }, v.current = t, R.current = /* @__PURE__ */ new Map(), o.reset(), p(m), t.length > 0 && (l = !0), E();
565
561
  },
566
562
  []
567
- ), x = b(() => {
563
+ ), N = d(() => {
568
564
  const r = Object.fromEntries(new FormData(g.current));
569
- return v.current.forEach((S, k) => {
570
- r[k] = u.current[k];
571
- }), l && m.current.forEach(
572
- (S) => r.hasOwnProperty(S) && (r[S] = Number(r[S]) || 0)
573
- ), { ...u.current, ...r };
574
- }, []), z = b(() => !!Object.values(W()).find((r) => r.isDirty), []), G = b(() => !!Object.values($()).find((r) => !!r), []), se = b((r) => Re(r.target), []), ne = b(() => c.current, []), oe = b(() => m.current, []), ue = b(() => v.current, []), P = b((r, s) => s ? Array.isArray(s) ? s.reduce((S, k) => ({ ...S, [k]: te(r, k) }), {}) : te(r, s) : { ...r }, []), H = b((r) => P(u.current, r), [P]), $ = b((r) => P(y.current, r), [P]), W = b((r) => P(f.current, r), [P]), M = b(
575
- (r) => P({ ...d.current, lastReset: h }, r),
576
- [P, h]
577
- ), { watch: Y, registerHookWatcher: B, getWatchValue: X, subscribe: Z } = $e({
565
+ return R.current.forEach((m, w) => {
566
+ r[w] = c.current[w];
567
+ }), l && v.current.forEach(
568
+ (m) => r.hasOwnProperty(m) && (r[m] = Number(r[m]) || 0)
569
+ ), { ...c.current, ...r };
570
+ }, []), B = d(() => !!Object.values(W()).find((r) => r.isDirty), []), I = d(() => !!Object.values(L()).find((r) => !!r), []), ue = d((r) => Re(r.target), []), ce = d(() => u.current, []), ae = d(() => v.current, []), ie = d(() => R.current, []), P = d((r, n) => n ? Array.isArray(n) ? n.reduce((m, w) => ({ ...m, [w]: X(r, w) }), {}) : X(r, n) : { ...r }, []), Z = d((r) => P(c.current, r), [P]), L = d((r) => P(F.current, r), [P]), W = d((r) => P(f.current, r), [P]), U = d(
571
+ (r) => P({ ...b.current, lastReset: h }, r),
572
+ [h]
573
+ ), { watch: Q, registerHookWatcher: q, getWatchValue: K, subscribe: ee } = Me({
578
574
  channels: o,
579
- getValues: H,
580
- getErrors: $,
575
+ getValues: Z,
576
+ getErrors: L,
581
577
  getFieldStates: W,
582
- getFormState: M
583
- }), Q = b((r, s) => {
584
- const S = d.current;
585
- te(S, r) !== s && (ve(d.current, r, s), o.publish(`formState.${r}`, s));
586
- }, []), w = b((r, s, S) => {
587
- const k = f.current[r] || { ...fe };
588
- te(k, s) !== S && (ve(f.current, `${r}.${s}`, S), o.publish(`fieldStates.${r}.${s}`, S), s === "error" && (d.current.errorFields = Object.keys(y.current).filter(
589
- (O) => !!y.current[O]
590
- ), o.publish("formState.errorFields", d.current.errorFields)), s === "isDirty" && (d.current.dirtyFields = Object.keys(f.current).filter(
591
- (O) => f.current[O].isDirty
592
- ), o.publish("formState.dirtyFields", d.current.dirtyFields)), s === "isTouched" && (d.current.touchedFields = Object.keys(f.current).filter(
593
- (O) => f.current[O].isTouched
594
- ), o.publish("formState.touchedFields", d.current.touchedFields)));
595
- }, []), K = b(
596
- (r) => {
597
- w(r, "isDirty", !1), w(r, "isTouched", !1), w(r, "error", null);
598
- },
599
- [w]
600
- ), e = b(
601
- (r, s) => {
602
- if (y.current[r] === s) return;
603
- y.current[r] = s, w(r, "error", s), o.publish(`errors.${r}`, s);
604
- const k = G();
605
- d.current.isError !== k && (d.current.isError = k, o.publish("formState.isError", k));
606
- },
607
- [w]
608
- ), a = b(
609
- (r) => {
610
- if (!y.current[r]) return;
611
- y.current[r] = null, w(r, "error", null), o.publish(`errors.${r}`, null);
612
- const s = G();
613
- d.current.isError !== s && (d.current.isError = s, o.publish("formState.isError", s));
614
- },
615
- [w]
616
- ), R = b(() => {
617
- if (Object.keys(y.current) === 0) return;
618
- Object.keys(y.current).forEach((s) => a(s)), y.current = {};
619
- const r = G();
620
- d.current.isError !== r && (d.current.isError = r, o.publish("formState.isError", r));
621
- }, []), T = b(
622
- (r) => {
623
- const s = Re(r.target);
624
- s ? e(r.target.name, s) : a(r.target.name);
625
- },
626
- [e, a]
627
- ), j = b(
628
- (r, s, { shouldDirty: S = !0, shouldOnChange: k = !0 } = {}) => {
629
- if (s === u.current[r]) return;
630
- l && m.current.includes(r) && (s = Number(s) || void 0), w(r, "isTouched", !0);
631
- const U = s !== c.current[r];
632
- S && f.current[r].isDirty !== U && w(r, "isDirty", U);
633
- const O = z();
634
- d.current.isDirty !== O && (d.current.isDirty = O, o.publish("formState.isDirty", O)), u.current[r] = s;
635
- const q = v.current.get(r);
636
- q && q(s), o.publish(`values.${r}`, s, { shouldDirty: S, shouldOnChange: k }), k && o.publish("onChange", r, s, u.current);
637
- },
638
- [w]
639
- ), A = b((r, s) => (v.current.set(r, s), f.current[r] = { ...fe }, () => {
640
- i && v.current.delete(r);
641
- }), []), I = b(
642
- (r, { keepError: s, keepDirty: S, keepTouched: k, keepCustomState: U, defaultValue: O }) => {
643
- const q = v.current.get(r);
644
- if (!q)
645
- throw new Error(`Cannot reset "${r}" because it's uncontrolled field`);
646
- c.current[r] = O, u.current[r] = O, q && q(O), s || a(r), S || w(r, "isDirty", !1), k || w(r, "isTouched", !1);
647
- },
648
- [a, w]
649
- ), L = b((r, s = N.getValues(r)) => {
650
- o.publish("onBlur", r, s, N.getValues());
651
- }, []), _ = b((r) => o.subscribe("onChange", r), []), D = b((r) => o.subscribe("onBlur", r), []), N = le(
578
+ getFormState: U
579
+ }), re = d((r, n) => {
580
+ const m = b.current;
581
+ X(m, r) !== n && (ve(b.current, r, n), o.publish(`formState.${r}`, n));
582
+ }, []), k = d((r, n, m) => {
583
+ const w = f.current[r] || { ...fe };
584
+ X(w, n) !== m && (ve(f.current, `${r}.${n}`, m), o.publish(`fieldStates.${r}.${n}`, m), n === "error" && (b.current.errorFields = Object.keys(F.current).filter(
585
+ (A) => !!F.current[A]
586
+ ), o.publish("formState.errorFields", b.current.errorFields)), n === "isDirty" && (b.current.dirtyFields = Object.keys(f.current).filter(
587
+ (A) => f.current[A].isDirty
588
+ ), o.publish("formState.dirtyFields", b.current.dirtyFields)), n === "isTouched" && (b.current.touchedFields = Object.keys(f.current).filter(
589
+ (A) => f.current[A].isTouched
590
+ ), o.publish("formState.touchedFields", b.current.touchedFields)));
591
+ }, []), te = d((r) => {
592
+ k(r, "isDirty", !1), k(r, "isTouched", !1), k(r, "error", null);
593
+ }, []), e = d((r, n) => {
594
+ if (F.current[r] === n) return;
595
+ F.current[r] = n, k(r, "error", n), o.publish(`errors.${r}`, n);
596
+ const w = I();
597
+ b.current.isError !== w && (b.current.isError = w, o.publish("formState.isError", w));
598
+ }, []), i = d((r) => {
599
+ if (!F.current[r]) return;
600
+ F.current[r] = null, k(r, "error", null), o.publish(`errors.${r}`, null);
601
+ const n = I();
602
+ b.current.isError !== n && (b.current.isError = n, o.publish("formState.isError", n));
603
+ }, []), S = d(() => {
604
+ if (Object.keys(F.current) === 0) return;
605
+ Object.keys(F.current).forEach((n) => i(n)), F.current = {};
606
+ const r = I();
607
+ b.current.isError !== r && (b.current.isError = r, o.publish("formState.isError", r));
608
+ }, []), T = d((r) => {
609
+ const n = Re(r.target);
610
+ n ? e(r.target.name, n) : i(r.target.name);
611
+ }, []), j = d((r, n, { shouldDirty: m = !0, shouldOnChange: w = !0 } = {}) => {
612
+ if (n === c.current[r]) return;
613
+ l && v.current.includes(r) && (n = Number(n) || void 0), k(r, "isTouched", !0);
614
+ const $ = n !== u.current[r];
615
+ m && f.current[r].isDirty !== $ && k(r, "isDirty", $);
616
+ const A = B();
617
+ b.current.isDirty !== A && (b.current.isDirty = A, o.publish("formState.isDirty", A)), c.current[r] = n;
618
+ const M = R.current.get(r);
619
+ M && M(n), o.publish(`values.${r}`, n, { shouldDirty: m, shouldOnChange: w }), w && o.publish("onChange", r, n, c.current);
620
+ }, []), O = d((r, n) => (R.current.set(r, n), f.current[r] = { ...fe }, () => {
621
+ a && R.current.delete(r);
622
+ }), []), J = d((r, { keepError: n, keepDirty: m, keepTouched: w, keepCustomState: $, defaultValue: A }) => {
623
+ const M = R.current.get(r);
624
+ if (!M)
625
+ throw new Error(`Cannot reset "${r}" because it's uncontrolled field`);
626
+ u.current[r] = A, c.current[r] = A, M && M(A), n || i(r), m || k(r, "isDirty", !1), w || k(r, "isTouched", !1);
627
+ }, []), z = d((r, n = D.getValues(r)) => {
628
+ o.publish("onBlur", r, n, D.getValues());
629
+ }, []), _ = d((r) => o.subscribe("onChange", r), []), V = d((r) => o.subscribe("onBlur", r), []), D = le(
652
630
  () => ({
653
- subscribe: Z,
631
+ subscribe: ee,
654
632
  reset: C,
655
- resetField: I,
633
+ reload: E,
634
+ resetField: J,
656
635
  setValue: j,
657
- getValues: H,
658
- getErrors: $,
636
+ getValues: Z,
637
+ getErrors: L,
659
638
  getFieldStates: W,
660
- getFormState: M,
639
+ getFormState: U,
661
640
  setError: e,
662
- clearError: a,
663
- clearErrors: R,
641
+ clearError: i,
642
+ clearErrors: S,
664
643
  checkValidity: T,
665
- getNumberFields: oe,
666
- getFieldValidity: se,
667
- getDefaultValues: ne,
668
- setFieldState: w,
669
- triggerFieldBlur: L,
670
- resetFieldState: K,
671
- getControlledFields: ue,
644
+ getNumberFields: ae,
645
+ getFieldValidity: ue,
646
+ getDefaultValues: ce,
647
+ setFieldState: k,
648
+ triggerFieldBlur: z,
649
+ resetFieldState: te,
650
+ getControlledFields: ie,
672
651
  subscribeChange: _,
673
- subscribeBlur: D,
674
- setFormState: Q,
652
+ subscribeBlur: V,
653
+ setFormState: re,
675
654
  getEvents: o.getEvents,
676
655
  getWatchEvents: o.getWatchEvents
677
656
  }),
678
- [
679
- Z,
680
- C,
681
- I,
682
- j,
683
- H,
684
- $,
685
- W,
686
- M,
687
- e,
688
- a,
689
- R,
690
- T,
691
- oe,
692
- se,
693
- ne,
694
- w,
695
- K,
696
- L,
697
- ue,
698
- _,
699
- D,
700
- Q
701
- ]
702
- ), ce = le(
657
+ [h]
658
+ ), se = d(() => {
659
+ [...g.current.querySelectorAll("[name]")].forEach((m) => {
660
+ !m.defaultValue && !R.current.has(m.name) && u.current[m.name] && (m.defaultValue = u.current[m.name]), m.type === "number" && !v.current.includes(m.name) && v.current.push(m.name);
661
+ });
662
+ const n = N();
663
+ c.current = { ...n }, u.current = { ...n };
664
+ }, []), Fe = le(
703
665
  () => ({
704
666
  ref: g,
705
- watch: Y,
706
- actions: N,
707
- registerController: A,
708
- registerHookWatcher: B,
667
+ watch: Q,
668
+ actions: D,
669
+ initForm: se,
670
+ registerController: O,
671
+ registerHookWatcher: q,
709
672
  lastReloadedAt: h,
710
- loadFormValues: x,
711
- getWatchValue: X,
673
+ loadFormValues: N,
674
+ getWatchValue: K,
712
675
  channels: o
713
676
  }),
714
- [
715
- g,
716
- Y,
717
- N,
718
- A,
719
- B,
720
- h,
721
- x,
722
- X,
723
- o
724
- ]
725
- ), Fe = le(() => ({ control: ce, actions: N, watch: Y }), [h, ce, N, Y]);
677
+ [h]
678
+ ), we = le(() => ({ control: Fe, actions: D, watch: Q }), [h]);
726
679
  return be(() => {
727
- if ([...g.current.querySelectorAll("[name]")].forEach((s) => {
728
- !s.defaultValue && !v.current.has(s.name) && c.current[s.name] && (s.defaultValue = c.current[s.name]), s.type === "number" && !m.current.includes(s.name) && m.current.push(s.name);
729
- }), g.current) {
730
- const s = x();
731
- u.current = { ...s }, c.current = { ...s };
732
- }
680
+ g.current && se();
733
681
  }, [h]), be(() => {
734
- F();
735
- }, []), Fe;
682
+ p(!1);
683
+ }, []), we;
736
684
  };
737
685
  export {
738
- Ue as Controller,
739
- Le as Form,
740
- Pe as useController,
741
- qe as useForm,
686
+ qe as Controller,
687
+ Ue as Form,
688
+ je as useController,
689
+ Je as useForm,
742
690
  ye as useFormContext,
743
- Ce as useWatch
691
+ Pe as useWatch
744
692
  };