{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport raf from \"rc-util/es/raf\";\nimport React, { useEffect, useRef, useState } from 'react';\nvar useIndicator = function useIndicator(options) {\n var activeTabOffset = options.activeTabOffset,\n horizontal = options.horizontal,\n rtl = options.rtl,\n _options$indicator = options.indicator,\n indicator = _options$indicator === void 0 ? {} : _options$indicator;\n var size = indicator.size,\n _indicator$align = indicator.align,\n align = _indicator$align === void 0 ? 'center' : _indicator$align;\n var _useState = useState(),\n _useState2 = _slicedToArray(_useState, 2),\n inkStyle = _useState2[0],\n setInkStyle = _useState2[1];\n var inkBarRafRef = useRef();\n var getLength = React.useCallback(function (origin) {\n if (typeof size === 'function') {\n return size(origin);\n }\n if (typeof size === 'number') {\n return size;\n }\n return origin;\n }, [size]);\n\n // Delay set ink style to avoid remove tab blink\n function cleanInkBarRaf() {\n raf.cancel(inkBarRafRef.current);\n }\n useEffect(function () {\n var newInkStyle = {};\n if (activeTabOffset) {\n if (horizontal) {\n newInkStyle.width = getLength(activeTabOffset.width);\n var key = rtl ? 'right' : 'left';\n if (align === 'start') {\n newInkStyle[key] = activeTabOffset[key];\n }\n if (align === 'center') {\n newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width / 2;\n newInkStyle.transform = rtl ? 'translateX(50%)' : 'translateX(-50%)';\n }\n if (align === 'end') {\n newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width;\n newInkStyle.transform = 'translateX(-100%)';\n }\n } else {\n newInkStyle.height = getLength(activeTabOffset.height);\n if (align === 'start') {\n newInkStyle.top = activeTabOffset.top;\n }\n if (align === 'center') {\n newInkStyle.top = activeTabOffset.top + activeTabOffset.height / 2;\n newInkStyle.transform = 'translateY(-50%)';\n }\n if (align === 'end') {\n newInkStyle.top = activeTabOffset.top + activeTabOffset.height;\n newInkStyle.transform = 'translateY(-100%)';\n }\n }\n }\n cleanInkBarRaf();\n inkBarRafRef.current = raf(function () {\n setInkStyle(newInkStyle);\n });\n return cleanInkBarRaf;\n }, [activeTabOffset, horizontal, rtl, align, getLength]);\n return {\n style: inkStyle\n };\n};\nexport default useIndicator;","map":{"version":3,"names":["_slicedToArray","raf","React","useEffect","useRef","useState","useIndicator","options","activeTabOffset","horizontal","rtl","_options$indicator","indicator","size","_indicator$align","align","_useState","_useState2","inkStyle","setInkStyle","inkBarRafRef","getLength","useCallback","origin","cleanInkBarRaf","cancel","current","newInkStyle","width","key","transform","height","top","style"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-tabs/es/hooks/useIndicator.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport raf from \"rc-util/es/raf\";\nimport React, { useEffect, useRef, useState } from 'react';\nvar useIndicator = function useIndicator(options) {\n var activeTabOffset = options.activeTabOffset,\n horizontal = options.horizontal,\n rtl = options.rtl,\n _options$indicator = options.indicator,\n indicator = _options$indicator === void 0 ? {} : _options$indicator;\n var size = indicator.size,\n _indicator$align = indicator.align,\n align = _indicator$align === void 0 ? 'center' : _indicator$align;\n var _useState = useState(),\n _useState2 = _slicedToArray(_useState, 2),\n inkStyle = _useState2[0],\n setInkStyle = _useState2[1];\n var inkBarRafRef = useRef();\n var getLength = React.useCallback(function (origin) {\n if (typeof size === 'function') {\n return size(origin);\n }\n if (typeof size === 'number') {\n return size;\n }\n return origin;\n }, [size]);\n\n // Delay set ink style to avoid remove tab blink\n function cleanInkBarRaf() {\n raf.cancel(inkBarRafRef.current);\n }\n useEffect(function () {\n var newInkStyle = {};\n if (activeTabOffset) {\n if (horizontal) {\n newInkStyle.width = getLength(activeTabOffset.width);\n var key = rtl ? 'right' : 'left';\n if (align === 'start') {\n newInkStyle[key] = activeTabOffset[key];\n }\n if (align === 'center') {\n newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width / 2;\n newInkStyle.transform = rtl ? 'translateX(50%)' : 'translateX(-50%)';\n }\n if (align === 'end') {\n newInkStyle[key] = activeTabOffset[key] + activeTabOffset.width;\n newInkStyle.transform = 'translateX(-100%)';\n }\n } else {\n newInkStyle.height = getLength(activeTabOffset.height);\n if (align === 'start') {\n newInkStyle.top = activeTabOffset.top;\n }\n if (align === 'center') {\n newInkStyle.top = activeTabOffset.top + activeTabOffset.height / 2;\n newInkStyle.transform = 'translateY(-50%)';\n }\n if (align === 'end') {\n newInkStyle.top = activeTabOffset.top + activeTabOffset.height;\n newInkStyle.transform = 'translateY(-100%)';\n }\n }\n }\n cleanInkBarRaf();\n inkBarRafRef.current = raf(function () {\n setInkStyle(newInkStyle);\n });\n return cleanInkBarRaf;\n }, [activeTabOffset, horizontal, rtl, align, getLength]);\n return {\n style: inkStyle\n };\n};\nexport default useIndicator;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,GAAG,MAAM,gBAAgB;AAChC,OAAOC,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,IAAIC,YAAY,GAAG,SAASA,YAAYA,CAACC,OAAO,EAAE;EAChD,IAAIC,eAAe,GAAGD,OAAO,CAACC,eAAe;IAC3CC,UAAU,GAAGF,OAAO,CAACE,UAAU;IAC/BC,GAAG,GAAGH,OAAO,CAACG,GAAG;IACjBC,kBAAkB,GAAGJ,OAAO,CAACK,SAAS;IACtCA,SAAS,GAAGD,kBAAkB,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,GAAGA,kBAAkB;EACrE,IAAIE,IAAI,GAAGD,SAAS,CAACC,IAAI;IACvBC,gBAAgB,GAAGF,SAAS,CAACG,KAAK;IAClCA,KAAK,GAAGD,gBAAgB,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAGA,gBAAgB;EACnE,IAAIE,SAAS,GAAGX,QAAQ,CAAC,CAAC;IACxBY,UAAU,GAAGjB,cAAc,CAACgB,SAAS,EAAE,CAAC,CAAC;IACzCE,QAAQ,GAAGD,UAAU,CAAC,CAAC,CAAC;IACxBE,WAAW,GAAGF,UAAU,CAA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