import O from "./index-objectWithoutPropertiesLoose.js";
import e from "./index-extends.js";
import * as x from "react";
import o from "./index-_virtual16.js";
import $ from "./index-useSnackbar.js";
import { getSnackbarUtilityClass as F } from "./index-snackbarClasses.js";
import { jsx as s } from "react/jsx-runtime";
import { useDefaultProps as I } from "./index-DefaultPropsProvider.js";
import q from "./index-useTheme.js";
import U from "./index-Grow.js";
import G from "./index-useSlotProps.js";
import { ClickAwayListener as V } from "./index-ClickAwayListener.js";
import X from "./index-SnackbarContent.js";
import a from "./index-capitalize.js";
import J from "./index-composeClasses.js";
import K from "./index-styled.js";
const Q = ["onEnter", "onExited"], Y = ["action", "anchorOrigin", "autoHideDuration", "children", "className", "ClickAwayListenerProps", "ContentProps", "disableWindowBlurListener", "message", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "open", "resumeHideDuration", "TransitionComponent", "transitionDuration", "TransitionProps"], Z = (t) => {
  const {
    classes: n,
    anchorOrigin: r
  } = t, i = {
    root: ["root", `anchorOrigin${a(r.vertical)}${a(r.horizontal)}`]
  };
  return J(i, F, n);
}, y = K("div", {
  name: "MuiSnackbar",
  slot: "Root",
  overridesResolver: (t, n) => {
    const {
      ownerState: r
    } = t;
    return [n.root, n[`anchorOrigin${a(r.anchorOrigin.vertical)}${a(r.anchorOrigin.horizontal)}`]];
  }
})(({
  theme: t,
  ownerState: n
}) => {
  const r = {
    left: "50%",
    right: "auto",
    transform: "translateX(-50%)"
  };
  return e({
    zIndex: (t.vars || t).zIndex.snackbar,
    position: "fixed",
    display: "flex",
    left: 8,
    right: 8,
    justifyContent: "center",
    alignItems: "center"
  }, n.anchorOrigin.vertical === "top" ? {
    top: 8
  } : {
    bottom: 8
  }, n.anchorOrigin.horizontal === "left" && {
    justifyContent: "flex-start"
  }, n.anchorOrigin.horizontal === "right" && {
    justifyContent: "flex-end"
  }, {
    [t.breakpoints.up("sm")]: e({}, n.anchorOrigin.vertical === "top" ? {
      top: 24
    } : {
      bottom: 24
    }, n.anchorOrigin.horizontal === "center" && r, n.anchorOrigin.horizontal === "left" && {
      left: 24,
      right: "auto"
    }, n.anchorOrigin.horizontal === "right" && {
      right: 24,
      left: "auto"
    })
  });
}), oo = /* @__PURE__ */ x.forwardRef(function(n, r) {
  const i = I({
    props: n,
    name: "MuiSnackbar"
  }), u = q(), C = {
    enter: u.transitions.duration.enteringScreen,
    exit: u.transitions.duration.leavingScreen
  }, {
    action: P,
    anchorOrigin: {
      vertical: p,
      horizontal: k
    } = {
      vertical: "bottom",
      horizontal: "left"
    },
    autoHideDuration: T = null,
    children: v,
    className: z,
    ClickAwayListenerProps: E,
    ContentProps: j,
    disableWindowBlurListener: D = !1,
    message: L,
    open: m,
    TransitionComponent: f = U,
    transitionDuration: d = C,
    TransitionProps: {
      onEnter: h,
      onExited: g
    } = {}
  } = i, w = O(i.TransitionProps, Q), S = O(i, Y), c = e({}, i, {
    anchorOrigin: {
      vertical: p,
      horizontal: k
    },
    autoHideDuration: T,
    disableWindowBlurListener: D,
    TransitionComponent: f,
    transitionDuration: d
  }), R = Z(c), {
    getRootProps: A,
    onClickAway: M
  } = $(e({}, c)), [N, b] = x.useState(!0), B = G({
    elementType: y,
    getSlotProps: A,
    externalForwardedProps: S,
    ownerState: c,
    additionalProps: {
      ref: r
    },
    className: [R.root, z]
  }), H = (l) => {
    b(!0), g && g(l);
  }, _ = (l, W) => {
    b(!1), h && h(l, W);
  };
  return !m && N ? null : /* @__PURE__ */ s(V, e({
    onClickAway: M
  }, E, {
    children: /* @__PURE__ */ s(y, e({}, B, {
      children: /* @__PURE__ */ s(f, e({
        appear: !0,
        in: m,
        timeout: d,
        direction: p === "top" ? "down" : "up",
        onEnter: _,
        onExited: H
      }, w, {
        children: v || /* @__PURE__ */ s(X, e({
          message: L,
          action: P
        }, j))
      }))
    }))
  }));
});
process.env.NODE_ENV !== "production" && (oo.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The action to display. It renders after the message, at the end of the snackbar.
   */
  action: o.node,
  /**
   * The anchor of the `Snackbar`.
   * On smaller screens, the component grows to occupy all the available width,
   * the horizontal alignment is ignored.
   * @default { vertical: 'bottom', horizontal: 'left' }
   */
  anchorOrigin: o.shape({
    horizontal: o.oneOf(["center", "left", "right"]).isRequired,
    vertical: o.oneOf(["bottom", "top"]).isRequired
  }),
  /**
   * The number of milliseconds to wait before automatically calling the
   * `onClose` function. `onClose` should then set the state of the `open`
   * prop to hide the Snackbar. This behavior is disabled by default with
   * the `null` value.
   * @default null
   */
  autoHideDuration: o.number,
  /**
   * Replace the `SnackbarContent` component.
   */
  children: o.element,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: o.object,
  /**
   * @ignore
   */
  className: o.string,
  /**
   * Props applied to the `ClickAwayListener` element.
   */
  ClickAwayListenerProps: o.object,
  /**
   * Props applied to the [`SnackbarContent`](/material-ui/api/snackbar-content/) element.
   */
  ContentProps: o.object,
  /**
   * If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
   * @default false
   */
  disableWindowBlurListener: o.bool,
  /**
   * When displaying multiple consecutive snackbars using a single parent-rendered
   * `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
   * For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
   * in place, and features like `autoHideDuration` could be affected.
   */
  key: () => null,
  /**
   * The message to display.
   */
  message: o.node,
  /**
   * @ignore
   */
  onBlur: o.func,
  /**
   * Callback fired when the component requests to be closed.
   * Typically `onClose` is used to set state in the parent component,
   * which is used to control the `Snackbar` `open` prop.
   * The `reason` parameter can optionally be used to control the response to `onClose`,
   * for example ignoring `clickaway`.
   *
   * @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
   * @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
   */
  onClose: o.func,
  /**
   * @ignore
   */
  onFocus: o.func,
  /**
   * @ignore
   */
  onMouseEnter: o.func,
  /**
   * @ignore
   */
  onMouseLeave: o.func,
  /**
   * If `true`, the component is shown.
   */
  open: o.bool,
  /**
   * The number of milliseconds to wait before dismissing after user interaction.
   * If `autoHideDuration` prop isn't specified, it does nothing.
   * If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
   * we default to `autoHideDuration / 2` ms.
   */
  resumeHideDuration: o.number,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
  /**
   * The component used for the transition.
   * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
   * @default Grow
   */
  TransitionComponent: o.elementType,
  /**
   * The duration for the transition, in milliseconds.
   * You may specify a single timeout for all transitions, or individually with an object.
   * @default {
   *   enter: theme.transitions.duration.enteringScreen,
   *   exit: theme.transitions.duration.leavingScreen,
   * }
   */
  transitionDuration: o.oneOfType([o.number, o.shape({
    appear: o.number,
    enter: o.number,
    exit: o.number
  })]),
  /**
   * Props applied to the transition element.
   * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
   * @default {}
   */
  TransitionProps: o.object
});
export {
  oo as default
};
