@ram_28/kf-ai-sdk 1.0.18 → 1.0.19

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.
package/dist/form.mjs CHANGED
@@ -1,51 +1,51 @@
1
1
  var Bt = Object.defineProperty;
2
2
  var Pt = (e, t, r) => t in e ? Bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var we = (e, t, r) => Pt(e, typeof t != "symbol" ? t + "" : t, r);
4
- import X, { useState as ye, useRef as qe, useEffect as $e, useMemo as Ne, useCallback as te } from "react";
5
- import { useQuery as ct } from "@tanstack/react-query";
6
- import { a as pe } from "./client-CfvLiGfP.js";
7
- import { g as qt } from "./metadata-DBcoDth-.js";
8
- var Le = (e) => e.type === "checkbox", ge = (e) => e instanceof Date, G = (e) => e == null;
9
- const St = (e) => typeof e == "object";
10
- var I = (e) => !G(e) && !Array.isArray(e) && St(e) && !ge(e), $t = (e) => I(e) && e.target ? Le(e.target) ? e.target.checked : e.target.value : e, jt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Wt = (e, t) => e.has(jt(t)), Ht = (e) => {
3
+ var ve = (e, t, r) => Pt(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import X, { useState as ge, useRef as Se, useEffect as We, useMemo as Re, useCallback as te } from "react";
5
+ import { useQuery as dt } from "@tanstack/react-query";
6
+ import { a as be } from "./client-V-WzUb8H.js";
7
+ import { g as qt } from "./metadata-B88D_pVS.js";
8
+ var Te = (e) => e.type === "checkbox", pe = (e) => e instanceof Date, J = (e) => e == null;
9
+ const Rt = (e) => typeof e == "object";
10
+ var U = (e) => !J(e) && !Array.isArray(e) && Rt(e) && !pe(e), $t = (e) => U(e) && e.target ? Te(e.target) ? e.target.checked : e.target.value : e, jt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Wt = (e, t) => e.has(jt(t)), Ht = (e) => {
11
11
  const t = e.constructor && e.constructor.prototype;
12
- return I(t) && t.hasOwnProperty("isPrototypeOf");
13
- }, rt = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
14
- function k(e) {
12
+ return U(t) && t.hasOwnProperty("isPrototypeOf");
13
+ }, st = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
14
+ function P(e) {
15
15
  if (e instanceof Date)
16
16
  return new Date(e);
17
17
  const t = typeof FileList < "u" && e instanceof FileList;
18
- if (rt && (e instanceof Blob || t))
18
+ if (st && (e instanceof Blob || t))
19
19
  return e;
20
20
  const r = Array.isArray(e);
21
- if (!r && !(I(e) && Ht(e)))
21
+ if (!r && !(U(e) && Ht(e)))
22
22
  return e;
23
23
  const s = r ? [] : Object.create(Object.getPrototypeOf(e));
24
24
  for (const i in e)
25
- Object.prototype.hasOwnProperty.call(e, i) && (s[i] = k(e[i]));
25
+ Object.prototype.hasOwnProperty.call(e, i) && (s[i] = P(e[i]));
26
26
  return s;
27
27
  }
28
- var He = (e) => /^\w*$/.test(e), C = (e) => e === void 0, st = (e) => Array.isArray(e) ? e.filter(Boolean) : [], it = (e) => st(e.replace(/["|']|\]/g, "").split(/\.|\[/)), g = (e, t, r) => {
29
- if (!t || !I(e))
28
+ var Ke = (e) => /^\w*$/.test(e), T = (e) => e === void 0, it = (e) => Array.isArray(e) ? e.filter(Boolean) : [], at = (e) => it(e.replace(/["|']|\]/g, "").split(/\.|\[/)), g = (e, t, r) => {
29
+ if (!t || !U(e))
30
30
  return r;
31
- const s = (He(t) ? [t] : it(t)).reduce((i, n) => G(i) ? i : i[n], e);
32
- return C(s) || s === e ? C(e[t]) ? r : e[t] : s;
33
- }, ie = (e) => typeof e == "boolean", re = (e) => typeof e == "function", R = (e, t, r) => {
31
+ const s = (Ke(t) ? [t] : at(t)).reduce((i, n) => J(i) ? i : i[n], e);
32
+ return T(s) || s === e ? T(e[t]) ? r : e[t] : s;
33
+ }, ie = (e) => typeof e == "boolean", re = (e) => typeof e == "function", N = (e, t, r) => {
34
34
  let s = -1;
35
- const i = He(t) ? [t] : it(t), n = i.length, l = n - 1;
35
+ const i = Ke(t) ? [t] : at(t), n = i.length, l = n - 1;
36
36
  for (; ++s < n; ) {
37
- const d = i[s];
37
+ const f = i[s];
38
38
  let w = r;
39
39
  if (s !== l) {
40
- const p = e[d];
41
- w = I(p) || Array.isArray(p) ? p : isNaN(+i[s + 1]) ? {} : [];
40
+ const b = e[f];
41
+ w = U(b) || Array.isArray(b) ? b : isNaN(+i[s + 1]) ? {} : [];
42
42
  }
43
- if (d === "__proto__" || d === "constructor" || d === "prototype")
43
+ if (f === "__proto__" || f === "constructor" || f === "prototype")
44
44
  return;
45
- e[d] = w, e = e[d];
45
+ e[f] = w, e = e[f];
46
46
  }
47
47
  };
48
- const dt = {
48
+ const ft = {
49
49
  BLUR: "blur",
50
50
  FOCUS_OUT: "focusout"
51
51
  }, se = {
@@ -78,11 +78,11 @@ var Kt = (e, t, r, s = !0) => {
78
78
  return i;
79
79
  };
80
80
  const zt = typeof window < "u" ? X.useLayoutEffect : X.useEffect;
81
- var Q = (e) => typeof e == "string", Jt = (e, t, r, s, i) => Q(e) ? (s && t.watch.add(e), g(r, e, i)) : Array.isArray(e) ? e.map((n) => (s && t.watch.add(n), g(r, n))) : (s && (t.watchAll = !0), r), et = (e) => G(e) || !St(e);
82
- function de(e, t, r = /* @__PURE__ */ new WeakSet()) {
83
- if (et(e) || et(t))
81
+ var Q = (e) => typeof e == "string", Jt = (e, t, r, s, i) => Q(e) ? (s && t.watch.add(e), g(r, e, i)) : Array.isArray(e) ? e.map((n) => (s && t.watch.add(n), g(r, n))) : (s && (t.watchAll = !0), r), tt = (e) => J(e) || !Rt(e);
82
+ function he(e, t, r = /* @__PURE__ */ new WeakSet()) {
83
+ if (tt(e) || tt(t))
84
84
  return Object.is(e, t);
85
- if (ge(e) && ge(t))
85
+ if (pe(e) && pe(t))
86
86
  return Object.is(e.getTime(), t.getTime());
87
87
  const s = Object.keys(e), i = Object.keys(t);
88
88
  if (s.length !== i.length)
@@ -95,8 +95,8 @@ function de(e, t, r = /* @__PURE__ */ new WeakSet()) {
95
95
  if (!i.includes(n))
96
96
  return !1;
97
97
  if (n !== "ref") {
98
- const d = t[n];
99
- if (ge(l) && ge(d) || I(l) && I(d) || Array.isArray(l) && Array.isArray(d) ? !de(l, d, r) : !Object.is(l, d))
98
+ const f = t[n];
99
+ if (pe(l) && pe(f) || U(l) && U(f) || Array.isArray(l) && Array.isArray(f) ? !he(l, f, r) : !Object.is(l, f))
100
100
  return !1;
101
101
  }
102
102
  }
@@ -108,7 +108,7 @@ var Gt = (e, t, r, s, i) => t ? {
108
108
  ...r[e] && r[e].types ? r[e].types : {},
109
109
  [s]: i || !0
110
110
  }
111
- } : {}, Ce = (e) => Array.isArray(e) ? e : [e], ft = () => {
111
+ } : {}, Oe = (e) => Array.isArray(e) ? e : [e], ht = () => {
112
112
  let e = [];
113
113
  return {
114
114
  get observers() {
@@ -128,40 +128,40 @@ var Gt = (e, t, r, s, i) => t ? {
128
128
  }
129
129
  };
130
130
  };
131
- function Rt(e, t) {
131
+ function Nt(e, t) {
132
132
  const r = {};
133
133
  for (const s in e)
134
134
  if (e.hasOwnProperty(s)) {
135
135
  const i = e[s], n = t[s];
136
- if (i && I(i) && n) {
137
- const l = Rt(i, n);
138
- I(l) && (r[s] = l);
136
+ if (i && U(i) && n) {
137
+ const l = Nt(i, n);
138
+ U(l) && (r[s] = l);
139
139
  } else e[s] && (r[s] = n);
140
140
  }
141
141
  return r;
142
142
  }
143
- var Y = (e) => I(e) && !Object.keys(e).length, at = (e) => e.type === "file", je = (e) => {
144
- if (!rt)
143
+ var H = (e) => U(e) && !Object.keys(e).length, nt = (e) => e.type === "file", He = (e) => {
144
+ if (!st)
145
145
  return !1;
146
146
  const t = e ? e.ownerDocument : 0;
147
147
  return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
148
- }, Nt = (e) => e.type === "select-multiple", nt = (e) => e.type === "radio", Xt = (e) => nt(e) || Le(e), Qe = (e) => je(e) && e.isConnected;
148
+ }, Ot = (e) => e.type === "select-multiple", ut = (e) => e.type === "radio", Xt = (e) => ut(e) || Te(e), Ze = (e) => He(e) && e.isConnected;
149
149
  function Qt(e, t) {
150
150
  const r = t.slice(0, -1).length;
151
151
  let s = 0;
152
152
  for (; s < r; )
153
- e = C(e) ? s++ : e[t[s++]];
153
+ e = T(e) ? s++ : e[t[s++]];
154
154
  return e;
155
155
  }
156
156
  function Zt(e) {
157
157
  for (const t in e)
158
- if (e.hasOwnProperty(t) && !C(e[t]))
158
+ if (e.hasOwnProperty(t) && !T(e[t]))
159
159
  return !1;
160
160
  return !0;
161
161
  }
162
- function M(e, t) {
163
- const r = Array.isArray(t) ? t : He(t) ? [t] : it(t), s = r.length === 1 ? e : Qt(e, r), i = r.length - 1, n = r[i];
164
- return s && delete s[n], i !== 0 && (I(s) && Y(s) || Array.isArray(s) && Zt(s)) && M(e, r.slice(0, -1)), e;
162
+ function k(e, t) {
163
+ const r = Array.isArray(t) ? t : Ke(t) ? [t] : at(t), s = r.length === 1 ? e : Qt(e, r), i = r.length - 1, n = r[i];
164
+ return s && delete s[n], i !== 0 && (U(s) && H(s) || Array.isArray(s) && Zt(s)) && k(e, r.slice(0, -1)), e;
165
165
  }
166
166
  var er = (e) => {
167
167
  for (const t in e)
@@ -169,34 +169,34 @@ var er = (e) => {
169
169
  return !0;
170
170
  return !1;
171
171
  };
172
- function Ot(e) {
173
- return Array.isArray(e) || I(e) && !er(e);
172
+ function Ct(e) {
173
+ return Array.isArray(e) || U(e) && !er(e);
174
174
  }
175
- function tt(e, t = {}) {
175
+ function rt(e, t = {}) {
176
176
  for (const r in e) {
177
177
  const s = e[r];
178
- Ot(s) ? (t[r] = Array.isArray(s) ? [] : {}, tt(s, t[r])) : C(s) || (t[r] = !0);
178
+ Ct(s) ? (t[r] = Array.isArray(s) ? [] : {}, rt(s, t[r])) : T(s) || (t[r] = !0);
179
179
  }
180
180
  return t;
181
181
  }
182
- function Fe(e, t, r) {
183
- r || (r = tt(t));
182
+ function Ve(e, t, r) {
183
+ r || (r = rt(t));
184
184
  for (const s in e) {
185
185
  const i = e[s];
186
- if (Ot(i))
187
- C(t) || et(r[s]) ? r[s] = tt(i, Array.isArray(i) ? [] : {}) : Fe(i, G(t) ? {} : t[s], r[s]);
186
+ if (Ct(i))
187
+ T(t) || tt(r[s]) ? r[s] = rt(i, Array.isArray(i) ? [] : {}) : Ve(i, J(t) ? {} : t[s], r[s]);
188
188
  else {
189
189
  const n = t[s];
190
- r[s] = !de(i, n);
190
+ r[s] = !he(i, n);
191
191
  }
192
192
  }
193
193
  return r;
194
194
  }
195
- const ht = {
195
+ const mt = {
196
196
  value: !1,
197
197
  isValid: !1
198
- }, mt = { value: !0, isValid: !0 };
199
- var Ct = (e) => {
198
+ }, yt = { value: !0, isValid: !0 };
199
+ var Tt = (e) => {
200
200
  if (Array.isArray(e)) {
201
201
  if (e.length > 1) {
202
202
  const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
@@ -204,28 +204,28 @@ var Ct = (e) => {
204
204
  }
205
205
  return e[0].checked && !e[0].disabled ? (
206
206
  // @ts-expect-error expected to work in the browser
207
- e[0].attributes && !C(e[0].attributes.value) ? C(e[0].value) || e[0].value === "" ? mt : { value: e[0].value, isValid: !0 } : mt
208
- ) : ht;
207
+ e[0].attributes && !T(e[0].attributes.value) ? T(e[0].value) || e[0].value === "" ? yt : { value: e[0].value, isValid: !0 } : yt
208
+ ) : mt;
209
209
  }
210
- return ht;
211
- }, Tt = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) => C(e) ? e : t ? e === "" ? NaN : e && +e : r && Q(e) ? new Date(e) : s ? s(e) : e;
212
- const yt = {
210
+ return mt;
211
+ }, Lt = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: s }) => T(e) ? e : t ? e === "" ? NaN : e && +e : r && Q(e) ? new Date(e) : s ? s(e) : e;
212
+ const gt = {
213
213
  isValid: !1,
214
214
  value: null
215
215
  };
216
- var Lt = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
216
+ var Mt = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
217
217
  isValid: !0,
218
218
  value: r.value
219
- } : t, yt) : yt;
220
- function gt(e) {
219
+ } : t, gt) : gt;
220
+ function pt(e) {
221
221
  const t = e.ref;
222
- return at(t) ? t.files : nt(t) ? Lt(e.refs).value : Nt(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Le(t) ? Ct(e.refs).value : Tt(C(t.value) ? e.ref.value : t.value, e);
222
+ return nt(t) ? t.files : ut(t) ? Mt(e.refs).value : Ot(t) ? [...t.selectedOptions].map(({ value: r }) => r) : Te(t) ? Tt(e.refs).value : Lt(T(t.value) ? e.ref.value : t.value, e);
223
223
  }
224
224
  var tr = (e, t, r, s) => {
225
225
  const i = {};
226
226
  for (const n of e) {
227
227
  const l = g(t, n);
228
- l && R(i, n, l._f);
228
+ l && N(i, n, l._f);
229
229
  }
230
230
  return {
231
231
  criteriaMode: r,
@@ -233,53 +233,53 @@ var tr = (e, t, r, s) => {
233
233
  fields: i,
234
234
  shouldUseNativeValidation: s
235
235
  };
236
- }, We = (e) => e instanceof RegExp, Oe = (e) => C(e) ? e : We(e) ? e.source : I(e) ? We(e.value) ? e.value.source : e.value : e, pt = (e) => ({
236
+ }, Ye = (e) => e instanceof RegExp, Ne = (e) => T(e) ? e : Ye(e) ? e.source : U(e) ? Ye(e.value) ? e.value.source : e.value : e, bt = (e) => ({
237
237
  isOnSubmit: !e || e === se.onSubmit,
238
238
  isOnBlur: e === se.onBlur,
239
239
  isOnChange: e === se.onChange,
240
240
  isOnAll: e === se.all,
241
241
  isOnTouch: e === se.onTouched
242
242
  });
243
- const bt = "AsyncFunction";
244
- var rr = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === bt || I(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === bt)), sr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), wt = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
245
- const Te = (e, t, r, s) => {
243
+ const wt = "AsyncFunction";
244
+ var rr = (e) => !!e && !!e.validate && !!(re(e.validate) && e.validate.constructor.name === wt || U(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === wt)), sr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), vt = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((s) => e.startsWith(s) && /^\.\w+/.test(e.slice(s.length))));
245
+ const Ce = (e, t, r, s) => {
246
246
  for (const i of r || Object.keys(e)) {
247
247
  const n = g(e, i);
248
248
  if (n) {
249
- const { _f: l, ...d } = n;
249
+ const { _f: l, ...f } = n;
250
250
  if (l) {
251
251
  if (l.refs && l.refs[0] && t(l.refs[0], i) && !s)
252
252
  return !0;
253
253
  if (l.ref && t(l.ref, l.name) && !s)
254
254
  return !0;
255
- if (Te(d, t))
255
+ if (Ce(f, t))
256
256
  break;
257
- } else if (I(d) && Te(d, t))
257
+ } else if (U(f) && Ce(f, t))
258
258
  break;
259
259
  }
260
260
  }
261
261
  };
262
- function vt(e, t, r) {
262
+ function Ft(e, t, r) {
263
263
  const s = g(e, r);
264
- if (s || He(r))
264
+ if (s || Ke(r))
265
265
  return {
266
266
  error: s,
267
267
  name: r
268
268
  };
269
269
  const i = r.split(".");
270
270
  for (; i.length; ) {
271
- const n = i.join("."), l = g(t, n), d = g(e, n);
271
+ const n = i.join("."), l = g(t, n), f = g(e, n);
272
272
  if (l && !Array.isArray(l) && r !== n)
273
273
  return { name: r };
274
- if (d && d.type)
274
+ if (f && f.type)
275
275
  return {
276
276
  name: n,
277
- error: d
277
+ error: f
278
278
  };
279
- if (d && d.root && d.root.type)
279
+ if (f && f.root && f.root.type)
280
280
  return {
281
281
  name: `${n}.root`,
282
- error: d.root
282
+ error: f.root
283
283
  };
284
284
  i.pop();
285
285
  }
@@ -290,12 +290,12 @@ function vt(e, t, r) {
290
290
  var ir = (e, t, r, s) => {
291
291
  r(e);
292
292
  const { name: i, ...n } = e;
293
- return Y(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((l) => t[l] === (!s || se.all));
294
- }, ar = (e, t, r) => !e || !t || e === t || Ce(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), nr = (e, t, r, s, i) => i.isOnAll ? !1 : !r && i.isOnTouch ? !(t || e) : (r ? s.isOnBlur : i.isOnBlur) ? !e : (r ? s.isOnChange : i.isOnChange) ? e : !0, or = (e, t) => !st(g(e, t)).length && M(e, t), ur = (e, t, r) => {
295
- const s = Ce(g(e, r));
296
- return R(s, "root", t[r]), R(e, r, s), e;
293
+ return H(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((l) => t[l] === (!s || se.all));
294
+ }, ar = (e, t, r) => !e || !t || e === t || Oe(e).some((s) => s && (r ? s === t : s.startsWith(t) || t.startsWith(s))), nr = (e, t, r, s, i) => i.isOnAll ? !1 : !r && i.isOnTouch ? !(t || e) : (r ? s.isOnBlur : i.isOnBlur) ? !e : (r ? s.isOnChange : i.isOnChange) ? e : !0, ur = (e, t) => !it(g(e, t)).length && k(e, t), or = (e, t, r) => {
295
+ const s = Oe(g(e, r));
296
+ return N(s, "root", t[r]), N(e, r, s), e;
297
297
  };
298
- function Ft(e, t, r = "validate") {
298
+ function Vt(e, t, r = "validate") {
299
299
  if (Q(e) || Array.isArray(e) && e.every(Q) || ie(e) && !e)
300
300
  return {
301
301
  type: r,
@@ -303,89 +303,89 @@ function Ft(e, t, r = "validate") {
303
303
  ref: t
304
304
  };
305
305
  }
306
- var ve = (e) => I(e) && !We(e) ? e : {
306
+ var Fe = (e) => U(e) && !Ye(e) ? e : {
307
307
  value: e,
308
308
  message: ""
309
- }, Vt = async (e, t, r, s, i, n) => {
310
- const { ref: l, refs: d, required: w, maxLength: p, minLength: N, min: D, max: v, pattern: m, validate: K, name: O, valueAsNumber: Z, mount: H } = e._f, x = g(r, O);
311
- if (!H || t.has(O))
309
+ }, Et = async (e, t, r, s, i, n) => {
310
+ const { ref: l, refs: f, required: w, maxLength: b, minLength: O, min: D, max: v, pattern: m, validate: Y, name: C, valueAsNumber: Z, mount: W } = e._f, A = g(r, C);
311
+ if (!W || t.has(C))
312
312
  return {};
313
- const ee = d ? d[0] : l, L = (V) => {
313
+ const ee = f ? f[0] : l, M = (V) => {
314
314
  i && ee.reportValidity && (ee.setCustomValidity(ie(V) ? "" : V || ""), ee.reportValidity());
315
- }, T = {}, ue = nt(l), he = Le(l), ae = ue || he, ne = (Z || at(l)) && C(l.value) && C(x) || je(l) && l.value === "" || x === "" || Array.isArray(x) && !x.length, B = Gt.bind(null, O, s, T), le = (V, E, S, U = oe.maxLength, $ = oe.minLength) => {
316
- const j = V ? E : S;
317
- T[O] = {
318
- type: V ? U : $,
319
- message: j,
315
+ }, L = {}, le = ut(l), ye = Te(l), ae = le || ye, ne = (Z || nt(l)) && T(l.value) && T(A) || He(l) && l.value === "" || A === "" || Array.isArray(A) && !A.length, j = Gt.bind(null, C, s, L), ce = (V, x, S, I = oe.maxLength, G = oe.minLength) => {
316
+ const q = V ? x : S;
317
+ L[C] = {
318
+ type: V ? I : G,
319
+ message: q,
320
320
  ref: l,
321
- ...B(V ? U : $, j)
321
+ ...j(V ? I : G, q)
322
322
  };
323
323
  };
324
- if (n ? !Array.isArray(x) || !x.length : w && (!ae && (ne || G(x)) || ie(x) && !x || he && !Ct(d).isValid || ue && !Lt(d).isValid)) {
325
- const { value: V, message: E } = Q(w) ? { value: !!w, message: w } : ve(w);
326
- if (V && (T[O] = {
324
+ if (n ? !Array.isArray(A) || !A.length : w && (!ae && (ne || J(A)) || ie(A) && !A || ye && !Tt(f).isValid || le && !Mt(f).isValid)) {
325
+ const { value: V, message: x } = Q(w) ? { value: !!w, message: w } : Fe(w);
326
+ if (V && (L[C] = {
327
327
  type: oe.required,
328
- message: E,
328
+ message: x,
329
329
  ref: ee,
330
- ...B(oe.required, E)
330
+ ...j(oe.required, x)
331
331
  }, !s))
332
- return L(E), T;
332
+ return M(x), L;
333
333
  }
334
- if (!ne && (!G(D) || !G(v))) {
335
- let V, E;
336
- const S = ve(v), U = ve(D);
337
- if (!G(x) && !isNaN(x)) {
338
- const $ = l.valueAsNumber || x && +x;
339
- G(S.value) || (V = $ > S.value), G(U.value) || (E = $ < U.value);
334
+ if (!ne && (!J(D) || !J(v))) {
335
+ let V, x;
336
+ const S = Fe(v), I = Fe(D);
337
+ if (!J(A) && !isNaN(A)) {
338
+ const G = l.valueAsNumber || A && +A;
339
+ J(S.value) || (V = G > S.value), J(I.value) || (x = G < I.value);
340
340
  } else {
341
- const $ = l.valueAsDate || new Date(x), j = (me) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + me), z = l.type == "time", ce = l.type == "week";
342
- Q(S.value) && x && (V = z ? j(x) > j(S.value) : ce ? x > S.value : $ > new Date(S.value)), Q(U.value) && x && (E = z ? j(x) < j(U.value) : ce ? x < U.value : $ < new Date(U.value));
341
+ const G = l.valueAsDate || new Date(A), q = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), de = l.type == "time", K = l.type == "week";
342
+ Q(S.value) && A && (V = de ? q(A) > q(S.value) : K ? A > S.value : G > new Date(S.value)), Q(I.value) && A && (x = de ? q(A) < q(I.value) : K ? A < I.value : G < new Date(I.value));
343
343
  }
344
- if ((V || E) && (le(!!V, S.message, U.message, oe.max, oe.min), !s))
345
- return L(T[O].message), T;
344
+ if ((V || x) && (ce(!!V, S.message, I.message, oe.max, oe.min), !s))
345
+ return M(L[C].message), L;
346
346
  }
347
- if ((p || N) && !ne && (Q(x) || n && Array.isArray(x))) {
348
- const V = ve(p), E = ve(N), S = !G(V.value) && x.length > +V.value, U = !G(E.value) && x.length < +E.value;
349
- if ((S || U) && (le(S, V.message, E.message), !s))
350
- return L(T[O].message), T;
347
+ if ((b || O) && !ne && (Q(A) || n && Array.isArray(A))) {
348
+ const V = Fe(b), x = Fe(O), S = !J(V.value) && A.length > +V.value, I = !J(x.value) && A.length < +x.value;
349
+ if ((S || I) && (ce(S, V.message, x.message), !s))
350
+ return M(L[C].message), L;
351
351
  }
352
- if (m && !ne && Q(x)) {
353
- const { value: V, message: E } = ve(m);
354
- if (We(V) && !x.match(V) && (T[O] = {
352
+ if (m && !ne && Q(A)) {
353
+ const { value: V, message: x } = Fe(m);
354
+ if (Ye(V) && !A.match(V) && (L[C] = {
355
355
  type: oe.pattern,
356
- message: E,
356
+ message: x,
357
357
  ref: l,
358
- ...B(oe.pattern, E)
358
+ ...j(oe.pattern, x)
359
359
  }, !s))
360
- return L(E), T;
360
+ return M(x), L;
361
361
  }
362
- if (K) {
363
- if (re(K)) {
364
- const V = await K(x, r), E = Ft(V, ee);
365
- if (E && (T[O] = {
366
- ...E,
367
- ...B(oe.validate, E.message)
362
+ if (Y) {
363
+ if (re(Y)) {
364
+ const V = await Y(A, r), x = Vt(V, ee);
365
+ if (x && (L[C] = {
366
+ ...x,
367
+ ...j(oe.validate, x.message)
368
368
  }, !s))
369
- return L(E.message), T;
370
- } else if (I(K)) {
369
+ return M(x.message), L;
370
+ } else if (U(Y)) {
371
371
  let V = {};
372
- for (const E in K) {
373
- if (!Y(V) && !s)
372
+ for (const x in Y) {
373
+ if (!H(V) && !s)
374
374
  break;
375
- const S = Ft(await K[E](x, r), ee, E);
375
+ const S = Vt(await Y[x](A, r), ee, x);
376
376
  S && (V = {
377
377
  ...S,
378
- ...B(E, S.message)
379
- }, L(S.message), s && (T[O] = V));
378
+ ...j(x, S.message)
379
+ }, M(S.message), s && (L[C] = V));
380
380
  }
381
- if (!Y(V) && (T[O] = {
381
+ if (!H(V) && (L[C] = {
382
382
  ref: ee,
383
383
  ...V
384
384
  }, !s))
385
- return T;
385
+ return L;
386
386
  }
387
387
  }
388
- return L(!0), T;
388
+ return M(!0), L;
389
389
  };
390
390
  const lr = {
391
391
  mode: se.onSubmit,
@@ -411,19 +411,19 @@ function cr(e = {}) {
411
411
  validatingFields: {},
412
412
  errors: t.errors || {},
413
413
  disabled: t.disabled || !1
414
- }, s = {}, i = I(t.defaultValues) || I(t.values) ? k(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : k(i), l = {
414
+ }, s = {}, i = U(t.defaultValues) || U(t.values) ? P(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : P(i), l = {
415
415
  action: !1,
416
416
  mount: !1,
417
417
  watch: !1,
418
418
  keepIsValid: !1
419
- }, d = {
419
+ }, f = {
420
420
  mount: /* @__PURE__ */ new Set(),
421
421
  disabled: /* @__PURE__ */ new Set(),
422
422
  unMount: /* @__PURE__ */ new Set(),
423
423
  array: /* @__PURE__ */ new Set(),
424
424
  watch: /* @__PURE__ */ new Set()
425
- }, w, p = 0;
426
- const N = {
425
+ }, w, b = 0;
426
+ const O = {
427
427
  isDirty: !1,
428
428
  dirtyFields: !1,
429
429
  validatingFields: !1,
@@ -432,45 +432,45 @@ function cr(e = {}) {
432
432
  isValid: !1,
433
433
  errors: !1
434
434
  }, D = {
435
- ...N
435
+ ...O
436
436
  };
437
437
  let v = {
438
438
  ...D
439
439
  };
440
440
  const m = {
441
- array: ft(),
442
- state: ft()
443
- }, K = t.criteriaMode === se.all, O = (a) => (o) => {
444
- clearTimeout(p), p = setTimeout(a, o);
441
+ array: ht(),
442
+ state: ht()
443
+ }, Y = t.criteriaMode === se.all, C = (a) => (o) => {
444
+ clearTimeout(b), b = setTimeout(a, o);
445
445
  }, Z = async (a) => {
446
446
  if (!l.keepIsValid && !t.disabled && (D.isValid || v.isValid || a)) {
447
447
  let o;
448
- t.resolver ? (o = Y((await ae()).errors), H()) : o = await B(s, !0), o !== r.isValid && m.state.next({
448
+ t.resolver ? (o = H((await ae()).errors), W()) : o = await j(s, !0), o !== r.isValid && m.state.next({
449
449
  isValid: o
450
450
  });
451
451
  }
452
- }, H = (a, o) => {
453
- !t.disabled && (D.isValidating || D.validatingFields || v.isValidating || v.validatingFields) && ((a || Array.from(d.mount)).forEach((u) => {
454
- u && (o ? R(r.validatingFields, u, o) : M(r.validatingFields, u));
452
+ }, W = (a, o) => {
453
+ !t.disabled && (D.isValidating || D.validatingFields || v.isValidating || v.validatingFields) && ((a || Array.from(f.mount)).forEach((u) => {
454
+ u && (o ? N(r.validatingFields, u, o) : k(r.validatingFields, u));
455
455
  }), m.state.next({
456
456
  validatingFields: r.validatingFields,
457
- isValidating: !Y(r.validatingFields)
457
+ isValidating: !H(r.validatingFields)
458
458
  }));
459
- }, x = (a, o = [], u, f, h = !0, c = !0) => {
460
- if (f && u && !t.disabled) {
461
- if (l.action = !0, c && Array.isArray(g(s, a))) {
462
- const y = u(g(s, a), f.argA, f.argB);
463
- h && R(s, a, y);
459
+ }, A = (a, o = [], u, h, c = !0, d = !0) => {
460
+ if (h && u && !t.disabled) {
461
+ if (l.action = !0, d && Array.isArray(g(s, a))) {
462
+ const y = u(g(s, a), h.argA, h.argB);
463
+ c && N(s, a, y);
464
464
  }
465
- if (c && Array.isArray(g(r.errors, a))) {
466
- const y = u(g(r.errors, a), f.argA, f.argB);
467
- h && R(r.errors, a, y), or(r.errors, a);
465
+ if (d && Array.isArray(g(r.errors, a))) {
466
+ const y = u(g(r.errors, a), h.argA, h.argB);
467
+ c && N(r.errors, a, y), ur(r.errors, a);
468
468
  }
469
- if ((D.touchedFields || v.touchedFields) && c && Array.isArray(g(r.touchedFields, a))) {
470
- const y = u(g(r.touchedFields, a), f.argA, f.argB);
471
- h && R(r.touchedFields, a, y);
469
+ if ((D.touchedFields || v.touchedFields) && d && Array.isArray(g(r.touchedFields, a))) {
470
+ const y = u(g(r.touchedFields, a), h.argA, h.argB);
471
+ c && N(r.touchedFields, a, y);
472
472
  }
473
- (D.dirtyFields || v.dirtyFields) && (r.dirtyFields = Fe(i, n)), m.state.next({
473
+ (D.dirtyFields || v.dirtyFields) && (r.dirtyFields = Ve(i, n)), m.state.next({
474
474
  name: a,
475
475
  isDirty: V(a, o),
476
476
  dirtyFields: r.dirtyFields,
@@ -478,46 +478,46 @@ function cr(e = {}) {
478
478
  isValid: r.isValid
479
479
  });
480
480
  } else
481
- R(n, a, o);
481
+ N(n, a, o);
482
482
  }, ee = (a, o) => {
483
- R(r.errors, a, o), m.state.next({
483
+ N(r.errors, a, o), m.state.next({
484
484
  errors: r.errors
485
485
  });
486
- }, L = (a) => {
486
+ }, M = (a) => {
487
487
  r.errors = a, m.state.next({
488
488
  errors: r.errors,
489
489
  isValid: !1
490
490
  });
491
- }, T = (a, o, u, f) => {
492
- const h = g(s, a);
493
- if (h) {
494
- const c = g(n, a, C(u) ? g(i, a) : u);
495
- C(c) || f && f.defaultChecked || o ? R(n, a, o ? c : gt(h._f)) : U(a, c), l.mount && !l.action && Z();
491
+ }, L = (a, o, u, h) => {
492
+ const c = g(s, a);
493
+ if (c) {
494
+ const d = g(n, a, T(u) ? g(i, a) : u);
495
+ T(d) || h && h.defaultChecked || o ? N(n, a, o ? d : pt(c._f)) : I(a, d), l.mount && !l.action && Z();
496
496
  }
497
- }, ue = (a, o, u, f, h) => {
498
- let c = !1, y = !1;
499
- const F = {
497
+ }, le = (a, o, u, h, c) => {
498
+ let d = !1, y = !1;
499
+ const p = {
500
500
  name: a
501
501
  };
502
502
  if (!t.disabled) {
503
- if (!u || f) {
504
- (D.isDirty || v.isDirty) && (y = r.isDirty, r.isDirty = F.isDirty = V(), c = y !== F.isDirty);
505
- const b = de(g(i, a), o);
506
- y = !!g(r.dirtyFields, a), b ? M(r.dirtyFields, a) : R(r.dirtyFields, a, !0), F.dirtyFields = r.dirtyFields, c = c || (D.dirtyFields || v.dirtyFields) && y !== !b;
503
+ if (!u || h) {
504
+ (D.isDirty || v.isDirty) && (y = r.isDirty, r.isDirty = p.isDirty = V(), d = y !== p.isDirty);
505
+ const F = he(g(i, a), o);
506
+ y = !!g(r.dirtyFields, a), F ? k(r.dirtyFields, a) : N(r.dirtyFields, a, !0), p.dirtyFields = r.dirtyFields, d = d || (D.dirtyFields || v.dirtyFields) && y !== !F;
507
507
  }
508
508
  if (u) {
509
- const b = g(r.touchedFields, a);
510
- b || (R(r.touchedFields, a, u), F.touchedFields = r.touchedFields, c = c || (D.touchedFields || v.touchedFields) && b !== u);
509
+ const F = g(r.touchedFields, a);
510
+ F || (N(r.touchedFields, a, u), p.touchedFields = r.touchedFields, d = d || (D.touchedFields || v.touchedFields) && F !== u);
511
511
  }
512
- c && h && m.state.next(F);
512
+ d && c && m.state.next(p);
513
513
  }
514
- return c ? F : {};
515
- }, he = (a, o, u, f) => {
516
- const h = g(r.errors, a), c = (D.isValid || v.isValid) && ie(o) && r.isValid !== o;
517
- if (t.delayError && u ? (w = O(() => ee(a, u)), w(t.delayError)) : (clearTimeout(p), w = null, u ? R(r.errors, a, u) : M(r.errors, a)), (u ? !de(h, u) : h) || !Y(f) || c) {
514
+ return d ? p : {};
515
+ }, ye = (a, o, u, h) => {
516
+ const c = g(r.errors, a), d = (D.isValid || v.isValid) && ie(o) && r.isValid !== o;
517
+ if (t.delayError && u ? (w = C(() => ee(a, u)), w(t.delayError)) : (clearTimeout(b), w = null, u ? N(r.errors, a, u) : k(r.errors, a)), (u ? !he(c, u) : c) || !H(h) || d) {
518
518
  const y = {
519
- ...f,
520
- ...c && ie(o) ? { isValid: o } : {},
519
+ ...h,
520
+ ...d && ie(o) ? { isValid: o } : {},
521
521
  errors: r.errors,
522
522
  name: a
523
523
  };
@@ -526,187 +526,187 @@ function cr(e = {}) {
526
526
  ...y
527
527
  }, m.state.next(y);
528
528
  }
529
- }, ae = async (a) => (H(a, !0), await t.resolver(n, t.context, tr(a || d.mount, s, t.criteriaMode, t.shouldUseNativeValidation))), ne = async (a) => {
529
+ }, ae = async (a) => (W(a, !0), await t.resolver(n, t.context, tr(a || f.mount, s, t.criteriaMode, t.shouldUseNativeValidation))), ne = async (a) => {
530
530
  const { errors: o } = await ae(a);
531
- if (H(a), a)
531
+ if (W(a), a)
532
532
  for (const u of a) {
533
- const f = g(o, u);
534
- f ? R(r.errors, u, f) : M(r.errors, u);
533
+ const h = g(o, u);
534
+ h ? N(r.errors, u, h) : k(r.errors, u);
535
535
  }
536
536
  else
537
537
  r.errors = o;
538
538
  return o;
539
- }, B = async (a, o, u = {
539
+ }, j = async (a, o, u = {
540
540
  valid: !0
541
541
  }) => {
542
- for (const f in a) {
543
- const h = a[f];
544
- if (h) {
545
- const { _f: c, ...y } = h;
546
- if (c) {
547
- const F = d.array.has(c.name), b = h._f && rr(h._f);
548
- b && D.validatingFields && H([c.name], !0);
549
- const _ = await Vt(h, d.disabled, n, K, t.shouldUseNativeValidation && !o, F);
550
- if (b && D.validatingFields && H([c.name]), _[c.name] && (u.valid = !1, o || e.shouldUseNativeValidation))
542
+ for (const h in a) {
543
+ const c = a[h];
544
+ if (c) {
545
+ const { _f: d, ...y } = c;
546
+ if (d) {
547
+ const p = f.array.has(d.name), F = c._f && rr(c._f);
548
+ F && D.validatingFields && W([d.name], !0);
549
+ const _ = await Et(c, f.disabled, n, Y, t.shouldUseNativeValidation && !o, p);
550
+ if (F && D.validatingFields && W([d.name]), _[d.name] && (u.valid = !1, o || e.shouldUseNativeValidation))
551
551
  break;
552
- !o && (g(_, c.name) ? F ? ur(r.errors, _, c.name) : R(r.errors, c.name, _[c.name]) : M(r.errors, c.name));
552
+ !o && (g(_, d.name) ? p ? or(r.errors, _, d.name) : N(r.errors, d.name, _[d.name]) : k(r.errors, d.name));
553
553
  }
554
- !Y(y) && await B(y, o, u);
554
+ !H(y) && await j(y, o, u);
555
555
  }
556
556
  }
557
557
  return u.valid;
558
- }, le = () => {
559
- for (const a of d.unMount) {
558
+ }, ce = () => {
559
+ for (const a of f.unMount) {
560
560
  const o = g(s, a);
561
- o && (o._f.refs ? o._f.refs.every((u) => !Qe(u)) : !Qe(o._f.ref)) && xe(a);
561
+ o && (o._f.refs ? o._f.refs.every((u) => !Ze(u)) : !Ze(o._f.ref)) && Ae(a);
562
562
  }
563
- d.unMount = /* @__PURE__ */ new Set();
564
- }, V = (a, o) => !t.disabled && (a && o && R(n, a, o), !de(Me(), i)), E = (a, o, u) => Jt(a, d, {
565
- ...l.mount ? n : C(o) ? i : Q(a) ? { [a]: o } : o
566
- }, u, o), S = (a) => st(g(l.mount ? n : i, a, t.shouldUnregister ? g(i, a, []) : [])), U = (a, o, u = {}) => {
567
- const f = g(s, a);
568
- let h = o;
569
- if (f) {
570
- const c = f._f;
571
- c && (!c.disabled && R(n, a, Tt(o, c)), h = je(c.ref) && G(o) ? "" : o, Nt(c.ref) ? [...c.ref.options].forEach((y) => y.selected = h.includes(y.value)) : c.refs ? Le(c.ref) ? c.refs.forEach((y) => {
572
- (!y.defaultChecked || !y.disabled) && (Array.isArray(h) ? y.checked = !!h.find((F) => F === y.value) : y.checked = h === y.value || !!h);
573
- }) : c.refs.forEach((y) => y.checked = y.value === h) : at(c.ref) ? c.ref.value = "" : (c.ref.value = h, c.ref.type || m.state.next({
563
+ f.unMount = /* @__PURE__ */ new Set();
564
+ }, V = (a, o) => !t.disabled && (a && o && N(n, a, o), !he(Le(), i)), x = (a, o, u) => Jt(a, f, {
565
+ ...l.mount ? n : T(o) ? i : Q(a) ? { [a]: o } : o
566
+ }, u, o), S = (a) => it(g(l.mount ? n : i, a, t.shouldUnregister ? g(i, a, []) : [])), I = (a, o, u = {}) => {
567
+ const h = g(s, a);
568
+ let c = o;
569
+ if (h) {
570
+ const d = h._f;
571
+ d && (!d.disabled && N(n, a, Lt(o, d)), c = He(d.ref) && J(o) ? "" : o, Ot(d.ref) ? [...d.ref.options].forEach((y) => y.selected = c.includes(y.value)) : d.refs ? Te(d.ref) ? d.refs.forEach((y) => {
572
+ (!y.defaultChecked || !y.disabled) && (Array.isArray(c) ? y.checked = !!c.find((p) => p === y.value) : y.checked = c === y.value || !!c);
573
+ }) : d.refs.forEach((y) => y.checked = y.value === c) : nt(d.ref) ? d.ref.value = "" : (d.ref.value = c, d.ref.type || m.state.next({
574
574
  name: a,
575
- values: k(n)
575
+ values: P(n)
576
576
  })));
577
577
  }
578
- (u.shouldDirty || u.shouldTouch) && ue(a, h, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && me(a);
579
- }, $ = (a, o, u) => {
580
- for (const f in o) {
581
- if (!o.hasOwnProperty(f))
578
+ (u.shouldDirty || u.shouldTouch) && le(a, c, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && fe(a);
579
+ }, G = (a, o, u) => {
580
+ for (const h in o) {
581
+ if (!o.hasOwnProperty(h))
582
582
  return;
583
- const h = o[f], c = a + "." + f, y = g(s, c);
584
- (d.array.has(a) || I(h) || y && !y._f) && !ge(h) ? $(c, h, u) : U(c, h, u);
583
+ const c = o[h], d = a + "." + h, y = g(s, d);
584
+ (f.array.has(a) || U(c) || y && !y._f) && !pe(c) ? G(d, c, u) : I(d, c, u);
585
585
  }
586
- }, j = (a, o, u = {}) => {
587
- const f = g(s, a), h = d.array.has(a), c = k(o);
588
- R(n, a, c), h ? (m.array.next({
586
+ }, q = (a, o, u = {}) => {
587
+ const h = g(s, a), c = f.array.has(a), d = P(o);
588
+ N(n, a, d), c ? (m.array.next({
589
589
  name: a,
590
- values: k(n)
590
+ values: P(n)
591
591
  }), (D.isDirty || D.dirtyFields || v.isDirty || v.dirtyFields) && u.shouldDirty && m.state.next({
592
592
  name: a,
593
- dirtyFields: Fe(i, n),
594
- isDirty: V(a, c)
595
- })) : f && !f._f && !G(c) ? $(a, c, u) : U(a, c, u), wt(a, d) ? m.state.next({
593
+ dirtyFields: Ve(i, n),
594
+ isDirty: V(a, d)
595
+ })) : h && !h._f && !J(d) ? G(a, d, u) : I(a, d, u), vt(a, f) ? m.state.next({
596
596
  ...r,
597
597
  name: a,
598
- values: k(n)
598
+ values: P(n)
599
599
  }) : m.state.next({
600
600
  name: l.mount ? a : void 0,
601
- values: k(n)
601
+ values: P(n)
602
602
  });
603
- }, z = async (a) => {
603
+ }, de = async (a) => {
604
604
  l.mount = !0;
605
605
  const o = a.target;
606
- let u = o.name, f = !0;
607
- const h = g(s, u), c = (b) => {
608
- f = Number.isNaN(b) || ge(b) && isNaN(b.getTime()) || de(b, g(n, u, b));
609
- }, y = pt(t.mode), F = pt(t.reValidateMode);
610
- if (h) {
611
- let b, _;
612
- const P = o.type ? gt(h._f) : $t(a), W = a.type === dt.BLUR || a.type === dt.FOCUS_OUT, q = !sr(h._f) && !t.resolver && !g(r.errors, u) && !h._f.deps || nr(W, g(r.touchedFields, u), r.isSubmitted, F, y), J = wt(u, d, W);
613
- R(n, u, P), W ? (!o || !o.readOnly) && (h._f.onBlur && h._f.onBlur(a), w && w(0)) : h._f.onChange && h._f.onChange(a);
614
- const be = ue(u, P, W), ut = !Y(be) || J;
615
- if (!W && m.state.next({
606
+ let u = o.name, h = !0;
607
+ const c = g(s, u), d = (F) => {
608
+ h = Number.isNaN(F) || pe(F) && isNaN(F.getTime()) || he(F, g(n, u, F));
609
+ }, y = bt(t.mode), p = bt(t.reValidateMode);
610
+ if (c) {
611
+ let F, _;
612
+ const R = o.type ? pt(c._f) : $t(a), $ = a.type === ft.BLUR || a.type === ft.FOCUS_OUT, ue = !sr(c._f) && !t.resolver && !g(r.errors, u) && !c._f.deps || nr($, g(r.touchedFields, u), r.isSubmitted, p, y), B = vt(u, f, $);
613
+ N(n, u, R), $ ? (!o || !o.readOnly) && (c._f.onBlur && c._f.onBlur(a), w && w(0)) : c._f.onChange && c._f.onChange(a);
614
+ const z = le(u, R, $), je = !H(z) || B;
615
+ if (!$ && m.state.next({
616
616
  name: u,
617
617
  type: a.type,
618
- values: k(n)
619
- }), q)
620
- return (D.isValid || v.isValid) && (t.mode === "onBlur" ? W && Z() : W || Z()), ut && m.state.next({ name: u, ...J ? {} : be });
621
- if (!W && J && m.state.next({ ...r }), t.resolver) {
622
- const { errors: Xe } = await ae([u]);
623
- if (H([u]), c(P), f) {
624
- const Ut = vt(r.errors, s, u), lt = vt(Xe, s, Ut.name || u);
625
- b = lt.error, u = lt.name, _ = Y(Xe);
618
+ values: P(n)
619
+ }), ue)
620
+ return (D.isValid || v.isValid) && (t.mode === "onBlur" ? $ && Z() : $ || Z()), je && m.state.next({ name: u, ...B ? {} : z });
621
+ if (!$ && B && m.state.next({ ...r }), t.resolver) {
622
+ const { errors: Qe } = await ae([u]);
623
+ if (W([u]), d(R), h) {
624
+ const lt = Ft(r.errors, s, u), ct = Ft(Qe, s, lt.name || u);
625
+ F = ct.error, u = ct.name, _ = H(Qe);
626
626
  }
627
627
  } else
628
- H([u], !0), b = (await Vt(h, d.disabled, n, K, t.shouldUseNativeValidation))[u], H([u]), c(P), f && (b ? _ = !1 : (D.isValid || v.isValid) && (_ = await B(s, !0)));
629
- f && (h._f.deps && (!Array.isArray(h._f.deps) || h._f.deps.length > 0) && me(h._f.deps), he(u, _, b, be));
628
+ W([u], !0), F = (await Et(c, f.disabled, n, Y, t.shouldUseNativeValidation))[u], W([u]), d(R), h && (F ? _ = !1 : (D.isValid || v.isValid) && (_ = await j(s, !0)));
629
+ h && (c._f.deps && (!Array.isArray(c._f.deps) || c._f.deps.length > 0) && fe(c._f.deps), ye(u, _, F, z));
630
630
  }
631
- }, ce = (a, o) => {
631
+ }, K = (a, o) => {
632
632
  if (g(r.errors, o) && a.focus)
633
633
  return a.focus(), 1;
634
- }, me = async (a, o = {}) => {
635
- let u, f;
636
- const h = Ce(a);
634
+ }, fe = async (a, o = {}) => {
635
+ let u, h;
636
+ const c = Oe(a);
637
637
  if (t.resolver) {
638
- const c = await ne(C(a) ? a : h);
639
- u = Y(c), f = a ? !h.some((y) => g(c, y)) : u;
640
- } else a ? (f = (await Promise.all(h.map(async (c) => {
641
- const y = g(s, c);
642
- return await B(y && y._f ? { [c]: y } : y);
643
- }))).every(Boolean), !(!f && !r.isValid) && Z()) : f = u = await B(s);
638
+ const d = await ne(T(a) ? a : c);
639
+ u = H(d), h = a ? !c.some((y) => g(d, y)) : u;
640
+ } else a ? (h = (await Promise.all(c.map(async (d) => {
641
+ const y = g(s, d);
642
+ return await j(y && y._f ? { [d]: y } : y);
643
+ }))).every(Boolean), !(!h && !r.isValid) && Z()) : h = u = await j(s);
644
644
  return m.state.next({
645
645
  ...!Q(a) || (D.isValid || v.isValid) && u !== r.isValid ? {} : { name: a },
646
646
  ...t.resolver || !a ? { isValid: u } : {},
647
647
  errors: r.errors
648
- }), o.shouldFocus && !f && Te(s, ce, a ? h : d.mount), f;
649
- }, Me = (a, o) => {
648
+ }), o.shouldFocus && !h && Ce(s, K, a ? c : f.mount), h;
649
+ }, Le = (a, o) => {
650
650
  let u = {
651
651
  ...l.mount ? n : i
652
652
  };
653
- return o && (u = Rt(o.dirtyFields ? r.dirtyFields : r.touchedFields, u)), C(a) ? u : Q(a) ? g(u, a) : a.map((f) => g(u, f));
654
- }, A = (a, o) => ({
653
+ return o && (u = Nt(o.dirtyFields ? r.dirtyFields : r.touchedFields, u)), T(a) ? u : Q(a) ? g(u, a) : a.map((h) => g(u, h));
654
+ }, Me = (a, o) => ({
655
655
  invalid: !!g((o || r).errors, a),
656
656
  isDirty: !!g((o || r).dirtyFields, a),
657
657
  error: g((o || r).errors, a),
658
658
  isValidating: !!g(r.validatingFields, a),
659
659
  isTouched: !!g((o || r).touchedFields, a)
660
- }), Ee = (a) => {
661
- a && Ce(a).forEach((o) => M(r.errors, o)), m.state.next({
660
+ }), E = (a) => {
661
+ a && Oe(a).forEach((o) => k(r.errors, o)), m.state.next({
662
662
  errors: a ? r.errors : {}
663
663
  });
664
- }, Ae = (a, o, u) => {
665
- const f = (g(s, a, { _f: {} })._f || {}).ref, h = g(r.errors, a) || {}, { ref: c, message: y, type: F, ...b } = h;
666
- R(r.errors, a, {
667
- ...b,
664
+ }, we = (a, o, u) => {
665
+ const h = (g(s, a, { _f: {} })._f || {}).ref, c = g(r.errors, a) || {}, { ref: d, message: y, type: p, ...F } = c;
666
+ N(r.errors, a, {
667
+ ...F,
668
668
  ...o,
669
- ref: f
669
+ ref: h
670
670
  }), m.state.next({
671
671
  name: a,
672
672
  errors: r.errors,
673
673
  isValid: !1
674
- }), u && u.shouldFocus && f && f.focus && f.focus();
675
- }, Ye = (a, o) => re(a) ? m.state.subscribe({
676
- next: (u) => "values" in u && a(E(void 0, o), u)
677
- }) : E(a, o, !0), Ie = (a) => m.state.subscribe({
674
+ }), u && u.shouldFocus && h && h.focus && h.focus();
675
+ }, Ie = (a, o) => re(a) ? m.state.subscribe({
676
+ next: (u) => "values" in u && a(x(void 0, o), u)
677
+ }) : x(a, o, !0), ke = (a) => m.state.subscribe({
678
678
  next: (o) => {
679
- ar(a.name, o.name, a.exact) && ir(o, a.formState || D, Ge, a.reRenderRoot) && a.callback({
679
+ ar(a.name, o.name, a.exact) && ir(o, a.formState || D, Xe, a.reRenderRoot) && a.callback({
680
680
  values: { ...n },
681
681
  ...r,
682
682
  ...o,
683
683
  defaultValues: i
684
684
  });
685
685
  }
686
- }).unsubscribe, Ke = (a) => (l.mount = !0, v = {
686
+ }).unsubscribe, ze = (a) => (l.mount = !0, v = {
687
687
  ...v,
688
688
  ...a.formState
689
- }, Ie({
689
+ }, ke({
690
690
  ...a,
691
691
  formState: {
692
- ...N,
692
+ ...O,
693
693
  ...a.formState
694
694
  }
695
- })), xe = (a, o = {}) => {
696
- for (const u of a ? Ce(a) : d.mount)
697
- d.mount.delete(u), d.array.delete(u), o.keepValue || (M(s, u), M(n, u)), !o.keepError && M(r.errors, u), !o.keepDirty && M(r.dirtyFields, u), !o.keepTouched && M(r.touchedFields, u), !o.keepIsValidating && M(r.validatingFields, u), !t.shouldUnregister && !o.keepDefaultValue && M(i, u);
695
+ })), Ae = (a, o = {}) => {
696
+ for (const u of a ? Oe(a) : f.mount)
697
+ f.mount.delete(u), f.array.delete(u), o.keepValue || (k(s, u), k(n, u)), !o.keepError && k(r.errors, u), !o.keepDirty && k(r.dirtyFields, u), !o.keepTouched && k(r.touchedFields, u), !o.keepIsValidating && k(r.validatingFields, u), !t.shouldUnregister && !o.keepDefaultValue && k(i, u);
698
698
  m.state.next({
699
- values: k(n)
699
+ values: P(n)
700
700
  }), m.state.next({
701
701
  ...r,
702
702
  ...o.keepDirty ? { isDirty: V() } : {}
703
703
  }), !o.keepIsValid && Z();
704
- }, ke = ({ disabled: a, name: o }) => {
705
- (ie(a) && l.mount || a || d.disabled.has(o)) && (a ? d.disabled.add(o) : d.disabled.delete(o));
706
- }, _e = (a, o = {}) => {
704
+ }, Ue = ({ disabled: a, name: o }) => {
705
+ (ie(a) && l.mount || a || f.disabled.has(o)) && (a ? f.disabled.add(o) : f.disabled.delete(o));
706
+ }, xe = (a, o = {}) => {
707
707
  let u = g(s, a);
708
- const f = ie(o.disabled) || ie(t.disabled);
709
- return R(s, a, {
708
+ const h = ie(o.disabled) || ie(t.disabled);
709
+ return N(s, a, {
710
710
  ...u || {},
711
711
  _f: {
712
712
  ...u && u._f ? u._f : { ref: { name: a } },
@@ -714,107 +714,107 @@ function cr(e = {}) {
714
714
  mount: !0,
715
715
  ...o
716
716
  }
717
- }), d.mount.add(a), u ? ke({
717
+ }), f.mount.add(a), u ? Ue({
718
718
  disabled: ie(o.disabled) ? o.disabled : t.disabled,
719
719
  name: a
720
- }) : T(a, !0, o.value), {
721
- ...f ? { disabled: o.disabled || t.disabled } : {},
720
+ }) : L(a, !0, o.value), {
721
+ ...h ? { disabled: o.disabled || t.disabled } : {},
722
722
  ...t.progressive ? {
723
723
  required: !!o.required,
724
- min: Oe(o.min),
725
- max: Oe(o.max),
726
- minLength: Oe(o.minLength),
727
- maxLength: Oe(o.maxLength),
728
- pattern: Oe(o.pattern)
724
+ min: Ne(o.min),
725
+ max: Ne(o.max),
726
+ minLength: Ne(o.minLength),
727
+ maxLength: Ne(o.maxLength),
728
+ pattern: Ne(o.pattern)
729
729
  } : {},
730
730
  name: a,
731
- onChange: z,
732
- onBlur: z,
733
- ref: (h) => {
734
- if (h) {
735
- _e(a, o), u = g(s, a);
736
- const c = C(h.value) && h.querySelectorAll && h.querySelectorAll("input,select,textarea")[0] || h, y = Xt(c), F = u._f.refs || [];
737
- if (y ? F.find((b) => b === c) : c === u._f.ref)
731
+ onChange: de,
732
+ onBlur: de,
733
+ ref: (c) => {
734
+ if (c) {
735
+ xe(a, o), u = g(s, a);
736
+ const d = T(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, y = Xt(d), p = u._f.refs || [];
737
+ if (y ? p.find((F) => F === d) : d === u._f.ref)
738
738
  return;
739
- R(s, a, {
739
+ N(s, a, {
740
740
  _f: {
741
741
  ...u._f,
742
742
  ...y ? {
743
743
  refs: [
744
- ...F.filter(Qe),
745
- c,
744
+ ...p.filter(Ze),
745
+ d,
746
746
  ...Array.isArray(g(i, a)) ? [{}] : []
747
747
  ],
748
- ref: { type: c.type, name: a }
749
- } : { ref: c }
748
+ ref: { type: d.type, name: a }
749
+ } : { ref: d }
750
750
  }
751
- }), T(a, !1, void 0, c);
751
+ }), L(a, !1, void 0, d);
752
752
  } else
753
- u = g(s, a, {}), u._f && (u._f.mount = !1), (t.shouldUnregister || o.shouldUnregister) && !(Wt(d.array, a) && l.action) && d.unMount.add(a);
753
+ u = g(s, a, {}), u._f && (u._f.mount = !1), (t.shouldUnregister || o.shouldUnregister) && !(Wt(f.array, a) && l.action) && f.unMount.add(a);
754
754
  }
755
755
  };
756
- }, De = () => t.shouldFocusError && Te(s, ce, d.mount), ze = (a) => {
757
- ie(a) && (m.state.next({ disabled: a }), Te(s, (o, u) => {
758
- const f = g(s, u);
759
- f && (o.disabled = f._f.disabled || a, Array.isArray(f._f.refs) && f._f.refs.forEach((h) => {
760
- h.disabled = f._f.disabled || a;
756
+ }, _e = () => t.shouldFocusError && Ce(s, K, f.mount), Je = (a) => {
757
+ ie(a) && (m.state.next({ disabled: a }), Ce(s, (o, u) => {
758
+ const h = g(s, u);
759
+ h && (o.disabled = h._f.disabled || a, Array.isArray(h._f.refs) && h._f.refs.forEach((c) => {
760
+ c.disabled = h._f.disabled || a;
761
761
  }));
762
762
  }, 0, !1));
763
- }, Ue = (a, o) => async (u) => {
764
- let f;
763
+ }, Be = (a, o) => async (u) => {
764
+ let h;
765
765
  u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
766
- let h = k(n);
766
+ let c = P(n);
767
767
  if (m.state.next({
768
768
  isSubmitting: !0
769
769
  }), t.resolver) {
770
- const { errors: c, values: y } = await ae();
771
- H(), r.errors = c, h = k(y);
770
+ const { errors: d, values: y } = await ae();
771
+ W(), r.errors = d, c = P(y);
772
772
  } else
773
- await B(s);
774
- if (d.disabled.size)
775
- for (const c of d.disabled)
776
- M(h, c);
777
- if (M(r.errors, "root"), Y(r.errors)) {
773
+ await j(s);
774
+ if (f.disabled.size)
775
+ for (const d of f.disabled)
776
+ k(c, d);
777
+ if (k(r.errors, "root"), H(r.errors)) {
778
778
  m.state.next({
779
779
  errors: {}
780
780
  });
781
781
  try {
782
- await a(h, u);
783
- } catch (c) {
784
- f = c;
782
+ await a(c, u);
783
+ } catch (d) {
784
+ h = d;
785
785
  }
786
786
  } else
787
- o && await o({ ...r.errors }, u), De(), setTimeout(De);
787
+ o && await o({ ...r.errors }, u), _e(), setTimeout(_e);
788
788
  if (m.state.next({
789
789
  isSubmitted: !0,
790
790
  isSubmitting: !1,
791
- isSubmitSuccessful: Y(r.errors) && !f,
791
+ isSubmitSuccessful: H(r.errors) && !h,
792
792
  submitCount: r.submitCount + 1,
793
793
  errors: r.errors
794
- }), f)
795
- throw f;
796
- }, Be = (a, o = {}) => {
797
- g(s, a) && (C(o.defaultValue) ? j(a, k(g(i, a))) : (j(a, o.defaultValue), R(i, a, k(o.defaultValue))), o.keepTouched || M(r.touchedFields, a), o.keepDirty || (M(r.dirtyFields, a), r.isDirty = o.defaultValue ? V(a, k(g(i, a))) : V()), o.keepError || (M(r.errors, a), D.isValid && Z()), m.state.next({ ...r }));
798
- }, Pe = (a, o = {}) => {
799
- const u = a ? k(a) : i, f = k(u), h = Y(a), c = h ? i : f;
794
+ }), h)
795
+ throw h;
796
+ }, Ge = (a, o = {}) => {
797
+ g(s, a) && (T(o.defaultValue) ? q(a, P(g(i, a))) : (q(a, o.defaultValue), N(i, a, P(o.defaultValue))), o.keepTouched || k(r.touchedFields, a), o.keepDirty || (k(r.dirtyFields, a), r.isDirty = o.defaultValue ? V(a, P(g(i, a))) : V()), o.keepError || (k(r.errors, a), D.isValid && Z()), m.state.next({ ...r }));
798
+ }, De = (a, o = {}) => {
799
+ const u = a ? P(a) : i, h = P(u), c = H(a), d = c ? i : h;
800
800
  if (o.keepDefaultValues || (i = u), !o.keepValues) {
801
801
  if (o.keepDirtyValues) {
802
802
  const y = /* @__PURE__ */ new Set([
803
- ...d.mount,
804
- ...Object.keys(Fe(i, n))
803
+ ...f.mount,
804
+ ...Object.keys(Ve(i, n))
805
805
  ]);
806
- for (const F of Array.from(y)) {
807
- const b = g(r.dirtyFields, F), _ = g(n, F), P = g(c, F);
808
- b && !C(_) ? R(c, F, _) : !b && !C(P) && j(F, P);
806
+ for (const p of Array.from(y)) {
807
+ const F = g(r.dirtyFields, p), _ = g(n, p), R = g(d, p);
808
+ F && !T(_) ? N(d, p, _) : !F && !T(R) && q(p, R);
809
809
  }
810
810
  } else {
811
- if (rt && C(a))
812
- for (const y of d.mount) {
813
- const F = g(s, y);
814
- if (F && F._f) {
815
- const b = Array.isArray(F._f.refs) ? F._f.refs[0] : F._f.ref;
816
- if (je(b)) {
817
- const _ = b.closest("form");
811
+ if (st && T(a))
812
+ for (const y of f.mount) {
813
+ const p = g(s, y);
814
+ if (p && p._f) {
815
+ const F = Array.isArray(p._f.refs) ? p._f.refs[0] : p._f.ref;
816
+ if (He(F)) {
817
+ const _ = F.closest("form");
818
818
  if (_) {
819
819
  _.reset();
820
820
  break;
@@ -823,75 +823,75 @@ function cr(e = {}) {
823
823
  }
824
824
  }
825
825
  if (o.keepFieldsRef)
826
- for (const y of d.mount)
827
- j(y, g(c, y));
826
+ for (const y of f.mount)
827
+ q(y, g(d, y));
828
828
  else
829
829
  s = {};
830
830
  }
831
- n = t.shouldUnregister ? o.keepDefaultValues ? k(i) : {} : k(c), m.array.next({
832
- values: { ...c }
831
+ n = t.shouldUnregister ? o.keepDefaultValues ? P(i) : {} : P(d), m.array.next({
832
+ values: { ...d }
833
833
  }), m.state.next({
834
- values: { ...c }
834
+ values: { ...d }
835
835
  });
836
836
  }
837
- d = {
838
- mount: o.keepDirtyValues ? d.mount : /* @__PURE__ */ new Set(),
837
+ f = {
838
+ mount: o.keepDirtyValues ? f.mount : /* @__PURE__ */ new Set(),
839
839
  unMount: /* @__PURE__ */ new Set(),
840
840
  array: /* @__PURE__ */ new Set(),
841
841
  disabled: /* @__PURE__ */ new Set(),
842
842
  watch: /* @__PURE__ */ new Set(),
843
843
  watchAll: !1,
844
844
  focus: ""
845
- }, l.mount = !D.isValid || !!o.keepIsValid || !!o.keepDirtyValues || !t.shouldUnregister && !Y(c), l.watch = !!t.shouldUnregister, l.keepIsValid = !!o.keepIsValid, l.action = !1, o.keepErrors || (r.errors = {}), m.state.next({
845
+ }, l.mount = !D.isValid || !!o.keepIsValid || !!o.keepDirtyValues || !t.shouldUnregister && !H(d), l.watch = !!t.shouldUnregister, l.keepIsValid = !!o.keepIsValid, l.action = !1, o.keepErrors || (r.errors = {}), m.state.next({
846
846
  submitCount: o.keepSubmitCount ? r.submitCount : 0,
847
- isDirty: h ? !1 : o.keepDirty ? r.isDirty : !!(o.keepDefaultValues && !de(a, i)),
847
+ isDirty: c ? !1 : o.keepDirty ? r.isDirty : !!(o.keepDefaultValues && !he(a, i)),
848
848
  isSubmitted: o.keepIsSubmitted ? r.isSubmitted : !1,
849
- dirtyFields: h ? {} : o.keepDirtyValues ? o.keepDefaultValues && n ? Fe(i, n) : r.dirtyFields : o.keepDefaultValues && a ? Fe(i, a) : o.keepDirty ? r.dirtyFields : {},
849
+ dirtyFields: c ? {} : o.keepDirtyValues ? o.keepDefaultValues && n ? Ve(i, n) : r.dirtyFields : o.keepDefaultValues && a ? Ve(i, a) : o.keepDirty ? r.dirtyFields : {},
850
850
  touchedFields: o.keepTouched ? r.touchedFields : {},
851
851
  errors: o.keepErrors ? r.errors : {},
852
852
  isSubmitSuccessful: o.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
853
853
  isSubmitting: !1,
854
854
  defaultValues: i
855
855
  });
856
- }, Se = (a, o) => Pe(re(a) ? a(n) : a, { ...t.resetOptions, ...o }), Je = (a, o = {}) => {
857
- const u = g(s, a), f = u && u._f;
858
- if (f) {
859
- const h = f.refs ? f.refs[0] : f.ref;
860
- h.focus && setTimeout(() => {
861
- h.focus(), o.shouldSelect && re(h.select) && h.select();
856
+ }, Pe = (a, o) => De(re(a) ? a(n) : a, { ...t.resetOptions, ...o }), qe = (a, o = {}) => {
857
+ const u = g(s, a), h = u && u._f;
858
+ if (h) {
859
+ const c = h.refs ? h.refs[0] : h.ref;
860
+ c.focus && setTimeout(() => {
861
+ c.focus(), o.shouldSelect && re(c.select) && c.select();
862
862
  });
863
863
  }
864
- }, Ge = (a) => {
864
+ }, Xe = (a) => {
865
865
  r = {
866
866
  ...r,
867
867
  ...a
868
868
  };
869
- }, Re = {
869
+ }, $e = {
870
870
  control: {
871
- register: _e,
872
- unregister: xe,
873
- getFieldState: A,
874
- handleSubmit: Ue,
875
- setError: Ae,
876
- _subscribe: Ie,
871
+ register: xe,
872
+ unregister: Ae,
873
+ getFieldState: Me,
874
+ handleSubmit: Be,
875
+ setError: we,
876
+ _subscribe: ke,
877
877
  _runSchema: ae,
878
- _updateIsValidating: H,
879
- _focusError: De,
880
- _getWatch: E,
878
+ _updateIsValidating: W,
879
+ _focusError: _e,
880
+ _getWatch: x,
881
881
  _getDirty: V,
882
882
  _setValid: Z,
883
- _setFieldArray: x,
884
- _setDisabledField: ke,
885
- _setErrors: L,
883
+ _setFieldArray: A,
884
+ _setDisabledField: Ue,
885
+ _setErrors: M,
886
886
  _getFieldArray: S,
887
- _reset: Pe,
887
+ _reset: De,
888
888
  _resetDefaultValues: () => re(t.defaultValues) && t.defaultValues().then((a) => {
889
- Se(a, t.resetOptions), m.state.next({
889
+ Pe(a, t.resetOptions), m.state.next({
890
890
  isLoading: !1
891
891
  });
892
892
  }),
893
- _removeUnmounted: le,
894
- _disableForm: ze,
893
+ _removeUnmounted: ce,
894
+ _disableForm: Je,
895
895
  _subjects: m,
896
896
  _proxyFormState: D,
897
897
  get _fields() {
@@ -910,10 +910,10 @@ function cr(e = {}) {
910
910
  return i;
911
911
  },
912
912
  get _names() {
913
- return d;
913
+ return f;
914
914
  },
915
915
  set _names(a) {
916
- d = a;
916
+ f = a;
917
917
  },
918
918
  get _formState() {
919
919
  return r;
@@ -928,24 +928,24 @@ function cr(e = {}) {
928
928
  };
929
929
  }
930
930
  },
931
- subscribe: Ke,
932
- trigger: me,
933
- register: _e,
934
- handleSubmit: Ue,
935
- watch: Ye,
936
- setValue: j,
937
- getValues: Me,
938
- reset: Se,
939
- resetField: Be,
940
- clearErrors: Ee,
941
- unregister: xe,
942
- setError: Ae,
943
- setFocus: Je,
944
- getFieldState: A
931
+ subscribe: ze,
932
+ trigger: fe,
933
+ register: xe,
934
+ handleSubmit: Be,
935
+ watch: Ie,
936
+ setValue: q,
937
+ getValues: Le,
938
+ reset: Pe,
939
+ resetField: Ge,
940
+ clearErrors: E,
941
+ unregister: Ae,
942
+ setError: we,
943
+ setFocus: qe,
944
+ getFieldState: Me
945
945
  };
946
946
  return {
947
- ...Re,
948
- formControl: Re
947
+ ...$e,
948
+ formControl: $e
949
949
  };
950
950
  }
951
951
  function dr(e = {}) {
@@ -973,9 +973,9 @@ function dr(e = {}) {
973
973
  formState: s
974
974
  }, e.defaultValues && !re(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
975
975
  else {
976
- const { formControl: l, ...d } = cr(e);
976
+ const { formControl: l, ...f } = cr(e);
977
977
  t.current = {
978
- ...d,
978
+ ...f,
979
979
  formState: s
980
980
  };
981
981
  }
@@ -986,8 +986,8 @@ function dr(e = {}) {
986
986
  callback: () => i({ ...n._formState }),
987
987
  reRenderRoot: !0
988
988
  });
989
- return i((d) => ({
990
- ...d,
989
+ return i((f) => ({
990
+ ...f,
991
991
  isReady: !0
992
992
  })), n._formState.isReady = !0, l;
993
993
  }, [n]), X.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), X.useEffect(() => {
@@ -1007,10 +1007,10 @@ function dr(e = {}) {
1007
1007
  }
1008
1008
  }, [n, s.isDirty]), X.useEffect(() => {
1009
1009
  var l;
1010
- e.values && !de(e.values, r.current) ? (n._reset(e.values, {
1010
+ e.values && !he(e.values, r.current) ? (n._reset(e.values, {
1011
1011
  keepFieldsRef: !0,
1012
1012
  ...n._options.resetOptions
1013
- }), !((l = n._options.resetOptions) === null || l === void 0) && l.keepIsValid || n._setValid(), r.current = e.values, i((d) => ({ ...d }))) : n._resetDefaultValues();
1013
+ }), !((l = n._options.resetOptions) === null || l === void 0) && l.keepIsValid || n._setValid(), r.current = e.values, i((f) => ({ ...f }))) : n._resetDefaultValues();
1014
1014
  }, [n, e.values]), X.useEffect(() => {
1015
1015
  n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
1016
1016
  }), t.current.formState = Kt(s, n), t.current;
@@ -1094,32 +1094,32 @@ const hr = {
1094
1094
  ARRAY_CONTAINS: (e, t) => Array.isArray(e) ? e.includes(t) : !1,
1095
1095
  ARRAY_JOIN: (e, t = ",") => Array.isArray(e) ? e.join(t) : ""
1096
1096
  };
1097
- function fe(e, t) {
1097
+ function me(e, t) {
1098
1098
  var r;
1099
1099
  switch (e.Type) {
1100
1100
  case "Literal":
1101
1101
  return e.Value;
1102
1102
  case "SystemIdentifier":
1103
1103
  if (e.Property) {
1104
- const p = t.systemValues[e.Name];
1105
- return Ze(p, e.Property.Name);
1104
+ const b = t.systemValues[e.Name];
1105
+ return et(b, e.Property.Name);
1106
1106
  }
1107
1107
  return t.systemValues[e.Name];
1108
1108
  case "Identifier":
1109
1109
  if (e.Property) {
1110
- const p = Et(e, t);
1111
- return Ze(p, e.Property.Name);
1110
+ const b = At(e, t);
1111
+ return et(b, e.Property.Name);
1112
1112
  }
1113
- return Et(e, t);
1113
+ return At(e, t);
1114
1114
  case "MemberExpression":
1115
1115
  if (!e.Arguments || e.Arguments.length === 0)
1116
1116
  throw new Error("MemberExpression requires Arguments array");
1117
- const s = fe(e.Arguments[0], t), i = (r = e.Arguments[0].Property) == null ? void 0 : r.Name;
1118
- return i ? Ze(s, i) : s;
1117
+ const s = me(e.Arguments[0], t), i = (r = e.Arguments[0].Property) == null ? void 0 : r.Name;
1118
+ return i ? et(s, i) : s;
1119
1119
  case "BinaryExpression":
1120
1120
  if (!e.Arguments || e.Arguments.length !== 2)
1121
1121
  throw new Error("BinaryExpression requires exactly 2 arguments");
1122
- const n = fe(e.Arguments[0], t), l = fe(e.Arguments[1], t);
1122
+ const n = me(e.Arguments[0], t), l = me(e.Arguments[1], t);
1123
1123
  return mr(e.Operator, n, l);
1124
1124
  case "LogicalExpression":
1125
1125
  if (!e.Arguments || e.Arguments.length < 2)
@@ -1128,22 +1128,22 @@ function fe(e, t) {
1128
1128
  case "CallExpression":
1129
1129
  if (!e.Callee)
1130
1130
  throw new Error("CallExpression requires Callee");
1131
- const d = hr[e.Callee];
1132
- if (!d)
1131
+ const f = hr[e.Callee];
1132
+ if (!f)
1133
1133
  throw new Error(`Unknown function: ${e.Callee}`);
1134
1134
  const w = (e.Arguments || []).map(
1135
- (p) => fe(p, t)
1135
+ (b) => me(b, t)
1136
1136
  );
1137
- return d(...w);
1137
+ return f(...w);
1138
1138
  case "AssignmentExpression":
1139
1139
  if (!e.Arguments || e.Arguments.length !== 1)
1140
1140
  throw new Error("AssignmentExpression requires exactly 1 argument");
1141
- return fe(e.Arguments[0], t);
1141
+ return me(e.Arguments[0], t);
1142
1142
  default:
1143
1143
  throw new Error(`Unknown expression type: ${e.Type}`);
1144
1144
  }
1145
1145
  }
1146
- function Et(e, t) {
1146
+ function At(e, t) {
1147
1147
  const { Name: r, Source: s } = e;
1148
1148
  if (!r)
1149
1149
  throw new Error("Identifier requires Name");
@@ -1153,7 +1153,7 @@ function Et(e, t) {
1153
1153
  return t.formValues[r];
1154
1154
  }
1155
1155
  }
1156
- function Ze(e, t) {
1156
+ function et(e, t) {
1157
1157
  if (!(!e || typeof e != "object"))
1158
1158
  return e[t];
1159
1159
  }
@@ -1188,30 +1188,30 @@ function mr(e, t, r) {
1188
1188
  function yr(e, t, r) {
1189
1189
  switch (e) {
1190
1190
  case "AND":
1191
- return t.every((s) => !!fe(s, r));
1191
+ return t.every((s) => !!me(s, r));
1192
1192
  case "OR":
1193
- return t.some((s) => !!fe(s, r));
1193
+ return t.some((s) => !!me(s, r));
1194
1194
  default:
1195
1195
  throw new Error(`Unknown logical operator: ${e}`);
1196
1196
  }
1197
1197
  }
1198
- function Mt(e, t, r = {}) {
1198
+ function It(e, t, r = {}) {
1199
1199
  const s = {
1200
1200
  formValues: t,
1201
1201
  systemValues: fr(),
1202
1202
  referenceData: r
1203
1203
  };
1204
1204
  try {
1205
- return fe(e, s);
1205
+ return me(e, s);
1206
1206
  } catch (i) {
1207
1207
  return console.warn("Expression evaluation failed:", i), !1;
1208
1208
  }
1209
1209
  }
1210
- function At(e, t, r = {}) {
1210
+ function xt(e, t, r = {}) {
1211
1211
  const s = [];
1212
1212
  for (const i of e)
1213
1213
  try {
1214
- Mt(
1214
+ It(
1215
1215
  i.Condition.ExpressionTree,
1216
1216
  t,
1217
1217
  r
@@ -1227,21 +1227,21 @@ function At(e, t, r = {}) {
1227
1227
  }
1228
1228
  function gr(e, t = {}, r = {}) {
1229
1229
  try {
1230
- return Mt(e, t, r);
1230
+ return It(e, t, r);
1231
1231
  } catch (s) {
1232
1232
  return console.warn("Default value calculation failed:", s), null;
1233
1233
  }
1234
1234
  }
1235
- function xt(e, t) {
1236
- var d, w, p;
1237
- const r = ((d = e.Expression) == null ? void 0 : d.toLowerCase()) || "", s = ((w = e.Name) == null ? void 0 : w.toLowerCase()) || "", i = ((p = e.Id) == null ? void 0 : p.toLowerCase()) || "", n = t.toLowerCase();
1235
+ function _t(e, t) {
1236
+ var f, w, b;
1237
+ const r = ((f = e.Expression) == null ? void 0 : f.toLowerCase()) || "", s = ((w = e.Name) == null ? void 0 : w.toLowerCase()) || "", i = ((b = e.Id) == null ? void 0 : b.toLowerCase()) || "", n = t.toLowerCase();
1238
1238
  return s.includes("required") || i.includes("required") ? !0 : [
1239
1239
  `${n} != null`,
1240
1240
  `${n} != ''`,
1241
1241
  `trim(${n}) != ''`,
1242
1242
  `${n}!=null`,
1243
1243
  `${n}!=''`
1244
- ].some((N) => r.includes(N));
1244
+ ].some((O) => r.includes(O));
1245
1245
  }
1246
1246
  function pr(e) {
1247
1247
  const t = { ...e };
@@ -1256,18 +1256,18 @@ function pr(e) {
1256
1256
  if (i.Validation && Array.isArray(i.Validation))
1257
1257
  if (i.Validation.length > 0 && typeof i.Validation[0] == "object") {
1258
1258
  const l = [];
1259
- i.Validation.forEach((d) => {
1260
- t.Rules.Validation[d.Id] = d, l.push(d.Id), xt(d, s) && (n = !0);
1259
+ i.Validation.forEach((f) => {
1260
+ t.Rules.Validation[f.Id] = f, l.push(f.Id), _t(f, s) && (n = !0);
1261
1261
  }), r[s] = {
1262
1262
  ...i,
1263
1263
  Validation: l,
1264
1264
  Required: n
1265
1265
  };
1266
1266
  } else
1267
- i.Validation.forEach((d) => {
1268
- var p;
1269
- const w = (p = t.Rules.Validation) == null ? void 0 : p[d];
1270
- w && xt(w, s) && (n = !0);
1267
+ i.Validation.forEach((f) => {
1268
+ var b;
1269
+ const w = (b = t.Rules.Validation) == null ? void 0 : b[f];
1270
+ w && _t(w, s) && (n = !0);
1271
1271
  }), n && !i.Required && (r[s] = {
1272
1272
  ...i,
1273
1273
  Required: !0
@@ -1302,15 +1302,15 @@ function wr(e) {
1302
1302
  return r.sort((i, n) => n.length - i.length), Object.entries(e.Rules.Computation).forEach(([i, n]) => {
1303
1303
  const l = i.toUpperCase().replace(/[_-]/g, "");
1304
1304
  for (const w of r) {
1305
- const p = w.toUpperCase().replace(/[_-]/g, "");
1306
- if (l.includes(p)) {
1305
+ const b = w.toUpperCase().replace(/[_-]/g, "");
1306
+ if (l.includes(b)) {
1307
1307
  t[i] = w;
1308
1308
  return;
1309
1309
  }
1310
1310
  }
1311
- const d = `${n.Name || ""} ${n.Description || ""}`.toLowerCase();
1311
+ const f = `${n.Name || ""} ${n.Description || ""}`.toLowerCase();
1312
1312
  for (const w of r)
1313
- if (d.includes(w.toLowerCase())) {
1313
+ if (f.includes(w.toLowerCase())) {
1314
1314
  t[i] = w;
1315
1315
  return;
1316
1316
  }
@@ -1325,11 +1325,11 @@ function vr(e, t) {
1325
1325
  businessLogic: []
1326
1326
  };
1327
1327
  }), Object.entries(e.Fields).forEach(([i, n]) => {
1328
- n.Validation && Array.isArray(n.Validation) && n.Validation.forEach((d) => {
1329
- t.validation[d] ? r[i].validation.push(d) : t.computation[d] ? r[i].computation.push(d) : t.businessLogic[d] && r[i].businessLogic.push(d);
1330
- }), n.Formula && Object.entries(t.computation).forEach(([l, d]) => {
1328
+ n.Validation && Array.isArray(n.Validation) && n.Validation.forEach((f) => {
1329
+ t.validation[f] ? r[i].validation.push(f) : t.computation[f] ? r[i].computation.push(f) : t.businessLogic[f] && r[i].businessLogic.push(f);
1330
+ }), n.Formula && Object.entries(t.computation).forEach(([l, f]) => {
1331
1331
  var w;
1332
- d.Expression === ((w = n.Formula) == null ? void 0 : w.Expression) && (r[i].computation.includes(l) || r[i].computation.push(l));
1332
+ f.Expression === ((w = n.Formula) == null ? void 0 : w.Expression) && (r[i].computation.includes(l) || r[i].computation.push(l));
1333
1333
  });
1334
1334
  });
1335
1335
  const s = wr(e);
@@ -1344,16 +1344,16 @@ function Fr(e, t) {
1344
1344
  hidden: !1
1345
1345
  };
1346
1346
  return Object.keys(e.Fields).forEach((i) => {
1347
- var w, p, N, D, v, m;
1347
+ var w, b, O, D, v, m;
1348
1348
  if (!t || !((w = e.RolePermission) != null && w[t])) {
1349
1349
  r[i] = s;
1350
1350
  return;
1351
1351
  }
1352
- const n = e.RolePermission[t], l = ((p = n.Editable) == null ? void 0 : p.includes(i)) || ((N = n.Editable) == null ? void 0 : N.includes("*")) || !1, d = ((D = n.ReadOnly) == null ? void 0 : D.includes(i)) || ((v = n.ReadOnly) == null ? void 0 : v.includes("*")) || l;
1352
+ const n = e.RolePermission[t], l = ((b = n.Editable) == null ? void 0 : b.includes(i)) || ((O = n.Editable) == null ? void 0 : O.includes("*")) || !1, f = ((D = n.ReadOnly) == null ? void 0 : D.includes(i)) || ((v = n.ReadOnly) == null ? void 0 : v.includes("*")) || l;
1353
1353
  r[i] = {
1354
1354
  editable: l && !((m = n.ReadOnly) != null && m.includes(i)),
1355
- readable: d,
1356
- hidden: !d
1355
+ readable: f,
1356
+ hidden: !f
1357
1357
  };
1358
1358
  }), r;
1359
1359
  }
@@ -1378,14 +1378,14 @@ function Vr(e, t) {
1378
1378
  return "text";
1379
1379
  }
1380
1380
  }
1381
- function It(e) {
1381
+ function kt(e) {
1382
1382
  return e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).replace(/_/g, " ").trim();
1383
1383
  }
1384
1384
  function Er(e, t, r) {
1385
1385
  const s = {};
1386
1386
  switch (t.Required && (s.required = {
1387
1387
  value: !0,
1388
- message: `${It(e)} is required`
1388
+ message: `${kt(e)} is required`
1389
1389
  }), t.Type) {
1390
1390
  case "Number":
1391
1391
  s.valueAsNumber = !0;
@@ -1433,16 +1433,16 @@ function _r(e, t, r, s = {}, i, n) {
1433
1433
  validation: [],
1434
1434
  computation: [],
1435
1435
  businessLogic: []
1436
- }, p = t.Computed || !!t.Formula || w.computation.length > 0, N = Er(e, t);
1437
- return p && (N.disabled = !0), {
1436
+ }, b = t.Computed || !!t.Formula || w.computation.length > 0, O = Er(e, t);
1437
+ return b && (O.disabled = !0), {
1438
1438
  name: e,
1439
1439
  type: Vr(t.Type, e),
1440
- label: t.Name || It(e),
1440
+ label: t.Name || kt(e),
1441
1441
  required: t.Required || !1,
1442
- computed: p,
1442
+ computed: b,
1443
1443
  defaultValue: xr(t, s),
1444
1444
  options: Ar(t),
1445
- validation: N,
1445
+ validation: O,
1446
1446
  description: t.Description,
1447
1447
  _bdoField: t,
1448
1448
  permission: i || l,
@@ -1452,35 +1452,35 @@ function _r(e, t, r, s = {}, i, n) {
1452
1452
  function Dr(e, t = {}, r) {
1453
1453
  let s = e;
1454
1454
  s = pr(s);
1455
- const i = {}, n = [], l = [], d = [], w = [], p = br(s), N = vr(s, p), D = Fr(s, r);
1455
+ const i = {}, n = [], l = [], f = [], w = [], b = br(s), O = vr(s, b), D = Fr(s, r);
1456
1456
  for (const [v, m] of Object.entries(s.Fields)) {
1457
1457
  if (v.startsWith("_") && !["_id"].includes(v))
1458
1458
  continue;
1459
- const K = D[v];
1460
- if (K.hidden)
1459
+ const Y = D[v];
1460
+ if (Y.hidden)
1461
1461
  continue;
1462
- const O = _r(
1462
+ const C = _r(
1463
1463
  v,
1464
1464
  m,
1465
1465
  s.Fields,
1466
1466
  t,
1467
- K,
1468
- N[v] || {
1467
+ Y,
1468
+ O[v] || {
1469
1469
  validation: [],
1470
1470
  computation: [],
1471
1471
  businessLogic: []
1472
1472
  }
1473
1473
  );
1474
- i[v] = O, n.push(v), O.computed && l.push(v), O.required && d.push(v);
1474
+ i[v] = C, n.push(v), C.computed && l.push(v), C.required && f.push(v);
1475
1475
  }
1476
1476
  return {
1477
1477
  fields: i,
1478
1478
  fieldOrder: n,
1479
1479
  computedFields: l,
1480
- requiredFields: d,
1480
+ requiredFields: f,
1481
1481
  crossFieldValidation: w,
1482
- rules: p,
1483
- fieldRules: N,
1482
+ rules: b,
1483
+ fieldRules: O,
1484
1484
  rolePermissions: s.RolePermission
1485
1485
  };
1486
1486
  }
@@ -1534,7 +1534,7 @@ async function Or(e, t = 3) {
1534
1534
  }
1535
1535
  async function Cr(e, t) {
1536
1536
  try {
1537
- return await pe(e).get(t);
1537
+ return await be(e).get(t);
1538
1538
  } catch (r) {
1539
1539
  throw console.error(`Record fetch error for ${e}/${t}:`, r), new Error(
1540
1540
  `Failed to load record: ${r instanceof Error ? r.message : "Unknown error"}`
@@ -1545,7 +1545,7 @@ async function Tr(e, t, r, s) {
1545
1545
  try {
1546
1546
  let i;
1547
1547
  if (t === "create")
1548
- return i = await pe(e).create(r), {
1548
+ return i = await be(e).create(r), {
1549
1549
  success: !0,
1550
1550
  data: i,
1551
1551
  recordId: i._id || s
@@ -1553,7 +1553,7 @@ async function Tr(e, t, r, s) {
1553
1553
  if (t === "update") {
1554
1554
  if (!s)
1555
1555
  throw new Error("Record ID is required for update operations");
1556
- return i = await pe(e).update(s, r), {
1556
+ return i = await be(e).update(s, r), {
1557
1557
  success: !0,
1558
1558
  data: i,
1559
1559
  recordId: i._id || s
@@ -1572,7 +1572,7 @@ async function Tr(e, t, r, s) {
1572
1572
  async function Lr(e, t = ["_id"], r, s) {
1573
1573
  try {
1574
1574
  const i = {};
1575
- return r && (i.Filter = r), s && (i.Sort = s), t.length > 0 && (i.Field = t), (await pe(e).list(i)).Data || [];
1575
+ return r && (i.Filter = r), s && (i.Sort = s), t.length > 0 && (i.Field = t), (await be(e).list(i)).Data || [];
1576
1576
  } catch (i) {
1577
1577
  return console.error(`Reference data fetch error for ${e}:`, i), [];
1578
1578
  }
@@ -1603,19 +1603,19 @@ async function Mr(e) {
1603
1603
  function Ir(e, t, r = "create", s) {
1604
1604
  const i = {};
1605
1605
  return Object.keys(e).forEach((n) => {
1606
- const l = n, d = e[l];
1607
- if (!t.includes(n) && d !== void 0) {
1606
+ const l = n, f = e[l];
1607
+ if (!t.includes(n) && f !== void 0) {
1608
1608
  if (r === "create") {
1609
- i[l] = d;
1609
+ i[l] = f;
1610
1610
  return;
1611
1611
  }
1612
1612
  if (r === "update") {
1613
1613
  if (!s) {
1614
- i[l] = d;
1614
+ i[l] = f;
1615
1615
  return;
1616
1616
  }
1617
1617
  const w = s[l];
1618
- JSON.stringify(d) !== JSON.stringify(w) && (i[l] = d);
1618
+ JSON.stringify(f) !== JSON.stringify(w) && (i[l] = f);
1619
1619
  }
1620
1620
  }
1621
1621
  }), i;
@@ -1632,22 +1632,22 @@ function Gr(e) {
1632
1632
  var t, r, s;
1633
1633
  return (e == null ? void 0 : e.status) === 400 || ((t = e == null ? void 0 : e.response) == null ? void 0 : t.status) === 400 || ((r = e == null ? void 0 : e.message) == null ? void 0 : r.toLowerCase().includes("validation")) || ((s = e == null ? void 0 : e.message) == null ? void 0 : s.toLowerCase().includes("invalid"));
1634
1634
  }
1635
- const Ve = /* @__PURE__ */ new Map();
1635
+ const Ee = /* @__PURE__ */ new Map();
1636
1636
  function kr(e, t, r = 10) {
1637
- Ve.set(e, {
1637
+ Ee.set(e, {
1638
1638
  data: t,
1639
1639
  timestamp: Date.now(),
1640
1640
  ttl: r * 60 * 1e3
1641
1641
  });
1642
1642
  }
1643
1643
  function Ur(e) {
1644
- const t = Ve.get(e);
1645
- return t ? Date.now() - t.timestamp > t.ttl ? (Ve.delete(e), null) : t.data : null;
1644
+ const t = Ee.get(e);
1645
+ return t ? Date.now() - t.timestamp > t.ttl ? (Ee.delete(e), null) : t.data : null;
1646
1646
  }
1647
1647
  function Xr(e) {
1648
- e ? Array.from(Ve.keys()).filter(
1648
+ e ? Array.from(Ee.keys()).filter(
1649
1649
  (r) => r.startsWith(e)
1650
- ).forEach((r) => Ve.delete(r)) : Ve.clear();
1650
+ ).forEach((r) => Ee.delete(r)) : Ee.clear();
1651
1651
  }
1652
1652
  async function Br(e) {
1653
1653
  const t = `schema:${e}`, r = Ur(t);
@@ -1656,10 +1656,10 @@ async function Br(e) {
1656
1656
  const s = await Or(e);
1657
1657
  return kr(t, s, 30), s;
1658
1658
  }
1659
- class _t {
1659
+ class Dt {
1660
1660
  constructor(t = 1e3) {
1661
- we(this, "cache", /* @__PURE__ */ new Map());
1662
- we(this, "maxSize");
1661
+ ve(this, "cache", /* @__PURE__ */ new Map());
1662
+ ve(this, "maxSize");
1663
1663
  this.maxSize = t;
1664
1664
  }
1665
1665
  get(t) {
@@ -1700,9 +1700,9 @@ function Pr(e) {
1700
1700
  }
1701
1701
  class qr {
1702
1702
  constructor() {
1703
- we(this, "resultCache", new _t(500));
1704
- we(this, "dependencyCache", new _t(200));
1705
- we(this, "compiledExpressions", /* @__PURE__ */ new Map());
1703
+ ve(this, "resultCache", new Dt(500));
1704
+ ve(this, "dependencyCache", new Dt(200));
1705
+ ve(this, "compiledExpressions", /* @__PURE__ */ new Map());
1706
1706
  }
1707
1707
  /**
1708
1708
  * Create cache key from expression and context
@@ -1848,7 +1848,7 @@ class qr {
1848
1848
  const s = ((i = t.Arguments) == null ? void 0 : i.map((n) => this.evaluateNode(n, r))) || [];
1849
1849
  switch (t.Callee) {
1850
1850
  case "CONCAT":
1851
- return s.map((p) => String(p || "")).join("");
1851
+ return s.map((b) => String(b || "")).join("");
1852
1852
  case "TRIM":
1853
1853
  return String(s[0] || "").trim();
1854
1854
  case "LENGTH":
@@ -1862,14 +1862,14 @@ class qr {
1862
1862
  case "MATCHES":
1863
1863
  return new RegExp(String(s[1])).test(String(s[0] || ""));
1864
1864
  case "SUM":
1865
- return s.reduce((p, N) => p + (Number(N) || 0), 0);
1865
+ return s.reduce((b, O) => b + (Number(O) || 0), 0);
1866
1866
  case "AVG":
1867
- const n = s.filter((p) => !isNaN(Number(p)));
1868
- return n.length > 0 ? n.reduce((p, N) => p + Number(N), 0) / n.length : 0;
1867
+ const n = s.filter((b) => !isNaN(Number(b)));
1868
+ return n.length > 0 ? n.reduce((b, O) => b + Number(O), 0) / n.length : 0;
1869
1869
  case "MIN":
1870
- return Math.min(...s.map((p) => Number(p) || 0));
1870
+ return Math.min(...s.map((b) => Number(b) || 0));
1871
1871
  case "MAX":
1872
- return Math.max(...s.map((p) => Number(p) || 0));
1872
+ return Math.max(...s.map((b) => Number(b) || 0));
1873
1873
  case "ROUND":
1874
1874
  return Math.round(Number(s[0]) || 0);
1875
1875
  case "FLOOR":
@@ -1885,7 +1885,7 @@ class qr {
1885
1885
  case "DAY":
1886
1886
  return new Date(s[0]).getDate();
1887
1887
  case "DATE_DIFF":
1888
- const l = new Date(s[0]), d = new Date(s[1]), w = Math.abs(l.getTime() - d.getTime());
1888
+ const l = new Date(s[0]), f = new Date(s[1]), w = Math.abs(l.getTime() - f.getTime());
1889
1889
  return Math.ceil(w / (1e3 * 60 * 60 * 24));
1890
1890
  case "IF":
1891
1891
  return s[0] ? s[1] : s[2];
@@ -1912,14 +1912,14 @@ class qr {
1912
1912
  this.resultCache.clear(), this.dependencyCache.clear(), this.compiledExpressions.clear();
1913
1913
  }
1914
1914
  }
1915
- const kt = new qr();
1915
+ const Ut = new qr();
1916
1916
  function $r(e, t, r, s, i) {
1917
1917
  if (!r || r.length === 0)
1918
1918
  return { isValid: !0 };
1919
1919
  const n = { ...s, [e]: t };
1920
1920
  for (const l of r)
1921
1921
  try {
1922
- if (!kt.evaluate(
1922
+ if (!Ut.evaluate(
1923
1923
  l.ExpressionTree,
1924
1924
  n,
1925
1925
  i
@@ -1929,13 +1929,13 @@ function $r(e, t, r, s, i) {
1929
1929
  message: l.Message || `Validation failed for ${l.Name}`,
1930
1930
  fieldName: e
1931
1931
  };
1932
- } catch (d) {
1933
- console.warn(`Validation rule ${l.Id} failed to evaluate:`, d);
1932
+ } catch (f) {
1933
+ console.warn(`Validation rule ${l.Id} failed to evaluate:`, f);
1934
1934
  }
1935
1935
  return { isValid: !0 };
1936
1936
  }
1937
- function Dt(e) {
1938
- return Array.from(kt.getDependencies(e));
1937
+ function St(e) {
1938
+ return Array.from(Ut.getDependencies(e));
1939
1939
  }
1940
1940
  function Qr(e) {
1941
1941
  const {
@@ -1946,24 +1946,24 @@ function Qr(e) {
1946
1946
  mode: n = "onBlur",
1947
1947
  // Validation mode - controls when errors are shown (see types.ts for details)
1948
1948
  enabled: l = !0,
1949
- userRole: d,
1949
+ userRole: f,
1950
1950
  onSchemaError: w,
1951
- skipSchemaFetch: p = !1,
1952
- schema: N,
1951
+ skipSchemaFetch: b = !1,
1952
+ schema: O,
1953
1953
  interactionMode: D = "interactive"
1954
- } = e, v = D === "interactive", [m, K] = ye(null), [O, Z] = ye({}), [H, x] = ye(!1), [ee] = ye({}), [L, T] = ye(null), [ue, he] = ye(!1), [ae, ne] = ye(null), B = qe(!1), le = qe(null), V = qe(null), E = qe(w);
1955
- $e(() => {
1956
- E.current = w;
1954
+ } = e, v = D === "interactive", [m, Y] = ge(null), [C, Z] = ge({}), [W, A] = ge(!1), [ee] = ge({}), [M, L] = ge(null), [le, ye] = ge(!1), [ae, ne] = ge(null), j = Se(!1), ce = Se(null), V = Se(null), x = Se(!1), S = Se(w);
1955
+ We(() => {
1956
+ S.current = w;
1957
1957
  }, [w]);
1958
1958
  const {
1959
- data: S,
1960
- isLoading: U,
1961
- error: $,
1962
- refetch: j
1963
- } = ct({
1959
+ data: I,
1960
+ isLoading: G,
1961
+ error: q,
1962
+ refetch: de
1963
+ } = dt({
1964
1964
  queryKey: ["form-schema", t],
1965
- queryFn: () => p ? Promise.resolve(N || {}) : Br(t),
1966
- enabled: l && (!p || !!N),
1965
+ queryFn: () => b ? Promise.resolve(O || {}) : Br(t),
1966
+ enabled: l && (!b || !!O),
1967
1967
  retry: 3,
1968
1968
  staleTime: 30 * 60 * 1e3,
1969
1969
  // 30 minutes - schemas don't change frequently
@@ -1971,10 +1971,10 @@ function Qr(e) {
1971
1971
  // 1 hour - keep schemas in cache longer
1972
1972
  throwOnError: !1
1973
1973
  }), {
1974
- data: z,
1975
- isLoading: ce,
1976
- error: me
1977
- } = ct({
1974
+ data: K,
1975
+ isLoading: fe,
1976
+ error: Le
1977
+ } = dt({
1978
1978
  queryKey: ["form-record", t, s],
1979
1979
  queryFn: () => Cr(t, s),
1980
1980
  enabled: l && r === "update" && !!s,
@@ -1984,122 +1984,122 @@ function Qr(e) {
1984
1984
  gcTime: 15 * 60 * 1e3,
1985
1985
  // 15 minutes - keep records for a reasonable time
1986
1986
  throwOnError: !1
1987
- }), Me = Ne(() => {
1988
- const o = { ...i };
1989
- if (r === "update" && z && Object.assign(o, z), m)
1990
- for (const [u, f] of Object.entries(m.fields))
1991
- f.defaultValue !== void 0 && !(u in o) && (o[u] = f.defaultValue);
1992
- return o;
1993
- }, [i, z, r, m]), A = dr({
1987
+ }), Me = Re(() => {
1988
+ const u = { ...i };
1989
+ if (r === "update" && K && Object.assign(u, K), m)
1990
+ for (const [h, c] of Object.entries(m.fields))
1991
+ c.defaultValue !== void 0 && !(h in u) && (u[h] = c.defaultValue);
1992
+ return u;
1993
+ }, [i, K, r, m]), E = dr({
1994
1994
  mode: n,
1995
1995
  defaultValues: i,
1996
- values: r === "update" && z ? Me : void 0
1996
+ values: r === "update" && K ? Me : void 0
1997
1997
  });
1998
- $e(() => {
1999
- var o;
2000
- if (S)
1998
+ We(() => {
1999
+ var u;
2000
+ if (I)
2001
2001
  try {
2002
- const u = Dr(
2003
- S,
2002
+ const h = Dr(
2003
+ I,
2004
2004
  {},
2005
2005
  // Pass empty object - validation functions get live values from react-hook-form
2006
- d
2006
+ f
2007
2007
  );
2008
- K(u);
2009
- const f = Rr(u);
2010
- Object.keys(f).length > 0 && Mr(f).then(Z).catch(console.warn);
2011
- } catch (u) {
2012
- console.error("Schema processing failed:", u), (o = E.current) == null || o.call(E, u);
2008
+ Y(h);
2009
+ const c = Rr(h);
2010
+ Object.keys(c).length > 0 && Mr(c).then(Z).catch(console.warn);
2011
+ } catch (h) {
2012
+ console.error("Schema processing failed:", h), (u = S.current) == null || u.call(S, h);
2013
2013
  }
2014
- }, [S, d]), $e(() => {
2015
- var o;
2016
- $ && ((o = E.current) == null || o.call(E, $));
2017
- }, [$]), $e(() => {
2018
- if (!v || r !== "create" || !m || !l || L)
2014
+ }, [I, f]), We(() => {
2015
+ var u;
2016
+ q && ((u = S.current) == null || u.call(S, q));
2017
+ }, [q]), We(() => {
2018
+ if (!v || r !== "create" || !m || !l || M || x.current)
2019
2019
  return;
2020
- (async () => {
2021
- he(!0), ne(null);
2020
+ x.current = !0, (async () => {
2021
+ ye(!0), ne(null);
2022
2022
  try {
2023
- const f = await pe(t).draftInteraction({});
2024
- T(f._id), f && typeof f == "object" && Object.entries(f).forEach(([h, c]) => {
2025
- if (h === "_id") return;
2026
- A.getValues(h) !== c && A.setValue(h, c, {
2023
+ const c = await be(t).draftInteraction({});
2024
+ L(c._id), c && typeof c == "object" && Object.entries(c).forEach(([d, y]) => {
2025
+ if (d === "_id") return;
2026
+ E.getValues(d) !== y && E.setValue(d, y, {
2027
2027
  shouldDirty: !1,
2028
2028
  shouldValidate: !1
2029
2029
  });
2030
2030
  });
2031
- } catch (u) {
2032
- console.error("Failed to create initial draft:", u), ne(u);
2031
+ } catch (h) {
2032
+ console.error("Failed to create initial draft:", h), ne(h), x.current = !1;
2033
2033
  } finally {
2034
- he(!1);
2034
+ ye(!1);
2035
2035
  }
2036
2036
  })();
2037
- }, [v, r, m, l, L, t, A]);
2038
- const Ee = Ne(() => {
2037
+ }, [v, r, m, l, M, t]);
2038
+ const we = Re(() => {
2039
2039
  if (!m) return [];
2040
- const o = /* @__PURE__ */ new Set(), u = new Set(m.computedFields);
2041
- return Object.entries(m.fieldRules).forEach(([f, h]) => {
2042
- h.computation.forEach((c) => {
2043
- const y = m.rules.computation[c];
2044
- y != null && y.ExpressionTree && Dt(y.ExpressionTree).forEach((b) => {
2045
- m.fields[b] && b !== f && !u.has(b) && o.add(b);
2040
+ const u = /* @__PURE__ */ new Set(), h = new Set(m.computedFields);
2041
+ return Object.entries(m.fieldRules).forEach(([c, d]) => {
2042
+ d.computation.forEach((y) => {
2043
+ const p = m.rules.computation[y];
2044
+ p != null && p.ExpressionTree && St(p.ExpressionTree).forEach((_) => {
2045
+ m.fields[_] && _ !== c && !h.has(_) && u.add(_);
2046
2046
  });
2047
2047
  });
2048
- }), m.computedFields.forEach((f) => {
2049
- const h = m.fields[f];
2050
- h._bdoField.Formula && Dt(
2051
- h._bdoField.Formula.ExpressionTree
2052
- ).forEach((y) => {
2053
- m.fields[y] && y !== f && !u.has(y) && o.add(y);
2048
+ }), m.computedFields.forEach((c) => {
2049
+ const d = m.fields[c];
2050
+ d._bdoField.Formula && St(
2051
+ d._bdoField.Formula.ExpressionTree
2052
+ ).forEach((p) => {
2053
+ m.fields[p] && p !== c && !h.has(p) && u.add(p);
2054
2054
  });
2055
- }), Array.from(o);
2056
- }, [m]), Ae = te(
2057
- async (o) => {
2058
- if (!(!m || !(v || Ee.length > 0 && Ee.includes(o)))) {
2059
- if (v && r === "create" && !L) {
2055
+ }), Array.from(u);
2056
+ }, [m]), Ie = te(
2057
+ async (u) => {
2058
+ if (!(!m || !(v || we.length > 0 && we.includes(u)))) {
2059
+ if (v && r === "create" && !M) {
2060
2060
  console.warn("Interactive create mode: waiting for draft ID");
2061
2061
  return;
2062
2062
  }
2063
- B.current || (le.current && clearTimeout(le.current), le.current = setTimeout(() => {
2064
- if (!m || B.current)
2063
+ j.current || (ce.current && clearTimeout(ce.current), ce.current = setTimeout(() => {
2064
+ if (!m || j.current)
2065
2065
  return;
2066
- const f = A.getValues();
2066
+ const c = E.getValues();
2067
2067
  (async () => {
2068
- B.current = !0;
2068
+ j.current = !0;
2069
2069
  try {
2070
- const c = pe(t), y = {};
2071
- r === "update" && s && "_id" in f && (y._id = f._id), v && r === "create" && L && (y._id = L);
2072
- const F = V.current ?? (r === "update" ? z : null) ?? {}, b = new Set(
2070
+ const y = be(t), p = {};
2071
+ r === "update" && s && "_id" in c && (p._id = c._id), v && r === "create" && M && (p._id = M);
2072
+ const F = V.current ?? (r === "update" ? K : null) ?? {}, _ = new Set(
2073
2073
  m.computedFields || []
2074
2074
  );
2075
- Object.keys(f).forEach((q) => {
2076
- if (q === "_id" || b.has(q)) return;
2077
- const J = f[q], be = F[q];
2078
- JSON.stringify(J) !== JSON.stringify(be) && (J !== "" && J !== null && J !== void 0) && (y[q] = J);
2075
+ Object.keys(c).forEach((B) => {
2076
+ if (B === "_id" || _.has(B)) return;
2077
+ const z = c[B], je = F[B];
2078
+ JSON.stringify(z) !== JSON.stringify(je) && (z !== "" && z !== null && z !== void 0) && (p[B] = z);
2079
2079
  });
2080
- const _ = y, P = {
2080
+ const R = p, $ = {
2081
2081
  ...V.current
2082
2082
  };
2083
- Object.keys(f).forEach((q) => {
2084
- b.has(q) || (P[q] = f[q]);
2085
- }), V.current = P;
2086
- let W;
2087
- r === "update" && s ? W = await c.draftPatch(s, _) : v && L ? W = await c.draftInteraction(_) : W = await c.draft(_), W && typeof W == "object" && (Object.entries(W).forEach(
2088
- ([q, J]) => {
2089
- f[q] !== J && A.setValue(q, J, {
2083
+ Object.keys(c).forEach((B) => {
2084
+ _.has(B) || ($[B] = c[B]);
2085
+ }), V.current = $;
2086
+ let ue;
2087
+ r === "update" && s ? ue = await y.draftPatch(s, R) : v && M ? ue = await y.draftInteraction(R) : ue = await y.draft(R), ue && typeof ue == "object" && (Object.entries(ue).forEach(
2088
+ ([B, z]) => {
2089
+ c[B] !== z && E.setValue(B, z, {
2090
2090
  shouldDirty: !1,
2091
2091
  shouldValidate: !1
2092
2092
  });
2093
2093
  }
2094
- ), Object.entries(W).forEach(
2095
- ([q, J]) => {
2096
- b.has(q) && (V.current[q] = J);
2094
+ ), Object.entries(ue).forEach(
2095
+ ([B, z]) => {
2096
+ _.has(B) && (V.current[B] = z);
2097
2097
  }
2098
2098
  ));
2099
- } catch (c) {
2100
- console.warn("Failed to compute fields via API:", c);
2099
+ } catch (y) {
2100
+ console.warn("Failed to compute fields via API:", y);
2101
2101
  } finally {
2102
- B.current = !1;
2102
+ j.current = !1;
2103
2103
  }
2104
2104
  })();
2105
2105
  }, 300));
@@ -2109,241 +2109,241 @@ function Qr(e) {
2109
2109
  m,
2110
2110
  r,
2111
2111
  s,
2112
- z,
2112
+ K,
2113
2113
  t,
2114
- A,
2115
- Ee,
2114
+ E,
2115
+ we,
2116
2116
  v,
2117
- L
2117
+ M
2118
2118
  ]
2119
- ), Ye = te(async () => {
2119
+ ), ke = te(async () => {
2120
2120
  if (!m)
2121
2121
  return !1;
2122
- const o = A.getValues();
2123
- if (!await A.trigger())
2122
+ const u = E.getValues();
2123
+ if (!await E.trigger())
2124
2124
  return !1;
2125
- const f = m.crossFieldValidation.map(
2126
- (c) => ({
2127
- Id: c.Id,
2128
- Condition: { ExpressionTree: c.ExpressionTree },
2129
- Message: c.Message || `Validation failed for ${c.Name}`
2125
+ const c = m.crossFieldValidation.map(
2126
+ (y) => ({
2127
+ Id: y.Id,
2128
+ Condition: { ExpressionTree: y.ExpressionTree },
2129
+ Message: y.Message || `Validation failed for ${y.Name}`
2130
2130
  })
2131
- ), h = At(
2132
- f,
2133
- o,
2134
- O
2131
+ ), d = xt(
2132
+ c,
2133
+ u,
2134
+ C
2135
2135
  );
2136
- return h.length > 0 ? (h.forEach((c, y) => {
2137
- A.setError(`root.crossField${y}`, {
2136
+ return d.length > 0 ? (d.forEach((y, p) => {
2137
+ E.setError(`root.crossField${p}`, {
2138
2138
  type: "validate",
2139
- message: c.message
2139
+ message: y.message
2140
2140
  });
2141
2141
  }), !1) : !0;
2142
2142
  }, [
2143
2143
  m,
2144
- A.getValues,
2145
- A.trigger,
2146
- A.setError,
2147
- O
2148
- ]), Ie = te(
2149
- (o, u) => A.handleSubmit(
2144
+ E.getValues,
2145
+ E.trigger,
2146
+ E.setError,
2147
+ C
2148
+ ]), ze = te(
2149
+ (u, h) => E.handleSubmit(
2150
2150
  // RHF onValid handler - validation passed, now do cross-field + API
2151
- async (f, h) => {
2151
+ async (c, d) => {
2152
2152
  if (!m) {
2153
- const c = new Error("Schema not loaded");
2154
- u == null || u(c, h);
2153
+ const y = new Error("Schema not loaded");
2154
+ h == null || h(y, d);
2155
2155
  return;
2156
2156
  }
2157
- x(!0);
2157
+ A(!0);
2158
2158
  try {
2159
- const c = m.crossFieldValidation.map(
2160
- (_) => ({
2161
- Id: _.Id,
2162
- Condition: { ExpressionTree: _.ExpressionTree },
2163
- Message: _.Message || `Validation failed for ${_.Name}`
2159
+ const y = m.crossFieldValidation.map(
2160
+ (R) => ({
2161
+ Id: R.Id,
2162
+ Condition: { ExpressionTree: R.ExpressionTree },
2163
+ Message: R.Message || `Validation failed for ${R.Name}`
2164
2164
  })
2165
- ), y = At(
2165
+ ), p = xt(
2166
+ y,
2166
2167
  c,
2167
- f,
2168
- O
2168
+ C
2169
2169
  );
2170
- if (y.length > 0) {
2171
- y.forEach((_, P) => {
2172
- A.setError(`root.crossField${P}`, {
2170
+ if (p.length > 0) {
2171
+ p.forEach((R, $) => {
2172
+ E.setError(`root.crossField${$}`, {
2173
2173
  type: "validate",
2174
- message: _.message
2174
+ message: R.message
2175
2175
  });
2176
- }), u == null || u(A.formState.errors, h);
2176
+ }), h == null || h(E.formState.errors, d);
2177
2177
  return;
2178
2178
  }
2179
2179
  const F = Ir(
2180
- f,
2180
+ c,
2181
2181
  m.computedFields,
2182
2182
  r,
2183
- z
2183
+ K
2184
2184
  );
2185
- let b;
2185
+ let _;
2186
2186
  if (v) {
2187
- const _ = pe(t);
2187
+ const R = be(t);
2188
2188
  if (r === "create") {
2189
- if (!L)
2189
+ if (!M)
2190
2190
  throw new Error(
2191
2191
  "Interactive create mode requires a draft ID. Draft creation may have failed."
2192
2192
  );
2193
- b = { success: !0, data: await _.draft({
2193
+ _ = { success: !0, data: await R.draft({
2194
2194
  ...F,
2195
- _id: L
2195
+ _id: M
2196
2196
  }) };
2197
2197
  } else
2198
- b = { success: !0, data: await _.draftUpdate(s, F) };
2199
- } else if (b = await Tr(
2198
+ _ = { success: !0, data: await R.draftUpdate(s, F) };
2199
+ } else if (_ = await Tr(
2200
2200
  t,
2201
2201
  r,
2202
2202
  F,
2203
2203
  s
2204
- ), !b.success)
2205
- throw b.error || new Error("Submission failed");
2206
- r === "create" && (A.reset(), v && T(null)), await (o == null ? void 0 : o(b.data || f, h));
2207
- } catch (c) {
2208
- u == null || u(c, h);
2204
+ ), !_.success)
2205
+ throw _.error || new Error("Submission failed");
2206
+ r === "create" && (E.reset(), v && L(null)), await (u == null ? void 0 : u(_.data || c, d));
2207
+ } catch (y) {
2208
+ h == null || h(y, d);
2209
2209
  } finally {
2210
- x(!1);
2210
+ A(!1);
2211
2211
  }
2212
2212
  },
2213
2213
  // RHF onInvalid handler - validation failed
2214
- (f, h) => {
2215
- u == null || u(f, h);
2214
+ (c, d) => {
2215
+ h == null || h(c, d);
2216
2216
  }
2217
2217
  ),
2218
2218
  [
2219
- A,
2219
+ E,
2220
2220
  m,
2221
- O,
2221
+ C,
2222
2222
  t,
2223
2223
  r,
2224
2224
  s,
2225
- z,
2225
+ K,
2226
2226
  v,
2227
- L
2227
+ M
2228
2228
  ]
2229
- ), Ke = te(
2230
- (o) => (m == null ? void 0 : m.fields[o]) || null,
2229
+ ), Ae = te(
2230
+ (u) => (m == null ? void 0 : m.fields[u]) || null,
2231
2231
  [m]
2232
- ), xe = te(() => {
2232
+ ), Ue = te(() => {
2233
2233
  if (!m) return {};
2234
- const o = {};
2235
- return Object.entries(m.fields).forEach(([u, f]) => {
2236
- o[u] = f;
2237
- }), o;
2238
- }, [m]), ke = te(
2239
- (o) => !!(m != null && m.fields[o]),
2234
+ const u = {};
2235
+ return Object.entries(m.fields).forEach(([h, c]) => {
2236
+ u[h] = c;
2237
+ }), u;
2238
+ }, [m]), xe = te(
2239
+ (u) => !!(m != null && m.fields[u]),
2240
2240
  [m]
2241
2241
  ), _e = te(
2242
- (o) => (m == null ? void 0 : m.requiredFields.includes(o)) || !1,
2242
+ (u) => (m == null ? void 0 : m.requiredFields.includes(u)) || !1,
2243
2243
  [m]
2244
- ), De = te(
2245
- (o) => (m == null ? void 0 : m.computedFields.includes(o)) || !1,
2244
+ ), Je = te(
2245
+ (u) => (m == null ? void 0 : m.computedFields.includes(u)) || !1,
2246
2246
  [m]
2247
- ), ze = te(async () => {
2248
- await j();
2249
- }, [j]), Ue = te(() => {
2250
- A.clearErrors();
2251
- }, [A]), Be = U || r === "update" && ce || v && r === "create" && ue, Pe = Be || H, Se = $ || me || ae, Je = !!Se, Ge = Ne(
2247
+ ), Be = te(async () => {
2248
+ await de();
2249
+ }, [de]), Ge = te(() => {
2250
+ E.clearErrors();
2251
+ }, [E]), De = G || r === "update" && fe || v && r === "create" && le, Pe = De || W, qe = q || Le || ae, Xe = !!qe, ot = Re(
2252
2252
  () => (m == null ? void 0 : m.computedFields) || [],
2253
2253
  [m]
2254
- ), ot = Ne(
2254
+ ), $e = Re(
2255
2255
  () => (m == null ? void 0 : m.requiredFields) || [],
2256
2256
  [m]
2257
- ), Re = Ne(() => {
2257
+ ), a = Re(() => {
2258
2258
  if (!m) return {};
2259
- const o = {};
2260
- return Object.entries(m.fields).forEach(([u, f]) => {
2261
- const h = {};
2262
- switch (f.required && (h.required = `${f.label} is required`), f.permission.editable || (h.disabled = !0), f.type) {
2259
+ const u = {};
2260
+ return Object.entries(m.fields).forEach(([h, c]) => {
2261
+ const d = {};
2262
+ switch (c.required && (d.required = `${c.label} is required`), c.permission.editable || (d.disabled = !0), c.type) {
2263
2263
  case "number":
2264
- h.valueAsNumber = !0;
2264
+ d.valueAsNumber = !0;
2265
2265
  break;
2266
2266
  case "date":
2267
2267
  case "datetime-local":
2268
- h.valueAsDate = !0;
2268
+ d.valueAsDate = !0;
2269
2269
  break;
2270
2270
  }
2271
- const c = f.rules.validation;
2272
- c.length > 0 && (h.validate = {
2273
- expressionValidation: (y) => {
2274
- const F = A.getValues();
2275
- for (const b of c) {
2276
- const _ = m.rules.validation[b];
2277
- if (_) {
2278
- const P = $r(
2279
- u,
2280
- y,
2281
- [_],
2271
+ const y = c.rules.validation;
2272
+ y.length > 0 && (d.validate = {
2273
+ expressionValidation: (p) => {
2274
+ const F = E.getValues();
2275
+ for (const _ of y) {
2276
+ const R = m.rules.validation[_];
2277
+ if (R) {
2278
+ const $ = $r(
2279
+ h,
2280
+ p,
2281
+ [R],
2282
2282
  F,
2283
2283
  ee
2284
2284
  );
2285
- if (!P.isValid)
2286
- return P.message || _.Message || "Invalid value";
2285
+ if (!$.isValid)
2286
+ return $.message || R.Message || "Invalid value";
2287
2287
  }
2288
2288
  }
2289
2289
  return !0;
2290
2290
  }
2291
- }), o[u] = h;
2292
- }), o;
2293
- }, [m, A, O]);
2291
+ }), u[h] = d;
2292
+ }), u;
2293
+ }, [m, E, C]);
2294
2294
  return {
2295
2295
  // Form methods with strict typing
2296
2296
  register: te(
2297
- (o, u) => {
2298
- const f = Re[o], h = u == null ? void 0 : u.onBlur, c = async (y) => {
2299
- h && await h(y);
2297
+ (u, h) => {
2298
+ const c = a[u], d = h == null ? void 0 : h.onBlur, y = async (p) => {
2299
+ d && await d(p);
2300
2300
  let F = !0;
2301
- n === "onBlur" || n === "onTouched" || n === "all" ? F = await A.trigger(o) : F = !A.getFieldState(o, A.formState).error, F && await Ae(o);
2301
+ n === "onBlur" || n === "onTouched" || n === "all" ? F = await E.trigger(u) : F = !E.getFieldState(u, E.formState).error, F && await Ie(u);
2302
2302
  };
2303
- return A.register(o, {
2304
- ...f,
2305
- ...u,
2306
- onBlur: c
2303
+ return E.register(u, {
2304
+ ...c,
2305
+ ...h,
2306
+ onBlur: y
2307
2307
  });
2308
2308
  },
2309
- [A, Re, Ae, n]
2309
+ [E, a, Ie, n]
2310
2310
  ),
2311
- handleSubmit: Ie,
2312
- watch: A.watch,
2311
+ handleSubmit: ze,
2312
+ watch: E.watch,
2313
2313
  // Type assertion for complex generic constraints
2314
- setValue: A.setValue,
2315
- reset: A.reset,
2314
+ setValue: E.setValue,
2315
+ reset: E.reset,
2316
2316
  // Flattened form state (NEW - direct access, no nested formState)
2317
- errors: A.formState.errors,
2318
- isValid: A.formState.isValid,
2319
- isDirty: A.formState.isDirty,
2320
- isSubmitting: A.formState.isSubmitting || H,
2321
- isSubmitSuccessful: A.formState.isSubmitSuccessful,
2317
+ errors: E.formState.errors,
2318
+ isValid: E.formState.isValid,
2319
+ isDirty: E.formState.isDirty,
2320
+ isSubmitting: E.formState.isSubmitting || W,
2321
+ isSubmitSuccessful: E.formState.isSubmitSuccessful,
2322
2322
  // Loading states
2323
- isLoadingInitialData: Be,
2324
- isLoadingRecord: ce,
2323
+ isLoadingInitialData: De,
2324
+ isLoadingRecord: fe,
2325
2325
  isLoading: Pe,
2326
2326
  // Interactive mode state
2327
- draftId: L,
2328
- isCreatingDraft: ue,
2327
+ draftId: M,
2328
+ isCreatingDraft: le,
2329
2329
  // Error handling
2330
- loadError: Se,
2331
- hasError: Je,
2330
+ loadError: qe,
2331
+ hasError: Xe,
2332
2332
  // Schema information
2333
- schema: S,
2333
+ schema: I,
2334
2334
  schemaConfig: m,
2335
- computedFields: Ge,
2336
- requiredFields: ot,
2335
+ computedFields: ot,
2336
+ requiredFields: $e,
2337
2337
  // Field helpers
2338
- getField: Ke,
2339
- getFields: xe,
2340
- hasField: ke,
2338
+ getField: Ae,
2339
+ getFields: Ue,
2340
+ hasField: xe,
2341
2341
  isFieldRequired: _e,
2342
- isFieldComputed: De,
2342
+ isFieldComputed: Je,
2343
2343
  // Operations
2344
- refreshSchema: ze,
2345
- validateForm: Ye,
2346
- clearErrors: Ue
2344
+ refreshSchema: Be,
2345
+ validateForm: ke,
2346
+ clearErrors: Ge
2347
2347
  };
2348
2348
  }
2349
2349
  export {