text: import _extends from "@babel/runtime/helpers/esm/extends";
  import * as React from 'react';
  import PropTypes from 'prop-types';
  import PopperUnstyled from '@mui/base/PopperUnstyled';
  import { chainPropTypes, HTMLElementType, refType } from '@mui/utils';
  import { useThemeWithoutDefault as useTheme } from '@mui/system';
  import { jsx as _jsx } from "react/jsx-runtime";
  
  /**
   *
   * Demos:
   *
   * - [Autocomplete](https://mui.com/components/autocomplete/)
   * - [Menus](https://mui.com/components/menus/)
   * - [Popper](https://mui.com/components/popper/)
   *
   * API:
   *
   * - [Popper API](https://mui.com/api/popper/)
   */
  const Popper = /*#__PURE__*/React.forwardRef(function Popper(props, ref) {
    const theme = useTheme();
    return /*#__PURE__*/_jsx(PopperUnstyled, _extends({
      direction: theme?.direction
    }, props, {
      ref: ref
    }));
  });
  
  function resolveAnchorEl(anchorEl) {
    return typeof anchorEl === 'function' ? anchorEl() : anchorEl;
  }
  
  process.env.NODE_ENV !== "production" ? Popper.propTypes
  /* remove-proptypes */
  = {
    // ----------------------------- Warning --------------------------------
    // | These PropTypes are generated from the TypeScript type definitions |
    // |     To update them edit TypeScript types and run "yarn proptypes"  |
    // ----------------------------------------------------------------------
  
    /**
     * An HTML element, [virtualElement](https://popper.js.org/docs/v2/virtual-elements/),
     * or a function that returns either.
     * It's used to set the position of the popper.
     * The return value will passed as the reference object of the Popper instance.
     */
    anchorEl: chainPropTypes(PropTypes.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]), props => {
      if (props.open) {
        const resolvedAnchorEl = resolveAnchorEl(props.anchorEl);
  
        if (resolvedAnchorEl && resolvedAnchorEl.nodeType === 1) {
          const box = resolvedAnchorEl.getBoundingClientRect();
  
          if (process.env.NODE_ENV !== 'test' && box.top === 0 && box.left === 0 && box.right === 0 && box.bottom === 0) {
            return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'The anchor element should be part of the document layout.', "Make sure the element is present in the document or that it's not display none."].join('\n'));
          }
        } else if (!resolvedAnchorEl || typeof resolvedAnchorEl.getBoundingClientRect !== 'function' || resolvedAnchorEl.contextElement != null && resolvedAnchorEl.contextElement.nodeType !== 1) {
          return new Error(['MUI: The `anchorEl` prop provided to the component is invalid.', 'It should be an HTML element instance or a virtualElement ', '(https://popper.js.org/docs/v2/virtual-elements/).'].join('\n'));
        }
      }
  
      return null;
    }),
  
    /**
     * Popper render function or node.
     */
    children: PropTypes
    /* @typescript-to-proptypes-ignore */
    .oneOfType([PropTypes.node, PropTypes.func]),
  
    /**
     * An HTML element or function that returns one.
     * The `container` will have the portal children appended to it.
     *
     * By default, it uses the body of the top-level document object,
     * so it's simply `document.body` most of the time.
     */
    container: PropTypes
    /* @typescript-to-proptypes-ignore */
    .oneOfType([HTMLElementType, PropTypes.func]),
  
    /**
     * The `children` will be under the DOM hierarchy of the parent component.
     * @default false
     */
    disablePortal: PropTypes.bool,
  
    /**
     * Always keep the children in the DOM.
     * This prop can be useful in SEO situation or
     * when you want to maximize the responsiveness of the Popper.
     * @default false
     */
    keepMounted: PropTypes.bool,
  
    /**
     * Popper.js is based on a "plugin-like" architecture,
     * most of its features are fully encapsulated "modifiers".
     *
     * A modifier is a function that is called each time Popper.js needs to
     * compute the position of the popper.
     * For this reason, modifiers should be very performant to avoid bottlenecks.
     * To learn how to create a modifier, [read the modifiers documentation](https://popper.js.org/docs/v2/modifiers/).
     */
    modifiers: PropTypes.arrayOf(PropTypes.shape({
      data: PropTypes.object,
      effect: PropTypes.func,
      enabled: PropTypes.bool,
      fn: PropTypes.func,
      name: PropTypes.any.isRequired,
      options: PropTypes.object,
      phase: PropTypes.oneOf(['afterMain', 'afterRead', 'afterWrite', 'beforeMain', 'beforeRead', 'beforeWrite', 'main', 'read', 'write']),
      requires: PropTypes.arrayOf(PropTypes.string),
      requiresIfExists: PropTypes.arrayOf(PropTypes.string)
    })),
  
    /**
     * If `true`, the component is shown.
     */
    open: PropTypes.bool.isRequired,
  
    /**
     * Popper placement.
     * @default 'bottom'
     */
    placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
  
    /**
     * Options provided to the [`Popper.js`](https://popper.js.org/docs/v2/constructors/#options) instance.
     * @default {}
     */
    popperOptions: PropTypes.shape({
      modifiers: PropTypes.array,
      onFirstUpdate: PropTypes.func,
      placement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
      strategy: PropTypes.oneOf(['absolute', 'fixed'])
    }),
  
    /**
     * A ref that points to the used popper instance.
     */
    popperRef: refType,
  
    /**
     * Help supporting a react-transition-group/Transition component.
     * @default false
     */
    transition: PropTypes.bool
  } : void 0;
  export default Popper;