semiotic 3.0.0-beta.2 → 3.0.0-beta.4

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 (342) hide show
  1. package/CLAUDE.md +93 -753
  2. package/README.md +92 -7
  3. package/ai/dist/componentRegistry.js +26 -0
  4. package/ai/dist/{ai/mcp-server.js → mcp-server.js} +1 -1
  5. package/ai/dist/{ai/renderHOCToSVG.js → renderHOCToSVG.js} +2 -2
  6. package/dist/ChartContainer.d.ts +60 -0
  7. package/dist/DetailsPanel.d.ts +37 -0
  8. package/dist/LinkedCharts.d.ts +2 -0
  9. package/dist/Tooltip/Tooltip.d.ts +2 -2
  10. package/dist/charts/index.d.ts +1 -1
  11. package/dist/charts/ordinal/BarChart.d.ts +1 -0
  12. package/dist/charts/ordinal/BoxPlot.d.ts +1 -0
  13. package/dist/charts/ordinal/DonutChart.d.ts +1 -0
  14. package/dist/charts/ordinal/DotPlot.d.ts +1 -0
  15. package/dist/charts/ordinal/GroupedBarChart.d.ts +1 -0
  16. package/dist/charts/ordinal/Histogram.d.ts +1 -0
  17. package/dist/charts/ordinal/PieChart.d.ts +1 -0
  18. package/dist/charts/ordinal/RidgelinePlot.d.ts +1 -0
  19. package/dist/charts/ordinal/StackedBarChart.d.ts +1 -0
  20. package/dist/charts/ordinal/SwarmPlot.d.ts +1 -0
  21. package/dist/charts/ordinal/ViolinPlot.d.ts +1 -0
  22. package/dist/charts/realtime/RealtimeHeatmap.d.ts +11 -0
  23. package/dist/charts/realtime/RealtimeHistogram.d.ts +15 -1
  24. package/dist/charts/realtime/RealtimeLineChart.d.ts +6 -0
  25. package/dist/charts/realtime/RealtimeSwarmChart.d.ts +6 -0
  26. package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +6 -0
  27. package/dist/charts/shared/annotationRules.d.ts +3 -0
  28. package/dist/charts/shared/colorUtils.d.ts +17 -11
  29. package/dist/charts/shared/hooks.d.ts +96 -1
  30. package/dist/charts/shared/loess.d.ts +13 -0
  31. package/dist/charts/shared/networkUtils.d.ts +31 -0
  32. package/dist/charts/shared/tooltipUtils.d.ts +16 -0
  33. package/dist/charts/shared/types.d.ts +17 -2
  34. package/dist/charts/shared/validateChartData.d.ts +2 -3
  35. package/dist/charts/shared/validateProps.d.ts +18 -0
  36. package/dist/charts/xy/AreaChart.d.ts +4 -0
  37. package/dist/charts/xy/BubbleChart.d.ts +6 -0
  38. package/dist/charts/xy/Heatmap.d.ts +4 -0
  39. package/dist/charts/xy/LineChart.d.ts +6 -0
  40. package/dist/charts/xy/Scatterplot.d.ts +4 -0
  41. package/dist/charts/xy/StackedAreaChart.d.ts +4 -0
  42. package/dist/data/fromVegaLite.d.ts +48 -0
  43. package/dist/export/chartConfig.d.ts +29 -0
  44. package/dist/export/selectionSerializer.d.ts +20 -0
  45. package/dist/geometry/sankeyLinks.d.ts +1 -1
  46. package/dist/network.min.js +1 -1
  47. package/dist/network.module.min.js +1 -1
  48. package/dist/ordinal.min.js +1 -1
  49. package/dist/ordinal.module.min.js +1 -1
  50. package/dist/realtime/types.d.ts +20 -6
  51. package/dist/realtime.min.js +1 -1
  52. package/dist/realtime.module.min.js +1 -1
  53. package/dist/semiotic-ai.d.ts +14 -0
  54. package/dist/semiotic-ai.min.js +1 -1
  55. package/dist/semiotic-ai.module.min.js +1 -1
  56. package/dist/semiotic-data.d.ts +2 -0
  57. package/dist/semiotic-data.min.js +1 -1
  58. package/dist/semiotic-data.module.min.js +1 -1
  59. package/dist/semiotic-network.d.ts +9 -19
  60. package/dist/semiotic-ordinal.d.ts +12 -14
  61. package/dist/semiotic-xy.d.ts +12 -18
  62. package/dist/semiotic.d.ts +16 -13
  63. package/dist/semiotic.min.js +1 -1
  64. package/dist/semiotic.module.min.js +1 -1
  65. package/dist/server.min.js +1 -1
  66. package/dist/server.module.min.js +1 -1
  67. package/dist/store/ObservationStore.d.ts +61 -0
  68. package/dist/store/SelectionStore.d.ts +9 -1
  69. package/dist/store/ThemeStore.d.ts +6 -1
  70. package/dist/store/TooltipStore.d.ts +3 -1
  71. package/dist/store/createStore.d.ts +4 -1
  72. package/dist/store/useObservation.d.ts +18 -0
  73. package/dist/stream/MarginalGraphics.d.ts +1 -1
  74. package/dist/stream/NetworkPipelineStore.d.ts +44 -0
  75. package/dist/stream/OrdinalCanvasHitTester.d.ts +1 -0
  76. package/dist/stream/OrdinalSVGOverlay.d.ts +6 -2
  77. package/dist/stream/ParticlePool.d.ts +2 -1
  78. package/dist/stream/PipelineStore.d.ts +11 -0
  79. package/dist/stream/SVGOverlay.d.ts +21 -2
  80. package/dist/stream/SceneGraph.d.ts +1 -1
  81. package/dist/stream/networkTypes.d.ts +58 -1
  82. package/dist/stream/ordinalTypes.d.ts +13 -0
  83. package/dist/stream/types.d.ts +14 -0
  84. package/dist/types/annotationTypes.d.ts +10 -0
  85. package/dist/types/networkTypes.d.ts +1 -2
  86. package/dist/xy.min.js +1 -1
  87. package/dist/xy.module.min.js +1 -1
  88. package/package.json +30 -42
  89. package/ai/dist/ai/componentRegistry.js +0 -45
  90. package/ai/dist/src/components/Annotation.js +0 -358
  91. package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +0 -369
  92. package/ai/dist/src/components/Axis/Axis.js +0 -374
  93. package/ai/dist/src/components/Axis/axisTitle.js +0 -14
  94. package/ai/dist/src/components/Axis/index.js +0 -7
  95. package/ai/dist/src/components/Axis/summaryGraphic.js +0 -37
  96. package/ai/dist/src/components/Brush.js +0 -84
  97. package/ai/dist/src/components/ChartErrorBoundary.js +0 -91
  98. package/ai/dist/src/components/DividedLine.js +0 -65
  99. package/ai/dist/src/components/Legend.js +0 -140
  100. package/ai/dist/src/components/LinkedCharts.js +0 -95
  101. package/ai/dist/src/components/ThemeProvider.js +0 -79
  102. package/ai/dist/src/components/Tooltip/Tooltip.js +0 -309
  103. package/ai/dist/src/components/TooltipPositioner/index.js +0 -132
  104. package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +0 -73
  105. package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +0 -254
  106. package/ai/dist/src/components/annotationRules/baseRules.js +0 -150
  107. package/ai/dist/src/components/annotationRules/networkframeRules.js +0 -196
  108. package/ai/dist/src/components/annotationRules/xyframeRules.js +0 -297
  109. package/ai/dist/src/components/batchWork.js +0 -35
  110. package/ai/dist/src/components/charts/index.js +0 -109
  111. package/ai/dist/src/components/charts/network/ChordDiagram.js +0 -142
  112. package/ai/dist/src/components/charts/network/CirclePack.js +0 -108
  113. package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +0 -121
  114. package/ai/dist/src/components/charts/network/SankeyDiagram.js +0 -155
  115. package/ai/dist/src/components/charts/network/TreeDiagram.js +0 -110
  116. package/ai/dist/src/components/charts/network/Treemap.js +0 -106
  117. package/ai/dist/src/components/charts/ordinal/BarChart.js +0 -156
  118. package/ai/dist/src/components/charts/ordinal/BoxPlot.js +0 -139
  119. package/ai/dist/src/components/charts/ordinal/DonutChart.js +0 -130
  120. package/ai/dist/src/components/charts/ordinal/DotPlot.js +0 -126
  121. package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +0 -129
  122. package/ai/dist/src/components/charts/ordinal/Histogram.js +0 -132
  123. package/ai/dist/src/components/charts/ordinal/PieChart.js +0 -128
  124. package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +0 -130
  125. package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +0 -130
  126. package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +0 -147
  127. package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +0 -138
  128. package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +0 -79
  129. package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +0 -114
  130. package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +0 -93
  131. package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +0 -105
  132. package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +0 -106
  133. package/ai/dist/src/components/charts/shared/ChartError.js +0 -72
  134. package/ai/dist/src/components/charts/shared/colorUtils.js +0 -138
  135. package/ai/dist/src/components/charts/shared/formatUtils.js +0 -213
  136. package/ai/dist/src/components/charts/shared/hooks.js +0 -49
  137. package/ai/dist/src/components/charts/shared/legendUtils.js +0 -57
  138. package/ai/dist/src/components/charts/shared/selectionUtils.js +0 -67
  139. package/ai/dist/src/components/charts/shared/tooltipUtils.js +0 -79
  140. package/ai/dist/src/components/charts/shared/types.js +0 -2
  141. package/ai/dist/src/components/charts/shared/validateChartData.js +0 -82
  142. package/ai/dist/src/components/charts/shared/validateProps.js +0 -736
  143. package/ai/dist/src/components/charts/xy/AreaChart.js +0 -230
  144. package/ai/dist/src/components/charts/xy/BubbleChart.js +0 -251
  145. package/ai/dist/src/components/charts/xy/Heatmap.js +0 -235
  146. package/ai/dist/src/components/charts/xy/LineChart.js +0 -307
  147. package/ai/dist/src/components/charts/xy/MinimapChart.js +0 -298
  148. package/ai/dist/src/components/charts/xy/Scatterplot.js +0 -172
  149. package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +0 -426
  150. package/ai/dist/src/components/charts/xy/StackedAreaChart.js +0 -231
  151. package/ai/dist/src/components/constants/coordinateNames.js +0 -11
  152. package/ai/dist/src/components/constants/frame_props.js +0 -251
  153. package/ai/dist/src/components/data/dataFunctions.js +0 -487
  154. package/ai/dist/src/components/data/multiAccessorUtils.js +0 -14
  155. package/ai/dist/src/components/data/transforms.js +0 -143
  156. package/ai/dist/src/components/data/unflowedFunctions.js +0 -5
  157. package/ai/dist/src/components/export/exportChart.js +0 -121
  158. package/ai/dist/src/components/generic_utilities/functions.js +0 -5
  159. package/ai/dist/src/components/geometry/areaDrawing.js +0 -312
  160. package/ai/dist/src/components/geometry/contourLayout.js +0 -73
  161. package/ai/dist/src/components/geometry/hexbinLayout.js +0 -163
  162. package/ai/dist/src/components/geometry/lineDrawing.js +0 -356
  163. package/ai/dist/src/components/geometry/sankeyLinks.js +0 -331
  164. package/ai/dist/src/components/geometry/summaryLayouts.js +0 -136
  165. package/ai/dist/src/components/index.js +0 -18
  166. package/ai/dist/src/components/processing/InteractionItems.js +0 -223
  167. package/ai/dist/src/components/processing/hierarchyUtils.js +0 -104
  168. package/ai/dist/src/components/processing/layouts/chordLayout.js +0 -58
  169. package/ai/dist/src/components/processing/layouts/forceLayout.js +0 -142
  170. package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +0 -31
  171. package/ai/dist/src/components/processing/layouts/index.js +0 -32
  172. package/ai/dist/src/components/processing/layouts/sankeyLayout.js +0 -96
  173. package/ai/dist/src/components/processing/layouts/simpleLayouts.js +0 -34
  174. package/ai/dist/src/components/processing/layouts/types.js +0 -2
  175. package/ai/dist/src/components/processing/networkDefaults.js +0 -39
  176. package/ai/dist/src/components/realtime/BinAccumulator.js +0 -36
  177. package/ai/dist/src/components/realtime/IncrementalExtent.js +0 -55
  178. package/ai/dist/src/components/realtime/RingBuffer.js +0 -104
  179. package/ai/dist/src/components/realtime/renderers/barRenderer.js +0 -133
  180. package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +0 -7
  181. package/ai/dist/src/components/realtime/renderers/lineRenderer.js +0 -164
  182. package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +0 -91
  183. package/ai/dist/src/components/realtime/renderers/types.js +0 -2
  184. package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +0 -163
  185. package/ai/dist/src/components/realtime/types.js +0 -2
  186. package/ai/dist/src/components/semiotic-ai.js +0 -89
  187. package/ai/dist/src/components/semiotic-data.js +0 -12
  188. package/ai/dist/src/components/semiotic-network.js +0 -38
  189. package/ai/dist/src/components/semiotic-ordinal.js +0 -28
  190. package/ai/dist/src/components/semiotic-realtime.js +0 -30
  191. package/ai/dist/src/components/semiotic-server.js +0 -8
  192. package/ai/dist/src/components/semiotic-xy.js +0 -35
  193. package/ai/dist/src/components/semiotic.js +0 -109
  194. package/ai/dist/src/components/server/renderToStaticSVG.js +0 -594
  195. package/ai/dist/src/components/store/SelectionStore.js +0 -91
  196. package/ai/dist/src/components/store/ThemeStore.js +0 -78
  197. package/ai/dist/src/components/store/TooltipStore.js +0 -13
  198. package/ai/dist/src/components/store/createStore.js +0 -81
  199. package/ai/dist/src/components/store/useSelection.js +0 -133
  200. package/ai/dist/src/components/stream/CanvasHitTester.js +0 -164
  201. package/ai/dist/src/components/stream/DataSourceAdapter.js +0 -99
  202. package/ai/dist/src/components/stream/MarginalGraphics.js +0 -266
  203. package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +0 -228
  204. package/ai/dist/src/components/stream/NetworkPipelineStore.js +0 -498
  205. package/ai/dist/src/components/stream/NetworkSVGOverlay.js +0 -70
  206. package/ai/dist/src/components/stream/NetworkSceneGraph.js +0 -38
  207. package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +0 -146
  208. package/ai/dist/src/components/stream/OrdinalPipelineStore.js +0 -786
  209. package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +0 -130
  210. package/ai/dist/src/components/stream/ParticlePool.js +0 -174
  211. package/ai/dist/src/components/stream/PipelineStore.js +0 -1243
  212. package/ai/dist/src/components/stream/SVGOverlay.js +0 -129
  213. package/ai/dist/src/components/stream/SceneGraph.js +0 -132
  214. package/ai/dist/src/components/stream/StreamNetworkFrame.js +0 -561
  215. package/ai/dist/src/components/stream/StreamOrdinalFrame.js +0 -492
  216. package/ai/dist/src/components/stream/StreamXYFrame.js +0 -590
  217. package/ai/dist/src/components/stream/accessorUtils.js +0 -20
  218. package/ai/dist/src/components/stream/index.js +0 -32
  219. package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +0 -352
  220. package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +0 -230
  221. package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +0 -568
  222. package/ai/dist/src/components/stream/layouts/index.js +0 -28
  223. package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +0 -245
  224. package/ai/dist/src/components/stream/networkTypes.js +0 -17
  225. package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +0 -126
  226. package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +0 -62
  227. package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +0 -33
  228. package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +0 -63
  229. package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +0 -278
  230. package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +0 -30
  231. package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +0 -2
  232. package/ai/dist/src/components/stream/ordinalTypes.js +0 -2
  233. package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +0 -48
  234. package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +0 -70
  235. package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +0 -75
  236. package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +0 -28
  237. package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +0 -47
  238. package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +0 -31
  239. package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +0 -140
  240. package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +0 -38
  241. package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +0 -37
  242. package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +0 -102
  243. package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +0 -63
  244. package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +0 -35
  245. package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +0 -38
  246. package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +0 -10
  247. package/ai/dist/src/components/stream/renderers/types.js +0 -2
  248. package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +0 -47
  249. package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +0 -38
  250. package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +0 -33
  251. package/ai/dist/src/components/stream/types.js +0 -2
  252. package/ai/dist/src/components/types/annotationTypes.js +0 -2
  253. package/ai/dist/src/components/types/canvasTypes.js +0 -2
  254. package/ai/dist/src/components/types/generalTypes.js +0 -2
  255. package/ai/dist/src/components/types/interactionTypes.js +0 -2
  256. package/ai/dist/src/components/types/legendTypes.js +0 -2
  257. package/ai/dist/src/components/types/networkTypes.js +0 -2
  258. package/ai/dist/src/components/types/ordinalTypes.js +0 -2
  259. package/ai/dist/src/components/types/xyTypes.js +0 -2
  260. package/ai/dist/src/components/useBoundingRect.js +0 -24
  261. package/ai/dist/src/components/visualizationLayerBehavior/axis.js +0 -301
  262. package/ai/dist/src/components/visualizationLayerBehavior/general.js +0 -435
  263. package/ai/dist/src/setupTests.js +0 -4
  264. package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -25
  265. package/dist/Axis/Axis.d.ts +0 -7
  266. package/dist/Axis/axisTitle.d.ts +0 -10
  267. package/dist/Axis/index.d.ts +0 -2
  268. package/dist/Axis/summaryGraphic.d.ts +0 -17
  269. package/dist/Brush.d.ts +0 -12
  270. package/dist/DividedLine.d.ts +0 -16
  271. package/dist/TooltipPositioner/index.d.ts +0 -7
  272. package/dist/annotationLayerBehavior/annotationHandling.d.ts +0 -19
  273. package/dist/annotationLayerBehavior/d3labeler.d.ts +0 -9
  274. package/dist/annotationRules/baseRules.d.ts +0 -25
  275. package/dist/annotationRules/networkframeRules.d.ts +0 -48
  276. package/dist/annotationRules/xyframeRules.d.ts +0 -117
  277. package/dist/batchWork.d.ts +0 -6
  278. package/dist/constants/coordinateNames.d.ts +0 -8
  279. package/dist/constants/frame_props.d.ts +0 -13
  280. package/dist/data/dataFunctions.d.ts +0 -45
  281. package/dist/data/multiAccessorUtils.d.ts +0 -1
  282. package/dist/data/unflowedFunctions.d.ts +0 -1
  283. package/dist/generic_utilities/functions.d.ts +0 -1
  284. package/dist/geometry/areaDrawing.d.ts +0 -21
  285. package/dist/geometry/contourLayout.d.ts +0 -6
  286. package/dist/geometry/hexbinLayout.d.ts +0 -7
  287. package/dist/geometry/lineDrawing.d.ts +0 -71
  288. package/dist/geometry/summaryLayouts.d.ts +0 -45
  289. package/dist/index.d.ts +0 -1
  290. package/dist/network.js +0 -7495
  291. package/dist/network.js.map +0 -1
  292. package/dist/network.module.js +0 -7458
  293. package/dist/network.module.js.map +0 -1
  294. package/dist/ordinal.js +0 -6497
  295. package/dist/ordinal.js.map +0 -1
  296. package/dist/ordinal.module.js +0 -6465
  297. package/dist/ordinal.module.js.map +0 -1
  298. package/dist/processing/InteractionItems.d.ts +0 -13
  299. package/dist/processing/hierarchyUtils.d.ts +0 -16
  300. package/dist/processing/layouts/chordLayout.d.ts +0 -2
  301. package/dist/processing/layouts/forceLayout.d.ts +0 -3
  302. package/dist/processing/layouts/hierarchyLayout.d.ts +0 -10
  303. package/dist/processing/layouts/index.d.ts +0 -8
  304. package/dist/processing/layouts/sankeyLayout.d.ts +0 -8
  305. package/dist/processing/layouts/simpleLayouts.d.ts +0 -7
  306. package/dist/processing/layouts/types.d.ts +0 -17
  307. package/dist/processing/networkDefaults.d.ts +0 -36
  308. package/dist/realtime/renderers/barRenderer.d.ts +0 -2
  309. package/dist/realtime/renderers/candlestickRenderer.d.ts +0 -2
  310. package/dist/realtime/renderers/lineRenderer.d.ts +0 -2
  311. package/dist/realtime/renderers/swarmRenderer.d.ts +0 -2
  312. package/dist/realtime.js +0 -7072
  313. package/dist/realtime.js.map +0 -1
  314. package/dist/realtime.module.js +0 -7043
  315. package/dist/realtime.module.js.map +0 -1
  316. package/dist/semiotic-ai.js +0 -13323
  317. package/dist/semiotic-ai.js.map +0 -1
  318. package/dist/semiotic-ai.module.js +0 -13264
  319. package/dist/semiotic-ai.module.js.map +0 -1
  320. package/dist/semiotic-data.js +0 -141
  321. package/dist/semiotic-data.js.map +0 -1
  322. package/dist/semiotic-data.module.js +0 -136
  323. package/dist/semiotic-data.module.js.map +0 -1
  324. package/dist/semiotic.js +0 -16351
  325. package/dist/semiotic.js.map +0 -1
  326. package/dist/semiotic.module.js +0 -16265
  327. package/dist/semiotic.module.js.map +0 -1
  328. package/dist/server.js +0 -5191
  329. package/dist/server.js.map +0 -1
  330. package/dist/server.module.js +0 -5166
  331. package/dist/server.module.js.map +0 -1
  332. package/dist/stream/NetworkSceneGraph.d.ts +0 -14
  333. package/dist/stream/index.d.ts +0 -16
  334. package/dist/types/canvasTypes.d.ts +0 -9
  335. package/dist/types/xyTypes.d.ts +0 -24
  336. package/dist/useBoundingRect.d.ts +0 -2
  337. package/dist/visualizationLayerBehavior/axis.d.ts +0 -36
  338. package/dist/visualizationLayerBehavior/general.d.ts +0 -80
  339. package/dist/xy.js +0 -6993
  340. package/dist/xy.js.map +0 -1
  341. package/dist/xy.module.js +0 -6957
  342. package/dist/xy.module.js.map +0 -1
@@ -1 +1 @@
1
- "use strict";const t=require("react"),e=require("d3-scale"),n=require("d3-array"),o=require("labella"),a=require("regression"),s=require("d3-shape"),i=require("d3-contour"),r=require("d3-hexbin"),l=require("d3-scale-chromatic");function c(t){return t&&t.__esModule?t:{default:t}}function u(t){if(t&&t.__esModule)return t;const e=Object.create(null);if(t)for(const n in t)if("default"!==n){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}return e.default=t,Object.freeze(e)}const d=u(t),h=c(o),p=c(a),f=5e3;class m{constructor(t){this.lastBoundedData=null,this.chunkTimer=0,this.callback=t}setBoundedData(t){if(t===this.lastBoundedData)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,f),bounded:!0,totalSize:t.length});let e=f;const n=()=>{if(e>=t.length)return;if(t!==this.lastBoundedData)return;const o=Math.min(e+f,t.length);this.callback({inserts:t.slice(e,o),bounded:!1}),e=o,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}push(t){this.callback({inserts:[t],bounded:!1})}pushMany(t){0!==t.length&&this.callback({inserts:t,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class y{constructor(t){if(this._capacity=t,this.head=0,this._size=0,1>t)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(t)}push(t){let e;return this._size===this._capacity?e=this.buffer[this.head]:this._size++,this.buffer[this.head]=t,this.head=(this.head+1)%this._capacity,e}pushMany(t){const e=[];for(const n of t){const t=this.push(n);void 0!==t&&e.push(t)}return e}get(t){if(t>=0&&this._size>t)return this.buffer[(this.head-this._size+t+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let t=0;const e=this;return{next:()=>e._size>t?{done:!1,value:e.get(t++)}:{done:!0,value:void 0}}}toArray(){const t=[];for(const e of this)t.push(e);return t}resize(t){if(1>t)throw Error("RingBuffer capacity must be at least 1");const e=this.toArray(),n=[];for(;e.length>t;)n.push(e.shift());this._capacity=t,this.buffer=Array(t),this.head=0,this._size=0;for(const t of e)this.push(t);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class g{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isNaN(t)||(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isNaN(t)||(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function x(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function v(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function b(t,e,n,o,a,s,i){return{type:"rect",x:t,y:e,w:n,h:o,style:a,datum:s,group:i}}function M(t,e){const{columns:n,config:o,resolvePieceStyle:a}=t,s=[],i=Math.min(e.width,e.height)/2-4,r="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const t of Object.values(n)){const e=l+t.pctStart*c,n=l+(t.pctStart+t.pct)*c,o=a(t.pieceData[0],t.name);s.push({type:"wedge",cx:0,cy:0,innerRadius:r,outerRadius:i,startAngle:e,endAngle:n,style:o,datum:t.pieceData,category:t.name})}return s}const E={bar:function(t,e){const{scales:n,columns:o,config:a,getR:s,getStack:i,resolvePieceStyle:r}=t,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,p=a.normalize;for(const t of Object.values(o)){const e=new Map;for(const n of t.pieceData){const t=i?i(n):"_default";e.has(t)||e.set(t,{total:0,pieces:[]});const o=e.get(t);o.total+=s(n),o.pieces.push(n)}let n=0;if(p)for(const t of e.values())n+=Math.abs(t.total);let o=0,a=0;for(const[s,c]of e){let e=c.total;p&&n>0&&(e/=n);const f=r(c.pieces[0],i?s:t.name),m=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:t.name});if(d){const n=l(0>e?a:o+e),i=0>e?l(a+e)-l(a):l(o)-l(o+e);u.push(b(t.x,n,t.width,Math.abs(i),f,m,s)),0>e?a+=e:o+=e}else if(h){const n=l(0>e?a+e:o),i=0>e?l(a)-l(a+e):l(o+e)-l(o);u.push(b(n,t.x,Math.abs(i),t.width,f,m,s)),0>e?a+=e:o+=e}}}return u},clusterbar:function(t,e){const{scales:n,columns:o,getR:a,getGroup:s,resolvePieceStyle:i}=t,{r:r,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const t of Object.values(o))for(const e of t.pieceData){const t=s?s(e):"_default";h.has(t)||(h.add(t),d.push(t))}const p=d.length||1;for(const t of Object.values(o)){const e=t.width/p,n=new Map;for(const e of t.pieceData){const t=s?s(e):"_default";n.has(t)||n.set(t,[]),n.get(t).push(e)}for(let o=0;d.length>o;o++){const s=n.get(d[o])||[];for(const n of s){const s=a(n),l=i(n,t.name);if(u){const a=t.x+o*e,i=r(0),u=r(s);c.push(b(a,Math.min(i,u),e,Math.abs(i-u),l,n,d[o]))}else{const a=t.x+o*e,i=r(0),u=r(s);c.push(b(Math.min(i,u),a,Math.abs(u-i),e,l,n,d[o]))}}}}return c},point:function(t,e){var n,o;const{scales:a,columns:s,getR:i,multiScales:r,resolvePieceStyle:l}=t,{r:c,projection:u}=a,d=[],h="vertical"===u,p="radial"===u,f=r.length>0,m=2*Math.PI,y=-Math.PI/2;for(const t of Object.values(s))for(const e of t.pieceData){const a=null!==(n=e.__rIndex)&&void 0!==n?n:0,s=null!==(o=e.__rValue)&&void 0!==o?o:i(e),u=f&&r[a]||c,g=l(e,t.name),x=g.r||5;let v,b;if(p){const e=y+(t.pctStart+t.pct/2)*m,n=u(s);v=Math.cos(e)*n,b=Math.sin(e)*n}else h?(v=t.middle,b=u(s)):(v=u(s),b=t.middle);d.push({type:"point",x:v,y:b,r:x,style:g,datum:e})}return d},swarm:function(t,e){const{scales:n,columns:o,getR:a,resolvePieceStyle:s}=t,{r:i,projection:r}=n,l=[],c="vertical"===r;for(const t of Object.values(o)){const e=t.width/2;for(let n=0;t.pieceData.length>n;n++){const o=t.pieceData[n],r=a(o),u=s(o,t.name),d=u.r||4,h=(7919*n%100/100-.5)*e*.8,p=c?t.middle+h:i(r),f=c?i(r):t.middle+h;l.push({type:"point",x:p,y:f,r:d,style:u,datum:o})}}return l},pie:M,donut:M,boxplot:function(t,e){var o,a,s,i,r;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=t,{r:p,projection:f}=l,m=[],y="vertical"===f,g=!1!==u.showOutliers;for(const t of Object.values(c)){const e=t.pieceData.map(t=>d(t)).filter(t=>null!=t&&!isNaN(t)).sort((t,e)=>t-e);if(0===e.length)continue;const l=e[0],c=e[e.length-1],u=null!==(o=n.quantile(e,.25))&&void 0!==o?o:l,f=null!==(a=n.quantile(e,.5))&&void 0!==a?a:(l+c)/2,x=null!==(s=n.quantile(e,.75))&&void 0!==s?s:c,v=x-u,b=u-1.5*v,M=x+1.5*v,E=null!==(i=e.find(t=>t>=b))&&void 0!==i?i:l,k=null!==(r=[...e].reverse().find(t=>M>=t))&&void 0!==r?r:c,w=h(t.pieceData[0],t.name),A=[];if(g)for(const e of t.pieceData){const n=d(e);if(b>n||n>M){const o=y?t.middle:p(n),a=y?p(n):t.middle;A.push({px:o,py:a,value:n,datum:e})}}if(m.push({type:"boxplot",x:y?t.middle:0,y:y?0:t.middle,projection:y?"vertical":"horizontal",columnWidth:.6*t.width,minPos:p(E),q1Pos:p(u),medianPos:p(f),q3Pos:p(x),maxPos:p(k),stats:{min:E,q1:u,median:f,q3:x,max:k},style:w,datum:t.pieceData,category:t.name,outliers:A}),g)for(const t of A)m.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:w.fill||"#999",opacity:.6},datum:t.datum})}return m},violin:function(t,e){var o,a,s;const{scales:i,columns:r,config:l,getR:c,resolveSummaryStyle:u}=t,{r:d,projection:h}=i,p=[],f="vertical"===h,m=l.bins||20,y=!1!==l.showIQR;for(const t of Object.values(r)){const e=t.pieceData.map(t=>c(t)).filter(t=>null!=t&&!isNaN(t)).sort((t,e)=>t-e);if(2>e.length)continue;const i=e[0],r=e[e.length-1],l=(r-i)/m||1,h=Array(m).fill(0);for(const t of e)h[Math.min(Math.floor((t-i)/l),m-1)]++;const g=Math.max(...h,1),x=t.width/2*.9;let v="";if(f){for(let e=0;m>e;e++){const n=d(i+(e+.5)*l),o=h[e]/g*x;v+=0===e?`M ${t.middle+o} ${n}`:` L ${t.middle+o} ${n}`}for(let e=m-1;e>=0;e--){const n=d(i+(e+.5)*l);v+=` L ${t.middle-h[e]/g*x} ${n}`}v+=" Z"}else{for(let e=0;m>e;e++){const n=d(i+(e+.5)*l),o=h[e]/g*x;v+=0===e?`M ${n} ${t.middle-o}`:` L ${n} ${t.middle-o}`}for(let e=m-1;e>=0;e--)v+=` L ${d(i+(e+.5)*l)} ${t.middle+h[e]/g*x}`;v+=" Z"}const b=u(t.pieceData[0],t.name);let M;if(y&&e.length>=4){const t=null!==(o=n.quantile(e,.25))&&void 0!==o?o:i,l=null!==(a=n.quantile(e,.5))&&void 0!==a?a:(i+r)/2,c=null!==(s=n.quantile(e,.75))&&void 0!==s?s:r;M={q1Pos:d(t),medianPos:d(l),q3Pos:d(c)}}const E=f?{x:t.x,y:Math.min(d(r),d(i)),width:t.width,height:Math.abs(d(r)-d(i))}:{x:Math.min(d(i),d(r)),y:t.x,width:Math.abs(d(r)-d(i)),height:t.width};p.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:E,iqrLine:M,style:b,datum:t.pieceData,category:t.name})}return p},histogram:function(t,e){const{scales:n,columns:o,config:a,getR:s,resolveSummaryStyle:i}=t,{r:r}=n,l=[],c=a.bins||25,u=a.normalize;for(const t of Object.values(o)){const e=t.pieceData.map(t=>s(t)).filter(t=>null!=t&&!isNaN(t));if(0===e.length)continue;const n=Math.min(...e),o=(Math.max(...e)-n)/c||1,a=Array(c).fill(0);for(const t of e)a[Math.min(Math.floor((t-n)/o),c-1)]++;const d=e.length,h=Math.max(...a,1),p=i(t.pieceData[0],t.name);for(let e=0;c>e;e++){if(0===a[e])continue;const s=(u?a[e]/d:a[e]/h)*t.width*.9,i=r(n+e*o),c=r(n+(e+1)*o);l.push(b(Math.min(i,c),t.x+t.width-s,Math.abs(c-i),s,p,{bin:e,count:a[e],range:[n+e*o,n+(e+1)*o],category:t.name},t.name))}}return l},ridgeline:function(t,e){var n;const{scales:o,columns:a,config:s,getR:i,resolveSummaryStyle:r}=t,{r:l,projection:c}=o,u=[],d=s.bins||20,h="horizontal"===c,p=s.amplitude||1.5;for(const t of Object.values(a)){const e=t.pieceData.map(t=>i(t)).filter(t=>null!=t&&!isNaN(t)).sort((t,e)=>t-e);if(2>e.length)continue;const o=e[0],a=e[e.length-1],s=(a-o)/d||1,c=Array(d).fill(0);for(const t of e)c[Math.min(Math.floor((t-o)/s),d-1)]++;const f=Math.max(...c,1),m=r(t.pieceData[0],t.name),y=t.width*p;let g="";if(h){const e=t.x+t.width;g=`M ${l(o)} ${e}`;for(let t=0;d>t;t++)g+=` L ${l(o+(t+.5)*s)} ${e-c[t]/f*y}`;g+=` L ${l(a)} ${e} Z`}else{const e=t.x;g=`M ${e} ${l(o)}`;for(let t=0;d>t;t++){const n=l(o+(t+.5)*s);g+=` L ${e+c[t]/f*y} ${n}`}g+=` L ${e} ${l(a)} Z`}const x=h?{x:Math.min(l(o),l(a)),y:t.x,width:Math.abs(l(a)-l(o)),height:t.width}:{x:t.x,y:Math.min(l(a),l(o)),width:t.width,height:Math.abs(l(a)-l(o))};u.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:x,style:Object.assign(Object.assign({},m),{fillOpacity:null!==(n=m.fillOpacity)&&void 0!==n?n:.5}),datum:t.pieceData,category:t.name})}return u},timeline:function(t,e){const{scales:n,columns:o,getRawRange:a,resolvePieceStyle:s}=t,{r:i,projection:r}=n,l=[],c="horizontal"===r;for(const t of Object.values(o))for(const e of t.pieceData){const n=a(e);if(!n)continue;const[o,r]=n,u=s(e,t.name);if(c){const n=i(Math.min(o,r)),a=i(Math.max(o,r));l.push(b(n,t.x,a-n,t.width,u,e,t.name))}else{const n=i(Math.max(o,r)),a=i(Math.min(o,r));l.push(b(t.x,n,t.width,a-n,u,e,t.name))}}return l}};class k{constructor(t){this.rExtent=new g,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=t,this.buffer=new y(t.windowSize),this.getO=v(t.oAccessor||t.categoryAccessor,"category");const e="streaming"===t.runtimeMode,n=t.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(t=>x(t,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new g)):(this.getR=x(e&&(t.timeAccessor||t.valueAccessor)&&t.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=v(t.stackBy),this.getGroup=v(t.groupBy),this.getColor=v(t.colorAccessor),this.getConnector=v(t.connectorAccessor),t.pulse&&(this.timestampBuffer=new y(t.windowSize))}ingest(t){const e="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=e,t.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=t.totalSize||t.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of t.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(e),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else for(const n of t.inserts){const t=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(e),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=t&&this.evictValueExtent(t)}return!0}pushValueExtent(t){if("timeline"===this.config.chartType){const e=this.getRawRange(t);e&&(this.rExtent.push(e[0]),this.rExtent.push(e[1]))}else if(this.rAccessors.length>1){for(let e=0;this.rAccessors.length>e;e++)this.rExtents[e].push(this.rAccessors[e](t));this.rExtent.push(this.getR(t))}else this.rExtent.push(this.getR(t))}evictValueExtent(t){if("timeline"===this.config.chartType){const e=this.getRawRange(t);e&&(this.rExtent.evict(e[0]),this.rExtent.evict(e[1]))}else if(this.rAccessors.length>1){for(let e=0;this.rAccessors.length>e;e++)this.rExtents[e].evict(this.rAccessors[e](t));this.rExtent.evict(this.getR(t))}else this.rExtent.evict(this.getR(t))}getRawRange(t){const e=this.config.rAccessor;if(!e)return null;const n="function"==typeof e?e(t):t[e];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(t){const{config:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const a=o.toArray(),s=n.projection||"vertical",i=n.oExtent||this.resolveCategories(a),r=this.computeValueDomain(a,i),l="horizontal"===s,c=null!=n.barPadding?n.barPadding/("vertical"===s?t.width:t.height):.1;let u,d;if("radial"===s){u=e.scaleBand().domain(i).range([0,1]).padding(0);const o=Math.min(t.width,t.height)/2,a=n.innerRadius||0;d=e.scaleLinear().domain(r).range([a,o])}else l?(u=e.scaleBand().domain(i).range([0,t.height]).padding(c),d=e.scaleLinear().domain(r).range([0,t.width])):(u=e.scaleBand().domain(i).range([0,t.width]).padding(c),d=e.scaleLinear().domain(r).range([t.height,0]));this.scales={o:u,r:d,projection:s},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((a,s)=>{const i=this.rExtents[s];i.dirty&&i.recalculate(o,a);let[r,c]=i.extent;r===1/0&&(r=0,c=1);const u=c-r,d=u>0?u*(n.extentPadding||.05):1;return r-=d,c+=d,r>0&&(r=0),l?e.scaleLinear().domain([r,c]).range([0,t.width]):e.scaleLinear().domain([r,c]).range([t.height,0])}):[];let h=a;this.rAccessors.length>1&&(h=a.flatMap(t=>this.rAccessors.map((e,n)=>Object.assign(Object.assign({},t),{__rIndex:n,__rValue:e(t),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(h,i,u,s,t),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,t),this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(t){const e=Array.isArray(this.config.rAccessor)?this.config.rAccessor[t]:this.config.rAccessor;return"string"==typeof e?e:"value"+t}resolveCategories(t){const e=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return e;if(!1===n)return e;if("function"==typeof n)return e.sort(n);const o=new Map;for(const e of t){const t=this.getO(e);o.set(t,(o.get(t)||0)+Math.abs(this.getR(e)))}return e.sort("asc"===n?(t,e)=>(o.get(t)||0)-(o.get(e)||0):(t,e)=>(o.get(e)||0)-(o.get(t)||0))}computeValueDomain(t,e){var n,o;const a=this.config.chartType,s=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let i=0,r=0;if("bar"===a&&this.getStack){const e=new Map,n=new Map;for(const o of t){const t=this.getO(o),a=this.getR(o);0>a?n.set(t,(n.get(t)||0)+a):e.set(t,(e.get(t)||0)+a)}for(const t of e.values())t>r&&(r=t);for(const t of n.values())i>t&&(i=t)}else if("bar"===a){const e=new Map;for(const n of t){const t=this.getO(n),o=this.getR(n);e.set(t,(e.get(t)||0)+o)}for(const t of e.values())t>r&&(r=t),i>t&&(i=t)}else if("clusterbar"===a)for(const e of t){const t=this.getR(e);t>r&&(r=t),i>t&&(i=t)}else{const t=this.rExtent.extent[0],e=this.rExtent.extent[1];t!==1/0&&(i=t),e!==-1/0&&(r=e)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(i=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(r=this.config.rExtent[1]));const l=r-i,c=l>0?l*s:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(i-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(r+=c),"bar"!==a&&"clusterbar"!==a||(i>0&&(i=0),0>r&&(r=0)),[i,r]}buildColumns(t,e,n,o,a){var s;const i={},r=new Map;for(const e of t){const t=this.getO(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}let l=0;if("radial"===o)for(const e of t)l+=Math.abs(this.getR(e));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let t=0;for(const n of e){const e=r.get(n)||[];let o;o="string"==typeof c?e.reduce((t,e)=>t+(Number(e[c])||0),0):c(e),u.set(n,o),t+=o}const s=("horizontal"===o?a.height:a.width)-n.padding()*n.step()*e.length;if(t>0)for(const[e,n]of u)u.set(e,n/t*s)}let d=0,h=0;for(const t of e){const e=r.get(t)||[],o=e.reduce((t,e)=>t+Math.abs(this.getR(e)),0),a=l>0?o/l:0;let c,p;u?(c=h,p=u.get(t)||n.bandwidth(),h+=p+n.padding()*n.step()):(c=null!==(s=n(t))&&void 0!==s?s:0,p=n.bandwidth()),i[t]={name:t,x:c,y:0,width:p,middle:c+p/2,padding:n.padding()*n.step(),pieceData:e,pct:a,pctStart:d},d+=a}return i}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(t,e)=>this.resolvePieceStyle(t,e),resolveSummaryStyle:(t,e)=>this.resolveSummaryStyle(t,e),getRawRange:t=>this.getRawRange(t)}}buildSceneNodes(t,e){if(!this.scales)return[];const n=this.getSceneContext(),o=E[this.config.chartType];let a=o?o(n,e):[];if(this.getConnector&&this.scales){const t=function(t,e){const{scales:n,config:o,getConnector:a,getO:s}=t;if(!a||!n)return[];const i=[],{projection:r}=n,l=new Map;for(const t of e){if("point"!==t.type&&"rect"!==t.type)continue;const e=t.datum;if(!e)continue;const n=a(e);if(!n)continue;let o,i;"point"===t.type?(o=t.x,i=t.y):(o=t.x+t.w/2,i=t.y+("vertical"===r?0:t.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:i,datum:e,category:s(e)})}const c=n.o.domain(),u=o.connectorStyle;for(const[t,e]of l)if(e.length>=2){e.sort((t,e)=>c.indexOf(t.category)-c.indexOf(e.category));for(let n=0;e.length-1>n;n++){const o=e[n],a=e[n+1],s="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};i.push({type:"connector",x1:o.x,y1:o.y,x2:a.x,y2:a.y,style:s,datum:o.datum,group:t})}}return i}(n,a);a=[...t,...a]}return a}resolvePieceStyle(t,e){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(t,e):this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&e?{fill:this.config.barColors[e]||"#007bff"}:e?{fill:this.getColorFromScheme(e)}:{fill:"#007bff"}}getColorFromScheme(t){this._colorSchemeMap||(this._colorSchemeMap=new Map);const e=this._colorSchemeMap.get(t);if(e)return e;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(t,o),o}resolveSummaryStyle(t,e){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(t,e):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(t,e){var n,o,a;const s=this.config.decay;if(!s||1>=e)return 1;const i=null!==(n=s.minOpacity)&&void 0!==n?n:.1,r=e-1-t;switch(s.type){case"linear":return i+(1-r/(e-1))*(1-i);case"exponential":{const t=null!==(o=s.halfLife)&&void 0!==o?o:e/2;return i+Math.pow(.5,r/t)*(1-i)}case"step":return(null!==(a=s.stepThreshold)&&void 0!==a?a:.5*e)>r?1:i;default:return 1}}applyDecay(t,e){var n,o;if(!this.config.decay)return;const a=e.length;if(1>=a)return;const s=new Map;for(let t=0;e.length>t;t++)s.set(e[t],t);for(const e of t){if("connector"===e.type||"violin"===e.type||"boxplot"===e.type||"wedge"===e.type)continue;const t=s.get(e.datum);if(null==t)continue;const i=this.computeDecayOpacity(t,a),r=null!==(o=null===(n=e.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;e.style=Object.assign(Object.assign({},e.style),{opacity:r*i})}}applyPulse(t,e){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const a="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,i=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",r=new Map;for(let t=0;e.length>t;t++)r.set(e[t],t);for(const e of t){if("connector"===e.type||"violin"===e.type||"boxplot"===e.type||"wedge"===e.type)continue;const t=r.get(e.datum);if(null==t)continue;const n=this.timestampBuffer.get(t);if(null==n)continue;const o=a-n;s>o&&(e._pulseIntensity=1-o/s,e._pulseColor=i)}}get hasActivePulses(){var t;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const e="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(t=this.config.pulse.duration)&&void 0!==t?t:500,o=this.timestampBuffer.peek();return null!=o&&n>e-o}snapshotPositions(){var t,e;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const a=`r:${o.group||""}:${null!==(e=null===(t=o.datum)||void 0===t?void 0:t.category)&&void 0!==e?e:n}`;this.prevPositionMap.set(a,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var t,e,n,o,a;if(!this.config.transition||0===this.prevPositionMap.size)return;const s=null!==(t=this.config.transition.duration)&&void 0!==t?t:300;let i=!1;for(let t=0;this.scene.length>t;t++){const s=this.scene[t];let r=null;if("point"===s.type?r="p:"+t:"rect"===s.type&&(r=`r:${s.group||""}:${null!==(n=null===(e=s.datum)||void 0===e?void 0:e.category)&&void 0!==n?n:t}`),!r)continue;const l=this.prevPositionMap.get(r);l&&("point"===s.type?l.x===s.x&&l.y===s.y||(s._targetX=s.x,s._targetY=s.y,s.x=l.x,s.y=l.y,i=!0):"rect"===s.type&&(l.x===s.x&&l.y===s.y&&l.w===s.w&&l.h===s.h||(s._targetX=s.x,s._targetY=s.y,s._targetW=s.w,s._targetH=s.h,s.x=l.x,s.y=l.y,s.w=null!==(o=l.w)&&void 0!==o?o:s.w,s.h=null!==(a=l.h)&&void 0!==a?a:s.h,i=!0)))}i&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:s})}advanceTransition(t){var e,n,o;if(!this.activeTransition)return!1;const a=Math.min((t-this.activeTransition.startTime)/this.activeTransition.duration,1),s="linear"===(null===(e=this.config.transition)||void 0===e?void 0:e.easing)?a:1-Math.pow(1-a,3);for(const t of this.scene)if("point"===t.type){if(void 0===t._targetX)continue;const e=this.prevPositionMap.get("p:0");if(!e)continue;t.x=e.x+(t._targetX-e.x)*s,t.y=e.y+(t._targetY-e.y)*s}else if("rect"===t.type){if(void 0===t._targetX)continue;const e=`r:${t.group||""}:${null!==(o=null===(n=t.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,a=this.prevPositionMap.get(e);if(!a)continue;t.x=a.x+(t._targetX-a.x)*s,t.y=a.y+(t._targetY-a.y)*s,void 0!==a.w&&(t.w=a.w+(t._targetW-a.w)*s,t.h=a.h+(t._targetH-a.h)*s)}if(a>=1){for(const t of this.scene)if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t._targetX=void 0,t._targetY=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(t){t.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,t)}}function w(t,e,n){return t.x>e||e>t.x+t.w||t.y>n||n>t.y+t.h?null:{datum:t.datum,x:t.x+t.w/2,y:t.y,distance:0,category:t.group}}function A(t,e,n){const o=e-t.x,a=n-t.y,s=Math.sqrt(o*o+a*a);return s>Math.max(t.r,5)?null:{datum:t.datum,x:t.x,y:t.y,distance:s}}function S(t,e,n){const o=e-t.cx,a=n-t.cy,s=Math.sqrt(o*o+a*a);if(t.innerRadius>s||s>t.outerRadius)return null;let i=Math.atan2(a,o);0>i&&(i+=2*Math.PI);let r=t.startAngle%(2*Math.PI),l=t.endAngle%(2*Math.PI);if(0>r&&(r+=2*Math.PI),0>l&&(l+=2*Math.PI),!(r>l?i>=r||l>=i:i>=r&&l>=i))return null;const c=(t.startAngle+t.endAngle)/2,u=(t.innerRadius+t.outerRadius)/2;return{datum:t.datum,x:t.cx+Math.cos(c)*u,y:t.cy+Math.sin(c)*u,distance:0,category:t.category}}function P(t,e,n){const o=t.columnWidth/2;if("vertical"===t.projection){if(!(t.x-o>e||e>t.x+o||Math.min(t.minPos,t.maxPos)>n||n>Math.max(t.minPos,t.maxPos)))return{datum:t.datum,x:t.x,y:t.medianPos,distance:0,category:t.category}}else{const a=t.y-o,s=t.y+o;if(!(Math.min(t.minPos,t.maxPos)>e||e>Math.max(t.minPos,t.maxPos)||a>n||n>s))return{datum:t.datum,x:t.medianPos,y:t.y,distance:0,category:t.category}}return null}function j(t,e,n){if(!t.bounds)return null;const{x:o,y:a,width:s,height:i}=t.bounds;return o>e||e>o+s||a>n||n>a+i?null:{datum:t.datum,x:o+s/2,y:a+i/2,distance:0,category:t.category}}const $={fill:t=>d.createElement("rect",{style:t,width:20,height:20}),line:t=>d.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function O(t,e,n,o){let a;return a="function"==typeof n?n(t):(0,$[n])(o(t,e)),a}function _(t){const{legendGroups:e,customClickBehavior:n,title:o="Legend",width:a=100,height:s=20,orientation:i="vertical"}=t,r="vertical"===i?(({legendGroups:t,width:e,customClickBehavior:n})=>{let o=30;const a=[];return t.forEach((t,s)=>{o+=5,a.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+s,stroke:"gray",x1:0,y1:o,x2:e,y2:o})),o+=10,t.label&&(o+=20,a.push(d.createElement("text",{key:"legend-text-"+s,y:o,className:"legend-group-label"},t.label)),o+=10),a.push(d.createElement("g",{key:"legend-group-"+s,className:"legend-item",transform:`translate(0,${o})`},((t,e)=>{const{type:n="fill",styleFn:o,items:a}=t,s=[];let i=0;return a.forEach((t,a)=>{const r=O(t,a,n,o);s.push(d.createElement("g",{key:"legend-item-"+a,transform:`translate(0,${i})`,onClick:e?()=>e(t):void 0,style:{cursor:e?"pointer":"default"}},r,d.createElement("text",{y:15,x:30},t.label))),i+=25}),s})(t,n))),o+=25*t.items.length+10}),a})({legendGroups:e,width:a,customClickBehavior:n}):(({legendGroups:t,title:e,height:n,customClickBehavior:o})=>{let a=0;const s=[],i=!1===e?10:40;return t.forEach((e,r)=>{e.label&&(s.push(d.createElement("text",{key:"legend-text-"+r,transform:`translate(${a},${i}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},e.label)),a+=20);const l=((t,e)=>{const{type:n="fill",styleFn:o,items:a}=t,s=[];let i=0;return a.forEach((t,a)=>{const r=O(t,a,n,o);s.push(d.createElement("g",{key:"legend-item-"+a,transform:`translate(${i},0)`,onClick:e?()=>e(t):void 0,style:{cursor:e?"pointer":"default"}},r,d.createElement("text",{y:15,x:25},t.label))),i+=35,i+=8*t.label.length}),{items:s,offset:i}})(e,o);s.push(d.createElement("g",{key:"legend-group-"+r,className:"legend-item",transform:`translate(${a},${i})`},l.items)),a+=l.offset+5,t[r+1]&&s.push(d.createElement("line",{key:"legend-top-line legend-symbol-"+r,stroke:"gray",x1:a,y1:i-10,x2:a,y2:n+i+10})),a+=15}),d.createElement("g",null,!1!==e&&d.createElement("line",{x1:0,x2:a+10,y1:i-10,y2:i-10,stroke:"gray",className:"title-neatline"}),s)})({legendGroups:e,title:o,height:s,customClickBehavior:n});return d.createElement("g",null,void 0!==o&&d.createElement("text",{className:"legend-title",y:20,x:"horizontal"===i?0:a/2,textAnchor:"horizontal"===i?"start":"middle"},o),r)}function D(t){return Math.round(100*t)/100+""}function C(e){const{width:n,height:o,totalWidth:a,totalHeight:s,margin:i,scales:r,showAxes:l,oLabel:c,rLabel:u,oFormat:h,rFormat:p,showGrid:f,title:m,legend:y,foregroundGraphics:g,annotations:x,svgAnnotationRules:v,annotationFrame:b,children:M}=e,E="radial"===(null==r?void 0:r.projection),k="horizontal"===(null==r?void 0:r.projection),w=t.useMemo(()=>l&&r&&!E?r.o.domain().map(t=>{var e;return{value:t,pixel:(null!==(e=r.o(t))&&void 0!==e?e:0)+r.o.bandwidth()/2,label:h?h(t):t}}):[],[l,r,h,E]),A=t.useMemo(()=>l&&r&&!E?r.r.ticks(5).map(t=>({value:t,pixel:r.r(t),label:(p||D)(t)})):[],[l,r,p,E]),S=t.useMemo(()=>x&&0!==x.length&&v?x.map((t,e)=>v(t,e,{scales:r?{time:r.r,value:r.r}:null,timeAxis:"x",width:n,height:o})).filter(Boolean):null,[x,v,n,o,b]);return l||m||y||g||S&&S.length>0||f||M?d.createElement("svg",{width:a,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},d.createElement("g",{transform:`translate(${i.left},${i.top})`},f&&r&&!E&&d.createElement("g",{className:"ordinal-grid"},A.map((t,e)=>d.createElement("line",{key:"grid-"+e,x1:k?t.pixel:0,y1:k?0:t.pixel,x2:k?t.pixel:n,y2:k?o:t.pixel,stroke:"#e0e0e0",strokeWidth:1}))),l&&r&&!E&&d.createElement("g",{className:"ordinal-axes"},k?d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"#ccc",strokeWidth:1}),w.map((t,e)=>d.createElement("g",{key:"cat-"+e,transform:`translate(0,${t.pixel})`},d.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),c&&d.createElement("text",{x:15-i.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-i.left}, ${o/2})`,style:{userSelect:"none"}},c),d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"#ccc",strokeWidth:1}),A.map((t,e)=>d.createElement("g",{key:"val-"+e,transform:`translate(${t.pixel},${o})`},d.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&d.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u)):d.createElement(d.Fragment,null,d.createElement("line",{x1:0,y1:o,x2:n,y2:o,stroke:"#ccc",strokeWidth:1}),w.map((t,e)=>d.createElement("g",{key:"cat-"+e,transform:`translate(${t.pixel},${o})`},d.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),d.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),c&&d.createElement("text",{x:n/2,y:o+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},c),d.createElement("line",{x1:0,y1:0,x2:0,y2:o,stroke:"#ccc",strokeWidth:1}),A.map((t,e)=>d.createElement("g",{key:"val-"+e,transform:`translate(0,${t.pixel})`},d.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),d.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&d.createElement("text",{x:15-i.left,y:o/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-i.left}, ${o/2})`,style:{userSelect:"none"}},u))),S,g,M),m&&d.createElement("text",{x:a/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof m?m:null),y&&d.createElement("g",{transform:`translate(${a-i.right+10}, ${i.top})`},"object"==typeof(P=y)&&null!==P&&!d.isValidElement(P)&&"legendGroups"in P?d.createElement(_,{legendGroups:y.legendGroups,title:"",width:100}):y)):null;var P}const N=(t,e,n,o)=>{const a=e.filter(t=>"rect"===t.type);for(const e of a)null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.icon?T(t,e):(t.fillStyle=e.style.fill||"#007bff",t.fillRect(e.x,e.y,e.w,e.h),e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.strokeRect(e.x,e.y,e.w,e.h))),e._pulseIntensity&&e._pulseIntensity>0&&(t.globalAlpha=.3*e._pulseIntensity,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h)),t.globalAlpha=1};function T(t,e){const n=e.style.icon,o=e.style.iconPadding||2,a=Math.min(e.w,e.w)-o;if(0>=a)return;const s=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),s){const s=a+o,i=e.x+(e.w-a)/2;for(let o=e.y+e.h-a;o>=e.y-a;o-=s)t.drawImage(n,i,o,a,a)}else{const s=a+o,i=e.y+(e.h-a)/2;for(let o=e.x;e.x+e.w>o;o+=s)t.drawImage(n,o,i,a,a)}t.restore()}const R=(t,e,n,o)=>{var a;const s=e.filter(t=>"point"===t.type);for(const e of s){t.beginPath(),t.arc(e.x,e.y,e.r,0,2*Math.PI);const n=null!==(a=e.style.opacity)&&void 0!==a?a:e.style.fillOpacity;if(null!=n&&(t.globalAlpha=n),t.fillStyle=e.style.fill||"#4e79a7",t.fill(),e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke()),e._pulseIntensity&&e._pulseIntensity>0){const n=4;t.beginPath(),t.arc(e.x,e.y,e.r+n*e._pulseIntensity,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=.5*e._pulseIntensity,t.stroke()}t.globalAlpha=1}},z=(t,e,n,o)=>{const a=e.filter(t=>"wedge"===t.type);for(const e of a)t.beginPath(),e.innerRadius>0?(t.arc(e.cx,e.cy,e.outerRadius,e.startAngle,e.endAngle),t.arc(e.cx,e.cy,e.innerRadius,e.endAngle,e.startAngle,!0)):(t.moveTo(e.cx,e.cy),t.arc(e.cx,e.cy,e.outerRadius,e.startAngle,e.endAngle)),t.closePath(),null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),null!=e.style.fillOpacity&&(t.globalAlpha=e.style.fillOpacity),t.fillStyle=e.style.fill||"#007bff",t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke()),t.globalAlpha=1},B=(t,e,n,o)=>{var a,s;const i=e.filter(t=>"violin"===t.type);for(const e of i){t.save(),(e.translateX||e.translateY)&&t.translate(e.translateX,e.translateY);const n=new Path2D(e.pathString);t.globalAlpha=null!==(s=null!==(a=e.style.fillOpacity)&&void 0!==a?a:e.style.opacity)&&void 0!==s?s:.6,t.fillStyle=e.style.fill||"#007bff",t.fill(n),t.globalAlpha=1,e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke(n)),e.iqrLine&&(t.strokeStyle="#333",t.lineWidth=2,t.globalAlpha=.8,t.beginPath(),t.moveTo(0,e.iqrLine.q1Pos),t.lineTo(0,e.iqrLine.q3Pos),t.stroke(),t.beginPath(),t.arc(0,e.iqrLine.medianPos,3,0,2*Math.PI),t.fillStyle="#fff",t.fill(),t.strokeStyle="#333",t.lineWidth=1,t.stroke(),t.globalAlpha=1),t.restore()}},L=(t,e,n,o)=>{var a,s,i;const r=e.filter(t=>"connector"===t.type);if(0===r.length)return;const l=new Map;for(const t of r){const e=t.group||"_default";l.has(e)||l.set(e,[]),l.get(e).push(t)}for(const[,e]of l){if(0===e.length)continue;const n=e[0].style;if(n.fill&&"none"!==n.fill){t.beginPath(),t.moveTo(e[0].x1,e[0].y1);for(const n of e)t.lineTo(n.x2,n.y2);t.closePath(),t.globalAlpha=null!==(s=null!==(a=n.fillOpacity)&&void 0!==a?a:n.opacity)&&void 0!==s?s:.3,t.fillStyle=n.fill,t.fill(),t.globalAlpha=1}for(const n of e)t.beginPath(),t.moveTo(n.x1,n.y1),t.lineTo(n.x2,n.y2),t.strokeStyle=n.style.stroke||n.style.fill||"#999",t.lineWidth=n.style.strokeWidth||1,t.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,t.stroke(),t.globalAlpha=1}},F=t=>[L,...t],I={bar:F([N]),clusterbar:F([N]),point:F([R]),swarm:F([R]),pie:[z],donut:[z],boxplot:F([(t,e,n,o)=>{var a,s;const i=e.filter(t=>"boxplot"===t.type);for(const e of i){const n=e.columnWidth/2,o="vertical"===e.projection,i=e.style.fill||"#007bff",r=e.style.stroke||"#333",l=e.style.strokeWidth||1,c=null!==(s=null!==(a=e.style.fillOpacity)&&void 0!==a?a:e.style.opacity)&&void 0!==s?s:.6;if(t.save(),t.strokeStyle=r,t.lineWidth=l,t.beginPath(),o?(t.moveTo(e.x,e.minPos),t.lineTo(e.x,e.maxPos)):(t.moveTo(e.minPos,e.y),t.lineTo(e.maxPos,e.y)),t.stroke(),t.beginPath(),o?(t.moveTo(e.x-.4*n,e.minPos),t.lineTo(e.x+.4*n,e.minPos),t.moveTo(e.x-.4*n,e.maxPos),t.lineTo(e.x+.4*n,e.maxPos)):(t.moveTo(e.minPos,e.y-.4*n),t.lineTo(e.minPos,e.y+.4*n),t.moveTo(e.maxPos,e.y-.4*n),t.lineTo(e.maxPos,e.y+.4*n)),t.stroke(),t.globalAlpha=c,t.fillStyle=i,o){const o=Math.min(e.q1Pos,e.q3Pos),a=Math.abs(e.q3Pos-e.q1Pos);t.fillRect(e.x-n,o,e.columnWidth,a),t.globalAlpha=1,t.strokeRect(e.x-n,o,e.columnWidth,a)}else{const o=Math.min(e.q1Pos,e.q3Pos),a=Math.abs(e.q3Pos-e.q1Pos);t.fillRect(o,e.y-n,a,e.columnWidth),t.globalAlpha=1,t.strokeRect(o,e.y-n,a,e.columnWidth)}t.strokeStyle="#fff",t.lineWidth=2,t.beginPath(),o?(t.moveTo(e.x-n,e.medianPos),t.lineTo(e.x+n,e.medianPos)):(t.moveTo(e.medianPos,e.y-n),t.lineTo(e.medianPos,e.y+n)),t.stroke(),t.restore()}},R]),violin:F([B]),histogram:F([N]),ridgeline:F([B]),timeline:F([N])},W={top:50,right:40,bottom:60,left:70},q={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function V({hover:t}){var e,n,o,a;const s=t.data||{};if(Array.isArray(s)){const t=(null===(e=s[0])||void 0===e?void 0:e.category)||"",n=s.length;return d.createElement("div",{className:"semiotic-tooltip",style:q},t&&d.createElement("div",{style:{fontWeight:"bold"}},t+""),d.createElement("div",null,n," items"))}if(null!=s.bin&&null!=s.count){const t=s.range||[];return d.createElement("div",{className:"semiotic-tooltip",style:q},s.category&&d.createElement("div",{style:{fontWeight:"bold"}},s.category+""),d.createElement("div",null,"Count: ",s.count),2===t.length&&d.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const i=s.category||s.name||s.group||s.__rName||"",r=null!==(a=null!==(o=null!==(n=s.value)&&void 0!==n?n:s.__rValue)&&void 0!==o?o:s.pct)&&void 0!==a?a:"";if(!i&&""===r){const t=Object.entries(s).filter(([t])=>!t.startsWith("_")&&"data"!==t);return d.createElement("div",{className:"semiotic-tooltip",style:q},t.map(([t,e])=>d.createElement("div",{key:t},d.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof e?e.toLocaleString():e+"")))}return d.createElement("div",{className:"semiotic-tooltip",style:q},i&&d.createElement("div",{style:{fontWeight:"bold"}},i+""),""!==r&&d.createElement("div",null,"number"==typeof r?r.toLocaleString():r+""))}const H=t.forwardRef(function(e,n){const{chartType:o,runtimeMode:a,data:s,oAccessor:i="category",rAccessor:r="value",colorAccessor:l,stackBy:c,groupBy:u,multiAxis:h,timeAccessor:p,valueAccessor:f,categoryAccessor:y,projection:g="vertical",size:x=[600,400],margin:v,barPadding:b,innerRadius:M,normalize:E,startAngle:$,dynamicColumnWidth:O,bins:_,showOutliers:D,showIQR:N,amplitude:T,connectorAccessor:R,connectorStyle:z,rExtent:B,oExtent:L,extentPadding:F=.05,oSort:q,windowMode:H="sliding",windowSize:G=200,pieceStyle:X,summaryStyle:Y,colorScheme:K,barColors:Q,showAxes:Z=!0,oLabel:J,rLabel:U,oFormat:tt,rFormat:et,enableHover:nt=!0,hoverAnnotation:ot,tooltipContent:at,customHoverBehavior:st,annotations:it,svgAnnotationRules:rt,showGrid:lt=!1,legend:ct,backgroundGraphics:ut,foregroundGraphics:dt,title:ht,className:pt,background:ft,centerContent:mt,decay:yt,pulse:gt,transition:xt,staleness:vt}=e,bt=t.useMemo(()=>Object.assign(Object.assign({},W),v),[v]),Mt=x[0]-bt.left-bt.right,Et=x[1]-bt.top-bt.bottom,kt=t.useRef(null),wt=t.useRef(!0),At=t.useRef(0),St=t.useRef(null),Pt=t.useRef(()=>{}),[jt,$t]=t.useState(null),[Ot,_t]=t.useState(null),[Dt,Ct]=t.useState(0),[Nt,Tt]=t.useState(!1),Rt=nt||ot,zt="streaming"===a,Bt=t.useMemo(()=>({chartType:o,runtimeMode:zt?"streaming":"bounded",windowSize:G,windowMode:H,extentPadding:F,projection:g,oAccessor:zt?void 0:i,rAccessor:zt?void 0:r,colorAccessor:l,stackBy:c,groupBy:u,multiAxis:h,timeAccessor:zt?p:void 0,valueAccessor:zt?f||("string"==typeof r||"function"==typeof r?r:void 0):void 0,categoryAccessor:zt?y||i:void 0,rExtent:B,oExtent:L,barPadding:b,innerRadius:M,normalize:E,startAngle:$,dynamicColumnWidth:O,bins:_,showOutliers:D,showIQR:N,amplitude:T,connectorAccessor:R,connectorStyle:z,oSort:q,pieceStyle:X,summaryStyle:Y,colorScheme:K,barColors:Q,decay:yt,pulse:gt,transition:xt,staleness:vt}),[o,G,H,F,g,i,r,l,c,u,h,p,f,y,B,L,b,M,E,$,O,_,D,N,T,R,z,q,X,Y,K,Q,yt,gt,xt,vt,zt]),Lt=t.useRef(null);Lt.current||(Lt.current=new k(Bt));const Ft=t.useCallback(()=>{At.current||(At.current=requestAnimationFrame(()=>Pt.current()))},[]);t.useEffect(()=>{var t;null===(t=Lt.current)||void 0===t||t.updateConfig(Bt),wt.current=!0,Ft()},[Bt,Ft]);const It=t.useRef(null);It.current||(It.current=new m(t=>{const e=Lt.current;e&&e.ingest(t)&&(wt.current=!0,Ft())}));const Wt=t.useCallback(t=>{var e;null===(e=It.current)||void 0===e||e.push(t)},[]),qt=t.useCallback(t=>{var e;null===(e=It.current)||void 0===e||e.pushMany(t)},[]),Vt=t.useCallback(()=>{var t,e;null===(t=It.current)||void 0===t||t.clear(),null===(e=Lt.current)||void 0===e||e.clear(),wt.current=!0,Ft()},[Ft]);t.useImperativeHandle(n,()=>({push:Wt,pushMany:qt,clear:Vt,getData:()=>{var t,e;return null!==(e=null===(t=Lt.current)||void 0===t?void 0:t.getData())&&void 0!==e?e:[]},getScales:()=>{var t,e;return null!==(e=null===(t=Lt.current)||void 0===t?void 0:t.scales)&&void 0!==e?e:null}}),[Wt,qt,Vt]),t.useEffect(()=>{var t;s&&(null===(t=It.current)||void 0===t||t.setBoundedData(s))},[s]);const Ht=t.useRef(()=>{}),Gt=t.useRef(()=>{});Ht.current=t=>{if(!Rt)return;const e=kt.current;if(!e)return;const n=e.getBoundingClientRect(),o=t.clientX-n.left-bt.left,a=t.clientY-n.top-bt.top;if(0>o||o>Mt||0>a||a>Et)return void(St.current&&(St.current=null,$t(null),st&&st(null),Ft()));const s=Lt.current;if(!s||0===s.scene.length)return;const i="radial"===g,r=function(t,e,n,o=30){let a=null;for(const s of t){let t=null;switch(s.type){case"rect":t=w(s,e,n);break;case"point":t=A(s,e,n);break;case"wedge":t=S(s,e,n);break;case"boxplot":t=P(s,e,n);break;case"violin":t=j(s,e,n)}t&&o>t.distance&&(a&&t.distance>=a.distance||(a=t))}return a}(s.scene,i?o-Mt/2:o,i?a-Et/2:a);if(!r)return void(St.current&&(St.current=null,$t(null),st&&st(null),Ft()));const l={data:r.datum,time:r.x,value:r.y,x:r.x,y:r.y};St.current=l,$t(l),st&&st(l),Ft()},Gt.current=()=>{St.current&&(St.current=null,$t(null),st&&st(null),Ft())};const Xt=t.useCallback(t=>Ht.current(t),[]),Yt=t.useCallback(()=>Gt.current(),[]);Pt.current=()=>{var t,e;At.current=0;const n=kt.current;if(!n)return;const a=n.getContext("2d");if(!a)return;const s=Lt.current;if(!s)return;const i="undefined"!=typeof performance?performance.now():Date.now(),r=s.advanceTransition(i),l=wt.current;l&&!r&&(s.computeScene({width:Mt,height:Et}),wt.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=x[0]*c,n.height=x[1]*c,n.style.width=x[0]+"px",n.style.height=x[1]+"px",a.scale(c,c),a.clearRect(0,0,x[0],x[1]);const u=null!==(t=null==vt?void 0:vt.threshold)&&void 0!==t?t:5e3,d=vt&&s.lastIngestTime>0&&i-s.lastIngestTime>u;d&&(a.globalAlpha=null!==(e=null==vt?void 0:vt.dimOpacity)&&void 0!==e?e:.5),ft&&(a.fillStyle=ft,a.fillRect(0,0,x[0],x[1]));const h="radial"===g;h?(a.save(),a.translate(bt.left+Mt/2,bt.top+Et/2)):a.translate(bt.left,bt.top);const p=I[o]||[],f={width:Mt,height:Et};for(const t of p)t(a,s.scene,s.scales,f);h&&a.restore(),d&&(a.globalAlpha=1),l&&s.scales&&(_t(s.scales),Ct(t=>t+1)),(null==vt?void 0:vt.showBadge)&&Tt(!!d),(r||s.hasActivePulses)&&(At.current=requestAnimationFrame(()=>Pt.current()))},t.useEffect(()=>(Ft(),()=>{At.current&&cancelAnimationFrame(At.current)}),[Ft]),t.useEffect(()=>{wt.current=!0,Ft()},[o,Mt,Et,Z,ft,Ft]),t.useEffect(()=>{if(!vt)return;const t=setInterval(()=>{var t;const e=Lt.current;if(!e||0===e.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(t=vt.threshold)&&void 0!==t?t:5e3,a=n-e.lastIngestTime>o;a!==Nt&&(Tt(a),wt.current=!0,Ft())},1e3);return()=>clearInterval(t)},[vt,Nt,Ft]);const Kt=Rt&&jt?at?at(jt):d.createElement(V,{hover:jt}):null,Qt="radial"===g,Zt=jt?Qt?jt.x+Mt/2:jt.x:0,Jt=jt?Qt?jt.y+Et/2:jt.y:0,Ut=Kt?d.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:bt.left+Zt,top:bt.top+Jt,transform:`translate(${Zt>.7*Mt?"calc(-100% - 12px)":"12px"}, ${.3*Et>Jt?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Kt):null;return d.createElement("div",{className:"stream-ordinal-frame"+(pt?" "+pt:""),style:{position:"relative",width:x[0],height:x[1]},onMouseMove:Rt?Xt:void 0,onMouseLeave:Rt?Yt:void 0},ut&&d.createElement("svg",{style:{position:"absolute",top:0,left:0,width:x[0],height:x[1],pointerEvents:"none"}},d.createElement("g",{transform:`translate(${bt.left},${bt.top})`},ut)),d.createElement("canvas",{ref:kt,style:{position:"absolute",top:0,left:0,width:x[0],height:x[1]}}),d.createElement(C,{width:Mt,height:Et,totalWidth:x[0],totalHeight:x[1],margin:bt,scales:Ot,showAxes:Z,oLabel:J,rLabel:U,oFormat:tt,rFormat:et,showGrid:lt,title:ht,legend:ct,foregroundGraphics:dt,annotations:it,svgAnnotationRules:rt,annotationFrame:Dt}),mt&&"radial"===g&&d.createElement("div",{style:{position:"absolute",left:bt.left+Mt/2,top:bt.top+Et/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},mt),(null==vt?void 0:vt.showBadge)&&d.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===vt.badgePosition?{top:4,left:4}:"bottom-left"===vt.badgePosition?{bottom:4,left:4}:"bottom-right"===vt.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Nt?"#dc3545":"#28a745",color:"white"})},Nt?"STALE":"LIVE"),Ut)});H.displayName="StreamOrdinalFrame";const G=({xy:t,orient:e,i:n,className:o="",jaggedBase:a})=>{let s=`M${t.x1},${t.y1}L${t.x2},${t.y2}`;return a&&0===n&&(s=((t,e)=>{let n="";const{x1:o,x2:a,y1:s,y2:i}=e;if("left"===t||"right"===t){const e=Math.abs(a-o);n=((t,e,n,o)=>{const a=t/e;let s=0,i="M0,"+n;const r="right"===o?-1:1;for(;t>=s;)i+=`L${s},${n}`,t>s&&(i+=`L${s+a/2},${n+10*r}`),s+=a;return i})(e,Math.ceil(e/40),"right"===t?0:s,t)}else{const e=Math.abs(i-s);n=((t,e,n,o)=>{const a=t/e;let s=0,i=`M${n},0`;const r="bottom"===o?-1:1;for(;t>=s;)i+=`L${n},${s}`,t>s&&(i+=`L${n+10*r},${s+a/2}`),s+=a;return i})(e,Math.ceil(e/40),o,t)}return n})(e,t)),d.createElement("path",{key:n,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:s,className:`tick-line tick ${e} ${o}`})};function X(t,e,n){const o=Math.abs(n.range()[1]-n.range()[0]);return t||(e||(e=Math.max(1,Math.floor(o/40))),t=n.ticks&&n.ticks(e)||n.domain()),t}function Y({t:t,o:e,w:n}){return"contour"!==t&&"boxplot"!==t||"left"!==e&&"right"!==e?0:n/2}function K({t:t,o:e,w:n}){return"contour"!==t&&"boxplot"!==t||"top"!==e&&"bottom"!==e?0:n/2}function Q(t){const{translation:e,orient:n,decoratedSummaryType:o,summaryWidth:a,renderedSummary:s,points:i}=t;return d.default.createElement("g",{className:"marginal-graphics",transform:`translate(${e[n]})`},d.default.createElement("g",{transform:`translate(${Y({t:o.type,o:n,w:a})},${K({t:o.type,o:n,w:a})})`},s),i)}function Z(t){const{className:e,translation:n,position:o,rotation:a,labelName:s,anchorMod:i}=t;return d.default.createElement("g",{className:"axis-title "+e,transform:`translate(${[n[0]+o[0],n[1]+o[1]]}) rotate(${a})`},d.default.isValidElement(s)?s:d.default.createElement("text",{textAnchor:i},s))}function J(t){if(null==t)return"";if("number"!=typeof t)return t+"";if(!isFinite(t))return t+"";if(0===t)return"0";const e=parseFloat(t.toPrecision(12)),n=Math.abs(e);return 1e9>n?1e6>n?1e4>n?Number.isInteger(e)?e+"":parseFloat(e.toPrecision(6))+"":parseFloat((e/1e3).toPrecision(3))+"K":parseFloat((e/1e6).toPrecision(3))+"M":parseFloat((e/1e9).toPrecision(3))+"B"}function U(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&0>e.indexOf(o)&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(t);o.length>a;a++)0>e.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(t,o[a])&&(n[o[a]]=t[o[a]])}return n}"function"==typeof SuppressedError&&SuppressedError;function tt(t,e=120,n=8){if(!t)return[];const o=Math.max(1,Math.floor(e/n)),a=t.split(/\s+/),s=[];let i="";for(const t of a)i&&i.length+1+t.length>o?(s.push(i),i=t):i=i?`${i} ${t}`:t;return i&&s.push(i),s}function et(t,e,n,o){return"curly"===t?o?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:o?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function nt(t){const{x:e=0,y:n=0,dx:o,dy:a,nx:s,ny:i,note:r,connector:l,subject:c,type:u,color:h,className:p,disable:f,events:m={},"data-testid":y}=t,g=new Set(Array.isArray(f)?f:[]);let x=o||0,v=a||0;null!=s&&(x=s-e),null!=i&&(v=i-n);const b="string"==typeof u?u:"label";if("bracket"===b&&c&&0===x&&0===v)if(void 0!==c.width){x=c.width/2;const t=c.depth||30;v=t+(0>t?-5:5)}else if(void 0!==c.height){const t=c.depth||30;x=t+(0>t?-5:5),v=c.height/2}return d.createElement("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${e},${n})`,"data-testid":y},m),!g.has("connector")&&function(t,e,n,o,a,s){const i=[];let r=0,l=0;if("callout-circle"!==a&&"label"!==a||!(null==s?void 0:s.radius)){if("callout-rect"===a&&s){const n=s.width||0,o=s.height||0;if(n>0||o>0){const a=n/2,s=o/2,i=t-a,c=e-s;if(0!==i||0!==c){const t=Math.abs(i),e=Math.abs(c),u=n/2,d=o/2,h=t*d>e*u?u/t:d/e;r=a+i*h,l=s+c*h}}}else if("bracket"===a&&s){const t=s.width,e=s.height,n=s.depth||30;void 0!==t?(r=t/2,l=n):void 0!==e&&(r=n,l=e/2)}}else{const n=(s.radius||0)+(s.radiusPadding||0);if(n>0&&(0!==t||0!==e)){const o=Math.atan2(e,t);r=Math.cos(o)*n,l=Math.sin(o)*n}}if(Math.sqrt(Math.pow(t-r,2)+Math.pow(e-l,2))>.5&&(i.push(d.createElement("line",{key:"connector-line",x1:r,y1:l,x2:t,y2:e,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,a=16/180*Math.PI,s=Math.atan2(e-l,t-r);i.push(d.createElement("path",{key:"connector-arrow",d:`M${r},${l}L${r+n*Math.cos(s+a)},${l+n*Math.sin(s+a)}L${r+n*Math.cos(s-a)},${l+n*Math.sin(s-a)}Z`,fill:o||"currentColor",stroke:"none"}))}return d.createElement("g",{className:"annotation-connector"},i)}(x,v,l,h,b,c),!g.has("subject")&&function(t,e,n,o,a){var s;const i=[];switch(t){case"callout-circle":{const t=((null==e?void 0:e.radius)||0)+((null==e?void 0:e.radiusPadding)||0);t>0&&i.push(d.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const t=(null==e?void 0:e.width)||0,o=(null==e?void 0:e.height)||0;(t>0||o>0)&&i.push(d.createElement("rect",{key:"subject-rect",width:t,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==e?void 0:e.custom)&&i.push(...Array.isArray(e.custom)?e.custom:[e.custom]);break;case"xy-threshold":{const t=o||0,s=a||0;if(void 0!==(null==e?void 0:e.x)){const o=(e.x||0)-t;i.push(d.createElement("line",{key:"threshold-line",x1:o,y1:(e.y1||0)-s,x2:o,y2:(e.y2||0)-s,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==e?void 0:e.y)){const o=(e.y||0)-s;i.push(d.createElement("line",{key:"threshold-line",x1:(e.x1||0)-t,y1:o,x2:(e.x2||0)-t,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==e?void 0:e.x1)||void 0!==(null==e?void 0:e.x2)?i.push(d.createElement("line",{key:"threshold-line",x1:(e.x1||0)-t,y1:0,x2:(e.x2||0)-t,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==e?void 0:e.y1)&&void 0===(null==e?void 0:e.y2)||i.push(d.createElement("line",{key:"threshold-line",x1:0,y1:(e.y1||0)-s,x2:0,y2:(e.y2||0)-s,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(s=null==e?void 0:e.width)&&void 0!==s?s:null==e?void 0:e.height;void 0!==t&&i.push(d.createElement("path",{key:"bracket-path",d:et((null==e?void 0:e.type)||"curly",t,(null==e?void 0:e.depth)||30,void 0===(null==e?void 0:e.width)),fill:"none",stroke:n||"currentColor"}));break}}return d.createElement("g",{className:"annotation-subject"},i)}(b,c,h,e,n),!g.has("note")&&function(t,e,n,o){if(!t)return d.createElement("g",{className:"annotation-note"});const{label:a,title:s,orientation:i,align:r,wrap:l=120,noWrap:c}=t;if(!a&&!s)return d.createElement("g",{className:"annotation-note"});let u=i;u||(u=Math.abs(e)>Math.abs(n)?"leftRight":"topBottom");let h=r;h&&"dynamic"!==h||(h="topBottom"===u?0>e?"right":"left":0>n?"bottom":"top");let p="start";"topBottom"===u?"right"===h?p="end":"middle"===h&&(p="middle"):p=0>e?"end":"start";const f=16,m=s?c?[s]:tt(s,l):[],y=a?c?[a]:tt(a,l):[],g="leftRight"===u?"end"===p?-4:4:0;let x=0;const v=[];m.length>0&&(v.push(d.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:p,fontWeight:"bold"},m.map((t,e)=>d.createElement("tspan",{key:e,x:g,dy:0===e?0:f},t)))),x=m.length*f),y.length>0&&v.push(d.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:p,y:x},y.map((t,e)=>d.createElement("tspan",{key:e,x:g,dy:f},t))));let b=null;if((s||a)&&(0!==e||0!==n))if("topBottom"===u){const t=Math.min(l,120);let e=0,n=t;"end"===p?(e=-t,n=0):"middle"===p&&(e=-t/2,n=t/2),b=d.createElement("line",{className:"note-line",x1:e,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const t=(m.length+y.length)*f+(y.length>0?f:0);let e=0,n=t;"bottom"===h?(e=-t,n=0):"middle"===h&&(e=-t/2,n=t/2),b=d.createElement("line",{className:"note-line",x1:0,x2:0,y1:e,y2:n,stroke:o||"currentColor"})}const M=(m.length+y.length)*f+(y.length>0?f:0);let E=0;return"topBottom"===u?0>n&&(E=-M):"leftRight"===u&&("middle"===h?E=-M/2:("bottom"===h||0>n)&&(E=-M)),d.createElement("g",{className:"annotation-note",transform:`translate(${e},${n})`},d.createElement("g",{className:"annotation-note-content",transform:0!==E?`translate(0,${E})`:void 0},v),b)}(r,x,v,h))}function ot(t){const{noteData:e}=t,{screenCoordinates:n}=e,o="string"==typeof e.type?e.type:"label",a=e.eventListeners||e.events||{};if(e.coordinates&&n){const t=e.nx||n[0][0]+e.dx,a=e.ny||n[0][1]+e.dy,s=n.map((n,s)=>{const i=Object.assign({},e,{note:0===s?e.note:{label:""},x:n[0],y:n[1],nx:t,ny:a});return d.createElement(nt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+s},i,{type:o}))});return d.createElement("g",null,s)}const s=e.note||{title:"none",label:e.label};return d.createElement(nt,Object.assign({"data-testid":"semiotic-annotation",key:`${s.label}-${s.title}-${e.i}`,events:a},e,{type:o}))}const at=(t,e,n,o)=>{const a=(t.note.label||t.note.title).length;return[Math.min(t.note.wrap||120,a*e)+2*o,Math.ceil(a*e/120)*n+2*o]};function st(e){let n=t.createContext(null),o=it(e);return[function({children:o}){let a=t.useMemo(()=>it(e),[]);return d.createElement(n.Provider,{value:a,children:o})},e=>{var a;let s=null!==(a=t.useContext(n))&&void 0!==a?a:o;return function(e,n){const[o,a]=t.useState(n);return t.useLayoutEffect(()=>e(()=>a(n)),[e]),o}(s.subscribe,()=>e(s.getState()))}]}function it(t){let e=new EventTarget,n=t(function(t){n=Object.assign(n,t(n)),e.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(t){return e.addEventListener("update",t),()=>e.removeEventListener("update",t)}}}let[rt,lt]=st(t=>({tooltip:null,changeTooltip(e){t(()=>({tooltip:e}))}}));function ct(t,e,n){return"number"==typeof n?n:e&&e.find(e=>e.props.orient===t)?50:10}const ut=(t,e,n)=>`${t.map(dt).join(",")}${JSON.stringify(e)}${n.join(",")}`;function dt(t){if(!t||!t.props||!t.props.noteData)return"";const{note:e={}}=t.props.noteData,{label:n,title:o}=e;return`${t.props.noteData.id||`${t.props.noteData.x}-${t.props.noteData.y}`}-${n}=${o}`}function ht(t,e=8,n){const{noteWidth:o=n}=t;let a=o;"number"==typeof o&&(a=()=>o);const s=t.note&&t.note.wrap||120,i=t.note.label||t.note.label||"";return o&&a(t)||(d.default.isValidElement(t.note)?100:Math.min(s,i.length*e))}function pt(t,e=8,n=20,o){const{noteHeight:a=o}=t;let s=a;"number"==typeof a&&(s=()=>a);const i=t.note&&t.note.wrap||120,r=t.note.label||t.note.title||"";return a&&s(t)||(d.default.isValidElement(t.note)?30:Math.ceil(r.length*e/i)*n+(t.note.label&&t.note.title?n:0))}const ft=(t,e)=>e.map((e,n)=>t.svgAnnotationRule(e,n,t)).filter(t=>null!=t),mt=(t,e)=>{let n=e.adjustedAnnotations,o=e.adjustedAnnotationsKey,a=e.adjustableAnnotations,s=e.fixedAnnotations,i=[],r=[];const l=e.adjustedAnnotationsKey,c=e.adjustedAnnotationsDataVersion,{annotations:u,annotationHandling:p=!1,size:f,svgAnnotationRule:m,htmlAnnotationRule:y}=t,g="object"==typeof p?p:{layout:{type:p},dataVersion:""},{dataVersion:x=""}=g;if(m){const e=ft(t,u);o=ut(e,g,f),!1===p&&(n=a),n=n.length!==a.length||l!==o||c!==x?((t,e,n)=>{const{layout:o={type:!1,noteHeight:void 0,noteWidth:void 0}}=e;if(!1===o.type)return t;const{noteWidth:a,noteHeight:s}=o;let{margin:i={top:0,bottom:0,left:0,right:0}}=n;const{size:r,axes:l=[]}=n;if(i="number"==typeof i?{top:i,left:i,right:i,bottom:i}:i,"bump"===o.type)return function(t,e,n,o,a){const{padding:s=1,characterWidth:i=8,lineHeight:r=20,iterations:l=500,pointSizeFunction:c=o,labelSizeFunction:u=a||at}=e,d=t.map((t,e)=>{const n=(t.props.noteData.x[0]||t.props.noteData.x)+(void 0!==t.props.noteData.dx?t.props.noteData.dx:-10*(e%3-1)),o=(t.props.noteData.y[0]||t.props.noteData.y)+(void 0!==t.props.noteData.dy?t.props.noteData.dy:10*(e%3-1)),[a,l]=u(t.props.noteData,i,r,s);return{x:n,y:o,above:t.props.noteData.y>o,left:t.props.noteData.x>n,width:a,height:l,type:"label",name:"",originalNote:t}}),h=t.map(t=>({x:t.props.noteData.x,y:t.props.noteData.y,fx:t.props.noteData.x,fy:t.props.noteData.y,r:c&&c(t.props.noteData)||5,type:"point",originalNote:t})),p=function(){let t,e=[],n=[],o=1,a=1,s={start:t=>{},width:t=>{},height:t=>{},label:t=>{},anchor:t=>{},alt_energy:t=>{},alt_schedule:t=>{}},i=!1;const r=function(t){let o=e.length,a=0,s=e[t].x-n[t].x,i=n[t].y-e[t].y,r=Math.sqrt(s*s+i*i);r>0&&(a+=.2*r),s/=r,i/=r,a+=s>0&&i>0?0:0>s&&i>0?3:0>s&&0>i?6:9;let l,c,d,h,p,f,m,y=e[t].x,g=e[t].y-e[t].height+2,x=e[t].x+e[t].width,v=e[t].y+2;for(let s=0;o>s;s++)s!==t&&(u(n[t].x,e[t].x,n[s].x,e[s].x,n[t].y,e[t].y,n[s].y,e[s].y)&&(a+=1),l=e[s].x,d=e[s].y-e[s].height+2,c=e[s].x+e[s].width,h=e[s].y+2,p=Math.max(0,Math.min(c,x)-Math.max(l,y)),f=Math.max(0,Math.min(h,v)-Math.max(d,g)),m=p*f,a+=30*m),l=n[s].x-n[s].r,d=n[s].y-n[s].r,c=n[s].x+n[s].r,h=n[s].y+n[s].r,p=Math.max(0,Math.min(c,x)-Math.max(l,y)),f=Math.max(0,Math.min(h,v)-Math.max(d,g)),m=p*f,a+=30*m;return a},l=function(s){let l,c,u=Math.floor(Math.random()*e.length),d=e[u].x,h=e[u].y;l=i?t(u,e,n):r(u),e[u].x+=5*(Math.random()-.5),e[u].y+=5*(Math.random()-.5),e[u].x>o&&(e[u].x=d),0>e[u].x&&(e[u].x=d),e[u].y>a&&(e[u].y=h),0>e[u].y&&(e[u].y=h),c=i?t(u,e,n):r(u);let p=c-l;Math.random()<Math.exp(-p/s)||(e[u].x=d,e[u].y=h)},c=function(s){let l,c=Math.floor(Math.random()*e.length),u=e[c].x,d=e[c].y;l=i?t(c,e,n):r(c);let h=.5*(Math.random()-.5),p=Math.sin(h),f=Math.cos(h);e[c].x-=n[c].x,e[c].y-=n[c].y;let m,y=e[c].x*p+e[c].y*f;e[c].x=e[c].x*f-e[c].y*p+n[c].x,e[c].y=y+n[c].y,e[c].x>o&&(e[c].x=u),0>e[c].x&&(e[c].x=u),e[c].y>a&&(e[c].y=d),0>e[c].y&&(e[c].y=d),m=i?t(c,e,n):r(c);let g=m-l;Math.random()<Math.exp(-g/s)||(e[c].x=u,e[c].y=d)},u=function(t,e,n,o,a,s,i,r){let l,c,u,d,h;return u=(r-i)*(e-t)-(o-n)*(s-a),d=(o-n)*(a-i)-(r-i)*(t-n),h=(e-t)*(a-i)-(s-a)*(t-n),l=d/u,c=h/u,!(0>l||l>1||0>c||c>1)},d=function(t,e,n){return t-e/n};return s.start=function(t){let n=e.length,o=1;for(let e=0;t>e;e++){for(let t=0;n>t;t++).5>Math.random()?l(o):c(o);o=d(o,1,t)}},s.width=function(t){return arguments.length?(o=t,s):o},s.height=function(t){return arguments.length?(a=t,s):a},s.label=function(t){return arguments.length?(e=t,s):e},s.anchor=function(t){return arguments.length?(n=t,s):n},s.alt_energy=function(e){return arguments.length?(t=e,i=!0,s):r},s.alt_schedule=function(t){return arguments.length?s:d},s}();return p.label(d),p.anchor(h),p.width(n[0]),p.height(n[1]),p.start(l),d.forEach(t=>{if("label"===t.type){const e=function(t,e,n){return t.y>e.y?[e.x+e.width/2+n/2,e.y-e.height+n/2]:[e.x+e.width/2,e.y]}(t.originalNote.props.noteData,t,s);t.originalNote.props.noteData.nx=e[0],t.originalNote.props.noteData.ny=e[1]}}),t}(t,o,r,n.pointSizeFunction,n.labelSizeFunction);if("marginalia"===o.type){const{marginOffset:e,orient:n="nearest",characterWidth:c=8,lineHeight:u=20,padding:p=2,axisMarginOverride:f={}}=o,m="nearest"===n?["left","right","top","bottom"]:Array.isArray(n)?n:[n],y=m.find(t=>"left"===t),g=m.find(t=>"right"===t),x=m.find(t=>"top"===t),v=m.find(t=>"bottom"===t),b=[],M=[],E=[],k=[];for(const e of t){const t=e.props.noteData,n=t.x[0]||t.x,o=t.y[0]||t.y,a=y?n:1/0,s=g?r[0]-n:1/0,i=x?o:1/0,l=Math.min(a,s,i,v?r[1]-o:1/0);a===l?b.push(e):s===l?M.push(e):i===l?E.push(e):k.push(e)}const w=new h.default.Force({minPos:void 0!==f.top?0+f.top:0-i.top,maxPos:void 0!==f.bottom?r[1]-f.bottom:v?r[1]:r[1]+i.bottom}).nodes(b.map(t=>new h.default.Node(t.props.noteData.y[0]||t.props.noteData.y,pt(t.props.noteData,c,u,a)+p))).compute(),A=new h.default.Force({minPos:void 0!==f.top?0+f.top:x?0:0-i.top,maxPos:void 0!==f.bottom?r[1]-f.bottom:r[1]+i.bottom}).nodes(M.map(t=>new h.default.Node(t.props.noteData.y[0]||t.props.noteData.y,pt(t.props.noteData,c,u,a)+p))).compute(),S=new h.default.Force({minPos:void 0!==f.left?0+f.left:y?0:0-i.left,maxPos:void 0!==f.right?r[0]-f.right:r[0]+i.right}).nodes(E.map(t=>new h.default.Node(t.props.noteData.x[0]||t.props.noteData.x,ht(t.props.noteData,c,s)+p))).compute(),P=new h.default.Force({minPos:void 0!==f.left?0+f.left:0-i.left,maxPos:void 0!==f.right?r[0]-f.right:g?r[0]:r[0]+i.right}).nodes(k.map(t=>new h.default.Node(t.props.noteData.x[0]||t.props.noteData.x,ht(t.props.noteData,c,s)+p))).compute(),j=Math.max(...k.map(t=>pt(t.props.noteData,c,u,a)+p)),$=Math.max(...E.map(t=>pt(t.props.noteData,c,u,a)+p)),O=Math.max(...b.map(t=>ht(t.props.noteData,c,s)+p)),_=Math.max(...M.map(t=>ht(t.props.noteData,c,s)+p)),D=w.nodes(),C=A.nodes(),N=S.nodes(),T=P.nodes();return b.forEach((t,n)=>{const o=0-D[n].layerIndex*O-ct("left",l,e),a=D[n].currentPos;t.props.noteData.nx=o,t.props.noteData.ny=a,t.props.noteData.note&&!d.isValidElement(t)&&(t.props.noteData.note.orientation=t.props.noteData.note.orientation||"leftRight",t.props.noteData.note.align=t.props.noteData.note.align||"right")}),M.forEach((t,n)=>{const o=r[0]+C[n].layerIndex*_+ct("right",l,e),a=C[n].currentPos;t.props.noteData.nx=o,t.props.noteData.ny=a,t.props.noteData.note&&!d.isValidElement(t)&&(t.props.noteData.note.orientation=t.props.noteData.note.orientation||"leftRight",t.props.noteData.note.align=t.props.noteData.note.align||"left")}),E.forEach((t,n)=>{const o=N[n].currentPos,a=0-N[n].layerIndex*$-ct("top",l,e);t.props.noteData.nx=o,t.props.noteData.ny=a}),k.forEach((t,n)=>{const o=T[n].currentPos,a=r[1]+T[n].layerIndex*j+ct("bottom",l,e);t.props.noteData.nx=o,t.props.noteData.ny=a}),t}return t})(a,g,t):a.map((t,e)=>{const o=Object.assign(Object.assign({},n[e].props.noteData),t.props.noteData);return d.createElement(ot,{key:t.key,noteData:o})}),i=[...n,...s]}return y&&(r=((t,e)=>e.map((e,n)=>t.htmlAnnotationRule(e,n,t)).filter(t=>null!=t))(t,u)),{svgAnnotations:i,htmlAnnotations:r,adjustedAnnotations:n,adjustedAnnotationsKey:o,adjustedAnnotationsDataVersion:x}},yt=t=>t instanceof Date?t.getTime():t,gt=({type:t="stackedarea",data:e,xProp:o,yProp:a,yPropMiddle:s,sort:i,yPropTop:r,yPropBottom:l})=>{const c=new Map,u=e.map(()=>0);let d=0;for(const t of e){t.__lineIndex=d;for(const e of t.data){const t=yt(e[o]);u[d]+=e[a],c.has(t)||c.set(t,[]),c.get(t)[d]=e}d++}let h=(t,e)=>u[e.key]-u[t.key];"stackedpercent-invert"!==t&&"stackedarea-invert"!==t||(h=(t,e)=>u[t.key]-u[e.key]),null!==(i=void 0===i?h:i)&&(e=e.sort(i));const p=e.map(t=>t.__lineIndex);for(const[,e]of c){let o=0,i=0;const c=n.sum(e,t=>(null==t?void 0:t[a])>0?t[a]:0),u=n.sum(e,t=>0>(null==t?void 0:t[a])?t[a]:0);for(const n of p){const d=e[n];if(d)if(0>d[a]){if("linepercent"===t||"stackedpercent"===t||"stackedpercent-invert"===t){const e=d[a]/u;if(d.percent=e,"linepercent"===t)d[l]=d[l]=d[r]=d[s]=e;else{const t=0>u?e:0;d[l]=0===u?0:-o/u,d[r]=d[l]-t,d[s]=d[l]-t/2}}else d[l]=o,d[r]=o+d[a],d[s]=o+d[a]/2;o+=d[a]}else{if("linepercent"===t||"stackedpercent"===t||"stackedpercent-invert"===t){const e=d[a]/c;if(d.percent=e,"linepercent"===t)d[l]=d[r]=d[s]=e;else{const t=c>0?e:0;d[l]=0===c?0:i/c,d[r]=d[l]+t,d[s]=d[l]+t/2}}else d[l]=i,d[r]=i+d[a],d[s]=i+d[a]/2;i+=d[a]}}}return e},xt=({data:t,y1:e,x1:n,yPropTop:o,yPropMiddle:a,yPropBottom:s,xPropTop:i,xPropMiddle:r,xPropBottom:l})=>{if(e)for(const n of t)for(const t of n.data)t[s]=e(t),t[a]=t[o];if(n)for(const e of t)for(const t of e.data)t[l]=n(t),t[r]=(t[l]+t[i])/2;return t},vt=({data:t,y1:e,yPropTop:n,yPropMiddle:o,yPropBottom:a,type:s="cumulative"})=>{for(const i of t){let t=0;const r="cumulative-reverse"===s?i.data.reverse():i.data;for(const s of r)t+=s[n],s[a]=s[n]=s[o]=t,e&&(s[a]=e(s),s[o]=s[a]+s[n]/2)}return t},bt=({type:t="bumpline",data:e,xProp:n,yProp:o,yPropMiddle:a,yPropTop:s,yPropBottom:i})=>{const r=new Map;for(const t of e)for(const e of t.data){const t=yt(e[n]);r.has(t)||r.set(t,[]),r.get(t).push(e)}let l=(t,e)=>t[o]>e[o]?1:-1;"bumparea-invert"!==t&&"bumpline-invert"!==t||(l=(t,e)=>e[o]>t[o]?1:-1);for(const[,e]of r){let n=0,r=0;e.sort(l);let c=1;for(const l of e)"bumparea"===t||"bumparea-invert"===t?0>l[o]?(l[s]=n+l[o],l[a]=n+l[o]/2,l[i]=n,n+=l[o]):(l[s]=r+l[o],l[a]=r+l[o]/2,l[i]=r,r+=l[o]):(l[o]=c,l[s]=c,l[i]=c),c++}return e},Mt="x",Et="y",kt="yMiddle",wt="yTop",At="yBottom",St="xMiddle",Pt="xTop",jt="xBottom",$t=(t,e,n,o)=>[...t.map((t,o)=>[t[0],t[1]+n(e[o])]),...t.map((t,n)=>[t[0],t[1]-o(e[n])]).reverse()],Ot=t=>t&&t.extent||Array.isArray(t)&&t||[],_t=()=>!0,Dt={top:wt,bottom:At,orphan:Et},Ct={top:Pt,bottom:jt,orphan:Mt},Nt={stackedarea:gt,"stackedarea-invert":gt,stackedpercent:gt,"stackedpercent-invert":gt,linepercent:gt,difference:({data:t,yProp:e,yPropTop:n,yPropBottom:o})=>(t.forEach((a,s)=>{a.data.forEach((a,i)=>{const r=0===s?1:0;a[e]>t[r].data[i][e]?(a[o]=t[r].data[i][e],a[n]=a[e]):(a[n]=a[e],a[o]=a[e])})}),t),bumparea:bt,bumpline:bt,"bumparea-invert":bt,line:xt,area:xt,cumulative:vt,"cumulative-reverse":vt};function Tt(t,e){const n=[];for(const t of e)n.push(Object.assign({},t));for(const e of t)e.parentSummary||n.push(e);return n}const Rt={category10:l.schemeCategory10,tableau10:l.schemeTableau10,set3:l.schemeSet3,blues:l.interpolateBlues,reds:l.interpolateReds,greens:l.interpolateGreens,oranges:l.interpolateOranges,purples:l.interpolatePurples,viridis:l.interpolateViridis,plasma:l.interpolatePlasma},zt=l.schemeCategory10;function Bt(t,e,n){if("function"==typeof e)return e(t);const o=t[e];return n?n(o):zt[Math.abs(function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)}(o+""))%zt.length]}const Lt="#007bff";function Ft(n,o,a="category10"){return t.useMemo(()=>{if(o&&"function"!=typeof o)return function(t,n,o="category10"){const a=Array.from(new Set(t.map(t=>t[n]))),s=a.every(t=>"number"==typeof t||!isNaN(Number(t)));if(Array.isArray(o))return e.scaleOrdinal().domain(a).range(o).unknown("#999");const i=Rt[o]||Rt.category10;if(s&&"function"==typeof i)return t=>i(Number(t)/Math.max(...a.map(Number)));{const t=Array.isArray(i)?i:zt;return e.scaleOrdinal().domain(a).range(t).unknown("#999")}}(n,o,a)},[n,o,a])}function It({data:t,colorBy:e,colorScale:n,getColor:o,strokeColor:a,strokeWidth:s}){return{legendGroups:[{styleFn:t=>{const e={fill:t.color,stroke:t.color};return void 0!==a&&(e.stroke=a),void 0!==s&&(e.strokeWidth=s),e},type:"fill",items:Array.from(new Set(t.map(t=>"function"==typeof e?e(t):t[e]))).map(a=>{const s=t.find("function"==typeof e?t=>e(t)===a:t=>t[e]===a),i=s?o(s,e,n):n?n(a):"#000000";return{label:a+"",color:i}}),label:""}]}}const Wt={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function qt(t,e){return"function"==typeof e?e(t):t[e]}function Vt(t,e){return e?e(t):null==t?"":"number"==typeof t?t.toLocaleString():t instanceof Date?t.toLocaleDateString():"object"==typeof t&&null!==t?void 0!==t.id?t.id+"":void 0!==t.name?t.name+"":JSON.stringify(t):t+""}function Ht(t){return!0===t||("function"==typeof t?t:!1!==t&&void 0!==t&&("object"!=typeof t||null===t||!("fields"in t)&&!("title"in t)||function(t={}){const{fields:e,title:n,format:o,style:a={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let i;const r=[];if(n){const e=qt(t,n);i=Vt(e,o)}if(e&&e.length>0)e.forEach(e=>{let n,a,s;"string"==typeof e?(n=e,a=e,s=o):(n=e.label,a=e.accessor||e.key||"",s=e.format||o);const i=qt(t,a);r.push({label:n,value:Vt(i,s)})});else if(!n){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){i=Vt(t[n],o);break}if(!i){const e=Object.keys(t).filter(t=>!t.startsWith("_"));e.length>0&&(i=Vt(t[e[0]],o))}}const l=Object.assign(Object.assign({},Wt),a);return d.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:l},i&&d.createElement("div",{style:{fontWeight:r.length>0?"bold":"normal"}},i),r.map((t,e)=>d.createElement("div",{key:e,style:{marginTop:0===e&&i?"4px":0}},t.label&&d.createElement("span",null,t.label,": "),t.value)))}}(t)))}function Gt({componentName:t,message:e,width:n,height:o}){return d.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},d.createElement("div",{style:{textAlign:"center",maxWidth:400}},d.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),d.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},e)))}function Xt({data:t,accessors:e,requiredProps:n}){if(n)for(const[t,e]of Object.entries(n))if(null==e)return t+" is required. Provide a field name or function.";if(!t||!Array.isArray(t)||0===t.length)return"No data provided. Pass a non-empty array to the data prop.";if(e){const n=t[0];if(n&&"object"==typeof n)for(const[t,o]of Object.entries(e))if(o&&"string"==typeof o&&!(o in n))return`${t} "${o}" not found in data. Available fields: ${Object.keys(n).join(", ")}.`}return null}function Yt(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields}:null}function Kt(t,e,n){return e?o=>{var a,s;const i=Object.assign({},t(o));return e.isActive&&(e.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle):(i.fillOpacity=null!==(a=null==n?void 0:n.unselectedOpacity)&&void 0!==a?a:.2,i.strokeOpacity=null!==(s=null==n?void 0:n.unselectedOpacity)&&void 0!==s?s:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle))),i}:t}function Qt(t){const e=[];for(const[n,o]of Object.entries(t.fields))if("point"===o.type)e.push(t=>o.values.has(t[n]));else{const[t,a]=o.range;e.push(e=>{const o=e[n];return o>=t&&a>=o})}return t=>e.every(e=>e(t))}function Zt(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}const[Jt,Ut]=st(t=>({selections:new Map,setClause(e,n){t(t=>{const o=new Map(t.selections),a=Zt(o,e),s=new Map(a.clauses);return s.set(n.clientId,n),o.set(e,Object.assign(Object.assign({},a),{clauses:s})),{selections:o}})},clearClause(e,n){t(t=>{const o=t.selections.get(e);if(!o)return{};const a=new Map(t.selections),s=new Map(o.clauses);return s.delete(n),a.set(e,Object.assign(Object.assign({},o),{clauses:s})),{selections:a}})},setResolution(e,n){t(t=>{const o=new Map(t.selections),a=Zt(o,e);return o.set(e,Object.assign(Object.assign({},a),{resolution:n})),{selections:o}})},clearSelection(e){t(t=>{const n=new Map(t.selections),o=n.get(e);return o&&n.set(e,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}}));function te(e){const n=t.useId(),o=e.clientId||n,{name:a}=e,s=Ut(t=>t.selections.get(a)),i=Ut(t=>t.setClause),r=Ut(t=>t.clearClause),l=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(t,e){const n=[];for(const[o,a]of t.clauses)"crossfilter"===t.resolution&&o===e||n.push(Qt(a));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(s,o):()=>!0,[s,o]),isActive:l,selectPoints:t.useCallback(t=>{const e={};for(const[n,o]of Object.entries(t))e[n]={type:"point",values:new Set(o)};i(a,{clientId:o,type:"point",fields:e})},[o,a,i]),selectInterval:t.useCallback(t=>{const e={};for(const[n,o]of Object.entries(t))e[n]={type:"interval",range:o};i(a,{clientId:o,type:"interval",fields:e})},[o,a,i]),clear:t.useCallback(()=>{r(a,o)},[r,a,o]),clientId:o}}function ee(e){const n=e.name||"hover",{fields:o}=e,{predicate:a,isActive:s,selectPoints:i,clear:r}=te({name:n});return{onHover:t.useCallback(t=>{if(!t)return void r();const e={};for(const n of o){const o=t[n];void 0!==o&&(e[n]=[o])}Object.keys(e).length>0&&i(e)},[o,i,r]),predicate:a,isActive:s}}function ne(e){const{data:n,width:o=600,height:a=400,margin:s,className:i,title:r,categoryAccessor:l="category",valueAccessor:c="value",bins:u=25,relative:h=!1,categoryLabel:p,valueLabel:f,valueFormat:m,colorBy:y,colorScheme:g="category10",categoryPadding:x=20,enableHover:v=!0,showGrid:b=!1,showLegend:M,tooltip:E,frameProps:k={},selection:w,linkedHover:A}=e,S=n||[],P=Yt(A,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),j=te({name:(null==w?void 0:w.name)||"__unused__"}),$=ee({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),O=w?{isActive:j.isActive,predicate:j.predicate}:null,_=Ft(S,y,g),D=t.useMemo(()=>t=>{const e=y?Bt(t,y,_):Lt;return{fill:e,stroke:e,fillOpacity:.8}},[y,_]),C=t.useMemo(()=>Kt(D,O,w),[D,O,w]),N=void 0!==M?M:!!y,T=t.useMemo(()=>{if(N&&y)return It({data:S,colorBy:y,colorScale:_,getColor:Bt})},[N,y,S,_]),R=t.useMemo(()=>{const t=Object.assign({top:50,bottom:60,left:70,right:40},s);return T&&120>t.right&&(t.right=120),t},[s,T]),z=t.useCallback(t=>{A&&$.onHover(t)},[A,$]),B=t.useMemo(()=>t=>{const e=t.data||t,n=e.category||t.category||"",o=e.count,a=e.range;return d.createElement("div",{className:"semiotic-tooltip",style:Wt},n&&d.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&d.createElement("div",null,"Count: ",o),a&&2===a.length&&d.createElement("div",{style:{opacity:.8}},Number(a[0]).toFixed(1)," – ",Number(a[1]).toFixed(1)))},[]),L=Xt({componentName:"Histogram",data:S,accessors:{categoryAccessor:l,valueAccessor:c}});if(L)return d.createElement(Gt,{componentName:"Histogram",message:L,width:o,height:a});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:S,oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:C,bins:u,normalize:h,size:[o,a],margin:R,barPadding:x,enableHover:v,showAxes:!0,oLabel:p,rLabel:f,rFormat:m,showGrid:b},T&&{legend:T}),r&&{title:r}),i&&{className:i}),{tooltipContent:E?Ht(E):B}),A&&{customHoverBehavior:z}),k);return d.createElement(H,Object.assign({},F))}function oe(e){const{data:n,width:o=600,height:a=400,margin:s,className:i,title:r,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",bins:h=25,showIQR:p=!0,categoryLabel:f,valueLabel:m,valueFormat:y,colorBy:g,colorScheme:x="category10",categoryPadding:v=20,enableHover:b=!0,showGrid:M=!1,showLegend:E,tooltip:k,frameProps:w={},selection:A,linkedHover:S}=e,P=n||[],j=Yt(S,g?["string"==typeof g?g:""]:["string"==typeof l?l:""]),$=te({name:(null==A?void 0:A.name)||"__unused__"}),O=ee({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),_=A?{isActive:$.isActive,predicate:$.predicate}:null,D=Ft(P,g,x),C=t.useMemo(()=>t=>{const e=g?Bt(t,g,D):Lt;return{fill:e,stroke:e,fillOpacity:.6}},[g,D]),N=t.useMemo(()=>Kt(C,_,A),[C,_,A]),T=void 0!==E?E:!!g,R=t.useMemo(()=>{if(T&&g)return It({data:P,colorBy:g,colorScale:D,getColor:Bt})},[T,g,P,D]),z=t.useMemo(()=>{const t=Object.assign({top:50,bottom:60,left:70,right:40},s);return R&&120>t.right&&(t.right=120),t},[s,R]),B=t.useCallback(t=>{S&&O.onHover(t)},[S,O]),L=t.useMemo(()=>t=>{const e=t.data||t,n=e.category||t.category||"",o=(Array.isArray(e)?e:[]).map(t=>{const e="function"==typeof c?c(t):t[c];return Number(e)}).filter(t=>!isNaN(t)).sort((t,e)=>t-e),a=o.length,s=a>0?o[Math.floor(a/2)]:null;return d.createElement("div",{className:"semiotic-tooltip",style:Wt},n&&d.createElement("div",{style:{fontWeight:"bold"}},n+""),a>0&&d.createElement("div",null,"n = ",a),null!=s&&d.createElement("div",null,"Median: ",s.toLocaleString()))},[c]),F=Xt({componentName:"ViolinPlot",data:P,accessors:{categoryAccessor:l,valueAccessor:c}});if(F)return d.createElement(Gt,{componentName:"ViolinPlot",message:F,width:o,height:a});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:P,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:N,bins:h,showIQR:p,size:[o,a],margin:z,barPadding:v,enableHover:b,showAxes:!0,oLabel:f,rLabel:m,rFormat:y,showGrid:M},R&&{legend:R}),r&&{title:r}),i&&{className:i}),{tooltipContent:k?Ht(k):L}),S&&{customHoverBehavior:B}),w);return d.createElement(H,Object.assign({},I))}ne.displayName="Histogram",oe.displayName="ViolinPlot",exports.Annotation=ot,exports.AnnotationLayer=function(e){const{legendSettings:n,margin:o,size:a,annotations:s,annotationHandling:i}=e,r=lt(t=>t.tooltip);let l=null!=r?s.concat(r):s,c=lt(t=>t.changeTooltip);const u=Object.assign(Object.assign({},e),{annotations:l,voronoiHover:t=>{c(t)}}),h="object"==typeof i?i:{layout:{type:i},dataVersion:""},{dataVersion:p=""}=h,[f,m]=t.useState([]),[y,g]=t.useState([]),[x,v]=t.useState([]),[b,M]=t.useState(""),[E,k]=t.useState(p),w=ft(u,l),A=w.filter(t=>t.props&&t.props.noteData&&!t.props.noteData.fixedPosition),S=ut(A,h,a);let P;if(t.useEffect(()=>{const t=w.filter(t=>!t.props||!t.props.noteData||t.props.noteData.fixedPosition),e=mt(u,{adjustedAnnotations:f,adjustedAnnotationsKey:b,adjustedAnnotationsDataVersion:E,adjustableAnnotations:A,fixedAnnotations:t});m(e.adjustedAnnotations),M(e.adjustedAnnotationsKey),k(e.adjustedAnnotationsDataVersion),g(e.svgAnnotations),v(e.htmlAnnotations)},[S,p,l.length,l.map(t=>function(t){const e=new Set;return JSON.stringify(t,(t,n)=>e.has(n)?"...":"object"==typeof n?(e.add(n),"note"===t?`${n.label}-${n.title}`:"connector"===t?`${n.end}-${n.type}`:"subject"===t?""+n.radius:"object"==typeof n.column?`${n.column.x}-${n.column.y}-${n.column.name}`:n.voronoiX||n.voronoiY||n.x||n.y||n.dx||n.dy||n.label||n.type||n.key||n.hierarchicalID||n.id||n.name?`${n.voronoiX}-${n.voronoiY}-${n.dx}-${n.dy}-${n.x}-${n.y}-${n.label}-${n.type}-${n.key}-${n.hierarchicalID}-${n.id}-${n.name}`:"..."):n)}(t)).join("-")]),n){const t={left:[15,15],right:[a[0]+15,15]},{position:e="right",title:o="Legend"}=n;P=d.createElement("g",{transform:`translate(${t[e].join(",")})`},d.createElement(_,Object.assign({},n,{title:o,position:e})))}return 0!==l.length||n?d.createElement("div",{className:"annotation-layer",style:{position:"absolute",pointerEvents:"none",background:"none"}},d.createElement("svg",{className:"annotation-layer-svg",height:a[1],width:a[0],style:{background:"none",pointerEvents:"none",position:"absolute",left:o.left+"px",top:o.top+"px",overflow:"visible"}},d.createElement("g",null,P,y)),d.createElement("div",{className:"annotation-layer-html",style:{background:"none",pointerEvents:"none",position:"absolute",height:a[1]+"px",width:a[0]+"px",left:o.left+"px",top:o.top+"px"}},x)):null},exports.Axis=function(e){const{rotate:n,label:o,dynamicLabelPosition:a,orient:s="left",marginalSummaryType:i,tickFormat:r=(i?()=>"":J),size:l,width:c=l&&l[0]||0,height:u=l&&l[1]||0,className:h,padding:p,tickValues:f,scale:m,ticks:y,footer:g,tickSize:x,tickLineGenerator:v,baseline:b=!0,margin:M={top:0,bottom:0,left:0,right:0},center:E=!1,annotationFunction:k,glyphFunction:w,xyPoints:A}=e,[S,P]=t.useState(0),[j,$]=t.useState(void 0),O=t.useRef(null);t.useEffect(()=>{if(!(null==o?void 0:o.position)&&a){const t=((t,e)=>{const n=t.current;if(!n)return 30;const o="left"===e||"right"===e?"width":"height";return Math.max(...[...n.querySelectorAll(".axis-label")].map(t=>t.getBBox&&t.getBBox()||{height:30,width:30}).map(t=>t[o]))+25})(O,s);t!==j&&$(t)}},[o,a]);let _,{axisParts:D,position:C=[0,0]}=e;if(D||(D=function({renderMode:t=()=>{},padding:e=5,scale:n,ticks:o,tickValues:a=X(void 0,o,n),orient:s="left",size:i,footer:r=!1,tickSize:l=(r?-10:["top","bottom"].find(t=>t===s)?i?i[1]:0:i?i[0]:0),jaggedBase:c}){let u,d,h,p,f,m,y=[],g=0,x=0,v="middle";switch(s){case"top":u="x1",d="x2",h="y1",p="y2",y=[0,l],f="tx",m="ty",g-=20-e;break;case"bottom":u="x1",d="x2",h="y2",p="y1",y=i?[i[1],i[1]-l]:[0,-l],f="tx",m="ty",g+=20+e;break;case"right":u="y2",d="y1",h="x2",p="x1",y=i?[i[0],i[0]-l]:[0,-l],f="ty",m="tx",g+=5+e,x+=5,v="start";break;default:u="y1",d="y2",h="x1",p="x2",y=[0,l],f="ty",m="tx",g-=5+e,x+=5,v="end"}let b=a instanceof Function?a({orient:s}):a;return c&&void 0===b.find(t=>t===n.domain()[0])&&(b=[n.domain()[0],...b]),b.map((e,o)=>{const a=n(e);return{[u]:a,[d]:a,[h]:y[0],[p]:y[1],[f]:a+x,[m]:y[0]+g,defaultAnchor:v,renderMode:t(e,o),value:e}})}({padding:p,tickValues:f,scale:m,ticks:y,orient:s,size:[c,u],footer:g,tickSize:x}),_=d.createElement("g",{className:"axis "+h},(({axisParts:t,orient:e,tickLineGenerator:n=G,className:o,jaggedBase:a,scale:s,showOutboundTickLines:i=!1})=>{const r=t.map((t,i)=>n({xy:t,orient:e,i:i,className:o,jaggedBase:a,scale:s})),l=i?t.map((t,n)=>(({xy:t,orient:e,i:n,className:o=""})=>{let a=`M-4,${t.y1}L${t.x1},${t.y2}`;return"left"===e?a=`M${t.x1-8},${t.y1}L${t.x1},${t.y2}`:"right"===e?a=`M${t.x2},${t.y1}L${t.x2+8},${t.y2}`:"top"===e?a=`M${t.x1},${t.y1-8}L${t.x1},${t.y1}`:"bottom"===e&&(a=`M${t.x1},${t.y2}L${t.x1},${t.y2+8}`),d.createElement("path",{key:n,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:a,className:`outbound-tick-line tick ${e} ${o}`})})({xy:t,orient:e,i:n,className:o})):[];return[...r,l]})({axisParts:D,orient:s,tickLineGenerator:v,className:h,scale:m}))),0===D.length)return null;let N,T,R,z,B=50,L=u,F=-50,I=0,W=0,q=0,V=0,H=u,Y=25,K=-25,tt=18,et=c+25,nt=0,ot=S,at=0,st="y";switch(s){case"right":C=[C[0],C[1]],F=c,V=W=c,at=M.top,et=-c-25,K=5,N=t=>{P(t.nativeEvent.offsetY-at)},!0===E&&(V=W=c/2);break;case"top":C=[C[0],0],B=c,L=50,I=-50,F=0,at=M.left,st="x",V=c,H=0,!0===E&&(H=q=u/2),N=t=>{P(t.nativeEvent.offsetX-at)},Y=S,ot=25,K=0,tt=-10,et=0,nt=u+25;break;case"bottom":C=[C[0],0],B=c,L=50,q=H=I=u,W=F=0,V=c,at=M.left,N=t=>{P(t.nativeEvent.offsetX-at)},Y=S,ot=25,K=0,tt=15,et=0,nt=-u-25,st="x",!0===E&&(H=q=u/2);break;default:C=[C[0],C[1]],at=M.top,!0===E&&(V=W=c/2),N=t=>{P(t.nativeEvent.offsetY-at)}}if(k){const t=function(t,e){return e.tickFormat?e.tickFormat(t):t.toString?""+t:t}(m.invert(S),e),n=w?w({lineHeight:nt,lineWidth:et,value:m.invert(S)}):d.createElement("g",null,d.isValidElement(t)?d.createElement("g",{transform:`translate(${K},${tt})`},t):d.createElement("text",{x:K,y:tt},t),d.createElement("circle",{r:5}),d.createElement("line",{x1:et,y1:nt,style:{stroke:"black"}})),o=S?d.createElement("g",{style:{pointerEvents:"none"},transform:`translate(${Y},${ot})`},n):null;T=d.createElement("g",{className:"annotation-brush",transform:`translate(${F},${I})`},d.createElement("rect",{style:{fillOpacity:0},height:L,width:B,onMouseMove:N,onClick:t=>k({className:"dynamic-axis-annotation",type:st,value:m.invert(S),e:t}),onMouseOut:()=>{P(void 0)}}),o)}if(i&&A){const t=Math.max(M[s]-6,5),e="string"==typeof i?{type:i}:i;void 0!==e.flip||"bottom"!==s&&"right"!==s||(e.flip=!0);const n=e.summaryStyle?()=>e.summaryStyle:()=>({fill:"black",fillOpacity:.5,stroke:"black",strokeDasharray:"0"}),o=e.renderMode?()=>e.renderMode:()=>{},a=e.summaryClass?()=>e.summaryClass:()=>"",r=e.filter||(()=>!0),c=A.filter(t=>void 0!==t.x&&void 0!==t.y&&r(t.data)).map(t=>Object.assign(Object.assign({},t),{xy:{x:"top"===s||"bottom"===s?m(t.x):0,y:"left"===s||"right"===s?m(t.y):0},piece:{scaledVerticalValue:m(t.y),scaledValue:m(t.x)},value:m("top"===s||"bottom"===s?t.y:t.x),scaledValue:m(t.x),scaledVerticalValue:m(t.y)})),u=function(t){const e=[];for(const n of t){const t=[],{elements:o,containerProps:a}=n;if(n.Mark)e.push(n.Mark);else{for(let e=0;o.length>e;e++){const n=o[e],{markType:a,style:s={}}=n,i=U(n,["markType","style"]),r=Object.assign({},i);void 0!==s.fill&&(r.fill=s.fill),void 0!==s.stroke&&(r.stroke=s.stroke),void 0!==s.strokeWidth&&(r.strokeWidth=s.strokeWidth),void 0!==s.opacity&&(r.opacity=s.opacity),void 0!==s.fillOpacity&&(r.fillOpacity=s.fillOpacity),void 0!==s.strokeOpacity&&(r.strokeOpacity=s.strokeOpacity);const l=Object.assign({},s);delete l.fill,delete l.stroke,delete l.strokeWidth,delete l.opacity,delete l.fillOpacity,delete l.strokeOpacity,Object.keys(l).length>0&&(r.style=l),r.key=n.key||e,a&&t.push(d.createElement(a,r))}a?e.push(d.createElement("g",Object.assign({},a),t)):e.push(...t)}}return e}((({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:a,classFn:s,projection:i,adjustedSize:r,margin:l,axisCreator:c})=>{if(e&&e.type)return function({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:a,classFn:s,projection:i,adjustedSize:r,chartSize:l,margin:c,axisCreator:u}){return"function"==typeof e.type?e.type({data:t,type:e,renderMode:n,eventListenersGenerator:o,styleFn:a,classFn:s,projection:i,adjustedSize:r,chartSize:l,margin:c,axisCreator:u}):(console.error(`Invalid summary type: ${e.type} - Must be a function`),{})}({data:t,type:e="string"==typeof e?{type:e}:e,renderMode:n,eventListenersGenerator:o,styleFn:a,classFn:s,projection:i,adjustedSize:r,chartSize:"vertical"===i?r[1]:r[0],margin:l,axisCreator:c})})({data:{column:{middle:t/2,pieceData:c,width:t,xyData:c}},type:e,renderMode:o,eventListenersGenerator:e.eventListenersGenerator||(()=>({})),styleFn:n,classFn:a,projection:"top"===s||"bottom"===s?"horizontal":"vertical",adjustedSize:l,margin:{top:0,bottom:0,left:0,right:0}}).marks);let h;if(!0===e.showPoints){const n=((t,e,n)=>{const o="left"===t||"right"===t?e/2:0,a="bottom"===t||"top"===t?e/2:0;return n.map(t=>[t.xy.x+o,t.xy.y+a])})(s,t,c);h=n.map((t,n)=>d.createElement("circle",{key:"axis-summary-point-"+n,cx:t[0],cy:t[1],r:e.r||3,style:e.pointStyle||{fill:"black",fillOpacity:.1}}))}R=d.createElement(Q,{translation:{left:[2-M.left,0],right:[l[0]+2,0],top:[0,2-M.top],bottom:[0,l[1]+2]},orient:s,decoratedSummaryType:e,summaryWidth:t,renderedSummary:u,points:h})}const it=(({axisParts:t,tickFormat:e,rotate:n=0,center:o=!1,orient:a})=>{const s=t.map((t,n)=>({axisPart:t,i:n,formatted:e(t.value,n)})),i="left"===a||"right"===a;let r=s;if(!n&&s.length>1){const t=8,e=14,n=8,o=t=>"string"==typeof t?t:"number"==typeof t?t+"":null;if("top"===a||"bottom"===a){const e=[...s].sort((t,e)=>t.axisPart.tx-e.axisPart.tx);let a=-1/0;const i=new Set;for(const s of e){const e=o(s.formatted);if(!e){i.add(s.i);continue}const r=e.length*t/2;a+n>s.axisPart.tx-r||(i.add(s.i),a=s.axisPart.tx+r)}r=s.filter(t=>i.has(t.i))}else if(i){const t=[...s].sort((t,e)=>t.axisPart.ty-e.axisPart.ty);let o=-1/0;const a=new Set;for(const s of t)o+e+n>s.axisPart.ty||(a.add(s.i),o=s.axisPart.ty);r=s.filter(t=>a.has(t.i))}}return r.map(({axisPart:t,i:e,formatted:s})=>{("object"!=typeof s||s instanceof Date)&&(s=d.createElement("text",{textAnchor:t.defaultAnchor,className:"axis-label"},s.toString?""+s:s));let i=t.tx,r=t.ty;if(o)switch(a){case"right":i-=(t.x2-t.x1)/2;break;case"left":i+=(t.x2-t.x1)/2;break;case"top":r+=(t.y2-t.y1)/2;break;case"bottom":r-=(t.y2-t.y1)/2}return d.createElement("g",{key:e,pointerEvents:"none",transform:`translate(${i},${r}) rotate(${n})`,className:"axis-label"},s)})})({tickFormat:r,axisParts:D,orient:s,rotate:n,center:E});if(o){const t=o.name||o,e=o.position||{};let n=e.anchor||"middle";const a=o.locationDistance||j,i=e.rotation||{left:-90,right:90,top:0,bottom:0}[s],r={left:{start:[0,l[1]],middle:[0,l[1]/2],end:[0,0],inside:[a||15,0],outside:[-(a||45),0]},right:{start:[l[0]+0,l[1]],middle:[l[0]+0,l[1]/2],end:[l[0]+0,0],inside:[-(a||15),0],outside:[a||45,0]},top:{start:[0,0],middle:[0+l[0]/2,0],end:[0+l[0],0],inside:[0,a||15],outside:[0,-(a||40)]},bottom:{start:[0,l[1]],middle:[0+l[0]/2,l[1]],end:[0+l[0],l[1]],inside:[0,-(a||5)],outside:[0,a||50]}},c=r[s][n],u=r[s][e.location||"outside"];c[0]=c[0]+u[0],c[1]=c[1]+u[1],"start"===n&&"right"===s?n="end":"end"===n&&"right"===s&&(n="start"),z=d.createElement(Z,{className:h,translation:c,position:C,rotation:i,labelName:t,anchorMod:n})}const rt=`${s} axis ${D&&D.length>0&&`from ${r(D[0].value,0)} to ${r(D[D.length-1].value,D.length-1)}`||"without ticks"}`;return d.createElement("g",{className:h,"aria-label":rt,ref:O},T,it,_,!0===b?d.createElement("line",{key:"baseline",className:"axis-baseline "+h,stroke:"black",strokeLinecap:"square",x1:W,x2:V,y1:q,y2:H}):null,z,R)},exports.Histogram=ne,exports.Legend=_,exports.StreamOrdinalFrame=H,exports.ViolinPlot=oe,exports.calculateDataExtent=({lineDataAccessor:t,xAccessor:n,yAccessor:o,summaries:a,points:l,lines:c,lineType:u,showLinePoints:h,showSummaryPoints:f,xExtent:m,yExtent:y,invertX:g,invertY:x,summaryDataAccessor:v,summaryType:b,adjustedSize:M,margin:E,summaryStyleFn:k,summaryClassFn:w,summaryRenderModeFn:A,chartSize:S,filterRenderedLines:P,filterRenderedSummaries:j,filterRenderedPoints:$,defined:O=_t,annotations:_=[]})=>{let D=[],C=[],N=[],T=[],R=[];if(l){n.forEach((t,e)=>{o.forEach((n,o)=>{let a=0;for(const s of l){const i=t(s,a),r=n(s,a),l={x:i,y:r,data:s,xIndex:e,yIndex:o};Array.isArray(r)&&(l[At]=Math.min(...r),l[wt]=Math.max(...r),l[kt]=(l[At]+l[wt])/2),Array.isArray(i)&&(l[jt]=Math.min(...i),l[Pt]=Math.max(...i),l[St]=(l[jt]+l[Pt])/2),N.push(l),a++}})});for(const t of N)D.push(Object.assign(Object.assign({},t),{[Mt]:t[Pt]||t[jt]||t.x,[Et]:t[wt]||t[At]||t.y}))}if(c){C=(({data:t,lineDataAccessor:e,xProp:n,xPropTop:o,xPropBottom:a,yProp:s,yPropTop:i,yPropBottom:r,xAccessor:l,yAccessor:c})=>{Array.isArray(t)||(t=[t]);const u=[];return e.forEach((e,d)=>{l.forEach((l,h)=>{c.forEach((c,p)=>{t.forEach(t=>{const f=Object.assign(Object.assign({},t),{xIndex:h,yIndex:p,lineIndex:d});f.data=e(t).map((t,e)=>{const u={data:t};return u[n]=l(t,e),u[o]=u[n],u[a]=u[n],u[s]=c(t,e),u[i]=u[s],u[r]=u[s],u}),f.key=f.key||u.length,u.push(f)})})})}),u})({data:c,lineDataAccessor:t,xProp:Mt,xPropTop:Pt,xPropBottom:jt,yProp:Et,yPropTop:wt,yPropBottom:At,xAccessor:n,yAccessor:o}),T=function(t,e){return n=>Nt[((t,e)=>!Nt[t]||"difference"===t&&2!==e.length?"line":t)(t.type,n)](Object.assign(Object.assign(Object.assign({},t),e),{data:n}))}(u,{xProp:Mt,yProp:Et,yPropMiddle:kt,yPropTop:wt,yPropBottom:At,xPropMiddle:St,xPropTop:Pt,xPropBottom:jt})(C);for(const t of T)for(let e=0;t.data.length>e;e++){const n=t.data[e];if(!O(Object.assign({},n.data,n),e))continue;const o={parentLine:t,y:n.y,x:n.x,xTop:n.xTop,xMiddle:n.xMiddle,xBottom:n.xBottom,yTop:n.yTop,yMiddle:n.yMiddle,yBottom:n.yBottom,data:n.data};n.percent&&(o.percent=n.percent),D.push(o)}if(h){const t=!0===h?St:Ct[h],e=!0===h?kt:Dt[h];T.forEach(n=>{n.data.filter((t,e)=>{if(O(Object.assign({},t.data,t))){if("orphan"===h){const t=n.data[e-1],o=n.data[e+1];return!(t&&O(Object.assign({},t.data,t))||o&&O(Object.assign({},o.data,o)))}return!0}return!1}).forEach(o=>{N.push(Object.assign(Object.assign({},o),{parentLine:n,[Et]:void 0!==o[e]?o[e]:void 0!==o[kt]?o[kt]:void 0!==o[At]?o[At]:o.y,[Mt]:void 0!==o[t]?o[t]:void 0!==o[St]?o[St]:void 0!==o[jt]?o[jt]:o.y}))})})}}a&&(R=(({data:t,summaryDataAccessor:e,xAccessor:n,yAccessor:o})=>{const a=[];return e.forEach(e=>{n.forEach(n=>{o.forEach(o=>{const s=t=>e(t).map((t,e)=>[n(t,e),o(t,e)]);t.forEach(t=>{a.push(Object.assign(Object.assign({},t),{_baseData:e(t),_xyfCoordinates:s(t)}))})})})}),a})({data:a,summaryDataAccessor:v,xAccessor:n,yAccessor:o}),R.forEach(t=>{const e=t._baseData;t._xyfCoordinates.length>0&&t._xyfCoordinates[0][0][0]?t._xyfCoordinates[0].forEach(n=>{Array.isArray(n)&&n.map((n,o)=>Object.assign({parentSummary:t},e[o],{[Mt]:n[0],[Et]:n[1]})).forEach(t=>{f&&N.push(Object.assign(Object.assign({x:0},t),{[Et]:t[wt]||t[At]||t[Et]})),D.push(Object.assign({x:0,y:0},t))})}):t._xyfCoordinates.length>0&&Array.isArray(t._xyfCoordinates)&&t._xyfCoordinates.map((n,o)=>Object.assign(Object.assign({parentSummary:t},e[o]),{[Mt]:n[0],[Et]:n[1]})).forEach(t=>{f&&N.push(Object.assign(Object.assign({x:0},t),{[Et]:t[wt]||t[At]||t[Et]})),D.push(Object.assign({x:0,y:0},t))})}));let z,B,L,F,I=[],W=[];m&&!Array.isArray(m)&&!0===m.includeAnnotations&&n.forEach(t=>{_.forEach((e,n)=>{const o=t(e,n);isFinite(o)&&I.push({[Mt]:o})})}),y&&!Array.isArray(y)&&!0===y.includeAnnotations&&o.forEach(t=>{_.forEach((e,n)=>{const o=t(e,n);isFinite(o)&&W.push({[Et]:o})})});for(const t of D){const e=void 0===t[jt]?t[Mt]:Math.min(t[Pt],t[jt]),n=void 0===t[Pt]?t[Mt]:Math.max(t[jt],t[Pt]),o=void 0===t[At]?t[Et]:Math.min(t[wt],t[At]),a=void 0===t[wt]?t[Et]:Math.max(t[At],t[wt]);void 0===e||void 0!==z&&e>=z||(z=e),void 0===n||void 0!==B&&B>=n||(B=n),void 0===o||void 0!==L&&o>=L||(L=o),void 0===a||void 0!==F&&F>=a||(F=a)}for(const t of I){const e=t[Mt];void 0===e||void 0!==z&&e>=z||(z=e),void 0===e||void 0!==B&&B>=e||(B=e)}for(const t of W){const e=t[Et];void 0===e||void 0!==L&&e>=L||(L=e),void 0===e||void 0!==F&&F>=e||(F=e)}const q=[z,B],V=[L,F],H=Ot(m),G=Ot(y);let X=[G&&void 0!==G[0]?G[0]:V[0],G&&void 0!==G[1]?G[1]:V[1]],Y=[H&&void 0!==H[0]?H[0]:q[0],H&&void 0!==H[1]?H[1]:q[1]];if(!g||H&&2===H.length||(Y=[Y[1],Y[0]]),"bumpline"!==u.type&&!x||G&&2===G.length||(X=[X[1],X[0]]),b.type&&"contour"===b.type)R=function({summaryType:t,data:n,finalXExtent:o,finalYExtent:a}){let s=[];t.type||(t={type:t});const{resolution:r=500,thresholds:l=10,bandwidth:c=20,neighborhood:u}=t,d=e.scaleLinear().domain(o).rangeRound([0,r]).nice(),h=e.scaleLinear().domain(a).rangeRound([r,0]).nice();return n.forEach(t=>{let e=i.contourDensity().size([r,r]).x(t=>d(t[0])).y(t=>h(t[1])).thresholds(l).bandwidth(c)(t._xyfCoordinates);u&&(e=[e[0]]);const n=Math.max(...e.map(t=>t.value));e.forEach(e=>{e.parentSummary=t,e.bounds=[],e.percent=e.value/n,e.coordinates.forEach(t=>{t.forEach((n,o)=>{t[o]=n.map(t=>[d.invert(t[0]),h.invert(t[1])]),0===o&&e.bounds.push(function(t){let e=[1/0,0],n=[-1/0,0],o=[0,1/0],a=[0,-1/0];return t.forEach(t=>{e=e[0]>t[0]?t:e,n=t[0]>n[0]?t:n,a=t[1]>a[1]?t:a,o=o[1]>t[1]?t:o}),{center:[(e[0]+n[0])/2,(o[1]+a[1])/2],top:o,left:e,right:n,bottom:a}}(t[o]))})})}),s=[...s,...e]}),s}({summaryType:b,data:R,finalXExtent:Y,finalYExtent:X});else if(b.type&&"linebounds"===b.type){if(R=function({summaryType:t,data:e,defined:n}){let o=[];t.type||(t={type:t});const{boundingAccessor:a,topBoundingAccessor:s=a,bottomBoundingAccessor:i=a}=t;return e.forEach(t=>{const e=t._baseData.map(n);let a=[],r=[];const l=[{xyf:r,base:a}];e.forEach((n,o)=>{!0===n?(a.push(t._baseData[o]),r.push(t._xyfCoordinates[o])):e[o+1]&&(a=[],r=[],l.push({xyf:r,base:a}))}),l.forEach(({xyf:e,base:n})=>{const a={data:t,parentSummary:t,_xyfCoordinates:$t(e,n,s,i)};o=[...o,a]})}),o}({summaryType:b,data:R,defined:O}),!G||2!==G.length)for(const t of R)for(const e of t._xyfCoordinates){const t=e[1];void 0!==t&&isFinite(t)&&(X[0]>t&&(X[0]=t),t>X[1]&&(X[1]=t))}}else b.type&&"hexbin"===b.type?(R=function({preprocess:t=!0,processedData:n=!1,summaryType:o,data:a,finalXExtent:s,finalYExtent:i,size:l,xScaleType:c=e.scaleLinear(),yScaleType:u=e.scaleLinear(),margin:h,styleFn:p,classFn:f,renderFn:m,chartSize:y}){let g=s,x=i;if(!g){const t=a.coordinates.map(t=>t.x);g=[Math.min(...t),Math.max(...t)]}if(!x){const t=a.coordinates.map(t=>t.y);x=[Math.min(...t),Math.max(...t)]}if(n&&a)return a.coordinates;let v,b=[];v=o.type?o:{type:v};const{bins:M=.05,cellPx:E,binValue:k=t=>t.length,binMax:w,customMark:A}=v;a.coordinates&&!a._xyfCoordinates&&(a._xyfCoordinates=a.coordinates.map(t=>[t.x,t.y]));const S=Array.isArray(a)?a:[a],P=c.domain(g).range([0,l[0]]),j=u.domain(x).range([0,l[1]]),$=E&&E/2||(M>1?1/M:M)*l[0]/2,O=r.hexbin().x(t=>P(t._xyfPoint[0])).y(t=>j(t._xyfPoint[1])).radius($).size(l);let _;const D=O.centers();return S.forEach(t=>{_=0;const e=O(t._xyfCoordinates.map((e,n)=>Object.assign({_xyfPoint:e},t.coordinates[n]))),n={};e.forEach(t=>{n[`${parseInt(t.x)}-${parseInt(t.y)}`]=!0}),D.forEach(t=>{if(!n[`${parseInt(t[0])}-${parseInt(t[1])}`]){const n=[];n.x=t[0],n.y=t[1],e.push(n)}}),_=Math.max(...e.map(t=>k(t))),w&&w(_);const o=[[0,-1],[.866,-.5],[.866,.5],[0,1],[-.866,.5],[-.866,-.5]],a=P.invert($)-g[0],s=j.invert($)-x[0],i=o.map(t=>[t[0]*a,t[1]*s]),r=e.map(e=>{const n=k(e),a=e.x,s=e.y;e.x=P.invert(e.x),e.y=j.invert(e.y);const r=n/_;return{customMark:A&&d.createElement("g",{transform:`translate(${a},${l[1]-s})`},A({d:Object.assign(Object.assign({},e),{binItems:e,percent:r,value:n,radius:$,hexCoordinates:o.map(t=>[t[0]*$,t[1]*$])}),margin:h,styleFn:p,classFn:f,renderFn:m,chartSize:y,adjustedSize:l})),_xyfCoordinates:i.map(t=>[t[0]+e.x,t[1]+e.y]),value:n,percent:r,data:e,parentSummary:t,centroid:!0}});b=[...b,...r]}),t?(b.forEach(t=>{t.x=t.data.x,t.y=t.data.y}),{type:"hexbin",processedData:!0,coordinates:b,binMax:_}):b}({summaryType:b,data:R[0],processedData:a&&!!a[0].processedData,preprocess:!1,finalXExtent:Y,finalYExtent:X,size:M,margin:E,styleFn:k,classFn:w,renderFn:A,chartSize:S}),D=Tt(D,R)):b.type&&"heatmap"===b.type?(R=function({preprocess:t=!0,processedData:n=!1,summaryType:o,data:a,finalXExtent:s=[Math.min(...a.coordinates.map(t=>t.x)),Math.max(...a.coordinates.map(t=>t.x))],finalYExtent:i=[Math.min(...a.coordinates.map(t=>t.y)),Math.max(...a.coordinates.map(t=>t.y))],size:r,xScaleType:l=e.scaleLinear(),yScaleType:c=e.scaleLinear(),margin:u,styleFn:h,classFn:p,renderFn:f,chartSize:m}){if(n&&a)return a.coordinates;a.coordinates&&!a._xyfCoordinates&&(a._xyfCoordinates=a.coordinates.map(t=>[t.x,t.y]));const y=Array.isArray(a)?a:[a];let g,x=[];g=o.type?o:{type:g};const{binValue:v=t=>t.length,xBins:b=g.yBins||.05,yBins:M=b,xCellPx:E=!g.xBins&&g.xCellPx,yCellPx:k=!g.yBins&&g.yCellPx,customMark:w,binMax:A}=g,S=1>b?b:1/b,P=1>M?M:1/M,j=l.domain(s).range([0,r[0]]),$=c.domain(i).range([r[1],0]),O=[Math.ceil((E&&E/r[0]||S)*r[0]*10)/10,Math.ceil((k&&k/r[1]||P)*r[1]*10)/10];let _=-1/0;return y.forEach(t=>{const e=[],n=[];let o,a;for(let s=0;r[0]>Math.ceil(s);s+=O[0]){const i=j.invert(s),l=j.invert(s+O[0]);a=[],e.push(a);for(let e=0;r[1]>Math.ceil(e);e+=O[1]){const r=$.invert(e),c=$.invert(e+O[1]);o={gx:s,gy:e,gw:O[0],gh:O[1],x:(i+l)/2,y:(r+c)/2,binItems:[],value:0,_xyfCoordinates:[[i,r],[l,r],[l,c],[i,c]],parentSummary:t},a.push(o),n.push(o)}a.push(o)}e.push(a),t._xyfCoordinates.forEach((n,o)=>{const a=j(n[0]),s=$(n[1]),i=Math.floor(a/O[0]),r=Math.floor(s/O[1]);e[i][r]&&e[i][r].binItems.push(t.coordinates[o])}),n.forEach(t=>{t.value=v(t.binItems),_=Math.max(_,t.value)}),n.forEach(t=>{t.percent=t.value/_,t.customMark=w&&d.createElement("g",{transform:`translate(${t.gx},${t.gy})`},w({d:t,margin:u,styleFn:h,classFn:p,renderFn:f,chartSize:m,adjustedSize:r}))}),x=[...x,...n]}),A&&A(_),t?{type:"heatmap",processedData:!0,_baseData:[],_xyfCoordinates:[],data:[],bounds:[],x:0,y:0,coordinates:x,binMax:_}:x}({summaryType:b,data:R[0],processedData:a&&!!a[0].processedData,preprocess:!1,finalXExtent:Y,finalYExtent:X,size:M,margin:E,styleFn:k,classFn:w,renderFn:A,chartSize:S}),D=Tt(D,R)):b.type&&"trendline"===b.type&&(R=function({preprocess:t=!1,summaryType:n,data:o,finalXExtent:a=[Math.min(...o.coordinates.map(t=>t.x)),Math.max(...o.coordinates.map(t=>t.x))],xScaleType:i=e.scaleLinear()}){if(t)return o[0].coordinates;let r,l=[];r=n.type?n:{type:r};const{regressionType:c="linear",order:u=2,precision:d=4,controlPoints:h=20,curve:f=s.curveCardinal}=r;let m=c;a[0]>=0||"logarithmic"!==c&&"power"!==c&&"exponential"!==c||(console.error(`Cannot use this ${c} regressionType type with value range that goes below 0, defaulting to linear`),m="linear"),o.coordinates&&!o._xyfCoordinates&&(o._xyfCoordinates=o.coordinates.map(t=>[t.x,t.y]));const y=Array.isArray(o)?o:[o],g=i.domain([0,1]).range(a);return l=[],y.forEach(t=>{const e=p.default[m](t._xyfCoordinates.map(t=>{let e=t[0],n=t[1];return"number"!=typeof e&&(e=e.getTime()),"number"!=typeof n&&(n=n.getTime()),[e,n]}),{order:u,precision:d}),n=1/h;let o=[0,1];if("linear"!==m){o=[];for(let t=0;1+n>t;t+=n)o.push(t)}const a=[];o.forEach(t=>{a.push(e.predict(g(t)))}),l.push({centroid:!1,customMark:void 0,data:t,parentSummary:t,value:e.string,r2:e.r2,curve:f,_xyfCoordinates:a})}),l}({summaryType:b,data:R[0],preprocess:a&&!!a[0].processedData,finalXExtent:Y}),D=Tt(D,R));return P&&(T=T.filter(P),D=D.filter((t,e)=>!t.parentLine||P(t.parentLine,e,[]))),$&&(D=D.filter($)),j&&(R=R.filter(j),D=D.filter((t,e)=>!t.parentSummary||j(t.parentSummary,e,[]))),{xExtent:Y,yExtent:X,projectedLines:T,projectedPoints:N,projectedSummaries:R,fullDataset:D,calculatedXExtent:q,calculatedYExtent:V}};
1
+ "use strict";const e=require("react"),t=require("d3-scale"),n=require("d3-array"),o=require("d3-hierarchy"),s=require("d3-scale-chromatic");function a(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const i=a(e),r=5e3;class l{constructor(e){this.lastBoundedData=null,this.chunkTimer=0,this.callback=e}setBoundedData(e){if(e===this.lastBoundedData)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),5e3>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,r),bounded:!0,totalSize:e.length});let t=r;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+r,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}push(e){this.callback({inserts:[e],bounded:!1})}pushMany(e){0!==e.length&&this.callback({inserts:e,bounded:!1})}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null}}class c{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;const t=this;return{next:()=>t._size>e?{done:!1,value:t.get(e++)}:{done:!0,value:void 0}}}toArray(){const e=[];for(const t of this)e.push(t);return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class u{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isNaN(e)||(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function h(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function d(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function g(e,t,n,o,s,a,i){return{type:"rect",x:e,y:t,w:n,h:o,style:s,datum:a,group:i}}function m(e,t){const{columns:n,config:o,resolvePieceStyle:s}=e,a=[],i=Math.min(t.width,t.height)/2-4,r="donut"===o.chartType?o.innerRadius||60:0,l=-Math.PI/2+(o.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(n)){const t=l+e.pctStart*c,n=l+(e.pctStart+e.pct)*c,o=s(e.pieceData[0],e.name);a.push({type:"wedge",cx:0,cy:0,innerRadius:r,outerRadius:i,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return a}function f(e){var t,o,s;const a=e.length,i=e[0],r=e[a-1];return{n:a,min:i,q1:null!==(t=n.quantile(e,.25))&&void 0!==t?t:i,median:null!==(o=n.quantile(e,.5))&&void 0!==o?o:(i+r)/2,q3:null!==(s=n.quantile(e,.75))&&void 0!==s?s:r,max:r,mean:e.reduce((e,t)=>e+t,0)/a}}const y={bar:function(e,t){const{scales:n,columns:o,config:s,getR:a,getStack:i,resolvePieceStyle:r}=e,{r:l,projection:c}=n,u=[],h="vertical"===c,d="horizontal"===c,m=s.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=i?i(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=a(n),o.pieces.push(n)}let n=0;if(m)for(const e of t.values())n+=Math.abs(e.total);let o=0,s=0;for(const[a,c]of t){let t=c.total;m&&n>0&&(t/=n);const f=r(c.pieces[0],i?a:e.name),y=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(h){const n=l(0>t?s:o+t),i=0>t?l(s+t)-l(s):l(o)-l(o+t);u.push(g(e.x,n,e.width,Math.abs(i),f,y,a)),0>t?s+=t:o+=t}else if(d){const n=l(0>t?s+t:o),i=0>t?l(s)-l(s+t):l(o+t)-l(o);u.push(g(n,e.x,Math.abs(i),e.width,f,y,a)),0>t?s+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:s,getGroup:a,resolvePieceStyle:i}=e,{r:r,projection:l}=n,c=[],u="vertical"===l,h=[],d=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=a?a(t):"_default";d.has(e)||(d.add(e),h.push(e))}const m=h.length||1;for(const e of Object.values(o)){const t=e.width/m,n=new Map;for(const t of e.pieceData){const e=a?a(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;h.length>o;o++){const a=n.get(h[o])||[];for(const n of a){const a=s(n),l=i(n,e.name);if(u){const s=e.x+o*t,i=r(0),u=r(a);c.push(g(s,Math.min(i,u),t,Math.abs(i-u),l,n,h[o]))}else{const s=e.x+o*t,i=r(0),u=r(a);c.push(g(Math.min(i,u),s,Math.abs(u-i),t,l,n,h[o]))}}}}return c},point:function(e,t){var n,o;const{scales:s,columns:a,getR:i,multiScales:r,resolvePieceStyle:l}=e,{r:c,projection:u}=s,h=[],d="vertical"===u,g="radial"===u,m=r.length>0,f=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(a))for(const t of e.pieceData){const s=null!==(n=t.__rIndex)&&void 0!==n?n:0,a=null!==(o=t.__rValue)&&void 0!==o?o:i(t),u=m&&r[s]||c,p=l(t,e.name),v=p.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*f,n=u(a);b=Math.cos(t)*n,x=Math.sin(t)*n}else d?(b=e.middle,x=u(a)):(b=u(a),x=e.middle);h.push({type:"point",x:b,y:x,r:v,style:p,datum:t})}return h},swarm:function(e,t){const{scales:n,columns:o,getR:s,resolvePieceStyle:a}=e,{r:i,projection:r}=n,l=[],c="vertical"===r;for(const e of Object.values(o)){const t=e.width/2;for(let n=0;e.pieceData.length>n;n++){const o=e.pieceData[n],r=s(o),u=a(o,e.name),h=u.r||4,d=(7919*n%100/100-.5)*t*.8,g=c?e.middle+d:i(r),m=c?i(r):e.middle+d;l.push({type:"point",x:g,y:m,r:h,style:u,datum:o})}}return l},pie:m,donut:m,boxplot:function(e,t){var o,s,a,i,r;const{scales:l,columns:c,config:u,getR:h,resolveSummaryStyle:d}=e,{r:g,projection:m}=l,f=[],y="vertical"===m,p=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(o=n.quantile(t,.25))&&void 0!==o?o:l,m=null!==(s=n.quantile(t,.5))&&void 0!==s?s:(l+c)/2,v=null!==(a=n.quantile(t,.75))&&void 0!==a?a:c,b=v-u,x=u-1.5*b,w=v+1.5*b,k=null!==(i=t.find(e=>e>=x))&&void 0!==i?i:l,A=null!==(r=[...t].reverse().find(e=>w>=e))&&void 0!==r?r:c,E=d(e.pieceData[0],e.name),M=[];if(p)for(const t of e.pieceData){const n=h(t);if(x>n||n>w){const o=y?e.middle:g(n),s=y?g(n):e.middle;M.push({px:o,py:s,value:n,datum:t})}}if(f.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:g(k),q1Pos:g(u),medianPos:g(m),q3Pos:g(v),maxPos:g(A),stats:{min:k,q1:u,median:m,q3:v,max:A},style:E,datum:e.pieceData,category:e.name,outliers:M}),p)for(const e of M)f.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return f},violin:function(e,t){var o,s,a;const{scales:i,columns:r,config:l,getR:c,resolveSummaryStyle:u}=e,{r:h,projection:d}=i,g=[],m="vertical"===d,y=l.bins||20,p=!1!==l.showIQR;for(const e of Object.values(r)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],r=t[t.length-1],l=(r-i)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/l),y-1)]++;const v=Math.max(...d,1),b=e.width/2*.9;let x="";if(m){for(let t=0;y>t;t++){const n=h(i+(t+.5)*l),o=d[t]/v*b;x+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=h(i+(t+.5)*l);x+=` L ${e.middle-d[t]/v*b} ${n}`}x+=" Z"}else{for(let t=0;y>t;t++){const n=h(i+(t+.5)*l),o=d[t]/v*b;x+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)x+=` L ${h(i+(t+.5)*l)} ${e.middle+d[t]/v*b}`;x+=" Z"}const w=u(e.pieceData[0],e.name);let k;if(p&&t.length>=4){const l=null!==(o=n.quantile(t,.25))&&void 0!==o?o:i,c=null!==(s=n.quantile(t,.5))&&void 0!==s?s:(i+r)/2,u=null!==(a=n.quantile(t,.75))&&void 0!==a?a:r;k={q1Pos:h(l),medianPos:h(c),q3Pos:h(u),centerPos:e.middle,isVertical:m}}const A=m?{x:e.x,y:Math.min(h(r),h(i)),width:e.width,height:Math.abs(h(r)-h(i))}:{x:Math.min(h(i),h(r)),y:e.x,width:Math.abs(h(r)-h(i)),height:e.width};g.push({type:"violin",pathString:x,translateX:0,translateY:0,bounds:A,iqrLine:k,stats:f(t),style:w,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){const{scales:n,columns:o,config:s,getR:a,resolveSummaryStyle:i}=e,{r:r}=n,l=[],c=s.bins||25,u=s.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,s=Array(c).fill(0);for(const e of t)s[Math.min(Math.floor((e-n)/o),c-1)]++;const h=t.length,d=Math.max(...s,1),m=i(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===s[t])continue;const a=(u?s[t]/h:s[t]/d)*e.width*.9,i=r(n+t*o),c=r(n+(t+1)*o);l.push(g(Math.min(i,c),e.x+e.width-a,Math.abs(c-i),a,m,{bin:t,count:s[t],range:[n+t*o,n+(t+1)*o],category:e.name},e.name))}}return l},ridgeline:function(e,t){var n;const{scales:o,columns:s,config:a,getR:i,resolveSummaryStyle:r}=e,{r:l,projection:c}=o,u=[],h=a.bins||20,d="horizontal"===c,g=a.amplitude||1.5;for(const e of Object.values(s)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],s=t[t.length-1],a=(s-o)/h||1,c=Array(h).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/a),h-1)]++;const m=Math.max(...c,1),y=r(e.pieceData[0],e.name),p=e.width*g;let v="";if(d){const t=e.x+e.width;v=`M ${l(o)} ${t}`;for(let e=0;h>e;e++)v+=` L ${l(o+(e+.5)*a)} ${t-c[e]/m*p}`;v+=` L ${l(s)} ${t} Z`}else{const t=e.x;v=`M ${t} ${l(o)}`;for(let e=0;h>e;e++){const n=l(o+(e+.5)*a);v+=` L ${t+c[e]/m*p} ${n}`}v+=` L ${t} ${l(s)} Z`}const b=d?{x:Math.min(l(o),l(s)),y:e.x,width:Math.abs(l(s)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(s),l(o)),width:e.width,height:Math.abs(l(s)-l(o))};u.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:b,stats:f(t),style:Object.assign(Object.assign({},y),{fillOpacity:null!==(n=y.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:s,resolvePieceStyle:a}=e,{r:i,projection:r}=n,l=[],c="horizontal"===r;for(const e of Object.values(o))for(const t of e.pieceData){const n=s(t);if(!n)continue;const[o,r]=n,u=a(t,e.name);if(c){const n=i(Math.min(o,r)),s=i(Math.max(o,r));l.push(g(n,e.x,s-n,e.width,u,t,e.name))}else{const n=i(Math.max(o,r)),s=i(Math.min(o,r));l.push(g(e.x,n,e.width,s-n,u,t,e.name))}}return l}};class p{constructor(e){this.rExtent=new u,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.version=0,this.config=e,this.buffer=new c(e.windowSize),this.getO=d(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>h(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new u)):(this.getR=h(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=d(e.stackBy),this.getGroup=d(e.groupBy),this.getColor=d(e.colorAccessor),this.getConnector=d(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new c(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n)}else for(const n of e.inserts){const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(n)),this.pushValueExtent(n),null!=e&&this.evictValueExtent(e)}return!0}pushValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.push(t[0]),this.rExtent.push(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].push(this.rAccessors[t](e));this.rExtent.push(this.getR(e))}else this.rExtent.push(this.getR(e))}evictValueExtent(e){if("timeline"===this.config.chartType){const t=this.getRawRange(e);t&&(this.rExtent.evict(t[0]),this.rExtent.evict(t[1]))}else if(this.rAccessors.length>1){for(let t=0;this.rAccessors.length>t;t++)this.rExtents[t].evict(this.rAccessors[t](e));this.rExtent.evict(this.getR(e))}else this.rExtent.evict(this.getR(e))}getRawRange(e){const t=this.config.rAccessor;if(!t)return null;const n="function"==typeof t?t(e):e[t];return Array.isArray(n)&&n.length>=2?[+n[0],+n[1]]:null}computeScene(e){const{config:n,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=o.toArray(),a=n.projection||"vertical",i=n.oExtent||this.resolveCategories(s),r=this.computeValueDomain(s,i),l="horizontal"===a,c=null!=n.barPadding?n.barPadding/("vertical"===a?e.width:e.height):.1;let u,h;if("radial"===a){u=t.scaleBand().domain(i).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,s=n.innerRadius||0;h=t.scaleLinear().domain(r).range([s,o])}else l?(u=t.scaleBand().domain(i).range([0,e.height]).padding(c),h=t.scaleLinear().domain(r).range([0,e.width])):(u=t.scaleBand().domain(i).range([0,e.width]).padding(c),h=t.scaleLinear().domain(r).range([e.height,0]));this.scales={o:u,r:h,projection:a},this.multiScales=this.rAccessors.length>1&&n.multiAxis?this.rAccessors.map((s,a)=>{const i=this.rExtents[a];i.dirty&&i.recalculate(o,s);let[r,c]=i.extent;r===1/0&&(r=0,c=1);const u=c-r,h=u>0?u*(n.extentPadding||.05):1;return r-=h,c+=h,r>0&&(r=0),l?t.scaleLinear().domain([r,c]).range([0,e.width]):t.scaleLinear().domain([r,c]).range([e.height,0])}):[];let d=s;this.rAccessors.length>1&&(d=s.flatMap(e=>this.rAccessors.map((t,n)=>Object.assign(Object.assign({},e),{__rIndex:n,__rValue:t(e),__rName:this.resolveRAccessorName(n)})))),this.columns=this.buildColumns(d,i,u,a,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=Array.isArray(this.config.rAccessor)?this.config.rAccessor[e]:this.config.rAccessor;return"string"==typeof t?t:"value"+e}resolveCategories(e){const t=Array.from(this.categories),n=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===n)return t;if(!1===n)return t;if("function"==typeof n)return t.sort(n);const o=new Map;for(const t of e){const e=this.getO(t);o.set(e,(o.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===n?(e,t)=>(o.get(e)||0)-(o.get(t)||0):(e,t)=>(o.get(t)||0)-(o.get(e)||0))}computeValueDomain(e,t){var n,o;const s=this.config.chartType,a=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===s||"donut"===s))return[0,1];let i=0,r=0;if("bar"===s&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),s=this.getR(o);0>s?n.set(e,(n.get(e)||0)+s):t.set(e,(t.get(e)||0)+s)}for(const e of t.values())e>r&&(r=e);for(const e of n.values())i>e&&(i=e)}else if("bar"===s){const t=new Map;for(const n of e){const e=this.getO(n),o=this.getR(n);t.set(e,(t.get(e)||0)+o)}for(const e of t.values())e>r&&(r=e),i>e&&(i=e)}else if("clusterbar"===s)for(const t of e){const e=this.getR(t);e>r&&(r=e),i>e&&(i=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(i=e),t!==-1/0&&(r=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(i=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(r=this.config.rExtent[1]));const l=r-i,c=l>0?l*a:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(i-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(r+=c),"bar"!==s&&"clusterbar"!==s||(i>0&&(i=0),0>r&&(r=0)),[i,r]}buildColumns(e,t,n,o,s){var a;const i={},r=new Map;for(const t of e){const e=this.getO(t);r.has(e)||r.set(e,[]),r.get(e).push(t)}let l=0;if("radial"===o)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==o){u=new Map;let e=0;for(const n of t){const t=r.get(n)||[];let o;o="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(n,o),e+=o}const a=("horizontal"===o?s.height:s.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*a)}let h=0,d=0;for(const e of t){const t=r.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),s=l>0?o/l:0;let c,g;u?(c=d,g=u.get(e)||n.bandwidth(),d+=g+n.padding()*n.step()):(c=null!==(a=n(e))&&void 0!==a?a:0,g=n.bandwidth()),i[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:s,pctStart:h},h+=s}return i}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getConnector:this.getConnector,getO:this.getO,multiScales:this.multiScales,rAccessors:this.rAccessors,resolvePieceStyle:(e,t)=>this.resolvePieceStyle(e,t),resolveSummaryStyle:(e,t)=>this.resolveSummaryStyle(e,t),getRawRange:e=>this.getRawRange(e)}}buildSceneNodes(e,t){if(!this.scales)return[];const n=this.getSceneContext(),o=y[this.config.chartType];let s=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:s,getO:a}=e;if(!s||!n)return[];const i=[],{projection:r}=n,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const n=s(t);if(!n)continue;let o,i;"point"===e.type?(o=e.x,i=e.y):(o=e.x+e.w/2,i=e.y+("vertical"===r?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:i,datum:t,category:a(t)})}const c=n.o.domain(),u=o.connectorStyle;for(const[e,t]of l)if(t.length>=2){t.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let n=0;t.length-1>n;n++){const o=t[n],s=t[n+1],a="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};i.push({type:"connector",x1:o.x,y1:o.y,x2:s.x,y2:s.y,style:a,datum:o.datum,group:e})}}return i}(n,s);s=[...e,...s]}return s}resolvePieceStyle(e,t){return"function"==typeof this.config.pieceStyle?this.config.pieceStyle(e,t):this.config.pieceStyle&&"object"==typeof this.config.pieceStyle?this.config.pieceStyle:this.config.barColors&&t?{fill:this.config.barColors[t]||"#007bff"}:t?{fill:this.getColorFromScheme(t)}:{fill:"#007bff"}}getColorFromScheme(e){this._colorSchemeMap||(this._colorSchemeMap=new Map);const t=this._colorSchemeMap.get(e);if(t)return t;const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],o=n[this._colorSchemeIndex%n.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,o),o}resolveSummaryStyle(e,t){return"function"==typeof this.config.summaryStyle?this.config.summaryStyle(e,t):this.config.summaryStyle&&"object"==typeof this.config.summaryStyle?this.config.summaryStyle:{fill:"#007bff",fillOpacity:.6,stroke:"#007bff",strokeWidth:1}}computeDecayOpacity(e,t){var n,o,s;const a=this.config.decay;if(!a||1>=t)return 1;const i=null!==(n=a.minOpacity)&&void 0!==n?n:.1,r=t-1-e;switch(a.type){case"linear":return i+(1-r/(t-1))*(1-i);case"exponential":{const e=null!==(o=a.halfLife)&&void 0!==o?o:t/2;return i+Math.pow(.5,r/e)*(1-i)}case"step":return(null!==(s=a.stepThreshold)&&void 0!==s?s:.5*t)>r?1:i;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const s=t.length;if(1>=s)return;const a=new Map;for(let e=0;t.length>e;e++)a.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=a.get(t.datum);if(null==e)continue;const i=this.computeDecayOpacity(e,s),r=null!==(o=null===(n=t.style)||void 0===n?void 0:n.opacity)&&void 0!==o?o:1;t.style=Object.assign(Object.assign({},t.style),{opacity:r*i})}}applyPulse(e,t){var n,o,s;if(!this.config.pulse||!this.timestampBuffer)return;const a="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,r=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(s=this.config.pulse.glowRadius)&&void 0!==s?s:4,c=new Map;for(let e=0;t.length>e;e++)c.set(t[e],e);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=c.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=a-n;i>o&&(t._pulseIntensity=1-o/i,t._pulseColor=r,t._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,o=this.timestampBuffer.peek();return null!=o&&n>t-o}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let n=0;this.scene.length>n;n++){const o=this.scene[n];if("point"===o.type)this.prevPositionMap.set("p:"+n,{x:o.x,y:o.y,r:o.r});else if("rect"===o.type){const s=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(s,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,s;if(!this.config.transition||0===this.prevPositionMap.size)return;const a=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let i=!1;for(let e=0;this.scene.length>e;e++){const a=this.scene[e];let r=null;if("point"===a.type?r="p:"+e:"rect"===a.type&&(r=`r:${a.group||""}:${null!==(n=null===(t=a.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!r)continue;const l=this.prevPositionMap.get(r);l&&("point"===a.type?l.x===a.x&&l.y===a.y||(a._targetX=a.x,a._targetY=a.y,a.x=l.x,a.y=l.y,i=!0):"rect"===a.type&&(l.x===a.x&&l.y===a.y&&l.w===a.w&&l.h===a.h||(a._targetX=a.x,a._targetY=a.y,a._targetW=a.w,a._targetH=a.h,a.x=l.x,a.y=l.y,a.w=null!==(o=l.w)&&void 0!==o?o:a.w,a.h=null!==(s=l.h)&&void 0!==s?s:a.h,i=!0)))}i&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:a})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const s=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),a="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?s:1-Math.pow(1-s,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.prevPositionMap.get("p:0");if(!t)continue;e.x=t.x+(e._targetX-t.x)*a,e.y=t.y+(e._targetY-t.y)*a}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=`r:${e.group||""}:${null!==(o=null===(n=e.datum)||void 0===n?void 0:n.category)&&void 0!==o?o:0}`,s=this.prevPositionMap.get(t);if(!s)continue;e.x=s.x+(e._targetX-s.x)*a,e.y=s.y+(e._targetY-s.y)*a,void 0!==s.w&&(e.w=s.w+(e._targetW-s.w)*a,e.h=s.h+(e._targetH-s.h)*a)}if(s>=1){for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e._targetX=void 0,e._targetY=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}return this.activeTransition=null,!1}return!0}getData(){return this.buffer.toArray()}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){e.colorScheme!==this.config.colorScheme&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),Object.assign(this.config,e)}}function v(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function b(e,t,n){const o=t-e.x,s=n-e.y,a=Math.sqrt(o*o+s*s);return a>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:a}}function x(e,t,n){const o=t-e.cx,s=n-e.cy,a=Math.sqrt(o*o+s*s);if(e.innerRadius>a||a>e.outerRadius)return null;let i=Math.atan2(s,o);0>i&&(i+=2*Math.PI);let r=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>r&&(r+=2*Math.PI),0>l&&(l+=2*Math.PI),!(r>l?i>=r||l>=i:i>=r&&l>=i))return null;const c=(e.startAngle+e.endAngle)/2,u=(e.innerRadius+e.outerRadius)/2;return{datum:e.datum,x:e.cx+Math.cos(c)*u,y:e.cy+Math.sin(c)*u,distance:0,category:e.category}}function w(e,t,n){const o=e.columnWidth/2,s=e.stats?Object.assign(Object.assign({},e.stats),{n:Array.isArray(e.datum)?e.datum.length:0,mean:(e.stats.q1+e.stats.median+e.stats.q3)/3}):void 0;if("vertical"===e.projection){if(!(e.x-o>t||t>e.x+o||Math.min(e.minPos,e.maxPos)>n||n>Math.max(e.minPos,e.maxPos)))return{datum:e.datum,x:e.x,y:e.medianPos,distance:0,category:e.category,stats:s}}else{const a=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||a>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:s}}return null}function k(e,t,n){if(!e.bounds)return null;const{x:o,y:s,width:a,height:i}=e.bounds;return o>t||t>o+a||s>n||n>s+i?null:{datum:e.datum,x:o+a/2,y:s+i/2,distance:0,category:e.category,stats:e.stats}}const A={fill:e=>i.createElement("rect",{style:e,width:20,height:20}),line:e=>i.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function E(e,t,n,o){let s;return s="function"==typeof n?n(e):(0,A[n])(o(e,t)),s}function M(e){const{legendGroups:t,customClickBehavior:n,title:o="Legend",width:s=100,height:a=20,orientation:r="vertical"}=e,l="vertical"===r?(({legendGroups:e,width:t,customClickBehavior:n})=>{let o=30;const s=[];return e.forEach((e,a)=>{o+=5,s.push(i.createElement("line",{key:"legend-top-line legend-symbol-"+a,stroke:"gray",x1:0,y1:o,x2:t,y2:o})),o+=10,e.label&&(o+=20,s.push(i.createElement("text",{key:"legend-text-"+a,y:o,className:"legend-group-label"},e.label)),o+=10),s.push(i.createElement("g",{key:"legend-group-"+a,className:"legend-item",transform:`translate(0,${o})`},((e,t)=>{const{type:n="fill",styleFn:o,items:s}=e,a=[];let r=0;return s.forEach((e,s)=>{const l=E(e,s,n,o);a.push(i.createElement("g",{key:"legend-item-"+s,transform:`translate(0,${r})`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},l,i.createElement("text",{y:15,x:30},e.label))),r+=25}),a})(e,n))),o+=25*e.items.length+10}),s})({legendGroups:t,width:s,customClickBehavior:n}):(({legendGroups:e,title:t,height:n,customClickBehavior:o})=>{let s=0;const a=[],r=!1===t?10:40;return e.forEach((t,l)=>{t.label&&(a.push(i.createElement("text",{key:"legend-text-"+l,transform:`translate(${s},${r}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),s+=20);const c=((e,t)=>{const{type:n="fill",styleFn:o,items:s}=e,a=[];let r=0;return s.forEach((e,s)=>{const l=E(e,s,n,o);a.push(i.createElement("g",{key:"legend-item-"+s,transform:`translate(${r},0)`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},l,i.createElement("text",{y:15,x:25},e.label))),r+=35,r+=8*e.label.length}),{items:a,offset:r}})(t,o);a.push(i.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${s},${r})`},c.items)),s+=c.offset+5,e[l+1]&&a.push(i.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:s,y1:r-10,x2:s,y2:n+r+10})),s+=15}),i.createElement("g",null,!1!==t&&i.createElement("line",{x1:0,x2:s+10,y1:r-10,y2:r-10,stroke:"gray",className:"title-neatline"}),a)})({legendGroups:t,title:o,height:a,customClickBehavior:n});return i.createElement("g",null,void 0!==o&&i.createElement("text",{className:"legend-title",y:20,x:"horizontal"===r?0:s/2,textAnchor:"horizontal"===r?"start":"middle"},o),l)}function S(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),s=e.split(/\s+/),a=[];let i="";for(const e of s)i&&i.length+1+e.length>o?(a.push(i),i=e):i=i?`${i} ${e}`:e;return i&&a.push(i),a}function O(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function j(e){const{x:t=0,y:n=0,dx:o,dy:s,nx:a,ny:r,note:l,connector:c,subject:u,type:h,color:d,className:g,disable:m,events:f={},"data-testid":y}=e,p=new Set(Array.isArray(m)?m:[]);let v=o||0,b=s||0;null!=a&&(v=a-t),null!=r&&(b=r-n);const x="string"==typeof h?h:"label";if("bracket"===x&&u&&0===v&&0===b)if(void 0!==u.width){v=u.width/2;const e=u.depth||30;b=e+(0>e?-5:5)}else if(void 0!==u.height){const e=u.depth||30;v=e+(0>e?-5:5),b=u.height/2}return i.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${t},${n})`,"data-testid":y},f),!p.has("connector")&&function(e,t,n,o,s,a){const r=[];let l=0,c=0;if("callout-circle"!==s&&"label"!==s||!(null==a?void 0:a.radius)){if("callout-rect"===s&&a){const n=a.width||0,o=a.height||0;if(n>0||o>0){const s=n/2,a=o/2,i=e-s,r=t-a;if(0!==i||0!==r){const e=Math.abs(i),t=Math.abs(r),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;l=s+i*d,c=a+r*d}}}else if("bracket"===s&&a){const e=a.width,t=a.height,n=a.depth||30;void 0!==e?(l=e/2,c=n):void 0!==t&&(l=n,c=t/2)}}else{const n=(a.radius||0)+(a.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);l=Math.cos(o)*n,c=Math.sin(o)*n}}if(Math.sqrt(Math.pow(e-l,2)+Math.pow(t-c,2))>.5&&(r.push(i.createElement("line",{key:"connector-line",x1:l,y1:c,x2:e,y2:t,stroke:o||"currentColor"})),"arrow"===(null==n?void 0:n.end))){const n=10,s=16/180*Math.PI,a=Math.atan2(t-c,e-l);r.push(i.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+n*Math.cos(a+s)},${c+n*Math.sin(a+s)}L${l+n*Math.cos(a-s)},${c+n*Math.sin(a-s)}Z`,fill:o||"currentColor",stroke:"none"}))}return i.createElement("g",{className:"annotation-connector"},r)}(v,b,c,d,x,u),!p.has("subject")&&function(e,t,n,o,s){var a;const r=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&r.push(i.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:n||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,o=(null==t?void 0:t.height)||0;(e>0||o>0)&&r.push(i.createElement("rect",{key:"subject-rect",width:e,height:o,fill:"none",stroke:n||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&r.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,a=s||0;if(void 0!==(null==t?void 0:t.x)){const o=(t.x||0)-e;r.push(i.createElement("line",{key:"threshold-line",x1:o,y1:(t.y1||0)-a,x2:o,y2:(t.y2||0)-a,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const o=(t.y||0)-a;r.push(i.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?r.push(i.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||r.push(i.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(a=null==t?void 0:t.width)&&void 0!==a?a:null==t?void 0:t.height;void 0!==e&&r.push(i.createElement("path",{key:"bracket-path",d:O((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:n||"currentColor"}));break}}return i.createElement("g",{className:"annotation-subject"},r)}(x,u,d,t,n),!p.has("note")&&function(e,t,n,o){if(!e)return i.createElement("g",{className:"annotation-note"});const{label:s,title:a,orientation:r,align:l,wrap:c=120,noWrap:u}=e;if(!s&&!a)return i.createElement("g",{className:"annotation-note"});let h=r;h||(h=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=l;d&&"dynamic"!==d||(d="topBottom"===h?0>t?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===h?"right"===d?g="end":"middle"===d&&(g="middle"):g=0>t?"end":"start";const m=16,f=a?u?[a]:S(a,c):[],y=s?u?[s]:S(s,c):[],p="leftRight"===h?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(i.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:o||void 0,textAnchor:g,fontWeight:"bold"},f.map((e,t)=>i.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e)))),v=f.length*m),y.length>0&&b.push(i.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:o||void 0,textAnchor:g,y:v},y.map((e,t)=>i.createElement("tspan",{key:t,x:p,dy:0===t?0:m},e))));let x=null;if((a||s)&&(0!==t||0!==n))if("topBottom"===h){const e=Math.min(c,120);let t=0,n=e;"end"===g?(t=-e,n=0):"middle"===g&&(t=-e/2,n=e/2),x=i.createElement("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"currentColor"})}else{const e=(f.length+y.length)*m+(y.length>0?m:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),x=i.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"currentColor"})}const w=Math.max(0,f.length+y.length-1)*m;let k=0;return"topBottom"===h?k=0>n?-(w+2):18:"leftRight"===h&&(k="middle"===d?-(w+m+(y.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>n?-(w+2):18),i.createElement("g",{className:"annotation-note",transform:`translate(${t},${n})`},i.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,d))}function L(e){var t,n;const{noteData:o}=e,{screenCoordinates:s}=o,a="string"==typeof o.type?o.type:"label",r=o.eventListeners||o.events||{};if(o.coordinates&&s){const e=o.nx||s[0][0]+(null!==(t=o.dx)&&void 0!==t?t:0),r=o.ny||s[0][1]+(null!==(n=o.dy)&&void 0!==n?n:0),l=s.map((t,n)=>{const s=Object.assign({},o,{note:0===n?o.note:{label:""},x:t[0],y:t[1],nx:e,ny:r});return i.createElement(j,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+n},s,{type:a}))});return i.createElement("g",null,l)}const l=o.note||{title:"none",label:o.label};return i.createElement(j,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${o.i}`,events:r},o,{type:a}))}function P(e,t){var n,o,s;const a=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(s=t.scales)||void 0===s?void 0:s.time;return a?null!=e.x?a(e.x):t.xAccessor&&null!=e[t.xAccessor]?a(e[t.xAccessor]):null:null}function _(e,t){var n,o,s;const a=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(s=t.scales)||void 0===s?void 0:s.value;return a?null!=e.y?a(e.y):t.yAccessor&&null!=e[t.yAccessor]?a(e[t.yAccessor]):null:null}function B(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function C(e){return Math.round(100*e)/100+""}function N(t){const{width:n,height:s,totalWidth:a,totalHeight:r,margin:l,scales:c,showAxes:u,oLabel:h,rLabel:d,oFormat:g,rFormat:m,showGrid:f,title:y,legend:p,foregroundGraphics:v,annotations:b,svgAnnotationRules:x,annotationFrame:w,xAccessor:k,yAccessor:A,annotationData:E,children:S}=t,O="radial"===(null==c?void 0:c.projection),j="horizontal"===(null==c?void 0:c.projection),N=e.useMemo(()=>u&&c&&!O?c.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=c.o(e))&&void 0!==t?t:0)+c.o.bandwidth()/2,label:g?g(e):e}}):[],[u,c,g,O]),H=e.useMemo(()=>u&&c&&!O?c.r.ticks(5).map(e=>({value:e,pixel:c.r(e),label:(m||C)(e)})):[],[u,c,m,O]),$=e.useMemo(()=>{if(!b||0===b.length)return null;const e=function(e,t,n){var s,a,r,l,c,u,h,d,g,m,f,y,p,v,b,x,w,k,A,E,M,S,O,j,C,N,H,$,D,R,z,T;switch(e.type){case"label":{let o=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,s=t.y}else o=P(e,n),s=_(e,n);return null==o||null==s?null:B(o,s,n)?i.createElement(L,{key:"ann-"+t,noteData:{x:o,y:s,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"label",connector:e.connector||{end:"arrow"},color:e.color}}):null}case"callout":{let o=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);if(!t)return null;o=t.x,s=t.y}else o=P(e,n),s=_(e,n);return null==o||null==s?null:B(o,s,n)?i.createElement(L,{key:"ann-"+t,noteData:{x:o,y:s,dx:e.dx||30,dy:e.dy||-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"callout-circle",subject:{radius:e.radius||12},connector:e.connector||{end:"arrow"},color:e.color}}):null}case"x-threshold":{const o=P(e,n);if(null==o)return null;const s=e.color||"#f97316";return i.createElement("g",{key:"ann-"+t},i.createElement("line",{x1:o,y1:0,x2:o,y2:n.height||0,stroke:s,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&i.createElement("text",{x:o+4,y:12,fill:s,fontSize:12,fontWeight:"bold"},e.label))}case"y-threshold":{const o=_(e,n);if(null==o)return null;const s=e.color||"#f97316";return i.createElement("g",{key:"ann-"+t},i.createElement("line",{x1:0,y1:o,x2:n.width||0,y2:o,stroke:s,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&i.createElement("text",{x:(n.width||0)-4,y:o-4,textAnchor:"end",fill:s,fontSize:12,fontWeight:"bold"},e.label))}case"enclose":{const s=(e.coordinates||[]).map(e=>({x:P(Object.assign(Object.assign({},e),{type:"point"}),n),y:_(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>s.length)return null;const a=o.packEnclose(s),r=e.padding||10;return i.createElement("g",{key:"ann-"+t},i.createElement("circle",{cx:a.x,cy:a.y,r:a.r+r,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&i.createElement("text",{x:a.x,y:a.y-a.r-r-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"rect-enclose":{const o=(e.coordinates||[]).map(e=>({x:P(Object.assign(Object.assign({},e),{type:"point"}),n),y:_(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>o.length)return null;const s=e.padding||10,a=o.map(e=>e.x),r=o.map(e=>e.y),l=Math.min(...a)-s,c=Math.max(...a)+s,u=Math.min(...r)-s,h=Math.max(...r)+s;return i.createElement("g",{key:"ann-"+t},i.createElement("rect",{x:l,y:u,width:c-l,height:h-u,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&i.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:e.color||"#666",fontSize:12},e.label))}case"highlight":{const o=n.data||[],s="function"==typeof e.filter?o.filter(e.filter):e.field&&null!=e.value?o.filter(t=>t[e.field]===e.value):[],a=e.style||{stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return i.createElement("g",{key:"ann-"+t},s.map((t,o)=>{const s=P(t,n),r=_(t,n);return null==s||null==r?null:i.createElement("circle",Object.assign({key:o,cx:s,cy:r,r:e.r||6},a))}))}case"bracket":{const o=P(e,n),s=_(e,n);return i.createElement(L,{key:"ann-"+t,noteData:{x:null!=o?o:0,y:null!=s?s:0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}})}case"trend":{const o=n.data||[];if(2>o.length)return null;const d=n.xAccessor||"x",g=n.yAccessor||"y",m=o.map(e=>[e[d],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>m.length)return null;const f=null!==(a=null===(s=n.scales)||void 0===s?void 0:s.x)&&void 0!==a?a:null===(r=n.scales)||void 0===r?void 0:r.time,y=null!==(c=null===(l=n.scales)||void 0===l?void 0:l.y)&&void 0!==c?c:null===(u=n.scales)||void 0===u?void 0:u.value;if(!f||!y)return null;const p=e.method||"linear";let v;if("loess"===p)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),s=o.map(e=>e[0]),a=o.map(e=>e[1]),i=Math.max(2,Math.ceil(t*n)),r=[];for(let e=0;n>e;e++){const t=s[e],o=s.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(i-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,g=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*s[e],d+=t*a[e],g+=t*s[e]*s[e],m+=t*s[e]*a[e])}if(0===u){r.push([t,a[e]]);continue}const f=u*g-h*h;if(1e-12>Math.abs(f))r.push([t,d/u]);else{const e=(u*m-h*d)/f;r.push([t,(d-e*h)/u+e*t])}}return r}(m,null!==(h=e.bandwidth)&&void 0!==h?h:.3);else{let t;try{const n=require("regression");t="polynomial"===p?n.polynomial(m,{order:e.order||2}):n.linear(m)}catch(e){return null}v=t.points}const b=v.map(([e,t])=>`${f(e)},${y(t)}`).join(" "),x=e.color||"#6366f1";return i.createElement("g",{key:"ann-"+t},i.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&i.createElement("text",{x:f(v[v.length-1][0])+4,y:y(v[v.length-1][1])-4,fill:x,fontSize:11},e.label))}case"band":{const o=null!==(g=null===(d=n.scales)||void 0===d?void 0:d.y)&&void 0!==g?g:null===(m=n.scales)||void 0===m?void 0:m.value,s=null!==(f=null==o?void 0:o(e.y0))&&void 0!==f?f:0,a=null!==(y=null==o?void 0:o(e.y1))&&void 0!==y?y:n.height||0;return i.createElement("g",{key:"ann-"+t},i.createElement("rect",{x:0,y:Math.min(s,a),width:n.width||0,height:Math.abs(a-s),fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity||.1}),e.label&&i.createElement("text",{x:(n.width||0)-4,y:Math.min(s,a)-4,textAnchor:"end",fill:e.color||"#6366f1",fontSize:11},e.label))}case"anomaly-band":{const o=n.data||[];if(2>o.length)return null;const s=n.yAccessor||"y",a=null!==(v=null===(p=n.scales)||void 0===p?void 0:p.x)&&void 0!==v?v:null===(b=n.scales)||void 0===b?void 0:b.time,r=null!==(w=null===(x=n.scales)||void 0===x?void 0:x.y)&&void 0!==w?w:null===(k=n.scales)||void 0===k?void 0:k.value;if(!a||!r)return null;const l=o.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,h=Math.sqrt(u),d=null!==(A=e.threshold)&&void 0!==A?A:2,g=c-d*h,m=!1!==e.showBand,f=e.fill||"#6366f1",y=null!==(E=e.fillOpacity)&&void 0!==E?E:.1,S=e.anomalyColor||"#ef4444",O=null!==(M=e.anomalyRadius)&&void 0!==M?M:6,j=r(c+d*h),L=r(g),B=o.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>d*h});return i.createElement("g",{key:"ann-"+t},m&&i.createElement("rect",{x:0,y:Math.min(j,L),width:n.width||0,height:Math.abs(L-j),fill:f,fillOpacity:y}),B.map((e,t)=>{const o=P(e,n),s=_(e,n);return null==o||null==s?null:i.createElement("circle",{key:t,cx:o,cy:s,r:O,fill:S,fillOpacity:.7,stroke:S,strokeWidth:1.5})}),e.label&&i.createElement("text",{x:(n.width||0)-4,y:Math.min(j,L)-4,textAnchor:"end",fill:f,fontSize:11},e.label))}case"forecast":{const o=n.data||[];if(3>o.length)return null;const s=n.xAccessor||"x",a=n.yAccessor||"y",r=null!==(O=null===(S=n.scales)||void 0===S?void 0:S.x)&&void 0!==O?O:null===(j=n.scales)||void 0===j?void 0:j.time,l=null!==(N=null===(C=n.scales)||void 0===C?void 0:C.y)&&void 0!==N?N:null===(H=n.scales)||void 0===H?void 0:H.value;if(!r||!l)return null;const c=o.map(e=>[e[s],e[a]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(e.method||"linear"))try{const t=require("regression").polynomial(c,{order:e.order||2}).equation;u=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}catch(e){return null}else{const e=c.length;let t=0,n=0,o=0,s=0;for(const[e,a]of c)t+=e,n+=a,o+=e*e,s+=e*a;const a=e*o-t*t;if(1e-12>Math.abs(a))return null;const i=(e*s-t*n)/a,r=(n-i*t)/e;u=e=>r+i*e}const h=c.length,d=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(d/Math.max(h-2,1)),m=c.reduce((e,t)=>e+t[0],0)/h,f=c.reduce((e,t)=>e+Math.pow(t[0]-m,2),0),y=null!==($=e.confidence)&&void 0!==$?$:.95,p=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,v=null!==(D=e.steps)&&void 0!==D?D:5,b=c[h-1][0],x=(b-c[0][0])/Math.max(h-1,1),w=[];for(let e=1;v>=e;e++)w.push(b+e*x);const k=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/h+(f>0?Math.pow(e-m,2)/f:0))*p;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${r(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${r(e.x)},${l(e.yLower)}`).join(" L")} Z`,E=k.map(e=>`${r(e.x)},${l(e.yCenter)}`).join(" "),M=`${r(b)},${l(u(b))}`,L=e.strokeColor||"#6366f1";return i.createElement("g",{key:"ann-"+t},i.createElement("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:null!==(R=e.fillOpacity)&&void 0!==R?R:.15,stroke:"none"}),i.createElement("polyline",{points:`${M} ${E}`,fill:"none",stroke:L,strokeWidth:null!==(z=e.strokeWidth)&&void 0!==z?z:2,strokeDasharray:null!==(T=e.strokeDasharray)&&void 0!==T?T:"6,3"}),e.label&&k.length>0&&i.createElement("text",{x:r(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:L,fontSize:11},e.label))}default:return null}},t={scales:c?{x:c.r,y:c.r,time:c.r,value:c.r}:null,timeAxis:"x",xAccessor:k,yAccessor:A,width:n,height:s,data:E,frameType:"ordinal"};return b.map((n,o)=>{if(x){const s=x(n,o,t);return null!=s?s:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[b,x,n,s,w,k,A,E]);return u||y||p||v||$&&$.length>0||f||S?i.createElement("svg",{width:a,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},i.createElement("g",{transform:`translate(${l.left},${l.top})`},f&&c&&!O&&i.createElement("g",{className:"ordinal-grid"},H.map((e,t)=>i.createElement("line",{key:"grid-"+t,x1:j?e.pixel:0,y1:j?0:e.pixel,x2:j?e.pixel:n,y2:j?s:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),u&&c&&!O&&i.createElement("g",{className:"ordinal-axes"},j?i.createElement(i.Fragment,null,i.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>i.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},i.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),i.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&i.createElement("text",{x:15-l.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${s/2})`,style:{userSelect:"none"}},h),i.createElement("line",{x1:0,y1:s,x2:n,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.map((e,t)=>i.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${s})`},i.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),i.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),d&&i.createElement("text",{x:n/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},d)):i.createElement(i.Fragment,null,i.createElement("line",{x1:0,y1:s,x2:n,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),N.map((e,t)=>i.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${s})`},i.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),i.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),h&&i.createElement("text",{x:n/2,y:s+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},h),i.createElement("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),H.map((e,t)=>i.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},i.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),i.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},e.label))),d&&i.createElement("text",{x:15-l.left,y:s/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-l.left}, ${s/2})`,style:{userSelect:"none"}},d))),$,v,S),y&&i.createElement("text",{x:a/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof y?y:null),p&&i.createElement("g",{transform:`translate(${a-l.right+10}, ${l.top})`},"object"==typeof(D=p)&&null!==D&&!i.isValidElement(D)&&"legendGroups"in D?i.createElement(M,{legendGroups:p.legendGroups,title:"",width:100}):p)):null;var D}const H=(e,t,n,o)=>{const s=t.filter(e=>"rect"===e.type);for(const t of s)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?$(e,t):(e.fillStyle=t.style.fill||"#007bff",e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))),t._pulseIntensity&&t._pulseIntensity>0&&(e.globalAlpha=.3*t._pulseIntensity,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h)),e.globalAlpha=1};function $(e,t){const n=t.style.icon,o=t.style.iconPadding||2,s=Math.min(t.w,t.w)-o;if(0>=s)return;const a=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),a){const a=s+o,i=t.x+(t.w-s)/2;for(let o=t.y+t.h-s;o>=t.y-s;o-=a)e.drawImage(n,i,o,s,s)}else{const a=s+o,i=t.y+(t.h-s)/2;for(let o=t.x;t.x+t.w>o;o+=a)e.drawImage(n,o,i,s,s)}e.restore()}const D=(e,t,n,o)=>{var s,a;const i=t.filter(e=>"point"===e.type);for(const t of i){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(s=t.style.opacity)&&void 0!==s?s:t.style.fillOpacity;if(null!=n&&(e.globalAlpha=n),e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(a=t._pulseGlowRadius)&&void 0!==a?a:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.x,t.y,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.6*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},R=(e,t,n,o)=>{const s=t.filter(e=>"wedge"===e.type);for(const t of s)e.beginPath(),t.innerRadius>0?(e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerRadius,t.endAngle,t.startAngle,!0)):(e.moveTo(t.cx,t.cy),e.arc(t.cx,t.cy,t.outerRadius,t.startAngle,t.endAngle)),e.closePath(),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),null!=t.style.fillOpacity&&(e.globalAlpha=t.style.fillOpacity),e.fillStyle=t.style.fill||"#007bff",e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1},z=(e,t,n,o)=>{var s,a;const i=t.filter(e=>"violin"===e.type);for(const t of i){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(a=null!==(s=t.style.fillOpacity)&&void 0!==s?s:t.style.opacity)&&void 0!==a?a:.6,e.fillStyle=t.style.fill||"#007bff",e.fill(n),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(n)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const n=t.iqrLine.centerPos,o=!1!==t.iqrLine.isVertical;e.beginPath(),o?(e.moveTo(n,t.iqrLine.q1Pos),e.lineTo(n,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,n),e.lineTo(t.iqrLine.q3Pos,n)),e.stroke(),e.beginPath(),o?e.arc(n,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,n,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},T=(e,t,n,o)=>{var s,a,i;const r=t.filter(e=>"connector"===e.type);if(0===r.length)return;const l=new Map;for(const e of r){const t=e.group||"_default";l.has(t)||l.set(t,[]),l.get(t).push(e)}for(const[,t]of l){if(0===t.length)continue;const n=t[0].style;if(n.fill&&"none"!==n.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const n of t)e.lineTo(n.x2,n.y2);e.closePath(),e.globalAlpha=null!==(a=null!==(s=n.fillOpacity)&&void 0!==s?s:n.opacity)&&void 0!==a?a:.3,e.fillStyle=n.fill,e.fill(),e.globalAlpha=1}for(const n of t)e.beginPath(),e.moveTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.strokeStyle=n.style.stroke||n.style.fill||"#999",e.lineWidth=n.style.strokeWidth||1,e.globalAlpha=null!==(i=n.style.opacity)&&void 0!==i?i:.5,e.stroke(),e.globalAlpha=1}},I=e=>[T,...e],W={bar:I([H]),clusterbar:I([H]),point:I([D]),swarm:I([D]),pie:[R],donut:[R],boxplot:I([(e,t,n,o)=>{var s,a;const i=t.filter(e=>"boxplot"===e.type);for(const t of i){const n=t.columnWidth/2,o="vertical"===t.projection,i=t.style.fill||"#007bff",r=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(a=null!==(s=t.style.fillOpacity)&&void 0!==s?s:t.style.opacity)&&void 0!==a?a:.6;if(e.save(),e.strokeStyle=r,e.lineWidth=l,e.beginPath(),o?(e.moveTo(t.x,t.minPos),e.lineTo(t.x,t.maxPos)):(e.moveTo(t.minPos,t.y),e.lineTo(t.maxPos,t.y)),e.stroke(),e.beginPath(),o?(e.moveTo(t.x-.4*n,t.minPos),e.lineTo(t.x+.4*n,t.minPos),e.moveTo(t.x-.4*n,t.maxPos),e.lineTo(t.x+.4*n,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*n),e.lineTo(t.minPos,t.y+.4*n),e.moveTo(t.maxPos,t.y-.4*n),e.lineTo(t.maxPos,t.y+.4*n)),e.stroke(),e.globalAlpha=c,e.fillStyle=i,o){const o=Math.min(t.q1Pos,t.q3Pos),s=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,s),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,s)}else{const o=Math.min(t.q1Pos,t.q3Pos),s=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,s,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,s,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),o?(e.moveTo(t.x-n,t.medianPos),e.lineTo(t.x+n,t.medianPos)):(e.moveTo(t.medianPos,t.y-n),e.lineTo(t.medianPos,t.y+n)),e.stroke(),e.restore()}},D]),violin:I([z]),histogram:I([H]),ridgeline:I([z]),timeline:I([H])},q={top:50,right:40,bottom:60,left:70},G={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:"4px",fontSize:"13px",lineHeight:"1.4",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function F({hover:e}){var t,n,o,s;const a=e.data||{},r=e.stats,l=e.category;if(Array.isArray(a)){const e=l||(null===(t=a[0])||void 0===t?void 0:t.category)||"";if(r)return i.createElement("div",{className:"semiotic-tooltip",style:G},e&&i.createElement("div",{style:{fontWeight:"bold"}},e+""),i.createElement("div",null,"n = ",r.n),i.createElement("div",null,"Min: ",r.min.toLocaleString()),i.createElement("div",null,"Q1: ",r.q1.toLocaleString()),i.createElement("div",null,"Median: ",r.median.toLocaleString()),i.createElement("div",null,"Q3: ",r.q3.toLocaleString()),i.createElement("div",null,"Max: ",r.max.toLocaleString()),i.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const n=a.length;return i.createElement("div",{className:"semiotic-tooltip",style:G},e&&i.createElement("div",{style:{fontWeight:"bold"}},e+""),i.createElement("div",null,n," items"))}if(null!=a.bin&&null!=a.count){const e=a.range||[];return i.createElement("div",{className:"semiotic-tooltip",style:G},a.category&&i.createElement("div",{style:{fontWeight:"bold"}},a.category+""),i.createElement("div",null,"Count: ",a.count),2===e.length&&i.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const c=a.category||a.name||a.group||a.__rName||"",u=null!==(s=null!==(o=null!==(n=a.value)&&void 0!==n?n:a.__rValue)&&void 0!==o?o:a.pct)&&void 0!==s?s:"";if(!c&&""===u){const e=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return i.createElement("div",{className:"semiotic-tooltip",style:G},e.map(([e,t])=>i.createElement("div",{key:e},i.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return i.createElement("div",{className:"semiotic-tooltip",style:G},c&&i.createElement("div",{style:{fontWeight:"bold"}},c+""),""!==u&&i.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const V=e.forwardRef(function(t,n){var o;const{chartType:s,runtimeMode:a,data:r,oAccessor:c="category",rAccessor:u="value",colorAccessor:h,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:f,valueAccessor:y,categoryAccessor:A,projection:E="vertical",size:M=[600,400],margin:S,barPadding:O,innerRadius:j,normalize:L,startAngle:P,dynamicColumnWidth:_,bins:B,showOutliers:C,showIQR:H,amplitude:$,connectorAccessor:D,connectorStyle:R,rExtent:z,oExtent:T,extentPadding:I=.05,oSort:G,windowMode:V="sliding",windowSize:X=200,pieceStyle:Y,summaryStyle:Q,colorScheme:Z,barColors:U,showAxes:J=!0,oLabel:K,rLabel:ee,oFormat:te,rFormat:ne,enableHover:oe=!0,hoverAnnotation:se,tooltipContent:ae,customHoverBehavior:ie,annotations:re,svgAnnotationRules:le,showGrid:ce=!1,legend:ue,backgroundGraphics:he,foregroundGraphics:de,title:ge,className:me,background:fe,centerContent:ye,decay:pe,pulse:ve,transition:be,staleness:xe}=t,we=e.useMemo(()=>Object.assign(Object.assign({},q),S),[S]),ke=M[0]-we.left-we.right,Ae=M[1]-we.top-we.bottom,Ee=e.useRef(null),Me=e.useRef(!0),Se=e.useRef(0),Oe=e.useRef(null),je=e.useRef(()=>{}),[Le,Pe]=e.useState(null),[_e,Be]=e.useState(null),[Ce,Ne]=e.useState(0),[He,$e]=e.useState(!1),De=oe||se,Re="streaming"===a,ze=e.useMemo(()=>({chartType:s,runtimeMode:Re?"streaming":"bounded",windowSize:X,windowMode:V,extentPadding:I,projection:E,oAccessor:Re?void 0:c,rAccessor:Re?void 0:u,colorAccessor:h,stackBy:d,groupBy:g,multiAxis:m,timeAccessor:Re?f:void 0,valueAccessor:Re?y||("string"==typeof u||"function"==typeof u?u:void 0):void 0,categoryAccessor:Re?A||c:void 0,rExtent:z,oExtent:T,barPadding:O,innerRadius:j,normalize:L,startAngle:P,dynamicColumnWidth:_,bins:B,showOutliers:C,showIQR:H,amplitude:$,connectorAccessor:D,connectorStyle:R,oSort:G,pieceStyle:Y,summaryStyle:Q,colorScheme:Z,barColors:U,decay:pe,pulse:ve,transition:be,staleness:xe}),[s,X,V,I,E,c,u,h,d,g,m,f,y,A,z,T,O,j,L,P,_,B,C,H,$,D,R,G,Y,Q,Z,U,pe,ve,be,xe,Re]),Te=e.useRef(null);Te.current||(Te.current=new p(ze));const Ie=e.useCallback(()=>{Se.current||(Se.current=requestAnimationFrame(()=>je.current()))},[]);e.useEffect(()=>{var e;null===(e=Te.current)||void 0===e||e.updateConfig(ze),Me.current=!0,Ie()},[ze,Ie]);const We=e.useRef(null);We.current||(We.current=new l(e=>{const t=Te.current;t&&t.ingest(e)&&(Me.current=!0,Ie())}));const qe=e.useCallback(e=>{var t;null===(t=We.current)||void 0===t||t.push(e)},[]),Ge=e.useCallback(e=>{var t;null===(t=We.current)||void 0===t||t.pushMany(e)},[]),Fe=e.useCallback(()=>{var e,t;null===(e=We.current)||void 0===e||e.clear(),null===(t=Te.current)||void 0===t||t.clear(),Me.current=!0,Ie()},[Ie]);e.useImperativeHandle(n,()=>({push:qe,pushMany:Ge,clear:Fe,getData:()=>{var e,t;return null!==(t=null===(e=Te.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Te.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[qe,Ge,Fe]),e.useEffect(()=>{var e;r&&(null===(e=We.current)||void 0===e||e.setBoundedData(r))},[r]);const Ve=e.useRef(()=>{}),Xe=e.useRef(()=>{});Ve.current=e=>{if(!De)return;const t=Ee.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-we.left,s=e.clientY-n.top-we.top;if(0>o||o>ke||0>s||s>Ae)return void(Oe.current&&(Oe.current=null,Pe(null),ie&&ie(null),Ie()));const a=Te.current;if(!a||0===a.scene.length)return;const i="radial"===E,r=function(e,t,n,o=30){let s=null;for(const a of e){let e=null;switch(a.type){case"rect":e=v(a,t,n);break;case"point":e=b(a,t,n);break;case"wedge":e=x(a,t,n);break;case"boxplot":e=w(a,t,n);break;case"violin":e=k(a,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(a.scene,i?o-ke/2:o,i?s-Ae/2:s);if(!r)return void(Oe.current&&(Oe.current=null,Pe(null),ie&&ie(null),Ie()));const l=Object.assign(Object.assign({data:r.datum,time:r.x,value:r.y,x:r.x,y:r.y},r.stats&&{stats:r.stats}),r.category&&{category:r.category});Oe.current=l,Pe(l),ie&&ie(l),Ie()},Xe.current=()=>{Oe.current&&(Oe.current=null,Pe(null),ie&&ie(null),Ie())};const Ye=e.useCallback(e=>Ve.current(e),[]),Qe=e.useCallback(()=>Xe.current(),[]);je.current=()=>{var e,t;Se.current=0;const n=Ee.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const a=Te.current;if(!a)return;const i="undefined"!=typeof performance?performance.now():Date.now(),r=a.advanceTransition(i),l=Me.current;l&&!r&&(a.computeScene({width:ke,height:Ae}),Me.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=M[0]*c,n.height=M[1]*c,n.style.width=M[0]+"px",n.style.height=M[1]+"px",o.scale(c,c),o.clearRect(0,0,M[0],M[1]);const u=null!==(e=null==xe?void 0:xe.threshold)&&void 0!==e?e:5e3,h=xe&&a.lastIngestTime>0&&i-a.lastIngestTime>u;h&&(o.globalAlpha=null!==(t=null==xe?void 0:xe.dimOpacity)&&void 0!==t?t:.5);const d=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=fe||(d&&"transparent"!==d?d:null);g&&(o.fillStyle=g,o.fillRect(0,0,M[0],M[1]));const m="radial"===E;m?(o.save(),o.translate(we.left+ke/2,we.top+Ae/2)):o.translate(we.left,we.top);const f=W[s]||[],y={width:ke,height:Ae};for(const e of f)e(o,a.scene,a.scales,y);m&&o.restore(),h&&(o.globalAlpha=1),l&&a.scales&&(Be(a.scales),Ne(e=>e+1)),(null==xe?void 0:xe.showBadge)&&$e(!!h),(r||a.hasActivePulses)&&(Se.current=requestAnimationFrame(()=>je.current()))},e.useEffect(()=>(Ie(),()=>{Se.current&&cancelAnimationFrame(Se.current)}),[Ie]),e.useEffect(()=>{Me.current=!0,Ie()},[s,ke,Ae,J,fe,Ie]),e.useEffect(()=>{if(!xe)return;const e=setInterval(()=>{var e;const t=Te.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=xe.threshold)&&void 0!==e?e:5e3,s=n-t.lastIngestTime>o;s!==He&&($e(s),Me.current=!0,Ie())},1e3);return()=>clearInterval(e)},[xe,He,Ie]);const Ze=De&&Le?ae?ae(Le):i.createElement(F,{hover:Le}):null,Ue="radial"===E,Je=Le?Ue?Le.x+ke/2:Le.x:0,Ke=Le?Ue?Le.y+Ae/2:Le.y:0,et=Ze?i.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:we.left+Je,top:we.top+Ke,transform:`translate(${Je>.7*ke?"calc(-100% - 12px)":"12px"}, ${.3*Ae>Ke?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Ze):null;return i.createElement("div",{className:"stream-ordinal-frame"+(me?" "+me:""),role:"img","aria-label":"string"==typeof ge?ge:"Ordinal chart",style:{position:"relative",width:M[0],height:M[1]},onMouseMove:De?Ye:void 0,onMouseLeave:De?Qe:void 0},he&&i.createElement("svg",{style:{position:"absolute",top:0,left:0,width:M[0],height:M[1],pointerEvents:"none"}},i.createElement("g",{transform:`translate(${we.left},${we.top})`},he)),i.createElement("canvas",{ref:Ee,style:{position:"absolute",top:0,left:0,width:M[0],height:M[1]}}),i.createElement(N,{width:ke,height:Ae,totalWidth:M[0],totalHeight:M[1],margin:we,scales:_e,showAxes:J,oLabel:K,rLabel:ee,oFormat:te,rFormat:ne,showGrid:ce,title:ge,legend:ue,foregroundGraphics:de,annotations:re,svgAnnotationRules:le,annotationFrame:Ce,xAccessor:"string"==typeof c?c:void 0,yAccessor:"string"==typeof u?u:void 0,annotationData:null===(o=Te.current)||void 0===o?void 0:o.getData()}),ye&&"radial"===E&&i.createElement("div",{style:{position:"absolute",left:we.left+ke/2,top:we.top+Ae/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ye),(null==xe?void 0:xe.showBadge)&&i.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===xe.badgePosition?{top:4,left:4}:"bottom-left"===xe.badgePosition?{bottom:4,left:4}:"bottom-right"===xe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:He?"#dc3545":"#28a745",color:"white"})},He?"STALE":"LIVE"),et)});V.displayName="StreamOrdinalFrame";const X={category10:s.schemeCategory10,tableau10:s.schemeTableau10,set3:s.schemeSet3,blues:s.interpolateBlues,reds:s.interpolateReds,greens:s.interpolateGreens,oranges:s.interpolateOranges,purples:s.interpolatePurples,viridis:s.interpolateViridis,plasma:s.interpolatePlasma},Y=s.schemeCategory10;function Q(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Y[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o+""))%Y.length]}function Z(e,t,n){return t?o=>{var s,a;const i=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(i,n.selectedStyle):(i.fillOpacity=null!==(s=null==n?void 0:n.unselectedOpacity)&&void 0!==s?s:.2,i.strokeOpacity=null!==(a=null==n?void 0:n.unselectedOpacity)&&void 0!==a?a:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(i,n.unselectedStyle))),i}:e}function U(t){const n=e.createContext(null),o=J(t);return[function({children:o}){const s=e.useMemo(()=>J(t),[]);return i.createElement(n.Provider,{value:s,children:o})},t=>{var s;const a=null!==(s=e.useContext(n))&&void 0!==s?s:o;return function(t,n){const[o,s]=e.useState(n);return e.useLayoutEffect(()=>t(()=>s(n)),[t]),o}(a.subscribe,()=>t(a.getState()))}]}function J(e){const t=new EventTarget;let n=e(function(e){n=Object.assign(Object.assign({},n),e(n)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>n,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}function K(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,s]=o.range;t.push(t=>{const o=t[n];return o>=e&&s>=o})}return e=>t.every(t=>t(e))}function ee(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[te,ne]=U(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),s=ee(o,t),a=new Map(s.clauses);return a.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},s),{clauses:a})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const s=new Map(e.selections),a=new Map(o.clauses);return a.delete(n),s.set(t,Object.assign(Object.assign({},o),{clauses:a})),{selections:s}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),s=ee(o,t);return o.set(t,Object.assign(Object.assign({},s),{resolution:n})),{selections:o}})},clearSelection(t){e(e=>{const n=new Map(e.selections),o=n.get(t);return o&&n.set(t,Object.assign(Object.assign({},o),{clauses:new Map})),{selections:n}})}}));function oe(t){const n=e.useId(),o=t.clientId||n,{name:s}=t,a=ne(e=>e.selections.get(s)),i=ne(e=>e.setClause),r=ne(e=>e.clearClause),l=e.useMemo(()=>!!a&&a.clauses.size>0,[a]);return{predicate:e.useMemo(()=>a&&0!==a.clauses.size?function(e,t){const n=[];for(const[o,s]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(K(s));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(a,o):()=>!0,[a,o]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};i(s,{clientId:o,type:"point",fields:t})},[o,s,i]),selectInterval:e.useCallback(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};i(s,{clientId:o,type:"interval",fields:t})},[o,s,i]),clear:e.useCallback(()=>{r(s,o)},[r,s,o]),clientId:o}}const[se,ae]=U(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}})),ie="#007bff";function re(n,o,s="category10"){return e.useMemo(()=>{if(o&&"function"!=typeof o)return function(e,n,o="category10"){const s=Array.from(new Set(e.map(e=>e[n]))),a=s.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return t.scaleOrdinal().domain(s).range(o).unknown("#999");const i=X[o]||X.category10;if(a&&"function"==typeof i)return e=>i(Number(e)/Math.max(...s.map(Number)));{const e=Array.isArray(i)?i:Y;return t.scaleOrdinal().domain(s).range(e).unknown("#999")}}(n,o,s)},[n,o,s])}function le(t,n,o){return e.useMemo(()=>{if(!n)return t;const e=[...t];if("function"==typeof n)return e.sort(n);const s="function"==typeof(a=o)?a:e=>e[a];var a;return e.sort("asc"===n?(e,t)=>s(e)-s(t):(e,t)=>s(t)-s(e))},[t,n,o])}function ce({selection:t,linkedHover:n,fallbackFields:o=[],unwrapData:s=!1,onObservation:a,chartType:i,chartId:r}){const l=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields}:null}(n,o),c=oe({name:(null==t?void 0:t.name)||"__unused__"}),u=function(t){const n=t.name||"hover",{fields:o}=t,{predicate:s,isActive:a,selectPoints:i,clear:r}=oe({name:n});return{onHover:e.useCallback(e=>{if(!e)return void r();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Object.keys(t).length>0&&i(t)},[o,i,r]),predicate:s,isActive:a}}({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||[]}),h=ae(e=>e.pushObservation);return{activeSelectionHook:t?{isActive:c.isActive,predicate:c.predicate}:null,customHoverBehavior:e.useCallback(e=>{var t,o;if(n){let t=e&&(e.data||e.datum)||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}if(a||h){const n={timestamp:Date.now(),chartType:i||"unknown",chartId:r};if(e){let s=e.data||e.datum||e;Array.isArray(s)&&(s=s[0]);const i=Object.assign(Object.assign({},n),{type:"hover",datum:s||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});a&&a(i),h&&h(i)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});a&&a(e),h&&h(e)}}},[n,u,a,i,r,h]),customClickBehavior:e.useCallback(e=>{var t,n;if(a||h){const o={timestamp:Date.now(),chartType:i||"unknown",chartId:r};if(e){let s=e.data||e.datum||e;Array.isArray(s)&&(s=s[0]);const i=Object.assign(Object.assign({},o),{type:"click",datum:s||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});a&&a(i),h&&h(i)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});a&&a(e),h&&h(e)}}},[a,h,i,r])}}function ue({data:t,colorBy:n,colorScale:o,showLegend:s,userMargin:a,defaults:i={top:50,bottom:60,left:70,right:40}}){const r=void 0!==s?s:!!n,l=e.useMemo(()=>{if(r&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:s,strokeWidth:a}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==s&&(t.stroke=s),void 0!==a&&(t.strokeWidth=a),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(s=>{const a=e.find("function"==typeof t?e=>t(e)===s:e=>e[t]===s),i=a?o(a,t,n):n?n(s):"#000000";return{label:s+"",color:i}}),label:""}]}}({data:t,colorBy:n,colorScale:o,getColor:Q})},[r,n,t,o]),c=e.useMemo(()=>{const e=Object.assign(Object.assign({},i),a);return l&&120>e.right&&(e.right=120),e},[i,a,l]);return{legend:l,margin:c}}const he={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function de(e,t,n){var o,s,a,i,r,l;const c=he[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:c.width,height:null!==(s=t.height)&&void 0!==s?s:c.height,showAxes:c.showAxes,showGrid:null!==(a=t.showGrid)&&void 0!==a?a:c.showGrid,enableHover:null!==(i=t.enableHover)&&void 0!==i?i:!!t.linkedHover||c.enableHover,showLegend:null!==(r=t.showLegend)&&void 0!==r?r:c.showLegend,showLabels:null!==(l=t.showLabels)&&void 0!==l?l:c.showLabels,title:u?void 0:t.title,xLabel:u?void 0:t.xLabel,yLabel:u?void 0:t.yLabel,categoryLabel:u?void 0:t.categoryLabel,valueLabel:u?void 0:t.valueLabel,marginDefaults:c.marginDefaults}}const ge={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"8px 12px",borderRadius:"4px",fontSize:"14px",lineHeight:"1.5",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function me(e,t){return"function"==typeof t?t(e):e[t]}function fe(e,t){return t?t(e):null==e?"":"number"==typeof e?e.toLocaleString():e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function ye(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||function(e={}){const{fields:t,title:n,format:o,style:s={},className:a=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let r;const l=[];if(n){const t=me(e,n);r=fe(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,s,a;"string"==typeof t?(n=t,s=t,a=o):(n=t.label,s=t.accessor||t.key||"",a=t.format||o);const i=me(e,s);l.push({label:n,value:fe(i,a)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){r=fe(e[n],o);break}if(!r){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(r=fe(e[t[0]],o))}}const c=Object.assign(Object.assign({},ge),s);return i.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},r&&i.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},r),l.map((e,t)=>i.createElement("div",{key:t,style:{marginTop:0===t&&r?"4px":0}},e.label&&i.createElement("span",null,e.label,": "),e.value)))}}(e)))}function pe(e){return null==e?"–":"number"==typeof e?e.toLocaleString():e instanceof Date?e.toLocaleDateString():e+""}function ve(e,t){return"function"==typeof t?t(e):e[t]}function be({categoryAccessor:e,valueAccessor:t,groupAccessor:n,groupLabel:o,pieData:s=!1}){return a=>{var r;const l=s?(null===(r=a.data)||void 0===r?void 0:r[0])||a.data||a:a.data||a,c=ve(l,e),u=ve(l,t),h=n?ve(l,n):void 0;return i.createElement("div",{className:"semiotic-tooltip",style:ge},i.createElement("div",{style:{fontWeight:"bold"}},pe(c)),i.createElement("div",{style:{marginTop:4}},pe(u)),null!=h&&i.createElement("div",{style:{marginTop:2,opacity:.8}},o||("string"==typeof(d=n)?d:"value"),": ",pe(h)));var d}}function xe({componentName:e,message:t,width:n,height:o}){return i.createElement("div",{role:"alert",style:{width:n,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"}},i.createElement("div",{style:{textAlign:"center",maxWidth:400}},i.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),i.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}function we({data:e,accessors:t,requiredProps:n}){if(n)for(const[e,t]of Object.entries(n))if(null==t)return e+" is required. Provide a field name or function.";if(!e||!Array.isArray(e)||0===e.length)return"No data provided. Pass a non-empty array to the data prop.";if(t)for(const n of function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(e))if(n&&"object"==typeof n)for(const[e,o]of Object.entries(t))if(o&&"string"==typeof o&&!(o in n))return`${e} "${o}" not found in data. Available fields: ${Object.keys(n).join(", ")}.`;return null}function ke(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",sort:g=!1,barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],{activeSelectionHook:_,customHoverBehavior:B}=ce({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),C=le(P,g,l),N=re(P,h,d),H=e.useMemo(()=>e=>{const t={};return t.fill=h?Q(e,h,N):ie,t},[h,N]),$=e.useMemo(()=>Z(H,_,v),[H,_,v]),{legend:D,margin:R}=ue({data:C,colorBy:h,colorScale:N,showLegend:S,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>be({categoryAccessor:r,valueAccessor:l,groupAccessor:h&&h!==r?h:void 0,groupLabel:"string"==typeof h?h:"group"}),[r,l,h]),T=we({componentName:"BarChart",data:P,accessors:{categoryAccessor:r,valueAccessor:l}});if(T)return i.createElement(xe,{componentName:"BarChart",message:T,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:C,oAccessor:r,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:$,size:[k,A],margin:R,barPadding:m,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:u,showGrid:M,oSort:g},D&&{legend:D}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?ye(f):z}),(b||x)&&{customHoverBehavior:B}),y&&y.length>0&&{annotations:y}),p);return i.createElement(V,Object.assign({},I))}function Ae(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:h,colorBy:d,colorScheme:g="category10",normalize:m=!1,barPadding:f=5,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=n.width,E=n.height,M=n.enableHover,S=n.showGrid,O=n.showLegend,j=n.title,L=n.categoryLabel,P=n.valueLabel,_=o||[],B=d||l,{activeSelectionHook:C,customHoverBehavior:N}=ce({selection:b,linkedHover:x,fallbackFields:B?["string"==typeof B?B:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),H=re(_,B,g),$=e.useMemo(()=>e=>B?{fill:Q(e,B,H)}:{fill:ie},[B,H]),D=e.useMemo(()=>Z($,C,b),[$,C,b]),{legend:R,margin:z}=ue({data:_,colorBy:B,colorScale:H,showLegend:O,userMargin:s,defaults:n.marginDefaults}),T=e.useMemo(()=>be({categoryAccessor:l,valueAccessor:c,groupAccessor:r}),[l,r,c]),I=we({componentName:"StackedBarChart",data:_,accessors:{categoryAccessor:r,valueAccessor:c},requiredProps:{stackBy:l}});if(I)return i.createElement(xe,{componentName:"StackedBarChart",message:I,width:A,height:E});const W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:_,oAccessor:r,rAccessor:c,stackBy:l,normalize:m,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:D,size:[A,E],margin:z,barPadding:f,enableHover:M,showAxes:n.showAxes,oLabel:L,rLabel:P,rFormat:h,showGrid:S},R&&{legend:R}),j&&{title:j}),a&&{className:a}),{tooltipContent:y?ye(y):T}),(x||w)&&{customHoverBehavior:N}),p&&p.length>0&&{annotations:p}),v);return i.createElement(V,Object.assign({},W))}function Ee(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:h,colorBy:d,colorScheme:g="category10",barPadding:m=5,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],_=d||l,{activeSelectionHook:B,customHoverBehavior:C}=ce({selection:v,linkedHover:b,fallbackFields:_?["string"==typeof _?_:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),N=re(P,_,g),H=e.useMemo(()=>e=>_?{fill:Q(e,_,N)}:{fill:ie},[_,N]),$=e.useMemo(()=>Z(H,B,v),[H,B,v]),{legend:D,margin:R}=ue({data:P,colorBy:_,colorScale:N,showLegend:S,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>be({categoryAccessor:l,valueAccessor:c,groupAccessor:r}),[l,r,c]),T=we({componentName:"GroupedBarChart",data:P,accessors:{categoryAccessor:r,valueAccessor:c},requiredProps:{groupBy:l}});if(T)return i.createElement(xe,{componentName:"GroupedBarChart",message:T,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:P,oAccessor:r,rAccessor:c,groupBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:$,size:[k,A],margin:R,barPadding:m,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:h,showGrid:M},D&&{legend:D}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?ye(f):z}),(b||x)&&{customHoverBehavior:C}),y&&y.length>0&&{annotations:y}),p);return i.createElement(V,Object.assign({},I))}function Me(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",sizeBy:g,sizeRange:m=[3,8],pointRadius:f=4,pointOpacity:y=.7,categoryPadding:p=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:E}=t,M=n.width,S=n.height,O=n.enableHover,j=n.showGrid,L=n.showLegend,P=n.title,_=n.categoryLabel,B=n.valueLabel,C=o||[],{activeSelectionHook:N,customHoverBehavior:H}=ce({selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof r?r:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:E}),$=re(C,h,d),D=e.useMemo(()=>{if(!g)return;const e=C.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[C,g]),R=e.useMemo(()=>e=>{const t={fillOpacity:y};return t.fill=h?Q(e,h,$):ie,t.r=g?function(e,t,n=[3,20],o){let s;if(s="function"==typeof t?t(e):e[t],!o)return s;const[a,i]=o,[r,l]=n;return i===a?(r+l)/2:r+(s-a)/(i-a)*(l-r)}(e,g,m,D):f,t},[h,$,g,m,D,f,y]),z=e.useMemo(()=>Z(R,N,w),[R,N,w]),{legend:T,margin:I}=ue({data:C,colorBy:h,colorScale:$,showLegend:L,userMargin:s,defaults:n.marginDefaults}),W=e.useMemo(()=>be({categoryAccessor:r,valueAccessor:l,groupAccessor:h||void 0}),[r,l,h]),q=we({componentName:"SwarmPlot",data:C,accessors:{categoryAccessor:r,valueAccessor:l}});if(q)return i.createElement(xe,{componentName:"SwarmPlot",message:q,width:M,height:S});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:C,oAccessor:r,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:z,size:[M,S],margin:I,barPadding:p,enableHover:O,showAxes:n.showAxes,oLabel:_,rLabel:B,rFormat:u,showGrid:j},T&&{legend:T}),P&&{title:P}),a&&{className:a}),{tooltipContent:v?ye(v):W}),(k||A)&&{customHoverBehavior:H}),b&&b.length>0&&{annotations:b}),x);return i.createElement(V,Object.assign({},G))}function Se(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:h,colorScheme:d="category10",showOutliers:g=!0,categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],{activeSelectionHook:_,customHoverBehavior:B}=ce({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof r?r:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),C=re(P,h,d),N=e.useMemo(()=>e=>{const t=h?Q(e,h,C):ie;return{fill:t,stroke:t,fillOpacity:.8}},[h,C]),H=e.useMemo(()=>Z(N,_,v),[N,_,v]),{legend:$,margin:D}=ue({data:P,colorBy:h,colorScale:C,showLegend:S,userMargin:s,defaults:n.marginDefaults}),R=e.useMemo(()=>e=>{const t=e.stats||(e.data||e).stats||{};return i.createElement("div",{className:"semiotic-tooltip",style:ge},i.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(e.category||(e.data||e).category||"")+""),null!=t.median&&i.createElement(i.Fragment,null,null!=t.n&&i.createElement("div",null,"n = ",t.n),i.createElement("div",null,"Median: ",t.median.toLocaleString()),i.createElement("div",null,"Q1: ",t.q1.toLocaleString()),i.createElement("div",null,"Q3: ",t.q3.toLocaleString()),i.createElement("div",null,"Min: ",t.min.toLocaleString()),i.createElement("div",null,"Max: ",t.max.toLocaleString())))},[]),z=we({componentName:"BoxPlot",data:P,accessors:{categoryAccessor:r,valueAccessor:l}});if(z)return i.createElement(xe,{componentName:"BoxPlot",message:z,width:k,height:A});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:P,oAccessor:r,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:H,showOutliers:g,size:[k,A],margin:D,barPadding:m,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:u,showGrid:M},$&&{legend:$}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?ye(f):R}),(b||x)&&{customHoverBehavior:B}),y&&y.length>0&&{annotations:y}),p);return i.createElement(V,Object.assign({},T))}function Oe(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:h,colorBy:d,colorScheme:g="category10",categoryPadding:m=20,tooltip:f,annotations:y,frameProps:p={},selection:v,linkedHover:b,onObservation:x,chartId:w}=t,k=n.width,A=n.height,E=n.enableHover,M=n.showGrid,S=n.showLegend,O=n.title,j=n.categoryLabel,L=n.valueLabel,P=o||[],{activeSelectionHook:_,customHoverBehavior:B}=ce({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof r?r:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),C=re(P,d,g),N=e.useMemo(()=>e=>{const t=d?Q(e,d,C):ie;return{fill:t,stroke:t,fillOpacity:.8}},[d,C]),H=e.useMemo(()=>Z(N,_,v),[N,_,v]),{legend:$,margin:D}=ue({data:P,colorBy:d,colorScale:C,showLegend:S,userMargin:s,defaults:n.marginDefaults}),R=e.useMemo(()=>e=>{const t=e.data||e,n=t.category||e.category||"",o=t.count,s=t.range;return i.createElement("div",{className:"semiotic-tooltip",style:ge},n&&i.createElement("div",{style:{fontWeight:"bold"}},n+""),null!=o&&i.createElement("div",null,"Count: ",o),s&&2===s.length&&i.createElement("div",{style:{opacity:.8}},Number(s[0]).toFixed(1)," – ",Number(s[1]).toFixed(1)))},[]),z=we({componentName:"Histogram",data:P,accessors:{categoryAccessor:r,valueAccessor:l}});if(z)return i.createElement(xe,{componentName:"Histogram",message:z,width:k,height:A});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:P,oAccessor:r,rAccessor:l,projection:"horizontal",summaryStyle:H,bins:c,normalize:u,size:[k,A],margin:D,barPadding:m,enableHover:E,showAxes:n.showAxes,oLabel:j,rLabel:L,rFormat:h,showGrid:M},$&&{legend:$}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?ye(f):R}),(b||x)&&{customHoverBehavior:B}),y&&y.length>0&&{annotations:y}),p);return i.createElement(V,Object.assign({},T))}function je(t){const n=de(t.mode,{width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:o,margin:s,className:a,categoryAccessor:r="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,showIQR:h=!0,valueFormat:d,colorBy:g,colorScheme:m="category10",categoryPadding:f=20,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=n.width,E=n.height,M=n.enableHover,S=n.showGrid,O=n.showLegend,j=n.title,L=n.categoryLabel,P=n.valueLabel,_=o||[],{activeSelectionHook:B,customHoverBehavior:C}=ce({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof r?r:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),N=re(_,g,m),H=e.useMemo(()=>e=>{const t=g?Q(e,g,N):ie;return{fill:t,stroke:t,fillOpacity:.6}},[g,N]),$=e.useMemo(()=>Z(H,B,b),[H,B,b]),{legend:D,margin:R}=ue({data:_,colorBy:g,colorScale:N,showLegend:O,userMargin:s,defaults:n.marginDefaults}),z=e.useMemo(()=>e=>{var t;const n=e.category||e.data&&(null===(t=e.data[0])||void 0===t?void 0:t.category)||"",o=e.stats;if(o)return i.createElement("div",{className:"semiotic-tooltip",style:ge},n&&i.createElement("div",{style:{fontWeight:"bold"}},n+""),i.createElement("div",null,"n = ",o.n),i.createElement("div",null,"Min: ",o.min.toLocaleString()),i.createElement("div",null,"Q1: ",o.q1.toLocaleString()),i.createElement("div",null,"Median: ",o.median.toLocaleString()),i.createElement("div",null,"Q3: ",o.q3.toLocaleString()),i.createElement("div",null,"Max: ",o.max.toLocaleString()),i.createElement("div",{style:{opacity:.8}},"Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const s=(Array.isArray(e.data)?e.data:[]).map(e=>{const t="function"==typeof l?l(e):e[l];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),a=s.length,r=a>0?s[Math.floor(a/2)]:null;return i.createElement("div",{className:"semiotic-tooltip",style:ge},n&&i.createElement("div",{style:{fontWeight:"bold"}},n+""),a>0&&i.createElement("div",null,"n = ",a),null!=r&&i.createElement("div",null,"Median: ",r.toLocaleString()))},[l]),T=we({componentName:"ViolinPlot",data:_,accessors:{categoryAccessor:r,valueAccessor:l}});if(T)return i.createElement(xe,{componentName:"ViolinPlot",message:T,width:A,height:E});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:_,oAccessor:r,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:$,bins:u,showIQR:h,size:[A,E],margin:R,barPadding:f,enableHover:M,showAxes:n.showAxes,oLabel:L,rLabel:P,rFormat:d,showGrid:S},D&&{legend:D}),j&&{title:j}),a&&{className:a}),{tooltipContent:y?ye(y):z}),(x||w)&&{customHoverBehavior:C}),p&&p.length>0&&{annotations:p}),v);return i.createElement(V,Object.assign({},I))}function Le(t){var n;const o=de(t.mode,{width:t.width,height:t.height,showGrid:null===(n=t.showGrid)||void 0===n||n,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,categoryLabel:t.categoryLabel,valueLabel:t.valueLabel}),{data:s,margin:a,className:r,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",valueFormat:h,colorBy:d,colorScheme:g="category10",sort:m=!0,dotRadius:f=5,categoryPadding:y=10,tooltip:p,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A}=t,E=o.width,M=o.height,S=o.enableHover,O=o.showGrid,j=o.showLegend,L=o.title,P=o.categoryLabel,_=o.valueLabel,B=s||[],{activeSelectionHook:C,customHoverBehavior:N}=ce({selection:x,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),H=le(B,m,c),$=re(B,d,g),D=e.useMemo(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=d?Q(e,d,$):ie,t},[d,$,f]),R=e.useMemo(()=>Z(D,C,x),[D,C,x]),{legend:z,margin:T}=ue({data:H,colorBy:d,colorScale:$,showLegend:j,userMargin:a,defaults:o.marginDefaults}),I=e.useMemo(()=>be({categoryAccessor:l,valueAccessor:c}),[l,c]),W=we({componentName:"DotPlot",data:B,accessors:{categoryAccessor:l,valueAccessor:c}});if(W)return i.createElement(xe,{componentName:"DotPlot",message:W,width:E,height:M});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:H,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:R,size:[E,M],margin:T,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:P,rLabel:_,rFormat:h,showGrid:O,oSort:m},z&&{legend:z}),L&&{title:L}),r&&{className:r}),{tooltipContent:p?ye(p):I}),(w||k)&&{customHoverBehavior:N}),v&&v.length>0&&{annotations:v}),b);return i.createElement(V,Object.assign({},q))}function Pe(t){var n,o;const s=de(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title}),{data:a,margin:r,className:l,categoryAccessor:c="category",valueAccessor:u="value",colorBy:h,colorScheme:d="category10",startAngle:g=0,tooltip:m,annotations:f,frameProps:y={},selection:p,linkedHover:v,onObservation:b,chartId:x}=t,w=s.width,k=s.height,A=s.enableHover,E=s.showLegend,M=s.title,S=a||[],O=h||c,{activeSelectionHook:j,customHoverBehavior:L}=ce({selection:p,linkedHover:v,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),P=re(S,O,d),_=e.useMemo(()=>e=>O?{fill:Q(e,O,P)}:{fill:ie},[O,P]),B=e.useMemo(()=>Z(_,j,p),[_,j,p]),{legend:C,margin:N}=ue({data:S,colorBy:O,colorScale:P,showLegend:E,userMargin:r,defaults:s.marginDefaults}),H=e.useMemo(()=>be({categoryAccessor:c,valueAccessor:u,groupAccessor:h&&h!==c?h:void 0,groupLabel:"string"==typeof h?h:"group",pieData:!0}),[c,u,h]),$=we({componentName:"PieChart",data:S,accessors:{categoryAccessor:c,valueAccessor:u}});if($)return i.createElement(xe,{componentName:"PieChart",message:$,width:w,height:k});const D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:S,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:B,startAngle:g,size:[w,k],margin:N,enableHover:A,showAxes:!1},C&&{legend:C}),M&&{title:M}),l&&{className:l}),{tooltipContent:m?ye(m):H}),(v||b)&&{customHoverBehavior:L}),f&&f.length>0&&{annotations:f}),y);return i.createElement(V,Object.assign({},D))}function _e(t){var n,o;const s=de(t.mode,{width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(o=t.height)&&void 0!==o?o:400,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,linkedHover:t.linkedHover}),{data:a,margin:r,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:h=60,centerContent:d,colorBy:g,colorScheme:m="category10",startAngle:f=0,tooltip:y,annotations:p,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=t,A=s.width,E=s.height,M=s.enableHover,S=s.showLegend,O=s.title,j=a||[],L=g||c,{activeSelectionHook:P,customHoverBehavior:_}=ce({selection:b,linkedHover:x,fallbackFields:L?["string"==typeof L?L:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),B=re(j,L,m),C=e.useMemo(()=>e=>L?{fill:Q(e,L,B)}:{fill:ie},[L,B]),N=e.useMemo(()=>Z(C,P,b),[C,P,b]),{legend:H,margin:$}=ue({data:j,colorBy:L,colorScale:B,showLegend:S,userMargin:r,defaults:s.marginDefaults}),D=e.useMemo(()=>be({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),R=we({componentName:"DonutChart",data:j,accessors:{categoryAccessor:c,valueAccessor:u}});if(R)return i.createElement(xe,{componentName:"DonutChart",message:R,width:A,height:E});const z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:j,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:N,innerRadius:h,startAngle:f,centerContent:d,size:[A,E],margin:$,enableHover:M,showAxes:!1},H&&{legend:H}),O&&{title:O}),l&&{className:l}),{tooltipContent:y?ye(y):D}),(x||w)&&{customHoverBehavior:_}),p&&p.length>0&&{annotations:p}),v);return i.createElement(V,Object.assign({},z))}ke.displayName="BarChart",Ae.displayName="StackedBarChart",Ee.displayName="GroupedBarChart",Me.displayName="SwarmPlot",Se.displayName="BoxPlot",Oe.displayName="Histogram",je.displayName="ViolinPlot",Le.displayName="DotPlot",Pe.displayName="PieChart",_e.displayName="DonutChart",exports.BarChart=ke,exports.BoxPlot=Se,exports.DonutChart=_e,exports.DotPlot=Le,exports.GroupedBarChart=Ee,exports.Histogram=Oe,exports.PieChart=Pe,exports.StackedBarChart=Ae,exports.StreamOrdinalFrame=V,exports.SwarmPlot=Me,exports.ViolinPlot=je;