solid-hook-form 1.6.2 → 1.6.3
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/main.d.ts +74 -4
- package/dist/main.js +339 -1381
- package/dist/main.jsx +403 -0
- package/package.json +8 -6
- package/dist/form_context.d.ts +0 -1
- package/dist/form_provider.d.ts +0 -7
- package/dist/logic/create_errors.d.ts +0 -10
- package/dist/logic/create_fields.d.ts +0 -6
- package/dist/logic/create_rules.d.ts +0 -8
- package/dist/logic/format_value.d.ts +0 -4
- package/dist/logic/get_value.d.ts +0 -1
- package/dist/logic/set_value.d.ts +0 -1
- package/dist/logic/validate.d.ts +0 -5
- package/dist/main.umd.cjs +0 -29
- package/dist/types/errors.d.ts +0 -10
- package/dist/types/form.d.ts +0 -32
- package/dist/types/path.d.ts +0 -1
- package/dist/types/validate.d.ts +0 -21
- package/dist/use_form.d.ts +0 -9
- package/dist/use_form_context.d.ts +0 -2
- package/dist/utils/get.d.ts +0 -1
- package/dist/utils/resolver.d.ts +0 -5
- package/dist/utils/set.d.ts +0 -1
package/dist/main.js
CHANGED
|
@@ -1,1427 +1,385 @@
|
|
|
1
|
-
import { createSignal
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createContext, createSignal, createMemo, useContext } from 'solid-js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { createComponent } from 'solid-js/web';
|
|
4
|
+
|
|
5
|
+
// src/use_form.ts
|
|
6
|
+
|
|
7
|
+
// src/logic/get_value.ts
|
|
8
|
+
var getFieldValue = (event) => {
|
|
9
|
+
const field = event.target;
|
|
10
|
+
if (field instanceof HTMLSelectElement) {
|
|
11
|
+
return field.value;
|
|
12
|
+
}
|
|
13
|
+
if (field instanceof HTMLInputElement && field.type === "checkbox") {
|
|
14
|
+
return field.checked;
|
|
15
|
+
}
|
|
16
|
+
if (field instanceof HTMLInputElement && field.type === "file") {
|
|
17
|
+
return [...field.files || []];
|
|
18
|
+
}
|
|
19
|
+
return field.value;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/logic/set_value.ts
|
|
23
|
+
var setFieldValue = (field, value) => {
|
|
24
|
+
if (field instanceof HTMLSelectElement) {
|
|
25
|
+
field.value = value;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (field instanceof HTMLInputElement && field.type === "checkbox") {
|
|
29
|
+
field.checked = value;
|
|
8
30
|
return;
|
|
9
31
|
}
|
|
10
|
-
if (
|
|
11
|
-
n.checked = u;
|
|
32
|
+
if (field instanceof HTMLInputElement && field.type === "file") {
|
|
12
33
|
return;
|
|
13
34
|
}
|
|
14
|
-
|
|
35
|
+
field.value = value;
|
|
15
36
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the MIT license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/
|
|
29
|
-
var Le;
|
|
30
|
-
function tt() {
|
|
31
|
-
if (Le) return p;
|
|
32
|
-
Le = 1;
|
|
33
|
-
var n = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), N = Symbol.for("react.context"), j = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), $ = Symbol.for("react.memo"), M = Symbol.for("react.lazy"), W = Symbol.iterator;
|
|
34
|
-
function B(t) {
|
|
35
|
-
return t === null || typeof t != "object" ? null : (t = W && t[W] || t["@@iterator"], typeof t == "function" ? t : null);
|
|
37
|
+
var isDateObject = (value) => value instanceof Date;
|
|
38
|
+
var isNullOrUndefined = (value) => value == null;
|
|
39
|
+
var isObjectType = (value) => typeof value === "object";
|
|
40
|
+
var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
41
|
+
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
42
|
+
var isUndefined = (val) => val === void 0;
|
|
43
|
+
var get = (object, path, defaultValue) => {
|
|
44
|
+
if (!path || !isObject(object)) {
|
|
45
|
+
return defaultValue;
|
|
36
46
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
const result = compact(path.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined(result2) ? result2 : result2[key], object);
|
|
48
|
+
return isUndefined(result) || result === object ? isUndefined(object[path]) ? defaultValue : object[path] : result;
|
|
49
|
+
};
|
|
50
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
51
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
52
|
+
var set = (object, path, value) => {
|
|
53
|
+
let index = -1;
|
|
54
|
+
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
55
|
+
const length = tempPath.length;
|
|
56
|
+
const lastIndex = length - 1;
|
|
57
|
+
while (++index < length) {
|
|
58
|
+
const key = tempPath[index];
|
|
59
|
+
let newValue = value;
|
|
60
|
+
if (index !== lastIndex) {
|
|
61
|
+
const objValue = object[key];
|
|
62
|
+
newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
46
63
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (typeof t != "object" && typeof t != "function" && t != null)
|
|
53
|
-
throw Error(
|
|
54
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
55
|
-
);
|
|
56
|
-
this.updater.enqueueSetState(this, t, o, "setState");
|
|
57
|
-
}, U.prototype.forceUpdate = function(t) {
|
|
58
|
-
this.updater.enqueueForceUpdate(this, t, "forceUpdate");
|
|
59
|
-
};
|
|
60
|
-
function z() {
|
|
64
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
object[key] = newValue;
|
|
68
|
+
object = object[key];
|
|
61
69
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
};
|
|
71
|
+
React.createContext(null);
|
|
72
|
+
|
|
73
|
+
// src/logic/validate.ts
|
|
74
|
+
var getRuleValue = (rule) => {
|
|
75
|
+
if (rule instanceof RegExp) {
|
|
76
|
+
return rule;
|
|
65
77
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var X = Array.isArray, b = { H: null, A: null, T: null, S: null, V: null }, Z = Object.prototype.hasOwnProperty;
|
|
69
|
-
function J(t, o, f, c, R, S) {
|
|
70
|
-
return f = S.ref, {
|
|
71
|
-
$$typeof: n,
|
|
72
|
-
type: t,
|
|
73
|
-
key: o,
|
|
74
|
-
ref: f !== void 0 ? f : null,
|
|
75
|
-
props: S
|
|
76
|
-
};
|
|
78
|
+
if (typeof rule === "string" || typeof rule === "number") {
|
|
79
|
+
return rule;
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
void 0,
|
|
84
|
-
void 0,
|
|
85
|
-
t.props
|
|
86
|
-
);
|
|
81
|
+
return rule.value;
|
|
82
|
+
};
|
|
83
|
+
var getRuleMessage = (rule) => {
|
|
84
|
+
if (typeof rule === "string") {
|
|
85
|
+
return rule;
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
return
|
|
87
|
+
if (typeof rule.message === "string") {
|
|
88
|
+
return rule.message;
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
return "";
|
|
91
|
+
};
|
|
92
|
+
var validate = (values, name, rules = {}) => {
|
|
93
|
+
const value = get(values, name);
|
|
94
|
+
if (rules.required && !value) {
|
|
95
|
+
return { type: "required", message: getRuleMessage(rules.required) };
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return typeof t == "object" && t !== null && t.key != null ? te("" + t.key) : o.toString(36);
|
|
97
|
+
if (rules.min && Number(value) < Number(getRuleValue(rules.min))) {
|
|
98
|
+
return { type: "min", message: getRuleMessage(rules.min) };
|
|
100
99
|
}
|
|
101
|
-
|
|
100
|
+
if (rules.max && Number(value) > Number(getRuleValue(rules.max))) {
|
|
101
|
+
return { type: "max", message: getRuleMessage(rules.max) };
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
case "fulfilled":
|
|
106
|
-
return t.value;
|
|
107
|
-
case "rejected":
|
|
108
|
-
throw t.reason;
|
|
109
|
-
default:
|
|
110
|
-
switch (typeof t.status == "string" ? t.then(V, V) : (t.status = "pending", t.then(
|
|
111
|
-
function(o) {
|
|
112
|
-
t.status === "pending" && (t.status = "fulfilled", t.value = o);
|
|
113
|
-
},
|
|
114
|
-
function(o) {
|
|
115
|
-
t.status === "pending" && (t.status = "rejected", t.reason = o);
|
|
116
|
-
}
|
|
117
|
-
)), t.status) {
|
|
118
|
-
case "fulfilled":
|
|
119
|
-
return t.value;
|
|
120
|
-
case "rejected":
|
|
121
|
-
throw t.reason;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
throw t;
|
|
103
|
+
if (rules.minLength && value.length < getRuleValue(rules.minLength)) {
|
|
104
|
+
return { type: "minLength", message: getRuleMessage(rules.minLength) };
|
|
125
105
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
(S === "undefined" || S === "boolean") && (t = null);
|
|
129
|
-
var m = !1;
|
|
130
|
-
if (t === null) m = !0;
|
|
131
|
-
else
|
|
132
|
-
switch (S) {
|
|
133
|
-
case "bigint":
|
|
134
|
-
case "string":
|
|
135
|
-
case "number":
|
|
136
|
-
m = !0;
|
|
137
|
-
break;
|
|
138
|
-
case "object":
|
|
139
|
-
switch (t.$$typeof) {
|
|
140
|
-
case n:
|
|
141
|
-
case u:
|
|
142
|
-
m = !0;
|
|
143
|
-
break;
|
|
144
|
-
case M:
|
|
145
|
-
return m = t._init, E(
|
|
146
|
-
m(t._payload),
|
|
147
|
-
o,
|
|
148
|
-
f,
|
|
149
|
-
c,
|
|
150
|
-
R
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (m)
|
|
155
|
-
return R = R(t), m = c === "" ? "." + re(t, 0) : c, X(R) ? (f = "", m != null && (f = m.replace(C, "$&/") + "/"), E(R, o, f, "", function(ne) {
|
|
156
|
-
return ne;
|
|
157
|
-
})) : R != null && (q(R) && (R = Y(
|
|
158
|
-
R,
|
|
159
|
-
f + (R.key == null || t && t.key === R.key ? "" : ("" + R.key).replace(
|
|
160
|
-
C,
|
|
161
|
-
"$&/"
|
|
162
|
-
) + "/") + m
|
|
163
|
-
)), o.push(R)), 1;
|
|
164
|
-
m = 0;
|
|
165
|
-
var F = c === "" ? "." : c + ":";
|
|
166
|
-
if (X(t))
|
|
167
|
-
for (var A = 0; A < t.length; A++)
|
|
168
|
-
c = t[A], S = F + re(c, A), m += E(
|
|
169
|
-
c,
|
|
170
|
-
o,
|
|
171
|
-
f,
|
|
172
|
-
S,
|
|
173
|
-
R
|
|
174
|
-
);
|
|
175
|
-
else if (A = B(t), typeof A == "function")
|
|
176
|
-
for (t = A.call(t), A = 0; !(c = t.next()).done; )
|
|
177
|
-
c = c.value, S = F + re(c, A++), m += E(
|
|
178
|
-
c,
|
|
179
|
-
o,
|
|
180
|
-
f,
|
|
181
|
-
S,
|
|
182
|
-
R
|
|
183
|
-
);
|
|
184
|
-
else if (S === "object") {
|
|
185
|
-
if (typeof t.then == "function")
|
|
186
|
-
return E(
|
|
187
|
-
l(t),
|
|
188
|
-
o,
|
|
189
|
-
f,
|
|
190
|
-
c,
|
|
191
|
-
R
|
|
192
|
-
);
|
|
193
|
-
throw o = String(t), Error(
|
|
194
|
-
"Objects are not valid as a React child (found: " + (o === "[object Object]" ? "object with keys {" + Object.keys(t).join(", ") + "}" : o) + "). If you meant to render a collection of children, use an array instead."
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
return m;
|
|
106
|
+
if (rules.maxLength && value.length > getRuleValue(rules.maxLength)) {
|
|
107
|
+
return { type: "maxLength", message: getRuleMessage(rules.maxLength) };
|
|
198
108
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var c = [], R = 0;
|
|
202
|
-
return E(t, c, "", "", function(S) {
|
|
203
|
-
return o.call(f, S, R++);
|
|
204
|
-
}), c;
|
|
109
|
+
if (rules.pattern && !getRuleValue(rules.pattern).test(value)) {
|
|
110
|
+
return { type: "pattern", message: getRuleMessage(rules.pattern) };
|
|
205
111
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function(f) {
|
|
211
|
-
(t._status === 0 || t._status === -1) && (t._status = 1, t._result = f);
|
|
212
|
-
},
|
|
213
|
-
function(f) {
|
|
214
|
-
(t._status === 0 || t._status === -1) && (t._status = 2, t._result = f);
|
|
215
|
-
}
|
|
216
|
-
), t._status === -1 && (t._status = 0, t._result = o);
|
|
112
|
+
if (rules.validate) {
|
|
113
|
+
const message = rules.validate(value, values);
|
|
114
|
+
if (message === false) {
|
|
115
|
+
return { type: "validate" };
|
|
217
116
|
}
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
var D = typeof reportError == "function" ? reportError : function(t) {
|
|
222
|
-
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
223
|
-
var o = new window.ErrorEvent("error", {
|
|
224
|
-
bubbles: !0,
|
|
225
|
-
cancelable: !0,
|
|
226
|
-
message: typeof t == "object" && t !== null && typeof t.message == "string" ? String(t.message) : String(t),
|
|
227
|
-
error: t
|
|
228
|
-
});
|
|
229
|
-
if (!window.dispatchEvent(o)) return;
|
|
230
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
231
|
-
process.emit("uncaughtException", t);
|
|
232
|
-
return;
|
|
117
|
+
if (typeof message === "string") {
|
|
118
|
+
return { type: "validate", message };
|
|
233
119
|
}
|
|
234
|
-
console.error(t);
|
|
235
|
-
};
|
|
236
|
-
function ce() {
|
|
237
120
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
__proto__: null,
|
|
269
|
-
c: function(t) {
|
|
270
|
-
return b.H.useMemoCache(t);
|
|
271
|
-
}
|
|
272
|
-
}, p.cache = function(t) {
|
|
273
|
-
return function() {
|
|
274
|
-
return t.apply(null, arguments);
|
|
275
|
-
};
|
|
276
|
-
}, p.cloneElement = function(t, o, f) {
|
|
277
|
-
if (t == null)
|
|
278
|
-
throw Error(
|
|
279
|
-
"The argument must be a React element, but you passed " + t + "."
|
|
280
|
-
);
|
|
281
|
-
var c = K({}, t.props), R = t.key, S = void 0;
|
|
282
|
-
if (o != null)
|
|
283
|
-
for (m in o.ref !== void 0 && (S = void 0), o.key !== void 0 && (R = "" + o.key), o)
|
|
284
|
-
!Z.call(o, m) || m === "key" || m === "__self" || m === "__source" || m === "ref" && o.ref === void 0 || (c[m] = o[m]);
|
|
285
|
-
var m = arguments.length - 2;
|
|
286
|
-
if (m === 1) c.children = f;
|
|
287
|
-
else if (1 < m) {
|
|
288
|
-
for (var F = Array(m), A = 0; A < m; A++)
|
|
289
|
-
F[A] = arguments[A + 2];
|
|
290
|
-
c.children = F;
|
|
291
|
-
}
|
|
292
|
-
return J(t.type, R, void 0, void 0, S, c);
|
|
293
|
-
}, p.createContext = function(t) {
|
|
294
|
-
return t = {
|
|
295
|
-
$$typeof: N,
|
|
296
|
-
_currentValue: t,
|
|
297
|
-
_currentValue2: t,
|
|
298
|
-
_threadCount: 0,
|
|
299
|
-
Provider: null,
|
|
300
|
-
Consumer: null
|
|
301
|
-
}, t.Provider = t, t.Consumer = {
|
|
302
|
-
$$typeof: k,
|
|
303
|
-
_context: t
|
|
304
|
-
}, t;
|
|
305
|
-
}, p.createElement = function(t, o, f) {
|
|
306
|
-
var c, R = {}, S = null;
|
|
307
|
-
if (o != null)
|
|
308
|
-
for (c in o.key !== void 0 && (S = "" + o.key), o)
|
|
309
|
-
Z.call(o, c) && c !== "key" && c !== "__self" && c !== "__source" && (R[c] = o[c]);
|
|
310
|
-
var m = arguments.length - 2;
|
|
311
|
-
if (m === 1) R.children = f;
|
|
312
|
-
else if (1 < m) {
|
|
313
|
-
for (var F = Array(m), A = 0; A < m; A++)
|
|
314
|
-
F[A] = arguments[A + 2];
|
|
315
|
-
R.children = F;
|
|
316
|
-
}
|
|
317
|
-
if (t && t.defaultProps)
|
|
318
|
-
for (c in m = t.defaultProps, m)
|
|
319
|
-
R[c] === void 0 && (R[c] = m[c]);
|
|
320
|
-
return J(t, S, void 0, void 0, null, R);
|
|
321
|
-
}, p.createRef = function() {
|
|
322
|
-
return { current: null };
|
|
323
|
-
}, p.forwardRef = function(t) {
|
|
324
|
-
return { $$typeof: j, render: t };
|
|
325
|
-
}, p.isValidElement = q, p.lazy = function(t) {
|
|
326
|
-
return {
|
|
327
|
-
$$typeof: M,
|
|
328
|
-
_payload: { _status: -1, _result: t },
|
|
329
|
-
_init: P
|
|
330
|
-
};
|
|
331
|
-
}, p.memo = function(t, o) {
|
|
332
|
-
return {
|
|
333
|
-
$$typeof: $,
|
|
334
|
-
type: t,
|
|
335
|
-
compare: o === void 0 ? null : o
|
|
336
|
-
};
|
|
337
|
-
}, p.startTransition = function(t) {
|
|
338
|
-
var o = b.T, f = {};
|
|
339
|
-
b.T = f;
|
|
340
|
-
try {
|
|
341
|
-
var c = t(), R = b.S;
|
|
342
|
-
R !== null && R(f, c), typeof c == "object" && c !== null && typeof c.then == "function" && c.then(ce, D);
|
|
343
|
-
} catch (S) {
|
|
344
|
-
D(S);
|
|
345
|
-
} finally {
|
|
346
|
-
b.T = o;
|
|
347
|
-
}
|
|
348
|
-
}, p.unstable_useCacheRefresh = function() {
|
|
349
|
-
return b.H.useCacheRefresh();
|
|
350
|
-
}, p.use = function(t) {
|
|
351
|
-
return b.H.use(t);
|
|
352
|
-
}, p.useActionState = function(t, o, f) {
|
|
353
|
-
return b.H.useActionState(t, o, f);
|
|
354
|
-
}, p.useCallback = function(t, o) {
|
|
355
|
-
return b.H.useCallback(t, o);
|
|
356
|
-
}, p.useContext = function(t) {
|
|
357
|
-
return b.H.useContext(t);
|
|
358
|
-
}, p.useDebugValue = function() {
|
|
359
|
-
}, p.useDeferredValue = function(t, o) {
|
|
360
|
-
return b.H.useDeferredValue(t, o);
|
|
361
|
-
}, p.useEffect = function(t, o, f) {
|
|
362
|
-
var c = b.H;
|
|
363
|
-
if (typeof f == "function")
|
|
364
|
-
throw Error(
|
|
365
|
-
"useEffect CRUD overload is not enabled in this build of React."
|
|
366
|
-
);
|
|
367
|
-
return c.useEffect(t, o);
|
|
368
|
-
}, p.useId = function() {
|
|
369
|
-
return b.H.useId();
|
|
370
|
-
}, p.useImperativeHandle = function(t, o, f) {
|
|
371
|
-
return b.H.useImperativeHandle(t, o, f);
|
|
372
|
-
}, p.useInsertionEffect = function(t, o) {
|
|
373
|
-
return b.H.useInsertionEffect(t, o);
|
|
374
|
-
}, p.useLayoutEffect = function(t, o) {
|
|
375
|
-
return b.H.useLayoutEffect(t, o);
|
|
376
|
-
}, p.useMemo = function(t, o) {
|
|
377
|
-
return b.H.useMemo(t, o);
|
|
378
|
-
}, p.useOptimistic = function(t, o) {
|
|
379
|
-
return b.H.useOptimistic(t, o);
|
|
380
|
-
}, p.useReducer = function(t, o, f) {
|
|
381
|
-
return b.H.useReducer(t, o, f);
|
|
382
|
-
}, p.useRef = function(t) {
|
|
383
|
-
return b.H.useRef(t);
|
|
384
|
-
}, p.useState = function(t) {
|
|
385
|
-
return b.H.useState(t);
|
|
386
|
-
}, p.useSyncExternalStore = function(t, o, f) {
|
|
387
|
-
return b.H.useSyncExternalStore(
|
|
388
|
-
t,
|
|
389
|
-
o,
|
|
390
|
-
f
|
|
391
|
-
);
|
|
392
|
-
}, p.useTransition = function() {
|
|
393
|
-
return b.H.useTransition();
|
|
394
|
-
}, p.version = "19.1.0", p;
|
|
395
|
-
}
|
|
396
|
-
var ae = { exports: {} };
|
|
397
|
-
/**
|
|
398
|
-
* @license React
|
|
399
|
-
* react.development.js
|
|
400
|
-
*
|
|
401
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the MIT license found in the
|
|
404
|
-
* LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/
|
|
406
|
-
ae.exports;
|
|
407
|
-
var Me;
|
|
408
|
-
function rt() {
|
|
409
|
-
return Me || (Me = 1, function(n, u) {
|
|
410
|
-
process.env.NODE_ENV !== "production" && function() {
|
|
411
|
-
function y(e, r) {
|
|
412
|
-
Object.defineProperty(k.prototype, e, {
|
|
413
|
-
get: function() {
|
|
414
|
-
console.warn(
|
|
415
|
-
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
416
|
-
r[0],
|
|
417
|
-
r[1]
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
function v(e) {
|
|
423
|
-
return e === null || typeof e != "object" ? null : (e = _e && e[_e] || e["@@iterator"], typeof e == "function" ? e : null);
|
|
424
|
-
}
|
|
425
|
-
function T(e, r) {
|
|
426
|
-
e = (e = e.constructor) && (e.displayName || e.name) || "ReactClass";
|
|
427
|
-
var s = e + "." + r;
|
|
428
|
-
Ee[s] || (console.error(
|
|
429
|
-
"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
|
|
430
|
-
r,
|
|
431
|
-
e
|
|
432
|
-
), Ee[s] = !0);
|
|
433
|
-
}
|
|
434
|
-
function k(e, r, s) {
|
|
435
|
-
this.props = e, this.context = r, this.refs = he, this.updater = s || we;
|
|
436
|
-
}
|
|
437
|
-
function N() {
|
|
438
|
-
}
|
|
439
|
-
function j(e, r, s) {
|
|
440
|
-
this.props = e, this.context = r, this.refs = he, this.updater = s || we;
|
|
441
|
-
}
|
|
442
|
-
function L(e) {
|
|
443
|
-
return "" + e;
|
|
444
|
-
}
|
|
445
|
-
function $(e) {
|
|
446
|
-
try {
|
|
447
|
-
L(e);
|
|
448
|
-
var r = !1;
|
|
449
|
-
} catch {
|
|
450
|
-
r = !0;
|
|
451
|
-
}
|
|
452
|
-
if (r) {
|
|
453
|
-
r = console;
|
|
454
|
-
var s = r.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
455
|
-
return s.call(
|
|
456
|
-
r,
|
|
457
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
458
|
-
i
|
|
459
|
-
), L(e);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function M(e) {
|
|
463
|
-
if (e == null) return null;
|
|
464
|
-
if (typeof e == "function")
|
|
465
|
-
return e.$$typeof === ze ? null : e.displayName || e.name || null;
|
|
466
|
-
if (typeof e == "string") return e;
|
|
467
|
-
switch (e) {
|
|
468
|
-
case t:
|
|
469
|
-
return "Fragment";
|
|
470
|
-
case f:
|
|
471
|
-
return "Profiler";
|
|
472
|
-
case o:
|
|
473
|
-
return "StrictMode";
|
|
474
|
-
case m:
|
|
475
|
-
return "Suspense";
|
|
476
|
-
case F:
|
|
477
|
-
return "SuspenseList";
|
|
478
|
-
case We:
|
|
479
|
-
return "Activity";
|
|
480
|
-
}
|
|
481
|
-
if (typeof e == "object")
|
|
482
|
-
switch (typeof e.tag == "number" && console.error(
|
|
483
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
484
|
-
), e.$$typeof) {
|
|
485
|
-
case ce:
|
|
486
|
-
return "Portal";
|
|
487
|
-
case R:
|
|
488
|
-
return (e.displayName || "Context") + ".Provider";
|
|
489
|
-
case c:
|
|
490
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
491
|
-
case S:
|
|
492
|
-
var r = e.render;
|
|
493
|
-
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
494
|
-
case A:
|
|
495
|
-
return r = e.displayName || null, r !== null ? r : M(e.type) || "Memo";
|
|
496
|
-
case ne:
|
|
497
|
-
r = e._payload, e = e._init;
|
|
498
|
-
try {
|
|
499
|
-
return M(e(r));
|
|
500
|
-
} catch {
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return null;
|
|
504
|
-
}
|
|
505
|
-
function W(e) {
|
|
506
|
-
if (e === t) return "<>";
|
|
507
|
-
if (typeof e == "object" && e !== null && e.$$typeof === ne)
|
|
508
|
-
return "<...>";
|
|
509
|
-
try {
|
|
510
|
-
var r = M(e);
|
|
511
|
-
return r ? "<" + r + ">" : "<...>";
|
|
512
|
-
} catch {
|
|
513
|
-
return "<...>";
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function B() {
|
|
517
|
-
var e = g.A;
|
|
518
|
-
return e === null ? null : e.getOwner();
|
|
519
|
-
}
|
|
520
|
-
function Q() {
|
|
521
|
-
return Error("react-stack-top-frame");
|
|
522
|
-
}
|
|
523
|
-
function K(e) {
|
|
524
|
-
if (le.call(e, "key")) {
|
|
525
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
526
|
-
if (r && r.isReactWarning) return !1;
|
|
527
|
-
}
|
|
528
|
-
return e.key !== void 0;
|
|
529
|
-
}
|
|
530
|
-
function ee(e, r) {
|
|
531
|
-
function s() {
|
|
532
|
-
Oe || (Oe = !0, console.error(
|
|
533
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
534
|
-
r
|
|
535
|
-
));
|
|
536
|
-
}
|
|
537
|
-
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
538
|
-
get: s,
|
|
539
|
-
configurable: !0
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
function U() {
|
|
543
|
-
var e = M(this.type);
|
|
544
|
-
return Se[e] || (Se[e] = !0, console.error(
|
|
545
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
546
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
547
|
-
}
|
|
548
|
-
function z(e, r, s, i, a, _, d, O) {
|
|
549
|
-
return s = _.ref, e = {
|
|
550
|
-
$$typeof: D,
|
|
551
|
-
type: e,
|
|
552
|
-
key: r,
|
|
553
|
-
props: _,
|
|
554
|
-
_owner: a
|
|
555
|
-
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
556
|
-
enumerable: !1,
|
|
557
|
-
get: U
|
|
558
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
559
|
-
configurable: !1,
|
|
560
|
-
enumerable: !1,
|
|
561
|
-
writable: !0,
|
|
562
|
-
value: 0
|
|
563
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
564
|
-
configurable: !1,
|
|
565
|
-
enumerable: !1,
|
|
566
|
-
writable: !0,
|
|
567
|
-
value: null
|
|
568
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
569
|
-
configurable: !1,
|
|
570
|
-
enumerable: !1,
|
|
571
|
-
writable: !0,
|
|
572
|
-
value: d
|
|
573
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
574
|
-
configurable: !1,
|
|
575
|
-
enumerable: !1,
|
|
576
|
-
writable: !0,
|
|
577
|
-
value: O
|
|
578
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
579
|
-
}
|
|
580
|
-
function x(e, r) {
|
|
581
|
-
return r = z(
|
|
582
|
-
e.type,
|
|
583
|
-
r,
|
|
584
|
-
void 0,
|
|
585
|
-
void 0,
|
|
586
|
-
e._owner,
|
|
587
|
-
e.props,
|
|
588
|
-
e._debugStack,
|
|
589
|
-
e._debugTask
|
|
590
|
-
), e._store && (r._store.validated = e._store.validated), r;
|
|
591
|
-
}
|
|
592
|
-
function I(e) {
|
|
593
|
-
return typeof e == "object" && e !== null && e.$$typeof === D;
|
|
594
|
-
}
|
|
595
|
-
function X(e) {
|
|
596
|
-
var r = { "=": "=0", ":": "=2" };
|
|
597
|
-
return "$" + e.replace(/[=:]/g, function(s) {
|
|
598
|
-
return r[s];
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
function b(e, r) {
|
|
602
|
-
return typeof e == "object" && e !== null && e.key != null ? ($(e.key), X("" + e.key)) : r.toString(36);
|
|
603
|
-
}
|
|
604
|
-
function Z() {
|
|
605
|
-
}
|
|
606
|
-
function J(e) {
|
|
607
|
-
switch (e.status) {
|
|
608
|
-
case "fulfilled":
|
|
609
|
-
return e.value;
|
|
610
|
-
case "rejected":
|
|
611
|
-
throw e.reason;
|
|
612
|
-
default:
|
|
613
|
-
switch (typeof e.status == "string" ? e.then(Z, Z) : (e.status = "pending", e.then(
|
|
614
|
-
function(r) {
|
|
615
|
-
e.status === "pending" && (e.status = "fulfilled", e.value = r);
|
|
616
|
-
},
|
|
617
|
-
function(r) {
|
|
618
|
-
e.status === "pending" && (e.status = "rejected", e.reason = r);
|
|
619
|
-
}
|
|
620
|
-
)), e.status) {
|
|
621
|
-
case "fulfilled":
|
|
622
|
-
return e.value;
|
|
623
|
-
case "rejected":
|
|
624
|
-
throw e.reason;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
throw e;
|
|
628
|
-
}
|
|
629
|
-
function Y(e, r, s, i, a) {
|
|
630
|
-
var _ = typeof e;
|
|
631
|
-
(_ === "undefined" || _ === "boolean") && (e = null);
|
|
632
|
-
var d = !1;
|
|
633
|
-
if (e === null) d = !0;
|
|
634
|
-
else
|
|
635
|
-
switch (_) {
|
|
636
|
-
case "bigint":
|
|
637
|
-
case "string":
|
|
638
|
-
case "number":
|
|
639
|
-
d = !0;
|
|
640
|
-
break;
|
|
641
|
-
case "object":
|
|
642
|
-
switch (e.$$typeof) {
|
|
643
|
-
case D:
|
|
644
|
-
case ce:
|
|
645
|
-
d = !0;
|
|
646
|
-
break;
|
|
647
|
-
case ne:
|
|
648
|
-
return d = e._init, Y(
|
|
649
|
-
d(e._payload),
|
|
650
|
-
r,
|
|
651
|
-
s,
|
|
652
|
-
i,
|
|
653
|
-
a
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
if (d) {
|
|
658
|
-
d = e, a = a(d);
|
|
659
|
-
var O = i === "" ? "." + b(d, 0) : i;
|
|
660
|
-
return Te(a) ? (s = "", O != null && (s = O.replace(ke, "$&/") + "/"), Y(a, r, s, "", function(G) {
|
|
661
|
-
return G;
|
|
662
|
-
})) : a != null && (I(a) && (a.key != null && (d && d.key === a.key || $(a.key)), s = x(
|
|
663
|
-
a,
|
|
664
|
-
s + (a.key == null || d && d.key === a.key ? "" : ("" + a.key).replace(
|
|
665
|
-
ke,
|
|
666
|
-
"$&/"
|
|
667
|
-
) + "/") + O
|
|
668
|
-
), i !== "" && d != null && I(d) && d.key == null && d._store && !d._store.validated && (s._store.validated = 2), a = s), r.push(a)), 1;
|
|
669
|
-
}
|
|
670
|
-
if (d = 0, O = i === "" ? "." : i + ":", Te(e))
|
|
671
|
-
for (var h = 0; h < e.length; h++)
|
|
672
|
-
i = e[h], _ = O + b(i, h), d += Y(
|
|
673
|
-
i,
|
|
674
|
-
r,
|
|
675
|
-
s,
|
|
676
|
-
_,
|
|
677
|
-
a
|
|
678
|
-
);
|
|
679
|
-
else if (h = v(e), typeof h == "function")
|
|
680
|
-
for (h === e.entries && (Ae || console.warn(
|
|
681
|
-
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
|
|
682
|
-
), Ae = !0), e = h.call(e), h = 0; !(i = e.next()).done; )
|
|
683
|
-
i = i.value, _ = O + b(i, h++), d += Y(
|
|
684
|
-
i,
|
|
685
|
-
r,
|
|
686
|
-
s,
|
|
687
|
-
_,
|
|
688
|
-
a
|
|
689
|
-
);
|
|
690
|
-
else if (_ === "object") {
|
|
691
|
-
if (typeof e.then == "function")
|
|
692
|
-
return Y(
|
|
693
|
-
J(e),
|
|
694
|
-
r,
|
|
695
|
-
s,
|
|
696
|
-
i,
|
|
697
|
-
a
|
|
698
|
-
);
|
|
699
|
-
throw r = String(e), Error(
|
|
700
|
-
"Objects are not valid as a React child (found: " + (r === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : r) + "). If you meant to render a collection of children, use an array instead."
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
|
-
return d;
|
|
704
|
-
}
|
|
705
|
-
function q(e, r, s) {
|
|
706
|
-
if (e == null) return e;
|
|
707
|
-
var i = [], a = 0;
|
|
708
|
-
return Y(e, i, "", "", function(_) {
|
|
709
|
-
return r.call(s, _, a++);
|
|
710
|
-
}), i;
|
|
711
|
-
}
|
|
712
|
-
function te(e) {
|
|
713
|
-
if (e._status === -1) {
|
|
714
|
-
var r = e._result;
|
|
715
|
-
r = r(), r.then(
|
|
716
|
-
function(s) {
|
|
717
|
-
(e._status === 0 || e._status === -1) && (e._status = 1, e._result = s);
|
|
718
|
-
},
|
|
719
|
-
function(s) {
|
|
720
|
-
(e._status === 0 || e._status === -1) && (e._status = 2, e._result = s);
|
|
721
|
-
}
|
|
722
|
-
), e._status === -1 && (e._status = 0, e._result = r);
|
|
723
|
-
}
|
|
724
|
-
if (e._status === 1)
|
|
725
|
-
return r = e._result, r === void 0 && console.error(
|
|
726
|
-
`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
121
|
+
};
|
|
122
|
+
var createErrors = () => {
|
|
123
|
+
const [errors, setErrors] = createSignal({});
|
|
124
|
+
const getError = (name) => {
|
|
125
|
+
return get(errors(), name);
|
|
126
|
+
};
|
|
127
|
+
const appendError = (name, error) => {
|
|
128
|
+
setErrors((prev) => {
|
|
129
|
+
const newState = { ...prev, [name]: error };
|
|
130
|
+
return newState;
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
const removeError = (name) => {
|
|
134
|
+
setErrors((prev) => {
|
|
135
|
+
const newState = { ...prev };
|
|
136
|
+
delete newState[name];
|
|
137
|
+
return newState;
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const resetErrors = () => {
|
|
141
|
+
setErrors({});
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
errors,
|
|
145
|
+
appendError,
|
|
146
|
+
removeError,
|
|
147
|
+
resetErrors,
|
|
148
|
+
getError
|
|
149
|
+
};
|
|
150
|
+
};
|
|
727
151
|
|
|
728
|
-
|
|
729
|
-
|
|
152
|
+
// src/logic/create_rules.ts
|
|
153
|
+
var createRules = () => {
|
|
154
|
+
const rules = {};
|
|
155
|
+
const addRule = (name, options) => {
|
|
156
|
+
rules[name] = {
|
|
157
|
+
required: options.required,
|
|
158
|
+
min: options.min,
|
|
159
|
+
max: options.max,
|
|
160
|
+
minLength: options.minLength,
|
|
161
|
+
maxLength: options.maxLength,
|
|
162
|
+
pattern: options.pattern,
|
|
163
|
+
valueAsNumber: options.valueAsNumber,
|
|
164
|
+
validate: options.validate
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
const getRule = (name) => {
|
|
168
|
+
return rules[name];
|
|
169
|
+
};
|
|
170
|
+
return { rules, addRule, getRule };
|
|
171
|
+
};
|
|
730
172
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
173
|
+
// src/logic/create_fields.ts
|
|
174
|
+
var createFields = () => {
|
|
175
|
+
const fields = {};
|
|
176
|
+
const getField = (name) => {
|
|
177
|
+
return fields[name];
|
|
178
|
+
};
|
|
179
|
+
const setField = (name, element) => {
|
|
180
|
+
fields[name] = element;
|
|
181
|
+
};
|
|
182
|
+
return {
|
|
183
|
+
fields,
|
|
184
|
+
getField,
|
|
185
|
+
setField
|
|
186
|
+
};
|
|
187
|
+
};
|
|
735
188
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
throw e._result;
|
|
741
|
-
}
|
|
742
|
-
function C() {
|
|
743
|
-
var e = g.H;
|
|
744
|
-
return e === null && console.error(
|
|
745
|
-
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
746
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
747
|
-
2. You might be breaking the Rules of Hooks
|
|
748
|
-
3. You might have more than one copy of React in the same app
|
|
749
|
-
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
|
|
750
|
-
), e;
|
|
751
|
-
}
|
|
752
|
-
function re() {
|
|
753
|
-
}
|
|
754
|
-
function V(e) {
|
|
755
|
-
if (pe === null)
|
|
756
|
-
try {
|
|
757
|
-
var r = ("require" + Math.random()).slice(0, 7);
|
|
758
|
-
pe = (n && n[r]).call(
|
|
759
|
-
n,
|
|
760
|
-
"timers"
|
|
761
|
-
).setImmediate;
|
|
762
|
-
} catch {
|
|
763
|
-
pe = function(i) {
|
|
764
|
-
Pe === !1 && (Pe = !0, typeof MessageChannel > "u" && console.error(
|
|
765
|
-
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
766
|
-
));
|
|
767
|
-
var a = new MessageChannel();
|
|
768
|
-
a.port1.onmessage = i, a.port2.postMessage(void 0);
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
return pe(e);
|
|
772
|
-
}
|
|
773
|
-
function l(e) {
|
|
774
|
-
return 1 < e.length && typeof AggregateError == "function" ? new AggregateError(e) : e[0];
|
|
775
|
-
}
|
|
776
|
-
function E(e, r) {
|
|
777
|
-
r !== de - 1 && console.error(
|
|
778
|
-
"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
|
|
779
|
-
), de = r;
|
|
780
|
-
}
|
|
781
|
-
function w(e, r, s) {
|
|
782
|
-
var i = g.actQueue;
|
|
783
|
-
if (i !== null)
|
|
784
|
-
if (i.length !== 0)
|
|
785
|
-
try {
|
|
786
|
-
P(i), V(function() {
|
|
787
|
-
return w(e, r, s);
|
|
788
|
-
});
|
|
789
|
-
return;
|
|
790
|
-
} catch (a) {
|
|
791
|
-
g.thrownErrors.push(a);
|
|
792
|
-
}
|
|
793
|
-
else g.actQueue = null;
|
|
794
|
-
0 < g.thrownErrors.length ? (i = l(g.thrownErrors), g.thrownErrors.length = 0, s(i)) : r(e);
|
|
795
|
-
}
|
|
796
|
-
function P(e) {
|
|
797
|
-
if (!ve) {
|
|
798
|
-
ve = !0;
|
|
799
|
-
var r = 0;
|
|
800
|
-
try {
|
|
801
|
-
for (; r < e.length; r++) {
|
|
802
|
-
var s = e[r];
|
|
803
|
-
do {
|
|
804
|
-
g.didUsePromise = !1;
|
|
805
|
-
var i = s(!1);
|
|
806
|
-
if (i !== null) {
|
|
807
|
-
if (g.didUsePromise) {
|
|
808
|
-
e[r] = s, e.splice(0, r);
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
s = i;
|
|
812
|
-
} else break;
|
|
813
|
-
} while (!0);
|
|
814
|
-
}
|
|
815
|
-
e.length = 0;
|
|
816
|
-
} catch (a) {
|
|
817
|
-
e.splice(0, r + 1), g.thrownErrors.push(a);
|
|
818
|
-
} finally {
|
|
819
|
-
ve = !1;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
824
|
-
var D = Symbol.for("react.transitional.element"), ce = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), c = Symbol.for("react.consumer"), R = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), ne = Symbol.for("react.lazy"), We = Symbol.for("react.activity"), _e = Symbol.iterator, Ee = {}, we = {
|
|
825
|
-
isMounted: function() {
|
|
826
|
-
return !1;
|
|
827
|
-
},
|
|
828
|
-
enqueueForceUpdate: function(e) {
|
|
829
|
-
T(e, "forceUpdate");
|
|
830
|
-
},
|
|
831
|
-
enqueueReplaceState: function(e) {
|
|
832
|
-
T(e, "replaceState");
|
|
833
|
-
},
|
|
834
|
-
enqueueSetState: function(e) {
|
|
835
|
-
T(e, "setState");
|
|
836
|
-
}
|
|
837
|
-
}, Re = Object.assign, he = {};
|
|
838
|
-
Object.freeze(he), k.prototype.isReactComponent = {}, k.prototype.setState = function(e, r) {
|
|
839
|
-
if (typeof e != "object" && typeof e != "function" && e != null)
|
|
840
|
-
throw Error(
|
|
841
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
842
|
-
);
|
|
843
|
-
this.updater.enqueueSetState(this, e, r, "setState");
|
|
844
|
-
}, k.prototype.forceUpdate = function(e) {
|
|
845
|
-
this.updater.enqueueForceUpdate(this, e, "forceUpdate");
|
|
846
|
-
};
|
|
847
|
-
var H = {
|
|
848
|
-
isMounted: [
|
|
849
|
-
"isMounted",
|
|
850
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
851
|
-
],
|
|
852
|
-
replaceState: [
|
|
853
|
-
"replaceState",
|
|
854
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
855
|
-
]
|
|
856
|
-
}, fe;
|
|
857
|
-
for (fe in H)
|
|
858
|
-
H.hasOwnProperty(fe) && y(fe, H[fe]);
|
|
859
|
-
N.prototype = k.prototype, H = j.prototype = new N(), H.constructor = j, Re(H, k.prototype), H.isPureReactComponent = !0;
|
|
860
|
-
var Te = Array.isArray, ze = Symbol.for("react.client.reference"), g = {
|
|
861
|
-
H: null,
|
|
862
|
-
A: null,
|
|
863
|
-
T: null,
|
|
864
|
-
S: null,
|
|
865
|
-
V: null,
|
|
866
|
-
actQueue: null,
|
|
867
|
-
isBatchingLegacy: !1,
|
|
868
|
-
didScheduleLegacyUpdate: !1,
|
|
869
|
-
didUsePromise: !1,
|
|
870
|
-
thrownErrors: [],
|
|
871
|
-
getCurrentStack: null,
|
|
872
|
-
recentlyCreatedOwnerStacks: 0
|
|
873
|
-
}, le = Object.prototype.hasOwnProperty, be = console.createTask ? console.createTask : function() {
|
|
874
|
-
return null;
|
|
875
|
-
};
|
|
876
|
-
H = {
|
|
877
|
-
"react-stack-bottom-frame": function(e) {
|
|
878
|
-
return e();
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
var Oe, Ce, Se = {}, xe = H["react-stack-bottom-frame"].bind(H, Q)(), Ve = be(W(Q)), Ae = !1, ke = /\/+/g, je = typeof reportError == "function" ? reportError : function(e) {
|
|
882
|
-
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
883
|
-
var r = new window.ErrorEvent("error", {
|
|
884
|
-
bubbles: !0,
|
|
885
|
-
cancelable: !0,
|
|
886
|
-
message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
|
|
887
|
-
error: e
|
|
888
|
-
});
|
|
889
|
-
if (!window.dispatchEvent(r)) return;
|
|
890
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
891
|
-
process.emit("uncaughtException", e);
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
console.error(e);
|
|
895
|
-
}, Pe = !1, pe = null, de = 0, me = !1, ve = !1, Ne = typeof queueMicrotask == "function" ? function(e) {
|
|
896
|
-
queueMicrotask(function() {
|
|
897
|
-
return queueMicrotask(e);
|
|
898
|
-
});
|
|
899
|
-
} : V;
|
|
900
|
-
H = Object.freeze({
|
|
901
|
-
__proto__: null,
|
|
902
|
-
c: function(e) {
|
|
903
|
-
return C().useMemoCache(e);
|
|
904
|
-
}
|
|
905
|
-
}), u.Children = {
|
|
906
|
-
map: q,
|
|
907
|
-
forEach: function(e, r, s) {
|
|
908
|
-
q(
|
|
909
|
-
e,
|
|
910
|
-
function() {
|
|
911
|
-
r.apply(this, arguments);
|
|
912
|
-
},
|
|
913
|
-
s
|
|
914
|
-
);
|
|
915
|
-
},
|
|
916
|
-
count: function(e) {
|
|
917
|
-
var r = 0;
|
|
918
|
-
return q(e, function() {
|
|
919
|
-
r++;
|
|
920
|
-
}), r;
|
|
921
|
-
},
|
|
922
|
-
toArray: function(e) {
|
|
923
|
-
return q(e, function(r) {
|
|
924
|
-
return r;
|
|
925
|
-
}) || [];
|
|
926
|
-
},
|
|
927
|
-
only: function(e) {
|
|
928
|
-
if (!I(e))
|
|
929
|
-
throw Error(
|
|
930
|
-
"React.Children.only expected to receive a single React element child."
|
|
931
|
-
);
|
|
932
|
-
return e;
|
|
933
|
-
}
|
|
934
|
-
}, u.Component = k, u.Fragment = t, u.Profiler = f, u.PureComponent = j, u.StrictMode = o, u.Suspense = m, u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = g, u.__COMPILER_RUNTIME = H, u.act = function(e) {
|
|
935
|
-
var r = g.actQueue, s = de;
|
|
936
|
-
de++;
|
|
937
|
-
var i = g.actQueue = r !== null ? r : [], a = !1;
|
|
938
|
-
try {
|
|
939
|
-
var _ = e();
|
|
940
|
-
} catch (h) {
|
|
941
|
-
g.thrownErrors.push(h);
|
|
942
|
-
}
|
|
943
|
-
if (0 < g.thrownErrors.length)
|
|
944
|
-
throw E(r, s), e = l(g.thrownErrors), g.thrownErrors.length = 0, e;
|
|
945
|
-
if (_ !== null && typeof _ == "object" && typeof _.then == "function") {
|
|
946
|
-
var d = _;
|
|
947
|
-
return Ne(function() {
|
|
948
|
-
a || me || (me = !0, console.error(
|
|
949
|
-
"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
|
|
950
|
-
));
|
|
951
|
-
}), {
|
|
952
|
-
then: function(h, G) {
|
|
953
|
-
a = !0, d.then(
|
|
954
|
-
function(oe) {
|
|
955
|
-
if (E(r, s), s === 0) {
|
|
956
|
-
try {
|
|
957
|
-
P(i), V(function() {
|
|
958
|
-
return w(
|
|
959
|
-
oe,
|
|
960
|
-
h,
|
|
961
|
-
G
|
|
962
|
-
);
|
|
963
|
-
});
|
|
964
|
-
} catch (Be) {
|
|
965
|
-
g.thrownErrors.push(Be);
|
|
966
|
-
}
|
|
967
|
-
if (0 < g.thrownErrors.length) {
|
|
968
|
-
var Ge = l(
|
|
969
|
-
g.thrownErrors
|
|
970
|
-
);
|
|
971
|
-
g.thrownErrors.length = 0, G(Ge);
|
|
972
|
-
}
|
|
973
|
-
} else h(oe);
|
|
974
|
-
},
|
|
975
|
-
function(oe) {
|
|
976
|
-
E(r, s), 0 < g.thrownErrors.length && (oe = l(
|
|
977
|
-
g.thrownErrors
|
|
978
|
-
), g.thrownErrors.length = 0), G(oe);
|
|
979
|
-
}
|
|
980
|
-
);
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
var O = _;
|
|
985
|
-
if (E(r, s), s === 0 && (P(i), i.length !== 0 && Ne(function() {
|
|
986
|
-
a || me || (me = !0, console.error(
|
|
987
|
-
"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
|
|
988
|
-
));
|
|
989
|
-
}), g.actQueue = null), 0 < g.thrownErrors.length)
|
|
990
|
-
throw e = l(g.thrownErrors), g.thrownErrors.length = 0, e;
|
|
991
|
-
return {
|
|
992
|
-
then: function(h, G) {
|
|
993
|
-
a = !0, s === 0 ? (g.actQueue = i, V(function() {
|
|
994
|
-
return w(
|
|
995
|
-
O,
|
|
996
|
-
h,
|
|
997
|
-
G
|
|
998
|
-
);
|
|
999
|
-
})) : h(O);
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
}, u.cache = function(e) {
|
|
1003
|
-
return function() {
|
|
1004
|
-
return e.apply(null, arguments);
|
|
1005
|
-
};
|
|
1006
|
-
}, u.captureOwnerStack = function() {
|
|
1007
|
-
var e = g.getCurrentStack;
|
|
1008
|
-
return e === null ? null : e();
|
|
1009
|
-
}, u.cloneElement = function(e, r, s) {
|
|
1010
|
-
if (e == null)
|
|
1011
|
-
throw Error(
|
|
1012
|
-
"The argument must be a React element, but you passed " + e + "."
|
|
1013
|
-
);
|
|
1014
|
-
var i = Re({}, e.props), a = e.key, _ = e._owner;
|
|
1015
|
-
if (r != null) {
|
|
1016
|
-
var d;
|
|
1017
|
-
e: {
|
|
1018
|
-
if (le.call(r, "ref") && (d = Object.getOwnPropertyDescriptor(
|
|
1019
|
-
r,
|
|
1020
|
-
"ref"
|
|
1021
|
-
).get) && d.isReactWarning) {
|
|
1022
|
-
d = !1;
|
|
1023
|
-
break e;
|
|
1024
|
-
}
|
|
1025
|
-
d = r.ref !== void 0;
|
|
1026
|
-
}
|
|
1027
|
-
d && (_ = B()), K(r) && ($(r.key), a = "" + r.key);
|
|
1028
|
-
for (O in r)
|
|
1029
|
-
!le.call(r, O) || O === "key" || O === "__self" || O === "__source" || O === "ref" && r.ref === void 0 || (i[O] = r[O]);
|
|
1030
|
-
}
|
|
1031
|
-
var O = arguments.length - 2;
|
|
1032
|
-
if (O === 1) i.children = s;
|
|
1033
|
-
else if (1 < O) {
|
|
1034
|
-
d = Array(O);
|
|
1035
|
-
for (var h = 0; h < O; h++)
|
|
1036
|
-
d[h] = arguments[h + 2];
|
|
1037
|
-
i.children = d;
|
|
1038
|
-
}
|
|
1039
|
-
for (i = z(
|
|
1040
|
-
e.type,
|
|
1041
|
-
a,
|
|
1042
|
-
void 0,
|
|
1043
|
-
void 0,
|
|
1044
|
-
_,
|
|
1045
|
-
i,
|
|
1046
|
-
e._debugStack,
|
|
1047
|
-
e._debugTask
|
|
1048
|
-
), a = 2; a < arguments.length; a++)
|
|
1049
|
-
_ = arguments[a], I(_) && _._store && (_._store.validated = 1);
|
|
1050
|
-
return i;
|
|
1051
|
-
}, u.createContext = function(e) {
|
|
1052
|
-
return e = {
|
|
1053
|
-
$$typeof: R,
|
|
1054
|
-
_currentValue: e,
|
|
1055
|
-
_currentValue2: e,
|
|
1056
|
-
_threadCount: 0,
|
|
1057
|
-
Provider: null,
|
|
1058
|
-
Consumer: null
|
|
1059
|
-
}, e.Provider = e, e.Consumer = {
|
|
1060
|
-
$$typeof: c,
|
|
1061
|
-
_context: e
|
|
1062
|
-
}, e._currentRenderer = null, e._currentRenderer2 = null, e;
|
|
1063
|
-
}, u.createElement = function(e, r, s) {
|
|
1064
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
1065
|
-
var a = arguments[i];
|
|
1066
|
-
I(a) && a._store && (a._store.validated = 1);
|
|
1067
|
-
}
|
|
1068
|
-
if (i = {}, a = null, r != null)
|
|
1069
|
-
for (h in Ce || !("__self" in r) || "key" in r || (Ce = !0, console.warn(
|
|
1070
|
-
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1071
|
-
)), K(r) && ($(r.key), a = "" + r.key), r)
|
|
1072
|
-
le.call(r, h) && h !== "key" && h !== "__self" && h !== "__source" && (i[h] = r[h]);
|
|
1073
|
-
var _ = arguments.length - 2;
|
|
1074
|
-
if (_ === 1) i.children = s;
|
|
1075
|
-
else if (1 < _) {
|
|
1076
|
-
for (var d = Array(_), O = 0; O < _; O++)
|
|
1077
|
-
d[O] = arguments[O + 2];
|
|
1078
|
-
Object.freeze && Object.freeze(d), i.children = d;
|
|
1079
|
-
}
|
|
1080
|
-
if (e && e.defaultProps)
|
|
1081
|
-
for (h in _ = e.defaultProps, _)
|
|
1082
|
-
i[h] === void 0 && (i[h] = _[h]);
|
|
1083
|
-
a && ee(
|
|
1084
|
-
i,
|
|
1085
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
1086
|
-
);
|
|
1087
|
-
var h = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
1088
|
-
return z(
|
|
1089
|
-
e,
|
|
1090
|
-
a,
|
|
1091
|
-
void 0,
|
|
1092
|
-
void 0,
|
|
1093
|
-
B(),
|
|
1094
|
-
i,
|
|
1095
|
-
h ? Error("react-stack-top-frame") : xe,
|
|
1096
|
-
h ? be(W(e)) : Ve
|
|
1097
|
-
);
|
|
1098
|
-
}, u.createRef = function() {
|
|
1099
|
-
var e = { current: null };
|
|
1100
|
-
return Object.seal(e), e;
|
|
1101
|
-
}, u.forwardRef = function(e) {
|
|
1102
|
-
e != null && e.$$typeof === A ? console.error(
|
|
1103
|
-
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
1104
|
-
) : typeof e != "function" ? console.error(
|
|
1105
|
-
"forwardRef requires a render function but was given %s.",
|
|
1106
|
-
e === null ? "null" : typeof e
|
|
1107
|
-
) : e.length !== 0 && e.length !== 2 && console.error(
|
|
1108
|
-
"forwardRef render functions accept exactly two parameters: props and ref. %s",
|
|
1109
|
-
e.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
|
|
1110
|
-
), e != null && e.defaultProps != null && console.error(
|
|
1111
|
-
"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
|
|
1112
|
-
);
|
|
1113
|
-
var r = { $$typeof: S, render: e }, s;
|
|
1114
|
-
return Object.defineProperty(r, "displayName", {
|
|
1115
|
-
enumerable: !1,
|
|
1116
|
-
configurable: !0,
|
|
1117
|
-
get: function() {
|
|
1118
|
-
return s;
|
|
1119
|
-
},
|
|
1120
|
-
set: function(i) {
|
|
1121
|
-
s = i, e.name || e.displayName || (Object.defineProperty(e, "name", { value: i }), e.displayName = i);
|
|
1122
|
-
}
|
|
1123
|
-
}), r;
|
|
1124
|
-
}, u.isValidElement = I, u.lazy = function(e) {
|
|
1125
|
-
return {
|
|
1126
|
-
$$typeof: ne,
|
|
1127
|
-
_payload: { _status: -1, _result: e },
|
|
1128
|
-
_init: te
|
|
1129
|
-
};
|
|
1130
|
-
}, u.memo = function(e, r) {
|
|
1131
|
-
e == null && console.error(
|
|
1132
|
-
"memo: The first argument must be a component. Instead received: %s",
|
|
1133
|
-
e === null ? "null" : typeof e
|
|
1134
|
-
), r = {
|
|
1135
|
-
$$typeof: A,
|
|
1136
|
-
type: e,
|
|
1137
|
-
compare: r === void 0 ? null : r
|
|
1138
|
-
};
|
|
1139
|
-
var s;
|
|
1140
|
-
return Object.defineProperty(r, "displayName", {
|
|
1141
|
-
enumerable: !1,
|
|
1142
|
-
configurable: !0,
|
|
1143
|
-
get: function() {
|
|
1144
|
-
return s;
|
|
1145
|
-
},
|
|
1146
|
-
set: function(i) {
|
|
1147
|
-
s = i, e.name || e.displayName || (Object.defineProperty(e, "name", { value: i }), e.displayName = i);
|
|
1148
|
-
}
|
|
1149
|
-
}), r;
|
|
1150
|
-
}, u.startTransition = function(e) {
|
|
1151
|
-
var r = g.T, s = {};
|
|
1152
|
-
g.T = s, s._updatedFibers = /* @__PURE__ */ new Set();
|
|
1153
|
-
try {
|
|
1154
|
-
var i = e(), a = g.S;
|
|
1155
|
-
a !== null && a(s, i), typeof i == "object" && i !== null && typeof i.then == "function" && i.then(re, je);
|
|
1156
|
-
} catch (_) {
|
|
1157
|
-
je(_);
|
|
1158
|
-
} finally {
|
|
1159
|
-
r === null && s._updatedFibers && (e = s._updatedFibers.size, s._updatedFibers.clear(), 10 < e && console.warn(
|
|
1160
|
-
"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
|
|
1161
|
-
)), g.T = r;
|
|
1162
|
-
}
|
|
1163
|
-
}, u.unstable_useCacheRefresh = function() {
|
|
1164
|
-
return C().useCacheRefresh();
|
|
1165
|
-
}, u.use = function(e) {
|
|
1166
|
-
return C().use(e);
|
|
1167
|
-
}, u.useActionState = function(e, r, s) {
|
|
1168
|
-
return C().useActionState(
|
|
1169
|
-
e,
|
|
1170
|
-
r,
|
|
1171
|
-
s
|
|
1172
|
-
);
|
|
1173
|
-
}, u.useCallback = function(e, r) {
|
|
1174
|
-
return C().useCallback(e, r);
|
|
1175
|
-
}, u.useContext = function(e) {
|
|
1176
|
-
var r = C();
|
|
1177
|
-
return e.$$typeof === c && console.error(
|
|
1178
|
-
"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
|
|
1179
|
-
), r.useContext(e);
|
|
1180
|
-
}, u.useDebugValue = function(e, r) {
|
|
1181
|
-
return C().useDebugValue(e, r);
|
|
1182
|
-
}, u.useDeferredValue = function(e, r) {
|
|
1183
|
-
return C().useDeferredValue(e, r);
|
|
1184
|
-
}, u.useEffect = function(e, r, s) {
|
|
1185
|
-
e == null && console.warn(
|
|
1186
|
-
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1187
|
-
);
|
|
1188
|
-
var i = C();
|
|
1189
|
-
if (typeof s == "function")
|
|
1190
|
-
throw Error(
|
|
1191
|
-
"useEffect CRUD overload is not enabled in this build of React."
|
|
1192
|
-
);
|
|
1193
|
-
return i.useEffect(e, r);
|
|
1194
|
-
}, u.useId = function() {
|
|
1195
|
-
return C().useId();
|
|
1196
|
-
}, u.useImperativeHandle = function(e, r, s) {
|
|
1197
|
-
return C().useImperativeHandle(e, r, s);
|
|
1198
|
-
}, u.useInsertionEffect = function(e, r) {
|
|
1199
|
-
return e == null && console.warn(
|
|
1200
|
-
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1201
|
-
), C().useInsertionEffect(e, r);
|
|
1202
|
-
}, u.useLayoutEffect = function(e, r) {
|
|
1203
|
-
return e == null && console.warn(
|
|
1204
|
-
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1205
|
-
), C().useLayoutEffect(e, r);
|
|
1206
|
-
}, u.useMemo = function(e, r) {
|
|
1207
|
-
return C().useMemo(e, r);
|
|
1208
|
-
}, u.useOptimistic = function(e, r) {
|
|
1209
|
-
return C().useOptimistic(e, r);
|
|
1210
|
-
}, u.useReducer = function(e, r, s) {
|
|
1211
|
-
return C().useReducer(e, r, s);
|
|
1212
|
-
}, u.useRef = function(e) {
|
|
1213
|
-
return C().useRef(e);
|
|
1214
|
-
}, u.useState = function(e) {
|
|
1215
|
-
return C().useState(e);
|
|
1216
|
-
}, u.useSyncExternalStore = function(e, r, s) {
|
|
1217
|
-
return C().useSyncExternalStore(
|
|
1218
|
-
e,
|
|
1219
|
-
r,
|
|
1220
|
-
s
|
|
1221
|
-
);
|
|
1222
|
-
}, u.useTransition = function() {
|
|
1223
|
-
return C().useTransition();
|
|
1224
|
-
}, u.version = "19.1.0", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1225
|
-
}();
|
|
1226
|
-
}(ae, ae.exports)), ae.exports;
|
|
1227
|
-
}
|
|
1228
|
-
var $e;
|
|
1229
|
-
function nt() {
|
|
1230
|
-
return $e || ($e = 1, process.env.NODE_ENV === "production" ? ye.exports = tt() : ye.exports = rt()), ye.exports;
|
|
1231
|
-
}
|
|
1232
|
-
var ot = nt();
|
|
1233
|
-
const ut = /* @__PURE__ */ et(ot);
|
|
1234
|
-
var st = (n) => n instanceof Date, Ye = (n) => n == null;
|
|
1235
|
-
const it = (n) => typeof n == "object";
|
|
1236
|
-
var Ue = (n) => !Ye(n) && !Array.isArray(n) && it(n) && !st(n), qe = (n) => Array.isArray(n) ? n.filter(Boolean) : [], Ie = (n) => n === void 0, se = (n, u, y) => {
|
|
1237
|
-
if (!u || !Ue(n))
|
|
1238
|
-
return y;
|
|
1239
|
-
const v = qe(u.split(/[,[\].]+?/)).reduce((T, k) => Ye(T) ? T : T[k], n);
|
|
1240
|
-
return Ie(v) || v === n ? Ie(n[u]) ? y : n[u] : v;
|
|
1241
|
-
}, at = (n) => /^\w*$/.test(n), ct = (n) => qe(n.replace(/["|']|\]/g, "").split(/\.|\[/)), De = (n, u, y) => {
|
|
1242
|
-
let v = -1;
|
|
1243
|
-
const T = at(u) ? [u] : ct(u), k = T.length, N = k - 1;
|
|
1244
|
-
for (; ++v < k; ) {
|
|
1245
|
-
const j = T[v];
|
|
1246
|
-
let L = y;
|
|
1247
|
-
if (v !== N) {
|
|
1248
|
-
const $ = n[j];
|
|
1249
|
-
L = Ue($) || Array.isArray($) ? $ : isNaN(+T[v + 1]) ? {} : [];
|
|
1250
|
-
}
|
|
1251
|
-
if (j === "__proto__" || j === "constructor" || j === "prototype")
|
|
1252
|
-
return;
|
|
1253
|
-
n[j] = L, n = n[j];
|
|
189
|
+
// src/logic/format_value.ts
|
|
190
|
+
var formatValue = (value, rules) => {
|
|
191
|
+
if (rules.valueAsNumber) {
|
|
192
|
+
return Number(value);
|
|
1254
193
|
}
|
|
194
|
+
return value;
|
|
1255
195
|
};
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
if (y.max && Number(v) > Number(ie(y.max)))
|
|
1264
|
-
return { type: "max", message: ue(y.max) };
|
|
1265
|
-
if (y.minLength && v.length < ie(y.minLength))
|
|
1266
|
-
return { type: "minLength", message: ue(y.minLength) };
|
|
1267
|
-
if (y.maxLength && v.length > ie(y.maxLength))
|
|
1268
|
-
return { type: "maxLength", message: ue(y.maxLength) };
|
|
1269
|
-
if (y.pattern && !ie(y.pattern).test(v))
|
|
1270
|
-
return { type: "pattern", message: ue(y.pattern) };
|
|
1271
|
-
if (y.validate) {
|
|
1272
|
-
const T = y.validate(v, n);
|
|
1273
|
-
if (T === !1)
|
|
1274
|
-
return { type: "validate" };
|
|
1275
|
-
if (typeof T == "string")
|
|
1276
|
-
return { type: "validate", message: T };
|
|
1277
|
-
}
|
|
1278
|
-
}, lt = () => {
|
|
1279
|
-
const [n, u] = He({});
|
|
1280
|
-
return {
|
|
1281
|
-
errors: n,
|
|
1282
|
-
appendError: (N, j) => {
|
|
1283
|
-
u((L) => ({ ...L, [N]: j }));
|
|
1284
|
-
},
|
|
1285
|
-
removeError: (N) => {
|
|
1286
|
-
u((j) => {
|
|
1287
|
-
const L = { ...j };
|
|
1288
|
-
return delete L[N], L;
|
|
1289
|
-
});
|
|
1290
|
-
},
|
|
1291
|
-
resetErrors: () => {
|
|
1292
|
-
u({});
|
|
1293
|
-
},
|
|
1294
|
-
getError: (N) => se(n(), N)
|
|
1295
|
-
};
|
|
1296
|
-
}, pt = () => {
|
|
1297
|
-
const n = {};
|
|
1298
|
-
return { rules: n, addRule: (v, T) => {
|
|
1299
|
-
n[v] = {
|
|
1300
|
-
required: T.required,
|
|
1301
|
-
min: T.min,
|
|
1302
|
-
max: T.max,
|
|
1303
|
-
minLength: T.minLength,
|
|
1304
|
-
maxLength: T.maxLength,
|
|
1305
|
-
pattern: T.pattern,
|
|
1306
|
-
valueAsNumber: T.valueAsNumber,
|
|
1307
|
-
validate: T.validate
|
|
196
|
+
|
|
197
|
+
// src/utils/resolver.ts
|
|
198
|
+
var getResolverFields = (fields) => {
|
|
199
|
+
return Object.entries(fields).reduce((acc, [name, ref]) => {
|
|
200
|
+
acc[name] = {
|
|
201
|
+
ref,
|
|
202
|
+
name
|
|
1308
203
|
};
|
|
1309
|
-
|
|
1310
|
-
},
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
204
|
+
return acc;
|
|
205
|
+
}, {});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// src/use_form.ts
|
|
209
|
+
var useForm = (arg = { defaultValues: {} }) => {
|
|
210
|
+
const { defaultValues, mode = "onInput", resolver } = arg;
|
|
211
|
+
const { fields, getField, setField } = createFields();
|
|
212
|
+
const { rules, addRule, getRule } = createRules();
|
|
213
|
+
const [values, setValues] = createSignal(defaultValues);
|
|
214
|
+
const { errors, appendError, removeError, resetErrors, getError } = createErrors();
|
|
215
|
+
const isValid = createMemo(() => {
|
|
216
|
+
return !Object.keys(errors()).length;
|
|
217
|
+
});
|
|
218
|
+
const setFieldError = (name, error) => {
|
|
219
|
+
const field = getField(name);
|
|
220
|
+
if (field) {
|
|
221
|
+
error.ref = field;
|
|
1317
222
|
}
|
|
223
|
+
appendError(name, error);
|
|
224
|
+
};
|
|
225
|
+
const clearFieldError = (name) => {
|
|
226
|
+
removeError(name);
|
|
1318
227
|
};
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
name: y
|
|
1322
|
-
}, u), {}), vt = (n = { defaultValues: {} }) => {
|
|
1323
|
-
const { defaultValues: u, mode: y = "onInput", resolver: v } = n, { fields: T, getField: k, setField: N } = dt(), { rules: j, addRule: L, getRule: $ } = pt(), [M, W] = He(u), { errors: B, appendError: Q, removeError: K, resetErrors: ee, getError: U } = lt(), z = Qe(() => !Object.keys(B()).length), x = (l, E) => {
|
|
1324
|
-
const w = k(l);
|
|
1325
|
-
w && (E.ref = w), Q(l, E);
|
|
1326
|
-
}, I = (l) => {
|
|
1327
|
-
K(l);
|
|
1328
|
-
}, X = async (l) => {
|
|
1329
|
-
if (!v)
|
|
228
|
+
const runSchema = async (names) => {
|
|
229
|
+
if (!resolver) {
|
|
1330
230
|
return;
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
231
|
+
}
|
|
232
|
+
const result = await resolver(values(), null, {
|
|
233
|
+
fields: getResolverFields(fields),
|
|
234
|
+
shouldUseNativeValidation: false
|
|
1334
235
|
});
|
|
1335
|
-
for (const
|
|
1336
|
-
const
|
|
1337
|
-
|
|
236
|
+
for (const name of names) {
|
|
237
|
+
const error = get(result.errors, name);
|
|
238
|
+
if (error) {
|
|
239
|
+
setFieldError(name, error);
|
|
240
|
+
} else {
|
|
241
|
+
clearFieldError(name);
|
|
242
|
+
}
|
|
1338
243
|
}
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
|
|
244
|
+
};
|
|
245
|
+
const validateField = (name) => {
|
|
246
|
+
if (resolver) {
|
|
247
|
+
runSchema([name]);
|
|
1342
248
|
return;
|
|
1343
249
|
}
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
250
|
+
const rule = getRule(name);
|
|
251
|
+
const error = validate(values(), name, rule);
|
|
252
|
+
if (error) {
|
|
253
|
+
setFieldError(name, error);
|
|
254
|
+
} else {
|
|
255
|
+
clearFieldError(name);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
const validateAllFields = async () => {
|
|
259
|
+
if (resolver) {
|
|
260
|
+
await runSchema(Object.keys(fields));
|
|
1349
261
|
return;
|
|
1350
262
|
}
|
|
1351
|
-
Object.keys(
|
|
1352
|
-
|
|
263
|
+
Object.keys(rules).forEach((key) => {
|
|
264
|
+
validateField(key);
|
|
1353
265
|
});
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
for (const
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1360
|
-
|
|
266
|
+
};
|
|
267
|
+
const focusFirstError = () => {
|
|
268
|
+
const names = Object.keys(fields);
|
|
269
|
+
for (const name of names) {
|
|
270
|
+
const error = getError(name);
|
|
271
|
+
if (error) {
|
|
272
|
+
error.ref?.focus();
|
|
1361
273
|
break;
|
|
1362
274
|
}
|
|
1363
275
|
}
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
276
|
+
};
|
|
277
|
+
const onFieldChange = (event, name) => {
|
|
278
|
+
const value = formatValue(getFieldValue(event), rules[name]);
|
|
279
|
+
setValues((prev) => {
|
|
280
|
+
const newState = { ...prev };
|
|
281
|
+
set(newState, name, value);
|
|
282
|
+
return newState;
|
|
283
|
+
});
|
|
284
|
+
validateField(name);
|
|
285
|
+
};
|
|
286
|
+
const register = (name, options = {}) => {
|
|
287
|
+
addRule(name, options);
|
|
288
|
+
return {
|
|
289
|
+
name,
|
|
290
|
+
// value: get(values(), name),
|
|
291
|
+
onInput(event) {
|
|
292
|
+
if (mode === "onChange") {
|
|
293
|
+
onFieldChange(event, name);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
onChange(event) {
|
|
297
|
+
if (mode === "onChange") {
|
|
298
|
+
onFieldChange(event, name);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
ref(element) {
|
|
302
|
+
const field = getField(name);
|
|
303
|
+
if (field) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
setField(name, element);
|
|
307
|
+
if (element) {
|
|
308
|
+
setFieldValue(element, get(values(), name));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
const getValues = (name) => {
|
|
314
|
+
if (name) {
|
|
315
|
+
return get(values(), name);
|
|
316
|
+
}
|
|
317
|
+
return values();
|
|
318
|
+
};
|
|
319
|
+
const setValue = (name, value) => {
|
|
320
|
+
setValues((prev) => {
|
|
321
|
+
const newValues = { ...prev };
|
|
322
|
+
set(newValues, name, value);
|
|
323
|
+
return newValues;
|
|
324
|
+
});
|
|
325
|
+
const field = getField(name);
|
|
326
|
+
if (field) {
|
|
327
|
+
setFieldValue(field, value);
|
|
1381
328
|
}
|
|
1382
|
-
}
|
|
329
|
+
};
|
|
330
|
+
const onSubmit = (submit) => {
|
|
331
|
+
return async (event) => {
|
|
332
|
+
event.preventDefault();
|
|
333
|
+
await validateAllFields();
|
|
334
|
+
if (isValid()) {
|
|
335
|
+
submit(getValues());
|
|
336
|
+
}
|
|
337
|
+
focusFirstError();
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
const reset = (newDefaultValues = {}) => {
|
|
341
|
+
const newValues = {
|
|
342
|
+
...structuredClone(defaultValues),
|
|
343
|
+
...newDefaultValues
|
|
344
|
+
};
|
|
345
|
+
setValues(() => newValues);
|
|
346
|
+
resetErrors();
|
|
347
|
+
Object.entries(fields).forEach(([name, field]) => {
|
|
348
|
+
if (field) {
|
|
349
|
+
setFieldValue(field, get(newValues, name));
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
};
|
|
1383
353
|
return {
|
|
1384
|
-
values
|
|
1385
|
-
errors
|
|
1386
|
-
isValid
|
|
1387
|
-
register
|
|
1388
|
-
getValues
|
|
1389
|
-
setValue
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
354
|
+
values,
|
|
355
|
+
errors,
|
|
356
|
+
isValid,
|
|
357
|
+
register,
|
|
358
|
+
getValues,
|
|
359
|
+
setValue,
|
|
360
|
+
onSubmit,
|
|
361
|
+
reset
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
var FormContext = createContext();
|
|
365
|
+
|
|
366
|
+
// src/form_provider.tsx
|
|
367
|
+
var FormProvider = (props) => {
|
|
368
|
+
return createComponent(FormContext.Provider, {
|
|
369
|
+
get value() {
|
|
370
|
+
return props.form;
|
|
1399
371
|
},
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
...structuredClone(u),
|
|
1403
|
-
...l
|
|
1404
|
-
};
|
|
1405
|
-
W(() => E), ee(), Object.entries(T).forEach(([w, P]) => {
|
|
1406
|
-
P && ge(P, se(E, w));
|
|
1407
|
-
});
|
|
372
|
+
get children() {
|
|
373
|
+
return props.children;
|
|
1408
374
|
}
|
|
1409
|
-
};
|
|
1410
|
-
}, Fe = Ke(), gt = (n) => Xe(Fe.Provider, {
|
|
1411
|
-
get value() {
|
|
1412
|
-
return n.form;
|
|
1413
|
-
},
|
|
1414
|
-
get children() {
|
|
1415
|
-
return n.children;
|
|
1416
|
-
}
|
|
1417
|
-
}), _t = () => {
|
|
1418
|
-
const n = Ze(Fe);
|
|
1419
|
-
if (!n)
|
|
1420
|
-
throw new Error("useFormContext: cannot find a FormProvider");
|
|
1421
|
-
return n;
|
|
375
|
+
});
|
|
1422
376
|
};
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
377
|
+
var useFormContext = () => {
|
|
378
|
+
const form = useContext(FormContext);
|
|
379
|
+
if (!form) {
|
|
380
|
+
throw new Error("useFormContext: cannot find a FormProvider");
|
|
381
|
+
}
|
|
382
|
+
return form;
|
|
1427
383
|
};
|
|
384
|
+
|
|
385
|
+
export { FormProvider, useForm, useFormContext };
|