import { a9 as he, z as fe, aa as _e, ab as Dn, ac as Wn, ad as Yt, y as rt, ae as Bn, af as Zt, ag as Qt, ah as Jt, x as je, ai as Hn, aj as kt, ak as zn, al as Gn, am as bt, an as it, ao as at, ap as Ie, aq as ot, ar as Un, as as en, at as Kn, au as tn, av as Xn, aw as Yn, ax as Zn, ay as Qn, az as wt, aA as Jn, _ as M, w as Ue, i as kn, a6 as er, m as xe, H as tr, aB as nr, a7 as rr, a as Y, g as ir, I as ar, a5 as or, aC as nn, J as rn, Y as lr, Z as sr, U as ur, $ as an, j as on, aD as lt, Q as fr, aE as cr, N as dr, n as mr, P as ge, aF as ln, b as gr, aG as hr, aH as vr, aI as pr, e as Se, D as pe, A as xt, F as $t, E as yr, C as ce, aJ as We } from "./index2.js"; import { cloneVNode as br, provide as sn, inject as un, computed as C, createVNode as R, Fragment as qe, defineComponent as Le, ref as st, watch as ue, Transition as wr, withDirectives as xr, TransitionGroup as $r, vShow as Fr, shallowRef as re, watchEffect as Ke, onBeforeUnmount as Or, reactive as fn, onMounted as Ar, toRaw as Xe, nextTick as cn, unref as oe } from "vue"; import { g as dn, i as Sr } from "./isPlainObject.js"; import { C as mn, A as Er } from "./Col.js"; import { i as ut, t as Cr, d as Pr } from "./debounce.js"; import { a as Tr, F as Ir, u as qr, b as Ye } from "./FormItemContext.js"; function Ft(e) { return typeof e == "object" && e != null && e.nodeType === 1; } function Ot(e, t) { return (!t || e !== "hidden") && e !== "visible" && e !== "clip"; } function Be(e, t) { if (e.clientHeight < e.scrollHeight || e.clientWidth < e.scrollWidth) { var n = getComputedStyle(e, null); return Ot(n.overflowY, t) || Ot(n.overflowX, t) || function(r) { var i = function(a) { if (!a.ownerDocument || !a.ownerDocument.defaultView) return null; try { return a.ownerDocument.defaultView.frameElement; } catch (o) { return null; } }(r); return !!i && (i.clientHeight < r.scrollHeight || i.clientWidth < r.scrollWidth); }(e); } return !1; } function Ee(e, t, n, r, i, a, o, l) { return a < e && o > t || a > e && o < t ? 0 : a <= e && l <= n || o >= t && l >= n ? a - e - r : o > t && l < n || a < e && l > n ? o - t + i : 0; } var At = function(e, t) { var n = window, r = t.scrollMode, i = t.block, a = t.inline, o = t.boundary, l = t.skipOverflowHiddenElements, s = typeof o == "function" ? o : function(Vn) { return Vn !== o; }; if (!Ft(e)) throw new TypeError("Invalid target"); for (var v, f, g = document.scrollingElement || document.documentElement, h = [], y = e; Ft(y) && s(y); ) { if ((y = (f = (v = y).parentElement) == null ? v.getRootNode().host || null : f) === g) { h.push(y); break; } y != null && y === document.body && Be(y) && !Be(document.documentElement) || y != null && Be(y, l) && h.push(y); } for (var $ = n.visualViewport ? n.visualViewport.width : innerWidth, d = n.visualViewport ? n.visualViewport.height : innerHeight, b = window.scrollX || pageXOffset, m = window.scrollY || pageYOffset, P = e.getBoundingClientRect(), u = P.height, c = P.width, w = P.top, E = P.right, F = P.bottom, O = P.left, j = i === "start" || i === "nearest" ? w : i === "end" ? F : w + u / 2, I = a === "center" ? O + c / 2 : a === "end" ? E : O, L = [], _ = 0; _ < h.length; _++) { var A = h[_], H = A.getBoundingClientRect(), Z = H.height, U = H.width, x = H.top, S = H.right, N = H.bottom, z = H.left; if (r === "if-needed" && w >= 0 && O >= 0 && F <= d && E <= $ && w >= x && F <= N && O >= z && E <= S) return L; var K = getComputedStyle(A), J = parseInt(K.borderLeftWidth, 10), ie = parseInt(K.borderTopWidth, 10), Q = parseInt(K.borderRightWidth, 10), p = parseInt(K.borderBottomWidth, 10), T = 0, V = 0, W = "offsetWidth" in A ? A.offsetWidth - A.clientWidth - J - Q : 0, B = "offsetHeight" in A ? A.offsetHeight - A.clientHeight - ie - p : 0, X = "offsetWidth" in A ? A.offsetWidth === 0 ? 0 : U / A.offsetWidth : 0, te = "offsetHeight" in A ? A.offsetHeight === 0 ? 0 : Z / A.offsetHeight : 0; if (g === A) T = i === "start" ? j : i === "end" ? j - d : i === "nearest" ? Ee(m, m + d, d, ie, p, m + j, m + j + u, u) : j - d / 2, V = a === "start" ? I : a === "center" ? I - $ / 2 : a === "end" ? I - $ : Ee(b, b + $, $, J, Q, b + I, b + I + c, c), T = Math.max(0, T + m), V = Math.max(0, V + b); else { T = i === "start" ? j - x - ie : i === "end" ? j - N + p + B : i === "nearest" ? Ee(x, N, Z, ie, p + B, j, j + u, u) : j - (x + Z / 2) + B / 2, V = a === "start" ? I - z - J : a === "center" ? I - (z + U / 2) + W / 2 : a === "end" ? I - S + Q + W : Ee(z, S, U, J, Q + W, I, I + c, c); var ne = A.scrollLeft, ve = A.scrollTop; j += ve - (T = Math.max(0, Math.min(ve + T / te, A.scrollHeight - Z / te + B))), I += ne - (V = Math.max(0, Math.min(ne + V / X, A.scrollWidth - U / X + W))); } L.push({ el: A, top: T, left: V }); } return L; }; function gn(e) { return e === Object(e) && Object.keys(e).length !== 0; } function Mr(e, t) { t === void 0 && (t = "auto"); var n = "scrollBehavior" in document.body.style; e.forEach(function(r) { var i = r.el, a = r.top, o = r.left; i.scroll && n ? i.scroll({ top: a, left: o, behavior: t }) : (i.scrollTop = a, i.scrollLeft = o); }); } function _r(e) { return e === !1 ? { block: "end", inline: "nearest" } : gn(e) ? e : { block: "start", inline: "nearest" }; } function jr(e, t) { var n = e.isConnected || e.ownerDocument.documentElement.contains(e); if (gn(t) && typeof t.behavior == "function") return t.behavior(n ? At(e, t) : []); if (n) { var r = _r(t); return Mr(At(e, r), r.behavior); } } function Ne(e, t) { for (var n = -1, r = e == null ? 0 : e.length, i = Array(r); ++n < r; ) i[n] = t(e[n], n, e); return i; } var Lr = 1 / 0, St = he ? he.prototype : void 0, Et = St ? St.toString : void 0; function hn(e) { if (typeof e == "string") return e; if (fe(e)) return Ne(e, hn) + ""; if (ut(e)) return Et ? Et.call(e) : ""; var t = e + ""; return t == "0" && 1 / e == -Lr ? "-0" : t; } var Ct = 1 / 0, Nr = 17976931348623157e292; function Rr(e) { if (!e) return e === 0 ? e : 0; if (e = Cr(e), e === Ct || e === -Ct) { var t = e < 0 ? -1 : 1; return t * Nr; } return e === e ? e : 0; } function Vr(e) { var t = Rr(e), n = t % 1; return t === t ? n ? t - n : t : 0; } function ft(e) { return e; } var Pt = Object.create, Dr = /* @__PURE__ */ function() { function e() { } return function(t) { if (!_e(t)) return {}; if (Pt) return Pt(t); e.prototype = t; var n = new e(); return e.prototype = void 0, n; }; }(); function Wr(e, t, n) { switch (n.length) { case 0: return e.call(t); case 1: return e.call(t, n[0]); case 2: return e.call(t, n[0], n[1]); case 3: return e.call(t, n[0], n[1], n[2]); } return e.apply(t, n); } function Br(e, t) { var n = -1, r = e.length; for (t || (t = Array(r)); ++n < r; ) t[n] = e[n]; return t; } var Hr = 800, zr = 16, Gr = Date.now; function Ur(e) { var t = 0, n = 0; return function() { var r = Gr(), i = zr - (r - n); if (n = r, i > 0) { if (++t >= Hr) return arguments[0]; } else t = 0; return e.apply(void 0, arguments); }; } function Kr(e) { return function() { return e; }; } var Me = function() { try { var e = Dn(Object, "defineProperty"); return e({}, "", {}), e; } catch (t) { } }(), Xr = Me ? function(e, t) { return Me(e, "toString", { configurable: !0, enumerable: !1, value: Kr(t), writable: !0 }); } : ft, vn = Ur(Xr); function Yr(e, t) { for (var n = -1, r = e == null ? 0 : e.length; ++n < r && t(e[n], n, e) !== !1; ) ; return e; } function pn(e, t, n) { t == "__proto__" && Me ? Me(e, t, { configurable: !0, enumerable: !0, value: n, writable: !0 }) : e[t] = n; } var Zr = Object.prototype, Qr = Zr.hasOwnProperty; function yn(e, t, n) { var r = e[t]; (!(Qr.call(e, t) && Wn(r, n)) || n === void 0 && !(t in e)) && pn(e, t, n); } function Fe(e, t, n, r) { var i = !n; n || (n = {}); for (var a = -1, o = t.length; ++a < o; ) { var l = t[a], s = void 0; s === void 0 && (s = e[l]), i ? pn(n, l, s) : yn(n, l, s); } return n; } var Tt = Math.max; function bn(e, t, n) { return t = Tt(t === void 0 ? e.length - 1 : t, 0), function() { for (var r = arguments, i = -1, a = Tt(r.length - t, 0), o = Array(a); ++i < a; ) o[i] = r[t + i]; i = -1; for (var l = Array(t + 1); ++i < t; ) l[i] = r[i]; return l[t] = n(o), Wr(e, this, l); }; } function Jr(e, t) { return vn(bn(e, t, ft), e + ""); } function kr(e) { var t = []; if (e != null) for (var n in Object(e)) t.push(n); return t; } var ei = Object.prototype, ti = ei.hasOwnProperty; function ni(e) { if (!_e(e)) return kr(e); var t = Yt(e), n = []; for (var r in e) r == "constructor" && (t || !ti.call(e, r)) || n.push(r); return n; } function ct(e) { return rt(e) ? Bn(e, !0) : ni(e); } var ri = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, ii = /^\w*$/; function dt(e, t) { if (fe(e)) return !1; var n = typeof e; return n == "number" || n == "symbol" || n == "boolean" || e == null || ut(e) ? !0 : ii.test(e) || !ri.test(e) || t != null && e in Object(t); } var ai = "Expected a function"; function mt(e, t) { if (typeof e != "function" || t != null && typeof t != "function") throw new TypeError(ai); var n = function() { var r = arguments, i = t ? t.apply(this, r) : r[0], a = n.cache; if (a.has(i)) return a.get(i); var o = e.apply(this, r); return n.cache = a.set(i, o) || a, o; }; return n.cache = new (mt.Cache || Zt)(), n; } mt.Cache = Zt; var oi = 500; function li(e) { var t = mt(e, function(r) { return n.size === oi && n.clear(), r; }), n = t.cache; return t; } var si = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ui = /\\(\\)?/g, fi = li(function(e) { var t = []; return e.charCodeAt(0) === 46 && t.push(""), e.replace(si, function(n, r, i, a) { t.push(i ? a.replace(ui, "$1") : r || n); }), t; }); function ci(e) { return e == null ? "" : hn(e); } function Re(e, t) { return fe(e) ? e : dt(e, t) ? [e] : fi(ci(e)); } var di = 1 / 0; function Oe(e) { if (typeof e == "string" || ut(e)) return e; var t = e + ""; return t == "0" && 1 / e == -di ? "-0" : t; } function gt(e, t) { t = Re(t, e); for (var n = 0, r = t.length; e != null && n < r; ) e = e[Oe(t[n++])]; return n && n == r ? e : void 0; } function mi(e, t, n) { var r = e == null ? void 0 : gt(e, t); return r === void 0 ? n : r; } var It = he ? he.isConcatSpreadable : void 0; function gi(e) { return fe(e) || Qt(e) || !!(It && e && e[It]); } function hi(e, t, n, r, i) { var a = -1, o = e.length; for (n || (n = gi), i || (i = []); ++a < o; ) { var l = e[a]; n(l) ? Jt(i, l) : i[i.length] = l; } return i; } function vi(e) { var t = e == null ? 0 : e.length; return t ? hi(e) : []; } function pi(e) { return vn(bn(e, void 0, vi), e + ""); } function yi(e, t, n) { var r = -1, i = e.length; t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0; for (var a = Array(i); ++r < i; ) a[r] = e[r + t]; return a; } function bi(e, t) { return e && Fe(t, je(t), e); } function wi(e, t) { return e && Fe(t, ct(t), e); } var wn = typeof exports == "object" && exports && !exports.nodeType && exports, qt = wn && typeof module == "object" && module && !module.nodeType && module, xi = qt && qt.exports === wn, Mt = xi ? Hn.Buffer : void 0, _t = Mt ? Mt.allocUnsafe : void 0; function $i(e, t) { if (t) return e.slice(); var n = e.length, r = _t ? _t(n) : new e.constructor(n); return e.copy(r), r; } function Fi(e, t) { return Fe(e, kt(e), t); } var Oi = Object.getOwnPropertySymbols, xn = Oi ? function(e) { for (var t = []; e; ) Jt(t, kt(e)), e = dn(e); return t; } : zn; function Ai(e, t) { return Fe(e, xn(e), t); } function $n(e) { return Gn(e, ct, xn); } var Si = Object.prototype, Ei = Si.hasOwnProperty; function Ci(e) { var t = e.length, n = new e.constructor(t); return t && typeof e[0] == "string" && Ei.call(e, "index") && (n.index = e.index, n.input = e.input), n; } function ht(e) { var t = new e.constructor(e.byteLength); return new bt(t).set(new bt(e)), t; } function Pi(e, t) { var n = t ? ht(e.buffer) : e.buffer; return new e.constructor(n, e.byteOffset, e.byteLength); } var Ti = /\w*$/; function Ii(e) { var t = new e.constructor(e.source, Ti.exec(e)); return t.lastIndex = e.lastIndex, t; } var jt = he ? he.prototype : void 0, Lt = jt ? jt.valueOf : void 0; function qi(e) { return Lt ? Object(Lt.call(e)) : {}; } function Mi(e, t) { var n = t ? ht(e.buffer) : e.buffer; return new e.constructor(n, e.byteOffset, e.length); } var _i = "[object Boolean]", ji = "[object Date]", Li = "[object Map]", Ni = "[object Number]", Ri = "[object RegExp]", Vi = "[object Set]", Di = "[object String]", Wi = "[object Symbol]", Bi = "[object ArrayBuffer]", Hi = "[object DataView]", zi = "[object Float32Array]", Gi = "[object Float64Array]", Ui = "[object Int8Array]", Ki = "[object Int16Array]", Xi = "[object Int32Array]", Yi = "[object Uint8Array]", Zi = "[object Uint8ClampedArray]", Qi = "[object Uint16Array]", Ji = "[object Uint32Array]"; function ki(e, t, n) { var r = e.constructor; switch (t) { case Bi: return ht(e); case _i: case ji: return new r(+e); case Hi: return Pi(e, n); case zi: case Gi: case Ui: case Ki: case Xi: case Yi: case Zi: case Qi: case Ji: return Mi(e, n); case Li: return new r(); case Ni: case Di: return new r(e); case Ri: return Ii(e); case Vi: return new r(); case Wi: return qi(e); } } function ea(e) { return typeof e.constructor == "function" && !Yt(e) ? Dr(dn(e)) : {}; } var ta = "[object Map]"; function na(e) { return it(e) && at(e) == ta; } var Nt = Ie && Ie.isMap, ra = Nt ? ot(Nt) : na, ia = "[object Set]"; function aa(e) { return it(e) && at(e) == ia; } var Rt = Ie && Ie.isSet, oa = Rt ? ot(Rt) : aa, la = 1, sa = 2, ua = 4, Fn = "[object Arguments]", fa = "[object Array]", ca = "[object Boolean]", da = "[object Date]", ma = "[object Error]", On = "[object Function]", ga = "[object GeneratorFunction]", ha = "[object Map]", va = "[object Number]", An = "[object Object]", pa = "[object RegExp]", ya = "[object Set]", ba = "[object String]", wa = "[object Symbol]", xa = "[object WeakMap]", $a = "[object ArrayBuffer]", Fa = "[object DataView]", Oa = "[object Float32Array]", Aa = "[object Float64Array]", Sa = "[object Int8Array]", Ea = "[object Int16Array]", Ca = "[object Int32Array]", Pa = "[object Uint8Array]", Ta = "[object Uint8ClampedArray]", Ia = "[object Uint16Array]", qa = "[object Uint32Array]", D = {}; D[Fn] = D[fa] = D[$a] = D[Fa] = D[ca] = D[da] = D[Oa] = D[Aa] = D[Sa] = D[Ea] = D[Ca] = D[ha] = D[va] = D[An] = D[pa] = D[ya] = D[ba] = D[wa] = D[Pa] = D[Ta] = D[Ia] = D[qa] = !0; D[ma] = D[On] = D[xa] = !1; function be(e, t, n, r, i, a) { var o, l = t & la, s = t & sa, v = t & ua; if (n && (o = i ? n(e, r, i, a) : n(e)), o !== void 0) return o; if (!_e(e)) return e; var f = fe(e); if (f) { if (o = Ci(e), !l) return Br(e, o); } else { var g = at(e), h = g == On || g == ga; if (Un(e)) return $i(e, l); if (g == An || g == Fn || h && !i) { if (o = s || h ? {} : ea(e), !l) return s ? Ai(e, wi(o, e)) : Fi(e, bi(o, e)); } else { if (!D[g]) return i ? e : {}; o = ki(e, g, l); } } a || (a = new en()); var y = a.get(e); if (y) return y; a.set(e, o), oa(e) ? e.forEach(function(b) { o.add(be(b, t, n, b, e, a)); }) : ra(e) && e.forEach(function(b, m) { o.set(m, be(b, t, n, m, e, a)); }); var $ = v ? s ? $n : Kn : s ? ct : je, d = f ? void 0 : $(e); return Yr(d || e, function(b, m) { d && (m = b, b = e[m]), yn(o, m, be(b, t, n, m, e, a)); }), o; } var Ma = 1, _a = 4; function Pe(e) { return be(e, Ma | _a); } var ja = 1, La = 2; function Na(e, t, n, r) { var i = n.length, a = i; if (e == null) return !a; for (e = Object(e); i--; ) { var o = n[i]; if (o[2] ? o[1] !== e[o[0]] : !(o[0] in e)) return !1; } for (; ++i < a; ) { o = n[i]; var l = o[0], s = e[l], v = o[1]; if (o[2]) { if (s === void 0 && !(l in e)) return !1; } else { var f = new en(), g; if (!(g === void 0 ? tn(v, s, ja | La, r, f) : g)) return !1; } } return !0; } function Sn(e) { return e === e && !_e(e); } function Ra(e) { for (var t = je(e), n = t.length; n--; ) { var r = t[n], i = e[r]; t[n] = [r, i, Sn(i)]; } return t; } function En(e, t) { return function(n) { return n == null ? !1 : n[e] === t && (t !== void 0 || e in Object(n)); }; } function Va(e) { var t = Ra(e); return t.length == 1 && t[0][2] ? En(t[0][0], t[0][1]) : function(n) { return n === e || Na(n, e, t); }; } function Da(e, t) { return e != null && t in Object(e); } function Wa(e, t, n) { t = Re(t, e); for (var r = -1, i = t.length, a = !1; ++r < i; ) { var o = Oe(t[r]); if (!(a = e != null && n(e, o))) break; e = e[o]; } return a || ++r != i ? a : (i = e == null ? 0 : e.length, !!i && Xn(i) && Yn(o, i) && (fe(e) || Qt(e))); } function Ba(e, t) { return e != null && Wa(e, t, Da); } var Ha = 1, za = 2; function Ga(e, t) { return dt(e) && Sn(t) ? En(Oe(e), t) : function(n) { var r = mi(n, e); return r === void 0 && r === t ? Ba(n, e) : tn(t, r, Ha | za); }; } function Ua(e) { return function(t) { return t == null ? void 0 : t[e]; }; } function Ka(e) { return function(t) { return gt(t, e); }; } function Xa(e) { return dt(e) ? Ua(Oe(e)) : Ka(e); } function Cn(e) { return typeof e == "function" ? e : e == null ? ft : typeof e == "object" ? fe(e) ? Ga(e[0], e[1]) : Va(e) : Xa(e); } function Ya(e) { return it(e) && rt(e); } function Za(e) { var t = e == null ? 0 : e.length; return t ? e[t - 1] : void 0; } function Qa(e) { return function(t, n, r) { var i = Object(t); if (!rt(t)) { var a = Cn(n); t = je(t), n = function(l) { return a(i[l], l, i); }; } var o = e(t, n, r); return o > -1 ? i[a ? t[o] : o] : void 0; }; } var Ja = Math.max; function ka(e, t, n) { var r = e == null ? 0 : e.length; if (!r) return -1; var i = n == null ? 0 : Vr(n); return i < 0 && (i = Ja(r + i, 0)), Zn(e, Cn(t), i); } var eo = Qa(ka), to = Math.min; function no(e, t, n) { for (var r = Jn, i = e[0].length, a = e.length, o = a, l = Array(a), s = 1 / 0, v = []; o--; ) { var f = e[o]; o && t && (f = Ne(f, ot(t))), s = to(f.length, s), l[o] = i >= 120 && f.length >= 120 ? new Qn(o && f) : void 0; } f = e[0]; var g = -1, h = l[0]; e: for (; ++g < i && v.length < s; ) { var y = f[g], $ = y; if (y = y !== 0 ? y : 0, !(h ? wt(h, $) : r(v, $))) { for (o = a; --o; ) { var d = l[o]; if (!(d ? wt(d, $) : r(e[o], $))) continue e; } h && h.push($), v.push(y); } } return v; } function ro(e) { return Ya(e) ? e : []; } var io = Jr(function(e) { var t = Ne(e, ro); return t.length && t[0] === e[0] ? no(t) : []; }); function ao(e, t) { return t.length < 2 ? e : gt(e, yi(t, 0, -1)); } function oo(e, t) { return t = Re(t, e), e = ao(e, t), e == null || delete e[Oe(Za(t))]; } function lo(e) { return Sr(e) ? void 0 : e; } var so = 1, uo = 2, fo = 4, co = pi(function(e, t) { var n = {}; if (e == null) return n; var r = !1; t = Ne(t, function(a) { return a = Re(a, e), r || (r = a.length > 1), a; }), Fe(e, $n(e), n), r && (n = be(n, so | uo | fo, lo)); for (var i = t.length; i--; ) oo(n, t[i]); return n; }); function se() { return se = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); } return e; }, se.apply(this, arguments); } function mo(e, t) { e.prototype = Object.create(t.prototype), e.prototype.constructor = e, $e(e, t); } function Ze(e) { return Ze = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(n) { return n.__proto__ || Object.getPrototypeOf(n); }, Ze(e); } function $e(e, t) { return $e = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, i) { return r.__proto__ = i, r; }, $e(e, t); } function go() { if (typeof Reflect == "undefined" || !Reflect.construct || Reflect.construct.sham) return !1; if (typeof Proxy == "function") return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })), !0; } catch (e) { return !1; } } function Te(e, t, n) { return go() ? Te = Reflect.construct.bind() : Te = function(i, a, o) { var l = [null]; l.push.apply(l, a); var s = Function.bind.apply(i, l), v = new s(); return o && $e(v, o.prototype), v; }, Te.apply(null, arguments); } function ho(e) { return Function.toString.call(e).indexOf("[native code]") !== -1; } function Qe(e) { var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0; return Qe = function(r) { if (r === null || !ho(r)) return r; if (typeof r != "function") throw new TypeError("Super expression must either be null or a function"); if (typeof t != "undefined") { if (t.has(r)) return t.get(r); t.set(r, i); } function i() { return Te(r, arguments, Ze(this).constructor); } return i.prototype = Object.create(r.prototype, { constructor: { value: i, enumerable: !1, writable: !0, configurable: !0 } }), $e(i, r); }, Qe(e); } var vo = /%[sdj%]/g, Pn = function() { }; typeof process != "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof window != "undefined" && typeof document != "undefined" && (Pn = function(t, n) { typeof console != "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING == "undefined" && n.every(function(r) { return typeof r == "string"; }) && console.warn(t, n); }); function Je(e) { if (!e || !e.length) return null; var t = {}; return e.forEach(function(n) { var r = n.field; t[r] = t[r] || [], t[r].push(n); }), t; } function ee(e) { for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) n[r - 1] = arguments[r]; var i = 0, a = n.length; if (typeof e == "function") return e.apply(null, n); if (typeof e == "string") { var o = e.replace(vo, function(l) { if (l === "%%") return "%"; if (i >= a) return l; switch (l) { case "%s": return String(n[i++]); case "%d": return Number(n[i++]); case "%j": try { return JSON.stringify(n[i++]); } catch (s) { return "[Circular]"; } break; default: return l; } }); return o; } return e; } function po(e) { return e === "string" || e === "url" || e === "hex" || e === "email" || e === "date" || e === "pattern"; } function G(e, t) { return !!(e == null || t === "array" && Array.isArray(e) && !e.length || po(t) && typeof e == "string" && !e); } function yo(e, t, n) { var r = [], i = 0, a = e.length; function o(l) { r.push.apply(r, l || []), i++, i === a && n(r); } e.forEach(function(l) { t(l, o); }); } function Vt(e, t, n) { var r = 0, i = e.length; function a(o) { if (o && o.length) { n(o); return; } var l = r; r = r + 1, l < i ? t(e[l], a) : n([]); } a([]); } function bo(e) { var t = []; return Object.keys(e).forEach(function(n) { t.push.apply(t, e[n] || []); }), t; } var Dt = /* @__PURE__ */ function(e) { mo(t, e); function t(n, r) { var i; return i = e.call(this, "Async Validation Error") || this, i.errors = n, i.fields = r, i; } return t; }(/* @__PURE__ */ Qe(Error)); function wo(e, t, n, r, i) { if (t.first) { var a = new Promise(function(h, y) { var $ = function(m) { return r(m), m.length ? y(new Dt(m, Je(m))) : h(i); }, d = bo(e); Vt(d, n, $); }); return a.catch(function(h) { return h; }), a; } var o = t.firstFields === !0 ? Object.keys(e) : t.firstFields || [], l = Object.keys(e), s = l.length, v = 0, f = [], g = new Promise(function(h, y) { var $ = function(b) { if (f.push.apply(f, b), v++, v === s) return r(f), f.length ? y(new Dt(f, Je(f))) : h(i); }; l.length || (r(f), h(i)), l.forEach(function(d) { var b = e[d]; o.indexOf(d) !== -1 ? Vt(b, n, $) : yo(b, n, $); }); }); return g.catch(function(h) { return h; }), g; } function xo(e) { return !!(e && e.message !== void 0); } function $o(e, t) { for (var n = e, r = 0; r < t.length; r++) { if (n == null) return n; n = n[t[r]]; } return n; } function Wt(e, t) { return function(n) { var r; return e.fullFields ? r = $o(t, e.fullFields) : r = t[n.field || e.fullField], xo(n) ? (n.field = n.field || e.fullField, n.fieldValue = r, n) : { message: typeof n == "function" ? n() : n, fieldValue: r, field: n.field || e.fullField }; }; } function Bt(e, t) { if (t) { for (var n in t) if (t.hasOwnProperty(n)) { var r = t[n]; typeof r == "object" && typeof e[n] == "object" ? e[n] = se({}, e[n], r) : e[n] = r; } } return e; } var Tn = function(t, n, r, i, a, o) { t.required && (!r.hasOwnProperty(t.field) || G(n, o || t.type)) && i.push(ee(a.messages.required, t.fullField)); }, Fo = function(t, n, r, i, a) { (/^\s+$/.test(n) || n === "") && i.push(ee(a.messages.whitespace, t.fullField)); }, Ce, Oo = function() { if (Ce) return Ce; var e = "[a-fA-F\\d:]", t = function(c) { return c && c.includeBoundaries ? "(?:(?<=\\s|^)(?=" + e + ")|(?<=" + e + ")(?=\\s|$))" : ""; }, n = "(?: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}", r = "[a-fA-F\\d]{1,4}", i = (` (?: (?:` + r + ":){7}(?:" + r + `|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 (?:` + r + ":){6}(?:" + n + "|:" + r + `|:)| // 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::1.2.3.4 (?:` + r + ":){5}(?::" + n + "|(?::" + r + `){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 (?:` + r + ":){4}(?:(?::" + r + "){0,1}:" + n + "|(?::" + r + `){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 (?:` + r + ":){3}(?:(?::" + r + "){0,2}:" + n + "|(?::" + r + `){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 (?:` + r + ":){2}(?:(?::" + r + "){0,3}:" + n + "|(?::" + r + `){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 (?:` + r + ":){1}(?:(?::" + r + "){0,4}:" + n + "|(?::" + r + `){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 (?::(?:(?::` + r + "){0,5}:" + n + "|(?::" + r + `){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1 `).replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(), a = new RegExp("(?:^" + n + "$)|(?:^" + i + "$)"), o = new RegExp("^" + n + "$"), l = new RegExp("^" + i + "$"), s = function(c) { return c && c.exact ? a : new RegExp("(?:" + t(c) + n + t(c) + ")|(?:" + t(c) + i + t(c) + ")", "g"); }; s.v4 = function(u) { return u && u.exact ? o : new RegExp("" + t(u) + n + t(u), "g"); }, s.v6 = function(u) { return u && u.exact ? l : new RegExp("" + t(u) + i + t(u), "g"); }; var v = "(?:(?:[a-z]+:)?//)", f = "(?:\\S+(?::\\S*)?@)?", g = s.v4().source, h = s.v6().source, y = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)", $ = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*", d = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))", b = "(?::\\d{2,5})?", m = '(?:[/?#][^\\s"]*)?', P = "(?:" + v + "|www\\.)" + f + "(?:localhost|" + g + "|" + h + "|" + y + $ + d + ")" + b + m; return Ce = new RegExp("(?:^" + P + "$)", "i"), Ce; }, Ht = { // http://emailregex.com/ 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,}))$/, // url: new RegExp( // '^(?!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]*)?$', // 'i', // ), hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i }, ye = { integer: function(t) { return ye.number(t) && parseInt(t, 10) === t; }, float: function(t) { return ye.number(t) && !ye.integer(t); }, array: function(t) { return Array.isArray(t); }, regexp: function(t) { if (t instanceof RegExp) return !0; try { return !!new RegExp(t); } catch (n) { return !1; } }, date: function(t) { return typeof t.getTime == "function" && typeof t.getMonth == "function" && typeof t.getYear == "function" && !isNaN(t.getTime()); }, number: function(t) { return isNaN(t) ? !1 : typeof t == "number"; }, object: function(t) { return typeof t == "object" && !ye.array(t); }, method: function(t) { return typeof t == "function"; }, email: function(t) { return typeof t == "string" && t.length <= 320 && !!t.match(Ht.email); }, url: function(t) { return typeof t == "string" && t.length <= 2048 && !!t.match(Oo()); }, hex: function(t) { return typeof t == "string" && !!t.match(Ht.hex); } }, Ao = function(t, n, r, i, a) { if (t.required && n === void 0) { Tn(t, n, r, i, a); return; } var o = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"], l = t.type; o.indexOf(l) > -1 ? ye[l](n) || i.push(ee(a.messages.types[l], t.fullField, t.type)) : l && typeof n !== t.type && i.push(ee(a.messages.types[l], t.fullField, t.type)); }, So = function(t, n, r, i, a) { var o = typeof t.len == "number", l = typeof t.min == "number", s = typeof t.max == "number", v = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, f = n, g = null, h = typeof n == "number", y = typeof n == "string", $ = Array.isArray(n); if (h ? g = "number" : y ? g = "string" : $ && (g = "array"), !g) return !1; $ && (f = n.length), y && (f = n.replace(v, "_").length), o ? f !== t.len && i.push(ee(a.messages[g].len, t.fullField, t.len)) : l && !s && f < t.min ? i.push(ee(a.messages[g].min, t.fullField, t.min)) : s && !l && f > t.max ? i.push(ee(a.messages[g].max, t.fullField, t.max)) : l && s && (f < t.min || f > t.max) && i.push(ee(a.messages[g].range, t.fullField, t.min, t.max)); }, de = "enum", Eo = function(t, n, r, i, a) { t[de] = Array.isArray(t[de]) ? t[de] : [], t[de].indexOf(n) === -1 && i.push(ee(a.messages[de], t.fullField, t[de].join(", "))); }, Co = function(t, n, r, i, a) { if (t.pattern) { if (t.pattern instanceof RegExp) t.pattern.lastIndex = 0, t.pattern.test(n) || i.push(ee(a.messages.pattern.mismatch, t.fullField, n, t.pattern)); else if (typeof t.pattern == "string") { var o = new RegExp(t.pattern); o.test(n) || i.push(ee(a.messages.pattern.mismatch, t.fullField, n, t.pattern)); } } }, q = { required: Tn, whitespace: Fo, type: Ao, range: So, enum: Eo, pattern: Co }, Po = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n, "string") && !t.required) return r(); q.required(t, n, i, o, a, "string"), G(n, "string") || (q.type(t, n, i, o, a), q.range(t, n, i, o, a), q.pattern(t, n, i, o, a), t.whitespace === !0 && q.whitespace(t, n, i, o, a)); } r(o); }, To = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && q.type(t, n, i, o, a); } r(o); }, Io = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (n === "" && (n = void 0), G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && (q.type(t, n, i, o, a), q.range(t, n, i, o, a)); } r(o); }, qo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && q.type(t, n, i, o, a); } r(o); }, Mo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), G(n) || q.type(t, n, i, o, a); } r(o); }, _o = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && (q.type(t, n, i, o, a), q.range(t, n, i, o, a)); } r(o); }, jo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && (q.type(t, n, i, o, a), q.range(t, n, i, o, a)); } r(o); }, Lo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (n == null && !t.required) return r(); q.required(t, n, i, o, a, "array"), n != null && (q.type(t, n, i, o, a), q.range(t, n, i, o, a)); } r(o); }, No = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && q.type(t, n, i, o, a); } r(o); }, Ro = "enum", Vo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a), n !== void 0 && q[Ro](t, n, i, o, a); } r(o); }, Do = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n, "string") && !t.required) return r(); q.required(t, n, i, o, a), G(n, "string") || q.pattern(t, n, i, o, a); } r(o); }, Wo = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n, "date") && !t.required) return r(); if (q.required(t, n, i, o, a), !G(n, "date")) { var s; n instanceof Date ? s = n : s = new Date(n), q.type(t, s, i, o, a), s && q.range(t, s.getTime(), i, o, a); } } r(o); }, Bo = function(t, n, r, i, a) { var o = [], l = Array.isArray(n) ? "array" : typeof n; q.required(t, n, i, o, a, l), r(o); }, He = function(t, n, r, i, a) { var o = t.type, l = [], s = t.required || !t.required && i.hasOwnProperty(t.field); if (s) { if (G(n, o) && !t.required) return r(); q.required(t, n, i, l, a, o), G(n, o) || q.type(t, n, i, l, a); } r(l); }, Ho = function(t, n, r, i, a) { var o = [], l = t.required || !t.required && i.hasOwnProperty(t.field); if (l) { if (G(n) && !t.required) return r(); q.required(t, n, i, o, a); } r(o); }, we = { string: Po, method: To, number: Io, boolean: qo, regexp: Mo, integer: _o, float: jo, array: Lo, object: No, enum: Vo, pattern: Do, date: Wo, url: He, hex: He, email: He, required: Bo, any: Ho }; function ke() { return { default: "Validation error on field %s", required: "%s is required", enum: "%s must be one of %s", whitespace: "%s cannot be empty", date: { format: "%s date %s is invalid for format %s", parse: "%s date could not be parsed, %s is invalid ", invalid: "%s date %s is invalid" }, types: { string: "%s is not a %s", method: "%s is not a %s (function)", array: "%s is not an %s", object: "%s is not an %s", number: "%s is not a %s", date: "%s is not a %s", boolean: "%s is not a %s", integer: "%s is not an %s", float: "%s is not a %s", regexp: "%s is not a valid %s", email: "%s is not a valid %s", url: "%s is not a valid %s", hex: "%s is not a valid %s" }, string: { len: "%s must be exactly %s characters", min: "%s must be at least %s characters", max: "%s cannot be longer than %s characters", range: "%s must be between %s and %s characters" }, number: { len: "%s must equal %s", min: "%s cannot be less than %s", max: "%s cannot be greater than %s", range: "%s must be between %s and %s" }, array: { len: "%s must be exactly %s in length", min: "%s cannot be less than %s in length", max: "%s cannot be greater than %s in length", range: "%s must be between %s and %s in length" }, pattern: { mismatch: "%s value %s does not match pattern %s" }, clone: function() { var t = JSON.parse(JSON.stringify(this)); return t.clone = this.clone, t; } }; } var et = ke(), Ae = /* @__PURE__ */ function() { function e(n) { this.rules = null, this._messages = et, this.define(n); } var t = e.prototype; return t.define = function(r) { var i = this; if (!r) throw new Error("Cannot configure a schema with no rules"); if (typeof r != "object" || Array.isArray(r)) throw new Error("Rules must be an object"); this.rules = {}, Object.keys(r).forEach(function(a) { var o = r[a]; i.rules[a] = Array.isArray(o) ? o : [o]; }); }, t.messages = function(r) { return r && (this._messages = Bt(ke(), r)), this._messages; }, t.validate = function(r, i, a) { var o = this; i === void 0 && (i = {}), a === void 0 && (a = function() { }); var l = r, s = i, v = a; if (typeof s == "function" && (v = s, s = {}), !this.rules || Object.keys(this.rules).length === 0) return v && v(null, l), Promise.resolve(l); function f(d) { var b = [], m = {}; function P(c) { if (Array.isArray(c)) { var w; b = (w = b).concat.apply(w, c); } else b.push(c); } for (var u = 0; u < d.length; u++) P(d[u]); b.length ? (m = Je(b), v(b, m)) : v(null, l); } if (s.messages) { var g = this.messages(); g === et && (g = ke()), Bt(g, s.messages), s.messages = g; } else s.messages = this.messages(); var h = {}, y = s.keys || Object.keys(this.rules); y.forEach(function(d) { var b = o.rules[d], m = l[d]; b.forEach(function(P) { var u = P; typeof u.transform == "function" && (l === r && (l = se({}, l)), m = l[d] = u.transform(m)), typeof u == "function" ? u = { validator: u } : u = se({}, u), u.validator = o.getValidationMethod(u), u.validator && (u.field = d, u.fullField = u.fullField || d, u.type = o.getType(u), h[d] = h[d] || [], h[d].push({ rule: u, value: m, source: l, field: d })); }); }); var $ = {}; return wo(h, s, function(d, b) { var m = d.rule, P = (m.type === "object" || m.type === "array") && (typeof m.fields == "object" || typeof m.defaultField == "object"); P = P && (m.required || !m.required && d.value), m.field = d.field; function u(E, F) { return se({}, F, { fullField: m.fullField + "." + E, fullFields: m.fullFields ? [].concat(m.fullFields, [E]) : [E] }); } function c(E) { E === void 0 && (E = []); var F = Array.isArray(E) ? E : [E]; !s.suppressWarning && F.length && e.warning("async-validator:", F), F.length && m.message !== void 0 && (F = [].concat(m.message)); var O = F.map(Wt(m, l)); if (s.first && O.length) return $[m.field] = 1, b(O); if (!P) b(O); else { if (m.required && !d.value) return m.message !== void 0 ? O = [].concat(m.message).map(Wt(m, l)) : s.error && (O = [s.error(m, ee(s.messages.required, m.field))]), b(O); var j = {}; m.defaultField && Object.keys(d.value).map(function(_) { j[_] = m.defaultField; }), j = se({}, j, d.rule.fields); var I = {}; Object.keys(j).forEach(function(_) { var A = j[_], H = Array.isArray(A) ? A : [A]; I[_] = H.map(u.bind(null, _)); }); var L = new e(I); L.messages(s.messages), d.rule.options && (d.rule.options.messages = s.messages, d.rule.options.error = s.error), L.validate(d.value, d.rule.options || s, function(_) { var A = []; O && O.length && A.push.apply(A, O), _ && _.length && A.push.apply(A, _), b(A.length ? A : null); }); } } var w; if (m.asyncValidator) w = m.asyncValidator(m, d.value, c, d.source, s); else if (m.validator) { try { w = m.validator(m, d.value, c, d.source, s); } catch (E) { console.error == null || console.error(E), s.suppressValidatorError || setTimeout(function() { throw E; }, 0), c(E.message); } w === !0 ? c() : w === !1 ? c(typeof m.message == "function" ? m.message(m.fullField || m.field) : m.message || (m.fullField || m.field) + " fails") : w instanceof Array ? c(w) : w instanceof Error && c(w.message); } w && w.then && w.then(function() { return c(); }, function(E) { return c(E); }); }, function(d) { f(d); }, l); }, t.getType = function(r) { if (r.type === void 0 && r.pattern instanceof RegExp && (r.type = "pattern"), typeof r.validator != "function" && r.type && !we.hasOwnProperty(r.type)) throw new Error(ee("Unknown rule type %s", r.type)); return r.type || "string"; }, t.getValidationMethod = function(r) { if (typeof r.validator == "function") return r.validator; var i = Object.keys(r), a = i.indexOf("message"); return a !== -1 && i.splice(a, 1), i.length === 1 && i[0] === "required" ? we.required : we[this.getType(r)] || void 0; }, e; }(); Ae.register = function(t, n) { if (typeof n != "function") throw new Error("Cannot register a validator by type, validator is not a function"); we[t] = n; }; Ae.warning = Pn; Ae.messages = et; Ae.validators = we; function ae(e) { return e == null ? [] : Array.isArray(e) ? e : [e]; } function In(e, t) { let n = e; for (let r = 0; r < t.length; r += 1) { if (n == null) return; n = n[t[r]]; } return n; } function qn(e, t, n, r) { if (!t.length) return n; const [i, ...a] = t; let o; return !e && typeof i == "number" ? o = [] : Array.isArray(e) ? o = [...e] : o = M({}, e), r && n === void 0 && a.length === 1 ? delete o[i][a[0]] : o[i] = qn(o[i], a, n, r), o; } function zo(e, t, n) { let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; return t.length && r && n === void 0 && !In(e, t.slice(0, -1)) ? e : qn(e, t, n, r); } function tt(e) { return ae(e); } function Go(e, t) { return In(e, t); } function Uo(e, t, n) { let r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; return zo(e, t, n, r); } function Ko(e, t) { return e && e.some((n) => Yo(n, t)); } function zt(e) { return typeof e == "object" && e !== null && Object.getPrototypeOf(e) === Object.prototype; } function Mn(e, t) { const n = Array.isArray(e) ? [...e] : M({}, e); return t && Object.keys(t).forEach((r) => { const i = n[r], a = t[r], o = zt(i) && zt(a); n[r] = o ? Mn(i, a || {}) : a; }), n; } function Xo(e) { for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) n[r - 1] = arguments[r]; return n.reduce((i, a) => Mn(i, a), e); } function Gt(e, t) { let n = {}; return t.forEach((r) => { const i = Go(e, r); n = Uo(n, r, i); }), n; } function Yo(e, t) { return !e || !t || e.length !== t.length ? !1 : e.every((n, r) => t[r] === n); } const k = "'${name}' is not a valid ${type}", Ve = { default: "Validation error on field '${name}'", required: "'${name}' is required", enum: "'${name}' must be one of [${enum}]", whitespace: "'${name}' cannot be empty", date: { format: "'${name}' is invalid for format date", parse: "'${name}' could not be parsed as date", invalid: "'${name}' is invalid date" }, types: { string: k, method: k, array: k, object: k, number: k, date: k, boolean: k, integer: k, float: k, regexp: k, email: k, url: k, hex: k }, string: { len: "'${name}' must be exactly ${len} characters", min: "'${name}' must be at least ${min} characters", max: "'${name}' cannot be longer than ${max} characters", range: "'${name}' must be between ${min} and ${max} characters" }, number: { len: "'${name}' must equal ${len}", min: "'${name}' cannot be less than ${min}", max: "'${name}' cannot be greater than ${max}", range: "'${name}' must be between ${min} and ${max}" }, array: { len: "'${name}' must be exactly ${len} in length", min: "'${name}' cannot be less than ${min} in length", max: "'${name}' cannot be greater than ${max} in length", range: "'${name}' must be between ${min} and ${max} in length" }, pattern: { mismatch: "'${name}' does not match pattern ${pattern}" } }; var De = function(e, t, n, r) { function i(a) { return a instanceof n ? a : new n(function(o) { o(a); }); } return new (n || (n = Promise))(function(a, o) { function l(f) { try { v(r.next(f)); } catch (g) { o(g); } } function s(f) { try { v(r.throw(f)); } catch (g) { o(g); } } function v(f) { f.done ? a(f.value) : i(f.value).then(l, s); } v((r = r.apply(e, t || [])).next()); }); }; const Zo = Ae; function Qo(e, t) { return e.replace(/\$\{\w+\}/g, (n) => { const r = n.slice(2, -1); return t[r]; }); } function nt(e, t, n, r, i) { return De(this, void 0, void 0, function* () { const a = M({}, n); delete a.ruleIndex, delete a.trigger; let o = null; a && a.type === "array" && a.defaultField && (o = a.defaultField, delete a.defaultField); const l = new Zo({ [e]: [a] }), s = Xo({}, Ve, r.validateMessages); l.messages(s); let v = []; try { yield Promise.resolve(l.validate({ [e]: t }, M({}, r))); } catch (h) { h.errors ? v = h.errors.map((y, $) => { let { message: d } = y; return ( // Wrap VueNode with `key` kn(d) ? br(d, { key: `error_${$}` }) : d ); }) : (console.error(h), v = [s.default()]); } if (!v.length && o) return (yield Promise.all(t.map((y, $) => nt(`${e}.${$}`, y, o, r, i)))).reduce((y, $) => [...y, ...$], []); const f = M(M(M({}, n), { name: e, enum: (n.enum || []).join(", ") }), i); return v.map((h) => typeof h == "string" ? Qo(h, f) : h); }); } function _n(e, t, n, r, i, a) { const o = e.join("."), l = n.map((v, f) => { const g = v.validator, h = M(M({}, v), { ruleIndex: f }); return g && (h.validator = (y, $, d) => { let b = !1; const P = g(y, $, function() { for (var u = arguments.length, c = new Array(u), w = 0; w < u; w++) c[w] = arguments[w]; Promise.resolve().then(() => { Ue(!b, "Your validator function has already return a promise. `callback` will be ignored."), b || d(...c); }); }); b = P && typeof P.then == "function" && typeof P.catch == "function", Ue(b, "`callback` is deprecated. Please return a promise instead."), b && P.then(() => { d(); }).catch((u) => { d(u || " "); }); }), h; }).sort((v, f) => { let { warningOnly: g, ruleIndex: h } = v, { warningOnly: y, ruleIndex: $ } = f; return !!g == !!y ? h - $ : g ? 1 : -1; }); let s; if (i === !0) s = new Promise((v, f) => De(this, void 0, void 0, function* () { for (let g = 0; g < l.length; g += 1) { const h = l[g], y = yield nt(o, t, h, r, a); if (y.length) { f([{ errors: y, rule: h }]); return; } } v([]); })); else { const v = l.map((f) => nt(o, t, f, r, a).then((g) => ({ errors: g, rule: f }))); s = (i ? ko(v) : Jo(v)).then((f) => Promise.reject(f)); } return s.catch((v) => v), s; } function Jo(e) { return De(this, void 0, void 0, function* () { return Promise.all(e).then((t) => [].concat(...t)); }); } function ko(e) { return De(this, void 0, void 0, function* () { let t = 0; return new Promise((n) => { e.forEach((r) => { r.then((i) => { i.errors.length && n([i]), t += 1, t === e.length && n([]); }); }); }); }); } const jn = Symbol("formContextKey"), Ln = (e) => { sn(jn, e); }, vt = () => un(jn, { name: C(() => { }), labelAlign: C(() => "right"), vertical: C(() => !1), // eslint-disable-next-line @typescript-eslint/no-unused-vars addField: (e, t) => { }, // eslint-disable-next-line @typescript-eslint/no-unused-vars removeField: (e) => { }, model: C(() => { }), rules: C(() => { }), colon: C(() => { }), labelWrap: C(() => { }), labelCol: C(() => { }), requiredMark: C(() => !1), validateTrigger: C(() => { }), onValidate: () => { }, validateMessages: C(() => Ve) }), Nn = Symbol("formItemPrefixContextKey"), el = (e) => { sn(Nn, e); }, tl = () => un(Nn, { prefixCls: C(() => "") }), pt = (e, t) => { let { slots: n, emit: r, attrs: i } = t; var a, o, l, s, v; const { prefixCls: f, htmlFor: g, labelCol: h, labelAlign: y, colon: $, required: d, requiredMark: b } = M(M({}, e), i), [m] = er("Form"), P = (a = e.label) !== null && a !== void 0 ? a : (o = n.label) === null || o === void 0 ? void 0 : o.call(n); if (!P) return null; const { vertical: u, labelAlign: c, labelCol: w, labelWrap: E, colon: F } = vt(), O = h || (w == null ? void 0 : w.value) || {}, j = y || (c == null ? void 0 : c.value), I = `${f}-item-label`, L = xe(I, j === "left" && `${I}-left`, O.class, { [`${I}-wrap`]: !!E.value }); let _ = P; const A = $ === !0 || (F == null ? void 0 : F.value) !== !1 && $ !== !1; if (A && !u.value && typeof P == "string" && P.trim() !== "" && (_ = P.replace(/[:|:]\s*$/, "")), e.tooltip || n.tooltip) { const U = R("span", { class: `${f}-item-tooltip` }, [R(tr, { title: e.tooltip }, { default: () => [R(nr, null, null)] })]); _ = R(qe, null, [_, n.tooltip ? (l = n.tooltip) === null || l === void 0 ? void 0 : l.call(n, { class: `${f}-item-tooltip` }) : U]); } b === "optional" && !d && (_ = R(qe, null, [_, R("span", { class: `${f}-item-optional` }, [((s = m.value) === null || s === void 0 ? void 0 : s.optional) || ((v = rr.Form) === null || v === void 0 ? void 0 : v.optional)])])); const Z = xe({ [`${f}-item-required`]: d, [`${f}-item-required-mark-optional`]: b === "optional", [`${f}-item-no-colon`]: !A }); return R(mn, Y(Y({}, O), {}, { class: L }), { default: () => [R("label", { for: g, class: Z, title: typeof P == "string" ? P : "", onClick: (U) => r("click", U) }, [_])] }); }; pt.displayName = "FormItemLabel"; pt.inheritAttrs = !1; const nl = (e) => { const { componentCls: t } = e, n = `${t}-show-help`, r = `${t}-show-help-item`; return { [n]: { // Explain holder transition: `opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`, "&-appear, &-enter": { opacity: 0, "&-active": { opacity: 1 } }, "&-leave": { opacity: 1, "&-active": { opacity: 0 } }, // Explain [r]: { overflow: "hidden", transition: `height ${e.motionDurationSlow} ${e.motionEaseInOut}, opacity ${e.motionDurationSlow} ${e.motionEaseInOut}, transform ${e.motionDurationSlow} ${e.motionEaseInOut} !important`, [`&${r}-appear, &${r}-enter`]: { transform: "translateY(-5px)", opacity: 0, "&-active": { transform: "translateY(0)", opacity: 1 } }, [`&${r}-leave-active`]: { transform: "translateY(-5px)" } } } }; }, rl = (e) => ({ legend: { display: "block", width: "100%", marginBottom: e.marginLG, padding: 0, color: e.colorTextDescription, fontSize: e.fontSizeLG, lineHeight: "inherit", border: 0, borderBottom: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}` }, label: { fontSize: e.fontSize }, 'input[type="search"]': { boxSizing: "border-box" }, // Position radios and checkboxes better 'input[type="radio"], input[type="checkbox"]': { lineHeight: "normal" }, 'input[type="file"]': { display: "block" }, // Make range inputs behave like textual form controls 'input[type="range"]': { display: "block", width: "100%" }, // Make multiple select elements height not fixed "select[multiple], select[size]": { height: "auto" }, // Focus for file, radio, and checkbox "input[type='file']:focus,\n input[type='radio']:focus,\n input[type='checkbox']:focus": { outline: 0, boxShadow: `0 0 0 ${e.controlOutlineWidth}px ${e.controlOutline}` }, // Adjust output element output: { display: "block", paddingTop: 15, color: e.colorText, fontSize: e.fontSize, lineHeight: e.lineHeight } }), Ut = (e, t) => { const { formItemCls: n } = e; return { [n]: { [`${n}-label > label`]: { height: t }, [`${n}-control-input`]: { minHeight: t } } }; }, il = (e) => { const { componentCls: t } = e; return { [e.componentCls]: M(M(M({}, rn(e)), rl(e)), { [`${t}-text`]: { display: "inline-block", paddingInlineEnd: e.paddingSM }, // ================================================================ // = Size = // ================================================================ "&-small": M({}, Ut(e, e.controlHeightSM)), "&-large": M({}, Ut(e, e.controlHeightLG)) }) }; }, al = (e) => { const { formItemCls: t, iconCls: n, componentCls: r, rootPrefixCls: i } = e; return { [t]: M(M({}, rn(e)), { marginBottom: e.marginLG, verticalAlign: "top", "&-with-help": { transition: "none" }, [`&-hidden, &-hidden.${i}-row`]: { // https://github.com/ant-design/ant-design/issues/26141 display: "none" }, "&-has-warning": { [`${t}-split`]: { color: e.colorError } }, "&-has-error": { [`${t}-split`]: { color: e.colorWarning } }, // ============================================================== // = Label = // ============================================================== [`${t}-label`]: { display: "inline-block", flexGrow: 0, overflow: "hidden", whiteSpace: "nowrap", textAlign: "end", verticalAlign: "middle", "&-left": { textAlign: "start" }, "&-wrap": { overflow: "unset", lineHeight: `${e.lineHeight} - 0.25em`, whiteSpace: "unset" }, "> label": { position: "relative", display: "inline-flex", alignItems: "center", maxWidth: "100%", height: e.controlHeight, color: e.colorTextHeading, fontSize: e.fontSize, [`> ${n}`]: { fontSize: e.fontSize, verticalAlign: "top" }, // Required mark [`&${t}-required:not(${t}-required-mark-optional)::before`]: { display: "inline-block", marginInlineEnd: e.marginXXS, color: e.colorError, fontSize: e.fontSize, fontFamily: "SimSun, sans-serif", lineHeight: 1, content: '"*"', [`${r}-hide-required-mark &`]: { display: "none" } }, // Optional mark [`${t}-optional`]: { display: "inline-block", marginInlineStart: e.marginXXS, color: e.colorTextDescription, [`${r}-hide-required-mark &`]: { display: "none" } }, // Optional mark [`${t}-tooltip`]: { color: e.colorTextDescription, cursor: "help", writingMode: "horizontal-tb", marginInlineStart: e.marginXXS }, "&::after": { content: '":"', position: "relative", marginBlock: 0, marginInlineStart: e.marginXXS / 2, marginInlineEnd: e.marginXS }, [`&${t}-no-colon::after`]: { content: '" "' } } }, // ============================================================== // = Input = // ============================================================== [`${t}-control`]: { display: "flex", flexDirection: "column", flexGrow: 1, [`&:first-child:not([class^="'${i}-col-'"]):not([class*="' ${i}-col-'"])`]: { width: "100%" }, "&-input": { position: "relative", display: "flex", alignItems: "center", minHeight: e.controlHeight, "&-content": { flex: "auto", maxWidth: "100%" } } }, // ============================================================== // = Explain = // ============================================================== [t]: { "&-explain, &-extra": { clear: "both", color: e.colorTextDescription, fontSize: e.fontSize, lineHeight: e.lineHeight }, "&-explain-connected": { width: "100%" }, "&-extra": { minHeight: e.controlHeightSM, transition: `color ${e.motionDurationMid} ${e.motionEaseOut}` // sync input color transition }, "&-explain": { "&-error": { color: e.colorError }, "&-warning": { color: e.colorWarning } } }, [`&-with-help ${t}-explain`]: { height: "auto", opacity: 1 }, // ============================================================== // = Feedback Icon = // ============================================================== [`${t}-feedback-icon`]: { fontSize: e.fontSize, textAlign: "center", visibility: "visible", animationName: nn, animationDuration: e.motionDurationMid, animationTimingFunction: e.motionEaseOutBack, pointerEvents: "none", "&-success": { color: e.colorSuccess }, "&-error": { color: e.colorError }, "&-warning": { color: e.colorWarning }, "&-validating": { color: e.colorPrimary } } }) }; }, ol = (e) => { const { componentCls: t, formItemCls: n, rootPrefixCls: r } = e; return { [`${t}-horizontal`]: { [`${n}-label`]: { flexGrow: 0 }, [`${n}-control`]: { flex: "1 1 0", // https://github.com/ant-design/ant-design/issues/32777 // https://github.com/ant-design/ant-design/issues/33773 minWidth: 0 }, // https://github.com/ant-design/ant-design/issues/32980 [`${n}-label.${r}-col-24 + ${n}-control`]: { minWidth: "unset" } } }; }, ll = (e) => { const { componentCls: t, formItemCls: n } = e; return { [`${t}-inline`]: { display: "flex", flexWrap: "wrap", [n]: { flex: "none", flexWrap: "nowrap", marginInlineEnd: e.margin, marginBottom: 0, "&-with-help": { marginBottom: e.marginLG }, [`> ${n}-label, > ${n}-control`]: { display: "inline-block", verticalAlign: "top" }, [`> ${n}-label`]: { flex: "none" }, [`${t}-text`]: { display: "inline-block" }, [`${n}-has-feedback`]: { display: "inline-block" } } } }; }, me = (e) => ({ margin: 0, padding: `0 0 ${e.paddingXS}px`, whiteSpace: "initial", textAlign: "start", "> label": { margin: 0, "&::after": { display: "none" } } }), sl = (e) => { const { componentCls: t, formItemCls: n } = e; return { [`${n} ${n}-label`]: me(e), [t]: { [n]: { flexWrap: "wrap", [`${n}-label, ${n}-control`]: { flex: "0 0 100%", maxWidth: "100%" } } } }; }, ul = (e) => { const { componentCls: t, formItemCls: n, rootPrefixCls: r } = e; return { [`${t}-vertical`]: { [n]: { "&-row": { flexDirection: "column" }, "&-label > label": { height: "auto" }, [`${t}-item-control`]: { width: "100%" } } }, [`${t}-vertical ${n}-label, .${r}-col-24${n}-label, .${r}-col-xl-24${n}-label`]: me(e), [`@media (max-width: ${e.screenXSMax}px)`]: [sl(e), { [t]: { [`.${r}-col-xs-24${n}-label`]: me(e) } }], [`@media (max-width: ${e.screenSMMax}px)`]: { [t]: { [`.${r}-col-sm-24${n}-label`]: me(e) } }, [`@media (max-width: ${e.screenMDMax}px)`]: { [t]: { [`.${r}-col-md-24${n}-label`]: me(e) } }, [`@media (max-width: ${e.screenLGMax}px)`]: { [t]: { [`.${r}-col-lg-24${n}-label`]: me(e) } } }; }, yt = ir("Form", (e, t) => { let { rootPrefixCls: n } = t; const r = ar(e, { formItemCls: `${e.componentCls}-item`, rootPrefixCls: n }); return [il(r), al(r), nl(r), ol(r), ll(r), ul(r), or(r), nn]; }), fl = Le({ compatConfig: { MODE: 3 }, name: "ErrorList", inheritAttrs: !1, props: ["errors", "help", "onErrorVisibleChanged", "helpStatus", "warnings"], setup(e, t) { let { attrs: n } = t; const { prefixCls: r, status: i } = tl(), a = C(() => `${r.value}-item-explain`), o = C(() => !!(e.errors && e.errors.length)), l = st(i.value), [, s] = yt(r); return ue([o, i], () => { o.value && (l.value = i.value); }), () => { var v, f; const g = lr(`${r.value}-show-help-item`), h = sr(`${r.value}-show-help-item`, g); return h.role = "alert", h.class = [s.value, a.value, n.class, `${r.value}-show-help`], R(wr, Y(Y({}, ur(`${r.value}-show-help`)), {}, { onAfterEnter: () => e.onErrorVisibleChanged(!0), onAfterLeave: () => e.onErrorVisibleChanged(!1) }), { default: () => [xr(R($r, Y(Y({}, h), {}, { tag: "div" }), { default: () => [(f = e.errors) === null || f === void 0 ? void 0 : f.map((y, $) => R("div", { key: $, class: l.value ? `${a.value}-${l.value}` : "" }, [y]))] }), [[Fr, !!(!((v = e.errors) === null || v === void 0) && v.length)]])] }); }; } }), cl = Le({ compatConfig: { MODE: 3 }, slots: Object, inheritAttrs: !1, props: ["prefixCls", "errors", "hasFeedback", "onDomErrorVisibleChange", "wrapperCol", "help", "extra", "status", "marginBottom", "onErrorVisibleChanged"], setup(e, t) { let { slots: n } = t; const r = vt(), { wrapperCol: i } = r, a = M({}, r); return delete a.labelCol, delete a.wrapperCol, Ln(a), el({ prefixCls: C(() => e.prefixCls), status: C(() => e.status) }), () => { var o, l, s; const { prefixCls: v, wrapperCol: f, marginBottom: g, onErrorVisibleChanged: h, help: y = (o = n.help) === null || o === void 0 ? void 0 : o.call(n), errors: $ = an((l = n.errors) === null || l === void 0 ? void 0 : l.call(n)), // hasFeedback, // status, extra: d = (s = n.extra) === null || s === void 0 ? void 0 : s.call(n) } = e, b = `${v}-item`, m = f || (i == null ? void 0 : i.value) || {}, P = xe(`${b}-control`, m.class); return R(mn, Y(Y({}, m), {}, { class: P }), { default: () => { var u; return R(qe, null, [R("div", { class: `${b}-control-input` }, [R("div", { class: `${b}-control-input-content` }, [(u = n.default) === null || u === void 0 ? void 0 : u.call(n)])]), g !== null || $.length ? R("div", { style: { display: "flex", flexWrap: "nowrap" } }, [R(fl, { errors: $, help: y, class: `${b}-explain-connected`, onErrorVisibleChanged: h }, null), !!g && R("div", { style: { width: 0, height: `${g}px` } }, null)]) : null, d ? R("div", { class: `${b}-extra` }, [d]) : null]); } }); }; } }); function dl(e) { const t = re(e.value.slice()); let n = null; return Ke(() => { clearTimeout(n), n = setTimeout(() => { t.value = e.value; }, e.value.length ? 0 : 10); }), t; } lt("success", "warning", "error", "validating", ""); const ml = { success: fr, warning: cr, error: dr, validating: mr }; function ze(e, t, n) { let r = e; const i = t; let a = 0; try { for (let o = i.length; a < o - 1 && !(!r && !n); ++a) { const l = i[a]; if (l in r) r = r[l]; else { if (n) throw Error("please transfer a valid name path to form item!"); break; } } if (n && !r) throw Error("please transfer a valid name path to form item!"); } catch (o) { console.error("please transfer a valid name path to form item!"); } return { o: r, k: i[a], v: r ? r[i[a]] : void 0 }; } const gl = () => ({ htmlFor: String, prefixCls: String, label: ge.any, help: ge.any, extra: ge.any, labelCol: { type: Object }, wrapperCol: { type: Object }, hasFeedback: { type: Boolean, default: !1 }, colon: { type: Boolean, default: void 0 }, labelAlign: String, prop: { type: [String, Number, Array] }, name: { type: [String, Number, Array] }, rules: [Array, Object], autoLink: { type: Boolean, default: !0 }, required: { type: Boolean, default: void 0 }, validateFirst: { type: Boolean, default: void 0 }, validateStatus: ge.oneOf(lt("", "success", "warning", "error", "validating")), validateTrigger: { type: [String, Array] }, messageVariables: { type: Object }, hidden: Boolean, noStyle: Boolean, tooltip: String }); let hl = 0; const vl = "form_item", pl = Le({ compatConfig: { MODE: 3 }, name: "AFormItem", inheritAttrs: !1, __ANT_NEW_FORM_ITEM: !0, props: gl(), slots: Object, setup(e, t) { let { slots: n, attrs: r, expose: i } = t; Ue(e.prop === void 0, "`prop` is deprecated. Please use `name` instead."); const a = `form-item-${++hl}`, { prefixCls: o } = on("form", e), [l, s] = yt(o), v = re(), f = vt(), g = C(() => e.name || e.prop), h = re([]), y = re(!1), $ = re(), d = C(() => { const p = g.value; return tt(p); }), b = C(() => { if (d.value.length) { const p = f.name.value, T = d.value.join("_"); return p ? `${p}_${T}` : `${vl}_${T}`; } else return; }), m = () => { const p = f.model.value; if (!(!p || !g.value)) return ze(p, d.value, !0).v; }, P = C(() => m()), u = re(Pe(P.value)), c = C(() => { let p = e.validateTrigger !== void 0 ? e.validateTrigger : f.validateTrigger.value; return p = p === void 0 ? "change" : p, ae(p); }), w = C(() => { let p = f.rules.value; const T = e.rules, V = e.required !== void 0 ? { required: !!e.required, trigger: c.value } : [], W = ze(p, d.value); p = p ? W.o[W.k] || W.v : []; const B = [].concat(T || p || []); return eo(B, (X) => X.required) ? B : B.concat(V); }), E = C(() => { const p = w.value; let T = !1; return p && p.length && p.every((V) => V.required ? (T = !0, !1) : !0), T || e.required; }), F = re(); Ke(() => { F.value = e.validateStatus; }); const O = C(() => { let p = {}; return typeof e.label == "string" ? p.label = e.label : e.name && (p.label = String(e.name)), e.messageVariables && (p = M(M({}, p), e.messageVariables)), p; }), j = (p) => { if (d.value.length === 0) return; const { validateFirst: T = !1 } = e, { triggerName: V } = p || {}; let W = w.value; if (V && (W = W.filter((X) => { const { trigger: te } = X; return !te && !c.value.length ? !0 : ae(te || c.value).includes(V); })), !W.length) return Promise.resolve(); const B = _n(d.value, P.value, W, M({ validateMessages: f.validateMessages.value }, p), T, O.value); return F.value = "validating", h.value = [], B.catch((X) => X).then(function() { let X = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; if (F.value === "validating") { const te = X.filter((ne) => ne && ne.errors.length); F.value = te.length ? "error" : "success", h.value = te.map((ne) => ne.errors), f.onValidate(g.value, !h.value.length, h.value.length ? Xe(h.value[0]) : null); } }), B; }, I = () => { j({ triggerName: "blur" }); }, L = () => { if (y.value) { y.value = !1; return; } j({ triggerName: "change" }); }, _ = () => { F.value = e.validateStatus, y.value = !1, h.value = []; }, A = () => { var p; F.value = e.validateStatus, y.value = !0, h.value = []; const T = f.model.value || {}, V = P.value, W = ze(T, d.value, !0); Array.isArray(V) ? W.o[W.k] = [].concat((p = u.value) !== null && p !== void 0 ? p : []) : W.o[W.k] = u.value, cn(() => { y.value = !1; }); }, H = C(() => e.htmlFor === void 0 ? b.value : e.htmlFor), Z = () => { const p = H.value; if (!p || !$.value) return; const T = $.value.$el.querySelector(`[id="${p}"]`); T && T.focus && T.focus(); }; i({ onFieldBlur: I, onFieldChange: L, clearValidate: _, resetField: A }), Tr({ id: b, onFieldBlur: () => { e.autoLink && I(); }, onFieldChange: () => { e.autoLink && L(); }, clearValidate: _ }, C(() => !!(e.autoLink && f.model.value && g.value))); let U = !1; ue(g, (p) => { p ? U || (U = !0, f.addField(a, { fieldValue: P, fieldId: b, fieldName: g, resetField: A, clearValidate: _, namePath: d, validateRules: j, rules: w })) : (U = !1, f.removeField(a)); }, { immediate: !0 }), Or(() => { f.removeField(a); }); const x = dl(h), S = C(() => e.validateStatus !== void 0 ? e.validateStatus : x.value.length ? "error" : F.value), N = C(() => ({ [`${o.value}-item`]: !0, [s.value]: !0, // Status [`${o.value}-item-has-feedback`]: S.value && e.hasFeedback, [`${o.value}-item-has-success`]: S.value === "success", [`${o.value}-item-has-warning`]: S.value === "warning", [`${o.value}-item-has-error`]: S.value === "error", [`${o.value}-item-is-validating`]: S.value === "validating", [`${o.value}-item-hidden`]: e.hidden })), z = fn({}); Ir.useProvide(z), Ke(() => { let p; if (e.hasFeedback) { const T = S.value && ml[S.value]; p = T ? R("span", { class: xe(`${o.value}-item-feedback-icon`, `${o.value}-item-feedback-icon-${S.value}`) }, [R(T, null, null)]) : null; } M(z, { status: S.value, hasFeedback: e.hasFeedback, feedbackIcon: p, isFormItemInput: !0 }); }); const K = re(null), J = re(!1), ie = () => { if (v.value) { const p = getComputedStyle(v.value); K.value = parseInt(p.marginBottom, 10); } }; Ar(() => { ue(J, () => { J.value && ie(); }, { flush: "post", immediate: !0 }); }); const Q = (p) => { p || (K.value = null); }; return () => { var p, T; if (e.noStyle) return (p = n.default) === null || p === void 0 ? void 0 : p.call(n); const V = (T = e.help) !== null && T !== void 0 ? T : n.help ? an(n.help()) : null, W = !!(V != null && Array.isArray(V) && V.length || x.value.length); return J.value = W, l(R("div", { class: [N.value, W ? `${o.value}-item-with-help` : "", r.class], ref: v }, [R(Er, Y(Y({}, r), {}, { class: `${o.value}-item-row`, key: "row" }), { default: () => { var B, X; return R(qe, null, [R(pt, Y(Y({}, e), {}, { htmlFor: H.value, required: E.value, requiredMark: f.requiredMark.value, prefixCls: o.value, onClick: Z, label: e.label }), { label: n.label, tooltip: n.tooltip }), R(cl, Y(Y({}, e), {}, { errors: V != null ? ae(V) : x.value, marginBottom: K.value, prefixCls: o.value, status: S.value, ref: $, help: V, extra: (B = e.extra) !== null && B !== void 0 ? B : (X = n.extra) === null || X === void 0 ? void 0 : X.call(n), onErrorVisibleChanged: Q }), { default: n.default })]); } }), !!K.value && R("div", { class: `${o.value}-margin-offset`, style: { marginBottom: `-${K.value}px` } }, null)])); }; } }); function Rn(e) { let t = !1, n = e.length; const r = []; return e.length ? new Promise((i, a) => { e.forEach((o, l) => { o.catch((s) => (t = !0, s)).then((s) => { n -= 1, r[l] = s, !(n > 0) && (t && a(r), i(r)); }); }); }) : Promise.resolve([]); } function Kt(e) { let t = !1; return e && e.length && e.every((n) => n.required ? (t = !0, !1) : !0), t; } function Xt(e) { return e == null ? [] : Array.isArray(e) ? e : [e]; } function Ge(e, t, n) { let r = e; t = t.replace(/\[(\w+)\]/g, ".$1"), t = t.replace(/^\./, ""); const i = t.split("."); let a = 0; for (let o = i.length; a < o - 1 && !(!r && !n); ++a) { const l = i[a]; if (l in r) r = r[l]; else { if (n) throw new Error("please transfer a valid name path to validate!"); break; } } return { o: r, k: i[a], v: r ? r[i[a]] : null, isValid: r && i[a] in r }; } function yl(e) { let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : st({}), n = arguments.length > 2 ? arguments[2] : void 0; const r = Pe(oe(e)), i = fn({}), a = re([]), o = (u) => { M(oe(e), M(M({}, Pe(r)), u)), cn(() => { Object.keys(i).forEach((c) => { i[c] = { autoLink: !1, required: Kt(oe(t)[c]) }; }); }); }, l = function() { let u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], c = arguments.length > 1 ? arguments[1] : void 0; return c.length ? u.filter((w) => { const E = Xt(w.trigger || "change"); return io(E, c).length; }) : u; }; let s = null; const v = function(u) { let c = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, w = arguments.length > 2 ? arguments[2] : void 0; const E = [], F = {}; for (let I = 0; I < u.length; I++) { const L = u[I], _ = Ge(oe(e), L, w); if (!_.isValid) continue; F[L] = _.v; const A = l(oe(t)[L], Xt(c && c.trigger)); A.length && E.push(f(L, _.v, A, c || {}).then(() => ({ name: L, errors: [], warnings: [] })).catch((H) => { const Z = [], U = []; return H.forEach((x) => { let { rule: { warningOnly: S }, errors: N } = x; S ? U.push(...N) : Z.push(...N); }), Z.length ? Promise.reject({ name: L, errors: Z, warnings: U }) : { name: L, errors: Z, warnings: U }; })); } const O = Rn(E); s = O; const j = O.then(() => s === O ? Promise.resolve(F) : Promise.reject([])).catch((I) => { const L = I.filter((_) => _ && _.errors.length); return L.length ? Promise.reject({ values: F, errorFields: L, outOfDate: s !== O }) : Promise.resolve(F); }); return j.catch((I) => I), j; }, f = function(u, c, w) { let E = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const F = _n([u], c, w, M({ validateMessages: Ve }, E), !!E.validateFirst); return i[u] ? (i[u].validateStatus = "validating", F.catch((O) => O).then(function() { let O = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; var j; if (i[u].validateStatus === "validating") { const I = O.filter((L) => L && L.errors.length); i[u].validateStatus = I.length ? "error" : "success", i[u].help = I.length ? I.map((L) => L.errors) : null, (j = n == null ? void 0 : n.onValidate) === null || j === void 0 || j.call(n, u, !I.length, I.length ? Xe(i[u].help[0]) : null); } }), F) : F.catch((O) => O); }, g = (u, c) => { let w = [], E = !0; u ? Array.isArray(u) ? w = u : w = [u] : (E = !1, w = a.value); const F = v(w, c || {}, E); return F.catch((O) => O), F; }, h = (u) => { let c = []; u ? Array.isArray(u) ? c = u : c = [u] : c = a.value, c.forEach((w) => { i[w] && M(i[w], { validateStatus: "", help: null }); }); }, y = (u) => { const c = { autoLink: !1 }, w = [], E = Array.isArray(u) ? u : [u]; for (let F = 0; F < E.length; F++) { const O = E[F]; (O == null ? void 0 : O.validateStatus) === "error" && (c.validateStatus = "error", O.help && w.push(O.help)), c.required = c.required || (O == null ? void 0 : O.required); } return c.help = w, c; }; let $ = r, d = !0; const b = (u) => { const c = []; a.value.forEach((w) => { const E = Ge(u, w, !1), F = Ge($, w, !1); (d && (n == null ? void 0 : n.immediate) && E.isValid || !ln(E.v, F.v)) && c.push(w); }), g(c, { trigger: "change" }), d = !1, $ = Pe(Xe(u)); }, m = n == null ? void 0 : n.debounce; let P = !0; return ue(t, () => { a.value = t ? Object.keys(oe(t)) : [], !P && n && n.validateOnRuleChange && g(), P = !1; }, { deep: !0, immediate: !0 }), ue(a, () => { const u = {}; a.value.forEach((c) => { u[c] = M({}, i[c], { autoLink: !1, required: Kt(oe(t)[c]) }), delete i[c]; }); for (const c in i) Object.prototype.hasOwnProperty.call(i, c) && delete i[c]; M(i, u); }, { immediate: !0 }), ue(e, m && m.wait ? Pr(b, m.wait, co(m, ["wait"])) : b, { immediate: n && !!n.immediate, deep: !0 }), { modelRef: e, rulesRef: t, initialModel: r, validateInfos: i, resetFields: o, validate: g, validateField: f, mergeValidateInfo: y, clearValidate: h }; } const bl = () => ({ layout: ge.oneOf(lt("horizontal", "inline", "vertical")), labelCol: Se(), wrapperCol: Se(), colon: pe(), labelAlign: xt(), labelWrap: pe(), prefixCls: String, requiredMark: $t([String, Boolean]), /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */ hideRequiredMark: pe(), model: ge.object, rules: Se(), validateMessages: Se(), validateOnRuleChange: pe(), // 提交失败自动滚动到第一个错误字段 scrollToFirstError: yr(), onSubmit: ce(), name: String, validateTrigger: $t([String, Array]), size: xt(), disabled: pe(), onValuesChange: ce(), onFieldsChange: ce(), onFinish: ce(), onFinishFailed: ce(), onValidate: ce() }); function wl(e, t) { return ln(ae(e), ae(t)); } const le = Le({ compatConfig: { MODE: 3 }, name: "AForm", inheritAttrs: !1, props: gr(bl(), { layout: "horizontal", hideRequiredMark: !1, colon: !0 }), Item: pl, useForm: yl, // emits: ['finishFailed', 'submit', 'finish', 'validate'], setup(e, t) { let { emit: n, slots: r, expose: i, attrs: a } = t; const { prefixCls: o, direction: l, form: s, size: v, disabled: f } = on("form", e), g = C(() => e.requiredMark === "" || e.requiredMark), h = C(() => { var x; return g.value !== void 0 ? g.value : s && ((x = s.value) === null || x === void 0 ? void 0 : x.requiredMark) !== void 0 ? s.value.requiredMark : !e.hideRequiredMark; }); hr(v), vr(f); const y = C(() => { var x, S; return (x = e.colon) !== null && x !== void 0 ? x : (S = s.value) === null || S === void 0 ? void 0 : S.colon; }), { validateMessages: $ } = pr(), d = C(() => M(M(M({}, Ve), $.value), e.validateMessages)), [b, m] = yt(o), P = C(() => xe(o.value, { [`${o.value}-${e.layout}`]: !0, [`${o.value}-hide-required-mark`]: h.value === !1, [`${o.value}-rtl`]: l.value === "rtl", [`${o.value}-${v.value}`]: v.value }, m.value)), u = st(), c = {}, w = (x, S) => { c[x] = S; }, E = (x) => { delete c[x]; }, F = (x) => { const S = !!x, N = S ? ae(x).map(tt) : []; return S ? Object.values(c).filter((z) => N.findIndex((K) => wl(K, z.fieldName.value)) > -1) : Object.values(c); }, O = (x) => { if (!e.model) { We(!1, "Form", "model is required for resetFields to work."); return; } F(x).forEach((S) => { S.resetField(); }); }, j = (x) => { F(x).forEach((S) => { S.clearValidate(); }); }, I = (x) => { const { scrollToFirstError: S } = e; if (n("finishFailed", x), S && x.errorFields.length) { let N = {}; typeof S == "object" && (N = S), _(x.errorFields[0].name, N); } }, L = function() { return Z(...arguments); }, _ = function(x) { let S = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const N = F(x ? [x] : void 0); if (N.length) { const z = N[0].fieldId.value, K = z ? document.getElementById(z) : null; K && jr(K, M({ scrollMode: "if-needed", block: "nearest" }, S)); } }, A = function() { let x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0; if (x === !0) { const S = []; return Object.values(c).forEach((N) => { let { namePath: z } = N; S.push(z.value); }), Gt(e.model, S); } else return Gt(e.model, x); }, H = (x, S) => { if (We(!(x instanceof Function), "Form", "validateFields/validateField/validate not support callback, please use promise instead"), !e.model) return We(!1, "Form", "model is required for validateFields to work."), Promise.reject("Form `model` is required for validateFields to work."); const N = !!x, z = N ? ae(x).map(tt) : [], K = []; Object.values(c).forEach((Q) => { var p; if (N || z.push(Q.namePath.value), !(!((p = Q.rules) === null || p === void 0) && p.value.length)) return; const T = Q.namePath.value; if (!N || Ko(z, T)) { const V = Q.validateRules(M({ validateMessages: d.value }, S)); K.push(V.then(() => ({ name: T, errors: [], warnings: [] })).catch((W) => { const B = [], X = []; return W.forEach((te) => { let { rule: { warningOnly: ne }, errors: ve } = te; ne ? X.push(...ve) : B.push(...ve); }), B.length ? Promise.reject({ name: T, errors: B, warnings: X }) : { name: T, errors: B, warnings: X }; })); } }); const J = Rn(K); u.value = J; const ie = J.then(() => u.value === J ? Promise.resolve(A(z)) : Promise.reject([])).catch((Q) => { const p = Q.filter((T) => T && T.errors.length); return Promise.reject({ values: A(z), errorFields: p, outOfDate: u.value !== J }); }); return ie.catch((Q) => Q), ie; }, Z = function() { return H(...arguments); }, U = (x) => { x.preventDefault(), x.stopPropagation(), n("submit", x), e.model && H().then((N) => { n("finish", N); }).catch((N) => { I(N); }); }; return i({ resetFields: O, clearValidate: j, validateFields: H, getFieldsValue: A, validate: L, scrollToField: _ }), Ln({ model: C(() => e.model), name: C(() => e.name), labelAlign: C(() => e.labelAlign), labelCol: C(() => e.labelCol), labelWrap: C(() => e.labelWrap), wrapperCol: C(() => e.wrapperCol), vertical: C(() => e.layout === "vertical"), colon: y, requiredMark: h, validateTrigger: C(() => e.validateTrigger), rules: C(() => e.rules), addField: w, removeField: E, onValidate: (x, S, N) => { n("validate", x, S, N); }, validateMessages: d }), ue(() => e.rules, () => { e.validateOnRuleChange && H(); }), () => { var x; return b(R("form", Y(Y({}, a), {}, { onSubmit: U, class: [P.value, a.class] }), [(x = r.default) === null || x === void 0 ? void 0 : x.call(r)])); }; } }); le.useInjectFormItemContext = qr; le.ItemRest = Ye; le.install = function(e) { return e.component(le.name, le), e.component(le.Item.name, le.Item), e.component(Ye.name, Ye), e; }; export { Cn as b };