{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport warning from \"rc-util/es/warning\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport OrderContext from \"./Context\";\nimport useDom from \"./useDom\";\nimport useScrollLocker from \"./useScrollLocker\";\nimport { inlineMock } from \"./mock\";\nvar getPortalContainer = function getPortalContainer(getContainer) {\n if (getContainer === false) {\n return false;\n }\n if (!canUseDom() || !getContainer) {\n return null;\n }\n if (typeof getContainer === 'string') {\n return document.querySelector(getContainer);\n }\n if (typeof getContainer === 'function') {\n return getContainer();\n }\n return getContainer;\n};\nvar Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var open = props.open,\n autoLock = props.autoLock,\n getContainer = props.getContainer,\n debug = props.debug,\n _props$autoDestroy = props.autoDestroy,\n autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,\n children = props.children;\n var _React$useState = React.useState(open),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n shouldRender = _React$useState2[0],\n setShouldRender = _React$useState2[1];\n var mergedRender = shouldRender || open;\n\n // ========================= Warning =========================\n if (process.env.NODE_ENV !== 'production') {\n warning(canUseDom() || !open, \"Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.\");\n }\n\n // ====================== Should Render ======================\n React.useEffect(function () {\n if (autoDestroy || open) {\n setShouldRender(open);\n }\n }, [open, autoDestroy]);\n\n // ======================== Container ========================\n var _React$useState3 = React.useState(function () {\n return getPortalContainer(getContainer);\n }),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n innerContainer = _React$useState4[0],\n setInnerContainer = _React$useState4[1];\n React.useEffect(function () {\n var customizeContainer = getPortalContainer(getContainer);\n\n // Tell component that we check this in effect which is safe to be `null`\n setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);\n });\n var _useDom = useDom(mergedRender && !innerContainer, debug),\n _useDom2 = _slicedToArray(_useDom, 2),\n defaultContainer = _useDom2[0],\n queueCreate = _useDom2[1];\n var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;\n\n // ========================= Locker ==========================\n useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body));\n\n // =========================== Ref ===========================\n var childRef = null;\n if (children && supportRef(children) && ref) {\n var _ref = children;\n childRef = _ref.ref;\n }\n var mergedRef = useComposeRef(childRef, ref);\n\n // ========================= Render ==========================\n // Do not render when nothing need render\n // When innerContainer is `undefined`, it may not ready since user use ref in the same render\n if (!mergedRender || !canUseDom() || innerContainer === undefined) {\n return null;\n }\n\n // Render inline\n var renderInline = mergedContainer === false || inlineMock();\n var reffedChildren = children;\n if (ref) {\n reffedChildren = /*#__PURE__*/React.cloneElement(children, {\n ref: mergedRef\n });\n }\n return /*#__PURE__*/React.createElement(OrderContext.Provider, {\n value: queueCreate\n }, renderInline ? reffedChildren : /*#__PURE__*/createPortal(reffedChildren, mergedContainer));\n});\nif (process.env.NODE_ENV !== 'production') {\n Portal.displayName = 'Portal';\n}\nexport default Portal;","map":{"version":3,"names":["_slicedToArray","React","createPortal","canUseDom","warning","supportRef","useComposeRef","OrderContext","useDom","useScrollLocker","inlineMock","getPortalContainer","getContainer","document","querySelector","Portal","forwardRef","props","ref","open","autoLock","debug","_props$autoDestroy","autoDestroy","children","_React$useState","useState","_React$useState2","shouldRender","setShouldRender","mergedRender","process","env","NODE_ENV","useEffect","_React$useState3","_React$useState4","innerContainer","setInnerContainer","customizeContainer","_useDom","_useDom2","defaultContainer","queueCreate","mergedContainer","body","childRef","_ref","mergedRef","undefined","renderInline","reffedChildren","cloneElement","createElement","Provider","value","displayName"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/portal/es/Portal.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport { createPortal } from 'react-dom';\nimport canUseDom from \"rc-util/es/Dom/canUseDom\";\nimport warning from \"rc-util/es/warning\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport OrderContext from \"./Context\";\nimport useDom from \"./useDom\";\nimport useScrollLocker from \"./useScrollLocker\";\nimport { inlineMock } from \"./mock\";\nvar getPortalContainer = function getPortalContainer(getContainer) {\n if (getContainer === false) {\n return false;\n }\n if (!canUseDom() || !getContainer) {\n return null;\n }\n if (typeof getContainer === 'string') {\n return document.querySelector(getContainer);\n }\n if (typeof getContainer === 'function') {\n return getContainer();\n }\n return getContainer;\n};\nvar Portal = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var open = props.open,\n autoLock = props.autoLock,\n getContainer = props.getContainer,\n debug = props.debug,\n _props$autoDestroy = props.autoDestroy,\n autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy,\n children = props.children;\n var _React$useState = React.useState(open),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n shouldRender = _React$useState2[0],\n setShouldRender = _React$useState2[1];\n var mergedRender = shouldRender || open;\n\n // ========================= Warning =========================\n if (process.env.NODE_ENV !== 'production') {\n warning(canUseDom() || !open, \"Portal only work in client side. Please call 'useEffect' to show Portal instead default render in SSR.\");\n }\n\n // ====================== Should Render ======================\n React.useEffect(function () {\n if (autoDestroy || open) {\n setShouldRender(open);\n }\n }, [open, autoDestroy]);\n\n // ======================== Container ========================\n var _React$useState3 = React.useState(function () {\n return getPortalContainer(getContainer);\n }),\n _React$useState4 = _slicedToArray(_React$useState3, 2),\n innerContainer = _React$useState4[0],\n setInnerContainer = _React$useState4[1];\n React.useEffect(function () {\n var customizeContainer = getPortalContainer(getContainer);\n\n // Tell component that we check this in effect which is safe to be `null`\n setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);\n });\n var _useDom = useDom(mergedRender && !innerContainer, debug),\n _useDom2 = _slicedToArray(_useDom, 2),\n defaultContainer = _useDom2[0],\n queueCreate = _useDom2[1];\n var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;\n\n // ========================= Locker ==========================\n useScrollLocker(autoLock && open && canUseDom() && (mergedContainer === defaultContainer || mergedContainer === document.body));\n\n // =========================== Ref ===========================\n var childRef = null;\n if (children && supportRef(children) && ref) {\n var _ref = children;\n childRef = _ref.ref;\n }\n var mergedRef = useComposeRef(childRef, ref);\n\n // ========================= Render ==========================\n // Do not render when nothing need render\n // When innerContainer is `undefined`, it may not ready since user use ref in the same render\n if (!mergedRender || !canUseDom() || innerContainer === undefined) {\n return null;\n }\n\n // Render inline\n var renderInline = mergedContainer === false || inlineMock();\n var reffedChildren = children;\n if (ref) {\n reffedChildren = /*#__PURE__*/React.cloneElement(children, {\n ref: mergedRef\n });\n }\n return /*#__PURE__*/React.createElement(OrderContext.Provider, {\n value: queueCreate\n }, renderInline ? reffedChildren : /*#__PURE__*/createPortal(reffedChildren, mergedContainer));\n});\nif (process.env.NODE_ENV !== 'production') {\n Portal.displayName = 'Portal';\n}\nexport default Portal;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,YAAY,QAAQ,WAAW;AACxC,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,UAAU,EAAEC,aAAa,QAAQ,gBAAgB;AAC1D,OAAOC,YAAY,MAAM,WAAW;AACpC,OAAOC,MAAM,MAAM,UAAU;AAC7B,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,UAAU,QAAQ,QAAQ;AACnC,IAAIC,kBAAkB,GAAG,SAASA,kBAAkBA,CAACC,YAAY,EAAE;EACjE,IAAIA,YAAY,KAAK,KAAK,EAAE;IAC1B,OAAO,KAAK;EACd;EACA,IAAI,CAACT,SAAS,CAAC,CAAC,IAAI,CAACS,YAAY,EAAE;IACjC,OAAO,IAAI;EACb;EACA,IAAI,OAAOA,YA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