import h from "./index-objectWithoutPropertiesLoose.js";
import p from "./index-extends.js";
import * as v from "react";
import { onSpaceOrEnter as x } from "./index-utils11.js";
import { getPickersMonthUtilityClass as k, pickersMonthClasses as i } from "./index-pickersMonthClasses.js";
import { jsx as g } from "react/jsx-runtime";
import C from "./index-useEnhancedEffect2.js";
import P from "./index-composeClasses.js";
import R from "./index-styled.js";
import F from "./index-Typography.js";
import { alpha as M } from "./index-colorManipulator.js";
const E = ["disabled", "onSelect", "selected", "value", "tabIndex", "hasFocus", "onFocus", "onBlur"], I = (o) => {
  const {
    classes: e,
    selected: r
  } = o;
  return P({
    root: ["root", r && "selected"]
  }, k, e);
}, S = R(F, {
  name: "PrivatePickersMonth",
  slot: "Root",
  overridesResolver: (o, e) => [e.root, {
    [`&.${i.selected}`]: e.selected
  }]
})(({
  theme: o
}) => p({
  flex: "1 0 33.33%",
  display: "flex",
  alignItems: "center",
  justifyContent: "center",
  color: "unset",
  backgroundColor: "transparent",
  border: 0,
  outline: 0
}, o.typography.subtitle1, {
  margin: "8px 0",
  height: 36,
  borderRadius: 18,
  cursor: "pointer",
  "&:focus, &:hover": {
    backgroundColor: M(o.palette.action.active, o.palette.action.hoverOpacity)
  },
  "&:disabled": {
    pointerEvents: "none",
    color: o.palette.text.secondary
  },
  [`&.${i.selected}`]: {
    color: o.palette.primary.contrastText,
    backgroundColor: o.palette.primary.main,
    "&:focus, &:hover": {
      backgroundColor: o.palette.primary.dark
    }
  }
})), d = () => {
}, N = (o) => {
  const {
    disabled: e,
    onSelect: r,
    selected: s,
    value: n,
    tabIndex: u,
    hasFocus: c,
    onFocus: m = d,
    onBlur: f = d
  } = o, b = h(o, E), y = I(o), a = () => {
    r(n);
  }, l = v.useRef(null);
  return C(() => {
    if (c) {
      var t;
      (t = l.current) == null || t.focus();
    }
  }, [c]), /* @__PURE__ */ g(S, p({
    ref: l,
    component: "button",
    type: "button",
    className: y.root,
    tabIndex: u,
    onClick: a,
    onKeyDown: x(a),
    color: s ? "primary" : void 0,
    variant: s ? "h5" : "subtitle1",
    disabled: e,
    onFocus: (t) => m(t, n),
    onBlur: (t) => f(t, n)
  }, b));
};
export {
  N as PickersMonth
};
