import { jsx as h } from "react/jsx-runtime";
import r from "prop-types";
import { Typography as u, useTheme as b } from "@mui/material";
import n from "lodash/isUndefined";
import { mergeProps as x } from "../Util/index.js";
import e from "../Colors/themes/default.js";
import { styled as w } from "../Theme/index.js";
const c = {
  error: {
    color: e.common.white,
    backgroundColor: e.error.main
  },
  warning: {
    color: e.common.white,
    backgroundColor: e.warning.main
  },
  success: {
    color: e.common.white,
    backgroundColor: e.success.main
  },
  primary: {
    color: e.common.white,
    backgroundColor: e.primary.main
  },
  reverse: {
    color: "#fff",
    backgroundColor: "#222"
  }
};
function p({ ...s }) {
  const o = Object.assign({}, s);
  n(o.type) && (o.type = "primary"), n(o.content) && (o.content = ""), n(o.style) && (o.style = {}), n(o.className) && (o.className = "");
  const m = x(o, p, ["style"]), { type: t, content: l, children: y, style: f, className: g, ...d } = m, { palette: i } = b(), a = Object.assign({}, c[t] || c.primary, f);
  return i[t] && Object.assign(a, {
    color: i[t].contrastText || e.common.white,
    backgroundColor: i[t].main
  }), /* @__PURE__ */ h(j, { component: "span", className: g, style: a, ...d, children: l || y });
}
p.propTypes = {
  children: r.any.isRequired,
  type: r.oneOf(Object.keys(c)),
  content: r.string,
  className: r.string,
  style: r.oneOfType([r.object, r.string])
};
const j = w(u)`
  && {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 2px 10px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    font-weight: 500;
    border-radius: ${({ theme: s }) => s.shape.borderRadius * 0.5}px;
  }
`;
export {
  p as default
};
