UNPKG

ivt

Version:

Ivt Components Library

1 lines 986 kB
{"version":3,"file":"index.mjs","sources":["../../node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js","../../node_modules/es-toolkit/dist/compat/_internal/isDeepKey.js","../../node_modules/es-toolkit/dist/compat/_internal/toKey.js","../../node_modules/es-toolkit/dist/compat/util/toPath.js","../../node_modules/es-toolkit/dist/compat/object/get.js","../../node_modules/es-toolkit/compat/get.js","../../node_modules/recharts/es6/util/DataUtils.js","../../node_modules/recharts/es6/util/types.js","../../node_modules/recharts/es6/util/ReactUtils.js","../../node_modules/recharts/es6/container/Surface.js","../../node_modules/recharts/es6/context/legendPortalContext.js","../../node_modules/d3-shape/src/constant.js","../../node_modules/d3-shape/src/math.js","../../node_modules/d3-path/src/path.js","../../node_modules/d3-shape/src/path.js","../../node_modules/d3-shape/src/array.js","../../node_modules/d3-shape/src/curve/linear.js","../../node_modules/d3-shape/src/point.js","../../node_modules/d3-shape/src/line.js","../../node_modules/d3-shape/src/area.js","../../node_modules/d3-shape/src/curve/bump.js","../../node_modules/d3-shape/src/symbol/circle.js","../../node_modules/d3-shape/src/symbol/cross.js","../../node_modules/d3-shape/src/symbol/diamond.js","../../node_modules/d3-shape/src/symbol/square.js","../../node_modules/d3-shape/src/symbol/star.js","../../node_modules/d3-shape/src/symbol/triangle.js","../../node_modules/d3-shape/src/symbol/wye.js","../../node_modules/d3-shape/src/noop.js","../../node_modules/d3-shape/src/curve/basis.js","../../node_modules/d3-shape/src/curve/basisClosed.js","../../node_modules/d3-shape/src/curve/basisOpen.js","../../node_modules/d3-shape/src/curve/linearClosed.js","../../node_modules/d3-shape/src/curve/monotone.js","../../node_modules/d3-shape/src/curve/natural.js","../../node_modules/d3-shape/src/curve/step.js","../../node_modules/d3-shape/src/offset/none.js","../../node_modules/d3-shape/src/order/none.js","../../node_modules/d3-shape/src/stack.js","../../node_modules/recharts/es6/shape/Symbols.js","../../node_modules/d3-shape/src/symbol.js","../../node_modules/recharts/es6/component/DefaultLegendContent.js","../../node_modules/es-toolkit/dist/array/uniqBy.js","../../node_modules/es-toolkit/dist/function/identity.js","../../node_modules/es-toolkit/dist/predicate/isLength.js","../../node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js","../../node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js","../../node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js","../../node_modules/es-toolkit/dist/compat/object/property.js","../../node_modules/es-toolkit/dist/compat/predicate/isObject.js","../../node_modules/es-toolkit/dist/predicate/isPrimitive.js","../../node_modules/es-toolkit/dist/compat/util/eq.js","../../node_modules/es-toolkit/dist/compat/predicate/isMatchWith.js","../../node_modules/es-toolkit/dist/compat/predicate/isMatch.js","../../node_modules/es-toolkit/dist/compat/_internal/getSymbols.js","../../node_modules/es-toolkit/dist/compat/_internal/getTag.js","../../node_modules/es-toolkit/dist/compat/_internal/tags.js","../../node_modules/es-toolkit/dist/predicate/isTypedArray.js","../../node_modules/es-toolkit/dist/object/cloneDeepWith.js","../../node_modules/es-toolkit/dist/object/cloneDeep.js","../../node_modules/es-toolkit/dist/compat/predicate/matches.js","../../node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js","../../node_modules/es-toolkit/dist/compat/object/cloneDeep.js","../../node_modules/es-toolkit/dist/compat/_internal/isIndex.js","../../node_modules/es-toolkit/dist/compat/predicate/isArguments.js","../../node_modules/es-toolkit/dist/compat/object/has.js","../../node_modules/es-toolkit/dist/compat/predicate/matchesProperty.js","../../node_modules/es-toolkit/dist/compat/util/iteratee.js","../../node_modules/es-toolkit/dist/compat/array/uniqBy.js","../../node_modules/es-toolkit/compat/uniqBy.js","../../node_modules/recharts/es6/util/payload/getUniqPayload.js","../../node_modules/use-sync-external-store/shim/with-selector.js","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js","../../node_modules/recharts/es6/state/RechartsReduxContext.js","../../node_modules/recharts/es6/state/hooks.js","../../node_modules/reselect/dist/reselect.mjs","../../node_modules/es-toolkit/dist/compat/_internal/compareValues.js","../../node_modules/es-toolkit/dist/compat/predicate/isSymbol.js","../../node_modules/es-toolkit/dist/compat/_internal/isKey.js","../../node_modules/es-toolkit/dist/compat/array/orderBy.js","../../node_modules/es-toolkit/dist/array/flatten.js","../../node_modules/es-toolkit/dist/compat/_internal/isIterateeCall.js","../../node_modules/es-toolkit/dist/compat/array/sortBy.js","../../node_modules/es-toolkit/compat/sortBy.js","../../node_modules/recharts/es6/state/selectors/legendSelectors.js","../../node_modules/recharts/es6/util/useElementOffset.js","../../node_modules/immer/dist/immer.mjs","../../node_modules/recharts/es6/util/PolarUtils.js","../../node_modules/recharts/es6/util/ChartUtils.js","../../node_modules/d3-shape/src/offset/expand.js","../../node_modules/d3-shape/src/offset/silhouette.js","../../node_modules/d3-shape/src/offset/wiggle.js","../../node_modules/recharts/es6/state/selectors/containerSelectors.js","../../node_modules/recharts/es6/state/selectors/selectAllAxes.js","../../node_modules/recharts/es6/state/selectors/selectChartOffsetInternal.js","../../node_modules/recharts/es6/util/Constants.js","../../node_modules/recharts/es6/context/PanoramaContext.js","../../node_modules/recharts/es6/state/selectors/brushSelectors.js","../../node_modules/recharts/es6/context/chartLayoutContext.js","../../node_modules/recharts/es6/state/legendSlice.js","../../node_modules/recharts/es6/component/Legend.js","../../node_modules/recharts/es6/context/legendPayloadContext.js","../../node_modules/recharts/es6/component/DefaultTooltipContent.js","../../node_modules/recharts/es6/util/tooltip/translate.js","../../node_modules/recharts/es6/component/TooltipBoundingBox.js","../../node_modules/recharts/es6/util/Global.js","../../node_modules/recharts/es6/util/isWellBehavedNumber.js","../../node_modules/recharts/es6/shape/Curve.js","../../node_modules/recharts/es6/shape/Cross.js","../../node_modules/recharts/es6/util/resolveDefaultProps.js","../../node_modules/es-toolkit/dist/predicate/isPlainObject.js","../../node_modules/es-toolkit/dist/predicate/isEqualWith.js","../../node_modules/es-toolkit/dist/function/noop.js","../../node_modules/es-toolkit/dist/predicate/isEqual.js","../../node_modules/es-toolkit/compat/isEqual.js","../../node_modules/recharts/es6/animation/easing.js","../../node_modules/recharts/es6/animation/util.js","../../node_modules/recharts/es6/animation/configUpdate.js","../../node_modules/recharts/es6/animation/timeoutController.js","../../node_modules/recharts/es6/animation/Animate.js","../../node_modules/recharts/es6/animation/AnimationManager.js","../../node_modules/recharts/es6/shape/Rectangle.js","../../node_modules/recharts/es6/util/cursor/getRadialCursorPoints.js","../../node_modules/recharts/es6/shape/Sector.js","../../node_modules/recharts/es6/util/cursor/getCursorPoints.js","../../node_modules/es-toolkit/dist/compat/util/toNumber.js","../../node_modules/es-toolkit/dist/compat/util/toFinite.js","../../node_modules/es-toolkit/dist/compat/math/range.js","../../node_modules/es-toolkit/compat/range.js","../../node_modules/d3-array/src/ascending.js","../../node_modules/d3-array/src/descending.js","../../node_modules/d3-array/src/bisector.js","../../node_modules/d3-array/src/number.js","../../node_modules/d3-array/src/bisect.js","../../node_modules/internmap/src/index.js","../../node_modules/d3-array/src/sort.js","../../node_modules/d3-array/src/ticks.js","../../node_modules/d3-array/src/max.js","../../node_modules/d3-array/src/min.js","../../node_modules/d3-array/src/quickselect.js","../../node_modules/d3-array/src/quantile.js","../../node_modules/d3-scale/src/init.js","../../node_modules/d3-scale/src/ordinal.js","../../node_modules/d3-scale/src/band.js","../../node_modules/d3-array/src/range.js","../../node_modules/d3-color/src/define.js","../../node_modules/d3-color/src/color.js","../../node_modules/d3-interpolate/src/constant.js","../../node_modules/d3-interpolate/src/color.js","../../node_modules/d3-interpolate/src/rgb.js","../../node_modules/d3-interpolate/src/numberArray.js","../../node_modules/d3-interpolate/src/array.js","../../node_modules/d3-interpolate/src/date.js","../../node_modules/d3-interpolate/src/number.js","../../node_modules/d3-interpolate/src/object.js","../../node_modules/d3-interpolate/src/string.js","../../node_modules/d3-interpolate/src/value.js","../../node_modules/d3-interpolate/src/round.js","../../node_modules/d3-interpolate/src/piecewise.js","../../node_modules/d3-scale/src/number.js","../../node_modules/d3-scale/src/continuous.js","../../node_modules/d3-scale/src/constant.js","../../node_modules/d3-format/src/formatDecimal.js","../../node_modules/d3-format/src/exponent.js","../../node_modules/d3-format/src/formatSpecifier.js","../../node_modules/d3-format/src/formatPrefixAuto.js","../../node_modules/d3-format/src/formatRounded.js","../../node_modules/d3-format/src/formatTypes.js","../../node_modules/d3-format/src/identity.js","../../node_modules/d3-format/src/locale.js","../../node_modules/d3-format/src/defaultLocale.js","../../node_modules/d3-format/src/formatGroup.js","../../node_modules/d3-format/src/formatNumerals.js","../../node_modules/d3-format/src/formatTrim.js","../../node_modules/d3-scale/src/tickFormat.js","../../node_modules/d3-format/src/precisionPrefix.js","../../node_modules/d3-format/src/precisionRound.js","../../node_modules/d3-format/src/precisionFixed.js","../../node_modules/d3-scale/src/linear.js","../../node_modules/d3-scale/src/nice.js","../../node_modules/d3-scale/src/log.js","../../node_modules/d3-scale/src/symlog.js","../../node_modules/d3-scale/src/pow.js","../../node_modules/d3-scale/src/radial.js","../../node_modules/d3-time/src/interval.js","../../node_modules/d3-time/src/millisecond.js","../../node_modules/d3-time/src/duration.js","../../node_modules/d3-time/src/second.js","../../node_modules/d3-time/src/minute.js","../../node_modules/d3-time/src/hour.js","../../node_modules/d3-time/src/day.js","../../node_modules/d3-time/src/week.js","../../node_modules/d3-time/src/month.js","../../node_modules/d3-time/src/year.js","../../node_modules/d3-time/src/ticks.js","../../node_modules/d3-time-format/src/locale.js","../../node_modules/d3-time-format/src/defaultLocale.js","../../node_modules/d3-scale/src/time.js","../../node_modules/d3-scale/src/sequential.js","../../node_modules/d3-scale/src/diverging.js","../../node_modules/d3-scale/src/identity.js","../../node_modules/d3-scale/src/quantile.js","../../node_modules/d3-scale/src/quantize.js","../../node_modules/d3-scale/src/sequentialQuantile.js","../../node_modules/d3-scale/src/threshold.js","../../node_modules/d3-scale/src/utcTime.js","../../node_modules/recharts/es6/state/selectors/dataSelectors.js","../../node_modules/recharts/es6/util/isDomainSpecifiedByUser.js","../../node_modules/decimal.js-light/decimal.mjs","../../node_modules/recharts/es6/util/scale/util/utils.js","../../node_modules/recharts/es6/util/scale/util/arithmetic.js","../../node_modules/recharts/es6/util/scale/getNiceTickValues.js","../../node_modules/recharts/es6/state/selectors/rootPropsSelectors.js","../../node_modules/recharts/es6/polar/defaultPolarAngleAxisProps.js","../../node_modules/recharts/es6/polar/defaultPolarRadiusAxisProps.js","../../node_modules/recharts/es6/state/selectors/combiners/combineAxisRangeWithReverse.js","../../node_modules/recharts/es6/state/selectors/polarAxisSelectors.js","../../node_modules/recharts/es6/state/selectors/pickAxisType.js","../../node_modules/recharts/es6/state/selectors/pickAxisId.js","../../node_modules/recharts/es6/state/selectors/axisSelectors.js","../../node_modules/recharts/es6/state/selectors/selectTooltipEventType.js","../../node_modules/recharts/es6/state/selectors/combiners/combineActiveLabel.js","../../node_modules/recharts/es6/state/tooltipSlice.js","../../node_modules/recharts/es6/state/selectors/combiners/combineTooltipInteractionState.js","../../node_modules/recharts/es6/state/selectors/combiners/combineActiveTooltipIndex.js","../../node_modules/recharts/es6/state/selectors/combiners/combineCoordinateForDefaultIndex.js","../../node_modules/recharts/es6/state/selectors/combiners/combineTooltipPayloadConfigurations.js","../../node_modules/recharts/es6/state/selectors/selectTooltipPayloadSearcher.js","../../node_modules/recharts/es6/state/selectors/selectTooltipState.js","../../node_modules/recharts/es6/state/selectors/combiners/combineTooltipPayload.js","../../node_modules/recharts/es6/state/selectors/tooltipSelectors.js","../../node_modules/recharts/es6/state/selectors/selectTooltipSettings.js","../../node_modules/recharts/es6/context/useTooltipAxis.js","../../node_modules/recharts/es6/state/selectors/selectors.js","../../node_modules/recharts/es6/component/Cursor.js","../../node_modules/recharts/es6/util/cursor/getCursorRectangle.js","../../node_modules/recharts/es6/context/tooltipPortalContext.js","../../node_modules/eventemitter3/index.js","../../node_modules/recharts/es6/util/Events.js","../../node_modules/recharts/es6/synchronisation/syncSelectors.js","../../node_modules/recharts/es6/synchronisation/useChartSynchronisation.js","../../node_modules/recharts/es6/component/Tooltip.js","../../node_modules/es-toolkit/dist/compat/function/debounce.js","../../node_modules/es-toolkit/dist/compat/function/throttle.js","../../node_modules/es-toolkit/compat/throttle.js","../../node_modules/recharts/es6/util/LogUtils.js","../../node_modules/recharts/es6/component/ResponsiveContainer.js","../../src/components/ui/chart/chart.tsx","../../node_modules/recharts/es6/context/accessibilityContext.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\nfunction isUnsafeProperty(key) {\n return key === '__proto__';\n}\n\nexports.isUnsafeProperty = isUnsafeProperty;\n","'use strict';\n\nObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\nfunction isDeepKey(key) {\n switch (typeof key) {\n case 'number':\n case 'symbol': {\n return false;\n }\n case 'string': {\n return key.includes('.') || key.includes('[') || key.includes(']');\n }\n }\n}\n\nexports.isDeepKey = isDeepKey;\n","'use strict';\n\nObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\nfunction toKey(value) {\n if (typeof value === 'string' || typeof value === 'symbol') {\n return value;\n }\n if (Object.is(value?.valueOf?.(), -0)) {\n return '-0';\n }\n return String(value);\n}\n\nexports.toKey = toKey;\n","'use strict';\n\nObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\nfunction toPath(deepKey) {\n const result = [];\n const length = deepKey.length;\n if (length === 0) {\n return result;\n }\n let index = 0;\n let key = '';\n let quoteChar = '';\n let bracket = false;\n if (deepKey.charCodeAt(0) === 46) {\n result.push('');\n index++;\n }\n while (index < length) {\n const char = deepKey[index];\n if (quoteChar) {\n if (char === '\\\\' && index + 1 < length) {\n index++;\n key += deepKey[index];\n }\n else if (char === quoteChar) {\n quoteChar = '';\n }\n else {\n key += char;\n }\n }\n else if (bracket) {\n if (char === '\"' || char === \"'\") {\n quoteChar = char;\n }\n else if (char === ']') {\n bracket = false;\n result.push(key);\n key = '';\n }\n else {\n key += char;\n }\n }\n else {\n if (char === '[') {\n bracket = true;\n if (key) {\n result.push(key);\n key = '';\n }\n }\n else if (char === '.') {\n if (key) {\n result.push(key);\n key = '';\n }\n }\n else {\n key += char;\n }\n }\n index++;\n }\n if (key) {\n result.push(key);\n }\n return result;\n}\n\nexports.toPath = toPath;\n","'use strict';\n\nObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\nconst isUnsafeProperty = require('../../_internal/isUnsafeProperty.js');\nconst isDeepKey = require('../_internal/isDeepKey.js');\nconst toKey = require('../_internal/toKey.js');\nconst toPath = require('../util/toPath.js');\n\nfunction get(object, path, defaultValue) {\n if (object == null) {\n return defaultValue;\n }\n switch (typeof path) {\n case 'string': {\n if (isUnsafeProperty.isUnsafeProperty(path)) {\n return defaultValue;\n }\n const result = object[path];\n if (result === undefined) {\n if (isDeepKey.isDeepKey(path)) {\n return get(object, toPath.toPath(path), defaultValue);\n }\n else {\n return defaultValue;\n }\n }\n return result;\n }\n case 'number':\n case 'symbol': {\n if (typeof path === 'number') {\n path = toKey.toKey(path);\n }\n const result = object[path];\n if (result === undefined) {\n return defaultValue;\n }\n return result;\n }\n default: {\n if (Array.isArray(path)) {\n return getWithPath(object, path, defaultValue);\n }\n if (Object.is(path?.valueOf(), -0)) {\n path = '-0';\n }\n else {\n path = String(path);\n }\n if (isUnsafeProperty.isUnsafeProperty(path)) {\n return defaultValue;\n }\n const result = object[path];\n if (result === undefined) {\n return defaultValue;\n }\n return result;\n }\n }\n}\nfunction getWithPath(object, path, defaultValue) {\n if (path.length === 0) {\n return defaultValue;\n }\n let current = object;\n for (let index = 0; index < path.length; index++) {\n if (current == null) {\n return defaultValue;\n }\n if (isUnsafeProperty.isUnsafeProperty(path[index])) {\n return defaultValue;\n }\n current = current[path[index]];\n }\n if (current === undefined) {\n return defaultValue;\n }\n return current;\n}\n\nexports.get = get;\n","module.exports = require('../dist/compat/object/get.js').get;\n","import get from 'es-toolkit/compat/get';\nexport var mathSign = value => {\n if (value === 0) {\n return 0;\n }\n if (value > 0) {\n return 1;\n }\n return -1;\n};\nexport var isNan = value => {\n // eslint-disable-next-line eqeqeq\n return typeof value == 'number' && value != +value;\n};\nexport var isPercent = value => typeof value === 'string' && value.indexOf('%') === value.length - 1;\nexport var isNumber = value => (typeof value === 'number' || value instanceof Number) && !isNan(value);\nexport var isNumOrStr = value => isNumber(value) || typeof value === 'string';\nvar idCounter = 0;\nexport var uniqueId = prefix => {\n var id = ++idCounter;\n return \"\".concat(prefix || '').concat(id);\n};\n\n/**\n * Get percent value of a total value\n * @param {number|string} percent A percent\n * @param {number} totalValue Total value\n * @param {number} defaultValue The value returned when percent is undefined or invalid\n * @param {boolean} validate If set to be true, the result will be validated\n * @return {number} value\n */\nexport var getPercentValue = function getPercentValue(percent, totalValue) {\n var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n if (!isNumber(percent) && typeof percent !== 'string') {\n return defaultValue;\n }\n var value;\n if (isPercent(percent)) {\n if (totalValue == null) {\n return defaultValue;\n }\n var index = percent.indexOf('%');\n value = totalValue * parseFloat(percent.slice(0, index)) / 100;\n } else {\n value = +percent;\n }\n if (isNan(value)) {\n value = defaultValue;\n }\n if (validate && totalValue != null && value > totalValue) {\n value = totalValue;\n }\n return value;\n};\nexport var hasDuplicate = ary => {\n if (!Array.isArray(ary)) {\n return false;\n }\n var len = ary.length;\n var cache = {};\n for (var i = 0; i < len; i++) {\n if (!cache[ary[i]]) {\n cache[ary[i]] = true;\n } else {\n return true;\n }\n }\n return false;\n};\n\n/**\n * @deprecated instead use {@link interpolate}\n * this function returns a function that is called immediately in all use-cases.\n * Instead, use interpolate which returns a number and skips the anonymous function step.\n * @param numberA The first number\n * @param numberB The second number\n * @return A function that returns the interpolated number\n */\nexport var interpolateNumber = (numberA, numberB) => {\n if (isNumber(numberA) && isNumber(numberB)) {\n return t => numberA + t * (numberB - numberA);\n }\n return () => numberB;\n};\nexport function interpolate(start, end, t) {\n if (isNumber(start) && isNumber(end)) {\n return start + t * (end - start);\n }\n return end;\n}\nexport function findEntryInArray(ary, specifiedKey, specifiedValue) {\n if (!ary || !ary.length) {\n return undefined;\n }\n return ary.find(entry => entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : get(entry, specifiedKey)) === specifiedValue);\n}\n\n/**\n * The least square linear regression\n * @param {Array} data The array of points\n * @returns {Object} The domain of x, and the parameter of linear function\n */\nexport var getLinearRegression = data => {\n if (!data || !data.length) {\n return null;\n }\n var len = data.length;\n var xsum = 0;\n var ysum = 0;\n var xysum = 0;\n var xxsum = 0;\n var xmin = Infinity;\n var xmax = -Infinity;\n var xcurrent = 0;\n var ycurrent = 0;\n for (var i = 0; i < len; i++) {\n xcurrent = data[i].cx || 0;\n ycurrent = data[i].cy || 0;\n xsum += xcurrent;\n ysum += ycurrent;\n xysum += xcurrent * ycurrent;\n xxsum += xcurrent * xcurrent;\n xmin = Math.min(xmin, xcurrent);\n xmax = Math.max(xmax, xcurrent);\n }\n var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;\n return {\n xmin,\n xmax,\n a,\n b: (ysum - a * xsum) / len\n };\n};\n/**\n * Checks if the value is null or undefined\n * @param value The value to check\n * @returns true if the value is null or undefined\n */\nexport var isNullish = value => {\n return value === null || typeof value === 'undefined';\n};\n\n/**\n *Uppercase the first letter of a string\n * @param {string} value The string to uppercase\n * @returns {string} The uppercased string\n */\nexport var upperFirst = value => {\n if (isNullish(value)) {\n return value;\n }\n return \"\".concat(value.charAt(0).toUpperCase()).concat(value.slice(1));\n};","import { isValidElement } from 'react';\n\n/**\n * Determines how values are stacked:\n *\n * - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap.\n * - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle.\n * - `wiggle` and `silhouette` tries to keep the chart centered.\n * - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives.\n * - `positive` ignores all negative values, and then behaves like \\`none\\`.\n *\n * Also see https://d3js.org/d3-shape/stack#stack-offsets\n * (note that the `diverging` offset in d3 is named `sign` in recharts)\n */\n\n/**\n * @deprecated use either `CartesianLayout` or `PolarLayout` instead.\n * Mixing both charts families leads to ambiguity in the type system.\n * These two layouts share very few properties, so it is best to keep them separate.\n */\n\n/**\n * @deprecated do not use: too many properties, mixing too many concepts, cartesian and polar together, everything optional.\n */\n\n//\n// Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props.\n//\n\nvar SVGContainerPropKeys = ['viewBox', 'children'];\nexport var SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style',\n/*\n * removed 'type' SVGElementPropKey because we do not currently use any SVG elements\n * that can use it, and it conflicts with the recharts prop 'type'\n * https://github.com/recharts/recharts/pull/3327\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type\n */\n// 'type',\n'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle'];\nvar PolyElementKeys = ['points', 'pathLength'];\n\n/** svg element types that have specific attribute filtration requirements */\n\n/** map of svg element types to unique svg attributes that belong to that element */\nexport var FilteredElementKeyMap = {\n svg: SVGContainerPropKeys,\n polygon: PolyElementKeys,\n polyline: PolyElementKeys\n};\nexport var EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];\n\n/** The type of easing function to use for animations */\n\n/** Specifies the duration of animation, the unit of this option is ms. */\n\n/**\n * This object defines the offset of the chart area and width and height and brush and ... it's a bit too much information all in one.\n * We use it internally but let's not expose it to the outside world.\n * If you are looking for this information, instead import `ChartOffset` or `PlotArea` from `recharts`.\n */\n\n/**\n * The domain of axis.\n * This is the definition\n *\n * Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis.\n * Categorical domain is defined as array of all possible values.\n *\n * Can be specified in many ways:\n * - array of numbers\n * - with special strings like 'dataMin' and 'dataMax'\n * - with special string math like 'dataMin - 100'\n * - with keyword 'auto'\n * - or a function\n * - array of functions\n * - or a combination of the above\n */\n\n/**\n * NumberDomain is an evaluated {@link AxisDomain}.\n * Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number.\n * This is after all the keywords and functions were evaluated and what is left is [min, max].\n *\n * Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible.\n *\n * There are also `category` axes that have different things than numbers in their domain.\n */\n\n/** The props definition of base axis */\n\n/** Defines how ticks are placed and whether / how tick collisions are handled.\n * 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown.\n * 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown.\n * 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks always show.\n * 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision.\n */\n\n/**\n * Ticks can be any type when the axis is the type of category.\n *\n * Ticks must be numbers when the axis is the type of number.\n */\n\nexport var adaptEventHandlers = (props, newHandler) => {\n if (!props || typeof props === 'function' || typeof props === 'boolean') {\n return null;\n }\n var inputProps = props;\n if (/*#__PURE__*/isValidElement(props)) {\n inputProps = props.props;\n }\n if (typeof inputProps !== 'object' && typeof inputProps !== 'function') {\n return null;\n }\n var out = {};\n Object.keys(inputProps).forEach(key => {\n if (EventKeys.includes(key)) {\n out[key] = newHandler || (e => inputProps[key](inputProps, e));\n }\n });\n return out;\n};\nvar getEventHandlerOfChild = (originalHandler, data, index) => e => {\n originalHandler(data, index, e);\n return null;\n};\nexport var adaptEventsOfChild = (props, data, index) => {\n if (props === null || typeof props !== 'object' && typeof props !== 'function') {\n return null;\n }\n var out = null;\n Object.keys(props).forEach(key => {\n var item = props[key];\n if (EventKeys.includes(key) && typeof item === 'function') {\n if (!out) out = {};\n out[key] = getEventHandlerOfChild(item, data, index);\n }\n });\n return out;\n};\n\n/**\n * 'axis' means that all graphical items belonging to this axis tick will be highlighted,\n * and all will be present in the tooltip.\n * Tooltip with 'axis' will display when hovering on the chart background.\n *\n * 'item' means only the one graphical item being hovered will show in the tooltip.\n * Tooltip with 'item' will display when hovering over individual graphical items.\n *\n * This is calculated internally;\n * charts have a `defaultTooltipEventType` and `validateTooltipEventTypes` options.\n *\n * Users then use <Tooltip shared={true} /> or <Tooltip shared={false} /> to control their preference,\n * and charts will then see what is allowed and what is not.\n */\n\n/**\n * These are the props we are going to pass to an `activeDot` if it is a function or a custom Component\n */\n\n/**\n * This is the type of `activeDot` prop on:\n * - Area\n * - Line\n * - Radar\n */\n\n// TODO we need two different range objects, one for polar and another for cartesian layouts\n\n/**\n * Simplified version of the MouseEvent so that we don't have to mock the whole thing in tests.\n *\n * This is meant to represent the React.MouseEvent\n * which is a wrapper on top of https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n */\n\n/**\n * Coordinates relative to the top-left corner of the chart.\n * Also include scale which means that a chart that's scaled will return the same coordinates as a chart that's not scaled.\n */","import get from 'es-toolkit/compat/get';\nimport { Children, isValidElement } from 'react';\nimport { isFragment } from 'react-is';\nimport { isNullish } from './DataUtils';\nimport { FilteredElementKeyMap, SVGElementPropKeys, EventKeys } from './types';\nexport var SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];\n\n/**\n * @deprecated instead find another approach that does not depend on displayName.\n * Get the display name of a component\n * @param {Object} Comp Specified Component\n * @return {String} Display name of Component\n */\nexport var getDisplayName = Comp => {\n if (typeof Comp === 'string') {\n return Comp;\n }\n if (!Comp) {\n return '';\n }\n return Comp.displayName || Comp.name || 'Component';\n};\n\n// `toArray` gets called multiple times during the render\n// so we can memoize last invocation (since reference to `children` is the same)\nvar lastChildren = null;\nvar lastResult = null;\n\n/**\n * @deprecated instead find another approach that does not require reading React Elements from DOM.\n *\n * @param children do not use\n * @return deprecated do not use\n */\nexport var toArray = children => {\n if (children === lastChildren && Array.isArray(lastResult)) {\n return lastResult;\n }\n var result = [];\n Children.forEach(children, child => {\n if (isNullish(child)) return;\n if (isFragment(child)) {\n result = result.concat(toArray(child.props.children));\n } else {\n // @ts-expect-error this could still be Iterable<ReactNode> and TS does not like that\n result.push(child);\n }\n });\n lastResult = result;\n lastChildren = children;\n return result;\n};\n\n/**\n * @deprecated instead find another approach that does not require reading React Elements from DOM.\n *\n * Find and return all matched children by type.\n * `type` must be a React.ComponentType\n *\n * @param children do not use\n * @param type do not use\n * @return deprecated do not use\n */\nexport function findAllByType(children, type) {\n var result = [];\n var types = [];\n if (Array.isArray(type)) {\n types = type.map(t => getDisplayName(t));\n } else {\n types = [getDisplayName(type)];\n }\n toArray(children).forEach(child => {\n var childType = get(child, 'type.displayName') || get(child, 'type.name');\n // ts-expect-error toArray and lodash.get are not compatible. Let's get rid of the whole findAllByType function\n if (types.indexOf(childType) !== -1) {\n result.push(child);\n }\n });\n return result;\n}\nexport var isClipDot = dot => {\n if (dot && typeof dot === 'object' && 'clipDot' in dot) {\n return Boolean(dot.clipDot);\n }\n return true;\n};\n\n/**\n * Checks if the property is valid to spread onto an SVG element or onto a specific component\n * @param {unknown} property property value currently being compared\n * @param {string} key property key currently being compared\n * @param {boolean} includeEvents if events are included in spreadable props\n * @param {boolean} svgElementType checks against map of SVG element types to attributes\n * @returns {boolean} is prop valid\n */\nexport var isValidSpreadableProp = (property, key, includeEvents, svgElementType) => {\n var _ref;\n /**\n * If the svg element type is explicitly included, check against the filtered element key map\n * to determine if there are attributes that should only exist on that element type.\n * @todo Add an internal cjs version of https://github.com/wooorm/svg-element-attributes for full coverage.\n */\n var matchingElementTypeKeys = (_ref = svgElementType && (FilteredElementKeyMap === null || FilteredElementKeyMap === void 0 ? void 0 : FilteredElementKeyMap[svgElementType])) !== null && _ref !== void 0 ? _ref : [];\n return key.startsWith('data-') || typeof property !== 'function' && (svgElementType && matchingElementTypeKeys.includes(key) || SVGElementPropKeys.includes(key)) || includeEvents && EventKeys.includes(key);\n};\nexport var filterProps = (props, includeEvents, svgElementType) => {\n if (!props || typeof props === 'function' || typeof props === 'boolean') {\n return null;\n }\n var inputProps = props;\n if (/*#__PURE__*/isValidElement(props)) {\n inputProps = props.props;\n }\n if (typeof inputProps !== 'object' && typeof inputProps !== 'function') {\n return null;\n }\n var out = {};\n\n /**\n * Props are blindly spread onto SVG elements. This loop filters out properties that we don't want to spread.\n * Items filtered out are as follows:\n * - functions in properties that are SVG attributes (functions are included when includeEvents is true)\n * - props that are SVG attributes but don't matched the passed svgElementType\n * - any prop that is not in SVGElementPropKeys (or in EventKeys if includeEvents is true)\n */\n Object.keys(inputProps).forEach(key => {\n var _inputProps;\n if (isValidSpreadableProp((_inputProps = inputProps) === null || _inputProps === void 0 ? void 0 : _inputProps[key], key, includeEvents, svgElementType)) {\n out[key] = inputProps[key];\n }\n });\n return out;\n};","var _excluded = [\"children\", \"width\", \"height\", \"viewBox\", \"className\", \"style\", \"title\", \"desc\"];\nfunction _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\nfunction _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }\nfunction _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }\n/**\n * @fileOverview Surface\n */\nimport * as React from 'react';\nimport { forwardRef } from 'react';\nimport { clsx } from 'clsx';\nimport { filterProps } from '../util/ReactUtils';\nexport var Surface = /*#__PURE__*/forwardRef((props, ref) => {\n var {\n children,\n width,\n height,\n viewBox,\n className,\n style,\n title,\n desc\n } = props,\n others = _objectWithoutProperties(props, _excluded);\n var svgView = viewBox || {\n width,\n height,\n x: 0,\n y: 0\n };\n var layerClass = clsx('recharts-surface', className);\n return /*#__PURE__*/React.createElement(\"svg\", _extends({}, filterProps(others, true, 'svg'), {\n className: layerClass,\n width: width,\n height: height,\n style: style,\n viewBox: \"\".concat(svgView.x, \" \").concat(svgView.y, \" \").concat(svgView.width, \" \").concat(svgView.height),\n ref: ref\n }), /*#__PURE__*/React.createElement(\"title\", null, title), /*#__PURE__*/React.createElement(\"desc\", null, desc), children);\n});","import { createContext, useContext } from 'react';\nexport var LegendPortalContext = /*#__PURE__*/createContext(null);\nexport var useLegendPortal = () => useContext(LegendPortalContext);","export default function(x) {\n return function constant() {\n return x;\n };\n}\n","export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","const pi = Math.PI,\n tau = 2 * pi,\n epsilon = 1e-6,\n tauEpsilon = tau - epsilon;\n\nfunction append(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += arguments[i] + strings[i];\n }\n}\n\nfunction appendRound(digits) {\n let d = Math.floor(digits);\n if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);\n if (d > 15) return append;\n const k = 10 ** d;\n return function(strings) {\n this._ += strings[0];\n for (let i = 1, n = strings.length; i < n; ++i) {\n this._ += Math.round(arguments[i] * k) / k + strings[i];\n }\n };\n}\n\nexport class Path {\n constructor(digits) {\n this._x0 = this._y0 = // start of current subpath\n this._x1 = this._y1 = null; // end of current subpath\n this._ = \"\";\n this._append = digits == null ? append : appendRound(digits);\n }\n moveTo(x, y) {\n this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;\n }\n closePath() {\n if (this._x1 !== null) {\n this._x1 = this._x0, this._y1 = this._y0;\n this._append`Z`;\n }\n }\n lineTo(x, y) {\n this._append`L${this._x1 = +x},${this._y1 = +y}`;\n }\n quadraticCurveTo(x1, y1, x, y) {\n this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;\n }\n bezierCurveTo(x1, y1, x2, y2, x, y) {\n this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;\n }\n arcTo(x1, y1, x2, y2, r) {\n x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let x0 = this._x1,\n y0 = this._y1,\n x21 = x2 - x1,\n y21 = y2 - y1,\n x01 = x0 - x1,\n y01 = y0 - y1,\n l01_2 = x01 * x01 + y01 * y01;\n\n // Is this path empty? Move to (x1,y1).\n if (this._x1 === null) {\n this._append`M${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.\n else if (!(l01_2 > epsilon));\n\n // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?\n // Equivalently, is (x1,y1) coincident with (x2,y2)?\n // Or, is the radius zero? Line to (x1,y1).\n else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {\n this._append`L${this._x1 = x1},${this._y1 = y1}`;\n }\n\n // Otherwise, draw an arc!\n else {\n let x20 = x2 - x0,\n y20 = y2 - y0,\n l21_2 = x21 * x21 + y21 * y21,\n l20_2 = x20 * x20 + y20 * y20,\n l21 = Math.sqrt(l21_2),\n l01 = Math.sqrt(l01_2),\n l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),\n t01 = l / l01,\n t21 = l / l21;\n\n // If the start tangent is not coincident with (x0,y0), line to.\n if (Math.abs(t01 - 1) > epsilon) {\n this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;\n }\n\n this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;\n }\n }\n arc(x, y, r, a0, a1, ccw) {\n x = +x, y = +y, r = +r, ccw = !!ccw;\n\n // Is the radius negative? Error.\n if (r < 0) throw new Error(`negative radius: ${r}`);\n\n let dx = r * Math.cos(a0),\n dy = r * Math.sin(a0),\n x0 = x + dx,\n y0 = y + dy,\n cw = 1 ^ ccw,\n da = ccw ? a0 - a1 : a1 - a0;\n\n // Is this path empty? Move to (x0,y0).\n if (this._x1 === null) {\n this._append`M${x0},${y0}`;\n }\n\n // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).\n else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {\n this._append`L${x0},${y0}`;\n }\n\n // Is this arc empty? We’re done.\n if (!r) return;\n\n // Does the angle go the wrong way? Flip the direction.\n if (da < 0) da = da % tau + tau;\n\n // Is this a complete circle? Draw two arcs to complete the circle.\n if (da > tauEpsilon) {\n this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;\n }\n\n // Is this arc non-empty? Draw an arc!\n else if (da > epsilon) {\n this._append`A${r},${r