import * as i from "react";
import E from "../../../classnames/index.mjs";
import "../config-provider/index.mjs";
import _ from "./RowContext.mjs";
import { useColStyle as R } from "./style/index.mjs";
import { ConfigContext as V } from "../config-provider/context.mjs";
var I = globalThis && globalThis.__rest || function(t, a) {
  var f = {};
  for (var o in t)
    Object.prototype.hasOwnProperty.call(t, o) && a.indexOf(o) < 0 && (f[o] = t[o]);
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
    for (var l = 0, o = Object.getOwnPropertySymbols(t); l < o.length; l++)
      a.indexOf(o[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, o[l]) && (f[o[l]] = t[o[l]]);
  return f;
};
function T(t) {
  return typeof t == "number" ? `${t} ${t} auto` : /^\d+(\.\d+)?(px|em|rem|%)$/.test(t) ? `0 0 ${t}` : t;
}
const W = ["xs", "sm", "md", "lg", "xl", "xxl"], g = /* @__PURE__ */ i.forwardRef((t, a) => {
  const {
    getPrefixCls: f,
    direction: o
  } = i.useContext(V), {
    gutter: l,
    wrap: y
  } = i.useContext(_), {
    prefixCls: C,
    span: u,
    order: $,
    offset: d,
    push: m,
    pull: h,
    className: O,
    children: j,
    flex: x,
    style: w
  } = t, b = I(t, ["prefixCls", "span", "order", "offset", "push", "pull", "className", "children", "flex", "style"]), r = f("col", C), [N, S, v] = R(r);
  let c = {};
  W.forEach((s) => {
    let e = {};
    const p = t[s];
    typeof p == "number" ? e.span = p : typeof p == "object" && (e = p || {}), delete b[s], c = Object.assign(Object.assign({}, c), {
      [`${r}-${s}-${e.span}`]: e.span !== void 0,
      [`${r}-${s}-order-${e.order}`]: e.order || e.order === 0,
      [`${r}-${s}-offset-${e.offset}`]: e.offset || e.offset === 0,
      [`${r}-${s}-push-${e.push}`]: e.push || e.push === 0,
      [`${r}-${s}-pull-${e.pull}`]: e.pull || e.pull === 0,
      [`${r}-${s}-flex-${e.flex}`]: e.flex || e.flex === "auto",
      [`${r}-rtl`]: o === "rtl"
    });
  });
  const P = E(r, {
    [`${r}-${u}`]: u !== void 0,
    [`${r}-order-${$}`]: $,
    [`${r}-offset-${d}`]: d,
    [`${r}-push-${m}`]: m,
    [`${r}-pull-${h}`]: h
  }, O, c, S, v), n = {};
  if (l && l[0] > 0) {
    const s = l[0] / 2;
    n.paddingLeft = s, n.paddingRight = s;
  }
  return x && (n.flex = T(x), y === !1 && !n.minWidth && (n.minWidth = 0)), N(/* @__PURE__ */ i.createElement("div", Object.assign({}, b, {
    style: Object.assign(Object.assign({}, n), w),
    className: P,
    ref: a
  }), j));
});
process.env.NODE_ENV !== "production" && (g.displayName = "Col");
const q = g;
export {
  q as default
};
