@pnkx-lib/ui 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2260 +0,0 @@
1
- import * as De from "react";
2
- import C, { createContext as Sr, useContext as Cr, useEffect as Er } from "react";
3
- import { Typography as Ar } from "antd";
4
- var $n = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function Tr(e) {
6
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
- }
8
- var Le = { exports: {} }, ke = {};
9
- /**
10
- * @license React
11
- * react-jsx-runtime.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
- var pt;
19
- function kr() {
20
- if (pt) return ke;
21
- pt = 1;
22
- var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
23
- function t(n, s, a) {
24
- var l = null;
25
- if (a !== void 0 && (l = "" + a), s.key !== void 0 && (l = "" + s.key), "key" in s) {
26
- a = {};
27
- for (var c in s)
28
- c !== "key" && (a[c] = s[c]);
29
- } else a = s;
30
- return s = a.ref, {
31
- $$typeof: e,
32
- type: n,
33
- key: l,
34
- ref: s !== void 0 ? s : null,
35
- props: a
36
- };
37
- }
38
- return ke.Fragment = r, ke.jsx = t, ke.jsxs = t, ke;
39
- }
40
- var Ve = {};
41
- /**
42
- * @license React
43
- * react-jsx-runtime.development.js
44
- *
45
- * Copyright (c) Meta Platforms, Inc. and affiliates.
46
- *
47
- * This source code is licensed under the MIT license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */
50
- var xt;
51
- function Vr() {
52
- return xt || (xt = 1, process.env.NODE_ENV !== "production" && function() {
53
- function e(f) {
54
- if (f == null) return null;
55
- if (typeof f == "function")
56
- return f.$$typeof === fe ? null : f.displayName || f.name || null;
57
- if (typeof f == "string") return f;
58
- switch (f) {
59
- case R:
60
- return "Fragment";
61
- case j:
62
- return "Profiler";
63
- case M:
64
- return "StrictMode";
65
- case P:
66
- return "Suspense";
67
- case ye:
68
- return "SuspenseList";
69
- case ne:
70
- return "Activity";
71
- }
72
- if (typeof f == "object")
73
- switch (typeof f.tag == "number" && console.error(
74
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
- ), f.$$typeof) {
76
- case Y:
77
- return "Portal";
78
- case z:
79
- return (f.displayName || "Context") + ".Provider";
80
- case w:
81
- return (f._context.displayName || "Context") + ".Consumer";
82
- case B:
83
- var S = f.render;
84
- return f = f.displayName, f || (f = S.displayName || S.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
85
- case me:
86
- return S = f.displayName || null, S !== null ? S : e(f.type) || "Memo";
87
- case pe:
88
- S = f._payload, f = f._init;
89
- try {
90
- return e(f(S));
91
- } catch {
92
- }
93
- }
94
- return null;
95
- }
96
- function r(f) {
97
- return "" + f;
98
- }
99
- function t(f) {
100
- try {
101
- r(f);
102
- var S = !1;
103
- } catch {
104
- S = !0;
105
- }
106
- if (S) {
107
- S = console;
108
- var V = S.error, L = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
109
- return V.call(
110
- S,
111
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- L
113
- ), r(f);
114
- }
115
- }
116
- function n(f) {
117
- if (f === R) return "<>";
118
- if (typeof f == "object" && f !== null && f.$$typeof === pe)
119
- return "<...>";
120
- try {
121
- var S = e(f);
122
- return S ? "<" + S + ">" : "<...>";
123
- } catch {
124
- return "<...>";
125
- }
126
- }
127
- function s() {
128
- var f = Z.A;
129
- return f === null ? null : f.getOwner();
130
- }
131
- function a() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function l(f) {
135
- if (A.call(f, "key")) {
136
- var S = Object.getOwnPropertyDescriptor(f, "key").get;
137
- if (S && S.isReactWarning) return !1;
138
- }
139
- return f.key !== void 0;
140
- }
141
- function c(f, S) {
142
- function V() {
143
- $ || ($ = !0, console.error(
144
- "%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)",
145
- S
146
- ));
147
- }
148
- V.isReactWarning = !0, Object.defineProperty(f, "key", {
149
- get: V,
150
- configurable: !0
151
- });
152
- }
153
- function h() {
154
- var f = e(this.type);
155
- return G[f] || (G[f] = !0, console.error(
156
- "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."
157
- )), f = this.props.ref, f !== void 0 ? f : null;
158
- }
159
- function _(f, S, V, L, oe, te, Ae, xe) {
160
- return V = te.ref, f = {
161
- $$typeof: K,
162
- type: f,
163
- key: S,
164
- props: te,
165
- _owner: oe
166
- }, (V !== void 0 ? V : null) !== null ? Object.defineProperty(f, "ref", {
167
- enumerable: !1,
168
- get: h
169
- }) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
170
- configurable: !1,
171
- enumerable: !1,
172
- writable: !0,
173
- value: 0
174
- }), Object.defineProperty(f, "_debugInfo", {
175
- configurable: !1,
176
- enumerable: !1,
177
- writable: !0,
178
- value: null
179
- }), Object.defineProperty(f, "_debugStack", {
180
- configurable: !1,
181
- enumerable: !1,
182
- writable: !0,
183
- value: Ae
184
- }), Object.defineProperty(f, "_debugTask", {
185
- configurable: !1,
186
- enumerable: !1,
187
- writable: !0,
188
- value: xe
189
- }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
190
- }
191
- function v(f, S, V, L, oe, te, Ae, xe) {
192
- var H = S.children;
193
- if (H !== void 0)
194
- if (L)
195
- if (E(H)) {
196
- for (L = 0; L < H.length; L++)
197
- p(H[L]);
198
- Object.freeze && Object.freeze(H);
199
- } else
200
- console.error(
201
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
202
- );
203
- else p(H);
204
- if (A.call(S, "key")) {
205
- H = e(f);
206
- var le = Object.keys(S).filter(function(Te) {
207
- return Te !== "key";
208
- });
209
- L = 0 < le.length ? "{key: someKey, " + le.join(": ..., ") + ": ...}" : "{key: someKey}", he[H + L] || (le = 0 < le.length ? "{" + le.join(": ..., ") + ": ...}" : "{}", console.error(
210
- `A props object containing a "key" prop is being spread into JSX:
211
- let props = %s;
212
- <%s {...props} />
213
- React keys must be passed directly to JSX without using spread:
214
- let props = %s;
215
- <%s key={someKey} {...props} />`,
216
- L,
217
- H,
218
- le,
219
- H
220
- ), he[H + L] = !0);
221
- }
222
- if (H = null, V !== void 0 && (t(V), H = "" + V), l(S) && (t(S.key), H = "" + S.key), "key" in S) {
223
- V = {};
224
- for (var we in S)
225
- we !== "key" && (V[we] = S[we]);
226
- } else V = S;
227
- return H && c(
228
- V,
229
- typeof f == "function" ? f.displayName || f.name || "Unknown" : f
230
- ), _(
231
- f,
232
- H,
233
- te,
234
- oe,
235
- s(),
236
- V,
237
- Ae,
238
- xe
239
- );
240
- }
241
- function p(f) {
242
- typeof f == "object" && f !== null && f.$$typeof === K && f._store && (f._store.validated = 1);
243
- }
244
- var x = C, K = Symbol.for("react.transitional.element"), Y = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), j = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), z = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), ye = Symbol.for("react.suspense_list"), me = Symbol.for("react.memo"), pe = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), Z = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, E = Array.isArray, F = console.createTask ? console.createTask : function() {
245
- return null;
246
- };
247
- x = {
248
- "react-stack-bottom-frame": function(f) {
249
- return f();
250
- }
251
- };
252
- var $, G = {}, ee = x["react-stack-bottom-frame"].bind(
253
- x,
254
- a
255
- )(), se = F(n(a)), he = {};
256
- Ve.Fragment = R, Ve.jsx = function(f, S, V, L, oe) {
257
- var te = 1e4 > Z.recentlyCreatedOwnerStacks++;
258
- return v(
259
- f,
260
- S,
261
- V,
262
- !1,
263
- L,
264
- oe,
265
- te ? Error("react-stack-top-frame") : ee,
266
- te ? F(n(f)) : se
267
- );
268
- }, Ve.jsxs = function(f, S, V, L, oe) {
269
- var te = 1e4 > Z.recentlyCreatedOwnerStacks++;
270
- return v(
271
- f,
272
- S,
273
- V,
274
- !0,
275
- L,
276
- oe,
277
- te ? Error("react-stack-top-frame") : ee,
278
- te ? F(n(f)) : se
279
- );
280
- };
281
- }()), Ve;
282
- }
283
- var wt;
284
- function Rr() {
285
- return wt || (wt = 1, process.env.NODE_ENV === "production" ? Le.exports = kr() : Le.exports = Vr()), Le.exports;
286
- }
287
- var ve = Rr();
288
- const Wn = C.memo(
289
- ({ errorMessage: e, isTouched: r, isSubmitted: t }) => !(r || t) || !e ? null : /* @__PURE__ */ ve.jsx("div", { className: "ml-2 text-red-600", children: e })
290
- ), { Title: Fr, Paragraph: Or, Text: Dr } = Ar, Pr = {
291
- Title: (e) => /* @__PURE__ */ ve.jsx(Fr, { ...e }),
292
- Paragraph: (e) => /* @__PURE__ */ ve.jsx(Or, { ...e }),
293
- Text: (e) => /* @__PURE__ */ ve.jsx(Dr, { ...e })
294
- }, qn = ({ label: e, required: r }) => {
295
- //! State
296
- //! Function
297
- //! Render
298
- return /* @__PURE__ */ ve.jsxs("div", { className: "flex gap-1 mb-2 items-baseline", children: [
299
- /* @__PURE__ */ ve.jsx(Pr.Text, { children: e }),
300
- r && /* @__PURE__ */ ve.jsx("span", { className: "text-red-600 h-0", children: "*" })
301
- ] });
302
- };
303
- var je = (e) => e.type === "checkbox", be = (e) => e instanceof Date, X = (e) => e == null;
304
- const Yt = (e) => typeof e == "object";
305
- var D = (e) => !X(e) && !Array.isArray(e) && Yt(e) && !be(e), zt = (e) => D(e) && e.target ? je(e.target) ? e.target.checked : e.target.value : e, Nr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Gt = (e, r) => e.has(Nr(r)), Mr = (e) => {
306
- const r = e.constructor && e.constructor.prototype;
307
- return D(r) && r.hasOwnProperty("isPrototypeOf");
308
- }, st = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
309
- function W(e) {
310
- let r;
311
- const t = Array.isArray(e), n = typeof FileList < "u" ? e instanceof FileList : !1;
312
- if (e instanceof Date)
313
- r = new Date(e);
314
- else if (e instanceof Set)
315
- r = new Set(e);
316
- else if (!(st && (e instanceof Blob || n)) && (t || D(e)))
317
- if (r = t ? [] : {}, !t && !Mr(e))
318
- r = e;
319
- else
320
- for (const s in e)
321
- e.hasOwnProperty(s) && (r[s] = W(e[s]));
322
- else
323
- return e;
324
- return r;
325
- }
326
- var qe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], O = (e) => e === void 0, y = (e, r, t) => {
327
- if (!r || !D(e))
328
- return t;
329
- const n = qe(r.split(/[,[\].]+?/)).reduce((s, a) => X(s) ? s : s[a], e);
330
- return O(n) || n === e ? O(e[r]) ? t : e[r] : n;
331
- }, re = (e) => typeof e == "boolean", it = (e) => /^\w*$/.test(e), Jt = (e) => qe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), k = (e, r, t) => {
332
- let n = -1;
333
- const s = it(r) ? [r] : Jt(r), a = s.length, l = a - 1;
334
- for (; ++n < a; ) {
335
- const c = s[n];
336
- let h = t;
337
- if (n !== l) {
338
- const _ = e[c];
339
- h = D(_) || Array.isArray(_) ? _ : isNaN(+s[n + 1]) ? {} : [];
340
- }
341
- if (c === "__proto__" || c === "constructor" || c === "prototype")
342
- return;
343
- e[c] = h, e = e[c];
344
- }
345
- };
346
- const Ue = {
347
- BLUR: "blur",
348
- FOCUS_OUT: "focusout",
349
- CHANGE: "change"
350
- }, ie = {
351
- onBlur: "onBlur",
352
- onChange: "onChange",
353
- onSubmit: "onSubmit",
354
- onTouched: "onTouched",
355
- all: "all"
356
- }, de = {
357
- max: "max",
358
- min: "min",
359
- maxLength: "maxLength",
360
- minLength: "minLength",
361
- pattern: "pattern",
362
- required: "required",
363
- validate: "validate"
364
- }, jr = C.createContext(null), at = () => C.useContext(jr);
365
- var Qt = (e, r, t, n = !0) => {
366
- const s = {
367
- defaultValues: r._defaultValues
368
- };
369
- for (const a in e)
370
- Object.defineProperty(s, a, {
371
- get: () => {
372
- const l = a;
373
- return r._proxyFormState[l] !== ie.all && (r._proxyFormState[l] = !n || ie.all), t && (t[l] = !0), e[l];
374
- }
375
- });
376
- return s;
377
- };
378
- function Lr(e) {
379
- const r = at(), { control: t = r.control, disabled: n, name: s, exact: a } = e || {}, [l, c] = C.useState(t._formState), h = C.useRef({
380
- isDirty: !1,
381
- isLoading: !1,
382
- dirtyFields: !1,
383
- touchedFields: !1,
384
- validatingFields: !1,
385
- isValidating: !1,
386
- isValid: !1,
387
- errors: !1
388
- }), _ = C.useRef(s);
389
- return _.current = s, C.useEffect(() => t._subscribe({
390
- name: _.current,
391
- formState: h.current,
392
- exact: a,
393
- callback: (v) => {
394
- !n && c({
395
- ...t._formState,
396
- ...v
397
- });
398
- }
399
- }), [t, n, a]), C.useEffect(() => {
400
- h.current.isValid && t._setValid(!0);
401
- }, [t]), C.useMemo(() => Qt(l, t, h.current, !1), [l, t]);
402
- }
403
- var ue = (e) => typeof e == "string", Xt = (e, r, t, n, s) => ue(e) ? (n && r.watch.add(e), y(t, e, s)) : Array.isArray(e) ? e.map((a) => (n && r.watch.add(a), y(t, a))) : (n && (r.watchAll = !0), t);
404
- function Ir(e) {
405
- const r = at(), { control: t = r.control, name: n, defaultValue: s, disabled: a, exact: l } = e || {}, c = C.useRef(n), h = C.useRef(s);
406
- c.current = n, C.useEffect(() => t._subscribe({
407
- name: c.current,
408
- formState: {
409
- values: !0
410
- },
411
- exact: l,
412
- callback: (p) => !a && v(Xt(c.current, t._names, p.values || t._formValues, !1, h.current))
413
- }), [t, a, l]);
414
- const [_, v] = C.useState(t._getWatch(n, s));
415
- return C.useEffect(() => t._removeUnmounted()), _;
416
- }
417
- function Hr(e) {
418
- const r = at(), { name: t, disabled: n, control: s = r.control, shouldUnregister: a } = e, l = Gt(s._names.array, t), c = Ir({
419
- control: s,
420
- name: t,
421
- defaultValue: y(s._formValues, t, y(s._defaultValues, t, e.defaultValue)),
422
- exact: !0
423
- }), h = Lr({
424
- control: s,
425
- name: t,
426
- exact: !0
427
- }), _ = C.useRef(e), v = C.useRef(s.register(t, {
428
- ...e.rules,
429
- value: c,
430
- ...re(e.disabled) ? { disabled: e.disabled } : {}
431
- })), p = C.useMemo(() => Object.defineProperties({}, {
432
- invalid: {
433
- enumerable: !0,
434
- get: () => !!y(h.errors, t)
435
- },
436
- isDirty: {
437
- enumerable: !0,
438
- get: () => !!y(h.dirtyFields, t)
439
- },
440
- isTouched: {
441
- enumerable: !0,
442
- get: () => !!y(h.touchedFields, t)
443
- },
444
- isValidating: {
445
- enumerable: !0,
446
- get: () => !!y(h.validatingFields, t)
447
- },
448
- error: {
449
- enumerable: !0,
450
- get: () => y(h.errors, t)
451
- }
452
- }), [h, t]), x = C.useCallback((M) => v.current.onChange({
453
- target: {
454
- value: zt(M),
455
- name: t
456
- },
457
- type: Ue.CHANGE
458
- }), [t]), K = C.useCallback(() => v.current.onBlur({
459
- target: {
460
- value: y(s._formValues, t),
461
- name: t
462
- },
463
- type: Ue.BLUR
464
- }), [t, s._formValues]), Y = C.useCallback((M) => {
465
- const j = y(s._fields, t);
466
- j && M && (j._f.ref = {
467
- focus: () => M.focus(),
468
- select: () => M.select(),
469
- setCustomValidity: (w) => M.setCustomValidity(w),
470
- reportValidity: () => M.reportValidity()
471
- });
472
- }, [s._fields, t]), R = C.useMemo(() => ({
473
- name: t,
474
- value: c,
475
- ...re(n) || h.disabled ? { disabled: h.disabled || n } : {},
476
- onChange: x,
477
- onBlur: K,
478
- ref: Y
479
- }), [t, n, h.disabled, x, K, Y, c]);
480
- return C.useEffect(() => {
481
- const M = s._options.shouldUnregister || a;
482
- s.register(t, {
483
- ..._.current.rules,
484
- ...re(_.current.disabled) ? { disabled: _.current.disabled } : {}
485
- });
486
- const j = (w, z) => {
487
- const B = y(s._fields, w);
488
- B && B._f && (B._f.mount = z);
489
- };
490
- if (j(t, !0), M) {
491
- const w = W(y(s._options.defaultValues, t));
492
- k(s._defaultValues, t, w), O(y(s._formValues, t)) && k(s._formValues, t, w);
493
- }
494
- return !l && s.register(t), () => {
495
- (l ? M && !s._state.action : M) ? s.unregister(t) : j(t, !1);
496
- };
497
- }, [t, s, l, a]), C.useEffect(() => {
498
- s._setDisabledField({
499
- disabled: n,
500
- name: t
501
- });
502
- }, [n, t, s]), C.useMemo(() => ({
503
- field: R,
504
- formState: h,
505
- fieldState: p
506
- }), [R, h, p]);
507
- }
508
- const Yn = (e) => e.render(Hr(e));
509
- var Ur = (e, r, t, n, s) => r ? {
510
- ...t[e],
511
- types: {
512
- ...t[e] && t[e].types ? t[e].types : {},
513
- [n]: s || !0
514
- }
515
- } : {}, Pe = (e) => Array.isArray(e) ? e : [e], St = () => {
516
- let e = [];
517
- return {
518
- get observers() {
519
- return e;
520
- },
521
- next: (s) => {
522
- for (const a of e)
523
- a.next && a.next(s);
524
- },
525
- subscribe: (s) => (e.push(s), {
526
- unsubscribe: () => {
527
- e = e.filter((a) => a !== s);
528
- }
529
- }),
530
- unsubscribe: () => {
531
- e = [];
532
- }
533
- };
534
- }, Ke = (e) => X(e) || !Yt(e);
535
- function ge(e, r) {
536
- if (Ke(e) || Ke(r))
537
- return e === r;
538
- if (be(e) && be(r))
539
- return e.getTime() === r.getTime();
540
- const t = Object.keys(e), n = Object.keys(r);
541
- if (t.length !== n.length)
542
- return !1;
543
- for (const s of t) {
544
- const a = e[s];
545
- if (!n.includes(s))
546
- return !1;
547
- if (s !== "ref") {
548
- const l = r[s];
549
- if (be(a) && be(l) || D(a) && D(l) || Array.isArray(a) && Array.isArray(l) ? !ge(a, l) : a !== l)
550
- return !1;
551
- }
552
- }
553
- return !0;
554
- }
555
- var Q = (e) => D(e) && !Object.keys(e).length, ot = (e) => e.type === "file", ae = (e) => typeof e == "function", Be = (e) => {
556
- if (!st)
557
- return !1;
558
- const r = e ? e.ownerDocument : 0;
559
- return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
560
- }, Kt = (e) => e.type === "select-multiple", lt = (e) => e.type === "radio", Br = (e) => lt(e) || je(e), Je = (e) => Be(e) && e.isConnected;
561
- function $r(e, r) {
562
- const t = r.slice(0, -1).length;
563
- let n = 0;
564
- for (; n < t; )
565
- e = O(e) ? n++ : e[r[n++]];
566
- return e;
567
- }
568
- function Wr(e) {
569
- for (const r in e)
570
- if (e.hasOwnProperty(r) && !O(e[r]))
571
- return !1;
572
- return !0;
573
- }
574
- function I(e, r) {
575
- const t = Array.isArray(r) ? r : it(r) ? [r] : Jt(r), n = t.length === 1 ? e : $r(e, t), s = t.length - 1, a = t[s];
576
- return n && delete n[a], s !== 0 && (D(n) && Q(n) || Array.isArray(n) && Wr(n)) && I(e, t.slice(0, -1)), e;
577
- }
578
- var Zt = (e) => {
579
- for (const r in e)
580
- if (ae(e[r]))
581
- return !0;
582
- return !1;
583
- };
584
- function $e(e, r = {}) {
585
- const t = Array.isArray(e);
586
- if (D(e) || t)
587
- for (const n in e)
588
- Array.isArray(e[n]) || D(e[n]) && !Zt(e[n]) ? (r[n] = Array.isArray(e[n]) ? [] : {}, $e(e[n], r[n])) : X(e[n]) || (r[n] = !0);
589
- return r;
590
- }
591
- function er(e, r, t) {
592
- const n = Array.isArray(e);
593
- if (D(e) || n)
594
- for (const s in e)
595
- Array.isArray(e[s]) || D(e[s]) && !Zt(e[s]) ? O(r) || Ke(t[s]) ? t[s] = Array.isArray(e[s]) ? $e(e[s], []) : { ...$e(e[s]) } : er(e[s], X(r) ? {} : r[s], t[s]) : t[s] = !ge(e[s], r[s]);
596
- return t;
597
- }
598
- var Re = (e, r) => er(e, r, $e(r));
599
- const Ct = {
600
- value: !1,
601
- isValid: !1
602
- }, Et = { value: !0, isValid: !0 };
603
- var tr = (e) => {
604
- if (Array.isArray(e)) {
605
- if (e.length > 1) {
606
- const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
607
- return { value: r, isValid: !!r.length };
608
- }
609
- return e[0].checked && !e[0].disabled ? (
610
- // @ts-expect-error expected to work in the browser
611
- e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? Et : { value: e[0].value, isValid: !0 } : Et
612
- ) : Ct;
613
- }
614
- return Ct;
615
- }, rr = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => O(e) ? e : r ? e === "" ? NaN : e && +e : t && ue(e) ? new Date(e) : n ? n(e) : e;
616
- const At = {
617
- isValid: !1,
618
- value: null
619
- };
620
- var nr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
621
- isValid: !0,
622
- value: t.value
623
- } : r, At) : At;
624
- function Tt(e) {
625
- const r = e.ref;
626
- return ot(r) ? r.files : lt(r) ? nr(e.refs).value : Kt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : je(r) ? tr(e.refs).value : rr(O(r.value) ? e.ref.value : r.value, e);
627
- }
628
- var qr = (e, r, t, n) => {
629
- const s = {};
630
- for (const a of e) {
631
- const l = y(r, a);
632
- l && k(s, a, l._f);
633
- }
634
- return {
635
- criteriaMode: t,
636
- names: [...e],
637
- fields: s,
638
- shouldUseNativeValidation: n
639
- };
640
- }, We = (e) => e instanceof RegExp, Fe = (e) => O(e) ? e : We(e) ? e.source : D(e) ? We(e.value) ? e.value.source : e.value : e, kt = (e) => ({
641
- isOnSubmit: !e || e === ie.onSubmit,
642
- isOnBlur: e === ie.onBlur,
643
- isOnChange: e === ie.onChange,
644
- isOnAll: e === ie.all,
645
- isOnTouch: e === ie.onTouched
646
- });
647
- const Vt = "AsyncFunction";
648
- var Yr = (e) => !!e && !!e.validate && !!(ae(e.validate) && e.validate.constructor.name === Vt || D(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === Vt)), zr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Rt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
649
- const Ne = (e, r, t, n) => {
650
- for (const s of t || Object.keys(e)) {
651
- const a = y(e, s);
652
- if (a) {
653
- const { _f: l, ...c } = a;
654
- if (l) {
655
- if (l.refs && l.refs[0] && r(l.refs[0], s) && !n)
656
- return !0;
657
- if (l.ref && r(l.ref, l.name) && !n)
658
- return !0;
659
- if (Ne(c, r))
660
- break;
661
- } else if (D(c) && Ne(c, r))
662
- break;
663
- }
664
- }
665
- };
666
- function Ft(e, r, t) {
667
- const n = y(e, t);
668
- if (n || it(t))
669
- return {
670
- error: n,
671
- name: t
672
- };
673
- const s = t.split(".");
674
- for (; s.length; ) {
675
- const a = s.join("."), l = y(r, a), c = y(e, a);
676
- if (l && !Array.isArray(l) && t !== a)
677
- return { name: t };
678
- if (c && c.type)
679
- return {
680
- name: a,
681
- error: c
682
- };
683
- s.pop();
684
- }
685
- return {
686
- name: t
687
- };
688
- }
689
- var Gr = (e, r, t, n) => {
690
- t(e);
691
- const { name: s, ...a } = e;
692
- return Q(a) || Object.keys(a).length >= Object.keys(r).length || Object.keys(a).find((l) => r[l] === (!n || ie.all));
693
- }, Jr = (e, r, t) => !e || !r || e === r || Pe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Qr = (e, r, t, n, s) => s.isOnAll ? !1 : !t && s.isOnTouch ? !(r || e) : (t ? n.isOnBlur : s.isOnBlur) ? !e : (t ? n.isOnChange : s.isOnChange) ? e : !0, Xr = (e, r) => !qe(y(e, r)).length && I(e, r), Kr = (e, r, t) => {
694
- const n = Pe(y(e, t));
695
- return k(n, "root", r[t]), k(e, t, n), e;
696
- }, He = (e) => ue(e);
697
- function Ot(e, r, t = "validate") {
698
- if (He(e) || Array.isArray(e) && e.every(He) || re(e) && !e)
699
- return {
700
- type: t,
701
- message: He(e) ? e : "",
702
- ref: r
703
- };
704
- }
705
- var Se = (e) => D(e) && !We(e) ? e : {
706
- value: e,
707
- message: ""
708
- }, Dt = async (e, r, t, n, s, a) => {
709
- const { ref: l, refs: c, required: h, maxLength: _, minLength: v, min: p, max: x, pattern: K, validate: Y, name: R, valueAsNumber: M, mount: j } = e._f, w = y(t, R);
710
- if (!j || r.has(R))
711
- return {};
712
- const z = c ? c[0] : l, B = (A) => {
713
- s && z.reportValidity && (z.setCustomValidity(re(A) ? "" : A || ""), z.reportValidity());
714
- }, P = {}, ye = lt(l), me = je(l), pe = ye || me, ne = (M || ot(l)) && O(l.value) && O(w) || Be(l) && l.value === "" || w === "" || Array.isArray(w) && !w.length, fe = Ur.bind(null, R, n, P), Z = (A, E, F, $ = de.maxLength, G = de.minLength) => {
715
- const ee = A ? E : F;
716
- P[R] = {
717
- type: A ? $ : G,
718
- message: ee,
719
- ref: l,
720
- ...fe(A ? $ : G, ee)
721
- };
722
- };
723
- if (a ? !Array.isArray(w) || !w.length : h && (!pe && (ne || X(w)) || re(w) && !w || me && !tr(c).isValid || ye && !nr(c).isValid)) {
724
- const { value: A, message: E } = He(h) ? { value: !!h, message: h } : Se(h);
725
- if (A && (P[R] = {
726
- type: de.required,
727
- message: E,
728
- ref: z,
729
- ...fe(de.required, E)
730
- }, !n))
731
- return B(E), P;
732
- }
733
- if (!ne && (!X(p) || !X(x))) {
734
- let A, E;
735
- const F = Se(x), $ = Se(p);
736
- if (!X(w) && !isNaN(w)) {
737
- const G = l.valueAsNumber || w && +w;
738
- X(F.value) || (A = G > F.value), X($.value) || (E = G < $.value);
739
- } else {
740
- const G = l.valueAsDate || new Date(w), ee = (f) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + f), se = l.type == "time", he = l.type == "week";
741
- ue(F.value) && w && (A = se ? ee(w) > ee(F.value) : he ? w > F.value : G > new Date(F.value)), ue($.value) && w && (E = se ? ee(w) < ee($.value) : he ? w < $.value : G < new Date($.value));
742
- }
743
- if ((A || E) && (Z(!!A, F.message, $.message, de.max, de.min), !n))
744
- return B(P[R].message), P;
745
- }
746
- if ((_ || v) && !ne && (ue(w) || a && Array.isArray(w))) {
747
- const A = Se(_), E = Se(v), F = !X(A.value) && w.length > +A.value, $ = !X(E.value) && w.length < +E.value;
748
- if ((F || $) && (Z(F, A.message, E.message), !n))
749
- return B(P[R].message), P;
750
- }
751
- if (K && !ne && ue(w)) {
752
- const { value: A, message: E } = Se(K);
753
- if (We(A) && !w.match(A) && (P[R] = {
754
- type: de.pattern,
755
- message: E,
756
- ref: l,
757
- ...fe(de.pattern, E)
758
- }, !n))
759
- return B(E), P;
760
- }
761
- if (Y) {
762
- if (ae(Y)) {
763
- const A = await Y(w, t), E = Ot(A, z);
764
- if (E && (P[R] = {
765
- ...E,
766
- ...fe(de.validate, E.message)
767
- }, !n))
768
- return B(E.message), P;
769
- } else if (D(Y)) {
770
- let A = {};
771
- for (const E in Y) {
772
- if (!Q(A) && !n)
773
- break;
774
- const F = Ot(await Y[E](w, t), z, E);
775
- F && (A = {
776
- ...F,
777
- ...fe(E, F.message)
778
- }, B(F.message), n && (P[R] = A));
779
- }
780
- if (!Q(A) && (P[R] = {
781
- ref: z,
782
- ...A
783
- }, !n))
784
- return P;
785
- }
786
- }
787
- return B(!0), P;
788
- };
789
- const Zr = {
790
- mode: ie.onSubmit,
791
- reValidateMode: ie.onChange,
792
- shouldFocusError: !0
793
- };
794
- function en(e = {}) {
795
- let r = {
796
- ...Zr,
797
- ...e
798
- }, t = {
799
- submitCount: 0,
800
- isDirty: !1,
801
- isLoading: ae(r.defaultValues),
802
- isValidating: !1,
803
- isSubmitted: !1,
804
- isSubmitting: !1,
805
- isSubmitSuccessful: !1,
806
- isValid: !1,
807
- touchedFields: {},
808
- dirtyFields: {},
809
- validatingFields: {},
810
- errors: r.errors || {},
811
- disabled: r.disabled || !1
812
- };
813
- const n = {};
814
- let s = D(r.defaultValues) || D(r.values) ? W(r.values || r.defaultValues) || {} : {}, a = r.shouldUnregister ? {} : W(s), l = {
815
- action: !1,
816
- mount: !1,
817
- watch: !1
818
- }, c = {
819
- mount: /* @__PURE__ */ new Set(),
820
- disabled: /* @__PURE__ */ new Set(),
821
- unMount: /* @__PURE__ */ new Set(),
822
- array: /* @__PURE__ */ new Set(),
823
- watch: /* @__PURE__ */ new Set()
824
- }, h, _ = 0;
825
- const v = {
826
- isDirty: !1,
827
- dirtyFields: !1,
828
- validatingFields: !1,
829
- touchedFields: !1,
830
- isValidating: !1,
831
- isValid: !1,
832
- errors: !1
833
- };
834
- let p = {
835
- ...v
836
- };
837
- const x = {
838
- array: St(),
839
- state: St()
840
- }, K = kt(r.mode), Y = kt(r.reValidateMode), R = r.criteriaMode === ie.all, M = (i) => (o) => {
841
- clearTimeout(_), _ = setTimeout(i, o);
842
- }, j = async (i) => {
843
- if (!r.disabled && (v.isValid || p.isValid || i)) {
844
- const o = r.resolver ? Q((await ne()).errors) : await Z(n, !0);
845
- o !== t.isValid && x.state.next({
846
- isValid: o
847
- });
848
- }
849
- }, w = (i, o) => {
850
- !r.disabled && (v.isValidating || v.validatingFields || p.isValidating || p.validatingFields) && ((i || Array.from(c.mount)).forEach((u) => {
851
- u && (o ? k(t.validatingFields, u, o) : I(t.validatingFields, u));
852
- }), x.state.next({
853
- validatingFields: t.validatingFields,
854
- isValidating: !Q(t.validatingFields)
855
- }));
856
- }, z = (i, o = [], u, m, g = !0, d = !0) => {
857
- if (m && u && !r.disabled) {
858
- if (l.action = !0, d && Array.isArray(y(n, i))) {
859
- const b = u(y(n, i), m.argA, m.argB);
860
- g && k(n, i, b);
861
- }
862
- if (d && Array.isArray(y(t.errors, i))) {
863
- const b = u(y(t.errors, i), m.argA, m.argB);
864
- g && k(t.errors, i, b), Xr(t.errors, i);
865
- }
866
- if ((v.touchedFields || p.touchedFields) && d && Array.isArray(y(t.touchedFields, i))) {
867
- const b = u(y(t.touchedFields, i), m.argA, m.argB);
868
- g && k(t.touchedFields, i, b);
869
- }
870
- (v.dirtyFields || p.dirtyFields) && (t.dirtyFields = Re(s, a)), x.state.next({
871
- name: i,
872
- isDirty: E(i, o),
873
- dirtyFields: t.dirtyFields,
874
- errors: t.errors,
875
- isValid: t.isValid
876
- });
877
- } else
878
- k(a, i, o);
879
- }, B = (i, o) => {
880
- k(t.errors, i, o), x.state.next({
881
- errors: t.errors
882
- });
883
- }, P = (i) => {
884
- t.errors = i, x.state.next({
885
- errors: t.errors,
886
- isValid: !1
887
- });
888
- }, ye = (i, o, u, m) => {
889
- const g = y(n, i);
890
- if (g) {
891
- const d = y(a, i, O(u) ? y(s, i) : u);
892
- O(d) || m && m.defaultChecked || o ? k(a, i, o ? d : Tt(g._f)) : G(i, d), l.mount && j();
893
- }
894
- }, me = (i, o, u, m, g) => {
895
- let d = !1, b = !1;
896
- const T = {
897
- name: i
898
- };
899
- if (!r.disabled) {
900
- if (!u || m) {
901
- (v.isDirty || p.isDirty) && (b = t.isDirty, t.isDirty = T.isDirty = E(), d = b !== T.isDirty);
902
- const N = ge(y(s, i), o);
903
- b = !!y(t.dirtyFields, i), N ? I(t.dirtyFields, i) : k(t.dirtyFields, i, !0), T.dirtyFields = t.dirtyFields, d = d || (v.dirtyFields || p.dirtyFields) && b !== !N;
904
- }
905
- if (u) {
906
- const N = y(t.touchedFields, i);
907
- N || (k(t.touchedFields, i, u), T.touchedFields = t.touchedFields, d = d || (v.touchedFields || p.touchedFields) && N !== u);
908
- }
909
- d && g && x.state.next(T);
910
- }
911
- return d ? T : {};
912
- }, pe = (i, o, u, m) => {
913
- const g = y(t.errors, i), d = (v.isValid || p.isValid) && re(o) && t.isValid !== o;
914
- if (r.delayError && u ? (h = M(() => B(i, u)), h(r.delayError)) : (clearTimeout(_), h = null, u ? k(t.errors, i, u) : I(t.errors, i)), (u ? !ge(g, u) : g) || !Q(m) || d) {
915
- const b = {
916
- ...m,
917
- ...d && re(o) ? { isValid: o } : {},
918
- errors: t.errors,
919
- name: i
920
- };
921
- t = {
922
- ...t,
923
- ...b
924
- }, x.state.next(b);
925
- }
926
- }, ne = async (i) => {
927
- w(i, !0);
928
- const o = await r.resolver(a, r.context, qr(i || c.mount, n, r.criteriaMode, r.shouldUseNativeValidation));
929
- return w(i), o;
930
- }, fe = async (i) => {
931
- const { errors: o } = await ne(i);
932
- if (i)
933
- for (const u of i) {
934
- const m = y(o, u);
935
- m ? k(t.errors, u, m) : I(t.errors, u);
936
- }
937
- else
938
- t.errors = o;
939
- return o;
940
- }, Z = async (i, o, u = {
941
- valid: !0
942
- }) => {
943
- for (const m in i) {
944
- const g = i[m];
945
- if (g) {
946
- const { _f: d, ...b } = g;
947
- if (d) {
948
- const T = c.array.has(d.name), N = g._f && Yr(g._f);
949
- N && v.validatingFields && w([m], !0);
950
- const q = await Dt(g, c.disabled, a, R, r.shouldUseNativeValidation && !o, T);
951
- if (N && v.validatingFields && w([m]), q[d.name] && (u.valid = !1, o))
952
- break;
953
- !o && (y(q, d.name) ? T ? Kr(t.errors, q, d.name) : k(t.errors, d.name, q[d.name]) : I(t.errors, d.name));
954
- }
955
- !Q(b) && await Z(b, o, u);
956
- }
957
- }
958
- return u.valid;
959
- }, A = () => {
960
- for (const i of c.unMount) {
961
- const o = y(n, i);
962
- o && (o._f.refs ? o._f.refs.every((u) => !Je(u)) : !Je(o._f.ref)) && le(i);
963
- }
964
- c.unMount = /* @__PURE__ */ new Set();
965
- }, E = (i, o) => !r.disabled && (i && o && k(a, i, o), !ge(V(), s)), F = (i, o, u) => Xt(i, c, {
966
- ...l.mount ? a : O(o) ? s : ue(i) ? { [i]: o } : o
967
- }, u, o), $ = (i) => qe(y(l.mount ? a : s, i, r.shouldUnregister ? y(s, i, []) : [])), G = (i, o, u = {}) => {
968
- const m = y(n, i);
969
- let g = o;
970
- if (m) {
971
- const d = m._f;
972
- d && (!d.disabled && k(a, i, rr(o, d)), g = Be(d.ref) && X(o) ? "" : o, Kt(d.ref) ? [...d.ref.options].forEach((b) => b.selected = g.includes(b.value)) : d.refs ? je(d.ref) ? d.refs.length > 1 ? d.refs.forEach((b) => (!b.defaultChecked || !b.disabled) && (b.checked = Array.isArray(g) ? !!g.find((T) => T === b.value) : g === b.value)) : d.refs[0] && (d.refs[0].checked = !!g) : d.refs.forEach((b) => b.checked = b.value === g) : ot(d.ref) ? d.ref.value = "" : (d.ref.value = g, d.ref.type || x.state.next({
973
- name: i,
974
- values: W(a)
975
- })));
976
- }
977
- (u.shouldDirty || u.shouldTouch) && me(i, g, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && S(i);
978
- }, ee = (i, o, u) => {
979
- for (const m in o) {
980
- const g = o[m], d = `${i}.${m}`, b = y(n, d);
981
- (c.array.has(i) || D(g) || b && !b._f) && !be(g) ? ee(d, g, u) : G(d, g, u);
982
- }
983
- }, se = (i, o, u = {}) => {
984
- const m = y(n, i), g = c.array.has(i), d = W(o);
985
- k(a, i, d), g ? (x.array.next({
986
- name: i,
987
- values: W(a)
988
- }), (v.isDirty || v.dirtyFields || p.isDirty || p.dirtyFields) && u.shouldDirty && x.state.next({
989
- name: i,
990
- dirtyFields: Re(s, a),
991
- isDirty: E(i, d)
992
- })) : m && !m._f && !X(d) ? ee(i, d, u) : G(i, d, u), Rt(i, c) && x.state.next({ ...t }), x.state.next({
993
- name: l.mount ? i : void 0,
994
- values: W(a)
995
- });
996
- }, he = async (i) => {
997
- l.mount = !0;
998
- const o = i.target;
999
- let u = o.name, m = !0;
1000
- const g = y(n, u), d = (b) => {
1001
- m = Number.isNaN(b) || be(b) && isNaN(b.getTime()) || ge(b, y(a, u, b));
1002
- };
1003
- if (g) {
1004
- let b, T;
1005
- const N = o.type ? Tt(g._f) : zt(i), q = i.type === Ue.BLUR || i.type === Ue.FOCUS_OUT, pr = !zr(g._f) && !r.resolver && !y(t.errors, u) && !g._f.deps || Qr(q, y(t.touchedFields, u), t.isSubmitted, Y, K), ze = Rt(u, c, q);
1006
- k(a, u, N), q ? (g._f.onBlur && g._f.onBlur(i), h && h(0)) : g._f.onChange && g._f.onChange(i);
1007
- const Ge = me(u, N, q), xr = !Q(Ge) || ze;
1008
- if (!q && x.state.next({
1009
- name: u,
1010
- type: i.type,
1011
- values: W(a)
1012
- }), pr)
1013
- return (v.isValid || p.isValid) && (r.mode === "onBlur" ? q && j() : q || j()), xr && x.state.next({ name: u, ...ze ? {} : Ge });
1014
- if (!q && ze && x.state.next({ ...t }), r.resolver) {
1015
- const { errors: vt } = await ne([u]);
1016
- if (d(N), m) {
1017
- const wr = Ft(t.errors, n, u), _t = Ft(vt, n, wr.name || u);
1018
- b = _t.error, u = _t.name, T = Q(vt);
1019
- }
1020
- } else
1021
- w([u], !0), b = (await Dt(g, c.disabled, a, R, r.shouldUseNativeValidation))[u], w([u]), d(N), m && (b ? T = !1 : (v.isValid || p.isValid) && (T = await Z(n, !0)));
1022
- m && (g._f.deps && S(g._f.deps), pe(u, T, b, Ge));
1023
- }
1024
- }, f = (i, o) => {
1025
- if (y(t.errors, o) && i.focus)
1026
- return i.focus(), 1;
1027
- }, S = async (i, o = {}) => {
1028
- let u, m;
1029
- const g = Pe(i);
1030
- if (r.resolver) {
1031
- const d = await fe(O(i) ? i : g);
1032
- u = Q(d), m = i ? !g.some((b) => y(d, b)) : u;
1033
- } else i ? (m = (await Promise.all(g.map(async (d) => {
1034
- const b = y(n, d);
1035
- return await Z(b && b._f ? { [d]: b } : b);
1036
- }))).every(Boolean), !(!m && !t.isValid) && j()) : m = u = await Z(n);
1037
- return x.state.next({
1038
- ...!ue(i) || (v.isValid || p.isValid) && u !== t.isValid ? {} : { name: i },
1039
- ...r.resolver || !i ? { isValid: u } : {},
1040
- errors: t.errors
1041
- }), o.shouldFocus && !m && Ne(n, f, i ? g : c.mount), m;
1042
- }, V = (i) => {
1043
- const o = {
1044
- ...l.mount ? a : s
1045
- };
1046
- return O(i) ? o : ue(i) ? y(o, i) : i.map((u) => y(o, u));
1047
- }, L = (i, o) => ({
1048
- invalid: !!y((o || t).errors, i),
1049
- isDirty: !!y((o || t).dirtyFields, i),
1050
- error: y((o || t).errors, i),
1051
- isValidating: !!y(t.validatingFields, i),
1052
- isTouched: !!y((o || t).touchedFields, i)
1053
- }), oe = (i) => {
1054
- i && Pe(i).forEach((o) => I(t.errors, o)), x.state.next({
1055
- errors: i ? t.errors : {}
1056
- });
1057
- }, te = (i, o, u) => {
1058
- const m = (y(n, i, { _f: {} })._f || {}).ref, g = y(t.errors, i) || {}, { ref: d, message: b, type: T, ...N } = g;
1059
- k(t.errors, i, {
1060
- ...N,
1061
- ...o,
1062
- ref: m
1063
- }), x.state.next({
1064
- name: i,
1065
- errors: t.errors,
1066
- isValid: !1
1067
- }), u && u.shouldFocus && m && m.focus && m.focus();
1068
- }, Ae = (i, o) => ae(i) ? x.state.subscribe({
1069
- next: (u) => i(F(void 0, o), u)
1070
- }) : F(i, o, !0), xe = (i) => x.state.subscribe({
1071
- next: (o) => {
1072
- Jr(i.name, o.name, i.exact) && Gr(o, i.formState || v, _r, i.reRenderRoot) && i.callback({
1073
- values: { ...a },
1074
- ...t,
1075
- ...o
1076
- });
1077
- }
1078
- }).unsubscribe, H = (i) => (l.mount = !0, p = {
1079
- ...p,
1080
- ...i.formState
1081
- }, xe({
1082
- ...i,
1083
- formState: p
1084
- })), le = (i, o = {}) => {
1085
- for (const u of i ? Pe(i) : c.mount)
1086
- c.mount.delete(u), c.array.delete(u), o.keepValue || (I(n, u), I(a, u)), !o.keepError && I(t.errors, u), !o.keepDirty && I(t.dirtyFields, u), !o.keepTouched && I(t.touchedFields, u), !o.keepIsValidating && I(t.validatingFields, u), !r.shouldUnregister && !o.keepDefaultValue && I(s, u);
1087
- x.state.next({
1088
- values: W(a)
1089
- }), x.state.next({
1090
- ...t,
1091
- ...o.keepDirty ? { isDirty: E() } : {}
1092
- }), !o.keepIsValid && j();
1093
- }, we = ({ disabled: i, name: o }) => {
1094
- (re(i) && l.mount || i || c.disabled.has(o)) && (i ? c.disabled.add(o) : c.disabled.delete(o));
1095
- }, Te = (i, o = {}) => {
1096
- let u = y(n, i);
1097
- const m = re(o.disabled) || re(r.disabled);
1098
- return k(n, i, {
1099
- ...u || {},
1100
- _f: {
1101
- ...u && u._f ? u._f : { ref: { name: i } },
1102
- name: i,
1103
- mount: !0,
1104
- ...o
1105
- }
1106
- }), c.mount.add(i), u ? we({
1107
- disabled: re(o.disabled) ? o.disabled : r.disabled,
1108
- name: i
1109
- }) : ye(i, !0, o.value), {
1110
- ...m ? { disabled: o.disabled || r.disabled } : {},
1111
- ...r.progressive ? {
1112
- required: !!o.required,
1113
- min: Fe(o.min),
1114
- max: Fe(o.max),
1115
- minLength: Fe(o.minLength),
1116
- maxLength: Fe(o.maxLength),
1117
- pattern: Fe(o.pattern)
1118
- } : {},
1119
- name: i,
1120
- onChange: he,
1121
- onBlur: he,
1122
- ref: (g) => {
1123
- if (g) {
1124
- Te(i, o), u = y(n, i);
1125
- const d = O(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, b = Br(d), T = u._f.refs || [];
1126
- if (b ? T.find((N) => N === d) : d === u._f.ref)
1127
- return;
1128
- k(n, i, {
1129
- _f: {
1130
- ...u._f,
1131
- ...b ? {
1132
- refs: [
1133
- ...T.filter(Je),
1134
- d,
1135
- ...Array.isArray(y(s, i)) ? [{}] : []
1136
- ],
1137
- ref: { type: d.type, name: i }
1138
- } : { ref: d }
1139
- }
1140
- }), ye(i, !1, void 0, d);
1141
- } else
1142
- u = y(n, i, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || o.shouldUnregister) && !(Gt(c.array, i) && l.action) && c.unMount.add(i);
1143
- }
1144
- };
1145
- }, ht = () => r.shouldFocusError && Ne(n, f, c.mount), mr = (i) => {
1146
- re(i) && (x.state.next({ disabled: i }), Ne(n, (o, u) => {
1147
- const m = y(n, u);
1148
- m && (o.disabled = m._f.disabled || i, Array.isArray(m._f.refs) && m._f.refs.forEach((g) => {
1149
- g.disabled = m._f.disabled || i;
1150
- }));
1151
- }, 0, !1));
1152
- }, gt = (i, o) => async (u) => {
1153
- let m;
1154
- u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1155
- let g = W(a);
1156
- if (x.state.next({
1157
- isSubmitting: !0
1158
- }), r.resolver) {
1159
- const { errors: d, values: b } = await ne();
1160
- t.errors = d, g = b;
1161
- } else
1162
- await Z(n);
1163
- if (c.disabled.size)
1164
- for (const d of c.disabled)
1165
- k(g, d, void 0);
1166
- if (I(t.errors, "root"), Q(t.errors)) {
1167
- x.state.next({
1168
- errors: {}
1169
- });
1170
- try {
1171
- await i(g, u);
1172
- } catch (d) {
1173
- m = d;
1174
- }
1175
- } else
1176
- o && await o({ ...t.errors }, u), ht(), setTimeout(ht);
1177
- if (x.state.next({
1178
- isSubmitted: !0,
1179
- isSubmitting: !1,
1180
- isSubmitSuccessful: Q(t.errors) && !m,
1181
- submitCount: t.submitCount + 1,
1182
- errors: t.errors
1183
- }), m)
1184
- throw m;
1185
- }, br = (i, o = {}) => {
1186
- y(n, i) && (O(o.defaultValue) ? se(i, W(y(s, i))) : (se(i, o.defaultValue), k(s, i, W(o.defaultValue))), o.keepTouched || I(t.touchedFields, i), o.keepDirty || (I(t.dirtyFields, i), t.isDirty = o.defaultValue ? E(i, W(y(s, i))) : E()), o.keepError || (I(t.errors, i), v.isValid && j()), x.state.next({ ...t }));
1187
- }, yt = (i, o = {}) => {
1188
- const u = i ? W(i) : s, m = W(u), g = Q(i), d = g ? s : m;
1189
- if (o.keepDefaultValues || (s = u), !o.keepValues) {
1190
- if (o.keepDirtyValues) {
1191
- const b = /* @__PURE__ */ new Set([
1192
- ...c.mount,
1193
- ...Object.keys(Re(s, a))
1194
- ]);
1195
- for (const T of Array.from(b))
1196
- y(t.dirtyFields, T) ? k(d, T, y(a, T)) : se(T, y(d, T));
1197
- } else {
1198
- if (st && O(i))
1199
- for (const b of c.mount) {
1200
- const T = y(n, b);
1201
- if (T && T._f) {
1202
- const N = Array.isArray(T._f.refs) ? T._f.refs[0] : T._f.ref;
1203
- if (Be(N)) {
1204
- const q = N.closest("form");
1205
- if (q) {
1206
- q.reset();
1207
- break;
1208
- }
1209
- }
1210
- }
1211
- }
1212
- for (const b of c.mount)
1213
- se(b, y(d, b));
1214
- }
1215
- a = W(d), x.array.next({
1216
- values: { ...d }
1217
- }), x.state.next({
1218
- values: { ...d }
1219
- });
1220
- }
1221
- c = {
1222
- mount: o.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
1223
- unMount: /* @__PURE__ */ new Set(),
1224
- array: /* @__PURE__ */ new Set(),
1225
- disabled: /* @__PURE__ */ new Set(),
1226
- watch: /* @__PURE__ */ new Set(),
1227
- watchAll: !1,
1228
- focus: ""
1229
- }, l.mount = !v.isValid || !!o.keepIsValid || !!o.keepDirtyValues, l.watch = !!r.shouldUnregister, x.state.next({
1230
- submitCount: o.keepSubmitCount ? t.submitCount : 0,
1231
- isDirty: g ? !1 : o.keepDirty ? t.isDirty : !!(o.keepDefaultValues && !ge(i, s)),
1232
- isSubmitted: o.keepIsSubmitted ? t.isSubmitted : !1,
1233
- dirtyFields: g ? {} : o.keepDirtyValues ? o.keepDefaultValues && a ? Re(s, a) : t.dirtyFields : o.keepDefaultValues && i ? Re(s, i) : o.keepDirty ? t.dirtyFields : {},
1234
- touchedFields: o.keepTouched ? t.touchedFields : {},
1235
- errors: o.keepErrors ? t.errors : {},
1236
- isSubmitSuccessful: o.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1237
- isSubmitting: !1
1238
- });
1239
- }, mt = (i, o) => yt(ae(i) ? i(a) : i, o), vr = (i, o = {}) => {
1240
- const u = y(n, i), m = u && u._f;
1241
- if (m) {
1242
- const g = m.refs ? m.refs[0] : m.ref;
1243
- g.focus && (g.focus(), o.shouldSelect && ae(g.select) && g.select());
1244
- }
1245
- }, _r = (i) => {
1246
- t = {
1247
- ...t,
1248
- ...i
1249
- };
1250
- }, bt = {
1251
- control: {
1252
- register: Te,
1253
- unregister: le,
1254
- getFieldState: L,
1255
- handleSubmit: gt,
1256
- setError: te,
1257
- _subscribe: xe,
1258
- _runSchema: ne,
1259
- _getWatch: F,
1260
- _getDirty: E,
1261
- _setValid: j,
1262
- _setFieldArray: z,
1263
- _setDisabledField: we,
1264
- _setErrors: P,
1265
- _getFieldArray: $,
1266
- _reset: yt,
1267
- _resetDefaultValues: () => ae(r.defaultValues) && r.defaultValues().then((i) => {
1268
- mt(i, r.resetOptions), x.state.next({
1269
- isLoading: !1
1270
- });
1271
- }),
1272
- _removeUnmounted: A,
1273
- _disableForm: mr,
1274
- _subjects: x,
1275
- _proxyFormState: v,
1276
- get _fields() {
1277
- return n;
1278
- },
1279
- get _formValues() {
1280
- return a;
1281
- },
1282
- get _state() {
1283
- return l;
1284
- },
1285
- set _state(i) {
1286
- l = i;
1287
- },
1288
- get _defaultValues() {
1289
- return s;
1290
- },
1291
- get _names() {
1292
- return c;
1293
- },
1294
- set _names(i) {
1295
- c = i;
1296
- },
1297
- get _formState() {
1298
- return t;
1299
- },
1300
- get _options() {
1301
- return r;
1302
- },
1303
- set _options(i) {
1304
- r = {
1305
- ...r,
1306
- ...i
1307
- };
1308
- }
1309
- },
1310
- subscribe: H,
1311
- trigger: S,
1312
- register: Te,
1313
- handleSubmit: gt,
1314
- watch: Ae,
1315
- setValue: se,
1316
- getValues: V,
1317
- reset: mt,
1318
- resetField: br,
1319
- clearErrors: oe,
1320
- unregister: le,
1321
- setError: te,
1322
- setFocus: vr,
1323
- getFieldState: L
1324
- };
1325
- return {
1326
- ...bt,
1327
- formControl: bt
1328
- };
1329
- }
1330
- function zn(e = {}) {
1331
- const r = C.useRef(void 0), t = C.useRef(void 0), [n, s] = C.useState({
1332
- isDirty: !1,
1333
- isValidating: !1,
1334
- isLoading: ae(e.defaultValues),
1335
- isSubmitted: !1,
1336
- isSubmitting: !1,
1337
- isSubmitSuccessful: !1,
1338
- isValid: !1,
1339
- submitCount: 0,
1340
- dirtyFields: {},
1341
- touchedFields: {},
1342
- validatingFields: {},
1343
- errors: e.errors || {},
1344
- disabled: e.disabled || !1,
1345
- defaultValues: ae(e.defaultValues) ? void 0 : e.defaultValues
1346
- });
1347
- r.current || (r.current = {
1348
- ...e.formControl ? e.formControl : en(e),
1349
- formState: n
1350
- }, e.formControl && e.defaultValues && !ae(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
1351
- const a = r.current.control;
1352
- return a._options = e, C.useLayoutEffect(() => a._subscribe({
1353
- formState: a._proxyFormState,
1354
- callback: () => s({ ...a._formState }),
1355
- reRenderRoot: !0
1356
- }), [a]), C.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), C.useEffect(() => {
1357
- if (a._proxyFormState.isDirty) {
1358
- const l = a._getDirty();
1359
- l !== n.isDirty && a._subjects.state.next({
1360
- isDirty: l
1361
- });
1362
- }
1363
- }, [a, n.isDirty]), C.useEffect(() => {
1364
- e.values && !ge(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, s((l) => ({ ...l }))) : a._resetDefaultValues();
1365
- }, [e.values, a]), C.useEffect(() => {
1366
- e.errors && !Q(e.errors) && a._setErrors(e.errors);
1367
- }, [e.errors, a]), C.useEffect(() => {
1368
- a._state.mount || (a._setValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1369
- }), C.useEffect(() => {
1370
- e.shouldUnregister && a._subjects.state.next({
1371
- values: a._getWatch()
1372
- });
1373
- }, [e.shouldUnregister, a]), r.current.formState = Qt(n, a), r.current;
1374
- }
1375
- var sr = /* @__PURE__ */ Sr({});
1376
- function Ze() {
1377
- return Ze = Object.assign ? Object.assign.bind() : function(e) {
1378
- for (var r = 1; r < arguments.length; r++) {
1379
- var t = arguments[r];
1380
- for (var n in t) ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
1381
- }
1382
- return e;
1383
- }, Ze.apply(null, arguments);
1384
- }
1385
- function tn(e) {
1386
- if (Array.isArray(e)) return e;
1387
- }
1388
- function rn(e, r) {
1389
- var t = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
1390
- if (t != null) {
1391
- var n, s, a, l, c = [], h = !0, _ = !1;
1392
- try {
1393
- if (a = (t = t.call(e)).next, r !== 0) for (; !(h = (n = a.call(t)).done) && (c.push(n.value), c.length !== r); h = !0) ;
1394
- } catch (v) {
1395
- _ = !0, s = v;
1396
- } finally {
1397
- try {
1398
- if (!h && t.return != null && (l = t.return(), Object(l) !== l)) return;
1399
- } finally {
1400
- if (_) throw s;
1401
- }
1402
- }
1403
- return c;
1404
- }
1405
- }
1406
- function Pt(e, r) {
1407
- (r == null || r > e.length) && (r = e.length);
1408
- for (var t = 0, n = Array(r); t < r; t++) n[t] = e[t];
1409
- return n;
1410
- }
1411
- function nn(e, r) {
1412
- if (e) {
1413
- if (typeof e == "string") return Pt(e, r);
1414
- var t = {}.toString.call(e).slice(8, -1);
1415
- return t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set" ? Array.from(e) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Pt(e, r) : void 0;
1416
- }
1417
- }
1418
- function sn() {
1419
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1420
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1421
- }
1422
- function ir(e, r) {
1423
- return tn(e) || rn(e, r) || nn(e, r) || sn();
1424
- }
1425
- function _e(e) {
1426
- "@babel/helpers - typeof";
1427
- return _e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
1428
- return typeof r;
1429
- } : function(r) {
1430
- return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
1431
- }, _e(e);
1432
- }
1433
- function an(e, r) {
1434
- if (_e(e) != "object" || !e) return e;
1435
- var t = e[Symbol.toPrimitive];
1436
- if (t !== void 0) {
1437
- var n = t.call(e, r);
1438
- if (_e(n) != "object") return n;
1439
- throw new TypeError("@@toPrimitive must return a primitive value.");
1440
- }
1441
- return (r === "string" ? String : Number)(e);
1442
- }
1443
- function on(e) {
1444
- var r = an(e, "string");
1445
- return _e(r) == "symbol" ? r : r + "";
1446
- }
1447
- function J(e, r, t) {
1448
- return (r = on(r)) in e ? Object.defineProperty(e, r, {
1449
- value: t,
1450
- enumerable: !0,
1451
- configurable: !0,
1452
- writable: !0
1453
- }) : e[r] = t, e;
1454
- }
1455
- function ln(e, r) {
1456
- if (e == null) return {};
1457
- var t = {};
1458
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
1459
- if (r.indexOf(n) !== -1) continue;
1460
- t[n] = e[n];
1461
- }
1462
- return t;
1463
- }
1464
- function ar(e, r) {
1465
- if (e == null) return {};
1466
- var t, n, s = ln(e, r);
1467
- if (Object.getOwnPropertySymbols) {
1468
- var a = Object.getOwnPropertySymbols(e);
1469
- for (n = 0; n < a.length; n++) t = a[n], r.indexOf(t) === -1 && {}.propertyIsEnumerable.call(e, t) && (s[t] = e[t]);
1470
- }
1471
- return s;
1472
- }
1473
- var Qe = { exports: {} };
1474
- /*!
1475
- Copyright (c) 2018 Jed Watson.
1476
- Licensed under the MIT License (MIT), see
1477
- http://jedwatson.github.io/classnames
1478
- */
1479
- var Nt;
1480
- function un() {
1481
- return Nt || (Nt = 1, function(e) {
1482
- (function() {
1483
- var r = {}.hasOwnProperty;
1484
- function t() {
1485
- for (var a = "", l = 0; l < arguments.length; l++) {
1486
- var c = arguments[l];
1487
- c && (a = s(a, n(c)));
1488
- }
1489
- return a;
1490
- }
1491
- function n(a) {
1492
- if (typeof a == "string" || typeof a == "number")
1493
- return a;
1494
- if (typeof a != "object")
1495
- return "";
1496
- if (Array.isArray(a))
1497
- return t.apply(null, a);
1498
- if (a.toString !== Object.prototype.toString && !a.toString.toString().includes("[native code]"))
1499
- return a.toString();
1500
- var l = "";
1501
- for (var c in a)
1502
- r.call(a, c) && a[c] && (l = s(l, c));
1503
- return l;
1504
- }
1505
- function s(a, l) {
1506
- return l ? a ? a + " " + l : a + l : a;
1507
- }
1508
- e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
1509
- })();
1510
- }(Qe)), Qe.exports;
1511
- }
1512
- var cn = un();
1513
- const fn = /* @__PURE__ */ Tr(cn), U = Math.round;
1514
- function Xe(e, r) {
1515
- const t = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], n = t.map((s) => parseFloat(s));
1516
- for (let s = 0; s < 3; s += 1)
1517
- n[s] = r(n[s] || 0, t[s] || "", s);
1518
- return t[3] ? n[3] = t[3].includes("%") ? n[3] / 100 : n[3] : n[3] = 1, n;
1519
- }
1520
- const Mt = (e, r, t) => t === 0 ? e : e / 100;
1521
- function Oe(e, r) {
1522
- const t = r || 255;
1523
- return e > t ? t : e < 0 ? 0 : e;
1524
- }
1525
- class Ce {
1526
- constructor(r) {
1527
- J(this, "isValid", !0), J(this, "r", 0), J(this, "g", 0), J(this, "b", 0), J(this, "a", 1), J(this, "_h", void 0), J(this, "_s", void 0), J(this, "_l", void 0), J(this, "_v", void 0), J(this, "_max", void 0), J(this, "_min", void 0), J(this, "_brightness", void 0);
1528
- function t(n) {
1529
- return n[0] in r && n[1] in r && n[2] in r;
1530
- }
1531
- if (r) if (typeof r == "string") {
1532
- let s = function(a) {
1533
- return n.startsWith(a);
1534
- };
1535
- const n = r.trim();
1536
- /^#?[A-F\d]{3,8}$/i.test(n) ? this.fromHexString(n) : s("rgb") ? this.fromRgbString(n) : s("hsl") ? this.fromHslString(n) : (s("hsv") || s("hsb")) && this.fromHsvString(n);
1537
- } else if (r instanceof Ce)
1538
- this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this._h = r._h, this._s = r._s, this._l = r._l, this._v = r._v;
1539
- else if (t("rgb"))
1540
- this.r = Oe(r.r), this.g = Oe(r.g), this.b = Oe(r.b), this.a = typeof r.a == "number" ? Oe(r.a, 1) : 1;
1541
- else if (t("hsl"))
1542
- this.fromHsl(r);
1543
- else if (t("hsv"))
1544
- this.fromHsv(r);
1545
- else
1546
- throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(r));
1547
- }
1548
- // ======================= Setter =======================
1549
- setR(r) {
1550
- return this._sc("r", r);
1551
- }
1552
- setG(r) {
1553
- return this._sc("g", r);
1554
- }
1555
- setB(r) {
1556
- return this._sc("b", r);
1557
- }
1558
- setA(r) {
1559
- return this._sc("a", r, 1);
1560
- }
1561
- setHue(r) {
1562
- const t = this.toHsv();
1563
- return t.h = r, this._c(t);
1564
- }
1565
- // ======================= Getter =======================
1566
- /**
1567
- * Returns the perceived luminance of a color, from 0-1.
1568
- * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
1569
- */
1570
- getLuminance() {
1571
- function r(a) {
1572
- const l = a / 255;
1573
- return l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
1574
- }
1575
- const t = r(this.r), n = r(this.g), s = r(this.b);
1576
- return 0.2126 * t + 0.7152 * n + 0.0722 * s;
1577
- }
1578
- getHue() {
1579
- if (typeof this._h > "u") {
1580
- const r = this.getMax() - this.getMin();
1581
- r === 0 ? this._h = 0 : this._h = U(60 * (this.r === this.getMax() ? (this.g - this.b) / r + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / r + 2 : (this.r - this.g) / r + 4));
1582
- }
1583
- return this._h;
1584
- }
1585
- getSaturation() {
1586
- if (typeof this._s > "u") {
1587
- const r = this.getMax() - this.getMin();
1588
- r === 0 ? this._s = 0 : this._s = r / this.getMax();
1589
- }
1590
- return this._s;
1591
- }
1592
- getLightness() {
1593
- return typeof this._l > "u" && (this._l = (this.getMax() + this.getMin()) / 510), this._l;
1594
- }
1595
- getValue() {
1596
- return typeof this._v > "u" && (this._v = this.getMax() / 255), this._v;
1597
- }
1598
- /**
1599
- * Returns the perceived brightness of the color, from 0-255.
1600
- * Note: this is not the b of HSB
1601
- * @see http://www.w3.org/TR/AERT#color-contrast
1602
- */
1603
- getBrightness() {
1604
- return typeof this._brightness > "u" && (this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3), this._brightness;
1605
- }
1606
- // ======================== Func ========================
1607
- darken(r = 10) {
1608
- const t = this.getHue(), n = this.getSaturation();
1609
- let s = this.getLightness() - r / 100;
1610
- return s < 0 && (s = 0), this._c({
1611
- h: t,
1612
- s: n,
1613
- l: s,
1614
- a: this.a
1615
- });
1616
- }
1617
- lighten(r = 10) {
1618
- const t = this.getHue(), n = this.getSaturation();
1619
- let s = this.getLightness() + r / 100;
1620
- return s > 1 && (s = 1), this._c({
1621
- h: t,
1622
- s: n,
1623
- l: s,
1624
- a: this.a
1625
- });
1626
- }
1627
- /**
1628
- * Mix the current color a given amount with another color, from 0 to 100.
1629
- * 0 means no mixing (return current color).
1630
- */
1631
- mix(r, t = 50) {
1632
- const n = this._c(r), s = t / 100, a = (c) => (n[c] - this[c]) * s + this[c], l = {
1633
- r: U(a("r")),
1634
- g: U(a("g")),
1635
- b: U(a("b")),
1636
- a: U(a("a") * 100) / 100
1637
- };
1638
- return this._c(l);
1639
- }
1640
- /**
1641
- * Mix the color with pure white, from 0 to 100.
1642
- * Providing 0 will do nothing, providing 100 will always return white.
1643
- */
1644
- tint(r = 10) {
1645
- return this.mix({
1646
- r: 255,
1647
- g: 255,
1648
- b: 255,
1649
- a: 1
1650
- }, r);
1651
- }
1652
- /**
1653
- * Mix the color with pure black, from 0 to 100.
1654
- * Providing 0 will do nothing, providing 100 will always return black.
1655
- */
1656
- shade(r = 10) {
1657
- return this.mix({
1658
- r: 0,
1659
- g: 0,
1660
- b: 0,
1661
- a: 1
1662
- }, r);
1663
- }
1664
- onBackground(r) {
1665
- const t = this._c(r), n = this.a + t.a * (1 - this.a), s = (a) => U((this[a] * this.a + t[a] * t.a * (1 - this.a)) / n);
1666
- return this._c({
1667
- r: s("r"),
1668
- g: s("g"),
1669
- b: s("b"),
1670
- a: n
1671
- });
1672
- }
1673
- // ======================= Status =======================
1674
- isDark() {
1675
- return this.getBrightness() < 128;
1676
- }
1677
- isLight() {
1678
- return this.getBrightness() >= 128;
1679
- }
1680
- // ======================== MISC ========================
1681
- equals(r) {
1682
- return this.r === r.r && this.g === r.g && this.b === r.b && this.a === r.a;
1683
- }
1684
- clone() {
1685
- return this._c(this);
1686
- }
1687
- // ======================= Format =======================
1688
- toHexString() {
1689
- let r = "#";
1690
- const t = (this.r || 0).toString(16);
1691
- r += t.length === 2 ? t : "0" + t;
1692
- const n = (this.g || 0).toString(16);
1693
- r += n.length === 2 ? n : "0" + n;
1694
- const s = (this.b || 0).toString(16);
1695
- if (r += s.length === 2 ? s : "0" + s, typeof this.a == "number" && this.a >= 0 && this.a < 1) {
1696
- const a = U(this.a * 255).toString(16);
1697
- r += a.length === 2 ? a : "0" + a;
1698
- }
1699
- return r;
1700
- }
1701
- /** CSS support color pattern */
1702
- toHsl() {
1703
- return {
1704
- h: this.getHue(),
1705
- s: this.getSaturation(),
1706
- l: this.getLightness(),
1707
- a: this.a
1708
- };
1709
- }
1710
- /** CSS support color pattern */
1711
- toHslString() {
1712
- const r = this.getHue(), t = U(this.getSaturation() * 100), n = U(this.getLightness() * 100);
1713
- return this.a !== 1 ? `hsla(${r},${t}%,${n}%,${this.a})` : `hsl(${r},${t}%,${n}%)`;
1714
- }
1715
- /** Same as toHsb */
1716
- toHsv() {
1717
- return {
1718
- h: this.getHue(),
1719
- s: this.getSaturation(),
1720
- v: this.getValue(),
1721
- a: this.a
1722
- };
1723
- }
1724
- toRgb() {
1725
- return {
1726
- r: this.r,
1727
- g: this.g,
1728
- b: this.b,
1729
- a: this.a
1730
- };
1731
- }
1732
- toRgbString() {
1733
- return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
1734
- }
1735
- toString() {
1736
- return this.toRgbString();
1737
- }
1738
- // ====================== Privates ======================
1739
- /** Return a new FastColor object with one channel changed */
1740
- _sc(r, t, n) {
1741
- const s = this.clone();
1742
- return s[r] = Oe(t, n), s;
1743
- }
1744
- _c(r) {
1745
- return new this.constructor(r);
1746
- }
1747
- getMax() {
1748
- return typeof this._max > "u" && (this._max = Math.max(this.r, this.g, this.b)), this._max;
1749
- }
1750
- getMin() {
1751
- return typeof this._min > "u" && (this._min = Math.min(this.r, this.g, this.b)), this._min;
1752
- }
1753
- fromHexString(r) {
1754
- const t = r.replace("#", "");
1755
- function n(s, a) {
1756
- return parseInt(t[s] + t[a || s], 16);
1757
- }
1758
- t.length < 6 ? (this.r = n(0), this.g = n(1), this.b = n(2), this.a = t[3] ? n(3) / 255 : 1) : (this.r = n(0, 1), this.g = n(2, 3), this.b = n(4, 5), this.a = t[6] ? n(6, 7) / 255 : 1);
1759
- }
1760
- fromHsl({
1761
- h: r,
1762
- s: t,
1763
- l: n,
1764
- a: s
1765
- }) {
1766
- if (this._h = r % 360, this._s = t, this._l = n, this.a = typeof s == "number" ? s : 1, t <= 0) {
1767
- const x = U(n * 255);
1768
- this.r = x, this.g = x, this.b = x;
1769
- }
1770
- let a = 0, l = 0, c = 0;
1771
- const h = r / 60, _ = (1 - Math.abs(2 * n - 1)) * t, v = _ * (1 - Math.abs(h % 2 - 1));
1772
- h >= 0 && h < 1 ? (a = _, l = v) : h >= 1 && h < 2 ? (a = v, l = _) : h >= 2 && h < 3 ? (l = _, c = v) : h >= 3 && h < 4 ? (l = v, c = _) : h >= 4 && h < 5 ? (a = v, c = _) : h >= 5 && h < 6 && (a = _, c = v);
1773
- const p = n - _ / 2;
1774
- this.r = U((a + p) * 255), this.g = U((l + p) * 255), this.b = U((c + p) * 255);
1775
- }
1776
- fromHsv({
1777
- h: r,
1778
- s: t,
1779
- v: n,
1780
- a: s
1781
- }) {
1782
- this._h = r % 360, this._s = t, this._v = n, this.a = typeof s == "number" ? s : 1;
1783
- const a = U(n * 255);
1784
- if (this.r = a, this.g = a, this.b = a, t <= 0)
1785
- return;
1786
- const l = r / 60, c = Math.floor(l), h = l - c, _ = U(n * (1 - t) * 255), v = U(n * (1 - t * h) * 255), p = U(n * (1 - t * (1 - h)) * 255);
1787
- switch (c) {
1788
- case 0:
1789
- this.g = p, this.b = _;
1790
- break;
1791
- case 1:
1792
- this.r = v, this.b = _;
1793
- break;
1794
- case 2:
1795
- this.r = _, this.b = p;
1796
- break;
1797
- case 3:
1798
- this.r = _, this.g = v;
1799
- break;
1800
- case 4:
1801
- this.r = p, this.g = _;
1802
- break;
1803
- case 5:
1804
- default:
1805
- this.g = _, this.b = v;
1806
- break;
1807
- }
1808
- }
1809
- fromHsvString(r) {
1810
- const t = Xe(r, Mt);
1811
- this.fromHsv({
1812
- h: t[0],
1813
- s: t[1],
1814
- v: t[2],
1815
- a: t[3]
1816
- });
1817
- }
1818
- fromHslString(r) {
1819
- const t = Xe(r, Mt);
1820
- this.fromHsl({
1821
- h: t[0],
1822
- s: t[1],
1823
- l: t[2],
1824
- a: t[3]
1825
- });
1826
- }
1827
- fromRgbString(r) {
1828
- const t = Xe(r, (n, s) => (
1829
- // Convert percentage to number. e.g. 50% -> 128
1830
- s.includes("%") ? U(n / 100 * 255) : n
1831
- ));
1832
- this.r = t[0], this.g = t[1], this.b = t[2], this.a = t[3];
1833
- }
1834
- }
1835
- var Ie = 2, jt = 0.16, dn = 0.05, hn = 0.05, gn = 0.15, or = 5, lr = 4, yn = [{
1836
- index: 7,
1837
- amount: 15
1838
- }, {
1839
- index: 6,
1840
- amount: 25
1841
- }, {
1842
- index: 5,
1843
- amount: 30
1844
- }, {
1845
- index: 5,
1846
- amount: 45
1847
- }, {
1848
- index: 5,
1849
- amount: 65
1850
- }, {
1851
- index: 5,
1852
- amount: 85
1853
- }, {
1854
- index: 4,
1855
- amount: 90
1856
- }, {
1857
- index: 3,
1858
- amount: 95
1859
- }, {
1860
- index: 2,
1861
- amount: 97
1862
- }, {
1863
- index: 1,
1864
- amount: 98
1865
- }];
1866
- function Lt(e, r, t) {
1867
- var n;
1868
- return Math.round(e.h) >= 60 && Math.round(e.h) <= 240 ? n = t ? Math.round(e.h) - Ie * r : Math.round(e.h) + Ie * r : n = t ? Math.round(e.h) + Ie * r : Math.round(e.h) - Ie * r, n < 0 ? n += 360 : n >= 360 && (n -= 360), n;
1869
- }
1870
- function It(e, r, t) {
1871
- if (e.h === 0 && e.s === 0)
1872
- return e.s;
1873
- var n;
1874
- return t ? n = e.s - jt * r : r === lr ? n = e.s + jt : n = e.s + dn * r, n > 1 && (n = 1), t && r === or && n > 0.1 && (n = 0.1), n < 0.06 && (n = 0.06), Math.round(n * 100) / 100;
1875
- }
1876
- function Ht(e, r, t) {
1877
- var n;
1878
- return t ? n = e.v + hn * r : n = e.v - gn * r, n = Math.max(0, Math.min(1, n)), Math.round(n * 100) / 100;
1879
- }
1880
- function mn(e) {
1881
- for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = [], n = new Ce(e), s = n.toHsv(), a = or; a > 0; a -= 1) {
1882
- var l = new Ce({
1883
- h: Lt(s, a, !0),
1884
- s: It(s, a, !0),
1885
- v: Ht(s, a, !0)
1886
- });
1887
- t.push(l);
1888
- }
1889
- t.push(n);
1890
- for (var c = 1; c <= lr; c += 1) {
1891
- var h = new Ce({
1892
- h: Lt(s, c),
1893
- s: It(s, c),
1894
- v: Ht(s, c)
1895
- });
1896
- t.push(h);
1897
- }
1898
- return r.theme === "dark" ? yn.map(function(_) {
1899
- var v = _.index, p = _.amount;
1900
- return new Ce(r.backgroundColor || "#141414").mix(t[v], p).toHexString();
1901
- }) : t.map(function(_) {
1902
- return _.toHexString();
1903
- });
1904
- }
1905
- var et = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
1906
- et.primary = et[5];
1907
- function Ut(e, r) {
1908
- var t = Object.keys(e);
1909
- if (Object.getOwnPropertySymbols) {
1910
- var n = Object.getOwnPropertySymbols(e);
1911
- r && (n = n.filter(function(s) {
1912
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
1913
- })), t.push.apply(t, n);
1914
- }
1915
- return t;
1916
- }
1917
- function ce(e) {
1918
- for (var r = 1; r < arguments.length; r++) {
1919
- var t = arguments[r] != null ? arguments[r] : {};
1920
- r % 2 ? Ut(Object(t), !0).forEach(function(n) {
1921
- J(e, n, t[n]);
1922
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Ut(Object(t)).forEach(function(n) {
1923
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
1924
- });
1925
- }
1926
- return e;
1927
- }
1928
- function bn() {
1929
- return !!(typeof window < "u" && window.document && window.document.createElement);
1930
- }
1931
- function vn(e, r) {
1932
- if (!e)
1933
- return !1;
1934
- if (e.contains)
1935
- return e.contains(r);
1936
- for (var t = r; t; ) {
1937
- if (t === e)
1938
- return !0;
1939
- t = t.parentNode;
1940
- }
1941
- return !1;
1942
- }
1943
- var Bt = "data-rc-order", $t = "data-rc-priority", _n = "rc-util-key", tt = /* @__PURE__ */ new Map();
1944
- function ur() {
1945
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = e.mark;
1946
- return r ? r.startsWith("data-") ? r : "data-".concat(r) : _n;
1947
- }
1948
- function ut(e) {
1949
- if (e.attachTo)
1950
- return e.attachTo;
1951
- var r = document.querySelector("head");
1952
- return r || document.body;
1953
- }
1954
- function pn(e) {
1955
- return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
1956
- }
1957
- function ct(e) {
1958
- return Array.from((tt.get(e) || e).children).filter(function(r) {
1959
- return r.tagName === "STYLE";
1960
- });
1961
- }
1962
- function cr(e) {
1963
- var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1964
- if (!bn())
1965
- return null;
1966
- var t = r.csp, n = r.prepend, s = r.priority, a = s === void 0 ? 0 : s, l = pn(n), c = l === "prependQueue", h = document.createElement("style");
1967
- h.setAttribute(Bt, l), c && a && h.setAttribute($t, "".concat(a)), t != null && t.nonce && (h.nonce = t == null ? void 0 : t.nonce), h.innerHTML = e;
1968
- var _ = ut(r), v = _.firstChild;
1969
- if (n) {
1970
- if (c) {
1971
- var p = (r.styles || ct(_)).filter(function(x) {
1972
- if (!["prepend", "prependQueue"].includes(x.getAttribute(Bt)))
1973
- return !1;
1974
- var K = Number(x.getAttribute($t) || 0);
1975
- return a >= K;
1976
- });
1977
- if (p.length)
1978
- return _.insertBefore(h, p[p.length - 1].nextSibling), h;
1979
- }
1980
- _.insertBefore(h, v);
1981
- } else
1982
- _.appendChild(h);
1983
- return h;
1984
- }
1985
- function xn(e) {
1986
- var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = ut(r);
1987
- return (r.styles || ct(t)).find(function(n) {
1988
- return n.getAttribute(ur(r)) === e;
1989
- });
1990
- }
1991
- function wn(e, r) {
1992
- var t = tt.get(e);
1993
- if (!t || !vn(document, t)) {
1994
- var n = cr("", r), s = n.parentNode;
1995
- tt.set(e, s), e.removeChild(n);
1996
- }
1997
- }
1998
- function Sn(e, r) {
1999
- var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = ut(t), s = ct(n), a = ce(ce({}, t), {}, {
2000
- styles: s
2001
- });
2002
- wn(n, a);
2003
- var l = xn(r, a);
2004
- if (l) {
2005
- var c, h;
2006
- if ((c = a.csp) !== null && c !== void 0 && c.nonce && l.nonce !== ((h = a.csp) === null || h === void 0 ? void 0 : h.nonce)) {
2007
- var _;
2008
- l.nonce = (_ = a.csp) === null || _ === void 0 ? void 0 : _.nonce;
2009
- }
2010
- return l.innerHTML !== e && (l.innerHTML = e), l;
2011
- }
2012
- var v = cr(e, a);
2013
- return v.setAttribute(ur(a), r), v;
2014
- }
2015
- function fr(e) {
2016
- var r;
2017
- return e == null || (r = e.getRootNode) === null || r === void 0 ? void 0 : r.call(e);
2018
- }
2019
- function Cn(e) {
2020
- return fr(e) instanceof ShadowRoot;
2021
- }
2022
- function En(e) {
2023
- return Cn(e) ? fr(e) : null;
2024
- }
2025
- var rt = {}, ft = [], An = function(r) {
2026
- ft.push(r);
2027
- };
2028
- function Tn(e, r) {
2029
- if (process.env.NODE_ENV !== "production" && !e && console !== void 0) {
2030
- var t = ft.reduce(function(n, s) {
2031
- return s(n ?? "", "warning");
2032
- }, r);
2033
- t && console.error("Warning: ".concat(t));
2034
- }
2035
- }
2036
- function kn(e, r) {
2037
- if (process.env.NODE_ENV !== "production" && !e && console !== void 0) {
2038
- var t = ft.reduce(function(n, s) {
2039
- return s(n ?? "", "note");
2040
- }, r);
2041
- t && console.warn("Note: ".concat(t));
2042
- }
2043
- }
2044
- function Vn() {
2045
- rt = {};
2046
- }
2047
- function dr(e, r, t) {
2048
- !r && !rt[t] && (e(!1, t), rt[t] = !0);
2049
- }
2050
- function Ye(e, r) {
2051
- dr(Tn, e, r);
2052
- }
2053
- function Rn(e, r) {
2054
- dr(kn, e, r);
2055
- }
2056
- Ye.preMessage = An;
2057
- Ye.resetWarned = Vn;
2058
- Ye.noteOnce = Rn;
2059
- function Fn(e) {
2060
- return e.replace(/-(.)/g, function(r, t) {
2061
- return t.toUpperCase();
2062
- });
2063
- }
2064
- function On(e, r) {
2065
- Ye(e, "[@ant-design/icons] ".concat(r));
2066
- }
2067
- function Wt(e) {
2068
- return _e(e) === "object" && typeof e.name == "string" && typeof e.theme == "string" && (_e(e.icon) === "object" || typeof e.icon == "function");
2069
- }
2070
- function qt() {
2071
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2072
- return Object.keys(e).reduce(function(r, t) {
2073
- var n = e[t];
2074
- switch (t) {
2075
- case "class":
2076
- r.className = n, delete r.class;
2077
- break;
2078
- default:
2079
- delete r[t], r[Fn(t)] = n;
2080
- }
2081
- return r;
2082
- }, {});
2083
- }
2084
- function nt(e, r, t) {
2085
- return t ? /* @__PURE__ */ C.createElement(e.tag, ce(ce({
2086
- key: r
2087
- }, qt(e.attrs)), t), (e.children || []).map(function(n, s) {
2088
- return nt(n, "".concat(r, "-").concat(e.tag, "-").concat(s));
2089
- })) : /* @__PURE__ */ C.createElement(e.tag, ce({
2090
- key: r
2091
- }, qt(e.attrs)), (e.children || []).map(function(n, s) {
2092
- return nt(n, "".concat(r, "-").concat(e.tag, "-").concat(s));
2093
- }));
2094
- }
2095
- function hr(e) {
2096
- return mn(e)[0];
2097
- }
2098
- function gr(e) {
2099
- return e ? Array.isArray(e) ? e : [e] : [];
2100
- }
2101
- var Dn = `
2102
- .anticon {
2103
- display: inline-flex;
2104
- align-items: center;
2105
- color: inherit;
2106
- font-style: normal;
2107
- line-height: 0;
2108
- text-align: center;
2109
- text-transform: none;
2110
- vertical-align: -0.125em;
2111
- text-rendering: optimizeLegibility;
2112
- -webkit-font-smoothing: antialiased;
2113
- -moz-osx-font-smoothing: grayscale;
2114
- }
2115
-
2116
- .anticon > * {
2117
- line-height: 1;
2118
- }
2119
-
2120
- .anticon svg {
2121
- display: inline-block;
2122
- }
2123
-
2124
- .anticon::before {
2125
- display: none;
2126
- }
2127
-
2128
- .anticon .anticon-icon {
2129
- display: block;
2130
- }
2131
-
2132
- .anticon[tabindex] {
2133
- cursor: pointer;
2134
- }
2135
-
2136
- .anticon-spin::before,
2137
- .anticon-spin {
2138
- display: inline-block;
2139
- -webkit-animation: loadingCircle 1s infinite linear;
2140
- animation: loadingCircle 1s infinite linear;
2141
- }
2142
-
2143
- @-webkit-keyframes loadingCircle {
2144
- 100% {
2145
- -webkit-transform: rotate(360deg);
2146
- transform: rotate(360deg);
2147
- }
2148
- }
2149
-
2150
- @keyframes loadingCircle {
2151
- 100% {
2152
- -webkit-transform: rotate(360deg);
2153
- transform: rotate(360deg);
2154
- }
2155
- }
2156
- `, Pn = function(r) {
2157
- var t = Cr(sr), n = t.csp, s = t.prefixCls, a = t.layer, l = Dn;
2158
- s && (l = l.replace(/anticon/g, s)), a && (l = "@layer ".concat(a, ` {
2159
- `).concat(l, `
2160
- }`)), Er(function() {
2161
- var c = r.current, h = En(c);
2162
- Sn(l, "@ant-design-icons", {
2163
- prepend: !a,
2164
- csp: n,
2165
- attachTo: h
2166
- });
2167
- }, []);
2168
- }, Nn = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"], Me = {
2169
- primaryColor: "#333",
2170
- secondaryColor: "#E6E6E6",
2171
- calculated: !1
2172
- };
2173
- function Mn(e) {
2174
- var r = e.primaryColor, t = e.secondaryColor;
2175
- Me.primaryColor = r, Me.secondaryColor = t || hr(r), Me.calculated = !!t;
2176
- }
2177
- function jn() {
2178
- return ce({}, Me);
2179
- }
2180
- var Ee = function(r) {
2181
- var t = r.icon, n = r.className, s = r.onClick, a = r.style, l = r.primaryColor, c = r.secondaryColor, h = ar(r, Nn), _ = De.useRef(), v = Me;
2182
- if (l && (v = {
2183
- primaryColor: l,
2184
- secondaryColor: c || hr(l)
2185
- }), Pn(_), On(Wt(t), "icon should be icon definiton, but got ".concat(t)), !Wt(t))
2186
- return null;
2187
- var p = t;
2188
- return p && typeof p.icon == "function" && (p = ce(ce({}, p), {}, {
2189
- icon: p.icon(v.primaryColor, v.secondaryColor)
2190
- })), nt(p.icon, "svg-".concat(p.name), ce(ce({
2191
- className: n,
2192
- onClick: s,
2193
- style: a,
2194
- "data-icon": p.name,
2195
- width: "1em",
2196
- height: "1em",
2197
- fill: "currentColor",
2198
- "aria-hidden": "true"
2199
- }, h), {}, {
2200
- ref: _
2201
- }));
2202
- };
2203
- Ee.displayName = "IconReact";
2204
- Ee.getTwoToneColors = jn;
2205
- Ee.setTwoToneColors = Mn;
2206
- function yr(e) {
2207
- var r = gr(e), t = ir(r, 2), n = t[0], s = t[1];
2208
- return Ee.setTwoToneColors({
2209
- primaryColor: n,
2210
- secondaryColor: s
2211
- });
2212
- }
2213
- function Ln() {
2214
- var e = Ee.getTwoToneColors();
2215
- return e.calculated ? [e.primaryColor, e.secondaryColor] : e.primaryColor;
2216
- }
2217
- var In = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
2218
- yr(et.primary);
2219
- var dt = /* @__PURE__ */ De.forwardRef(function(e, r) {
2220
- var t = e.className, n = e.icon, s = e.spin, a = e.rotate, l = e.tabIndex, c = e.onClick, h = e.twoToneColor, _ = ar(e, In), v = De.useContext(sr), p = v.prefixCls, x = p === void 0 ? "anticon" : p, K = v.rootClassName, Y = fn(K, x, J(J({}, "".concat(x, "-").concat(n.name), !!n.name), "".concat(x, "-spin"), !!s || n.name === "loading"), t), R = l;
2221
- R === void 0 && c && (R = -1);
2222
- var M = a ? {
2223
- msTransform: "rotate(".concat(a, "deg)"),
2224
- transform: "rotate(".concat(a, "deg)")
2225
- } : void 0, j = gr(h), w = ir(j, 2), z = w[0], B = w[1];
2226
- return /* @__PURE__ */ De.createElement("span", Ze({
2227
- role: "img",
2228
- "aria-label": n.name
2229
- }, _, {
2230
- ref: r,
2231
- tabIndex: R,
2232
- onClick: c,
2233
- className: Y
2234
- }), /* @__PURE__ */ De.createElement(Ee, {
2235
- icon: n,
2236
- primaryColor: z,
2237
- secondaryColor: B,
2238
- style: M
2239
- }));
2240
- });
2241
- dt.displayName = "AntdIcon";
2242
- dt.getTwoToneColor = Ln;
2243
- dt.setTwoToneColor = yr;
2244
- export {
2245
- Yn as C,
2246
- Wn as E,
2247
- dt as I,
2248
- qn as L,
2249
- Pr as T,
2250
- Ze as _,
2251
- $n as a,
2252
- _e as b,
2253
- fn as c,
2254
- nn as d,
2255
- J as e,
2256
- Tr as g,
2257
- ve as j,
2258
- on as t,
2259
- zn as u
2260
- };