PromoCursed/node_modules/.cache/babel-loader/47dc4fce91108608fc44a1cb88afac65500a902087fb074a5bb25bf1d2a35517.json
2024-08-20 23:25:37 +04:00

1 line
5.5 KiB
JSON

{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { useLayoutUpdateEffect } from \"rc-util/es/hooks/useLayoutEffect\";\nimport { useRef, useState } from 'react';\n\n/**\n * Help to merge callback with `useLayoutEffect`.\n * One time will only trigger once.\n */\nexport default function useUpdate(callback) {\n var _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n count = _useState2[0],\n setCount = _useState2[1];\n var effectRef = useRef(0);\n var callbackRef = useRef();\n callbackRef.current = callback;\n\n // Trigger on `useLayoutEffect`\n useLayoutUpdateEffect(function () {\n var _callbackRef$current;\n (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 || _callbackRef$current.call(callbackRef);\n }, [count]);\n\n // Trigger to update count\n return function () {\n if (effectRef.current !== count) {\n return;\n }\n effectRef.current += 1;\n setCount(effectRef.current);\n };\n}\nexport function useUpdateState(defaultState) {\n var batchRef = useRef([]);\n var _useState3 = useState({}),\n _useState4 = _slicedToArray(_useState3, 2),\n forceUpdate = _useState4[1];\n var state = useRef(typeof defaultState === 'function' ? defaultState() : defaultState);\n var flushUpdate = useUpdate(function () {\n var current = state.current;\n batchRef.current.forEach(function (callback) {\n current = callback(current);\n });\n batchRef.current = [];\n state.current = current;\n forceUpdate({});\n });\n function updater(callback) {\n batchRef.current.push(callback);\n flushUpdate();\n }\n return [state.current, updater];\n}","map":{"version":3,"names":["_slicedToArray","useLayoutUpdateEffect","useRef","useState","useUpdate","callback","_useState","_useState2","count","setCount","effectRef","callbackRef","current","_callbackRef$current","call","useUpdateState","defaultState","batchRef","_useState3","_useState4","forceUpdate","state","flushUpdate","forEach","updater","push"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-tabs/es/hooks/useUpdate.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { useLayoutUpdateEffect } from \"rc-util/es/hooks/useLayoutEffect\";\nimport { useRef, useState } from 'react';\n\n/**\n * Help to merge callback with `useLayoutEffect`.\n * One time will only trigger once.\n */\nexport default function useUpdate(callback) {\n var _useState = useState(0),\n _useState2 = _slicedToArray(_useState, 2),\n count = _useState2[0],\n setCount = _useState2[1];\n var effectRef = useRef(0);\n var callbackRef = useRef();\n callbackRef.current = callback;\n\n // Trigger on `useLayoutEffect`\n useLayoutUpdateEffect(function () {\n var _callbackRef$current;\n (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 || _callbackRef$current.call(callbackRef);\n }, [count]);\n\n // Trigger to update count\n return function () {\n if (effectRef.current !== count) {\n return;\n }\n effectRef.current += 1;\n setCount(effectRef.current);\n };\n}\nexport function useUpdateState(defaultState) {\n var batchRef = useRef([]);\n var _useState3 = useState({}),\n _useState4 = _slicedToArray(_useState3, 2),\n forceUpdate = _useState4[1];\n var state = useRef(typeof defaultState === 'function' ? defaultState() : defaultState);\n var flushUpdate = useUpdate(function () {\n var current = state.current;\n batchRef.current.forEach(function (callback) {\n current = callback(current);\n });\n batchRef.current = [];\n state.current = current;\n forceUpdate({});\n });\n function updater(callback) {\n batchRef.current.push(callback);\n flushUpdate();\n }\n return [state.current, updater];\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;;AAExC;AACA;AACA;AACA;AACA,eAAe,SAASC,SAASA,CAACC,QAAQ,EAAE;EAC1C,IAAIC,SAAS,GAAGH,QAAQ,CAAC,CAAC,CAAC;IACzBI,UAAU,GAAGP,cAAc,CAACM,SAAS,EAAE,CAAC,CAAC;IACzCE,KAAK,GAAGD,UAAU,CAAC,CAAC,CAAC;IACrBE,QAAQ,GAAGF,UAAU,CAAC,CAAC,CAAC;EAC1B,IAAIG,SAAS,G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