import { jsxs } from "react/jsx-runtime";
import { Box, Text } from "ink";
function GenericRenderer({ content, maxLines = 15 }) {
  const text = content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
  if (!text) {
    return null;
  }
  const lines = text.split("\n").filter((line) => line.trim().length > 0);
  const displayLines = lines.slice(0, maxLines);
  const truncated = lines.length > maxLines;
  if (lines.length === 1 && lines[0]) {
    const line = lines[0];
    return /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
      "  \u23BF ",
      line.slice(0, 80),
      line.length > 80 ? "..." : ""
    ] });
  }
  return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
    /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
      "  \u23BF ",
      displayLines.length,
      " lines"
    ] }),
    displayLines.map((line, i) => /* @__PURE__ */ jsxs(Text, { color: "gray", wrap: "truncate", children: [
      "  \u23BF ",
      line
    ] }, i)),
    truncated && /* @__PURE__ */ jsxs(Text, { color: "gray", children: [
      "  \u23BF ",
      "... ",
      lines.length - maxLines,
      " more lines"
    ] })
  ] });
}
export {
  GenericRenderer
};
