import { jsxs as a, jsx as o } from "react/jsx-runtime";
import e from "@mui/material/Box";
import { C as f } from "./CopyButton-DPBgL0K8.js";
function v({
  children: r,
  lineNumbers: p = !1,
  copy: i = !0,
  maxHeight: d,
  wrap: l = !1,
  sx: t
}) {
  const s = r.split(`
`);
  return /* @__PURE__ */ a(
    e,
    {
      sx: {
        position: "relative",
        bgcolor: "var(--ov-bg-surface-inset)",
        borderRadius: "6px",
        border: "1px solid var(--ov-border-muted)",
        overflow: "hidden",
        ...typeof t == "object" && !Array.isArray(t) ? t : {}
      },
      children: [
        i && /* @__PURE__ */ o(e, { sx: { position: "absolute", top: 4, right: 4, zIndex: 1 }, children: /* @__PURE__ */ o(f, { value: r, size: "xs" }) }),
        /* @__PURE__ */ o(
          e,
          {
            component: "pre",
            sx: {
              m: 0,
              p: 1.5,
              pr: i ? 5 : 1.5,
              overflow: "auto",
              maxHeight: d,
              fontFamily: "var(--ov-font-mono)",
              fontSize: "13px",
              lineHeight: 1.6,
              color: "var(--ov-fg-default)",
              whiteSpace: l ? "pre-wrap" : "pre",
              wordBreak: l ? "break-all" : void 0
            },
            children: p ? /* @__PURE__ */ o(e, { component: "table", sx: { borderCollapse: "collapse", width: "100%" }, children: /* @__PURE__ */ o("tbody", { children: s.map((c, n) => /* @__PURE__ */ a("tr", { children: [
              /* @__PURE__ */ o(
                e,
                {
                  component: "td",
                  sx: {
                    pr: 2,
                    pl: 0.5,
                    textAlign: "right",
                    userSelect: "none",
                    color: "var(--ov-fg-faint)",
                    width: 1,
                    whiteSpace: "nowrap",
                    verticalAlign: "top"
                  },
                  children: n + 1
                }
              ),
              /* @__PURE__ */ o("td", { children: c })
            ] }, n)) }) }) : /* @__PURE__ */ o("code", { children: r })
          }
        )
      ]
    }
  );
}
v.displayName = "CodeBlock";
export {
  v as C
};
