import F from "./index-objectWithoutPropertiesLoose.js";
import s from "./index-extends.js";
import * as g from "react";
import r from "./index-_virtual16.js";
import { clsx as I } from "./index-clsx.js";
import { c as u } from "./index-colorManipulator2.js";
import x from "./index-styled.js";
import v, { getButtonUtilityClass as M } from "./index-buttonClasses.js";
import L from "./index-ButtonGroupContext.js";
import D from "./index-ButtonGroupButtonContext.js";
import { jsx as R, jsxs as G } from "react/jsx-runtime";
import H from "./index-resolveProps.js";
import { useDefaultProps as U } from "./index-DefaultPropsProvider.js";
import n from "./index-capitalize.js";
import A from "./index-composeClasses.js";
import q from "./index-ButtonBase.js";
import J from "./index-rootShouldForwardProp.js";
const K = ["children", "color", "component", "className", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"], Q = (o) => {
  const {
    color: a,
    disableElevation: i,
    fullWidth: l,
    size: t,
    variant: c,
    classes: e
  } = o, b = {
    root: ["root", c, `${c}${n(a)}`, `size${n(t)}`, `${c}Size${n(t)}`, `color${n(a)}`, i && "disableElevation", l && "fullWidth"],
    label: ["label"],
    startIcon: ["icon", "startIcon", `iconSize${n(t)}`],
    endIcon: ["icon", "endIcon", `iconSize${n(t)}`]
  }, f = A(b, M, e);
  return s({}, e, f);
}, k = (o) => s({}, o.size === "small" && {
  "& > *:nth-of-type(1)": {
    fontSize: 18
  }
}, o.size === "medium" && {
  "& > *:nth-of-type(1)": {
    fontSize: 20
  }
}, o.size === "large" && {
  "& > *:nth-of-type(1)": {
    fontSize: 22
  }
}), X = x(q, {
  shouldForwardProp: (o) => J(o) || o === "classes",
  name: "MuiButton",
  slot: "Root",
  overridesResolver: (o, a) => {
    const {
      ownerState: i
    } = o;
    return [a.root, a[i.variant], a[`${i.variant}${n(i.color)}`], a[`size${n(i.size)}`], a[`${i.variant}Size${n(i.size)}`], i.color === "inherit" && a.colorInherit, i.disableElevation && a.disableElevation, i.fullWidth && a.fullWidth];
  }
})(({
  theme: o,
  ownerState: a
}) => {
  var i, l;
  const t = o.palette.mode === "light" ? o.palette.grey[300] : o.palette.grey[800], c = o.palette.mode === "light" ? o.palette.grey.A100 : o.palette.grey[700];
  return s({}, o.typography.button, {
    minWidth: 64,
    padding: "6px 16px",
    borderRadius: (o.vars || o).shape.borderRadius,
    transition: o.transitions.create(["background-color", "box-shadow", "border-color", "color"], {
      duration: o.transitions.duration.short
    }),
    "&:hover": s({
      textDecoration: "none",
      backgroundColor: o.vars ? `rgba(${o.vars.palette.text.primaryChannel} / ${o.vars.palette.action.hoverOpacity})` : u.alpha(o.palette.text.primary, o.palette.action.hoverOpacity),
      // Reset on touch devices, it doesn't add specificity
      "@media (hover: none)": {
        backgroundColor: "transparent"
      }
    }, a.variant === "text" && a.color !== "inherit" && {
      backgroundColor: o.vars ? `rgba(${o.vars.palette[a.color].mainChannel} / ${o.vars.palette.action.hoverOpacity})` : u.alpha(o.palette[a.color].main, o.palette.action.hoverOpacity),
      // Reset on touch devices, it doesn't add specificity
      "@media (hover: none)": {
        backgroundColor: "transparent"
      }
    }, a.variant === "outlined" && a.color !== "inherit" && {
      border: `1px solid ${(o.vars || o).palette[a.color].main}`,
      backgroundColor: o.vars ? `rgba(${o.vars.palette[a.color].mainChannel} / ${o.vars.palette.action.hoverOpacity})` : u.alpha(o.palette[a.color].main, o.palette.action.hoverOpacity),
      // Reset on touch devices, it doesn't add specificity
      "@media (hover: none)": {
        backgroundColor: "transparent"
      }
    }, a.variant === "contained" && {
      backgroundColor: o.vars ? o.vars.palette.Button.inheritContainedHoverBg : c,
      boxShadow: (o.vars || o).shadows[4],
      // Reset on touch devices, it doesn't add specificity
      "@media (hover: none)": {
        boxShadow: (o.vars || o).shadows[2],
        backgroundColor: (o.vars || o).palette.grey[300]
      }
    }, a.variant === "contained" && a.color !== "inherit" && {
      backgroundColor: (o.vars || o).palette[a.color].dark,
      // Reset on touch devices, it doesn't add specificity
      "@media (hover: none)": {
        backgroundColor: (o.vars || o).palette[a.color].main
      }
    }),
    "&:active": s({}, a.variant === "contained" && {
      boxShadow: (o.vars || o).shadows[8]
    }),
    [`&.${v.focusVisible}`]: s({}, a.variant === "contained" && {
      boxShadow: (o.vars || o).shadows[6]
    }),
    [`&.${v.disabled}`]: s({
      color: (o.vars || o).palette.action.disabled
    }, a.variant === "outlined" && {
      border: `1px solid ${(o.vars || o).palette.action.disabledBackground}`
    }, a.variant === "contained" && {
      color: (o.vars || o).palette.action.disabled,
      boxShadow: (o.vars || o).shadows[0],
      backgroundColor: (o.vars || o).palette.action.disabledBackground
    })
  }, a.variant === "text" && {
    padding: "6px 8px"
  }, a.variant === "text" && a.color !== "inherit" && {
    color: (o.vars || o).palette[a.color].main
  }, a.variant === "outlined" && {
    padding: "5px 15px",
    border: "1px solid currentColor"
  }, a.variant === "outlined" && a.color !== "inherit" && {
    color: (o.vars || o).palette[a.color].main,
    border: o.vars ? `1px solid rgba(${o.vars.palette[a.color].mainChannel} / 0.5)` : `1px solid ${u.alpha(o.palette[a.color].main, 0.5)}`
  }, a.variant === "contained" && {
    color: o.vars ? (
      // this is safe because grey does not change between default light/dark mode
      o.vars.palette.text.primary
    ) : (i = (l = o.palette).getContrastText) == null ? void 0 : i.call(l, o.palette.grey[300]),
    backgroundColor: o.vars ? o.vars.palette.Button.inheritContainedBg : t,
    boxShadow: (o.vars || o).shadows[2]
  }, a.variant === "contained" && a.color !== "inherit" && {
    color: (o.vars || o).palette[a.color].contrastText,
    backgroundColor: (o.vars || o).palette[a.color].main
  }, a.color === "inherit" && {
    color: "inherit",
    borderColor: "currentColor"
  }, a.size === "small" && a.variant === "text" && {
    padding: "4px 5px",
    fontSize: o.typography.pxToRem(13)
  }, a.size === "large" && a.variant === "text" && {
    padding: "8px 11px",
    fontSize: o.typography.pxToRem(15)
  }, a.size === "small" && a.variant === "outlined" && {
    padding: "3px 9px",
    fontSize: o.typography.pxToRem(13)
  }, a.size === "large" && a.variant === "outlined" && {
    padding: "7px 21px",
    fontSize: o.typography.pxToRem(15)
  }, a.size === "small" && a.variant === "contained" && {
    padding: "4px 10px",
    fontSize: o.typography.pxToRem(13)
  }, a.size === "large" && a.variant === "contained" && {
    padding: "8px 22px",
    fontSize: o.typography.pxToRem(15)
  }, a.fullWidth && {
    width: "100%"
  });
}, ({
  ownerState: o
}) => o.disableElevation && {
  boxShadow: "none",
  "&:hover": {
    boxShadow: "none"
  },
  [`&.${v.focusVisible}`]: {
    boxShadow: "none"
  },
  "&:active": {
    boxShadow: "none"
  },
  [`&.${v.disabled}`]: {
    boxShadow: "none"
  }
}), Y = x("span", {
  name: "MuiButton",
  slot: "StartIcon",
  overridesResolver: (o, a) => {
    const {
      ownerState: i
    } = o;
    return [a.startIcon, a[`iconSize${n(i.size)}`]];
  }
})(({
  ownerState: o
}) => s({
  display: "inherit",
  marginRight: 8,
  marginLeft: -4
}, o.size === "small" && {
  marginLeft: -2
}, k(o))), Z = x("span", {
  name: "MuiButton",
  slot: "EndIcon",
  overridesResolver: (o, a) => {
    const {
      ownerState: i
    } = o;
    return [a.endIcon, a[`iconSize${n(i.size)}`]];
  }
})(({
  ownerState: o
}) => s({
  display: "inherit",
  marginRight: -4,
  marginLeft: 8
}, o.size === "small" && {
  marginRight: -2
}, k(o))), S = /* @__PURE__ */ g.forwardRef(function(a, i) {
  const l = g.useContext(L), t = g.useContext(D), c = H(l, a), e = U({
    props: c,
    name: "MuiButton"
  }), {
    children: b,
    color: f = "primary",
    component: y = "button",
    className: h,
    disabled: C = !1,
    disableElevation: O = !1,
    disableFocusRipple: z = !1,
    endIcon: m,
    focusVisibleClassName: T,
    fullWidth: N = !1,
    size: E = "medium",
    startIcon: $,
    type: B,
    variant: P = "text"
  } = e, W = F(e, K), d = s({}, e, {
    color: f,
    component: y,
    disabled: C,
    disableElevation: O,
    disableFocusRipple: z,
    fullWidth: N,
    size: E,
    type: B,
    variant: P
  }), p = Q(d), V = $ && /* @__PURE__ */ R(Y, {
    className: p.startIcon,
    ownerState: d,
    children: $
  }), j = m && /* @__PURE__ */ R(Z, {
    className: p.endIcon,
    ownerState: d,
    children: m
  }), _ = t || "";
  return /* @__PURE__ */ G(X, s({
    ownerState: d,
    className: I(l.className, p.root, h, _),
    component: y,
    disabled: C,
    focusRipple: !z,
    focusVisibleClassName: I(p.focusVisible, T),
    ref: i,
    type: B
  }, W, {
    classes: p,
    children: [V, b, j]
  }));
});
process.env.NODE_ENV !== "production" && (S.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The content of the component.
   */
  children: r.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: r.object,
  /**
   * @ignore
   */
  className: r.string,
  /**
   * The color of the component.
   * It supports both default and custom theme colors, which can be added as shown in the
   * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
   * @default 'primary'
   */
  color: r.oneOfType([r.oneOf(["inherit", "primary", "secondary", "success", "error", "info", "warning"]), r.string]),
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: r.elementType,
  /**
   * If `true`, the component is disabled.
   * @default false
   */
  disabled: r.bool,
  /**
   * If `true`, no elevation is used.
   * @default false
   */
  disableElevation: r.bool,
  /**
   * If `true`, the  keyboard focus ripple is disabled.
   * @default false
   */
  disableFocusRipple: r.bool,
  /**
   * If `true`, the ripple effect is disabled.
   *
   * ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
   * to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
   * @default false
   */
  disableRipple: r.bool,
  /**
   * Element placed after the children.
   */
  endIcon: r.node,
  /**
   * @ignore
   */
  focusVisibleClassName: r.string,
  /**
   * If `true`, the button will take up the full width of its container.
   * @default false
   */
  fullWidth: r.bool,
  /**
   * The URL to link to when the button is clicked.
   * If defined, an `a` element will be used as the root node.
   */
  href: r.string,
  /**
   * The size of the component.
   * `small` is equivalent to the dense button styling.
   * @default 'medium'
   */
  size: r.oneOfType([r.oneOf(["small", "medium", "large"]), r.string]),
  /**
   * Element placed before the children.
   */
  startIcon: r.node,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: r.oneOfType([r.arrayOf(r.oneOfType([r.func, r.object, r.bool])), r.func, r.object]),
  /**
   * @ignore
   */
  type: r.oneOfType([r.oneOf(["button", "reset", "submit"]), r.string]),
  /**
   * The variant to use.
   * @default 'text'
   */
  variant: r.oneOfType([r.oneOf(["contained", "outlined", "text"]), r.string])
});
export {
  S as default
};
