{"version":3,"file":"Portal.mjs","sources":["../../../../../../../../node_modules/@mui/material/Portal/Portal.js"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { exactProp, HTMLElementType, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useForkRef as useForkRef, unstable_setRef as setRef, unstable_getReactElementRef as getReactElementRef } from '@mui/utils';\nfunction getContainer(container) {\n  return typeof container === 'function' ? container() : container;\n}\n\n/**\n * Portals provide a first-class way to render children into a DOM node\n * that exists outside the DOM hierarchy of the parent component.\n *\n * Demos:\n *\n * - [Portal](https://mui.com/material-ui/react-portal/)\n *\n * API:\n *\n * - [Portal API](https://mui.com/material-ui/api/portal/)\n */\nconst Portal = /*#__PURE__*/React.forwardRef(function Portal(props, forwardedRef) {\n  const {\n    children,\n    container,\n    disablePortal = false\n  } = props;\n  const [mountNode, setMountNode] = React.useState(null);\n  const handleRef = useForkRef(/*#__PURE__*/React.isValidElement(children) ? getReactElementRef(children) : null, forwardedRef);\n  useEnhancedEffect(() => {\n    if (!disablePortal) {\n      setMountNode(getContainer(container) || document.body);\n    }\n  }, [container, disablePortal]);\n  useEnhancedEffect(() => {\n    if (mountNode && !disablePortal) {\n      setRef(forwardedRef, mountNode);\n      return () => {\n        setRef(forwardedRef, null);\n      };\n    }\n    return undefined;\n  }, [forwardedRef, mountNode, disablePortal]);\n  if (disablePortal) {\n    if (/*#__PURE__*/React.isValidElement(children)) {\n      const newProps = {\n        ref: handleRef\n      };\n      return /*#__PURE__*/React.cloneElement(children, newProps);\n    }\n    return children;\n  }\n  return mountNode ? /*#__PURE__*/ReactDOM.createPortal(children, mountNode) : mountNode;\n});\nprocess.env.NODE_ENV !== \"production\" ? Portal.propTypes /* remove-proptypes */ = {\n  // ┌────────────────────────────── Warning ──────────────────────────────┐\n  // │ These PropTypes are generated from the TypeScript type definitions. │\n  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │\n  // └─────────────────────────────────────────────────────────────────────┘\n  /**\n   * The children to render into the `container`.\n   */\n  children: PropTypes.node,\n  /**\n   * An HTML element or function that returns one.\n   * The `container` will have the portal children appended to it.\n   *\n   * You can also provide a callback, which is called in a React layout effect.\n   * This lets you set the container from a ref, and also makes server-side rendering possible.\n   *\n   * By default, it uses the body of the top-level document object,\n   * so it's simply `document.body` most of the time.\n   */\n  container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),\n  /**\n   * The `children` will be under the DOM hierarchy of the parent component.\n   * @default false\n   */\n  disablePortal: PropTypes.bool\n} : void 0;\nif (process.env.NODE_ENV !== 'production') {\n  // eslint-disable-next-line\n  Portal['propTypes' + ''] = exactProp(Portal.propTypes);\n}\nexport default Portal;"],"names":["getContainer","React.forwardRef","React.useState","React.isValidElement","React.cloneElement","ReactDOM.createPortal"],"mappings":";;;;;;;AAMA,SAASA,cAAY,CAAC,SAAS,EAAE;AACjC,EAAE,OAAO,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,EAAE,GAAG,SAAS;AAClE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACK,MAAC,MAAM,gBAAgBC,CAAgB,CAAC,SAAS,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE;AAClF,EAAE,MAAM;AACR,IAAI,QAAQ;AACZ,IAAI,SAAS;AACb,IAAI,aAAa,GAAG;AACpB,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAGC,CAAc,CAAC,IAAI,CAAC;AACxD,EAAE,MAAM,SAAS,GAAG,UAAU,cAAcC,EAAoB,CAAC,QAAQ,CAAC,GAAG,kBAAkB,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,YAAY,CAAC;AAC/H,EAAE,iBAAiB,CAAC,MAAM;AAC1B,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,MAAM,YAAY,CAACH,cAAY,CAAC,SAAS,CA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