import { jsx as y } from "react/jsx-runtime";
import v from "@mui/material/Typography";
import { toCssColor as x } from "./types.js";
const u = {
  body: "body2",
  caption: "caption",
  overline: "overline",
  mono: "body2",
  code: "body2"
}, m = {
  xs: "0.625rem",
  sm: "0.75rem",
  md: "0.875rem",
  lg: "1rem",
  xl: "1.125rem"
}, g = {
  normal: 400,
  medium: 500,
  semibold: 600,
  bold: 700
};
function C({
  children: d,
  variant: o = "body",
  color: t,
  size: e,
  weight: i,
  truncate: p = !1,
  noWrap: l = !1,
  lines: r,
  muted: s = !1,
  inline: k = !1,
  component: c,
  sx: n
}) {
  const f = u[o], b = o === "mono" || o === "code", a = s ? "var(--ov-fg-muted)" : t ? x(t) : void 0;
  return /* @__PURE__ */ y(
    v,
    {
      variant: f,
      component: c ?? "span",
      noWrap: l || p,
      sx: {
        ...a && { color: a },
        ...e && { fontSize: m[e] },
        ...i && { fontWeight: g[i] },
        ...b && {
          fontFamily: "var(--ov-font-mono)",
          fontSize: e ? m[e] : o === "code" ? "0.85em" : void 0
        },
        ...o === "code" && {
          backgroundColor: "var(--ov-bg-surface-inset)",
          padding: "1px 4px",
          borderRadius: "3px"
        },
        ...r && r > 0 && {
          display: "-webkit-box",
          WebkitLineClamp: r,
          WebkitBoxOrient: "vertical",
          overflow: "hidden"
        },
        ...typeof n == "object" && !Array.isArray(n) ? n : {}
      },
      children: d
    }
  );
}
C.displayName = "Text";
export {
  C as T
};
