import "./Typography.css";
import { jsx } from "react/jsx-runtime";
import { Typography as Typography$1 } from "antd";
import { isBoolean } from "lodash";
import { useTheme } from "./kit/Theme/UI.js";
import "./kit/Theme/themeUtils.js";
import "./kit/Theme/themes.js";
const title = "Typography_title_38dad";
const large = "Typography_large_38dad";
const small = "Typography_small_38dad";
const body = "Typography_body_38dad";
const label = "Typography_label_38dad";
const code = "Typography_code_38dad";
const strong = "Typography_strong_38dad";
const inactive = "Typography_inactive_38dad";
const css = {
  title,
  "default": "Typography_default_38dad",
  large,
  small,
  "x-small": "Typography_x-small_38dad",
  body,
  label,
  code,
  strong,
  inactive
};
const TypographySize = {
  Default: "default",
  L: "large",
  S: "small",
  XS: "x-small"
};
const getEllipsisConfig = (themeClass, children, truncate, isText = false) => {
  let ellipsis;
  if (truncate) {
    ellipsis = {
      tooltip: truncate.tooltip ? {
        overlayClassName: themeClass,
        title: !isBoolean(truncate.tooltip) ? truncate.tooltip : children,
        trigger: ["hover", "focus"]
      } : false
    };
    if (!isText)
      ellipsis.rows = truncate.rows;
  }
  return ellipsis;
};
const getClassName = (element, size) => {
  const classes = [css[element]];
  if (size)
    classes.push(css[size]);
  return classes.join(" ");
};
const Title = ({
  children,
  truncate,
  size = "default"
}) => {
  const {
    themeSettings: { className: themeClass }
  } = useTheme();
  const classes = [getClassName("title", size), themeClass];
  const ellipsis = getEllipsisConfig(themeClass, children, truncate);
  return /* @__PURE__ */ jsx(
    Typography$1.Title,
    {
      className: classes.join(" "),
      ellipsis,
      tabIndex: (truncate == null ? void 0 : truncate.tooltip) ? 0 : void 0,
      children
    }
  );
};
const Body = ({
  children,
  truncate,
  inactive: inactive2,
  size = "default"
}) => {
  const {
    themeSettings: { className: themeClass }
  } = useTheme();
  const classes = [getClassName("body", size), themeClass];
  const ellipsis = getEllipsisConfig(themeClass, children, truncate);
  if (inactive2)
    classes.push(css.inactive);
  return /* @__PURE__ */ jsx(
    Typography$1.Paragraph,
    {
      className: classes.join(" "),
      ellipsis,
      tabIndex: (truncate == null ? void 0 : truncate.tooltip) ? 0 : void 0,
      children
    }
  );
};
const Label = ({
  children,
  truncate,
  inactive: inactive2,
  strong: strong2,
  size = "default"
}) => {
  const {
    themeSettings: { className: themeClass }
  } = useTheme();
  const classes = [getClassName("label", size), themeClass];
  const ellipsis = getEllipsisConfig(themeClass, children, truncate, true);
  if (strong2)
    classes.push(css.strong);
  if (inactive2)
    classes.push(css.inactive);
  return /* @__PURE__ */ jsx(
    Typography$1.Text,
    {
      className: classes.join(" "),
      ellipsis,
      tabIndex: (truncate == null ? void 0 : truncate.tooltip) ? 0 : void 0,
      children
    }
  );
};
const Code = ({ children, truncate }) => {
  const {
    themeSettings: { className: themeClass }
  } = useTheme();
  const classes = [getClassName("code"), themeClass];
  const ellipsis = getEllipsisConfig(themeClass, children, truncate);
  return /* @__PURE__ */ jsx(
    Typography$1.Paragraph,
    {
      className: classes.join(" "),
      ellipsis,
      tabIndex: (truncate == null ? void 0 : truncate.tooltip) ? 0 : void 0,
      children
    }
  );
};
const Typography = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  Body,
  Code,
  Label,
  Title,
  TypographySize
}, Symbol.toStringTag, { value: "Module" }));
export {
  Body as B,
  Code as C,
  Label as L,
  Typography as T,
  Title as a,
  TypographySize as b
};
