import B from "./index-objectWithoutPropertiesLoose.js";
import s from "./index-extends.js";
import * as W from "react";
import o from "./index-_virtual16.js";
import { clsx as O } from "./index-clsx.js";
import j from "./index-styled.js";
import { getTypographyUtilityClass as M } from "./index-typographyClasses.js";
import { jsx as N } from "react/jsx-runtime";
import { useDefaultProps as P } from "./index-DefaultPropsProvider.js";
import C from "./index-extendSxProp.js";
import u from "./index-capitalize.js";
import R from "./index-composeClasses.js";
const _ = ["align", "className", "component", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"], D = (a) => {
  const {
    align: r,
    gutterBottom: t,
    noWrap: e,
    paragraph: i,
    variant: n,
    classes: m
  } = a, p = {
    root: ["root", n, a.align !== "inherit" && `align${u(r)}`, t && "gutterBottom", e && "noWrap", i && "paragraph"]
  };
  return R(p, M, m);
}, E = j("span", {
  name: "MuiTypography",
  slot: "Root",
  overridesResolver: (a, r) => {
    const {
      ownerState: t
    } = a;
    return [r.root, t.variant && r[t.variant], t.align !== "inherit" && r[`align${u(t.align)}`], t.noWrap && r.noWrap, t.gutterBottom && r.gutterBottom, t.paragraph && r.paragraph];
  }
})(({
  theme: a,
  ownerState: r
}) => s({
  margin: 0
}, r.variant === "inherit" && {
  // Some elements, like <button> on Chrome have default font that doesn't inherit, reset this.
  font: "inherit"
}, r.variant !== "inherit" && a.typography[r.variant], r.align !== "inherit" && {
  textAlign: r.align
}, r.noWrap && {
  overflow: "hidden",
  textOverflow: "ellipsis",
  whiteSpace: "nowrap"
}, r.gutterBottom && {
  marginBottom: "0.35em"
}, r.paragraph && {
  marginBottom: 16
})), y = {
  h1: "h1",
  h2: "h2",
  h3: "h3",
  h4: "h4",
  h5: "h5",
  h6: "h6",
  subtitle1: "h6",
  subtitle2: "h6",
  body1: "p",
  body2: "p",
  inherit: "p"
}, U = {
  primary: "primary.main",
  textPrimary: "text.primary",
  secondary: "secondary.main",
  textSecondary: "text.secondary",
  error: "error.main"
}, V = (a) => U[a] || a, $ = /* @__PURE__ */ W.forwardRef(function(r, t) {
  const e = P({
    props: r,
    name: "MuiTypography"
  }), i = V(e.color), n = C(s({}, e, {
    color: i
  })), {
    align: m = "inherit",
    className: p,
    component: h,
    gutterBottom: d = !1,
    noWrap: b = !1,
    paragraph: l = !1,
    variant: c = "body1",
    variantMapping: g = y
  } = n, v = B(n, _), f = s({}, n, {
    align: m,
    color: i,
    className: p,
    component: h,
    gutterBottom: d,
    noWrap: b,
    paragraph: l,
    variant: c,
    variantMapping: g
  }), x = h || (l ? "p" : g[c] || y[c]) || "span", T = D(f);
  return /* @__PURE__ */ N(E, s({
    as: x,
    ref: t,
    ownerState: f,
    className: O(T.root, p)
  }, v));
});
process.env.NODE_ENV !== "production" && ($.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * Set the text-align on the component.
   * @default 'inherit'
   */
  align: o.oneOf(["center", "inherit", "justify", "left", "right"]),
  /**
   * The content of the component.
   */
  children: o.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: o.object,
  /**
   * @ignore
   */
  className: o.string,
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: o.elementType,
  /**
   * If `true`, the text will have a bottom margin.
   * @default false
   */
  gutterBottom: o.bool,
  /**
   * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.
   *
   * Note that text overflow can only happen with block or inline-block level elements
   * (the element needs to have a width in order to overflow).
   * @default false
   */
  noWrap: o.bool,
  /**
   * If `true`, the element will be a paragraph element.
   * @default false
   */
  paragraph: o.bool,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
  /**
   * Applies the theme typography styles.
   * @default 'body1'
   */
  variant: o.oneOfType([o.oneOf(["body1", "body2", "button", "caption", "h1", "h2", "h3", "h4", "h5", "h6", "inherit", "overline", "subtitle1", "subtitle2"]), o.string]),
  /**
   * The component maps the variant prop to a range of different HTML element types.
   * For instance, subtitle1 to `<h6>`.
   * If you wish to change that mapping, you can provide your own.
   * Alternatively, you can use the `component` prop.
   * @default {
   *   h1: 'h1',
   *   h2: 'h2',
   *   h3: 'h3',
   *   h4: 'h4',
   *   h5: 'h5',
   *   h6: 'h6',
   *   subtitle1: 'h6',
   *   subtitle2: 'h6',
   *   body1: 'p',
   *   body2: 'p',
   *   inherit: 'p',
   * }
   */
  variantMapping: o.object
});
export {
  E as TypographyRoot,
  $ as default
};
