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

1 line
8.1 KiB
JSON

{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport useForceUpdate from '../_util/hooks/useForceUpdate';\nimport { cloneElement } from '../_util/reactNode';\nimport Statistic from './Statistic';\nimport { formatCountdown } from './utils';\nconst REFRESH_INTERVAL = 1000 / 30;\nfunction getTime(value) {\n return new Date(value).getTime();\n}\nconst Countdown = props => {\n const {\n value,\n format = 'HH:mm:ss',\n onChange,\n onFinish\n } = props,\n rest = __rest(props, [\"value\", \"format\", \"onChange\", \"onFinish\"]);\n const forceUpdate = useForceUpdate();\n const countdown = React.useRef(null);\n const stopTimer = () => {\n onFinish === null || onFinish === void 0 ? void 0 : onFinish();\n if (countdown.current) {\n clearInterval(countdown.current);\n countdown.current = null;\n }\n };\n const syncTimer = () => {\n const timestamp = getTime(value);\n if (timestamp >= Date.now()) {\n countdown.current = setInterval(() => {\n forceUpdate();\n onChange === null || onChange === void 0 ? void 0 : onChange(timestamp - Date.now());\n if (timestamp < Date.now()) {\n stopTimer();\n }\n }, REFRESH_INTERVAL);\n }\n };\n React.useEffect(() => {\n syncTimer();\n return () => {\n if (countdown.current) {\n clearInterval(countdown.current);\n countdown.current = null;\n }\n };\n }, [value]);\n const formatter = (formatValue, config) => formatCountdown(formatValue, Object.assign(Object.assign({}, config), {\n format\n }));\n const valueRender = node => cloneElement(node, {\n title: undefined\n });\n return /*#__PURE__*/React.createElement(Statistic, Object.assign({}, rest, {\n value: value,\n valueRender: valueRender,\n formatter: formatter\n }));\n};\nexport default /*#__PURE__*/React.memo(Countdown);","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","useForceUpdate","cloneElement","Statistic","formatCountdown","REFRESH_INTERVAL","getTime","value","Date","Countdown","props","format","onChange","onFinish","rest","forceUpdate","countdown","useRef","stopTimer","current","clearInterval","syncTimer","timestamp","now","setInterval","useEffect","formatter","formatValue","config","assign","valueRender","node","title","undefined","createElement","memo"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/statistic/Countdown.js"],"sourcesContent":["\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport useForceUpdate from '../_util/hooks/useForceUpdate';\nimport { cloneElement } from '../_util/reactNode';\nimport Statistic from './Statistic';\nimport { formatCountdown } from './utils';\nconst REFRESH_INTERVAL = 1000 / 30;\nfunction getTime(value) {\n return new Date(value).getTime();\n}\nconst Countdown = props => {\n const {\n value,\n format = 'HH:mm:ss',\n onChange,\n onFinish\n } = props,\n rest = __rest(props, [\"value\", \"format\", \"onChange\", \"onFinish\"]);\n const forceUpdate = useForceUpdate();\n const countdown = React.useRef(null);\n const stopTimer = () => {\n onFinish === null || onFinish === void 0 ? void 0 : onFinish();\n if (countdown.current) {\n clearInterval(countdown.current);\n countdown.current = null;\n }\n };\n const syncTimer = () => {\n const timestamp = getTime(value);\n if (timestamp >= Date.now()) {\n countdown.current = setInterval(() => {\n forceUpdate();\n onChange === null || onChange === void 0 ? void 0 : onChange(timestamp - Date.now());\n if (timestamp < Date.now()) {\n stopTimer();\n }\n }, REFRESH_INTERVAL);\n }\n };\n React.useEffect(() => {\n syncTimer();\n return () => {\n if (countdown.current) {\n clearInterval(countdown.current);\n countdown.current = null;\n }\n };\n }, [value]);\n const formatter = (formatValue, config) => formatCountdown(formatValue, Object.assign(Object.assign({}, config), {\n format\n }));\n const valueRender = node => cloneElement(node, {\n title: undefined\n });\n return /*#__PURE__*/React.createElement(Statistic, Object.assign({}, rest, {\n value: value,\n valueRender: valueRender,\n formatter: formatter\n }));\n};\nexport default /*#__PURE__*/React.memo(Countdown);"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,OAAOI,MAAM,CAACK,qBAAqB,KAAK,UAAU,EAAE,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEP,CAAC,GAAGC,MAAM,CAACK,qBAAqB,CAACT,CAAC,CAAC,EAAEU,CAAC,GAAGP,CAAC,CAACQ,MAAM,EAAED,CAAC,EAAE,EAAE;IAC3I,IAAIT,CAAC,CAACO,OAAO,CAACL,CAAC,CAACO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAIN,MAAM,CAACC,SAAS,CAACO,oBAAoB,CAACL,IAAI,CAACP,CAAC,EAAEG,CAAC,CAACO,CAAC,CAAC,C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