import { jsxs as m, jsx as t } from "react/jsx-runtime";
import { useSortable as O } from "@dnd-kit/sortable";
import { CSS as R } from "@dnd-kit/utilities";
import { noop as $, isEmpty as j } from "es-toolkit/compat";
import H from "../../../utils/classNames.js";
import _ from "../../checkbox/Checkbox.js";
import B from "../../collapse/Collapse.js";
import { TableSettingsColumnDetails as E } from "./TableSettingsColumnDetails.js";
import { TableSettingsColumnButtons as F } from "./TableSettingsColumnButtons.js";
const P = 1e3, U = (o, e, l) => o ? !(l[e] || "").toLowerCase().includes(o.toLowerCase()) : !1, Z = (o) => {
  const {
    column: e,
    orderIndex: l,
    columnLabels: i,
    autoLabel: d,
    disabledColumns: c = [],
    columnOrder: u,
    hiddenColumns: p = [],
    columnSearchValue: a,
    columnsDetails: b,
    columnLabelStrings: f = {},
    openColumnsDetails: r = {},
    onColumnWidthChange: C,
    onResetColumnWidth: h,
    onMoveColumn: g,
    onOpenDetails: N,
    onToggleHideColumn: x = $,
    isActive: S = !1,
    className: v
  } = o, n = !j(a), { attributes: D, listeners: L, setNodeRef: T, setActivatorNodeRef: k, transform: w, transition: W } = O({
    id: e,
    disabled: n
  }), y = {
    transform: R.Transform.toString(w),
    transition: W
  }, A = U(a, e, f), I = H("table-settings-item", v), s = b[e];
  return /* @__PURE__ */ m(
    "li",
    {
      hidden: A,
      className: I,
      ref: T,
      style: y,
      children: [
        /* @__PURE__ */ m("div", { className: "table-settings-item-header user-select-none", ref: k, children: [
          /* @__PURE__ */ t("div", { className: "CheckboxWrapper display-flex align-items-center padding-left-2 margin-top--3", children: /* @__PURE__ */ t(
            _,
            {
              checked: !p.includes(e),
              onClick: (M) => {
                x(e), M.stopPropagation();
              },
              disabled: c.includes(e)
            }
          ) }),
          /* @__PURE__ */ t(
            "div",
            {
              className: `table-settings-item-label ${n ? "no-drag" : ""}`,
              "data-key": e,
              ...D,
              ...L,
              children: i?.[e]
            }
          ),
          s && /* @__PURE__ */ t("div", { className: "column-width-label", children: s.width ? `${s.width}px` : d }),
          /* @__PURE__ */ t(
            F,
            {
              column: e,
              index: l,
              columnDetails: s,
              columnOrder: u,
              openColumnsDetails: r,
              disabled: n,
              onMoveColumn: g,
              onOpenDetails: N
            }
          )
        ] }),
        s && !S && /* @__PURE__ */ t(B, { open: !!r[e], children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
          E,
          {
            ...s,
            column: e,
            maxColumnWidth: P,
            onColumnWidthChange: C,
            onResetColumnWidth: h
          }
        ) }) })
      ]
    },
    `table-settings-item-${e}`
  );
};
export {
  Z as default,
  U as filterColumns
};
//# sourceMappingURL=TableSettingsListItem.js.map
