import * as t from "react";
import M from "../../../classnames/index.mjs";
import { matchScreen as V } from "../_util/responsiveObserver.mjs";
import "../config-provider/index.mjs";
import R from "../config-provider/hooks/useSize.mjs";
import T from "../grid/hooks/useBreakpoint.mjs";
import k from "./constant.mjs";
import A from "./DescriptionsContext.mjs";
import L from "./hooks/useItems.mjs";
import U from "./hooks/useRow.mjs";
import B from "./Item.mjs";
import F from "./Row.mjs";
import q from "./style/index.mjs";
import { ConfigContext as G } from "../config-provider/context.mjs";
var H = globalThis && globalThis.__rest || function(o, a) {
  var l = {};
  for (var e in o)
    Object.prototype.hasOwnProperty.call(o, e) && a.indexOf(e) < 0 && (l[e] = o[e]);
  if (o != null && typeof Object.getOwnPropertySymbols == "function")
    for (var r = 0, e = Object.getOwnPropertySymbols(o); r < e.length; r++)
      a.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, e[r]) && (l[e[r]] = o[e[r]]);
  return l;
};
const p = (o) => {
  const {
    prefixCls: a,
    title: l,
    extra: e,
    column: r,
    colon: b = !0,
    bordered: d,
    layout: v,
    children: x,
    className: C,
    rootClassName: O,
    style: g,
    size: N,
    labelStyle: f,
    contentStyle: u,
    items: E
  } = o, S = H(o, ["prefixCls", "title", "extra", "column", "colon", "bordered", "layout", "children", "className", "rootClassName", "style", "size", "labelStyle", "contentStyle", "items"]), {
    getPrefixCls: h,
    direction: j,
    descriptions: i
  } = t.useContext(G), s = h("descriptions", a), c = T(), w = t.useMemo(() => {
    var n;
    return typeof r == "number" ? r : (n = V(c, Object.assign(Object.assign({}, k), r))) !== null && n !== void 0 ? n : 3;
  }, [c, r]), $ = L(c, E, x), m = R(N), P = U(w, $), [_, z, D] = q(s), I = t.useMemo(() => ({
    labelStyle: f,
    contentStyle: u
  }), [f, u]);
  return _(/* @__PURE__ */ t.createElement(A.Provider, {
    value: I
  }, /* @__PURE__ */ t.createElement("div", Object.assign({
    className: M(s, i == null ? void 0 : i.className, {
      [`${s}-${m}`]: m && m !== "default",
      [`${s}-bordered`]: !!d,
      [`${s}-rtl`]: j === "rtl"
    }, C, O, z, D),
    style: Object.assign(Object.assign({}, i == null ? void 0 : i.style), g)
  }, S), (l || e) && /* @__PURE__ */ t.createElement("div", {
    className: `${s}-header`
  }, l && /* @__PURE__ */ t.createElement("div", {
    className: `${s}-title`
  }, l), e && /* @__PURE__ */ t.createElement("div", {
    className: `${s}-extra`
  }, e)), /* @__PURE__ */ t.createElement("div", {
    className: `${s}-view`
  }, /* @__PURE__ */ t.createElement("table", null, /* @__PURE__ */ t.createElement("tbody", null, P.map((n, y) => /* @__PURE__ */ t.createElement(F, {
    key: y,
    index: y,
    colon: b,
    prefixCls: s,
    vertical: v === "vertical",
    bordered: d,
    row: n
  }))))))));
};
process.env.NODE_ENV !== "production" && (p.displayName = "Descriptions");
p.Item = B;
const ie = p;
export {
  A as DescriptionsContext,
  ie as default
};
