@semcore/d3-chart 3.60.0 → 3.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/Area.js +14 -12
  3. package/lib/cjs/Area.js.map +1 -1
  4. package/lib/cjs/Axis.js +17 -15
  5. package/lib/cjs/Axis.js.map +1 -1
  6. package/lib/cjs/Bar.js +19 -17
  7. package/lib/cjs/Bar.js.map +1 -1
  8. package/lib/cjs/Bubble.js +15 -13
  9. package/lib/cjs/Bubble.js.map +1 -1
  10. package/lib/cjs/CompactHorizontalBar.js +19 -17
  11. package/lib/cjs/CompactHorizontalBar.js.map +1 -1
  12. package/lib/cjs/Donut.js +12 -10
  13. package/lib/cjs/Donut.js.map +1 -1
  14. package/lib/cjs/Dots.js +11 -9
  15. package/lib/cjs/Dots.js.map +1 -1
  16. package/lib/cjs/HorizontalBar.js +19 -17
  17. package/lib/cjs/HorizontalBar.js.map +1 -1
  18. package/lib/cjs/Hover.js +6 -4
  19. package/lib/cjs/Hover.js.map +1 -1
  20. package/lib/cjs/Line.js +12 -10
  21. package/lib/cjs/Line.js.map +1 -1
  22. package/lib/cjs/Plot.js +6 -4
  23. package/lib/cjs/Plot.js.map +1 -1
  24. package/lib/cjs/Radar.js +22 -20
  25. package/lib/cjs/Radar.js.map +1 -1
  26. package/lib/cjs/RadialTree.js +15 -13
  27. package/lib/cjs/RadialTree.js.map +1 -1
  28. package/lib/cjs/Reference.js +15 -13
  29. package/lib/cjs/Reference.js.map +1 -1
  30. package/lib/cjs/ScatterPlot.js +12 -10
  31. package/lib/cjs/ScatterPlot.js.map +1 -1
  32. package/lib/cjs/Tooltip.js +12 -10
  33. package/lib/cjs/Tooltip.js.map +1 -1
  34. package/lib/cjs/Venn.js +12 -10
  35. package/lib/cjs/Venn.js.map +1 -1
  36. package/lib/cjs/a11y/PlotA11yModule.js +5 -3
  37. package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
  38. package/lib/cjs/a11y/PlotA11yView.js +5 -3
  39. package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
  40. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
  41. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  42. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +20 -18
  43. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  44. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +9 -7
  45. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  46. package/lib/es6/Area.js +14 -12
  47. package/lib/es6/Area.js.map +1 -1
  48. package/lib/es6/Axis.js +17 -15
  49. package/lib/es6/Axis.js.map +1 -1
  50. package/lib/es6/Bar.js +19 -17
  51. package/lib/es6/Bar.js.map +1 -1
  52. package/lib/es6/Bubble.js +15 -13
  53. package/lib/es6/Bubble.js.map +1 -1
  54. package/lib/es6/CompactHorizontalBar.js +19 -17
  55. package/lib/es6/CompactHorizontalBar.js.map +1 -1
  56. package/lib/es6/Donut.js +12 -10
  57. package/lib/es6/Donut.js.map +1 -1
  58. package/lib/es6/Dots.js +11 -9
  59. package/lib/es6/Dots.js.map +1 -1
  60. package/lib/es6/HorizontalBar.js +19 -17
  61. package/lib/es6/HorizontalBar.js.map +1 -1
  62. package/lib/es6/Hover.js +6 -4
  63. package/lib/es6/Hover.js.map +1 -1
  64. package/lib/es6/Line.js +12 -10
  65. package/lib/es6/Line.js.map +1 -1
  66. package/lib/es6/Plot.js +6 -4
  67. package/lib/es6/Plot.js.map +1 -1
  68. package/lib/es6/Radar.js +22 -20
  69. package/lib/es6/Radar.js.map +1 -1
  70. package/lib/es6/RadialTree.js +15 -13
  71. package/lib/es6/RadialTree.js.map +1 -1
  72. package/lib/es6/Reference.js +15 -13
  73. package/lib/es6/Reference.js.map +1 -1
  74. package/lib/es6/ScatterPlot.js +12 -10
  75. package/lib/es6/ScatterPlot.js.map +1 -1
  76. package/lib/es6/Tooltip.js +12 -10
  77. package/lib/es6/Tooltip.js.map +1 -1
  78. package/lib/es6/Venn.js +12 -10
  79. package/lib/es6/Venn.js.map +1 -1
  80. package/lib/es6/a11y/PlotA11yModule.js +5 -3
  81. package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
  82. package/lib/es6/a11y/PlotA11yView.js +5 -3
  83. package/lib/es6/a11y/PlotA11yView.js.map +1 -1
  84. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
  85. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
  86. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +20 -18
  87. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
  88. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +9 -7
  89. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
  90. package/lib/esm/AnimatedClipPath.mjs +54 -0
  91. package/lib/esm/Area.mjs +189 -0
  92. package/lib/esm/Axis.mjs +406 -0
  93. package/lib/esm/Bar.mjs +201 -0
  94. package/lib/esm/Bubble.mjs +216 -0
  95. package/lib/esm/CompactHorizontalBar.mjs +518 -0
  96. package/lib/esm/Donut.mjs +415 -0
  97. package/lib/esm/Dots.mjs +120 -0
  98. package/lib/esm/GroupBar.mjs +94 -0
  99. package/lib/esm/HorizontalBar.mjs +181 -0
  100. package/lib/esm/Hover.mjs +217 -0
  101. package/lib/esm/Line.mjs +199 -0
  102. package/lib/esm/Pattern.mjs +520 -0
  103. package/lib/esm/Plot.mjs +137 -0
  104. package/lib/esm/Radar.mjs +706 -0
  105. package/lib/esm/RadialTree.mjs +565 -0
  106. package/lib/esm/Reference.mjs +243 -0
  107. package/lib/esm/ResponsiveContainer.mjs +99 -0
  108. package/lib/esm/ScatterPlot.mjs +194 -0
  109. package/lib/esm/StackBar.mjs +177 -0
  110. package/lib/esm/StackedArea.mjs +84 -0
  111. package/lib/esm/Tooltip.mjs +255 -0
  112. package/lib/esm/Venn.mjs +234 -0
  113. package/lib/esm/a11y/DataAccessibilityTable.mjs +100 -0
  114. package/lib/esm/a11y/PlotA11yModule.mjs +117 -0
  115. package/lib/esm/a11y/PlotA11yView.mjs +146 -0
  116. package/lib/esm/a11y/bezier.mjs +32 -0
  117. package/lib/esm/a11y/focus.mjs +44 -0
  118. package/lib/esm/a11y/hints.mjs +122 -0
  119. package/lib/esm/a11y/insights.mjs +700 -0
  120. package/lib/esm/a11y/intl.mjs +17 -0
  121. package/lib/esm/a11y/locale.mjs +39 -0
  122. package/lib/esm/a11y/serialize.mjs +363 -0
  123. package/lib/esm/a11y/summarize.mjs +14 -0
  124. package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +33 -0
  125. package/lib/esm/a11y/translations/module/de.json.mjs +14 -0
  126. package/lib/esm/a11y/translations/module/en.json.mjs +14 -0
  127. package/lib/esm/a11y/translations/module/es.json.mjs +14 -0
  128. package/lib/esm/a11y/translations/module/fr.json.mjs +14 -0
  129. package/lib/esm/a11y/translations/module/it.json.mjs +14 -0
  130. package/lib/esm/a11y/translations/module/ja.json.mjs +14 -0
  131. package/lib/esm/a11y/translations/module/ko.json.mjs +14 -0
  132. package/lib/esm/a11y/translations/module/nl.json.mjs +14 -0
  133. package/lib/esm/a11y/translations/module/pl.json.mjs +14 -0
  134. package/lib/esm/a11y/translations/module/pt.json.mjs +14 -0
  135. package/lib/esm/a11y/translations/module/sv.json.mjs +14 -0
  136. package/lib/esm/a11y/translations/module/tr.json.mjs +14 -0
  137. package/lib/esm/a11y/translations/module/vi.json.mjs +14 -0
  138. package/lib/esm/a11y/translations/module/zh.json.mjs +14 -0
  139. package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +33 -0
  140. package/lib/esm/a11y/translations/view/de.json.mjs +48 -0
  141. package/lib/esm/a11y/translations/view/en.json.mjs +48 -0
  142. package/lib/esm/a11y/translations/view/es.json.mjs +48 -0
  143. package/lib/esm/a11y/translations/view/fr.json.mjs +48 -0
  144. package/lib/esm/a11y/translations/view/it.json.mjs +48 -0
  145. package/lib/esm/a11y/translations/view/ja.json.mjs +48 -0
  146. package/lib/esm/a11y/translations/view/ko.json.mjs +48 -0
  147. package/lib/esm/a11y/translations/view/nl.json.mjs +48 -0
  148. package/lib/esm/a11y/translations/view/pl.json.mjs +48 -0
  149. package/lib/esm/a11y/translations/view/pt.json.mjs +48 -0
  150. package/lib/esm/a11y/translations/view/sv.json.mjs +48 -0
  151. package/lib/esm/a11y/translations/view/tr.json.mjs +48 -0
  152. package/lib/esm/a11y/translations/view/vi.json.mjs +48 -0
  153. package/lib/esm/a11y/translations/view/zh.json.mjs +48 -0
  154. package/lib/esm/color.mjs +127 -0
  155. package/lib/esm/component/Chart/AbstractChart.mjs +408 -0
  156. package/lib/esm/component/Chart/AreaChart.mjs +145 -0
  157. package/lib/esm/component/Chart/BarChart.mjs +240 -0
  158. package/lib/esm/component/Chart/BubbleChart.mjs +135 -0
  159. package/lib/esm/component/Chart/CigaretteChart.mjs +294 -0
  160. package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +113 -0
  161. package/lib/esm/component/Chart/DonutChart.mjs +113 -0
  162. package/lib/esm/component/Chart/HistogramChart.mjs +166 -0
  163. package/lib/esm/component/Chart/LineChart.mjs +131 -0
  164. package/lib/esm/component/Chart/RadarChart.mjs +115 -0
  165. package/lib/esm/component/Chart/ScatterPlotChart.mjs +144 -0
  166. package/lib/esm/component/Chart/VennChart.mjs +141 -0
  167. package/lib/esm/component/Chart/index.mjs +27 -0
  168. package/lib/esm/component/ChartLegend/BaseLegend.mjs +91 -0
  169. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +86 -0
  170. package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +12 -0
  171. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +240 -0
  172. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +4 -0
  173. package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +129 -0
  174. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +90 -0
  175. package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +19 -0
  176. package/lib/esm/component/ChartLegend/index.mjs +5 -0
  177. package/lib/esm/component/Cigarette/Cigarette.mjs +139 -0
  178. package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +141 -0
  179. package/lib/esm/createElement.mjs +104 -0
  180. package/lib/esm/index.mjs +70 -0
  181. package/lib/esm/style/area.shadow.css +50 -0
  182. package/lib/esm/style/axis.shadow.css +88 -0
  183. package/lib/esm/style/bar.shadow.css +66 -0
  184. package/lib/esm/style/bubble.shadow.css +64 -0
  185. package/lib/esm/style/donut.shadow.css +36 -0
  186. package/lib/esm/style/dot.shadow.css +27 -0
  187. package/lib/esm/style/hover.shadow.css +9 -0
  188. package/lib/esm/style/line.shadow.css +43 -0
  189. package/lib/esm/style/plot.shadow.css +19 -0
  190. package/lib/esm/style/plotA11yModule.shadow.css +12 -0
  191. package/lib/esm/style/plotA11yView.shadow.css +39 -0
  192. package/lib/esm/style/radar.shadow.css +80 -0
  193. package/lib/esm/style/radial-tree.shadow.css +54 -0
  194. package/lib/esm/style/reference.shadow.css +43 -0
  195. package/lib/esm/style/scatterplot.shadow.css +41 -0
  196. package/lib/esm/style/tooltip.shadow.css +42 -0
  197. package/lib/esm/style/venn.shadow.css +48 -0
  198. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +31 -0
  199. package/lib/esm/translations/en.json.mjs +12 -0
  200. package/lib/esm/translations/es.json.mjs +11 -0
  201. package/lib/esm/translations/fr.json.mjs +11 -0
  202. package/lib/esm/translations/it.json.mjs +11 -0
  203. package/lib/esm/translations/ja.json.mjs +11 -0
  204. package/lib/esm/translations/ko.json.mjs +11 -0
  205. package/lib/esm/translations/nl.json.mjs +11 -0
  206. package/lib/esm/translations/pl.json.mjs +11 -0
  207. package/lib/esm/translations/pt.json.mjs +11 -0
  208. package/lib/esm/translations/sv.json.mjs +11 -0
  209. package/lib/esm/translations/tr.json.mjs +11 -0
  210. package/lib/esm/translations/vi.json.mjs +11 -0
  211. package/lib/esm/translations/zh.json.mjs +11 -0
  212. package/lib/esm/utils.mjs +266 -0
  213. package/package.json +11 -11
  214. package/vite.config.ts +2 -0
@@ -0,0 +1,706 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
10
+ import { sstyled } from "@semcore/utils/lib/core/index";
11
+ import { sstyled as sstyled$1, Component, assignProps } from "@semcore/core";
12
+ import React, { cloneElement } from "react";
13
+ import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
14
+ import getOriginChildren from "@semcore/utils/lib/getOriginChildren";
15
+ import trottle from "@semcore/utils/lib/rafTrottle";
16
+ import canUseDOM from "@semcore/utils/lib/canUseDOM";
17
+ import { polygonContains } from "d3-polygon";
18
+ import { lineRadial, curveLinearClosed, arc, line } from "d3-shape";
19
+ import createElement from "./createElement.mjs";
20
+ import { getChartDefaultColorName, eventToPoint, measureText } from "./utils.mjs";
21
+ import Tooltip from "./Tooltip.mjs";
22
+ import { PatternFill, getPatternSymbolSize, PatternSymbol } from "./Pattern.mjs";
23
+ /*!__reshadow-styles__:"./style/radar.shadow.css"*/
24
+ var style = (
25
+ /*__reshadow_css_start__*/
26
+ (sstyled.insert(
27
+ /*__inner_css_start__*/
28
+ ".___SAxisLine_17thy_gg_,.___SAxisTick_17thy_gg_,.___SAxis_17thy_gg_{stroke:var(--intergalactic-chart-grid-line, #e0e1e9);stroke-width:1;fill:transparent}.___SAxisLine_17thy_gg_,.___SAxisTick_17thy_gg_{stroke-dasharray:2}.___SAxisLine_17thy_gg_.__active_17thy_gg_{stroke:var(--intergalactic-chart-grid-y-accent-hover-line, #a9abb6)}.___SAxisLabel_17thy_gg_{text-anchor:middle;dominant-baseline:central;font-size:12px}.___SAxisLabel_17thy_gg_.__xDirection_17thy_gg_{text-anchor:var(--xDirection_17thy)}.___SAxisLabel_17thy_gg_.__yDirection_17thy_gg_{dominant-baseline:var(--yDirection_17thy)}.___SPolygonDot_17thy_gg_,.___SPolygon_17thy_gg_{fill:var(--intergalactic-chart-palette-order-1, #2bb3ff)}.___SPolygon_17thy_gg_{opacity:.2}.___SPolygon_17thy_gg_.__color_17thy_gg_{fill:var(--color_17thy)}.___SPolygon_17thy_gg_.__pattern_17thy_gg_.__color_17thy_gg_{fill:var(--pattern_17thy);stroke:var(--color_17thy);stroke-width:1px}.___SPolygonDot_17thy_gg_{stroke-width:2px;stroke:var(--intergalactic-chart-grid-border, #ffffff);r:6px}.___SPolygonDot_17thy_gg_.__transparent_17thy_gg_{opacity:.3}.___SPolygonDot_17thy_gg_.__color_17thy_gg_{fill:var(--color_17thy)}.___SPolygonLine_17thy_gg_{stroke:var(--intergalactic-chart-palette-order-1, #2bb3ff);stroke-width:3;fill:transparent}.___SPolygonLine_17thy_gg_.__transparent_17thy_gg_{opacity:.3}.___SPolygonLine_17thy_gg_.__color_17thy_gg_{stroke:var(--color_17thy)}.___SPieRect_17thy_gg_{outline:0;fill:var(--intergalactic-chart-grid-bar-chart-hover, rgba(196, 199, 207, 0.3))}",
29
+ /*__inner_css_end__*/
30
+ "17thy_gg_"
31
+ ), /*__reshadow_css_end__*/
32
+ {
33
+ "__SAxis": "___SAxis_17thy_gg_",
34
+ "__SAxisLine": "___SAxisLine_17thy_gg_",
35
+ "__SAxisTick": "___SAxisTick_17thy_gg_",
36
+ "_active": "__active_17thy_gg_",
37
+ "__SAxisLabel": "___SAxisLabel_17thy_gg_",
38
+ "_xDirection": "__xDirection_17thy_gg_",
39
+ "--xDirection": "--xDirection_17thy",
40
+ "_yDirection": "__yDirection_17thy_gg_",
41
+ "--yDirection": "--yDirection_17thy",
42
+ "__SPolygon": "___SPolygon_17thy_gg_",
43
+ "_color": "__color_17thy_gg_",
44
+ "--color": "--color_17thy",
45
+ "_pattern": "__pattern_17thy_gg_",
46
+ "--pattern": "--pattern_17thy",
47
+ "__SPolygonDot": "___SPolygonDot_17thy_gg_",
48
+ "_transparent": "__transparent_17thy_gg_",
49
+ "__SPolygonLine": "___SPolygonLine_17thy_gg_",
50
+ "__SPieRect": "___SPieRect_17thy_gg_"
51
+ })
52
+ );
53
+ var clampAngle = function clampAngle2(angle) {
54
+ angle = angle % (2 * Math.PI);
55
+ if (angle < 0) angle += 2 * Math.PI;
56
+ return angle;
57
+ };
58
+ function getBoxAxesValue(i, range, axes, total, angleOffset) {
59
+ var func = axes === "y" ? Math.sin : Math.cos;
60
+ var angle = clampAngle((total - i) * 2 * Math.PI / total + angleOffset);
61
+ return range * (1 - func(angle)) - range;
62
+ }
63
+ function getRadianPosition(i, range, total, angleOffset) {
64
+ return [getBoxAxesValue(i, range, "y", total, angleOffset), getBoxAxesValue(i, range, "x", total, angleOffset)];
65
+ }
66
+ var getLabelXPlacement = function getLabelXPlacement2(i, total, angleOffset) {
67
+ var angle = clampAngle(i / total * (Math.PI * 2) - angleOffset);
68
+ if (angle >= Math.PI + Math.PI * (8 / 9) || angle <= Math.PI * (1 / 9)) return "middle";
69
+ if (angle >= Math.PI * (8 / 9) && angle <= Math.PI + Math.PI * (1 / 9)) return "middle";
70
+ return angle < Math.PI ? "start" : "end";
71
+ };
72
+ var getLabelYPlacement = function getLabelYPlacement2(i, total, angleOffset) {
73
+ var angle = clampAngle(i / total * (Math.PI * 2) - angleOffset);
74
+ if (angle >= Math.PI + Math.PI * (8 / 9) || angle <= Math.PI * (1 / 9)) return "alphabetic";
75
+ if (angle >= Math.PI * (8 / 9) && angle <= Math.PI + Math.PI * (1 / 9)) return "mathematical";
76
+ return "middle";
77
+ };
78
+ function getLabelPlacement(i, total, angleOffset) {
79
+ return [getLabelXPlacement(i, total, angleOffset), getLabelYPlacement(i, total, angleOffset)];
80
+ }
81
+ function computeTextWidth(texts, textSize) {
82
+ var defaultWidth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 50;
83
+ var defaultHeight = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 20;
84
+ var widths = texts.map(function(text) {
85
+ if (typeof text === "string") {
86
+ return measureText(text, textSize);
87
+ }
88
+ if (/* @__PURE__ */ React.isValidElement(text)) {
89
+ var _text$props, _text$props2;
90
+ return Math.max(((_text$props = text.props) === null || _text$props === void 0 ? void 0 : _text$props.width) || defaultWidth, ((_text$props2 = text.props) === null || _text$props2 === void 0 ? void 0 : _text$props2.height) || defaultHeight);
91
+ }
92
+ return defaultWidth;
93
+ });
94
+ return Math.max.apply(Math, _toConsumableArray(widths));
95
+ }
96
+ function getTicks(tickSize, radius) {
97
+ var ticks = 0;
98
+ while (Math.trunc(radius / (tickSize / 2)) > ticks) {
99
+ ticks += 1;
100
+ }
101
+ return _toConsumableArray(Array(ticks).keys()).reduce(function(ticks2, t, i, total) {
102
+ if (i) ticks2.push(i / total.length);
103
+ return ticks2;
104
+ }, []);
105
+ }
106
+ function pieContains(_ref13, _ref14) {
107
+ var _ref15 = _slicedToArray(_ref13, 3), startAngle = _ref15[0], endAngle = _ref15[1], radius = _ref15[2];
108
+ var _ref16 = _slicedToArray(_ref14, 2), x = _ref16[0], y = _ref16[1];
109
+ var distance = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
110
+ if (distance > radius) return false;
111
+ startAngle = clampAngle(startAngle);
112
+ endAngle = clampAngle(endAngle);
113
+ startAngle = startAngle < endAngle ? startAngle : startAngle - 2 * Math.PI;
114
+ var angle = clampAngle(Math.atan2(y, x) + Math.PI / 2);
115
+ var prevAngle = angle - Math.PI * 2;
116
+ var nextAngle = angle + Math.PI * 2;
117
+ if (angle > startAngle && angle < endAngle) return true;
118
+ if (prevAngle > startAngle && prevAngle < endAngle) return true;
119
+ if (nextAngle > startAngle && nextAngle < endAngle) return true;
120
+ return false;
121
+ }
122
+ function getLabelOffsetPosition(xDirection, yDirection, width, height) {
123
+ var xOffset = 0;
124
+ var yOffset = 0;
125
+ switch ("".concat(xDirection, "-").concat(yDirection)) {
126
+ case "middle-alphabetic":
127
+ yOffset = height / 2;
128
+ break;
129
+ case "start-middle":
130
+ xOffset = -width / 2;
131
+ break;
132
+ case "middle-mathematical":
133
+ yOffset = -height / 2;
134
+ break;
135
+ case "end-middle":
136
+ xOffset = width / 2;
137
+ break;
138
+ }
139
+ return [xOffset + width / 2, yOffset + height / 2];
140
+ }
141
+ var MINIMUM_OFFSET = 5;
142
+ var RadarRoot = /* @__PURE__ */ function(_Component) {
143
+ _inherits(RadarRoot2, _Component);
144
+ var _super = _createSuper(RadarRoot2);
145
+ function RadarRoot2() {
146
+ var _this;
147
+ _classCallCheck(this, RadarRoot2);
148
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
149
+ args[_key] = arguments[_key];
150
+ }
151
+ _this = _super.call.apply(_super, [this].concat(args));
152
+ _defineProperty(_assertThisInitialized(_this), "computeOffset", 0);
153
+ _defineProperty(_assertThisInitialized(_this), "categoriesKey", null);
154
+ return _this;
155
+ }
156
+ _createClass(RadarRoot2, [{
157
+ key: "id",
158
+ get: function get() {
159
+ var _this$asProps = this.asProps, id = _this$asProps.id, uid = _this$asProps.uid;
160
+ return id || uid;
161
+ }
162
+ }, {
163
+ key: "offset",
164
+ get: function get() {
165
+ var offset = this.asProps.offset;
166
+ return offset !== null && offset !== void 0 ? offset : this.computeOffset;
167
+ }
168
+ }, {
169
+ key: "textSize",
170
+ get: function get() {
171
+ var textSize = this.asProps.textSize;
172
+ return textSize !== null && textSize !== void 0 ? textSize : 12;
173
+ }
174
+ }, {
175
+ key: "getAxisProps",
176
+ value: function getAxisProps() {
177
+ return {
178
+ offset: this.offset,
179
+ textSize: this.textSize,
180
+ type: this.asProps.type,
181
+ angleOffset: this.asProps.angleOffset
182
+ };
183
+ }
184
+ }, {
185
+ key: "getPolygonProps",
186
+ value: function getPolygonProps(_ref17, index) {
187
+ var dataKey = _ref17.dataKey;
188
+ var _this$asProps2 = this.asProps, data = _this$asProps2.data, scale = _this$asProps2.scale, angleOffset = _this$asProps2.angleOffset, uid = _this$asProps2.uid, patterns = _this$asProps2.patterns;
189
+ return {
190
+ offset: this.offset,
191
+ data: data[dataKey] || [],
192
+ scale,
193
+ angleOffset,
194
+ color: getChartDefaultColorName(index),
195
+ uid: "".concat(uid, "-").concat(index),
196
+ patterns
197
+ };
198
+ }
199
+ }, {
200
+ key: "getHoverProps",
201
+ value: function getHoverProps() {
202
+ return {
203
+ type: this.asProps.type,
204
+ offset: this.offset,
205
+ categories: this.asProps.data[this.categoriesKey],
206
+ angleOffset: this.asProps.angleOffset
207
+ };
208
+ }
209
+ }, {
210
+ key: "render",
211
+ value: function render() {
212
+ var _ref2;
213
+ var SRadar = this.Element;
214
+ var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, styles = _this$asProps3.styles, size = _this$asProps3.size, data = _this$asProps3.data, offset = _this$asProps3.offset;
215
+ var _size = _slicedToArray(size, 2), width = _size[0], height = _size[1];
216
+ this.asProps.dataHintsHandler.establishDataType("indexed-groups");
217
+ var dataKey;
218
+ React.Children.toArray(getOriginChildren(Children)).forEach(function(child) {
219
+ if (/* @__PURE__ */ React.isValidElement(child) && child.type === Radar.Axis) {
220
+ dataKey = child.props.dataKey;
221
+ }
222
+ });
223
+ if (dataKey) {
224
+ if (offset === void 0) {
225
+ this.computeOffset = computeTextWidth(data[dataKey], this.textSize) + MINIMUM_OFFSET;
226
+ }
227
+ this.categoriesKey = dataKey;
228
+ }
229
+ return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SRadar, _ref2.cn("SRadar", {
230
+ "aria-hidden": true,
231
+ "id": this.id,
232
+ "render": "g",
233
+ "childrenPosition": "inside",
234
+ "transform": "translate(".concat(width / 2, ",").concat(height / 2, ")")
235
+ }));
236
+ }
237
+ }]);
238
+ return RadarRoot2;
239
+ }(Component);
240
+ _defineProperty(RadarRoot, "displayName", "Line");
241
+ _defineProperty(RadarRoot, "style", style);
242
+ _defineProperty(RadarRoot, "enhance", [uniqueIDEnhancement()]);
243
+ _defineProperty(RadarRoot, "defaultProps", {
244
+ type: "polygon",
245
+ angleOffset: 0
246
+ });
247
+ var PolygonRoot = /* @__PURE__ */ function(_Component2) {
248
+ _inherits(PolygonRoot2, _Component2);
249
+ var _super2 = _createSuper(PolygonRoot2);
250
+ function PolygonRoot2() {
251
+ _classCallCheck(this, PolygonRoot2);
252
+ return _super2.apply(this, arguments);
253
+ }
254
+ _createClass(PolygonRoot2, [{
255
+ key: "getDotsProps",
256
+ value: function getDotsProps() {
257
+ var _this$asProps4 = this.asProps, data = _this$asProps4.data, scale = _this$asProps4.scale, color = _this$asProps4.color, resolveColor = _this$asProps4.resolveColor, transparent = _this$asProps4.transparent, dataKey = _this$asProps4.dataKey, dataHintsHandler = _this$asProps4.dataHintsHandler, angleOffset = _this$asProps4.angleOffset, patterns = _this$asProps4.patterns;
258
+ return {
259
+ data,
260
+ scale,
261
+ color,
262
+ resolveColor,
263
+ transparent,
264
+ categoryKey: dataKey,
265
+ dataHintsHandler,
266
+ angleOffset,
267
+ patterns
268
+ };
269
+ }
270
+ }, {
271
+ key: "getLineProps",
272
+ value: function getLineProps() {
273
+ var _this$asProps5 = this.asProps, d3 = _this$asProps5.d3, data = _this$asProps5.data, color = _this$asProps5.color, resolveColor = _this$asProps5.resolveColor, transparent = _this$asProps5.transparent;
274
+ return {
275
+ data,
276
+ color,
277
+ resolveColor,
278
+ transparent,
279
+ d3
280
+ };
281
+ }
282
+ }, {
283
+ key: "render",
284
+ value: function render() {
285
+ var _ref3;
286
+ var _this$asProps6 = this.asProps, SPolygon = _this$asProps6.Element, styles = _this$asProps6.styles, d3 = _this$asProps6.d3, data = _this$asProps6.data, color = _this$asProps6.color, resolveColor = _this$asProps6.resolveColor, fill = _this$asProps6.fill, uid = _this$asProps6.uid, patterns = _this$asProps6.patterns;
287
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (_ref3 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPolygon, _ref3.cn("SPolygon", {
288
+ "render": "path",
289
+ "d": d3(data),
290
+ "color": resolveColor(fill || color),
291
+ "pattern": patterns ? "url(#".concat(uid, "-pattern)") : void 0
292
+ }))), patterns && /* @__PURE__ */ React.createElement(PatternFill, _ref3.cn("PatternFill", {
293
+ "id": "".concat(uid, "-pattern"),
294
+ "patternKey": color,
295
+ "color": resolveColor(fill || color),
296
+ "patterns": patterns
297
+ })));
298
+ }
299
+ }]);
300
+ return PolygonRoot2;
301
+ }(Component);
302
+ _defineProperty(PolygonRoot, "displayName", "Polygon");
303
+ _defineProperty(PolygonRoot, "style", style);
304
+ _defineProperty(PolygonRoot, "defaultProps", function(_ref22) {
305
+ var scale = _ref22.scale, _ref22$curve = _ref22.curve, curve = _ref22$curve === void 0 ? curveLinearClosed : _ref22$curve, size = _ref22.size, offset = _ref22.offset, angleOffset = _ref22.angleOffset;
306
+ scale.range([0, Math.min(size[0], size[1]) / 2 - offset]);
307
+ return {
308
+ d3: lineRadial().curve(curve).radius(function(d) {
309
+ return scale(d || 0);
310
+ }).angle(function(d, i, data) {
311
+ return i / data.length * 2 * Math.PI - angleOffset;
312
+ })
313
+ };
314
+ });
315
+ function PolygonLine(props) {
316
+ var _ref4;
317
+ var SPolygonLine = props.Element, styles = props.styles, d3 = props.d3, color = props.color, resolveColor = props.resolveColor, data = props.data, transparent = props.transparent;
318
+ return _ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPolygonLine, _ref4.cn("SPolygonLine", {
319
+ "render": "path",
320
+ "d": d3(data),
321
+ "color": resolveColor(color),
322
+ "transparent": transparent
323
+ }));
324
+ }
325
+ function PolygonDots(props) {
326
+ var SPolygonDot = props.Element, styles = props.styles, color = props.color, resolveColor = props.resolveColor, data = props.data, scale = props.scale, transparent = props.transparent, categoryKey = props.categoryKey, angleOffset = props.angleOffset, patterns = props.patterns;
327
+ return data.map(function(value, i) {
328
+ var _ref6;
329
+ if (value === null || value === void 0) return;
330
+ var radius = scale(value);
331
+ props.dataHintsHandler.describeGroupedValues(categoryKey, "".concat(categoryKey, ".").concat(i));
332
+ var _getRadianPosition = getRadianPosition(i, radius, data.length, angleOffset), _getRadianPosition2 = _slicedToArray(_getRadianPosition, 2), cx = _getRadianPosition2[0], cy = _getRadianPosition2[1];
333
+ if (!patterns) {
334
+ var _ref5;
335
+ return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPolygonDot, _ref5.cn("SPolygonDot", {
336
+ "render": "circle",
337
+ "color": resolveColor(color),
338
+ "transparent": transparent,
339
+ "patternKey": color,
340
+ "key": "".concat(i),
341
+ "cx": cx,
342
+ "cy": cy
343
+ }));
344
+ }
345
+ var patternKey = color || getChartDefaultColorName(0);
346
+ var _getPatternSymbolSize = getPatternSymbolSize({
347
+ patternKey,
348
+ patterns
349
+ }), _getPatternSymbolSize2 = _slicedToArray(_getPatternSymbolSize, 2), width = _getPatternSymbolSize2[0], height = _getPatternSymbolSize2[1];
350
+ return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPolygonDot, _ref6.cn("SPolygonDot", {
351
+ "render": PatternSymbol,
352
+ "color": resolveColor(color),
353
+ "transparent": transparent,
354
+ "patternKey": color,
355
+ "key": "".concat(i),
356
+ "x": cx - width / 2,
357
+ "y": cy - height / 2
358
+ }));
359
+ });
360
+ }
361
+ var AxisRoot = /* @__PURE__ */ function(_Component3) {
362
+ _inherits(AxisRoot2, _Component3);
363
+ var _super3 = _createSuper(AxisRoot2);
364
+ function AxisRoot2() {
365
+ var _this2;
366
+ _classCallCheck(this, AxisRoot2);
367
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
368
+ args[_key2] = arguments[_key2];
369
+ }
370
+ _this2 = _super3.call.apply(_super3, [this].concat(args));
371
+ _defineProperty(_assertThisInitialized(_this2), "unsubscribeTooltipVisible", null);
372
+ _defineProperty(_assertThisInitialized(_this2), "state", {
373
+ activeLineIndex: null
374
+ });
375
+ _defineProperty(_assertThisInitialized(_this2), "handleTooltipRenderingProps", function(_anchorProps, _ref18) {
376
+ var index = _ref18.index;
377
+ _this2.setState({
378
+ activeLineIndex: index
379
+ });
380
+ });
381
+ return _this2;
382
+ }
383
+ _createClass(AxisRoot2, [{
384
+ key: "createLineRadial",
385
+ value: function createLineRadial(radius, total) {
386
+ return lineRadial().curve(curveLinearClosed).radius(function() {
387
+ return radius;
388
+ }).angle(function(d, i) {
389
+ return i / total * 2 * Math.PI;
390
+ });
391
+ }
392
+ }, {
393
+ key: "getTicksProps",
394
+ value: function getTicksProps(_ref19) {
395
+ var _ref19$tickSize = _ref19.tickSize, tickSize = _ref19$tickSize === void 0 ? 100 : _ref19$tickSize;
396
+ var _this$asProps7 = this.asProps, data = _this$asProps7.data, offset = _this$asProps7.offset, categories = _this$asProps7.categories, size = _this$asProps7.size, type = _this$asProps7.type;
397
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
398
+ return {
399
+ type,
400
+ data,
401
+ categories,
402
+ ticks: getTicks(tickSize, radius),
403
+ offset,
404
+ d3: this.createLineRadial(radius, categories.length)
405
+ };
406
+ }
407
+ }, {
408
+ key: "getLabelsProps",
409
+ value: function getLabelsProps(_ref20) {
410
+ var _ref20$labelOffset = _ref20.labelOffset, labelOffset = _ref20$labelOffset === void 0 ? 10 : _ref20$labelOffset;
411
+ var _this$asProps8 = this.asProps, offset = _this$asProps8.offset, categories = _this$asProps8.categories, textSize = _this$asProps8.textSize, angleOffset = _this$asProps8.angleOffset;
412
+ return {
413
+ categories,
414
+ textSize,
415
+ offset: offset - labelOffset,
416
+ angleOffset
417
+ };
418
+ }
419
+ }, {
420
+ key: "componentDidMount",
421
+ value: function componentDidMount() {
422
+ var eventEmitter = this.asProps.eventEmitter;
423
+ this.unsubscribeTooltipVisible = eventEmitter.subscribe("setTooltipRenderingProps", this.handleTooltipRenderingProps);
424
+ }
425
+ }, {
426
+ key: "componentWillUnmount",
427
+ value: function componentWillUnmount() {
428
+ var _this$unsubscribeTool;
429
+ (_this$unsubscribeTool = this.unsubscribeTooltipVisible) === null || _this$unsubscribeTool === void 0 ? void 0 : _this$unsubscribeTool.call(this);
430
+ }
431
+ }, {
432
+ key: "render",
433
+ value: function render() {
434
+ var _ref7;
435
+ var _this$asProps9 = this.asProps, SAxis = _this$asProps9.Element, styles = _this$asProps9.styles, categories = _this$asProps9.categories, size = _this$asProps9.size, offset = _this$asProps9.offset, type = _this$asProps9.type, angleOffset = _this$asProps9.angleOffset;
436
+ var activeLineIndex = this.state.activeLineIndex;
437
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
438
+ var total = categories.length;
439
+ return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, type === "circle" ? /* @__PURE__ */ React.createElement(SAxis, _ref7.cn("SAxis", {
440
+ "render": "circle",
441
+ "cx": 0,
442
+ "cy": 0,
443
+ "r": radius
444
+ })) : /* @__PURE__ */ React.createElement(SAxis, _ref7.cn("SAxis", {
445
+ "render": "path",
446
+ "d": this.createLineRadial(radius, total)(categories)
447
+ })), categories.map(function(category, i) {
448
+ var _getRadianPosition3 = getRadianPosition(i, radius, total, angleOffset), _getRadianPosition4 = _slicedToArray(_getRadianPosition3, 2), x = _getRadianPosition4[0], y = _getRadianPosition4[1];
449
+ var _sstyled$cn = sstyled$1(styles).cn("SAxisLine", {
450
+ active: activeLineIndex === i
451
+ }), className = _sstyled$cn.className;
452
+ return /* @__PURE__ */ React.createElement("line", {
453
+ key: i,
454
+ x1: 0,
455
+ y1: 0,
456
+ x2: x,
457
+ y2: y,
458
+ className
459
+ });
460
+ }));
461
+ }
462
+ }]);
463
+ return AxisRoot2;
464
+ }(Component);
465
+ _defineProperty(AxisRoot, "displayName", "Polygon");
466
+ _defineProperty(AxisRoot, "style", style);
467
+ _defineProperty(AxisRoot, "defaultProps", function(_ref23) {
468
+ var data = _ref23.data, dataKey = _ref23.dataKey;
469
+ var categories = data[dataKey];
470
+ return {
471
+ categories
472
+ };
473
+ });
474
+ function AxisTicks(props) {
475
+ var SAxisTick = props.Element, styles = props.styles, size = props.size, ticks = props.ticks, d3 = props.d3, categories = props.categories, offset = props.offset, type = props.type;
476
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
477
+ return ticks.map(function(tick, i) {
478
+ var _ref8;
479
+ d3.radius(function() {
480
+ return radius * tick;
481
+ });
482
+ return _ref8 = sstyled$1(styles), type === "circle" ? /* @__PURE__ */ React.createElement(SAxisTick, _ref8.cn("SAxisTick", {
483
+ "key": i,
484
+ "render": "circle",
485
+ "cx": 0,
486
+ "cy": 0,
487
+ "r": radius * tick
488
+ })) : /* @__PURE__ */ React.createElement(SAxisTick, _ref8.cn("SAxisTick", {
489
+ "render": "path",
490
+ "key": i,
491
+ "d": d3(categories)
492
+ }));
493
+ });
494
+ }
495
+ function AxisLabels(props) {
496
+ var SAxisLabel = props.Element, styles = props.styles, textSize = props.textSize, size = props.size, offset = props.offset, categories = props.categories, angleOffset = props.angleOffset;
497
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
498
+ return categories.map(function(category, i) {
499
+ var _getRadianPosition5 = getRadianPosition(i, radius, categories.length, angleOffset), _getRadianPosition6 = _slicedToArray(_getRadianPosition5, 2), x = _getRadianPosition6[0], y = _getRadianPosition6[1];
500
+ var _getLabelPlacement = getLabelPlacement(i, categories.length, angleOffset), _getLabelPlacement2 = _slicedToArray(_getLabelPlacement, 2), xDirection = _getLabelPlacement2[0], yDirection = _getLabelPlacement2[1];
501
+ if (typeof category === "string") {
502
+ var _ref9;
503
+ props.dataHintsHandler.labelKey("value", i, category);
504
+ var lines = category.split("\n");
505
+ return _ref9 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SAxisLabel, _ref9.cn("SAxisLabel", {
506
+ "key": i,
507
+ "render": "text",
508
+ "childrenPosition": "inside",
509
+ "x": x,
510
+ "y": y,
511
+ "xDirection": xDirection,
512
+ "yDirection": yDirection
513
+ }), lines.map(function(lineText, lineIndex) {
514
+ return /* @__PURE__ */ React.createElement("tspan", {
515
+ x,
516
+ y: y + (lineIndex - (lines.length - 1) / 2) * textSize,
517
+ key: "#".concat(lineIndex, "-").concat(lineText)
518
+ }, lineText);
519
+ }));
520
+ }
521
+ if (/* @__PURE__ */ React.isValidElement(category)) {
522
+ var _category$props;
523
+ var _ref21 = (_category$props = category === null || category === void 0 ? void 0 : category.props) !== null && _category$props !== void 0 ? _category$props : {}, _ref21$width = _ref21.width, width = _ref21$width === void 0 ? 0 : _ref21$width, _ref21$height = _ref21.height, height = _ref21$height === void 0 ? 0 : _ref21$height;
524
+ var _getLabelOffsetPositi = getLabelOffsetPosition(xDirection, yDirection, width, height), _getLabelOffsetPositi2 = _slicedToArray(_getLabelOffsetPositi, 2), xOffset = _getLabelOffsetPositi2[0], yOffset = _getLabelOffsetPositi2[1];
525
+ return /* @__PURE__ */ cloneElement(category, {
526
+ key: i,
527
+ x: x - xOffset,
528
+ y: y - yOffset
529
+ });
530
+ }
531
+ });
532
+ }
533
+ var Hover = /* @__PURE__ */ function(_Component4) {
534
+ _inherits(Hover2, _Component4);
535
+ var _super4 = _createSuper(Hover2);
536
+ function Hover2() {
537
+ var _this3;
538
+ _classCallCheck(this, Hover2);
539
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
540
+ args[_key3] = arguments[_key3];
541
+ }
542
+ _this3 = _super4.call.apply(_super4, [this].concat(args));
543
+ _defineProperty(_assertThisInitialized(_this3), "state", {
544
+ index: null
545
+ });
546
+ _defineProperty(_assertThisInitialized(_this3), "virtualElement", canUseDOM() ? document.createElement("div") : {});
547
+ _defineProperty(_assertThisInitialized(_this3), "unsubscribeMouseMoveRoot", null);
548
+ _defineProperty(_assertThisInitialized(_this3), "unsubscribeMouseLeaveRoot", null);
549
+ _defineProperty(_assertThisInitialized(_this3), "handlerMouseMoveRoot", trottle(function(e) {
550
+ var _this3$asProps = _this3.asProps, eventEmitter = _this3$asProps.eventEmitter, size = _this3$asProps.size, rootRef = _this3$asProps.rootRef, patterns = _this3$asProps.patterns;
551
+ var point = eventToPoint(e, rootRef.current);
552
+ var diam = Math.min(size[0], size[1]);
553
+ var centerX = point[0] - diam / 2;
554
+ var centerY = point[1] - diam / 2;
555
+ var clientX = e.clientX, clientY = e.clientY;
556
+ var index = _this3.getIndex([centerX, centerY]);
557
+ _this3.setState({
558
+ index
559
+ }, function() {
560
+ eventEmitter.emit("setTooltipPosition", clientX, clientY);
561
+ eventEmitter.emit("setTooltipRenderingProps", {}, {
562
+ index,
563
+ patterns
564
+ });
565
+ eventEmitter.emit("setTooltipVisible", index !== null);
566
+ });
567
+ }));
568
+ _defineProperty(_assertThisInitialized(_this3), "handlerMouseLeaveRoot", trottle(function() {
569
+ _this3.setState({
570
+ index: null
571
+ }, function() {
572
+ _this3.asProps.eventEmitter.emit("setTooltipVisible", false);
573
+ });
574
+ }));
575
+ return _this3;
576
+ }
577
+ _createClass(Hover2, [{
578
+ key: "generateGetBoundingClientRect",
579
+ value: function generateGetBoundingClientRect() {
580
+ var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
581
+ var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
582
+ return function() {
583
+ return {
584
+ width: 0,
585
+ height: 0,
586
+ top: y,
587
+ right: x,
588
+ bottom: y,
589
+ left: x
590
+ };
591
+ };
592
+ }
593
+ }, {
594
+ key: "getPolygon",
595
+ value: function getPolygon(index) {
596
+ var _this$asProps10 = this.asProps, categories = _this$asProps10.categories, size = _this$asProps10.size, offset = _this$asProps10.offset, angleOffset = _this$asProps10.angleOffset;
597
+ var total = categories.length;
598
+ var diam = Math.min(size[0], size[1]);
599
+ var radius = diam / 2 - offset;
600
+ var prevIndex = (index - 1 + total) % total;
601
+ var nextIndex = (index + 1 + total) % total;
602
+ var _getRadianPosition7 = getRadianPosition(prevIndex, radius, total, angleOffset), _getRadianPosition8 = _slicedToArray(_getRadianPosition7, 2), prevX1 = _getRadianPosition8[0], prevY1 = _getRadianPosition8[1];
603
+ var _getRadianPosition9 = getRadianPosition(index, radius, total, angleOffset), _getRadianPosition10 = _slicedToArray(_getRadianPosition9, 2), x = _getRadianPosition10[0], y = _getRadianPosition10[1];
604
+ var _getRadianPosition11 = getRadianPosition(nextIndex, radius, total, angleOffset), _getRadianPosition12 = _slicedToArray(_getRadianPosition11, 2), nextX1 = _getRadianPosition12[0], nextY1 = _getRadianPosition12[1];
605
+ return [[0, 0], [(prevX1 + x) / 2, (prevY1 + y) / 2], [x, y], [(nextX1 + x) / 2, (nextY1 + y) / 2]];
606
+ }
607
+ }, {
608
+ key: "getPie",
609
+ value: function getPie(index) {
610
+ var _this$asProps11 = this.asProps, categories = _this$asProps11.categories, size = _this$asProps11.size, offset = _this$asProps11.offset, angleOffset = _this$asProps11.angleOffset;
611
+ var angle = Math.PI * 2 / categories.length;
612
+ var radius = Math.min(size[0], size[1]) / 2 - offset;
613
+ return [index * angle - angle / 2 - angleOffset, (index + 1) * angle - angle / 2 - angleOffset, radius];
614
+ }
615
+ }, {
616
+ key: "getIndex",
617
+ value: function getIndex(point) {
618
+ var _this4 = this;
619
+ var _this$asProps12 = this.asProps, categories = _this$asProps12.categories, type = _this$asProps12.type;
620
+ var index;
621
+ if (type === "circle") {
622
+ index = categories.findIndex(function(c, i) {
623
+ return pieContains(_this4.getPie(i), point);
624
+ });
625
+ } else {
626
+ index = categories.findIndex(function(c, i) {
627
+ return polygonContains(_this4.getPolygon(i), point);
628
+ });
629
+ }
630
+ return index === -1 ? null : index;
631
+ }
632
+ }, {
633
+ key: "componentDidMount",
634
+ value: function componentDidMount() {
635
+ var _this5 = this;
636
+ var eventEmitter = this.asProps.eventEmitter;
637
+ this.unsubscribeMouseMoveRoot = eventEmitter.subscribe("onMouseMoveRoot", function(e) {
638
+ e.persist();
639
+ _this5.handlerMouseMoveRoot(e);
640
+ });
641
+ this.unsubscribeMouseLeaveRoot = eventEmitter.subscribe("onMouseLeaveRoot", this.handlerMouseLeaveRoot);
642
+ }
643
+ }, {
644
+ key: "componentWillUnmount",
645
+ value: function componentWillUnmount() {
646
+ if (this.unsubscribeMouseMoveRoot) {
647
+ this.unsubscribeMouseMoveRoot();
648
+ }
649
+ if (this.unsubscribeMouseLeaveRoot) {
650
+ this.unsubscribeMouseLeaveRoot();
651
+ }
652
+ }
653
+ }, {
654
+ key: "render",
655
+ value: function render() {
656
+ var _this$asProps13 = this.asProps, styles = _this$asProps13.styles, type = _this$asProps13.type;
657
+ var index = this.state.index;
658
+ var SPieRect = this.Element;
659
+ if (index !== null) {
660
+ if (type === "circle") {
661
+ var _ref10;
662
+ var _this$getPie = this.getPie(index), _this$getPie2 = _slicedToArray(_this$getPie, 3), startAngle = _this$getPie2[0], endAngle = _this$getPie2[1], radius = _this$getPie2[2];
663
+ var circle = arc().innerRadius(0).outerRadius(radius).startAngle(startAngle).endAngle(endAngle);
664
+ return _ref10 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPieRect, _ref10.cn("SPieRect", {
665
+ "render": "path",
666
+ "d": circle()
667
+ }));
668
+ } else {
669
+ var _ref11;
670
+ return _ref11 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SPieRect, _ref11.cn("SPieRect", {
671
+ "render": "path",
672
+ "d": line()(this.getPolygon(index))
673
+ }));
674
+ }
675
+ }
676
+ return null;
677
+ }
678
+ }]);
679
+ return Hover2;
680
+ }(Component);
681
+ var Axis = createElement(AxisRoot, {
682
+ Ticks: AxisTicks,
683
+ Labels: AxisLabels
684
+ });
685
+ var Polygon = createElement(PolygonRoot, {
686
+ Line: PolygonLine,
687
+ Dots: PolygonDots
688
+ });
689
+ var RadarTooltip = function RadarTooltip2(props) {
690
+ var _ref = arguments[0], _ref12;
691
+ var SRadarTooltip = Tooltip;
692
+ return _ref12 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SRadarTooltip, _ref12.cn("SRadarTooltip", _objectSpread({}, assignProps({
693
+ "tag": Radar.Hover,
694
+ "excludeAnchorProps": true
695
+ }, _ref))));
696
+ };
697
+ var Radar = createElement(RadarRoot, {
698
+ Axis,
699
+ Polygon,
700
+ Hover,
701
+ Tooltip: [RadarTooltip, Tooltip._______childrenComponents]
702
+ });
703
+ export {
704
+ Radar as default,
705
+ getLabelOffsetPosition
706
+ };