import { g as E, m as _, d as g, u as k, bh as T, bi as w, c as F, _ as C, be as N } from "./index2.js"; import { inject as D, computed as $, provide as V, defineComponent as L, ref as R, onMounted as X, onBeforeUnmount as H, createVNode as W } from "vue"; import { u as K } from "./useFlexGapSupport.js"; const B = Symbol("rowContextKey"), P = (e) => { V(B, e); }, J = () => D(B, { gutter: $(() => { }), wrap: $(() => { }), supportFlexGap: $(() => { }) }), U = (e) => { const { componentCls: t } = e; return { // Grid system [t]: { display: "flex", flexFlow: "row wrap", minWidth: 0, "&::before, &::after": { display: "flex" }, "&-no-wrap": { flexWrap: "nowrap" }, // The origin of the X-axis "&-start": { justifyContent: "flex-start" }, // The center of the X-axis "&-center": { justifyContent: "center" }, // The opposite of the X-axis "&-end": { justifyContent: "flex-end" }, "&-space-between": { justifyContent: "space-between" }, "&-space-around ": { justifyContent: "space-around" }, "&-space-evenly ": { justifyContent: "space-evenly" }, // Align at the top "&-top": { alignItems: "flex-start" }, // Align at the center "&-middle": { alignItems: "center" }, "&-bottom": { alignItems: "flex-end" } } }; }, q = (e) => { const { componentCls: t } = e; return { // Grid system [t]: { position: "relative", maxWidth: "100%", // Prevent columns from collapsing when empty minHeight: 1 } }; }, Q = (e, t) => { const { componentCls: u, gridColumns: a } = e, o = {}; for (let s = a; s >= 0; s--) s === 0 ? (o[`${u}${t}-${s}`] = { display: "none" }, o[`${u}-push-${s}`] = { insetInlineStart: "auto" }, o[`${u}-pull-${s}`] = { insetInlineEnd: "auto" }, o[`${u}${t}-push-${s}`] = { insetInlineStart: "auto" }, o[`${u}${t}-pull-${s}`] = { insetInlineEnd: "auto" }, o[`${u}${t}-offset-${s}`] = { marginInlineEnd: 0 }, o[`${u}${t}-order-${s}`] = { order: 0 }) : (o[`${u}${t}-${s}`] = { display: "block", flex: `0 0 ${s / a * 100}%`, maxWidth: `${s / a * 100}%` }, o[`${u}${t}-push-${s}`] = { insetInlineStart: `${s / a * 100}%` }, o[`${u}${t}-pull-${s}`] = { insetInlineEnd: `${s / a * 100}%` }, o[`${u}${t}-offset-${s}`] = { marginInlineStart: `${s / a * 100}%` }, o[`${u}${t}-order-${s}`] = { order: s }); return o; }, O = (e, t) => Q(e, t), Y = (e, t, u) => ({ [`@media (min-width: ${t}px)`]: g({}, O(e, u)) }), Z = E("Grid", (e) => [U(e)]), z = E("Grid", (e) => { const t = _(e, { gridColumns: 24 // Row is divided into 24 parts in Grid }), u = { "-sm": t.screenSMMin, "-md": t.screenMDMin, "-lg": t.screenLGMin, "-xl": t.screenXLMin, "-xxl": t.screenXXLMin }; return [q(t), O(t, ""), O(t, "-xs"), Object.keys(u).map((a) => Y(t, u[a], a)).reduce((a, o) => g(g({}, a), o), {})]; }), ee = () => ({ align: N([String, Object]), justify: N([String, Object]), prefixCls: String, gutter: N([Number, Array, Object], 0), wrap: { type: Boolean, default: void 0 } }), ue = L({ compatConfig: { MODE: 3 }, name: "ARow", inheritAttrs: !1, props: ee(), setup(e, t) { let { slots: u, attrs: a } = t; const { prefixCls: o, direction: s } = k("row", e), [G, y] = Z(o); let b; const v = T(), x = R({ xs: !0, sm: !0, md: !0, lg: !0, xl: !0, xxl: !0 }), S = R({ xs: !1, sm: !1, md: !1, lg: !1, xl: !1, xxl: !1 }), h = (n) => $(() => { if (typeof e[n] == "string") return e[n]; if (typeof e[n] != "object") return ""; for (let r = 0; r < w.length; r++) { const l = w[r]; if (!S.value[l]) continue; const i = e[n][l]; if (i !== void 0) return i; } return ""; }), f = h("align"), p = h("justify"), d = K(); X(() => { b = v.value.subscribe((n) => { S.value = n; const r = e.gutter || 0; (!Array.isArray(r) && typeof r == "object" || Array.isArray(r) && (typeof r[0] == "object" || typeof r[1] == "object")) && (x.value = n); }); }), H(() => { v.value.unsubscribe(b); }); const m = $(() => { const n = [void 0, void 0], { gutter: r = 0 } = e; return (Array.isArray(r) ? r : [r, void 0]).forEach((i, M) => { if (typeof i == "object") for (let A = 0; A < w.length; A++) { const I = w[A]; if (x.value[I] && i[I] !== void 0) { n[M] = i[I]; break; } } else n[M] = i; }), n; }); P({ gutter: m, supportFlexGap: d, wrap: $(() => e.wrap) }); const j = $(() => F(o.value, { [`${o.value}-no-wrap`]: e.wrap === !1, [`${o.value}-${p.value}`]: p.value, [`${o.value}-${f.value}`]: f.value, [`${o.value}-rtl`]: s.value === "rtl" }, a.class, y.value)), c = $(() => { const n = m.value, r = {}, l = n[0] != null && n[0] > 0 ? `${n[0] / -2}px` : void 0, i = n[1] != null && n[1] > 0 ? `${n[1] / -2}px` : void 0; return l && (r.marginLeft = l, r.marginRight = l), d.value ? r.rowGap = `${n[1]}px` : i && (r.marginTop = i, r.marginBottom = i), r; }); return () => { var n; return G(W("div", C(C({}, a), {}, { class: j.value, style: g(g({}, c.value), a.style) }), [(n = u.default) === null || n === void 0 ? void 0 : n.call(u)])); }; } }); function te(e) { return typeof e == "number" ? `${e} ${e} auto` : /^\d+(\.\d+)?(px|em|rem|%)$/.test(e) ? `0 0 ${e}` : e; } const ne = () => ({ span: [String, Number], order: [String, Number], offset: [String, Number], push: [String, Number], pull: [String, Number], xs: { type: [String, Number, Object], default: void 0 }, sm: { type: [String, Number, Object], default: void 0 }, md: { type: [String, Number, Object], default: void 0 }, lg: { type: [String, Number, Object], default: void 0 }, xl: { type: [String, Number, Object], default: void 0 }, xxl: { type: [String, Number, Object], default: void 0 }, prefixCls: String, flex: [String, Number] }), re = ["xs", "sm", "md", "lg", "xl", "xxl"], ae = L({ compatConfig: { MODE: 3 }, name: "ACol", inheritAttrs: !1, props: ne(), setup(e, t) { let { slots: u, attrs: a } = t; const { gutter: o, supportFlexGap: s, wrap: G } = J(), { prefixCls: y, direction: b } = k("col", e), [v, x] = z(y), S = $(() => { const { span: f, order: p, offset: d, push: m, pull: j } = e, c = y.value; let n = {}; return re.forEach((r) => { let l = {}; const i = e[r]; typeof i == "number" ? l.span = i : typeof i == "object" && (l = i || {}), n = g(g({}, n), { [`${c}-${r}-${l.span}`]: l.span !== void 0, [`${c}-${r}-order-${l.order}`]: l.order || l.order === 0, [`${c}-${r}-offset-${l.offset}`]: l.offset || l.offset === 0, [`${c}-${r}-push-${l.push}`]: l.push || l.push === 0, [`${c}-${r}-pull-${l.pull}`]: l.pull || l.pull === 0, [`${c}-rtl`]: b.value === "rtl" }); }), F(c, { [`${c}-${f}`]: f !== void 0, [`${c}-order-${p}`]: p, [`${c}-offset-${d}`]: d, [`${c}-push-${m}`]: m, [`${c}-pull-${j}`]: j }, n, a.class, x.value); }), h = $(() => { const { flex: f } = e, p = o.value, d = {}; if (p && p[0] > 0) { const m = `${p[0] / 2}px`; d.paddingLeft = m, d.paddingRight = m; } if (p && p[1] > 0 && !s.value) { const m = `${p[1] / 2}px`; d.paddingTop = m, d.paddingBottom = m; } return f && (d.flex = te(f), G.value === !1 && !d.minWidth && (d.minWidth = 0)), d; }); return () => { var f; return v(W("div", C(C({}, a), {}, { class: S.value, style: [h.value, a.style] }), [(f = u.default) === null || f === void 0 ? void 0 : f.call(u)])); }; } }); export { ue as A, ae as C };