import { jsx as r, jsxs as p, Fragment as y } from "react/jsx-runtime";
import { alignItemsCenter as x, dFlex as C } from "./index-general.module.js";
import { classNames as u } from "./index-classNames.js";
import "react";
import { Text as v, TextTypes as F } from "./index-Text.js";
import n from "./index-TableCell.module.scss.js";
const m = (i) => {
  const {
    row: t = {},
    column: e,
    type: o
  } = i;
  let {
    options: a
  } = i;
  t && a && (a = {
    ...a
  }, a.postfixForColumn = t.postfixForColumn !== void 0 ? t.postfixForColumn ?? void 0 : a.postfixForColumn, a.prefixForColumn = t.prefixForColumn !== void 0 ? t.prefixForColumn ?? void 0 : a.prefixForColumn);
  const d = a ? (`${o}`, a[`${o}ForColumn`]) : null, l = d ? d.filter((f) => f.columnAlias == (e == null ? void 0 : e.alias) ? f : !1)[0] : null;
  let s = null;
  return l != null && l.value && typeof (l == null ? void 0 : l.value) == "object" && (s = () => r(y, {
    children: l.value
  })), l && l.value && l.columnAlias == (e == null ? void 0 : e.alias) ? r("div", {
    style: l.style ?? void 0,
    className: `optional-${o}`,
    children: typeof l.value == "function" && l.valueParam && t[l.valueParam] ? l.value(t[l.valueParam], t) : s ? r(s, {}) : null
  }) : null;
}, N = (i) => {
  const {
    row: t,
    column: e,
    options: o,
    rowIndex: a,
    colIndex: d,
    isBlurred: l,
    hasGreyBody: s
  } = i;
  return r("td", {
    className: u(n.tableCell, s ? n.tableGreyBody : void 0, e != null && e.sticky ? n.tableSticky : void 0, e != null && e.seamShadow ? n.tableSeamShadow : void 0),
    style: e != null && e.styles ? {
      ...e.styles
    } : void 0,
    children: p("div", {
      className: u(C, x, e != null && e.center ? n.tableCentered : void 0, e != null && e.end ? n.tableEnd : void 0),
      children: [r(m, {
        ...i,
        type: "prefix"
      }), e != null && e.alias ? typeof t[e.alias] == "object" ? t[e.alias] : r(v, {
        type: F.textHelp,
        isBlurred: l,
        translate: !1,
        className: n.value,
        children: t[e.alias]
      }) : null, r(m, {
        ...i,
        type: "postfix"
      })]
    })
  }, `${a}-${d}`);
};
export {
  N as TableCell,
  m as TableCellContent
};
