stone-kit 0.0.415 → 0.0.417

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,74 +1,78 @@
1
- import { jsx as M, jsxs as ve } from "react/jsx-runtime";
2
- import { I as bt } from "../../../index-BaVdWc7x.js";
3
- import { M as xt } from "../../../Modal-DbD1tgiF.js";
4
- import { Flex as Vt } from "../../Flex/ui/Flex.js";
1
+ import { jsx as D, jsxs as ee } from "react/jsx-runtime";
2
+ import { I as xr } from "../../../index-BaVdWc7x.js";
3
+ import { M as Vr } from "../../../Modal-DbD1tgiF.js";
4
+ import { Flex as Fr } from "../../Flex/ui/Flex.js";
5
5
  import { Input as Ee } from "../../Input/ui/Input.js";
6
- import W from "react";
6
+ import $ from "react";
7
7
  import { Button as Ke } from "../../Button/ui/Button.js";
8
- import { NewIcon as Ft } from "../../NewIcon/ui/NewIcon.js";
9
- import { phoneReg as At, nameReg as pt, emailReg as wt } from "../utils/reg.js";
10
- import { CheckBox as Ge } from "../../CheckBox/CheckBox.js";
11
- import { TextArea as kt } from "../../TextArea/TextArea.js";
12
- import { useClientWidth as Dt } from "../../../shared/useClientWidth.js";
13
- const St = "_btn_1yfj5_1", Et = "_modal_1yfj5_9", Ct = "_modalBody_1yfj5_16", Bt = "_root_1yfj5_21", Tt = "_title_1yfj5_34", Rt = "_description_1yfj5_41", Lt = "_inputWrapper_1yfj5_48", Mt = "_linkPolicy_1yfj5_55", X = {
14
- btn: St,
15
- modal: Et,
16
- modalBody: Ct,
17
- root: Bt,
18
- title: Tt,
19
- description: Rt,
20
- inputWrapper: Lt,
21
- linkPolicy: Mt
8
+ import { NewIcon as Ge } from "../../NewIcon/ui/NewIcon.js";
9
+ import { phoneReg as Ar, nameReg as pr, emailReg as kr } from "../utils/reg.js";
10
+ import { CheckBox as Je } from "../../CheckBox/CheckBox.js";
11
+ import { TextArea as wr } from "../../TextArea/TextArea.js";
12
+ import { useClientWidth as Dr } from "../../../shared/useClientWidth.js";
13
+ const Sr = "_btn_7n08v_1", Er = "_modal_7n08v_9", Cr = "_modalBody_7n08v_16", Tr = "_root_7n08v_21", Br = "_title_7n08v_34", Lr = "_description_7n08v_41", Rr = "_inputWrapper_7n08v_48", Mr = "_linkPolicy_7n08v_55", Or = "_telegramLink_7n08v_60", Nr = "_telegramWrapper_7n08v_65", Ur = "_telegram_7n08v_60", Ir = "_orText_7n08v_88", O = {
14
+ btn: Sr,
15
+ modal: Er,
16
+ modalBody: Cr,
17
+ root: Tr,
18
+ title: Br,
19
+ description: Lr,
20
+ inputWrapper: Rr,
21
+ linkPolicy: Mr,
22
+ telegramLink: Or,
23
+ telegramWrapper: Nr,
24
+ telegram: Ur,
25
+ orText: Ir
22
26
  };
23
- var ge = (e) => e.type === "checkbox", oe = (e) => e instanceof Date, T = (e) => e == null;
24
- const it = (e) => typeof e == "object";
25
- var E = (e) => !T(e) && !Array.isArray(e) && it(e) && !oe(e), Ot = (e) => E(e) && e.target ? ge(e.target) ? e.target.checked : e.target.value : e, Nt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ut = (e, s) => e.has(Nt(s)), It = (e) => {
27
+ var ve = (e) => e.type === "checkbox", ue = (e) => e instanceof Date, L = (e) => e == null;
28
+ const lr = (e) => typeof e == "object";
29
+ var E = (e) => !L(e) && !Array.isArray(e) && lr(e) && !ue(e), Pr = (e) => E(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, qr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Wr = (e, s) => e.has(qr(s)), Hr = (e) => {
26
30
  const s = e.constructor && e.constructor.prototype;
27
31
  return E(s) && s.hasOwnProperty("isPrototypeOf");
28
- }, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
29
- function q(e) {
32
+ }, Le = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
33
+ function z(e) {
30
34
  let s;
31
- const r = Array.isArray(e);
35
+ const t = Array.isArray(e);
32
36
  if (e instanceof Date)
33
37
  s = new Date(e);
34
38
  else if (e instanceof Set)
35
39
  s = new Set(e);
36
- else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r || E(e)))
37
- if (s = r ? [] : {}, !r && !It(e))
40
+ else if (!(Le && (e instanceof Blob || e instanceof FileList)) && (t || E(e)))
41
+ if (s = t ? [] : {}, !t && !Hr(e))
38
42
  s = e;
39
43
  else
40
44
  for (const n in e)
41
- e.hasOwnProperty(n) && (s[n] = q(e[n]));
45
+ e.hasOwnProperty(n) && (s[n] = z(e[n]));
42
46
  else
43
47
  return e;
44
48
  return s;
45
49
  }
46
- var pe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, d = (e, s, r) => {
50
+ var pe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, f = (e, s, t) => {
47
51
  if (!s || !E(e))
48
- return r;
49
- const n = pe(s.split(/[,[\].]+?/)).reduce((u, a) => T(u) ? u : u[a], e);
50
- return w(n) || n === e ? w(e[s]) ? r : e[s] : n;
51
- }, te = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), lt = (e) => pe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, r) => {
52
+ return t;
53
+ const n = pe(s.split(/[,[\].]+?/)).reduce((o, a) => L(o) ? o : o[a], e);
54
+ return k(n) || n === e ? k(e[s]) ? t : e[s] : n;
55
+ }, re = (e) => typeof e == "boolean", Re = (e) => /^\w*$/.test(e), ar = (e) => pe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, t) => {
52
56
  let n = -1;
53
- const u = Le(s) ? [s] : lt(s), a = u.length, y = a - 1;
57
+ const o = Re(s) ? [s] : ar(s), a = o.length, y = a - 1;
54
58
  for (; ++n < a; ) {
55
- const g = u[n];
56
- let R = r;
59
+ const g = o[n];
60
+ let U = t;
57
61
  if (n !== y) {
58
- const I = e[g];
59
- R = E(I) || Array.isArray(I) ? I : isNaN(+u[n + 1]) ? {} : [];
62
+ const q = e[g];
63
+ U = E(q) || Array.isArray(q) ? q : isNaN(+o[n + 1]) ? {} : [];
60
64
  }
61
65
  if (g === "__proto__")
62
66
  return;
63
- e[g] = R, e = e[g];
67
+ e[g] = U, e = e[g];
64
68
  }
65
69
  return e;
66
70
  };
67
- const Je = {
71
+ const Qe = {
68
72
  BLUR: "blur",
69
73
  FOCUS_OUT: "focusout",
70
74
  CHANGE: "change"
71
- }, z = {
75
+ }, G = {
72
76
  onBlur: "onBlur",
73
77
  onChange: "onChange",
74
78
  onSubmit: "onSubmit",
@@ -83,206 +87,206 @@ const Je = {
83
87
  required: "required",
84
88
  validate: "validate"
85
89
  };
86
- W.createContext(null);
87
- var Pt = (e, s, r, n = !0) => {
88
- const u = {
90
+ $.createContext(null);
91
+ var zr = (e, s, t, n = !0) => {
92
+ const o = {
89
93
  defaultValues: s._defaultValues
90
94
  };
91
95
  for (const a in e)
92
- Object.defineProperty(u, a, {
96
+ Object.defineProperty(o, a, {
93
97
  get: () => {
94
98
  const y = a;
95
- return s._proxyFormState[y] !== z.all && (s._proxyFormState[y] = !n || z.all), e[y];
99
+ return s._proxyFormState[y] !== G.all && (s._proxyFormState[y] = !n || G.all), e[y];
96
100
  }
97
101
  });
98
- return u;
99
- }, O = (e) => E(e) && !Object.keys(e).length, qt = (e, s, r, n) => {
100
- r(e);
101
- const { name: u, ...a } = e;
102
- return O(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === z.all);
102
+ return o;
103
+ }, N = (e) => E(e) && !Object.keys(e).length, $r = (e, s, t, n) => {
104
+ t(e);
105
+ const { name: o, ...a } = e;
106
+ return N(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === G.all);
103
107
  }, me = (e) => Array.isArray(e) ? e : [e];
104
- function Wt(e) {
105
- const s = W.useRef(e);
106
- s.current = e, W.useEffect(() => {
107
- const r = !e.disabled && s.current.subject && s.current.subject.subscribe({
108
+ function jr(e) {
109
+ const s = $.useRef(e);
110
+ s.current = e, $.useEffect(() => {
111
+ const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
108
112
  next: s.current.next
109
113
  });
110
114
  return () => {
111
- r && r.unsubscribe();
115
+ t && t.unsubscribe();
112
116
  };
113
117
  }, [e.disabled]);
114
118
  }
115
- var J = (e) => typeof e == "string", jt = (e, s, r, n, u) => J(e) ? (n && s.watch.add(e), d(r, e, u)) : Array.isArray(e) ? e.map((a) => (n && s.watch.add(a), d(r, a))) : (n && (s.watchAll = !0), r), Ht = (e, s, r, n, u) => s ? {
116
- ...r[e],
119
+ var Q = (e) => typeof e == "string", Kr = (e, s, t, n, o) => Q(e) ? (n && s.watch.add(e), f(t, e, o)) : Array.isArray(e) ? e.map((a) => (n && s.watch.add(a), f(t, a))) : (n && (s.watchAll = !0), t), Gr = (e, s, t, n, o) => s ? {
120
+ ...t[e],
117
121
  types: {
118
- ...r[e] && r[e].types ? r[e].types : {},
119
- [n]: u || !0
122
+ ...t[e] && t[e].types ? t[e].types : {},
123
+ [n]: o || !0
120
124
  }
121
- } : {}, Qe = (e) => ({
122
- isOnSubmit: !e || e === z.onSubmit,
123
- isOnBlur: e === z.onBlur,
124
- isOnChange: e === z.onChange,
125
- isOnAll: e === z.all,
126
- isOnTouch: e === z.onTouched
127
- }), Xe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
128
- const he = (e, s, r, n) => {
129
- for (const u of r || Object.keys(e)) {
130
- const a = d(e, u);
125
+ } : {}, Xe = (e) => ({
126
+ isOnSubmit: !e || e === G.onSubmit,
127
+ isOnBlur: e === G.onBlur,
128
+ isOnChange: e === G.onChange,
129
+ isOnAll: e === G.all,
130
+ isOnTouch: e === G.onTouched
131
+ }), Ye = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
132
+ const ge = (e, s, t, n) => {
133
+ for (const o of t || Object.keys(e)) {
134
+ const a = f(e, o);
131
135
  if (a) {
132
136
  const { _f: y, ...g } = a;
133
137
  if (y) {
134
- if (y.refs && y.refs[0] && s(y.refs[0], u) && !n)
138
+ if (y.refs && y.refs[0] && s(y.refs[0], o) && !n)
135
139
  break;
136
140
  if (y.ref && s(y.ref, y.name) && !n)
137
141
  break;
138
- he(g, s);
142
+ ge(g, s);
139
143
  } else
140
- E(g) && he(g, s);
144
+ E(g) && ge(g, s);
141
145
  }
142
146
  }
143
147
  };
144
- var zt = (e, s, r) => {
145
- const n = me(d(e, r));
146
- return V(n, "root", s[r]), V(e, r, n), e;
147
- }, Me = (e) => e.type === "file", re = (e) => typeof e == "function", xe = (e) => {
148
- if (!Re)
148
+ var Jr = (e, s, t) => {
149
+ const n = me(f(e, t));
150
+ return V(n, "root", s[t]), V(e, t, n), e;
151
+ }, Me = (e) => e.type === "file", te = (e) => typeof e == "function", xe = (e) => {
152
+ if (!Le)
149
153
  return !1;
150
154
  const s = e ? e.ownerDocument : 0;
151
155
  return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
152
- }, be = (e) => J(e), Oe = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
153
- const Ye = {
156
+ }, be = (e) => Q(e), Oe = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
157
+ const Ze = {
154
158
  value: !1,
155
159
  isValid: !1
156
- }, Ze = { value: !0, isValid: !0 };
157
- var at = (e) => {
160
+ }, er = { value: !0, isValid: !0 };
161
+ var nr = (e) => {
158
162
  if (Array.isArray(e)) {
159
163
  if (e.length > 1) {
160
- const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
164
+ const s = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
161
165
  return { value: s, isValid: !!s.length };
162
166
  }
163
167
  return e[0].checked && !e[0].disabled ? (
164
168
  // @ts-expect-error expected to work in the browser
165
- e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Ze : { value: e[0].value, isValid: !0 } : Ze
166
- ) : Ye;
169
+ e[0].attributes && !k(e[0].attributes.value) ? k(e[0].value) || e[0].value === "" ? er : { value: e[0].value, isValid: !0 } : er
170
+ ) : Ze;
167
171
  }
168
- return Ye;
172
+ return Ze;
169
173
  };
170
- const et = {
174
+ const rr = {
171
175
  isValid: !1,
172
176
  value: null
173
177
  };
174
- var nt = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disabled ? {
178
+ var or = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
175
179
  isValid: !0,
176
- value: r.value
177
- } : s, et) : et;
178
- function tt(e, s, r = "validate") {
179
- if (be(e) || Array.isArray(e) && e.every(be) || te(e) && !e)
180
+ value: t.value
181
+ } : s, rr) : rr;
182
+ function tr(e, s, t = "validate") {
183
+ if (be(e) || Array.isArray(e) && e.every(be) || re(e) && !e)
180
184
  return {
181
- type: r,
185
+ type: t,
182
186
  message: be(e) ? e : "",
183
187
  ref: s
184
188
  };
185
189
  }
186
- var ue = (e) => E(e) && !Ve(e) ? e : {
190
+ var oe = (e) => E(e) && !Ve(e) ? e : {
187
191
  value: e,
188
192
  message: ""
189
- }, rt = async (e, s, r, n, u) => {
190
- const { ref: a, refs: y, required: g, maxLength: R, minLength: I, min: F, max: _, pattern: ie, validate: $, name: D, valueAsNumber: j, mount: K, disabled: G } = e._f, m = d(s, D);
191
- if (!K || G)
193
+ }, sr = async (e, s, t, n, o) => {
194
+ const { ref: a, refs: y, required: g, maxLength: U, minLength: q, min: F, max: _, pattern: le, validate: J, name: B, valueAsNumber: ce, mount: R, disabled: T } = e._f, m = f(s, B);
195
+ if (!R || T)
192
196
  return {};
193
- const N = y ? y[0] : a, B = (v) => {
194
- n && N.reportValidity && (N.setCustomValidity(te(v) ? "" : v || ""), N.reportValidity());
195
- }, A = {}, Z = Oe(a), le = ge(a), Q = Z || le, ee = (j || Me(a)) && w(a.value) && w(m) || xe(a) && a.value === "" || m === "" || Array.isArray(m) && !m.length, L = Ht.bind(null, D, r, A), ae = (v, b, p, C = Y.maxLength, H = Y.minLength) => {
196
- const P = v ? b : p;
197
- A[D] = {
198
- type: v ? C : H,
199
- message: P,
197
+ const j = y ? y[0] : a, K = (v) => {
198
+ n && j.reportValidity && (j.setCustomValidity(re(v) ? "" : v || ""), j.reportValidity());
199
+ }, A = {}, W = Oe(a), se = ve(a), X = W || se, Z = (ce || Me(a)) && k(a.value) && k(m) || xe(a) && a.value === "" || m === "" || Array.isArray(m) && !m.length, M = Gr.bind(null, B, t, A), ae = (v, b, p, C = Y.maxLength, I = Y.minLength) => {
200
+ const H = v ? b : p;
201
+ A[B] = {
202
+ type: v ? C : I,
203
+ message: H,
200
204
  ref: a,
201
- ...L(v ? C : H, P)
205
+ ...M(v ? C : I, H)
202
206
  };
203
207
  };
204
- if (u ? !Array.isArray(m) || !m.length : g && (!Q && (ee || T(m)) || te(m) && !m || le && !at(y).isValid || Z && !nt(y).isValid)) {
205
- const { value: v, message: b } = be(g) ? { value: !!g, message: g } : ue(g);
206
- if (v && (A[D] = {
208
+ if (o ? !Array.isArray(m) || !m.length : g && (!X && (Z || L(m)) || re(m) && !m || se && !nr(y).isValid || W && !or(y).isValid)) {
209
+ const { value: v, message: b } = be(g) ? { value: !!g, message: g } : oe(g);
210
+ if (v && (A[B] = {
207
211
  type: Y.required,
208
212
  message: b,
209
- ref: N,
210
- ...L(Y.required, b)
211
- }, !r))
212
- return B(b), A;
213
+ ref: j,
214
+ ...M(Y.required, b)
215
+ }, !t))
216
+ return K(b), A;
213
217
  }
214
- if (!ee && (!T(F) || !T(_))) {
218
+ if (!Z && (!L(F) || !L(_))) {
215
219
  let v, b;
216
- const p = ue(_), C = ue(F);
217
- if (!T(m) && !isNaN(m)) {
218
- const H = a.valueAsNumber || m && +m;
219
- T(p.value) || (v = H > p.value), T(C.value) || (b = H < C.value);
220
+ const p = oe(_), C = oe(F);
221
+ if (!L(m) && !isNaN(m)) {
222
+ const I = a.valueAsNumber || m && +m;
223
+ L(p.value) || (v = I > p.value), L(C.value) || (b = I < C.value);
220
224
  } else {
221
- const H = a.valueAsDate || new Date(m), P = (de) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + de), ce = a.type == "time", fe = a.type == "week";
222
- J(p.value) && m && (v = ce ? P(m) > P(p.value) : fe ? m > p.value : H > new Date(p.value)), J(C.value) && m && (b = ce ? P(m) < P(C.value) : fe ? m < C.value : H < new Date(C.value));
225
+ const I = a.valueAsDate || new Date(m), H = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), de = a.type == "time", fe = a.type == "week";
226
+ Q(p.value) && m && (v = de ? H(m) > H(p.value) : fe ? m > p.value : I > new Date(p.value)), Q(C.value) && m && (b = de ? H(m) < H(C.value) : fe ? m < C.value : I < new Date(C.value));
223
227
  }
224
- if ((v || b) && (ae(!!v, p.message, C.message, Y.max, Y.min), !r))
225
- return B(A[D].message), A;
228
+ if ((v || b) && (ae(!!v, p.message, C.message, Y.max, Y.min), !t))
229
+ return K(A[B].message), A;
226
230
  }
227
- if ((R || I) && !ee && (J(m) || u && Array.isArray(m))) {
228
- const v = ue(R), b = ue(I), p = !T(v.value) && m.length > +v.value, C = !T(b.value) && m.length < +b.value;
229
- if ((p || C) && (ae(p, v.message, b.message), !r))
230
- return B(A[D].message), A;
231
+ if ((U || q) && !Z && (Q(m) || o && Array.isArray(m))) {
232
+ const v = oe(U), b = oe(q), p = !L(v.value) && m.length > +v.value, C = !L(b.value) && m.length < +b.value;
233
+ if ((p || C) && (ae(p, v.message, b.message), !t))
234
+ return K(A[B].message), A;
231
235
  }
232
- if (ie && !ee && J(m)) {
233
- const { value: v, message: b } = ue(ie);
234
- if (Ve(v) && !m.match(v) && (A[D] = {
236
+ if (le && !Z && Q(m)) {
237
+ const { value: v, message: b } = oe(le);
238
+ if (Ve(v) && !m.match(v) && (A[B] = {
235
239
  type: Y.pattern,
236
240
  message: b,
237
241
  ref: a,
238
- ...L(Y.pattern, b)
239
- }, !r))
240
- return B(b), A;
242
+ ...M(Y.pattern, b)
243
+ }, !t))
244
+ return K(b), A;
241
245
  }
242
- if ($) {
243
- if (re($)) {
244
- const v = await $(m, s), b = tt(v, N);
245
- if (b && (A[D] = {
246
+ if (J) {
247
+ if (te(J)) {
248
+ const v = await J(m, s), b = tr(v, j);
249
+ if (b && (A[B] = {
246
250
  ...b,
247
- ...L(Y.validate, b.message)
248
- }, !r))
249
- return B(b.message), A;
250
- } else if (E($)) {
251
+ ...M(Y.validate, b.message)
252
+ }, !t))
253
+ return K(b.message), A;
254
+ } else if (E(J)) {
251
255
  let v = {};
252
- for (const b in $) {
253
- if (!O(v) && !r)
256
+ for (const b in J) {
257
+ if (!N(v) && !t)
254
258
  break;
255
- const p = tt(await $[b](m, s), N, b);
259
+ const p = tr(await J[b](m, s), j, b);
256
260
  p && (v = {
257
261
  ...p,
258
- ...L(b, p.message)
259
- }, B(p.message), r && (A[D] = v));
262
+ ...M(b, p.message)
263
+ }, K(p.message), t && (A[B] = v));
260
264
  }
261
- if (!O(v) && (A[D] = {
262
- ref: N,
265
+ if (!N(v) && (A[B] = {
266
+ ref: j,
263
267
  ...v
264
- }, !r))
268
+ }, !t))
265
269
  return A;
266
270
  }
267
271
  }
268
- return B(!0), A;
272
+ return K(!0), A;
269
273
  };
270
- function $t(e, s) {
271
- const r = s.slice(0, -1).length;
274
+ function Qr(e, s) {
275
+ const t = s.slice(0, -1).length;
272
276
  let n = 0;
273
- for (; n < r; )
274
- e = w(e) ? n++ : e[s[n++]];
277
+ for (; n < t; )
278
+ e = k(e) ? n++ : e[s[n++]];
275
279
  return e;
276
280
  }
277
- function Kt(e) {
281
+ function Xr(e) {
278
282
  for (const s in e)
279
- if (e.hasOwnProperty(s) && !w(e[s]))
283
+ if (e.hasOwnProperty(s) && !k(e[s]))
280
284
  return !1;
281
285
  return !0;
282
286
  }
283
287
  function S(e, s) {
284
- const r = Array.isArray(s) ? s : Le(s) ? [s] : lt(s), n = r.length === 1 ? e : $t(e, r), u = r.length - 1, a = r[u];
285
- return n && delete n[a], u !== 0 && (E(n) && O(n) || Array.isArray(n) && Kt(n)) && S(e, r.slice(0, -1)), e;
288
+ const t = Array.isArray(s) ? s : Re(s) ? [s] : ar(s), n = t.length === 1 ? e : Qr(e, t), o = t.length - 1, a = t[o];
289
+ return n && delete n[a], o !== 0 && (E(n) && N(n) || Array.isArray(n) && Xr(n)) && S(e, t.slice(0, -1)), e;
286
290
  }
287
291
  var Ce = () => {
288
292
  let e = [];
@@ -290,116 +294,116 @@ var Ce = () => {
290
294
  get observers() {
291
295
  return e;
292
296
  },
293
- next: (u) => {
297
+ next: (o) => {
294
298
  for (const a of e)
295
- a.next && a.next(u);
299
+ a.next && a.next(o);
296
300
  },
297
- subscribe: (u) => (e.push(u), {
301
+ subscribe: (o) => (e.push(o), {
298
302
  unsubscribe: () => {
299
- e = e.filter((a) => a !== u);
303
+ e = e.filter((a) => a !== o);
300
304
  }
301
305
  }),
302
306
  unsubscribe: () => {
303
307
  e = [];
304
308
  }
305
309
  };
306
- }, Fe = (e) => T(e) || !it(e);
307
- function se(e, s) {
310
+ }, Fe = (e) => L(e) || !lr(e);
311
+ function ie(e, s) {
308
312
  if (Fe(e) || Fe(s))
309
313
  return e === s;
310
- if (oe(e) && oe(s))
314
+ if (ue(e) && ue(s))
311
315
  return e.getTime() === s.getTime();
312
- const r = Object.keys(e), n = Object.keys(s);
313
- if (r.length !== n.length)
316
+ const t = Object.keys(e), n = Object.keys(s);
317
+ if (t.length !== n.length)
314
318
  return !1;
315
- for (const u of r) {
316
- const a = e[u];
317
- if (!n.includes(u))
319
+ for (const o of t) {
320
+ const a = e[o];
321
+ if (!n.includes(o))
318
322
  return !1;
319
- if (u !== "ref") {
320
- const y = s[u];
321
- if (oe(a) && oe(y) || E(a) && E(y) || Array.isArray(a) && Array.isArray(y) ? !se(a, y) : a !== y)
323
+ if (o !== "ref") {
324
+ const y = s[o];
325
+ if (ue(a) && ue(y) || E(a) && E(y) || Array.isArray(a) && Array.isArray(y) ? !ie(a, y) : a !== y)
322
326
  return !1;
323
327
  }
324
328
  }
325
329
  return !0;
326
330
  }
327
- var ut = (e) => e.type === "select-multiple", Gt = (e) => Oe(e) || ge(e), Be = (e) => xe(e) && e.isConnected, ot = (e) => {
331
+ var ur = (e) => e.type === "select-multiple", Yr = (e) => Oe(e) || ve(e), Te = (e) => xe(e) && e.isConnected, cr = (e) => {
328
332
  for (const s in e)
329
- if (re(e[s]))
333
+ if (te(e[s]))
330
334
  return !0;
331
335
  return !1;
332
336
  };
333
337
  function Ae(e, s = {}) {
334
- const r = Array.isArray(e);
335
- if (E(e) || r)
338
+ const t = Array.isArray(e);
339
+ if (E(e) || t)
336
340
  for (const n in e)
337
- Array.isArray(e[n]) || E(e[n]) && !ot(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, Ae(e[n], s[n])) : T(e[n]) || (s[n] = !0);
341
+ Array.isArray(e[n]) || E(e[n]) && !cr(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, Ae(e[n], s[n])) : L(e[n]) || (s[n] = !0);
338
342
  return s;
339
343
  }
340
- function ct(e, s, r) {
344
+ function dr(e, s, t) {
341
345
  const n = Array.isArray(e);
342
346
  if (E(e) || n)
343
- for (const u in e)
344
- Array.isArray(e[u]) || E(e[u]) && !ot(e[u]) ? w(s) || Fe(r[u]) ? r[u] = Array.isArray(e[u]) ? Ae(e[u], []) : { ...Ae(e[u]) } : ct(e[u], T(s) ? {} : s[u], r[u]) : r[u] = !se(e[u], s[u]);
345
- return r;
347
+ for (const o in e)
348
+ Array.isArray(e[o]) || E(e[o]) && !cr(e[o]) ? k(s) || Fe(t[o]) ? t[o] = Array.isArray(e[o]) ? Ae(e[o], []) : { ...Ae(e[o]) } : dr(e[o], L(s) ? {} : s[o], t[o]) : t[o] = !ie(e[o], s[o]);
349
+ return t;
346
350
  }
347
- var _e = (e, s) => ct(e, s, Ae(s)), ft = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: n }) => w(e) ? e : s ? e === "" ? NaN : e && +e : r && J(e) ? new Date(e) : n ? n(e) : e;
348
- function Te(e) {
351
+ var _e = (e, s) => dr(e, s, Ae(s)), fr = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: n }) => k(e) ? e : s ? e === "" ? NaN : e && +e : t && Q(e) ? new Date(e) : n ? n(e) : e;
352
+ function Be(e) {
349
353
  const s = e.ref;
350
- if (!(e.refs ? e.refs.every((r) => r.disabled) : s.disabled))
351
- return Me(s) ? s.files : Oe(s) ? nt(e.refs).value : ut(s) ? [...s.selectedOptions].map(({ value: r }) => r) : ge(s) ? at(e.refs).value : ft(w(s.value) ? e.ref.value : s.value, e);
354
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
355
+ return Me(s) ? s.files : Oe(s) ? or(e.refs).value : ur(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ve(s) ? nr(e.refs).value : fr(k(s.value) ? e.ref.value : s.value, e);
352
356
  }
353
- var Jt = (e, s, r, n) => {
354
- const u = {};
357
+ var Zr = (e, s, t, n) => {
358
+ const o = {};
355
359
  for (const a of e) {
356
- const y = d(s, a);
357
- y && V(u, a, y._f);
360
+ const y = f(s, a);
361
+ y && V(o, a, y._f);
358
362
  }
359
363
  return {
360
- criteriaMode: r,
364
+ criteriaMode: t,
361
365
  names: [...e],
362
- fields: u,
366
+ fields: o,
363
367
  shouldUseNativeValidation: n
364
368
  };
365
- }, ye = (e) => w(e) ? e : Ve(e) ? e.source : E(e) ? Ve(e.value) ? e.value.source : e.value : e, Qt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
366
- function st(e, s, r) {
367
- const n = d(e, r);
368
- if (n || Le(r))
369
+ }, he = (e) => k(e) ? e : Ve(e) ? e.source : E(e) ? Ve(e.value) ? e.value.source : e.value : e, et = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
370
+ function ir(e, s, t) {
371
+ const n = f(e, t);
372
+ if (n || Re(t))
369
373
  return {
370
374
  error: n,
371
- name: r
375
+ name: t
372
376
  };
373
- const u = r.split(".");
374
- for (; u.length; ) {
375
- const a = u.join("."), y = d(s, a), g = d(e, a);
376
- if (y && !Array.isArray(y) && r !== a)
377
- return { name: r };
377
+ const o = t.split(".");
378
+ for (; o.length; ) {
379
+ const a = o.join("."), y = f(s, a), g = f(e, a);
380
+ if (y && !Array.isArray(y) && t !== a)
381
+ return { name: t };
378
382
  if (g && g.type)
379
383
  return {
380
384
  name: a,
381
385
  error: g
382
386
  };
383
- u.pop();
387
+ o.pop();
384
388
  }
385
389
  return {
386
- name: r
390
+ name: t
387
391
  };
388
392
  }
389
- var Xt = (e, s, r, n, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? n.isOnBlur : u.isOnBlur) ? !e : (r ? n.isOnChange : u.isOnChange) ? e : !0, Yt = (e, s) => !pe(d(e, s)).length && S(e, s);
390
- const Zt = {
391
- mode: z.onSubmit,
392
- reValidateMode: z.onChange,
393
+ var rt = (e, s, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, tt = (e, s) => !pe(f(e, s)).length && S(e, s);
394
+ const st = {
395
+ mode: G.onSubmit,
396
+ reValidateMode: G.onChange,
393
397
  shouldFocusError: !0
394
398
  };
395
- function er(e = {}) {
399
+ function it(e = {}) {
396
400
  let s = {
397
- ...Zt,
401
+ ...st,
398
402
  ...e
399
- }, r = {
403
+ }, t = {
400
404
  submitCount: 0,
401
405
  isDirty: !1,
402
- isLoading: re(s.defaultValues),
406
+ isLoading: te(s.defaultValues),
403
407
  isValidating: !1,
404
408
  isSubmitted: !1,
405
409
  isSubmitting: !1,
@@ -410,7 +414,7 @@ function er(e = {}) {
410
414
  validatingFields: {},
411
415
  errors: s.errors || {},
412
416
  disabled: s.disabled || !1
413
- }, n = {}, u = E(s.defaultValues) || E(s.values) ? q(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : q(u), y = {
417
+ }, n = {}, o = E(s.defaultValues) || E(s.values) ? z(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : z(o), y = {
414
418
  action: !1,
415
419
  mount: !1,
416
420
  watch: !1
@@ -419,7 +423,7 @@ function er(e = {}) {
419
423
  unMount: /* @__PURE__ */ new Set(),
420
424
  array: /* @__PURE__ */ new Set(),
421
425
  watch: /* @__PURE__ */ new Set()
422
- }, R, I = 0;
426
+ }, U, q = 0;
423
427
  const F = {
424
428
  isDirty: !1,
425
429
  dirtyFields: !1,
@@ -432,355 +436,355 @@ function er(e = {}) {
432
436
  values: Ce(),
433
437
  array: Ce(),
434
438
  state: Ce()
435
- }, ie = Qe(s.mode), $ = Qe(s.reValidateMode), D = s.criteriaMode === z.all, j = (t) => (i) => {
436
- clearTimeout(I), I = setTimeout(t, i);
437
- }, K = async (t) => {
438
- if (F.isValid || t) {
439
- const i = s.resolver ? O((await Q()).errors) : await L(n, !0);
440
- i !== r.isValid && _.state.next({
439
+ }, le = Xe(s.mode), J = Xe(s.reValidateMode), B = s.criteriaMode === G.all, ce = (r) => (i) => {
440
+ clearTimeout(q), q = setTimeout(r, i);
441
+ }, R = async (r) => {
442
+ if (F.isValid || r) {
443
+ const i = s.resolver ? N((await X()).errors) : await M(n, !0);
444
+ i !== t.isValid && _.state.next({
441
445
  isValid: i
442
446
  });
443
447
  }
444
- }, G = (t, i) => {
445
- (F.isValidating || F.validatingFields) && ((t || Array.from(g.mount)).forEach((l) => {
446
- l && (i ? V(r.validatingFields, l, i) : S(r.validatingFields, l));
448
+ }, T = (r, i) => {
449
+ (F.isValidating || F.validatingFields) && ((r || Array.from(g.mount)).forEach((l) => {
450
+ l && (i ? V(t.validatingFields, l, i) : S(t.validatingFields, l));
447
451
  }), _.state.next({
448
- validatingFields: r.validatingFields,
449
- isValidating: !O(r.validatingFields)
452
+ validatingFields: t.validatingFields,
453
+ isValidating: !N(t.validatingFields)
450
454
  }));
451
- }, m = (t, i = [], l, f, c = !0, o = !0) => {
452
- if (f && l) {
453
- if (y.action = !0, o && Array.isArray(d(n, t))) {
454
- const h = l(d(n, t), f.argA, f.argB);
455
- c && V(n, t, h);
455
+ }, m = (r, i = [], l, d, c = !0, u = !0) => {
456
+ if (d && l) {
457
+ if (y.action = !0, u && Array.isArray(f(n, r))) {
458
+ const h = l(f(n, r), d.argA, d.argB);
459
+ c && V(n, r, h);
456
460
  }
457
- if (o && Array.isArray(d(r.errors, t))) {
458
- const h = l(d(r.errors, t), f.argA, f.argB);
459
- c && V(r.errors, t, h), Yt(r.errors, t);
461
+ if (u && Array.isArray(f(t.errors, r))) {
462
+ const h = l(f(t.errors, r), d.argA, d.argB);
463
+ c && V(t.errors, r, h), tt(t.errors, r);
460
464
  }
461
- if (F.touchedFields && o && Array.isArray(d(r.touchedFields, t))) {
462
- const h = l(d(r.touchedFields, t), f.argA, f.argB);
463
- c && V(r.touchedFields, t, h);
465
+ if (F.touchedFields && u && Array.isArray(f(t.touchedFields, r))) {
466
+ const h = l(f(t.touchedFields, r), d.argA, d.argB);
467
+ c && V(t.touchedFields, r, h);
464
468
  }
465
- F.dirtyFields && (r.dirtyFields = _e(u, a)), _.state.next({
466
- name: t,
467
- isDirty: v(t, i),
468
- dirtyFields: r.dirtyFields,
469
- errors: r.errors,
470
- isValid: r.isValid
469
+ F.dirtyFields && (t.dirtyFields = _e(o, a)), _.state.next({
470
+ name: r,
471
+ isDirty: v(r, i),
472
+ dirtyFields: t.dirtyFields,
473
+ errors: t.errors,
474
+ isValid: t.isValid
471
475
  });
472
476
  } else
473
- V(a, t, i);
474
- }, N = (t, i) => {
475
- V(r.errors, t, i), _.state.next({
476
- errors: r.errors
477
+ V(a, r, i);
478
+ }, j = (r, i) => {
479
+ V(t.errors, r, i), _.state.next({
480
+ errors: t.errors
477
481
  });
478
- }, B = (t) => {
479
- r.errors = t, _.state.next({
480
- errors: r.errors,
482
+ }, K = (r) => {
483
+ t.errors = r, _.state.next({
484
+ errors: t.errors,
481
485
  isValid: !1
482
486
  });
483
- }, A = (t, i, l, f) => {
484
- const c = d(n, t);
487
+ }, A = (r, i, l, d) => {
488
+ const c = f(n, r);
485
489
  if (c) {
486
- const o = d(a, t, w(l) ? d(u, t) : l);
487
- w(o) || f && f.defaultChecked || i ? V(a, t, i ? o : Te(c._f)) : C(t, o), y.mount && K();
490
+ const u = f(a, r, k(l) ? f(o, r) : l);
491
+ k(u) || d && d.defaultChecked || i ? V(a, r, i ? u : Be(c._f)) : C(r, u), y.mount && R();
488
492
  }
489
- }, Z = (t, i, l, f, c) => {
490
- let o = !1, h = !1;
493
+ }, W = (r, i, l, d, c) => {
494
+ let u = !1, h = !1;
491
495
  const x = {
492
- name: t
493
- }, k = !!(d(n, t) && d(n, t)._f && d(n, t)._f.disabled);
494
- if (!l || f) {
495
- F.isDirty && (h = r.isDirty, r.isDirty = x.isDirty = v(), o = h !== x.isDirty);
496
- const U = k || se(d(u, t), i);
497
- h = !!(!k && d(r.dirtyFields, t)), U || k ? S(r.dirtyFields, t) : V(r.dirtyFields, t, !0), x.dirtyFields = r.dirtyFields, o = o || F.dirtyFields && h !== !U;
496
+ name: r
497
+ }, w = !!(f(n, r) && f(n, r)._f && f(n, r)._f.disabled);
498
+ if (!l || d) {
499
+ F.isDirty && (h = t.isDirty, t.isDirty = x.isDirty = v(), u = h !== x.isDirty);
500
+ const P = w || ie(f(o, r), i);
501
+ h = !!(!w && f(t.dirtyFields, r)), P || w ? S(t.dirtyFields, r) : V(t.dirtyFields, r, !0), x.dirtyFields = t.dirtyFields, u = u || F.dirtyFields && h !== !P;
498
502
  }
499
503
  if (l) {
500
- const U = d(r.touchedFields, t);
501
- U || (V(r.touchedFields, t, l), x.touchedFields = r.touchedFields, o = o || F.touchedFields && U !== l);
504
+ const P = f(t.touchedFields, r);
505
+ P || (V(t.touchedFields, r, l), x.touchedFields = t.touchedFields, u = u || F.touchedFields && P !== l);
502
506
  }
503
- return o && c && _.state.next(x), o ? x : {};
504
- }, le = (t, i, l, f) => {
505
- const c = d(r.errors, t), o = F.isValid && te(i) && r.isValid !== i;
506
- if (e.delayError && l ? (R = j(() => N(t, l)), R(e.delayError)) : (clearTimeout(I), R = null, l ? V(r.errors, t, l) : S(r.errors, t)), (l ? !se(c, l) : c) || !O(f) || o) {
507
+ return u && c && _.state.next(x), u ? x : {};
508
+ }, se = (r, i, l, d) => {
509
+ const c = f(t.errors, r), u = F.isValid && re(i) && t.isValid !== i;
510
+ if (e.delayError && l ? (U = ce(() => j(r, l)), U(e.delayError)) : (clearTimeout(q), U = null, l ? V(t.errors, r, l) : S(t.errors, r)), (l ? !ie(c, l) : c) || !N(d) || u) {
507
511
  const h = {
508
- ...f,
509
- ...o && te(i) ? { isValid: i } : {},
510
- errors: r.errors,
511
- name: t
512
+ ...d,
513
+ ...u && re(i) ? { isValid: i } : {},
514
+ errors: t.errors,
515
+ name: r
512
516
  };
513
- r = {
514
- ...r,
517
+ t = {
518
+ ...t,
515
519
  ...h
516
520
  }, _.state.next(h);
517
521
  }
518
- }, Q = async (t) => {
519
- G(t, !0);
520
- const i = await s.resolver(a, s.context, Jt(t || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
521
- return G(t), i;
522
- }, ee = async (t) => {
523
- const { errors: i } = await Q(t);
524
- if (t)
525
- for (const l of t) {
526
- const f = d(i, l);
527
- f ? V(r.errors, l, f) : S(r.errors, l);
522
+ }, X = async (r) => {
523
+ T(r, !0);
524
+ const i = await s.resolver(a, s.context, Zr(r || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
525
+ return T(r), i;
526
+ }, Z = async (r) => {
527
+ const { errors: i } = await X(r);
528
+ if (r)
529
+ for (const l of r) {
530
+ const d = f(i, l);
531
+ d ? V(t.errors, l, d) : S(t.errors, l);
528
532
  }
529
533
  else
530
- r.errors = i;
534
+ t.errors = i;
531
535
  return i;
532
- }, L = async (t, i, l = {
536
+ }, M = async (r, i, l = {
533
537
  valid: !0
534
538
  }) => {
535
- for (const f in t) {
536
- const c = t[f];
539
+ for (const d in r) {
540
+ const c = r[d];
537
541
  if (c) {
538
- const { _f: o, ...h } = c;
539
- if (o) {
540
- const x = g.array.has(o.name);
541
- G([f], !0);
542
- const k = await rt(c, a, D, s.shouldUseNativeValidation && !i, x);
543
- if (G([f]), k[o.name] && (l.valid = !1, i))
542
+ const { _f: u, ...h } = c;
543
+ if (u) {
544
+ const x = g.array.has(u.name);
545
+ T([d], !0);
546
+ const w = await sr(c, a, B, s.shouldUseNativeValidation && !i, x);
547
+ if (T([d]), w[u.name] && (l.valid = !1, i))
544
548
  break;
545
- !i && (d(k, o.name) ? x ? zt(r.errors, k, o.name) : V(r.errors, o.name, k[o.name]) : S(r.errors, o.name));
549
+ !i && (f(w, u.name) ? x ? Jr(t.errors, w, u.name) : V(t.errors, u.name, w[u.name]) : S(t.errors, u.name));
546
550
  }
547
- !O(h) && await L(h, i, l);
551
+ !N(h) && await M(h, i, l);
548
552
  }
549
553
  }
550
554
  return l.valid;
551
555
  }, ae = () => {
552
- for (const t of g.unMount) {
553
- const i = d(n, t);
554
- i && (i._f.refs ? i._f.refs.every((l) => !Be(l)) : !Be(i._f.ref)) && we(t);
556
+ for (const r of g.unMount) {
557
+ const i = f(n, r);
558
+ i && (i._f.refs ? i._f.refs.every((l) => !Te(l)) : !Te(i._f.ref)) && ke(r);
555
559
  }
556
560
  g.unMount = /* @__PURE__ */ new Set();
557
- }, v = (t, i) => (t && i && V(a, t, i), !se(Ne(), u)), b = (t, i, l) => jt(t, g, {
558
- ...y.mount ? a : w(i) ? u : J(t) ? { [t]: i } : i
559
- }, l, i), p = (t) => pe(d(y.mount ? a : u, t, e.shouldUnregister ? d(u, t, []) : [])), C = (t, i, l = {}) => {
560
- const f = d(n, t);
561
+ }, v = (r, i) => (r && i && V(a, r, i), !ie(Ne(), o)), b = (r, i, l) => Kr(r, g, {
562
+ ...y.mount ? a : k(i) ? o : Q(r) ? { [r]: i } : i
563
+ }, l, i), p = (r) => pe(f(y.mount ? a : o, r, e.shouldUnregister ? f(o, r, []) : [])), C = (r, i, l = {}) => {
564
+ const d = f(n, r);
561
565
  let c = i;
562
- if (f) {
563
- const o = f._f;
564
- o && (!o.disabled && V(a, t, ft(i, o)), c = xe(o.ref) && T(i) ? "" : i, ut(o.ref) ? [...o.ref.options].forEach((h) => h.selected = c.includes(h.value)) : o.refs ? ge(o.ref) ? o.refs.length > 1 ? o.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(c) ? !!c.find((x) => x === h.value) : c === h.value)) : o.refs[0] && (o.refs[0].checked = !!c) : o.refs.forEach((h) => h.checked = h.value === c) : Me(o.ref) ? o.ref.value = "" : (o.ref.value = c, o.ref.type || _.values.next({
565
- name: t,
566
+ if (d) {
567
+ const u = d._f;
568
+ u && (!u.disabled && V(a, r, fr(i, u)), c = xe(u.ref) && L(i) ? "" : i, ur(u.ref) ? [...u.ref.options].forEach((h) => h.selected = c.includes(h.value)) : u.refs ? ve(u.ref) ? u.refs.length > 1 ? u.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(c) ? !!c.find((x) => x === h.value) : c === h.value)) : u.refs[0] && (u.refs[0].checked = !!c) : u.refs.forEach((h) => h.checked = h.value === c) : Me(u.ref) ? u.ref.value = "" : (u.ref.value = c, u.ref.type || _.values.next({
569
+ name: r,
566
570
  values: { ...a }
567
571
  })));
568
572
  }
569
- (l.shouldDirty || l.shouldTouch) && Z(t, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && de(t);
570
- }, H = (t, i, l) => {
571
- for (const f in i) {
572
- const c = i[f], o = `${t}.${f}`, h = d(n, o);
573
- (g.array.has(t) || !Fe(c) || h && !h._f) && !oe(c) ? H(o, c, l) : C(o, c, l);
573
+ (l.shouldDirty || l.shouldTouch) && W(r, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(r);
574
+ }, I = (r, i, l) => {
575
+ for (const d in i) {
576
+ const c = i[d], u = `${r}.${d}`, h = f(n, u);
577
+ (g.array.has(r) || !Fe(c) || h && !h._f) && !ue(c) ? I(u, c, l) : C(u, c, l);
574
578
  }
575
- }, P = (t, i, l = {}) => {
576
- const f = d(n, t), c = g.array.has(t), o = q(i);
577
- V(a, t, o), c ? (_.array.next({
578
- name: t,
579
+ }, H = (r, i, l = {}) => {
580
+ const d = f(n, r), c = g.array.has(r), u = z(i);
581
+ V(a, r, u), c ? (_.array.next({
582
+ name: r,
579
583
  values: { ...a }
580
584
  }), (F.isDirty || F.dirtyFields) && l.shouldDirty && _.state.next({
581
- name: t,
582
- dirtyFields: _e(u, a),
583
- isDirty: v(t, o)
584
- })) : f && !f._f && !T(o) ? H(t, o, l) : C(t, o, l), Xe(t, g) && _.state.next({ ...r }), _.values.next({
585
- name: y.mount ? t : void 0,
585
+ name: r,
586
+ dirtyFields: _e(o, a),
587
+ isDirty: v(r, u)
588
+ })) : d && !d._f && !L(u) ? I(r, u, l) : C(r, u, l), Ye(r, g) && _.state.next({ ...t }), _.values.next({
589
+ name: y.mount ? r : void 0,
586
590
  values: { ...a }
587
591
  });
588
- }, ce = async (t) => {
592
+ }, de = async (r) => {
589
593
  y.mount = !0;
590
- const i = t.target;
591
- let l = i.name, f = !0;
592
- const c = d(n, l), o = () => i.type ? Te(c._f) : Ot(t), h = (x) => {
593
- f = Number.isNaN(x) || x === d(a, l, x);
594
+ const i = r.target;
595
+ let l = i.name, d = !0;
596
+ const c = f(n, l), u = () => i.type ? Be(c._f) : Pr(r), h = (x) => {
597
+ d = Number.isNaN(x) || x === f(a, l, x);
594
598
  };
595
599
  if (c) {
596
- let x, k;
597
- const U = o(), ne = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, vt = !Qt(c._f) && !s.resolver && !d(r.errors, l) && !c._f.deps || Xt(ne, d(r.touchedFields, l), r.isSubmitted, $, ie), De = Xe(l, g, ne);
598
- V(a, l, U), ne ? (c._f.onBlur && c._f.onBlur(t), R && R(0)) : c._f.onChange && c._f.onChange(t);
599
- const Se = Z(l, U, ne, !1), _t = !O(Se) || De;
600
+ let x, w;
601
+ const P = u(), ne = r.type === Qe.BLUR || r.type === Qe.FOCUS_OUT, _r = !et(c._f) && !s.resolver && !f(t.errors, l) && !c._f.deps || rt(ne, f(t.touchedFields, l), t.isSubmitted, J, le), De = Ye(l, g, ne);
602
+ V(a, l, P), ne ? (c._f.onBlur && c._f.onBlur(r), U && U(0)) : c._f.onChange && c._f.onChange(r);
603
+ const Se = W(l, P, ne, !1), mr = !N(Se) || De;
600
604
  if (!ne && _.values.next({
601
605
  name: l,
602
- type: t.type,
606
+ type: r.type,
603
607
  values: { ...a }
604
- }), vt)
605
- return F.isValid && K(), _t && _.state.next({ name: l, ...De ? {} : Se });
606
- if (!ne && De && _.state.next({ ...r }), s.resolver) {
607
- const { errors: ze } = await Q([l]);
608
- if (h(U), f) {
609
- const mt = st(r.errors, n, l), $e = st(ze, n, mt.name || l);
610
- x = $e.error, l = $e.name, k = O(ze);
608
+ }), _r)
609
+ return F.isValid && R(), mr && _.state.next({ name: l, ...De ? {} : Se });
610
+ if (!ne && De && _.state.next({ ...t }), s.resolver) {
611
+ const { errors: $e } = await X([l]);
612
+ if (h(P), d) {
613
+ const br = ir(t.errors, n, l), je = ir($e, n, br.name || l);
614
+ x = je.error, l = je.name, w = N($e);
611
615
  }
612
616
  } else
613
- G([l], !0), x = (await rt(c, a, D, s.shouldUseNativeValidation))[l], G([l]), h(U), f && (x ? k = !1 : F.isValid && (k = await L(n, !0)));
614
- f && (c._f.deps && de(c._f.deps), le(l, k, x, Se));
617
+ T([l], !0), x = (await sr(c, a, B, s.shouldUseNativeValidation))[l], T([l]), h(P), d && (x ? w = !1 : F.isValid && (w = await M(n, !0)));
618
+ d && (c._f.deps && ye(c._f.deps), se(l, w, x, Se));
615
619
  }
616
- }, fe = (t, i) => {
617
- if (d(r.errors, i) && t.focus)
618
- return t.focus(), 1;
619
- }, de = async (t, i = {}) => {
620
- let l, f;
621
- const c = me(t);
620
+ }, fe = (r, i) => {
621
+ if (f(t.errors, i) && r.focus)
622
+ return r.focus(), 1;
623
+ }, ye = async (r, i = {}) => {
624
+ let l, d;
625
+ const c = me(r);
622
626
  if (s.resolver) {
623
- const o = await ee(w(t) ? t : c);
624
- l = O(o), f = t ? !c.some((h) => d(o, h)) : l;
627
+ const u = await Z(k(r) ? r : c);
628
+ l = N(u), d = r ? !c.some((h) => f(u, h)) : l;
625
629
  } else
626
- t ? (f = (await Promise.all(c.map(async (o) => {
627
- const h = d(n, o);
628
- return await L(h && h._f ? { [o]: h } : h);
629
- }))).every(Boolean), !(!f && !r.isValid) && K()) : f = l = await L(n);
630
+ r ? (d = (await Promise.all(c.map(async (u) => {
631
+ const h = f(n, u);
632
+ return await M(h && h._f ? { [u]: h } : h);
633
+ }))).every(Boolean), !(!d && !t.isValid) && R()) : d = l = await M(n);
630
634
  return _.state.next({
631
- ...!J(t) || F.isValid && l !== r.isValid ? {} : { name: t },
632
- ...s.resolver || !t ? { isValid: l } : {},
633
- errors: r.errors
634
- }), i.shouldFocus && !f && he(n, fe, t ? c : g.mount), f;
635
- }, Ne = (t) => {
635
+ ...!Q(r) || F.isValid && l !== t.isValid ? {} : { name: r },
636
+ ...s.resolver || !r ? { isValid: l } : {},
637
+ errors: t.errors
638
+ }), i.shouldFocus && !d && ge(n, fe, r ? c : g.mount), d;
639
+ }, Ne = (r) => {
636
640
  const i = {
637
- ...y.mount ? a : u
641
+ ...y.mount ? a : o
638
642
  };
639
- return w(t) ? i : J(t) ? d(i, t) : t.map((l) => d(i, l));
640
- }, Ue = (t, i) => ({
641
- invalid: !!d((i || r).errors, t),
642
- isDirty: !!d((i || r).dirtyFields, t),
643
- error: d((i || r).errors, t),
644
- isValidating: !!d(r.validatingFields, t),
645
- isTouched: !!d((i || r).touchedFields, t)
646
- }), dt = (t) => {
647
- t && me(t).forEach((i) => S(r.errors, i)), _.state.next({
648
- errors: t ? r.errors : {}
643
+ return k(r) ? i : Q(r) ? f(i, r) : r.map((l) => f(i, l));
644
+ }, Ue = (r, i) => ({
645
+ invalid: !!f((i || t).errors, r),
646
+ isDirty: !!f((i || t).dirtyFields, r),
647
+ error: f((i || t).errors, r),
648
+ isValidating: !!f(t.validatingFields, r),
649
+ isTouched: !!f((i || t).touchedFields, r)
650
+ }), yr = (r) => {
651
+ r && me(r).forEach((i) => S(t.errors, i)), _.state.next({
652
+ errors: r ? t.errors : {}
649
653
  });
650
- }, Ie = (t, i, l) => {
651
- const f = (d(n, t, { _f: {} })._f || {}).ref, c = d(r.errors, t) || {}, { ref: o, message: h, type: x, ...k } = c;
652
- V(r.errors, t, {
653
- ...k,
654
+ }, Ie = (r, i, l) => {
655
+ const d = (f(n, r, { _f: {} })._f || {}).ref, c = f(t.errors, r) || {}, { ref: u, message: h, type: x, ...w } = c;
656
+ V(t.errors, r, {
657
+ ...w,
654
658
  ...i,
655
- ref: f
659
+ ref: d
656
660
  }), _.state.next({
657
- name: t,
658
- errors: r.errors,
661
+ name: r,
662
+ errors: t.errors,
659
663
  isValid: !1
660
- }), l && l.shouldFocus && f && f.focus && f.focus();
661
- }, yt = (t, i) => re(t) ? _.values.subscribe({
662
- next: (l) => t(b(void 0, i), l)
663
- }) : b(t, i, !0), we = (t, i = {}) => {
664
- for (const l of t ? me(t) : g.mount)
665
- g.mount.delete(l), g.array.delete(l), i.keepValue || (S(n, l), S(a, l)), !i.keepError && S(r.errors, l), !i.keepDirty && S(r.dirtyFields, l), !i.keepTouched && S(r.touchedFields, l), !i.keepIsValidating && S(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && S(u, l);
664
+ }), l && l.shouldFocus && d && d.focus && d.focus();
665
+ }, hr = (r, i) => te(r) ? _.values.subscribe({
666
+ next: (l) => r(b(void 0, i), l)
667
+ }) : b(r, i, !0), ke = (r, i = {}) => {
668
+ for (const l of r ? me(r) : g.mount)
669
+ g.mount.delete(l), g.array.delete(l), i.keepValue || (S(n, l), S(a, l)), !i.keepError && S(t.errors, l), !i.keepDirty && S(t.dirtyFields, l), !i.keepTouched && S(t.touchedFields, l), !i.keepIsValidating && S(t.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && S(o, l);
666
670
  _.values.next({
667
671
  values: { ...a }
668
672
  }), _.state.next({
669
- ...r,
673
+ ...t,
670
674
  ...i.keepDirty ? { isDirty: v() } : {}
671
- }), !i.keepIsValid && K();
672
- }, Pe = ({ disabled: t, name: i, field: l, fields: f, value: c }) => {
673
- if (te(t) && y.mount || t) {
674
- const o = t ? void 0 : w(c) ? Te(l ? l._f : d(f, i)._f) : c;
675
- V(a, i, o), Z(i, o, !1, !1, !0);
675
+ }), !i.keepIsValid && R();
676
+ }, Pe = ({ disabled: r, name: i, field: l, fields: d, value: c }) => {
677
+ if (re(r) && y.mount || r) {
678
+ const u = r ? void 0 : k(c) ? Be(l ? l._f : f(d, i)._f) : c;
679
+ V(a, i, u), W(i, u, !1, !1, !0);
676
680
  }
677
- }, ke = (t, i = {}) => {
678
- let l = d(n, t);
679
- const f = te(i.disabled);
680
- return V(n, t, {
681
+ }, we = (r, i = {}) => {
682
+ let l = f(n, r);
683
+ const d = re(i.disabled);
684
+ return V(n, r, {
681
685
  ...l || {},
682
686
  _f: {
683
- ...l && l._f ? l._f : { ref: { name: t } },
684
- name: t,
687
+ ...l && l._f ? l._f : { ref: { name: r } },
688
+ name: r,
685
689
  mount: !0,
686
690
  ...i
687
691
  }
688
- }), g.mount.add(t), l ? Pe({
692
+ }), g.mount.add(r), l ? Pe({
689
693
  field: l,
690
694
  disabled: i.disabled,
691
- name: t,
695
+ name: r,
692
696
  value: i.value
693
- }) : A(t, !0, i.value), {
694
- ...f ? { disabled: i.disabled } : {},
697
+ }) : A(r, !0, i.value), {
698
+ ...d ? { disabled: i.disabled } : {},
695
699
  ...s.progressive ? {
696
700
  required: !!i.required,
697
- min: ye(i.min),
698
- max: ye(i.max),
699
- minLength: ye(i.minLength),
700
- maxLength: ye(i.maxLength),
701
- pattern: ye(i.pattern)
701
+ min: he(i.min),
702
+ max: he(i.max),
703
+ minLength: he(i.minLength),
704
+ maxLength: he(i.maxLength),
705
+ pattern: he(i.pattern)
702
706
  } : {},
703
- name: t,
704
- onChange: ce,
705
- onBlur: ce,
707
+ name: r,
708
+ onChange: de,
709
+ onBlur: de,
706
710
  ref: (c) => {
707
711
  if (c) {
708
- ke(t, i), l = d(n, t);
709
- const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Gt(o), x = l._f.refs || [];
710
- if (h ? x.find((k) => k === o) : o === l._f.ref)
712
+ we(r, i), l = f(n, r);
713
+ const u = k(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Yr(u), x = l._f.refs || [];
714
+ if (h ? x.find((w) => w === u) : u === l._f.ref)
711
715
  return;
712
- V(n, t, {
716
+ V(n, r, {
713
717
  _f: {
714
718
  ...l._f,
715
719
  ...h ? {
716
720
  refs: [
717
- ...x.filter(Be),
718
- o,
719
- ...Array.isArray(d(u, t)) ? [{}] : []
721
+ ...x.filter(Te),
722
+ u,
723
+ ...Array.isArray(f(o, r)) ? [{}] : []
720
724
  ],
721
- ref: { type: o.type, name: t }
722
- } : { ref: o }
725
+ ref: { type: u.type, name: r }
726
+ } : { ref: u }
723
727
  }
724
- }), A(t, !1, void 0, o);
728
+ }), A(r, !1, void 0, u);
725
729
  } else
726
- l = d(n, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Ut(g.array, t) && y.action) && g.unMount.add(t);
730
+ l = f(n, r, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Wr(g.array, r) && y.action) && g.unMount.add(r);
727
731
  }
728
732
  };
729
- }, qe = () => s.shouldFocusError && he(n, fe, g.mount), ht = (t) => {
730
- te(t) && (_.state.next({ disabled: t }), he(n, (i, l) => {
731
- const f = d(n, l);
732
- f && (i.disabled = f._f.disabled || t, Array.isArray(f._f.refs) && f._f.refs.forEach((c) => {
733
- c.disabled = f._f.disabled || t;
733
+ }, qe = () => s.shouldFocusError && ge(n, fe, g.mount), gr = (r) => {
734
+ re(r) && (_.state.next({ disabled: r }), ge(n, (i, l) => {
735
+ const d = f(n, l);
736
+ d && (i.disabled = d._f.disabled || r, Array.isArray(d._f.refs) && d._f.refs.forEach((c) => {
737
+ c.disabled = d._f.disabled || r;
734
738
  }));
735
739
  }, 0, !1));
736
- }, We = (t, i) => async (l) => {
737
- let f;
740
+ }, We = (r, i) => async (l) => {
741
+ let d;
738
742
  l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
739
- let c = q(a);
743
+ let c = z(a);
740
744
  if (_.state.next({
741
745
  isSubmitting: !0
742
746
  }), s.resolver) {
743
- const { errors: o, values: h } = await Q();
744
- r.errors = o, c = h;
747
+ const { errors: u, values: h } = await X();
748
+ t.errors = u, c = h;
745
749
  } else
746
- await L(n);
747
- if (S(r.errors, "root"), O(r.errors)) {
750
+ await M(n);
751
+ if (S(t.errors, "root"), N(t.errors)) {
748
752
  _.state.next({
749
753
  errors: {}
750
754
  });
751
755
  try {
752
- await t(c, l);
753
- } catch (o) {
754
- f = o;
756
+ await r(c, l);
757
+ } catch (u) {
758
+ d = u;
755
759
  }
756
760
  } else
757
- i && await i({ ...r.errors }, l), qe(), setTimeout(qe);
761
+ i && await i({ ...t.errors }, l), qe(), setTimeout(qe);
758
762
  if (_.state.next({
759
763
  isSubmitted: !0,
760
764
  isSubmitting: !1,
761
- isSubmitSuccessful: O(r.errors) && !f,
762
- submitCount: r.submitCount + 1,
763
- errors: r.errors
764
- }), f)
765
- throw f;
766
- }, gt = (t, i = {}) => {
767
- d(n, t) && (w(i.defaultValue) ? P(t, q(d(u, t))) : (P(t, i.defaultValue), V(u, t, q(i.defaultValue))), i.keepTouched || S(r.touchedFields, t), i.keepDirty || (S(r.dirtyFields, t), r.isDirty = i.defaultValue ? v(t, q(d(u, t))) : v()), i.keepError || (S(r.errors, t), F.isValid && K()), _.state.next({ ...r }));
768
- }, je = (t, i = {}) => {
769
- const l = t ? q(t) : u, f = q(l), c = O(t), o = c ? u : f;
770
- if (i.keepDefaultValues || (u = l), !i.keepValues) {
765
+ isSubmitSuccessful: N(t.errors) && !d,
766
+ submitCount: t.submitCount + 1,
767
+ errors: t.errors
768
+ }), d)
769
+ throw d;
770
+ }, vr = (r, i = {}) => {
771
+ f(n, r) && (k(i.defaultValue) ? H(r, z(f(o, r))) : (H(r, i.defaultValue), V(o, r, z(i.defaultValue))), i.keepTouched || S(t.touchedFields, r), i.keepDirty || (S(t.dirtyFields, r), t.isDirty = i.defaultValue ? v(r, z(f(o, r))) : v()), i.keepError || (S(t.errors, r), F.isValid && R()), _.state.next({ ...t }));
772
+ }, He = (r, i = {}) => {
773
+ const l = r ? z(r) : o, d = z(l), c = N(r), u = c ? o : d;
774
+ if (i.keepDefaultValues || (o = l), !i.keepValues) {
771
775
  if (i.keepDirtyValues)
772
776
  for (const h of g.mount)
773
- d(r.dirtyFields, h) ? V(o, h, d(a, h)) : P(h, d(o, h));
777
+ f(t.dirtyFields, h) ? V(u, h, f(a, h)) : H(h, f(u, h));
774
778
  else {
775
- if (Re && w(t))
779
+ if (Le && k(r))
776
780
  for (const h of g.mount) {
777
- const x = d(n, h);
781
+ const x = f(n, h);
778
782
  if (x && x._f) {
779
- const k = Array.isArray(x._f.refs) ? x._f.refs[0] : x._f.ref;
780
- if (xe(k)) {
781
- const U = k.closest("form");
782
- if (U) {
783
- U.reset();
783
+ const w = Array.isArray(x._f.refs) ? x._f.refs[0] : x._f.ref;
784
+ if (xe(w)) {
785
+ const P = w.closest("form");
786
+ if (P) {
787
+ P.reset();
784
788
  break;
785
789
  }
786
790
  }
@@ -788,10 +792,10 @@ function er(e = {}) {
788
792
  }
789
793
  n = {};
790
794
  }
791
- a = e.shouldUnregister ? i.keepDefaultValues ? q(u) : {} : q(o), _.array.next({
792
- values: { ...o }
795
+ a = e.shouldUnregister ? i.keepDefaultValues ? z(o) : {} : z(u), _.array.next({
796
+ values: { ...u }
793
797
  }), _.values.next({
794
- values: { ...o }
798
+ values: { ...u }
795
799
  });
796
800
  }
797
801
  g = {
@@ -802,47 +806,47 @@ function er(e = {}) {
802
806
  watchAll: !1,
803
807
  focus: ""
804
808
  }, y.mount = !F.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, _.state.next({
805
- submitCount: i.keepSubmitCount ? r.submitCount : 0,
806
- isDirty: c ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !se(t, u)),
807
- isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
808
- dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? _e(u, a) : r.dirtyFields : i.keepDefaultValues && t ? _e(u, t) : i.keepDirty ? r.dirtyFields : {},
809
- touchedFields: i.keepTouched ? r.touchedFields : {},
810
- errors: i.keepErrors ? r.errors : {},
811
- isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
809
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
810
+ isDirty: c ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !ie(r, o)),
811
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
812
+ dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? _e(o, a) : t.dirtyFields : i.keepDefaultValues && r ? _e(o, r) : i.keepDirty ? t.dirtyFields : {},
813
+ touchedFields: i.keepTouched ? t.touchedFields : {},
814
+ errors: i.keepErrors ? t.errors : {},
815
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
812
816
  isSubmitting: !1
813
817
  });
814
- }, He = (t, i) => je(re(t) ? t(a) : t, i);
818
+ }, ze = (r, i) => He(te(r) ? r(a) : r, i);
815
819
  return {
816
820
  control: {
817
- register: ke,
818
- unregister: we,
821
+ register: we,
822
+ unregister: ke,
819
823
  getFieldState: Ue,
820
824
  handleSubmit: We,
821
825
  setError: Ie,
822
- _executeSchema: Q,
826
+ _executeSchema: X,
823
827
  _getWatch: b,
824
828
  _getDirty: v,
825
- _updateValid: K,
829
+ _updateValid: R,
826
830
  _removeUnmounted: ae,
827
831
  _updateFieldArray: m,
828
832
  _updateDisabledField: Pe,
829
833
  _getFieldArray: p,
830
- _reset: je,
831
- _resetDefaultValues: () => re(s.defaultValues) && s.defaultValues().then((t) => {
832
- He(t, s.resetOptions), _.state.next({
834
+ _reset: He,
835
+ _resetDefaultValues: () => te(s.defaultValues) && s.defaultValues().then((r) => {
836
+ ze(r, s.resetOptions), _.state.next({
833
837
  isLoading: !1
834
838
  });
835
839
  }),
836
- _updateFormState: (t) => {
837
- r = {
838
- ...r,
839
- ...t
840
+ _updateFormState: (r) => {
841
+ t = {
842
+ ...t,
843
+ ...r
840
844
  };
841
845
  },
842
- _disableForm: ht,
846
+ _disableForm: gr,
843
847
  _subjects: _,
844
848
  _proxyFormState: F,
845
- _setErrors: B,
849
+ _setErrors: K,
846
850
  get _fields() {
847
851
  return n;
848
852
  },
@@ -852,60 +856,60 @@ function er(e = {}) {
852
856
  get _state() {
853
857
  return y;
854
858
  },
855
- set _state(t) {
856
- y = t;
859
+ set _state(r) {
860
+ y = r;
857
861
  },
858
862
  get _defaultValues() {
859
- return u;
863
+ return o;
860
864
  },
861
865
  get _names() {
862
866
  return g;
863
867
  },
864
- set _names(t) {
865
- g = t;
868
+ set _names(r) {
869
+ g = r;
866
870
  },
867
871
  get _formState() {
868
- return r;
872
+ return t;
869
873
  },
870
- set _formState(t) {
871
- r = t;
874
+ set _formState(r) {
875
+ t = r;
872
876
  },
873
877
  get _options() {
874
878
  return s;
875
879
  },
876
- set _options(t) {
880
+ set _options(r) {
877
881
  s = {
878
882
  ...s,
879
- ...t
883
+ ...r
880
884
  };
881
885
  }
882
886
  },
883
- trigger: de,
884
- register: ke,
887
+ trigger: ye,
888
+ register: we,
885
889
  handleSubmit: We,
886
- watch: yt,
887
- setValue: P,
890
+ watch: hr,
891
+ setValue: H,
888
892
  getValues: Ne,
889
- reset: He,
890
- resetField: gt,
891
- clearErrors: dt,
892
- unregister: we,
893
+ reset: ze,
894
+ resetField: vr,
895
+ clearErrors: yr,
896
+ unregister: ke,
893
897
  setError: Ie,
894
- setFocus: (t, i = {}) => {
895
- const l = d(n, t), f = l && l._f;
896
- if (f) {
897
- const c = f.refs ? f.refs[0] : f.ref;
898
+ setFocus: (r, i = {}) => {
899
+ const l = f(n, r), d = l && l._f;
900
+ if (d) {
901
+ const c = d.refs ? d.refs[0] : d.ref;
898
902
  c.focus && (c.focus(), i.shouldSelect && c.select());
899
903
  }
900
904
  },
901
905
  getFieldState: Ue
902
906
  };
903
907
  }
904
- function tr(e = {}) {
905
- const s = W.useRef(), r = W.useRef(), [n, u] = W.useState({
908
+ function lt(e = {}) {
909
+ const s = $.useRef(), t = $.useRef(), [n, o] = $.useState({
906
910
  isDirty: !1,
907
911
  isValidating: !1,
908
- isLoading: re(e.defaultValues),
912
+ isLoading: te(e.defaultValues),
909
913
  isSubmitted: !1,
910
914
  isSubmitting: !1,
911
915
  isSubmitSuccessful: !1,
@@ -916,102 +920,119 @@ function tr(e = {}) {
916
920
  validatingFields: {},
917
921
  errors: e.errors || {},
918
922
  disabled: e.disabled || !1,
919
- defaultValues: re(e.defaultValues) ? void 0 : e.defaultValues
923
+ defaultValues: te(e.defaultValues) ? void 0 : e.defaultValues
920
924
  });
921
925
  s.current || (s.current = {
922
- ...er(e),
926
+ ...it(e),
923
927
  formState: n
924
928
  });
925
929
  const a = s.current.control;
926
- return a._options = e, Wt({
930
+ return a._options = e, jr({
927
931
  subject: a._subjects.state,
928
932
  next: (y) => {
929
- qt(y, a._proxyFormState, a._updateFormState) && u({ ...a._formState });
933
+ $r(y, a._proxyFormState, a._updateFormState) && o({ ...a._formState });
930
934
  }
931
- }), W.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), W.useEffect(() => {
935
+ }), $.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), $.useEffect(() => {
932
936
  if (a._proxyFormState.isDirty) {
933
937
  const y = a._getDirty();
934
938
  y !== n.isDirty && a._subjects.state.next({
935
939
  isDirty: y
936
940
  });
937
941
  }
938
- }, [a, n.isDirty]), W.useEffect(() => {
939
- e.values && !se(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values, u((y) => ({ ...y }))) : a._resetDefaultValues();
940
- }, [e.values, a]), W.useEffect(() => {
942
+ }, [a, n.isDirty]), $.useEffect(() => {
943
+ e.values && !ie(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, o((y) => ({ ...y }))) : a._resetDefaultValues();
944
+ }, [e.values, a]), $.useEffect(() => {
941
945
  e.errors && a._setErrors(e.errors);
942
- }, [e.errors, a]), W.useEffect(() => {
946
+ }, [e.errors, a]), $.useEffect(() => {
943
947
  a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
944
- }), W.useEffect(() => {
948
+ }), $.useEffect(() => {
945
949
  e.shouldUnregister && a._subjects.values.next({
946
950
  values: a._getWatch()
947
951
  });
948
- }, [e.shouldUnregister, a]), s.current.formState = Pt(n, a), s.current;
952
+ }, [e.shouldUnregister, a]), s.current.formState = zr(n, a), s.current;
949
953
  }
950
- const rr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", mr = ({
954
+ const at = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Ft = ({
951
955
  isFormOpen: e,
952
956
  setIsFormOpen: s,
953
- title: r,
954
- isEmail: n,
955
- isPhone: u,
956
- isTextArea: a,
957
- isRequiredPhone: y = !0,
958
- isRequiredEmail: g = !1,
959
- isRequiredPhoneOrEmail: R,
960
- textAreaPlaceholder: I,
961
- subTitle: F,
962
- submitHandler: _,
963
- modalWidth: ie = "442px",
964
- rowsTextArea: $ = 2,
965
- advCheckBox: D = { text: rr, isRequired: !0 }
957
+ isNews: t,
958
+ title: n,
959
+ isEmail: o,
960
+ isPhone: a,
961
+ isTextArea: y,
962
+ telegramLink: g = "https://t.me/stone_developer",
963
+ isRequiredPhone: U = !0,
964
+ isRequiredEmail: q = !1,
965
+ isRequiredPhoneOrEmail: F,
966
+ textAreaPlaceholder: _,
967
+ subTitle: le,
968
+ submitHandler: J,
969
+ modalWidth: B = "442px",
970
+ rowsTextArea: ce = 2,
971
+ advCheckBox: R = { text: at, isRequired: !0 }
966
972
  }) => {
967
973
  const {
968
- register: j,
969
- handleSubmit: K,
970
- trigger: G,
971
- reset: m,
972
- watch: N,
973
- formState: { errors: B }
974
- } = tr(), A = !!N("email"), { onChange: Z, onBlur: le, ...Q } = j("phone", {
975
- required: y || R ? !A : !0,
976
- pattern: { value: At, message: "" },
977
- onBlur: () => G("phone")
978
- }), { isMobile: ee, currentClientWidth: L } = Dt(), ae = N("personalCheckBox"), v = N("advCheckBox"), b = (p) => {
979
- _(p), m();
974
+ register: T,
975
+ handleSubmit: m,
976
+ trigger: j,
977
+ reset: K,
978
+ watch: A,
979
+ formState: { errors: W }
980
+ } = lt(), se = !!A("email"), { onChange: X, onBlur: Z, ...M } = T("phone", {
981
+ required: U || F ? !se : !0,
982
+ pattern: { value: Ar, message: "" },
983
+ onBlur: () => j("phone")
984
+ }), { isMobile: ae, currentClientWidth: v } = Dr(), b = A("personalCheckBox"), p = A("advCheckBox"), C = (I) => {
985
+ J(I), K();
980
986
  };
981
- return L ? /* @__PURE__ */ M(
982
- xt,
987
+ return v ? /* @__PURE__ */ D(
988
+ Vr,
983
989
  {
984
990
  isOpen: e,
985
991
  emitIsOpen: () => s(!1),
986
- additionalClass: X.modal,
992
+ additionalClass: O.modal,
987
993
  opacity: 0.7,
988
994
  isTransparentBack: !0,
989
- additionalClassModalBody: X.modalBody,
990
- children: /* @__PURE__ */ ve(
995
+ additionalClassModalBody: O.modalBody,
996
+ children: /* @__PURE__ */ ee(
991
997
  "div",
992
998
  {
993
- className: X.root,
994
- style: { width: ee ? "100%" : ie },
999
+ className: O.root,
1000
+ style: { width: ae ? "100%" : B },
995
1001
  children: [
996
- /* @__PURE__ */ M(
1002
+ /* @__PURE__ */ D(
997
1003
  "div",
998
1004
  {
999
- className: X.title,
1000
- dangerouslySetInnerHTML: { __html: r ?? "Оставить обращение" }
1005
+ className: O.title,
1006
+ dangerouslySetInnerHTML: { __html: n ?? "Оставить обращение" }
1001
1007
  }
1002
1008
  ),
1003
- /* @__PURE__ */ M(
1009
+ t && /* @__PURE__ */ ee("div", { className: O.telegramWrapper, children: [
1010
+ /* @__PURE__ */ D(
1011
+ "a",
1012
+ {
1013
+ className: O.telegramLink,
1014
+ href: g,
1015
+ target: "_blank",
1016
+ children: /* @__PURE__ */ ee("div", { className: O.telegram, children: [
1017
+ /* @__PURE__ */ D("div", { children: "Подписаться в Telegram" }),
1018
+ /* @__PURE__ */ D(Ge, { name: "telegram" })
1019
+ ] })
1020
+ }
1021
+ ),
1022
+ /* @__PURE__ */ D("div", { className: O.orText, children: "или" })
1023
+ ] }),
1024
+ !t && /* @__PURE__ */ D(
1004
1025
  "div",
1005
1026
  {
1006
- className: X.description,
1027
+ className: O.description,
1007
1028
  dangerouslySetInnerHTML: {
1008
- __html: F ?? "Оставьте номер телефона для получения консультации"
1029
+ __html: le && !t ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ D("div", { children: "привет" })}`
1009
1030
  }
1010
1031
  }
1011
1032
  ),
1012
- /* @__PURE__ */ ve("form", { onSubmit: K(b), children: [
1013
- /* @__PURE__ */ ve(Vt, { className: X.inputWrapper, children: [
1014
- /* @__PURE__ */ M(
1033
+ /* @__PURE__ */ ee("form", { onSubmit: m(C), children: [
1034
+ /* @__PURE__ */ ee(Fr, { className: O.inputWrapper, children: [
1035
+ /* @__PURE__ */ D(
1015
1036
  Ee,
1016
1037
  {
1017
1038
  width: "full",
@@ -1019,20 +1040,20 @@ const rr = "Я принимаю условия Политики обработк
1019
1040
  variant: "light",
1020
1041
  placeholder: "Введите имя",
1021
1042
  "data-testid": "modal_name",
1022
- ...j("name", { required: !0, pattern: pt }),
1023
- error: !!B.name
1043
+ ...T("name", { required: !0, pattern: pr }),
1044
+ error: !!W.name
1024
1045
  }
1025
1046
  ),
1026
- u && /* @__PURE__ */ M(
1027
- bt,
1047
+ a && /* @__PURE__ */ D(
1048
+ xr,
1028
1049
  {
1029
1050
  inputMode: "numeric",
1030
1051
  name: "phone",
1031
1052
  mask: "+7 (999) 999-99-99",
1032
- onChange: Z,
1053
+ onChange: X,
1033
1054
  placeholder: "+7 (- - -) - - - - - - -",
1034
- onBlur: le,
1035
- children: /* @__PURE__ */ M(
1055
+ onBlur: Z,
1056
+ children: /* @__PURE__ */ D(
1036
1057
  Ee,
1037
1058
  {
1038
1059
  width: "full",
@@ -1040,14 +1061,14 @@ const rr = "Я принимаю условия Политики обработк
1040
1061
  type: "tel",
1041
1062
  size_s: "small",
1042
1063
  variant: "light",
1043
- ...Q,
1044
- ...j("phone"),
1045
- error: !!B.phone
1064
+ ...M,
1065
+ ...T("phone"),
1066
+ error: !!W.phone
1046
1067
  }
1047
1068
  )
1048
1069
  }
1049
1070
  ),
1050
- n && /* @__PURE__ */ M(
1071
+ o && /* @__PURE__ */ D(
1051
1072
  Ee,
1052
1073
  {
1053
1074
  width: "full",
@@ -1055,48 +1076,72 @@ const rr = "Я принимаю условия Политики обработк
1055
1076
  variant: "light",
1056
1077
  placeholder: "Введите email",
1057
1078
  "data-testid": "modal_email",
1058
- ...j("email", {
1059
- required: g || R ? A : !1,
1060
- pattern: wt
1079
+ ...T("email", {
1080
+ required: q || F ? se : !1,
1081
+ pattern: kr
1061
1082
  }),
1062
- error: !!B.email
1083
+ error: !!W.email
1063
1084
  }
1064
1085
  ),
1065
- a && /* @__PURE__ */ M(
1066
- kt,
1086
+ y && /* @__PURE__ */ D(
1087
+ wr,
1067
1088
  {
1068
1089
  "data-testid": "modal_textarea",
1069
- placeholder: I,
1070
- rows: $,
1090
+ placeholder: _,
1091
+ rows: ce,
1071
1092
  width: "full",
1072
- ...j("textarea")
1093
+ ...T("textarea")
1073
1094
  }
1074
1095
  ),
1075
- D && /* @__PURE__ */ M(
1076
- Ge,
1096
+ R && !t && /* @__PURE__ */ D(
1097
+ Je,
1077
1098
  {
1078
1099
  "data-testid": "modal_advCheckBox",
1079
- isChecked: v,
1080
- error: !!B.advCheckBox,
1081
- text: D.text,
1082
- ...j("advCheckBox", { required: D == null ? void 0 : D.isRequired })
1100
+ isChecked: p,
1101
+ error: !!W.advCheckBox,
1102
+ text: R.text,
1103
+ ...T("advCheckBox", { required: R == null ? void 0 : R.isRequired })
1083
1104
  }
1084
1105
  ),
1085
- /* @__PURE__ */ M(
1086
- Ge,
1106
+ /* @__PURE__ */ ee(
1107
+ Je,
1087
1108
  {
1088
1109
  "data-testid": "modal_personalCheckBox",
1089
- isChecked: ae,
1090
- error: !!B.personalCheckBox,
1091
- ...j("personalCheckBox", { required: !0 }),
1092
- children: /* @__PURE__ */ ve("div", { children: [
1093
- принимаю условия ",
1094
- /* @__PURE__ */ M("a", { className: X.linkPolicy, href: "/documents/docs", children: "Политики обработки и защиты персональных данных" }),
1095
- ", даю согласия на обработку персональных данных"
1096
- ] })
1110
+ isChecked: b,
1111
+ error: !!W.personalCheckBox,
1112
+ ...T("personalCheckBox", { required: !t }),
1113
+ children: [
1114
+ t && /* @__PURE__ */ ee("div", { children: [
1115
+ "Согласен(-на)",
1116
+ " ",
1117
+ /* @__PURE__ */ D(
1118
+ "a",
1119
+ {
1120
+ className: O.linkPolicy,
1121
+ href: "/documents/soglasie-na-rassylki",
1122
+ children: "получать новости, информацию по сделке и рекламу"
1123
+ }
1124
+ ),
1125
+ " ",
1126
+ "от Stone"
1127
+ ] }),
1128
+ !t && /* @__PURE__ */ ee("div", { children: [
1129
+ "Я принимаю условия",
1130
+ " ",
1131
+ /* @__PURE__ */ D(
1132
+ "a",
1133
+ {
1134
+ className: O.linkPolicy,
1135
+ href: "/documents/docs",
1136
+ children: "Политики обработки и защиты персональных данных"
1137
+ }
1138
+ ),
1139
+ ", даю согласия на обработку персональных данных"
1140
+ ] })
1141
+ ]
1097
1142
  }
1098
1143
  ),
1099
- /* @__PURE__ */ M(
1144
+ /* @__PURE__ */ D(
1100
1145
  Ke,
1101
1146
  {
1102
1147
  "data-testid": "modal_submit",
@@ -1105,22 +1150,22 @@ const rr = "Я принимаю условия Политики обработк
1105
1150
  type: "submit",
1106
1151
  size: "large",
1107
1152
  as: "button",
1108
- additionalClass: X.modalBtn,
1153
+ additionalClass: O.modalBtn,
1109
1154
  children: "Отправить"
1110
1155
  }
1111
1156
  )
1112
1157
  ] }),
1113
- /* @__PURE__ */ M(
1158
+ /* @__PURE__ */ D(
1114
1159
  Ke,
1115
1160
  {
1116
- additionalClass: X.btn,
1161
+ additionalClass: O.btn,
1117
1162
  onClick: () => s(!1),
1118
1163
  as: "button",
1119
1164
  variant: "gray",
1120
1165
  type: "button",
1121
1166
  size: "small",
1122
- children: /* @__PURE__ */ M(
1123
- Ft,
1167
+ children: /* @__PURE__ */ D(
1168
+ Ge,
1124
1169
  {
1125
1170
  name: "close",
1126
1171
  size: "16",
@@ -1137,5 +1182,5 @@ const rr = "Я принимаю условия Политики обработк
1137
1182
  ) : null;
1138
1183
  };
1139
1184
  export {
1140
- mr as ModalForm
1185
+ Ft as ModalForm
1141
1186
  };