}\r\n */\r\n this.observations_ = new MapShim();\r\n if (typeof callback !== 'function') {\r\n throw new TypeError('The callback provided as parameter 1 is not a function.');\r\n }\r\n this.callback_ = callback;\r\n this.controller_ = controller;\r\n this.callbackCtx_ = callbackCtx;\r\n }\r\n /**\r\n * Starts observing provided element.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.observe = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is already being observed.\r\n if (observations.has(target)) {\r\n return;\r\n }\r\n observations.set(target, new ResizeObservation(target));\r\n this.controller_.addObserver(this);\r\n // Force the update of observations.\r\n this.controller_.refresh();\r\n };\r\n /**\r\n * Stops observing provided element.\r\n *\r\n * @param {Element} target - Element to stop observing.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.unobserve = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is not being observed.\r\n if (!observations.has(target)) {\r\n return;\r\n }\r\n observations.delete(target);\r\n if (!observations.size) {\r\n this.controller_.removeObserver(this);\r\n }\r\n };\r\n /**\r\n * Stops observing all elements.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.disconnect = function () {\r\n this.clearActive();\r\n this.observations_.clear();\r\n this.controller_.removeObserver(this);\r\n };\r\n /**\r\n * Collects observation instances the associated element of which has changed\r\n * it's content rectangle.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.gatherActive = function () {\r\n var _this = this;\r\n this.clearActive();\r\n this.observations_.forEach(function (observation) {\r\n if (observation.isActive()) {\r\n _this.activeObservations_.push(observation);\r\n }\r\n });\r\n };\r\n /**\r\n * Invokes initial callback function with a list of ResizeObserverEntry\r\n * instances collected from active resize observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.broadcastActive = function () {\r\n // Do nothing if observer doesn't have active observations.\r\n if (!this.hasActive()) {\r\n return;\r\n }\r\n var ctx = this.callbackCtx_;\r\n // Create ResizeObserverEntry instance for every active observation.\r\n var entries = this.activeObservations_.map(function (observation) {\r\n return new ResizeObserverEntry(observation.target, observation.broadcastRect());\r\n });\r\n this.callback_.call(ctx, entries, ctx);\r\n this.clearActive();\r\n };\r\n /**\r\n * Clears the collection of active observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.clearActive = function () {\r\n this.activeObservations_.splice(0);\r\n };\r\n /**\r\n * Tells whether observer has active observations.\r\n *\r\n * @returns {boolean}\r\n */\r\n ResizeObserverSPI.prototype.hasActive = function () {\r\n return this.activeObservations_.length > 0;\r\n };\r\n return ResizeObserverSPI;\r\n}());\n\n// Registry of internal observers. If WeakMap is not available use current shim\r\n// for the Map collection as it has all required methods and because WeakMap\r\n// can't be fully polyfilled anyway.\r\nvar observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();\r\n/**\r\n * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation\r\n * exposing only those methods and properties that are defined in the spec.\r\n */\r\nvar ResizeObserver = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback that is invoked when\r\n * dimensions of the observed elements change.\r\n */\r\n function ResizeObserver(callback) {\r\n if (!(this instanceof ResizeObserver)) {\r\n throw new TypeError('Cannot call a class as a function.');\r\n }\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n var controller = ResizeObserverController.getInstance();\r\n var observer = new ResizeObserverSPI(callback, controller, this);\r\n observers.set(this, observer);\r\n }\r\n return ResizeObserver;\r\n}());\r\n// Expose public methods of ResizeObserver.\r\n[\r\n 'observe',\r\n 'unobserve',\r\n 'disconnect'\r\n].forEach(function (method) {\r\n ResizeObserver.prototype[method] = function () {\r\n var _a;\r\n return (_a = observers.get(this))[method].apply(_a, arguments);\r\n };\r\n});\n\nvar index = (function () {\r\n // Export existing implementation if available.\r\n if (typeof global$1.ResizeObserver !== 'undefined') {\r\n return global$1.ResizeObserver;\r\n }\r\n return ResizeObserver;\r\n})();\n\nexport default index;\n","import { useRef, useState, useEffect } from 'react'\nimport ResizeObserver from 'resize-observer-polyfill'\n\nexport const useMeasure = () => {\n const measureRef = useRef(null)\n const animationFrameId = useRef(null)\n const [bounds, setBounds] = useState({\n left: 0,\n top: 0,\n width: 0,\n height: 0,\n })\n const [observer] = useState(\n () =>\n new ResizeObserver(([entry]) => {\n // wrap this call in requestAnimationFrame to avoid \"Resize Observer loop limit exceeded\"\n // error in certain situations\n animationFrameId.current = requestAnimationFrame(() => {\n setBounds(entry.contentRect)\n })\n })\n )\n\n useEffect(() => {\n if (measureRef.current) {\n observer.observe(measureRef.current)\n }\n\n return () => {\n if (animationFrameId.current) {\n cancelAnimationFrame(animationFrameId.current)\n }\n observer.disconnect()\n }\n }, [])\n\n return [measureRef, bounds]\n}\n","import { useMemo } from 'react'\nimport { format as d3Format } from 'd3-format'\nimport { timeFormat as d3TimeFormat } from 'd3-time-format'\n\nexport const getValueFormatter = format => {\n // user defined function\n if (typeof format === 'function') return format\n\n if (typeof format === 'string') {\n // time format specifier\n if (format.indexOf('time:') === 0) {\n return d3TimeFormat(format.slice('5'))\n }\n\n // standard format specifier\n return d3Format(format)\n }\n\n // no formatting\n return v => `${v}`\n}\n\nexport const useValueFormatter = format => useMemo(() => getValueFormatter(format), [format])\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { createContext, useContext } from 'react'\nimport PropTypes from 'prop-types'\nimport { usePartialTheme } from '../hooks'\n\nexport const themeContext = createContext()\n\n// required to preserve equality\nconst defaultPartialTheme = {}\n\nexport const ThemeProvider = ({ theme: partialTheme = defaultPartialTheme, children }) => {\n const theme = usePartialTheme(partialTheme)\n\n return {children}\n}\n\nThemeProvider.propTypes = {\n children: PropTypes.node.isRequired,\n theme: PropTypes.object,\n}\n\nexport const useTheme = () => useContext(themeContext)\n","import { useMemo } from 'react'\nimport { defaultTheme, extendDefaultTheme } from '../theming'\n\nexport const usePartialTheme = partialTheme =>\n useMemo(() => extendDefaultTheme(defaultTheme, partialTheme), [partialTheme])\n","import { cloneElement } from 'react'\nimport PropTypes from 'prop-types'\n\n// type ConditionalWrapperProps = {\n// children: JSX.Element\n// condition: boolean\n// wrapper: (children: JSX.Element) => JSX.Element\n// }\n\nexport const ConditionalWrapper = ({ children, condition, wrapper }) => {\n if (!condition) return children\n\n return cloneElement(wrapper, {}, children)\n}\n\nConditionalWrapper.propTypes = {\n children: PropTypes.node.isRequired,\n condition: PropTypes.bool.isRequired,\n wrapper: PropTypes.element.isRequired,\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { TooltipProvider, Tooltip } from '@nivo/tooltip'\nimport { ThemeProvider } from '../theming'\nimport { MotionConfigProvider } from '../motion'\nimport { ConditionalWrapper } from './ConditionalWrapper'\n\nconst containerStyle = {\n position: 'relative',\n}\n\nexport const Container = ({\n children,\n theme,\n renderWrapper = true,\n isInteractive = true,\n animate,\n motionStiffness,\n motionDamping,\n motionConfig,\n}) => {\n const container = useRef(null)\n\n return (\n \n \n \n {/* we should not render the div element if using the HTTP API */}\n }\n >\n {children}\n {isInteractive && }\n \n \n \n \n )\n}\n\nContainer.propTypes = {\n children: PropTypes.element.isRequired,\n isInteractive: PropTypes.bool,\n renderWrapper: PropTypes.bool,\n theme: PropTypes.object,\n animate: PropTypes.bool,\n motionStiffness: PropTypes.number,\n motionDamping: PropTypes.number,\n motionConfig: PropTypes.string,\n}\n\nexport default Container\n","export default () => {}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { useRef, useMemo, useCallback } from 'react'\nimport PropTypes from 'prop-types'\nimport {\n TooltipActionsContext,\n TooltipStateContext,\n useTooltipHandlers,\n Tooltip,\n} from '@nivo/tooltip'\nimport noop from '../lib/noop'\nimport { ThemeProvider } from '../theming'\nimport { MotionConfigProvider } from '../motion'\nimport { ConditionalWrapper } from './ConditionalWrapper'\n\nconst containerStyle = {\n position: 'relative',\n}\n\n/**\n * This component should only be used when relying on render props,\n * passing `showTooltip`, `hideTooltip`, but you should use the regular\n * `Container` component.\n *\n * @deprecated\n */\nexport const LegacyContainer = ({\n children,\n theme,\n isInteractive = true,\n renderWrapper = true,\n animate,\n motionStiffness,\n motionDamping,\n motionConfig,\n}) => {\n const container = useRef(null)\n const { actions: tooltipActions, state: tooltipState } = useTooltipHandlers(container)\n\n const showTooltip = useCallback(\n (content, event) => tooltipActions.showTooltipFromEvent(content, event),\n [tooltipActions.showTooltipFromEvent]\n )\n\n const handlers = useMemo(\n () => ({\n showTooltip: isInteractive ? showTooltip : noop,\n hideTooltip: isInteractive ? tooltipActions.hideTooltip : noop,\n }),\n [tooltipActions.hideTooltip, isInteractive, showTooltip]\n )\n\n return (\n \n \n \n \n {/* we should not render the div element if using the HTTP API */}\n }\n >\n {children(handlers)}\n {isInteractive && }\n \n \n \n \n \n )\n}\n\nLegacyContainer.propTypes = {\n children: PropTypes.func.isRequired,\n isInteractive: PropTypes.bool,\n renderWrapper: PropTypes.bool,\n theme: PropTypes.object.isRequired,\n animate: PropTypes.bool.isRequired,\n motionStiffness: PropTypes.number,\n motionDamping: PropTypes.number,\n motionConfig: PropTypes.string,\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { useMeasure } from '../hooks'\n\nconst ResponsiveWrapper = ({ children }) => {\n const [measureRef, bounds] = useMeasure()\n const shouldRender = bounds.width > 0 && bounds.height > 0\n\n return (\n \n {shouldRender && children({ width: bounds.width, height: bounds.height })}\n
\n )\n}\n\nResponsiveWrapper.propTypes = {\n children: PropTypes.func.isRequired,\n}\n\nexport default ResponsiveWrapper\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { LinearGradient } from './LinearGradient'\n\nexport const gradientTypes = {\n linearGradient: LinearGradient,\n}\n\nexport * from './LinearGradient'\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\n\nexport const LinearGradient = ({ id, colors }) => (\n \n {colors.map(({ offset, color, opacity }) => (\n \n ))}\n \n)\n\nLinearGradient.propTypes = {\n id: PropTypes.string.isRequired,\n colors: PropTypes.arrayOf(\n PropTypes.shape({\n offset: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n opacity: PropTypes.number,\n })\n ).isRequired,\n}\n\nexport const linearGradientDef = (id, colors, options = {}) => ({\n id,\n type: 'linearGradient',\n colors,\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nexport const PatternDots = memo(({ id, background, color, size, padding, stagger }) => {\n let fullSize = size + padding\n const radius = size / 2\n const halfPadding = padding / 2\n if (stagger === true) {\n fullSize = size * 2 + padding * 2\n }\n\n return (\n \n \n \n {stagger && (\n \n )}\n \n )\n})\n\nPatternDots.displayName = 'PatternDots'\nPatternDots.propTypes = {\n id: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n background: PropTypes.string.isRequired,\n size: PropTypes.number.isRequired,\n padding: PropTypes.number.isRequired,\n stagger: PropTypes.bool.isRequired,\n}\n\nPatternDots.defaultProps = {\n color: '#000000',\n background: '#ffffff',\n size: 4,\n padding: 4,\n stagger: false,\n}\n\nexport const patternDotsDef = (id, options = {}) => ({\n id,\n type: 'patternDots',\n ...options,\n})\n","export const TWO_PI = Math.PI * 2\n\nexport const degreesToRadians = degrees => (degrees * Math.PI) / 180\n\nexport const radiansToDegrees = radians => (180 * radians) / Math.PI\n\nexport const midAngle = arc => arc.startAngle + (arc.endAngle - arc.startAngle) / 2\n\nexport const positionFromAngle = (angle, distance) => ({\n x: Math.cos(angle) * distance,\n y: Math.sin(angle) * distance,\n})\n\n/**\n * Normalize given angle (degrees) in the 0~360 range.\n *\n * @param {number} angle\n *\n * @return {number}\n */\nexport const absoluteAngleDegrees = angle => {\n let absAngle = angle % 360\n if (absAngle < 0) {\n absAngle += 360\n }\n\n return absAngle\n}\n\nexport const absoluteAngleRadians = angle => angle - TWO_PI * Math.floor((angle + Math.PI) / TWO_PI)\n","export const textPropsByEngine = {\n svg: {\n align: {\n left: 'start',\n center: 'middle',\n right: 'end',\n start: 'start',\n middle: 'middle',\n end: 'end',\n },\n baseline: {\n top: 'text-before-edge',\n center: 'central',\n bottom: 'alphabetic',\n },\n },\n canvas: {\n align: {\n left: 'left',\n center: 'center',\n right: 'right',\n start: 'left',\n middle: 'center',\n end: 'right',\n },\n baseline: {\n top: 'top',\n center: 'middle',\n bottom: 'bottom',\n },\n },\n}\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { degreesToRadians } from '../../../lib/polar'\n\nexport const PatternLines = memo(\n ({ id, spacing: _spacing, rotation: _rotation, background, color, lineWidth }) => {\n let rotation = Math.round(_rotation) % 360\n const spacing = Math.abs(_spacing)\n\n if (rotation > 180) rotation = rotation - 360\n else if (rotation > 90) rotation = rotation - 180\n else if (rotation < -180) rotation = rotation + 360\n else if (rotation < -90) rotation = rotation + 180\n\n let width = spacing\n let height = spacing\n let path\n\n if (rotation === 0) {\n path = `\n M 0 0 L ${width} 0\n M 0 ${height} L ${width} ${height}\n `\n } else if (rotation === 90) {\n path = `\n M 0 0 L 0 ${height}\n M ${width} 0 L ${width} ${height}\n `\n } else {\n width = Math.abs(spacing / Math.sin(degreesToRadians(rotation)))\n height = spacing / Math.sin(degreesToRadians(90 - rotation))\n\n if (rotation > 0) {\n path = `\n M 0 ${-height} L ${width * 2} ${height}\n M ${-width} ${-height} L ${width} ${height}\n M ${-width} 0 L ${width} ${height * 2}\n `\n } else {\n path = `\n M ${-width} ${height} L ${width} ${-height}\n M ${-width} ${height * 2} L ${width * 2} ${-height}\n M 0 ${height * 2} L ${width * 2} 0\n `\n }\n }\n\n return (\n \n \n \n \n )\n }\n)\n\nPatternLines.displayName = 'PatternLines'\nPatternLines.propTypes = {\n id: PropTypes.string.isRequired,\n spacing: PropTypes.number.isRequired,\n rotation: PropTypes.number.isRequired,\n background: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n lineWidth: PropTypes.number.isRequired,\n}\nPatternLines.defaultProps = {\n spacing: 5,\n rotation: 0,\n color: '#000000',\n background: '#ffffff',\n lineWidth: 2,\n}\n\nexport const patternLinesDef = (id, options = {}) => ({\n id,\n type: 'patternLines',\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nexport const PatternSquares = memo(({ id, background, color, size, padding, stagger }) => {\n let fullSize = size + padding\n const halfPadding = padding / 2\n if (stagger === true) {\n fullSize = size * 2 + padding * 2\n }\n\n return (\n \n \n \n {stagger && (\n \n )}\n \n )\n})\n\nPatternSquares.displayName = 'PatternSquares'\nPatternSquares.propTypes = {\n id: PropTypes.string.isRequired,\n color: PropTypes.string.isRequired,\n background: PropTypes.string.isRequired,\n size: PropTypes.number.isRequired,\n padding: PropTypes.number.isRequired,\n stagger: PropTypes.bool.isRequired,\n}\nPatternSquares.defaultProps = {\n color: '#000000',\n background: '#ffffff',\n size: 4,\n padding: 4,\n stagger: false,\n}\n\nexport const patternSquaresDef = (id, options = {}) => ({\n id,\n type: 'patternSquares',\n ...options,\n})\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { PatternDots } from './PatternDots'\nimport { PatternLines } from './PatternLines'\nimport { PatternSquares } from './PatternSquares'\n\nexport const patternTypes = {\n patternDots: PatternDots,\n patternLines: PatternLines,\n patternSquares: PatternSquares,\n}\n\nexport * from './PatternDots'\nexport * from './PatternLines'\nexport * from './PatternSquares'\n","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { gradientTypes } from './gradients'\nimport { patternTypes } from './patterns'\n\nexport const defsMapping = {\n ...gradientTypes,\n ...patternTypes,\n}\n\nconst Defs = ({ defs: definitions }) => {\n if (!definitions || definitions.length < 1) return null\n\n return (\n \n {definitions.map(({ type, ...def }) => {\n if (defsMapping[type])\n return React.createElement(defsMapping[type], { key: def.id, ...def })\n\n return null\n })}\n \n )\n}\n\nDefs.propTypes = {\n defs: PropTypes.arrayOf(\n PropTypes.shape({\n type: PropTypes.oneOf(Object.keys(defsMapping)).isRequired,\n id: PropTypes.string.isRequired,\n })\n ),\n}\n\nexport default memo(Defs)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React from 'react'\nimport PropTypes from 'prop-types'\nimport { Defs } from './defs'\nimport { useTheme } from '../theming'\n\nconst SvgWrapper = ({ width, height, margin, defs, children, role }) => {\n const theme = useTheme()\n\n return (\n \n )\n}\n\nSvgWrapper.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n margin: PropTypes.shape({\n top: PropTypes.number.isRequired,\n left: PropTypes.number.isRequired,\n }).isRequired,\n defs: PropTypes.array,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n role: PropTypes.string,\n}\n\nexport default SvgWrapper\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\n\nconst DotsItemSymbol = ({ size, color, borderWidth, borderColor }) => (\n \n)\n\nDotsItemSymbol.propTypes = {\n size: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n borderWidth: PropTypes.number.isRequired,\n borderColor: PropTypes.string.isRequired,\n}\n\nexport default memo(DotsItemSymbol)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useSpring, animated } from '@react-spring/web'\nimport { dotsThemePropType } from '../../theming'\nimport { useMotionConfig } from '../../motion'\nimport DotsItemSymbol from './DotsItemSymbol'\n\nconst DotsItem = ({\n x,\n y,\n symbol,\n size,\n datum,\n color,\n borderWidth,\n borderColor,\n label,\n labelTextAnchor,\n labelYOffset,\n theme,\n}) => {\n const { animate, config: springConfig } = useMotionConfig()\n\n const animatedProps = useSpring({\n transform: `translate(${x}, ${y})`,\n config: springConfig,\n immediate: !animate,\n })\n\n return (\n \n {React.createElement(symbol, {\n size,\n color,\n datum,\n borderWidth,\n borderColor,\n })}\n {label && (\n \n {label}\n \n )}\n \n )\n}\n\nDotsItem.propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n datum: PropTypes.object.isRequired,\n\n size: PropTypes.number.isRequired,\n color: PropTypes.string.isRequired,\n borderWidth: PropTypes.number.isRequired,\n borderColor: PropTypes.string.isRequired,\n\n symbol: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n\n label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n labelTextAnchor: PropTypes.oneOf(['start', 'middle', 'end']),\n labelYOffset: PropTypes.number.isRequired,\n\n theme: PropTypes.shape({\n dots: dotsThemePropType.isRequired,\n }).isRequired,\n}\n\nexport const DotsItemDefaultProps = {\n symbol: DotsItemSymbol,\n\n labelTextAnchor: 'middle',\n labelYOffset: -12,\n}\n\nDotsItem.defaultProps = DotsItemDefaultProps\n\nexport default memo(DotsItem)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport { useTheme } from '../../../theming'\n\n/**\n *\n * @param {string} axis\n * @param {number} width\n * @param {number} height\n * @param {string} position\n * @param {number} offsetX\n * @param {number} offsetY\n * @param {string} orientation\n * @return {{ x: number, y: number, textAnchor: string }}\n */\nconst computeLabel = ({ axis, width, height, position, offsetX, offsetY, orientation }) => {\n let x = 0\n let y = 0\n const rotation = orientation === 'vertical' ? -90 : 0\n let textAnchor = 'start'\n\n if (axis === 'x') {\n switch (position) {\n case 'top-left':\n x = -offsetX\n y = offsetY\n textAnchor = 'end'\n break\n case 'top':\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'start'\n }\n break\n case 'top-right':\n x = offsetX\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'end'\n }\n break\n case 'right':\n x = offsetX\n y = height / 2\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'middle'\n }\n break\n case 'bottom-right':\n x = offsetX\n y = height - offsetY\n textAnchor = 'start'\n break\n case 'bottom':\n y = height + offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'end'\n }\n break\n case 'bottom-left':\n y = height - offsetY\n x = -offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'start'\n }\n break\n case 'left':\n x = -offsetX\n y = height / 2\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'middle'\n }\n break\n }\n } else {\n switch (position) {\n case 'top-left':\n x = offsetX\n y = -offsetY\n textAnchor = 'start'\n break\n case 'top':\n x = width / 2\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'start'\n }\n break\n case 'top-right':\n x = width - offsetX\n y = -offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'start'\n }\n break\n case 'right':\n x = width + offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'middle'\n }\n break\n case 'bottom-right':\n x = width - offsetX\n y = offsetY\n textAnchor = 'end'\n break\n case 'bottom':\n x = width / 2\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'middle'\n } else {\n textAnchor = 'end'\n }\n break\n case 'bottom-left':\n x = offsetX\n y = offsetY\n if (orientation === 'horizontal') {\n textAnchor = 'start'\n } else {\n textAnchor = 'end'\n }\n break\n case 'left':\n x = -offsetX\n if (orientation === 'horizontal') {\n textAnchor = 'end'\n } else {\n textAnchor = 'middle'\n }\n break\n }\n }\n\n return { x, y, rotation, textAnchor }\n}\n\nconst CartesianMarkersItem = ({\n width,\n height,\n axis,\n scale,\n value,\n lineStyle,\n textStyle,\n legend,\n legendPosition,\n legendOffsetX,\n legendOffsetY,\n legendOrientation,\n}) => {\n const theme = useTheme()\n\n let x = 0\n let x2 = 0\n let y = 0\n let y2 = 0\n\n if (axis === 'y') {\n y = scale(value)\n x2 = width\n } else {\n x = scale(value)\n y2 = height\n }\n\n let legendNode = null\n if (legend) {\n const legendProps = computeLabel({\n axis,\n width,\n height,\n position: legendPosition,\n offsetX: legendOffsetX,\n offsetY: legendOffsetY,\n orientation: legendOrientation,\n })\n legendNode = (\n \n {legend}\n \n )\n }\n\n return (\n \n \n {legendNode}\n \n )\n}\n\nCartesianMarkersItem.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n\n axis: PropTypes.oneOf(['x', 'y']).isRequired,\n scale: PropTypes.func.isRequired,\n value: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.instanceOf(Date)])\n .isRequired,\n lineStyle: PropTypes.object,\n textStyle: PropTypes.object,\n\n legend: PropTypes.string,\n legendPosition: PropTypes.oneOf([\n 'top-left',\n 'top',\n 'top-right',\n 'right',\n 'bottom-right',\n 'bottom',\n 'bottom-left',\n 'left',\n ]),\n legendOffsetX: PropTypes.number.isRequired,\n legendOffsetY: PropTypes.number.isRequired,\n legendOrientation: PropTypes.oneOf(['horizontal', 'vertical']).isRequired,\n}\nCartesianMarkersItem.defaultProps = {\n legendPosition: 'top-right',\n legendOffsetX: 14,\n legendOffsetY: 14,\n legendOrientation: 'horizontal',\n}\n\nexport default memo(CartesianMarkersItem)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { memo } from 'react'\nimport PropTypes from 'prop-types'\nimport CartesianMarkersItem from './CartesianMarkersItem'\n\nconst CartesianMarkers = ({ markers, width, height, xScale, yScale }) => {\n if (!markers || markers.length === 0) return null\n\n return markers.map((marker, i) => (\n \n ))\n}\n\nCartesianMarkers.propTypes = {\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n\n xScale: PropTypes.func.isRequired,\n yScale: PropTypes.func.isRequired,\n\n markers: PropTypes.arrayOf(\n PropTypes.shape({\n axis: PropTypes.oneOf(['x', 'y']).isRequired,\n value: PropTypes.oneOfType([\n PropTypes.number,\n PropTypes.string,\n PropTypes.instanceOf(Date),\n ]).isRequired,\n lineStyle: PropTypes.object,\n textStyle: PropTypes.object,\n })\n ),\n}\n\nexport default memo(CartesianMarkers)\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { compose, setPropTypes, defaultProps, withPropsOnChange } from '@nivo/recompose'\nimport PropTypes from 'prop-types'\nimport isEqual from 'lodash/isEqual'\nimport { marginPropType } from '../props'\nimport { defaultMargin } from '../defaults'\n\n/**\n * This HOC watch width, height & margin props change\n * and returns new width/height plus outer dimensions.\n * Using it prevent from having a new ref each time\n * we pass through the component, useful for shallow comparison.\n * It also add required propTypes & set default margin.\n */\nexport default () =>\n compose(\n defaultProps({\n margin: defaultMargin,\n }),\n setPropTypes({\n width: PropTypes.number.isRequired,\n height: PropTypes.number.isRequired,\n margin: marginPropType,\n }),\n withPropsOnChange(\n (props, nextProps) =>\n props.width !== nextProps.width ||\n props.height !== nextProps.height ||\n !isEqual(props.margin, nextProps.margin),\n props => {\n const margin = Object.assign({}, defaultMargin, props.margin)\n\n return {\n margin,\n width: props.width - margin.left - margin.right,\n height: props.height - margin.top - margin.bottom,\n outerWidth: props.width,\n outerHeight: props.height,\n }\n }\n )\n )\n","import isFunction from 'lodash/isFunction'\nimport get from 'lodash/get'\nimport { format } from 'd3-format'\nimport { useMemo } from 'react'\n\nexport const getLabelGenerator = (_label, labelFormat) => {\n const getRawLabel = isFunction(_label) ? _label : d => get(d, _label)\n let formatter\n if (labelFormat) {\n formatter = isFunction(labelFormat) ? labelFormat : format(labelFormat)\n }\n\n if (formatter) return d => formatter(getRawLabel(d))\n return getRawLabel\n}\n\nexport const getPropertyAccessor = accessor =>\n isFunction(accessor) ? accessor : d => get(d, accessor)\n\nexport const usePropertyAccessor = accessor =>\n useMemo(() => getPropertyAccessor(accessor), [accessor])\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { compose, defaultProps, setPropTypes } from '@nivo/recompose'\nimport { motionPropTypes } from '../motion'\nimport { defaultAnimate, defaultMotionDamping, defaultMotionStiffness } from '../defaults'\n\nexport default () =>\n compose(\n setPropTypes(motionPropTypes),\n defaultProps({\n animate: defaultAnimate,\n motionDamping: defaultMotionDamping,\n motionStiffness: defaultMotionStiffness,\n })\n )\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport { compose, setPropTypes, withPropsOnChange } from '@nivo/recompose'\nimport PropTypes from 'prop-types'\nimport { defaultTheme, extendDefaultTheme } from '../theming'\n\n/**\n * This HOC watch theme prop change\n * and returns it deeply merged with default theme.\n * Using it prevent from having a new ref each time\n * we pass through the component, useful for shallow comparison.\n */\nexport default ({ srcKey = 'theme', destKey = 'theme' } = {}) =>\n compose(\n setPropTypes({\n [srcKey]: PropTypes.object,\n }),\n withPropsOnChange([srcKey], props => ({\n [destKey]: extendDefaultTheme(defaultTheme, props[srcKey]),\n }))\n )\n","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\nimport React, { Component } from 'react'\nimport { Container } from '../components/Container'\n\nexport const withContainer = WrappedComponent => {\n // eslint-disable-next-line react/display-name\n return class extends Component {\n render() {\n // eslint-disable-next-line react/prop-types\n const {\n theme,\n renderWrapper,\n animate,\n motionStiffness,\n motionDamping,\n motionConfig,\n ...childProps\n } = this.props\n\n return (\n \n \n \n )\n }\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import getPrototypeOf from \"./getPrototypeOf\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn\";\nexport default function _createSuper(Derived) {\n return function () {\n var Super = getPrototypeOf(Derived),\n result;\n\n if (isNativeReflectConstruct()) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return possibleConstructorReturn(this, result);\n };\n}","/**\n * Computes distance between two points.\n *\n * @param {number} x1\n * @param {number} y1\n * @param {number} x2\n * @param {number} y2\n * @return {number}\n */\nexport const getDistance = (x1, y1, x2, y2) => {\n let deltaX = x2 - x1\n let deltaY = y2 - y1\n\n deltaX *= deltaX\n deltaY *= deltaY\n\n return Math.sqrt(deltaX + deltaY)\n}\n\n/**\n * Computes angle (radians) between two points.\n *\n * @param {number} x1\n * @param {number} y1\n * @param {number} x2\n * @param {number} y2\n * @return {number}\n */\nexport const getAngle = (x1, y1, x2, y2) => {\n const angle = Math.atan2(y2 - y1, x2 - x1) - Math.PI / 2\n\n return angle > 0 ? angle : Math.PI * 2 + angle\n}\n\n/**\n * Check if cursor is in given rectangle.\n *\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n * @param {number} cursorX\n * @param {number} cursorY\n * @return {boolean}\n */\nexport const isCursorInRect = (x, y, width, height, cursorX, cursorY) =>\n x <= cursorX && cursorX <= x + width && y <= cursorY && cursorY <= y + height\n","/*\n * This file is part of the nivo project.\n *\n * Copyright 2016-present, Raphaël Benitte.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nexport * from './detect'\n\nexport const getRelativeCursor = (el, event) => {\n const { clientX, clientY } = event\n const bounds = el.getBoundingClientRect()\n\n return [clientX - bounds.left, clientY - bounds.top]\n}\n","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import isFunction from 'lodash/isFunction'\nimport isPlainObject from 'lodash/isPlainObject'\nimport pick from 'lodash/pick'\nimport isEqual from 'lodash/isEqual'\nimport get from 'lodash/get'\nimport set from 'lodash/set'\nimport { gradientTypes, patternTypes } from '../components/defs'\n\nconst gradientKeys = Object.keys(gradientTypes)\nconst patternKeys = Object.keys(patternTypes)\n\n/**\n * Check a node matches given def predicate.\n *\n * @param {string|Function|Object} predicate\n * @param {Object} node\n * @param {string} [dataKey] - Optional path to access node data\n * @returns {boolean}\n */\nexport const isMatchingDef = (predicate, node, dataKey) => {\n if (predicate === '*') {\n return true\n } else if (isFunction(predicate)) {\n return predicate(node)\n } else if (isPlainObject(predicate)) {\n const data = dataKey ? get(node, dataKey) : node\n return isEqual(pick(data, Object.keys(predicate)), predicate)\n }\n\n return false\n}\n\n/**\n * Compute SVG defs.\n *\n * @param {Array.