{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport raf from \"rc-util/es/raf\";\nimport { render, unmount } from \"rc-util/es/React/render\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport { TARGET_CLS } from './interface';\nimport { getTargetWaveColor } from './util';\nfunction validateNum(value) {\n return Number.isNaN(value) ? 0 : value;\n}\nconst WaveEffect = props => {\n const {\n className,\n target,\n component\n } = props;\n const divRef = React.useRef(null);\n const [color, setWaveColor] = React.useState(null);\n const [borderRadius, setBorderRadius] = React.useState([]);\n const [left, setLeft] = React.useState(0);\n const [top, setTop] = React.useState(0);\n const [width, setWidth] = React.useState(0);\n const [height, setHeight] = React.useState(0);\n const [enabled, setEnabled] = React.useState(false);\n const waveStyle = {\n left,\n top,\n width,\n height,\n borderRadius: borderRadius.map(radius => `${radius}px`).join(' ')\n };\n if (color) {\n waveStyle['--wave-color'] = color;\n }\n function syncPos() {\n const nodeStyle = getComputedStyle(target);\n // Get wave color from target\n setWaveColor(getTargetWaveColor(target));\n const isStatic = nodeStyle.position === 'static';\n // Rect\n const {\n borderLeftWidth,\n borderTopWidth\n } = nodeStyle;\n setLeft(isStatic ? target.offsetLeft : validateNum(-parseFloat(borderLeftWidth)));\n setTop(isStatic ? target.offsetTop : validateNum(-parseFloat(borderTopWidth)));\n setWidth(target.offsetWidth);\n setHeight(target.offsetHeight);\n // Get border radius\n const {\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius\n } = nodeStyle;\n setBorderRadius([borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(radius => validateNum(parseFloat(radius))));\n }\n React.useEffect(() => {\n if (target) {\n // We need delay to check position here\n // since UI may change after click\n const id = raf(() => {\n syncPos();\n setEnabled(true);\n });\n // Add resize observer to follow size\n let resizeObserver;\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(syncPos);\n resizeObserver.observe(target);\n }\n return () => {\n raf.cancel(id);\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();\n };\n }\n }, []);\n if (!enabled) {\n return null;\n }\n const isSmallComponent = (component === 'Checkbox' || component === 'Radio') && (target === null || target === void 0 ? void 0 : target.classList.contains(TARGET_CLS));\n return /*#__PURE__*/React.createElement(CSSMotion, {\n visible: true,\n motionAppear: true,\n motionName: \"wave-motion\",\n motionDeadline: 5000,\n onAppearEnd: (_, event) => {\n var _a;\n if (event.deadline || event.propertyName === 'opacity') {\n const holder = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;\n unmount(holder).then(() => {\n holder === null || holder === void 0 ? void 0 : holder.remove();\n });\n }\n return false;\n }\n }, (_ref, ref) => {\n let {\n className: motionClassName\n } = _ref;\n return /*#__PURE__*/React.createElement(\"div\", {\n ref: composeRef(divRef, ref),\n className: classNames(className, motionClassName, {\n 'wave-quick': isSmallComponent\n }),\n style: waveStyle\n });\n });\n};\nconst showWaveEffect = (target, info) => {\n var _a;\n const {\n component\n } = info;\n // Skip for unchecked checkbox\n if (component === 'Checkbox' && !((_a = target.querySelector('input')) === null || _a === void 0 ? void 0 : _a.checked)) {\n return;\n }\n // Create holder\n const holder = document.createElement('div');\n holder.style.position = 'absolute';\n holder.style.left = '0px';\n holder.style.top = '0px';\n target === null || target === void 0 ? void 0 : target.insertBefore(holder, target === null || target === void 0 ? void 0 : target.firstChild);\n render( /*#__PURE__*/React.createElement(WaveEffect, Object.assign({}, info, {\n target: target\n })), holder);\n};\nexport default showWaveEffect;","map":{"version":3,"names":["React","classNames","CSSMotion","raf","render","unmount","composeRef","TARGET_CLS","getTargetWaveColor","validateNum","value","Number","isNaN","WaveEffect","props","className","target","component","divRef","useRef","color","setWaveColor","useState","borderRadius","setBorderRadius","left","setLeft","top","setTop","width","setWidth","height","setHeight","enabled","setEnabled","waveStyle","map","radius","join","syncPos","nodeStyle","getComputedStyle","isStatic","position","borderLeftWidth","borderTopWidth","offsetLeft","parseFloat","offsetTop","offsetWidth","offsetHeight","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","useEffect","id","resizeObserver","ResizeObserver","observe","cancel","disconnect","isSmallComponent","classList","contains","createElement","visible","motionAppear","motionName","motionDeadline","onAppearEnd","_","event","_a","deadline","propertyName","holder","current","parentElement","then","remove","_ref","ref","motionClassName","style","showWaveEffect","info","querySelector","checked","document","insertBefore","firstChild","Object","assign"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/_util/wave/WaveEffect.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport raf from \"rc-util/es/raf\";\nimport { render, unmount } from \"rc-util/es/React/render\";\nimport { composeRef } from \"rc-util/es/ref\";\nimport { TARGET_CLS } from './interface';\nimport { getTargetWaveColor } from './util';\nfunction validateNum(value) {\n return Number.isNaN(value) ? 0 : value;\n}\nconst WaveEffect = props => {\n const {\n className,\n target,\n component\n } = props;\n const divRef = React.useRef(null);\n const [color, setWaveColor] = React.useState(null);\n const [borderRadius, setBorderRadius] = React.useState([]);\n const [left, setLeft] = React.useState(0);\n const [top, setTop] = React.useState(0);\n const [width, setWidth] = React.useState(0);\n const [height, setHeight] = React.useState(0);\n const [enabled, setEnabled] = React.useState(false);\n const waveStyle = {\n left,\n top,\n width,\n height,\n borderRadius: borderRadius.map(radius => `${radius}px`).join(' ')\n };\n if (color) {\n waveStyle['--wave-color'] = color;\n }\n function syncPos() {\n const nodeStyle = getComputedStyle(target);\n // Get wave color from target\n setWaveColor(getTargetWaveColor(target));\n const isStatic = nodeStyle.position === 'static';\n // Rect\n const {\n borderLeftWidth,\n borderTopWidth\n } = nodeStyle;\n setLeft(isStatic ? target.offsetLeft : validateNum(-parseFloat(borderLeftWidth)));\n setTop(isStatic ? target.offsetTop : validateNum(-parseFloat(borderTopWidth)));\n setWidth(target.offsetWidth);\n setHeight(target.offsetHeight);\n // Get border radius\n const {\n borderTopLeftRadius,\n borderTopRightRadius,\n borderBottomLeftRadius,\n borderBottomRightRadius\n } = nodeStyle;\n setBorderRadius([borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius].map(radius => validateNum(parseFloat(radius))));\n }\n React.useEffect(() => {\n if (target) {\n // We need delay to check position here\n // since UI may change after click\n const id = raf(() => {\n syncPos();\n setEnabled(true);\n });\n // Add resize observer to follow size\n let resizeObserver;\n if (typeof ResizeObserver !== 'undefined') {\n resizeObserver = new ResizeObserver(syncPos);\n resizeObserver.observe(target);\n }\n return () => {\n raf.cancel(id);\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();\n };\n }\n }, []);\n if (!enabled) {\n return null;\n }\n const isSmallComponent = (component === 'Checkbox' || component === 'Radio') && (target === null || target === void 0 ? void 0 : target.classList.contains(TARGET_CLS));\n return /*#__PURE__*/React.createElement(CSSMotion, {\n visible: true,\n motionAppear: true,\n motionName: \"wave-motion\",\n motionDeadline: 5000,\n onAppearEnd: (_, event) => {\n var _a;\n if (event.deadline || event.propertyName === 'opacity') {\n const holder = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.parentElement;\n unmount(holder).then(() => {\n holder === null || holder === void 0 ? void 0 : holder.remove();\n });\n }\n return false;\n }\n }, (_ref, ref) => {\n let {\n className: motionClassName\n } = _ref;\n return /*#__PURE__*/React.createElement(\"div\", {\n ref: composeRef(divRef, ref),\n className: classNames(className, motionClassName, {\n 'wave-quick': isSmallComponent\n }),\n style: waveStyle\n });\n });\n};\nconst showWaveEffect = (target, info) => {\n var _a;\n const {\n component\n } = info;\n // Skip for unchecked checkbox\n if (component === 'Checkbox' && !((_a = target.querySelector('input')) === null || _a === void 0 ? void 0 : _a.checked)) {\n return;\n }\n // Create holder\n const holder = document.createElement('div');\n holder.style.position = 'absolute';\n holder.style.left = '0px';\n holder.style.top = '0px';\n target === null || target === void 0 ? void 0 : target.insertBefore(holder, target === null || target === void 0 ? void 0 : target.firstChild);\n render( /*#__PURE__*/React.createElement(WaveEffect, Object.assign({}, info, {\n target: target\n })), holder);\n};\nexport default showWaveEffect;"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,WAAW;AACjC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,MAAM,EAAEC,OAAO,QAAQ,yBAAyB;AACzD,SAASC,UAAU,QAAQ,gBAAgB;AAC3C,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,kBAAkB,QAAQ,QAAQ;AAC3C,SAASC,WAAWA,CAACC,KAAK,EAAE;EAC1B,OAAOC,MAAM,CAACC,KAAK,CAACF,KAAK,CAAC,GAAG,CAAC,GAAGA,KAAK;AACxC;AACA,MAAMG,UAAU,GAAGC,KAAK,IAAI;EAC1B,MAAM;IACJC,SAAS;IACTC,MAAM;IACNC;EACF,CAAC,GAAGH,KAAK;EACT,MAAMI,MAAM,GAAGlB,KAAK,CAACmB,MAAM,CAAC,IAAI,CAAC;EACjC,MAAM,CAACC,KAAK,EAAEC,YAAY,CAAC,GAAGrB,KAAK,CAACsB,QAAQ,CAAC,IAAI,CAAC;EAClD,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGxB,KAAK,CAACsB,QAAQ,CAAC,EAAE,CAAC;EAC1D,MAAM,CAACG,IAAI,EAAEC,OAAO,CAAC,GAAG1B,KAAK,CAACsB,QAAQ,CAAC,CAAC,CAAC;EACzC,MAAM,CAACK,GAAG,EAAEC,MAAM,CAAC,GAAG5B,KAAK,CAACsB,QAAQ,CAAC,CAAC,CAAC;EACvC,MAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAG9B,KAAK,CAACsB,QAAQ,CAAC,CAAC,CAAC;EAC3C,MAAM,CAACS,MAAM,EAAEC,SAAS,CAAC,GAAGhC,KAAK,CAACsB,QAAQ,CA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