md-components-mdigial-azamat 0.0.56 → 0.0.57
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/AllComponents.js +76 -69
- package/dist/AnimatedSwiper/info.js +1 -1
- package/dist/Banner/info.js +1 -1
- package/dist/BannerAndText/info.js +1 -1
- package/dist/CardIconList/info.js +1 -1
- package/dist/CardImageList/info.js +1 -1
- package/dist/CardImageSecondary/info.js +1 -1
- package/dist/CardImageSecondaryList/info.js +1 -1
- package/dist/CardInfoTable/info.js +1 -1
- package/dist/Cards/CardImage/info.js +1 -1
- package/dist/Cards/ColoredCard/info.js +1 -1
- package/dist/Cards/ContentCard/info.js +1 -1
- package/dist/Cards/FeaturesCard/info.js +1 -1
- package/dist/Cards/WarningCard/info.js +1 -1
- package/dist/ContentCardList/info.js +1 -1
- package/dist/DownloadFile/components/DownloadFileBanner/info.js +1 -1
- package/dist/DownloadFile/components/DownloadFileBright/info.js +1 -1
- package/dist/DownloadFile/components/DownloadFileFull/info.js +1 -1
- package/dist/DownloadFile/components/DownloadFileHalf/DownloadFileHalf.js +21 -19
- package/dist/DownloadFile/components/DownloadFileHalf/info.js +1 -1
- package/dist/DownloadFile/components/DownloadFileMini/info.js +1 -1
- package/dist/Faq/components/FeedbackForm/FeedbackForm.js +37 -1043
- package/dist/Faq/info.js +1 -1
- package/dist/Footer/info.js +1 -1
- package/dist/Forms/FormDefault/index.js +316 -0
- package/dist/Forms/FormDefault/info.js +20 -0
- package/dist/Header/info.js +1 -1
- package/dist/HeroPossibilityBanner/info.js +1 -1
- package/dist/InfoBanner/info.js +1 -1
- package/dist/InfoBannerList/info.js +1 -1
- package/dist/InstructionList/info.js +1 -1
- package/dist/IntroBanner/info.js +1 -1
- package/dist/MainBanner/info.js +1 -1
- package/dist/MultiCards/info.js +1 -1
- package/dist/Partners/info.js +1 -1
- package/dist/PartnersColors/info.js +1 -1
- package/dist/PreviewList/info.js +1 -1
- package/dist/PromoPoster/info.js +1 -1
- package/dist/Segments/info.js +1 -1
- package/dist/Space/info.js +1 -1
- package/dist/StandartTable/info.js +1 -1
- package/dist/Stepper/info.js +1 -1
- package/dist/SwiperList/info.js +1 -1
- package/dist/TasksBanner/info.js +1 -1
- package/dist/TasksBannerList/info.js +1 -1
- package/dist/Video/VideoFull/info.js +1 -1
- package/dist/Video/VideoList/info.js +1 -1
- package/dist/Video/VideoListMini/info.js +1 -1
- package/dist/VideoMainBanner/info.js +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/{index-1a32da94.js → index-b826f1c7.js} +1 -1
- package/dist/index.esm-67811428.js +1012 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
import I from "react";
|
|
2
|
+
var de = (e) => e.type === "checkbox", re = (e) => e instanceof Date, N = (e) => e == null;
|
|
3
|
+
const tt = (e) => typeof e == "object";
|
|
4
|
+
var S = (e) => !N(e) && !Array.isArray(e) && tt(e) && !re(e), Vt = (e) => S(e) && e.target ? de(e.target) ? e.target.checked : e.target.value : e, Ft = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, At = (e, s) => e.has(Ft(s)), mt = (e) => {
|
|
5
|
+
const s = e.constructor && e.constructor.prototype;
|
|
6
|
+
return S(s) && s.hasOwnProperty("isPrototypeOf");
|
|
7
|
+
}, Se = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
8
|
+
function C(e) {
|
|
9
|
+
let s;
|
|
10
|
+
const r = Array.isArray(e), a = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
11
|
+
if (e instanceof Date)
|
|
12
|
+
s = new Date(e);
|
|
13
|
+
else if (!(Se && (e instanceof Blob || a)) && (r || S(e)))
|
|
14
|
+
if (s = r ? [] : Object.create(Object.getPrototypeOf(e)), !r && !mt(e))
|
|
15
|
+
s = e;
|
|
16
|
+
else
|
|
17
|
+
for (const u in e)
|
|
18
|
+
e.hasOwnProperty(u) && (s[u] = C(e[u]));
|
|
19
|
+
else
|
|
20
|
+
return e;
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
var be = (e) => /^\w*$/.test(e), D = (e) => e === void 0, Oe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Te = (e) => Oe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), h = (e, s, r) => {
|
|
24
|
+
if (!s || !S(e))
|
|
25
|
+
return r;
|
|
26
|
+
const a = (be(s) ? [s] : Te(s)).reduce((u, n) => N(u) ? u : u[n], e);
|
|
27
|
+
return D(a) || a === e ? D(e[s]) ? r : e[s] : a;
|
|
28
|
+
}, Y = (e) => typeof e == "boolean", x = (e, s, r) => {
|
|
29
|
+
let a = -1;
|
|
30
|
+
const u = be(s) ? [s] : Te(s), n = u.length, d = n - 1;
|
|
31
|
+
for (; ++a < n; ) {
|
|
32
|
+
const y = u[a];
|
|
33
|
+
let U = r;
|
|
34
|
+
if (a !== d) {
|
|
35
|
+
const p = e[y];
|
|
36
|
+
U = S(p) || Array.isArray(p) ? p : isNaN(+u[a + 1]) ? {} : [];
|
|
37
|
+
}
|
|
38
|
+
if (y === "__proto__" || y === "constructor" || y === "prototype")
|
|
39
|
+
return;
|
|
40
|
+
e[y] = U, e = e[y];
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const pe = {
|
|
44
|
+
BLUR: "blur",
|
|
45
|
+
FOCUS_OUT: "focusout",
|
|
46
|
+
CHANGE: "change"
|
|
47
|
+
}, W = {
|
|
48
|
+
onBlur: "onBlur",
|
|
49
|
+
onChange: "onChange",
|
|
50
|
+
onSubmit: "onSubmit",
|
|
51
|
+
onTouched: "onTouched",
|
|
52
|
+
all: "all"
|
|
53
|
+
}, G = {
|
|
54
|
+
max: "max",
|
|
55
|
+
min: "min",
|
|
56
|
+
maxLength: "maxLength",
|
|
57
|
+
minLength: "minLength",
|
|
58
|
+
pattern: "pattern",
|
|
59
|
+
required: "required",
|
|
60
|
+
validate: "validate"
|
|
61
|
+
}, rt = I.createContext(null);
|
|
62
|
+
rt.displayName = "HookFormContext";
|
|
63
|
+
const pt = (e) => {
|
|
64
|
+
const { children: s, ...r } = e;
|
|
65
|
+
return I.createElement(rt.Provider, { value: r }, s);
|
|
66
|
+
};
|
|
67
|
+
var xt = (e, s, r, a = !0) => {
|
|
68
|
+
const u = {
|
|
69
|
+
defaultValues: s._defaultValues
|
|
70
|
+
};
|
|
71
|
+
for (const n in e)
|
|
72
|
+
Object.defineProperty(u, n, {
|
|
73
|
+
get: () => {
|
|
74
|
+
const d = n;
|
|
75
|
+
return s._proxyFormState[d] !== W.all && (s._proxyFormState[d] = !a || W.all), r && (r[d] = !0), e[d];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return u;
|
|
79
|
+
};
|
|
80
|
+
const wt = typeof window < "u" ? I.useLayoutEffect : I.useEffect;
|
|
81
|
+
var B = (e) => typeof e == "string", Dt = (e, s, r, a, u) => B(e) ? (a && s.watch.add(e), h(r, e, u)) : Array.isArray(e) ? e.map((n) => (a && s.watch.add(n), h(r, n))) : (a && (s.watchAll = !0), r), ke = (e) => N(e) || !tt(e);
|
|
82
|
+
function ee(e, s, r = /* @__PURE__ */ new WeakSet()) {
|
|
83
|
+
if (ke(e) || ke(s))
|
|
84
|
+
return Object.is(e, s);
|
|
85
|
+
if (re(e) && re(s))
|
|
86
|
+
return e.getTime() === s.getTime();
|
|
87
|
+
const a = Object.keys(e), u = Object.keys(s);
|
|
88
|
+
if (a.length !== u.length)
|
|
89
|
+
return !1;
|
|
90
|
+
if (r.has(e) || r.has(s))
|
|
91
|
+
return !0;
|
|
92
|
+
r.add(e), r.add(s);
|
|
93
|
+
for (const n of a) {
|
|
94
|
+
const d = e[n];
|
|
95
|
+
if (!u.includes(n))
|
|
96
|
+
return !1;
|
|
97
|
+
if (n !== "ref") {
|
|
98
|
+
const y = s[n];
|
|
99
|
+
if (re(d) && re(y) || S(d) && S(y) || Array.isArray(d) && Array.isArray(y) ? !ee(d, y, r) : !Object.is(d, y))
|
|
100
|
+
return !1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return !0;
|
|
104
|
+
}
|
|
105
|
+
var kt = (e, s, r, a, u) => s ? {
|
|
106
|
+
...r[e],
|
|
107
|
+
types: {
|
|
108
|
+
...r[e] && r[e].types ? r[e].types : {},
|
|
109
|
+
[a]: u || !0
|
|
110
|
+
}
|
|
111
|
+
} : {}, oe = (e) => Array.isArray(e) ? e : [e], $e = () => {
|
|
112
|
+
let e = [];
|
|
113
|
+
return {
|
|
114
|
+
get observers() {
|
|
115
|
+
return e;
|
|
116
|
+
},
|
|
117
|
+
next: (u) => {
|
|
118
|
+
for (const n of e)
|
|
119
|
+
n.next && n.next(u);
|
|
120
|
+
},
|
|
121
|
+
subscribe: (u) => (e.push(u), {
|
|
122
|
+
unsubscribe: () => {
|
|
123
|
+
e = e.filter((n) => n !== u);
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
unsubscribe: () => {
|
|
127
|
+
e = [];
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
function st(e, s) {
|
|
132
|
+
const r = {};
|
|
133
|
+
for (const a in e)
|
|
134
|
+
if (e.hasOwnProperty(a)) {
|
|
135
|
+
const u = e[a], n = s[a];
|
|
136
|
+
if (u && S(u) && n) {
|
|
137
|
+
const d = st(u, n);
|
|
138
|
+
S(d) && (r[a] = d);
|
|
139
|
+
} else
|
|
140
|
+
e[a] && (r[a] = n);
|
|
141
|
+
}
|
|
142
|
+
return r;
|
|
143
|
+
}
|
|
144
|
+
var R = (e) => S(e) && !Object.keys(e).length, Ce = (e) => e.type === "file", H = (e) => typeof e == "function", ge = (e) => {
|
|
145
|
+
if (!Se)
|
|
146
|
+
return !1;
|
|
147
|
+
const s = e ? e.ownerDocument : 0;
|
|
148
|
+
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
149
|
+
}, it = (e) => e.type === "select-multiple", Le = (e) => e.type === "radio", Et = (e) => Le(e) || de(e), De = (e) => ge(e) && e.isConnected;
|
|
150
|
+
function St(e, s) {
|
|
151
|
+
const r = s.slice(0, -1).length;
|
|
152
|
+
let a = 0;
|
|
153
|
+
for (; a < r; )
|
|
154
|
+
e = D(e) ? a++ : e[s[a++]];
|
|
155
|
+
return e;
|
|
156
|
+
}
|
|
157
|
+
function Ot(e) {
|
|
158
|
+
for (const s in e)
|
|
159
|
+
if (e.hasOwnProperty(s) && !D(e[s]))
|
|
160
|
+
return !1;
|
|
161
|
+
return !0;
|
|
162
|
+
}
|
|
163
|
+
function E(e, s) {
|
|
164
|
+
const r = Array.isArray(s) ? s : be(s) ? [s] : Te(s), a = r.length === 1 ? e : St(e, r), u = r.length - 1, n = r[u];
|
|
165
|
+
return a && delete a[n], u !== 0 && (S(a) && R(a) || Array.isArray(a) && Ot(a)) && E(e, r.slice(0, -1)), e;
|
|
166
|
+
}
|
|
167
|
+
var Tt = (e) => {
|
|
168
|
+
for (const s in e)
|
|
169
|
+
if (H(e[s]))
|
|
170
|
+
return !0;
|
|
171
|
+
return !1;
|
|
172
|
+
};
|
|
173
|
+
function at(e) {
|
|
174
|
+
return Array.isArray(e) || S(e) && !Tt(e);
|
|
175
|
+
}
|
|
176
|
+
function Ee(e, s = {}) {
|
|
177
|
+
for (const r in e) {
|
|
178
|
+
const a = e[r];
|
|
179
|
+
at(a) ? (s[r] = Array.isArray(a) ? [] : {}, Ee(a, s[r])) : D(a) || (s[r] = !0);
|
|
180
|
+
}
|
|
181
|
+
return s;
|
|
182
|
+
}
|
|
183
|
+
function ae(e, s, r) {
|
|
184
|
+
r || (r = Ee(s));
|
|
185
|
+
for (const a in e) {
|
|
186
|
+
const u = e[a];
|
|
187
|
+
if (at(u))
|
|
188
|
+
D(s) || ke(r[a]) ? r[a] = Ee(u, Array.isArray(u) ? [] : {}) : ae(u, N(s) ? {} : s[a], r[a]);
|
|
189
|
+
else {
|
|
190
|
+
const n = s[a];
|
|
191
|
+
r[a] = !ee(u, n);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return r;
|
|
195
|
+
}
|
|
196
|
+
const Ke = {
|
|
197
|
+
value: !1,
|
|
198
|
+
isValid: !1
|
|
199
|
+
}, ze = { value: !0, isValid: !0 };
|
|
200
|
+
var lt = (e) => {
|
|
201
|
+
if (Array.isArray(e)) {
|
|
202
|
+
if (e.length > 1) {
|
|
203
|
+
const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
204
|
+
return { value: s, isValid: !!s.length };
|
|
205
|
+
}
|
|
206
|
+
return e[0].checked && !e[0].disabled ? (
|
|
207
|
+
// @ts-expect-error expected to work in the browser
|
|
208
|
+
e[0].attributes && !D(e[0].attributes.value) ? D(e[0].value) || e[0].value === "" ? ze : { value: e[0].value, isValid: !0 } : ze
|
|
209
|
+
) : Ke;
|
|
210
|
+
}
|
|
211
|
+
return Ke;
|
|
212
|
+
}, nt = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: a }) => D(e) ? e : s ? e === "" ? NaN : e && +e : r && B(e) ? new Date(e) : a ? a(e) : e;
|
|
213
|
+
const Ye = {
|
|
214
|
+
isValid: !1,
|
|
215
|
+
value: null
|
|
216
|
+
};
|
|
217
|
+
var ut = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disabled ? {
|
|
218
|
+
isValid: !0,
|
|
219
|
+
value: r.value
|
|
220
|
+
} : s, Ye) : Ye;
|
|
221
|
+
function je(e) {
|
|
222
|
+
const s = e.ref;
|
|
223
|
+
return Ce(s) ? s.files : Le(s) ? ut(e.refs).value : it(s) ? [...s.selectedOptions].map(({ value: r }) => r) : de(s) ? lt(e.refs).value : nt(D(s.value) ? e.ref.value : s.value, e);
|
|
224
|
+
}
|
|
225
|
+
var Ct = (e, s, r, a) => {
|
|
226
|
+
const u = {};
|
|
227
|
+
for (const n of e) {
|
|
228
|
+
const d = h(s, n);
|
|
229
|
+
d && x(u, n, d._f);
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
criteriaMode: r,
|
|
233
|
+
names: [...e],
|
|
234
|
+
fields: u,
|
|
235
|
+
shouldUseNativeValidation: a
|
|
236
|
+
};
|
|
237
|
+
}, ve = (e) => e instanceof RegExp, ue = (e) => D(e) ? e : ve(e) ? e.source : S(e) ? ve(e.value) ? e.value.source : e.value : e, Ge = (e) => ({
|
|
238
|
+
isOnSubmit: !e || e === W.onSubmit,
|
|
239
|
+
isOnBlur: e === W.onBlur,
|
|
240
|
+
isOnChange: e === W.onChange,
|
|
241
|
+
isOnAll: e === W.all,
|
|
242
|
+
isOnTouch: e === W.onTouched
|
|
243
|
+
});
|
|
244
|
+
const Je = "AsyncFunction";
|
|
245
|
+
var Lt = (e) => !!e && !!e.validate && !!(H(e.validate) && e.validate.constructor.name === Je || S(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === Je)), Rt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Qe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((a) => e.startsWith(a) && /^\.\w+/.test(e.slice(a.length))));
|
|
246
|
+
const fe = (e, s, r, a) => {
|
|
247
|
+
for (const u of r || Object.keys(e)) {
|
|
248
|
+
const n = h(e, u);
|
|
249
|
+
if (n) {
|
|
250
|
+
const { _f: d, ...y } = n;
|
|
251
|
+
if (d) {
|
|
252
|
+
if (d.refs && d.refs[0] && s(d.refs[0], u) && !a)
|
|
253
|
+
return !0;
|
|
254
|
+
if (d.ref && s(d.ref, d.name) && !a)
|
|
255
|
+
return !0;
|
|
256
|
+
if (fe(y, s))
|
|
257
|
+
break;
|
|
258
|
+
} else if (S(y) && fe(y, s))
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
function Xe(e, s, r) {
|
|
264
|
+
const a = h(e, r);
|
|
265
|
+
if (a || be(r))
|
|
266
|
+
return {
|
|
267
|
+
error: a,
|
|
268
|
+
name: r
|
|
269
|
+
};
|
|
270
|
+
const u = r.split(".");
|
|
271
|
+
for (; u.length; ) {
|
|
272
|
+
const n = u.join("."), d = h(s, n), y = h(e, n);
|
|
273
|
+
if (d && !Array.isArray(d) && r !== n)
|
|
274
|
+
return { name: r };
|
|
275
|
+
if (y && y.type)
|
|
276
|
+
return {
|
|
277
|
+
name: n,
|
|
278
|
+
error: y
|
|
279
|
+
};
|
|
280
|
+
if (y && y.root && y.root.type)
|
|
281
|
+
return {
|
|
282
|
+
name: `${n}.root`,
|
|
283
|
+
error: y.root
|
|
284
|
+
};
|
|
285
|
+
u.pop();
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
name: r
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
var Ut = (e, s, r, a) => {
|
|
292
|
+
r(e);
|
|
293
|
+
const { name: u, ...n } = e;
|
|
294
|
+
return R(n) || Object.keys(n).length >= Object.keys(s).length || Object.keys(n).find((d) => s[d] === (!a || W.all));
|
|
295
|
+
}, Mt = (e, s, r) => !e || !s || e === s || oe(e).some((a) => a && (r ? a === s : a.startsWith(s) || s.startsWith(a))), It = (e, s, r, a, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? a.isOnBlur : u.isOnBlur) ? !e : (r ? a.isOnChange : u.isOnChange) ? e : !0, Nt = (e, s) => !Oe(h(e, s)).length && E(e, s), Bt = (e, s, r) => {
|
|
296
|
+
const a = oe(h(e, r));
|
|
297
|
+
return x(a, "root", s[r]), x(e, r, a), e;
|
|
298
|
+
};
|
|
299
|
+
function Ze(e, s, r = "validate") {
|
|
300
|
+
if (B(e) || Array.isArray(e) && e.every(B) || Y(e) && !e)
|
|
301
|
+
return {
|
|
302
|
+
type: r,
|
|
303
|
+
message: B(e) ? e : "",
|
|
304
|
+
ref: s
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
var ie = (e) => S(e) && !ve(e) ? e : {
|
|
308
|
+
value: e,
|
|
309
|
+
message: ""
|
|
310
|
+
}, et = async (e, s, r, a, u, n) => {
|
|
311
|
+
const { ref: d, refs: y, required: U, maxLength: p, minLength: m, min: k, max: v, pattern: le, validate: J, name: O, valueAsNumber: Q, mount: _e } = e._f, _ = h(r, O);
|
|
312
|
+
if (!_e || s.has(O))
|
|
313
|
+
return {};
|
|
314
|
+
const j = y ? y[0] : d, $ = (b) => {
|
|
315
|
+
u && j.reportValidity && (j.setCustomValidity(Y(b) ? "" : b || ""), j.reportValidity());
|
|
316
|
+
}, T = {}, ce = Le(d), X = de(d), Ve = ce || X, q = (Q || Ce(d)) && D(d.value) && D(_) || ge(d) && d.value === "" || _ === "" || Array.isArray(_) && !_.length, te = kt.bind(null, O, a, T), K = (b, F, w, L = G.maxLength, M = G.minLength) => {
|
|
317
|
+
const z = b ? F : w;
|
|
318
|
+
T[O] = {
|
|
319
|
+
type: b ? L : M,
|
|
320
|
+
message: z,
|
|
321
|
+
ref: d,
|
|
322
|
+
...te(b ? L : M, z)
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
if (n ? !Array.isArray(_) || !_.length : U && (!Ve && (q || N(_)) || Y(_) && !_ || X && !lt(y).isValid || ce && !ut(y).isValid)) {
|
|
326
|
+
const { value: b, message: F } = B(U) ? { value: !!U, message: U } : ie(U);
|
|
327
|
+
if (b && (T[O] = {
|
|
328
|
+
type: G.required,
|
|
329
|
+
message: F,
|
|
330
|
+
ref: j,
|
|
331
|
+
...te(G.required, F)
|
|
332
|
+
}, !a))
|
|
333
|
+
return $(F), T;
|
|
334
|
+
}
|
|
335
|
+
if (!q && (!N(k) || !N(v))) {
|
|
336
|
+
let b, F;
|
|
337
|
+
const w = ie(v), L = ie(k);
|
|
338
|
+
if (!N(_) && !isNaN(_)) {
|
|
339
|
+
const M = d.valueAsNumber || _ && +_;
|
|
340
|
+
N(w.value) || (b = M > w.value), N(L.value) || (F = M < L.value);
|
|
341
|
+
} else {
|
|
342
|
+
const M = d.valueAsDate || new Date(_), z = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), ne = d.type == "time", se = d.type == "week";
|
|
343
|
+
B(w.value) && _ && (b = ne ? z(_) > z(w.value) : se ? _ > w.value : M > new Date(w.value)), B(L.value) && _ && (F = ne ? z(_) < z(L.value) : se ? _ < L.value : M < new Date(L.value));
|
|
344
|
+
}
|
|
345
|
+
if ((b || F) && (K(!!b, w.message, L.message, G.max, G.min), !a))
|
|
346
|
+
return $(T[O].message), T;
|
|
347
|
+
}
|
|
348
|
+
if ((p || m) && !q && (B(_) || n && Array.isArray(_))) {
|
|
349
|
+
const b = ie(p), F = ie(m), w = !N(b.value) && _.length > +b.value, L = !N(F.value) && _.length < +F.value;
|
|
350
|
+
if ((w || L) && (K(w, b.message, F.message), !a))
|
|
351
|
+
return $(T[O].message), T;
|
|
352
|
+
}
|
|
353
|
+
if (le && !q && B(_)) {
|
|
354
|
+
const { value: b, message: F } = ie(le);
|
|
355
|
+
if (ve(b) && !_.match(b) && (T[O] = {
|
|
356
|
+
type: G.pattern,
|
|
357
|
+
message: F,
|
|
358
|
+
ref: d,
|
|
359
|
+
...te(G.pattern, F)
|
|
360
|
+
}, !a))
|
|
361
|
+
return $(F), T;
|
|
362
|
+
}
|
|
363
|
+
if (J) {
|
|
364
|
+
if (H(J)) {
|
|
365
|
+
const b = await J(_, r), F = Ze(b, j);
|
|
366
|
+
if (F && (T[O] = {
|
|
367
|
+
...F,
|
|
368
|
+
...te(G.validate, F.message)
|
|
369
|
+
}, !a))
|
|
370
|
+
return $(F.message), T;
|
|
371
|
+
} else if (S(J)) {
|
|
372
|
+
let b = {};
|
|
373
|
+
for (const F in J) {
|
|
374
|
+
if (!R(b) && !a)
|
|
375
|
+
break;
|
|
376
|
+
const w = Ze(await J[F](_, r), j, F);
|
|
377
|
+
w && (b = {
|
|
378
|
+
...w,
|
|
379
|
+
...te(F, w.message)
|
|
380
|
+
}, $(w.message), a && (T[O] = b));
|
|
381
|
+
}
|
|
382
|
+
if (!R(b) && (T[O] = {
|
|
383
|
+
ref: j,
|
|
384
|
+
...b
|
|
385
|
+
}, !a))
|
|
386
|
+
return T;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return $(!0), T;
|
|
390
|
+
};
|
|
391
|
+
const Pt = {
|
|
392
|
+
mode: W.onSubmit,
|
|
393
|
+
reValidateMode: W.onChange,
|
|
394
|
+
shouldFocusError: !0
|
|
395
|
+
};
|
|
396
|
+
function qt(e = {}) {
|
|
397
|
+
let s = {
|
|
398
|
+
...Pt,
|
|
399
|
+
...e
|
|
400
|
+
}, r = {
|
|
401
|
+
submitCount: 0,
|
|
402
|
+
isDirty: !1,
|
|
403
|
+
isReady: !1,
|
|
404
|
+
isLoading: H(s.defaultValues),
|
|
405
|
+
isValidating: !1,
|
|
406
|
+
isSubmitted: !1,
|
|
407
|
+
isSubmitting: !1,
|
|
408
|
+
isSubmitSuccessful: !1,
|
|
409
|
+
isValid: !1,
|
|
410
|
+
touchedFields: {},
|
|
411
|
+
dirtyFields: {},
|
|
412
|
+
validatingFields: {},
|
|
413
|
+
errors: s.errors || {},
|
|
414
|
+
disabled: s.disabled || !1
|
|
415
|
+
}, a = {}, u = S(s.defaultValues) || S(s.values) ? C(s.defaultValues || s.values) || {} : {}, n = s.shouldUnregister ? {} : C(u), d = {
|
|
416
|
+
action: !1,
|
|
417
|
+
mount: !1,
|
|
418
|
+
watch: !1
|
|
419
|
+
}, y = {
|
|
420
|
+
mount: /* @__PURE__ */ new Set(),
|
|
421
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
422
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
423
|
+
array: /* @__PURE__ */ new Set(),
|
|
424
|
+
watch: /* @__PURE__ */ new Set()
|
|
425
|
+
}, U, p = 0;
|
|
426
|
+
const m = {
|
|
427
|
+
isDirty: !1,
|
|
428
|
+
dirtyFields: !1,
|
|
429
|
+
validatingFields: !1,
|
|
430
|
+
touchedFields: !1,
|
|
431
|
+
isValidating: !1,
|
|
432
|
+
isValid: !1,
|
|
433
|
+
errors: !1
|
|
434
|
+
};
|
|
435
|
+
let k = {
|
|
436
|
+
...m
|
|
437
|
+
};
|
|
438
|
+
const v = {
|
|
439
|
+
array: $e(),
|
|
440
|
+
state: $e()
|
|
441
|
+
}, le = s.criteriaMode === W.all, J = (t) => (i) => {
|
|
442
|
+
clearTimeout(p), p = setTimeout(t, i);
|
|
443
|
+
}, O = async (t) => {
|
|
444
|
+
if (!s.disabled && (m.isValid || k.isValid || t)) {
|
|
445
|
+
const i = s.resolver ? R((await X()).errors) : await q(a, !0);
|
|
446
|
+
i !== r.isValid && v.state.next({
|
|
447
|
+
isValid: i
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}, Q = (t, i) => {
|
|
451
|
+
!s.disabled && (m.isValidating || m.validatingFields || k.isValidating || k.validatingFields) && ((t || Array.from(y.mount)).forEach((l) => {
|
|
452
|
+
l && (i ? x(r.validatingFields, l, i) : E(r.validatingFields, l));
|
|
453
|
+
}), v.state.next({
|
|
454
|
+
validatingFields: r.validatingFields,
|
|
455
|
+
isValidating: !R(r.validatingFields)
|
|
456
|
+
}));
|
|
457
|
+
}, _e = (t, i = [], l, c, f = !0, o = !0) => {
|
|
458
|
+
if (c && l && !s.disabled) {
|
|
459
|
+
if (d.action = !0, o && Array.isArray(h(a, t))) {
|
|
460
|
+
const g = l(h(a, t), c.argA, c.argB);
|
|
461
|
+
f && x(a, t, g);
|
|
462
|
+
}
|
|
463
|
+
if (o && Array.isArray(h(r.errors, t))) {
|
|
464
|
+
const g = l(h(r.errors, t), c.argA, c.argB);
|
|
465
|
+
f && x(r.errors, t, g), Nt(r.errors, t);
|
|
466
|
+
}
|
|
467
|
+
if ((m.touchedFields || k.touchedFields) && o && Array.isArray(h(r.touchedFields, t))) {
|
|
468
|
+
const g = l(h(r.touchedFields, t), c.argA, c.argB);
|
|
469
|
+
f && x(r.touchedFields, t, g);
|
|
470
|
+
}
|
|
471
|
+
(m.dirtyFields || k.dirtyFields) && (r.dirtyFields = ae(u, n)), v.state.next({
|
|
472
|
+
name: t,
|
|
473
|
+
isDirty: K(t, i),
|
|
474
|
+
dirtyFields: r.dirtyFields,
|
|
475
|
+
errors: r.errors,
|
|
476
|
+
isValid: r.isValid
|
|
477
|
+
});
|
|
478
|
+
} else
|
|
479
|
+
x(n, t, i);
|
|
480
|
+
}, _ = (t, i) => {
|
|
481
|
+
x(r.errors, t, i), v.state.next({
|
|
482
|
+
errors: r.errors
|
|
483
|
+
});
|
|
484
|
+
}, j = (t) => {
|
|
485
|
+
r.errors = t, v.state.next({
|
|
486
|
+
errors: r.errors,
|
|
487
|
+
isValid: !1
|
|
488
|
+
});
|
|
489
|
+
}, $ = (t, i, l, c) => {
|
|
490
|
+
const f = h(a, t);
|
|
491
|
+
if (f) {
|
|
492
|
+
const o = h(n, t, D(l) ? h(u, t) : l);
|
|
493
|
+
D(o) || c && c.defaultChecked || i ? x(n, t, i ? o : je(f._f)) : w(t, o), d.mount && !d.action && O();
|
|
494
|
+
}
|
|
495
|
+
}, T = (t, i, l, c, f) => {
|
|
496
|
+
let o = !1, g = !1;
|
|
497
|
+
const V = {
|
|
498
|
+
name: t
|
|
499
|
+
};
|
|
500
|
+
if (!s.disabled) {
|
|
501
|
+
if (!l || c) {
|
|
502
|
+
(m.isDirty || k.isDirty) && (g = r.isDirty, r.isDirty = V.isDirty = K(), o = g !== V.isDirty);
|
|
503
|
+
const A = ee(h(u, t), i);
|
|
504
|
+
g = !!h(r.dirtyFields, t), A ? E(r.dirtyFields, t) : x(r.dirtyFields, t, !0), V.dirtyFields = r.dirtyFields, o = o || (m.dirtyFields || k.dirtyFields) && g !== !A;
|
|
505
|
+
}
|
|
506
|
+
if (l) {
|
|
507
|
+
const A = h(r.touchedFields, t);
|
|
508
|
+
A || (x(r.touchedFields, t, l), V.touchedFields = r.touchedFields, o = o || (m.touchedFields || k.touchedFields) && A !== l);
|
|
509
|
+
}
|
|
510
|
+
o && f && v.state.next(V);
|
|
511
|
+
}
|
|
512
|
+
return o ? V : {};
|
|
513
|
+
}, ce = (t, i, l, c) => {
|
|
514
|
+
const f = h(r.errors, t), o = (m.isValid || k.isValid) && Y(i) && r.isValid !== i;
|
|
515
|
+
if (s.delayError && l ? (U = J(() => _(t, l)), U(s.delayError)) : (clearTimeout(p), U = null, l ? x(r.errors, t, l) : E(r.errors, t)), (l ? !ee(f, l) : f) || !R(c) || o) {
|
|
516
|
+
const g = {
|
|
517
|
+
...c,
|
|
518
|
+
...o && Y(i) ? { isValid: i } : {},
|
|
519
|
+
errors: r.errors,
|
|
520
|
+
name: t
|
|
521
|
+
};
|
|
522
|
+
r = {
|
|
523
|
+
...r,
|
|
524
|
+
...g
|
|
525
|
+
}, v.state.next(g);
|
|
526
|
+
}
|
|
527
|
+
}, X = async (t) => {
|
|
528
|
+
Q(t, !0);
|
|
529
|
+
const i = await s.resolver(n, s.context, Ct(t || y.mount, a, s.criteriaMode, s.shouldUseNativeValidation));
|
|
530
|
+
return Q(t), i;
|
|
531
|
+
}, Ve = async (t) => {
|
|
532
|
+
const { errors: i } = await X(t);
|
|
533
|
+
if (t)
|
|
534
|
+
for (const l of t) {
|
|
535
|
+
const c = h(i, l);
|
|
536
|
+
c ? x(r.errors, l, c) : E(r.errors, l);
|
|
537
|
+
}
|
|
538
|
+
else
|
|
539
|
+
r.errors = i;
|
|
540
|
+
return i;
|
|
541
|
+
}, q = async (t, i, l = {
|
|
542
|
+
valid: !0
|
|
543
|
+
}) => {
|
|
544
|
+
for (const c in t) {
|
|
545
|
+
const f = t[c];
|
|
546
|
+
if (f) {
|
|
547
|
+
const { _f: o, ...g } = f;
|
|
548
|
+
if (o) {
|
|
549
|
+
const V = y.array.has(o.name), A = f._f && Lt(f._f);
|
|
550
|
+
A && m.validatingFields && Q([o.name], !0);
|
|
551
|
+
const P = await et(f, y.disabled, n, le, s.shouldUseNativeValidation && !i, V);
|
|
552
|
+
if (A && m.validatingFields && Q([o.name]), P[o.name] && (l.valid = !1, i))
|
|
553
|
+
break;
|
|
554
|
+
!i && (h(P, o.name) ? V ? Bt(r.errors, P, o.name) : x(r.errors, o.name, P[o.name]) : E(r.errors, o.name));
|
|
555
|
+
}
|
|
556
|
+
!R(g) && await q(g, i, l);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return l.valid;
|
|
560
|
+
}, te = () => {
|
|
561
|
+
for (const t of y.unMount) {
|
|
562
|
+
const i = h(a, t);
|
|
563
|
+
i && (i._f.refs ? i._f.refs.every((l) => !De(l)) : !De(i._f.ref)) && Fe(t);
|
|
564
|
+
}
|
|
565
|
+
y.unMount = /* @__PURE__ */ new Set();
|
|
566
|
+
}, K = (t, i) => !s.disabled && (t && i && x(n, t, i), !ee(ye(), u)), b = (t, i, l) => Dt(t, y, {
|
|
567
|
+
...d.mount ? n : D(i) ? u : B(t) ? { [t]: i } : i
|
|
568
|
+
}, l, i), F = (t) => Oe(h(d.mount ? n : u, t, s.shouldUnregister ? h(u, t, []) : [])), w = (t, i, l = {}) => {
|
|
569
|
+
const c = h(a, t);
|
|
570
|
+
let f = i;
|
|
571
|
+
if (c) {
|
|
572
|
+
const o = c._f;
|
|
573
|
+
o && (!o.disabled && x(n, t, nt(i, o)), f = ge(o.ref) && N(i) ? "" : i, it(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? de(o.ref) ? o.refs.forEach((g) => {
|
|
574
|
+
(!g.defaultChecked || !g.disabled) && (Array.isArray(f) ? g.checked = !!f.find((V) => V === g.value) : g.checked = f === g.value || !!f);
|
|
575
|
+
}) : o.refs.forEach((g) => g.checked = g.value === f) : Ce(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || v.state.next({
|
|
576
|
+
name: t,
|
|
577
|
+
values: C(n)
|
|
578
|
+
})));
|
|
579
|
+
}
|
|
580
|
+
(l.shouldDirty || l.shouldTouch) && T(t, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && se(t);
|
|
581
|
+
}, L = (t, i, l) => {
|
|
582
|
+
for (const c in i) {
|
|
583
|
+
if (!i.hasOwnProperty(c))
|
|
584
|
+
return;
|
|
585
|
+
const f = i[c], o = t + "." + c, g = h(a, o);
|
|
586
|
+
(y.array.has(t) || S(f) || g && !g._f) && !re(f) ? L(o, f, l) : w(o, f, l);
|
|
587
|
+
}
|
|
588
|
+
}, M = (t, i, l = {}) => {
|
|
589
|
+
const c = h(a, t), f = y.array.has(t), o = C(i);
|
|
590
|
+
x(n, t, o), f ? (v.array.next({
|
|
591
|
+
name: t,
|
|
592
|
+
values: C(n)
|
|
593
|
+
}), (m.isDirty || m.dirtyFields || k.isDirty || k.dirtyFields) && l.shouldDirty && v.state.next({
|
|
594
|
+
name: t,
|
|
595
|
+
dirtyFields: ae(u, n),
|
|
596
|
+
isDirty: K(t, o)
|
|
597
|
+
})) : c && !c._f && !N(o) ? L(t, o, l) : w(t, o, l), Qe(t, y) && v.state.next({ ...r, name: t }), v.state.next({
|
|
598
|
+
name: d.mount ? t : void 0,
|
|
599
|
+
values: C(n)
|
|
600
|
+
});
|
|
601
|
+
}, z = async (t) => {
|
|
602
|
+
d.mount = !0;
|
|
603
|
+
const i = t.target;
|
|
604
|
+
let l = i.name, c = !0;
|
|
605
|
+
const f = h(a, l), o = (A) => {
|
|
606
|
+
c = Number.isNaN(A) || re(A) && isNaN(A.getTime()) || ee(A, h(n, l, A));
|
|
607
|
+
}, g = Ge(s.mode), V = Ge(s.reValidateMode);
|
|
608
|
+
if (f) {
|
|
609
|
+
let A, P;
|
|
610
|
+
const he = i.type ? je(f._f) : Vt(t), Z = t.type === pe.BLUR || t.type === pe.FOCUS_OUT, vt = !Rt(f._f) && !s.resolver && !h(r.errors, l) && !f._f.deps || It(Z, h(r.touchedFields, l), r.isSubmitted, V, g), xe = Qe(l, y, Z);
|
|
611
|
+
x(n, l, he), Z ? (!i || !i.readOnly) && (f._f.onBlur && f._f.onBlur(t), U && U(0)) : f._f.onChange && f._f.onChange(t);
|
|
612
|
+
const we = T(l, he, Z), bt = !R(we) || xe;
|
|
613
|
+
if (!Z && v.state.next({
|
|
614
|
+
name: l,
|
|
615
|
+
type: t.type,
|
|
616
|
+
values: C(n)
|
|
617
|
+
}), vt)
|
|
618
|
+
return (m.isValid || k.isValid) && (s.mode === "onBlur" ? Z && O() : Z || O()), bt && v.state.next({ name: l, ...xe ? {} : we });
|
|
619
|
+
if (!Z && xe && v.state.next({ ...r }), s.resolver) {
|
|
620
|
+
const { errors: We } = await X([l]);
|
|
621
|
+
if (o(he), c) {
|
|
622
|
+
const _t = Xe(r.errors, a, l), He = Xe(We, a, _t.name || l);
|
|
623
|
+
A = He.error, l = He.name, P = R(We);
|
|
624
|
+
}
|
|
625
|
+
} else
|
|
626
|
+
Q([l], !0), A = (await et(f, y.disabled, n, le, s.shouldUseNativeValidation))[l], Q([l]), o(he), c && (A ? P = !1 : (m.isValid || k.isValid) && (P = await q(a, !0)));
|
|
627
|
+
c && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && se(f._f.deps), ce(l, P, A, we));
|
|
628
|
+
}
|
|
629
|
+
}, ne = (t, i) => {
|
|
630
|
+
if (h(r.errors, i) && t.focus)
|
|
631
|
+
return t.focus(), 1;
|
|
632
|
+
}, se = async (t, i = {}) => {
|
|
633
|
+
let l, c;
|
|
634
|
+
const f = oe(t);
|
|
635
|
+
if (s.resolver) {
|
|
636
|
+
const o = await Ve(D(t) ? t : f);
|
|
637
|
+
l = R(o), c = t ? !f.some((g) => h(o, g)) : l;
|
|
638
|
+
} else
|
|
639
|
+
t ? (c = (await Promise.all(f.map(async (o) => {
|
|
640
|
+
const g = h(a, o);
|
|
641
|
+
return await q(g && g._f ? { [o]: g } : g);
|
|
642
|
+
}))).every(Boolean), !(!c && !r.isValid) && O()) : c = l = await q(a);
|
|
643
|
+
return v.state.next({
|
|
644
|
+
...!B(t) || (m.isValid || k.isValid) && l !== r.isValid ? {} : { name: t },
|
|
645
|
+
...s.resolver || !t ? { isValid: l } : {},
|
|
646
|
+
errors: r.errors
|
|
647
|
+
}), i.shouldFocus && !c && fe(a, ne, t ? f : y.mount), c;
|
|
648
|
+
}, ye = (t, i) => {
|
|
649
|
+
let l = {
|
|
650
|
+
...d.mount ? n : u
|
|
651
|
+
};
|
|
652
|
+
return i && (l = st(i.dirtyFields ? r.dirtyFields : r.touchedFields, l)), D(t) ? l : B(t) ? h(l, t) : t.map((c) => h(l, c));
|
|
653
|
+
}, Re = (t, i) => ({
|
|
654
|
+
invalid: !!h((i || r).errors, t),
|
|
655
|
+
isDirty: !!h((i || r).dirtyFields, t),
|
|
656
|
+
error: h((i || r).errors, t),
|
|
657
|
+
isValidating: !!h(r.validatingFields, t),
|
|
658
|
+
isTouched: !!h((i || r).touchedFields, t)
|
|
659
|
+
}), ot = (t) => {
|
|
660
|
+
t && oe(t).forEach((i) => E(r.errors, i)), v.state.next({
|
|
661
|
+
errors: t ? r.errors : {}
|
|
662
|
+
});
|
|
663
|
+
}, Ue = (t, i, l) => {
|
|
664
|
+
const c = (h(a, t, { _f: {} })._f || {}).ref, f = h(r.errors, t) || {}, { ref: o, message: g, type: V, ...A } = f;
|
|
665
|
+
x(r.errors, t, {
|
|
666
|
+
...A,
|
|
667
|
+
...i,
|
|
668
|
+
ref: c
|
|
669
|
+
}), v.state.next({
|
|
670
|
+
name: t,
|
|
671
|
+
errors: r.errors,
|
|
672
|
+
isValid: !1
|
|
673
|
+
}), l && l.shouldFocus && c && c.focus && c.focus();
|
|
674
|
+
}, ft = (t, i) => H(t) ? v.state.subscribe({
|
|
675
|
+
next: (l) => "values" in l && t(b(void 0, i), l)
|
|
676
|
+
}) : b(t, i, !0), Me = (t) => v.state.subscribe({
|
|
677
|
+
next: (i) => {
|
|
678
|
+
Mt(t.name, i.name, t.exact) && Ut(i, t.formState || m, gt, t.reRenderRoot) && t.callback({
|
|
679
|
+
values: { ...n },
|
|
680
|
+
...r,
|
|
681
|
+
...i,
|
|
682
|
+
defaultValues: u
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}).unsubscribe, dt = (t) => (d.mount = !0, k = {
|
|
686
|
+
...k,
|
|
687
|
+
...t.formState
|
|
688
|
+
}, Me({
|
|
689
|
+
...t,
|
|
690
|
+
formState: k
|
|
691
|
+
})), Fe = (t, i = {}) => {
|
|
692
|
+
for (const l of t ? oe(t) : y.mount)
|
|
693
|
+
y.mount.delete(l), y.array.delete(l), i.keepValue || (E(a, l), E(n, l)), !i.keepError && E(r.errors, l), !i.keepDirty && E(r.dirtyFields, l), !i.keepTouched && E(r.touchedFields, l), !i.keepIsValidating && E(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && E(u, l);
|
|
694
|
+
v.state.next({
|
|
695
|
+
values: C(n)
|
|
696
|
+
}), v.state.next({
|
|
697
|
+
...r,
|
|
698
|
+
...i.keepDirty ? { isDirty: K() } : {}
|
|
699
|
+
}), !i.keepIsValid && O();
|
|
700
|
+
}, Ie = ({ disabled: t, name: i }) => {
|
|
701
|
+
(Y(t) && d.mount || t || y.disabled.has(i)) && (t ? y.disabled.add(i) : y.disabled.delete(i));
|
|
702
|
+
}, Ae = (t, i = {}) => {
|
|
703
|
+
let l = h(a, t);
|
|
704
|
+
const c = Y(i.disabled) || Y(s.disabled);
|
|
705
|
+
return x(a, t, {
|
|
706
|
+
...l || {},
|
|
707
|
+
_f: {
|
|
708
|
+
...l && l._f ? l._f : { ref: { name: t } },
|
|
709
|
+
name: t,
|
|
710
|
+
mount: !0,
|
|
711
|
+
...i
|
|
712
|
+
}
|
|
713
|
+
}), y.mount.add(t), l ? Ie({
|
|
714
|
+
disabled: Y(i.disabled) ? i.disabled : s.disabled,
|
|
715
|
+
name: t
|
|
716
|
+
}) : $(t, !0, i.value), {
|
|
717
|
+
...c ? { disabled: i.disabled || s.disabled } : {},
|
|
718
|
+
...s.progressive ? {
|
|
719
|
+
required: !!i.required,
|
|
720
|
+
min: ue(i.min),
|
|
721
|
+
max: ue(i.max),
|
|
722
|
+
minLength: ue(i.minLength),
|
|
723
|
+
maxLength: ue(i.maxLength),
|
|
724
|
+
pattern: ue(i.pattern)
|
|
725
|
+
} : {},
|
|
726
|
+
name: t,
|
|
727
|
+
onChange: z,
|
|
728
|
+
onBlur: z,
|
|
729
|
+
ref: (f) => {
|
|
730
|
+
if (f) {
|
|
731
|
+
Ae(t, i), l = h(a, t);
|
|
732
|
+
const o = D(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Et(o), V = l._f.refs || [];
|
|
733
|
+
if (g ? V.find((A) => A === o) : o === l._f.ref)
|
|
734
|
+
return;
|
|
735
|
+
x(a, t, {
|
|
736
|
+
_f: {
|
|
737
|
+
...l._f,
|
|
738
|
+
...g ? {
|
|
739
|
+
refs: [
|
|
740
|
+
...V.filter(De),
|
|
741
|
+
o,
|
|
742
|
+
...Array.isArray(h(u, t)) ? [{}] : []
|
|
743
|
+
],
|
|
744
|
+
ref: { type: o.type, name: t }
|
|
745
|
+
} : { ref: o }
|
|
746
|
+
}
|
|
747
|
+
}), $(t, !1, void 0, o);
|
|
748
|
+
} else
|
|
749
|
+
l = h(a, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(At(y.array, t) && d.action) && y.unMount.add(t);
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
}, me = () => s.shouldFocusError && fe(a, ne, y.mount), ct = (t) => {
|
|
753
|
+
Y(t) && (v.state.next({ disabled: t }), fe(a, (i, l) => {
|
|
754
|
+
const c = h(a, l);
|
|
755
|
+
c && (i.disabled = c._f.disabled || t, Array.isArray(c._f.refs) && c._f.refs.forEach((f) => {
|
|
756
|
+
f.disabled = c._f.disabled || t;
|
|
757
|
+
}));
|
|
758
|
+
}, 0, !1));
|
|
759
|
+
}, Ne = (t, i) => async (l) => {
|
|
760
|
+
let c;
|
|
761
|
+
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
762
|
+
let f = C(n);
|
|
763
|
+
if (v.state.next({
|
|
764
|
+
isSubmitting: !0
|
|
765
|
+
}), s.resolver) {
|
|
766
|
+
const { errors: o, values: g } = await X();
|
|
767
|
+
r.errors = o, f = C(g);
|
|
768
|
+
} else
|
|
769
|
+
await q(a);
|
|
770
|
+
if (y.disabled.size)
|
|
771
|
+
for (const o of y.disabled)
|
|
772
|
+
E(f, o);
|
|
773
|
+
if (E(r.errors, "root"), R(r.errors)) {
|
|
774
|
+
v.state.next({
|
|
775
|
+
errors: {}
|
|
776
|
+
});
|
|
777
|
+
try {
|
|
778
|
+
await t(f, l);
|
|
779
|
+
} catch (o) {
|
|
780
|
+
c = o;
|
|
781
|
+
}
|
|
782
|
+
} else
|
|
783
|
+
i && await i({ ...r.errors }, l), me(), setTimeout(me);
|
|
784
|
+
if (v.state.next({
|
|
785
|
+
isSubmitted: !0,
|
|
786
|
+
isSubmitting: !1,
|
|
787
|
+
isSubmitSuccessful: R(r.errors) && !c,
|
|
788
|
+
submitCount: r.submitCount + 1,
|
|
789
|
+
errors: r.errors
|
|
790
|
+
}), c)
|
|
791
|
+
throw c;
|
|
792
|
+
}, yt = (t, i = {}) => {
|
|
793
|
+
h(a, t) && (D(i.defaultValue) ? M(t, C(h(u, t))) : (M(t, i.defaultValue), x(u, t, C(i.defaultValue))), i.keepTouched || E(r.touchedFields, t), i.keepDirty || (E(r.dirtyFields, t), r.isDirty = i.defaultValue ? K(t, C(h(u, t))) : K()), i.keepError || (E(r.errors, t), m.isValid && O()), v.state.next({ ...r }));
|
|
794
|
+
}, Be = (t, i = {}) => {
|
|
795
|
+
const l = t ? C(t) : u, c = C(l), f = R(t), o = f ? u : c;
|
|
796
|
+
if (i.keepDefaultValues || (u = l), !i.keepValues) {
|
|
797
|
+
if (i.keepDirtyValues) {
|
|
798
|
+
const g = /* @__PURE__ */ new Set([
|
|
799
|
+
...y.mount,
|
|
800
|
+
...Object.keys(ae(u, n))
|
|
801
|
+
]);
|
|
802
|
+
for (const V of Array.from(g))
|
|
803
|
+
h(r.dirtyFields, V) ? x(o, V, h(n, V)) : M(V, h(o, V));
|
|
804
|
+
} else {
|
|
805
|
+
if (Se && D(t))
|
|
806
|
+
for (const g of y.mount) {
|
|
807
|
+
const V = h(a, g);
|
|
808
|
+
if (V && V._f) {
|
|
809
|
+
const A = Array.isArray(V._f.refs) ? V._f.refs[0] : V._f.ref;
|
|
810
|
+
if (ge(A)) {
|
|
811
|
+
const P = A.closest("form");
|
|
812
|
+
if (P) {
|
|
813
|
+
P.reset();
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
if (i.keepFieldsRef)
|
|
820
|
+
for (const g of y.mount)
|
|
821
|
+
M(g, h(o, g));
|
|
822
|
+
else
|
|
823
|
+
a = {};
|
|
824
|
+
}
|
|
825
|
+
n = s.shouldUnregister ? i.keepDefaultValues ? C(u) : {} : C(o), v.array.next({
|
|
826
|
+
values: { ...o }
|
|
827
|
+
}), v.state.next({
|
|
828
|
+
values: { ...o }
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
y = {
|
|
832
|
+
mount: i.keepDirtyValues ? y.mount : /* @__PURE__ */ new Set(),
|
|
833
|
+
unMount: /* @__PURE__ */ new Set(),
|
|
834
|
+
array: /* @__PURE__ */ new Set(),
|
|
835
|
+
disabled: /* @__PURE__ */ new Set(),
|
|
836
|
+
watch: /* @__PURE__ */ new Set(),
|
|
837
|
+
watchAll: !1,
|
|
838
|
+
focus: ""
|
|
839
|
+
}, d.mount = !m.isValid || !!i.keepIsValid || !!i.keepDirtyValues || !s.shouldUnregister && !R(o), d.watch = !!s.shouldUnregister, d.action = !1, i.keepErrors || (r.errors = {}), v.state.next({
|
|
840
|
+
submitCount: i.keepSubmitCount ? r.submitCount : 0,
|
|
841
|
+
isDirty: f ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !ee(t, u)),
|
|
842
|
+
isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
|
|
843
|
+
dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && n ? ae(u, n) : r.dirtyFields : i.keepDefaultValues && t ? ae(u, t) : i.keepDirty ? r.dirtyFields : {},
|
|
844
|
+
touchedFields: i.keepTouched ? r.touchedFields : {},
|
|
845
|
+
errors: i.keepErrors ? r.errors : {},
|
|
846
|
+
isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
847
|
+
isSubmitting: !1,
|
|
848
|
+
defaultValues: u
|
|
849
|
+
});
|
|
850
|
+
}, Pe = (t, i) => Be(H(t) ? t(n) : t, i), ht = (t, i = {}) => {
|
|
851
|
+
const l = h(a, t), c = l && l._f;
|
|
852
|
+
if (c) {
|
|
853
|
+
const f = c.refs ? c.refs[0] : c.ref;
|
|
854
|
+
f.focus && (f.focus(), i.shouldSelect && H(f.select) && f.select());
|
|
855
|
+
}
|
|
856
|
+
}, gt = (t) => {
|
|
857
|
+
r = {
|
|
858
|
+
...r,
|
|
859
|
+
...t
|
|
860
|
+
};
|
|
861
|
+
}, qe = {
|
|
862
|
+
control: {
|
|
863
|
+
register: Ae,
|
|
864
|
+
unregister: Fe,
|
|
865
|
+
getFieldState: Re,
|
|
866
|
+
handleSubmit: Ne,
|
|
867
|
+
setError: Ue,
|
|
868
|
+
_subscribe: Me,
|
|
869
|
+
_runSchema: X,
|
|
870
|
+
_focusError: me,
|
|
871
|
+
_getWatch: b,
|
|
872
|
+
_getDirty: K,
|
|
873
|
+
_setValid: O,
|
|
874
|
+
_setFieldArray: _e,
|
|
875
|
+
_setDisabledField: Ie,
|
|
876
|
+
_setErrors: j,
|
|
877
|
+
_getFieldArray: F,
|
|
878
|
+
_reset: Be,
|
|
879
|
+
_resetDefaultValues: () => H(s.defaultValues) && s.defaultValues().then((t) => {
|
|
880
|
+
Pe(t, s.resetOptions), v.state.next({
|
|
881
|
+
isLoading: !1
|
|
882
|
+
});
|
|
883
|
+
}),
|
|
884
|
+
_removeUnmounted: te,
|
|
885
|
+
_disableForm: ct,
|
|
886
|
+
_subjects: v,
|
|
887
|
+
_proxyFormState: m,
|
|
888
|
+
get _fields() {
|
|
889
|
+
return a;
|
|
890
|
+
},
|
|
891
|
+
get _formValues() {
|
|
892
|
+
return n;
|
|
893
|
+
},
|
|
894
|
+
get _state() {
|
|
895
|
+
return d;
|
|
896
|
+
},
|
|
897
|
+
set _state(t) {
|
|
898
|
+
d = t;
|
|
899
|
+
},
|
|
900
|
+
get _defaultValues() {
|
|
901
|
+
return u;
|
|
902
|
+
},
|
|
903
|
+
get _names() {
|
|
904
|
+
return y;
|
|
905
|
+
},
|
|
906
|
+
set _names(t) {
|
|
907
|
+
y = t;
|
|
908
|
+
},
|
|
909
|
+
get _formState() {
|
|
910
|
+
return r;
|
|
911
|
+
},
|
|
912
|
+
get _options() {
|
|
913
|
+
return s;
|
|
914
|
+
},
|
|
915
|
+
set _options(t) {
|
|
916
|
+
s = {
|
|
917
|
+
...s,
|
|
918
|
+
...t
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
subscribe: dt,
|
|
923
|
+
trigger: se,
|
|
924
|
+
register: Ae,
|
|
925
|
+
handleSubmit: Ne,
|
|
926
|
+
watch: ft,
|
|
927
|
+
setValue: M,
|
|
928
|
+
getValues: ye,
|
|
929
|
+
reset: Pe,
|
|
930
|
+
resetField: yt,
|
|
931
|
+
clearErrors: ot,
|
|
932
|
+
unregister: Fe,
|
|
933
|
+
setError: Ue,
|
|
934
|
+
setFocus: ht,
|
|
935
|
+
getFieldState: Re
|
|
936
|
+
};
|
|
937
|
+
return {
|
|
938
|
+
...qe,
|
|
939
|
+
formControl: qe
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function $t(e = {}) {
|
|
943
|
+
const s = I.useRef(void 0), r = I.useRef(void 0), [a, u] = I.useState({
|
|
944
|
+
isDirty: !1,
|
|
945
|
+
isValidating: !1,
|
|
946
|
+
isLoading: H(e.defaultValues),
|
|
947
|
+
isSubmitted: !1,
|
|
948
|
+
isSubmitting: !1,
|
|
949
|
+
isSubmitSuccessful: !1,
|
|
950
|
+
isValid: !1,
|
|
951
|
+
submitCount: 0,
|
|
952
|
+
dirtyFields: {},
|
|
953
|
+
touchedFields: {},
|
|
954
|
+
validatingFields: {},
|
|
955
|
+
errors: e.errors || {},
|
|
956
|
+
disabled: e.disabled || !1,
|
|
957
|
+
isReady: !1,
|
|
958
|
+
defaultValues: H(e.defaultValues) ? void 0 : e.defaultValues
|
|
959
|
+
});
|
|
960
|
+
if (!s.current)
|
|
961
|
+
if (e.formControl)
|
|
962
|
+
s.current = {
|
|
963
|
+
...e.formControl,
|
|
964
|
+
formState: a
|
|
965
|
+
}, e.defaultValues && !H(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
966
|
+
else {
|
|
967
|
+
const { formControl: d, ...y } = qt(e);
|
|
968
|
+
s.current = {
|
|
969
|
+
...y,
|
|
970
|
+
formState: a
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
const n = s.current.control;
|
|
974
|
+
return n._options = e, wt(() => {
|
|
975
|
+
const d = n._subscribe({
|
|
976
|
+
formState: n._proxyFormState,
|
|
977
|
+
callback: () => u({ ...n._formState }),
|
|
978
|
+
reRenderRoot: !0
|
|
979
|
+
});
|
|
980
|
+
return u((y) => ({
|
|
981
|
+
...y,
|
|
982
|
+
isReady: !0
|
|
983
|
+
})), n._formState.isReady = !0, d;
|
|
984
|
+
}, [n]), I.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), I.useEffect(() => {
|
|
985
|
+
e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
|
|
986
|
+
}, [n, e.mode, e.reValidateMode]), I.useEffect(() => {
|
|
987
|
+
e.errors && (n._setErrors(e.errors), n._focusError());
|
|
988
|
+
}, [n, e.errors]), I.useEffect(() => {
|
|
989
|
+
e.shouldUnregister && n._subjects.state.next({
|
|
990
|
+
values: n._getWatch()
|
|
991
|
+
});
|
|
992
|
+
}, [n, e.shouldUnregister]), I.useEffect(() => {
|
|
993
|
+
if (n._proxyFormState.isDirty) {
|
|
994
|
+
const d = n._getDirty();
|
|
995
|
+
d !== a.isDirty && n._subjects.state.next({
|
|
996
|
+
isDirty: d
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
}, [n, a.isDirty]), I.useEffect(() => {
|
|
1000
|
+
var d;
|
|
1001
|
+
e.values && !ee(e.values, r.current) ? (n._reset(e.values, {
|
|
1002
|
+
keepFieldsRef: !0,
|
|
1003
|
+
...n._options.resetOptions
|
|
1004
|
+
}), !((d = n._options.resetOptions) === null || d === void 0) && d.keepIsValid || n._setValid(), r.current = e.values, u((y) => ({ ...y }))) : n._resetDefaultValues();
|
|
1005
|
+
}, [n, e.values]), I.useEffect(() => {
|
|
1006
|
+
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
1007
|
+
}), s.current.formState = xt(a, n), s.current;
|
|
1008
|
+
}
|
|
1009
|
+
export {
|
|
1010
|
+
pt as F,
|
|
1011
|
+
$t as u
|
|
1012
|
+
};
|