react-simple-formkit 2.4.3 → 2.4.4

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 jr, { createContext as Cr, useContext as Pr, useCallback as d, useEffect as Er, useState as er, useRef as W, useMemo as dr, useLayoutEffect as hr } from "react";
2
- var ar = { exports: {} }, K = {};
1
+ import Cr, { createContext as jr, useContext as Pr, useCallback as b, useEffect as Er, useRef as W, useState as tr, useMemo as dr, useLayoutEffect as hr } from "react";
2
+ var ir = { exports: {} }, rr = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -11,27 +11,27 @@ var ar = { exports: {} }, K = {};
11
11
  */
12
12
  var mr;
13
13
  function Nr() {
14
- if (mr) return K;
14
+ if (mr) return rr;
15
15
  mr = 1;
16
16
  var n = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
17
- function u(a, c, l) {
17
+ function u(i, c, l) {
18
18
  var o = null;
19
19
  if (l !== void 0 && (o = "" + l), c.key !== void 0 && (o = "" + c.key), "key" in c) {
20
20
  l = {};
21
- for (var m in c)
22
- m !== "key" && (l[m] = c[m]);
21
+ for (var h in c)
22
+ h !== "key" && (l[h] = c[h]);
23
23
  } else l = c;
24
24
  return c = l.ref, {
25
25
  $$typeof: n,
26
- type: a,
26
+ type: i,
27
27
  key: o,
28
28
  ref: c !== void 0 ? c : null,
29
29
  props: l
30
30
  };
31
31
  }
32
- return K.Fragment = t, K.jsx = u, K.jsxs = u, K;
32
+ return rr.Fragment = t, rr.jsx = u, rr.jsxs = u, rr;
33
33
  }
34
- var rr = {};
34
+ var er = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -47,20 +47,20 @@ function Dr() {
47
47
  function n(e) {
48
48
  if (e == null) return null;
49
49
  if (typeof e == "function")
50
- return e.$$typeof === nr ? null : e.displayName || e.name || null;
50
+ return e.$$typeof === sr ? null : e.displayName || e.name || null;
51
51
  if (typeof e == "string") return e;
52
52
  switch (e) {
53
53
  case p:
54
54
  return "Fragment";
55
- case C:
55
+ case O:
56
56
  return "Profiler";
57
- case A:
57
+ case I:
58
58
  return "StrictMode";
59
- case ir:
59
+ case z:
60
60
  return "Suspense";
61
61
  case lr:
62
62
  return "SuspenseList";
63
- case T:
63
+ case A:
64
64
  return "Activity";
65
65
  }
66
66
  if (typeof e == "object")
@@ -69,19 +69,19 @@ function Dr() {
69
69
  ), e.$$typeof) {
70
70
  case S:
71
71
  return "Portal";
72
- case x:
72
+ case N:
73
73
  return (e.displayName || "Context") + ".Provider";
74
- case Y:
74
+ case x:
75
75
  return (e._context.displayName || "Context") + ".Consumer";
76
- case V:
77
- var f = e.render;
78
- return e = e.displayName, e || (e = f.displayName || f.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
- case tr:
80
- return f = e.displayName || null, f !== null ? f : n(e.type) || "Memo";
76
+ case Y:
77
+ var d = e.render;
78
+ return e = e.displayName, e || (e = d.displayName || d.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
+ case nr:
80
+ return d = e.displayName || null, d !== null ? d : n(e.type) || "Memo";
81
81
  case B:
82
- f = e._payload, e = e._init;
82
+ d = e._payload, e = e._init;
83
83
  try {
84
- return n(e(f));
84
+ return n(e(d));
85
85
  } catch {
86
86
  }
87
87
  }
@@ -93,50 +93,50 @@ function Dr() {
93
93
  function u(e) {
94
94
  try {
95
95
  t(e);
96
- var f = !1;
96
+ var d = !1;
97
97
  } catch {
98
- f = !0;
98
+ d = !0;
99
99
  }
100
- if (f) {
101
- f = console;
102
- var y = f.error, j = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
100
+ if (d) {
101
+ d = console;
102
+ var y = d.error, C = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
103
  return y.call(
104
- f,
104
+ d,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
- j
106
+ C
107
107
  ), t(e);
108
108
  }
109
109
  }
110
- function a(e) {
110
+ function i(e) {
111
111
  if (e === p) return "<>";
112
112
  if (typeof e == "object" && e !== null && e.$$typeof === B)
113
113
  return "<...>";
114
114
  try {
115
- var f = n(e);
116
- return f ? "<" + f + ">" : "<...>";
115
+ var d = n(e);
116
+ return d ? "<" + d + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
121
  function c() {
122
- var e = X.A;
122
+ var e = Z.A;
123
123
  return e === null ? null : e.getOwner();
124
124
  }
125
125
  function l() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
128
  function o(e) {
129
- if (sr.call(e, "key")) {
130
- var f = Object.getOwnPropertyDescriptor(e, "key").get;
131
- if (f && f.isReactWarning) return !1;
129
+ if (or.call(e, "key")) {
130
+ var d = Object.getOwnPropertyDescriptor(e, "key").get;
131
+ if (d && d.isReactWarning) return !1;
132
132
  }
133
133
  return e.key !== void 0;
134
134
  }
135
- function m(e, f) {
135
+ function h(e, d) {
136
136
  function y() {
137
137
  J || (J = !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
- f
139
+ d
140
140
  ));
141
141
  }
142
142
  y.isReactWarning = !0, Object.defineProperty(e, "key", {
@@ -144,22 +144,22 @@ function Dr() {
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function E() {
147
+ function v() {
148
148
  var e = n(this.type);
149
- return or[e] || (or[e] = !0, console.error(
149
+ return ur[e] || (ur[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 b(e, f, y, j, M, k, Z, U) {
153
+ function f(e, d, y, C, V, k, Q, U) {
154
154
  return y = k.ref, e = {
155
- $$typeof: O,
155
+ $$typeof: _,
156
156
  type: e,
157
- key: f,
157
+ key: d,
158
158
  props: k,
159
- _owner: M
159
+ _owner: V
160
160
  }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
161
161
  enumerable: !1,
162
- get: E
162
+ get: v
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,7 +174,7 @@ function Dr() {
174
174
  configurable: !1,
175
175
  enumerable: !1,
176
176
  writable: !0,
177
- value: Z
177
+ value: Q
178
178
  }), Object.defineProperty(e, "_debugTask", {
179
179
  configurable: !1,
180
180
  enumerable: !1,
@@ -182,60 +182,60 @@ function Dr() {
182
182
  value: U
183
183
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
184
184
  }
185
- function i(e, f, y, j, M, k, Z, U) {
186
- var w = f.children;
185
+ function a(e, d, y, C, V, k, Q, U) {
186
+ var w = d.children;
187
187
  if (w !== void 0)
188
- if (j)
188
+ if (C)
189
189
  if (fr(w)) {
190
- for (j = 0; j < w.length; j++)
191
- g(w[j]);
190
+ for (C = 0; C < w.length; C++)
191
+ g(w[C]);
192
192
  Object.freeze && Object.freeze(w);
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
197
  else g(w);
198
- if (sr.call(f, "key")) {
198
+ if (or.call(d, "key")) {
199
199
  w = n(e);
200
- var q = Object.keys(f).filter(function(r) {
200
+ var q = Object.keys(d).filter(function(r) {
201
201
  return r !== "key";
202
202
  });
203
- j = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", cr[w + j] || (q = 0 < q.length ? "{" + q.join(": ..., ") + ": ...}" : "{}", console.error(
203
+ C = 0 < q.length ? "{key: someKey, " + q.join(": ..., ") + ": ...}" : "{key: someKey}", ar[w + C] || (q = 0 < q.length ? "{" + q.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} />
207
207
  React keys must be passed directly to JSX without using spread:
208
208
  let props = %s;
209
209
  <%s key={someKey} {...props} />`,
210
- j,
210
+ C,
211
211
  w,
212
212
  q,
213
213
  w
214
- ), cr[w + j] = !0);
214
+ ), ar[w + C] = !0);
215
215
  }
216
- if (w = null, y !== void 0 && (u(y), w = "" + y), o(f) && (u(f.key), w = "" + f.key), "key" in f) {
216
+ if (w = null, y !== void 0 && (u(y), w = "" + y), o(d) && (u(d.key), w = "" + d.key), "key" in d) {
217
217
  y = {};
218
- for (var Q in f)
219
- Q !== "key" && (y[Q] = f[Q]);
220
- } else y = f;
221
- return w && m(
218
+ for (var K in d)
219
+ K !== "key" && (y[K] = d[K]);
220
+ } else y = d;
221
+ return w && h(
222
222
  y,
223
223
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
224
- ), b(
224
+ ), f(
225
225
  e,
226
226
  w,
227
227
  k,
228
- M,
228
+ V,
229
229
  c(),
230
230
  y,
231
- Z,
231
+ Q,
232
232
  U
233
233
  );
234
234
  }
235
235
  function g(e) {
236
- typeof e == "object" && e !== null && e.$$typeof === O && e._store && (e._store.validated = 1);
236
+ typeof e == "object" && e !== null && e.$$typeof === _ && e._store && (e._store.validated = 1);
237
237
  }
238
- var R = jr, O = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), A = Symbol.for("react.strict_mode"), C = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), x = Symbol.for("react.context"), V = Symbol.for("react.forward_ref"), ir = Symbol.for("react.suspense"), lr = Symbol.for("react.suspense_list"), tr = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), T = Symbol.for("react.activity"), nr = Symbol.for("react.client.reference"), X = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, sr = Object.prototype.hasOwnProperty, fr = Array.isArray, z = console.createTask ? console.createTask : function() {
238
+ var R = Cr, _ = Symbol.for("react.transitional.element"), S = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), O = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), N = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), lr = Symbol.for("react.suspense_list"), nr = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), A = Symbol.for("react.activity"), sr = Symbol.for("react.client.reference"), Z = R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, or = Object.prototype.hasOwnProperty, fr = Array.isArray, H = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
241
  R = {
@@ -243,44 +243,44 @@ React keys must be passed directly to JSX without using spread:
243
243
  return e();
244
244
  }
245
245
  };
246
- var J, or = {}, D = R["react-stack-bottom-frame"].bind(
246
+ var J, ur = {}, D = R["react-stack-bottom-frame"].bind(
247
247
  R,
248
248
  l
249
- )(), ur = z(a(l)), cr = {};
250
- rr.Fragment = p, rr.jsx = function(e, f, y, j, M) {
251
- var k = 1e4 > X.recentlyCreatedOwnerStacks++;
252
- return i(
249
+ )(), cr = H(i(l)), ar = {};
250
+ er.Fragment = p, er.jsx = function(e, d, y, C, V) {
251
+ var k = 1e4 > Z.recentlyCreatedOwnerStacks++;
252
+ return a(
253
253
  e,
254
- f,
254
+ d,
255
255
  y,
256
256
  !1,
257
- j,
258
- M,
257
+ C,
258
+ V,
259
259
  k ? Error("react-stack-top-frame") : D,
260
- k ? z(a(e)) : ur
260
+ k ? H(i(e)) : cr
261
261
  );
262
- }, rr.jsxs = function(e, f, y, j, M) {
263
- var k = 1e4 > X.recentlyCreatedOwnerStacks++;
264
- return i(
262
+ }, er.jsxs = function(e, d, y, C, V) {
263
+ var k = 1e4 > Z.recentlyCreatedOwnerStacks++;
264
+ return a(
265
265
  e,
266
- f,
266
+ d,
267
267
  y,
268
268
  !0,
269
- j,
270
- M,
269
+ C,
270
+ V,
271
271
  k ? Error("react-stack-top-frame") : D,
272
- k ? z(a(e)) : ur
272
+ k ? H(i(e)) : cr
273
273
  );
274
274
  };
275
- }()), rr;
275
+ }()), er;
276
276
  }
277
277
  var Rr;
278
278
  function xr() {
279
- return Rr || (Rr = 1, process.env.NODE_ENV === "production" ? ar.exports = Nr() : ar.exports = Dr()), ar.exports;
279
+ return Rr || (Rr = 1, process.env.NODE_ENV === "production" ? ir.exports = Nr() : ir.exports = Dr()), ir.exports;
280
280
  }
281
281
  var pr = xr();
282
282
  const F = () => {
283
- }, Fr = Cr({
283
+ }, Fr = jr({
284
284
  ref: null,
285
285
  watch: F,
286
286
  actions: {
@@ -312,21 +312,21 @@ const F = () => {
312
312
  id: n,
313
313
  control: t,
314
314
  method: u,
315
- action: a,
315
+ action: i,
316
316
  children: c,
317
317
  onChange: l,
318
318
  onBlur: o,
319
- onSubmit: m = () => {
319
+ onSubmit: h = () => {
320
320
  },
321
- onInput: E = () => {
321
+ onInput: v = () => {
322
322
  },
323
- onReset: b = () => {
323
+ onReset: f = () => {
324
324
  },
325
- numberFields: i = [],
325
+ numberFields: a = [],
326
326
  className: g,
327
327
  ...R
328
328
  }) => {
329
- const O = d(
329
+ const _ = b(
330
330
  (S) => {
331
331
  t.ref && (t.ref.current = S, t.ref.current && t.initForm());
332
332
  },
@@ -343,15 +343,15 @@ const F = () => {
343
343
  "form",
344
344
  {
345
345
  id: n,
346
- ref: O,
347
- action: a,
346
+ ref: _,
347
+ action: i,
348
348
  method: u,
349
349
  className: g,
350
- onInput: E,
350
+ onInput: v,
351
351
  onSubmit: (S) => {
352
352
  u || S.preventDefault();
353
353
  const p = t.loadFormValues();
354
- m(p);
354
+ h(p);
355
355
  },
356
356
  onChange: (S) => {
357
357
  const p = S.target.name;
@@ -360,11 +360,11 @@ const F = () => {
360
360
  onBlur: (S) => {
361
361
  const p = S.target.name;
362
362
  if (!p || t.actions.getControlledFields().has(p)) return;
363
- const A = S.target.value;
364
- t.channels.publish("onBlur", p, A, t.actions.getValues());
363
+ const I = S.target.value;
364
+ t.channels.publish("onBlur", p, I, t.actions.getValues());
365
365
  },
366
366
  onReset: (S) => {
367
- t.actions.reset(), b(S);
367
+ t.actions.reset(), f(S);
368
368
  },
369
369
  ...R,
370
370
  children: c
@@ -389,371 +389,381 @@ const F = () => {
389
389
  "tooShort",
390
390
  "typeMismatch",
391
391
  "valueMissing"
392
- ], N = (n = {}, t = "") => t.split(".").reduce((u, a) => u && u[a] !== void 0 ? u[a] : void 0, n), I = (n = {}, t = "", u) => {
393
- const a = Array.isArray(n) ? [...n] : { ...n };
394
- let c = a;
392
+ ], P = (n = {}, t = "") => t.split(".").reduce((u, i) => u && u[i] !== void 0 ? u[i] : void 0, n), M = (n = {}, t = "", u) => {
393
+ const i = Array.isArray(n) ? [...n] : { ...n };
394
+ let c = i;
395
395
  const l = t.split(".");
396
- return l.forEach((o, m) => {
397
- m < l.length - 1 ? (c[o] || (c[o] = /^\d+$/.test(l[m + 1]) ? [] : {}), Array.isArray(c[o]) ? c[o] = [...c[o]] : c[o] = { ...c[o] }, c = c[o]) : c[o] = u;
398
- }), a;
396
+ return l.forEach((o, h) => {
397
+ h < l.length - 1 ? (c[o] || (c[o] = /^\d+$/.test(l[h + 1]) ? [] : {}), Array.isArray(c[o]) ? c[o] = [...c[o]] : c[o] = { ...c[o] }, c = c[o]) : c[o] = u;
398
+ }), i;
399
399
  }, Wr = (n) => {
400
400
  let t = Array.isArray(n) ? [...n] : { ...n };
401
401
  return Object.keys(t).forEach((u) => {
402
402
  if (u.includes(".")) {
403
- const a = N(t, u);
404
- t = I(t, u, a || ""), delete t[u];
403
+ const i = P(t, u);
404
+ t = M(t, u, i || ""), delete t[u];
405
405
  }
406
406
  }), t;
407
407
  }, Ir = ["errors", "fieldStates", "formState"], G = (n) => Ir.some((t) => n.startsWith(t)) ? n : "values." + n, yr = (n) => {
408
408
  typeof n.setCustomValidity == "function" && n.setCustomValidity("");
409
- let t = n.validity, u = $r.find((a) => t[a]);
409
+ let t = n.validity, u = $r.find((i) => t[i]);
410
410
  if (u) return { type: u, message: n.validationMessage };
411
- }, Tr = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((a, c) => {
411
+ }, Tr = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((i, c) => {
412
412
  const l = (t || {})[c];
413
- return n.has(u + c) ? [...a, ...Tr(n, l, u + c + ".")] : l != null && l.isDirty ? [...a, u + c] : a;
414
- }, []), _r = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((a, c) => {
413
+ return n.has(u + c) ? [...i, ...Tr(n, l, u + c + ".")] : l != null && l.isDirty ? [...i, u + c] : i;
414
+ }, []), _r = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((i, c) => {
415
415
  const l = (t || {})[c];
416
- return n.has(u + c) ? [...a, ..._r(n, l, u + c + ".")] : l != null && l.isTouched ? [...a, u + c] : a;
417
- }, []), Or = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((a, c) => {
416
+ return n.has(u + c) ? [...i, ..._r(n, l, u + c + ".")] : l != null && l.isTouched ? [...i, u + c] : i;
417
+ }, []), Or = (n = /* @__PURE__ */ new Set(), t = {}, u = "") => Object.keys(t || {}).reduce((i, c) => {
418
418
  const l = (t || {})[c];
419
- return n.has(u + c) ? [...a, ...Or(n, l, u + c + ".")] : l ? [...a, u + c] : a;
420
- }, []), Gr = ({ control: n, name: t, compute: u }) => {
421
- const { getWatchValue: a, registerHookWatcher: c } = n || Ar(), l = a({ name: t, compute: u }), [o, m] = er(l);
422
- return Er(() => c({ name: t, compute: u, value: o, setValue: m }), []), o;
423
- }, Mr = ({ control: n, name: t, defaultValue: u }) => {
424
- const { actions: a, registerController: c, channels: l, getWatchValue: o } = n || Ar(), m = W(), E = W(), b = N(a.getDefaultValues(), t) || u || "", [i, g] = er(b), [R, O] = er({}), S = d(
425
- (A, { shouldDirty: C = !0, shouldOnChange: Y = !0 } = {}) => {
426
- var V;
427
- let x = A;
428
- ((V = A == null ? void 0 : A.target) == null ? void 0 : V.value) !== void 0 && (x = A.target.value), g(x), a.setValue(t, x, { shouldDirty: C, shouldOnChange: Y });
419
+ return n.has(u + c) ? [...i, ...Or(n, l, u + c + ".")] : l ? [...i, u + c] : i;
420
+ }, []), Mr = ({ control: n, name: t, defaultValue: u, shouldUnRegister: i }) => {
421
+ const { actions: c, registerController: l, channels: o, getWatchValue: h } = n || Ar(), v = W(), f = W(), a = P(c.getDefaultValues(), t) || u || "", [g, R] = tr(a), [_, S] = tr({}), p = b(
422
+ (O, { shouldDirty: x = !0, shouldOnChange: N = !0 } = {}) => {
423
+ var z;
424
+ let Y = O;
425
+ ((z = O == null ? void 0 : O.target) == null ? void 0 : z.value) !== void 0 && (Y = O.target.value), R(Y), c.setValue(t, Y, { shouldDirty: x, shouldOnChange: N });
429
426
  },
430
- [a.setValue]
431
- ), p = d((A) => {
432
- const C = a.getValues(), Y = A ?? N(C, t);
433
- l.publish("onBlur", t, Y, C);
427
+ [c.setValue]
428
+ ), I = b((O) => {
429
+ const x = c.getValues(), N = O ?? P(x, t);
430
+ o.publish("onBlur", t, N, x);
434
431
  }, []);
435
432
  return Er(() => {
436
- const A = c(t, g);
433
+ const O = l(t, R, { shouldUnRegister: i });
437
434
  return () => {
438
- A(), E.current && E.current();
435
+ O(), f.current && f.current();
439
436
  };
440
- }, []), new Proxy(
441
- { ref: m, name: t, defaultValue: b, value: i, onChange: S, onBlur: p, fieldState: R },
437
+ }, [i]), new Proxy(
438
+ { ref: v, name: t, defaultValue: a, value: g, onChange: p, onBlur: I, fieldState: _ },
442
439
  {
443
- get(A, C, Y) {
444
- return typeof C == "string" && C === "fieldState" && (E.current && E.current(), E.current = a.subscribe(`fieldStates.${t}`, () => {
445
- O(o({ name: `fieldStates.${t}` }));
446
- })), Reflect.get(A, C, Y);
440
+ get(O, x, N) {
441
+ return typeof x == "string" && x === "fieldState" && (f.current && f.current(), f.current = c.subscribe(`fieldStates.${t}`, () => {
442
+ S(h({ name: `fieldStates.${t}` }));
443
+ })), Reflect.get(O, x, N);
447
444
  }
448
445
  }
449
446
  );
450
- }, Jr = ({
447
+ }, Gr = ({
451
448
  name: n,
452
449
  control: t,
453
- defaultValue: u,
454
- render: a = ({ ref: c, name: l, defaultValue: o, value: m, onChange: E, onBlur: b, fieldState: i }) => null
450
+ shouldUnRegister: u,
451
+ defaultValue: i,
452
+ render: c = ({ ref: l, name: o, defaultValue: h, value: v, onChange: f, onBlur: a, fieldState: g }) => null
455
453
  }) => {
456
- const c = Mr({ name: n, defaultValue: u, control: t });
457
- return a(c);
454
+ const l = Mr({ name: n, defaultValue: i, shouldUnRegister: u, control: t });
455
+ return c(l);
458
456
  }, Yr = () => {
459
- const [n, t] = er(), u = d(() => t((/* @__PURE__ */ new Date()).toString()), []);
457
+ const [n, t] = tr(), u = b(() => t((/* @__PURE__ */ new Date()).toString()), []);
460
458
  return [n, u];
461
459
  }, Vr = () => {
462
- const [, n] = er({});
463
- return d(() => n({}), []);
460
+ const [, n] = tr({});
461
+ return b(() => n({}), []);
464
462
  }, Lr = ({ channels: n, getWatchValue: t }) => {
465
- const u = Vr(), a = d((o) => {
463
+ const u = Vr(), i = b((o) => {
466
464
  if (!o)
467
465
  return n.subscribeWatch("values", () => u()), t();
468
466
  if (typeof o == "string") {
469
- const m = G(o);
470
- n.subscribeWatch(m, (E, b) => {
471
- E !== b && u();
467
+ const h = G(o);
468
+ n.subscribeWatch(h, (v, f) => {
469
+ v !== f && u();
472
470
  });
473
471
  }
474
- return Array.isArray(o) && o.forEach((m) => {
475
- const E = G(m);
476
- n.subscribeWatch(E, (b, i) => {
477
- b !== i && u();
472
+ return Array.isArray(o) && o.forEach((h) => {
473
+ const v = G(h);
474
+ n.subscribeWatch(v, (f, a) => {
475
+ f !== a && u();
478
476
  });
479
477
  }), t({ name: o });
480
- }, []), c = d(({ name: o, compute: m, setValue: E }) => {
481
- if (typeof m == "function")
478
+ }, []), c = b(({ name: o, compute: h, setValue: v }) => {
479
+ if (typeof h == "function")
482
480
  return n.subscribe("values", () => {
483
- const i = t({ compute: m });
484
- E(i);
481
+ const a = t({ compute: h });
482
+ v(a);
485
483
  });
486
484
  if (!o)
487
485
  return n.subscribe("values", () => {
488
- E(t());
486
+ v(t());
489
487
  });
490
488
  if (typeof o == "string") {
491
- const b = G(o);
492
- return n.subscribe(b, () => {
489
+ const f = G(o);
490
+ return n.subscribe(f, () => {
493
491
  const g = t({ name: o });
494
- E(g);
492
+ v(g);
495
493
  });
496
494
  }
497
495
  if (Array.isArray(o)) {
498
- const b = [];
499
- return o.forEach((i) => {
500
- const g = G(i), R = n.subscribe(g, () => {
501
- const O = t({ name: o });
502
- E(O);
496
+ const f = [];
497
+ return o.forEach((a) => {
498
+ const g = G(a), R = n.subscribe(g, () => {
499
+ const _ = t({ name: o });
500
+ v(_);
503
501
  });
504
- b.push(R);
505
- }), () => b.forEach((i) => i());
502
+ f.push(R);
503
+ }), () => f.forEach((a) => a());
506
504
  }
507
505
  throw new Error("Parameters of name must be string or array of string or compute must be a function");
508
- }, []), l = d((o, m) => {
506
+ }, []), l = b((o, h) => {
509
507
  if (!o)
510
- return n.subscribe("values", () => m(t()));
508
+ return n.subscribe("values", () => h(t()));
511
509
  if (["onChange", "onBlur"].includes(o))
512
- return n.subscribe(o, m);
510
+ return n.subscribe(o, h);
513
511
  if (typeof o == "string") {
514
- const E = G(o);
515
- return n.subscribe(E, () => m(t({ name: o })));
512
+ const v = G(o);
513
+ return n.subscribe(v, () => h(t({ name: o })));
516
514
  }
517
515
  if (Array.isArray(o)) {
518
- const E = [];
519
- return o.forEach((b) => {
520
- const i = G(b), g = n.subscribe(i, () => {
521
- m(t({ name: o }));
516
+ const v = [];
517
+ return o.forEach((f) => {
518
+ const a = G(f), g = n.subscribe(a, () => {
519
+ h(t({ name: o }));
522
520
  });
523
- E.push(g);
524
- }), () => E.forEach((b) => b());
521
+ v.push(g);
522
+ }), () => v.forEach((f) => f());
525
523
  }
526
524
  throw new Error("Parameters of name must be string or array of string");
527
525
  }, []);
528
- return { watch: a, registerHookWatcher: c, getWatchValue: t, subscribe: l };
526
+ return { watch: i, registerHookWatcher: c, getWatchValue: t, subscribe: l };
529
527
  }, Br = ({ getWatchValue: n }) => {
530
- const t = W(/* @__PURE__ */ new Map()), u = W(/* @__PURE__ */ new Map()), a = d(() => u.current, []), c = d(() => t.current, []), l = d(() => {
528
+ const t = W(/* @__PURE__ */ new Map()), u = W(/* @__PURE__ */ new Map()), i = b(() => u.current, []), c = b(() => t.current, []), l = b(() => {
531
529
  t.current.clear(), u.current.clear();
532
- }, []), o = d((i, ...g) => {
533
- const R = t.current.get(i), O = u.current.get(i);
534
- R && R.forEach((S) => S(...g)), O && O.forEach((S) => S(...g)), t.current.forEach((S, p) => {
535
- if (p !== i && i.startsWith(p)) {
536
- const A = n({ name: p.replace("values.", "").replace("values", "") });
537
- S.forEach((C) => C(I(A, i.replace(`${p}.`, ""), g[0])));
530
+ }, []), o = b((a, ...g) => {
531
+ const R = t.current.get(a), _ = u.current.get(a);
532
+ R && R.forEach((S) => S(...g)), _ && _.forEach((S) => S(...g)), t.current.forEach((S, p) => {
533
+ if (p !== a && a.startsWith(p)) {
534
+ const I = n({ name: p.replace("values.", "").replace("values", "") });
535
+ S.forEach((O) => O(M(I, a.replace(`${p}.`, ""), g[0])));
538
536
  }
539
537
  }), u.current.forEach((S, p) => {
540
- if (p !== i && i.startsWith(p)) {
541
- const A = n({ name: p.replace("values.", "").replace("values", "") });
542
- S.forEach((C) => C(I(A, i.replace(`${p}.`, ""), g[0])));
538
+ if (p !== a && a.startsWith(p)) {
539
+ const I = n({ name: p.replace("values.", "").replace("values", "") });
540
+ S.forEach((O) => O(M(I, a.replace(`${p}.`, ""), g[0])));
543
541
  }
544
542
  });
545
- }, []), m = d((i) => {
543
+ }, []), h = b((a) => {
546
544
  t.current.forEach((g, R) => {
547
- R.startsWith(i) && g.forEach((O) => O(n({ name: R.replace("values.", "").replace("values", "") })));
545
+ R.startsWith(a) && g.forEach((_) => _(n({ name: R.replace("values.", "").replace("values", "") })));
548
546
  }), u.current.forEach((g, R) => {
549
- R.startsWith(i) && g.forEach((O) => O(n({ name: R.replace("values.", "").replace("values", "") })));
547
+ R.startsWith(a) && g.forEach((_) => _(n({ name: R.replace("values.", "").replace("values", "") })));
550
548
  });
551
- }, []), E = d((i, g) => (t.current.has(i) || t.current.set(i, /* @__PURE__ */ new Set()), t.current.get(i).add(g), () => {
549
+ }, []), v = b((a, g) => (t.current.has(a) || t.current.set(a, /* @__PURE__ */ new Set()), t.current.get(a).add(g), () => {
552
550
  var R;
553
- return (R = t.current.get(i)) == null ? void 0 : R.delete(g);
554
- }), []), b = d((i, g) => {
555
- u.current.has(i) || (u.current.set(i, /* @__PURE__ */ new Set()), u.current.get(i).add(g));
551
+ return (R = t.current.get(a)) == null ? void 0 : R.delete(g);
552
+ }), []), f = b((a, g) => {
553
+ u.current.has(a) || (u.current.set(a, /* @__PURE__ */ new Set()), u.current.get(a).add(g));
556
554
  }, []);
557
- return { reset: l, publish: o, subscribe: E, subscribeWatch: b, getEvents: c, getWatchEvents: a, trigger: m };
558
- }, zr = ({ defaultValues: n = kr, shouldUnRegister: t = !1, groups: u = [] } = {}) => {
559
- const [a, c] = Yr(), l = W(), o = W(/* @__PURE__ */ new Map()), m = W({}), E = W({}), b = W({ ...Sr }), i = W({ ...n }), g = W({ ...n }), R = W(new Set(u)), O = d((r, s = g.current) => Object.keys(s).reduce((h, v) => {
560
- if (typeof s[v] == "object")
561
- return { ...h, [v]: O(r, s[v]) };
562
- const P = { ...r ? {} : E.current[v] || {}, ...br };
563
- return { ...h, [v]: P };
564
- }, {}), []), S = d(
565
- (r = {}, { clearCustomFormStates: s = !1, clearCustomFieldStates: h = !1, groups: v = R.current } = {}) => {
566
- g.current = { ...g.current, ...r }, i.current = { ...g.current }, o.current.forEach((P, _) => {
567
- P(N(g.current, _) ?? "");
568
- }), m.current = {}, R.current = new Set(v), o.current = /* @__PURE__ */ new Map(), b.current = { ...s ? {} : b.current, ...Sr }, E.current = O(h), T.reset(), c();
555
+ return { reset: l, publish: o, subscribe: v, subscribeWatch: f, getEvents: c, getWatchEvents: i, trigger: h };
556
+ }, Jr = ({ defaultValues: n = kr, shouldUnRegister: t = !1, groups: u = [] } = {}) => {
557
+ const [i, c] = Yr(), l = W(), o = W(/* @__PURE__ */ new Map()), h = W({}), v = W({}), f = W({ ...Sr }), a = W({ ...n }), g = W({ ...n }), R = W(new Set(u)), _ = b((r, s = g.current) => Object.keys(s).reduce((E, m) => {
558
+ if (typeof s[m] == "object")
559
+ return { ...E, [m]: _(r, s[m]) };
560
+ const j = { ...r ? {} : v.current[m] || {}, ...br };
561
+ return { ...E, [m]: j };
562
+ }, {}), []), S = b(
563
+ (r = {}, { clearCustomFormStates: s = !1, clearCustomFieldStates: E = !1, groups: m = R.current } = {}) => {
564
+ g.current = { ...g.current, ...r }, a.current = { ...g.current }, o.current.forEach((j, T) => {
565
+ j(P(g.current, T) ?? "");
566
+ }), h.current = {}, R.current = new Set(m), o.current = /* @__PURE__ */ new Map(), f.current = { ...s ? {} : f.current, ...Sr }, v.current = _(E), A.reset(), c();
569
567
  },
570
568
  []
571
- ), p = d(() => {
569
+ ), p = b(() => {
572
570
  let r = Object.fromEntries(new FormData(l.current));
573
- o.current.forEach((h, v) => {
574
- r = I(r, v, N(i.current, v));
571
+ o.current.forEach((E, m) => {
572
+ r = M(r, m, P(a.current, m));
575
573
  });
576
- let s = { ...i.current, ...r };
574
+ let s = { ...a.current, ...r };
577
575
  return Wr(s);
578
- }, []), A = d((r) => yr(r.target), []), C = d(() => g.current, []), Y = d(() => o.current, []), x = d((r, s) => s ? Array.isArray(s) ? s.reduce((h, v) => ({ ...h, [v]: N(r, v) }), {}) : N(r, s) : { ...r }, []), V = d((r) => x(i.current, r), [x]), ir = d((r) => x(m.current, r), [x]), lr = d((r) => x(E.current, r), [x]), tr = d(
579
- (r) => x({ ...b.current, lastReset: a }, r),
580
- [a]
581
- ), B = d(({ name: r, compute: s } = {}) => !r && !s || r === "values" ? V() : typeof s == "function" ? s(V()) : Array.isArray(r) ? r.reduce((h, v) => ({ ...h, [v]: B({ name: v }) }), {}) : N(
576
+ }, []), I = b((r) => yr(r.target), []), O = b(() => g.current, []), x = b(() => o.current, []), N = b((r, s) => s ? Array.isArray(s) ? s.reduce((E, m) => ({ ...E, [m]: P(r, m) }), {}) : P(r, s) : { ...r }, []), Y = b((r) => N(a.current, r), [N]), z = b((r) => N(h.current, r), [N]), lr = b((r) => N(v.current, r), [N]), nr = b(
577
+ (r) => N({ ...f.current, lastReset: i }, r),
578
+ [i]
579
+ ), B = b(({ name: r, compute: s } = {}) => !r && !s || r === "values" ? Y() : typeof s == "function" ? s(Y()) : Array.isArray(r) ? r.reduce((E, m) => ({ ...E, [m]: B({ name: m }) }), {}) : P(
582
580
  {
583
- ...i.current,
584
- errors: m.current,
585
- fieldStates: E.current,
586
- formState: tr()
581
+ ...a.current,
582
+ errors: h.current,
583
+ fieldStates: v.current,
584
+ formState: nr()
587
585
  },
588
586
  r
589
- ), []), T = Br({ getWatchValue: B }), { watch: nr, registerHookWatcher: X, subscribe: sr } = Lr({ getWatchValue: B, channels: T }), fr = d((r, s) => {
590
- const h = b.current, v = N(h, r);
591
- v !== s && (b.current = I(b.current, r, s), T.publish(`formState.${r}`, s, v));
592
- }, []), z = d((r, s) => {
587
+ ), []), A = Br({ getWatchValue: B }), { watch: sr, registerHookWatcher: Z, subscribe: or } = Lr({ getWatchValue: B, channels: A }), fr = b((r, s) => {
588
+ const E = f.current, m = P(E, r);
589
+ m !== s && (f.current = M(f.current, r, s), A.publish(`formState.${r}`, s, m));
590
+ }, []), H = b((r, s) => {
593
591
  D(r, "error", s);
594
- }, []), J = d((r) => {
592
+ }, []), J = b((r) => {
595
593
  D(r, "error", null);
596
- }, []), or = d(() => {
597
- b.current.isError && Object.keys(m.current).forEach((r) => J(r));
598
- }, []), D = d((r, s, h) => {
594
+ }, []), ur = b(() => {
595
+ f.current.isError && Object.keys(h.current).forEach((r) => J(r));
596
+ }, []), D = b((r, s, E) => {
599
597
  try {
600
- if (typeof h == "function" && (h = h(B({ name: r }))), R.current.has(r))
601
- if (typeof h == "object" && h !== null) {
602
- Object.keys(h).forEach((_) => {
603
- D(`${r}.${_}`, s, h[_]);
598
+ if (typeof E == "function" && (E = E(B({ name: r }))), R.current.has(r))
599
+ if (typeof E == "object" && E !== null) {
600
+ Object.keys(E).forEach((T) => {
601
+ D(`${r}.${T}`, s, E[T]);
604
602
  });
605
603
  return;
606
604
  } else
607
605
  return console.error(
608
606
  `Cannot set primitive value for nested parent field "${r}". Please set value for its children or provide an object.`
609
607
  );
610
- const v = N(E.current, r) || { ...br }, P = N(v, s);
611
- if (P !== h) {
612
- if (E.current = I(E.current, `${r}.${s}`, h), T.publish(`fieldStates.${r}.${s}`, h, P), s === "error") {
613
- const _ = N(m.current, r), L = h || null;
614
- _ !== L && (m.current = I(m.current, r, L), T.publish(`errors.${r}`, L, _));
615
- const $ = Or(R.current, m.current);
616
- b.current.errorFields = $, T.publish("formState.errorFields", $);
617
- const H = $.length > 0;
618
- if (b.current.isError !== H) {
619
- const gr = b.current.isError;
620
- b.current.isError = H, T.publish("formState.isError", H, gr);
608
+ const m = P(v.current, r) || { ...br }, j = P(m, s);
609
+ if (j !== E) {
610
+ if (v.current = M(v.current, `${r}.${s}`, E), A.publish(`fieldStates.${r}.${s}`, E, j), s === "error") {
611
+ const T = P(h.current, r), L = E || null;
612
+ T !== L && (h.current = M(h.current, r, L), A.publish(`errors.${r}`, L, T));
613
+ const $ = Or(R.current, h.current);
614
+ f.current.errorFields = $, A.publish("formState.errorFields", $);
615
+ const X = $.length > 0;
616
+ if (f.current.isError !== X) {
617
+ const gr = f.current.isError;
618
+ f.current.isError = X, A.publish("formState.isError", X, gr);
621
619
  }
622
620
  }
623
621
  if (s === "isDirty") {
624
- const _ = Tr(R.current, E.current);
625
- b.current.dirtyFields = _, T.publish("formState.dirtyFields", _);
626
- const L = _.length > 0;
627
- if (b.current.isDirty !== L) {
628
- const $ = b.current.isDirty;
629
- b.current.isDirty = L, T.publish("formState.isDirty", L, $);
622
+ const T = Tr(R.current, v.current);
623
+ f.current.dirtyFields = T, A.publish("formState.dirtyFields", T);
624
+ const L = T.length > 0;
625
+ if (f.current.isDirty !== L) {
626
+ const $ = f.current.isDirty;
627
+ f.current.isDirty = L, A.publish("formState.isDirty", L, $);
630
628
  }
631
629
  }
632
630
  if (s === "isTouched") {
633
- const _ = _r(R.current, E.current);
634
- b.current.touchedFields = _, T.publish("formState.touchedFields", _);
631
+ const T = _r(R.current, v.current);
632
+ f.current.touchedFields = T, A.publish("formState.touchedFields", T);
635
633
  }
636
634
  }
637
- } catch (v) {
638
- console.log(v);
635
+ } catch (m) {
636
+ console.log(m);
639
637
  }
640
- }, []), ur = d((r) => {
638
+ }, []), cr = b((r) => {
641
639
  D(r, "isDirty", !1), D(r, "isTouched", !1), D(r, "error", !1);
642
- }, []), cr = d((r) => {
640
+ }, []), ar = b((r) => {
643
641
  const s = yr(r.target);
644
- s ? z(r.target.name, s) : J(r.target.name);
645
- }, []), e = d((r, s, { shouldDirty: h = !0, shouldOnChange: v = !0 } = {}) => {
646
- if (typeof s == "function" && (s = s(V(r))), R.current.has(r)) {
642
+ s ? H(r.target.name, s) : J(r.target.name);
643
+ }, []), e = b((r, s, { shouldDirty: E = !0, shouldOnChange: m = !0 } = {}) => {
644
+ if (typeof s == "function" && (s = s(Y(r))), R.current.has(r)) {
647
645
  typeof s == "object" && s !== null ? Object.keys(s).forEach(($) => {
648
- e(`${r}.${$}`, s[$], { shouldDirty: h, shouldOnChange: v });
646
+ e(`${r}.${$}`, s[$], { shouldDirty: E, shouldOnChange: m });
649
647
  }) : console.error(
650
648
  `Cannot set primitive value for nested parent field "${r}". Please set value for its children or provide an object.`
651
649
  );
652
650
  return;
653
651
  }
654
- const P = N(i.current, r);
655
- if (s === P) return;
656
- i.current = I(i.current, r, s), T.publish(`values.${r}`, s, P);
657
- const _ = o.current.get(r);
658
- if (_ && _(s), r.includes(".")) {
659
- const $ = r.split("."), H = $.findIndex(
652
+ const j = P(a.current, r);
653
+ if (s === j) return;
654
+ a.current = M(a.current, r, s), A.publish(`values.${r}`, s, j);
655
+ const T = o.current.get(r);
656
+ if (T && T(s), r.includes(".")) {
657
+ const $ = r.split("."), X = $.findIndex(
660
658
  (gr, wr) => !R.current.has($.slice(0, wr + 1).join("."))
661
659
  );
662
- H !== -1 && (r = $.slice(0, H + 1).join("."));
660
+ X !== -1 && (r = $.slice(0, X + 1).join("."));
663
661
  }
664
662
  s && D(r, "isTouched", !0);
665
- const L = s !== (N(g.current, r) || "");
666
- h && D(r, "isDirty", L), v && T.publish("onChange", r, s, P);
667
- }, []), f = d((r) => {
663
+ const L = s !== (P(g.current, r) || "");
664
+ E && D(r, "isDirty", L), m && A.publish("onChange", r, s, j);
665
+ }, []), d = b((r) => {
668
666
  const s = r.split(".");
669
- let h = "";
670
- s.forEach((v, P) => {
671
- P < s.length - 1 && (h = h ? `${h}.${v}` : v, R.current.add(h));
667
+ let E = "";
668
+ s.forEach((m, j) => {
669
+ j < s.length - 1 && (E = E ? `${E}.${m}` : m, R.current.add(E));
672
670
  });
673
- }, []), y = d((r) => {
674
- Array.isArray(r) ? r.forEach((s) => f(s + ".")) : f(r + ".");
675
- }, []), j = d((r = "", s) => (o.current.set(r, s), E.current = I(E.current, r, { ...br }), r.includes(".") && f(r), () => {
676
- t && o.current.delete(r);
677
- }), []), M = d((r, { keepError: s, keepDirty: h, keepTouched: v, defaultValue: P }) => {
678
- const _ = o.current.get(r);
679
- if (!_)
671
+ }, []), y = b((r) => {
672
+ Array.isArray(r) ? r.forEach((s) => d(s + ".")) : d(r + ".");
673
+ }, []), C = b(
674
+ (r = "", s, { shouldUnRegister: E = t } = {}) => {
675
+ if (!r) {
676
+ console.error("Controller must have a name");
677
+ return;
678
+ }
679
+ return o.current.set(r, s), v.current = M(v.current, r, { ...br }), r.includes(".") && d(r), () => {
680
+ E && o.current.delete(r);
681
+ };
682
+ },
683
+ []
684
+ ), V = b((r, { keepError: s, keepDirty: E, keepTouched: m, defaultValue: j }) => {
685
+ const T = o.current.get(r);
686
+ if (!T)
680
687
  throw new Error(`Cannot reset "${r}" because it's uncontrolled field`);
681
- g.current = I(g.current, r, P), i.current = I(i.current, r, P), _ && _(P), s || J(r), h || D(r, "isDirty", !1), v || D(r, "isTouched", !1);
682
- }, []), k = d((r) => {
683
- if (!r) return T.trigger("values");
688
+ g.current = M(g.current, r, j), a.current = M(a.current, r, j), T && T(j), s || J(r), E || D(r, "isDirty", !1), m || D(r, "isTouched", !1);
689
+ }, []), k = b((r) => {
690
+ if (!r) return A.trigger("values");
684
691
  if (!Array.isArray(r)) {
685
692
  const s = G(r);
686
- T.trigger(s);
693
+ A.trigger(s);
687
694
  return;
688
695
  }
689
696
  r.forEach((s) => {
690
- const h = G(s);
691
- T.trigger(h);
697
+ const E = G(s);
698
+ A.trigger(E);
692
699
  });
693
- }, []), Z = d((r, s = U.getValues(r)) => {
694
- T.publish("onBlur", r, s, U.getValues());
700
+ }, []), Q = b((r, s = U.getValues(r)) => {
701
+ A.publish("onBlur", r, s, U.getValues());
695
702
  }, []), U = dr(
696
703
  () => ({
697
- subscribe: sr,
704
+ subscribe: or,
698
705
  reset: S,
699
706
  trigger: k,
700
707
  reload: c,
701
- resetField: M,
708
+ resetField: V,
702
709
  setValue: e,
703
- getValues: V,
704
- getErrors: ir,
710
+ getValues: Y,
711
+ getErrors: z,
705
712
  getFieldStates: lr,
706
- getFormState: tr,
707
- setError: z,
713
+ getFormState: nr,
714
+ setError: H,
708
715
  clearError: J,
709
- clearErrors: or,
710
- checkValidity: cr,
711
- getFieldValidity: A,
712
- getDefaultValues: C,
716
+ clearErrors: ur,
717
+ checkValidity: ar,
718
+ getFieldValidity: I,
719
+ getDefaultValues: O,
713
720
  setFieldState: D,
714
- triggerFieldBlur: Z,
715
- resetFieldState: ur,
716
- getControlledFields: Y,
721
+ triggerFieldBlur: Q,
722
+ resetFieldState: cr,
723
+ getControlledFields: x,
717
724
  setFormState: fr,
718
- getEvents: T.getEvents,
719
- getWatchEvents: T.getWatchEvents,
725
+ getEvents: A.getEvents,
726
+ getWatchEvents: A.getWatchEvents,
720
727
  addGroups: y
721
728
  }),
722
- [a]
723
- ), w = d(() => {
724
- [...l.current.querySelectorAll("[name]")].forEach((h) => {
725
- const v = h.name || "";
726
- v.includes(".") && f(v), !h.defaultValue && !o.current.has(v) && N(g.current, v) && (h.defaultValue = N(g.current, v));
729
+ [i]
730
+ ), w = b(() => {
731
+ [...l.current.querySelectorAll("[name]")].forEach((E) => {
732
+ const m = E.name || "";
733
+ m.includes(".") && d(m), !E.defaultValue && !o.current.has(m) && P(g.current, m) && (E.defaultValue = P(g.current, m));
727
734
  });
728
735
  const s = p();
729
- i.current = { ...s }, g.current = { ...s };
736
+ a.current = { ...s }, g.current = { ...s };
730
737
  }, []), q = dr(
731
738
  () => ({
732
739
  ref: l,
733
- watch: nr,
740
+ watch: sr,
734
741
  actions: U,
735
742
  initForm: w,
736
- registerController: j,
737
- registerHookWatcher: X,
738
- lastReloadedAt: a,
743
+ registerController: C,
744
+ registerHookWatcher: Z,
745
+ lastReloadedAt: i,
739
746
  loadFormValues: p,
740
747
  getWatchValue: B,
741
- channels: T
748
+ channels: A
742
749
  }),
743
- [a]
744
- ), Q = dr(() => ({ control: q, actions: U, watch: nr }), [a]);
750
+ [i]
751
+ ), K = dr(() => ({ control: q, actions: U, watch: sr }), [i]);
745
752
  return hr(() => {
746
753
  l.current && w();
747
- }, [a]), hr(() => {
748
- E.current = O(!1);
749
- }, []), Q;
754
+ }, [i]), hr(() => {
755
+ v.current = _(!1);
756
+ }, []), K;
757
+ }, zr = ({ control: n, name: t, compute: u }) => {
758
+ const { getWatchValue: i, registerHookWatcher: c } = n || Ar(), l = i({ name: t, compute: u }), [o, h] = tr(l);
759
+ return Er(() => c({ name: t, compute: u, value: o, setValue: h }), []), o;
750
760
  };
751
761
  export {
752
- Jr as Controller,
762
+ Gr as Controller,
753
763
  qr as Form,
754
764
  Wr as restoreFromDotNotation,
755
765
  Mr as useController,
756
- zr as useForm,
766
+ Jr as useForm,
757
767
  Ar as useFormContext,
758
- Gr as useWatch
768
+ zr as useWatch
759
769
  };