import { jsxs as R, jsx as m } from "react/jsx-runtime";
import { useSortable as A } from "@dnd-kit/sortable";
import k from "./TableHeaderCellContent.js";
import H from "./TableHeaderCellResizeHandle.js";
import { resolveAriaSort as w } from "./resolveAriaSort.js";
import { resolveHeaderCellClassName as D } from "./resolveHeaderCellClassName.js";
import { resolveHeaderCellStyle as N } from "./resolveHeaderCellStyle.js";
import { resolveAriaSpan as c, resolveAriaColIndex as L } from "../../shared/resolveTableAria.js";
const _ = (t) => {
  const {
    column: e,
    header: r,
    hideWhileDragging: a,
    htmlAttributes: u,
    isResizable: d,
    showSelectionColumn: l,
    stickyLeftColumnCount: C,
    stickyRightColumnCount: f
  } = t, i = C ?? 0, n = f ?? 0, s = e.columnKey ?? String(e.key), { attributes: g, listeners: p, setActivatorNodeRef: S, setNodeRef: v, transform: o, transition: b, isDragging: y } = A({
    id: s
  }), { role: T, ...h } = g, x = {
    ...h,
    ...p
  };
  return /* @__PURE__ */ R(
    "div",
    {
      ref: v,
      ...u,
      className: D(e, r, {
        isDraggable: !0,
        isDragging: y,
        isResizable: d,
        isStickyLeftColumn: i > 0 && e.columnStart <= i,
        isStickyRightColumn: n > 0 && e.columnStart + e.colSpan - 1 > r.totalColumnCount - n
      }),
      "data-column": s,
      role: "columnheader",
      "aria-colindex": L(e.columnStart, l),
      "aria-colspan": c(e.colSpan),
      "aria-rowindex": e.rowStart,
      "aria-rowspan": c(e.rowSpan),
      "aria-sort": w(e),
      style: N(e, l, {
        pointerEvents: a ? "none" : void 0,
        transform: a ? void 0 : o ? `translate3d(${o.x}px, ${o.y}px, 0)` : void 0,
        transition: b
      }),
      children: [
        /* @__PURE__ */ m(
          k,
          {
            ...t,
            dragActivatorProps: x,
            dragActivatorRef: S
          }
        ),
        /* @__PURE__ */ m(H, { ...t })
      ]
    }
  );
};
export {
  _ as default
};
//# sourceMappingURL=TableDraggableHeaderCell.js.map
