@amateescu/portal-ui-components 0.0.13 → 0.0.15-beta0

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.
@@ -0,0 +1,4781 @@
1
+ import * as $ from "react";
2
+ import L, { useContext as Oe, useRef as ce, forwardRef as ke, useState as Ke, useEffect as Me, useMemo as be, createRef as nn, Children as an } from "react";
3
+ import { I as on, R as Nt, r as Vt, e as ee, b as T, ae as sn, af as ln, ag as cn, w as Ye, l as Fr, c as ne, a2 as _t, C as _e, i as It, a5 as un, Z as dn, g as Er, m as je, z as wr, t as Sr, f as m, V as Lt, W as Ce, X as Ht, k as De, Y as Fe, a as de, p as xr, D as fn, K as ue, ah as ot, x as gn, u as Be, O as hn, ai as mn, o as vn, n as re, aj as pn, ak as yn, _ as j, al as He, am as pe, an as ve, a8 as tr, Q as bn } from "./useId-D0OLY2mt.js";
4
+ import { a as $e } from "./objectWithoutPropertiesLoose-CIT-1_kH.js";
5
+ import { _ as Or, a as W } from "./assertThisInitialized-BUtkG-md.js";
6
+ function Cn(e) {
7
+ return e && /* @__PURE__ */ L.isValidElement(e) && e.type === L.Fragment;
8
+ }
9
+ const Fn = (e, t, r) => /* @__PURE__ */ L.isValidElement(e) ? /* @__PURE__ */ L.cloneElement(e, typeof r == "function" ? r(e.props || {}) : r) : t;
10
+ function $r(e, t) {
11
+ return Fn(e, e, t);
12
+ }
13
+ var En = { icon: { tag: "svg", attrs: { viewBox: "0 0 1024 1024", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, name: "loading", theme: "outlined" }, wn = function(t, r) {
14
+ return /* @__PURE__ */ $.createElement(on, $e({}, t, {
15
+ ref: r,
16
+ icon: En
17
+ }));
18
+ }, Pr = /* @__PURE__ */ $.forwardRef(wn);
19
+ process.env.NODE_ENV !== "production" && (Pr.displayName = "LoadingOutlined");
20
+ const Rr = /* @__PURE__ */ L.createContext(void 0);
21
+ process.env.NODE_ENV !== "production" && (Rr.displayName = "zIndexContext");
22
+ const ge = 100, Sn = 10, xn = ge * Sn, On = xn + ge, Nr = {
23
+ Modal: ge,
24
+ Drawer: ge,
25
+ Popover: ge,
26
+ Popconfirm: ge,
27
+ Tooltip: ge,
28
+ Tour: ge,
29
+ FloatButton: ge
30
+ }, $n = {
31
+ SelectLike: 50,
32
+ Dropdown: 50,
33
+ DatePicker: 50,
34
+ Menu: 50,
35
+ ImagePreview: 1
36
+ };
37
+ function Pn(e) {
38
+ return e in Nr;
39
+ }
40
+ const lo = (e, t) => {
41
+ const [, r] = Nt(), i = L.useContext(Rr), n = Pn(e);
42
+ let a;
43
+ if (t !== void 0)
44
+ a = [t, t];
45
+ else {
46
+ let o = i ?? 0;
47
+ n ? o += // Use preset token zIndex by default but not stack when has parent container
48
+ (i ? 0 : r.zIndexPopupBase) + // Container offset
49
+ Nr[e] : o += $n[e], a = [i === void 0 ? t : o, o];
50
+ }
51
+ if (process.env.NODE_ENV !== "production") {
52
+ const o = Vt(e), s = r.zIndexPopupBase + On, c = a[0] || 0;
53
+ process.env.NODE_ENV !== "production" && o(t !== void 0 || c <= s, "usage", "`zIndex` is over design token `zIndexPopupBase` too much. It may cause unexpected override.");
54
+ }
55
+ return a;
56
+ };
57
+ function ie() {
58
+ ie = function() {
59
+ return t;
60
+ };
61
+ var e, t = {}, r = Object.prototype, i = r.hasOwnProperty, n = Object.defineProperty || function(F, y, E) {
62
+ F[y] = E.value;
63
+ }, a = typeof Symbol == "function" ? Symbol : {}, o = a.iterator || "@@iterator", s = a.asyncIterator || "@@asyncIterator", c = a.toStringTag || "@@toStringTag";
64
+ function u(F, y, E) {
65
+ return Object.defineProperty(F, y, {
66
+ value: E,
67
+ enumerable: !0,
68
+ configurable: !0,
69
+ writable: !0
70
+ }), F[y];
71
+ }
72
+ try {
73
+ u({}, "");
74
+ } catch {
75
+ u = function(E, x, H) {
76
+ return E[x] = H;
77
+ };
78
+ }
79
+ function l(F, y, E, x) {
80
+ var H = y && y.prototype instanceof C ? y : C, N = Object.create(H.prototype), U = new A(x || []);
81
+ return n(N, "_invoke", {
82
+ value: I(F, E, U)
83
+ }), N;
84
+ }
85
+ function f(F, y, E) {
86
+ try {
87
+ return {
88
+ type: "normal",
89
+ arg: F.call(y, E)
90
+ };
91
+ } catch (x) {
92
+ return {
93
+ type: "throw",
94
+ arg: x
95
+ };
96
+ }
97
+ }
98
+ t.wrap = l;
99
+ var g = "suspendedStart", O = "suspendedYield", v = "executing", p = "completed", d = {};
100
+ function C() {
101
+ }
102
+ function h() {
103
+ }
104
+ function b() {
105
+ }
106
+ var S = {};
107
+ u(S, o, function() {
108
+ return this;
109
+ });
110
+ var w = Object.getPrototypeOf, V = w && w(w(K([])));
111
+ V && V !== r && i.call(V, o) && (S = V);
112
+ var R = b.prototype = C.prototype = Object.create(S);
113
+ function _(F) {
114
+ ["next", "throw", "return"].forEach(function(y) {
115
+ u(F, y, function(E) {
116
+ return this._invoke(y, E);
117
+ });
118
+ });
119
+ }
120
+ function P(F, y) {
121
+ function E(H, N, U, Y) {
122
+ var q = f(F[H], F, N);
123
+ if (q.type !== "throw") {
124
+ var te = q.arg, k = te.value;
125
+ return k && ee(k) == "object" && i.call(k, "__await") ? y.resolve(k.__await).then(function(ae) {
126
+ E("next", ae, U, Y);
127
+ }, function(ae) {
128
+ E("throw", ae, U, Y);
129
+ }) : y.resolve(k).then(function(ae) {
130
+ te.value = ae, U(te);
131
+ }, function(ae) {
132
+ return E("throw", ae, U, Y);
133
+ });
134
+ }
135
+ Y(q.arg);
136
+ }
137
+ var x;
138
+ n(this, "_invoke", {
139
+ value: function(N, U) {
140
+ function Y() {
141
+ return new y(function(q, te) {
142
+ E(N, U, q, te);
143
+ });
144
+ }
145
+ return x = x ? x.then(Y, Y) : Y();
146
+ }
147
+ });
148
+ }
149
+ function I(F, y, E) {
150
+ var x = g;
151
+ return function(H, N) {
152
+ if (x === v) throw Error("Generator is already running");
153
+ if (x === p) {
154
+ if (H === "throw") throw N;
155
+ return {
156
+ value: e,
157
+ done: !0
158
+ };
159
+ }
160
+ for (E.method = H, E.arg = N; ; ) {
161
+ var U = E.delegate;
162
+ if (U) {
163
+ var Y = M(U, E);
164
+ if (Y) {
165
+ if (Y === d) continue;
166
+ return Y;
167
+ }
168
+ }
169
+ if (E.method === "next") E.sent = E._sent = E.arg;
170
+ else if (E.method === "throw") {
171
+ if (x === g) throw x = p, E.arg;
172
+ E.dispatchException(E.arg);
173
+ } else E.method === "return" && E.abrupt("return", E.arg);
174
+ x = v;
175
+ var q = f(F, y, E);
176
+ if (q.type === "normal") {
177
+ if (x = E.done ? p : O, q.arg === d) continue;
178
+ return {
179
+ value: q.arg,
180
+ done: E.done
181
+ };
182
+ }
183
+ q.type === "throw" && (x = p, E.method = "throw", E.arg = q.arg);
184
+ }
185
+ };
186
+ }
187
+ function M(F, y) {
188
+ var E = y.method, x = F.iterator[E];
189
+ if (x === e) return y.delegate = null, E === "throw" && F.iterator.return && (y.method = "return", y.arg = e, M(F, y), y.method === "throw") || E !== "return" && (y.method = "throw", y.arg = new TypeError("The iterator does not provide a '" + E + "' method")), d;
190
+ var H = f(x, F.iterator, y.arg);
191
+ if (H.type === "throw") return y.method = "throw", y.arg = H.arg, y.delegate = null, d;
192
+ var N = H.arg;
193
+ return N ? N.done ? (y[F.resultName] = N.value, y.next = F.nextLoc, y.method !== "return" && (y.method = "next", y.arg = e), y.delegate = null, d) : N : (y.method = "throw", y.arg = new TypeError("iterator result is not an object"), y.delegate = null, d);
194
+ }
195
+ function z(F) {
196
+ var y = {
197
+ tryLoc: F[0]
198
+ };
199
+ 1 in F && (y.catchLoc = F[1]), 2 in F && (y.finallyLoc = F[2], y.afterLoc = F[3]), this.tryEntries.push(y);
200
+ }
201
+ function B(F) {
202
+ var y = F.completion || {};
203
+ y.type = "normal", delete y.arg, F.completion = y;
204
+ }
205
+ function A(F) {
206
+ this.tryEntries = [{
207
+ tryLoc: "root"
208
+ }], F.forEach(z, this), this.reset(!0);
209
+ }
210
+ function K(F) {
211
+ if (F || F === "") {
212
+ var y = F[o];
213
+ if (y) return y.call(F);
214
+ if (typeof F.next == "function") return F;
215
+ if (!isNaN(F.length)) {
216
+ var E = -1, x = function H() {
217
+ for (; ++E < F.length; ) if (i.call(F, E)) return H.value = F[E], H.done = !1, H;
218
+ return H.value = e, H.done = !0, H;
219
+ };
220
+ return x.next = x;
221
+ }
222
+ }
223
+ throw new TypeError(ee(F) + " is not iterable");
224
+ }
225
+ return h.prototype = b, n(R, "constructor", {
226
+ value: b,
227
+ configurable: !0
228
+ }), n(b, "constructor", {
229
+ value: h,
230
+ configurable: !0
231
+ }), h.displayName = u(b, c, "GeneratorFunction"), t.isGeneratorFunction = function(F) {
232
+ var y = typeof F == "function" && F.constructor;
233
+ return !!y && (y === h || (y.displayName || y.name) === "GeneratorFunction");
234
+ }, t.mark = function(F) {
235
+ return Object.setPrototypeOf ? Object.setPrototypeOf(F, b) : (F.__proto__ = b, u(F, c, "GeneratorFunction")), F.prototype = Object.create(R), F;
236
+ }, t.awrap = function(F) {
237
+ return {
238
+ __await: F
239
+ };
240
+ }, _(P.prototype), u(P.prototype, s, function() {
241
+ return this;
242
+ }), t.AsyncIterator = P, t.async = function(F, y, E, x, H) {
243
+ H === void 0 && (H = Promise);
244
+ var N = new P(l(F, y, E, x), H);
245
+ return t.isGeneratorFunction(y) ? N : N.next().then(function(U) {
246
+ return U.done ? U.value : N.next();
247
+ });
248
+ }, _(R), u(R, c, "Generator"), u(R, o, function() {
249
+ return this;
250
+ }), u(R, "toString", function() {
251
+ return "[object Generator]";
252
+ }), t.keys = function(F) {
253
+ var y = Object(F), E = [];
254
+ for (var x in y) E.push(x);
255
+ return E.reverse(), function H() {
256
+ for (; E.length; ) {
257
+ var N = E.pop();
258
+ if (N in y) return H.value = N, H.done = !1, H;
259
+ }
260
+ return H.done = !0, H;
261
+ };
262
+ }, t.values = K, A.prototype = {
263
+ constructor: A,
264
+ reset: function(y) {
265
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = e, this.done = !1, this.delegate = null, this.method = "next", this.arg = e, this.tryEntries.forEach(B), !y) for (var E in this) E.charAt(0) === "t" && i.call(this, E) && !isNaN(+E.slice(1)) && (this[E] = e);
266
+ },
267
+ stop: function() {
268
+ this.done = !0;
269
+ var y = this.tryEntries[0].completion;
270
+ if (y.type === "throw") throw y.arg;
271
+ return this.rval;
272
+ },
273
+ dispatchException: function(y) {
274
+ if (this.done) throw y;
275
+ var E = this;
276
+ function x(te, k) {
277
+ return U.type = "throw", U.arg = y, E.next = te, k && (E.method = "next", E.arg = e), !!k;
278
+ }
279
+ for (var H = this.tryEntries.length - 1; H >= 0; --H) {
280
+ var N = this.tryEntries[H], U = N.completion;
281
+ if (N.tryLoc === "root") return x("end");
282
+ if (N.tryLoc <= this.prev) {
283
+ var Y = i.call(N, "catchLoc"), q = i.call(N, "finallyLoc");
284
+ if (Y && q) {
285
+ if (this.prev < N.catchLoc) return x(N.catchLoc, !0);
286
+ if (this.prev < N.finallyLoc) return x(N.finallyLoc);
287
+ } else if (Y) {
288
+ if (this.prev < N.catchLoc) return x(N.catchLoc, !0);
289
+ } else {
290
+ if (!q) throw Error("try statement without catch or finally");
291
+ if (this.prev < N.finallyLoc) return x(N.finallyLoc);
292
+ }
293
+ }
294
+ }
295
+ },
296
+ abrupt: function(y, E) {
297
+ for (var x = this.tryEntries.length - 1; x >= 0; --x) {
298
+ var H = this.tryEntries[x];
299
+ if (H.tryLoc <= this.prev && i.call(H, "finallyLoc") && this.prev < H.finallyLoc) {
300
+ var N = H;
301
+ break;
302
+ }
303
+ }
304
+ N && (y === "break" || y === "continue") && N.tryLoc <= E && E <= N.finallyLoc && (N = null);
305
+ var U = N ? N.completion : {};
306
+ return U.type = y, U.arg = E, N ? (this.method = "next", this.next = N.finallyLoc, d) : this.complete(U);
307
+ },
308
+ complete: function(y, E) {
309
+ if (y.type === "throw") throw y.arg;
310
+ return y.type === "break" || y.type === "continue" ? this.next = y.arg : y.type === "return" ? (this.rval = this.arg = y.arg, this.method = "return", this.next = "end") : y.type === "normal" && E && (this.next = E), d;
311
+ },
312
+ finish: function(y) {
313
+ for (var E = this.tryEntries.length - 1; E >= 0; --E) {
314
+ var x = this.tryEntries[E];
315
+ if (x.finallyLoc === y) return this.complete(x.completion, x.afterLoc), B(x), d;
316
+ }
317
+ },
318
+ catch: function(y) {
319
+ for (var E = this.tryEntries.length - 1; E >= 0; --E) {
320
+ var x = this.tryEntries[E];
321
+ if (x.tryLoc === y) {
322
+ var H = x.completion;
323
+ if (H.type === "throw") {
324
+ var N = H.arg;
325
+ B(x);
326
+ }
327
+ return N;
328
+ }
329
+ }
330
+ throw Error("illegal catch attempt");
331
+ },
332
+ delegateYield: function(y, E, x) {
333
+ return this.delegate = {
334
+ iterator: K(y),
335
+ resultName: E,
336
+ nextLoc: x
337
+ }, this.method === "next" && (this.arg = e), d;
338
+ }
339
+ }, t;
340
+ }
341
+ function rr(e, t, r, i, n, a, o) {
342
+ try {
343
+ var s = e[a](o), c = s.value;
344
+ } catch (u) {
345
+ return void r(u);
346
+ }
347
+ s.done ? t(c) : Promise.resolve(c).then(i, n);
348
+ }
349
+ function Ee(e) {
350
+ return function() {
351
+ var t = this, r = arguments;
352
+ return new Promise(function(i, n) {
353
+ var a = e.apply(t, r);
354
+ function o(c) {
355
+ rr(a, i, n, o, s, "next", c);
356
+ }
357
+ function s(c) {
358
+ rr(a, i, n, o, s, "throw", c);
359
+ }
360
+ o(void 0);
361
+ });
362
+ };
363
+ }
364
+ var ze = T({}, sn), Rn = ze.version, Nn = ze.render, Vn = ze.unmountComponentAtNode, Je;
365
+ try {
366
+ var _n = Number((Rn || "").split(".")[0]);
367
+ _n >= 18 && (Je = ze.createRoot);
368
+ } catch {
369
+ }
370
+ function nr(e) {
371
+ var t = ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
372
+ t && ee(t) === "object" && (t.usingClientEntryPoint = e);
373
+ }
374
+ var Ze = "__rc_react_root__";
375
+ function In(e, t) {
376
+ nr(!0);
377
+ var r = t[Ze] || Je(t);
378
+ nr(!1), r.render(e), t[Ze] = r;
379
+ }
380
+ function Ln(e, t) {
381
+ Nn(e, t);
382
+ }
383
+ function Hn(e, t) {
384
+ if (Je) {
385
+ In(e, t);
386
+ return;
387
+ }
388
+ Ln(e, t);
389
+ }
390
+ function Tn(e) {
391
+ return vt.apply(this, arguments);
392
+ }
393
+ function vt() {
394
+ return vt = Ee(/* @__PURE__ */ ie().mark(function e(t) {
395
+ return ie().wrap(function(i) {
396
+ for (; ; ) switch (i.prev = i.next) {
397
+ case 0:
398
+ return i.abrupt("return", Promise.resolve().then(function() {
399
+ var n;
400
+ (n = t[Ze]) === null || n === void 0 || n.unmount(), delete t[Ze];
401
+ }));
402
+ case 1:
403
+ case "end":
404
+ return i.stop();
405
+ }
406
+ }, e);
407
+ })), vt.apply(this, arguments);
408
+ }
409
+ function An(e) {
410
+ Vn(e);
411
+ }
412
+ function Mn(e) {
413
+ return pt.apply(this, arguments);
414
+ }
415
+ function pt() {
416
+ return pt = Ee(/* @__PURE__ */ ie().mark(function e(t) {
417
+ return ie().wrap(function(i) {
418
+ for (; ; ) switch (i.prev = i.next) {
419
+ case 0:
420
+ if (Je === void 0) {
421
+ i.next = 2;
422
+ break;
423
+ }
424
+ return i.abrupt("return", Tn(t));
425
+ case 2:
426
+ An(t);
427
+ case 3:
428
+ case "end":
429
+ return i.stop();
430
+ }
431
+ }, e);
432
+ })), pt.apply(this, arguments);
433
+ }
434
+ const Bn = (e) => {
435
+ const {
436
+ componentCls: t,
437
+ colorPrimary: r
438
+ } = e;
439
+ return {
440
+ [t]: {
441
+ position: "absolute",
442
+ background: "transparent",
443
+ pointerEvents: "none",
444
+ boxSizing: "border-box",
445
+ color: `var(--wave-color, ${r})`,
446
+ boxShadow: "0 0 0 0 currentcolor",
447
+ opacity: 0.2,
448
+ // =================== Motion ===================
449
+ "&.wave-motion-appear": {
450
+ transition: [`box-shadow 0.4s ${e.motionEaseOutCirc}`, `opacity 2s ${e.motionEaseOutCirc}`].join(","),
451
+ "&-active": {
452
+ boxShadow: "0 0 0 6px currentcolor",
453
+ opacity: 0
454
+ },
455
+ "&.wave-quick": {
456
+ transition: [`box-shadow ${e.motionDurationSlow} ${e.motionEaseInOut}`, `opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`].join(",")
457
+ }
458
+ }
459
+ }
460
+ };
461
+ }, jn = ln("Wave", (e) => [Bn(e)]), Vr = `${cn}-wave-target`;
462
+ function st(e) {
463
+ return e && e !== "#fff" && e !== "#ffffff" && e !== "rgb(255, 255, 255)" && e !== "rgba(255, 255, 255, 1)" && !/rgba\((?:\d*, ){3}0\)/.test(e) && // any transparent rgba color
464
+ e !== "transparent";
465
+ }
466
+ function Dn(e) {
467
+ const {
468
+ borderTopColor: t,
469
+ borderColor: r,
470
+ backgroundColor: i
471
+ } = getComputedStyle(e);
472
+ return st(t) ? t : st(r) ? r : st(i) ? i : null;
473
+ }
474
+ function lt(e) {
475
+ return Number.isNaN(e) ? 0 : e;
476
+ }
477
+ const zn = (e) => {
478
+ const {
479
+ className: t,
480
+ target: r,
481
+ component: i
482
+ } = e, n = $.useRef(null), [a, o] = $.useState(null), [s, c] = $.useState([]), [u, l] = $.useState(0), [f, g] = $.useState(0), [O, v] = $.useState(0), [p, d] = $.useState(0), [C, h] = $.useState(!1), b = {
483
+ left: u,
484
+ top: f,
485
+ width: O,
486
+ height: p,
487
+ borderRadius: s.map((V) => `${V}px`).join(" ")
488
+ };
489
+ a && (b["--wave-color"] = a);
490
+ function S() {
491
+ const V = getComputedStyle(r);
492
+ o(Dn(r));
493
+ const R = V.position === "static", {
494
+ borderLeftWidth: _,
495
+ borderTopWidth: P
496
+ } = V;
497
+ l(R ? r.offsetLeft : lt(-parseFloat(_))), g(R ? r.offsetTop : lt(-parseFloat(P))), v(r.offsetWidth), d(r.offsetHeight);
498
+ const {
499
+ borderTopLeftRadius: I,
500
+ borderTopRightRadius: M,
501
+ borderBottomLeftRadius: z,
502
+ borderBottomRightRadius: B
503
+ } = V;
504
+ c([I, M, B, z].map((A) => lt(parseFloat(A))));
505
+ }
506
+ if ($.useEffect(() => {
507
+ if (r) {
508
+ const V = Ye(() => {
509
+ S(), h(!0);
510
+ });
511
+ let R;
512
+ return typeof ResizeObserver < "u" && (R = new ResizeObserver(S), R.observe(r)), () => {
513
+ Ye.cancel(V), R == null || R.disconnect();
514
+ };
515
+ }
516
+ }, []), !C)
517
+ return null;
518
+ const w = (i === "Checkbox" || i === "Radio") && (r == null ? void 0 : r.classList.contains(Vr));
519
+ return /* @__PURE__ */ $.createElement(Fr, {
520
+ visible: !0,
521
+ motionAppear: !0,
522
+ motionName: "wave-motion",
523
+ motionDeadline: 5e3,
524
+ onAppearEnd: (V, R) => {
525
+ var _;
526
+ if (R.deadline || R.propertyName === "opacity") {
527
+ const P = (_ = n.current) === null || _ === void 0 ? void 0 : _.parentElement;
528
+ Mn(P).then(() => {
529
+ P == null || P.remove();
530
+ });
531
+ }
532
+ return !1;
533
+ }
534
+ }, (V, R) => {
535
+ let {
536
+ className: _
537
+ } = V;
538
+ return /* @__PURE__ */ $.createElement("div", {
539
+ ref: _t(n, R),
540
+ className: ne(t, _, {
541
+ "wave-quick": w
542
+ }),
543
+ style: b
544
+ });
545
+ });
546
+ }, Wn = (e, t) => {
547
+ var r;
548
+ const {
549
+ component: i
550
+ } = t;
551
+ if (i === "Checkbox" && !(!((r = e.querySelector("input")) === null || r === void 0) && r.checked))
552
+ return;
553
+ const n = document.createElement("div");
554
+ n.style.position = "absolute", n.style.left = "0px", n.style.top = "0px", e == null || e.insertBefore(n, e == null ? void 0 : e.firstChild), Hn(/* @__PURE__ */ $.createElement(zn, Object.assign({}, t, {
555
+ target: e
556
+ })), n);
557
+ }, qn = (e, t, r) => {
558
+ const {
559
+ wave: i
560
+ } = $.useContext(_e), [, n, a] = Nt(), o = It((u) => {
561
+ const l = e.current;
562
+ if (i != null && i.disabled || !l)
563
+ return;
564
+ const f = l.querySelector(`.${Vr}`) || l, {
565
+ showEffect: g
566
+ } = i || {};
567
+ (g || Wn)(f, {
568
+ className: t,
569
+ token: n,
570
+ component: r,
571
+ event: u,
572
+ hashId: a
573
+ });
574
+ }), s = $.useRef();
575
+ return (u) => {
576
+ Ye.cancel(s.current), s.current = Ye(() => {
577
+ o(u);
578
+ });
579
+ };
580
+ }, _r = (e) => {
581
+ const {
582
+ children: t,
583
+ disabled: r,
584
+ component: i
585
+ } = e, {
586
+ getPrefixCls: n
587
+ } = Oe(_e), a = ce(null), o = n("wave"), [, s] = jn(o), c = qn(a, ne(o, s), i);
588
+ if (L.useEffect(() => {
589
+ const l = a.current;
590
+ if (!l || l.nodeType !== 1 || r)
591
+ return;
592
+ const f = (g) => {
593
+ !un(g.target) || // No need wave
594
+ !l.getAttribute || l.getAttribute("disabled") || l.disabled || l.className.includes("disabled") || l.className.includes("-leave") || c(g);
595
+ };
596
+ return l.addEventListener("click", f, !0), () => {
597
+ l.removeEventListener("click", f, !0);
598
+ };
599
+ }, [r]), !/* @__PURE__ */ L.isValidElement(t))
600
+ return t ?? null;
601
+ const u = dn(t) ? _t(t.ref, a) : a;
602
+ return $r(t, {
603
+ ref: u
604
+ });
605
+ };
606
+ process.env.NODE_ENV !== "production" && (_r.displayName = "Wave");
607
+ const Gn = (e) => {
608
+ const {
609
+ componentCls: t
610
+ } = e;
611
+ return {
612
+ [t]: {
613
+ "&-block": {
614
+ display: "flex",
615
+ width: "100%"
616
+ },
617
+ "&-vertical": {
618
+ flexDirection: "column"
619
+ }
620
+ }
621
+ };
622
+ }, Un = (e) => {
623
+ const {
624
+ componentCls: t,
625
+ antCls: r
626
+ } = e;
627
+ return {
628
+ [t]: {
629
+ display: "inline-flex",
630
+ "&-rtl": {
631
+ direction: "rtl"
632
+ },
633
+ "&-vertical": {
634
+ flexDirection: "column"
635
+ },
636
+ "&-align": {
637
+ flexDirection: "column",
638
+ "&-center": {
639
+ alignItems: "center"
640
+ },
641
+ "&-start": {
642
+ alignItems: "flex-start"
643
+ },
644
+ "&-end": {
645
+ alignItems: "flex-end"
646
+ },
647
+ "&-baseline": {
648
+ alignItems: "baseline"
649
+ }
650
+ },
651
+ [`${t}-item:empty`]: {
652
+ display: "none"
653
+ },
654
+ // https://github.com/ant-design/ant-design/issues/47875
655
+ [`${t}-item > ${r}-badge-not-a-wrapper:only-child`]: {
656
+ display: "block"
657
+ }
658
+ }
659
+ };
660
+ }, Kn = (e) => {
661
+ const {
662
+ componentCls: t
663
+ } = e;
664
+ return {
665
+ [t]: {
666
+ "&-gap-row-small": {
667
+ rowGap: e.spaceGapSmallSize
668
+ },
669
+ "&-gap-row-middle": {
670
+ rowGap: e.spaceGapMiddleSize
671
+ },
672
+ "&-gap-row-large": {
673
+ rowGap: e.spaceGapLargeSize
674
+ },
675
+ "&-gap-col-small": {
676
+ columnGap: e.spaceGapSmallSize
677
+ },
678
+ "&-gap-col-middle": {
679
+ columnGap: e.spaceGapMiddleSize
680
+ },
681
+ "&-gap-col-large": {
682
+ columnGap: e.spaceGapLargeSize
683
+ }
684
+ }
685
+ };
686
+ }, Yn = Er("Space", (e) => {
687
+ const t = je(e, {
688
+ spaceGapSmallSize: e.paddingXS,
689
+ spaceGapMiddleSize: e.padding,
690
+ spaceGapLargeSize: e.paddingLG
691
+ });
692
+ return [Un(t), Kn(t), Gn(t)];
693
+ }, () => ({}), {
694
+ // Space component don't apply extra font style
695
+ // https://github.com/ant-design/ant-design/issues/40315
696
+ resetStyle: !1
697
+ });
698
+ var Ir = function(e, t) {
699
+ var r = {};
700
+ for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
701
+ if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, i = Object.getOwnPropertySymbols(e); n < i.length; n++)
702
+ t.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[n]) && (r[i[n]] = e[i[n]]);
703
+ return r;
704
+ };
705
+ const Qe = /* @__PURE__ */ $.createContext(null), Zn = (e, t) => {
706
+ const r = $.useContext(Qe), i = $.useMemo(() => {
707
+ if (!r)
708
+ return "";
709
+ const {
710
+ compactDirection: n,
711
+ isFirstItem: a,
712
+ isLastItem: o
713
+ } = r, s = n === "vertical" ? "-vertical-" : "-";
714
+ return ne(`${e}-compact${s}item`, {
715
+ [`${e}-compact${s}first-item`]: a,
716
+ [`${e}-compact${s}last-item`]: o,
717
+ [`${e}-compact${s}item-rtl`]: t === "rtl"
718
+ });
719
+ }, [e, t, r]);
720
+ return {
721
+ compactSize: r == null ? void 0 : r.compactSize,
722
+ compactDirection: r == null ? void 0 : r.compactDirection,
723
+ compactItemClassnames: i
724
+ };
725
+ }, Xn = (e) => {
726
+ let {
727
+ children: t
728
+ } = e;
729
+ return /* @__PURE__ */ $.createElement(Qe.Provider, {
730
+ value: null
731
+ }, t);
732
+ }, kn = (e) => {
733
+ var {
734
+ children: t
735
+ } = e, r = Ir(e, ["children"]);
736
+ return /* @__PURE__ */ $.createElement(Qe.Provider, {
737
+ value: r
738
+ }, t);
739
+ }, co = (e) => {
740
+ const {
741
+ getPrefixCls: t,
742
+ direction: r
743
+ } = $.useContext(_e), {
744
+ size: i,
745
+ direction: n,
746
+ block: a,
747
+ prefixCls: o,
748
+ className: s,
749
+ rootClassName: c,
750
+ children: u
751
+ } = e, l = Ir(e, ["size", "direction", "block", "prefixCls", "className", "rootClassName", "children"]), f = wr((b) => i ?? b), g = t("space-compact", o), [O, v] = Yn(g), p = ne(g, v, {
752
+ [`${g}-rtl`]: r === "rtl",
753
+ [`${g}-block`]: a,
754
+ [`${g}-vertical`]: n === "vertical"
755
+ }, s, c), d = $.useContext(Qe), C = Sr(u), h = $.useMemo(() => C.map((b, S) => {
756
+ const w = (b == null ? void 0 : b.key) || `${g}-item-${S}`;
757
+ return /* @__PURE__ */ $.createElement(kn, {
758
+ key: w,
759
+ compactSize: f,
760
+ compactDirection: n,
761
+ isFirstItem: S === 0 && (!d || (d == null ? void 0 : d.isFirstItem)),
762
+ isLastItem: S === C.length - 1 && (!d || (d == null ? void 0 : d.isLastItem))
763
+ }, b);
764
+ }), [i, C, d]);
765
+ return C.length === 0 ? null : O(/* @__PURE__ */ $.createElement("div", Object.assign({
766
+ className: p
767
+ }, l), h));
768
+ };
769
+ var Jn = function(e, t) {
770
+ var r = {};
771
+ for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
772
+ if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, i = Object.getOwnPropertySymbols(e); n < i.length; n++)
773
+ t.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[n]) && (r[i[n]] = e[i[n]]);
774
+ return r;
775
+ };
776
+ const Lr = /* @__PURE__ */ $.createContext(void 0), Qn = (e) => {
777
+ const {
778
+ getPrefixCls: t,
779
+ direction: r
780
+ } = $.useContext(_e), {
781
+ prefixCls: i,
782
+ size: n,
783
+ className: a
784
+ } = e, o = Jn(e, ["prefixCls", "size", "className"]), s = t("btn-group", i), [, , c] = Nt();
785
+ let u = "";
786
+ switch (n) {
787
+ case "large":
788
+ u = "lg";
789
+ break;
790
+ case "small":
791
+ u = "sm";
792
+ break;
793
+ }
794
+ if (process.env.NODE_ENV !== "production") {
795
+ const f = Vt("Button.Group");
796
+ process.env.NODE_ENV !== "production" && f(!n || ["large", "small", "middle"].includes(n), "usage", "Invalid prop `size`.");
797
+ }
798
+ const l = ne(s, {
799
+ [`${s}-${u}`]: u,
800
+ [`${s}-rtl`]: r === "rtl"
801
+ }, a, c);
802
+ return /* @__PURE__ */ $.createElement(Lr.Provider, {
803
+ value: n
804
+ }, /* @__PURE__ */ $.createElement("div", Object.assign({}, o, {
805
+ className: l
806
+ })));
807
+ }, ir = /^[\u4E00-\u9FA5]{2}$/, yt = ir.test.bind(ir);
808
+ function uo(e) {
809
+ return e === "danger" ? {
810
+ danger: !0
811
+ } : {
812
+ type: e
813
+ };
814
+ }
815
+ function ar(e) {
816
+ return typeof e == "string";
817
+ }
818
+ function Ge(e) {
819
+ return e === "text" || e === "link";
820
+ }
821
+ function ei(e, t) {
822
+ if (e == null)
823
+ return;
824
+ const r = t ? " " : "";
825
+ return typeof e != "string" && typeof e != "number" && ar(e.type) && yt(e.props.children) ? $r(e, {
826
+ children: e.props.children.split("").join(r)
827
+ }) : ar(e) ? yt(e) ? /* @__PURE__ */ L.createElement("span", null, e.split("").join(r)) : /* @__PURE__ */ L.createElement("span", null, e) : Cn(e) ? /* @__PURE__ */ L.createElement("span", null, e) : e;
828
+ }
829
+ function ti(e, t) {
830
+ let r = !1;
831
+ const i = [];
832
+ return L.Children.forEach(e, (n) => {
833
+ const a = typeof n, o = a === "string" || a === "number";
834
+ if (r && o) {
835
+ const s = i.length - 1, c = i[s];
836
+ i[s] = `${c}${n}`;
837
+ } else
838
+ i.push(n);
839
+ r = o;
840
+ }), L.Children.map(i, (n) => ei(n, t));
841
+ }
842
+ const Hr = /* @__PURE__ */ ke((e, t) => {
843
+ const {
844
+ className: r,
845
+ style: i,
846
+ children: n,
847
+ prefixCls: a
848
+ } = e, o = ne(`${a}-icon`, r);
849
+ return /* @__PURE__ */ L.createElement("span", {
850
+ ref: t,
851
+ className: o,
852
+ style: i
853
+ }, n);
854
+ }), or = /* @__PURE__ */ ke((e, t) => {
855
+ const {
856
+ prefixCls: r,
857
+ className: i,
858
+ style: n,
859
+ iconClassName: a
860
+ } = e, o = ne(`${r}-loading-icon`, i);
861
+ return /* @__PURE__ */ L.createElement(Hr, {
862
+ prefixCls: r,
863
+ className: o,
864
+ style: n,
865
+ ref: t
866
+ }, /* @__PURE__ */ L.createElement(Pr, {
867
+ className: a
868
+ }));
869
+ }), ct = () => ({
870
+ width: 0,
871
+ opacity: 0,
872
+ transform: "scale(0)"
873
+ }), ut = (e) => ({
874
+ width: e.scrollWidth,
875
+ opacity: 1,
876
+ transform: "scale(1)"
877
+ }), ri = (e) => {
878
+ const {
879
+ prefixCls: t,
880
+ loading: r,
881
+ existIcon: i,
882
+ className: n,
883
+ style: a
884
+ } = e, o = !!r;
885
+ return i ? /* @__PURE__ */ L.createElement(or, {
886
+ prefixCls: t,
887
+ className: n,
888
+ style: a
889
+ }) : /* @__PURE__ */ L.createElement(Fr, {
890
+ visible: o,
891
+ // We do not really use this motionName
892
+ motionName: `${t}-loading-icon-motion`,
893
+ motionLeave: o,
894
+ removeOnLeave: !0,
895
+ onAppearStart: ct,
896
+ onAppearActive: ut,
897
+ onEnterStart: ct,
898
+ onEnterActive: ut,
899
+ onLeaveStart: ut,
900
+ onLeaveActive: ct
901
+ }, (s, c) => {
902
+ let {
903
+ className: u,
904
+ style: l
905
+ } = s;
906
+ return /* @__PURE__ */ L.createElement(or, {
907
+ prefixCls: t,
908
+ className: n,
909
+ style: Object.assign(Object.assign({}, a), l),
910
+ ref: c,
911
+ iconClassName: u
912
+ });
913
+ });
914
+ }, sr = (e, t) => ({
915
+ // Border
916
+ [`> span, > ${e}`]: {
917
+ "&:not(:last-child)": {
918
+ [`&, & > ${e}`]: {
919
+ "&:not(:disabled)": {
920
+ borderInlineEndColor: t
921
+ }
922
+ }
923
+ },
924
+ "&:not(:first-child)": {
925
+ [`&, & > ${e}`]: {
926
+ "&:not(:disabled)": {
927
+ borderInlineStartColor: t
928
+ }
929
+ }
930
+ }
931
+ }
932
+ }), ni = (e) => {
933
+ const {
934
+ componentCls: t,
935
+ fontSize: r,
936
+ lineWidth: i,
937
+ groupBorderColor: n,
938
+ colorErrorHover: a
939
+ } = e;
940
+ return {
941
+ [`${t}-group`]: [
942
+ {
943
+ position: "relative",
944
+ display: "inline-flex",
945
+ // Border
946
+ [`> span, > ${t}`]: {
947
+ "&:not(:last-child)": {
948
+ [`&, & > ${t}`]: {
949
+ borderStartEndRadius: 0,
950
+ borderEndEndRadius: 0
951
+ }
952
+ },
953
+ "&:not(:first-child)": {
954
+ marginInlineStart: e.calc(i).mul(-1).equal(),
955
+ [`&, & > ${t}`]: {
956
+ borderStartStartRadius: 0,
957
+ borderEndStartRadius: 0
958
+ }
959
+ }
960
+ },
961
+ [t]: {
962
+ position: "relative",
963
+ zIndex: 1,
964
+ "&:hover, &:focus, &:active": {
965
+ zIndex: 2
966
+ },
967
+ "&[disabled]": {
968
+ zIndex: 0
969
+ }
970
+ },
971
+ [`${t}-icon-only`]: {
972
+ fontSize: r
973
+ }
974
+ },
975
+ // Border Color
976
+ sr(`${t}-primary`, n),
977
+ sr(`${t}-danger`, a)
978
+ ]
979
+ };
980
+ }, Q = Math.round;
981
+ function dt(e, t) {
982
+ const r = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], i = r.map((n) => parseFloat(n));
983
+ for (let n = 0; n < 3; n += 1)
984
+ i[n] = t(i[n] || 0, r[n] || "", n);
985
+ return r[3] ? i[3] = r[3].includes("%") ? i[3] / 100 : i[3] : i[3] = 1, i;
986
+ }
987
+ const lr = (e, t, r) => r === 0 ? e : e / 100;
988
+ function Le(e, t) {
989
+ const r = t || 255;
990
+ return e > r ? r : e < 0 ? 0 : e;
991
+ }
992
+ class et {
993
+ constructor(t) {
994
+ m(this, "isValid", !0), m(this, "r", 0), m(this, "g", 0), m(this, "b", 0), m(this, "a", 1), m(this, "_h", void 0), m(this, "_s", void 0), m(this, "_l", void 0), m(this, "_v", void 0), m(this, "_max", void 0), m(this, "_min", void 0), m(this, "_brightness", void 0);
995
+ function r(i) {
996
+ return i[0] in t && i[1] in t && i[2] in t;
997
+ }
998
+ if (t) if (typeof t == "string") {
999
+ let n = function(a) {
1000
+ return i.startsWith(a);
1001
+ };
1002
+ const i = t.trim();
1003
+ /^#?[A-F\d]{3,8}$/i.test(i) ? this.fromHexString(i) : n("rgb") ? this.fromRgbString(i) : n("hsl") ? this.fromHslString(i) : (n("hsv") || n("hsb")) && this.fromHsvString(i);
1004
+ } else if (t instanceof et)
1005
+ this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this._h = t._h, this._s = t._s, this._l = t._l, this._v = t._v;
1006
+ else if (r("rgb"))
1007
+ this.r = Le(t.r), this.g = Le(t.g), this.b = Le(t.b), this.a = typeof t.a == "number" ? Le(t.a, 1) : 1;
1008
+ else if (r("hsl"))
1009
+ this.fromHsl(t);
1010
+ else if (r("hsv"))
1011
+ this.fromHsv(t);
1012
+ else
1013
+ throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(t));
1014
+ }
1015
+ // ======================= Setter =======================
1016
+ setR(t) {
1017
+ return this._sc("r", t);
1018
+ }
1019
+ setG(t) {
1020
+ return this._sc("g", t);
1021
+ }
1022
+ setB(t) {
1023
+ return this._sc("b", t);
1024
+ }
1025
+ setA(t) {
1026
+ return this._sc("a", t, 1);
1027
+ }
1028
+ setHue(t) {
1029
+ const r = this.toHsv();
1030
+ return r.h = t, this._c(r);
1031
+ }
1032
+ // ======================= Getter =======================
1033
+ /**
1034
+ * Returns the perceived luminance of a color, from 0-1.
1035
+ * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
1036
+ */
1037
+ getLuminance() {
1038
+ function t(a) {
1039
+ const o = a / 255;
1040
+ return o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4);
1041
+ }
1042
+ const r = t(this.r), i = t(this.g), n = t(this.b);
1043
+ return 0.2126 * r + 0.7152 * i + 0.0722 * n;
1044
+ }
1045
+ getHue() {
1046
+ if (typeof this._h > "u") {
1047
+ const t = this.getMax() - this.getMin();
1048
+ t === 0 ? this._h = 0 : this._h = Q(60 * (this.r === this.getMax() ? (this.g - this.b) / t + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / t + 2 : (this.r - this.g) / t + 4));
1049
+ }
1050
+ return this._h;
1051
+ }
1052
+ getSaturation() {
1053
+ if (typeof this._s > "u") {
1054
+ const t = this.getMax() - this.getMin();
1055
+ t === 0 ? this._s = 0 : this._s = t / this.getMax();
1056
+ }
1057
+ return this._s;
1058
+ }
1059
+ getLightness() {
1060
+ return typeof this._l > "u" && (this._l = (this.getMax() + this.getMin()) / 510), this._l;
1061
+ }
1062
+ getValue() {
1063
+ return typeof this._v > "u" && (this._v = this.getMax() / 255), this._v;
1064
+ }
1065
+ /**
1066
+ * Returns the perceived brightness of the color, from 0-255.
1067
+ * Note: this is not the b of HSB
1068
+ * @see http://www.w3.org/TR/AERT#color-contrast
1069
+ */
1070
+ getBrightness() {
1071
+ return typeof this._brightness > "u" && (this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3), this._brightness;
1072
+ }
1073
+ // ======================== Func ========================
1074
+ darken(t = 10) {
1075
+ const r = this.getHue(), i = this.getSaturation();
1076
+ let n = this.getLightness() - t / 100;
1077
+ return n < 0 && (n = 0), this._c({
1078
+ h: r,
1079
+ s: i,
1080
+ l: n,
1081
+ a: this.a
1082
+ });
1083
+ }
1084
+ lighten(t = 10) {
1085
+ const r = this.getHue(), i = this.getSaturation();
1086
+ let n = this.getLightness() + t / 100;
1087
+ return n > 1 && (n = 1), this._c({
1088
+ h: r,
1089
+ s: i,
1090
+ l: n,
1091
+ a: this.a
1092
+ });
1093
+ }
1094
+ /**
1095
+ * Mix the current color a given amount with another color, from 0 to 100.
1096
+ * 0 means no mixing (return current color).
1097
+ */
1098
+ mix(t, r = 50) {
1099
+ const i = this._c(t), n = r / 100, a = (s) => (i[s] - this[s]) * n + this[s], o = {
1100
+ r: Q(a("r")),
1101
+ g: Q(a("g")),
1102
+ b: Q(a("b")),
1103
+ a: Q(a("a") * 100) / 100
1104
+ };
1105
+ return this._c(o);
1106
+ }
1107
+ /**
1108
+ * Mix the color with pure white, from 0 to 100.
1109
+ * Providing 0 will do nothing, providing 100 will always return white.
1110
+ */
1111
+ tint(t = 10) {
1112
+ return this.mix({
1113
+ r: 255,
1114
+ g: 255,
1115
+ b: 255,
1116
+ a: 1
1117
+ }, t);
1118
+ }
1119
+ /**
1120
+ * Mix the color with pure black, from 0 to 100.
1121
+ * Providing 0 will do nothing, providing 100 will always return black.
1122
+ */
1123
+ shade(t = 10) {
1124
+ return this.mix({
1125
+ r: 0,
1126
+ g: 0,
1127
+ b: 0,
1128
+ a: 1
1129
+ }, t);
1130
+ }
1131
+ onBackground(t) {
1132
+ const r = this._c(t), i = this.a + r.a * (1 - this.a), n = (a) => Q((this[a] * this.a + r[a] * r.a * (1 - this.a)) / i);
1133
+ return this._c({
1134
+ r: n("r"),
1135
+ g: n("g"),
1136
+ b: n("b"),
1137
+ a: i
1138
+ });
1139
+ }
1140
+ // ======================= Status =======================
1141
+ isDark() {
1142
+ return this.getBrightness() < 128;
1143
+ }
1144
+ isLight() {
1145
+ return this.getBrightness() >= 128;
1146
+ }
1147
+ // ======================== MISC ========================
1148
+ equals(t) {
1149
+ return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a;
1150
+ }
1151
+ clone() {
1152
+ return this._c(this);
1153
+ }
1154
+ // ======================= Format =======================
1155
+ toHexString() {
1156
+ let t = "#";
1157
+ const r = (this.r || 0).toString(16);
1158
+ t += r.length === 2 ? r : "0" + r;
1159
+ const i = (this.g || 0).toString(16);
1160
+ t += i.length === 2 ? i : "0" + i;
1161
+ const n = (this.b || 0).toString(16);
1162
+ if (t += n.length === 2 ? n : "0" + n, typeof this.a == "number" && this.a >= 0 && this.a < 1) {
1163
+ const a = Q(this.a * 255).toString(16);
1164
+ t += a.length === 2 ? a : "0" + a;
1165
+ }
1166
+ return t;
1167
+ }
1168
+ /** CSS support color pattern */
1169
+ toHsl() {
1170
+ return {
1171
+ h: this.getHue(),
1172
+ s: this.getSaturation(),
1173
+ l: this.getLightness(),
1174
+ a: this.a
1175
+ };
1176
+ }
1177
+ /** CSS support color pattern */
1178
+ toHslString() {
1179
+ const t = this.getHue(), r = Q(this.getSaturation() * 100), i = Q(this.getLightness() * 100);
1180
+ return this.a !== 1 ? `hsla(${t},${r}%,${i}%,${this.a})` : `hsl(${t},${r}%,${i}%)`;
1181
+ }
1182
+ /** Same as toHsb */
1183
+ toHsv() {
1184
+ return {
1185
+ h: this.getHue(),
1186
+ s: this.getSaturation(),
1187
+ v: this.getValue(),
1188
+ a: this.a
1189
+ };
1190
+ }
1191
+ toRgb() {
1192
+ return {
1193
+ r: this.r,
1194
+ g: this.g,
1195
+ b: this.b,
1196
+ a: this.a
1197
+ };
1198
+ }
1199
+ toRgbString() {
1200
+ return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
1201
+ }
1202
+ toString() {
1203
+ return this.toRgbString();
1204
+ }
1205
+ // ====================== Privates ======================
1206
+ /** Return a new FastColor object with one channel changed */
1207
+ _sc(t, r, i) {
1208
+ const n = this.clone();
1209
+ return n[t] = Le(r, i), n;
1210
+ }
1211
+ _c(t) {
1212
+ return new this.constructor(t);
1213
+ }
1214
+ getMax() {
1215
+ return typeof this._max > "u" && (this._max = Math.max(this.r, this.g, this.b)), this._max;
1216
+ }
1217
+ getMin() {
1218
+ return typeof this._min > "u" && (this._min = Math.min(this.r, this.g, this.b)), this._min;
1219
+ }
1220
+ fromHexString(t) {
1221
+ const r = t.replace("#", "");
1222
+ function i(n, a) {
1223
+ return parseInt(r[n] + r[a || n], 16);
1224
+ }
1225
+ r.length < 6 ? (this.r = i(0), this.g = i(1), this.b = i(2), this.a = r[3] ? i(3) / 255 : 1) : (this.r = i(0, 1), this.g = i(2, 3), this.b = i(4, 5), this.a = r[6] ? i(6, 7) / 255 : 1);
1226
+ }
1227
+ fromHsl({
1228
+ h: t,
1229
+ s: r,
1230
+ l: i,
1231
+ a: n
1232
+ }) {
1233
+ if (this._h = t % 360, this._s = r, this._l = i, this.a = typeof n == "number" ? n : 1, r <= 0) {
1234
+ const g = Q(i * 255);
1235
+ this.r = g, this.g = g, this.b = g;
1236
+ }
1237
+ let a = 0, o = 0, s = 0;
1238
+ const c = t / 60, u = (1 - Math.abs(2 * i - 1)) * r, l = u * (1 - Math.abs(c % 2 - 1));
1239
+ c >= 0 && c < 1 ? (a = u, o = l) : c >= 1 && c < 2 ? (a = l, o = u) : c >= 2 && c < 3 ? (o = u, s = l) : c >= 3 && c < 4 ? (o = l, s = u) : c >= 4 && c < 5 ? (a = l, s = u) : c >= 5 && c < 6 && (a = u, s = l);
1240
+ const f = i - u / 2;
1241
+ this.r = Q((a + f) * 255), this.g = Q((o + f) * 255), this.b = Q((s + f) * 255);
1242
+ }
1243
+ fromHsv({
1244
+ h: t,
1245
+ s: r,
1246
+ v: i,
1247
+ a: n
1248
+ }) {
1249
+ this._h = t % 360, this._s = r, this._v = i, this.a = typeof n == "number" ? n : 1;
1250
+ const a = Q(i * 255);
1251
+ if (this.r = a, this.g = a, this.b = a, r <= 0)
1252
+ return;
1253
+ const o = t / 60, s = Math.floor(o), c = o - s, u = Q(i * (1 - r) * 255), l = Q(i * (1 - r * c) * 255), f = Q(i * (1 - r * (1 - c)) * 255);
1254
+ switch (s) {
1255
+ case 0:
1256
+ this.g = f, this.b = u;
1257
+ break;
1258
+ case 1:
1259
+ this.r = l, this.b = u;
1260
+ break;
1261
+ case 2:
1262
+ this.r = u, this.b = f;
1263
+ break;
1264
+ case 3:
1265
+ this.r = u, this.g = l;
1266
+ break;
1267
+ case 4:
1268
+ this.r = f, this.g = u;
1269
+ break;
1270
+ case 5:
1271
+ default:
1272
+ this.g = u, this.b = l;
1273
+ break;
1274
+ }
1275
+ }
1276
+ fromHsvString(t) {
1277
+ const r = dt(t, lr);
1278
+ this.fromHsv({
1279
+ h: r[0],
1280
+ s: r[1],
1281
+ v: r[2],
1282
+ a: r[3]
1283
+ });
1284
+ }
1285
+ fromHslString(t) {
1286
+ const r = dt(t, lr);
1287
+ this.fromHsl({
1288
+ h: r[0],
1289
+ s: r[1],
1290
+ l: r[2],
1291
+ a: r[3]
1292
+ });
1293
+ }
1294
+ fromRgbString(t) {
1295
+ const r = dt(t, (i, n) => (
1296
+ // Convert percentage to number. e.g. 50% -> 128
1297
+ n.includes("%") ? Q(i / 100 * 255) : i
1298
+ ));
1299
+ this.r = r[0], this.g = r[1], this.b = r[2], this.a = r[3];
1300
+ }
1301
+ }
1302
+ var ii = ["b"], ai = ["v"], ft = function(t) {
1303
+ return Math.round(Number(t || 0));
1304
+ }, oi = function(t) {
1305
+ if (t instanceof et)
1306
+ return t;
1307
+ if (t && ee(t) === "object" && "h" in t && "b" in t) {
1308
+ var r = t, i = r.b, n = De(r, ii);
1309
+ return T(T({}, n), {}, {
1310
+ v: i
1311
+ });
1312
+ }
1313
+ return typeof t == "string" && /hsb/.test(t) ? t.replace(/hsb/, "hsv") : t;
1314
+ }, he = /* @__PURE__ */ function(e) {
1315
+ Lt(r, e);
1316
+ var t = Ht(r);
1317
+ function r(i) {
1318
+ return Ce(this, r), t.call(this, oi(i));
1319
+ }
1320
+ return Fe(r, [{
1321
+ key: "toHsbString",
1322
+ value: function() {
1323
+ var n = this.toHsb(), a = ft(n.s * 100), o = ft(n.b * 100), s = ft(n.h), c = n.a, u = "hsb(".concat(s, ", ").concat(a, "%, ").concat(o, "%)"), l = "hsba(".concat(s, ", ").concat(a, "%, ").concat(o, "%, ").concat(c.toFixed(c === 0 ? 0 : 2), ")");
1324
+ return c === 1 ? u : l;
1325
+ }
1326
+ }, {
1327
+ key: "toHsb",
1328
+ value: function() {
1329
+ var n = this.toHsv(), a = n.v, o = De(n, ai);
1330
+ return T(T({}, o), {}, {
1331
+ b: a,
1332
+ a: this.a
1333
+ });
1334
+ }
1335
+ }]), r;
1336
+ }(et), si = "rc-color-picker", Pe = function(t) {
1337
+ return t instanceof he ? t : new he(t);
1338
+ }, li = Pe("#1677ff"), Tr = function(t) {
1339
+ var r = t.offset, i = t.targetRef, n = t.containerRef, a = t.color, o = t.type, s = n.current.getBoundingClientRect(), c = s.width, u = s.height, l = i.current.getBoundingClientRect(), f = l.width, g = l.height, O = f / 2, v = g / 2, p = (r.x + O) / c, d = 1 - (r.y + v) / u, C = a.toHsb(), h = p, b = (r.x + O) / c * 360;
1340
+ if (o)
1341
+ switch (o) {
1342
+ case "hue":
1343
+ return Pe(T(T({}, C), {}, {
1344
+ h: b <= 0 ? 0 : b
1345
+ }));
1346
+ case "alpha":
1347
+ return Pe(T(T({}, C), {}, {
1348
+ a: h <= 0 ? 0 : h
1349
+ }));
1350
+ }
1351
+ return Pe({
1352
+ h: C.h,
1353
+ s: p <= 0 ? 0 : p,
1354
+ b: d >= 1 ? 1 : d,
1355
+ a: C.a
1356
+ });
1357
+ }, Ar = function(t, r) {
1358
+ var i = t.toHsb();
1359
+ switch (r) {
1360
+ case "hue":
1361
+ return {
1362
+ x: i.h / 360 * 100,
1363
+ y: 50
1364
+ };
1365
+ case "alpha":
1366
+ return {
1367
+ x: t.a * 100,
1368
+ y: 50
1369
+ };
1370
+ default:
1371
+ return {
1372
+ x: i.s * 100,
1373
+ y: (1 - i.b) * 100
1374
+ };
1375
+ }
1376
+ }, ci = function(t) {
1377
+ var r = t.color, i = t.prefixCls, n = t.className, a = t.style, o = t.onClick, s = "".concat(i, "-color-block");
1378
+ return /* @__PURE__ */ L.createElement("div", {
1379
+ className: ne(s, n),
1380
+ style: a,
1381
+ onClick: o
1382
+ }, /* @__PURE__ */ L.createElement("div", {
1383
+ className: "".concat(s, "-inner"),
1384
+ style: {
1385
+ background: r
1386
+ }
1387
+ }));
1388
+ };
1389
+ function ui(e) {
1390
+ var t = "touches" in e ? e.touches[0] : e, r = document.documentElement.scrollLeft || document.body.scrollLeft || window.pageXOffset, i = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
1391
+ return {
1392
+ pageX: t.pageX - r,
1393
+ pageY: t.pageY - i
1394
+ };
1395
+ }
1396
+ function Mr(e) {
1397
+ var t = e.targetRef, r = e.containerRef, i = e.direction, n = e.onDragChange, a = e.onDragChangeComplete, o = e.calculate, s = e.color, c = e.disabledDrag, u = Ke({
1398
+ x: 0,
1399
+ y: 0
1400
+ }), l = de(u, 2), f = l[0], g = l[1], O = ce(null), v = ce(null);
1401
+ Me(function() {
1402
+ g(o());
1403
+ }, [s]), Me(function() {
1404
+ return function() {
1405
+ document.removeEventListener("mousemove", O.current), document.removeEventListener("mouseup", v.current), document.removeEventListener("touchmove", O.current), document.removeEventListener("touchend", v.current), O.current = null, v.current = null;
1406
+ };
1407
+ }, []);
1408
+ var p = function(S) {
1409
+ var w = ui(S), V = w.pageX, R = w.pageY, _ = r.current.getBoundingClientRect(), P = _.x, I = _.y, M = _.width, z = _.height, B = t.current.getBoundingClientRect(), A = B.width, K = B.height, F = A / 2, y = K / 2, E = Math.max(0, Math.min(V - P, M)) - F, x = Math.max(0, Math.min(R - I, z)) - y, H = {
1410
+ x: E,
1411
+ y: i === "x" ? f.y : x
1412
+ };
1413
+ if (A === 0 && K === 0 || A !== K)
1414
+ return !1;
1415
+ n == null || n(H);
1416
+ }, d = function(S) {
1417
+ S.preventDefault(), p(S);
1418
+ }, C = function(S) {
1419
+ S.preventDefault(), document.removeEventListener("mousemove", O.current), document.removeEventListener("mouseup", v.current), document.removeEventListener("touchmove", O.current), document.removeEventListener("touchend", v.current), O.current = null, v.current = null, a == null || a();
1420
+ }, h = function(S) {
1421
+ document.removeEventListener("mousemove", O.current), document.removeEventListener("mouseup", v.current), !c && (p(S), document.addEventListener("mousemove", d), document.addEventListener("mouseup", C), document.addEventListener("touchmove", d), document.addEventListener("touchend", C), O.current = d, v.current = C);
1422
+ };
1423
+ return [f, h];
1424
+ }
1425
+ var Br = function(t) {
1426
+ var r = t.size, i = r === void 0 ? "default" : r, n = t.color, a = t.prefixCls;
1427
+ return /* @__PURE__ */ L.createElement("div", {
1428
+ className: ne("".concat(a, "-handler"), m({}, "".concat(a, "-handler-sm"), i === "small")),
1429
+ style: {
1430
+ backgroundColor: n
1431
+ }
1432
+ });
1433
+ }, jr = function(t) {
1434
+ var r = t.children, i = t.style, n = t.prefixCls;
1435
+ return /* @__PURE__ */ L.createElement("div", {
1436
+ className: "".concat(n, "-palette"),
1437
+ style: T({
1438
+ position: "relative"
1439
+ }, i)
1440
+ }, r);
1441
+ }, Dr = /* @__PURE__ */ ke(function(e, t) {
1442
+ var r = e.children, i = e.x, n = e.y;
1443
+ return /* @__PURE__ */ L.createElement("div", {
1444
+ ref: t,
1445
+ style: {
1446
+ position: "absolute",
1447
+ left: "".concat(i, "%"),
1448
+ top: "".concat(n, "%"),
1449
+ zIndex: 1,
1450
+ transform: "translate(-50%, -50%)"
1451
+ }
1452
+ }, r);
1453
+ }), di = function(t) {
1454
+ var r = t.color, i = t.onChange, n = t.prefixCls, a = t.onChangeComplete, o = t.disabled, s = ce(), c = ce(), u = ce(r), l = It(function(p) {
1455
+ var d = Tr({
1456
+ offset: p,
1457
+ targetRef: c,
1458
+ containerRef: s,
1459
+ color: r
1460
+ });
1461
+ u.current = d, i(d);
1462
+ }), f = Mr({
1463
+ color: r,
1464
+ containerRef: s,
1465
+ targetRef: c,
1466
+ calculate: function() {
1467
+ return Ar(r);
1468
+ },
1469
+ onDragChange: l,
1470
+ onDragChangeComplete: function() {
1471
+ return a == null ? void 0 : a(u.current);
1472
+ },
1473
+ disabledDrag: o
1474
+ }), g = de(f, 2), O = g[0], v = g[1];
1475
+ return /* @__PURE__ */ L.createElement("div", {
1476
+ ref: s,
1477
+ className: "".concat(n, "-select"),
1478
+ onMouseDown: v,
1479
+ onTouchStart: v
1480
+ }, /* @__PURE__ */ L.createElement(jr, {
1481
+ prefixCls: n
1482
+ }, /* @__PURE__ */ L.createElement(Dr, {
1483
+ x: O.x,
1484
+ y: O.y,
1485
+ ref: c
1486
+ }, /* @__PURE__ */ L.createElement(Br, {
1487
+ color: r.toRgbString(),
1488
+ prefixCls: n
1489
+ })), /* @__PURE__ */ L.createElement("div", {
1490
+ className: "".concat(n, "-saturation"),
1491
+ style: {
1492
+ backgroundColor: "hsl(".concat(r.toHsb().h, ",100%, 50%)"),
1493
+ backgroundImage: "linear-gradient(0deg, #000, transparent),linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0))"
1494
+ }
1495
+ })));
1496
+ }, fi = function(t, r) {
1497
+ var i = xr(t, {
1498
+ value: r
1499
+ }), n = de(i, 2), a = n[0], o = n[1], s = be(function() {
1500
+ return Pe(a);
1501
+ }, [a]);
1502
+ return [s, o];
1503
+ }, gi = function(t) {
1504
+ var r = t.colors, i = t.children, n = t.direction, a = n === void 0 ? "to right" : n, o = t.type, s = t.prefixCls, c = be(function() {
1505
+ return r.map(function(u, l) {
1506
+ var f = Pe(u);
1507
+ return o === "alpha" && l === r.length - 1 && (f = new he(f.setA(1))), f.toRgbString();
1508
+ }).join(",");
1509
+ }, [r, o]);
1510
+ return /* @__PURE__ */ L.createElement("div", {
1511
+ className: "".concat(s, "-gradient"),
1512
+ style: {
1513
+ position: "absolute",
1514
+ inset: 0,
1515
+ background: "linear-gradient(".concat(a, ", ").concat(c, ")")
1516
+ }
1517
+ }, i);
1518
+ }, hi = function(t) {
1519
+ var r = t.prefixCls, i = t.colors, n = t.disabled, a = t.onChange, o = t.onChangeComplete, s = t.color, c = t.type, u = ce(), l = ce(), f = ce(s), g = function(w) {
1520
+ return c === "hue" ? w.getHue() : w.a * 100;
1521
+ }, O = It(function(S) {
1522
+ var w = Tr({
1523
+ offset: S,
1524
+ targetRef: l,
1525
+ containerRef: u,
1526
+ color: s,
1527
+ type: c
1528
+ });
1529
+ f.current = w, a(g(w));
1530
+ }), v = Mr({
1531
+ color: s,
1532
+ targetRef: l,
1533
+ containerRef: u,
1534
+ calculate: function() {
1535
+ return Ar(s, c);
1536
+ },
1537
+ onDragChange: O,
1538
+ onDragChangeComplete: function() {
1539
+ o(g(f.current));
1540
+ },
1541
+ direction: "x",
1542
+ disabledDrag: n
1543
+ }), p = de(v, 2), d = p[0], C = p[1], h = L.useMemo(function() {
1544
+ if (c === "hue") {
1545
+ var S = s.toHsb();
1546
+ S.s = 1, S.b = 1, S.a = 1;
1547
+ var w = new he(S);
1548
+ return w;
1549
+ }
1550
+ return s;
1551
+ }, [s, c]), b = L.useMemo(function() {
1552
+ return i.map(function(S) {
1553
+ return "".concat(S.color, " ").concat(S.percent, "%");
1554
+ });
1555
+ }, [i]);
1556
+ return /* @__PURE__ */ L.createElement("div", {
1557
+ ref: u,
1558
+ className: ne("".concat(r, "-slider"), "".concat(r, "-slider-").concat(c)),
1559
+ onMouseDown: C,
1560
+ onTouchStart: C
1561
+ }, /* @__PURE__ */ L.createElement(jr, {
1562
+ prefixCls: r
1563
+ }, /* @__PURE__ */ L.createElement(Dr, {
1564
+ x: d.x,
1565
+ y: d.y,
1566
+ ref: l
1567
+ }, /* @__PURE__ */ L.createElement(Br, {
1568
+ size: "small",
1569
+ color: h.toHexString(),
1570
+ prefixCls: r
1571
+ })), /* @__PURE__ */ L.createElement(gi, {
1572
+ colors: b,
1573
+ type: c,
1574
+ prefixCls: r
1575
+ })));
1576
+ };
1577
+ function mi(e) {
1578
+ return $.useMemo(function() {
1579
+ var t = e || {}, r = t.slider;
1580
+ return [r || hi];
1581
+ }, [e]);
1582
+ }
1583
+ var vi = [{
1584
+ color: "rgb(255, 0, 0)",
1585
+ percent: 0
1586
+ }, {
1587
+ color: "rgb(255, 255, 0)",
1588
+ percent: 17
1589
+ }, {
1590
+ color: "rgb(0, 255, 0)",
1591
+ percent: 33
1592
+ }, {
1593
+ color: "rgb(0, 255, 255)",
1594
+ percent: 50
1595
+ }, {
1596
+ color: "rgb(0, 0, 255)",
1597
+ percent: 67
1598
+ }, {
1599
+ color: "rgb(255, 0, 255)",
1600
+ percent: 83
1601
+ }, {
1602
+ color: "rgb(255, 0, 0)",
1603
+ percent: 100
1604
+ }], pi = /* @__PURE__ */ ke(function(e, t) {
1605
+ var r = e.value, i = e.defaultValue, n = e.prefixCls, a = n === void 0 ? si : n, o = e.onChange, s = e.onChangeComplete, c = e.className, u = e.style, l = e.panelRender, f = e.disabledAlpha, g = f === void 0 ? !1 : f, O = e.disabled, v = O === void 0 ? !1 : O, p = e.components, d = mi(p), C = de(d, 1), h = C[0], b = fi(i || li, r), S = de(b, 2), w = S[0], V = S[1], R = be(function() {
1606
+ return w.setA(1).toRgbString();
1607
+ }, [w]), _ = function(x, H) {
1608
+ r || V(x), o == null || o(x, H);
1609
+ }, P = function(x) {
1610
+ return new he(w.setHue(x));
1611
+ }, I = function(x) {
1612
+ return new he(w.setA(x / 100));
1613
+ }, M = function(x) {
1614
+ _(P(x), {
1615
+ type: "hue",
1616
+ value: x
1617
+ });
1618
+ }, z = function(x) {
1619
+ _(I(x), {
1620
+ type: "alpha",
1621
+ value: x
1622
+ });
1623
+ }, B = function(x) {
1624
+ s && s(P(x));
1625
+ }, A = function(x) {
1626
+ s && s(I(x));
1627
+ }, K = ne("".concat(a, "-panel"), c, m({}, "".concat(a, "-panel-disabled"), v)), F = {
1628
+ prefixCls: a,
1629
+ disabled: v,
1630
+ color: w
1631
+ }, y = /* @__PURE__ */ L.createElement(L.Fragment, null, /* @__PURE__ */ L.createElement(di, $e({
1632
+ onChange: _
1633
+ }, F, {
1634
+ onChangeComplete: s
1635
+ })), /* @__PURE__ */ L.createElement("div", {
1636
+ className: "".concat(a, "-slider-container")
1637
+ }, /* @__PURE__ */ L.createElement("div", {
1638
+ className: ne("".concat(a, "-slider-group"), m({}, "".concat(a, "-slider-group-disabled-alpha"), g))
1639
+ }, /* @__PURE__ */ L.createElement(h, $e({}, F, {
1640
+ type: "hue",
1641
+ colors: vi,
1642
+ min: 0,
1643
+ max: 359,
1644
+ value: w.getHue(),
1645
+ onChange: M,
1646
+ onChangeComplete: B
1647
+ })), !g && /* @__PURE__ */ L.createElement(h, $e({}, F, {
1648
+ type: "alpha",
1649
+ colors: [{
1650
+ percent: 0,
1651
+ color: "rgba(255, 0, 4, 0)"
1652
+ }, {
1653
+ percent: 100,
1654
+ color: R
1655
+ }],
1656
+ min: 0,
1657
+ max: 100,
1658
+ value: w.a * 100,
1659
+ onChange: z,
1660
+ onChangeComplete: A
1661
+ }))), /* @__PURE__ */ L.createElement(ci, {
1662
+ color: w.toRgbString(),
1663
+ prefixCls: a
1664
+ })));
1665
+ return /* @__PURE__ */ L.createElement("div", {
1666
+ className: K,
1667
+ style: u,
1668
+ ref: t
1669
+ }, typeof l == "function" ? l(y) : y);
1670
+ });
1671
+ process.env.NODE_ENV !== "production" && (pi.displayName = "ColorPicker");
1672
+ const yi = (e, t) => (e == null ? void 0 : e.replace(/[^\w/]/g, "").slice(0, t ? 8 : 6)) || "", bi = (e, t) => e ? yi(e, t) : "";
1673
+ let Ci = /* @__PURE__ */ function() {
1674
+ function e(t) {
1675
+ Ce(this, e);
1676
+ var r;
1677
+ if (this.cleared = !1, t instanceof e) {
1678
+ this.metaColor = t.metaColor.clone(), this.colors = (r = t.colors) === null || r === void 0 ? void 0 : r.map((n) => ({
1679
+ color: new e(n.color),
1680
+ percent: n.percent
1681
+ })), this.cleared = t.cleared;
1682
+ return;
1683
+ }
1684
+ const i = Array.isArray(t);
1685
+ i && t.length ? (this.colors = t.map((n) => {
1686
+ let {
1687
+ color: a,
1688
+ percent: o
1689
+ } = n;
1690
+ return {
1691
+ color: new e(a),
1692
+ percent: o
1693
+ };
1694
+ }), this.metaColor = new he(this.colors[0].color.metaColor)) : this.metaColor = new he(i ? "" : t), (!t || i && !this.colors) && (this.metaColor = this.metaColor.setA(0), this.cleared = !0);
1695
+ }
1696
+ return Fe(e, [{
1697
+ key: "toHsb",
1698
+ value: function() {
1699
+ return this.metaColor.toHsb();
1700
+ }
1701
+ }, {
1702
+ key: "toHsbString",
1703
+ value: function() {
1704
+ return this.metaColor.toHsbString();
1705
+ }
1706
+ }, {
1707
+ key: "toHex",
1708
+ value: function() {
1709
+ return bi(this.toHexString(), this.metaColor.a < 1);
1710
+ }
1711
+ }, {
1712
+ key: "toHexString",
1713
+ value: function() {
1714
+ return this.metaColor.toHexString();
1715
+ }
1716
+ }, {
1717
+ key: "toRgb",
1718
+ value: function() {
1719
+ return this.metaColor.toRgb();
1720
+ }
1721
+ }, {
1722
+ key: "toRgbString",
1723
+ value: function() {
1724
+ return this.metaColor.toRgbString();
1725
+ }
1726
+ }, {
1727
+ key: "isGradient",
1728
+ value: function() {
1729
+ return !!this.colors && !this.cleared;
1730
+ }
1731
+ }, {
1732
+ key: "getColors",
1733
+ value: function() {
1734
+ return this.colors || [{
1735
+ color: this,
1736
+ percent: 0
1737
+ }];
1738
+ }
1739
+ }, {
1740
+ key: "toCssString",
1741
+ value: function() {
1742
+ const {
1743
+ colors: r
1744
+ } = this;
1745
+ return r ? `linear-gradient(90deg, ${r.map((n) => `${n.color.toRgbString()} ${n.percent}%`).join(", ")})` : this.metaColor.toRgbString();
1746
+ }
1747
+ }, {
1748
+ key: "equals",
1749
+ value: function(r) {
1750
+ return !r || this.isGradient() !== r.isGradient() ? !1 : this.isGradient() ? this.colors.length === r.colors.length && this.colors.every((i, n) => {
1751
+ const a = r.colors[n];
1752
+ return i.percent === a.percent && i.color.equals(a.color);
1753
+ }) : this.toHexString() === r.toHexString();
1754
+ }
1755
+ }]);
1756
+ }();
1757
+ const Fi = new ue("antZoomIn", {
1758
+ "0%": {
1759
+ transform: "scale(0.2)",
1760
+ opacity: 0
1761
+ },
1762
+ "100%": {
1763
+ transform: "scale(1)",
1764
+ opacity: 1
1765
+ }
1766
+ }), Ei = new ue("antZoomOut", {
1767
+ "0%": {
1768
+ transform: "scale(1)"
1769
+ },
1770
+ "100%": {
1771
+ transform: "scale(0.2)",
1772
+ opacity: 0
1773
+ }
1774
+ }), cr = new ue("antZoomBigIn", {
1775
+ "0%": {
1776
+ transform: "scale(0.8)",
1777
+ opacity: 0
1778
+ },
1779
+ "100%": {
1780
+ transform: "scale(1)",
1781
+ opacity: 1
1782
+ }
1783
+ }), ur = new ue("antZoomBigOut", {
1784
+ "0%": {
1785
+ transform: "scale(1)"
1786
+ },
1787
+ "100%": {
1788
+ transform: "scale(0.8)",
1789
+ opacity: 0
1790
+ }
1791
+ }), wi = new ue("antZoomUpIn", {
1792
+ "0%": {
1793
+ transform: "scale(0.8)",
1794
+ transformOrigin: "50% 0%",
1795
+ opacity: 0
1796
+ },
1797
+ "100%": {
1798
+ transform: "scale(1)",
1799
+ transformOrigin: "50% 0%"
1800
+ }
1801
+ }), Si = new ue("antZoomUpOut", {
1802
+ "0%": {
1803
+ transform: "scale(1)",
1804
+ transformOrigin: "50% 0%"
1805
+ },
1806
+ "100%": {
1807
+ transform: "scale(0.8)",
1808
+ transformOrigin: "50% 0%",
1809
+ opacity: 0
1810
+ }
1811
+ }), xi = new ue("antZoomLeftIn", {
1812
+ "0%": {
1813
+ transform: "scale(0.8)",
1814
+ transformOrigin: "0% 50%",
1815
+ opacity: 0
1816
+ },
1817
+ "100%": {
1818
+ transform: "scale(1)",
1819
+ transformOrigin: "0% 50%"
1820
+ }
1821
+ }), Oi = new ue("antZoomLeftOut", {
1822
+ "0%": {
1823
+ transform: "scale(1)",
1824
+ transformOrigin: "0% 50%"
1825
+ },
1826
+ "100%": {
1827
+ transform: "scale(0.8)",
1828
+ transformOrigin: "0% 50%",
1829
+ opacity: 0
1830
+ }
1831
+ }), $i = new ue("antZoomRightIn", {
1832
+ "0%": {
1833
+ transform: "scale(0.8)",
1834
+ transformOrigin: "100% 50%",
1835
+ opacity: 0
1836
+ },
1837
+ "100%": {
1838
+ transform: "scale(1)",
1839
+ transformOrigin: "100% 50%"
1840
+ }
1841
+ }), Pi = new ue("antZoomRightOut", {
1842
+ "0%": {
1843
+ transform: "scale(1)",
1844
+ transformOrigin: "100% 50%"
1845
+ },
1846
+ "100%": {
1847
+ transform: "scale(0.8)",
1848
+ transformOrigin: "100% 50%",
1849
+ opacity: 0
1850
+ }
1851
+ }), Ri = new ue("antZoomDownIn", {
1852
+ "0%": {
1853
+ transform: "scale(0.8)",
1854
+ transformOrigin: "50% 100%",
1855
+ opacity: 0
1856
+ },
1857
+ "100%": {
1858
+ transform: "scale(1)",
1859
+ transformOrigin: "50% 100%"
1860
+ }
1861
+ }), Ni = new ue("antZoomDownOut", {
1862
+ "0%": {
1863
+ transform: "scale(1)",
1864
+ transformOrigin: "50% 100%"
1865
+ },
1866
+ "100%": {
1867
+ transform: "scale(0.8)",
1868
+ transformOrigin: "50% 100%",
1869
+ opacity: 0
1870
+ }
1871
+ }), Vi = {
1872
+ zoom: {
1873
+ inKeyframes: Fi,
1874
+ outKeyframes: Ei
1875
+ },
1876
+ "zoom-big": {
1877
+ inKeyframes: cr,
1878
+ outKeyframes: ur
1879
+ },
1880
+ "zoom-big-fast": {
1881
+ inKeyframes: cr,
1882
+ outKeyframes: ur
1883
+ },
1884
+ "zoom-left": {
1885
+ inKeyframes: xi,
1886
+ outKeyframes: Oi
1887
+ },
1888
+ "zoom-right": {
1889
+ inKeyframes: $i,
1890
+ outKeyframes: Pi
1891
+ },
1892
+ "zoom-up": {
1893
+ inKeyframes: wi,
1894
+ outKeyframes: Si
1895
+ },
1896
+ "zoom-down": {
1897
+ inKeyframes: Ri,
1898
+ outKeyframes: Ni
1899
+ }
1900
+ }, fo = (e, t) => {
1901
+ const {
1902
+ antCls: r
1903
+ } = e, i = `${r}-${t}`, {
1904
+ inKeyframes: n,
1905
+ outKeyframes: a
1906
+ } = Vi[t];
1907
+ return [fn(i, n, a, t === "zoom-big-fast" ? e.motionDurationFast : e.motionDurationMid), {
1908
+ [`
1909
+ ${i}-enter,
1910
+ ${i}-appear
1911
+ `]: {
1912
+ transform: "scale(0)",
1913
+ opacity: 0,
1914
+ animationTimingFunction: e.motionEaseOutCirc,
1915
+ "&-prepare": {
1916
+ transform: "none"
1917
+ }
1918
+ },
1919
+ [`${i}-leave`]: {
1920
+ animationTimingFunction: e.motionEaseInOutCirc
1921
+ }
1922
+ }];
1923
+ }, _i = (e, t) => {
1924
+ const {
1925
+ r,
1926
+ g: i,
1927
+ b: n,
1928
+ a
1929
+ } = e.toRgb(), o = new he(e.toRgbString()).onBackground(t).toHsv();
1930
+ return a <= 0.5 ? o.v > 0.5 : r * 0.299 + i * 0.587 + n * 0.114 > 192;
1931
+ }, zr = (e) => {
1932
+ const {
1933
+ paddingInline: t,
1934
+ onlyIconSize: r,
1935
+ paddingBlock: i
1936
+ } = e;
1937
+ return je(e, {
1938
+ buttonPaddingHorizontal: t,
1939
+ buttonPaddingVertical: i,
1940
+ buttonIconOnlyFontSize: r
1941
+ });
1942
+ }, Wr = (e) => {
1943
+ var t, r, i, n, a, o;
1944
+ const s = (t = e.contentFontSize) !== null && t !== void 0 ? t : e.fontSize, c = (r = e.contentFontSizeSM) !== null && r !== void 0 ? r : e.fontSize, u = (i = e.contentFontSizeLG) !== null && i !== void 0 ? i : e.fontSizeLG, l = (n = e.contentLineHeight) !== null && n !== void 0 ? n : ot(s), f = (a = e.contentLineHeightSM) !== null && a !== void 0 ? a : ot(c), g = (o = e.contentLineHeightLG) !== null && o !== void 0 ? o : ot(u), O = _i(new Ci(e.colorBgSolid), "#fff") ? "#000" : "#fff";
1945
+ return {
1946
+ fontWeight: 400,
1947
+ defaultShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`,
1948
+ primaryShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`,
1949
+ dangerShadow: `0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`,
1950
+ primaryColor: e.colorTextLightSolid,
1951
+ dangerColor: e.colorTextLightSolid,
1952
+ borderColorDisabled: e.colorBorder,
1953
+ defaultGhostColor: e.colorBgContainer,
1954
+ ghostBg: "transparent",
1955
+ defaultGhostBorderColor: e.colorBgContainer,
1956
+ paddingInline: e.paddingContentHorizontal - e.lineWidth,
1957
+ paddingInlineLG: e.paddingContentHorizontal - e.lineWidth,
1958
+ paddingInlineSM: 8 - e.lineWidth,
1959
+ onlyIconSize: e.fontSizeLG,
1960
+ onlyIconSizeSM: e.fontSizeLG - 2,
1961
+ onlyIconSizeLG: e.fontSizeLG + 2,
1962
+ groupBorderColor: e.colorPrimaryHover,
1963
+ linkHoverBg: "transparent",
1964
+ textTextColor: e.colorText,
1965
+ textTextHoverColor: e.colorText,
1966
+ textTextActiveColor: e.colorText,
1967
+ textHoverBg: e.colorFillTertiary,
1968
+ defaultColor: e.colorText,
1969
+ defaultBg: e.colorBgContainer,
1970
+ defaultBorderColor: e.colorBorder,
1971
+ defaultBorderColorDisabled: e.colorBorder,
1972
+ defaultHoverBg: e.colorBgContainer,
1973
+ defaultHoverColor: e.colorPrimaryHover,
1974
+ defaultHoverBorderColor: e.colorPrimaryHover,
1975
+ defaultActiveBg: e.colorBgContainer,
1976
+ defaultActiveColor: e.colorPrimaryActive,
1977
+ defaultActiveBorderColor: e.colorPrimaryActive,
1978
+ solidTextColor: O,
1979
+ contentFontSize: s,
1980
+ contentFontSizeSM: c,
1981
+ contentFontSizeLG: u,
1982
+ contentLineHeight: l,
1983
+ contentLineHeightSM: f,
1984
+ contentLineHeightLG: g,
1985
+ paddingBlock: Math.max((e.controlHeight - s * l) / 2 - e.lineWidth, 0),
1986
+ paddingBlockSM: Math.max((e.controlHeightSM - c * f) / 2 - e.lineWidth, 0),
1987
+ paddingBlockLG: Math.max((e.controlHeightLG - u * g) / 2 - e.lineWidth, 0)
1988
+ };
1989
+ }, Ii = (e) => {
1990
+ const {
1991
+ componentCls: t,
1992
+ iconCls: r,
1993
+ fontWeight: i
1994
+ } = e;
1995
+ return {
1996
+ [t]: {
1997
+ outline: "none",
1998
+ position: "relative",
1999
+ display: "inline-flex",
2000
+ gap: e.marginXS,
2001
+ alignItems: "center",
2002
+ justifyContent: "center",
2003
+ fontWeight: i,
2004
+ whiteSpace: "nowrap",
2005
+ textAlign: "center",
2006
+ backgroundImage: "none",
2007
+ background: "transparent",
2008
+ border: `${Be(e.lineWidth)} ${e.lineType} transparent`,
2009
+ cursor: "pointer",
2010
+ transition: `all ${e.motionDurationMid} ${e.motionEaseInOut}`,
2011
+ userSelect: "none",
2012
+ touchAction: "manipulation",
2013
+ color: e.colorText,
2014
+ "&:disabled > *": {
2015
+ pointerEvents: "none"
2016
+ },
2017
+ "> span": {
2018
+ display: "inline-block"
2019
+ },
2020
+ [`${t}-icon`]: {
2021
+ lineHeight: 1
2022
+ },
2023
+ "> a": {
2024
+ color: "currentColor"
2025
+ },
2026
+ "&:not(:disabled)": Object.assign({}, gn(e)),
2027
+ [`&${t}-two-chinese-chars::first-letter`]: {
2028
+ letterSpacing: "0.34em"
2029
+ },
2030
+ [`&${t}-two-chinese-chars > *:not(${r})`]: {
2031
+ marginInlineEnd: "-0.34em",
2032
+ letterSpacing: "0.34em"
2033
+ },
2034
+ // iconPosition="end"
2035
+ "&-icon-end": {
2036
+ flexDirection: "row-reverse"
2037
+ }
2038
+ }
2039
+ };
2040
+ }, qr = (e, t, r) => ({
2041
+ [`&:not(:disabled):not(${e}-disabled)`]: {
2042
+ "&:hover": t,
2043
+ "&:active": r
2044
+ }
2045
+ }), Li = (e) => ({
2046
+ minWidth: e.controlHeight,
2047
+ paddingInlineStart: 0,
2048
+ paddingInlineEnd: 0,
2049
+ borderRadius: "50%"
2050
+ }), Hi = (e) => ({
2051
+ borderRadius: e.controlHeight,
2052
+ paddingInlineStart: e.calc(e.controlHeight).div(2).equal(),
2053
+ paddingInlineEnd: e.calc(e.controlHeight).div(2).equal()
2054
+ }), Ti = (e) => ({
2055
+ cursor: "not-allowed",
2056
+ borderColor: e.borderColorDisabled,
2057
+ color: e.colorTextDisabled,
2058
+ background: e.colorBgContainerDisabled,
2059
+ boxShadow: "none"
2060
+ }), Tt = (e, t, r, i, n, a, o, s) => ({
2061
+ [`&${e}-background-ghost`]: Object.assign(Object.assign({
2062
+ color: r || void 0,
2063
+ background: t,
2064
+ borderColor: i || void 0,
2065
+ boxShadow: "none"
2066
+ }, qr(e, Object.assign({
2067
+ background: t
2068
+ }, o), Object.assign({
2069
+ background: t
2070
+ }, s))), {
2071
+ "&:disabled": {
2072
+ cursor: "not-allowed",
2073
+ color: n || void 0,
2074
+ borderColor: a || void 0
2075
+ }
2076
+ })
2077
+ }), Ai = (e) => ({
2078
+ [`&:disabled, &${e.componentCls}-disabled`]: Object.assign({}, Ti(e))
2079
+ }), Mi = (e) => ({
2080
+ [`&:disabled, &${e.componentCls}-disabled`]: {
2081
+ cursor: "not-allowed",
2082
+ color: e.colorTextDisabled
2083
+ }
2084
+ }), tt = (e, t, r, i) => {
2085
+ const a = i && ["link", "text"].includes(i) ? Mi : Ai;
2086
+ return Object.assign(Object.assign({}, a(e)), qr(e.componentCls, t, r));
2087
+ }, At = (e, t, r, i, n) => ({
2088
+ [`&${e.componentCls}-variant-solid`]: Object.assign({
2089
+ color: t,
2090
+ background: r
2091
+ }, tt(e, i, n))
2092
+ }), Mt = (e, t, r, i, n) => ({
2093
+ [`&${e.componentCls}-variant-outlined, &${e.componentCls}-variant-dashed`]: Object.assign({
2094
+ borderColor: t,
2095
+ background: r
2096
+ }, tt(e, i, n))
2097
+ }), Bt = (e) => ({
2098
+ [`&${e.componentCls}-variant-dashed`]: {
2099
+ borderStyle: "dashed"
2100
+ }
2101
+ }), jt = (e, t, r, i) => ({
2102
+ [`&${e.componentCls}-variant-filled`]: Object.assign({
2103
+ boxShadow: "none",
2104
+ background: t
2105
+ }, tt(e, r, i))
2106
+ }), Ne = (e, t, r, i, n) => ({
2107
+ [`&${e.componentCls}-variant-${r}`]: Object.assign({
2108
+ color: t,
2109
+ boxShadow: "none"
2110
+ }, tt(e, i, n, r))
2111
+ }), Bi = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
2112
+ color: e.defaultColor,
2113
+ boxShadow: e.defaultShadow
2114
+ }, At(e, e.solidTextColor, e.colorBgSolid, {
2115
+ background: e.colorBgSolidHover
2116
+ }, {
2117
+ background: e.colorBgSolidActive
2118
+ })), Bt(e)), jt(e, e.colorFillTertiary, {
2119
+ background: e.colorFillSecondary
2120
+ }, {
2121
+ background: e.colorFill
2122
+ })), Ne(e, e.textTextColor, "link", {
2123
+ color: e.colorLinkHover,
2124
+ background: e.linkHoverBg
2125
+ }, {
2126
+ color: e.colorLinkActive
2127
+ })), Tt(e.componentCls, e.ghostBg, e.defaultGhostColor, e.defaultGhostBorderColor, e.colorTextDisabled, e.colorBorder)), ji = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
2128
+ color: e.colorPrimary,
2129
+ boxShadow: e.primaryShadow
2130
+ }, Mt(e, e.colorPrimary, e.colorBgContainer, {
2131
+ color: e.colorPrimaryTextHover,
2132
+ borderColor: e.colorPrimaryHover,
2133
+ background: e.colorBgContainer
2134
+ }, {
2135
+ color: e.colorPrimaryTextActive,
2136
+ borderColor: e.colorPrimaryActive,
2137
+ background: e.colorBgContainer
2138
+ })), Bt(e)), jt(e, e.colorPrimaryBg, {
2139
+ background: e.colorPrimaryBgHover
2140
+ }, {
2141
+ background: e.colorPrimaryBorder
2142
+ })), Ne(e, e.colorLink, "text", {
2143
+ color: e.colorPrimaryTextHover,
2144
+ background: e.colorPrimaryBg
2145
+ }, {
2146
+ color: e.colorPrimaryTextActive,
2147
+ background: e.colorPrimaryBorder
2148
+ })), Tt(e.componentCls, e.ghostBg, e.colorPrimary, e.colorPrimary, e.colorTextDisabled, e.colorBorder, {
2149
+ color: e.colorPrimaryHover,
2150
+ borderColor: e.colorPrimaryHover
2151
+ }, {
2152
+ color: e.colorPrimaryActive,
2153
+ borderColor: e.colorPrimaryActive
2154
+ })), Di = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
2155
+ color: e.colorError,
2156
+ boxShadow: e.dangerShadow
2157
+ }, At(e, e.dangerColor, e.colorError, {
2158
+ background: e.colorErrorHover
2159
+ }, {
2160
+ background: e.colorErrorActive
2161
+ })), Mt(e, e.colorError, e.colorBgContainer, {
2162
+ color: e.colorErrorHover,
2163
+ borderColor: e.colorErrorBorderHover
2164
+ }, {
2165
+ color: e.colorErrorActive,
2166
+ borderColor: e.colorErrorActive
2167
+ })), Bt(e)), jt(e, e.colorErrorBg, {
2168
+ background: e.colorErrorBgFilledHover
2169
+ }, {
2170
+ background: e.colorErrorBgActive
2171
+ })), Ne(e, e.colorError, "text", {
2172
+ color: e.colorErrorHover,
2173
+ background: e.colorErrorBg
2174
+ }, {
2175
+ color: e.colorErrorHover,
2176
+ background: e.colorErrorBgActive
2177
+ })), Ne(e, e.colorError, "link", {
2178
+ color: e.colorErrorHover
2179
+ }, {
2180
+ color: e.colorErrorActive
2181
+ })), Tt(e.componentCls, e.ghostBg, e.colorError, e.colorError, e.colorTextDisabled, e.colorBorder, {
2182
+ color: e.colorErrorHover,
2183
+ borderColor: e.colorErrorHover
2184
+ }, {
2185
+ color: e.colorErrorActive,
2186
+ borderColor: e.colorErrorActive
2187
+ })), zi = (e) => {
2188
+ const {
2189
+ componentCls: t
2190
+ } = e;
2191
+ return {
2192
+ [`${t}-color-default`]: Bi(e),
2193
+ [`${t}-color-primary`]: ji(e),
2194
+ [`${t}-color-dangerous`]: Di(e)
2195
+ };
2196
+ }, Wi = (e) => Object.assign(Object.assign(Object.assign(Object.assign({}, Mt(e, e.defaultBorderColor, e.defaultBg, {
2197
+ color: e.defaultHoverColor,
2198
+ borderColor: e.defaultHoverBorderColor,
2199
+ background: e.defaultHoverBg
2200
+ }, {
2201
+ color: e.defaultActiveColor,
2202
+ borderColor: e.defaultActiveBorderColor,
2203
+ background: e.defaultActiveBg
2204
+ })), Ne(e, e.textTextColor, "text", {
2205
+ color: e.textTextHoverColor,
2206
+ background: e.textHoverBg
2207
+ }, {
2208
+ color: e.textTextActiveColor,
2209
+ background: e.colorBgTextActive
2210
+ })), At(e, e.primaryColor, e.colorPrimary, {
2211
+ background: e.colorPrimaryHover,
2212
+ color: e.primaryColor
2213
+ }, {
2214
+ background: e.colorPrimaryActive,
2215
+ color: e.primaryColor
2216
+ })), Ne(e, e.colorLink, "link", {
2217
+ color: e.colorLinkHover,
2218
+ background: e.linkHoverBg
2219
+ }, {
2220
+ color: e.colorLinkActive
2221
+ })), Dt = function(e) {
2222
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2223
+ const {
2224
+ componentCls: r,
2225
+ controlHeight: i,
2226
+ fontSize: n,
2227
+ lineHeight: a,
2228
+ borderRadius: o,
2229
+ buttonPaddingHorizontal: s,
2230
+ iconCls: c,
2231
+ buttonPaddingVertical: u
2232
+ } = e, l = `${r}-icon-only`;
2233
+ return [
2234
+ {
2235
+ [t]: {
2236
+ fontSize: n,
2237
+ lineHeight: a,
2238
+ height: i,
2239
+ padding: `${Be(u)} ${Be(s)}`,
2240
+ borderRadius: o,
2241
+ [`&${l}`]: {
2242
+ width: i,
2243
+ paddingInline: 0,
2244
+ // make `btn-icon-only` not too narrow
2245
+ [`&${r}-compact-item`]: {
2246
+ flex: "none"
2247
+ },
2248
+ [`&${r}-round`]: {
2249
+ width: "auto"
2250
+ },
2251
+ [c]: {
2252
+ fontSize: e.buttonIconOnlyFontSize
2253
+ }
2254
+ },
2255
+ // Loading
2256
+ [`&${r}-loading`]: {
2257
+ opacity: e.opacityLoading,
2258
+ cursor: "default"
2259
+ },
2260
+ [`${r}-loading-icon`]: {
2261
+ transition: `width ${e.motionDurationSlow} ${e.motionEaseInOut}, opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`
2262
+ }
2263
+ }
2264
+ },
2265
+ // Shape - patch prefixCls again to override solid border radius style
2266
+ {
2267
+ [`${r}${r}-circle${t}`]: Li(e)
2268
+ },
2269
+ {
2270
+ [`${r}${r}-round${t}`]: Hi(e)
2271
+ }
2272
+ ];
2273
+ }, qi = (e) => {
2274
+ const t = je(e, {
2275
+ fontSize: e.contentFontSize,
2276
+ lineHeight: e.contentLineHeight
2277
+ });
2278
+ return Dt(t, e.componentCls);
2279
+ }, Gi = (e) => {
2280
+ const t = je(e, {
2281
+ controlHeight: e.controlHeightSM,
2282
+ fontSize: e.contentFontSizeSM,
2283
+ lineHeight: e.contentLineHeightSM,
2284
+ padding: e.paddingXS,
2285
+ buttonPaddingHorizontal: e.paddingInlineSM,
2286
+ buttonPaddingVertical: e.paddingBlockSM,
2287
+ borderRadius: e.borderRadiusSM,
2288
+ buttonIconOnlyFontSize: e.onlyIconSizeSM
2289
+ });
2290
+ return Dt(t, `${e.componentCls}-sm`);
2291
+ }, Ui = (e) => {
2292
+ const t = je(e, {
2293
+ controlHeight: e.controlHeightLG,
2294
+ fontSize: e.contentFontSizeLG,
2295
+ lineHeight: e.contentLineHeightLG,
2296
+ buttonPaddingHorizontal: e.paddingInlineLG,
2297
+ buttonPaddingVertical: e.paddingBlockLG,
2298
+ borderRadius: e.borderRadiusLG,
2299
+ buttonIconOnlyFontSize: e.onlyIconSizeLG
2300
+ });
2301
+ return Dt(t, `${e.componentCls}-lg`);
2302
+ }, Ki = (e) => {
2303
+ const {
2304
+ componentCls: t
2305
+ } = e;
2306
+ return {
2307
+ [t]: {
2308
+ [`&${t}-block`]: {
2309
+ width: "100%"
2310
+ }
2311
+ }
2312
+ };
2313
+ }, Yi = Er("Button", (e) => {
2314
+ const t = zr(e);
2315
+ return [
2316
+ // Shared
2317
+ Ii(t),
2318
+ // Size
2319
+ qi(t),
2320
+ Gi(t),
2321
+ Ui(t),
2322
+ // Block
2323
+ Ki(t),
2324
+ // Color
2325
+ zi(t),
2326
+ // https://github.com/ant-design/ant-design/issues/50969
2327
+ Wi(t),
2328
+ // Button Group
2329
+ ni(t)
2330
+ ];
2331
+ }, Wr, {
2332
+ unitless: {
2333
+ fontWeight: !0,
2334
+ contentLineHeight: !0,
2335
+ contentLineHeightSM: !0,
2336
+ contentLineHeightLG: !0
2337
+ }
2338
+ });
2339
+ function Zi(e, t, r) {
2340
+ const {
2341
+ focusElCls: i,
2342
+ focus: n,
2343
+ borderElCls: a
2344
+ } = r, o = a ? "> *" : "", s = ["hover", n ? "focus" : null, "active"].filter(Boolean).map((c) => `&:${c} ${o}`).join(",");
2345
+ return {
2346
+ [`&-item:not(${t}-last-item)`]: {
2347
+ marginInlineEnd: e.calc(e.lineWidth).mul(-1).equal()
2348
+ },
2349
+ "&-item": Object.assign(Object.assign({
2350
+ [s]: {
2351
+ zIndex: 2
2352
+ }
2353
+ }, i ? {
2354
+ [`&${i}`]: {
2355
+ zIndex: 2
2356
+ }
2357
+ } : {}), {
2358
+ [`&[disabled] ${o}`]: {
2359
+ zIndex: 0
2360
+ }
2361
+ })
2362
+ };
2363
+ }
2364
+ function Xi(e, t, r) {
2365
+ const {
2366
+ borderElCls: i
2367
+ } = r, n = i ? `> ${i}` : "";
2368
+ return {
2369
+ [`&-item:not(${t}-first-item):not(${t}-last-item) ${n}`]: {
2370
+ borderRadius: 0
2371
+ },
2372
+ [`&-item:not(${t}-last-item)${t}-first-item`]: {
2373
+ [`& ${n}, &${e}-sm ${n}, &${e}-lg ${n}`]: {
2374
+ borderStartEndRadius: 0,
2375
+ borderEndEndRadius: 0
2376
+ }
2377
+ },
2378
+ [`&-item:not(${t}-first-item)${t}-last-item`]: {
2379
+ [`& ${n}, &${e}-sm ${n}, &${e}-lg ${n}`]: {
2380
+ borderStartStartRadius: 0,
2381
+ borderEndStartRadius: 0
2382
+ }
2383
+ }
2384
+ };
2385
+ }
2386
+ function ki(e) {
2387
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
2388
+ focus: !0
2389
+ };
2390
+ const {
2391
+ componentCls: r
2392
+ } = e, i = `${r}-compact`;
2393
+ return {
2394
+ [i]: Object.assign(Object.assign({}, Zi(e, i, t)), Xi(r, i, t))
2395
+ };
2396
+ }
2397
+ function Ji(e, t) {
2398
+ return {
2399
+ // border collapse
2400
+ [`&-item:not(${t}-last-item)`]: {
2401
+ marginBottom: e.calc(e.lineWidth).mul(-1).equal()
2402
+ },
2403
+ "&-item": {
2404
+ "&:hover,&:focus,&:active": {
2405
+ zIndex: 2
2406
+ },
2407
+ "&[disabled]": {
2408
+ zIndex: 0
2409
+ }
2410
+ }
2411
+ };
2412
+ }
2413
+ function Qi(e, t) {
2414
+ return {
2415
+ [`&-item:not(${t}-first-item):not(${t}-last-item)`]: {
2416
+ borderRadius: 0
2417
+ },
2418
+ [`&-item${t}-first-item:not(${t}-last-item)`]: {
2419
+ [`&, &${e}-sm, &${e}-lg`]: {
2420
+ borderEndEndRadius: 0,
2421
+ borderEndStartRadius: 0
2422
+ }
2423
+ },
2424
+ [`&-item${t}-last-item:not(${t}-first-item)`]: {
2425
+ [`&, &${e}-sm, &${e}-lg`]: {
2426
+ borderStartStartRadius: 0,
2427
+ borderStartEndRadius: 0
2428
+ }
2429
+ }
2430
+ };
2431
+ }
2432
+ function ea(e) {
2433
+ const t = `${e.componentCls}-compact-vertical`;
2434
+ return {
2435
+ [t]: Object.assign(Object.assign({}, Ji(e, t)), Qi(e.componentCls, t))
2436
+ };
2437
+ }
2438
+ const ta = (e) => {
2439
+ const {
2440
+ componentCls: t,
2441
+ calc: r
2442
+ } = e;
2443
+ return {
2444
+ [t]: {
2445
+ // Special styles for Primary Button
2446
+ [`&-compact-item${t}-primary`]: {
2447
+ [`&:not([disabled]) + ${t}-compact-item${t}-primary:not([disabled])`]: {
2448
+ position: "relative",
2449
+ "&:before": {
2450
+ position: "absolute",
2451
+ top: r(e.lineWidth).mul(-1).equal(),
2452
+ insetInlineStart: r(e.lineWidth).mul(-1).equal(),
2453
+ display: "inline-block",
2454
+ width: e.lineWidth,
2455
+ height: `calc(100% + ${Be(e.lineWidth)} * 2)`,
2456
+ backgroundColor: e.colorPrimaryHover,
2457
+ content: '""'
2458
+ }
2459
+ }
2460
+ },
2461
+ // Special styles for Primary Button
2462
+ "&-compact-vertical-item": {
2463
+ [`&${t}-primary`]: {
2464
+ [`&:not([disabled]) + ${t}-compact-vertical-item${t}-primary:not([disabled])`]: {
2465
+ position: "relative",
2466
+ "&:before": {
2467
+ position: "absolute",
2468
+ top: r(e.lineWidth).mul(-1).equal(),
2469
+ insetInlineStart: r(e.lineWidth).mul(-1).equal(),
2470
+ display: "inline-block",
2471
+ width: `calc(100% + ${Be(e.lineWidth)} * 2)`,
2472
+ height: e.lineWidth,
2473
+ backgroundColor: e.colorPrimaryHover,
2474
+ content: '""'
2475
+ }
2476
+ }
2477
+ }
2478
+ }
2479
+ }
2480
+ };
2481
+ }, ra = hn(["Button", "compact"], (e) => {
2482
+ const t = zr(e);
2483
+ return [
2484
+ // Space Compact
2485
+ ki(t),
2486
+ ea(t),
2487
+ ta(t)
2488
+ ];
2489
+ }, Wr);
2490
+ var na = function(e, t) {
2491
+ var r = {};
2492
+ for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
2493
+ if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, i = Object.getOwnPropertySymbols(e); n < i.length; n++)
2494
+ t.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, i[n]) && (r[i[n]] = e[i[n]]);
2495
+ return r;
2496
+ };
2497
+ function ia(e) {
2498
+ if (typeof e == "object" && e) {
2499
+ let t = e == null ? void 0 : e.delay;
2500
+ return t = !Number.isNaN(t) && typeof t == "number" ? t : 0, {
2501
+ loading: t <= 0,
2502
+ delay: t
2503
+ };
2504
+ }
2505
+ return {
2506
+ loading: !!e,
2507
+ delay: 0
2508
+ };
2509
+ }
2510
+ const aa = {
2511
+ default: ["default", "outlined"],
2512
+ primary: ["primary", "solid"],
2513
+ dashed: ["default", "dashed"],
2514
+ link: ["primary", "link"],
2515
+ text: ["default", "text"]
2516
+ }, oa = /* @__PURE__ */ L.forwardRef((e, t) => {
2517
+ var r, i, n, a;
2518
+ const {
2519
+ loading: o = !1,
2520
+ prefixCls: s,
2521
+ color: c,
2522
+ variant: u,
2523
+ type: l,
2524
+ danger: f = !1,
2525
+ shape: g = "default",
2526
+ size: O,
2527
+ styles: v,
2528
+ disabled: p,
2529
+ className: d,
2530
+ rootClassName: C,
2531
+ children: h,
2532
+ icon: b,
2533
+ iconPosition: S = "start",
2534
+ ghost: w = !1,
2535
+ block: V = !1,
2536
+ // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
2537
+ htmlType: R = "button",
2538
+ classNames: _,
2539
+ style: P = {},
2540
+ autoInsertSpace: I
2541
+ } = e, M = na(e, ["loading", "prefixCls", "color", "variant", "type", "danger", "shape", "size", "styles", "disabled", "className", "rootClassName", "children", "icon", "iconPosition", "ghost", "block", "htmlType", "classNames", "style", "autoInsertSpace"]), z = l || "default", [B, A] = be(() => {
2542
+ if (c && u)
2543
+ return [c, u];
2544
+ const J = aa[z] || [];
2545
+ return f ? ["danger", J[1]] : J;
2546
+ }, [l, c, u, f]), F = B === "danger" ? "dangerous" : B, {
2547
+ getPrefixCls: y,
2548
+ direction: E,
2549
+ button: x
2550
+ } = Oe(_e), H = (r = I ?? (x == null ? void 0 : x.autoInsertSpace)) !== null && r !== void 0 ? r : !0, N = y("btn", s), [U, Y, q] = Yi(N), te = Oe(mn), k = p ?? te, ae = Oe(Lr), Ie = be(() => ia(o), [o]), [me, qt] = Ke(Ie.loading), [rt, Gt] = Ke(!1), we = _t(t, /* @__PURE__ */ nn()), Ut = an.count(h) === 1 && !b && !Ge(A);
2551
+ Me(() => {
2552
+ let J = null;
2553
+ Ie.delay > 0 ? J = setTimeout(() => {
2554
+ J = null, qt(!0);
2555
+ }, Ie.delay) : qt(Ie.loading);
2556
+ function fe() {
2557
+ J && (clearTimeout(J), J = null);
2558
+ }
2559
+ return fe;
2560
+ }, [Ie]), Me(() => {
2561
+ if (!we || !we.current || !H)
2562
+ return;
2563
+ const J = we.current.textContent;
2564
+ Ut && yt(J) ? rt || Gt(!0) : rt && Gt(!1);
2565
+ }, [we]);
2566
+ const Kt = L.useCallback((J) => {
2567
+ var fe;
2568
+ if (me || k) {
2569
+ J.preventDefault();
2570
+ return;
2571
+ }
2572
+ (fe = e.onClick) === null || fe === void 0 || fe.call(e, J);
2573
+ }, [e.onClick, me, k]);
2574
+ if (process.env.NODE_ENV !== "production") {
2575
+ const J = Vt("Button");
2576
+ process.env.NODE_ENV !== "production" && J(!(typeof b == "string" && b.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${b}\` at https://ant.design/components/icon`), process.env.NODE_ENV !== "production" && J(!(w && Ge(A)), "usage", "`link` or `text` button can't be a `ghost` button.");
2577
+ }
2578
+ const {
2579
+ compactSize: Jr,
2580
+ compactItemClassnames: Yt
2581
+ } = Zn(N, E), Qr = {
2582
+ large: "lg",
2583
+ small: "sm",
2584
+ middle: void 0
2585
+ }, Zt = wr((J) => {
2586
+ var fe, at;
2587
+ return (at = (fe = O ?? Jr) !== null && fe !== void 0 ? fe : ae) !== null && at !== void 0 ? at : J;
2588
+ }), Xt = Zt && (i = Qr[Zt]) !== null && i !== void 0 ? i : "", en = me ? "loading" : b, nt = vn(M, ["navigate"]), kt = ne(N, Y, q, {
2589
+ [`${N}-${g}`]: g !== "default" && g,
2590
+ // line(253 - 254): Compatible with versions earlier than 5.21.0
2591
+ [`${N}-${z}`]: z,
2592
+ [`${N}-dangerous`]: f,
2593
+ [`${N}-color-${F}`]: F,
2594
+ [`${N}-variant-${A}`]: A,
2595
+ [`${N}-${Xt}`]: Xt,
2596
+ [`${N}-icon-only`]: !h && h !== 0 && !!en,
2597
+ [`${N}-background-ghost`]: w && !Ge(A),
2598
+ [`${N}-loading`]: me,
2599
+ [`${N}-two-chinese-chars`]: rt && H && !me,
2600
+ [`${N}-block`]: V,
2601
+ [`${N}-rtl`]: E === "rtl",
2602
+ [`${N}-icon-end`]: S === "end"
2603
+ }, Yt, d, C, x == null ? void 0 : x.className), Jt = Object.assign(Object.assign({}, x == null ? void 0 : x.style), P), tn = ne(_ == null ? void 0 : _.icon, (n = x == null ? void 0 : x.classNames) === null || n === void 0 ? void 0 : n.icon), rn = Object.assign(Object.assign({}, (v == null ? void 0 : v.icon) || {}), ((a = x == null ? void 0 : x.styles) === null || a === void 0 ? void 0 : a.icon) || {}), Qt = b && !me ? /* @__PURE__ */ L.createElement(Hr, {
2604
+ prefixCls: N,
2605
+ className: tn,
2606
+ style: rn
2607
+ }, b) : /* @__PURE__ */ L.createElement(ri, {
2608
+ existIcon: !!b,
2609
+ prefixCls: N,
2610
+ loading: me
2611
+ }), er = h || h === 0 ? ti(h, Ut && H) : null;
2612
+ if (nt.href !== void 0)
2613
+ return U(/* @__PURE__ */ L.createElement("a", Object.assign({}, nt, {
2614
+ className: ne(kt, {
2615
+ [`${N}-disabled`]: k
2616
+ }),
2617
+ href: k ? void 0 : nt.href,
2618
+ style: Jt,
2619
+ onClick: Kt,
2620
+ ref: we,
2621
+ tabIndex: k ? -1 : 0
2622
+ }), Qt, er));
2623
+ let it = /* @__PURE__ */ L.createElement("button", Object.assign({}, M, {
2624
+ type: R,
2625
+ className: kt,
2626
+ style: Jt,
2627
+ onClick: Kt,
2628
+ disabled: k,
2629
+ ref: we
2630
+ }), Qt, er, !!Yt && /* @__PURE__ */ L.createElement(ra, {
2631
+ key: "compact",
2632
+ prefixCls: N
2633
+ }));
2634
+ return Ge(A) || (it = /* @__PURE__ */ L.createElement(_r, {
2635
+ component: "Button",
2636
+ disabled: me
2637
+ }, it)), U(it);
2638
+ }), zt = oa;
2639
+ zt.Group = Qn;
2640
+ zt.__ANT_BUTTON = !0;
2641
+ process.env.NODE_ENV !== "production" && (zt.displayName = "Button");
2642
+ var ye = "RC_FORM_INTERNAL_HOOKS", G = function() {
2643
+ re(!1, "Can not find FormContext. Please make sure you wrap Field under Form.");
2644
+ }, Ve = /* @__PURE__ */ $.createContext({
2645
+ getFieldValue: G,
2646
+ getFieldsValue: G,
2647
+ getFieldError: G,
2648
+ getFieldWarning: G,
2649
+ getFieldsError: G,
2650
+ isFieldsTouched: G,
2651
+ isFieldTouched: G,
2652
+ isFieldValidating: G,
2653
+ isFieldsValidating: G,
2654
+ resetFields: G,
2655
+ setFields: G,
2656
+ setFieldValue: G,
2657
+ setFieldsValue: G,
2658
+ validateFields: G,
2659
+ submit: G,
2660
+ getInternalHooks: function() {
2661
+ return G(), {
2662
+ dispatch: G,
2663
+ initEntityValue: G,
2664
+ registerField: G,
2665
+ useSubscribe: G,
2666
+ setInitialValues: G,
2667
+ destroyForm: G,
2668
+ setCallbacks: G,
2669
+ registerWatch: G,
2670
+ getFields: G,
2671
+ setValidateMessages: G,
2672
+ setPreserve: G,
2673
+ getInitialValue: G
2674
+ };
2675
+ }
2676
+ }), Xe = /* @__PURE__ */ $.createContext(null);
2677
+ function bt(e) {
2678
+ return e == null ? [] : Array.isArray(e) ? e : [e];
2679
+ }
2680
+ function sa(e) {
2681
+ return e && !!e._init;
2682
+ }
2683
+ function Ct() {
2684
+ return {
2685
+ default: "Validation error on field %s",
2686
+ required: "%s is required",
2687
+ enum: "%s must be one of %s",
2688
+ whitespace: "%s cannot be empty",
2689
+ date: {
2690
+ format: "%s date %s is invalid for format %s",
2691
+ parse: "%s date could not be parsed, %s is invalid ",
2692
+ invalid: "%s date %s is invalid"
2693
+ },
2694
+ types: {
2695
+ string: "%s is not a %s",
2696
+ method: "%s is not a %s (function)",
2697
+ array: "%s is not an %s",
2698
+ object: "%s is not an %s",
2699
+ number: "%s is not a %s",
2700
+ date: "%s is not a %s",
2701
+ boolean: "%s is not a %s",
2702
+ integer: "%s is not an %s",
2703
+ float: "%s is not a %s",
2704
+ regexp: "%s is not a valid %s",
2705
+ email: "%s is not a valid %s",
2706
+ url: "%s is not a valid %s",
2707
+ hex: "%s is not a valid %s"
2708
+ },
2709
+ string: {
2710
+ len: "%s must be exactly %s characters",
2711
+ min: "%s must be at least %s characters",
2712
+ max: "%s cannot be longer than %s characters",
2713
+ range: "%s must be between %s and %s characters"
2714
+ },
2715
+ number: {
2716
+ len: "%s must equal %s",
2717
+ min: "%s cannot be less than %s",
2718
+ max: "%s cannot be greater than %s",
2719
+ range: "%s must be between %s and %s"
2720
+ },
2721
+ array: {
2722
+ len: "%s must be exactly %s in length",
2723
+ min: "%s cannot be less than %s in length",
2724
+ max: "%s cannot be greater than %s in length",
2725
+ range: "%s must be between %s and %s in length"
2726
+ },
2727
+ pattern: {
2728
+ mismatch: "%s value %s does not match pattern %s"
2729
+ },
2730
+ clone: function() {
2731
+ var t = JSON.parse(JSON.stringify(this));
2732
+ return t.clone = this.clone, t;
2733
+ }
2734
+ };
2735
+ }
2736
+ var Ft = Ct();
2737
+ function la(e) {
2738
+ try {
2739
+ return Function.toString.call(e).indexOf("[native code]") !== -1;
2740
+ } catch {
2741
+ return typeof e == "function";
2742
+ }
2743
+ }
2744
+ function ca(e, t, r) {
2745
+ if (pn()) return Reflect.construct.apply(null, arguments);
2746
+ var i = [null];
2747
+ i.push.apply(i, t);
2748
+ var n = new (e.bind.apply(e, i))();
2749
+ return r && Or(n, r.prototype), n;
2750
+ }
2751
+ function Et(e) {
2752
+ var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
2753
+ return Et = function(i) {
2754
+ if (i === null || !la(i)) return i;
2755
+ if (typeof i != "function") throw new TypeError("Super expression must either be null or a function");
2756
+ if (t !== void 0) {
2757
+ if (t.has(i)) return t.get(i);
2758
+ t.set(i, n);
2759
+ }
2760
+ function n() {
2761
+ return ca(i, arguments, yn(this).constructor);
2762
+ }
2763
+ return n.prototype = Object.create(i.prototype, {
2764
+ constructor: {
2765
+ value: n,
2766
+ enumerable: !1,
2767
+ writable: !0,
2768
+ configurable: !0
2769
+ }
2770
+ }), Or(n, i);
2771
+ }, Et(e);
2772
+ }
2773
+ var ua = /%[sdj%]/g, Gr = function() {
2774
+ };
2775
+ typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && (Gr = function(t, r) {
2776
+ typeof console < "u" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING > "u" && r.every(function(i) {
2777
+ return typeof i == "string";
2778
+ }) && console.warn(t, r);
2779
+ });
2780
+ function wt(e) {
2781
+ if (!e || !e.length) return null;
2782
+ var t = {};
2783
+ return e.forEach(function(r) {
2784
+ var i = r.field;
2785
+ t[i] = t[i] || [], t[i].push(r);
2786
+ }), t;
2787
+ }
2788
+ function se(e) {
2789
+ for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
2790
+ r[i - 1] = arguments[i];
2791
+ var n = 0, a = r.length;
2792
+ if (typeof e == "function")
2793
+ return e.apply(null, r);
2794
+ if (typeof e == "string") {
2795
+ var o = e.replace(ua, function(s) {
2796
+ if (s === "%%")
2797
+ return "%";
2798
+ if (n >= a)
2799
+ return s;
2800
+ switch (s) {
2801
+ case "%s":
2802
+ return String(r[n++]);
2803
+ case "%d":
2804
+ return Number(r[n++]);
2805
+ case "%j":
2806
+ try {
2807
+ return JSON.stringify(r[n++]);
2808
+ } catch {
2809
+ return "[Circular]";
2810
+ }
2811
+ break;
2812
+ default:
2813
+ return s;
2814
+ }
2815
+ });
2816
+ return o;
2817
+ }
2818
+ return e;
2819
+ }
2820
+ function da(e) {
2821
+ return e === "string" || e === "url" || e === "hex" || e === "email" || e === "date" || e === "pattern";
2822
+ }
2823
+ function X(e, t) {
2824
+ return !!(e == null || t === "array" && Array.isArray(e) && !e.length || da(t) && typeof e == "string" && !e);
2825
+ }
2826
+ function fa(e, t, r) {
2827
+ var i = [], n = 0, a = e.length;
2828
+ function o(s) {
2829
+ i.push.apply(i, j(s || [])), n++, n === a && r(i);
2830
+ }
2831
+ e.forEach(function(s) {
2832
+ t(s, o);
2833
+ });
2834
+ }
2835
+ function dr(e, t, r) {
2836
+ var i = 0, n = e.length;
2837
+ function a(o) {
2838
+ if (o && o.length) {
2839
+ r(o);
2840
+ return;
2841
+ }
2842
+ var s = i;
2843
+ i = i + 1, s < n ? t(e[s], a) : r([]);
2844
+ }
2845
+ a([]);
2846
+ }
2847
+ function ga(e) {
2848
+ var t = [];
2849
+ return Object.keys(e).forEach(function(r) {
2850
+ t.push.apply(t, j(e[r] || []));
2851
+ }), t;
2852
+ }
2853
+ var fr = /* @__PURE__ */ function(e) {
2854
+ Lt(r, e);
2855
+ var t = Ht(r);
2856
+ function r(i, n) {
2857
+ var a;
2858
+ return Ce(this, r), a = t.call(this, "Async Validation Error"), m(W(a), "errors", void 0), m(W(a), "fields", void 0), a.errors = i, a.fields = n, a;
2859
+ }
2860
+ return Fe(r);
2861
+ }(/* @__PURE__ */ Et(Error));
2862
+ function ha(e, t, r, i, n) {
2863
+ if (t.first) {
2864
+ var a = new Promise(function(g, O) {
2865
+ var v = function(C) {
2866
+ return i(C), C.length ? O(new fr(C, wt(C))) : g(n);
2867
+ }, p = ga(e);
2868
+ dr(p, r, v);
2869
+ });
2870
+ return a.catch(function(g) {
2871
+ return g;
2872
+ }), a;
2873
+ }
2874
+ var o = t.firstFields === !0 ? Object.keys(e) : t.firstFields || [], s = Object.keys(e), c = s.length, u = 0, l = [], f = new Promise(function(g, O) {
2875
+ var v = function(d) {
2876
+ if (l.push.apply(l, d), u++, u === c)
2877
+ return i(l), l.length ? O(new fr(l, wt(l))) : g(n);
2878
+ };
2879
+ s.length || (i(l), g(n)), s.forEach(function(p) {
2880
+ var d = e[p];
2881
+ o.indexOf(p) !== -1 ? dr(d, r, v) : fa(d, r, v);
2882
+ });
2883
+ });
2884
+ return f.catch(function(g) {
2885
+ return g;
2886
+ }), f;
2887
+ }
2888
+ function ma(e) {
2889
+ return !!(e && e.message !== void 0);
2890
+ }
2891
+ function va(e, t) {
2892
+ for (var r = e, i = 0; i < t.length; i++) {
2893
+ if (r == null)
2894
+ return r;
2895
+ r = r[t[i]];
2896
+ }
2897
+ return r;
2898
+ }
2899
+ function gr(e, t) {
2900
+ return function(r) {
2901
+ var i;
2902
+ return e.fullFields ? i = va(t, e.fullFields) : i = t[r.field || e.fullField], ma(r) ? (r.field = r.field || e.fullField, r.fieldValue = i, r) : {
2903
+ message: typeof r == "function" ? r() : r,
2904
+ fieldValue: i,
2905
+ field: r.field || e.fullField
2906
+ };
2907
+ };
2908
+ }
2909
+ function hr(e, t) {
2910
+ if (t) {
2911
+ for (var r in t)
2912
+ if (t.hasOwnProperty(r)) {
2913
+ var i = t[r];
2914
+ ee(i) === "object" && ee(e[r]) === "object" ? e[r] = T(T({}, e[r]), i) : e[r] = i;
2915
+ }
2916
+ }
2917
+ return e;
2918
+ }
2919
+ var Se = "enum", pa = function(t, r, i, n, a) {
2920
+ t[Se] = Array.isArray(t[Se]) ? t[Se] : [], t[Se].indexOf(r) === -1 && n.push(se(a.messages[Se], t.fullField, t[Se].join(", ")));
2921
+ }, ya = function(t, r, i, n, a) {
2922
+ if (t.pattern) {
2923
+ if (t.pattern instanceof RegExp)
2924
+ t.pattern.lastIndex = 0, t.pattern.test(r) || n.push(se(a.messages.pattern.mismatch, t.fullField, r, t.pattern));
2925
+ else if (typeof t.pattern == "string") {
2926
+ var o = new RegExp(t.pattern);
2927
+ o.test(r) || n.push(se(a.messages.pattern.mismatch, t.fullField, r, t.pattern));
2928
+ }
2929
+ }
2930
+ }, ba = function(t, r, i, n, a) {
2931
+ var o = typeof t.len == "number", s = typeof t.min == "number", c = typeof t.max == "number", u = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, l = r, f = null, g = typeof r == "number", O = typeof r == "string", v = Array.isArray(r);
2932
+ if (g ? f = "number" : O ? f = "string" : v && (f = "array"), !f)
2933
+ return !1;
2934
+ v && (l = r.length), O && (l = r.replace(u, "_").length), o ? l !== t.len && n.push(se(a.messages[f].len, t.fullField, t.len)) : s && !c && l < t.min ? n.push(se(a.messages[f].min, t.fullField, t.min)) : c && !s && l > t.max ? n.push(se(a.messages[f].max, t.fullField, t.max)) : s && c && (l < t.min || l > t.max) && n.push(se(a.messages[f].range, t.fullField, t.min, t.max));
2935
+ }, Ur = function(t, r, i, n, a, o) {
2936
+ t.required && (!i.hasOwnProperty(t.field) || X(r, o || t.type)) && n.push(se(a.messages.required, t.fullField));
2937
+ }, Ue;
2938
+ const Ca = function() {
2939
+ if (Ue)
2940
+ return Ue;
2941
+ var e = "[a-fA-F\\d:]", t = function(V) {
2942
+ return V && V.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(e, ")|(?<=").concat(e, ")(?=\\s|$))") : "";
2943
+ }, r = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}", i = "[a-fA-F\\d]{1,4}", n = [
2944
+ "(?:".concat(i, ":){7}(?:").concat(i, "|:)"),
2945
+ // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
2946
+ "(?:".concat(i, ":){6}(?:").concat(r, "|:").concat(i, "|:)"),
2947
+ // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::
2948
+ "(?:".concat(i, ":){5}(?::").concat(r, "|(?::").concat(i, "){1,2}|:)"),
2949
+ // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::
2950
+ "(?:".concat(i, ":){4}(?:(?::").concat(i, "){0,1}:").concat(r, "|(?::").concat(i, "){1,3}|:)"),
2951
+ // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::
2952
+ "(?:".concat(i, ":){3}(?:(?::").concat(i, "){0,2}:").concat(r, "|(?::").concat(i, "){1,4}|:)"),
2953
+ // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::
2954
+ "(?:".concat(i, ":){2}(?:(?::").concat(i, "){0,3}:").concat(r, "|(?::").concat(i, "){1,5}|:)"),
2955
+ // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::
2956
+ "(?:".concat(i, ":){1}(?:(?::").concat(i, "){0,4}:").concat(r, "|(?::").concat(i, "){1,6}|:)"),
2957
+ // 1:: 1::3:4:5:6:7:8 1::8 1::
2958
+ "(?::(?:(?::".concat(i, "){0,5}:").concat(r, "|(?::").concat(i, "){1,7}|:))")
2959
+ // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::
2960
+ ], a = "(?:%[0-9a-zA-Z]{1,})?", o = "(?:".concat(n.join("|"), ")").concat(a), s = new RegExp("(?:^".concat(r, "$)|(?:^").concat(o, "$)")), c = new RegExp("^".concat(r, "$")), u = new RegExp("^".concat(o, "$")), l = function(V) {
2961
+ return V && V.exact ? s : new RegExp("(?:".concat(t(V)).concat(r).concat(t(V), ")|(?:").concat(t(V)).concat(o).concat(t(V), ")"), "g");
2962
+ };
2963
+ l.v4 = function(w) {
2964
+ return w && w.exact ? c : new RegExp("".concat(t(w)).concat(r).concat(t(w)), "g");
2965
+ }, l.v6 = function(w) {
2966
+ return w && w.exact ? u : new RegExp("".concat(t(w)).concat(o).concat(t(w)), "g");
2967
+ };
2968
+ var f = "(?:(?:[a-z]+:)?//)", g = "(?:\\S+(?::\\S*)?@)?", O = l.v4().source, v = l.v6().source, p = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", d = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", C = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", h = "(?::\\d{2,5})?", b = '(?:[/?#][^\\s"]*)?', S = "(?:".concat(f, "|www\\.)").concat(g, "(?:localhost|").concat(O, "|").concat(v, "|").concat(p).concat(d).concat(C, ")").concat(h).concat(b);
2969
+ return Ue = new RegExp("(?:^".concat(S, "$)"), "i"), Ue;
2970
+ };
2971
+ var mr = {
2972
+ // http://emailregex.com/
2973
+ email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
2974
+ // url: new RegExp(
2975
+ // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
2976
+ // 'i',
2977
+ // ),
2978
+ hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
2979
+ }, Te = {
2980
+ integer: function(t) {
2981
+ return Te.number(t) && parseInt(t, 10) === t;
2982
+ },
2983
+ float: function(t) {
2984
+ return Te.number(t) && !Te.integer(t);
2985
+ },
2986
+ array: function(t) {
2987
+ return Array.isArray(t);
2988
+ },
2989
+ regexp: function(t) {
2990
+ if (t instanceof RegExp)
2991
+ return !0;
2992
+ try {
2993
+ return !!new RegExp(t);
2994
+ } catch {
2995
+ return !1;
2996
+ }
2997
+ },
2998
+ date: function(t) {
2999
+ return typeof t.getTime == "function" && typeof t.getMonth == "function" && typeof t.getYear == "function" && !isNaN(t.getTime());
3000
+ },
3001
+ number: function(t) {
3002
+ return isNaN(t) ? !1 : typeof t == "number";
3003
+ },
3004
+ object: function(t) {
3005
+ return ee(t) === "object" && !Te.array(t);
3006
+ },
3007
+ method: function(t) {
3008
+ return typeof t == "function";
3009
+ },
3010
+ email: function(t) {
3011
+ return typeof t == "string" && t.length <= 320 && !!t.match(mr.email);
3012
+ },
3013
+ url: function(t) {
3014
+ return typeof t == "string" && t.length <= 2048 && !!t.match(Ca());
3015
+ },
3016
+ hex: function(t) {
3017
+ return typeof t == "string" && !!t.match(mr.hex);
3018
+ }
3019
+ }, Fa = function(t, r, i, n, a) {
3020
+ if (t.required && r === void 0) {
3021
+ Ur(t, r, i, n, a);
3022
+ return;
3023
+ }
3024
+ var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], s = t.type;
3025
+ o.indexOf(s) > -1 ? Te[s](r) || n.push(se(a.messages.types[s], t.fullField, t.type)) : s && ee(r) !== t.type && n.push(se(a.messages.types[s], t.fullField, t.type));
3026
+ }, Ea = function(t, r, i, n, a) {
3027
+ (/^\s+$/.test(r) || r === "") && n.push(se(a.messages.whitespace, t.fullField));
3028
+ };
3029
+ const D = {
3030
+ required: Ur,
3031
+ whitespace: Ea,
3032
+ type: Fa,
3033
+ range: ba,
3034
+ enum: pa,
3035
+ pattern: ya
3036
+ };
3037
+ var wa = function(t, r, i, n, a) {
3038
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3039
+ if (s) {
3040
+ if (X(r) && !t.required)
3041
+ return i();
3042
+ D.required(t, r, n, o, a);
3043
+ }
3044
+ i(o);
3045
+ }, Sa = function(t, r, i, n, a) {
3046
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3047
+ if (s) {
3048
+ if (r == null && !t.required)
3049
+ return i();
3050
+ D.required(t, r, n, o, a, "array"), r != null && (D.type(t, r, n, o, a), D.range(t, r, n, o, a));
3051
+ }
3052
+ i(o);
3053
+ }, xa = function(t, r, i, n, a) {
3054
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3055
+ if (s) {
3056
+ if (X(r) && !t.required)
3057
+ return i();
3058
+ D.required(t, r, n, o, a), r !== void 0 && D.type(t, r, n, o, a);
3059
+ }
3060
+ i(o);
3061
+ }, Oa = function(t, r, i, n, a) {
3062
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3063
+ if (s) {
3064
+ if (X(r, "date") && !t.required)
3065
+ return i();
3066
+ if (D.required(t, r, n, o, a), !X(r, "date")) {
3067
+ var c;
3068
+ r instanceof Date ? c = r : c = new Date(r), D.type(t, c, n, o, a), c && D.range(t, c.getTime(), n, o, a);
3069
+ }
3070
+ }
3071
+ i(o);
3072
+ }, $a = "enum", Pa = function(t, r, i, n, a) {
3073
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3074
+ if (s) {
3075
+ if (X(r) && !t.required)
3076
+ return i();
3077
+ D.required(t, r, n, o, a), r !== void 0 && D[$a](t, r, n, o, a);
3078
+ }
3079
+ i(o);
3080
+ }, Ra = function(t, r, i, n, a) {
3081
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3082
+ if (s) {
3083
+ if (X(r) && !t.required)
3084
+ return i();
3085
+ D.required(t, r, n, o, a), r !== void 0 && (D.type(t, r, n, o, a), D.range(t, r, n, o, a));
3086
+ }
3087
+ i(o);
3088
+ }, Na = function(t, r, i, n, a) {
3089
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3090
+ if (s) {
3091
+ if (X(r) && !t.required)
3092
+ return i();
3093
+ D.required(t, r, n, o, a), r !== void 0 && (D.type(t, r, n, o, a), D.range(t, r, n, o, a));
3094
+ }
3095
+ i(o);
3096
+ }, Va = function(t, r, i, n, a) {
3097
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3098
+ if (s) {
3099
+ if (X(r) && !t.required)
3100
+ return i();
3101
+ D.required(t, r, n, o, a), r !== void 0 && D.type(t, r, n, o, a);
3102
+ }
3103
+ i(o);
3104
+ }, _a = function(t, r, i, n, a) {
3105
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3106
+ if (s) {
3107
+ if (r === "" && (r = void 0), X(r) && !t.required)
3108
+ return i();
3109
+ D.required(t, r, n, o, a), r !== void 0 && (D.type(t, r, n, o, a), D.range(t, r, n, o, a));
3110
+ }
3111
+ i(o);
3112
+ }, Ia = function(t, r, i, n, a) {
3113
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3114
+ if (s) {
3115
+ if (X(r) && !t.required)
3116
+ return i();
3117
+ D.required(t, r, n, o, a), r !== void 0 && D.type(t, r, n, o, a);
3118
+ }
3119
+ i(o);
3120
+ }, La = function(t, r, i, n, a) {
3121
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3122
+ if (s) {
3123
+ if (X(r, "string") && !t.required)
3124
+ return i();
3125
+ D.required(t, r, n, o, a), X(r, "string") || D.pattern(t, r, n, o, a);
3126
+ }
3127
+ i(o);
3128
+ }, Ha = function(t, r, i, n, a) {
3129
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3130
+ if (s) {
3131
+ if (X(r) && !t.required)
3132
+ return i();
3133
+ D.required(t, r, n, o, a), X(r) || D.type(t, r, n, o, a);
3134
+ }
3135
+ i(o);
3136
+ }, Ta = function(t, r, i, n, a) {
3137
+ var o = [], s = Array.isArray(r) ? "array" : ee(r);
3138
+ D.required(t, r, n, o, a, s), i(o);
3139
+ }, Aa = function(t, r, i, n, a) {
3140
+ var o = [], s = t.required || !t.required && n.hasOwnProperty(t.field);
3141
+ if (s) {
3142
+ if (X(r, "string") && !t.required)
3143
+ return i();
3144
+ D.required(t, r, n, o, a, "string"), X(r, "string") || (D.type(t, r, n, o, a), D.range(t, r, n, o, a), D.pattern(t, r, n, o, a), t.whitespace === !0 && D.whitespace(t, r, n, o, a));
3145
+ }
3146
+ i(o);
3147
+ }, gt = function(t, r, i, n, a) {
3148
+ var o = t.type, s = [], c = t.required || !t.required && n.hasOwnProperty(t.field);
3149
+ if (c) {
3150
+ if (X(r, o) && !t.required)
3151
+ return i();
3152
+ D.required(t, r, n, s, a, o), X(r, o) || D.type(t, r, n, s, a);
3153
+ }
3154
+ i(s);
3155
+ };
3156
+ const Ae = {
3157
+ string: Aa,
3158
+ method: Va,
3159
+ number: _a,
3160
+ boolean: xa,
3161
+ regexp: Ha,
3162
+ integer: Na,
3163
+ float: Ra,
3164
+ array: Sa,
3165
+ object: Ia,
3166
+ enum: Pa,
3167
+ pattern: La,
3168
+ date: Oa,
3169
+ url: gt,
3170
+ hex: gt,
3171
+ email: gt,
3172
+ required: Ta,
3173
+ any: wa
3174
+ };
3175
+ var We = /* @__PURE__ */ function() {
3176
+ function e(t) {
3177
+ Ce(this, e), m(this, "rules", null), m(this, "_messages", Ft), this.define(t);
3178
+ }
3179
+ return Fe(e, [{
3180
+ key: "define",
3181
+ value: function(r) {
3182
+ var i = this;
3183
+ if (!r)
3184
+ throw new Error("Cannot configure a schema with no rules");
3185
+ if (ee(r) !== "object" || Array.isArray(r))
3186
+ throw new Error("Rules must be an object");
3187
+ this.rules = {}, Object.keys(r).forEach(function(n) {
3188
+ var a = r[n];
3189
+ i.rules[n] = Array.isArray(a) ? a : [a];
3190
+ });
3191
+ }
3192
+ }, {
3193
+ key: "messages",
3194
+ value: function(r) {
3195
+ return r && (this._messages = hr(Ct(), r)), this._messages;
3196
+ }
3197
+ }, {
3198
+ key: "validate",
3199
+ value: function(r) {
3200
+ var i = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
3201
+ }, o = r, s = n, c = a;
3202
+ if (typeof s == "function" && (c = s, s = {}), !this.rules || Object.keys(this.rules).length === 0)
3203
+ return c && c(null, o), Promise.resolve(o);
3204
+ function u(v) {
3205
+ var p = [], d = {};
3206
+ function C(b) {
3207
+ if (Array.isArray(b)) {
3208
+ var S;
3209
+ p = (S = p).concat.apply(S, j(b));
3210
+ } else
3211
+ p.push(b);
3212
+ }
3213
+ for (var h = 0; h < v.length; h++)
3214
+ C(v[h]);
3215
+ p.length ? (d = wt(p), c(p, d)) : c(null, o);
3216
+ }
3217
+ if (s.messages) {
3218
+ var l = this.messages();
3219
+ l === Ft && (l = Ct()), hr(l, s.messages), s.messages = l;
3220
+ } else
3221
+ s.messages = this.messages();
3222
+ var f = {}, g = s.keys || Object.keys(this.rules);
3223
+ g.forEach(function(v) {
3224
+ var p = i.rules[v], d = o[v];
3225
+ p.forEach(function(C) {
3226
+ var h = C;
3227
+ typeof h.transform == "function" && (o === r && (o = T({}, o)), d = o[v] = h.transform(d), d != null && (h.type = h.type || (Array.isArray(d) ? "array" : ee(d)))), typeof h == "function" ? h = {
3228
+ validator: h
3229
+ } : h = T({}, h), h.validator = i.getValidationMethod(h), h.validator && (h.field = v, h.fullField = h.fullField || v, h.type = i.getType(h), f[v] = f[v] || [], f[v].push({
3230
+ rule: h,
3231
+ value: d,
3232
+ source: o,
3233
+ field: v
3234
+ }));
3235
+ });
3236
+ });
3237
+ var O = {};
3238
+ return ha(f, s, function(v, p) {
3239
+ var d = v.rule, C = (d.type === "object" || d.type === "array") && (ee(d.fields) === "object" || ee(d.defaultField) === "object");
3240
+ C = C && (d.required || !d.required && v.value), d.field = v.field;
3241
+ function h(R, _) {
3242
+ return T(T({}, _), {}, {
3243
+ fullField: "".concat(d.fullField, ".").concat(R),
3244
+ fullFields: d.fullFields ? [].concat(j(d.fullFields), [R]) : [R]
3245
+ });
3246
+ }
3247
+ function b() {
3248
+ var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], _ = Array.isArray(R) ? R : [R];
3249
+ !s.suppressWarning && _.length && e.warning("async-validator:", _), _.length && d.message !== void 0 && (_ = [].concat(d.message));
3250
+ var P = _.map(gr(d, o));
3251
+ if (s.first && P.length)
3252
+ return O[d.field] = 1, p(P);
3253
+ if (!C)
3254
+ p(P);
3255
+ else {
3256
+ if (d.required && !v.value)
3257
+ return d.message !== void 0 ? P = [].concat(d.message).map(gr(d, o)) : s.error && (P = [s.error(d, se(s.messages.required, d.field))]), p(P);
3258
+ var I = {};
3259
+ d.defaultField && Object.keys(v.value).map(function(B) {
3260
+ I[B] = d.defaultField;
3261
+ }), I = T(T({}, I), v.rule.fields);
3262
+ var M = {};
3263
+ Object.keys(I).forEach(function(B) {
3264
+ var A = I[B], K = Array.isArray(A) ? A : [A];
3265
+ M[B] = K.map(h.bind(null, B));
3266
+ });
3267
+ var z = new e(M);
3268
+ z.messages(s.messages), v.rule.options && (v.rule.options.messages = s.messages, v.rule.options.error = s.error), z.validate(v.value, v.rule.options || s, function(B) {
3269
+ var A = [];
3270
+ P && P.length && A.push.apply(A, j(P)), B && B.length && A.push.apply(A, j(B)), p(A.length ? A : null);
3271
+ });
3272
+ }
3273
+ }
3274
+ var S;
3275
+ if (d.asyncValidator)
3276
+ S = d.asyncValidator(d, v.value, b, v.source, s);
3277
+ else if (d.validator) {
3278
+ try {
3279
+ S = d.validator(d, v.value, b, v.source, s);
3280
+ } catch (R) {
3281
+ var w, V;
3282
+ (w = (V = console).error) === null || w === void 0 || w.call(V, R), s.suppressValidatorError || setTimeout(function() {
3283
+ throw R;
3284
+ }, 0), b(R.message);
3285
+ }
3286
+ S === !0 ? b() : S === !1 ? b(typeof d.message == "function" ? d.message(d.fullField || d.field) : d.message || "".concat(d.fullField || d.field, " fails")) : S instanceof Array ? b(S) : S instanceof Error && b(S.message);
3287
+ }
3288
+ S && S.then && S.then(function() {
3289
+ return b();
3290
+ }, function(R) {
3291
+ return b(R);
3292
+ });
3293
+ }, function(v) {
3294
+ u(v);
3295
+ }, o);
3296
+ }
3297
+ }, {
3298
+ key: "getType",
3299
+ value: function(r) {
3300
+ if (r.type === void 0 && r.pattern instanceof RegExp && (r.type = "pattern"), typeof r.validator != "function" && r.type && !Ae.hasOwnProperty(r.type))
3301
+ throw new Error(se("Unknown rule type %s", r.type));
3302
+ return r.type || "string";
3303
+ }
3304
+ }, {
3305
+ key: "getValidationMethod",
3306
+ value: function(r) {
3307
+ if (typeof r.validator == "function")
3308
+ return r.validator;
3309
+ var i = Object.keys(r), n = i.indexOf("message");
3310
+ return n !== -1 && i.splice(n, 1), i.length === 1 && i[0] === "required" ? Ae.required : Ae[this.getType(r)] || void 0;
3311
+ }
3312
+ }]), e;
3313
+ }();
3314
+ m(We, "register", function(t, r) {
3315
+ if (typeof r != "function")
3316
+ throw new Error("Cannot register a validator by type, validator is not a function");
3317
+ Ae[t] = r;
3318
+ });
3319
+ m(We, "warning", Gr);
3320
+ m(We, "messages", Ft);
3321
+ m(We, "validators", Ae);
3322
+ var oe = "'${name}' is not a valid ${type}", Kr = {
3323
+ default: "Validation error on field '${name}'",
3324
+ required: "'${name}' is required",
3325
+ enum: "'${name}' must be one of [${enum}]",
3326
+ whitespace: "'${name}' cannot be empty",
3327
+ date: {
3328
+ format: "'${name}' is invalid for format date",
3329
+ parse: "'${name}' could not be parsed as date",
3330
+ invalid: "'${name}' is invalid date"
3331
+ },
3332
+ types: {
3333
+ string: oe,
3334
+ method: oe,
3335
+ array: oe,
3336
+ object: oe,
3337
+ number: oe,
3338
+ date: oe,
3339
+ boolean: oe,
3340
+ integer: oe,
3341
+ float: oe,
3342
+ regexp: oe,
3343
+ email: oe,
3344
+ url: oe,
3345
+ hex: oe
3346
+ },
3347
+ string: {
3348
+ len: "'${name}' must be exactly ${len} characters",
3349
+ min: "'${name}' must be at least ${min} characters",
3350
+ max: "'${name}' cannot be longer than ${max} characters",
3351
+ range: "'${name}' must be between ${min} and ${max} characters"
3352
+ },
3353
+ number: {
3354
+ len: "'${name}' must equal ${len}",
3355
+ min: "'${name}' cannot be less than ${min}",
3356
+ max: "'${name}' cannot be greater than ${max}",
3357
+ range: "'${name}' must be between ${min} and ${max}"
3358
+ },
3359
+ array: {
3360
+ len: "'${name}' must be exactly ${len} in length",
3361
+ min: "'${name}' cannot be less than ${min} in length",
3362
+ max: "'${name}' cannot be greater than ${max} in length",
3363
+ range: "'${name}' must be between ${min} and ${max} in length"
3364
+ },
3365
+ pattern: {
3366
+ mismatch: "'${name}' does not match pattern ${pattern}"
3367
+ }
3368
+ }, vr = We;
3369
+ function Ma(e, t) {
3370
+ return e.replace(/\\?\$\{\w+\}/g, function(r) {
3371
+ if (r.startsWith("\\"))
3372
+ return r.slice(1);
3373
+ var i = r.slice(2, -1);
3374
+ return t[i];
3375
+ });
3376
+ }
3377
+ var pr = "CODE_LOGIC_ERROR";
3378
+ function St(e, t, r, i, n) {
3379
+ return xt.apply(this, arguments);
3380
+ }
3381
+ function xt() {
3382
+ return xt = Ee(/* @__PURE__ */ ie().mark(function e(t, r, i, n, a) {
3383
+ var o, s, c, u, l, f, g, O, v;
3384
+ return ie().wrap(function(d) {
3385
+ for (; ; ) switch (d.prev = d.next) {
3386
+ case 0:
3387
+ return o = T({}, i), delete o.ruleIndex, vr.warning = function() {
3388
+ }, o.validator && (s = o.validator, o.validator = function() {
3389
+ try {
3390
+ return s.apply(void 0, arguments);
3391
+ } catch (C) {
3392
+ return console.error(C), Promise.reject(pr);
3393
+ }
3394
+ }), c = null, o && o.type === "array" && o.defaultField && (c = o.defaultField, delete o.defaultField), u = new vr(m({}, t, [o])), l = He(Kr, n.validateMessages), u.messages(l), f = [], d.prev = 10, d.next = 13, Promise.resolve(u.validate(m({}, t, r), T({}, n)));
3395
+ case 13:
3396
+ d.next = 18;
3397
+ break;
3398
+ case 15:
3399
+ d.prev = 15, d.t0 = d.catch(10), d.t0.errors && (f = d.t0.errors.map(function(C, h) {
3400
+ var b = C.message, S = b === pr ? l.default : b;
3401
+ return /* @__PURE__ */ $.isValidElement(S) ? (
3402
+ // Wrap ReactNode with `key`
3403
+ /* @__PURE__ */ $.cloneElement(S, {
3404
+ key: "error_".concat(h)
3405
+ })
3406
+ ) : S;
3407
+ }));
3408
+ case 18:
3409
+ if (!(!f.length && c)) {
3410
+ d.next = 23;
3411
+ break;
3412
+ }
3413
+ return d.next = 21, Promise.all(r.map(function(C, h) {
3414
+ return St("".concat(t, ".").concat(h), C, c, n, a);
3415
+ }));
3416
+ case 21:
3417
+ return g = d.sent, d.abrupt("return", g.reduce(function(C, h) {
3418
+ return [].concat(j(C), j(h));
3419
+ }, []));
3420
+ case 23:
3421
+ return O = T(T({}, i), {}, {
3422
+ name: t,
3423
+ enum: (i.enum || []).join(", ")
3424
+ }, a), v = f.map(function(C) {
3425
+ return typeof C == "string" ? Ma(C, O) : C;
3426
+ }), d.abrupt("return", v);
3427
+ case 26:
3428
+ case "end":
3429
+ return d.stop();
3430
+ }
3431
+ }, e, null, [[10, 15]]);
3432
+ })), xt.apply(this, arguments);
3433
+ }
3434
+ function Ba(e, t, r, i, n, a) {
3435
+ var o = e.join("."), s = r.map(function(l, f) {
3436
+ var g = l.validator, O = T(T({}, l), {}, {
3437
+ ruleIndex: f
3438
+ });
3439
+ return g && (O.validator = function(v, p, d) {
3440
+ var C = !1, h = function() {
3441
+ for (var w = arguments.length, V = new Array(w), R = 0; R < w; R++)
3442
+ V[R] = arguments[R];
3443
+ Promise.resolve().then(function() {
3444
+ re(!C, "Your validator function has already return a promise. `callback` will be ignored."), C || d.apply(void 0, V);
3445
+ });
3446
+ }, b = g(v, p, h);
3447
+ C = b && typeof b.then == "function" && typeof b.catch == "function", re(C, "`callback` is deprecated. Please return a promise instead."), C && b.then(function() {
3448
+ d();
3449
+ }).catch(function(S) {
3450
+ d(S || " ");
3451
+ });
3452
+ }), O;
3453
+ }).sort(function(l, f) {
3454
+ var g = l.warningOnly, O = l.ruleIndex, v = f.warningOnly, p = f.ruleIndex;
3455
+ return !!g == !!v ? O - p : g ? 1 : -1;
3456
+ }), c;
3457
+ if (n === !0)
3458
+ c = new Promise(/* @__PURE__ */ function() {
3459
+ var l = Ee(/* @__PURE__ */ ie().mark(function f(g, O) {
3460
+ var v, p, d;
3461
+ return ie().wrap(function(h) {
3462
+ for (; ; ) switch (h.prev = h.next) {
3463
+ case 0:
3464
+ v = 0;
3465
+ case 1:
3466
+ if (!(v < s.length)) {
3467
+ h.next = 12;
3468
+ break;
3469
+ }
3470
+ return p = s[v], h.next = 5, St(o, t, p, i, a);
3471
+ case 5:
3472
+ if (d = h.sent, !d.length) {
3473
+ h.next = 9;
3474
+ break;
3475
+ }
3476
+ return O([{
3477
+ errors: d,
3478
+ rule: p
3479
+ }]), h.abrupt("return");
3480
+ case 9:
3481
+ v += 1, h.next = 1;
3482
+ break;
3483
+ case 12:
3484
+ g([]);
3485
+ case 13:
3486
+ case "end":
3487
+ return h.stop();
3488
+ }
3489
+ }, f);
3490
+ }));
3491
+ return function(f, g) {
3492
+ return l.apply(this, arguments);
3493
+ };
3494
+ }());
3495
+ else {
3496
+ var u = s.map(function(l) {
3497
+ return St(o, t, l, i, a).then(function(f) {
3498
+ return {
3499
+ errors: f,
3500
+ rule: l
3501
+ };
3502
+ });
3503
+ });
3504
+ c = (n ? Da(u) : ja(u)).then(function(l) {
3505
+ return Promise.reject(l);
3506
+ });
3507
+ }
3508
+ return c.catch(function(l) {
3509
+ return l;
3510
+ }), c;
3511
+ }
3512
+ function ja(e) {
3513
+ return Ot.apply(this, arguments);
3514
+ }
3515
+ function Ot() {
3516
+ return Ot = Ee(/* @__PURE__ */ ie().mark(function e(t) {
3517
+ return ie().wrap(function(i) {
3518
+ for (; ; ) switch (i.prev = i.next) {
3519
+ case 0:
3520
+ return i.abrupt("return", Promise.all(t).then(function(n) {
3521
+ var a, o = (a = []).concat.apply(a, j(n));
3522
+ return o;
3523
+ }));
3524
+ case 1:
3525
+ case "end":
3526
+ return i.stop();
3527
+ }
3528
+ }, e);
3529
+ })), Ot.apply(this, arguments);
3530
+ }
3531
+ function Da(e) {
3532
+ return $t.apply(this, arguments);
3533
+ }
3534
+ function $t() {
3535
+ return $t = Ee(/* @__PURE__ */ ie().mark(function e(t) {
3536
+ var r;
3537
+ return ie().wrap(function(n) {
3538
+ for (; ; ) switch (n.prev = n.next) {
3539
+ case 0:
3540
+ return r = 0, n.abrupt("return", new Promise(function(a) {
3541
+ t.forEach(function(o) {
3542
+ o.then(function(s) {
3543
+ s.errors.length && a([s]), r += 1, r === t.length && a([]);
3544
+ });
3545
+ });
3546
+ }));
3547
+ case 2:
3548
+ case "end":
3549
+ return n.stop();
3550
+ }
3551
+ }, e);
3552
+ })), $t.apply(this, arguments);
3553
+ }
3554
+ function Z(e) {
3555
+ return bt(e);
3556
+ }
3557
+ function yr(e, t) {
3558
+ var r = {};
3559
+ return t.forEach(function(i) {
3560
+ var n = pe(e, i);
3561
+ r = ve(r, i, n);
3562
+ }), r;
3563
+ }
3564
+ function Re(e, t) {
3565
+ var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
3566
+ return e && e.some(function(i) {
3567
+ return Yr(t, i, r);
3568
+ });
3569
+ }
3570
+ function Yr(e, t) {
3571
+ var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
3572
+ return !e || !t || !r && e.length !== t.length ? !1 : t.every(function(i, n) {
3573
+ return e[n] === i;
3574
+ });
3575
+ }
3576
+ function za(e, t) {
3577
+ if (e === t)
3578
+ return !0;
3579
+ if (!e && t || e && !t || !e || !t || ee(e) !== "object" || ee(t) !== "object")
3580
+ return !1;
3581
+ var r = Object.keys(e), i = Object.keys(t), n = new Set([].concat(r, i));
3582
+ return j(n).every(function(a) {
3583
+ var o = e[a], s = t[a];
3584
+ return typeof o == "function" && typeof s == "function" ? !0 : o === s;
3585
+ });
3586
+ }
3587
+ function Wa(e) {
3588
+ var t = arguments.length <= 1 ? void 0 : arguments[1];
3589
+ return t && t.target && ee(t.target) === "object" && e in t.target ? t.target[e] : t;
3590
+ }
3591
+ function br(e, t, r) {
3592
+ var i = e.length;
3593
+ if (t < 0 || t >= i || r < 0 || r >= i)
3594
+ return e;
3595
+ var n = e[t], a = t - r;
3596
+ return a > 0 ? [].concat(j(e.slice(0, r)), [n], j(e.slice(r, t)), j(e.slice(t + 1, i))) : a < 0 ? [].concat(j(e.slice(0, t)), j(e.slice(t + 1, r + 1)), [n], j(e.slice(r + 1, i))) : e;
3597
+ }
3598
+ var qa = ["name"], le = [];
3599
+ function ht(e, t, r, i, n, a) {
3600
+ return typeof e == "function" ? e(t, r, "source" in a ? {
3601
+ source: a.source
3602
+ } : {}) : i !== n;
3603
+ }
3604
+ var Wt = /* @__PURE__ */ function(e) {
3605
+ Lt(r, e);
3606
+ var t = Ht(r);
3607
+ function r(i) {
3608
+ var n;
3609
+ if (Ce(this, r), n = t.call(this, i), m(W(n), "state", {
3610
+ resetCount: 0
3611
+ }), m(W(n), "cancelRegisterFunc", null), m(W(n), "mounted", !1), m(W(n), "touched", !1), m(W(n), "dirty", !1), m(W(n), "validatePromise", void 0), m(W(n), "prevValidating", void 0), m(W(n), "errors", le), m(W(n), "warnings", le), m(W(n), "cancelRegister", function() {
3612
+ var c = n.props, u = c.preserve, l = c.isListField, f = c.name;
3613
+ n.cancelRegisterFunc && n.cancelRegisterFunc(l, u, Z(f)), n.cancelRegisterFunc = null;
3614
+ }), m(W(n), "getNamePath", function() {
3615
+ var c = n.props, u = c.name, l = c.fieldContext, f = l.prefixName, g = f === void 0 ? [] : f;
3616
+ return u !== void 0 ? [].concat(j(g), j(u)) : [];
3617
+ }), m(W(n), "getRules", function() {
3618
+ var c = n.props, u = c.rules, l = u === void 0 ? [] : u, f = c.fieldContext;
3619
+ return l.map(function(g) {
3620
+ return typeof g == "function" ? g(f) : g;
3621
+ });
3622
+ }), m(W(n), "refresh", function() {
3623
+ n.mounted && n.setState(function(c) {
3624
+ var u = c.resetCount;
3625
+ return {
3626
+ resetCount: u + 1
3627
+ };
3628
+ });
3629
+ }), m(W(n), "metaCache", null), m(W(n), "triggerMetaEvent", function(c) {
3630
+ var u = n.props.onMetaChange;
3631
+ if (u) {
3632
+ var l = T(T({}, n.getMeta()), {}, {
3633
+ destroy: c
3634
+ });
3635
+ tr(n.metaCache, l) || u(l), n.metaCache = l;
3636
+ } else
3637
+ n.metaCache = null;
3638
+ }), m(W(n), "onStoreChange", function(c, u, l) {
3639
+ var f = n.props, g = f.shouldUpdate, O = f.dependencies, v = O === void 0 ? [] : O, p = f.onReset, d = l.store, C = n.getNamePath(), h = n.getValue(c), b = n.getValue(d), S = u && Re(u, C);
3640
+ switch (l.type === "valueUpdate" && l.source === "external" && !tr(h, b) && (n.touched = !0, n.dirty = !0, n.validatePromise = null, n.errors = le, n.warnings = le, n.triggerMetaEvent()), l.type) {
3641
+ case "reset":
3642
+ if (!u || S) {
3643
+ n.touched = !1, n.dirty = !1, n.validatePromise = void 0, n.errors = le, n.warnings = le, n.triggerMetaEvent(), p == null || p(), n.refresh();
3644
+ return;
3645
+ }
3646
+ break;
3647
+ case "remove": {
3648
+ if (g && ht(g, c, d, h, b, l)) {
3649
+ n.reRender();
3650
+ return;
3651
+ }
3652
+ break;
3653
+ }
3654
+ case "setField": {
3655
+ var w = l.data;
3656
+ if (S) {
3657
+ "touched" in w && (n.touched = w.touched), "validating" in w && !("originRCField" in w) && (n.validatePromise = w.validating ? Promise.resolve([]) : null), "errors" in w && (n.errors = w.errors || le), "warnings" in w && (n.warnings = w.warnings || le), n.dirty = !0, n.triggerMetaEvent(), n.reRender();
3658
+ return;
3659
+ } else if ("value" in w && Re(u, C, !0)) {
3660
+ n.reRender();
3661
+ return;
3662
+ }
3663
+ if (g && !C.length && ht(g, c, d, h, b, l)) {
3664
+ n.reRender();
3665
+ return;
3666
+ }
3667
+ break;
3668
+ }
3669
+ case "dependenciesUpdate": {
3670
+ var V = v.map(Z);
3671
+ if (V.some(function(R) {
3672
+ return Re(l.relatedFields, R);
3673
+ })) {
3674
+ n.reRender();
3675
+ return;
3676
+ }
3677
+ break;
3678
+ }
3679
+ default:
3680
+ if (S || (!v.length || C.length || g) && ht(g, c, d, h, b, l)) {
3681
+ n.reRender();
3682
+ return;
3683
+ }
3684
+ break;
3685
+ }
3686
+ g === !0 && n.reRender();
3687
+ }), m(W(n), "validateRules", function(c) {
3688
+ var u = n.getNamePath(), l = n.getValue(), f = c || {}, g = f.triggerName, O = f.validateOnly, v = O === void 0 ? !1 : O, p = Promise.resolve().then(/* @__PURE__ */ Ee(/* @__PURE__ */ ie().mark(function d() {
3689
+ var C, h, b, S, w, V, R;
3690
+ return ie().wrap(function(P) {
3691
+ for (; ; ) switch (P.prev = P.next) {
3692
+ case 0:
3693
+ if (n.mounted) {
3694
+ P.next = 2;
3695
+ break;
3696
+ }
3697
+ return P.abrupt("return", []);
3698
+ case 2:
3699
+ if (C = n.props, h = C.validateFirst, b = h === void 0 ? !1 : h, S = C.messageVariables, w = C.validateDebounce, V = n.getRules(), g && (V = V.filter(function(I) {
3700
+ return I;
3701
+ }).filter(function(I) {
3702
+ var M = I.validateTrigger;
3703
+ if (!M)
3704
+ return !0;
3705
+ var z = bt(M);
3706
+ return z.includes(g);
3707
+ })), !(w && g)) {
3708
+ P.next = 10;
3709
+ break;
3710
+ }
3711
+ return P.next = 8, new Promise(function(I) {
3712
+ setTimeout(I, w);
3713
+ });
3714
+ case 8:
3715
+ if (n.validatePromise === p) {
3716
+ P.next = 10;
3717
+ break;
3718
+ }
3719
+ return P.abrupt("return", []);
3720
+ case 10:
3721
+ return R = Ba(u, l, V, c, b, S), R.catch(function(I) {
3722
+ return I;
3723
+ }).then(function() {
3724
+ var I = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : le;
3725
+ if (n.validatePromise === p) {
3726
+ var M;
3727
+ n.validatePromise = null;
3728
+ var z = [], B = [];
3729
+ (M = I.forEach) === null || M === void 0 || M.call(I, function(A) {
3730
+ var K = A.rule.warningOnly, F = A.errors, y = F === void 0 ? le : F;
3731
+ K ? B.push.apply(B, j(y)) : z.push.apply(z, j(y));
3732
+ }), n.errors = z, n.warnings = B, n.triggerMetaEvent(), n.reRender();
3733
+ }
3734
+ }), P.abrupt("return", R);
3735
+ case 13:
3736
+ case "end":
3737
+ return P.stop();
3738
+ }
3739
+ }, d);
3740
+ })));
3741
+ return v || (n.validatePromise = p, n.dirty = !0, n.errors = le, n.warnings = le, n.triggerMetaEvent(), n.reRender()), p;
3742
+ }), m(W(n), "isFieldValidating", function() {
3743
+ return !!n.validatePromise;
3744
+ }), m(W(n), "isFieldTouched", function() {
3745
+ return n.touched;
3746
+ }), m(W(n), "isFieldDirty", function() {
3747
+ if (n.dirty || n.props.initialValue !== void 0)
3748
+ return !0;
3749
+ var c = n.props.fieldContext, u = c.getInternalHooks(ye), l = u.getInitialValue;
3750
+ return l(n.getNamePath()) !== void 0;
3751
+ }), m(W(n), "getErrors", function() {
3752
+ return n.errors;
3753
+ }), m(W(n), "getWarnings", function() {
3754
+ return n.warnings;
3755
+ }), m(W(n), "isListField", function() {
3756
+ return n.props.isListField;
3757
+ }), m(W(n), "isList", function() {
3758
+ return n.props.isList;
3759
+ }), m(W(n), "isPreserve", function() {
3760
+ return n.props.preserve;
3761
+ }), m(W(n), "getMeta", function() {
3762
+ n.prevValidating = n.isFieldValidating();
3763
+ var c = {
3764
+ touched: n.isFieldTouched(),
3765
+ validating: n.prevValidating,
3766
+ errors: n.errors,
3767
+ warnings: n.warnings,
3768
+ name: n.getNamePath(),
3769
+ validated: n.validatePromise === null
3770
+ };
3771
+ return c;
3772
+ }), m(W(n), "getOnlyChild", function(c) {
3773
+ if (typeof c == "function") {
3774
+ var u = n.getMeta();
3775
+ return T(T({}, n.getOnlyChild(c(n.getControlled(), u, n.props.fieldContext))), {}, {
3776
+ isFunction: !0
3777
+ });
3778
+ }
3779
+ var l = Sr(c);
3780
+ return l.length !== 1 || !/* @__PURE__ */ $.isValidElement(l[0]) ? {
3781
+ child: l,
3782
+ isFunction: !1
3783
+ } : {
3784
+ child: l[0],
3785
+ isFunction: !1
3786
+ };
3787
+ }), m(W(n), "getValue", function(c) {
3788
+ var u = n.props.fieldContext.getFieldsValue, l = n.getNamePath();
3789
+ return pe(c || u(!0), l);
3790
+ }), m(W(n), "getControlled", function() {
3791
+ var c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, u = n.props, l = u.name, f = u.trigger, g = u.validateTrigger, O = u.getValueFromEvent, v = u.normalize, p = u.valuePropName, d = u.getValueProps, C = u.fieldContext, h = g !== void 0 ? g : C.validateTrigger, b = n.getNamePath(), S = C.getInternalHooks, w = C.getFieldsValue, V = S(ye), R = V.dispatch, _ = n.getValue(), P = d || function(A) {
3792
+ return m({}, p, A);
3793
+ }, I = c[f], M = l !== void 0 ? P(_) : {};
3794
+ process.env.NODE_ENV !== "production" && M && Object.keys(M).forEach(function(A) {
3795
+ re(typeof M[A] != "function", "It's not recommended to generate dynamic function prop by `getValueProps`. Please pass it to child component directly (prop: ".concat(A, ")"));
3796
+ });
3797
+ var z = T(T({}, c), M);
3798
+ z[f] = function() {
3799
+ n.touched = !0, n.dirty = !0, n.triggerMetaEvent();
3800
+ for (var A, K = arguments.length, F = new Array(K), y = 0; y < K; y++)
3801
+ F[y] = arguments[y];
3802
+ O ? A = O.apply(void 0, F) : A = Wa.apply(void 0, [p].concat(F)), v && (A = v(A, _, w(!0))), A !== _ && R({
3803
+ type: "updateValue",
3804
+ namePath: b,
3805
+ value: A
3806
+ }), I && I.apply(void 0, F);
3807
+ };
3808
+ var B = bt(h || []);
3809
+ return B.forEach(function(A) {
3810
+ var K = z[A];
3811
+ z[A] = function() {
3812
+ K && K.apply(void 0, arguments);
3813
+ var F = n.props.rules;
3814
+ F && F.length && R({
3815
+ type: "validateField",
3816
+ namePath: b,
3817
+ triggerName: A
3818
+ });
3819
+ };
3820
+ }), z;
3821
+ }), i.fieldContext) {
3822
+ var a = i.fieldContext.getInternalHooks, o = a(ye), s = o.initEntityValue;
3823
+ s(W(n));
3824
+ }
3825
+ return n;
3826
+ }
3827
+ return Fe(r, [{
3828
+ key: "componentDidMount",
3829
+ value: function() {
3830
+ var n = this.props, a = n.shouldUpdate, o = n.fieldContext;
3831
+ if (this.mounted = !0, o) {
3832
+ var s = o.getInternalHooks, c = s(ye), u = c.registerField;
3833
+ this.cancelRegisterFunc = u(this);
3834
+ }
3835
+ a === !0 && this.reRender();
3836
+ }
3837
+ }, {
3838
+ key: "componentWillUnmount",
3839
+ value: function() {
3840
+ this.cancelRegister(), this.triggerMetaEvent(!0), this.mounted = !1;
3841
+ }
3842
+ }, {
3843
+ key: "reRender",
3844
+ value: function() {
3845
+ this.mounted && this.forceUpdate();
3846
+ }
3847
+ }, {
3848
+ key: "render",
3849
+ value: function() {
3850
+ var n = this.state.resetCount, a = this.props.children, o = this.getOnlyChild(a), s = o.child, c = o.isFunction, u;
3851
+ return c ? u = s : /* @__PURE__ */ $.isValidElement(s) ? u = /* @__PURE__ */ $.cloneElement(s, this.getControlled(s.props)) : (re(!s, "`children` of Field is not validate ReactElement."), u = s), /* @__PURE__ */ $.createElement($.Fragment, {
3852
+ key: n
3853
+ }, u);
3854
+ }
3855
+ }]), r;
3856
+ }($.Component);
3857
+ m(Wt, "contextType", Ve);
3858
+ m(Wt, "defaultProps", {
3859
+ trigger: "onChange",
3860
+ valuePropName: "value"
3861
+ });
3862
+ function Zr(e) {
3863
+ var t = e.name, r = De(e, qa), i = $.useContext(Ve), n = $.useContext(Xe), a = t !== void 0 ? Z(t) : void 0, o = "keep";
3864
+ return r.isListField || (o = "_".concat((a || []).join("_"))), process.env.NODE_ENV !== "production" && r.preserve === !1 && r.isListField && a.length <= 1 && re(!1, "`preserve` should not apply on Form.List fields."), /* @__PURE__ */ $.createElement(Wt, $e({
3865
+ key: o,
3866
+ name: a,
3867
+ isListField: !!n
3868
+ }, r, {
3869
+ fieldContext: i
3870
+ }));
3871
+ }
3872
+ function Ga(e) {
3873
+ var t = e.name, r = e.initialValue, i = e.children, n = e.rules, a = e.validateTrigger, o = e.isListField, s = $.useContext(Ve), c = $.useContext(Xe), u = $.useRef({
3874
+ keys: [],
3875
+ id: 0
3876
+ }), l = u.current, f = $.useMemo(function() {
3877
+ var p = Z(s.prefixName) || [];
3878
+ return [].concat(j(p), j(Z(t)));
3879
+ }, [s.prefixName, t]), g = $.useMemo(function() {
3880
+ return T(T({}, s), {}, {
3881
+ prefixName: f
3882
+ });
3883
+ }, [s, f]), O = $.useMemo(function() {
3884
+ return {
3885
+ getKey: function(d) {
3886
+ var C = f.length, h = d[C];
3887
+ return [l.keys[h], d.slice(C + 1)];
3888
+ }
3889
+ };
3890
+ }, [f]);
3891
+ if (typeof i != "function")
3892
+ return re(!1, "Form.List only accepts function as children."), null;
3893
+ var v = function(d, C, h) {
3894
+ var b = h.source;
3895
+ return b === "internal" ? !1 : d !== C;
3896
+ };
3897
+ return /* @__PURE__ */ $.createElement(Xe.Provider, {
3898
+ value: O
3899
+ }, /* @__PURE__ */ $.createElement(Ve.Provider, {
3900
+ value: g
3901
+ }, /* @__PURE__ */ $.createElement(Zr, {
3902
+ name: [],
3903
+ shouldUpdate: v,
3904
+ rules: n,
3905
+ validateTrigger: a,
3906
+ initialValue: r,
3907
+ isList: !0,
3908
+ isListField: o ?? !!c
3909
+ }, function(p, d) {
3910
+ var C = p.value, h = C === void 0 ? [] : C, b = p.onChange, S = s.getFieldValue, w = function() {
3911
+ var P = S(f || []);
3912
+ return P || [];
3913
+ }, V = {
3914
+ add: function(P, I) {
3915
+ var M = w();
3916
+ I >= 0 && I <= M.length ? (l.keys = [].concat(j(l.keys.slice(0, I)), [l.id], j(l.keys.slice(I))), b([].concat(j(M.slice(0, I)), [P], j(M.slice(I))))) : (process.env.NODE_ENV !== "production" && (I < 0 || I > M.length) && re(!1, "The second parameter of the add function should be a valid positive number."), l.keys = [].concat(j(l.keys), [l.id]), b([].concat(j(M), [P]))), l.id += 1;
3917
+ },
3918
+ remove: function(P) {
3919
+ var I = w(), M = new Set(Array.isArray(P) ? P : [P]);
3920
+ M.size <= 0 || (l.keys = l.keys.filter(function(z, B) {
3921
+ return !M.has(B);
3922
+ }), b(I.filter(function(z, B) {
3923
+ return !M.has(B);
3924
+ })));
3925
+ },
3926
+ move: function(P, I) {
3927
+ if (P !== I) {
3928
+ var M = w();
3929
+ P < 0 || P >= M.length || I < 0 || I >= M.length || (l.keys = br(l.keys, P, I), b(br(M, P, I)));
3930
+ }
3931
+ }
3932
+ }, R = h || [];
3933
+ return Array.isArray(R) || (R = [], process.env.NODE_ENV !== "production" && re(!1, "Current value of '".concat(f.join(" > "), "' is not an array type."))), i(R.map(function(_, P) {
3934
+ var I = l.keys[P];
3935
+ return I === void 0 && (l.keys[P] = l.id, I = l.keys[P], l.id += 1), {
3936
+ name: P,
3937
+ key: I,
3938
+ isListField: !0
3939
+ };
3940
+ }), V, d);
3941
+ })));
3942
+ }
3943
+ function Ua(e) {
3944
+ var t = !1, r = e.length, i = [];
3945
+ return e.length ? new Promise(function(n, a) {
3946
+ e.forEach(function(o, s) {
3947
+ o.catch(function(c) {
3948
+ return t = !0, c;
3949
+ }).then(function(c) {
3950
+ r -= 1, i[s] = c, !(r > 0) && (t && a(i), n(i));
3951
+ });
3952
+ });
3953
+ }) : Promise.resolve([]);
3954
+ }
3955
+ var Xr = "__@field_split__";
3956
+ function mt(e) {
3957
+ return e.map(function(t) {
3958
+ return "".concat(ee(t), ":").concat(t);
3959
+ }).join(Xr);
3960
+ }
3961
+ var xe = /* @__PURE__ */ function() {
3962
+ function e() {
3963
+ Ce(this, e), m(this, "kvs", /* @__PURE__ */ new Map());
3964
+ }
3965
+ return Fe(e, [{
3966
+ key: "set",
3967
+ value: function(r, i) {
3968
+ this.kvs.set(mt(r), i);
3969
+ }
3970
+ }, {
3971
+ key: "get",
3972
+ value: function(r) {
3973
+ return this.kvs.get(mt(r));
3974
+ }
3975
+ }, {
3976
+ key: "update",
3977
+ value: function(r, i) {
3978
+ var n = this.get(r), a = i(n);
3979
+ a ? this.set(r, a) : this.delete(r);
3980
+ }
3981
+ }, {
3982
+ key: "delete",
3983
+ value: function(r) {
3984
+ this.kvs.delete(mt(r));
3985
+ }
3986
+ // Since we only use this in test, let simply realize this
3987
+ }, {
3988
+ key: "map",
3989
+ value: function(r) {
3990
+ return j(this.kvs.entries()).map(function(i) {
3991
+ var n = de(i, 2), a = n[0], o = n[1], s = a.split(Xr);
3992
+ return r({
3993
+ key: s.map(function(c) {
3994
+ var u = c.match(/^([^:]*):(.*)$/), l = de(u, 3), f = l[1], g = l[2];
3995
+ return f === "number" ? Number(g) : g;
3996
+ }),
3997
+ value: o
3998
+ });
3999
+ });
4000
+ }
4001
+ }, {
4002
+ key: "toJSON",
4003
+ value: function() {
4004
+ var r = {};
4005
+ return this.map(function(i) {
4006
+ var n = i.key, a = i.value;
4007
+ return r[n.join(".")] = a, null;
4008
+ }), r;
4009
+ }
4010
+ }]), e;
4011
+ }(), Ka = ["name"], Ya = /* @__PURE__ */ Fe(function e(t) {
4012
+ var r = this;
4013
+ Ce(this, e), m(this, "formHooked", !1), m(this, "forceRootUpdate", void 0), m(this, "subscribable", !0), m(this, "store", {}), m(this, "fieldEntities", []), m(this, "initialValues", {}), m(this, "callbacks", {}), m(this, "validateMessages", null), m(this, "preserve", null), m(this, "lastValidatePromise", null), m(this, "getForm", function() {
4014
+ return {
4015
+ getFieldValue: r.getFieldValue,
4016
+ getFieldsValue: r.getFieldsValue,
4017
+ getFieldError: r.getFieldError,
4018
+ getFieldWarning: r.getFieldWarning,
4019
+ getFieldsError: r.getFieldsError,
4020
+ isFieldsTouched: r.isFieldsTouched,
4021
+ isFieldTouched: r.isFieldTouched,
4022
+ isFieldValidating: r.isFieldValidating,
4023
+ isFieldsValidating: r.isFieldsValidating,
4024
+ resetFields: r.resetFields,
4025
+ setFields: r.setFields,
4026
+ setFieldValue: r.setFieldValue,
4027
+ setFieldsValue: r.setFieldsValue,
4028
+ validateFields: r.validateFields,
4029
+ submit: r.submit,
4030
+ _init: !0,
4031
+ getInternalHooks: r.getInternalHooks
4032
+ };
4033
+ }), m(this, "getInternalHooks", function(i) {
4034
+ return i === ye ? (r.formHooked = !0, {
4035
+ dispatch: r.dispatch,
4036
+ initEntityValue: r.initEntityValue,
4037
+ registerField: r.registerField,
4038
+ useSubscribe: r.useSubscribe,
4039
+ setInitialValues: r.setInitialValues,
4040
+ destroyForm: r.destroyForm,
4041
+ setCallbacks: r.setCallbacks,
4042
+ setValidateMessages: r.setValidateMessages,
4043
+ getFields: r.getFields,
4044
+ setPreserve: r.setPreserve,
4045
+ getInitialValue: r.getInitialValue,
4046
+ registerWatch: r.registerWatch
4047
+ }) : (re(!1, "`getInternalHooks` is internal usage. Should not call directly."), null);
4048
+ }), m(this, "useSubscribe", function(i) {
4049
+ r.subscribable = i;
4050
+ }), m(this, "prevWithoutPreserves", null), m(this, "setInitialValues", function(i, n) {
4051
+ if (r.initialValues = i || {}, n) {
4052
+ var a, o = He(i, r.store);
4053
+ (a = r.prevWithoutPreserves) === null || a === void 0 || a.map(function(s) {
4054
+ var c = s.key;
4055
+ o = ve(o, c, pe(i, c));
4056
+ }), r.prevWithoutPreserves = null, r.updateStore(o);
4057
+ }
4058
+ }), m(this, "destroyForm", function(i) {
4059
+ if (i)
4060
+ r.updateStore({});
4061
+ else {
4062
+ var n = new xe();
4063
+ r.getFieldEntities(!0).forEach(function(a) {
4064
+ r.isMergedPreserve(a.isPreserve()) || n.set(a.getNamePath(), !0);
4065
+ }), r.prevWithoutPreserves = n;
4066
+ }
4067
+ }), m(this, "getInitialValue", function(i) {
4068
+ var n = pe(r.initialValues, i);
4069
+ return i.length ? He(n) : n;
4070
+ }), m(this, "setCallbacks", function(i) {
4071
+ r.callbacks = i;
4072
+ }), m(this, "setValidateMessages", function(i) {
4073
+ r.validateMessages = i;
4074
+ }), m(this, "setPreserve", function(i) {
4075
+ r.preserve = i;
4076
+ }), m(this, "watchList", []), m(this, "registerWatch", function(i) {
4077
+ return r.watchList.push(i), function() {
4078
+ r.watchList = r.watchList.filter(function(n) {
4079
+ return n !== i;
4080
+ });
4081
+ };
4082
+ }), m(this, "notifyWatch", function() {
4083
+ var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
4084
+ if (r.watchList.length) {
4085
+ var n = r.getFieldsValue(), a = r.getFieldsValue(!0);
4086
+ r.watchList.forEach(function(o) {
4087
+ o(n, a, i);
4088
+ });
4089
+ }
4090
+ }), m(this, "timeoutId", null), m(this, "warningUnhooked", function() {
4091
+ process.env.NODE_ENV !== "production" && !r.timeoutId && typeof window < "u" && (r.timeoutId = setTimeout(function() {
4092
+ r.timeoutId = null, r.formHooked || re(!1, "Instance created by `useForm` is not connected to any Form element. Forget to pass `form` prop?");
4093
+ }));
4094
+ }), m(this, "updateStore", function(i) {
4095
+ r.store = i;
4096
+ }), m(this, "getFieldEntities", function() {
4097
+ var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
4098
+ return i ? r.fieldEntities.filter(function(n) {
4099
+ return n.getNamePath().length;
4100
+ }) : r.fieldEntities;
4101
+ }), m(this, "getFieldsMap", function() {
4102
+ var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, n = new xe();
4103
+ return r.getFieldEntities(i).forEach(function(a) {
4104
+ var o = a.getNamePath();
4105
+ n.set(o, a);
4106
+ }), n;
4107
+ }), m(this, "getFieldEntitiesForNamePathList", function(i) {
4108
+ if (!i)
4109
+ return r.getFieldEntities(!0);
4110
+ var n = r.getFieldsMap(!0);
4111
+ return i.map(function(a) {
4112
+ var o = Z(a);
4113
+ return n.get(o) || {
4114
+ INVALIDATE_NAME_PATH: Z(a)
4115
+ };
4116
+ });
4117
+ }), m(this, "getFieldsValue", function(i, n) {
4118
+ r.warningUnhooked();
4119
+ var a, o, s;
4120
+ if (i === !0 || Array.isArray(i) ? (a = i, o = n) : i && ee(i) === "object" && (s = i.strict, o = i.filter), a === !0 && !o)
4121
+ return r.store;
4122
+ var c = r.getFieldEntitiesForNamePathList(Array.isArray(a) ? a : null), u = [];
4123
+ return c.forEach(function(l) {
4124
+ var f, g, O = "INVALIDATE_NAME_PATH" in l ? l.INVALIDATE_NAME_PATH : l.getNamePath();
4125
+ if (s) {
4126
+ var v, p;
4127
+ if ((v = (p = l).isList) !== null && v !== void 0 && v.call(p))
4128
+ return;
4129
+ } else if (!a && (f = (g = l).isListField) !== null && f !== void 0 && f.call(g))
4130
+ return;
4131
+ if (!o)
4132
+ u.push(O);
4133
+ else {
4134
+ var d = "getMeta" in l ? l.getMeta() : null;
4135
+ o(d) && u.push(O);
4136
+ }
4137
+ }), yr(r.store, u.map(Z));
4138
+ }), m(this, "getFieldValue", function(i) {
4139
+ r.warningUnhooked();
4140
+ var n = Z(i);
4141
+ return pe(r.store, n);
4142
+ }), m(this, "getFieldsError", function(i) {
4143
+ r.warningUnhooked();
4144
+ var n = r.getFieldEntitiesForNamePathList(i);
4145
+ return n.map(function(a, o) {
4146
+ return a && !("INVALIDATE_NAME_PATH" in a) ? {
4147
+ name: a.getNamePath(),
4148
+ errors: a.getErrors(),
4149
+ warnings: a.getWarnings()
4150
+ } : {
4151
+ name: Z(i[o]),
4152
+ errors: [],
4153
+ warnings: []
4154
+ };
4155
+ });
4156
+ }), m(this, "getFieldError", function(i) {
4157
+ r.warningUnhooked();
4158
+ var n = Z(i), a = r.getFieldsError([n])[0];
4159
+ return a.errors;
4160
+ }), m(this, "getFieldWarning", function(i) {
4161
+ r.warningUnhooked();
4162
+ var n = Z(i), a = r.getFieldsError([n])[0];
4163
+ return a.warnings;
4164
+ }), m(this, "isFieldsTouched", function() {
4165
+ r.warningUnhooked();
4166
+ for (var i = arguments.length, n = new Array(i), a = 0; a < i; a++)
4167
+ n[a] = arguments[a];
4168
+ var o = n[0], s = n[1], c, u = !1;
4169
+ n.length === 0 ? c = null : n.length === 1 ? Array.isArray(o) ? (c = o.map(Z), u = !1) : (c = null, u = o) : (c = o.map(Z), u = s);
4170
+ var l = r.getFieldEntities(!0), f = function(d) {
4171
+ return d.isFieldTouched();
4172
+ };
4173
+ if (!c)
4174
+ return u ? l.every(function(p) {
4175
+ return f(p) || p.isList();
4176
+ }) : l.some(f);
4177
+ var g = new xe();
4178
+ c.forEach(function(p) {
4179
+ g.set(p, []);
4180
+ }), l.forEach(function(p) {
4181
+ var d = p.getNamePath();
4182
+ c.forEach(function(C) {
4183
+ C.every(function(h, b) {
4184
+ return d[b] === h;
4185
+ }) && g.update(C, function(h) {
4186
+ return [].concat(j(h), [p]);
4187
+ });
4188
+ });
4189
+ });
4190
+ var O = function(d) {
4191
+ return d.some(f);
4192
+ }, v = g.map(function(p) {
4193
+ var d = p.value;
4194
+ return d;
4195
+ });
4196
+ return u ? v.every(O) : v.some(O);
4197
+ }), m(this, "isFieldTouched", function(i) {
4198
+ return r.warningUnhooked(), r.isFieldsTouched([i]);
4199
+ }), m(this, "isFieldsValidating", function(i) {
4200
+ r.warningUnhooked();
4201
+ var n = r.getFieldEntities();
4202
+ if (!i)
4203
+ return n.some(function(o) {
4204
+ return o.isFieldValidating();
4205
+ });
4206
+ var a = i.map(Z);
4207
+ return n.some(function(o) {
4208
+ var s = o.getNamePath();
4209
+ return Re(a, s) && o.isFieldValidating();
4210
+ });
4211
+ }), m(this, "isFieldValidating", function(i) {
4212
+ return r.warningUnhooked(), r.isFieldsValidating([i]);
4213
+ }), m(this, "resetWithFieldInitialValue", function() {
4214
+ var i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = new xe(), a = r.getFieldEntities(!0);
4215
+ a.forEach(function(c) {
4216
+ var u = c.props.initialValue, l = c.getNamePath();
4217
+ if (u !== void 0) {
4218
+ var f = n.get(l) || /* @__PURE__ */ new Set();
4219
+ f.add({
4220
+ entity: c,
4221
+ value: u
4222
+ }), n.set(l, f);
4223
+ }
4224
+ });
4225
+ var o = function(u) {
4226
+ u.forEach(function(l) {
4227
+ var f = l.props.initialValue;
4228
+ if (f !== void 0) {
4229
+ var g = l.getNamePath(), O = r.getInitialValue(g);
4230
+ if (O !== void 0)
4231
+ re(!1, "Form already set 'initialValues' with path '".concat(g.join("."), "'. Field can not overwrite it."));
4232
+ else {
4233
+ var v = n.get(g);
4234
+ if (v && v.size > 1)
4235
+ re(!1, "Multiple Field with path '".concat(g.join("."), "' set 'initialValue'. Can not decide which one to pick."));
4236
+ else if (v) {
4237
+ var p = r.getFieldValue(g), d = l.isListField();
4238
+ !d && (!i.skipExist || p === void 0) && r.updateStore(ve(r.store, g, j(v)[0].value));
4239
+ }
4240
+ }
4241
+ }
4242
+ });
4243
+ }, s;
4244
+ i.entities ? s = i.entities : i.namePathList ? (s = [], i.namePathList.forEach(function(c) {
4245
+ var u = n.get(c);
4246
+ if (u) {
4247
+ var l;
4248
+ (l = s).push.apply(l, j(j(u).map(function(f) {
4249
+ return f.entity;
4250
+ })));
4251
+ }
4252
+ })) : s = a, o(s);
4253
+ }), m(this, "resetFields", function(i) {
4254
+ r.warningUnhooked();
4255
+ var n = r.store;
4256
+ if (!i) {
4257
+ r.updateStore(He(r.initialValues)), r.resetWithFieldInitialValue(), r.notifyObservers(n, null, {
4258
+ type: "reset"
4259
+ }), r.notifyWatch();
4260
+ return;
4261
+ }
4262
+ var a = i.map(Z);
4263
+ a.forEach(function(o) {
4264
+ var s = r.getInitialValue(o);
4265
+ r.updateStore(ve(r.store, o, s));
4266
+ }), r.resetWithFieldInitialValue({
4267
+ namePathList: a
4268
+ }), r.notifyObservers(n, a, {
4269
+ type: "reset"
4270
+ }), r.notifyWatch(a);
4271
+ }), m(this, "setFields", function(i) {
4272
+ r.warningUnhooked();
4273
+ var n = r.store, a = [];
4274
+ i.forEach(function(o) {
4275
+ var s = o.name, c = De(o, Ka), u = Z(s);
4276
+ a.push(u), "value" in c && r.updateStore(ve(r.store, u, c.value)), r.notifyObservers(n, [u], {
4277
+ type: "setField",
4278
+ data: o
4279
+ });
4280
+ }), r.notifyWatch(a);
4281
+ }), m(this, "getFields", function() {
4282
+ var i = r.getFieldEntities(!0), n = i.map(function(a) {
4283
+ var o = a.getNamePath(), s = a.getMeta(), c = T(T({}, s), {}, {
4284
+ name: o,
4285
+ value: r.getFieldValue(o)
4286
+ });
4287
+ return Object.defineProperty(c, "originRCField", {
4288
+ value: !0
4289
+ }), c;
4290
+ });
4291
+ return n;
4292
+ }), m(this, "initEntityValue", function(i) {
4293
+ var n = i.props.initialValue;
4294
+ if (n !== void 0) {
4295
+ var a = i.getNamePath(), o = pe(r.store, a);
4296
+ o === void 0 && r.updateStore(ve(r.store, a, n));
4297
+ }
4298
+ }), m(this, "isMergedPreserve", function(i) {
4299
+ var n = i !== void 0 ? i : r.preserve;
4300
+ return n ?? !0;
4301
+ }), m(this, "registerField", function(i) {
4302
+ r.fieldEntities.push(i);
4303
+ var n = i.getNamePath();
4304
+ if (r.notifyWatch([n]), i.props.initialValue !== void 0) {
4305
+ var a = r.store;
4306
+ r.resetWithFieldInitialValue({
4307
+ entities: [i],
4308
+ skipExist: !0
4309
+ }), r.notifyObservers(a, [i.getNamePath()], {
4310
+ type: "valueUpdate",
4311
+ source: "internal"
4312
+ });
4313
+ }
4314
+ return function(o, s) {
4315
+ var c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4316
+ if (r.fieldEntities = r.fieldEntities.filter(function(f) {
4317
+ return f !== i;
4318
+ }), !r.isMergedPreserve(s) && (!o || c.length > 1)) {
4319
+ var u = o ? void 0 : r.getInitialValue(n);
4320
+ if (n.length && r.getFieldValue(n) !== u && r.fieldEntities.every(function(f) {
4321
+ return (
4322
+ // Only reset when no namePath exist
4323
+ !Yr(f.getNamePath(), n)
4324
+ );
4325
+ })) {
4326
+ var l = r.store;
4327
+ r.updateStore(ve(l, n, u, !0)), r.notifyObservers(l, [n], {
4328
+ type: "remove"
4329
+ }), r.triggerDependenciesUpdate(l, n);
4330
+ }
4331
+ }
4332
+ r.notifyWatch([n]);
4333
+ };
4334
+ }), m(this, "dispatch", function(i) {
4335
+ switch (i.type) {
4336
+ case "updateValue": {
4337
+ var n = i.namePath, a = i.value;
4338
+ r.updateValue(n, a);
4339
+ break;
4340
+ }
4341
+ case "validateField": {
4342
+ var o = i.namePath, s = i.triggerName;
4343
+ r.validateFields([o], {
4344
+ triggerName: s
4345
+ });
4346
+ break;
4347
+ }
4348
+ }
4349
+ }), m(this, "notifyObservers", function(i, n, a) {
4350
+ if (r.subscribable) {
4351
+ var o = T(T({}, a), {}, {
4352
+ store: r.getFieldsValue(!0)
4353
+ });
4354
+ r.getFieldEntities().forEach(function(s) {
4355
+ var c = s.onStoreChange;
4356
+ c(i, n, o);
4357
+ });
4358
+ } else
4359
+ r.forceRootUpdate();
4360
+ }), m(this, "triggerDependenciesUpdate", function(i, n) {
4361
+ var a = r.getDependencyChildrenFields(n);
4362
+ return a.length && r.validateFields(a), r.notifyObservers(i, a, {
4363
+ type: "dependenciesUpdate",
4364
+ relatedFields: [n].concat(j(a))
4365
+ }), a;
4366
+ }), m(this, "updateValue", function(i, n) {
4367
+ var a = Z(i), o = r.store;
4368
+ r.updateStore(ve(r.store, a, n)), r.notifyObservers(o, [a], {
4369
+ type: "valueUpdate",
4370
+ source: "internal"
4371
+ }), r.notifyWatch([a]);
4372
+ var s = r.triggerDependenciesUpdate(o, a), c = r.callbacks.onValuesChange;
4373
+ if (c) {
4374
+ var u = yr(r.store, [a]);
4375
+ c(u, r.getFieldsValue());
4376
+ }
4377
+ r.triggerOnFieldsChange([a].concat(j(s)));
4378
+ }), m(this, "setFieldsValue", function(i) {
4379
+ r.warningUnhooked();
4380
+ var n = r.store;
4381
+ if (i) {
4382
+ var a = He(r.store, i);
4383
+ r.updateStore(a);
4384
+ }
4385
+ r.notifyObservers(n, null, {
4386
+ type: "valueUpdate",
4387
+ source: "external"
4388
+ }), r.notifyWatch();
4389
+ }), m(this, "setFieldValue", function(i, n) {
4390
+ r.setFields([{
4391
+ name: i,
4392
+ value: n
4393
+ }]);
4394
+ }), m(this, "getDependencyChildrenFields", function(i) {
4395
+ var n = /* @__PURE__ */ new Set(), a = [], o = new xe();
4396
+ r.getFieldEntities().forEach(function(c) {
4397
+ var u = c.props.dependencies;
4398
+ (u || []).forEach(function(l) {
4399
+ var f = Z(l);
4400
+ o.update(f, function() {
4401
+ var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Set();
4402
+ return g.add(c), g;
4403
+ });
4404
+ });
4405
+ });
4406
+ var s = function c(u) {
4407
+ var l = o.get(u) || /* @__PURE__ */ new Set();
4408
+ l.forEach(function(f) {
4409
+ if (!n.has(f)) {
4410
+ n.add(f);
4411
+ var g = f.getNamePath();
4412
+ f.isFieldDirty() && g.length && (a.push(g), c(g));
4413
+ }
4414
+ });
4415
+ };
4416
+ return s(i), a;
4417
+ }), m(this, "triggerOnFieldsChange", function(i, n) {
4418
+ var a = r.callbacks.onFieldsChange;
4419
+ if (a) {
4420
+ var o = r.getFields();
4421
+ if (n) {
4422
+ var s = new xe();
4423
+ n.forEach(function(u) {
4424
+ var l = u.name, f = u.errors;
4425
+ s.set(l, f);
4426
+ }), o.forEach(function(u) {
4427
+ u.errors = s.get(u.name) || u.errors;
4428
+ });
4429
+ }
4430
+ var c = o.filter(function(u) {
4431
+ var l = u.name;
4432
+ return Re(i, l);
4433
+ });
4434
+ c.length && a(c, o);
4435
+ }
4436
+ }), m(this, "validateFields", function(i, n) {
4437
+ r.warningUnhooked();
4438
+ var a, o;
4439
+ Array.isArray(i) || typeof i == "string" || typeof n == "string" ? (a = i, o = n) : o = i;
4440
+ var s = !!a, c = s ? a.map(Z) : [], u = [], l = String(Date.now()), f = /* @__PURE__ */ new Set(), g = o || {}, O = g.recursive, v = g.dirty;
4441
+ r.getFieldEntities(!0).forEach(function(h) {
4442
+ if (s || c.push(h.getNamePath()), !(!h.props.rules || !h.props.rules.length) && !(v && !h.isFieldDirty())) {
4443
+ var b = h.getNamePath();
4444
+ if (f.add(b.join(l)), !s || Re(c, b, O)) {
4445
+ var S = h.validateRules(T({
4446
+ validateMessages: T(T({}, Kr), r.validateMessages)
4447
+ }, o));
4448
+ u.push(S.then(function() {
4449
+ return {
4450
+ name: b,
4451
+ errors: [],
4452
+ warnings: []
4453
+ };
4454
+ }).catch(function(w) {
4455
+ var V, R = [], _ = [];
4456
+ return (V = w.forEach) === null || V === void 0 || V.call(w, function(P) {
4457
+ var I = P.rule.warningOnly, M = P.errors;
4458
+ I ? _.push.apply(_, j(M)) : R.push.apply(R, j(M));
4459
+ }), R.length ? Promise.reject({
4460
+ name: b,
4461
+ errors: R,
4462
+ warnings: _
4463
+ }) : {
4464
+ name: b,
4465
+ errors: R,
4466
+ warnings: _
4467
+ };
4468
+ }));
4469
+ }
4470
+ }
4471
+ });
4472
+ var p = Ua(u);
4473
+ r.lastValidatePromise = p, p.catch(function(h) {
4474
+ return h;
4475
+ }).then(function(h) {
4476
+ var b = h.map(function(S) {
4477
+ var w = S.name;
4478
+ return w;
4479
+ });
4480
+ r.notifyObservers(r.store, b, {
4481
+ type: "validateFinish"
4482
+ }), r.triggerOnFieldsChange(b, h);
4483
+ });
4484
+ var d = p.then(function() {
4485
+ return r.lastValidatePromise === p ? Promise.resolve(r.getFieldsValue(c)) : Promise.reject([]);
4486
+ }).catch(function(h) {
4487
+ var b = h.filter(function(S) {
4488
+ return S && S.errors.length;
4489
+ });
4490
+ return Promise.reject({
4491
+ values: r.getFieldsValue(c),
4492
+ errorFields: b,
4493
+ outOfDate: r.lastValidatePromise !== p
4494
+ });
4495
+ });
4496
+ d.catch(function(h) {
4497
+ return h;
4498
+ });
4499
+ var C = c.filter(function(h) {
4500
+ return f.has(h.join(l));
4501
+ });
4502
+ return r.triggerOnFieldsChange(C), d;
4503
+ }), m(this, "submit", function() {
4504
+ r.warningUnhooked(), r.validateFields().then(function(i) {
4505
+ var n = r.callbacks.onFinish;
4506
+ if (n)
4507
+ try {
4508
+ n(i);
4509
+ } catch (a) {
4510
+ console.error(a);
4511
+ }
4512
+ }).catch(function(i) {
4513
+ var n = r.callbacks.onFinishFailed;
4514
+ n && n(i);
4515
+ });
4516
+ }), this.forceRootUpdate = t;
4517
+ });
4518
+ function kr(e) {
4519
+ var t = $.useRef(), r = $.useState({}), i = de(r, 2), n = i[1];
4520
+ if (!t.current)
4521
+ if (e)
4522
+ t.current = e;
4523
+ else {
4524
+ var a = function() {
4525
+ n({});
4526
+ }, o = new Ya(a);
4527
+ t.current = o.getForm();
4528
+ }
4529
+ return [t.current];
4530
+ }
4531
+ var Pt = /* @__PURE__ */ $.createContext({
4532
+ triggerFormChange: function() {
4533
+ },
4534
+ triggerFormFinish: function() {
4535
+ },
4536
+ registerForm: function() {
4537
+ },
4538
+ unregisterForm: function() {
4539
+ }
4540
+ }), Za = function(t) {
4541
+ var r = t.validateMessages, i = t.onFormChange, n = t.onFormFinish, a = t.children, o = $.useContext(Pt), s = $.useRef({});
4542
+ return /* @__PURE__ */ $.createElement(Pt.Provider, {
4543
+ value: T(T({}, o), {}, {
4544
+ validateMessages: T(T({}, o.validateMessages), r),
4545
+ // =========================================================
4546
+ // = Global Form Control =
4547
+ // =========================================================
4548
+ triggerFormChange: function(u, l) {
4549
+ i && i(u, {
4550
+ changedFields: l,
4551
+ forms: s.current
4552
+ }), o.triggerFormChange(u, l);
4553
+ },
4554
+ triggerFormFinish: function(u, l) {
4555
+ n && n(u, {
4556
+ values: l,
4557
+ forms: s.current
4558
+ }), o.triggerFormFinish(u, l);
4559
+ },
4560
+ registerForm: function(u, l) {
4561
+ u && (s.current = T(T({}, s.current), {}, m({}, u, l))), o.registerForm(u, l);
4562
+ },
4563
+ unregisterForm: function(u) {
4564
+ var l = T({}, s.current);
4565
+ delete l[u], s.current = l, o.unregisterForm(u);
4566
+ }
4567
+ })
4568
+ }, a);
4569
+ }, Xa = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed", "clearOnDestroy"], ka = function(t, r) {
4570
+ var i = t.name, n = t.initialValues, a = t.fields, o = t.form, s = t.preserve, c = t.children, u = t.component, l = u === void 0 ? "form" : u, f = t.validateMessages, g = t.validateTrigger, O = g === void 0 ? "onChange" : g, v = t.onValuesChange, p = t.onFieldsChange, d = t.onFinish, C = t.onFinishFailed, h = t.clearOnDestroy, b = De(t, Xa), S = $.useRef(null), w = $.useContext(Pt), V = kr(o), R = de(V, 1), _ = R[0], P = _.getInternalHooks(ye), I = P.useSubscribe, M = P.setInitialValues, z = P.setCallbacks, B = P.setValidateMessages, A = P.setPreserve, K = P.destroyForm;
4571
+ $.useImperativeHandle(r, function() {
4572
+ return T(T({}, _), {}, {
4573
+ nativeElement: S.current
4574
+ });
4575
+ }), $.useEffect(function() {
4576
+ return w.registerForm(i, _), function() {
4577
+ w.unregisterForm(i);
4578
+ };
4579
+ }, [w, _, i]), B(T(T({}, w.validateMessages), f)), z({
4580
+ onValuesChange: v,
4581
+ onFieldsChange: function(q) {
4582
+ if (w.triggerFormChange(i, q), p) {
4583
+ for (var te = arguments.length, k = new Array(te > 1 ? te - 1 : 0), ae = 1; ae < te; ae++)
4584
+ k[ae - 1] = arguments[ae];
4585
+ p.apply(void 0, [q].concat(k));
4586
+ }
4587
+ },
4588
+ onFinish: function(q) {
4589
+ w.triggerFormFinish(i, q), d && d(q);
4590
+ },
4591
+ onFinishFailed: C
4592
+ }), A(s);
4593
+ var F = $.useRef(null);
4594
+ M(n, !F.current), F.current || (F.current = !0), $.useEffect(
4595
+ function() {
4596
+ return function() {
4597
+ return K(h);
4598
+ };
4599
+ },
4600
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4601
+ []
4602
+ );
4603
+ var y, E = typeof c == "function";
4604
+ if (E) {
4605
+ var x = _.getFieldsValue(!0);
4606
+ y = c(x, _);
4607
+ } else
4608
+ y = c;
4609
+ I(!E);
4610
+ var H = $.useRef();
4611
+ $.useEffect(function() {
4612
+ za(H.current || [], a || []) || _.setFields(a || []), H.current = a;
4613
+ }, [a, _]);
4614
+ var N = $.useMemo(function() {
4615
+ return T(T({}, _), {}, {
4616
+ validateTrigger: O
4617
+ });
4618
+ }, [_, O]), U = /* @__PURE__ */ $.createElement(Xe.Provider, {
4619
+ value: null
4620
+ }, /* @__PURE__ */ $.createElement(Ve.Provider, {
4621
+ value: N
4622
+ }, y));
4623
+ return l === !1 ? U : /* @__PURE__ */ $.createElement(l, $e({}, b, {
4624
+ ref: S,
4625
+ onSubmit: function(q) {
4626
+ q.preventDefault(), q.stopPropagation(), _.submit();
4627
+ },
4628
+ onReset: function(q) {
4629
+ var te;
4630
+ q.preventDefault(), _.resetFields(), (te = b.onReset) === null || te === void 0 || te.call(b, q);
4631
+ }
4632
+ }), U);
4633
+ };
4634
+ function Cr(e) {
4635
+ try {
4636
+ return JSON.stringify(e);
4637
+ } catch {
4638
+ return Math.random();
4639
+ }
4640
+ }
4641
+ var Ja = process.env.NODE_ENV !== "production" ? function(e) {
4642
+ var t = e.join("__RC_FIELD_FORM_SPLIT__"), r = ce(t);
4643
+ re(r.current === t, "`useWatch` is not support dynamic `namePath`. Please provide static instead.");
4644
+ } : function() {
4645
+ };
4646
+ function Qa() {
4647
+ for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
4648
+ t[r] = arguments[r];
4649
+ var i = t[0], n = t[1], a = n === void 0 ? {} : n, o = sa(a) ? {
4650
+ form: a
4651
+ } : a, s = o.form, c = Ke(), u = de(c, 2), l = u[0], f = u[1], g = be(function() {
4652
+ return Cr(l);
4653
+ }, [l]), O = ce(g);
4654
+ O.current = g;
4655
+ var v = Oe(Ve), p = s || v, d = p && p._init;
4656
+ process.env.NODE_ENV !== "production" && re(t.length === 2 ? s ? d : !0 : d, "useWatch requires a form instance since it can not auto detect from context.");
4657
+ var C = Z(i), h = ce(C);
4658
+ return h.current = C, Ja(C), Me(
4659
+ function() {
4660
+ if (d) {
4661
+ var b = p.getFieldsValue, S = p.getInternalHooks, w = S(ye), V = w.registerWatch, R = function(M, z) {
4662
+ var B = o.preserve ? z : M;
4663
+ return typeof i == "function" ? i(B) : pe(B, h.current);
4664
+ }, _ = V(function(I, M) {
4665
+ var z = R(I, M), B = Cr(z);
4666
+ O.current !== B && (O.current = B, f(z));
4667
+ }), P = R(b(), b(!0));
4668
+ return l !== P && f(P), _;
4669
+ }
4670
+ },
4671
+ // We do not need re-register since namePath content is the same
4672
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4673
+ [d]
4674
+ ), l;
4675
+ }
4676
+ var eo = /* @__PURE__ */ $.forwardRef(ka), qe = eo;
4677
+ qe.FormProvider = Za;
4678
+ qe.Field = Zr;
4679
+ qe.List = Ga;
4680
+ qe.useForm = kr;
4681
+ qe.useWatch = Qa;
4682
+ const Rt = /* @__PURE__ */ $.createContext({});
4683
+ process.env.NODE_ENV !== "production" && (Rt.displayName = "FormItemInputContext");
4684
+ const to = (e) => {
4685
+ let {
4686
+ children: t,
4687
+ status: r,
4688
+ override: i
4689
+ } = e;
4690
+ const n = Oe(Rt), a = be(() => {
4691
+ const o = Object.assign({}, n);
4692
+ return i && delete o.isFormItemInput, r && (delete o.status, delete o.hasFeedback, delete o.feedbackIcon), o;
4693
+ }, [r, i, n]);
4694
+ return /* @__PURE__ */ $.createElement(Rt.Provider, {
4695
+ value: a
4696
+ }, t);
4697
+ }, go = (e) => {
4698
+ const {
4699
+ space: t,
4700
+ form: r,
4701
+ children: i
4702
+ } = e;
4703
+ if (i == null)
4704
+ return null;
4705
+ let n = i;
4706
+ return r && (n = /* @__PURE__ */ L.createElement(to, {
4707
+ override: !0,
4708
+ status: !0
4709
+ }, n)), t && (n = /* @__PURE__ */ L.createElement(Xn, null, n)), n;
4710
+ };
4711
+ function ro(e) {
4712
+ return (t) => /* @__PURE__ */ $.createElement(bn, {
4713
+ theme: {
4714
+ token: {
4715
+ motion: !1,
4716
+ zIndexPopupBase: 0
4717
+ }
4718
+ }
4719
+ }, /* @__PURE__ */ $.createElement(e, Object.assign({}, t)));
4720
+ }
4721
+ const ho = (e, t, r, i) => ro((a) => {
4722
+ const {
4723
+ prefixCls: o,
4724
+ style: s
4725
+ } = a, c = $.useRef(null), [u, l] = $.useState(0), [f, g] = $.useState(0), [O, v] = xr(!1, {
4726
+ value: a.open
4727
+ }), {
4728
+ getPrefixCls: p
4729
+ } = $.useContext(_e), d = p(t, o);
4730
+ $.useEffect(() => {
4731
+ if (v(!0), typeof ResizeObserver < "u") {
4732
+ const b = new ResizeObserver((w) => {
4733
+ const V = w[0].target;
4734
+ l(V.offsetHeight + 8), g(V.offsetWidth);
4735
+ }), S = setInterval(() => {
4736
+ var w;
4737
+ const V = r ? `.${r(d)}` : `.${d}-dropdown`, R = (w = c.current) === null || w === void 0 ? void 0 : w.querySelector(V);
4738
+ R && (clearInterval(S), b.observe(R));
4739
+ }, 10);
4740
+ return () => {
4741
+ clearInterval(S), b.disconnect();
4742
+ };
4743
+ }
4744
+ }, []);
4745
+ let C = Object.assign(Object.assign({}, a), {
4746
+ style: Object.assign(Object.assign({}, s), {
4747
+ margin: 0
4748
+ }),
4749
+ open: O,
4750
+ visible: O,
4751
+ getPopupContainer: () => c.current
4752
+ });
4753
+ i && (C = i(C));
4754
+ const h = {
4755
+ paddingBottom: u,
4756
+ position: "relative",
4757
+ minWidth: f
4758
+ };
4759
+ return /* @__PURE__ */ $.createElement("div", {
4760
+ ref: c,
4761
+ style: h
4762
+ }, /* @__PURE__ */ $.createElement(e, Object.assign({}, C)));
4763
+ });
4764
+ export {
4765
+ zt as B,
4766
+ go as C,
4767
+ xn as a,
4768
+ Mn as b,
4769
+ uo as c,
4770
+ Cn as d,
4771
+ $r as e,
4772
+ Yn as f,
4773
+ ho as g,
4774
+ co as h,
4775
+ fo as i,
4776
+ Zn as j,
4777
+ Hn as r,
4778
+ lo as u,
4779
+ ro as w,
4780
+ Rr as z
4781
+ };