import { jsx as u, jsxs as x } from "react/jsx-runtime";
import r from "prop-types";
import i from "lodash/isUndefined";
import { CircularProgress as j } from "@mui/material";
import o from "../Colors/themes/default.js";
import { mergeProps as k } from "../Util/index.js";
const y = {
  did: {
    contained: { backgroundColor: o.did.primary, color: o.common.white },
    outlined: { borderColor: o.did.primary, color: o.did.primary }
  },
  reverse: {
    contained: { backgroundColor: "rgba(255, 255, 255, 0.9)", color: o.grey[900] },
    outlined: { borderColor: o.grey[900], color: o.grey[900] }
  }
};
function q(g) {
  function d({ ...c }) {
    const e = Object.assign({}, c);
    i(e.rounded) && (e.rounded = !1), i(e.size) && (e.size = "medium"), i(e.forwardedRef) && (e.forwardedRef = null), i(e.style) && (e.style = {});
    const s = k(e, d, ["style"]), { children: b, rounded: w, loading: f, disabled: h, style: R, forwardedRef: C, color: n, ...t } = s, z = h || f;
    let a = 16;
    switch (t.size) {
      case "small":
        a = 14;
        break;
      case "large":
        a = 18;
        break;
    }
    const m = y[n] && y[n][t.variant], p = Object.assign(
      {},
      {
        boxShadow: "none",
        textTransform: "capitalize",
        ...m
      },
      R
    );
    let l = t;
    return m || (l = { ...l, color: n }), w && (p.borderRadius = "100vw"), /* @__PURE__ */ x(g, { style: p, ref: C, disabled: z, ...l, children: [
      f && /* @__PURE__ */ u(j, { size: a, style: { marginRight: 5 } }),
      b
    ] });
  }
  return d.propTypes = {
    children: r.any.isRequired,
    style: r.oneOfType([r.object, r.string]),
    size: r.oneOf(["large", "medium", "small"]),
    forwardedRef: r.any,
    rounded: r.bool
  }, function({ ref: e, ...s }) {
    return /* @__PURE__ */ u(d, { ...s, forwardedRef: e });
  };
}
export {
  q as default
};
