stone-kit 0.0.1029 → 0.0.1031
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/App.js +4 -4
- package/dist/Menu-CdJTzN7T.js +494 -0
- package/dist/{Option-CtwUzW8a.js → Option-rFBMQAPk.js} +1 -1
- package/dist/Router.js +1 -1
- package/dist/components/Button/ui/Button.js +1 -1
- package/dist/components/CheckBoxNew/CheckBoxNew.js +1 -1
- package/dist/components/CheckboxSelect/ui/CheckboxSelect.js +1 -1
- package/dist/components/CommercialLotCard/CommercialLotCard.js +1 -1
- package/dist/components/CommercialLotCard/components/Price/Price.js +11 -11
- package/dist/components/CommercialLotCard/components/Snippets/Snippets.js +1 -1
- package/dist/components/DestinationTab/ui/DestinationTab.js +1 -1
- package/dist/components/FilterWithSave/hooks/useFilterWithSave.d.ts +1 -1
- package/dist/components/FilterWithSave/ui/FilterWithSave.js +7 -2
- package/dist/components/Flex/ui/Flex.js +1 -1
- package/dist/components/FormModal/ui/ModalForm.js +641 -656
- package/dist/components/GroupedInput/ui/GroupedInputs.js +1 -1
- package/dist/components/Input/ui/Input.js +22 -1
- package/dist/components/Logo/ui/Logo.js +1 -1
- package/dist/components/LotCard/hooks/useLotCard.js +2 -2
- package/dist/components/LotCard/ui/LotCard.js +2 -2
- package/dist/components/LotCardSkeleton/ui/LotCardSkeleton.js +1 -1
- package/dist/components/MetroLabel/ui/MetroLabel.js +1 -1
- package/dist/components/MetroTag/ui/MetroTag.js +1 -1
- package/dist/components/NewIcon/ui/NewIcon.js +1 -1
- package/dist/components/RoundButton/ui/RoundButton.js +1 -1
- package/dist/components/Select/ui/Category.js +2 -2
- package/dist/components/Select/ui/Option.js +2 -2
- package/dist/components/Select/ui/Select.js +2 -2
- package/dist/components/SliderNavigation/ui/SliderNavigation.js +1 -1
- package/dist/components/SortSelect/hooks/useSortSelect.js +2 -2
- package/dist/components/SortSelect/ui/SortSelect.js +2 -2
- package/dist/components/Switcher/ui/Switcher.js +1 -1
- package/dist/components/TabSelect/ui/TabSelect.js +1 -1
- package/dist/components/TabSwitcher/ui/TabSwitcher.js +1 -1
- package/dist/components/Tag/ui/Tag.js +1 -1
- package/dist/components/Text/ui/Text.js +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/mobileButton/ui/MobileButton.js +1 -1
- package/dist/{index-BJwl9stn.js → index-3E04UaC2.js} +784 -785
- package/dist/{index-YnD2EP-S.js → index-B2JRaoNz.js} +5 -0
- package/dist/index-CBdtKu-u.js +891 -0
- package/dist/layout/components/Header/Header.js +1 -1
- package/dist/layout/components/Menu.js +4 -107
- package/dist/stone-kit.css +1 -1
- package/dist/stories/entities/CommercialLotCard/CommercialLotCard.stories.js +1 -1
- package/dist/stories/shared/ui/Button/Button.stories.js +1 -1
- package/dist/stories/shared/ui/CheckBox/CheckBox.stories.js +1 -1
- package/dist/stories/shared/ui/CheckBox/CheckBoxNew.stories.js +1 -1
- package/dist/stories/shared/ui/CheckboxSelect/CheckboxSelect.stories.js +1 -1
- package/dist/stories/shared/ui/DestinationTab/DestinationTab.stories.js +1 -1
- package/dist/stories/shared/ui/FieldInput/FieldInput.stories.js +1 -1
- package/dist/stories/shared/ui/FilterWithSave/FilterWithSave.stories.js +1 -1
- package/dist/stories/shared/ui/FormModal/FormModal.stories.js +1 -1
- package/dist/stories/shared/ui/GroupedInput/GroupedInput.stories.js +1 -1
- package/dist/stories/shared/ui/Logo/Logo.stories.js +1 -1
- package/dist/stories/shared/ui/MobileButton/MobileButton.stories.js +1 -1
- package/dist/stories/shared/ui/Modal/Modal.stories.js +1 -1
- package/dist/stories/shared/ui/ModalSuccess/ModalSuccess.stories.js +1 -1
- package/dist/stories/shared/ui/RoundButton/RoundButton.stories.js +1 -1
- package/dist/stories/shared/ui/Select/Select.stories.js +1 -1
- package/dist/stories/shared/ui/SliderNavigation/SliderNavigation.stories.js +1 -1
- package/dist/stories/shared/ui/SortSelect/SortSelect.stories.js +1 -1
- package/dist/stories/shared/ui/SummarySelect/SummarySelect.stories.js +1 -1
- package/dist/stories/shared/ui/Switcher/Switcher.stories.js +1 -1
- package/dist/stories/shared/ui/TabSelect/TabSelect.stories.js +1 -1
- package/dist/stories/shared/ui/TabSwitcher/TabSwitcher.stories.js +1 -1
- package/dist/stories/shared/ui/ZoomControls/ZoomControls.stories.js +1 -1
- package/dist/{useLotCard-CYcRSogE.js → useLotCard-DG9doKCX.js} +1 -1
- package/dist/useSortSelect-B8HOGdOt.js +79 -0
- package/package.json +1 -1
- package/dist/chunk-4WY6JWTD-BeveLKf_.js +0 -1582
- package/dist/useSortSelect-Cy3od4ig.js +0 -80
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { nameReg as
|
|
1
|
+
import { jsx as R, jsxs as ce } from "react/jsx-runtime";
|
|
2
|
+
import b, { useEffect as Ze } from "react";
|
|
3
|
+
import { nameReg as Lt, phoneReg as Mt, emailReg as Rt } from "../utils/reg.js";
|
|
4
4
|
import { TextArea as Ot } from "../../TextArea/TextArea.js";
|
|
5
|
-
import { c as Nt } from "../../../index-
|
|
5
|
+
import { c as Nt } from "../../../index-B2JRaoNz.js";
|
|
6
6
|
import { useClientWidth as Ut } from "../../../shared/useClientWidth.js";
|
|
7
7
|
import { Modal as Pt } from "../../Modal/ui/Modal.js";
|
|
8
|
-
import { NewIcon as
|
|
8
|
+
import { NewIcon as et } from "../../NewIcon/ui/NewIcon.js";
|
|
9
9
|
import { Flex as It } from "../../Flex/ui/Flex.js";
|
|
10
|
-
import { Input as
|
|
11
|
-
import { CheckBox as
|
|
12
|
-
import { Button as
|
|
10
|
+
import { Input as Re } from "../../Input/ui/Input.js";
|
|
11
|
+
import { CheckBox as tt } from "../../CheckBox/CheckBox.js";
|
|
12
|
+
import { Button as rt } from "../../Button/ui/Button.js";
|
|
13
13
|
const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt = "_root_ky28a_21", $t = "_title_ky28a_34", Kt = "_description_ky28a_41", jt = "_inputWrapper_ky28a_48", Gt = "_linkPolicy_ky28a_55", Yt = "_telegramLink_ky28a_60", Jt = "_telegramWrapper_ky28a_65", Qt = "_telegram_ky28a_60", Xt = "_orText_ky28a_88", Zt = "_checkboxText_ky28a_116", I = {
|
|
14
14
|
btn: Wt,
|
|
15
15
|
modal: qt,
|
|
@@ -25,18 +25,18 @@ const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt
|
|
|
25
25
|
orText: Xt,
|
|
26
26
|
checkboxText: Zt
|
|
27
27
|
};
|
|
28
|
-
var
|
|
29
|
-
const
|
|
30
|
-
var
|
|
28
|
+
var ke = (e) => e.type === "checkbox", fe = (e) => e instanceof Date, K = (e) => e == null;
|
|
29
|
+
const ht = (e) => typeof e == "object";
|
|
30
|
+
var N = (e) => !K(e) && !Array.isArray(e) && ht(e) && !fe(e), mt = (e) => N(e) && e.target ? ke(e.target) ? e.target.checked : e.target.value : e, er = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, _t = (e, s) => e.has(er(s)), tr = (e) => {
|
|
31
31
|
const s = e.constructor && e.constructor.prototype;
|
|
32
|
-
return
|
|
33
|
-
},
|
|
32
|
+
return N(s) && s.hasOwnProperty("isPrototypeOf");
|
|
33
|
+
}, Pe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
34
34
|
function P(e) {
|
|
35
35
|
let s;
|
|
36
|
-
const t = Array.isArray(e),
|
|
36
|
+
const t = Array.isArray(e), a = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
37
37
|
if (e instanceof Date)
|
|
38
38
|
s = new Date(e);
|
|
39
|
-
else if (!(
|
|
39
|
+
else if (!(Pe && (e instanceof Blob || a)) && (t || N(e)))
|
|
40
40
|
if (s = t ? [] : Object.create(Object.getPrototypeOf(e)), !t && !tr(e))
|
|
41
41
|
s = e;
|
|
42
42
|
else
|
|
@@ -46,37 +46,37 @@ function P(e) {
|
|
|
46
46
|
return e;
|
|
47
47
|
return s;
|
|
48
48
|
}
|
|
49
|
-
var De = (e) => /^\w*$/.test(e), L = (e) => e === void 0,
|
|
50
|
-
if (!s || !
|
|
49
|
+
var De = (e) => /^\w*$/.test(e), L = (e) => e === void 0, Ie = (e) => Array.isArray(e) ? e.filter(Boolean) : [], We = (e) => Ie(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
|
|
50
|
+
if (!s || !N(e))
|
|
51
51
|
return t;
|
|
52
|
-
const
|
|
53
|
-
return L(
|
|
54
|
-
}, J = (e) => typeof e == "boolean",
|
|
55
|
-
let
|
|
56
|
-
const o = De(s) ? [s] :
|
|
57
|
-
for (; ++
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
|
|
52
|
+
const a = (De(s) ? [s] : We(s)).reduce((o, l) => K(o) ? o : o[l], e);
|
|
53
|
+
return L(a) || a === e ? L(e[s]) ? t : e[s] : a;
|
|
54
|
+
}, J = (e) => typeof e == "boolean", B = (e, s, t) => {
|
|
55
|
+
let a = -1;
|
|
56
|
+
const o = De(s) ? [s] : We(s), l = o.length, d = l - 1;
|
|
57
|
+
for (; ++a < l; ) {
|
|
58
|
+
const c = o[a];
|
|
59
|
+
let S = t;
|
|
60
|
+
if (a !== d) {
|
|
61
|
+
const D = e[c];
|
|
62
|
+
S = N(D) || Array.isArray(D) ? D : isNaN(+o[a + 1]) ? {} : [];
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (c === "__proto__" || c === "constructor" || c === "prototype")
|
|
65
65
|
return;
|
|
66
|
-
e[
|
|
66
|
+
e[c] = S, e = e[c];
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
const we = {
|
|
70
70
|
BLUR: "blur",
|
|
71
71
|
FOCUS_OUT: "focusout",
|
|
72
72
|
CHANGE: "change"
|
|
73
|
-
},
|
|
73
|
+
}, se = {
|
|
74
74
|
onBlur: "onBlur",
|
|
75
75
|
onChange: "onChange",
|
|
76
76
|
onSubmit: "onSubmit",
|
|
77
77
|
onTouched: "onTouched",
|
|
78
78
|
all: "all"
|
|
79
|
-
},
|
|
79
|
+
}, ae = {
|
|
80
80
|
max: "max",
|
|
81
81
|
min: "min",
|
|
82
82
|
maxLength: "maxLength",
|
|
@@ -84,25 +84,25 @@ const we = {
|
|
|
84
84
|
pattern: "pattern",
|
|
85
85
|
required: "required",
|
|
86
86
|
validate: "validate"
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
var
|
|
87
|
+
}, gt = b.createContext(null);
|
|
88
|
+
gt.displayName = "HookFormContext";
|
|
89
|
+
const qe = () => b.useContext(gt);
|
|
90
|
+
var vt = (e, s, t, a = !0) => {
|
|
91
91
|
const o = {
|
|
92
92
|
defaultValues: s._defaultValues
|
|
93
93
|
};
|
|
94
94
|
for (const l in e)
|
|
95
95
|
Object.defineProperty(o, l, {
|
|
96
96
|
get: () => {
|
|
97
|
-
const
|
|
98
|
-
return s._proxyFormState[
|
|
97
|
+
const d = l;
|
|
98
|
+
return s._proxyFormState[d] !== se.all && (s._proxyFormState[d] = !a || se.all), t && (t[d] = !0), e[d];
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
return o;
|
|
102
102
|
};
|
|
103
|
-
const
|
|
103
|
+
const He = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
|
|
104
104
|
function rr(e) {
|
|
105
|
-
const s =
|
|
105
|
+
const s = qe(), { control: t = s.control, disabled: a, name: o, exact: l } = e || {}, [d, c] = b.useState(t._formState), S = b.useRef({
|
|
106
106
|
isDirty: !1,
|
|
107
107
|
isLoading: !1,
|
|
108
108
|
dirtyFields: !1,
|
|
@@ -112,182 +112,167 @@ function rr(e) {
|
|
|
112
112
|
isValid: !1,
|
|
113
113
|
errors: !1
|
|
114
114
|
});
|
|
115
|
-
return
|
|
115
|
+
return He(() => t._subscribe({
|
|
116
116
|
name: o,
|
|
117
|
-
formState:
|
|
117
|
+
formState: S.current,
|
|
118
118
|
exact: l,
|
|
119
|
-
callback: (
|
|
120
|
-
!
|
|
119
|
+
callback: (D) => {
|
|
120
|
+
!a && c({
|
|
121
121
|
...t._formState,
|
|
122
|
-
...
|
|
122
|
+
...D
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
}), [o,
|
|
126
|
-
|
|
127
|
-
}, [t]),
|
|
125
|
+
}), [o, a, l]), b.useEffect(() => {
|
|
126
|
+
S.current.isValid && t._setValid(!0);
|
|
127
|
+
}, [t]), b.useMemo(() => vt(d, t, S.current, !1), [d, t]);
|
|
128
128
|
}
|
|
129
|
-
var Q = (e) => typeof e == "string",
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
129
|
+
var Q = (e) => typeof e == "string", bt = (e, s, t, a, o) => Q(e) ? (a && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((l) => (a && s.watch.add(l), y(t, l))) : (a && (s.watchAll = !0), t), Ne = (e) => K(e) || !ht(e);
|
|
130
|
+
function le(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
131
|
+
if (Ne(e) || Ne(s))
|
|
132
132
|
return e === s;
|
|
133
133
|
if (fe(e) && fe(s))
|
|
134
134
|
return e.getTime() === s.getTime();
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
135
|
+
const a = Object.keys(e), o = Object.keys(s);
|
|
136
|
+
if (a.length !== o.length)
|
|
137
137
|
return !1;
|
|
138
138
|
if (t.has(e) || t.has(s))
|
|
139
139
|
return !0;
|
|
140
140
|
t.add(e), t.add(s);
|
|
141
|
-
for (const l of
|
|
142
|
-
const
|
|
141
|
+
for (const l of a) {
|
|
142
|
+
const d = e[l];
|
|
143
143
|
if (!o.includes(l))
|
|
144
144
|
return !1;
|
|
145
145
|
if (l !== "ref") {
|
|
146
|
-
const
|
|
147
|
-
if (fe(
|
|
146
|
+
const c = s[l];
|
|
147
|
+
if (fe(d) && fe(c) || N(d) && N(c) || Array.isArray(d) && Array.isArray(c) ? !le(d, c, t) : d !== c)
|
|
148
148
|
return !1;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return !0;
|
|
152
152
|
}
|
|
153
153
|
function sr(e) {
|
|
154
|
-
const s =
|
|
155
|
-
|
|
156
|
-
const [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}), E = v.useCallback((F) => {
|
|
160
|
-
const V = Ne(i, t._names, F || t._formValues, !1, D.current);
|
|
161
|
-
return C.current ? C.current(V) : V;
|
|
162
|
-
}, [t._formValues, t._names, i]), M = v.useCallback((F) => {
|
|
163
|
-
if (!l) {
|
|
164
|
-
const V = Ne(i, t._names, F || t._formValues, !1, D.current);
|
|
165
|
-
if (C.current) {
|
|
166
|
-
const H = C.current(V);
|
|
167
|
-
ae(H, g.current) || (q(H), g.current = H);
|
|
168
|
-
} else
|
|
169
|
-
q(V);
|
|
170
|
-
}
|
|
171
|
-
}, [t._formValues, t._names, l, i]);
|
|
172
|
-
ze(() => ((x.current !== t || !ae(_.current, i)) && (x.current = t, _.current = i, M()), t._subscribe({
|
|
173
|
-
name: i,
|
|
154
|
+
const s = qe(), { control: t = s.control, name: a, defaultValue: o, disabled: l, exact: d, compute: c } = e || {}, S = b.useRef(o), D = b.useRef(c), _ = b.useRef(void 0);
|
|
155
|
+
D.current = c;
|
|
156
|
+
const x = b.useMemo(() => t._getWatch(a, S.current), [t, a]), [g, j] = b.useState(D.current ? D.current(x) : x);
|
|
157
|
+
return He(() => t._subscribe({
|
|
158
|
+
name: a,
|
|
174
159
|
formState: {
|
|
175
160
|
values: !0
|
|
176
161
|
},
|
|
177
|
-
exact:
|
|
178
|
-
callback: (
|
|
179
|
-
|
|
162
|
+
exact: d,
|
|
163
|
+
callback: (q) => {
|
|
164
|
+
if (!l) {
|
|
165
|
+
const p = bt(a, t._names, q.values || t._formValues, !1, S.current);
|
|
166
|
+
if (D.current) {
|
|
167
|
+
const M = D.current(p);
|
|
168
|
+
le(M, _.current) || (j(M), _.current = M);
|
|
169
|
+
} else
|
|
170
|
+
j(p);
|
|
171
|
+
}
|
|
180
172
|
}
|
|
181
|
-
})
|
|
182
|
-
const Z = x.current !== t, b = _.current, S = v.useMemo(() => {
|
|
183
|
-
if (l)
|
|
184
|
-
return null;
|
|
185
|
-
const F = !Z && !ae(b, i);
|
|
186
|
-
return Z || F ? E() : null;
|
|
187
|
-
}, [l, Z, i, b, E]);
|
|
188
|
-
return S !== null ? S : X;
|
|
173
|
+
}), [t, l, a, d]), b.useEffect(() => t._removeUnmounted()), g;
|
|
189
174
|
}
|
|
190
175
|
function ir(e) {
|
|
191
|
-
const s =
|
|
176
|
+
const s = qe(), { name: t, disabled: a, control: o = s.control, shouldUnregister: l, defaultValue: d } = e, c = _t(o._names.array, t), S = b.useMemo(() => y(o._formValues, t, y(o._defaultValues, t, d)), [o, t, d]), D = sr({
|
|
192
177
|
control: o,
|
|
193
178
|
name: t,
|
|
194
|
-
defaultValue:
|
|
179
|
+
defaultValue: S,
|
|
195
180
|
exact: !0
|
|
196
|
-
}),
|
|
181
|
+
}), _ = rr({
|
|
197
182
|
control: o,
|
|
198
183
|
name: t,
|
|
199
184
|
exact: !0
|
|
200
|
-
}), x =
|
|
185
|
+
}), x = b.useRef(e), g = b.useRef(void 0), j = b.useRef(o.register(t, {
|
|
201
186
|
...e.rules,
|
|
202
|
-
value:
|
|
187
|
+
value: D,
|
|
203
188
|
...J(e.disabled) ? { disabled: e.disabled } : {}
|
|
204
189
|
}));
|
|
205
190
|
x.current = e;
|
|
206
|
-
const q =
|
|
191
|
+
const q = b.useMemo(() => Object.defineProperties({}, {
|
|
207
192
|
invalid: {
|
|
208
193
|
enumerable: !0,
|
|
209
|
-
get: () => !!y(
|
|
194
|
+
get: () => !!y(_.errors, t)
|
|
210
195
|
},
|
|
211
196
|
isDirty: {
|
|
212
197
|
enumerable: !0,
|
|
213
|
-
get: () => !!y(
|
|
198
|
+
get: () => !!y(_.dirtyFields, t)
|
|
214
199
|
},
|
|
215
200
|
isTouched: {
|
|
216
201
|
enumerable: !0,
|
|
217
|
-
get: () => !!y(
|
|
202
|
+
get: () => !!y(_.touchedFields, t)
|
|
218
203
|
},
|
|
219
204
|
isValidating: {
|
|
220
205
|
enumerable: !0,
|
|
221
|
-
get: () => !!y(
|
|
206
|
+
get: () => !!y(_.validatingFields, t)
|
|
222
207
|
},
|
|
223
208
|
error: {
|
|
224
209
|
enumerable: !0,
|
|
225
|
-
get: () => y(
|
|
210
|
+
get: () => y(_.errors, t)
|
|
226
211
|
}
|
|
227
|
-
}), [
|
|
212
|
+
}), [_, t]), p = b.useCallback((T) => j.current.onChange({
|
|
228
213
|
target: {
|
|
229
|
-
value:
|
|
214
|
+
value: mt(T),
|
|
230
215
|
name: t
|
|
231
216
|
},
|
|
232
217
|
type: we.CHANGE
|
|
233
|
-
}), [t]), M =
|
|
218
|
+
}), [t]), M = b.useCallback(() => j.current.onBlur({
|
|
234
219
|
target: {
|
|
235
220
|
value: y(o._formValues, t),
|
|
236
221
|
name: t
|
|
237
222
|
},
|
|
238
223
|
type: we.BLUR
|
|
239
|
-
}), [t, o._formValues]),
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
focus: () =>
|
|
243
|
-
select: () =>
|
|
244
|
-
setCustomValidity: (
|
|
245
|
-
reportValidity: () =>
|
|
224
|
+
}), [t, o._formValues]), ne = b.useCallback((T) => {
|
|
225
|
+
const U = y(o._fields, t);
|
|
226
|
+
U && T && (U._f.ref = {
|
|
227
|
+
focus: () => T.focus && T.focus(),
|
|
228
|
+
select: () => T.select && T.select(),
|
|
229
|
+
setCustomValidity: (w) => T.setCustomValidity(w),
|
|
230
|
+
reportValidity: () => T.reportValidity()
|
|
246
231
|
});
|
|
247
|
-
}, [o._fields, t]),
|
|
232
|
+
}, [o._fields, t]), v = b.useMemo(() => ({
|
|
248
233
|
name: t,
|
|
249
|
-
value:
|
|
250
|
-
...J(
|
|
251
|
-
onChange:
|
|
234
|
+
value: D,
|
|
235
|
+
...J(a) || _.disabled ? { disabled: _.disabled || a } : {},
|
|
236
|
+
onChange: p,
|
|
252
237
|
onBlur: M,
|
|
253
|
-
ref:
|
|
254
|
-
}), [t,
|
|
255
|
-
return
|
|
256
|
-
const
|
|
257
|
-
|
|
238
|
+
ref: ne
|
|
239
|
+
}), [t, a, _.disabled, p, M, ne, D]);
|
|
240
|
+
return b.useEffect(() => {
|
|
241
|
+
const T = o._options.shouldUnregister || l, U = g.current;
|
|
242
|
+
U && U !== t && !c && o.unregister(U), o.register(t, {
|
|
258
243
|
...x.current.rules,
|
|
259
244
|
...J(x.current.disabled) ? { disabled: x.current.disabled } : {}
|
|
260
245
|
});
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
|
|
246
|
+
const w = (X, H) => {
|
|
247
|
+
const re = y(o._fields, X);
|
|
248
|
+
re && re._f && (re._f.mount = H);
|
|
264
249
|
};
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
|
|
250
|
+
if (w(t, !0), T) {
|
|
251
|
+
const X = P(y(o._options.defaultValues, t, x.current.defaultValue));
|
|
252
|
+
B(o._defaultValues, t, X), L(y(o._formValues, t)) && B(o._formValues, t, X);
|
|
268
253
|
}
|
|
269
|
-
return !
|
|
270
|
-
(
|
|
254
|
+
return !c && o.register(t), g.current = t, () => {
|
|
255
|
+
(c ? T && !o._state.action : T) ? o.unregister(t) : w(t, !1);
|
|
271
256
|
};
|
|
272
|
-
}, [t, o,
|
|
257
|
+
}, [t, o, c, l]), b.useEffect(() => {
|
|
273
258
|
o._setDisabledField({
|
|
274
|
-
disabled:
|
|
259
|
+
disabled: a,
|
|
275
260
|
name: t
|
|
276
261
|
});
|
|
277
|
-
}, [
|
|
278
|
-
field:
|
|
279
|
-
formState:
|
|
262
|
+
}, [a, t, o]), b.useMemo(() => ({
|
|
263
|
+
field: v,
|
|
264
|
+
formState: _,
|
|
280
265
|
fieldState: q
|
|
281
|
-
}), [
|
|
266
|
+
}), [v, _, q]);
|
|
282
267
|
}
|
|
283
268
|
const ar = (e) => e.render(ir(e));
|
|
284
|
-
var lr = (e, s, t,
|
|
269
|
+
var lr = (e, s, t, a, o) => s ? {
|
|
285
270
|
...t[e],
|
|
286
271
|
types: {
|
|
287
272
|
...t[e] && t[e].types ? t[e].types : {},
|
|
288
|
-
[
|
|
273
|
+
[a]: o || !0
|
|
289
274
|
}
|
|
290
|
-
} : {}, Ve = (e) => Array.isArray(e) ? e : [e],
|
|
275
|
+
} : {}, Ve = (e) => Array.isArray(e) ? e : [e], st = () => {
|
|
291
276
|
let e = [];
|
|
292
277
|
return {
|
|
293
278
|
get observers() {
|
|
@@ -309,27 +294,27 @@ var lr = (e, s, t, i, o) => s ? {
|
|
|
309
294
|
};
|
|
310
295
|
function Vt(e, s) {
|
|
311
296
|
const t = {};
|
|
312
|
-
for (const
|
|
313
|
-
if (e.hasOwnProperty(
|
|
314
|
-
const o = e[
|
|
315
|
-
if (o &&
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
} else e[
|
|
297
|
+
for (const a in e)
|
|
298
|
+
if (e.hasOwnProperty(a)) {
|
|
299
|
+
const o = e[a], l = s[a];
|
|
300
|
+
if (o && N(o) && l) {
|
|
301
|
+
const d = Vt(o, l);
|
|
302
|
+
N(d) && (t[a] = d);
|
|
303
|
+
} else e[a] && (t[a] = l);
|
|
319
304
|
}
|
|
320
305
|
return t;
|
|
321
306
|
}
|
|
322
|
-
var
|
|
323
|
-
if (!
|
|
307
|
+
var $ = (e) => N(e) && !Object.keys(e).length, ze = (e) => e.type === "file", ie = (e) => typeof e == "function", Ce = (e) => {
|
|
308
|
+
if (!Pe)
|
|
324
309
|
return !1;
|
|
325
310
|
const s = e ? e.ownerDocument : 0;
|
|
326
311
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
327
|
-
},
|
|
312
|
+
}, xt = (e) => e.type === "select-multiple", $e = (e) => e.type === "radio", nr = (e) => $e(e) || ke(e), Oe = (e) => Ce(e) && e.isConnected;
|
|
328
313
|
function or(e, s) {
|
|
329
314
|
const t = s.slice(0, -1).length;
|
|
330
|
-
let
|
|
331
|
-
for (;
|
|
332
|
-
e = L(e) ?
|
|
315
|
+
let a = 0;
|
|
316
|
+
for (; a < t; )
|
|
317
|
+
e = L(e) ? a++ : e[s[a++]];
|
|
333
318
|
return e;
|
|
334
319
|
}
|
|
335
320
|
function ur(e) {
|
|
@@ -338,34 +323,34 @@ function ur(e) {
|
|
|
338
323
|
return !1;
|
|
339
324
|
return !0;
|
|
340
325
|
}
|
|
341
|
-
function
|
|
342
|
-
const t = Array.isArray(s) ? s : De(s) ? [s] :
|
|
343
|
-
return
|
|
326
|
+
function O(e, s) {
|
|
327
|
+
const t = Array.isArray(s) ? s : De(s) ? [s] : We(s), a = t.length === 1 ? e : or(e, t), o = t.length - 1, l = t[o];
|
|
328
|
+
return a && delete a[l], o !== 0 && (N(a) && $(a) || Array.isArray(a) && ur(a)) && O(e, t.slice(0, -1)), e;
|
|
344
329
|
}
|
|
345
|
-
var
|
|
330
|
+
var dr = (e) => {
|
|
346
331
|
for (const s in e)
|
|
347
|
-
if (
|
|
332
|
+
if (ie(e[s]))
|
|
348
333
|
return !0;
|
|
349
334
|
return !1;
|
|
350
335
|
};
|
|
351
|
-
function
|
|
352
|
-
return Array.isArray(e) ||
|
|
336
|
+
function kt(e) {
|
|
337
|
+
return Array.isArray(e) || N(e) && !dr(e);
|
|
353
338
|
}
|
|
354
|
-
function
|
|
339
|
+
function Ue(e, s = {}) {
|
|
355
340
|
for (const t in e)
|
|
356
|
-
|
|
341
|
+
kt(e[t]) ? (s[t] = Array.isArray(e[t]) ? [] : {}, Ue(e[t], s[t])) : L(e[t]) || (s[t] = !0);
|
|
357
342
|
return s;
|
|
358
343
|
}
|
|
359
344
|
function me(e, s, t) {
|
|
360
|
-
t || (t =
|
|
361
|
-
for (const
|
|
362
|
-
|
|
345
|
+
t || (t = Ue(s));
|
|
346
|
+
for (const a in e)
|
|
347
|
+
kt(e[a]) ? L(s) || Ne(t[a]) ? t[a] = Ue(e[a], Array.isArray(e[a]) ? [] : {}) : me(e[a], K(s) ? {} : s[a], t[a]) : t[a] = !le(e[a], s[a]);
|
|
363
348
|
return t;
|
|
364
349
|
}
|
|
365
|
-
const
|
|
350
|
+
const it = {
|
|
366
351
|
value: !1,
|
|
367
352
|
isValid: !1
|
|
368
|
-
},
|
|
353
|
+
}, at = { value: !0, isValid: !0 };
|
|
369
354
|
var Ft = (e) => {
|
|
370
355
|
if (Array.isArray(e)) {
|
|
371
356
|
if (e.length > 1) {
|
|
@@ -374,82 +359,82 @@ var Ft = (e) => {
|
|
|
374
359
|
}
|
|
375
360
|
return e[0].checked && !e[0].disabled ? (
|
|
376
361
|
// @ts-expect-error expected to work in the browser
|
|
377
|
-
e[0].attributes && !L(e[0].attributes.value) ? L(e[0].value) || e[0].value === "" ?
|
|
378
|
-
) :
|
|
362
|
+
e[0].attributes && !L(e[0].attributes.value) ? L(e[0].value) || e[0].value === "" ? at : { value: e[0].value, isValid: !0 } : at
|
|
363
|
+
) : it;
|
|
379
364
|
}
|
|
380
|
-
return
|
|
381
|
-
},
|
|
382
|
-
const
|
|
365
|
+
return it;
|
|
366
|
+
}, At = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: a }) => L(e) ? e : s ? e === "" ? NaN : e && +e : t && Q(e) ? new Date(e) : a ? a(e) : e;
|
|
367
|
+
const lt = {
|
|
383
368
|
isValid: !1,
|
|
384
369
|
value: null
|
|
385
370
|
};
|
|
386
|
-
var
|
|
371
|
+
var pt = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
|
|
387
372
|
isValid: !0,
|
|
388
373
|
value: t.value
|
|
389
|
-
} : s,
|
|
390
|
-
function
|
|
374
|
+
} : s, lt) : lt;
|
|
375
|
+
function nt(e) {
|
|
391
376
|
const s = e.ref;
|
|
392
|
-
return
|
|
377
|
+
return ze(s) ? s.files : $e(s) ? pt(e.refs).value : xt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ke(s) ? Ft(e.refs).value : At(L(s.value) ? e.ref.value : s.value, e);
|
|
393
378
|
}
|
|
394
|
-
var
|
|
379
|
+
var cr = (e, s, t, a) => {
|
|
395
380
|
const o = {};
|
|
396
381
|
for (const l of e) {
|
|
397
|
-
const
|
|
398
|
-
|
|
382
|
+
const d = y(s, l);
|
|
383
|
+
d && B(o, l, d._f);
|
|
399
384
|
}
|
|
400
385
|
return {
|
|
401
386
|
criteriaMode: t,
|
|
402
387
|
names: [...e],
|
|
403
388
|
fields: o,
|
|
404
|
-
shouldUseNativeValidation:
|
|
389
|
+
shouldUseNativeValidation: a
|
|
405
390
|
};
|
|
406
|
-
}, Se = (e) => e instanceof RegExp, be = (e) => L(e) ? e : Se(e) ? e.source :
|
|
407
|
-
isOnSubmit: !e || e ===
|
|
408
|
-
isOnBlur: e ===
|
|
409
|
-
isOnChange: e ===
|
|
410
|
-
isOnAll: e ===
|
|
411
|
-
isOnTouch: e ===
|
|
391
|
+
}, Se = (e) => e instanceof RegExp, be = (e) => L(e) ? e : Se(e) ? e.source : N(e) ? Se(e.value) ? e.value.source : e.value : e, ot = (e) => ({
|
|
392
|
+
isOnSubmit: !e || e === se.onSubmit,
|
|
393
|
+
isOnBlur: e === se.onBlur,
|
|
394
|
+
isOnChange: e === se.onChange,
|
|
395
|
+
isOnAll: e === se.all,
|
|
396
|
+
isOnTouch: e === se.onTouched
|
|
412
397
|
});
|
|
413
|
-
const
|
|
414
|
-
var fr = (e) => !!e && !!e.validate && !!(
|
|
415
|
-
const
|
|
398
|
+
const ut = "AsyncFunction";
|
|
399
|
+
var fr = (e) => !!e && !!e.validate && !!(ie(e.validate) && e.validate.constructor.name === ut || N(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === ut)), yr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), dt = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((a) => e.startsWith(a) && /^\.\w+/.test(e.slice(a.length))));
|
|
400
|
+
const xe = (e, s, t, a) => {
|
|
416
401
|
for (const o of t || Object.keys(e)) {
|
|
417
402
|
const l = y(e, o);
|
|
418
403
|
if (l) {
|
|
419
|
-
const { _f:
|
|
420
|
-
if (
|
|
421
|
-
if (
|
|
404
|
+
const { _f: d, ...c } = l;
|
|
405
|
+
if (d) {
|
|
406
|
+
if (d.refs && d.refs[0] && s(d.refs[0], o) && !a)
|
|
422
407
|
return !0;
|
|
423
|
-
if (
|
|
408
|
+
if (d.ref && s(d.ref, d.name) && !a)
|
|
424
409
|
return !0;
|
|
425
|
-
if (
|
|
410
|
+
if (xe(c, s))
|
|
426
411
|
break;
|
|
427
|
-
} else if (
|
|
412
|
+
} else if (N(c) && xe(c, s))
|
|
428
413
|
break;
|
|
429
414
|
}
|
|
430
415
|
}
|
|
431
416
|
};
|
|
432
|
-
function
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
417
|
+
function ct(e, s, t) {
|
|
418
|
+
const a = y(e, t);
|
|
419
|
+
if (a || De(t))
|
|
435
420
|
return {
|
|
436
|
-
error:
|
|
421
|
+
error: a,
|
|
437
422
|
name: t
|
|
438
423
|
};
|
|
439
424
|
const o = t.split(".");
|
|
440
425
|
for (; o.length; ) {
|
|
441
|
-
const l = o.join("."),
|
|
442
|
-
if (
|
|
426
|
+
const l = o.join("."), d = y(s, l), c = y(e, l);
|
|
427
|
+
if (d && !Array.isArray(d) && t !== l)
|
|
443
428
|
return { name: t };
|
|
444
|
-
if (
|
|
429
|
+
if (c && c.type)
|
|
445
430
|
return {
|
|
446
431
|
name: l,
|
|
447
|
-
error:
|
|
432
|
+
error: c
|
|
448
433
|
};
|
|
449
|
-
if (
|
|
434
|
+
if (c && c.root && c.root.type)
|
|
450
435
|
return {
|
|
451
436
|
name: `${l}.root`,
|
|
452
|
-
error:
|
|
437
|
+
error: c.root
|
|
453
438
|
};
|
|
454
439
|
o.pop();
|
|
455
440
|
}
|
|
@@ -457,15 +442,15 @@ function ft(e, s, t) {
|
|
|
457
442
|
name: t
|
|
458
443
|
};
|
|
459
444
|
}
|
|
460
|
-
var hr = (e, s, t,
|
|
445
|
+
var hr = (e, s, t, a) => {
|
|
461
446
|
t(e);
|
|
462
447
|
const { name: o, ...l } = e;
|
|
463
|
-
return
|
|
464
|
-
}, mr = (e, s, t) => !e || !s || e === s || Ve(e).some((
|
|
465
|
-
const
|
|
466
|
-
return
|
|
448
|
+
return $(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((d) => s[d] === (!a || se.all));
|
|
449
|
+
}, mr = (e, s, t) => !e || !s || e === s || Ve(e).some((a) => a && (t ? a === s : a.startsWith(s) || s.startsWith(a))), _r = (e, s, t, a, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? a.isOnBlur : o.isOnBlur) ? !e : (t ? a.isOnChange : o.isOnChange) ? e : !0, gr = (e, s) => !Ie(y(e, s)).length && O(e, s), vr = (e, s, t) => {
|
|
450
|
+
const a = Ve(y(e, t));
|
|
451
|
+
return B(a, "root", s[t]), B(e, t, a), e;
|
|
467
452
|
};
|
|
468
|
-
function
|
|
453
|
+
function ft(e, s, t = "validate") {
|
|
469
454
|
if (Q(e) || Array.isArray(e) && e.every(Q) || J(e) && !e)
|
|
470
455
|
return {
|
|
471
456
|
type: t,
|
|
@@ -473,93 +458,93 @@ function yt(e, s, t = "validate") {
|
|
|
473
458
|
ref: s
|
|
474
459
|
};
|
|
475
460
|
}
|
|
476
|
-
var he = (e) =>
|
|
461
|
+
var he = (e) => N(e) && !Se(e) ? e : {
|
|
477
462
|
value: e,
|
|
478
463
|
message: ""
|
|
479
|
-
},
|
|
480
|
-
const { ref:
|
|
481
|
-
if (!
|
|
464
|
+
}, yt = async (e, s, t, a, o, l) => {
|
|
465
|
+
const { ref: d, refs: c, required: S, maxLength: D, minLength: _, min: x, max: g, pattern: j, validate: q, name: p, valueAsNumber: M, mount: ne } = e._f, v = y(t, p);
|
|
466
|
+
if (!ne || s.has(p))
|
|
482
467
|
return {};
|
|
483
|
-
const
|
|
484
|
-
o &&
|
|
485
|
-
},
|
|
486
|
-
const Y =
|
|
487
|
-
|
|
488
|
-
type:
|
|
468
|
+
const T = c ? c[0] : d, U = (V) => {
|
|
469
|
+
o && T.reportValidity && (T.setCustomValidity(J(V) ? "" : V || ""), T.reportValidity());
|
|
470
|
+
}, w = {}, X = $e(d), H = ke(d), re = X || H, z = (M || ze(d)) && L(d.value) && L(v) || Ce(d) && d.value === "" || v === "" || Array.isArray(v) && !v.length, G = lr.bind(null, p, a, w), Z = (V, k, C, F = ae.maxLength, W = ae.minLength) => {
|
|
471
|
+
const Y = V ? k : C;
|
|
472
|
+
w[p] = {
|
|
473
|
+
type: V ? F : W,
|
|
489
474
|
message: Y,
|
|
490
|
-
ref:
|
|
491
|
-
...G(
|
|
475
|
+
ref: d,
|
|
476
|
+
...G(V ? F : W, Y)
|
|
492
477
|
};
|
|
493
478
|
};
|
|
494
|
-
if (l ? !Array.isArray(
|
|
495
|
-
const { value:
|
|
496
|
-
if (
|
|
497
|
-
type:
|
|
498
|
-
message:
|
|
499
|
-
ref:
|
|
500
|
-
...G(
|
|
501
|
-
}, !
|
|
502
|
-
return
|
|
479
|
+
if (l ? !Array.isArray(v) || !v.length : S && (!re && (z || K(v)) || J(v) && !v || H && !Ft(c).isValid || X && !pt(c).isValid)) {
|
|
480
|
+
const { value: V, message: k } = Q(S) ? { value: !!S, message: S } : he(S);
|
|
481
|
+
if (V && (w[p] = {
|
|
482
|
+
type: ae.required,
|
|
483
|
+
message: k,
|
|
484
|
+
ref: T,
|
|
485
|
+
...G(ae.required, k)
|
|
486
|
+
}, !a))
|
|
487
|
+
return U(k), w;
|
|
503
488
|
}
|
|
504
|
-
if (
|
|
505
|
-
let
|
|
506
|
-
const
|
|
507
|
-
if (!
|
|
508
|
-
const W =
|
|
509
|
-
|
|
489
|
+
if (!z && (!K(x) || !K(g))) {
|
|
490
|
+
let V, k;
|
|
491
|
+
const C = he(g), F = he(x);
|
|
492
|
+
if (!K(v) && !isNaN(v)) {
|
|
493
|
+
const W = d.valueAsNumber || v && +v;
|
|
494
|
+
K(C.value) || (V = W > C.value), K(F.value) || (k = W < F.value);
|
|
510
495
|
} else {
|
|
511
|
-
const W =
|
|
512
|
-
Q(
|
|
496
|
+
const W = d.valueAsDate || new Date(v), Y = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), oe = d.type == "time", ue = d.type == "week";
|
|
497
|
+
Q(C.value) && v && (V = oe ? Y(v) > Y(C.value) : ue ? v > C.value : W > new Date(C.value)), Q(F.value) && v && (k = oe ? Y(v) < Y(F.value) : ue ? v < F.value : W < new Date(F.value));
|
|
513
498
|
}
|
|
514
|
-
if ((
|
|
515
|
-
return
|
|
499
|
+
if ((V || k) && (Z(!!V, C.message, F.message, ae.max, ae.min), !a))
|
|
500
|
+
return U(w[p].message), w;
|
|
516
501
|
}
|
|
517
|
-
if ((
|
|
518
|
-
const
|
|
519
|
-
if ((
|
|
520
|
-
return
|
|
502
|
+
if ((D || _) && !z && (Q(v) || l && Array.isArray(v))) {
|
|
503
|
+
const V = he(D), k = he(_), C = !K(V.value) && v.length > +V.value, F = !K(k.value) && v.length < +k.value;
|
|
504
|
+
if ((C || F) && (Z(C, V.message, k.message), !a))
|
|
505
|
+
return U(w[p].message), w;
|
|
521
506
|
}
|
|
522
|
-
if (
|
|
523
|
-
const { value:
|
|
524
|
-
if (Se(
|
|
525
|
-
type:
|
|
526
|
-
message:
|
|
527
|
-
ref:
|
|
528
|
-
...G(
|
|
529
|
-
}, !
|
|
530
|
-
return
|
|
507
|
+
if (j && !z && Q(v)) {
|
|
508
|
+
const { value: V, message: k } = he(j);
|
|
509
|
+
if (Se(V) && !v.match(V) && (w[p] = {
|
|
510
|
+
type: ae.pattern,
|
|
511
|
+
message: k,
|
|
512
|
+
ref: d,
|
|
513
|
+
...G(ae.pattern, k)
|
|
514
|
+
}, !a))
|
|
515
|
+
return U(k), w;
|
|
531
516
|
}
|
|
532
517
|
if (q) {
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
536
|
-
...
|
|
537
|
-
...G(
|
|
538
|
-
}, !
|
|
539
|
-
return
|
|
540
|
-
} else if (
|
|
541
|
-
let
|
|
542
|
-
for (const
|
|
543
|
-
if (
|
|
518
|
+
if (ie(q)) {
|
|
519
|
+
const V = await q(v, t), k = ft(V, T);
|
|
520
|
+
if (k && (w[p] = {
|
|
521
|
+
...k,
|
|
522
|
+
...G(ae.validate, k.message)
|
|
523
|
+
}, !a))
|
|
524
|
+
return U(k.message), w;
|
|
525
|
+
} else if (N(q)) {
|
|
526
|
+
let V = {};
|
|
527
|
+
for (const k in q) {
|
|
528
|
+
if (!$(V) && !a)
|
|
544
529
|
break;
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
...
|
|
548
|
-
...G(
|
|
549
|
-
},
|
|
530
|
+
const C = ft(await q[k](v, t), T, k);
|
|
531
|
+
C && (V = {
|
|
532
|
+
...C,
|
|
533
|
+
...G(k, C.message)
|
|
534
|
+
}, U(C.message), a && (w[p] = V));
|
|
550
535
|
}
|
|
551
|
-
if (
|
|
552
|
-
ref:
|
|
553
|
-
...
|
|
554
|
-
}, !
|
|
555
|
-
return
|
|
536
|
+
if (!$(V) && (w[p] = {
|
|
537
|
+
ref: T,
|
|
538
|
+
...V
|
|
539
|
+
}, !a))
|
|
540
|
+
return w;
|
|
556
541
|
}
|
|
557
542
|
}
|
|
558
|
-
return
|
|
543
|
+
return U(!0), w;
|
|
559
544
|
};
|
|
560
545
|
const br = {
|
|
561
|
-
mode:
|
|
562
|
-
reValidateMode:
|
|
546
|
+
mode: se.onSubmit,
|
|
547
|
+
reValidateMode: se.onChange,
|
|
563
548
|
shouldFocusError: !0
|
|
564
549
|
};
|
|
565
550
|
function Vr(e = {}) {
|
|
@@ -570,7 +555,7 @@ function Vr(e = {}) {
|
|
|
570
555
|
submitCount: 0,
|
|
571
556
|
isDirty: !1,
|
|
572
557
|
isReady: !1,
|
|
573
|
-
isLoading:
|
|
558
|
+
isLoading: ie(s.defaultValues),
|
|
574
559
|
isValidating: !1,
|
|
575
560
|
isSubmitted: !1,
|
|
576
561
|
isSubmitting: !1,
|
|
@@ -581,18 +566,18 @@ function Vr(e = {}) {
|
|
|
581
566
|
validatingFields: {},
|
|
582
567
|
errors: s.errors || {},
|
|
583
568
|
disabled: s.disabled || !1
|
|
584
|
-
},
|
|
569
|
+
}, a = {}, o = N(s.defaultValues) || N(s.values) ? P(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : P(o), d = {
|
|
585
570
|
action: !1,
|
|
586
571
|
mount: !1,
|
|
587
572
|
watch: !1
|
|
588
|
-
},
|
|
573
|
+
}, c = {
|
|
589
574
|
mount: /* @__PURE__ */ new Set(),
|
|
590
575
|
disabled: /* @__PURE__ */ new Set(),
|
|
591
576
|
unMount: /* @__PURE__ */ new Set(),
|
|
592
577
|
array: /* @__PURE__ */ new Set(),
|
|
593
578
|
watch: /* @__PURE__ */ new Set()
|
|
594
|
-
},
|
|
595
|
-
const
|
|
579
|
+
}, S, D = 0;
|
|
580
|
+
const _ = {
|
|
596
581
|
isDirty: !1,
|
|
597
582
|
dirtyFields: !1,
|
|
598
583
|
validatingFields: !1,
|
|
@@ -602,112 +587,112 @@ function Vr(e = {}) {
|
|
|
602
587
|
errors: !1
|
|
603
588
|
};
|
|
604
589
|
let x = {
|
|
605
|
-
...
|
|
590
|
+
..._
|
|
606
591
|
};
|
|
607
|
-
const
|
|
608
|
-
array:
|
|
609
|
-
state:
|
|
610
|
-
},
|
|
611
|
-
clearTimeout(
|
|
612
|
-
},
|
|
613
|
-
if (!s.disabled && (
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
isValid:
|
|
592
|
+
const g = {
|
|
593
|
+
array: st(),
|
|
594
|
+
state: st()
|
|
595
|
+
}, j = s.criteriaMode === se.all, q = (r) => (i) => {
|
|
596
|
+
clearTimeout(D), D = setTimeout(r, i);
|
|
597
|
+
}, p = async (r) => {
|
|
598
|
+
if (!s.disabled && (_.isValid || x.isValid || r)) {
|
|
599
|
+
const i = s.resolver ? $((await H()).errors) : await z(a, !0);
|
|
600
|
+
i !== t.isValid && g.state.next({
|
|
601
|
+
isValid: i
|
|
617
602
|
});
|
|
618
603
|
}
|
|
619
|
-
}, M = (r,
|
|
620
|
-
!s.disabled && (
|
|
621
|
-
n && (
|
|
622
|
-
}),
|
|
604
|
+
}, M = (r, i) => {
|
|
605
|
+
!s.disabled && (_.isValidating || _.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(c.mount)).forEach((n) => {
|
|
606
|
+
n && (i ? B(t.validatingFields, n, i) : O(t.validatingFields, n));
|
|
607
|
+
}), g.state.next({
|
|
623
608
|
validatingFields: t.validatingFields,
|
|
624
|
-
isValidating:
|
|
609
|
+
isValidating: !$(t.validatingFields)
|
|
625
610
|
}));
|
|
626
|
-
},
|
|
611
|
+
}, ne = (r, i = [], n, h, f = !0, u = !0) => {
|
|
627
612
|
if (h && n && !s.disabled) {
|
|
628
|
-
if (
|
|
629
|
-
const m = n(y(
|
|
630
|
-
f &&
|
|
613
|
+
if (d.action = !0, u && Array.isArray(y(a, r))) {
|
|
614
|
+
const m = n(y(a, r), h.argA, h.argB);
|
|
615
|
+
f && B(a, r, m);
|
|
631
616
|
}
|
|
632
617
|
if (u && Array.isArray(y(t.errors, r))) {
|
|
633
618
|
const m = n(y(t.errors, r), h.argA, h.argB);
|
|
634
|
-
f &&
|
|
619
|
+
f && B(t.errors, r, m), gr(t.errors, r);
|
|
635
620
|
}
|
|
636
|
-
if ((
|
|
621
|
+
if ((_.touchedFields || x.touchedFields) && u && Array.isArray(y(t.touchedFields, r))) {
|
|
637
622
|
const m = n(y(t.touchedFields, r), h.argA, h.argB);
|
|
638
|
-
f &&
|
|
623
|
+
f && B(t.touchedFields, r, m);
|
|
639
624
|
}
|
|
640
|
-
(
|
|
625
|
+
(_.dirtyFields || x.dirtyFields) && (t.dirtyFields = me(o, l)), g.state.next({
|
|
641
626
|
name: r,
|
|
642
|
-
isDirty:
|
|
627
|
+
isDirty: Z(r, i),
|
|
643
628
|
dirtyFields: t.dirtyFields,
|
|
644
629
|
errors: t.errors,
|
|
645
630
|
isValid: t.isValid
|
|
646
631
|
});
|
|
647
632
|
} else
|
|
648
|
-
|
|
649
|
-
},
|
|
650
|
-
|
|
633
|
+
B(l, r, i);
|
|
634
|
+
}, v = (r, i) => {
|
|
635
|
+
B(t.errors, r, i), g.state.next({
|
|
651
636
|
errors: t.errors
|
|
652
637
|
});
|
|
653
|
-
},
|
|
654
|
-
t.errors = r,
|
|
638
|
+
}, T = (r) => {
|
|
639
|
+
t.errors = r, g.state.next({
|
|
655
640
|
errors: t.errors,
|
|
656
641
|
isValid: !1
|
|
657
642
|
});
|
|
658
|
-
},
|
|
659
|
-
const f = y(
|
|
643
|
+
}, U = (r, i, n, h) => {
|
|
644
|
+
const f = y(a, r);
|
|
660
645
|
if (f) {
|
|
661
646
|
const u = y(l, r, L(n) ? y(o, r) : n);
|
|
662
|
-
L(u) || h && h.defaultChecked ||
|
|
647
|
+
L(u) || h && h.defaultChecked || i ? B(l, r, i ? u : nt(f._f)) : C(r, u), d.mount && p();
|
|
663
648
|
}
|
|
664
|
-
},
|
|
649
|
+
}, w = (r, i, n, h, f) => {
|
|
665
650
|
let u = !1, m = !1;
|
|
666
|
-
const
|
|
651
|
+
const A = {
|
|
667
652
|
name: r
|
|
668
653
|
};
|
|
669
654
|
if (!s.disabled) {
|
|
670
655
|
if (!n || h) {
|
|
671
|
-
(
|
|
672
|
-
const
|
|
673
|
-
m = !!y(t.dirtyFields, r),
|
|
656
|
+
(_.isDirty || x.isDirty) && (m = t.isDirty, t.isDirty = A.isDirty = Z(), u = m !== A.isDirty);
|
|
657
|
+
const E = le(y(o, r), i);
|
|
658
|
+
m = !!y(t.dirtyFields, r), E ? O(t.dirtyFields, r) : B(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, u = u || (_.dirtyFields || x.dirtyFields) && m !== !E;
|
|
674
659
|
}
|
|
675
660
|
if (n) {
|
|
676
|
-
const
|
|
677
|
-
|
|
661
|
+
const E = y(t.touchedFields, r);
|
|
662
|
+
E || (B(t.touchedFields, r, n), A.touchedFields = t.touchedFields, u = u || (_.touchedFields || x.touchedFields) && E !== n);
|
|
678
663
|
}
|
|
679
|
-
u && f &&
|
|
664
|
+
u && f && g.state.next(A);
|
|
680
665
|
}
|
|
681
|
-
return u ?
|
|
682
|
-
},
|
|
683
|
-
const f = y(t.errors, r), u = (
|
|
684
|
-
if (s.delayError && n ? (
|
|
666
|
+
return u ? A : {};
|
|
667
|
+
}, X = (r, i, n, h) => {
|
|
668
|
+
const f = y(t.errors, r), u = (_.isValid || x.isValid) && J(i) && t.isValid !== i;
|
|
669
|
+
if (s.delayError && n ? (S = q(() => v(r, n)), S(s.delayError)) : (clearTimeout(D), S = null, n ? B(t.errors, r, n) : O(t.errors, r)), (n ? !le(f, n) : f) || !$(h) || u) {
|
|
685
670
|
const m = {
|
|
686
671
|
...h,
|
|
687
|
-
...u && J(
|
|
672
|
+
...u && J(i) ? { isValid: i } : {},
|
|
688
673
|
errors: t.errors,
|
|
689
674
|
name: r
|
|
690
675
|
};
|
|
691
676
|
t = {
|
|
692
677
|
...t,
|
|
693
678
|
...m
|
|
694
|
-
},
|
|
679
|
+
}, g.state.next(m);
|
|
695
680
|
}
|
|
696
|
-
},
|
|
681
|
+
}, H = async (r) => {
|
|
697
682
|
M(r, !0);
|
|
698
|
-
const
|
|
699
|
-
return M(r),
|
|
700
|
-
},
|
|
701
|
-
const { errors:
|
|
683
|
+
const i = await s.resolver(l, s.context, cr(r || c.mount, a, s.criteriaMode, s.shouldUseNativeValidation));
|
|
684
|
+
return M(r), i;
|
|
685
|
+
}, re = async (r) => {
|
|
686
|
+
const { errors: i } = await H(r);
|
|
702
687
|
if (r)
|
|
703
688
|
for (const n of r) {
|
|
704
|
-
const h = y(
|
|
705
|
-
h ?
|
|
689
|
+
const h = y(i, n);
|
|
690
|
+
h ? B(t.errors, n, h) : O(t.errors, n);
|
|
706
691
|
}
|
|
707
692
|
else
|
|
708
|
-
t.errors =
|
|
709
|
-
return
|
|
710
|
-
},
|
|
693
|
+
t.errors = i;
|
|
694
|
+
return i;
|
|
695
|
+
}, z = async (r, i, n = {
|
|
711
696
|
valid: !0
|
|
712
697
|
}) => {
|
|
713
698
|
for (const h in r) {
|
|
@@ -715,231 +700,231 @@ function Vr(e = {}) {
|
|
|
715
700
|
if (f) {
|
|
716
701
|
const { _f: u, ...m } = f;
|
|
717
702
|
if (u) {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
703
|
+
const A = c.array.has(u.name), E = f._f && fr(f._f);
|
|
704
|
+
E && _.validatingFields && M([u.name], !0);
|
|
705
|
+
const te = await yt(f, c.disabled, l, j, s.shouldUseNativeValidation && !i, A);
|
|
706
|
+
if (E && _.validatingFields && M([u.name]), te[u.name] && (n.valid = !1, i))
|
|
722
707
|
break;
|
|
723
|
-
!
|
|
708
|
+
!i && (y(te, u.name) ? A ? vr(t.errors, te, u.name) : B(t.errors, u.name, te[u.name]) : O(t.errors, u.name));
|
|
724
709
|
}
|
|
725
|
-
|
|
710
|
+
!$(m) && await z(m, i, n);
|
|
726
711
|
}
|
|
727
712
|
}
|
|
728
713
|
return n.valid;
|
|
729
714
|
}, G = () => {
|
|
730
|
-
for (const r of
|
|
731
|
-
const
|
|
732
|
-
|
|
715
|
+
for (const r of c.unMount) {
|
|
716
|
+
const i = y(a, r);
|
|
717
|
+
i && (i._f.refs ? i._f.refs.every((n) => !Oe(n)) : !Oe(i._f.ref)) && ve(r);
|
|
733
718
|
}
|
|
734
|
-
|
|
735
|
-
},
|
|
736
|
-
...
|
|
737
|
-
}, n,
|
|
738
|
-
const h = y(
|
|
739
|
-
let f =
|
|
719
|
+
c.unMount = /* @__PURE__ */ new Set();
|
|
720
|
+
}, Z = (r, i) => !s.disabled && (r && i && B(l, r, i), !le(ye(), o)), V = (r, i, n) => bt(r, c, {
|
|
721
|
+
...d.mount ? l : L(i) ? o : Q(r) ? { [r]: i } : i
|
|
722
|
+
}, n, i), k = (r) => Ie(y(d.mount ? l : o, r, s.shouldUnregister ? y(o, r, []) : [])), C = (r, i, n = {}) => {
|
|
723
|
+
const h = y(a, r);
|
|
724
|
+
let f = i;
|
|
740
725
|
if (h) {
|
|
741
726
|
const u = h._f;
|
|
742
|
-
u && (!u.disabled &&
|
|
743
|
-
(!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((
|
|
744
|
-
}) : u.refs.forEach((m) => m.checked = m.value === f) :
|
|
727
|
+
u && (!u.disabled && B(l, r, At(i, u)), f = Ce(u.ref) && K(i) ? "" : i, xt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = f.includes(m.value)) : u.refs ? ke(u.ref) ? u.refs.forEach((m) => {
|
|
728
|
+
(!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((A) => A === m.value) : m.checked = f === m.value || !!f);
|
|
729
|
+
}) : u.refs.forEach((m) => m.checked = m.value === f) : ze(u.ref) ? u.ref.value = "" : (u.ref.value = f, u.ref.type || g.state.next({
|
|
745
730
|
name: r,
|
|
746
731
|
values: P(l)
|
|
747
732
|
})));
|
|
748
733
|
}
|
|
749
|
-
(n.shouldDirty || n.shouldTouch) &&
|
|
750
|
-
},
|
|
751
|
-
for (const h in
|
|
752
|
-
if (!
|
|
734
|
+
(n.shouldDirty || n.shouldTouch) && w(r, f, n.shouldTouch, n.shouldDirty, !0), n.shouldValidate && ue(r);
|
|
735
|
+
}, F = (r, i, n) => {
|
|
736
|
+
for (const h in i) {
|
|
737
|
+
if (!i.hasOwnProperty(h))
|
|
753
738
|
return;
|
|
754
|
-
const f =
|
|
755
|
-
(
|
|
739
|
+
const f = i[h], u = r + "." + h, m = y(a, u);
|
|
740
|
+
(c.array.has(r) || N(f) || m && !m._f) && !fe(f) ? F(u, f, n) : C(u, f, n);
|
|
756
741
|
}
|
|
757
|
-
}, W = (r,
|
|
758
|
-
const h = y(
|
|
759
|
-
|
|
742
|
+
}, W = (r, i, n = {}) => {
|
|
743
|
+
const h = y(a, r), f = c.array.has(r), u = P(i);
|
|
744
|
+
B(l, r, u), f ? (g.array.next({
|
|
760
745
|
name: r,
|
|
761
746
|
values: P(l)
|
|
762
|
-
}), (
|
|
747
|
+
}), (_.isDirty || _.dirtyFields || x.isDirty || x.dirtyFields) && n.shouldDirty && g.state.next({
|
|
763
748
|
name: r,
|
|
764
749
|
dirtyFields: me(o, l),
|
|
765
|
-
isDirty:
|
|
766
|
-
})) : h && !h._f && !
|
|
767
|
-
name:
|
|
750
|
+
isDirty: Z(r, u)
|
|
751
|
+
})) : h && !h._f && !K(u) ? F(r, u, n) : C(r, u, n), dt(r, c) && g.state.next({ ...t, name: r }), g.state.next({
|
|
752
|
+
name: d.mount ? r : void 0,
|
|
768
753
|
values: P(l)
|
|
769
754
|
});
|
|
770
755
|
}, Y = async (r) => {
|
|
771
|
-
|
|
772
|
-
const
|
|
773
|
-
let n =
|
|
774
|
-
const f = y(
|
|
775
|
-
h = Number.isNaN(
|
|
776
|
-
}, m =
|
|
756
|
+
d.mount = !0;
|
|
757
|
+
const i = r.target;
|
|
758
|
+
let n = i.name, h = !0;
|
|
759
|
+
const f = y(a, n), u = (E) => {
|
|
760
|
+
h = Number.isNaN(E) || fe(E) && isNaN(E.getTime()) || le(E, y(l, n, E));
|
|
761
|
+
}, m = ot(s.mode), A = ot(s.reValidateMode);
|
|
777
762
|
if (f) {
|
|
778
|
-
let
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
const
|
|
782
|
-
if (!
|
|
763
|
+
let E, te;
|
|
764
|
+
const pe = i.type ? nt(f._f) : mt(r), de = r.type === we.BLUR || r.type === we.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors, n) && !f._f.deps || _r(de, y(t.touchedFields, n), t.isSubmitted, A, m), Le = dt(n, c, de);
|
|
765
|
+
B(l, n, pe), de ? (!i || !i.readOnly) && (f._f.onBlur && f._f.onBlur(r), S && S(0)) : f._f.onChange && f._f.onChange(r);
|
|
766
|
+
const Me = w(n, pe, de), Bt = !$(Me) || Le;
|
|
767
|
+
if (!de && g.state.next({
|
|
783
768
|
name: n,
|
|
784
769
|
type: r.type,
|
|
785
770
|
values: P(l)
|
|
786
771
|
}), Et)
|
|
787
|
-
return (
|
|
788
|
-
if (!
|
|
789
|
-
const { errors:
|
|
790
|
-
if (u(
|
|
791
|
-
const Tt =
|
|
792
|
-
|
|
772
|
+
return (_.isValid || x.isValid) && (s.mode === "onBlur" ? de && p() : de || p()), Bt && g.state.next({ name: n, ...Le ? {} : Me });
|
|
773
|
+
if (!de && Le && g.state.next({ ...t }), s.resolver) {
|
|
774
|
+
const { errors: Qe } = await H([n]);
|
|
775
|
+
if (u(pe), h) {
|
|
776
|
+
const Tt = ct(t.errors, a, n), Xe = ct(Qe, a, Tt.name || n);
|
|
777
|
+
E = Xe.error, n = Xe.name, te = $(Qe);
|
|
793
778
|
}
|
|
794
779
|
} else
|
|
795
|
-
M([n], !0),
|
|
796
|
-
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ue(f._f.deps),
|
|
780
|
+
M([n], !0), E = (await yt(f, c.disabled, l, j, s.shouldUseNativeValidation))[n], M([n]), u(pe), h && (E ? te = !1 : (_.isValid || x.isValid) && (te = await z(a, !0)));
|
|
781
|
+
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ue(f._f.deps), X(n, te, E, Me));
|
|
797
782
|
}
|
|
798
|
-
}, oe = (r,
|
|
799
|
-
if (y(t.errors,
|
|
783
|
+
}, oe = (r, i) => {
|
|
784
|
+
if (y(t.errors, i) && r.focus)
|
|
800
785
|
return r.focus(), 1;
|
|
801
|
-
}, ue = async (r,
|
|
786
|
+
}, ue = async (r, i = {}) => {
|
|
802
787
|
let n, h;
|
|
803
788
|
const f = Ve(r);
|
|
804
789
|
if (s.resolver) {
|
|
805
|
-
const u = await
|
|
806
|
-
n =
|
|
790
|
+
const u = await re(L(r) ? r : f);
|
|
791
|
+
n = $(u), h = r ? !f.some((m) => y(u, m)) : n;
|
|
807
792
|
} else r ? (h = (await Promise.all(f.map(async (u) => {
|
|
808
|
-
const m = y(
|
|
809
|
-
return await
|
|
810
|
-
}))).every(Boolean), !(!h && !t.isValid) &&
|
|
811
|
-
return
|
|
812
|
-
...!Q(r) || (
|
|
793
|
+
const m = y(a, u);
|
|
794
|
+
return await z(m && m._f ? { [u]: m } : m);
|
|
795
|
+
}))).every(Boolean), !(!h && !t.isValid) && p()) : h = n = await z(a);
|
|
796
|
+
return g.state.next({
|
|
797
|
+
...!Q(r) || (_.isValid || x.isValid) && n !== t.isValid ? {} : { name: r },
|
|
813
798
|
...s.resolver || !r ? { isValid: n } : {},
|
|
814
799
|
errors: t.errors
|
|
815
|
-
}),
|
|
816
|
-
}, ye = (r,
|
|
800
|
+
}), i.shouldFocus && !h && xe(a, oe, r ? f : c.mount), h;
|
|
801
|
+
}, ye = (r, i) => {
|
|
817
802
|
let n = {
|
|
818
|
-
...
|
|
803
|
+
...d.mount ? l : o
|
|
819
804
|
};
|
|
820
|
-
return
|
|
821
|
-
}, Fe = (r,
|
|
822
|
-
invalid: !!y((
|
|
823
|
-
isDirty: !!y((
|
|
824
|
-
error: y((
|
|
805
|
+
return i && (n = Vt(i.dirtyFields ? t.dirtyFields : t.touchedFields, n)), L(r) ? n : Q(r) ? y(n, r) : r.map((h) => y(n, h));
|
|
806
|
+
}, Fe = (r, i) => ({
|
|
807
|
+
invalid: !!y((i || t).errors, r),
|
|
808
|
+
isDirty: !!y((i || t).dirtyFields, r),
|
|
809
|
+
error: y((i || t).errors, r),
|
|
825
810
|
isValidating: !!y(t.validatingFields, r),
|
|
826
|
-
isTouched: !!y((
|
|
811
|
+
isTouched: !!y((i || t).touchedFields, r)
|
|
827
812
|
}), Ee = (r) => {
|
|
828
|
-
r && Ve(r).forEach((
|
|
813
|
+
r && Ve(r).forEach((i) => O(t.errors, i)), g.state.next({
|
|
829
814
|
errors: r ? t.errors : {}
|
|
830
815
|
});
|
|
831
|
-
},
|
|
832
|
-
const h = (y(
|
|
833
|
-
|
|
834
|
-
...
|
|
835
|
-
...
|
|
816
|
+
}, Ae = (r, i, n) => {
|
|
817
|
+
const h = (y(a, r, { _f: {} })._f || {}).ref, f = y(t.errors, r) || {}, { ref: u, message: m, type: A, ...E } = f;
|
|
818
|
+
B(t.errors, r, {
|
|
819
|
+
...E,
|
|
820
|
+
...i,
|
|
836
821
|
ref: h
|
|
837
|
-
}),
|
|
822
|
+
}), g.state.next({
|
|
838
823
|
name: r,
|
|
839
824
|
errors: t.errors,
|
|
840
825
|
isValid: !1
|
|
841
826
|
}), n && n.shouldFocus && h && h.focus && h.focus();
|
|
842
|
-
}, _e = (r,
|
|
843
|
-
next: (n) => "values" in n && r(
|
|
844
|
-
}) :
|
|
845
|
-
next: (
|
|
846
|
-
mr(r.name,
|
|
827
|
+
}, _e = (r, i) => ie(r) ? g.state.subscribe({
|
|
828
|
+
next: (n) => "values" in n && r(V(void 0, i), n)
|
|
829
|
+
}) : V(r, i, !0), ee = (r) => g.state.subscribe({
|
|
830
|
+
next: (i) => {
|
|
831
|
+
mr(r.name, i.name, r.exact) && hr(i, r.formState || _, Dt, r.reRenderRoot) && r.callback({
|
|
847
832
|
values: { ...l },
|
|
848
833
|
...t,
|
|
849
|
-
...
|
|
834
|
+
...i,
|
|
850
835
|
defaultValues: o
|
|
851
836
|
});
|
|
852
837
|
}
|
|
853
|
-
}).unsubscribe, ge = (r) => (
|
|
838
|
+
}).unsubscribe, ge = (r) => (d.mount = !0, x = {
|
|
854
839
|
...x,
|
|
855
840
|
...r.formState
|
|
856
|
-
},
|
|
841
|
+
}, ee({
|
|
857
842
|
...r,
|
|
858
843
|
formState: x
|
|
859
|
-
})), ve = (r,
|
|
860
|
-
for (const n of r ? Ve(r) :
|
|
861
|
-
|
|
862
|
-
|
|
844
|
+
})), ve = (r, i = {}) => {
|
|
845
|
+
for (const n of r ? Ve(r) : c.mount)
|
|
846
|
+
c.mount.delete(n), c.array.delete(n), i.keepValue || (O(a, n), O(l, n)), !i.keepError && O(t.errors, n), !i.keepDirty && O(t.dirtyFields, n), !i.keepTouched && O(t.touchedFields, n), !i.keepIsValidating && O(t.validatingFields, n), !s.shouldUnregister && !i.keepDefaultValue && O(o, n);
|
|
847
|
+
g.state.next({
|
|
863
848
|
values: P(l)
|
|
864
|
-
}),
|
|
849
|
+
}), g.state.next({
|
|
865
850
|
...t,
|
|
866
|
-
...
|
|
867
|
-
}), !
|
|
868
|
-
},
|
|
869
|
-
(J(r) &&
|
|
870
|
-
}, Be = (r,
|
|
871
|
-
let n = y(
|
|
872
|
-
const h = J(
|
|
873
|
-
return
|
|
851
|
+
...i.keepDirty ? { isDirty: Z() } : {}
|
|
852
|
+
}), !i.keepIsValid && p();
|
|
853
|
+
}, Ke = ({ disabled: r, name: i }) => {
|
|
854
|
+
(J(r) && d.mount || r || c.disabled.has(i)) && (r ? c.disabled.add(i) : c.disabled.delete(i));
|
|
855
|
+
}, Be = (r, i = {}) => {
|
|
856
|
+
let n = y(a, r);
|
|
857
|
+
const h = J(i.disabled) || J(s.disabled);
|
|
858
|
+
return B(a, r, {
|
|
874
859
|
...n || {},
|
|
875
860
|
_f: {
|
|
876
861
|
...n && n._f ? n._f : { ref: { name: r } },
|
|
877
862
|
name: r,
|
|
878
863
|
mount: !0,
|
|
879
|
-
...
|
|
864
|
+
...i
|
|
880
865
|
}
|
|
881
|
-
}),
|
|
882
|
-
disabled: J(
|
|
866
|
+
}), c.mount.add(r), n ? Ke({
|
|
867
|
+
disabled: J(i.disabled) ? i.disabled : s.disabled,
|
|
883
868
|
name: r
|
|
884
|
-
}) :
|
|
885
|
-
...h ? { disabled:
|
|
869
|
+
}) : U(r, !0, i.value), {
|
|
870
|
+
...h ? { disabled: i.disabled || s.disabled } : {},
|
|
886
871
|
...s.progressive ? {
|
|
887
|
-
required: !!
|
|
888
|
-
min: be(
|
|
889
|
-
max: be(
|
|
890
|
-
minLength: be(
|
|
891
|
-
maxLength: be(
|
|
892
|
-
pattern: be(
|
|
872
|
+
required: !!i.required,
|
|
873
|
+
min: be(i.min),
|
|
874
|
+
max: be(i.max),
|
|
875
|
+
minLength: be(i.minLength),
|
|
876
|
+
maxLength: be(i.maxLength),
|
|
877
|
+
pattern: be(i.pattern)
|
|
893
878
|
} : {},
|
|
894
879
|
name: r,
|
|
895
880
|
onChange: Y,
|
|
896
881
|
onBlur: Y,
|
|
897
882
|
ref: (f) => {
|
|
898
883
|
if (f) {
|
|
899
|
-
Be(r,
|
|
900
|
-
const u = L(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u),
|
|
901
|
-
if (m ?
|
|
884
|
+
Be(r, i), n = y(a, r);
|
|
885
|
+
const u = L(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u), A = n._f.refs || [];
|
|
886
|
+
if (m ? A.find((E) => E === u) : u === n._f.ref)
|
|
902
887
|
return;
|
|
903
|
-
|
|
888
|
+
B(a, r, {
|
|
904
889
|
_f: {
|
|
905
890
|
...n._f,
|
|
906
891
|
...m ? {
|
|
907
892
|
refs: [
|
|
908
|
-
...
|
|
893
|
+
...A.filter(Oe),
|
|
909
894
|
u,
|
|
910
895
|
...Array.isArray(y(o, r)) ? [{}] : []
|
|
911
896
|
],
|
|
912
897
|
ref: { type: u.type, name: r }
|
|
913
898
|
} : { ref: u }
|
|
914
899
|
}
|
|
915
|
-
}),
|
|
900
|
+
}), U(r, !1, void 0, u);
|
|
916
901
|
} else
|
|
917
|
-
n = y(
|
|
902
|
+
n = y(a, r, {}), n._f && (n._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(_t(c.array, r) && d.action) && c.unMount.add(r);
|
|
918
903
|
}
|
|
919
904
|
};
|
|
920
|
-
}, Te = () => s.shouldFocusError &&
|
|
921
|
-
J(r) && (
|
|
922
|
-
const h = y(
|
|
923
|
-
h && (
|
|
905
|
+
}, Te = () => s.shouldFocusError && xe(a, oe, c.mount), wt = (r) => {
|
|
906
|
+
J(r) && (g.state.next({ disabled: r }), xe(a, (i, n) => {
|
|
907
|
+
const h = y(a, n);
|
|
908
|
+
h && (i.disabled = h._f.disabled || r, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
|
|
924
909
|
f.disabled = h._f.disabled || r;
|
|
925
910
|
}));
|
|
926
911
|
}, 0, !1));
|
|
927
|
-
},
|
|
912
|
+
}, je = (r, i) => async (n) => {
|
|
928
913
|
let h;
|
|
929
914
|
n && (n.preventDefault && n.preventDefault(), n.persist && n.persist());
|
|
930
915
|
let f = P(l);
|
|
931
|
-
if (
|
|
916
|
+
if (g.state.next({
|
|
932
917
|
isSubmitting: !0
|
|
933
918
|
}), s.resolver) {
|
|
934
|
-
const { errors: u, values: m } = await
|
|
919
|
+
const { errors: u, values: m } = await H();
|
|
935
920
|
t.errors = u, f = P(m);
|
|
936
921
|
} else
|
|
937
|
-
await
|
|
938
|
-
if (
|
|
939
|
-
for (const u of
|
|
940
|
-
|
|
941
|
-
if (
|
|
942
|
-
|
|
922
|
+
await z(a);
|
|
923
|
+
if (c.disabled.size)
|
|
924
|
+
for (const u of c.disabled)
|
|
925
|
+
O(f, u);
|
|
926
|
+
if (O(t.errors, "root"), $(t.errors)) {
|
|
927
|
+
g.state.next({
|
|
943
928
|
errors: {}
|
|
944
929
|
});
|
|
945
930
|
try {
|
|
@@ -948,131 +933,131 @@ function Vr(e = {}) {
|
|
|
948
933
|
h = u;
|
|
949
934
|
}
|
|
950
935
|
} else
|
|
951
|
-
|
|
952
|
-
if (
|
|
936
|
+
i && await i({ ...t.errors }, n), Te(), setTimeout(Te);
|
|
937
|
+
if (g.state.next({
|
|
953
938
|
isSubmitted: !0,
|
|
954
939
|
isSubmitting: !1,
|
|
955
|
-
isSubmitSuccessful:
|
|
940
|
+
isSubmitSuccessful: $(t.errors) && !h,
|
|
956
941
|
submitCount: t.submitCount + 1,
|
|
957
942
|
errors: t.errors
|
|
958
943
|
}), h)
|
|
959
944
|
throw h;
|
|
960
|
-
}, Ct = (r,
|
|
961
|
-
y(
|
|
962
|
-
},
|
|
963
|
-
const n = r ? P(r) : o, h = P(n), f =
|
|
964
|
-
if (
|
|
965
|
-
if (
|
|
945
|
+
}, Ct = (r, i = {}) => {
|
|
946
|
+
y(a, r) && (L(i.defaultValue) ? W(r, P(y(o, r))) : (W(r, i.defaultValue), B(o, r, P(i.defaultValue))), i.keepTouched || O(t.touchedFields, r), i.keepDirty || (O(t.dirtyFields, r), t.isDirty = i.defaultValue ? Z(r, P(y(o, r))) : Z()), i.keepError || (O(t.errors, r), _.isValid && p()), g.state.next({ ...t }));
|
|
947
|
+
}, Ge = (r, i = {}) => {
|
|
948
|
+
const n = r ? P(r) : o, h = P(n), f = $(r), u = f ? o : h;
|
|
949
|
+
if (i.keepDefaultValues || (o = n), !i.keepValues) {
|
|
950
|
+
if (i.keepDirtyValues) {
|
|
966
951
|
const m = /* @__PURE__ */ new Set([
|
|
967
|
-
...
|
|
952
|
+
...c.mount,
|
|
968
953
|
...Object.keys(me(o, l))
|
|
969
954
|
]);
|
|
970
|
-
for (const
|
|
971
|
-
y(t.dirtyFields,
|
|
955
|
+
for (const A of Array.from(m))
|
|
956
|
+
y(t.dirtyFields, A) ? B(u, A, y(l, A)) : W(A, y(u, A));
|
|
972
957
|
} else {
|
|
973
|
-
if (
|
|
974
|
-
for (const m of
|
|
975
|
-
const
|
|
976
|
-
if (
|
|
977
|
-
const
|
|
978
|
-
if (Ce(
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
981
|
-
|
|
958
|
+
if (Pe && L(r))
|
|
959
|
+
for (const m of c.mount) {
|
|
960
|
+
const A = y(a, m);
|
|
961
|
+
if (A && A._f) {
|
|
962
|
+
const E = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
|
|
963
|
+
if (Ce(E)) {
|
|
964
|
+
const te = E.closest("form");
|
|
965
|
+
if (te) {
|
|
966
|
+
te.reset();
|
|
982
967
|
break;
|
|
983
968
|
}
|
|
984
969
|
}
|
|
985
970
|
}
|
|
986
971
|
}
|
|
987
|
-
if (
|
|
988
|
-
for (const m of
|
|
972
|
+
if (i.keepFieldsRef)
|
|
973
|
+
for (const m of c.mount)
|
|
989
974
|
W(m, y(u, m));
|
|
990
975
|
else
|
|
991
|
-
|
|
976
|
+
a = {};
|
|
992
977
|
}
|
|
993
|
-
l = s.shouldUnregister ?
|
|
978
|
+
l = s.shouldUnregister ? i.keepDefaultValues ? P(o) : {} : P(u), g.array.next({
|
|
994
979
|
values: { ...u }
|
|
995
|
-
}),
|
|
980
|
+
}), g.state.next({
|
|
996
981
|
values: { ...u }
|
|
997
982
|
});
|
|
998
983
|
}
|
|
999
|
-
|
|
1000
|
-
mount:
|
|
984
|
+
c = {
|
|
985
|
+
mount: i.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
|
|
1001
986
|
unMount: /* @__PURE__ */ new Set(),
|
|
1002
987
|
array: /* @__PURE__ */ new Set(),
|
|
1003
988
|
disabled: /* @__PURE__ */ new Set(),
|
|
1004
989
|
watch: /* @__PURE__ */ new Set(),
|
|
1005
990
|
watchAll: !1,
|
|
1006
991
|
focus: ""
|
|
1007
|
-
},
|
|
1008
|
-
submitCount:
|
|
1009
|
-
isDirty: f ? !1 :
|
|
1010
|
-
isSubmitted:
|
|
1011
|
-
dirtyFields: f ? {} :
|
|
1012
|
-
touchedFields:
|
|
1013
|
-
errors:
|
|
1014
|
-
isSubmitSuccessful:
|
|
992
|
+
}, d.mount = !_.isValid || !!i.keepIsValid || !!i.keepDirtyValues, d.watch = !!s.shouldUnregister, g.state.next({
|
|
993
|
+
submitCount: i.keepSubmitCount ? t.submitCount : 0,
|
|
994
|
+
isDirty: f ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !le(r, o)),
|
|
995
|
+
isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
|
|
996
|
+
dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && l ? me(o, l) : t.dirtyFields : i.keepDefaultValues && r ? me(o, r) : i.keepDirty ? t.dirtyFields : {},
|
|
997
|
+
touchedFields: i.keepTouched ? t.touchedFields : {},
|
|
998
|
+
errors: i.keepErrors ? t.errors : {},
|
|
999
|
+
isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
1015
1000
|
isSubmitting: !1,
|
|
1016
1001
|
defaultValues: o
|
|
1017
1002
|
});
|
|
1018
|
-
},
|
|
1019
|
-
const n = y(
|
|
1003
|
+
}, Ye = (r, i) => Ge(ie(r) ? r(l) : r, i), St = (r, i = {}) => {
|
|
1004
|
+
const n = y(a, r), h = n && n._f;
|
|
1020
1005
|
if (h) {
|
|
1021
1006
|
const f = h.refs ? h.refs[0] : h.ref;
|
|
1022
|
-
f.focus && (f.focus(),
|
|
1007
|
+
f.focus && (f.focus(), i.shouldSelect && ie(f.select) && f.select());
|
|
1023
1008
|
}
|
|
1024
1009
|
}, Dt = (r) => {
|
|
1025
1010
|
t = {
|
|
1026
1011
|
...t,
|
|
1027
1012
|
...r
|
|
1028
1013
|
};
|
|
1029
|
-
},
|
|
1014
|
+
}, Je = {
|
|
1030
1015
|
control: {
|
|
1031
1016
|
register: Be,
|
|
1032
1017
|
unregister: ve,
|
|
1033
1018
|
getFieldState: Fe,
|
|
1034
|
-
handleSubmit:
|
|
1035
|
-
setError:
|
|
1036
|
-
_subscribe:
|
|
1037
|
-
_runSchema:
|
|
1019
|
+
handleSubmit: je,
|
|
1020
|
+
setError: Ae,
|
|
1021
|
+
_subscribe: ee,
|
|
1022
|
+
_runSchema: H,
|
|
1038
1023
|
_focusError: Te,
|
|
1039
|
-
_getWatch:
|
|
1040
|
-
_getDirty:
|
|
1041
|
-
_setValid:
|
|
1042
|
-
_setFieldArray:
|
|
1043
|
-
_setDisabledField:
|
|
1044
|
-
_setErrors:
|
|
1045
|
-
_getFieldArray:
|
|
1046
|
-
_reset:
|
|
1047
|
-
_resetDefaultValues: () =>
|
|
1048
|
-
|
|
1024
|
+
_getWatch: V,
|
|
1025
|
+
_getDirty: Z,
|
|
1026
|
+
_setValid: p,
|
|
1027
|
+
_setFieldArray: ne,
|
|
1028
|
+
_setDisabledField: Ke,
|
|
1029
|
+
_setErrors: T,
|
|
1030
|
+
_getFieldArray: k,
|
|
1031
|
+
_reset: Ge,
|
|
1032
|
+
_resetDefaultValues: () => ie(s.defaultValues) && s.defaultValues().then((r) => {
|
|
1033
|
+
Ye(r, s.resetOptions), g.state.next({
|
|
1049
1034
|
isLoading: !1
|
|
1050
1035
|
});
|
|
1051
1036
|
}),
|
|
1052
1037
|
_removeUnmounted: G,
|
|
1053
1038
|
_disableForm: wt,
|
|
1054
|
-
_subjects:
|
|
1055
|
-
_proxyFormState:
|
|
1039
|
+
_subjects: g,
|
|
1040
|
+
_proxyFormState: _,
|
|
1056
1041
|
get _fields() {
|
|
1057
|
-
return
|
|
1042
|
+
return a;
|
|
1058
1043
|
},
|
|
1059
1044
|
get _formValues() {
|
|
1060
1045
|
return l;
|
|
1061
1046
|
},
|
|
1062
1047
|
get _state() {
|
|
1063
|
-
return
|
|
1048
|
+
return d;
|
|
1064
1049
|
},
|
|
1065
1050
|
set _state(r) {
|
|
1066
|
-
|
|
1051
|
+
d = r;
|
|
1067
1052
|
},
|
|
1068
1053
|
get _defaultValues() {
|
|
1069
1054
|
return o;
|
|
1070
1055
|
},
|
|
1071
1056
|
get _names() {
|
|
1072
|
-
return
|
|
1057
|
+
return c;
|
|
1073
1058
|
},
|
|
1074
1059
|
set _names(r) {
|
|
1075
|
-
|
|
1060
|
+
c = r;
|
|
1076
1061
|
},
|
|
1077
1062
|
get _formState() {
|
|
1078
1063
|
return t;
|
|
@@ -1090,28 +1075,28 @@ function Vr(e = {}) {
|
|
|
1090
1075
|
subscribe: ge,
|
|
1091
1076
|
trigger: ue,
|
|
1092
1077
|
register: Be,
|
|
1093
|
-
handleSubmit:
|
|
1078
|
+
handleSubmit: je,
|
|
1094
1079
|
watch: _e,
|
|
1095
1080
|
setValue: W,
|
|
1096
1081
|
getValues: ye,
|
|
1097
|
-
reset:
|
|
1082
|
+
reset: Ye,
|
|
1098
1083
|
resetField: Ct,
|
|
1099
1084
|
clearErrors: Ee,
|
|
1100
1085
|
unregister: ve,
|
|
1101
|
-
setError:
|
|
1086
|
+
setError: Ae,
|
|
1102
1087
|
setFocus: St,
|
|
1103
1088
|
getFieldState: Fe
|
|
1104
1089
|
};
|
|
1105
1090
|
return {
|
|
1106
|
-
...
|
|
1107
|
-
formControl:
|
|
1091
|
+
...Je,
|
|
1092
|
+
formControl: Je
|
|
1108
1093
|
};
|
|
1109
1094
|
}
|
|
1110
|
-
function
|
|
1111
|
-
const s =
|
|
1095
|
+
function xr(e = {}) {
|
|
1096
|
+
const s = b.useRef(void 0), t = b.useRef(void 0), [a, o] = b.useState({
|
|
1112
1097
|
isDirty: !1,
|
|
1113
1098
|
isValidating: !1,
|
|
1114
|
-
isLoading:
|
|
1099
|
+
isLoading: ie(e.defaultValues),
|
|
1115
1100
|
isSubmitted: !1,
|
|
1116
1101
|
isSubmitting: !1,
|
|
1117
1102
|
isSubmitSuccessful: !1,
|
|
@@ -1123,211 +1108,211 @@ function kr(e = {}) {
|
|
|
1123
1108
|
errors: e.errors || {},
|
|
1124
1109
|
disabled: e.disabled || !1,
|
|
1125
1110
|
isReady: !1,
|
|
1126
|
-
defaultValues:
|
|
1111
|
+
defaultValues: ie(e.defaultValues) ? void 0 : e.defaultValues
|
|
1127
1112
|
});
|
|
1128
1113
|
if (!s.current)
|
|
1129
1114
|
if (e.formControl)
|
|
1130
1115
|
s.current = {
|
|
1131
1116
|
...e.formControl,
|
|
1132
|
-
formState:
|
|
1133
|
-
}, e.defaultValues && !
|
|
1117
|
+
formState: a
|
|
1118
|
+
}, e.defaultValues && !ie(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
1134
1119
|
else {
|
|
1135
|
-
const { formControl:
|
|
1120
|
+
const { formControl: d, ...c } = Vr(e);
|
|
1136
1121
|
s.current = {
|
|
1137
|
-
...
|
|
1138
|
-
formState:
|
|
1122
|
+
...c,
|
|
1123
|
+
formState: a
|
|
1139
1124
|
};
|
|
1140
1125
|
}
|
|
1141
1126
|
const l = s.current.control;
|
|
1142
|
-
return l._options = e,
|
|
1143
|
-
const
|
|
1127
|
+
return l._options = e, He(() => {
|
|
1128
|
+
const d = l._subscribe({
|
|
1144
1129
|
formState: l._proxyFormState,
|
|
1145
1130
|
callback: () => o({ ...l._formState }),
|
|
1146
1131
|
reRenderRoot: !0
|
|
1147
1132
|
});
|
|
1148
|
-
return o((
|
|
1149
|
-
...
|
|
1133
|
+
return o((c) => ({
|
|
1134
|
+
...c,
|
|
1150
1135
|
isReady: !0
|
|
1151
|
-
})), l._formState.isReady = !0,
|
|
1152
|
-
}, [l]),
|
|
1136
|
+
})), l._formState.isReady = !0, d;
|
|
1137
|
+
}, [l]), b.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), b.useEffect(() => {
|
|
1153
1138
|
e.mode && (l._options.mode = e.mode), e.reValidateMode && (l._options.reValidateMode = e.reValidateMode);
|
|
1154
|
-
}, [l, e.mode, e.reValidateMode]),
|
|
1139
|
+
}, [l, e.mode, e.reValidateMode]), b.useEffect(() => {
|
|
1155
1140
|
e.errors && (l._setErrors(e.errors), l._focusError());
|
|
1156
|
-
}, [l, e.errors]),
|
|
1141
|
+
}, [l, e.errors]), b.useEffect(() => {
|
|
1157
1142
|
e.shouldUnregister && l._subjects.state.next({
|
|
1158
1143
|
values: l._getWatch()
|
|
1159
1144
|
});
|
|
1160
|
-
}, [l, e.shouldUnregister]),
|
|
1145
|
+
}, [l, e.shouldUnregister]), b.useEffect(() => {
|
|
1161
1146
|
if (l._proxyFormState.isDirty) {
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
isDirty:
|
|
1147
|
+
const d = l._getDirty();
|
|
1148
|
+
d !== a.isDirty && l._subjects.state.next({
|
|
1149
|
+
isDirty: d
|
|
1165
1150
|
});
|
|
1166
1151
|
}
|
|
1167
|
-
}, [l,
|
|
1168
|
-
e.values && !
|
|
1152
|
+
}, [l, a.isDirty]), b.useEffect(() => {
|
|
1153
|
+
e.values && !le(e.values, t.current) ? (l._reset(e.values, {
|
|
1169
1154
|
keepFieldsRef: !0,
|
|
1170
1155
|
...l._options.resetOptions
|
|
1171
|
-
}), t.current = e.values, o((
|
|
1172
|
-
}, [l, e.values]),
|
|
1156
|
+
}), t.current = e.values, o((d) => ({ ...d }))) : l._resetDefaultValues();
|
|
1157
|
+
}, [l, e.values]), b.useEffect(() => {
|
|
1173
1158
|
l._state.mount || (l._setValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
|
|
1174
|
-
}), s.current.formState =
|
|
1159
|
+
}), s.current.formState = vt(a, l), s.current;
|
|
1175
1160
|
}
|
|
1176
|
-
const
|
|
1161
|
+
const kr = Nt.bind(I), Fr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Nr = ({
|
|
1177
1162
|
isFormOpen: e,
|
|
1178
1163
|
setIsFormOpen: s,
|
|
1179
1164
|
isNews: t,
|
|
1180
|
-
title:
|
|
1165
|
+
title: a,
|
|
1181
1166
|
isEmail: o,
|
|
1182
1167
|
isPhone: l,
|
|
1183
|
-
isTextArea:
|
|
1184
|
-
telegramLink:
|
|
1185
|
-
isRequiredPhone:
|
|
1186
|
-
isRequiredEmail:
|
|
1187
|
-
isRequiredPhoneOrEmail:
|
|
1168
|
+
isTextArea: d,
|
|
1169
|
+
telegramLink: c = "https://t.me/stone_developer",
|
|
1170
|
+
isRequiredPhone: S = !0,
|
|
1171
|
+
isRequiredEmail: D = !1,
|
|
1172
|
+
isRequiredPhoneOrEmail: _,
|
|
1188
1173
|
textAreaPlaceholder: x,
|
|
1189
|
-
subTitle:
|
|
1190
|
-
submitHandler:
|
|
1174
|
+
subTitle: g,
|
|
1175
|
+
submitHandler: j,
|
|
1191
1176
|
modalWidth: q = "442px",
|
|
1192
|
-
rowsTextArea:
|
|
1177
|
+
rowsTextArea: p = 2,
|
|
1193
1178
|
advCheckBox: M = { text: Fr, isRequired: !0 },
|
|
1194
|
-
isAdvCheckBox:
|
|
1195
|
-
addTitleClassName:
|
|
1196
|
-
createPortalObj:
|
|
1197
|
-
telegramClickHandler:
|
|
1198
|
-
blurHandler:
|
|
1199
|
-
handlerButton:
|
|
1200
|
-
block_name:
|
|
1201
|
-
emitCheckBox:
|
|
1202
|
-
emitAdvCheckBox:
|
|
1179
|
+
isAdvCheckBox: ne,
|
|
1180
|
+
addTitleClassName: v,
|
|
1181
|
+
createPortalObj: T,
|
|
1182
|
+
telegramClickHandler: U = () => null,
|
|
1183
|
+
blurHandler: w,
|
|
1184
|
+
handlerButton: X,
|
|
1185
|
+
block_name: H,
|
|
1186
|
+
emitCheckBox: re,
|
|
1187
|
+
emitAdvCheckBox: z
|
|
1203
1188
|
}) => {
|
|
1204
1189
|
const {
|
|
1205
1190
|
register: G,
|
|
1206
|
-
handleSubmit:
|
|
1207
|
-
reset:
|
|
1208
|
-
control:
|
|
1209
|
-
watch:
|
|
1210
|
-
formState: { errors:
|
|
1211
|
-
} =
|
|
1212
|
-
|
|
1213
|
-
typeof Y < "u" &&
|
|
1214
|
-
}, [
|
|
1215
|
-
typeof oe < "u" &&
|
|
1216
|
-
}, [
|
|
1217
|
-
const { isMobile: ue, currentClientWidth: ye } = Ut(), Fe =
|
|
1218
|
-
|
|
1219
|
-
}, _e = (
|
|
1220
|
-
|
|
1221
|
-
e:
|
|
1222
|
-
analyticParams: { action_element: ve, action_element_status: ge, block_name:
|
|
1191
|
+
handleSubmit: Z,
|
|
1192
|
+
reset: V,
|
|
1193
|
+
control: k,
|
|
1194
|
+
watch: C,
|
|
1195
|
+
formState: { errors: F }
|
|
1196
|
+
} = xr(), W = !!C("email"), Y = C("personalCheckBox"), oe = C("advCheckBox");
|
|
1197
|
+
Ze(() => {
|
|
1198
|
+
typeof Y < "u" && re && re();
|
|
1199
|
+
}, [re, Y]), Ze(() => {
|
|
1200
|
+
typeof oe < "u" && z && z();
|
|
1201
|
+
}, [z, oe]);
|
|
1202
|
+
const { isMobile: ue, currentClientWidth: ye } = Ut(), Fe = C("personalCheckBox"), Ee = C("advCheckBox"), Ae = (ee) => {
|
|
1203
|
+
j(ee), V();
|
|
1204
|
+
}, _e = (ee, { action_element_status: ge, action_element: ve }) => {
|
|
1205
|
+
w && w({
|
|
1206
|
+
e: ee,
|
|
1207
|
+
analyticParams: { action_element: ve, action_element_status: ge, block_name: H }
|
|
1223
1208
|
});
|
|
1224
1209
|
};
|
|
1225
|
-
return ye ? /* @__PURE__ */
|
|
1210
|
+
return ye ? /* @__PURE__ */ R(
|
|
1226
1211
|
Pt,
|
|
1227
1212
|
{
|
|
1228
1213
|
additionalClass: I.modal,
|
|
1229
1214
|
additionalClassModalBody: I.modalBody,
|
|
1230
|
-
createPortalObj:
|
|
1215
|
+
createPortalObj: T,
|
|
1231
1216
|
isOpen: e,
|
|
1232
1217
|
isTransparentBack: !0,
|
|
1233
1218
|
emitIsOpen: () => s(!1),
|
|
1234
1219
|
opacity: 0.7,
|
|
1235
|
-
children: /* @__PURE__ */
|
|
1220
|
+
children: /* @__PURE__ */ ce(
|
|
1236
1221
|
"div",
|
|
1237
1222
|
{
|
|
1238
1223
|
className: I.root,
|
|
1239
1224
|
style: { width: ue ? "100%" : q },
|
|
1240
1225
|
"data-testid": "modal_window",
|
|
1241
1226
|
children: [
|
|
1242
|
-
/* @__PURE__ */
|
|
1227
|
+
/* @__PURE__ */ R(
|
|
1243
1228
|
"div",
|
|
1244
1229
|
{
|
|
1245
|
-
className:
|
|
1246
|
-
dangerouslySetInnerHTML: { __html:
|
|
1230
|
+
className: kr(I.title, v),
|
|
1231
|
+
dangerouslySetInnerHTML: { __html: a ?? "Оставить обращение" }
|
|
1247
1232
|
}
|
|
1248
1233
|
),
|
|
1249
|
-
t && /* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1234
|
+
t && /* @__PURE__ */ ce("div", { className: I.telegramWrapper, children: [
|
|
1235
|
+
/* @__PURE__ */ R(
|
|
1251
1236
|
"a",
|
|
1252
1237
|
{
|
|
1253
1238
|
className: I.telegramLink,
|
|
1254
|
-
href:
|
|
1239
|
+
href: c,
|
|
1255
1240
|
target: "_blank",
|
|
1256
1241
|
"data-testid": "modal_telegram_link",
|
|
1257
|
-
children: /* @__PURE__ */
|
|
1242
|
+
children: /* @__PURE__ */ ce(
|
|
1258
1243
|
"div",
|
|
1259
1244
|
{
|
|
1260
1245
|
className: I.telegram,
|
|
1261
|
-
onClick:
|
|
1246
|
+
onClick: U,
|
|
1262
1247
|
children: [
|
|
1263
|
-
/* @__PURE__ */
|
|
1264
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ R("div", { children: "Подписаться в Telegram" }),
|
|
1249
|
+
/* @__PURE__ */ R(et, { name: "telegram" })
|
|
1265
1250
|
]
|
|
1266
1251
|
}
|
|
1267
1252
|
)
|
|
1268
1253
|
}
|
|
1269
1254
|
),
|
|
1270
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ R("div", { className: I.orText, children: "или" })
|
|
1271
1256
|
] }),
|
|
1272
|
-
!t && /* @__PURE__ */
|
|
1257
|
+
!t && /* @__PURE__ */ R(
|
|
1273
1258
|
"div",
|
|
1274
1259
|
{
|
|
1275
1260
|
className: I.description,
|
|
1276
1261
|
dangerouslySetInnerHTML: {
|
|
1277
|
-
__html:
|
|
1262
|
+
__html: g && !t ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ R("div", { children: "привет" })}`
|
|
1278
1263
|
}
|
|
1279
1264
|
}
|
|
1280
1265
|
),
|
|
1281
|
-
/* @__PURE__ */
|
|
1282
|
-
/* @__PURE__ */
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
|
|
1266
|
+
/* @__PURE__ */ ce("form", { onSubmit: Z(Ae), children: [
|
|
1267
|
+
/* @__PURE__ */ ce(It, { className: I.inputWrapper, children: [
|
|
1268
|
+
/* @__PURE__ */ R(
|
|
1269
|
+
Re,
|
|
1285
1270
|
{
|
|
1286
1271
|
width: "full",
|
|
1287
1272
|
size_s: "large",
|
|
1288
1273
|
variant: "light",
|
|
1289
1274
|
placeholder: "Введите имя",
|
|
1290
1275
|
"data-testid": "modal_name",
|
|
1291
|
-
...G("name", { required: !0, pattern:
|
|
1292
|
-
onBlur: (
|
|
1293
|
-
action_element_status:
|
|
1294
|
-
action_element: `input_${
|
|
1276
|
+
...G("name", { required: !0, pattern: Lt }),
|
|
1277
|
+
onBlur: (ee) => _e(ee, {
|
|
1278
|
+
action_element_status: F.name ? "error" : "success",
|
|
1279
|
+
action_element: `input_${H}_name`
|
|
1295
1280
|
}),
|
|
1296
|
-
error: !!
|
|
1281
|
+
error: !!F.name
|
|
1297
1282
|
}
|
|
1298
1283
|
),
|
|
1299
|
-
l && /* @__PURE__ */
|
|
1284
|
+
l && /* @__PURE__ */ R(
|
|
1300
1285
|
ar,
|
|
1301
1286
|
{
|
|
1302
1287
|
name: "phone",
|
|
1303
|
-
control:
|
|
1288
|
+
control: k,
|
|
1304
1289
|
rules: {
|
|
1305
|
-
required:
|
|
1306
|
-
pattern: { value:
|
|
1290
|
+
required: D || S || _ && !W,
|
|
1291
|
+
pattern: { value: Mt, message: "" }
|
|
1307
1292
|
},
|
|
1308
1293
|
defaultValue: "",
|
|
1309
|
-
render: ({ field:
|
|
1310
|
-
|
|
1294
|
+
render: ({ field: ee }) => /* @__PURE__ */ R(
|
|
1295
|
+
Re,
|
|
1311
1296
|
{
|
|
1312
1297
|
inputMode: "numeric",
|
|
1313
1298
|
isPhoneIMask: !0,
|
|
1314
|
-
...
|
|
1299
|
+
...ee,
|
|
1315
1300
|
width: "full",
|
|
1316
1301
|
"data-testid": "phone_modal",
|
|
1317
1302
|
type: "tel",
|
|
1318
|
-
error: !!
|
|
1303
|
+
error: !!F.phone,
|
|
1319
1304
|
size_s: "large",
|
|
1320
1305
|
variant: "light",
|
|
1321
1306
|
onBlur: (ge) => _e(ge, {
|
|
1322
|
-
action_element_status:
|
|
1323
|
-
action_element: `input_${
|
|
1307
|
+
action_element_status: F.phone ? "error" : "success",
|
|
1308
|
+
action_element: `input_${H}_phone`
|
|
1324
1309
|
})
|
|
1325
1310
|
}
|
|
1326
1311
|
)
|
|
1327
1312
|
}
|
|
1328
1313
|
),
|
|
1329
|
-
o && /* @__PURE__ */
|
|
1330
|
-
|
|
1314
|
+
o && /* @__PURE__ */ R(
|
|
1315
|
+
Re,
|
|
1331
1316
|
{
|
|
1332
1317
|
width: "full",
|
|
1333
1318
|
size_s: "large",
|
|
@@ -1335,48 +1320,48 @@ const xr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1335
1320
|
placeholder: "Введите email",
|
|
1336
1321
|
"data-testid": "modal_email",
|
|
1337
1322
|
...G("email", {
|
|
1338
|
-
required:
|
|
1339
|
-
pattern:
|
|
1323
|
+
required: D || _ && !W,
|
|
1324
|
+
pattern: Rt
|
|
1340
1325
|
}),
|
|
1341
|
-
error: !!
|
|
1342
|
-
onBlur: (
|
|
1343
|
-
action_element_status:
|
|
1344
|
-
action_element: `input_${
|
|
1326
|
+
error: !!F.email,
|
|
1327
|
+
onBlur: (ee) => _e(ee, {
|
|
1328
|
+
action_element_status: F.email ? "error" : "success",
|
|
1329
|
+
action_element: `input_${H}_email`
|
|
1345
1330
|
})
|
|
1346
1331
|
}
|
|
1347
1332
|
),
|
|
1348
|
-
|
|
1333
|
+
d && /* @__PURE__ */ R(
|
|
1349
1334
|
Ot,
|
|
1350
1335
|
{
|
|
1351
1336
|
"data-testid": "modal_textarea",
|
|
1352
1337
|
placeholder: x,
|
|
1353
|
-
rows:
|
|
1338
|
+
rows: p,
|
|
1354
1339
|
width: "full",
|
|
1355
1340
|
...G("textarea")
|
|
1356
1341
|
}
|
|
1357
1342
|
),
|
|
1358
|
-
M && !t &&
|
|
1359
|
-
|
|
1343
|
+
M && !t && ne && /* @__PURE__ */ R(
|
|
1344
|
+
tt,
|
|
1360
1345
|
{
|
|
1361
1346
|
"data-testid": "modal_advCheckBox",
|
|
1362
1347
|
isChecked: Ee,
|
|
1363
|
-
error: !!
|
|
1348
|
+
error: !!F.advCheckBox,
|
|
1364
1349
|
text: M.text,
|
|
1365
1350
|
...G("advCheckBox", { required: M?.isRequired })
|
|
1366
1351
|
}
|
|
1367
1352
|
),
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
|
|
1353
|
+
/* @__PURE__ */ ce(
|
|
1354
|
+
tt,
|
|
1370
1355
|
{
|
|
1371
1356
|
"data-testid": "modal_personalCheckBox",
|
|
1372
1357
|
isChecked: Fe,
|
|
1373
|
-
error: !!
|
|
1358
|
+
error: !!F.personalCheckBox,
|
|
1374
1359
|
...G("personalCheckBox", { required: !t }),
|
|
1375
1360
|
children: [
|
|
1376
|
-
t && /* @__PURE__ */
|
|
1361
|
+
t && /* @__PURE__ */ ce("div", { className: I.checkboxText, children: [
|
|
1377
1362
|
"Согласен(-на)",
|
|
1378
1363
|
" ",
|
|
1379
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ R(
|
|
1380
1365
|
"a",
|
|
1381
1366
|
{
|
|
1382
1367
|
className: I.linkPolicy,
|
|
@@ -1387,19 +1372,19 @@ const xr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1387
1372
|
" ",
|
|
1388
1373
|
"от Stone"
|
|
1389
1374
|
] }),
|
|
1390
|
-
!t && /* @__PURE__ */
|
|
1375
|
+
!t && /* @__PURE__ */ ce("div", { className: I.checkboxText, children: [
|
|
1391
1376
|
"Я принимаю условия",
|
|
1392
1377
|
" ",
|
|
1393
|
-
/* @__PURE__ */
|
|
1378
|
+
/* @__PURE__ */ R("a", { className: I.linkPolicy, href: "/documents/politika-konfidenczialnosti", children: "Политики обработки и защиты персональных данных" }),
|
|
1394
1379
|
", даю",
|
|
1395
1380
|
" ",
|
|
1396
|
-
/* @__PURE__ */
|
|
1381
|
+
/* @__PURE__ */ R("a", { className: I.linkPolicy, href: "/documents/docs", children: "согласие на обработку персональных данных" })
|
|
1397
1382
|
] })
|
|
1398
1383
|
]
|
|
1399
1384
|
}
|
|
1400
1385
|
),
|
|
1401
|
-
/* @__PURE__ */
|
|
1402
|
-
|
|
1386
|
+
/* @__PURE__ */ R(
|
|
1387
|
+
rt,
|
|
1403
1388
|
{
|
|
1404
1389
|
"data-testid": "modal_submit",
|
|
1405
1390
|
variant: "blue",
|
|
@@ -1409,15 +1394,15 @@ const xr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1409
1394
|
as: "button",
|
|
1410
1395
|
additionalClass: I.modalBtn,
|
|
1411
1396
|
onClick: () => {
|
|
1412
|
-
|
|
1397
|
+
X && X();
|
|
1413
1398
|
},
|
|
1414
|
-
disabled: !!
|
|
1399
|
+
disabled: !!F.name || !!F.phone && S || !!F.email && D || !!F.advCheckBox && M?.isRequired || !!F.personalCheckBox && !t,
|
|
1415
1400
|
children: "Отправить запрос"
|
|
1416
1401
|
}
|
|
1417
1402
|
)
|
|
1418
1403
|
] }),
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
|
|
1404
|
+
/* @__PURE__ */ R(
|
|
1405
|
+
rt,
|
|
1421
1406
|
{
|
|
1422
1407
|
additionalClass: I.btn,
|
|
1423
1408
|
onClick: () => s(!1),
|
|
@@ -1425,8 +1410,8 @@ const xr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1425
1410
|
variant: "gray",
|
|
1426
1411
|
type: "button",
|
|
1427
1412
|
size: "small",
|
|
1428
|
-
children: /* @__PURE__ */
|
|
1429
|
-
|
|
1413
|
+
children: /* @__PURE__ */ R(
|
|
1414
|
+
et,
|
|
1430
1415
|
{
|
|
1431
1416
|
name: "close",
|
|
1432
1417
|
size: "16",
|