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CAAQA,CAAAA,CACPC,QAAQ,OACRpC,WAAW,SACXvC,QAAUgB,YAEV,GAAApK,EAAAC,GAAA,EAAC4I,EAAAA,CAAOA,CAAAA,CAACtD,KAAK,cAAcoI,QAAU,EAAIK,GAAK,IAAK,iBAItD,GAAAhO,EAAAwC,IAAA,EAACsL,EAAAA,CAAQA,CAAAA,CACPC,QAAQ,OACRpC,WAAW,SACXvC,QAAU4B,YAEV,GAAAhL,EAAAC,GAAA,EAAC4I,EAAAA,CAAOA,CAAAA,CAACtD,KAAK,YAAYoI,QAAU,EAAIK,GAAK,IAAK,6BAS5DvC,KAGFD,GACA,GAAAxL,EAAAC,GAAA,EAACgO,EAAoBA,CACnB7G,OAAS0C,EACT5I,MAAQA,EACRyC,MAAQA,EACR0D,YAAcA,EACdC,QAAU6C,EACVrG,MAAQA,MAKlB","sources":["webpack://_N_E/./lib/downloadBlob.ts","webpack://_N_E/./lib/saveAsCSV.ts","webpack://_N_E/./ui/shared/chart/ChartAxis.tsx","webpack://_N_E/./ui/shared/chart/ChartGridLine.tsx","webpack://_N_E/./ui/shared/chart/ChartSelectionX.tsx","webpack://_N_E/./ui/shared/chart/ChartWidgetGraph.tsx","webpack://_N_E/./ui/shared/chart/FullscreenChartModal.tsx","webpack://_N_E/./ui/shared/chart/ChartWidget.tsx"],"sourcesContent":["export default function downloadBlob(blob: Blob, filename: string) {\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.setAttribute('href', url);\n link.setAttribute('download', filename);\n link.click();\n\n link.remove();\n URL.revokeObjectURL(url);\n}\n","import { unparse } from 'papaparse';\n\nimport downloadBlob from 'lib/downloadBlob';\n\nexport default function saveAsCSV(headerRows: Array, dataRows: Array>, filename: string) {\n const csv = unparse([\n headerRows,\n ...dataRows,\n ]);\n\n const blob = new Blob([ csv ], { type: 'text/csv;charset=utf-8;' });\n\n downloadBlob(blob, filename);\n}\n","import { useColorModeValue, useToken } from '@chakra-ui/react';\nimport * as d3 from 'd3';\nimport React from 'react';\n\ninterface Props extends Omit, 'scale'> {\n type: 'left' | 'bottom';\n scale: d3.ScaleTime | d3.ScaleLinear;\n noAnimation?: boolean;\n ticks: number;\n tickFormatGenerator?: (axis: d3.Axis) => (domainValue: d3.AxisDomain, index: number) => string;\n anchorEl?: SVGRectElement | null;\n}\n\nconst ChartAxis = ({ type, scale, ticks, tickFormatGenerator, noAnimation, anchorEl, ...props }: Props) => {\n const ref = React.useRef(null);\n\n const textColorToken = useColorModeValue('blackAlpha.600', 'whiteAlpha.500');\n const textColor = useToken('colors', textColorToken);\n\n React.useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const axisGenerator = type === 'left' ? d3.axisLeft : d3.axisBottom;\n const axis = axisGenerator(scale).ticks(ticks);\n\n if (tickFormatGenerator) {\n axis.tickFormat(tickFormatGenerator(axis));\n }\n\n const axisGroup = d3.select(ref.current);\n\n if (noAnimation) {\n axisGroup.call(axis);\n } else {\n axisGroup.transition().duration(750).ease(d3.easeLinear).call(axis);\n }\n axisGroup.select('.domain').remove();\n axisGroup.selectAll('line').remove();\n axisGroup.selectAll('text')\n .attr('opacity', 1)\n .attr('color', textColor)\n .attr('font-size', '0.75rem');\n }, [ scale, ticks, tickFormatGenerator, noAnimation, type, textColor ]);\n\n React.useEffect(() => {\n if (!anchorEl) {\n return;\n }\n\n const anchorD3 = d3.select(anchorEl);\n\n anchorD3\n .on('mouseout.axisX', () => {\n d3.select(ref.current)\n .selectAll('text')\n .style('font-weight', 'normal');\n })\n .on('mousemove.axisX', (event) => {\n const [ x ] = d3.pointer(event, anchorEl);\n const xDate = scale.invert(x);\n const textElements = d3.select(ref.current).selectAll('text');\n const data = textElements.data();\n const index = d3.bisector((d) => d).left(data, xDate);\n textElements\n .style('font-weight', (d, i) => i === index - 1 ? 'bold' : 'normal');\n });\n\n return () => {\n anchorD3.on('mouseout.axisX mousemove.axisX', null);\n };\n }, [ anchorEl, scale ]);\n\n return ;\n};\n\nexport default React.memo(ChartAxis);\n","import { useToken } from '@chakra-ui/react';\nimport * as d3 from 'd3';\nimport React from 'react';\n\ninterface Props extends Omit, 'scale'> {\n type: 'vertical' | 'horizontal';\n scale: d3.ScaleTime | d3.ScaleLinear;\n noAnimation?: boolean;\n size: number;\n ticks: number;\n}\n\nconst ChartGridLine = ({ type, scale, ticks, size, noAnimation, ...props }: Props) => {\n const ref = React.useRef(null);\n\n const strokeColor = useToken('colors', 'divider');\n\n React.useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const axisGenerator = type === 'vertical' ? d3.axisBottom : d3.axisLeft;\n const axis = axisGenerator(scale).ticks(ticks).tickSize(-size);\n\n const gridGroup = d3.select(ref.current);\n if (noAnimation) {\n gridGroup.call(axis);\n } else {\n gridGroup.transition().duration(750).ease(d3.easeLinear).call(axis);\n }\n gridGroup.select('.domain').remove();\n gridGroup.selectAll('text').remove();\n gridGroup.selectAll('line').attr('stroke', strokeColor);\n }, [ scale, ticks, size, noAnimation, type, strokeColor ]);\n\n return ;\n};\n\nexport default React.memo(ChartGridLine);\n","import { useToken } from '@chakra-ui/react';\nimport * as d3 from 'd3';\nimport React from 'react';\n\nimport type { TimeChartData, TimeChartItem } from 'ui/shared/chart/types';\n\nimport dayjs from 'lib/date/dayjs';\n\nconst SELECTION_THRESHOLD = 2;\n\ninterface Props {\n height: number;\n anchorEl?: SVGRectElement | null;\n scale: d3.ScaleTime;\n data: TimeChartData;\n onSelect: (range: [Date, Date]) => void;\n}\n\nconst ChartSelectionX = ({ anchorEl, height, scale, data, onSelect }: Props) => {\n const borderColor = useToken('colors', 'blue.200');\n\n const ref = React.useRef(null);\n const isActive = React.useRef(false);\n const startX = React.useRef();\n const endX = React.useRef();\n\n const getIndexByX = React.useCallback((x: number) => {\n const xDate = scale.invert(x);\n const bisectDate = d3.bisector((d) => d.date).left;\n return bisectDate(data[0].items, xDate, 1);\n }, [ data, scale ]);\n\n const drawSelection = React.useCallback((x0: number, x1: number) => {\n const diffX = x1 - x0;\n\n d3.select(ref.current)\n .attr('opacity', 1);\n\n d3.select(ref.current)\n .select('.ChartSelectionX__line_left')\n .attr('x1', x0)\n .attr('x2', x0);\n\n d3.select(ref.current)\n .select('.ChartSelectionX__line_right')\n .attr('x1', x1)\n .attr('x2', x1);\n\n d3.select(ref.current)\n .select('.ChartSelectionX__rect')\n .attr('x', diffX > 0 ? x0 : diffX + x0)\n .attr('width', Math.abs(diffX));\n }, []);\n\n const handleSelect = React.useCallback((x0: number, x1: number) => {\n const startDate = scale.invert(x0);\n const endDate = scale.invert(x1);\n\n if (Math.abs(dayjs(startDate).diff(endDate, 'day')) > SELECTION_THRESHOLD) {\n onSelect([ dayjs.min(dayjs(startDate), dayjs(endDate)).toDate(), dayjs.max(dayjs(startDate), dayjs(endDate)).toDate() ]);\n }\n }, [ onSelect, scale ]);\n\n const cleanUp = React.useCallback(() => {\n isActive.current = false;\n startX.current = undefined;\n endX.current = undefined;\n d3.select(ref.current).attr('opacity', 0);\n }, [ ]);\n\n const handelMouseUp = React.useCallback(() => {\n if (!isActive.current) {\n return;\n }\n\n if (startX.current && endX.current) {\n handleSelect(startX.current, endX.current);\n }\n\n cleanUp();\n }, [ cleanUp, handleSelect ]);\n\n React.useEffect(() => {\n if (!anchorEl) {\n return;\n }\n\n const anchorD3 = d3.select(anchorEl);\n\n anchorD3\n .on('mousedown.selectionX', (event: MouseEvent) => {\n const [ x ] = d3.pointer(event, anchorEl);\n isActive.current = true;\n startX.current = x;\n })\n .on('mousemove.selectionX', (event: MouseEvent) => {\n if (isActive.current) {\n const [ x ] = d3.pointer(event, anchorEl);\n startX.current && drawSelection(startX.current, x);\n endX.current = x;\n }\n })\n .on('mouseup.selectionX', handelMouseUp)\n .on('touchstart.selectionX', (event: TouchEvent) => {\n const pointers = d3.pointers(event, anchorEl);\n isActive.current = pointers.length === 2;\n })\n .on('touchmove.selectionX', (event: TouchEvent) => {\n if (isActive.current) {\n const pointers = d3.pointers(event, anchorEl);\n\n if (pointers.length === 2 && Math.abs(pointers[0][0] - pointers[1][0]) > 5) {\n drawSelection(pointers[0][0], pointers[1][0]);\n\n startX.current = pointers[0][0];\n endX.current = pointers[1][0];\n }\n }\n })\n .on('touchend.selectionX', handelMouseUp);\n\n d3.select('body').on('mouseup.selectionX', function(event) {\n const isOutside = startX.current !== undefined && event.target !== anchorD3.node();\n if (isOutside) {\n handelMouseUp();\n }\n });\n\n return () => {\n anchorD3.on('.selectionX', null);\n d3.select('body').on('.selectionX', null);\n };\n }, [ anchorEl, cleanUp, drawSelection, getIndexByX, handelMouseUp, handleSelect ]);\n\n return (\n \n \n \n \n \n );\n};\n\nexport default React.memo(ChartSelectionX);\n","import { useToken } from '@chakra-ui/react';\nimport * as d3 from 'd3';\nimport React from 'react';\n\nimport type { ChartMargin, TimeChartData, TimeChartItem } from 'ui/shared/chart/types';\n\nimport dayjs from 'lib/date/dayjs';\nimport useIsMobile from 'lib/hooks/useIsMobile';\nimport ChartArea from 'ui/shared/chart/ChartArea';\nimport ChartAxis from 'ui/shared/chart/ChartAxis';\nimport ChartGridLine from 'ui/shared/chart/ChartGridLine';\nimport ChartLine from 'ui/shared/chart/ChartLine';\nimport ChartOverlay from 'ui/shared/chart/ChartOverlay';\nimport ChartSelectionX from 'ui/shared/chart/ChartSelectionX';\nimport ChartTooltip from 'ui/shared/chart/ChartTooltip';\nimport useTimeChartController from 'ui/shared/chart/useTimeChartController';\n\ninterface Props {\n isEnlarged?: boolean;\n title: string;\n units?: string;\n items: Array;\n onZoom: () => void;\n isZoomResetInitial: boolean;\n margin?: ChartMargin;\n noAnimation?: boolean;\n}\n\n// temporarily turn off the data aggregation, we need a better algorithm for that\nconst MAX_SHOW_ITEMS = 100_000_000_000;\nconst DEFAULT_CHART_MARGIN = { bottom: 20, left: 10, right: 20, top: 10 };\n\nconst ChartWidgetGraph = ({ isEnlarged, items, onZoom, isZoomResetInitial, title, margin: marginProps, units, noAnimation }: Props) => {\n const isMobile = useIsMobile();\n const color = useToken('colors', 'blue.200');\n const chartId = `chart-${ title.split(' ').join('') }-${ isEnlarged ? 'fullscreen' : 'small' }`;\n\n const overlayRef = React.useRef(null);\n\n const [ range, setRange ] = React.useState<[ Date, Date ]>([ items[0].date, items[items.length - 1].date ]);\n\n const rangedItems = React.useMemo(() =>\n items.filter((item) => item.date >= range[0] && item.date <= range[1]),\n [ items, range ]);\n const isGroupedValues = rangedItems.length > MAX_SHOW_ITEMS;\n\n const displayedData = React.useMemo(() => {\n if (isGroupedValues) {\n return groupChartItemsByWeekNumber(rangedItems);\n } else {\n return rangedItems;\n }\n }, [ isGroupedValues, rangedItems ]);\n\n const chartData: TimeChartData = React.useMemo(() => ([ { items: displayedData, name: 'Value', color, units } ]), [ color, displayedData, units ]);\n\n const margin: ChartMargin = React.useMemo(() => ({ ...DEFAULT_CHART_MARGIN, ...marginProps }), [ marginProps ]);\n const axesConfig = React.useMemo(() => {\n return {\n x: {\n ticks: isEnlarged ? 8 : 4,\n },\n y: {\n ticks: isEnlarged ? 6 : 3,\n nice: true,\n },\n };\n }, [ isEnlarged ]);\n\n const {\n ref,\n rect,\n innerWidth,\n innerHeight,\n chartMargin,\n axes,\n } = useTimeChartController({\n data: chartData,\n margin,\n axesConfig,\n });\n\n const handleRangeSelect = React.useCallback((nextRange: [ Date, Date ]) => {\n setRange([ nextRange[0], nextRange[1] ]);\n onZoom();\n }, [ onZoom ]);\n\n React.useEffect(() => {\n if (isZoomResetInitial) {\n setRange([ items[0].date, items[items.length - 1].date ]);\n }\n }, [ isZoomResetInitial, items ]);\n\n return (\n \n\n \n \n\n \n\n \n\n \n\n \n\n \n \n\n \n \n \n \n );\n};\n\nexport default React.memo(ChartWidgetGraph);\n\nfunction groupChartItemsByWeekNumber(items: Array): Array {\n return d3.rollups(items,\n (group) => ({\n date: group[0].date,\n value: d3.sum(group, (d) => d.value),\n dateLabel: `${ d3.timeFormat('%e %b %Y')(group[0].date) } – ${ d3.timeFormat('%e %b %Y')(group[group.length - 1].date) }`,\n }),\n (t) => `${ dayjs(t.date).week() } / ${ dayjs(t.date).year() }`,\n ).map(([ , v ]) => v);\n}\n","import { Box, Button, Grid, Heading, Modal, ModalBody, ModalCloseButton, ModalContent, ModalOverlay, Text } from '@chakra-ui/react';\nimport React, { useCallback } from 'react';\n\nimport type { TimeChartItem } from './types';\n\nimport IconSvg from 'ui/shared/IconSvg';\n\nimport ChartWidgetGraph from './ChartWidgetGraph';\n\ntype Props = {\n isOpen: boolean;\n title: string;\n description?: string;\n items: Array;\n onClose: () => void;\n units?: string;\n}\n\nconst FullscreenChartModal = ({\n isOpen,\n title,\n description,\n items,\n units,\n onClose,\n}: Props) => {\n const [ isZoomResetInitial, setIsZoomResetInitial ] = React.useState(true);\n\n const handleZoom = useCallback(() => {\n setIsZoomResetInitial(false);\n }, []);\n\n const handleZoomResetClick = useCallback(() => {\n setIsZoomResetInitial(true);\n }, []);\n\n return (\n \n \n\n \n\n \n \n \n { title }\n \n\n { description && (\n \n { description }\n \n ) }\n\n { !isZoomResetInitial && (\n }\n colorScheme=\"blue\"\n gridColumn={ 2 }\n justifySelf=\"end\"\n alignSelf=\"top\"\n gridRow=\"1/3\"\n size=\"sm\"\n variant=\"outline\"\n onClick={ handleZoomResetClick }\n >\n Reset zoom\n \n ) }\n \n \n\n \n\n \n \n \n \n \n );\n};\n\nexport default FullscreenChartModal;\n","import {\n Box,\n Center,\n chakra,\n Flex,\n IconButton, Link,\n MenuButton,\n MenuItem,\n MenuList,\n Skeleton,\n Text,\n Tooltip,\n useColorModeValue,\n VisuallyHidden,\n} from '@chakra-ui/react';\nimport domToImage from 'dom-to-image';\nimport React, { useRef, useCallback, useState } from 'react';\n\nimport type { TimeChartItem } from './types';\n\nimport dayjs from 'lib/date/dayjs';\nimport { apos } from 'lib/html-entities';\nimport saveAsCSV from 'lib/saveAsCSV';\nimport Menu from 'ui/shared/chakra/Menu';\nimport IconSvg from 'ui/shared/IconSvg';\n\nimport ChartWidgetGraph from './ChartWidgetGraph';\nimport FullscreenChartModal from './FullscreenChartModal';\n\nexport type Props = {\n items?: Array;\n title: string;\n description?: string;\n units?: string;\n isLoading: boolean;\n className?: string;\n isError: boolean;\n emptyText?: string;\n noAnimation?: boolean;\n}\n\nconst DOWNLOAD_IMAGE_SCALE = 5;\n\nconst ChartWidget = ({ items, title, description, isLoading, className, isError, units, emptyText, noAnimation }: Props) => {\n const ref = useRef(null);\n const [ isFullscreen, setIsFullscreen ] = useState(false);\n const [ isZoomResetInitial, setIsZoomResetInitial ] = React.useState(true);\n\n const pngBackgroundColor = useColorModeValue('white', 'black');\n const borderColor = useColorModeValue('gray.200', 'gray.600');\n\n const handleZoom = useCallback(() => {\n setIsZoomResetInitial(false);\n }, []);\n\n const handleZoomResetClick = useCallback(() => {\n setIsZoomResetInitial(true);\n }, []);\n\n const showChartFullscreen = useCallback(() => {\n setIsFullscreen(true);\n }, []);\n\n const clearFullscreenChart = useCallback(() => {\n setIsFullscreen(false);\n }, []);\n\n const handleFileSaveClick = useCallback(() => {\n // wait for context menu to close\n setTimeout(() => {\n if (ref.current) {\n domToImage.toPng(ref.current,\n {\n quality: 100,\n bgcolor: pngBackgroundColor,\n width: ref.current.offsetWidth * DOWNLOAD_IMAGE_SCALE,\n height: ref.current.offsetHeight * DOWNLOAD_IMAGE_SCALE,\n filter: (node) => node.nodeName !== 'BUTTON',\n style: {\n borderColor: 'transparent',\n transform: `scale(${ DOWNLOAD_IMAGE_SCALE })`,\n 'transform-origin': 'top left',\n },\n })\n .then((dataUrl) => {\n const link = document.createElement('a');\n link.download = `${ title } (Blockscout chart).png`;\n link.href = dataUrl;\n link.click();\n link.remove();\n });\n }\n }, 100);\n }, [ pngBackgroundColor, title ]);\n\n const handleSVGSavingClick = useCallback(() => {\n if (items) {\n const headerRows = [\n 'Date', 'Value',\n ];\n const dataRows = items.map((item) => [\n dayjs(item.date).format('YYYY-MM-DD'), String(item.value),\n ]);\n\n saveAsCSV(headerRows, dataRows, `${ title } (Blockscout stats)`);\n }\n }, [ items, title ]);\n\n const hasItems = items && items.length > 2;\n\n const content = (() => {\n if (isError) {\n return (\n \n \n { `The data didn${ apos }t load. Please, ` }\n try to reload the page.\n \n \n );\n }\n\n if (isLoading) {\n return ;\n }\n\n if (!hasItems) {\n return (\n
\n { emptyText || 'No data' }\n
\n );\n }\n\n return (\n \n \n \n );\n })();\n\n return (\n <>\n \n \n \n \n { title }\n
\n\n { description && (\n \n { description }\n \n ) }\n \n\n \n \n \n\n { hasItems && (\n \n \n }\n colorScheme=\"gray\"\n variant=\"ghost\"\n as={ IconButton }\n >\n \n Open chart options menu\n \n \n \n \n \n \n View fullscreen\n \n\n \n \n Save as PNG\n \n\n \n \n Save as CSV\n \n \n \n ) }\n \n \n\n { content }\n \n\n { hasItems && (\n \n ) }\n \n );\n};\n\nexport default React.memo(chakra(ChartWidget));\n"],"names":["downloadBlob","blob","filename","url","URL","createObjectURL","link","document","createElement","setAttribute","click","remove","revokeObjectURL","chart_ChartAxis","React","type","scale","ticks","tickFormatGenerator","noAnimation","anchorEl","props","param","ref","textColorToken","useColorModeValue","textColor","useToken","current","axis","axisGenerator","d3","tickFormat","axisGroup","call","transition","duration","ease","select","selectAll","attr","anchorD3","on","style","x","event","xDate","invert","textElements","data","index","d","left","i","jsx_runtime","jsx","g","chart_ChartGridLine","size","strokeColor","tickSize","gridGroup","chart_ChartSelectionX","height","onSelect","borderColor","isActive","startX","endX","getIndexByX","bisectDate","date","items","drawSelection","x0","x1","diffX","Math","abs","handleSelect","startDate","endDate","dayjs","diff","min","toDate","max","cleanUp","undefined","handelMouseUp","pointers","length","target","node","jsxs","className","opacity","rect","width","fill","line","x2","y1","y2","stroke","DEFAULT_CHART_MARGIN","bottom","right","top","chart_ChartWidgetGraph","isEnlarged","onZoom","isZoomResetInitial","title","margin","marginProps","units","isMobile","useIsMobile","color","chartId","split","join","concat","overlayRef","range","setRange","rangedItems","filter","item","isGroupedValues","displayedData","group","value","dateLabel","t","week","year","map","v","chartData","name","axesConfig","y","nice","innerWidth","innerHeight","chartMargin","axes","useTimeChartController","handleRangeSelect","nextRange","svg","cursor","id","transform","ChartGridLine","ChartArea","xScale","yScale","ChartLine","animation","strokeWidth","ChartAxis","tickFormatter","ChartOverlay","ChartTooltip","tooltipWidth","ChartSelectionX","chart_FullscreenChartModal","isOpen","description","onClose","setIsZoomResetInitial","handleZoom","useCallback","handleZoomResetClick","Modal","isCentered","ModalOverlay","ModalContent","Box","mb","Grid","gridColumnGap","Heading","base","sm","Text","gridColumn","as","variant","fontSize","Button","leftIcon","IconSvg","w","h","colorScheme","justifySelf","alignSelf","gridRow","onClick","ModalCloseButton","ModalBody","ChartWidgetGraph","chart_ChartWidget","chakra","isLoading","isError","emptyText","useRef","isFullscreen","setIsFullscreen","useState","pngBackgroundColor","showChartFullscreen","clearFullscreenChart","handleFileSaveClick","setTimeout","domToImage","quality","bgcolor","offsetWidth","offsetHeight","nodeName","then","download","href","dataUrl","handleSVGSavingClick","saveAsCSV","headerRows","dataRows","Blob","unparse","format","String","hasItems","content","Flex","alignItems","justifyContent","flexGrow","py","textAlign","apos","Link","window","location","Skeleton","maxW","Center","Fragment","flexDir","padding","lg","borderRadius","border","columnGap","isLoaded","fontWeight","mt","span","ml","Tooltip","label","IconButton","hidden","aria-label","icon","Menu","MenuButton","boxSize","VisuallyHidden","MenuList","MenuItem","display","mr","FullscreenChartModal"],"sourceRoot":""}