import { jsxs as f, jsx as r } from "react/jsx-runtime";
import { Typography as x } from "@mui/material";
import { styled as y } from "../Theme/index.js";
import { withDeprecated as u } from "../Util/deprecate.js";
function g({
  children: t,
  maxWidth: s,
  startChars: n = 5,
  endChars: e = 5,
  scaleFactor: o = 0.45,
  style: a = void 0,
  fontType: l = "normal",
  ...p
}) {
  if (typeof t != "string")
    return null;
  const i = l === "monospace", c = i ? `${n}ch` : `${o * (n + 3)}em`, d = i ? `${e}ch` : `${o * e}em`, m = Object.assign(
    i ? { fontFamily: '"Courier New", Courier, monospace' } : {},
    { fontSize: "inherit", color: "inherit", fontWeight: "inherit", maxWidth: s },
    a
  ), [h, w] = [
    t.slice(0, t.length - e),
    t.slice(t.length - e)
  ];
  return /* @__PURE__ */ f($, { component: "span", style: m, startwidth: c, endwidth: d, ...p, children: [
    /* @__PURE__ */ r("span", { className: "start-part", children: h }),
    /* @__PURE__ */ r("span", { className: "end-part", children: w })
  ] });
}
const T = u(g, { name: "TextCollapse" }), $ = y(x)`
  display: inline-flex;
  align-items: center;
  justify-content: start;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;

  .start-part,
  .end-part {
    display: inline-block;
    vertical-align: bottom;
    white-space: nowrap;
    overflow: hidden;
  }
  .start-part {
    max-width: calc(100% - ${(t) => t.endwidth});
    min-width: ${(t) => t.startwidth};
    text-overflow: ellipsis;
  }
  .end-part {
    max-width: calc(100% - ${(t) => t.startwidth});
    direction: rtl;
  }
`;
export {
  T as default
};
