import { j as jsxRuntimeExports } from "./doenetml-cB_aZGJ5.js";
import React__default from "react";
import { u as useDoenetRenderer } from "./useDoenetRenderer-DN3Z9CW3.js";
import { a as addCommasForCompositeRanges } from "./composites-DgtFnuE1.js";
const cell = React__default.memo(function Cell(props) {
  let { id, SVs, children } = useDoenetRenderer(props);
  if (SVs.hidden) {
    return null;
  }
  let properties = {
    style: { padding: "3px 10px" }
  };
  if (SVs.colSpan !== 1) {
    properties.colSpan = SVs.colSpan;
  }
  if (SVs.halign !== null) {
    properties.style.textAlign = SVs.halign;
  }
  if (SVs.bottom !== "none") {
    properties.style.borderBottomStyle = "solid";
    if (SVs.bottom === "minor") {
      properties.style.borderBottomWidth = "thin";
    } else if (SVs.bottom === "medium") {
      properties.style.borderBottomWidth = "medium";
    } else {
      properties.style.borderBottomWidth = "thick";
    }
  }
  if (SVs.right !== "none") {
    properties.style.borderRightStyle = "solid";
    if (SVs.right === "minor") {
      properties.style.borderRightWidth = "thin";
    } else if (SVs.right === "medium") {
      properties.style.borderRightWidth = "medium";
    } else {
      properties.style.borderRightWidth = "thick";
    }
  }
  if (SVs._compositeReplacementActiveRange) {
    children = addCommasForCompositeRanges({
      children,
      compositeReplacementActiveRange: SVs._compositeReplacementActiveRange,
      startInd: 0,
      endInd: children.length - 1
    });
  }
  let content = children;
  if (content.length === 0) {
    content = SVs.text;
  }
  if (SVs.inHeader) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("th", { id, ...properties, children: content });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { id, ...properties, children: content });
  }
});
export {
  cell as default
};
