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
- import*as e from"react";import{useMemo as t,forwardRef as n,useRef as o,useState as r,useCallback as i,useEffect as s,useImperativeHandle as a,createContext as l,useContext as c,useLayoutEffect as u,useId as d}from"react";import{brushX as h,brushY as g,brush as y}from"d3-brush";import{select as p}from"d3-selection";import{scaleLinear as f,scaleOrdinal as m,scaleSequential as v,scaleBand as b}from"d3-scale";import{bin as x,quantile as A,min as w,max as k}from"d3-array";import{interpolatePlasma as S,interpolateViridis as E,interpolatePurples as O,interpolateOranges as j,interpolateGreens as M,interpolateReds as P,interpolateBlues as N,schemeSet3 as _,schemeTableau10 as z,schemeCategory10 as W}from"d3-scale-chromatic";import{interpolateNumber as B}from"d3-interpolate";import{sankeyCircular as C,sankeyJustify as L,sankeyCenter as T,sankeyRight as R,sankeyLeft as D}from"d3-sankey-circular";import{line as $,curveLinearClosed as F,arc as H}from"d3-shape";import{forceLink as I,forceSimulation as Y,forceManyBody as X,forceX as G,forceY as q}from"d3-force";import{ribbon as V,chord as U}from"d3-chord";import{hierarchy as Q,partition as Z,pack as K,treemap as J,treemapBinary as ee,cluster as te,tree as ne}from"d3-hierarchy";const oe=5e3;class re{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,oe),bounded:!0,totalSize:e.length});let t=oe;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+oe,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 ie{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 se{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 ae(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function le(e,t,n,o,r,i){const s=[],a=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||(s.push([t.x(e),t.y(i)]),a.push(i))}return{type:"line",path:s,rawValues:a,style:r,datum:e,group:i}}function ce(e,t,n,o,r,i,s){const a=[],l=[];for(const i of e){const e=n(i),s=o(i);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const c=t.x(e);a.push([c,t.y(s)]),l.push([c,t.y(r)])}return{type:"area",topPath:a,bottomPath:l,style:i,datum:e,group:s}}function ue(e,t,n,o,r,i){const s=n(e),a=o(e);return null==s||null==a||Number.isNaN(s)||Number.isNaN(a)?null:{type:"point",x:t.x(s),y:t.y(a),r:r,style:i,datum:e}}function de(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function he(e,t,n,o,r,i){return{type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i}}function ge(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function ye(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class pe{constructor(e){this.xExtent=new se,this.yExtent=new se,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version=0,this.config=e,this.buffer=new ie(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ge(e.timeAccessor||e.xAccessor,"time"),this.getY=ge(e.valueAccessor||e.yAccessor,"value")):(this.getX=ge(e.xAccessor,"x"),this.getY=ge(e.yAccessor,"y")),this.getGroup=ye(e.groupAccessor),this.getCategory=ye(e.categoryAccessor),this.getSize=e.sizeAccessor?ge(e.sizeAccessor,"size"):void 0,this.getColor=ye(e.colorAccessor),this.getBounds=e.boundsAccessor?ge(e.boundsAccessor,"bounds"):void 0,"candlestick"===e.chartType&&(this.getOpen=ge(e.openAccessor,"open"),this.getHigh=ge(e.highAccessor,"high"),this.getLow=ge(e.lowAccessor,"low"),this.getClose=ge(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new ie(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.xExtent.clear(),this.yExtent.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.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n))}else for(const n of e.inserts){"growing"===this.config.windowMode&&this.buffer.full&&(this.growingCap*=2,this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap));const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n)),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,s;const{config:a,buffer:l}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===a.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.xExtent.extent,u=this.yExtent.extent;let d=a.xExtent?[null!==(t=a.xExtent[0])&&void 0!==t?t:c[0],null!==(n=a.xExtent[1])&&void 0!==n?n:c[1]]:c,h=a.yExtent?[null!==(o=a.yExtent[0])&&void 0!==o?o:u[0],null!==(r=a.yExtent[1])&&void 0!==r?r:u[1]]:u;const g=a.yExtent&&null!=a.yExtent[0]&&null!=a.yExtent[1];if("stackedarea"===a.chartType&&!g&&l.size>0)if(a.normalize)h=[0,1+a.extentPadding];else{const e=l.toArray(),t=this.groupData(e),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);h=[0,o+(o>0?o*a.extentPadding:1)]}else if("bar"===a.chartType&&a.binSize&&!g&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ae(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(l,this.getX,this.getY,a.binSize,this.getCategory);h=[0,e+e*a.extentPadding]}else if("waterfall"===a.chartType&&!g&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*a.extentPadding:1;h=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!g&&h[0]!==1/0){if(this.getBounds){const e=l.toArray();for(const t of e){const e=this.getY(t),n=this.getBounds(t);null!=e&&!Number.isNaN(e)&&n&&(e+n>h[1]&&(h[1]=e+n),h[0]>e-n&&(h[0]=e-n))}}const e=h[1]-h[0],t=e>0?e*a.extentPadding:1,n=null===(i=a.yExtent)||void 0===i?void 0:i[0],o=null===(s=a.yExtent)||void 0===s?void 0:s[1];h=[null!=n?h[0]:h[0]-t,null!=o?h[1]:h[1]+t]}if(d[0]!==1/0&&d[1]!==-1/0||(d=[0,1]),h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),void 0!==a.arrowOfTime)if("x"==("up"===(y=a.arrowOfTime)||"down"===y?"y":"x")){const t="right"===a.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:f().domain(d).range(t),y:f().domain(h).range([e.height,0])}}else{const t="down"===a.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:f().domain(h).range([0,e.width]),y:f().domain(d).range(t)}}else this.scales={x:f().domain(d).range([0,e.width]),y:f().domain(h).range([e.height,0])};var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const p=l.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,p),this.config.pulse&&this.applyPulse(this.scene,p),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:n,scales:o}=this;if(!o||0===n.size)return[];const r=n.toArray();switch(t.chartType){case"line":return this.buildLineScene(r);case"area":return this.buildAreaScene(r);case"stackedarea":return this.buildStackedAreaScene(r);case"scatter":case"bubble":return this.buildPointScene(r);case"heatmap":return this.buildHeatmapScene(r,e);case"bar":return this.buildBarScene(r);case"swarm":return this.buildSwarmScene(r);case"waterfall":return this.buildWaterfallScene(r,e);case"candlestick":return this.buildCandlestickScene(r,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=le(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);n.push(ce(e.data,this.scales,this.getX,this.getY,o,t,e.key))}return n}buildStackedAreaScene(e){return function(e,t,n,o,r,i){var s;const a=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||a.add(t)}const l=Array.from(a).sort((e,t)=>e-t),c=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}c.set(t.key,e)}let u;if(i){u=new Map;for(const t of l){let n=0;for(const o of e)n+=(null===(s=c.get(o.key))||void 0===s?void 0:s.get(t))||0;u.set(t,n||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const n of e){const e=c.get(n.key),o=[],s=[];for(const n of l){let r=e.get(n)||0;const a=h.get(n);i&&(r/=u.get(n));const l=t.x(n);s.push([l,t.y(a)]),o.push([l,t.y(a+r)]),h.set(n,a+r)}d.push({type:"area",topPath:o,bottomPath:s,style:r(n.key,n.data[0]),datum:n.data,group:n.key})}return d}(this.groupData(e),this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){const e=Math.min(...t),n=Math.max(...t);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}let i=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];i=new Map;let o=0;for(const e of t)i.set(e,n[o%n.length]),o++}for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},s=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(s=r(e))}if(i&&this.getColor){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const a=ue(o,this.scales,this.getX,this.getY,s,e);a&&t.push(a)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=ge(this.config.valueAccessor,"value"),r=new Set,i=new Set;for(const t of e)r.add(this.getX(t)),i.add(this.getY(t));const s=Array.from(r).sort((e,t)=>e-t),a=Array.from(i).sort((e,t)=>e-t);if(0===s.length||0===a.length)return n;const l=t.width/s.length,c=t.height/a.length,u=new Map;for(const t of e){const e=`${this.getX(t)}_${this.getY(t)}`;u.set(e,{val:o(t),datum:t})}let d=1/0,h=-1/0;for(const{val:e}of u.values())d>e&&(d=e),e>h&&(h=e);const g=h-d||1;for(let e=0;s.length>e;e++)for(let t=0;a.length>t;t++){const o=u.get(`${s[e]}_${a[t]}`);if(!o)continue;const r=(o.val-d)/g;n.push(he(e*l,(a.length-1-t)*c,l,c,`rgb(${Math.round(220-180*r)},${Math.round(220-100*r)},${Math.round(255-50*r)})`,o.datum))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],s=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,a=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=ge(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,g]=this.scales.y.domain(),y=(d-u||1)/s,p=(g-h||1)/a,f=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/y),s-1),r=Math.min(Math.floor((n-h)/p),a-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=f.get(i);l||(l={sum:0,count:0,data:[]},f.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of f){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,A=t.width/s,w=t.height/a;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,s=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=f.get(e);i.push(he(r*A,(a-1-s)*w,A,w,c,{xi:r,yi:s,value:t,count:u.count,sum:u.sum,data:u.data}))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ae(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort();o=[...t.filter(t=>e.has(t)),...i]}const r=[],i=this.scales,[s,a]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,s),l=Math.min(e.end,a);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(o&&e.categories.size>0){let n=0;for(const s of o){const o=e.categories.get(s)||0;if(0===o)continue;const a=i.y(n),l=i.y(n+o);r.push(de(d,Math.min(a,l),h,Math.abs(a-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[s])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:s,categoryValue:o},s)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(de(d,Math.min(t,n),h,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],s=this.config.swarmStyle||{},a=null!==(t=s.radius)&&void 0!==t?t:3,l=null!==(n=s.fill)&&void 0!==n?n:"#007bff",c=null!==(o=s.opacity)&&void 0!==o?o:.7,u=s.stroke,d=s.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),s=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}i.push({type:"point",x:o,y:s,r:a,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t})}return i}buildWaterfallScene(e,t){const n=[],o=this.scales,r=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===r.length)return n;let i=0;for(let e=0;r.length>e;e++){const s=r[e],a=this.getX(s),l=this.getY(s),c=i+l;let u;u=r.length-1>e?this.getX(r[e+1])-a:e>0?a-this.getX(r[e-1]):0;const d=o.x(a),h=0!==u?o.x(a+u):d+t.width/10,g=Math.min(d,h)+.5,y=Math.max(d,h)-.5-g;if(0>=y){i=c;continue}const p=o.y(i),f=o.y(c);n.push(de(g,Math.min(p,f),y,Math.abs(p-f),{fill:0>l?"#dc3545":"#28a745"},Object.assign(Object.assign({},s),{baseline:i,cumEnd:c,delta:l}))),i=c}return n}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",s=o.wickColor||"#333",a=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:s,wickWidth:a,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),s=this.scales.x(e);if(i&&0!==i)n.push([s,this.scales.y(r+i)]),o.push([s,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([s,e]),o.push([s,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:s};else if("candlestick"===t.type)t._decayOpacity=s;else{const e=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:e*s})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n;if(!this.config.pulse||!this.timestampBuffer)return;const o="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const s=this.computePulseIntensity(n,o);s>0&&(t._pulseIntensity=s,t._pulseColor=r)}}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(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeIdentity(t,e);n&&("point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(n,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":return`p:${void 0===e.datum?t:this.getX(e.datum)}_${this.getY(e.datum)}`;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return"c:"+this.getX(e.datum);default:return null}}startTransition(){var e,t,n,o,r,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const s=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let a=!1;for(let e=0;this.scene.length>e;e++){const s=this.scene[e],l=this.getNodeIdentity(s,e);if(!l)continue;const c=this.prevPositionMap.get(l);if(c)if("point"===s.type){const e={x:s.x,y:s.y,r:s.r};c.x===e.x&&c.y===e.y||(s._targetX=e.x,s._targetY=e.y,s._targetR=e.r,s.x=c.x,s.y=c.y,s.r=null!==(t=c.r)&&void 0!==t?t:s.r,a=!0)}else if("rect"===s.type){const e={x:s.x,y:s.y,w:s.w,h:s.h};c.x===e.x&&c.y===e.y&&c.w===e.w&&c.h===e.h||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=c.x,s.y=c.y,s.w=null!==(n=c.w)&&void 0!==n?n:s.w,s.h=null!==(o=c.h)&&void 0!==o?o:s.h,a=!0)}else if("heatcell"===s.type){const e={x:s.x,y:s.y,w:s.w,h:s.h};c.x===e.x&&c.y===e.y||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=c.x,s.y=c.y,s.w=null!==(r=c.w)&&void 0!==r?r:s.w,s.h=null!==(i=c.h)&&void 0!==i?i:s.h,a=!0)}}a&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:s})}advanceTransition(e){var t;if(!this.activeTransition)return!1;const n=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),o="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?n:1-Math.pow(1-n,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==e._targetR&&void 0!==n.r&&(e.r=n.r+(e._targetR-n.r)*o)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}if(n>=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,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=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}else if("heatcell"===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}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveLineStyle(e,t){const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle)return this.config.areaStyle(t||{});const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}getData(){return this.buffer.toArray()}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){Object.assign(this.config,e)}}function fe(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function me(e,t,n){if(0===e.path.length)return null;const o=we(e.path,t);if(0>o)return null;const[r,i]=e.path[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function ve(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function be(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function xe(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function Ae(e,t,n){if(0===e.topPath.length)return null;const o=we(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i;return{node:e,datum:e.datum,x:r,y:i,distance:Math.sqrt(s*s+a*a)}}function we(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}const ke={fill:t=>e.createElement("rect",{style:t,width:20,height:20}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function Se(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,ke[n])(o(e,t)),r}function Ee(t){const{legendGroups:n,customClickBehavior:o,title:r="Legend",width:i=100,height:s=20,orientation:a="vertical"}=t,l="vertical"===a?(({legendGroups:t,width:n,customClickBehavior:o})=>{let r=30;const i=[];return t.forEach((t,s)=>{r+=5,i.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+s,stroke:"gray",x1:0,y1:r,x2:n,y2:r})),r+=10,t.label&&(r+=20,i.push(e.createElement("text",{key:"legend-text-"+s,y:r,className:"legend-group-label"},t.label)),r+=10),i.push(e.createElement("g",{key:"legend-group-"+s,className:"legend-item",transform:`translate(0,${r})`},((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,s=[];let a=0;return i.forEach((t,i)=>{const l=Se(t,i,o,r);s.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(0,${a})`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:30},t.label))),a+=25}),s})(t,o))),r+=25*t.items.length+10}),i})({legendGroups:n,width:i,customClickBehavior:o}):(({legendGroups:t,title:n,height:o,customClickBehavior:r})=>{let i=0;const s=[],a=!1===n?10:40;return t.forEach((n,l)=>{n.label&&(s.push(e.createElement("text",{key:"legend-text-"+l,transform:`translate(${i},${a}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),i+=20);const c=((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,s=[];let a=0;return i.forEach((t,i)=>{const l=Se(t,i,o,r);s.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(${a},0)`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:25},t.label))),a+=35,a+=8*t.label.length}),{items:s,offset:a}})(n,r);s.push(e.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${i},${a})`},c.items)),i+=c.offset+5,t[l+1]&&s.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:i,y1:a-10,x2:i,y2:o+a+10})),i+=15}),e.createElement("g",null,!1!==n&&e.createElement("line",{x1:0,x2:i+10,y1:a-10,y2:a-10,stroke:"gray",className:"title-neatline"}),s)})({legendGroups:n,title:r,height:s,customClickBehavior:o});return e.createElement("g",null,void 0!==r&&e.createElement("text",{className:"legend-title",y:20,x:"horizontal"===a?0:i/2,textAnchor:"horizontal"===a?"start":"middle"},r),l)}function Oe(e){return"string"==typeof e?{type:e}:e}function je({orient:n,config:o,values:r,scale:i,size:s,length:a}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===n||"bottom"===n,u=t(()=>{if(0===r.length)return null;const t=i.domain(),o=s-8;if("boxplot"===l.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(r);if(!t)return null;const{q1:s,median:a,q3:u,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*o,20),y=(o-g)/2+4;if(c){const t=i(s),o=i(u),r=i(a),c=i(d),p=i(h),f="top"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:c,y1:m+f*(y+g/2),x2:p,y2:m+f*(y+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+f*y,x2:c,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:p,y1:m+f*y,x2:p,y2:m+f*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(t,o),y:"top"===n?m-y-g:m+y,width:Math.abs(o-t),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===n?m-y-g:m+y,x2:r,y2:"top"===n?m-y:m+y+g,stroke:l.fill,strokeWidth:2}))}{const t=i(s),o=i(u),r=i(a),c=i(d),p=i(h),f="left"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:m+f*(y+g/2),y1:c,x2:m+f*(y+g/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:c,x2:m+f*(y+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+f*y,y1:p,x2:m+f*(y+g),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===n?m-y-g:m+y,y:Math.min(t,o),width:g,height:Math.abs(o-t),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===n?m-y-g:m+y,y1:r,x2:"left"===n?m-y:m+y+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=x().domain(t).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+n},u.map((t,r)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/d*o;if(c){const o=i(t.x0),a=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:o,y:"top"===n?-4-s:4,width:Math.max(a,.5),height:s,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(t.x0),a=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:"left"===n?-4-s:4,y:Math.min(o,o+a),width:s,height:Math.abs(a),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const t=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const s=e.length/d*(o/2),a=i((e.x0+e.x1)/2);r.push(c?`${a},${"top"===n?-(t-s):t-s}`:`${"left"===n?-(t-s):t-s},${a}`)}for(let e=u.length-1;e>=0;e--){const s=u[e];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);r.push(c?`${l},${"top"===n?-(t+a):t+a}`:`${"left"===n?-(t+a):t+a},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+n},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const t=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);t.push(`L${s},${"top"===n?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,s=i((e.x0+e.x1)/2);t.push(`L${"left"===n?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;t.push(`L${e},${s}`),t.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+n},e.createElement("path",{d:t.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,s,a,n,c,4]);return u?e.createElement("g",{className:"marginal-"+n,"data-testid":"marginal-"+n},u):null}function Me(e){return Math.round(100*e)/100+""}function Pe(n){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,xLabel:u,yLabel:d,xFormat:h,yFormat:g,showGrid:y,title:p,legend:f,foregroundGraphics:m,marginalGraphics:v,xValues:b,yValues:x,annotations:A,svgAnnotationRules:w,annotationFrame:k,children:S}=n,E=t(()=>c&&l?l.x.ticks(5).map(e=>({value:e,pixel:l.x(e),label:(h||Me)(e)})):[],[c,l,h]),O=t(()=>c&&l?l.y.ticks(5).map(e=>({value:e,pixel:l.y(e),label:(g||Me)(e)})):[],[c,l,g]),j=t(()=>A&&0!==A.length&&w?A.map((e,t)=>w(e,t,{scales:l?{time:l.x,value:l.y}:null,timeAxis:"x",width:o,height:r})).filter(Boolean):null,[A,w,o,r,k]);return c||p||f||m||v||j&&j.length>0||y||S?e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&l&&e.createElement("g",{className:"stream-grid"},E.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"#e0e0e0",strokeWidth:1})),O.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"#e0e0e0",strokeWidth:1}))),c&&l&&e.createElement("g",{className:"stream-axes"},e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),E.map((t,n)=>e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),O.map((t,n)=>e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},d)),j,v&&l&&b&&x&&e.createElement(e.Fragment,null,v.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(je,{orient:"top",config:Oe(v.top),values:b,scale:l.x,size:a.top,length:o})),v.bottom&&e.createElement("g",{transform:`translate(0, ${r})`},e.createElement(je,{orient:"bottom",config:Oe(v.bottom),values:b,scale:l.x,size:a.bottom,length:o})),v.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(je,{orient:"left",config:Oe(v.left),values:x,scale:l.y,size:a.left,length:r})),v.right&&e.createElement("g",{transform:`translate(${o}, 0)`},e.createElement(je,{orient:"right",config:Oe(v.right),values:x,scale:l.y,size:a.right,length:r}))),m,S),p&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof p?p:null),f&&e.createElement("g",{transform:`translate(${i-a.right+10}, ${a.top})`},"object"==typeof(M=f)&&null!==M&&!e.isValidElement(M)&&"legendGroups"in M?e.createElement(Ee,{legendGroups:f.legendGroups,title:"",width:100}):f)):null;var M}function Ne(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}const _e=(e,t,n,o)=>{var r;const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;e.beginPath();const[n,o]=t.topPath[0];e.moveTo(n,o);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath();const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;if(e.globalAlpha=i,e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=1,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);e.stroke()}e.globalAlpha=1}},ze=(e,t,n,o)=>{var r;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!==(r=t.style.opacity)&&void 0!==r?r: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=4;e.beginPath(),e.arc(t.x,t.y,t.r+n*t._pulseIntensity,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=.5*t._pulseIntensity,e.stroke()}e.globalAlpha=1}},We=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?Be(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 Be(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.w)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}const Ce={line:[_e,(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const i of r){if(2>i.path.length)continue;const s=i.style.stroke||"#007bff",a=i.style.strokeWidth||2,l=i.colorThresholds,c=i.rawValues;if(e.setLineDash(i.style.strokeDasharray?i.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=i.style.opacity&&(e.globalAlpha=i.style.opacity),e.lineWidth=a,l&&0!==l.length&&c&&c.length===i.path.length){let u=null,d=null,h=null,g=null,y=!1;function p(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),y=!0}function f(){y&&(e.stroke(),y=!1)}for(let m=0;i.path.length>m;m++){const[v,b]=i.path[m],x=c[m],A=Ne(x,l,s);if(null!==u&&null!==g&&null!==h){if(A===g)e.lineTo(v,b);else{const w=[];for(const k of l){const S=k.value;(h>S||S>x)&&(S>h||x>S)||h===S||x===S||w.push({t:(S-h)/(x-h)})}w.sort((e,t)=>e.t-t.t);for(const E of w){const O=u+(v-u)*E.t,j=d+(b-d)*E.t,M=Ne(h+(x-h)*Math.min(E.t+1e-4,1),l,s);e.lineTo(O,j),f(),p(M,O,j)}e.lineTo(v,b)}u=v,d=b,h=x,g=A}else p(A,v,b),u=v,d=b,h=x,g=A}f()}else{e.beginPath(),e.strokeStyle=s;const[P,N]=i.path[0];e.moveTo(P,N);for(let _=1;i.path.length>_;_++)e.lineTo(i.path[_][0],i.path[_][1]);e.stroke()}if(i.style.fill&&i.style.fillOpacity&&i.style.fillOpacity>0){e.beginPath(),e.globalAlpha=i.style.fillOpacity,e.fillStyle=i.style.fill;const[z,W]=i.path[0];e.moveTo(z,W);for(let C=1;i.path.length>C;C++)e.lineTo(i.path[C][0],i.path[C][1]);const B=i.path[0][0];e.lineTo(i.path[i.path.length-1][0],o.height),e.lineTo(B,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[_e],stackedarea:[_e],scatter:[ze],bubble:[ze],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const n=t.style;null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=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}}],bar:[We],swarm:[ze],waterfall:[(e,t,n,o)=>{var r,i;We(e,t);const s=t.filter(e=>"rect"===e.type);if(s.length>=2){e.save(),e.strokeStyle="#999",e.lineWidth=1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],a=s[t+1];if(!(null===(r=o.datum)||void 0===r?void 0:r.cumEnd)||!(null===(i=a.datum)||void 0===i?void 0:i.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=a.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}}]},Le={top:20,right:20,bottom:30,left:40},Te={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"},Re={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function De({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Re},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function $e({width:t,height:n,totalWidth:r,totalHeight:i,margin:a,dimension:l,scales:c,onBrush:u}){const d=o(null),f=o(null);return s(()=>{if(!d.current)return;const e=p(d.current).select(".brush-g"),o="x"===l?h():"y"===l?g():y();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let o,r;if("x"===l){const[t,i]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(n),c.y.invert(0)]}else if("y"===l){const[n,i]=e.selection;o=[c.x.invert(0),c.x.invert(t)],r=[c.y.invert(i),c.y.invert(n)]}else{const[[t,n],[i,s]]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(s),c.y.invert(n)]}u({x:o,y:r})}),e.call(o),f.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),f.current=null}},[t,n,l,c,u]),e.createElement("svg",{ref:d,width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`}))}const Fe=n(function(n,l){var c;const{chartType:u,runtimeMode:d,data:h,xAccessor:g,yAccessor:y,colorAccessor:p,sizeAccessor:f,groupAccessor:m,lineDataAccessor:v,normalize:b,binSize:x,valueAccessor:A,arrowOfTime:w="right",windowMode:k="sliding",windowSize:S=200,timeAccessor:E,xExtent:O,yExtent:j,extentPadding:M=.1,sizeRange:P,size:N=[500,300],margin:_,className:z,background:W,lineStyle:B,pointStyle:C,areaStyle:L,swarmStyle:T,barColors:R,colorScheme:D,boundsAccessor:$,boundsStyle:F,openAccessor:H,highAccessor:I,lowAccessor:Y,closeAccessor:X,candlestickStyle:G,showAxes:q=!0,xLabel:V,yLabel:U,xFormat:Q,yFormat:Z,tickFormatTime:K,tickFormatValue:J,hoverAnnotation:ee,tooltipContent:te,customHoverBehavior:ne,enableHover:oe,annotations:ie,svgAnnotationRules:se,showGrid:ae,legend:le,backgroundGraphics:ce,foregroundGraphics:ue,title:de,categoryAccessor:he,brush:ge,onBrush:ye,decay:we,pulse:ke,transition:Se,staleness:Ee,heatmapAggregation:Oe,heatmapXBins:je,heatmapYBins:Me,marginalGraphics:Ne}=n,_e=Object.assign(Object.assign({},Le),_);if(Ne){const e=60;Ne.top&&e>_e.top&&(_e.top=e),Ne.bottom&&e>_e.bottom&&(_e.bottom=e),Ne.left&&e>_e.left&&(_e.left=e),Ne.right&&e>_e.right&&(_e.right=e)}const ze=N[0]-_e.left-_e.right,We=N[1]-_e.top-_e.bottom,Be=null!=ee?ee:oe,Re=o(null),Fe=o(0),He=o(!1),[Ie,Ye]=r(0),[Xe,Ge]=r(null),qe=o(null),[Ve,Ue]=r(null),[Qe,Ze]=r(!1),[Ke,Je]=r([]),[et,tt]=r([]),nt=o(()=>{}),ot="streaming"===d||["bar","swarm","waterfall"].includes(u),rt=t(()=>({chartType:u,runtimeMode:ot?"streaming":"bounded",windowSize:S,windowMode:k,arrowOfTime:ot?w:"right",extentPadding:M,xAccessor:ot?void 0:g,yAccessor:ot?void 0:y,timeAccessor:ot?E:void 0,valueAccessor:A,colorAccessor:p,sizeAccessor:f,groupAccessor:m,categoryAccessor:he,lineDataAccessor:v,xExtent:O,yExtent:j,sizeRange:P,binSize:x,normalize:b,boundsAccessor:$,boundsStyle:F,openAccessor:H,highAccessor:I,lowAccessor:Y,closeAccessor:X,candlestickStyle:G,lineStyle:B,pointStyle:C,areaStyle:L,swarmStyle:T,colorScheme:D,barColors:R,annotations:ie,decay:we,pulse:ke,transition:Se,staleness:Ee,heatmapAggregation:Oe,heatmapXBins:je,heatmapYBins:Me}),[u,S,k,w,M,g,y,E,A,p,f,m,he,v,O,j,P,x,b,$,F,H,I,Y,X,G,B,C,L,T,D,R,ie,we,ke,Se,Ee,Oe,je,Me,ot]),it=o(null);it.current||(it.current=new pe(rt));const st=i(()=>{Fe.current||(Fe.current=requestAnimationFrame(()=>nt.current()))},[]);s(()=>{var e;null===(e=it.current)||void 0===e||e.updateConfig(rt),He.current=!0,st()},[rt,st]);const at=o(null);at.current||(at.current=new re(e=>{const t=it.current;t&&t.ingest(e)&&(He.current=!0,st())}));const lt=i(e=>{var t;null===(t=at.current)||void 0===t||t.push(e)},[]),ct=i(e=>{var t;null===(t=at.current)||void 0===t||t.pushMany(e)},[]),ut=i(()=>{var e,t;null===(e=at.current)||void 0===e||e.clear(),null===(t=it.current)||void 0===t||t.clear(),He.current=!0,st()},[st]);a(l,()=>({push:lt,pushMany:ct,clear:ut,getData:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=it.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[lt,ct,ut]),s(()=>{var e;h&&(null===(e=at.current)||void 0===e||e.setBoundedData(h))},[h]);const dt=o(()=>{}),ht=o(()=>{});dt.current=e=>{if(!Be)return;const t=Re.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-_e.left,r=e.clientY-n.top-_e.top;if(0>o||o>ze||0>r||r>We)return void(qe.current&&(qe.current=null,Ue(null),ne&&ne(null),st()));const i=it.current;if(!i||0===i.scene.length)return;const s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"point":e=fe(i,t,n);break;case"line":e=me(i,t,n);break;case"rect":e=ve(i,t,n);break;case"heatcell":e=be(i,t,n);break;case"area":if(!1===i.interactive)break;e=Ae(i,t,n);break;case"candlestick":e=xe(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,o,r);if(!s)return void(qe.current&&(qe.current=null,Ue(null),ne&&ne(null),st()));const a={data:s.datum,time:s.x,value:s.y,x:s.x,y:s.y};qe.current=a,Ue(a),ne&&ne(a),st()},ht.current=()=>{qe.current&&(qe.current=null,Ue(null),ne&&ne(null),st())};const gt=i(e=>dt.current(e),[]),yt=i(()=>ht.current(),[]);nt.current=()=>{var e,t;Fe.current=0;const n=Re.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=it.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i);s||r.computeScene({width:ze,height:We});const a="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=N[0]*a,n.height=N[1]*a,n.style.width=N[0]+"px",n.style.height=N[1]+"px",o.scale(a,a),o.translate(_e.left,_e.top),o.clearRect(-_e.left,-_e.top,N[0],N[1]);const l=function(e){if(!e)return Te;const t=getComputedStyle(e),n=t.getPropertyValue("--text-secondary").trim(),o=t.getPropertyValue("--text-primary").trim(),r=t.getPropertyValue("--surface-3").trim(),i=t.getPropertyValue("--surface-0").trim();return n||o?{axisStroke:r||Te.axisStroke,tickText:n||Te.tickText,crosshair:n?n+"66":Te.crosshair,hoverFill:i?i+"4D":Te.hoverFill,hoverStroke:n?n+"99":Te.hoverStroke,pointRing:i||Te.pointRing}:Te}(n),c=null!==(e=null==Ee?void 0:Ee.threshold)&&void 0!==e?e:5e3,d=Ee&&r.lastIngestTime>0&&i-r.lastIngestTime>c;d&&(o.globalAlpha=null!==(t=null==Ee?void 0:Ee.dimOpacity)&&void 0!==t?t:.5),W&&(o.fillStyle=W,o.fillRect(0,0,ze,We));const h=Ce[u];if(h&&r.scales)for(const e of h)e(o,r.scene,r.scales,{width:ze,height:We});d&&(o.globalAlpha=1),Be&&qe.current&&r.scales&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;e.save();const a="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=a.stroke||s.crosshair,e.lineWidth=a.strokeWidth||1,e.setLineDash(a.strokeDasharray?a.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}(o,qe.current,ze,We,"object"==typeof Be?Be:{},0,l);const p=He.current;if(He.current=!1,p&&r.scales&&(Ge(r.scales),Ne)){const e=r.getData(),t="function"==typeof g?g:e=>e[g||"x"],n="function"==typeof y?y:e=>e[y||"y"];Je(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),tt(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}p&&ie&&ie.length>0&&se&&Ye(e=>e+1),(null==Ee?void 0:Ee.showBadge)&&Ze(!!d),(s||r.hasActivePulses)&&(Fe.current=requestAnimationFrame(()=>nt.current()))},s(()=>(st(),()=>{Fe.current&&cancelAnimationFrame(Fe.current)}),[st]),s(()=>{He.current=!0,st()},[u,ze,We,q,W,B,st]),s(()=>{if(!Ee)return;const e=setInterval(()=>{var e;const t=it.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=Ee.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Qe&&(Ze(r),He.current=!0,st())},1e3);return()=>clearInterval(e)},[Ee,Qe,st]);const pt=Be&&Ve?te?te(Ve):e.createElement(De,{hover:Ve}):null,ft=pt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:_e.left+Ve.x,top:_e.top+Ve.y,transform:`translate(${Ve.x>.7*ze?"calc(-100% - 12px)":"12px"}, ${.3*We>Ve.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},pt):null;return e.createElement("div",{className:"stream-xy-frame"+(z?" "+z:""),style:{position:"relative",width:N[0],height:N[1]},onMouseMove:Be?gt:void 0,onMouseLeave:Be?yt:void 0},ce&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:N[0],height:N[1],pointerEvents:"none"}},ce),e.createElement("canvas",{ref:Re,style:{position:"absolute",left:0,top:0}}),e.createElement(Pe,{width:ze,height:We,totalWidth:N[0],totalHeight:N[1],margin:_e,scales:Xe,showAxes:q,xLabel:V,yLabel:U,xFormat:Q||K,yFormat:Z||J,showGrid:ae,title:de,legend:le,foregroundGraphics:ue,marginalGraphics:Ne,xValues:Ke,yValues:et,annotations:ie,svgAnnotationRules:se,annotationFrame:Ie}),(ge||ye)&&e.createElement($e,{width:ze,height:We,totalWidth:N[0],totalHeight:N[1],margin:_e,dimension:null!==(c=null==ge?void 0:ge.dimension)&&void 0!==c?c:"xy",scales:Xe,onBrush:null!=ye?ye:()=>{}}),(null==Ee?void 0:Ee.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Ee.badgePosition?{top:4,left:4}:"bottom-left"===Ee.badgePosition?{bottom:4,left:4}:"bottom-right"===Ee.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Qe?"#dc3545":"#28a745",color:"white"})},Qe?"STALE":"LIVE"),ft)});Fe.displayName="StreamXYFrame";const He={category10:W,tableau10:z,set3:_,blues:N,reds:P,greens:M,oranges:j,purples:O,viridis:E,plasma:S},Ie=W;function Ye(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Ie[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+""))%Ie.length]}function Xe(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>e[t]))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return m().domain(o).range(n).unknown("#999");const i=He[n]||He.category10;if(r&&"function"==typeof i)return e=>i(Number(e)/Math.max(...o.map(Number)));{const e=Array.isArray(i)?i:Ie;return m().domain(o).range(e).unknown("#999")}}function Ge(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,s]=o,[a,l]=n;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}const qe="#007bff";function Ve(e){return"function"==typeof e?e:t=>t[e]}function Ue(e,n,o="category10"){return t(()=>{if(n&&"function"!=typeof n)return Xe(e,n,o)},[e,n,o])}function Qe(e,n,o){return t(()=>{if(!n)return e;const t=[...e];if("function"==typeof n)return t.sort(n);const r=Ve(o);return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}function Ze({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==r&&(t.stroke=r),void 0!==i&&(t.strokeWidth=i),t},type:"fill",items:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),s=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:s}}),label:""}]}}const Ke={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 Je(e,t){return"function"==typeof t?t(e):e[t]}function et(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 tt(t={}){const{fields:n=[],title:o,format:r,style:i={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Je(t,o);c.push({value:et(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=et(Je(t,o),i);c.push({label:a?n:void 0,value:s})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:a?e:void 0,value:et(t[e],r)})});const u=Object.assign(Object.assign({},Ke),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function nt(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:n,title:o,format:r,style:i={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(o){const e=Je(t,o);a=et(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const s=Je(t,o);l.push({label:n,value:et(s,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){a=et(t[n],r);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=et(t[e[0]],r))}}const c=Object.assign(Object.assign({},Ke),i);return e.createElement("div",{className:("semiotic-tooltip "+s).trim(),style:c},a&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},a),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&a?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}(t)))}function ot(e){return"string"==typeof e?e:"value"}function rt(t){return n=>{const o=n.data;return o?e.createElement("div",{className:"semiotic-tooltip",style:Ke},t.map((t,n)=>{const r=function(e,t){return"function"==typeof t?t(e):e[t]}(o,t.accessor),i=null==(s=r)?"–":"number"==typeof s?s.toLocaleString():s instanceof Date?s.toLocaleDateString():s+"";var s;return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.8}},t.label,": "),e.createElement("span",{style:{fontWeight:"color"===t.role||"group"===t.role?"bold":"normal"}},i))})):null}}function it({componentName:t,message:n,width:o,height:r}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n)))}function st({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){const n=e[0];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 at({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function lt({nodes:e,edges:t,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!e||!Array.isArray(e)||0===e.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&e&&e.length>0){const t=e[0];if(t&&"object"==typeof t)for(const[e,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in t))return`${e} "${n}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`}return null}function ct(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}function ut(e){return e?"string"==typeof e?{name:e}:e:null}function dt(e,t,n){return t?o=>{var r,i;const s=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(s,n.selectedStyle):(s.fillOpacity=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2,s.strokeOpacity=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(s,n.unselectedStyle))),s}:e}function ht(n){let o=l(null),i=gt(n);return[function({children:r}){let i=t(()=>gt(n),[]);return e.createElement(o.Provider,{value:i,children:r})},e=>{var t;let n=null!==(t=c(o))&&void 0!==t?t:i;return function(e,t){const[n,o]=r(t);return u(()=>e(()=>o(t)),[e]),n}(n.subscribe,()=>e(n.getState()))}]}function gt(e){let t=new EventTarget,n=e(function(e){n=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 yt(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,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function pt(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(yt(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function ft(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[mt,vt]=ht(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=ft(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=ft(o,t);return o.set(t,Object.assign(Object.assign({},r),{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 bt(e){const n=d(),o=e.clientId||n,{name:r}=e,s=vt(e=>e.selections.get(r)),a=vt(e=>e.setClause),l=vt(e=>e.clearClause),c=t(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t(()=>s&&0!==s.clauses.size?pt(s,o):()=>!0,[s,o]),isActive:c,selectPoints:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};a(r,{clientId:o,type:"point",fields:t})},[o,r,a]),selectInterval:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};a(r,{clientId:o,type:"interval",fields:t})},[o,r,a]),clear:i(()=>{l(r,o)},[l,r,o]),clientId:o}}function xt(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:s,clear:a}=bt({name:t});return{onHover:i(e=>{if(!e)return void a();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&s(t)},[n,s,a]),predicate:o,isActive:r}}function At(e){const{name:n,xField:o,yField:r}=e,{predicate:s,isActive:a,selectInterval:l,clear:c}=bt({name:n}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=i(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:t(()=>({brush:u,during:d,end:d}),[u,d]),predicate:s,isActive:a,clear:c}}function wt(e,n,o){const r=vt(e=>e.selections.get(n));return t(()=>{if(!r||0===r.clauses.size)return e;const t=pt(r,o);return e.filter(t)},[e,r,o])}function kt(n){var o;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:g,yFormat:y,xAccessor:p="x",yAccessor:f="y",lineBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:A="linear",showPoints:w=!1,pointRadius:k=3,fillArea:S=!1,areaOpacity:E=.3,lineWidth:O=2,enableHover:j=!0,showGrid:M=!1,showLegend:P,tooltip:N,frameProps:_={},selection:z,linkedHover:W}=n,B=r||[],C=ct(W,b?["string"==typeof b?b:""]:[]),L=bt({name:(null==z?void 0:z.name)||"__unused__"}),T=xt({name:(null==C?void 0:C.name)||"hover",fields:(null==C?void 0:C.fields)||[]}),R=z?{isActive:L.isActive,predicate:L.predicate}:null,D=void 0!==(null===(o=B[0])||void 0===o?void 0:o[v]),$=t(()=>{if(D)return B;if(m){const e=B.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:B}]},[B,m,v,D]),F=Ue(B,b,x),H=t(()=>e=>{const t={strokeWidth:O};return t.stroke=b?Ye(e,b,F):qe,S&&(t.fill=t.stroke,t.fillOpacity=E),t},[b,F,O,S,E]),I=t(()=>dt(H,R,z),[H,R,z]),Y=t(()=>{if(w)return e=>{const t={r:k,fillOpacity:1};return t.fill=b?Ye(e.parentLine||e,b,F):qe,t}},[w,k,b,F]),X=S?"area":"line",G=void 0!==P?P:$.length>1,q=t(()=>{if(G&&b)return Ze({data:$,colorBy:b,colorScale:F,getColor:Ye})},[G,b,$,F]),V=t(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return q&&120>e.right&&(e.right=120),e},[l,q]),U=i(e=>{W&&T.onHover(e)},[W,T]),Q=m||b,Z=t(()=>rt([{label:d||ot(p),accessor:p,role:"x"},{label:h||ot(f),accessor:f,role:"y"},...Q?[{label:ot(Q),accessor:Q,role:"group"}]:[]]),[p,f,d,h,Q]),K=st({componentName:"LineChart",data:B,accessors:{xAccessor:p,yAccessor:f}});if(K)return e.createElement(it,{componentName:"LineChart",message:K,width:s,height:a});const J=t(()=>D||m?$.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):B,[$,v,D,m,B]),ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:X,data:J,xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:A,lineStyle:I},w&&{pointStyle:Y}),{size:[s,a],margin:V,showAxes:!0,xLabel:d,yLabel:h,xFormat:g,yFormat:y,enableHover:j,showGrid:M}),q&&{legend:q}),u&&{title:u}),c&&{className:c}),{tooltipContent:N?nt(N):Z}),W&&{customHoverBehavior:U}),_);return e.createElement(Fe,Object.assign({},ee))}function St(n){var o;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:g,yFormat:y,xAccessor:p="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:A="monotoneX",areaOpacity:w=.7,showLine:k=!0,lineWidth:S=2,enableHover:E=!0,showGrid:O=!1,showLegend:j,tooltip:M,frameProps:P={},selection:N,linkedHover:_}=n,z=r||[],W=ct(_,b?["string"==typeof b?b:""]:[]),B=bt({name:(null==N?void 0:N.name)||"__unused__"}),C=xt({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]}),L=N?{isActive:B.isActive,predicate:B.predicate}:null,T=void 0!==(null===(o=z[0])||void 0===o?void 0:o[v]),R=t(()=>{if(T)return z;if(m){const e=z.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:z}]},[z,m,v,T]),D=Ue(z,b,x),$=t(()=>e=>{const t={},n=b?Ye(e,b,D):qe;return t.fill=n,t.fillOpacity=w,k?(t.stroke=n,t.strokeWidth=S):t.stroke="none",t},[b,D,w,k,S]),F=t(()=>dt($,L,N),[$,L,N]),H=void 0!==j?j:R.length>1,I=t(()=>{if(H&&b)return Ze({data:R,colorBy:b,colorScale:D,getColor:Ye})},[H,b,R,D]),Y=t(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return I&&120>e.right&&(e.right=120),e},[l,I]),X=i(e=>{_&&C.onHover(e)},[_,C]),G=m||b,q=t(()=>rt([{label:d||ot(p),accessor:p,role:"x"},{label:h||ot(f),accessor:f,role:"y"},...G?[{label:ot(G),accessor:G,role:"group"}]:[]]),[p,f,d,h,G]),V=st({componentName:"AreaChart",data:z,accessors:{xAccessor:p,yAccessor:f}});if(V)return e.createElement(it,{componentName:"AreaChart",message:V,width:s,height:a});const U=t(()=>T||m?R.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):z,[R,v,T,m,z]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:U,xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:A,lineStyle:F,size:[s,a],margin:Y,showAxes:!0,xLabel:d,yLabel:h,xFormat:g,yFormat:y,enableHover:E,showGrid:O},I&&{legend:I}),u&&{title:u}),c&&{className:c}),{tooltipContent:M?nt(M):q}),_&&{customHoverBehavior:X}),P);return e.createElement(Fe,Object.assign({},Q))}function Et(n){var o;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,xLabel:d,yLabel:h,xFormat:g,yFormat:y,xAccessor:p="x",yAccessor:f="y",areaBy:m,lineDataAccessor:v="coordinates",colorBy:b,colorScheme:x="category10",curve:A="monotoneX",areaOpacity:w=.7,showLine:k=!0,lineWidth:S=2,normalize:E=!1,enableHover:O=!0,showGrid:j=!1,showLegend:M,tooltip:P,frameProps:N={},selection:_,linkedHover:z}=n,W=r||[],B=ct(z,b?["string"==typeof b?b:""]:[]),C=bt({name:(null==_?void 0:_.name)||"__unused__"}),L=xt({name:(null==B?void 0:B.name)||"hover",fields:(null==B?void 0:B.fields)||[]}),T=_?{isActive:C.isActive,predicate:C.predicate}:null,R=void 0!==(null===(o=W[0])||void 0===o?void 0:o[v]),D=t(()=>{if(R)return W;if(m){const e=W.reduce((e,t)=>{const n="function"==typeof m?m(t):t[m];if(!e[n]){const t={[v]:[]};"string"==typeof m&&(t[m]=n),e[n]=t}return e[n][v].push(t),e},{});return Object.values(e)}return[{[v]:W}]},[W,m,v,R]),$=Ue(W,b,x),F=t(()=>e=>{const t={},n=b?Ye(e,b,$):qe;return t.fill=n,t.fillOpacity=w,k?(t.stroke=n,t.strokeWidth=S):t.stroke="none",t},[b,$,w,k,S]),H=t(()=>dt(F,T,_),[F,T,_]),I=void 0!==M?M:D.length>1,Y=t(()=>{if(I&&b)return Ze({data:D,colorBy:b,colorScale:$,getColor:Ye})},[I,b,D,$]),X=t(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),l);return Y&&120>e.right&&(e.right=120),e},[l,Y]),G=i(e=>{z&&L.onHover(e)},[z,L]),q=m||b,V=t(()=>rt([{label:d||ot(p),accessor:p,role:"x"},{label:h||ot(f),accessor:f,role:"y"},...q?[{label:ot(q),accessor:q,role:"group"}]:[]]),[p,f,d,h,q]),U=st({componentName:"StackedAreaChart",data:W,accessors:{xAccessor:p,yAccessor:f}});if(U)return e.createElement(it,{componentName:"StackedAreaChart",message:U,width:s,height:a});const Q=t(()=>R||m?D.flatMap(e=>{const t=e[v]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):W,[D,v,R,m,W]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:Q,xAccessor:p,yAccessor:f,groupAccessor:m||void 0,curve:A,normalize:E,lineStyle:H,size:[s,a],margin:X,showAxes:!0,xLabel:d,yLabel:h,xFormat:g,yFormat:y,enableHover:O,showGrid:j},Y&&{legend:Y}),u&&{title:u}),c&&{className:c}),{tooltipContent:P?nt(P):V}),z&&{customHoverBehavior:G}),N);return e.createElement(Fe,Object.assign({},Z))}function Ot(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,xLabel:u,yLabel:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",colorBy:f,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:A=.8,enableHover:w=!0,showGrid:k=!1,showLegend:S,tooltip:E,marginalGraphics:O,frameProps:j={},selection:M,linkedHover:P,linkedBrush:N}=n,_=o||[],z=ct(P,f?["string"==typeof f?f:""]:[]),W=ut(N),B=bt({name:(null==M?void 0:M.name)||"__unused__"}),C=xt({name:(null==z?void 0:z.name)||"hover",fields:(null==z?void 0:z.fields)||[]});At({name:(null==W?void 0:W.name)||"__unused_brush__",xField:(null==W?void 0:W.xField)||("string"==typeof y?y:void 0),yField:(null==W?void 0:W.yField)||("string"==typeof p?p:void 0)});const L=M?{isActive:B.isActive,predicate:B.predicate}:null,T=Ue(_,f,m),R=t(()=>{if(!v||0===_.length)return;const e=_.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[_,v]),D=t(()=>e=>{const t={fillOpacity:A};return t.fill=f?Ye(e,f,T):qe,t.r=v?Ge(e,v,b,R):x,t},[f,T,v,b,R,x,A]),$=t(()=>dt(D,L,M),[D,L,M]),F=void 0!==S?S:!!f,H=t(()=>{if(F&&f)return Ze({data:_,colorBy:f,colorScale:T,getColor:Ye})},[F,f,_,T]),I=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return H&&120>e.right&&(e.right=120),e},[a,H]),Y=i(e=>{P&&C.onHover(e)},[P,C]),X=t(()=>rt([{label:u||ot(y),accessor:y,role:"x"},{label:d||ot(p),accessor:p,role:"y"},...f?[{label:ot(f),accessor:f,role:"color"}]:[],...v?[{label:ot(v),accessor:v,role:"size"}]:[]]),[y,p,u,d,f,v]),G=st({componentName:"Scatterplot",data:_,accessors:{xAccessor:y,yAccessor:p}});if(G)return e.createElement(it,{componentName:"Scatterplot",message:G,width:r,height:s});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:_,xAccessor:y,yAccessor:p,colorAccessor:f||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:$,colorScheme:m,size:[r,s],margin:I,showAxes:!0,xLabel:u,yLabel:d,xFormat:h,yFormat:g,enableHover:w,showGrid:k},H&&{legend:H}),c&&{title:c}),l&&{className:l}),{tooltipContent:E?nt(E):X}),P&&{customHoverBehavior:Y}),O&&{marginalGraphics:O}),j);return e.createElement(Fe,Object.assign({},q))}function jt(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,xLabel:u,yLabel:d,xFormat:h,yFormat:g,xAccessor:y="x",yAccessor:p="y",sizeBy:f,sizeRange:m=[5,40],colorBy:v,colorScheme:b="category10",bubbleOpacity:x=.6,bubbleStrokeWidth:A=1,bubbleStrokeColor:w="white",enableHover:k=!0,showGrid:S=!1,showLegend:E,tooltip:O,marginalGraphics:j,frameProps:M={},selection:P,linkedHover:N,linkedBrush:_}=n,z=o||[],W=ct(N,v?["string"==typeof v?v:""]:[]),B=ut(_),C=bt({name:(null==P?void 0:P.name)||"__unused__"}),L=xt({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]});At({name:(null==B?void 0:B.name)||"__unused_brush__",xField:(null==B?void 0:B.xField)||("string"==typeof y?y:void 0),yField:(null==B?void 0:B.yField)||("string"==typeof p?p:void 0)});const T=P?{isActive:C.isActive,predicate:C.predicate}:null,R=Ue(z,v,b),D=t(()=>{const e=z.map(e=>"function"==typeof f?f(e):e[f]);return[Math.min(...e),Math.max(...e)]},[z,f]),$=t(()=>e=>{const t={fillOpacity:x,strokeWidth:A,stroke:w};return t.fill=v?Ye(e,v,R):qe,t.r=Ge(e,f,m,D),t},[v,R,f,m,D,x,A,w]),F=t(()=>dt($,T,P),[$,T,P]),H=void 0!==E?E:!!v,I=t(()=>{if(H&&v)return Ze({data:z,colorBy:v,colorScale:R,getColor:Ye,strokeColor:w,strokeWidth:A})},[H,v,z,R,w,A]),Y=t(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),a);return I&&120>e.right&&(e.right=120),e},[a,I]),X=i(e=>{N&&L.onHover(e)},[N,L]),G=t(()=>rt([{label:u||ot(y),accessor:y,role:"x"},{label:d||ot(p),accessor:p,role:"y"},{label:ot(f),accessor:f,role:"size"},...v?[{label:ot(v),accessor:v,role:"color"}]:[]]),[y,p,u,d,f,v]),q=st({componentName:"BubbleChart",data:z,accessors:{xAccessor:y,yAccessor:p},requiredProps:{sizeBy:f}});if(q)return e.createElement(it,{componentName:"BubbleChart",message:q,width:r,height:s});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:z,xAccessor:y,yAccessor:p,colorAccessor:v||void 0,sizeAccessor:f,sizeRange:m,pointStyle:F,colorScheme:b,size:[r,s],margin:Y,showAxes:!0,xLabel:u,yLabel:d,xFormat:h,yFormat:g,enableHover:k,showGrid:S},I&&{legend:I}),c&&{title:c}),l&&{className:l}),{tooltipContent:O?nt(O):G}),N&&{customHoverBehavior:X}),j&&{marginalGraphics:j}),M);return e.createElement(Fe,Object.assign({},V))}function Mt(n){const{data:o,width:r=600,height:s=400,margin:a={top:50,bottom:60,left:70,right:80},className:l,title:c,xAccessor:u="x",yAccessor:d="y",valueAccessor:h="value",xLabel:g,yLabel:y,xFormat:p,yFormat:f,colorScheme:m="blues",customColorScale:b,showValues:x=!1,valueFormat:A,cellBorderColor:w="#fff",cellBorderWidth:k=1,enableHover:S=!0,tooltip:O,frameProps:j={},selection:_,linkedHover:z}=n,W=o||[],B=ct(z,[]),C=bt({name:(null==_?void 0:_.name)||"__unused__"}),L=xt({name:(null==B?void 0:B.name)||"hover",fields:(null==B?void 0:B.fields)||[]}),T=_?{isActive:C.isActive,predicate:C.predicate}:null,R=t(()=>"function"==typeof h?e=>h(e):e=>e[h],[h]),D=t(()=>{const e=W.map(R);return[Math.min(...e),Math.max(...e)]},[W,R]),$=t(()=>"custom"===m&&b?b:v({blues:N,reds:P,greens:M,viridis:E}[m]||N).domain(D),[m,b,D]);t(()=>{const e=Ve(u),t=Ve(d);return{xBinCount:new Set(W.map(e)).size,yBinCount:new Set(W.map(t)).size}},[W,u,d]),t(()=>({coordinates:W}),[W]);const F=t(()=>e=>{const t=R(e);return{fill:$(t),stroke:w,strokeWidth:k}},[R,$,w,k]);t(()=>dt(F,T,_),[F,T,_]),t(()=>{if(!x)return;const t=(D[0]+D[1])/2;return(n,o)=>{const r=R(n),i=A?A(r):r+"";return e.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:R(n)>t?"#fff":"#000",fontSize:"12px"},i)}},[x,R,A,D]);const H=i(e=>{z&&L.onHover(e)},[z,L]),I=t(()=>rt([{label:g||ot(u),accessor:u,role:"x"},{label:y||ot(d),accessor:d,role:"y"},{label:ot(h),accessor:h,role:"value"}]),[u,d,g,y,h]),Y=st({componentName:"Heatmap",data:W,accessors:{xAccessor:u,yAccessor:d,valueAccessor:h}});if(Y)return e.createElement(it,{componentName:"Heatmap",message:Y,width:r,height:s});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:W,xAccessor:u,yAccessor:d,valueAccessor:h,size:[r,s],margin:a,showAxes:!0,xLabel:g,yLabel:y,xFormat:p,yFormat:f,enableHover:S},c&&{title:c}),l&&{className:l}),{tooltipContent:O?nt(O):I}),z&&{customHoverBehavior:H}),j);return e.createElement(Fe,Object.assign({},X))}function Pt({selections:e}){const t=vt(e=>e.setResolution);return s(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[]),null}function Nt({children:t,selections:n}){return e.createElement(mt,null,n&&e.createElement(Pt,{selections:n}),t)}kt.displayName="LineChart",St.displayName="AreaChart",Et.displayName="StackedAreaChart",Ot.displayName="Scatterplot",jt.displayName="BubbleChart",Mt.displayName="Heatmap";const _t="__splomIdx",zt={top:4,bottom:4,left:4,right:4};function Wt({frameRef:t,cellSize:n,onBrush:r}){const i=o(null),a=n-zt.left-zt.right,l=n-zt.top-zt.bottom;return s(()=>{if(!i.current)return;const e=p(i.current).select(".brush-g"),n=y().extent([[0,0],[a,l]]).on("brush end",e=>{var n;const o=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!o)return;if(!e.selection)return void r(null);const[[i,s],[a,l]]=e.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];r(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[a,l,t,r]),e.createElement("svg",{ref:i,width:n,height:n,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${zt.left},${zt.top})`}))}function Bt({data:t,xField:n,yField:r,cellSize:s,pointRadius:a,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:y,onPointHover:p}){const f=o(null),m=bt({name:d,clientId:`splom-${n}-${r}`}),v=At({name:d,xField:n,yField:r}),b=bt({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,A=i(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),w=i(e=>{if(!e)return void(null==p||p(null));const t=e.data,n=null==t?void 0:t[_t];void 0!==n&&(x({[_t]:[n]}),null==p||p(t,e.x+zt.left,e.y+zt.top))},[x,p]),k=i(e=>{const t={opacity:l,r:a};return t.fill=c?Ye(e,c,u):qe,"hover"===y?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*a,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,a,y,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:s,height:s}},e.createElement(Fe,{ref:f,chartType:"scatter",data:t,size:[s,s],xAccessor:n,yAccessor:r,pointStyle:k,margin:zt,showAxes:!1,enableHover:"hover"===y,customHoverBehavior:"hover"===y?w:void 0,tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&e.createElement(Wt,{frameRef:f,cellSize:s,xField:n,yField:r,onBrush:A}))}function Ct({data:n,field:o,label:r,cellSize:i,bins:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const u=bt({name:a,clientId:"splom-diag-"+o}),d=bt({name:l,clientId:`splom-diag-${o}-hover`}),h="hover"===c?d:u,g=h.isActive,y=h.predicate,p=t(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const t=Math.min(...e),r=(Math.max(...e)-t)/s||1,a=Array(s).fill(0),l=Array(s).fill(0);for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-t)/r),s-1);a[i]++,g&&!y(e)||l[i]++}const c=Math.max(...a,1);return{bars:a.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/c*(i-24),count:e})),selectedBars:l.map((e,t)=>({x:t/s*i,w:i/s-1,h:e/c*(i-24),count:e})),max:c}},[n,o,s,i,g,y]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),p.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:"#ccc",opacity:g?.3:.6})),g&&p.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:qe,opacity:.7})))}function Lt({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function Tt(n){const{data:o,fields:s,fieldLabels:a={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:y="histogram",histogramBins:p=20,brushMode:f="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:A,idAccessor:w,className:k}=n,S="splom",E="splom-hover",O=m?"hover":f?"brush":"hover",j=vt(e=>e.clearSelection),[M,P]=r(null),N=i(()=>{j(E),P(null)},[j,E]),_=t(()=>(o||[]).map((e,t)=>void 0!==e[_t]?e:Object.assign(Object.assign({},e),{[_t]:t})),[o]),z=Ue(_,l,c),W=void 0!==A?A:!!l,B=t(()=>{if(!W||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(_.map(t=>t[e]))].map(e=>({label:e+"",color:z?z(e+""):qe})):null},[W,l,_,z]),C=t(()=>({display:"grid",gridTemplateColumns:"40px "+s.map(()=>u+"px").join(" "),gridTemplateRows:s.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[s,u,d,40]);return e.createElement("div",{className:k,style:{position:"relative"}},B&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},B.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:C,onMouseLeave:"hover"===O?N:void 0},s.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t),s.map((o,r)=>n===r?"label"===y?e.createElement(Lt,{key:"diag-"+t,label:a[t]||t,cellSize:u}):e.createElement(Ct,{key:"diag-"+t,data:_,field:t,label:a[t]||t,cellSize:u,bins:p,colorBy:l,colorScale:z,brushSelectionName:S,hoverSelectionName:E,unselectedOpacity:v,mode:O}):e.createElement(Bt,{key:`cell-${t}-${o}`,data:_,xField:o,yField:t,fieldLabels:a,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:l,colorScale:z,brushSelectionName:S,hoverSelectionName:E,unselectedOpacity:v,showGrid:b,tooltip:x,mode:O,onPointHover:"hover"===O?(e,i,s)=>{P(e?{datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=s?s:0}:null)}:void 0})))),e.createElement("div",null)," ",s.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},a[t]||t))),M&&"hover"===O&&(()=>{const t=M.datum,n=a[M.xField]||M.xField,o=a[M.yField]||M.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=w?"function"==typeof w?w(t):t[w]:"Row "+t[_t];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function Rt(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(Nt,{selections:r},e.createElement(Tt,Object.assign({},t)))}function Dt(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="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=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}Rt.displayName="ScatterplotMatrix";const $t={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=s?s(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=a(c.pieces[0],s?i:e.name),p=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),s=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(de(e.x,n,e.width,Math.abs(s),y,p,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),s=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(de(n,e.x,Math.abs(s),e.width,y,p,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:s}=e,{r:a,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const i=n.get(d[o])||[];for(const n of i){const i=r(n),l=s(n,e.name);if(u){const r=e.x+o*t,s=a(0),u=a(i);c.push(de(r,Math.min(s,u),t,Math.abs(s-u),l,n,d[o]))}else{const r=e.x+o*t,s=a(0),u=a(i);c.push(de(Math.min(s,u),r,Math.abs(u-s),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=a.length>0,p=2*Math.PI,f=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:s(t),u=y&&a[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=f+(e.pctStart+e.pct/2)*p,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="vertical"===a;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],a=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:s(a),y=c?s(a):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:Dt,donut:Dt,boxplot:function(e,t){var n,o,r,i,s;const{scales:a,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=a,y=[],p="vertical"===g,f=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const a=t[0],l=t[t.length-1],c=null!==(n=A(t,.25))&&void 0!==n?n:a,g=null!==(o=A(t,.5))&&void 0!==o?o:(a+l)/2,m=null!==(r=A(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,w=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:a,k=null!==(s=[...t].reverse().find(e=>x>=e))&&void 0!==s?s:l,S=d(e.pieceData[0],e.name),E=[];if(f)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=p?e.middle:h(n),r=p?h(n):e.middle;E.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:p?e.middle:0,y:p?0:e.middle,projection:p?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(w),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(k),stats:{min:w,q1:c,median:g,q3:m,max:k},style:S,datum:e.pieceData,category:e.name,outliers:E}),f)for(const e of E)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:s,config:a,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,y=a.bins||20,p=!1!==a.showIQR;for(const e of Object.values(s)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],s=t[t.length-1],a=(s-i)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/a),y-1)]++;const f=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*a),o=d[t]/f*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*a);v+=` L ${e.middle-d[t]/f*m} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*a),o=d[t]/f*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*a)} ${e.middle+d[t]/f*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(p&&t.length>=4){const e=null!==(n=A(t,.25))&&void 0!==n?n:i,a=null!==(o=A(t,.5))&&void 0!==o?o:(i+s)/2,l=null!==(r=A(t,.75))&&void 0!==r?r:s;x={q1Pos:u(e),medianPos:u(a),q3Pos:u(l)}}const w=g?{x:e.x,y:Math.min(u(s),u(i)),width:e.width,height:Math.abs(u(s)-u(i))}:{x:Math.min(u(i),u(s)),y:e.x,width:Math.abs(u(s)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:w,iqrLine:x,style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,s=a(n+t*o),c=a(n+(t+1)*o);l.push(de(Math.min(s,c),e.x+e.width-i,Math.abs(c-s),i,g,{bin:t,count:r[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:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),p=a(e.pieceData[0],e.name),f=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*f}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/y*f} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,style:Object.assign(Object.assign({},p),{fillOpacity:null!==(n=p.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=n,l=[],c="horizontal"===a;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,a]=n,u=i(t,e.name);if(c){const n=s(Math.min(o,a)),r=s(Math.max(o,a));l.push(de(n,e.x,r-n,e.width,u,t,e.name))}else{const n=s(Math.max(o,a)),r=s(Math.min(o,a));l.push(de(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class Ft{constructor(e){this.rExtent=new se,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 ie(e.windowSize),this.getO=ye(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>ge(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new se)):(this.getR=ge(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=ye(e.stackBy),this.getGroup=ye(e.groupBy),this.getColor=ye(e.colorAccessor),this.getConnector=ye(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new ie(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:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),s=this.computeValueDomain(o,i),a="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=b().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=f().domain(s).range([o,n])}else a?(c=b().domain(i).range([0,e.height]).padding(l),u=f().domain(s).range([0,e.width])):(c=b().domain(i).range([0,e.width]).padding(l),u=f().domain(s).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[s,l]=i.extent;s===1/0&&(s=0,l=1);const c=l-s,u=c>0?c*(t.extentPadding||.05):1;return s-=u,l+=u,s>0&&(s=0),a?f().domain([s,l]).range([0,e.width]):f().domain([s,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.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,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),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 r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let s=0,a=0;if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>a&&(a=e);for(const e of n.values())s>e&&(s=e)}else if("bar"===r){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>a&&(a=e),s>e&&(s=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>a&&(a=e),s>e&&(s=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(s=e),t!==-1/0&&(a=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(s=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(a=this.config.rExtent[1]));const l=a-s,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(s-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(a+=c),"bar"!==r&&"clusterbar"!==r||(s>0&&(s=0),0>a&&(a=0)),[s,a]}buildColumns(e,t,n,o,r){var i;const s={},a=new Map;for(const t of e){const e=this.getO(t);a.has(e)||a.set(e,[]),a.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=a.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 i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return s}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=$t[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const s=[],{projection:a}=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=r(t);if(!n)continue;let o,s;"point"===e.type?(o=e.x,s=e.y):(o=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:s,datum:t,category:i(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],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return s}(n,r);r=[...e,...r]}return r}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,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(n=i.minOpacity)&&void 0!==n?n:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return s+Math.pow(.5,a/e)*(1-s)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>a?1:s;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.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=i.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,r),a=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:a*s})}}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",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 n=this.timestampBuffer.get(e);if(null==n)continue;const o=r-n;i>o&&(t._pulseIntensity=1-o/i,t._pulseColor=s)}}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 r=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,r;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e];let a=null;if("point"===i.type?a="p:"+e:"rect"===i.type&&(a=`r:${i.group||""}:${null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!a)continue;const l=this.prevPositionMap.get(a);l&&("point"===i.type?l.x===i.x&&l.y===i.y||(i._targetX=i.x,i._targetY=i.y,i.x=l.x,i.y=l.y,s=!0):"rect"===i.type&&(l.x===i.x&&l.y===i.y&&l.w===i.w&&l.h===i.h||(i._targetX=i.x,i._targetY=i.y,i._targetW=i.w,i._targetH=i.h,i.x=l.x,i.y=l.y,i.w=null!==(o=l.w)&&void 0!==o?o:i.w,i.h=null!==(r=l.h)&&void 0!==r?r:i.h,s=!0)))}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),i="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?r:1-Math.pow(1-r,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)*i,e.y=t.y+(e._targetY-t.y)*i}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}`,r=this.prevPositionMap.get(t);if(!r)continue;e.x=r.x+(e._targetX-r.x)*i,e.y=r.y+(e._targetY-r.y)*i,void 0!==r.w&&(e.w=r.w+(e._targetW-r.w)*i,e.h=r.h+(e._targetH-r.h)*i)}if(r>=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 Ht(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 It(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function Yt(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;let s=Math.atan2(r,o);0>s&&(s+=2*Math.PI);let a=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>a&&(a+=2*Math.PI),0>l&&(l+=2*Math.PI),!(a>l?s>=a||l>=s:s>=a&&l>=s))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 Xt(e,t,n){const o=e.columnWidth/2;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}}else{const r=e.y-o,i=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>n||n>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category}}return null}function Gt(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:s}=e.bounds;return o>t||t>o+i||r>n||n>r+s?null:{datum:e.datum,x:o+i/2,y:r+s/2,distance:0,category:e.category}}function qt(e){return Math.round(100*e)/100+""}function Vt(n){const{width:o,height:r,totalWidth:i,totalHeight:s,margin:a,scales:l,showAxes:c,oLabel:u,rLabel:d,oFormat:h,rFormat:g,showGrid:y,title:p,legend:f,foregroundGraphics:m,annotations:v,svgAnnotationRules:b,annotationFrame:x,children:A}=n,w="radial"===(null==l?void 0:l.projection),k="horizontal"===(null==l?void 0:l.projection),S=t(()=>c&&l&&!w?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:h?h(e):e}}):[],[c,l,h,w]),E=t(()=>c&&l&&!w?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(g||qt)(e)})):[],[c,l,g,w]),O=t(()=>v&&0!==v.length&&b?v.map((e,t)=>b(e,t,{scales:l?{time:l.r,value:l.r}:null,timeAxis:"x",width:o,height:r})).filter(Boolean):null,[v,b,o,r,x]);return c||p||f||m||O&&O.length>0||y||A?e.createElement("svg",{width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},y&&l&&!w&&e.createElement("g",{className:"ordinal-grid"},E.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:k?t.pixel:0,y1:k?0:t.pixel,x2:k?t.pixel:o,y2:k?r:t.pixel,stroke:"#e0e0e0",strokeWidth:1}))),c&&l&&!w&&e.createElement("g",{className:"ordinal-axes"},k?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),S.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),E.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},d)):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"#ccc",strokeWidth:1}),S.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"#ccc",strokeWidth:1}),E.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-a.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-a.left}, ${r/2})`,style:{userSelect:"none"}},d))),O,m,A),p&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof p?p:null),f&&e.createElement("g",{transform:`translate(${i-a.right+10}, ${a.top})`},"object"==typeof(j=f)&&null!==j&&!e.isValidElement(j)&&"legendGroups"in j?e.createElement(Ee,{legendGroups:f.legendGroups,title:"",width:100}):f)):null;var j}const Ut=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)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},Qt=(e,t,n,o)=>{var r,i;const s=t.filter(e=>"violin"===e.type);for(const t of s){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.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,e.beginPath(),e.moveTo(0,t.iqrLine.q1Pos),e.lineTo(0,t.iqrLine.q3Pos),e.stroke(),e.beginPath(),e.arc(0,t.iqrLine.medianPos,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1),e.restore()}},Zt=(e,t,n,o)=>{var r,i,s;const a=t.filter(e=>"connector"===e.type);if(0===a.length)return;const l=new Map;for(const e of a){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!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.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!==(s=n.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},Kt=e=>[Zt,...e],Jt={bar:Kt([We]),clusterbar:Kt([We]),point:Kt([ze]),swarm:Kt([ze]),pie:[Ut],donut:[Ut],boxplot:Kt([(e,t,n,o)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const n=t.columnWidth/2,o="vertical"===t.projection,s=t.style.fill||"#007bff",a=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=a,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=s,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,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()}},ze]),violin:Kt([Qt]),histogram:Kt([We]),ridgeline:Kt([Qt]),timeline:Kt([We])},en={top:50,right:40,bottom:60,left:70},tn={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 nn({hover:t}){var n,o,r,i;const s=t.data||{};if(Array.isArray(s)){const t=(null===(n=s[0])||void 0===n?void 0:n.category)||"",o=s.length;return e.createElement("div",{className:"semiotic-tooltip",style:tn},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=s.bin&&null!=s.count){const t=s.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:tn},s.category&&e.createElement("div",{style:{fontWeight:"bold"}},s.category+""),e.createElement("div",null,"Count: ",s.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const a=s.category||s.name||s.group||s.__rName||"",l=null!==(i=null!==(r=null!==(o=s.value)&&void 0!==o?o:s.__rValue)&&void 0!==r?r:s.pct)&&void 0!==i?i:"";if(!a&&""===l){const t=Object.entries(s).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:tn},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:tn},a&&e.createElement("div",{style:{fontWeight:"bold"}},a+""),""!==l&&e.createElement("div",null,"number"==typeof l?l.toLocaleString():l+""))}const on=n(function(n,l){const{chartType:c,runtimeMode:u,data:d,oAccessor:h="category",rAccessor:g="value",colorAccessor:y,stackBy:p,groupBy:f,multiAxis:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,projection:A="vertical",size:w=[600,400],margin:k,barPadding:S,innerRadius:E,normalize:O,startAngle:j,dynamicColumnWidth:M,bins:P,showOutliers:N,showIQR:_,amplitude:z,connectorAccessor:W,connectorStyle:B,rExtent:C,oExtent:L,extentPadding:T=.05,oSort:R,windowMode:D="sliding",windowSize:$=200,pieceStyle:F,summaryStyle:H,colorScheme:I,barColors:Y,showAxes:X=!0,oLabel:G,rLabel:q,oFormat:V,rFormat:U,enableHover:Q=!0,hoverAnnotation:Z,tooltipContent:K,customHoverBehavior:J,annotations:ee,svgAnnotationRules:te,showGrid:ne=!1,legend:oe,backgroundGraphics:ie,foregroundGraphics:se,title:ae,className:le,background:ce,centerContent:ue,decay:de,pulse:he,transition:ge,staleness:ye}=n,pe=t(()=>Object.assign(Object.assign({},en),k),[k]),fe=w[0]-pe.left-pe.right,me=w[1]-pe.top-pe.bottom,ve=o(null),be=o(!0),xe=o(0),Ae=o(null),we=o(()=>{}),[ke,Se]=r(null),[Ee,Oe]=r(null),[je,Me]=r(0),[Pe,Ne]=r(!1),_e=Q||Z,ze="streaming"===u,We=t(()=>({chartType:c,runtimeMode:ze?"streaming":"bounded",windowSize:$,windowMode:D,extentPadding:T,projection:A,oAccessor:ze?void 0:h,rAccessor:ze?void 0:g,colorAccessor:y,stackBy:p,groupBy:f,multiAxis:m,timeAccessor:ze?v:void 0,valueAccessor:ze?b||("string"==typeof g||"function"==typeof g?g:void 0):void 0,categoryAccessor:ze?x||h:void 0,rExtent:C,oExtent:L,barPadding:S,innerRadius:E,normalize:O,startAngle:j,dynamicColumnWidth:M,bins:P,showOutliers:N,showIQR:_,amplitude:z,connectorAccessor:W,connectorStyle:B,oSort:R,pieceStyle:F,summaryStyle:H,colorScheme:I,barColors:Y,decay:de,pulse:he,transition:ge,staleness:ye}),[c,$,D,T,A,h,g,y,p,f,m,v,b,x,C,L,S,E,O,j,M,P,N,_,z,W,B,R,F,H,I,Y,de,he,ge,ye,ze]),Be=o(null);Be.current||(Be.current=new Ft(We));const Ce=i(()=>{xe.current||(xe.current=requestAnimationFrame(()=>we.current()))},[]);s(()=>{var e;null===(e=Be.current)||void 0===e||e.updateConfig(We),be.current=!0,Ce()},[We,Ce]);const Le=o(null);Le.current||(Le.current=new re(e=>{const t=Be.current;t&&t.ingest(e)&&(be.current=!0,Ce())}));const Te=i(e=>{var t;null===(t=Le.current)||void 0===t||t.push(e)},[]),Re=i(e=>{var t;null===(t=Le.current)||void 0===t||t.pushMany(e)},[]),De=i(()=>{var e,t;null===(e=Le.current)||void 0===e||e.clear(),null===(t=Be.current)||void 0===t||t.clear(),be.current=!0,Ce()},[Ce]);a(l,()=>({push:Te,pushMany:Re,clear:De,getData:()=>{var e,t;return null!==(t=null===(e=Be.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Be.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[Te,Re,De]),s(()=>{var e;d&&(null===(e=Le.current)||void 0===e||e.setBoundedData(d))},[d]);const $e=o(()=>{}),Fe=o(()=>{});$e.current=e=>{if(!_e)return;const t=ve.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>fe||0>r||r>me)return void(Ae.current&&(Ae.current=null,Se(null),J&&J(null),Ce()));const i=Be.current;if(!i||0===i.scene.length)return;const s="radial"===A,a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=Ht(i,t,n);break;case"point":e=It(i,t,n);break;case"wedge":e=Yt(i,t,n);break;case"boxplot":e=Xt(i,t,n);break;case"violin":e=Gt(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?o-fe/2:o,s?r-me/2:r);if(!a)return void(Ae.current&&(Ae.current=null,Se(null),J&&J(null),Ce()));const l={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};Ae.current=l,Se(l),J&&J(l),Ce()},Fe.current=()=>{Ae.current&&(Ae.current=null,Se(null),J&&J(null),Ce())};const He=i(e=>$e.current(e),[]),Ie=i(()=>Fe.current(),[]);we.current=()=>{var e,t;xe.current=0;const n=ve.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Be.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),s=r.advanceTransition(i),a=be.current;a&&!s&&(r.computeScene({width:fe,height:me}),be.current=!1);const l="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=w[0]*l,n.height=w[1]*l,n.style.width=w[0]+"px",n.style.height=w[1]+"px",o.scale(l,l),o.clearRect(0,0,w[0],w[1]);const u=null!==(e=null==ye?void 0:ye.threshold)&&void 0!==e?e:5e3,d=ye&&r.lastIngestTime>0&&i-r.lastIngestTime>u;d&&(o.globalAlpha=null!==(t=null==ye?void 0:ye.dimOpacity)&&void 0!==t?t:.5),ce&&(o.fillStyle=ce,o.fillRect(0,0,w[0],w[1]));const h="radial"===A;h?(o.save(),o.translate(pe.left+fe/2,pe.top+me/2)):o.translate(pe.left,pe.top);const g=Jt[c]||[],y={width:fe,height:me};for(const e of g)e(o,r.scene,r.scales,y);h&&o.restore(),d&&(o.globalAlpha=1),a&&r.scales&&(Oe(r.scales),Me(e=>e+1)),(null==ye?void 0:ye.showBadge)&&Ne(!!d),(s||r.hasActivePulses)&&(xe.current=requestAnimationFrame(()=>we.current()))},s(()=>(Ce(),()=>{xe.current&&cancelAnimationFrame(xe.current)}),[Ce]),s(()=>{be.current=!0,Ce()},[c,fe,me,X,ce,Ce]),s(()=>{if(!ye)return;const e=setInterval(()=>{var e;const t=Be.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ye.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Pe&&(Ne(r),be.current=!0,Ce())},1e3);return()=>clearInterval(e)},[ye,Pe,Ce]);const Ye=_e&&ke?K?K(ke):e.createElement(nn,{hover:ke}):null,Xe="radial"===A,Ge=ke?Xe?ke.x+fe/2:ke.x:0,qe=ke?Xe?ke.y+me/2:ke.y:0,Ve=Ye?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:pe.left+Ge,top:pe.top+qe,transform:`translate(${Ge>.7*fe?"calc(-100% - 12px)":"12px"}, ${.3*me>qe?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Ye):null;return e.createElement("div",{className:"stream-ordinal-frame"+(le?" "+le:""),style:{position:"relative",width:w[0],height:w[1]},onMouseMove:_e?He:void 0,onMouseLeave:_e?Ie:void 0},ie&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:w[0],height:w[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${pe.left},${pe.top})`},ie)),e.createElement("canvas",{ref:ve,style:{position:"absolute",top:0,left:0,width:w[0],height:w[1]}}),e.createElement(Vt,{width:fe,height:me,totalWidth:w[0],totalHeight:w[1],margin:pe,scales:Ee,showAxes:X,oLabel:G,rLabel:q,oFormat:V,rFormat:U,showGrid:ne,title:ae,legend:oe,foregroundGraphics:se,annotations:ee,svgAnnotationRules:te,annotationFrame:je}),ue&&"radial"===A&&e.createElement("div",{style:{position:"absolute",left:pe.left+fe/2,top:pe.top+me/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ue),(null==ye?void 0:ye.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ye.badgePosition?{top:4,left:4}:"bottom-left"===ye.badgePosition?{bottom:4,left:4}:"bottom-right"===ye.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Pe?"#dc3545":"#28a745",color:"white"})},Pe?"STALE":"LIVE"),Ve)});function rn(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:g,valueLabel:y,valueFormat:p,colorBy:f,colorScheme:m="category10",sort:v=!1,barPadding:b=5,enableHover:x=!0,showGrid:A=!1,showLegend:w,tooltip:k,frameProps:S={},selection:E,linkedHover:O}=n,j=o||[],M=ct(O,f?["string"==typeof f?f:""]:[]),P=bt({name:(null==E?void 0:E.name)||"__unused__"}),N=xt({name:(null==M?void 0:M.name)||"hover",fields:(null==M?void 0:M.fields)||[]}),_=E?{isActive:P.isActive,predicate:P.predicate}:null,z=Qe(j,v,d),W=Ue(j,f,m),B=t(()=>e=>{const t={};return t.fill=f?Ye(e,f,W):qe,t},[f,W]),C=t(()=>dt(B,_,E),[B,_,E]),L=void 0!==w?w:!!f,T=t(()=>{if(L&&f)return Ze({data:z,colorBy:f,colorScale:W,getColor:Ye})},[L,f,z,W]),R=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return T&&120>e.right&&(e.right=120),e},[a,T]),D=i(e=>{O&&N.onHover(e?e.data||e:null)},[O,N]),$=t(()=>{const t=f&&f!==u;return n=>{const o=n.data||n,r="function"==typeof u?u(o):o[u],i="function"==typeof d?d(o):o[d],s=t?"function"==typeof f?f(o):o[f]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},r+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof i?i.toLocaleString():i+""),null!=s&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof f?f:"group",": ",s+""))}},[u,d,f]),F=st({componentName:"BarChart",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return e.createElement(it,{componentName:"BarChart",message:F,width:r,height:s});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:z,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:C,size:[r,s],margin:R,barPadding:b,enableHover:x,showAxes:!0,oLabel:g,rLabel:y,rFormat:p,showGrid:A,oSort:v},T&&{legend:T}),c&&{title:c}),l&&{className:l}),{tooltipContent:k?nt(k):$}),O&&{customHoverBehavior:D}),S);return e.createElement(on,Object.assign({},H))}function sn(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",stackBy:d,valueAccessor:h="value",orientation:g="vertical",categoryLabel:y,valueLabel:p,valueFormat:f,colorBy:m,colorScheme:v="category10",normalize:b=!1,barPadding:x=5,enableHover:A=!0,showGrid:w=!1,showLegend:k=!0,tooltip:S,frameProps:E={},selection:O,linkedHover:j}=n,M=o||[],P=m||d,N=ct(j,P?["string"==typeof P?P:""]:[]),_=bt({name:(null==O?void 0:O.name)||"__unused__"}),z=xt({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),W=O?{isActive:_.isActive,predicate:_.predicate}:null,B=Ue(M,P,v),C=t(()=>e=>P?{fill:Ye(e,P,B)}:{fill:qe},[P,B]),L=t(()=>dt(C,W,O),[C,W,O]),T=t(()=>{if(k)return Ze({data:M,colorBy:P,colorScale:B,getColor:Ye})},[k,M,P,B]),R=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:120},a);return T&&120>e.right&&(e.right=120),e},[a,T]),D=i(e=>{j&&z.onHover(e)},[j,z]),$=t(()=>{const t=Ve(d),n=Ve(u),o=Ve(h);return r=>{const i=r.data||r;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},t(i)+""),e.createElement("div",{style:{marginTop:"4px"}},n(i)+""," · ",Number(o(i)).toLocaleString()))}},[d,u,h]),F=st({componentName:"StackedBarChart",data:M,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{stackBy:d}});if(F)return e.createElement(it,{componentName:"StackedBarChart",message:F,width:r,height:s});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:M,oAccessor:u,rAccessor:h,stackBy:d,normalize:b,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:L,size:[r,s],margin:R,barPadding:x,enableHover:A,showAxes:!0,oLabel:y,rLabel:p,rFormat:f,showGrid:w},T&&{legend:T}),c&&{title:c}),l&&{className:l}),{tooltipContent:S?nt(S):$}),j&&{customHoverBehavior:D}),E);return e.createElement(on,Object.assign({},H))}function an(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",groupBy:d,valueAccessor:h="value",orientation:g="vertical",categoryLabel:y,valueLabel:p,valueFormat:f,colorBy:m,colorScheme:v="category10",barPadding:b=5,enableHover:x=!0,showGrid:A=!1,showLegend:w=!0,tooltip:k,frameProps:S={},selection:E,linkedHover:O}=n,j=o||[],M=m||d,P=ct(O,M?["string"==typeof M?M:""]:[]),N=bt({name:(null==E?void 0:E.name)||"__unused__"}),_=xt({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=E?{isActive:N.isActive,predicate:N.predicate}:null,W=Ue(j,M,v),B=t(()=>e=>M?{fill:Ye(e,M,W)}:{fill:qe},[M,W]),C=t(()=>dt(B,z,E),[B,z,E]),L=t(()=>{if(w)return Ze({data:j,colorBy:M,colorScale:W,getColor:Ye})},[w,j,M,W]),T=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return L&&120>e.right&&(e.right=120),e},[a,L]),R=i(e=>{O&&_.onHover(e)},[O,_]),D=t(()=>{const t=Ve(d),n=Ve(u),o=Ve(h);return r=>{const i=r.data||r;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},t(i)+""),e.createElement("div",{style:{marginTop:"4px"}},n(i)+""," · ",Number(o(i)).toLocaleString()))}},[d,u,h]),$=st({componentName:"GroupedBarChart",data:j,accessors:{categoryAccessor:u,valueAccessor:h},requiredProps:{groupBy:d}});if($)return e.createElement(it,{componentName:"GroupedBarChart",message:$,width:r,height:s});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:j,oAccessor:u,rAccessor:h,groupBy:d,projection:"horizontal"===g?"horizontal":"vertical",pieceStyle:C,size:[r,s],margin:T,barPadding:b,enableHover:x,showAxes:!0,oLabel:y,rLabel:p,rFormat:f,showGrid:A},L&&{legend:L}),c&&{title:c}),l&&{className:l}),{tooltipContent:k?nt(k):D}),O&&{customHoverBehavior:R}),S);return e.createElement(on,Object.assign({},F))}function ln(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:g,valueLabel:y,valueFormat:p,colorBy:f,colorScheme:m="category10",sizeBy:v,sizeRange:b=[3,8],pointRadius:x=4,pointOpacity:A=.7,categoryPadding:w=20,enableHover:k=!0,showGrid:S=!1,showLegend:E,tooltip:O,frameProps:j={},selection:M,linkedHover:P}=n,N=o||[],_=ct(P,f?["string"==typeof f?f:""]:["string"==typeof u?u:""]),z=bt({name:(null==M?void 0:M.name)||"__unused__"}),W=xt({name:(null==_?void 0:_.name)||"hover",fields:(null==_?void 0:_.fields)||[]}),B=M?{isActive:z.isActive,predicate:z.predicate}:null,C=Ue(N,f,m),L=t(()=>{if(!v)return;const e=N.map(e=>"function"==typeof v?v(e):e[v]);return[Math.min(...e),Math.max(...e)]},[N,v]),T=t(()=>e=>{const t={fillOpacity:A};return t.fill=f?Ye(e,f,C):qe,t.r=v?Ge(e,v,b,L):x,t},[f,C,v,b,L,x,A]),R=t(()=>dt(T,B,M),[T,B,M]),D=void 0!==E?E:!!f,$=t(()=>{if(D&&f)return Ze({data:N,colorBy:f,colorScale:C,getColor:Ye})},[D,f,N,C]),F=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return $&&120>e.right&&(e.right=120),e},[a,$]),H=i(e=>{P&&W.onHover(e)},[P,W]),I=t(()=>{const t=Ve(d),n=Ve(u);return o=>{const r=o.data||o,i=n(r),s=t(r),a=f?"function"==typeof f?f(r):r[f]:null,l=v?"function"==typeof v?v(r):r[v]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof f?f:"color",": ",a+""),null!=l&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof v?v:"size",": ","number"==typeof l?l.toLocaleString():l+""))}},[u,d,f,v]),Y=st({componentName:"SwarmPlot",data:N,accessors:{categoryAccessor:u,valueAccessor:d}});if(Y)return e.createElement(it,{componentName:"SwarmPlot",message:Y,width:r,height:s});const X=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:N,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:R,size:[r,s],margin:F,barPadding:w,enableHover:k,showAxes:!0,oLabel:g,rLabel:y,rFormat:p,showGrid:S},$&&{legend:$}),c&&{title:c}),l&&{className:l}),{tooltipContent:O?nt(O):I}),P&&{customHoverBehavior:H}),j);return e.createElement(on,Object.assign({},X))}function cn(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",categoryLabel:g,valueLabel:y,valueFormat:p,colorBy:f,colorScheme:m="category10",showOutliers:v=!0,categoryPadding:b=20,enableHover:x=!0,showGrid:A=!1,showLegend:w,tooltip:k,frameProps:S={},selection:E,linkedHover:O}=n,j=o||[],M=ct(O,f?["string"==typeof f?f:""]:["string"==typeof u?u:""]),P=bt({name:(null==E?void 0:E.name)||"__unused__"}),N=xt({name:(null==M?void 0:M.name)||"hover",fields:(null==M?void 0:M.fields)||[]}),_=E?{isActive:P.isActive,predicate:P.predicate}:null,z=Ue(j,f,m),W=t(()=>e=>{const t=f?Ye(e,f,z):qe;return{fill:t,stroke:t,fillOpacity:.8}},[f,z]),B=t(()=>dt(W,_,E),[W,_,E]),C=void 0!==w?w:!!f,L=t(()=>{if(C&&f)return Ze({data:j,colorBy:f,colorScale:z,getColor:Ye})},[C,f,j,z]),T=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return L&&120>e.right&&(e.right=120),e},[a,L]),R=i(e=>{O&&N.onHover(e)},[O,N]),D=t(()=>t=>{const n=t.data||t,o=n.stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(n.category||t.category||"")+""),null!=o.median&&e.createElement(e.Fragment,null,e.createElement("div",null,"Median: ",o.median.toLocaleString()),e.createElement("div",null,"Q1: ",o.q1.toLocaleString()),e.createElement("div",null,"Q3: ",o.q3.toLocaleString()),e.createElement("div",null,"Min: ",o.min.toLocaleString()),e.createElement("div",null,"Max: ",o.max.toLocaleString())))},[]),$=st({componentName:"BoxPlot",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if($)return e.createElement(it,{componentName:"BoxPlot",message:$,width:r,height:s});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:j,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:B,showOutliers:v,size:[r,s],margin:T,barPadding:b,enableHover:x,showAxes:!0,oLabel:g,rLabel:y,rFormat:p,showGrid:A},L&&{legend:L}),c&&{title:c}),l&&{className:l}),{tooltipContent:k?nt(k):D}),O&&{customHoverBehavior:R}),S);return e.createElement(on,Object.assign({},F))}function un(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",bins:h=25,relative:g=!1,categoryLabel:y,valueLabel:p,valueFormat:f,colorBy:m,colorScheme:v="category10",categoryPadding:b=20,enableHover:x=!0,showGrid:A=!1,showLegend:w,tooltip:k,frameProps:S={},selection:E,linkedHover:O}=n,j=o||[],M=ct(O,m?["string"==typeof m?m:""]:["string"==typeof u?u:""]),P=bt({name:(null==E?void 0:E.name)||"__unused__"}),N=xt({name:(null==M?void 0:M.name)||"hover",fields:(null==M?void 0:M.fields)||[]}),_=E?{isActive:P.isActive,predicate:P.predicate}:null,z=Ue(j,m,v),W=t(()=>e=>{const t=m?Ye(e,m,z):qe;return{fill:t,stroke:t,fillOpacity:.8}},[m,z]),B=t(()=>dt(W,_,E),[W,_,E]),C=void 0!==w?w:!!m,L=t(()=>{if(C&&m)return Ze({data:j,colorBy:m,colorScale:z,getColor:Ye})},[C,m,j,z]),T=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return L&&120>e.right&&(e.right=120),e},[a,L]),R=i(e=>{O&&N.onHover(e)},[O,N]),D=t(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),$=st({componentName:"Histogram",data:j,accessors:{categoryAccessor:u,valueAccessor:d}});if($)return e.createElement(it,{componentName:"Histogram",message:$,width:r,height:s});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:j,oAccessor:u,rAccessor:d,projection:"horizontal",summaryStyle:B,bins:h,normalize:g,size:[r,s],margin:T,barPadding:b,enableHover:x,showAxes:!0,oLabel:y,rLabel:p,rFormat:f,showGrid:A},L&&{legend:L}),c&&{title:c}),l&&{className:l}),{tooltipContent:k?nt(k):D}),O&&{customHoverBehavior:R}),S);return e.createElement(on,Object.assign({},F))}function dn(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="vertical",bins:g=25,showIQR:y=!0,categoryLabel:p,valueLabel:f,valueFormat:m,colorBy:v,colorScheme:b="category10",categoryPadding:x=20,enableHover:A=!0,showGrid:w=!1,showLegend:k,tooltip:S,frameProps:E={},selection:O,linkedHover:j}=n,M=o||[],P=ct(j,v?["string"==typeof v?v:""]:["string"==typeof u?u:""]),N=bt({name:(null==O?void 0:O.name)||"__unused__"}),_=xt({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=O?{isActive:N.isActive,predicate:N.predicate}:null,W=Ue(M,v,b),B=t(()=>e=>{const t=v?Ye(e,v,W):qe;return{fill:t,stroke:t,fillOpacity:.6}},[v,W]),C=t(()=>dt(B,z,O),[B,z,O]),L=void 0!==k?k:!!v,T=t(()=>{if(L&&v)return Ze({data:M,colorBy:v,colorScale:W,getColor:Ye})},[L,v,M,W]),R=t(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},a);return T&&120>e.right&&(e.right=120),e},[a,T]),D=i(e=>{j&&_.onHover(e)},[j,_]),$=t(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=(Array.isArray(n)?n:[]).map(e=>{const t="function"==typeof d?d(e):e[d];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),i=r.length,s=i>0?r[Math.floor(i/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),i>0&&e.createElement("div",null,"n = ",i),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[d]),F=st({componentName:"ViolinPlot",data:M,accessors:{categoryAccessor:u,valueAccessor:d}});if(F)return e.createElement(it,{componentName:"ViolinPlot",message:F,width:r,height:s});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:M,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",summaryStyle:C,bins:g,showIQR:y,size:[r,s],margin:R,barPadding:x,enableHover:A,showAxes:!0,oLabel:p,rLabel:f,rFormat:m,showGrid:w},T&&{legend:T}),c&&{title:c}),l&&{className:l}),{tooltipContent:S?nt(S):$}),j&&{customHoverBehavior:D}),E);return e.createElement(on,Object.assign({},H))}function hn(n){const{data:o,width:r=600,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",categoryLabel:g,valueLabel:y,valueFormat:p,colorBy:f,colorScheme:m="category10",sort:v=!0,dotRadius:b=5,categoryPadding:x=10,enableHover:A=!0,showGrid:w=!0,showLegend:k,tooltip:S,frameProps:E={},selection:O,linkedHover:j}=n,M=o||[],P=ct(j,f?["string"==typeof f?f:""]:["string"==typeof u?u:""]),N=bt({name:(null==O?void 0:O.name)||"__unused__"}),_=xt({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),z=O?{isActive:N.isActive,predicate:N.predicate}:null,W=Qe(M,v,d),B=Ue(M,f,m),C=t(()=>e=>{const t={r:b,fillOpacity:.8};return t.fill=f?Ye(e,f,B):qe,t},[f,B,b]),L=t(()=>dt(C,z,O),[C,z,O]),T=void 0!==k?k:!!f,R=t(()=>{if(T&&f)return Ze({data:W,colorBy:f,colorScale:B,getColor:Ye})},[T,f,W,B]),D=t(()=>{const e=Object.assign({top:50,bottom:60,left:120,right:40},a);return R&&120>e.right&&(e.right=120),e},[a,R]),$=i(e=>{j&&_.onHover(e)},[j,_]),F=t(()=>t=>{const n=t.data||t,o="function"==typeof u?u(n):n[u],r="function"==typeof d?d(n):n[d];return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof r?r.toLocaleString():r+""))},[u,d]),H=st({componentName:"DotPlot",data:M,accessors:{categoryAccessor:u,valueAccessor:d}});if(H)return e.createElement(it,{componentName:"DotPlot",message:H,width:r,height:s});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:W,oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:L,size:[r,s],margin:D,barPadding:x,enableHover:A,showAxes:!0,oLabel:g,rLabel:y,rFormat:p,showGrid:w,oSort:v},R&&{legend:R}),c&&{title:c}),l&&{className:l}),{tooltipContent:S?nt(S):F}),j&&{customHoverBehavior:$}),E);return e.createElement(on,Object.assign({},I))}function gn(n){const{data:o,width:r=400,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",colorBy:h,colorScheme:g="category10",startAngle:y=0,enableHover:p=!0,showLegend:f=!0,tooltip:m,frameProps:v={},selection:b,linkedHover:x}=n,A=o||[],w=h||u,k=ct(x,w?["string"==typeof w?w:""]:[]),S=bt({name:(null==b?void 0:b.name)||"__unused__"}),E=xt({name:(null==k?void 0:k.name)||"hover",fields:(null==k?void 0:k.fields)||[]}),O=b?{isActive:S.isActive,predicate:S.predicate}:null,j=Ue(A,w,g),M=t(()=>e=>w?{fill:Ye(e,w,j)}:{fill:qe},[w,j]),P=t(()=>dt(M,O,b),[M,O,b]),N=t(()=>{if(f)return Ze({data:A,colorBy:w,colorScale:j,getColor:Ye})},[f,A,w,j]),_=t(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},a);return N&&120>e.right&&(e.right=120),e},[a,N]),z=i(e=>{x&&E.onHover(e)},[x,E]),W=t(()=>{const t=h&&h!==u;return n=>{var o;const r=(null===(o=n.data)||void 0===o?void 0:o[0])||n.data||n,i="function"==typeof u?u(r):r[u],s="function"==typeof d?d(r):r[d],a=t?"function"==typeof h?h(r):r[h]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof h?h:"group",": ",a+""))}},[u,d,h]),B=st({componentName:"PieChart",data:A,accessors:{categoryAccessor:u,valueAccessor:d}});if(B)return e.createElement(it,{componentName:"PieChart",message:B,width:r,height:s});const C=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:A,oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:P,startAngle:y,size:[r,s],margin:_,enableHover:p,showAxes:!1},N&&{legend:N}),c&&{title:c}),l&&{className:l}),{tooltipContent:m?nt(m):W}),x&&{customHoverBehavior:z}),v);return e.createElement(on,Object.assign({},C))}function yn(n){const{data:o,width:r=400,height:s=400,margin:a,className:l,title:c,categoryAccessor:u="category",valueAccessor:d="value",innerRadius:h=60,centerContent:g,colorBy:y,colorScheme:p="category10",startAngle:f=0,enableHover:m=!0,showLegend:v=!0,tooltip:b,frameProps:x={},selection:A,linkedHover:w}=n,k=o||[],S=y||u,E=ct(w,S?["string"==typeof S?S:""]:[]),O=bt({name:(null==A?void 0:A.name)||"__unused__"}),j=xt({name:(null==E?void 0:E.name)||"hover",fields:(null==E?void 0:E.fields)||[]}),M=A?{isActive:O.isActive,predicate:O.predicate}:null,P=Ue(k,S,p),N=t(()=>e=>S?{fill:Ye(e,S,P)}:{fill:qe},[S,P]),_=t(()=>dt(N,M,A),[N,M,A]),z=t(()=>{if(v)return Ze({data:k,colorBy:S,colorScale:P,getColor:Ye})},[v,k,S,P]),W=t(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},a);return z&&120>e.right&&(e.right=120),e},[a,z]),B=i(e=>{w&&j.onHover(e)},[w,j]),C=t(()=>{const t=y&&y!==u;return n=>{var o;const r=(null===(o=n.data)||void 0===o?void 0:o[0])||n.data||n,i="function"==typeof u?u(r):r[u],s="function"==typeof d?d(r):r[d],a=t?"function"==typeof y?y(r):r[y]:null;return e.createElement("div",{className:"semiotic-tooltip",style:Ke},e.createElement("div",{style:{fontWeight:"bold"}},i+""),e.createElement("div",{style:{marginTop:"4px"}},"number"==typeof s?s.toLocaleString():s+""),null!=a&&e.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof y?y:"group",": ",a+""))}},[u,d,y]),L=st({componentName:"DonutChart",data:k,accessors:{categoryAccessor:u,valueAccessor:d}});if(L)return e.createElement(it,{componentName:"DonutChart",message:L,width:r,height:s});const T=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:k,oAccessor:u,rAccessor:d,projection:"radial",pieceStyle:_,innerRadius:h,startAngle:f,centerContent:g,size:[r,s],margin:W,enableHover:m,showAxes:!1},z&&{legend:z}),c&&{title:c}),l&&{className:l}),{tooltipContent:b?nt(b):C}),w&&{customHoverBehavior:B}),x);return e.createElement(on,Object.assign({},T))}on.displayName="StreamOrdinalFrame",rn.displayName="BarChart",sn.displayName="StackedBarChart",an.displayName="GroupedBarChart",ln.displayName="SwarmPlot",cn.displayName="BoxPlot",un.displayName="Histogram",dn.displayName="ViolinPlot",hn.displayName="DotPlot",gn.displayName="PieChart",yn.displayName="DonutChart";const pn={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},fn={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class mn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const i=n[r.edgeIndex];if(!i||!i.bezier){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=vn(i.bezier,r.t,r.offset);r.x=s.x,r.y=s.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function vn(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,s=Math.min(Math.floor(i),r-1),a=i-s,[l,c,u,d]=e[s],h=bn(l,c,u,d,a),g=d.x-l.x,y=d.y-l.y,p=Math.sqrt(g*g+y*y);if(p>.001){const e=g/p;h.x+=-y/p*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,s]=e.points,a=bn(o,r,i,s,t),l=s.x-o.x,c=s.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;a.x+=-c/u*n*e.halfWidth*2,a.y+=t*n*e.halfWidth*2}return a}function bn(e,t,n,o,r){const i=1-r,s=i*i,a=s*i,l=r*r,c=l*r;return{x:a*e.x+3*s*r*t.x+3*i*l*n.x+c*o.x,y:a*e.y+3*s*r*t.y+3*i*l*n.y+c*o.y}}const xn=(e=1)=>(t,n)=>{const o=t[t.length-1];return o&&Math.round(o.x/e)===Math.round(n.x/e)&&Math.round(o.y/e)===Math.round(n.y/e)||t.push(n),t},An=e=>{let t,n,o,r,i,s,a,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.y1,s=e.target.y0,a=B(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${s}L${o},${s}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,a=B(t,n),o=a(.5),r=a(.5),i=e.y0-e.sankeyWidth/2,s=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${s} ${n},${s}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function wn(e){const t=function(){const e=$();let t=function(e){return e.x},n=function(e){return e.y},o=function(e){return e.r},r=F;function i(i){if(i.multiple){const s=o,l=i.multiple.reduce((e,t)=>e+t.weight,0);o=()=>l;let c=a(i.points).filter(e=>"forward"===e.direction).reduce(xn(),[]);const u=[];return i.multiple.forEach((e,t)=>{o=()=>e.weight;const n=a(c);u.push(n);const r=i.multiple[t+1];if(r){const e=n.reverse().filter(e=>"back"===e.direction).reduce(xn(),[]);o=()=>r.weight;const t=a(e);c=t.reverse().filter(e=>"back"===e.direction).reduce(xn(),[])}}),o=s,u.map(o=>e.x(t).y(n).curve(r)(o))}const s=a(i).reduce(xn(),[]);return e.x(t).y(n).curve(r)(s)}return i.x=function(e){return arguments.length?(t=e,i):t},i.y=function(e){return arguments.length?(n=e,i):n},i.r=function(e){return arguments.length?(o=e,i):o},i.interpolate=function(e){return arguments.length?(r=e,i):r},i;function s(e){const r=n(e.target)-n(e.source),i=t(e.target)-t(e.source),s=Math.atan2(i,r)+Math.PI/2,a=s+.5*Math.PI,l=s+.5*Math.PI;return{x1:t(e.source)+o(e.source)*Math.cos(a),y1:n(e.source)-o(e.source)*Math.sin(a),x2:t(e.target)+o(e.target)*Math.cos(l),y2:n(e.target)-o(e.target)*Math.sin(l)}}function a(e){const t=[];let n=0,o={x1:0,y1:0,x2:0,y2:0};for(;e.length>n;){if(n!==e.length-1&&(o=s({source:e[n],target:e[n+1]}),t.push({x:o.x1,y:o.y1,direction:"forward"},{x:o.x2,y:o.y2,direction:"forward"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=l(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n++}for(n--;n>=0;){if(0!==n&&(o=s({source:e[n],target:e[n-1]}),t.push({x:o.x1,y:o.y1,direction:"back"},{x:o.x2,y:o.y2,direction:"back"}),t.length>3)){const e=t.length-1,n={a:t[e-3],b:t[e-2]},o={a:t[e-1],b:t[e]},r=l(n.a.x,n.a.y,n.b.x,n.b.y,o.a.x,o.a.y,o.b.x,o.b.y);!0===r.found&&(n.b.x=r.x,n.b.y=r.y,o.a.x=r.x,o.a.y=r.y)}n--}return t}function l(e,t,n,o,r,i,s,a){let l,c;const u={x:null,y:null,found:!1},d=(a-i)*(n-e)-(s-r)*(o-t);if(0===d)return u;l=t-i,c=e-r;const h=(n-e)*l-(o-t)*c;return l=((s-r)*l-(a-i)*c)/d,c=h/d,u.x=e+l*(n-e),u.y=t+l*(o-t),l>0&&1>l&&c>0&&1>c&&(u.found=!0),u}}();return t.x(e=>e.x),t.y(e=>e.y),t.r(()=>e.sankeyWidth/2),t("down"===e.direction?[{x:e.circularPathData.sourceY,y:e.circularPathData.sourceX},{x:e.circularPathData.sourceY,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.leftFullExtent},{x:e.circularPathData.verticalFullExtent,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.rightFullExtent},{x:e.circularPathData.targetY,y:e.circularPathData.targetX}]:[{x:e.circularPathData.sourceX,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.sourceY},{x:e.circularPathData.leftFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.verticalFullExtent},{x:e.circularPathData.rightFullExtent,y:e.circularPathData.targetY},{x:e.circularPathData.targetX,y:e.circularPathData.targetY}])}const kn={left:D,right:R,center:T,justify:L},Sn={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,s,a;if(0===e.length)return;const l="vertical"===n.orientation?"down":"right",c=n.nodeAlign||"justify",u=null!==(r=n.nodeWidth)&&void 0!==r?r:15,d=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,h=null!==(s=n.iterations)&&void 0!==s?s:100,g=e.map(e=>Object.assign({},e)),y=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));let p;p="down"===l?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const f=C().extent(p).links(y).nodes(g).nodeAlign(kn[c]||L).nodeId(e=>e.id).nodeWidth(u).iterations(h);f.nodePaddingRatio&&f.nodePaddingRatio(d),f();for(const t of g){const n=e.find(e=>e.id===t.id);n&&(n.x0=t.x0,n.x1=t.x1,n.y0=t.y0,n.y1=t.y1,n.value=t.value,n.depth=t.depth,n.sourceLinks=t.sourceLinks,n.targetLinks=t.targetLinks,n.width=t.x1-t.x0,n.height=t.y1-t.y0,n.x=t.x0+(t.x1-t.x0)/2,n.y=t.y0+(t.y1-t.y0)/2)}for(const n of y){const o=n.source,r=n.target,i="object"==typeof o&&null!==o?o.id:o+"",s="object"==typeof r&&null!==r?r.id:r+"",c=t.find(e=>("string"==typeof e.source?e.source:e.source.id)===i&&("string"==typeof e.target?e.target:e.target.id)===s);if(c){c.y0=n.y0,c.y1=n.y1,c.sankeyWidth=null!==(a=n.width)&&void 0!==a?a:0,c.circular=!!n.circular,c.circularPathData=n.circularPathData,c.direction=l;const t=e.find(e=>e.id===i),o=e.find(e=>e.id===s);t&&(c.source=t),o&&(c.target=o)}}},buildScene(e,t,n,o){var r,i;const s="vertical"===n.orientation?"down":"right",a=n.nodeStyle,l=n.edgeStyle,c=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,u=n.edgeColorBy||"source",d=Array.isArray(n.colorScheme)?n.colorScheme:W,h=new Map;e.forEach((e,t)=>{h.set(e.id,d[t%d.length])});const g=[],y=[],p=[];for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=a?a(t):{},r={fill:o.fill||h.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};g.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const f=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of f){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o;o=e.circular&&e.circularPathData?wn(e):An(e);let r="#999";l?r=l(e).fill||r:"target"===u&&n?r=h.get(n.id)||r:t&&(r=h.get(t.id)||r);const s=l?l(e):{},a={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:c,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};y.push({type:"bezier",pathD:o,bezierCache:e.bezier,style:a,datum:e})}if(!1!==n.showLabels){const t=(m=n.nodeLabel)?"function"==typeof m?m:e=>e[m]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,l,c;"down"===s?(a=n.x0+e/2,l=n.y1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),l=n.y0+r/2),p.push({x:a,y:l,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:g,sceneEdges:y,labels:p}}},En={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const s=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),a=null!==(i=n.forceStrength)&&void 0!==i?i:.1,l=o[0]/2,c=o[1]/2;for(let t=0;e.length>t;t++){const n=e[t];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(t+.5),o=2.399963229728653*t;n.x=l+e*Math.cos(o),n.y=c+e*Math.sin(o)}}const u=jn(n.nodeSize,n.nodeSizeRange,e),d=I().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),h=o[1]/o[0],g=Y().force("charge",X().strength(e=>-25*(e=>u(e))(e))).force("x",G(o[0]/2).strength(.1*h)).force("y",q(o[1]/2).strength(.1));if(g.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));g.force("link",d),g.force("link").links(e)}.1>g.alpha()&&g.alpha(1),g.stop();for(let e=0;s>e;++e)g.tick();for(const n of t){if("string"==typeof n.source){const t=e.find(e=>e.id===n.source);t&&(n.source=t)}if("string"==typeof n.target){const t=e.find(e=>e.id===n.target);t&&(n.target=t)}}},buildScene(e,t,n,o){var r,i,s;const a=n.nodeStyle,l=n.edgeStyle,c=jn(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:W,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=a?a(t):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}for(const n of t){const t="object"==typeof n.source?n.source:On(e,n.source),o="object"==typeof n.target?n.target:On(e,n.target);if(!t||!o)continue;if(null==t.x||null==t.y)continue;if(null==o.x||null==o.y)continue;const r=l?l(n):{},a={stroke:r.stroke||"#999",strokeWidth:null!==(i=r.strokeWidth)&&void 0!==i?i:1,opacity:null!==(s=r.opacity)&&void 0!==s?s:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:a,datum:n})}if(!1!==n.showLabels){const t=(p=n.nodeLabel)?"function"==typeof p?p:e=>e[p]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:h,sceneEdges:g,labels:y}}};function On(e,t){return e.find(e=>e.id===t)}function jn(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],s=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===s.length)return()=>i[0];const a=null!==(o=w(s))&&void 0!==o?o:0,l=null!==(r=k(s))&&void 0!==r?r:1;if(a===l)return()=>(i[0]+i[1])/2;const c=f().domain([a,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const Mn=W,Pn={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:s}=n,a=Math.min(o[0],o[1])/2,l=a-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const y=e.length,p=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);p[n][o]=r}const f=U().padAngle(r);s&&f.sortGroups(s);const m=f(p),v=m.groups,b=H().innerRadius(l).outerRadius(a);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(const n of t){const t="string"==typeof n.source?n.source:n.source.id,o="string"==typeof n.target?n.target:n.target.id,r=e.find(e=>e.id===t),i=e.find(e=>e.id===o);r&&(n.source=r),i&&(n.target=i)}for(const n of m){const o=e[n.source.index].id,r=e[n.target.index].id,i=t.find(e=>{const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id;return t===o&&n===r||t===r&&n===o});i&&(i.chordData=n)}},buildScene(e,t,n,o){var r,i;const{groupWidth:s=20,edgeOpacity:a=.5}=n,l=Math.min(o[0],o[1])/2,c=l-s,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,y=n.edgeColorBy||"source",p=Array.isArray(n.colorScheme)?n.colorScheme:Mn,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const m=V().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(n).fill||f.get(n.id)||p[t%p.length]:f.get(n.id)||p[t%p.length];const s=h?h(n):{},a={fill:i,stroke:s.stroke||"black",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:a,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m({source:Object.assign(Object.assign({},t.source),{startAngle:t.source.startAngle-Math.PI/2,endAngle:t.source.endAngle-Math.PI/2}),target:Object.assign(Object.assign({},t.target),{startAngle:t.target.startAngle-Math.PI/2,endAngle:t.target.endAngle-Math.PI/2})});if(!n)continue;const o=Nn(n,u,d);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=f.get(n.id)||r:t&&(r=f.get(t.id)||r)}const s=g?g(e):{},l={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:a,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(A=n.nodeLabel)?"function"==typeof A?A:e=>e[A]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;x.push({x:u+Math.cos(s)*o,y:d+Math.sin(s)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var A;return{sceneNodes:v,sceneEdges:b,labels:x}}};function Nn(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const _n={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const s=n.chartType,a=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=Q(i,a);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(s){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=ne();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=te();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const s=null!==(r=t.padding)&&void 0!==r?r:4,a=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=J().size([n,o]).tile(ee).padding(s);a>0&&l.paddingTop(a),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;K().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;Z().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:Ln(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===s||"cluster"===s?zn(i,o,n):"treemap"===s||"partition"===s?Wn(i,o):"circlepack"===s&&Bn(i,o),i.__hierarchyNode=o,e.push(i),y.set(o,i)}if("tree"===s||"cluster"===s)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var s,a,l,c,u;const d=[],h=[],g=[],y=n.treeOrientation||"vertical",p="radial"===y,f=o[0]/2,m=o[1]/2,v="number"==typeof(b=n.nodeSize)?b:5;var b;for(const t of e){let e=t.x,n=t.y;p&&(e+=f,n+=m);const o=r(t),i={fill:o.fill||"#4d430c",stroke:o.stroke||"#fff",strokeWidth:null!==(s=o.strokeWidth)&&void 0!==s?s:1,opacity:o.opacity};d.push({type:"circle",cx:e,cy:n,r:v,style:i,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(a=n.edgeOpacity)&&void 0!==a?a:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,s=n.x,a=n.y;p&&(o+=f,r+=m,s+=f,a+=m);const u=Cn(o,r,s,a,y),d=i(e),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:x};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Tn(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,s=n.x,a=n.y;if(p&&(s+=f,a+=m),p){const e=s-f,t=a-m,n=Math.sqrt(e*e+t*t);n>0?(o=s+e/n*10,r=a+t/n*10,i=0>e?"end":"start"):(o=s,r=a-12,i="middle")}else"horizontal"===y?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=s-v-6,i="end"):(o=s+v+6,i="start"),r=a):(o=s,r=a+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const s=[],a=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const a=o(n);let c=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,stroke:a.stroke||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};s.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Tn(t.nodeLabel);for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;if((null===(i=o.data)||void 0===i?void 0:i.children)&&o.data.children.length>0&&"partition"!==t.chartType)continue;const s=n?n(o):o.id;s&&(30>e||16>r||a.push({x:o.x0+e/2,y:o.y0+r/2,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,r)/6))}))}}return{sceneNodes:s,sceneEdges:[],labels:a}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,s,a,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const a=o(n);let l=a.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.length]);const u={fill:l,stroke:a.stroke||"#fff",strokeWidth:null!==(i=a.strokeWidth)&&void 0!==i?i:1,opacity:null!==(s=a.opacity)&&void 0!==s?s:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Tn(t.nodeLabel);for(const t of e){const e=null!==(a=t.__radius)&&void 0!==a?a:5,o=n?n(t):t.id;if(!o)continue;if(15>e)continue;const r=!((null===(l=t.data)||void 0===l?void 0:l.children)&&t.data.children.length>0);u.push({x:t.x,y:r?t.y:t.y-e+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:r?void 0:"#000",stroke:r?void 0:"#fff",strokeWidth:r?void 0:3,paintOrder:r?void 0:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function zn(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Wn(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Bn(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Cn(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}function Ln(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Tn(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}const Rn={sankey:Sn,force:En,chord:Pn,tree:_n,cluster:_n,treemap:_n,circlepack:_n,partition:_n};function Dn(e){return Rn[e]}class $n{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},pn),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new mn(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},pn),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new mn(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:s="value"}=this.config,a="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear();for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Fn(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Fn(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Fn(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;this.nodes.has(t)||(this.nodes.set(t,Fn(t)),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Fn(n)),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),a=this.edges.get(s);return a?(a.value+=o,this.tension+=this.tensionConfig.weightChange):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=Dn(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0!==n.length||t.hierarchical){if(this.prepareForRelayout(),t.computeLayout(n,o,this.config,e),t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const e of n)this.nodes.set(e.id,e);for(const e of o)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}this.finalizeLayout(),this.saveTargetPositions(),n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration}),this.layoutVersion++}}buildScene(e){const t=Dn(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:s}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=s}advanceTransition(e){if(!this.transition)return!1;const t=Math.min((e-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-t,3);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0+(e._targetX0-e._prevX0)*n,e.x1=e._prevX1+(e._targetX1-e._prevX1)*n,e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n);for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,i=n.y0,s=B(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,s=B(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e.sankeyWidth||1)/2,n=e.circularPathData;let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.targetY,y:n.rightFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.leftFullExtent,y:n.sourceY},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.rightFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,s=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+s/3},{x:t.x+2*i/3,y:t.y+2*s/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.particlePool&&this.particlePool.clear()}}function Fn(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Hn(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{type:"node",datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;let s=Math.atan2(r,o);0>s&&(s+=2*Math.PI);let a,l=e.startAngle,c=e.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),a=l>c?s>=l||c>=s:s>=l&&c>=s,a){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}function In(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),s=document.createElement("canvas").getContext("2d");if(!s)return null;if(s.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,s="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&s?(i.x1+s.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let s=((t-e.x1)*o+(n-e.y1)*r)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*o,l=e.y1+s*r,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0}}catch(e){}return null}(e,t,n);default:return null}}function Yn(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:s,labels:a,title:l,legend:c,foregroundGraphics:u,annotations:d,svgAnnotationRules:h}=t;return e.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},a.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),d&&h&&d.map((t,r)=>{const i=h(t,r,{width:n,height:o});return i?e.createElement(e.Fragment,{key:"annotation-"+r},i):null}),u),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:s.top},l):null,c&&"object"==typeof c&&"legendGroups"in c?e.createElement("g",{transform:`translate(${r-s.right+10},${s.top})`},c.legendGroups.map((t,n)=>{var o;return e.createElement("g",{key:"legend-group-"+n},null===(o=t.items)||void 0===o?void 0:o.map((t,n)=>e.createElement("g",{key:"legend-item-"+n,transform:`translate(0,${20*n})`},e.createElement("rect",{x:0,y:0,width:12,height:12,fill:t.color,rx:2}),e.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},t.label))))})):c?e.createElement("g",{transform:`translate(${r-s.right+10},${s.top})`},c):null)}function Xn(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const s=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.5*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(s)),e.restore()}function Gn(e,t){var n;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),e.restore()}function qn(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const s=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(s)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(s)),e.restore()}function Vn(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Yn.displayName="NetworkSVGOverlay";const Un={top:20,right:80,bottom:20,left:80},Qn={top:40,right:40,bottom:40,left:40},Zn=new Set(["chord","force","circlepack"]),Kn=[800,600],Jn={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function eo({data:t}){var n,o,r,i,s,a;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:Jn},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let s=c;for(;s;){const e=null!==(i=null!==(o=null===(n=s.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=s.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:Jn},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===a?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=l.targetLinks)||void 0===a?void 0:a.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:Jn},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const to=n(function(n,l){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:g,nodeIDAccessor:y="id",sourceAccessor:p="source",targetAccessor:f="target",valueAccessor:m="value",childrenAccessor:v,hierarchySum:b,orientation:x="horizontal",nodeAlign:A="justify",nodePaddingRatio:w=.05,nodeWidth:k=15,iterations:S=300,forceStrength:E=.1,padAngle:O=.01,groupWidth:j=20,sortGroups:M,edgeSort:P,treeOrientation:N="vertical",edgeType:_="curve",padding:z,paddingTop:W,tensionConfig:B,showParticles:C=!1,particleStyle:L,nodeStyle:T,edgeStyle:R,colorBy:D,colorScheme:$="category10",edgeColorBy:F="source",edgeOpacity:H=.5,colorByDepth:I=!1,nodeSize:Y=8,nodeSizeRange:X=[5,20],nodeLabel:G,showLabels:q=!0,size:V=Kn,margin:U,className:Q,background:Z,enableHover:K=!0,tooltipContent:J,onTopologyChange:ee,annotations:te,svgAnnotationRules:ne,legend:oe,title:re,foregroundGraphics:ie,backgroundGraphics:se}=n,ae=Zn.has(c)?Qn:Un,le=Object.assign(Object.assign({},ae),U),ce=V[0]-le.left-le.right,ue=V[1]-le.top-le.bottom,de=t(()=>Object.assign(Object.assign({},pn),B),[B]),he=t(()=>Object.assign(Object.assign({},fn),L),[L]),ge=t(()=>({chartType:c,nodeIDAccessor:y,sourceAccessor:p,targetAccessor:f,valueAccessor:m,childrenAccessor:v,hierarchySum:b,orientation:x,nodeAlign:A,nodePaddingRatio:w,nodeWidth:k,iterations:S,forceStrength:E,padAngle:O,groupWidth:j,sortGroups:M,edgeSort:P,treeOrientation:N,edgeType:_,padding:z,paddingTop:W,tensionConfig:de,showParticles:C,particleStyle:he,nodeStyle:T,edgeStyle:R,nodeLabel:G,showLabels:q,colorBy:D,colorScheme:$,edgeColorBy:F,edgeOpacity:H,colorByDepth:I,nodeSize:Y,nodeSizeRange:X}),[c,y,p,f,m,v,b,x,A,w,k,S,E,O,j,M,P,N,_,z,W,de,C,he,T,R,G,q,D,$,F,H,I,Y,X]),ye=o(null),pe=o(0),fe=o(0),me=o(!0),ve=o(()=>{}),be=o(null);be.current||(be.current=new $n(ge));const[xe,Ae]=r(null),[we,ke]=r(0),[Se,Ee]=r(0),Oe=o(null),je=o(new Map),Me=o(0),Pe=i(e=>{if("function"==typeof D)return D(e);if("string"==typeof D&&e.data){const t=e.data[D];if(void 0!==t){if(!je.current.has(t+"")){const e=Array.isArray($)?$:Ie;je.current.set(t+"",e[Me.current++%e.length])}return je.current.get(t+"")}}if(!je.current.has(e.id)){const t=Array.isArray($)?$:Ie;je.current.set(e.id,t[Me.current++%t.length])}return je.current.get(e.id)},[D,$]);i(e=>{if("function"==typeof F)return F(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===F&&n?Pe(n):t?Pe(t):"#999"},[F,Pe]);const Ne=i(e=>{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===(he.colorBy||"source")&&n?Pe(n):t?Pe(t):"#999"},[he.colorBy,Pe]),_e="sankey"===c&&C,ze=i(()=>{pe.current&&!_e||pe.current||(pe.current=requestAnimationFrame(()=>ve.current()))},[_e]);s(()=>{var e;null===(e=be.current)||void 0===e||e.updateConfig(ge),me.current=!0,ze()},[ge,ze]);const We=i(()=>{const e=be.current;if(e&&(e.runLayout([ce,ue]),e.buildScene([ce,ue]),me.current=!0,ke(e.layoutVersion),ee)){const{nodes:t,edges:n}=e.getLayoutData();ee(t,n)}},[ce,ue,ee]),Be=i(e=>{const t=be.current;t&&(t.ingestEdge(e)&&We(),ze())},[We,ze]),Ce=i(e=>{const t=be.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&We(),ze()},[We,ze]),Le=i(()=>{var e;null===(e=be.current)||void 0===e||e.clear(),je.current.clear(),Me.current=0,ke(0),Ae(null),Oe.current=null,me.current=!0,ze()},[ze]),Te=i(()=>{const e=be.current;e&&(e.tension+=999,We(),ze())},[We,ze]);a(l,()=>({push:Be,pushMany:Ce,clear:Le,getTopology:()=>{var e,t;return null!==(t=null===(e=be.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},relayout:Te,getTension:()=>{var e,t;return null!==(t=null===(e=be.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Be,Ce,Le,Te]);const Re=["tree","cluster","treemap","circlepack","partition"].includes(c),De=Re?h||(Array.isArray(d)?void 0:d):void 0;s(()=>{const e=be.current;if(e)if(Re&&De)e.ingestHierarchy(De,[ce,ue]),e.buildScene([ce,ue]),me.current=!0,ze();else{const t=u||[],n=Array.isArray(d)?d:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[ce,ue]),e.buildScene([ce,ue]),me.current=!0,ze()}},[u,d,h,De,Re,ce,ue,ge,ze]),s(()=>{g&&g.length>0&&Ce(g)},[]);const $e=o(()=>{}),Fe=o(()=>{});$e.current=e=>{if(!K)return;const t=ye.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-le.left,r=e.clientY-n.top-le.top;if(0>o||o>ce||0>r||r>ue)return void(Oe.current&&(Oe.current=null,Ae(null),ze()));const i=be.current;if(!i)return;const s=function(e,t,n,o,r=30){let i=null,s=r,a=1/0;for(const t of e){const e=Hn(t,n,o);if(e)if("rect"===t.type){const n=t.w*t.h;a>n&&(i=e,a=n)}else s>e.distance&&(i=e,s=e.distance)}if(i)return i;for(const e of t){const t=In(e,n,o);t&&s>t.distance&&(i=t,s=t.distance)}return i}(i.sceneNodes,i.sceneEdges,o,r);if(!s)return void(Oe.current&&(Oe.current=null,Ae(null),ze()));const a={type:s.type,data:s.datum,x:s.x,y:s.y};Oe.current=a,Ae(a),ze()},Fe.current=()=>{Oe.current&&(Oe.current=null,Ae(null),ze())};const He=i(e=>$e.current(e),[]),Ye=i(()=>Fe.current(),[]);ve.current=()=>{var e;pe.current=0;const t=ye.current;if(!t)return;const n=t.getContext("2d");if(!n)return;const o=be.current;if(!o)return;const r=performance.now(),i=fe.current?Math.min((r-fe.current)/1e3,.1):.016;fe.current=r;const s=o.advanceTransition(r);(s||me.current)&&o.buildScene([ce,ue]);const a="undefined"!=typeof window&&window.devicePixelRatio||1;if(t.width=V[0]*a,t.height=V[1]*a,t.style.width=V[0]+"px",t.style.height=V[1]+"px",n.scale(a,a),n.translate(le.left,le.top),n.clearRect(-le.left,-le.top,V[0],V[1]),Z&&(n.fillStyle=Z,n.fillRect(0,0,ce,ue)),function(e,t){for(const n of t)switch(n.type){case"bezier":Xn(e,n);break;case"line":Gn(e,n);break;case"ribbon":qn(e,n);break;case"curved":Vn(e,n)}}(n,o.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.strokeRect(t.x,t.y,t.w,t.h)),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("circle"!==i.type)continue;const t=i;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore())}}(n,o.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(n,o.sceneNodes),C&&o.particlePool){const t=Array.from(o.edges.values());if(t.length>0){!function(e,t,n,o){var r,i;const s=null!==(r=o.spawnRate)&&void 0!==r?r:fn.spawnRate,a=null!==(i=o.maxPerEdge)&&void 0!==i?i:fn.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=a)continue;const i=r.value*s*n,l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<a;t++)e.spawn(o)}}(o.particlePool,t,i,he);const r=.5*(null!==(e=he.speedMultiplier)&&void 0!==e?e:1);o.particlePool.step(i,r,t),function(e,t,n,o,r){var i,s;const a=null!==(i=o.radius)&&void 0!==i?i:fn.radius,l=null!==(s=o.opacity)&&void 0!==s?s:fn.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const s=t.particles[i];if(!s.active)continue;const l=n[s.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(n,o.particlePool,t,he,Ne)}}const l=me.current;me.current=!1,(l||s)&&Ee(e=>e+1),(_e||s)&&(pe.current=requestAnimationFrame(()=>ve.current()))},s(()=>(ze(),()=>{pe.current&&cancelAnimationFrame(pe.current)}),[ze]),s(()=>{me.current=!0,ze()},[c,ce,ue,Z,ze]);const Xe=K&&xe?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:le.left+xe.x,top:le.top+xe.y,transform:`translate(${xe.x>.6*ce?"calc(-100% - 12px)":"12px"}, ${.3*ue>xe.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},J?J(xe):e.createElement(eo,{data:xe})):null,Ge=be.current;return e.createElement("div",{className:"stream-network-frame"+(Q?" "+Q:""),style:{position:"relative",width:V[0],height:V[1]},onMouseMove:K?He:void 0,onMouseLeave:K?Ye:void 0},se&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:V[0],height:V[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${le.left},${le.top})`},se)),e.createElement("canvas",{ref:ye,style:{position:"absolute",top:0,left:0}}),e.createElement(Yn,{width:ce,height:ue,totalWidth:V[0],totalHeight:V[1],margin:le,labels:(null==Ge?void 0:Ge.labels)||[],title:re,legend:oe,foregroundGraphics:ie,annotations:te,svgAnnotationRules:ne,annotationFrame:Se}),Xe)});function no(n){const{nodes:o,edges:r,width:i=600,height:s=600,margin:a,className:l,title:c,nodeIDAccessor:u="id",sourceAccessor:d="source",targetAccessor:h="target",nodeLabel:g,colorBy:y,colorScheme:p="category10",nodeSize:f=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:A=300,forceStrength:w=.1,showLabels:k=!1,enableHover:S=!0,showLegend:E,tooltip:O,frameProps:j={}}=n,M=o||[],P=r||[],N=Ue(M,y,p),_=t(()=>e=>{const t={};return t.fill=y?Ye(e.data||e,y,N):qe,"number"==typeof f&&(t.r=f),t},[y,N,f]),z=t(()=>e=>({stroke:b,strokeWidth:"number"==typeof v?v:"function"==typeof v?v(e):e[v]||1,opacity:x}),[v,b,x]),W=t(()=>{if(k&&g)return"function"==typeof g?g:e=>e[g]},[k,g]),B=void 0!==E?E:!!y,C=t(()=>{if(B&&y)return Ze({data:M,colorBy:y,colorScale:N,getColor:Ye})},[B,y,M,N]),L=t(()=>{const e=Object.assign(Object.assign({},{top:20,bottom:20,left:20,right:20}),a);return C&&120>e.right&&(e.right=120),e},[a,C]),T=lt({componentName:"ForceDirectedGraph",nodes:o,edges:r,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:u}});return T?e.createElement(it,{componentName:"ForceDirectedGraph",message:T,width:i,height:s}):e.createElement(to,Object.assign({chartType:"force",nodes:M,edges:P,size:[i,s],margin:L,nodeIDAccessor:u,sourceAccessor:d,targetAccessor:h,iterations:A,forceStrength:w,nodeStyle:_,edgeStyle:z,colorBy:y,colorScheme:p,nodeSize:f,nodeSizeRange:m,nodeLabel:W,showLabels:k,enableHover:S,tooltipContent:O?e=>nt(O)(e.data):void 0,legend:C,className:l,title:c},j))}function oo(n){const{nodes:o,edges:r,width:i=600,height:s=600,margin:a={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p="category10",edgeColorBy:f="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,showLabels:A=!0,enableHover:w=!0,edgeOpacity:k=.5,tooltip:S,frameProps:E={}}=n,O=r||[],j=t(()=>{if(o&&o.length>0)return o;const e=new Set;return O.forEach(t=>{const n="function"==typeof u?u(t):t[u],o="function"==typeof d?d(t):t[d];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[o,O,u,d]),M=Ue(j,y,p),P=t(()=>(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(y)r.fill=Ye(e.data||e,y,M);else{const i=Array.isArray(p)?p:He[p]||Ie,s=Array.isArray(i)?i:Ie,a=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=s[a%s.length]}return r},[y,M,p]),N=t(()=>e=>{const t={stroke:"black",strokeWidth:.5,fillOpacity:k,strokeOpacity:k};if("function"==typeof f)t.fill=f(e);else if("source"===f){const n="object"==typeof e.source?e.source:null;y&&n?t.fill=Ye(n.data||n,y,M):n&&(t.fill=P(n,n.index).fill)}else if("target"===f){const n="object"==typeof e.target?e.target:null;y&&n?t.fill=Ye(n.data||n,y,M):n&&(t.fill=P(n,n.index).fill)}return t},[f,y,M,P,k]),_=t(()=>{if(!A)return;const e=x||g;return"function"==typeof e?e:t=>t[e]},[A,x,g]),z=lt({componentName:"ChordDiagram",edges:r,edgesRequired:!0});return z?e.createElement(it,{componentName:"ChordDiagram",message:z,width:i,height:s}):e.createElement(to,Object.assign({chartType:"chord",nodes:j,edges:O,size:[i,s],margin:a,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:P,edgeStyle:N,colorBy:y,colorScheme:p,edgeColorBy:f,edgeOpacity:k,nodeLabel:_,showLabels:A,enableHover:w,tooltipContent:S?e=>nt(S)(e.data):void 0,className:l,title:c},E))}function ro(n){const{nodes:o,edges:r,width:i=800,height:s=600,margin:a={top:50,bottom:50,left:50,right:50},className:l,title:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:p="category10",edgeColorBy:f="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:A,showLabels:w=!0,enableHover:k=!0,edgeOpacity:S=.5,edgeSort:E,tooltip:O,frameProps:j={}}=n,M=r||[],P=t(()=>{if(o&&o.length>0)return o;const e=new Set;return M.forEach(t=>{const n="function"==typeof u?u(t):t[u],o="function"==typeof d?d(t):t[d];e.add(n),e.add(o)}),Array.from(e).map(e=>({id:e}))},[o,M,u,d]),N=Ue(P,y,p),_=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=y?Ye(e.data||e,y,N):"#4d430c",t},[y,N]),z=t(()=>e=>{const t={stroke:"none",strokeWidth:0,fillOpacity:S};if("function"==typeof f)t.fill=f(e);else if("source"===f){const n="object"==typeof e.source?e.source:null;y&&n?t.fill=Ye(n.data||n,y,N):n&&(t.fill=_(n).fill)}else if("target"===f){const n="object"==typeof e.target?e.target:null;y&&n?t.fill=Ye(n.data||n,y,N):n&&(t.fill=_(n).fill)}else"gradient"===f&&(t.fill="#999",t.fillOpacity=.7*S);return t},[f,y,N,_,S]),W=t(()=>{if(!w)return;const e=A||g;return"function"==typeof e?e:t=>t[e]},[w,A,g]),B=t(()=>{if("function"==typeof O)return O},[O]),C=lt({componentName:"SankeyDiagram",edges:r,edgesRequired:!0});return C?e.createElement(it,{componentName:"SankeyDiagram",message:C,width:i,height:s}):e.createElement(to,Object.assign({chartType:"sankey",nodes:P,edges:M,size:[i,s],margin:a,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:_,edgeStyle:z,colorBy:y,colorScheme:p,edgeColorBy:f,edgeOpacity:S,edgeSort:E,nodeLabel:W,showLabels:w,enableHover:k,tooltipContent:B?e=>B(e.data):void 0,className:l,title:c},j))}function io(n){const{data:o,width:r=600,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:a,title:l,layout:c="tree",orientation:u="vertical",childrenAccessor:d="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:y,colorScheme:p="category10",colorByDepth:f=!1,edgeStyle:m="curve",nodeLabel:v,showLabels:b=!0,nodeSize:x=5,enableHover:A=!0,tooltip:w,frameProps:k={}}=n,S=t(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof d?d(n):n[d];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,d]),E=t(()=>f?Xe(S.map((e,t)=>({depth:t%5})),"depth",p):y&&"function"!=typeof y?Xe(S,y,p):void 0,[S,y,f,p]),O=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?Ye({depth:e.depth||0},"depth",E):y?Ye(e.data||e,y,E):qe,t},[y,f,E]),j=t(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),M=t(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return"function"==typeof h?h:e=>e[h]||1},[c,h]),P=at({componentName:"TreeDiagram",data:o});return P?e.createElement(it,{componentName:"TreeDiagram",message:P,width:r,height:i}):e.createElement(to,Object.assign({chartType:c,data:o,size:[r,i],margin:s,nodeIDAccessor:g,childrenAccessor:d,hierarchySum:M,treeOrientation:u,edgeType:m,nodeStyle:O,edgeStyle:j,colorBy:y,colorScheme:p,colorByDepth:f,nodeSize:x,nodeLabel:b?v||g:void 0,showLabels:b,enableHover:A,tooltipContent:w?e=>nt(w)(e.data):void 0,className:a,title:l},k))}function so(n){const{data:o,width:r=600,height:i=600,margin:s={top:10,bottom:10,left:10,right:10},className:a,title:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,showLabels:p=!0,labelMode:f="leaf",nodeLabel:m,padding:v=4,paddingTop:b,enableHover:x=!0,tooltip:A,frameProps:w={}}=n,k=t(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,c]),S=t(()=>{if(!y&&h&&"function"!=typeof h)return Xe(k,h,g)},[k,h,y,g]),E=t(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return n.fill=y?e[(t.depth||0)%e.length]:h?Ye(t.data||t,h,S):qe,n}},[h,y,S]),O=t(()=>"function"==typeof u?u:e=>e[u]||1,[u]),j=void 0!==b?b:p&&"parent"===f?18:void 0,M=at({componentName:"Treemap",data:o});return M?e.createElement(it,{componentName:"Treemap",message:M,width:r,height:i}):e.createElement(to,Object.assign({chartType:"treemap",data:o,size:[r,i],margin:s,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:O,padding:v,paddingTop:j,nodeStyle:E,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:p?m||d:void 0,showLabels:p,enableHover:x,tooltipContent:A?e=>nt(A)(e.data):void 0,className:a,title:l},w))}function ao(n){const{data:o,width:r=600,height:i=600,margin:s={top:10,bottom:10,left:10,right:10},className:a,title:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,showLabels:p=!0,nodeLabel:f,circleOpacity:m=.7,padding:v=4,enableHover:b=!0,tooltip:x,frameProps:A={}}=n,w=t(()=>{if(!o)return[];const e=[],t=n=>{e.push(n);const o="function"==typeof c?c(n):n[c];o&&Array.isArray(o)&&o.forEach(t)};return t(o),e},[o,c]),k=t(()=>{if(!y&&h&&"function"!=typeof h)return Xe(w,h,g)},[w,h,y,g]),S=t(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const n={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:m};return n.fill=y?e[(t.depth||0)%e.length]:h?Ye(t.data||t,h,k):qe,n}},[h,y,k,m]),E=t(()=>"function"==typeof u?u:e=>e[u]||1,[u]),O=at({componentName:"CirclePack",data:o});return O?e.createElement(it,{componentName:"CirclePack",message:O,width:r,height:i}):e.createElement(to,Object.assign({chartType:"circlepack",data:o,size:[r,i],margin:s,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:E,padding:v,nodeStyle:S,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:p?f||d:void 0,showLabels:p,enableHover:b,tooltipContent:x?e=>nt(x)(e.data):void 0,className:a,title:l},A))}to.displayName="StreamNetworkFrame",no.displayName="ForceDirectedGraph",oo.displayName="ChordDiagram",ro.displayName="SankeyDiagram",io.displayName="TreeDiagram",so.displayName="Treemap",ao.displayName="CirclePack";const lo=n(function(t,n){const{size:r,width:s,height:l,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:g=200,data:y,timeAccessor:p,valueAccessor:f,timeExtent:m,valueExtent:v,extentPadding:b,stroke:x="#007bff",strokeWidth:A=2,strokeDasharray:w,showAxes:k=!0,background:S,enableHover:E,tooltipContent:O,tooltip:j,onHover:M,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:W,pulse:B,staleness:C,transition:L,linkedHover:T}=t,R=null!=s&&null!=l?[s,l]:r||[500,300],D=null!=O?O:j,$=o(null),F=ct(T),H=xt({name:(null==F?void 0:F.name)||"hover",fields:(null==F?void 0:F.fields)||[]}),I=i(e=>{M&&M(e),T&&H.onHover(e?e.data||e:null)},[M,T,H]);return a(n,()=>({push:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=$.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=$.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Fe,{ref:$,chartType:"line",runtimeMode:"streaming",size:R,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:g,data:y,timeAccessor:p,valueAccessor:f,xExtent:m,yExtent:v,extentPadding:b,lineStyle:{stroke:x,strokeWidth:A,strokeDasharray:w},showAxes:k,background:S,hoverAnnotation:E,tooltipContent:D,customHoverBehavior:I,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:W,pulse:B,staleness:C,transition:L})});lo.displayName="RealtimeLineChart";const co=n(function(t,n){const{binSize:r,size:s,width:l,height:c,margin:u,className:d,arrowOfTime:h="right",windowMode:g="sliding",windowSize:y=200,data:p,timeAccessor:f,valueAccessor:m,timeExtent:v,valueExtent:b,extentPadding:x,categoryAccessor:A,colors:w,fill:k,stroke:S,strokeWidth:E,gap:O,showAxes:j=!0,background:M,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L,linkedHover:T}=t,R=null!=l&&null!=c?[l,c]:s||[500,300],D=null!=N?N:_,$=o(null),F=ct(T),H=xt({name:(null==F?void 0:F.name)||"hover",fields:(null==F?void 0:F.fields)||[]}),I=i(e=>{z&&z(e),T&&H.onHover(e?e.data||e:null)},[z,T,H]);a(n,()=>({push:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=$.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=$.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=k&&(Y.fill=k),null!=S&&(Y.stroke=S),null!=E&&(Y.strokeWidth=E),null!=O&&(Y.gap=O),e.createElement(Fe,{ref:$,chartType:"bar",runtimeMode:"streaming",size:R,margin:u,className:d,arrowOfTime:h,windowMode:g,windowSize:y,data:p,timeAccessor:f,valueAccessor:m,xExtent:v,yExtent:b,extentPadding:x,binSize:r,categoryAccessor:A,barColors:w,barStyle:Y,showAxes:j,background:M,hoverAnnotation:P,tooltipContent:D,customHoverBehavior:I,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L})});co.displayName="RealtimeTemporalHistogram";const uo=co,ho=n(function(t,n){const{size:r,width:s,height:l,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:g=200,data:y,timeAccessor:p,valueAccessor:f,timeExtent:m,valueExtent:v,extentPadding:b,categoryAccessor:x,colors:A,radius:w,fill:k,opacity:S,stroke:E,strokeWidth:O,showAxes:j=!0,background:M,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L,linkedHover:T}=t,R=null!=s&&null!=l?[s,l]:r||[500,300],D=null!=N?N:_,$=o(null),F=ct(T),H=xt({name:(null==F?void 0:F.name)||"hover",fields:(null==F?void 0:F.fields)||[]}),I=i(e=>{z&&z(e),T&&H.onHover(e?e.data||e:null)},[z,T,H]);a(n,()=>({push:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=$.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=$.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=w&&(Y.radius=w),null!=k&&(Y.fill=k),null!=S&&(Y.opacity=S),null!=E&&(Y.stroke=E),null!=O&&(Y.strokeWidth=O),e.createElement(Fe,{ref:$,chartType:"swarm",runtimeMode:"streaming",size:R,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:g,data:y,timeAccessor:p,valueAccessor:f,xExtent:m,yExtent:v,extentPadding:b,categoryAccessor:x,barColors:A,swarmStyle:Y,showAxes:j,background:M,hoverAnnotation:P,tooltipContent:D,customHoverBehavior:I,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L})});ho.displayName="RealtimeSwarmChart";const go=n(function(t,n){const{size:r,width:s,height:l,margin:c,className:u,arrowOfTime:d="right",windowMode:h="sliding",windowSize:g=200,data:y,timeAccessor:p,valueAccessor:f,timeExtent:m,valueExtent:v,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:w,connectorWidth:k,gap:S,stroke:E,strokeWidth:O,showAxes:j=!0,background:M,enableHover:P,tooltipContent:N,tooltip:_,onHover:z,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L,linkedHover:T}=t,R=null!=s&&null!=l?[s,l]:r||[500,300],D=null!=N?N:_,$=o(null),F=ct(T),H=xt({name:(null==F?void 0:F.name)||"hover",fields:(null==F?void 0:F.fields)||[]}),I=i(e=>{z&&z(e),T&&H.onHover(e?e.data||e:null)},[z,T,H]);a(n,()=>({push:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=$.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=$.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=$.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const Y={};return null!=x&&(Y.positiveColor=x),null!=A&&(Y.negativeColor=A),null!=w&&(Y.connectorStroke=w),null!=k&&(Y.connectorWidth=k),null!=S&&(Y.gap=S),null!=E&&(Y.stroke=E),null!=O&&(Y.strokeWidth=O),e.createElement(Fe,{ref:$,chartType:"waterfall",runtimeMode:"streaming",size:R,margin:c,className:u,arrowOfTime:d,windowMode:h,windowSize:g,data:y,timeAccessor:p,valueAccessor:f,xExtent:m,yExtent:v,extentPadding:b,waterfallStyle:Y,showAxes:j,background:M,hoverAnnotation:P,tooltipContent:D,customHoverBehavior:I,annotations:W,svgAnnotationRules:B,tickFormatTime:C,tickFormatValue:L})});go.displayName="RealtimeWaterfallChart";const yo=n(function(t,n){const{size:r,width:i,height:s,margin:l,className:c,arrowOfTime:u="right",windowMode:d="sliding",windowSize:h=200,data:g,timeAccessor:y,valueAccessor:p,categoryAccessor:f,timeExtent:m,valueExtent:v,extentPadding:b,heatmapXBins:x=20,heatmapYBins:A=20,aggregation:w="count",showAxes:k=!0,background:S,enableHover:E,tooltipContent:O,tooltip:j,onHover:M,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:W,pulse:B,staleness:C}=t,L=null!=i&&null!=s?[i,s]:r||[500,300],T=null!=O?O:j,R=o(null);return a(n,()=>({push:e=>{var t;return null===(t=R.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=R.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=R.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=R.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Fe,{ref:R,chartType:"heatmap",runtimeMode:"streaming",size:L,margin:l,className:c,arrowOfTime:u,windowMode:d,windowSize:h,data:g,timeAccessor:y,valueAccessor:p,categoryAccessor:f,xExtent:m,yExtent:v,extentPadding:b,heatmapXBins:x,heatmapYBins:A,heatmapAggregation:w,showAxes:k,background:S,hoverAnnotation:E,tooltipContent:T,customHoverBehavior:M,annotations:P,svgAnnotationRules:N,tickFormatTime:_,tickFormatValue:z,decay:W,pulse:B,staleness:C})});yo.displayName="RealtimeHeatmap";let[po]=ht(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));const fo={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},mo={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[vo,bo]=ht(e=>({theme:fo,setTheme(t){e(e=>"light"===t?{theme:fo}:"dark"===t?{theme:mo}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function xo({theme:t}){const n=bo(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function Ao({children:t}){const n=bo(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function wo({theme:t,children:n}){return e.createElement(vo,null,e.createElement(xo,{theme:t}),e.createElement(Ao,null,n))}function ko(){return bo(e=>e.theme)}function So(e,t){return n=this,o=void 0,i=function*(){const{format:n="svg",filename:o="chart",scale:r=2,background:i="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const a=s.cloneNode(!0),l=s.getBoundingClientRect();if(a.getAttribute("width")||a.setAttribute("width",l.width+""),a.getAttribute("height")||a.setAttribute("height",l.height+""),a.getAttribute("xmlns")||a.setAttribute("xmlns","http://www.w3.org/2000/svg"),Eo(s,a),"svg"===n){const e=(new XMLSerializer).serializeToString(a);Oo(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const e=l.width*r,t=l.height*r,n=(new XMLSerializer).serializeToString(a),s=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(s),u=new Image;u.width=l.width,u.height=l.height,yield new Promise((n,s)=>{u.onload=()=>{const a=document.createElement("canvas");a.width=e,a.height=t;const l=a.getContext("2d");l.fillStyle=i,l.fillRect(0,0,e,t),l.scale(r,r),l.drawImage(u,0,0),a.toBlob(e=>{e?(Oo(e,o+".png"),n()):s(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(c)},u.onerror=()=>{URL.revokeObjectURL(c),s(Error("Failed to load SVG image"))},u.src=c})}},new((r=void 0)||(r=Promise))(function(e,t){function s(e){try{l(i.next(e))}catch(e){t(e)}}function a(e){try{l(i.throw(e))}catch(e){t(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(e){e(n)})).then(s,a)}l((i=i.apply(n,o||[])).next())});var n,o,r,i}function Eo(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),s=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of s){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Eo(o[e],r[e])}function Oo(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}"function"==typeof SuppressedError&&SuppressedError;const jo={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["function","object"]},frameProps:{type:"object"}},Mo={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},Po={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},No=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],_o=["vertical","horizontal"],zo={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:No},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:No},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:No},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Mo),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},jo),Po),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_o},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},jo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},jo),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},jo),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},jo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:_o},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},jo),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},jo),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},jo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},jo),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Wo(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Bo(e,t){const n=[],o=zo[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(zo).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Wo(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=new Set(Object.keys(o.props));for(const o of Object.keys(t))void 0!==t[o]&&(r.has(o)||n.push(`Unknown prop "${o}" for ${e}. Check for typos.`));if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const s=st({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});s&&n.push(s)}else if("object"===o.dataShape){const o=at({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=lt({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}export{St as AreaChart,rn as BarChart,cn as BoxPlot,jt as BubbleChart,oo as ChordDiagram,ao as CirclePack,yn as DonutChart,hn as DotPlot,no as ForceDirectedGraph,an as GroupedBarChart,Mt as Heatmap,un as Histogram,kt as LineChart,Nt as LinkedCharts,tt as MultiLineTooltip,gn as PieChart,yo as RealtimeHeatmap,uo as RealtimeHistogram,lo as RealtimeLineChart,ho as RealtimeSwarmChart,go as RealtimeWaterfallChart,ro as SankeyDiagram,Ot as Scatterplot,Rt as ScatterplotMatrix,Et as StackedAreaChart,sn as StackedBarChart,ln as SwarmPlot,wo as ThemeProvider,po as TooltipProvider,io as TreeDiagram,so as Treemap,dn as ViolinPlot,So as exportChart,At as useBrushSelection,wt as useFilteredData,xt as useLinkedHover,bt as useSelection,ko as useTheme,Bo as validateProps};
1
+ import*as e from"react";import{useMemo as t,forwardRef as n,useRef as o,useState as r,useCallback as i,useEffect as a,useImperativeHandle as s,createContext as l,useContext as c,useLayoutEffect as u,useId as d}from"react";import{brushX as h,brushY as g,brush as y}from"d3-brush";import{select as f}from"d3-selection";import{scaleLinear as p,scaleOrdinal as m,scaleSequential as v,scaleBand as b}from"d3-scale";import{bin as x,quantile as w,min as k,groups as A,max as S,sum as E,mean as L,group as O}from"d3-array";import{packEnclose as j,hierarchy as P,partition as M,pack as N,treemap as D,treemapBinary as T,cluster as B,tree as C}from"d3-hierarchy";import{interpolatePlasma as z,interpolateViridis as $,interpolatePurples as W,interpolateOranges as _,interpolateGreens as H,interpolateReds as I,interpolateBlues as R,schemeSet3 as F,schemeTableau10 as Y,schemeCategory10 as X}from"d3-scale-chromatic";import{interpolateNumber as G}from"d3-interpolate";import{forceLink as q,forceSimulation as V,forceManyBody as U,forceX as Z,forceY as Q}from"d3-force";import{ribbon as J,chord as K}from"d3-chord";import{arc as ee}from"d3-shape";const te=5e3;class ne{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,te),bounded:!0,totalSize:e.length});let t=te;const n=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const o=Math.min(t+te,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 oe{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 re{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 ie(e,t,n,o,r){const i=new Map;for(const a of e){const e=t(a),s=n(a);if(null==e||null==s||Number.isNaN(e)||Number.isNaN(s))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=s,r){const e=r(a);c.categories.set(e,(c.categories.get(e)||0)+s)}}return i}function ae(e,t,n,o,r,i){const a=[],s=[];for(const r of e){const e=n(r),i=o(r);null==e||null==i||Number.isNaN(e)||Number.isNaN(i)||(a.push([t.x(e),t.y(i)]),s.push(i))}return{type:"line",path:a,rawValues:s,style:r,datum:e,group:i}}function se(e,t,n,o,r,i,a){const s=[],l=[];for(const i of e){const e=n(i),a=o(i);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const c=t.x(e);s.push([c,t.y(a)]),l.push([c,t.y(r)])}return{type:"area",topPath:s,bottomPath:l,style:i,datum:e,group:a}}function le(e,t,n,o,r,i,a){const s=n(e),l=o(e);if(null==s||null==l||Number.isNaN(s)||Number.isNaN(l))return null;const c={type:"point",x:t.x(s),y:t.y(l),r:r,style:i,datum:e};return void 0!==a&&(c.pointId=a),c}function ce(e,t,n,o,r,i,a){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:a}}function ue(e,t,n,o,r,i){return{type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i}}function de(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function he(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class ge{constructor(e){this.xExtent=new re,this.yExtent=new re,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version=0,this.config=e,this.buffer=new oe(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=de(e.timeAccessor||e.xAccessor,"time"),this.getY=de(e.valueAccessor||e.yAccessor,"value")):(this.getX=de(e.xAccessor,"x"),this.getY=de(e.yAccessor,"y")),this.getGroup=he(e.groupAccessor),this.getCategory=he(e.categoryAccessor),this.getSize=e.sizeAccessor?de(e.sizeAccessor,"size"):void 0,this.getColor=he(e.colorAccessor),this.getBounds=e.boundsAccessor?de(e.boundsAccessor,"bounds"):void 0,this.getPointId=he(e.pointIdAccessor),"candlestick"===e.chartType&&(this.getOpen=de(e.openAccessor,"open"),this.getHigh=de(e.highAccessor,"high"),this.getLow=de(e.lowAccessor,"low"),this.getClose=de(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new oe(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,e.bounded){this.buffer.clear(),this.xExtent.clear(),this.yExtent.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.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n))}else for(const n of e.inserts){"growing"===this.config.windowMode&&this.buffer.full&&(this.growingCap*=2,this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap));const e=this.buffer.push(n);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n))):this.yExtent.push(this.getY(n)),null!=e&&(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):this.yExtent.evict(this.getY(e)))}return!0}computeScene(e){var t,n,o,r,i,a;const{config:s,buffer:l}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(l,this.getX),this.yExtent.dirty)if("candlestick"===s.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of l)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(l,this.getY);const c=this.xExtent.extent,u=this.yExtent.extent;let d=s.xExtent?[null!==(t=s.xExtent[0])&&void 0!==t?t:c[0],null!==(n=s.xExtent[1])&&void 0!==n?n:c[1]]:c,h=s.yExtent?[null!==(o=s.yExtent[0])&&void 0!==o?o:u[0],null!==(r=s.yExtent[1])&&void 0!==r?r:u[1]]:u;const g=s.yExtent&&null!=s.yExtent[0]&&null!=s.yExtent[1];if("stackedarea"===s.chartType&&!g&&l.size>0)if(s.normalize)h=[0,1+s.extentPadding];else{const e=l.toArray(),t=this.groupData(e),n=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),o=this.getY(t);null==e||null==o||Number.isNaN(e)||Number.isNaN(o)||n.set(e,(n.get(e)||0)+o)}let o=0;for(const e of n.values())e>o&&(o=e);h=[0,o+(o>0?o*s.extentPadding:1)]}else if("bar"===s.chartType&&s.binSize&&!g&&l.size>0){const[,e]=function(e,t,n,o,r){const i=ie(e,t,n,o,r);if(0===i.size)return[0,0];let a=0;for(const e of i.values())e.total>a&&(a=e.total);return[0,a]}(l,this.getX,this.getY,s.binSize,this.getCategory);h=[0,e+e*s.extentPadding]}else if("waterfall"===s.chartType&&!g&&l.size>0){const[e,t]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(l,this.getY),n=t-e,o=n>0?n*s.extentPadding:1;h=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!g&&h[0]!==1/0){if(this.getBounds){const e=l.toArray();for(const t of e){const e=this.getY(t),n=this.getBounds(t);null!=e&&!Number.isNaN(e)&&n&&(e+n>h[1]&&(h[1]=e+n),h[0]>e-n&&(h[0]=e-n))}}const e=h[1]-h[0],t=e>0?e*s.extentPadding:1,n=null===(i=s.yExtent)||void 0===i?void 0:i[0],o=null===(a=s.yExtent)||void 0===a?void 0:a[1];h=[null!=n?h[0]:h[0]-t,null!=o?h[1]:h[1]+t]}if(d[0]!==1/0&&d[1]!==-1/0||(d=[0,1]),h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),void 0!==s.arrowOfTime)if("x"==("up"===(y=s.arrowOfTime)||"down"===y?"y":"x")){const t="right"===s.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:p().domain(d).range(t),y:p().domain(h).range([e.height,0])}}else{const t="down"===s.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:p().domain(h).range([0,e.width]),y:p().domain(d).range(t)}}else this.scales={x:p().domain(d).range([0,e.width]),y:p().domain(h).range([e.height,0])};var y;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const f=l.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,f),this.config.pulse&&this.applyPulse(this.scene,f),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:n,scales:o}=this;if(!o||0===n.size)return[];const r=n.toArray();switch(t.chartType){case"line":return this.buildLineScene(r);case"area":return this.buildAreaScene(r);case"stackedarea":return this.buildStackedAreaScene(r);case"scatter":case"bubble":return this.buildPointScene(r);case"heatmap":return this.buildHeatmapScene(r,e);case"bar":return this.buildBarScene(r);case"swarm":return this.buildSwarmScene(r);case"waterfall":return this.buildWaterfallScene(r,e);case"candlestick":return this.buildCandlestickScene(r,e);default:return[]}}buildLineScene(e){var t;const n=this.groupData(e),o=[],r=null===(t=this.config.annotations)||void 0===t?void 0:t.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(this.getBounds)for(const e of n){const t=this.buildBoundsForGroup(e.data,e.key);t&&o.push(t)}for(const e of n){const t=this.resolveLineStyle(e.key,e.data[0]),n=ae(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(n.colorThresholds=r),o.push(n)}return o}buildAreaScene(e){const t=this.groupData(e),n=[],o=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);n.push(se(e.data,this.scales,this.getX,this.getY,o,t,e.key))}return n}buildStackedAreaScene(e){const t=this.groupData(e);return t.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0),function(e,t,n,o,r,i){var a;const s=new Set;for(const t of e)for(const e of t.data){const t=n(e);null==t||Number.isNaN(t)||s.add(t)}const l=Array.from(s).sort((e,t)=>e-t),c=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);null==t||null==i||Number.isNaN(t)||Number.isNaN(i)||e.set(t,(e.get(t)||0)+i)}c.set(t.key,e)}let u;if(i){u=new Map;for(const t of l){let n=0;for(const o of e)n+=(null===(a=c.get(o.key))||void 0===a?void 0:a.get(t))||0;u.set(t,n||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const n of e){const e=c.get(n.key),o=[],a=[];for(const n of l){let r=e.get(n)||0;const s=h.get(n);i&&(r/=u.get(n));const l=t.x(n);a.push([l,t.y(s)]),o.push([l,t.y(s+r)]),h.set(n,s+r)}d.push({type:"area",topPath:o,bottomPath:a,style:r(n.key,n.data[0]),datum:n.data,group:n.key})}return d}(t,this.scales,this.getX,this.getY,(e,t)=>this.resolveAreaStyle(e,t),this.config.normalize)}buildPointScene(e){const t=[],n="bubble"===this.config.chartType?10:5,o=this.config.sizeRange||[3,15];let r=null;if(this.getSize&&!this.config.pointStyle){const t=e.map(e=>this.getSize(e)).filter(e=>null!=e&&!Number.isNaN(e));if(t.length>0){const e=Math.min(...t),n=Math.max(...t);r=t=>e===n?(o[0]+o[1])/2:o[0]+(t-e)/(n-e)*(o[1]-o[0])}}let i=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];i=new Map;let o=0;for(const e of t)i.set(e,n[o%n.length]),o++}for(const o of e){let e=this.config.pointStyle?this.config.pointStyle(o):{fill:"#4e79a7",opacity:.8},a=e.r||n;if(r&&this.getSize){const e=this.getSize(o);null==e||Number.isNaN(e)||(a=r(e))}if(i&&this.getColor){const t=this.getColor(o);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const s=this.getPointId?this.getPointId(o)+"":void 0,l=le(o,this.scales,this.getX,this.getY,a,e,s);l&&t.push(l)}return t}buildHeatmapScene(e,t){const n=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const o=de(this.config.valueAccessor,"value"),r=new Set,i=new Set;for(const t of e)r.add(this.getX(t)),i.add(this.getY(t));const a=Array.from(r).sort((e,t)=>e-t),s=Array.from(i).sort((e,t)=>e-t);if(0===a.length||0===s.length)return n;const l=t.width/a.length,c=t.height/s.length,u=new Map;for(const t of e){const e=`${this.getX(t)}_${this.getY(t)}`;u.set(e,{val:o(t),datum:t})}let d=1/0,h=-1/0;for(const{val:e}of u.values())d>e&&(d=e),e>h&&(h=e);const g=h-d||1;for(let e=0;a.length>e;e++)for(let t=0;s.length>t;t++){const o=u.get(`${a[e]}_${s[t]}`);if(!o)continue;const r=(o.val-d)/g;n.push(ue(e*l,(s.length-1-t)*c,l,c,`rgb(${Math.round(220-180*r)},${Math.round(220-100*r)},${Math.round(255-50*r)})`,o.datum))}return n}buildStreamingHeatmapScene(e,t){var n,o,r;const i=[],a=null!==(n=this.config.heatmapXBins)&&void 0!==n?n:20,s=null!==(o=this.config.heatmapYBins)&&void 0!==o?o:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=de(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,g]=this.scales.y.domain(),y=(d-u||1)/a,f=(g-h||1)/s,p=new Map;for(const t of e){const e=this.getX(t),n=this.getY(t),o=Math.min(Math.floor((e-u)/y),a-1),r=Math.min(Math.floor((n-h)/f),s-1);if(0>o||0>r)continue;const i=`${o}_${r}`;let l=p.get(i);l||(l={sum:0,count:0,data:[]},p.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let m=1/0,v=-1/0;const b=new Map;for(const[e,t]of p){let n;switch(l){case"sum":n=t.sum;break;case"mean":n=t.count>0?t.sum/t.count:0;break;default:n=t.count}b.set(e,n),m>n&&(m=n),n>v&&(v=n)}const x=v-m||1,w=t.width/a,k=t.height/s;for(const[e,t]of b){const[n,o]=e.split("_"),r=+n,a=+o,l=(t-m)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=p.get(e);i.push(ue(r*w,(s-1-a)*k,w,k,c,{xi:r,yi:a,value:t,count:u.count,sum:u.sum,data:u.data}))}return i}buildBarScene(e){var t;if(!this.config.binSize)return[];const n=ie(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===n.size)return[];let o=null;if(this.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort();o=[...t.filter(t=>e.has(t)),...i]}const r=[],i=this.scales,[a,s]=i.x.domain();for(const e of n.values()){const n=Math.max(e.start,a),l=Math.min(e.end,s);if(n>=l)continue;const c=i.x(n),u=i.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(o&&e.categories.size>0){let n=0;for(const a of o){const o=e.categories.get(a)||0;if(0===o)continue;const s=i.y(n),l=i.y(n+o);r.push(ce(d,Math.min(s,l),h,Math.abs(s-l),{fill:(null===(t=this.config.barColors)||void 0===t?void 0:t[a])||"#4e79a7"},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:o},a)),n+=o}}else{const t=i.y(0),n=i.y(e.total);r.push(ce(d,Math.min(t,n),h,Math.abs(t-n),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,n,o,r;const i=[],a=this.config.swarmStyle||{},s=null!==(t=a.radius)&&void 0!==t?t:3,l=null!==(n=a.fill)&&void 0!==n?n:"#007bff",c=null!==(o=a.opacity)&&void 0!==o?o:.7,u=a.stroke,d=a.strokeWidth;for(const t of e){const e=this.getX(t),n=this.getY(t);if(null==n||Number.isNaN(n))continue;const o=this.scales.x(e),a=this.scales.y(n);let h=l;if(this.getCategory){const e=this.getCategory(t);h=(null===(r=this.config.barColors)||void 0===r?void 0:r[e])||h}const g={type:"point",x:o,y:a,r:s,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t};this.getPointId&&(g.pointId=this.getPointId(t)+""),i.push(g)}return i}buildWaterfallScene(e,t){var n,o,r;const i=[],a=this.scales,s=this.config.waterfallStyle,l=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===l.length)return i;const c=null!==(n=null==s?void 0:s.positiveColor)&&void 0!==n?n:"#28a745",u=null!==(o=null==s?void 0:s.negativeColor)&&void 0!==o?o:"#dc3545",d=null!==(r=null==s?void 0:s.gap)&&void 0!==r?r:1,h=null==s?void 0:s.stroke,g=null==s?void 0:s.strokeWidth;let y=0;for(let e=0;l.length>e;e++){const n=l[e],o=this.getX(n),r=this.getY(n),f=y+r;let p;p=l.length-1>e?this.getX(l[e+1])-o:e>0?o-this.getX(l[e-1]):0;const m=a.x(o),v=0!==p?a.x(o+p):m+t.width/10,b=Math.min(m,v)+d/2,x=Math.max(m,v)-d/2-b;if(0>=x){y=f;continue}const w=a.y(y),k=a.y(f);i.push(ce(b,Math.min(w,k),x,Math.abs(w-k),{fill:0>r?u:c,stroke:h,strokeWidth:g},Object.assign(Object.assign({},n),{baseline:y,cumEnd:f,delta:r,_connectorStroke:null==s?void 0:s.connectorStroke,_connectorWidth:null==s?void 0:s.connectorWidth}))),y=f}return i}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const n=[],o=this.config.candlestickStyle||{},r=o.upColor||"#28a745",i=o.downColor||"#dc3545",a=o.wickColor||"#333",s=o.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=o.bodyWidth||6;if(!o.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const n=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));n>0&&e>n&&(e=n)}e!==1/0&&(c=Math.max(2,Math.min(.6*e,20)))}for(const t of e){const e=this.getX(t);if(null==e||Number.isNaN(e))continue;const o=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([o,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=o;n.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(o),closeY:this.scales.y(d),highY:this.scales.y(l),lowY:this.scales.y(u),bodyWidth:c,upColor:r,downColor:i,wickColor:a,wickWidth:s,isUp:h,datum:t})}return n}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const n=[],o=[];for(const t of e){const e=this.getX(t),r=this.getY(t);if(null==e||null==r||Number.isNaN(e)||Number.isNaN(r))continue;const i=this.getBounds(t),a=this.scales.x(e);if(i&&0!==i)n.push([a,this.scales.y(r+i)]),o.push([a,this.scales.y(r-i)]);else{const e=this.scales.y(r);n.push([a,e]),o.push([a,e])}}return 2>n.length?null:{type:"area",topPath:n,bottomPath:o,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var n,o,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r);if("heatcell"===t.type)t.style={opacity:a};else if("candlestick"===t.type)t._decayOpacity=a;else{const e=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:e*a})}}}computePulseIntensity(e,t){var n;const o=this.config.pulse;if(!o)return 0;const r=null!==(n=o.duration)&&void 0!==n?n:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var n,o;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",a=null!==(o=this.config.pulse.glowRadius)&&void 0!==o?o:4,s=new Map;for(let e=0;t.length>e;e++)s.set(t[e],e);for(const t of e){if("line"===t.type||"area"===t.type)continue;const e=s.get(t.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const o=this.computePulseIntensity(n,r);o>0&&(t._pulseIntensity=o,t._pulseColor=i,t._pulseGlowRadius=a)}}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(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],n=this.getNodeIdentity(t,e);n&&("point"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(n,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(n,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var n,o,r,i;switch(e.type){case"point":return`p:${void 0===e.datum?t:this.getX(e.datum)}_${this.getY(e.datum)}`;case"rect":return`r:${e.group||""}:${null!==(i=null!==(o=null===(n=e.datum)||void 0===n?void 0:n.binStart)&&void 0!==o?o:null===(r=e.datum)||void 0===r?void 0:r.category)&&void 0!==i?i:t}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return"c:"+this.getX(e.datum);default:return null}}startTransition(){var e,t,n,o,r,i;if(!this.config.transition||0===this.prevPositionMap.size)return;const a=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let s=!1;for(let e=0;this.scene.length>e;e++){const a=this.scene[e],l=this.getNodeIdentity(a,e);if(!l)continue;const c=this.prevPositionMap.get(l);if(c)if("point"===a.type){const e={x:a.x,y:a.y,r:a.r};c.x===e.x&&c.y===e.y||(a._targetX=e.x,a._targetY=e.y,a._targetR=e.r,a.x=c.x,a.y=c.y,a.r=null!==(t=c.r)&&void 0!==t?t:a.r,s=!0)}else if("rect"===a.type){const e={x:a.x,y:a.y,w:a.w,h:a.h};c.x===e.x&&c.y===e.y&&c.w===e.w&&c.h===e.h||(a._targetX=e.x,a._targetY=e.y,a._targetW=e.w,a._targetH=e.h,a.x=c.x,a.y=c.y,a.w=null!==(n=c.w)&&void 0!==n?n:a.w,a.h=null!==(o=c.h)&&void 0!==o?o:a.h,s=!0)}else if("heatcell"===a.type){const e={x:a.x,y:a.y,w:a.w,h:a.h};c.x===e.x&&c.y===e.y||(a._targetX=e.x,a._targetY=e.y,a._targetW=e.w,a._targetH=e.h,a.x=c.x,a.y=c.y,a.w=null!==(r=c.w)&&void 0!==r?r:a.w,a.h=null!==(i=c.h)&&void 0!==i?i:a.h,s=!0)}}s&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:a})}advanceTransition(e){var t;if(!this.activeTransition)return!1;const n=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),o="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?n:1-Math.pow(1-n,3);for(const e of this.scene)if("point"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==e._targetR&&void 0!==n.r&&(e.r=n.r+(e._targetR-n.r)*o)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const n=this.prevPositionMap.get(t);if(!n)continue;e.x=n.x+(e._targetX-n.x)*o,e.y=n.y+(e._targetY-n.y)*o,void 0!==n.w&&(e.w=n.w+(e._targetW-n.w)*o),void 0!==n.h&&(e.h=n.h+(e._targetH-n.h)*o)}if(n>=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,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=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}else if("heatcell"===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}groupData(e){if(!this.getGroup)return[{key:"_default",data:e}];const t=new Map;for(const n of e){const e=this.getGroup(n);t.has(e)||t.set(e,[]),t.get(e).push(n)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveLineStyle(e,t){const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{stroke:n.stroke||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n;if(this.config.areaStyle)return this.config.areaStyle(t||{});const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{fill:o.fill||o.stroke||"#4e79a7",fillOpacity:null!==(n=o.fillOpacity)&&void 0!==n?n:.7,stroke:o.stroke||"#4e79a7",strokeWidth:o.strokeWidth||2}:{fill:"#4e79a7",fillOpacity:.7,stroke:"#4e79a7",strokeWidth:2}}getData(){return this.buffer.toArray()}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}updateConfig(e){Object.assign(this.config,e)}}function ye(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function fe(e,t,n){if(0===e.path.length)return null;const o=xe(e.path,t);if(0>o)return null;const[r,i]=e.path[o],a=t-r,s=n-i,l=Math.sqrt(a*a+s*s);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function pe(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function me(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{node:e,datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}function ve(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,a=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+a*a)}}return null}function be(e,t,n){if(0===e.topPath.length)return null;const o=xe(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],a=t-r,s=n-i;return{node:e,datum:e.datum,x:r,y:i,distance:Math.sqrt(a*a+s*s)}}function xe(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}const we={fill:t=>e.createElement("rect",{style:t,width:20,height:20}),line:t=>e.createElement("line",{style:t,x1:0,y1:0,x2:20,y2:20})};function ke(e,t,n,o){let r;return r="function"==typeof n?n(e):(0,we[n])(o(e,t)),r}function Ae(t){const{legendGroups:n,customClickBehavior:o,title:r="Legend",width:i=100,height:a=20,orientation:s="vertical"}=t,l="vertical"===s?(({legendGroups:t,width:n,customClickBehavior:o})=>{let r=30;const i=[];return t.forEach((t,a)=>{r+=5,i.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+a,stroke:"gray",x1:0,y1:r,x2:n,y2:r})),r+=10,t.label&&(r+=20,i.push(e.createElement("text",{key:"legend-text-"+a,y:r,className:"legend-group-label"},t.label)),r+=10),i.push(e.createElement("g",{key:"legend-group-"+a,className:"legend-item",transform:`translate(0,${r})`},((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,a=[];let s=0;return i.forEach((t,i)=>{const l=ke(t,i,o,r);a.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(0,${s})`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:30},t.label))),s+=25}),a})(t,o))),r+=25*t.items.length+10}),i})({legendGroups:n,width:i,customClickBehavior:o}):(({legendGroups:t,title:n,height:o,customClickBehavior:r})=>{let i=0;const a=[],s=!1===n?10:40;return t.forEach((n,l)=>{n.label&&(a.push(e.createElement("text",{key:"legend-text-"+l,transform:`translate(${i},${s}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},n.label)),i+=20);const c=((t,n)=>{const{type:o="fill",styleFn:r,items:i}=t,a=[];let s=0;return i.forEach((t,i)=>{const l=ke(t,i,o,r);a.push(e.createElement("g",{key:"legend-item-"+i,transform:`translate(${s},0)`,onClick:n?()=>n(t):void 0,style:{cursor:n?"pointer":"default"}},l,e.createElement("text",{y:15,x:25},t.label))),s+=35,s+=8*t.label.length}),{items:a,offset:s}})(n,r);a.push(e.createElement("g",{key:"legend-group-"+l,className:"legend-item",transform:`translate(${i},${s})`},c.items)),i+=c.offset+5,t[l+1]&&a.push(e.createElement("line",{key:"legend-top-line legend-symbol-"+l,stroke:"gray",x1:i,y1:s-10,x2:i,y2:o+s+10})),i+=15}),e.createElement("g",null,!1!==n&&e.createElement("line",{x1:0,x2:i+10,y1:s-10,y2:s-10,stroke:"gray",className:"title-neatline"}),a)})({legendGroups:n,title:r,height:a,customClickBehavior:o});return e.createElement("g",null,void 0!==r&&e.createElement("text",{className:"legend-title",y:20,x:"horizontal"===s?0:i/2,textAnchor:"horizontal"===s?"start":"middle"},r),l)}function Se(e){return"string"==typeof e?{type:e}:e}function Ee({orient:n,config:o,values:r,scale:i,size:a,length:s}){const l=function(e){var t,n,o,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===n||"bottom"===n,u=t(()=>{if(0===r.length)return null;const t=i.domain(),o=a-8;if("boxplot"===l.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],a=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*a),whiskerHigh:Math.min(t[n-1],i+1.5*a)}}(r);if(!t)return null;const{q1:a,median:s,q3:u,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*o,20),y=(o-g)/2+4;if(c){const t=i(a),o=i(u),r=i(s),c=i(d),f=i(h),p="top"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:c,y1:m+p*(y+g/2),x2:f,y2:m+p*(y+g/2),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:c,y1:m+p*y,x2:c,y2:m+p*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:f,y1:m+p*y,x2:f,y2:m+p*(y+g),stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:Math.min(t,o),y:"top"===n?m-y-g:m+y,width:Math.abs(o-t),height:g,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:r,y1:"top"===n?m-y-g:m+y,x2:r,y2:"top"===n?m-y:m+y+g,stroke:l.fill,strokeWidth:2}))}{const t=i(a),o=i(u),r=i(s),c=i(d),f=i(h),p="left"===n?-1:1,m=0;return e.createElement("g",{"data-testid":"marginal-boxplot-"+n},e.createElement("line",{x1:m+p*(y+g/2),y1:c,x2:m+p*(y+g/2),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+p*y,y1:c,x2:m+p*(y+g),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:m+p*y,y1:f,x2:m+p*(y+g),y2:f,stroke:l.fill,strokeWidth:l.strokeWidth}),e.createElement("rect",{x:"left"===n?m-y-g:m+y,y:Math.min(t,o),width:g,height:Math.abs(o-t),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),e.createElement("line",{x1:"left"===n?m-y-g:m+y,y1:r,x2:"left"===n?m-y:m+y+g,y2:r,stroke:l.fill,strokeWidth:2}))}}const u=x().domain(t).thresholds(l.bins)(r);if(0===u.length)return null;const d=Math.max(...u.map(e=>e.length));if(0===d)return null;if("histogram"===l.type)return e.createElement("g",{"data-testid":"marginal-histogram-"+n},u.map((t,r)=>{if(null==t.x0||null==t.x1)return null;const a=t.length/d*o;if(c){const o=i(t.x0),s=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:o,y:"top"===n?-4-a:4,width:Math.max(s,.5),height:a,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(t.x0),s=i(t.x1)-i(t.x0);return e.createElement("rect",{key:r,x:"left"===n?-4-a:4,y:Math.min(o,o+s),width:a,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const t=o/2+4,r=[];for(const e of u){if(null==e.x0||null==e.x1)continue;const a=e.length/d*(o/2),s=i((e.x0+e.x1)/2);r.push(c?`${s},${"top"===n?-(t-a):t-a}`:`${"left"===n?-(t-a):t-a},${s}`)}for(let e=u.length-1;e>=0;e--){const a=u[e];if(null==a.x0||null==a.x1)continue;const s=a.length/d*(o/2),l=i((a.x0+a.x1)/2);r.push(c?`${l},${"top"===n?-(t+s):t+s}`:`${"left"===n?-(t+s):t+s},${l}`)}return e.createElement("g",{"data-testid":"marginal-violin-"+n},e.createElement("polygon",{points:r.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const t=[];if(c){const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${r},${e}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);t.push(`L${a},${"top"===n?-r-4:r+4}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;t.push(`L${a},${e}`),t.push("Z")}else{const e=0,r=null!=u[0].x0?i(u[0].x0):0;t.push(`M${e},${r}`);for(const e of u){if(null==e.x0||null==e.x1)continue;const r=e.length/d*o,a=i((e.x0+e.x1)/2);t.push(`L${"left"===n?-r-4:r+4},${a}`)}const a=null!=u[u.length-1].x1?i(u[u.length-1].x1):s;t.push(`L${e},${a}`),t.push("Z")}return e.createElement("g",{"data-testid":"marginal-ridgeline-"+n},e.createElement("path",{d:t.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[r,i,l,a,s,n,c,4]);return u?e.createElement("g",{className:"marginal-"+n,"data-testid":"marginal-"+n},u):null}function Le(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let a="";for(const e of r)a&&a.length+1+e.length>o?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function Oe(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 je(t){const{x:n=0,y:o=0,dx:r,dy:i,nx:a,ny:s,note:l,connector:c,subject:u,type:d,color:h,className:g,disable:y,events:f={},"data-testid":p}=t,m=new Set(Array.isArray(y)?y:[]);let v=r||0,b=i||0;null!=a&&(v=a-n),null!=s&&(b=s-o);const x="string"==typeof d?d:"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 e.createElement("g",Object.assign({className:("annotation "+(g||"")).trim(),transform:`translate(${n},${o})`,"data-testid":p},f),!m.has("connector")&&function(t,n,o,r,i,a){const s=[];let l=0,c=0;if("callout-circle"!==i&&"label"!==i||!(null==a?void 0:a.radius)){if("callout-rect"===i&&a){const e=a.width||0,o=a.height||0;if(e>0||o>0){const r=e/2,i=o/2,a=t-r,s=n-i;if(0!==a||0!==s){const t=Math.abs(a),n=Math.abs(s),u=e/2,d=o/2,h=t*d>n*u?u/t:d/n;l=r+a*h,c=i+s*h}}}else if("bracket"===i&&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 e=(a.radius||0)+(a.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);l=Math.cos(o)*e,c=Math.sin(o)*e}}if(Math.sqrt(Math.pow(t-l,2)+Math.pow(n-c,2))>.5&&(s.push(e.createElement("line",{key:"connector-line",x1:l,y1:c,x2:t,y2:n,stroke:r||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,i=16/180*Math.PI,a=Math.atan2(n-c,t-l);s.push(e.createElement("path",{key:"connector-arrow",d:`M${l},${c}L${l+o*Math.cos(a+i)},${c+o*Math.sin(a+i)}L${l+o*Math.cos(a-i)},${c+o*Math.sin(a-i)}Z`,fill:r||"currentColor",stroke:"none"}))}return e.createElement("g",{className:"annotation-connector"},s)}(v,b,c,h,x,u),!m.has("subject")&&function(t,n,o,r,i){var a;const s=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&s.push(e.createElement("circle",{key:"subject-circle",r:t,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,r=(null==n?void 0:n.height)||0;(t>0||r>0)&&s.push(e.createElement("rect",{key:"subject-rect",width:t,height:r,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==n?void 0:n.custom)&&s.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=r||0,a=i||0;if(void 0!==(null==n?void 0:n.x)){const r=(n.x||0)-t;s.push(e.createElement("line",{key:"threshold-line",x1:r,y1:(n.y1||0)-a,x2:r,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==n?void 0:n.y)){const r=(n.y||0)-a;s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:r,x2:(n.x2||0)-t,y2:r,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?s.push(e.createElement("line",{key:"threshold-line",x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||s.push(e.createElement("line",{key:"threshold-line",x1:0,y1:(n.y1||0)-a,x2:0,y2:(n.y2||0)-a,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const t=null!==(a=null==n?void 0:n.width)&&void 0!==a?a:null==n?void 0:n.height;void 0!==t&&s.push(e.createElement("path",{key:"bracket-path",d:Oe((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"currentColor"}));break}}return e.createElement("g",{className:"annotation-subject"},s)}(x,u,h,n,o),!m.has("note")&&function(t,n,o,r){if(!t)return e.createElement("g",{className:"annotation-note"});const{label:i,title:a,orientation:s,align:l,wrap:c=120,noWrap:u}=t;if(!i&&!a)return e.createElement("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>n?"end":"start";const y=16,f=a?u?[a]:Le(a,c):[],p=i?u?[i]:Le(i,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[];f.length>0&&(b.push(e.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:r||void 0,textAnchor:g,fontWeight:"bold"},f.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t)))),v=f.length*y),p.length>0&&b.push(e.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:r||void 0,textAnchor:g,y:v},p.map((t,n)=>e.createElement("tspan",{key:n,x:m,dy:0===n?0:y},t))));let x=null;if((a||i)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===g?(n=-t,o=0):"middle"===g&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:r||"currentColor"})}else{const t=(f.length+p.length)*y+(p.length>0?y:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),x=e.createElement("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:r||"currentColor"})}const w=Math.max(0,f.length+p.length-1)*y;let k=0;return"topBottom"===d?k=0>o?-(w+2):18:"leftRight"===d&&(k="middle"===h?-(w+y+(p.length>0&&f.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.createElement("g",{className:"annotation-note",transform:`translate(${n},${o})`},e.createElement("g",{className:"annotation-note-content",transform:0!==k?`translate(0,${k})`:void 0},b),x)}(l,v,b,h))}function Pe(t){var n,o;const{noteData:r}=t,{screenCoordinates:i}=r,a="string"==typeof r.type?r.type:"label",s=r.eventListeners||r.events||{};if(r.coordinates&&i){const t=r.nx||i[0][0]+(null!==(n=r.dx)&&void 0!==n?n:0),s=r.ny||i[0][1]+(null!==(o=r.dy)&&void 0!==o?o:0),l=i.map((n,o)=>{const i=Object.assign({},r,{note:0===o?r.note:{label:""},x:n[0],y:n[1],nx:t,ny:s});return e.createElement(je,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+o},i,{type:a}))});return e.createElement("g",null,l)}const l=r.note||{title:"none",label:r.label};return e.createElement(je,Object.assign({"data-testid":"semiotic-annotation",key:`${l.label}-${l.title}-${r.i}`,events:s},r,{type:a}))}function Me(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function Ne(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function De(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}function Te(t){return function(t,n,o){var r,i,a,s,l,c,u,d,h,g,y,f,p,m,v,b,x,w,k,A,S,E,L,O,P,M,N,D,T,B,C,z;switch(t.type){case"label":{let r=null,i=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;r=e.x,i=e.y}else r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:De(r,i,o)?e.createElement(Pe,{key:"ann-"+n,noteData:{x:r,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"label",connector:t.connector||{end:"arrow"},color:t.color}}):null}case"callout":{let r=null,i=null;if(null!=t.pointId&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===t.pointId);if(!e)return null;r=e.x,i=e.y}else r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:De(r,i,o)?e.createElement(Pe,{key:"ann-"+n,noteData:{x:r,y:i,dx:t.dx||30,dy:t.dy||-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"callout-circle",subject:{radius:t.radius||12},connector:t.connector||{end:"arrow"},color:t.color}}):null}case"x-threshold":{const r=Me(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:r+4,y:12,fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"y-threshold":{const r=Ne(t,o);if(null==r)return null;const i=t.color||"#f97316";return e.createElement("g",{key:"ann-"+n},e.createElement("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:i,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:r-4,textAnchor:"end",fill:i,fontSize:12,fontWeight:"bold"},t.label))}case"enclose":{const r=(t.coordinates||[]).map(e=>({x:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ne(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=j(r),a=t.padding||10;return e.createElement("g",{key:"ann-"+n},e.createElement("circle",{cx:i.x,cy:i.y,r:i.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:i.x,y:i.y-i.r-a-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"rect-enclose":{const r=(t.coordinates||[]).map(e=>({x:Me(Object.assign(Object.assign({},e),{type:"point"}),o),y:Ne(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const i=t.padding||10,a=r.map(e=>e.x),s=r.map(e=>e.y),l=Math.min(...a)-i,c=Math.max(...a)+i,u=Math.min(...s)-i,d=Math.max(...s)+i;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"#666",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.createElement("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"#666",fontSize:12},t.label))}case"highlight":{const r=o.data||[],i="function"==typeof t.filter?r.filter(t.filter):t.field&&null!=t.value?r.filter(e=>e[t.field]===t.value):[],a=t.style||{stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.createElement("g",{key:"ann-"+n},i.map((n,r)=>{const i=Me(n,o),s=Ne(n,o);return null==i||null==s?null:e.createElement("circle",Object.assign({key:r,cx:i,cy:s,r:t.r||6},a))}))}case"bracket":{const r=Me(t,o),i=Ne(t,o);return e.createElement(Pe,{key:"ann-"+n,noteData:{x:null!=r?r:0,y:null!=i?i:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}})}case"trend":{const d=o.data||[];if(2>d.length)return null;const h=o.xAccessor||"x",g=o.yAccessor||"y",y=d.map(e=>[e[h],e[g]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>y.length)return null;const f=null!==(i=null===(r=o.scales)||void 0===r?void 0:r.x)&&void 0!==i?i:null===(a=o.scales)||void 0===a?void 0:a.time,p=null!==(l=null===(s=o.scales)||void 0===s?void 0:s.y)&&void 0!==l?l:null===(c=o.scales)||void 0===c?void 0:c.value;if(!f||!p)return null;const m=t.method||"linear";let v;if("loess"===m)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]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(a-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,d=0,h=0,g=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*r[e],h+=t*i[e],g+=t*r[e]*r[e],y+=t*r[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const f=u*g-d*d;if(1e-12>Math.abs(f))s.push([t,h/u]);else{const e=(u*y-d*h)/f;s.push([t,(h-e*d)/u+e*t])}}return s}(y,null!==(u=t.bandwidth)&&void 0!==u?u:.3);else{let e;try{const n=require("regression");e="polynomial"===m?n.polynomial(y,{order:t.order||2}):n.linear(y)}catch(e){return null}v=e.points}const b=v.map(([e,t])=>`${f(e)},${p(t)}`).join(" "),x=t.color||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("polyline",{points:b,fill:"none",stroke:x,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.createElement("text",{x:f(v[v.length-1][0])+4,y:p(v[v.length-1][1])-4,fill:x,fontSize:11},t.label))}case"band":{const r=null!==(h=null===(d=o.scales)||void 0===d?void 0:d.y)&&void 0!==h?h:null===(g=o.scales)||void 0===g?void 0:g.value,i=null!==(y=null==r?void 0:r(t.y0))&&void 0!==y?y:0,a=null!==(f=null==r?void 0:r(t.y1))&&void 0!==f?f:o.height||0;return e.createElement("g",{key:"ann-"+n},e.createElement("rect",{x:0,y:Math.min(i,a),width:o.width||0,height:Math.abs(a-i),fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity||.1}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(i,a)-4,textAnchor:"end",fill:t.color||"#6366f1",fontSize:11},t.label))}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const i=o.yAccessor||"y",a=null!==(m=null===(p=o.scales)||void 0===p?void 0:p.x)&&void 0!==m?m:null===(v=o.scales)||void 0===v?void 0:v.time,s=null!==(x=null===(b=o.scales)||void 0===b?void 0:b.y)&&void 0!==x?x:null===(w=o.scales)||void 0===w?void 0:w.value;if(!a||!s)return null;const l=r.map(e=>e[i]).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,d=Math.sqrt(u),h=null!==(k=t.threshold)&&void 0!==k?k:2,g=c-h*d,y=!1!==t.showBand,f=t.fill||"#6366f1",E=null!==(A=t.fillOpacity)&&void 0!==A?A:.1,L=t.anomalyColor||"#ef4444",O=null!==(S=t.anomalyRadius)&&void 0!==S?S:6,j=s(c+h*d),P=s(g),M=r.filter(e=>{const t=e[i];return null!=t&&Math.abs(t-c)>h*d});return e.createElement("g",{key:"ann-"+n},y&&e.createElement("rect",{x:0,y:Math.min(j,P),width:o.width||0,height:Math.abs(P-j),fill:f,fillOpacity:E}),M.map((t,n)=>{const r=Me(t,o),i=Ne(t,o);return null==r||null==i?null:e.createElement("circle",{key:n,cx:r,cy:i,r:O,fill:L,fillOpacity:.7,stroke:L,strokeWidth:1.5})}),t.label&&e.createElement("text",{x:(o.width||0)-4,y:Math.min(j,P)-4,textAnchor:"end",fill:f,fontSize:11},t.label))}case"forecast":{const r=o.data||[];if(3>r.length)return null;const i=o.xAccessor||"x",a=o.yAccessor||"y",s=null!==(L=null===(E=o.scales)||void 0===E?void 0:E.x)&&void 0!==L?L:null===(O=o.scales)||void 0===O?void 0:O.time,l=null!==(M=null===(P=o.scales)||void 0===P?void 0:P.y)&&void 0!==M?M:null===(N=o.scales)||void 0===N?void 0:N.value;if(!s||!l)return null;const c=r.map(e=>[e[i],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"===(t.method||"linear"))try{const e=require("regression").polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}catch(e){return null}else{const e=c.length;let t=0,n=0,o=0,r=0;for(const[e,i]of c)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const a=(e*r-t*n)/i,s=(n-a*t)/e;u=e=>s+a*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),y=c.reduce((e,t)=>e+t[0],0)/d,f=c.reduce((e,t)=>e+Math.pow(t[0]-y,2),0),p=null!==(D=t.confidence)&&void 0!==D?D:.95,m=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,v=null!==(T=t.steps)&&void 0!==T?T:5,b=c[d-1][0],x=(b-c[0][0])/Math.max(d-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/d+(f>0?Math.pow(e-y,2)/f:0))*m;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${k.map(e=>`${s(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${l(e.yCenter)}`).join(" "),j=`${s(b)},${l(u(b))}`,$=t.strokeColor||"#6366f1";return e.createElement("g",{key:"ann-"+n},e.createElement("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(B=t.fillOpacity)&&void 0!==B?B:.15,stroke:"none"}),e.createElement("polyline",{points:`${j} ${S}`,fill:"none",stroke:$,strokeWidth:null!==(C=t.strokeWidth)&&void 0!==C?C:2,strokeDasharray:null!==(z=t.strokeDasharray)&&void 0!==z?z:"6,3"}),t.label&&k.length>0&&e.createElement("text",{x:s(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:$,fontSize:11},t.label))}default:return null}}}function Be(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let a="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);a+=`L${Math.min(8*e+4,t)},${o+4*r}`,a+=`L${Math.min(n,t)},${o}`}return a}{const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let a=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);a+=`L${o+4*r},${Math.min(8*e+4,n)}`,a+=`L${o},${Math.min(t,n)}`}return a}}function Ce(e){return Math.round(100*e)/100+""}function ze(n){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,axes:u,xLabel:d,yLabel:h,xFormat:g,yFormat:y,showGrid:f,title:p,legend:m,foregroundGraphics:v,marginalGraphics:b,xValues:x,yValues:w,annotations:k,svgAnnotationRules:A,annotationFrame:S,xAccessor:E,yAccessor:L,annotationData:O,pointNodes:j,children:P}=n,M=t(()=>c&&l?l.x.ticks(5).map(e=>({value:e,pixel:l.x(e),label:(g||Ce)(e)})):[],[c,l,g]),N=t(()=>c&&l?l.y.ticks(5).map(e=>({value:e,pixel:l.y(e),label:(y||Ce)(e)})):[],[c,l,y]),D=t(()=>{if(!k||0===k.length)return null;const e=Te(),t={scales:l?{x:l.x,y:l.y,time:l.x,value:l.y}:null,timeAxis:"x",xAccessor:E,yAccessor:L,width:o,height:r,data:O,frameType:"xy",pointNodes:j};return k.map((n,o)=>{if(A){const r=A(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[k,A,o,r,S,E,L,O]);return c||p||m||v||b||D&&D.length>0||f||P?e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},f&&l&&e.createElement("g",{className:"stream-grid"},M.map((t,n)=>e.createElement("line",{key:"xgrid-"+n,x1:t.pixel,y1:0,x2:t.pixel,y2:r,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1})),N.map((t,n)=>e.createElement("line",{key:"ygrid-"+n,x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),c&&l&&(()=>{const t=null==u?void 0:u.find(e=>"left"===e.orient),n=null==u?void 0:u.find(e=>"bottom"===e.orient),i=!t||!1!==t.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==n?void 0:n.jaggedBase)||!1,c="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, #666)",y="var(--semiotic-text, #333)";return e.createElement("g",{className:"stream-axes"},(!n||!1!==n.baseline)&&!l&&e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:c,strokeWidth:1}),l&&e.createElement("path",{d:Be("bottom",o,r),fill:"none",stroke:c,strokeWidth:1}),M.map((t,n)=>e.createElement("g",{key:"xtick-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:c,strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:g,style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:y,style:{userSelect:"none"}},d),i&&!a&&e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:c,strokeWidth:1}),a&&e.createElement("path",{d:Be("left",o,r),fill:"none",stroke:c,strokeWidth:1}),N.map((t,n)=>e.createElement("g",{key:"ytick-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:c,strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:g,style:{userSelect:"none"}},t.label))),h&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:y,transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},h))})(),D,b&&l&&x&&w&&e.createElement(e.Fragment,null,b.top&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ee,{orient:"top",config:Se(b.top),values:x,scale:l.x,size:s.top,length:o})),b.bottom&&e.createElement("g",{transform:`translate(0, ${r})`},e.createElement(Ee,{orient:"bottom",config:Se(b.bottom),values:x,scale:l.x,size:s.bottom,length:o})),b.left&&e.createElement("g",{transform:"translate(0, 0)"},e.createElement(Ee,{orient:"left",config:Se(b.left),values:w,scale:l.y,size:s.left,length:r})),b.right&&e.createElement("g",{transform:`translate(${o}, 0)`},e.createElement(Ee,{orient:"right",config:Se(b.right),values:w,scale:l.y,size:s.right,length:r}))),v,P),p&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof p?p:null),m&&e.createElement("g",{transform:`translate(${i-s.right+10}, ${s.top})`},function(t){return"object"==typeof t&&null!==t&&!e.isValidElement(t)&&"legendGroups"in t}(m)?e.createElement(Ae,{legendGroups:m.legendGroups,title:"",width:100}):m)):null}function $e(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}const We=(e,t,n,o)=>{var r;const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;e.beginPath();const[n,o]=t.topPath[0];e.moveTo(n,o);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath();const i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:.7;if(e.globalAlpha=i,e.fillStyle=t.style.fill||"#4e79a7",e.fill(),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=1,e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]),e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);e.stroke()}e.globalAlpha=1}},_e=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"point"===e.type);for(const t of a){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const n=null!==(r=t.style.opacity)&&void 0!==r?r: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!==(i=t._pulseGlowRadius)&&void 0!==i?i: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}},He=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r)null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon?Ie(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 Ie(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.w)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,a=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,a,o,r,r)}else{const i=r+o,a=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,a,r,r)}e.restore()}const Re={line:[We,(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const i of r){if(2>i.path.length)continue;const a=i.style.stroke||"#007bff",s=i.style.strokeWidth||2,l=i.colorThresholds,c=i.rawValues;if(e.setLineDash(i.style.strokeDasharray?i.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=i.style.opacity&&(e.globalAlpha=i.style.opacity),e.lineWidth=s,l&&0!==l.length&&c&&c.length===i.path.length){let u=null,d=null,h=null,g=null,y=!1;function f(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),y=!0}function p(){y&&(e.stroke(),y=!1)}for(let m=0;i.path.length>m;m++){const[v,b]=i.path[m],x=c[m],w=$e(x,l,a);if(null!==u&&null!==g&&null!==h){if(w===g)e.lineTo(v,b);else{const k=[];for(const A of l){const S=A.value;(h>S||S>x)&&(S>h||x>S)||h===S||x===S||k.push({t:(S-h)/(x-h)})}k.sort((e,t)=>e.t-t.t);for(const E of k){const L=u+(v-u)*E.t,O=d+(b-d)*E.t,j=$e(h+(x-h)*Math.min(E.t+1e-4,1),l,a);e.lineTo(L,O),p(),f(j,L,O)}e.lineTo(v,b)}u=v,d=b,h=x,g=w}else f(w,v,b),u=v,d=b,h=x,g=w}p()}else{e.beginPath(),e.strokeStyle=a;const[P,M]=i.path[0];e.moveTo(P,M);for(let N=1;i.path.length>N;N++)e.lineTo(i.path[N][0],i.path[N][1]);e.stroke()}if(i.style.fill&&i.style.fillOpacity&&i.style.fillOpacity>0){e.beginPath(),e.globalAlpha=i.style.fillOpacity,e.fillStyle=i.style.fill;const[D,T]=i.path[0];e.moveTo(D,T);for(let C=1;i.path.length>C;C++)e.lineTo(i.path[C][0],i.path[C][1]);const B=i.path[0][0];e.lineTo(i.path[i.path.length-1][0],o.height),e.lineTo(B,o.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[We],stackedarea:[We],scatter:[_e],bubble:[_e],heatmap:[(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const n=t.style;null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle="#fff",e.lineWidth=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}}],bar:[He],swarm:[_e],waterfall:[(e,t,n,o)=>{var r,i,a;He(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const l=s[0].datum,c=null==l?void 0:l._connectorStroke;if(c){e.save(),e.strokeStyle=c,e.lineWidth=null!==(r=null==l?void 0:l._connectorWidth)&&void 0!==r?r:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],r=s[t+1];if(!(null===(i=o.datum)||void 0===i?void 0:i.cumEnd)||!(null===(a=r.datum)||void 0===a?void 0:a.baseline))continue;const l=n.y(o.datum.cumEnd),c=o.x+o.w,u=r.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=t.wickColor,e.lineWidth=t.wickWidth,e.stroke();const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}}]},Fe={top:20,right:20,bottom:30,left:40},Ye={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white"},Xe={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function Ge({hover:t}){const n=e=>Number.isInteger(e)?e+"":e.toFixed(2);return e.createElement("div",{className:"semiotic-tooltip",style:Xe},e.createElement("div",{style:{fontWeight:600,marginBottom:2}},n(t.value)),e.createElement("div",{style:{opacity:.7,fontSize:11}},n(t.time)))}function qe({width:t,height:n,totalWidth:r,totalHeight:i,margin:s,dimension:l,scales:c,onBrush:u}){const d=o(null),p=o(null);return a(()=>{if(!d.current)return;const e=f(d.current).select(".brush-g"),o="x"===l?h():"y"===l?g():y();return o.extent([[0,0],[t,n]]),o.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let o,r;if("x"===l){const[t,i]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(n),c.y.invert(0)]}else if("y"===l){const[n,i]=e.selection;o=[c.x.invert(0),c.x.invert(t)],r=[c.y.invert(i),c.y.invert(n)]}else{const[[t,n],[i,a]]=e.selection;o=[c.x.invert(t),c.x.invert(i)],r=[c.y.invert(a),c.y.invert(n)]}u({x:o,y:r})}),e.call(o),p.current=o,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),p.current=null}},[t,n,l,c,u]),e.createElement("svg",{ref:d,width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},e.createElement("g",{className:"brush-g",transform:`translate(${s.left},${s.top})`}))}const Ve=n(function(n,l){var c,u,d;const{chartType:h,runtimeMode:g,data:y,xAccessor:f,yAccessor:p,colorAccessor:m,sizeAccessor:v,groupAccessor:b,lineDataAccessor:x,normalize:w,binSize:k,valueAccessor:A,arrowOfTime:S="right",windowMode:E="sliding",windowSize:L=200,timeAccessor:O,xExtent:j,yExtent:P,extentPadding:M=.1,sizeRange:N,size:D=[500,300],margin:T,className:B,background:C,lineStyle:z,pointStyle:$,areaStyle:W,waterfallStyle:_,swarmStyle:H,barColors:I,colorScheme:R,boundsAccessor:F,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:q,closeAccessor:V,candlestickStyle:U,showAxes:Z=!0,axes:Q,xLabel:J,yLabel:K,xFormat:ee,yFormat:te,tickFormatTime:oe,tickFormatValue:re,hoverAnnotation:ie,tooltipContent:ae,customHoverBehavior:se,enableHover:le,annotations:ce,svgAnnotationRules:ue,showGrid:de,legend:he,backgroundGraphics:xe,foregroundGraphics:we,title:ke,categoryAccessor:Ae,brush:Se,onBrush:Ee,decay:Le,pulse:Oe,transition:je,staleness:Pe,heatmapAggregation:Me,heatmapXBins:Ne,heatmapYBins:De,marginalGraphics:Te,pointIdAccessor:Be}=n,Ce=Object.assign(Object.assign({},Fe),T);if(Te){const e=60;Te.top&&e>Ce.top&&(Ce.top=e),Te.bottom&&e>Ce.bottom&&(Ce.bottom=e),Te.left&&e>Ce.left&&(Ce.left=e),Te.right&&e>Ce.right&&(Ce.right=e)}const $e=D[0]-Ce.left-Ce.right,We=D[1]-Ce.top-Ce.bottom,_e=null!=ie?ie:le,He=o(null),Ie=o(0),Xe=o(!1),[Ve,Ue]=r(0),[Ze,Qe]=r(null),Je=o(null),Ke=o(null),[et,tt]=r(null),[nt,ot]=r(!1),[rt,it]=r([]),[at,st]=r([]),lt=o(()=>{}),ct="streaming"===g||["bar","swarm","waterfall"].includes(h),ut=t(()=>({chartType:h,runtimeMode:ct?"streaming":"bounded",windowSize:L,windowMode:E,arrowOfTime:ct?S:"right",extentPadding:M,xAccessor:ct?void 0:f,yAccessor:ct?void 0:p,timeAccessor:ct?O:void 0,valueAccessor:A,colorAccessor:m,sizeAccessor:v,groupAccessor:b,categoryAccessor:Ae,lineDataAccessor:x,xExtent:j,yExtent:P,sizeRange:N,binSize:k,normalize:w,boundsAccessor:F,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:q,closeAccessor:V,candlestickStyle:U,lineStyle:z,pointStyle:$,areaStyle:W,swarmStyle:H,waterfallStyle:_,colorScheme:R,barColors:I,annotations:ce,decay:Le,pulse:Oe,transition:je,staleness:Pe,heatmapAggregation:Me,heatmapXBins:Ne,heatmapYBins:De,pointIdAccessor:Be}),[h,L,E,S,M,f,p,O,A,m,v,b,Ae,x,j,P,N,k,w,F,Y,X,G,q,V,U,z,$,W,H,_,R,I,ce,Le,Oe,je,Pe,Me,Ne,De,ct,Be]),dt=o(null);dt.current||(dt.current=new ge(ut));const ht=i(()=>{Ie.current||(Ie.current=requestAnimationFrame(()=>lt.current()))},[]);a(()=>{var e;null===(e=dt.current)||void 0===e||e.updateConfig(ut),Xe.current=!0,ht()},[ut,ht]);const gt=o(null);gt.current||(gt.current=new ne(e=>{const t=dt.current;t&&t.ingest(e)&&(Xe.current=!0,ht())}));const yt=i(e=>{var t;null===(t=gt.current)||void 0===t||t.push(e)},[]),ft=i(e=>{var t;null===(t=gt.current)||void 0===t||t.pushMany(e)},[]),pt=i(()=>{var e,t;null===(e=gt.current)||void 0===e||e.clear(),null===(t=dt.current)||void 0===t||t.clear(),Xe.current=!0,ht()},[ht]);s(l,()=>({push:yt,pushMany:ft,clear:pt,getData:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=dt.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[yt,ft,pt]),a(()=>{var e;y&&(null===(e=gt.current)||void 0===e||e.setBoundedData(y))},[y]);const mt=o(()=>{}),vt=o(()=>{});mt.current=e=>{if(!_e)return;const t=He.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-Ce.left,r=e.clientY-n.top-Ce.top;if(0>o||o>$e||0>r||r>We)return void(Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht()));const i=dt.current;if(!i||0===i.scene.length)return;const a=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"point":e=ye(i,t,n);break;case"line":e=fe(i,t,n);break;case"rect":e=pe(i,t,n);break;case"heatcell":e=me(i,t,n);break;case"area":if(!1===i.interactive)break;e=be(i,t,n);break;case"candlestick":e=ve(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,o,r);if(!a)return void(Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht()));const s={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};Je.current=s,Ke.current=a.node,tt(s),se&&se(s),ht()},vt.current=()=>{Je.current&&(Je.current=null,Ke.current=null,tt(null),se&&se(null),ht())};const bt=i(e=>mt.current(e),[]),xt=i(()=>vt.current(),[]);lt.current=()=>{var e,t;Ie.current=0;const n=He.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=dt.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i);a||r.computeScene({width:$e,height:We});const s="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=D[0]*s,n.height=D[1]*s,n.style.width=D[0]+"px",n.style.height=D[1]+"px",o.scale(s,s),o.translate(Ce.left,Ce.top),o.clearRect(-Ce.left,-Ce.top,D[0],D[1]);const l=function(e){if(!e)return Ye;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),s=n||t.getPropertyValue("--surface-3").trim(),l=r||t.getPropertyValue("--surface-0").trim();return i||a||n?{axisStroke:s||Ye.axisStroke,tickText:i||Ye.tickText,crosshair:i?i+"66":Ye.crosshair,hoverFill:l?l+"4D":Ye.hoverFill,hoverStroke:i?i+"99":Ye.hoverStroke,pointRing:l||Ye.pointRing}:Ye}(n),c=null!==(e=null==Pe?void 0:Pe.threshold)&&void 0!==e?e:5e3,u=Pe&&r.lastIngestTime>0&&i-r.lastIngestTime>c;u&&(o.globalAlpha=null!==(t=null==Pe?void 0:Pe.dimOpacity)&&void 0!==t?t:.5);const d=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=C||(d&&"transparent"!==d?d:null);g&&(o.fillStyle=g,o.fillRect(-Ce.left,-Ce.top,D[0],D[1])),o.save(),"function"==typeof o.rect&&(o.beginPath(),o.rect(0,0,$e,We),o.clip());const y=Re[h];if(y&&r.scales)for(const e of y)e(o,r.scene,r.scales,{width:$e,height:We});if(o.restore(),u&&(o.globalAlpha=1),_e&&Je.current&&r.scales&&function(e,t,n,o,r,i,a){if(!1===r.crosshair)return;e.save();const s="object"==typeof r.crosshair?r.crosshair:{};e.strokeStyle=s.stroke||a.crosshair,e.lineWidth=s.strokeWidth||1,e.setLineDash(s.strokeDasharray?s.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(t.x,0),e.lineTo(t.x,o),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke(),e.restore(),e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle="#007bff",e.fill(),e.strokeStyle=a.pointRing,e.lineWidth=2,e.stroke()}(o,Je.current,$e,We,"object"==typeof _e?_e:{},0,l),Ke.current&&Array.isArray(ie)){const e=ie.find(e=>e&&"object"==typeof e&&"highlight"===e.type);e&&function(e,t,n,o){var r;if(!n)return;const i=n.group;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?o.style(n.datum):o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||"#007bff",e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(o,r.scene,Ke.current,e)}const m=Xe.current;if(Xe.current=!1,m&&r.scales&&(Qe(r.scales),Te)){const e=r.getData(),t="function"==typeof f?f:e=>e[f||"x"],n="function"==typeof p?p:e=>e[p||"y"];it(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),st(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}m&&ce&&ce.length>0&&Ue(e=>e+1),(null==Pe?void 0:Pe.showBadge)&&ot(!!u),(a||r.hasActivePulses)&&(Ie.current=requestAnimationFrame(()=>lt.current()))},a(()=>(ht(),()=>{Ie.current&&cancelAnimationFrame(Ie.current)}),[ht]),a(()=>{Xe.current=!0,ht()},[h,$e,We,Z,C,z,ht]),a(()=>{if(!Pe)return;const e=setInterval(()=>{var e;const t=dt.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=Pe.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==nt&&(ot(r),Xe.current=!0,ht())},1e3);return()=>clearInterval(e)},[Pe,nt,ht]);const wt=_e&&et?ae?ae(et):e.createElement(Ge,{hover:et}):null,kt=wt?e.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:Ce.left+et.x,top:Ce.top+et.y,transform:`translate(${et.x>.7*$e?"calc(-100% - 12px)":"12px"}, ${.3*We>et.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},wt):null;return e.createElement("div",{className:"stream-xy-frame"+(B?" "+B:""),role:"img","aria-label":"string"==typeof ke?ke:"XY chart",style:{position:"relative",width:D[0],height:D[1]},onMouseMove:_e?bt:void 0,onMouseLeave:_e?xt:void 0},xe&&e.createElement("svg",{style:{position:"absolute",left:0,top:0,width:D[0],height:D[1],pointerEvents:"none"}},xe),e.createElement("canvas",{ref:He,style:{position:"absolute",left:0,top:0}}),e.createElement(ze,{width:$e,height:We,totalWidth:D[0],totalHeight:D[1],margin:Ce,scales:Ze,showAxes:Z,axes:Q,xLabel:J,yLabel:K,xFormat:ee||oe,yFormat:te||re,showGrid:de,title:ke,legend:he,foregroundGraphics:we,marginalGraphics:Te,xValues:rt,yValues:at,annotations:ce,svgAnnotationRules:ue,annotationFrame:Ve,xAccessor:"string"==typeof f?f:"string"==typeof O?O:void 0,yAccessor:"string"==typeof p?p:"string"==typeof A?A:void 0,annotationData:null===(c=dt.current)||void 0===c?void 0:c.getData(),pointNodes:null===(u=dt.current)||void 0===u?void 0:u.scene.filter(e=>"point"===e.type)}),(Se||Ee)&&e.createElement(qe,{width:$e,height:We,totalWidth:D[0],totalHeight:D[1],margin:Ce,dimension:null!==(d=null==Se?void 0:Se.dimension)&&void 0!==d?d:"xy",scales:Ze,onBrush:null!=Ee?Ee:()=>{}}),(null==Pe?void 0:Pe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Pe.badgePosition?{top:4,left:4}:"bottom-left"===Pe.badgePosition?{bottom:4,left:4}:"bottom-right"===Pe.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"),kt)});Ve.displayName="StreamXYFrame";const Ue={category10:X,tableau10:Y,set3:F,blues:R,reds:I,greens:H,oranges:_,purples:W,viridis:$,plasma:z},Ze=X,Qe=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];function Je(e,t,n){if("function"==typeof t)return t(e);const o=e[t];return n?n(o):Ze[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+""))%Ze.length]}function Ke(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>e[t]))),r=o.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(n))return m().domain(o).range(n).unknown("#999");const i=Ue[n]||Ue.category10;if(r&&"function"==typeof i)return e=>i(Number(e)/Math.max(...o.map(Number)));{const e=Array.isArray(i)?i:Ze;return m().domain(o).range(e).unknown("#999")}}function et(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e[t],!o)return r;const[i,a]=o,[s,l]=n;return a===i?(s+l)/2:s+(r-i)/(a-i)*(l-s)}function tt(e){return e?"string"==typeof e?{name:e}:e:null}function nt(e,t,n){return t?o=>{var r,i;const a=Object.assign({},e(o));return t.isActive&&(t.predicate(o)?(null==n?void 0:n.selectedStyle)&&Object.assign(a,n.selectedStyle):(a.fillOpacity=null!==(r=null==n?void 0:n.unselectedOpacity)&&void 0!==r?r:.2,a.strokeOpacity=null!==(i=null==n?void 0:n.unselectedOpacity)&&void 0!==i?i:.2,(null==n?void 0:n.unselectedStyle)&&Object.assign(a,n.unselectedStyle))),a}:e}function ot(n){const o=l(null),i=rt(n);return[function({children:r}){const i=t(()=>rt(n),[]);return e.createElement(o.Provider,{value:i,children:r})},e=>{var t;const n=null!==(t=c(o))&&void 0!==t?t:i;return function(e,t){const[n,o]=r(t);return u(()=>e(()=>o(t)),[e]),n}(n.subscribe,()=>e(n.getState()))}]}function rt(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 it(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,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function at(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(it(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function st(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}const[lt,ct]=ot(e=>({selections:new Map,setClause(t,n){e(e=>{const o=new Map(e.selections),r=st(o,t),i=new Map(r.clauses);return i.set(n.clientId,n),o.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:o}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o)return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,Object.assign(Object.assign({},o),{clauses:i})),{selections:r}})},setResolution(t,n){e(e=>{const o=new Map(e.selections),r=st(o,t);return o.set(t,Object.assign(Object.assign({},r),{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 ut(e){const n=d(),o=e.clientId||n,{name:r}=e,a=ct(e=>e.selections.get(r)),s=ct(e=>e.setClause),l=ct(e=>e.clearClause),c=t(()=>!!a&&a.clauses.size>0,[a]);return{predicate:t(()=>a&&0!==a.clauses.size?at(a,o):()=>!0,[a,o]),isActive:c,selectPoints:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)};s(r,{clientId:o,type:"point",fields:t})},[o,r,s]),selectInterval:i(e=>{const t={};for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o};s(r,{clientId:o,type:"interval",fields:t})},[o,r,s]),clear:i(()=>{l(r,o)},[l,r,o]),clientId:o}}function dt(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:a,clear:s}=ut({name:t});return{onHover:i(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Object.keys(t).length>0&&a(t)},[n,a,s]),predicate:o,isActive:r}}function ht(e){const{name:n,xField:o,yField:r}=e,{predicate:a,isActive:s,selectInterval:l,clear:c}=ut({name:n}),u=o&&r?"xyBrush":o?"xBrush":"yBrush",d=i(e=>{if(!e)return void c();const t={};"xyBrush"===u&&Array.isArray(e)&&2===e.length?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===u&&Array.isArray(e)?o&&(t[o]=[Math.min(...e),Math.max(...e)]):"yBrush"===u&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&l(t)},[u,o,r,l,c]);return{brushInteraction:t(()=>({brush:u,during:d,end:d}),[u,d]),predicate:a,isActive:s,clear:c}}function gt(e,n,o){const r=ct(e=>e.selections.get(n));return t(()=>{if(!r||0===r.clauses.size)return e;const t=at(r,o);return e.filter(t)},[e,r,o])}const[yt,ft]=ot(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}))}})),pt="#007bff";function mt(e){return"function"==typeof e?e:t=>t[e]}function vt(e,n,o="category10"){return t(()=>{if(n&&"function"!=typeof n)return Ke(e,n,o)},[e,n,o])}function bt(e,n,o){return t(()=>{if(!n)return e;const t=[...e];if("function"==typeof n)return t.sort(n);const r=mt(o);return t.sort("asc"===n?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[e,n,o])}function xt({selection:e,linkedHover:t,fallbackFields:n=[],unwrapData:o=!1,onObservation:r,chartType:a,chartId:s}){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}(t,n),c=ut({name:(null==e?void 0:e.name)||"__unused__"}),u=dt({name:(null==l?void 0:l.name)||"hover",fields:(null==l?void 0:l.fields)||[]}),d=ft(e=>e.pushObservation);return{activeSelectionHook:e?{isActive:c.isActive,predicate:c.predicate}:null,customHoverBehavior:i(e=>{var n,o;if(t){let t=e&&(e.data||e.datum)||e;Array.isArray(t)&&(t=t[0]),u.onHover(t)}if(r||d){const t={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},t),{type:"hover",datum:i||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(o=e.y)&&void 0!==o?o:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},t),{type:"hover-end"});r&&r(e),d&&d(e)}}},[t,u,r,a,s,d]),customClickBehavior:i(e=>{var t,n;if(r||d){const o={timestamp:Date.now(),chartType:a||"unknown",chartId:s};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);const a=Object.assign(Object.assign({},o),{type:"click",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(a),d&&d(a)}else{const e=Object.assign(Object.assign({},o),{type:"click-end"});r&&r(e),d&&d(e)}}},[r,d,a,s])}}function wt({data:e,colorBy:n,colorScale:o,showLegend:r,userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40}}){const s=void 0!==r?r:!!n,l=t(()=>{if(s&&n)return function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i}){const a=Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t]))).map(r=>{const i=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=i?o(i,t,n):n?n(r):"#000000";return{label:r+"",color:a}});return{legendGroups:[{styleFn:e=>{const t={fill:e.color,stroke:e.color};return void 0!==r&&(t.stroke=r),void 0!==i&&(t.strokeWidth=i),t},type:"fill",items:a,label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:Je})},[s,n,e,o]),c=t(()=>{const e=Object.assign(Object.assign({},a),i);return l&&120>e.right&&(e.right=120),e},[a,i,l]);return{legend:l,margin:c}}const kt={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 At(e,t,n){var o,r,i,a,s,l;const c=kt[e||"primary"],u="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?c.width:n.width,height:null!==(r=t.height)&&void 0!==r?r:e&&"primary"!==e||!(null==n?void 0:n.height)?c.height:n.height,showAxes:c.showAxes,showGrid:null!==(i=t.showGrid)&&void 0!==i?i:c.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||c.enableHover,showLegend:null!==(s=t.showLegend)&&void 0!==s?s: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 St={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 Et(e,t){return"function"==typeof t?t(e):e[t]}function Lt(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 Ot(t={}){const{fields:n=[],title:o,format:r,style:i={},className:a="",showLabels:s=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(o){const e=Et(t,o);c.push({value:Lt(e,r)})}n&&Array.isArray(n)&&n.length>0?n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Lt(Et(t,o),i);c.push({label:s?n:void 0,value:a})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:s?e:void 0,value:Lt(t[e],r)})});const u=Object.assign(Object.assign({},St),i);return Array.isArray(c)&&0!==c.length?e.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+a).trim(),style:u},c.map((t,n)=>e.createElement("div",{key:n,style:{marginBottom:c.length-1>n?"4px":0}},t.label&&e.createElement("strong",null,t.label,l),t.value))):null}}function jt(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:n,title:o,format:r,style:i={},className:a=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let s;const l=[];if(o){const e=Et(t,o);s=Lt(e,r)}if(n&&n.length>0)n.forEach(e=>{let n,o,i;"string"==typeof e?(n=e,o=e,i=r):(n=e.label,o=e.accessor||e.key||"",i=e.format||r);const a=Et(t,o);l.push({label:n,value:Lt(a,i)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){s=Lt(t[n],r);break}if(!s){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(s=Lt(t[e[0]],r))}}const c=Object.assign(Object.assign({},St),i);return e.createElement("div",{className:("semiotic-tooltip "+a).trim(),style:c},s&&e.createElement("div",{style:{fontWeight:l.length>0?"bold":"normal"}},s),l.map((t,n)=>e.createElement("div",{key:n,style:{marginTop:0===n&&s?"4px":0}},t.label&&e.createElement("span",null,t.label,": "),t.value)))}}(t)))}function Pt(e){return"string"==typeof e?e:"value"}function Mt(e){return null==e?"–":"number"==typeof e?e.toLocaleString():e instanceof Date?e.toLocaleDateString():e+""}function Nt(e,t){return"function"==typeof t?t(e):e[t]}function Dt(t){return n=>{const o=n.data;return o?e.createElement("div",{className:"semiotic-tooltip",style:St},t.map((t,n)=>{const r=Mt(Nt(o,t.accessor));return e.createElement("div",{key:n,style:n>0?{marginTop:2}:void 0},e.createElement("span",{style:{opacity:.8}},t.label,": "),e.createElement("span",{style:{fontWeight:"color"===t.role||"group"===t.role?"bold":"normal"}},r))})):null}}function Tt({categoryAccessor:t,valueAccessor:n,groupAccessor:o,groupLabel:r,pieData:i=!1}){return a=>{var s;const l=i?(null===(s=a.data)||void 0===s?void 0:s[0])||a.data||a:a.data||a,c=Nt(l,t),u=Nt(l,n),d=o?Nt(l,o):void 0;return e.createElement("div",{className:"semiotic-tooltip",style:St},e.createElement("div",{style:{fontWeight:"bold"}},Mt(c)),e.createElement("div",{style:{marginTop:4}},Mt(u)),null!=d&&e.createElement("div",{style:{marginTop:2,opacity:.8}},r||Pt(o),": ",Mt(d)))}}function Bt({componentName:t,message:n,width:o,height:r}){return e.createElement("div",{role:"alert",style:{width:o,height:Math.max(r,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"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400}},e.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},t),e.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},n)))}function Ct(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function zt({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 Ct(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 $t({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function Wt({nodes:e,edges:t,nodesRequired:n=!1,edgesRequired:o=!0,accessors:r}){if(o&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(n&&(!e||!Array.isArray(e)||0===e.length))return"No nodes provided. Pass a non-empty array to the nodes prop.";if(r&&e&&e.length>0)for(const t of Ct(e))if(t&&"object"==typeof t)for(const[e,n]of Object.entries(r))if(n&&"string"==typeof n&&!(n in t))return`${e} "${n}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`;return null}function _t(n){var o,r;const i=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:s,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",lineBy:g,lineDataAccessor:y="coordinates",colorBy:f,colorScheme:p="category10",curve:m="linear",showPoints:v=!1,pointRadius:b=3,fillArea:x=!1,areaOpacity:w=.3,lineWidth:k=2,tooltip:A,pointIdAccessor:S,annotations:E,frameProps:L={},selection:O,linkedHover:j,onObservation:P,chartId:M}=n,N=i.width,D=i.height,T=i.enableHover,B=i.showGrid,C=i.showLegend,z=i.title,$=i.xLabel,W=i.yLabel,_=a||[],{activeSelectionHook:H,customHoverBehavior:I}=xt({selection:O,linkedHover:j,fallbackFields:f?["string"==typeof f?f:""]:[],onObservation:P,chartType:"LineChart",chartId:M}),R=void 0!==(null===(o=_[0])||void 0===o?void 0:o[y]),F=t(()=>{if(R)return _;if(g){const e=_.reduce((e,t)=>{const n="function"==typeof g?g(t):t[g];if(!e[n]){const t={[y]:[]};"string"==typeof g&&(t[g]=n),e[n]=t}return e[n][y].push(t),e},{});return Object.values(e)}return[{[y]:_}]},[_,g,y,R]),Y=vt(_,f,p),X=t(()=>e=>{const t={strokeWidth:k};return t.stroke=f?Je(e,f,Y):pt,x&&(t.fill=t.stroke,t.fillOpacity=w),t},[f,Y,k,x,w]),G=t(()=>nt(X,H,O),[X,H,O]),q=t(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return t.fill=f?Je(e.parentLine||e,f,Y):pt,t}},[v,b,f,Y]),V=x?"area":"line",{legend:U,margin:Z}=wt({data:F,colorBy:f,colorScale:Y,showLegend:C,userMargin:s,defaults:i.marginDefaults}),Q=g||f,J=t(()=>Dt([{label:$||Pt(d),accessor:d,role:"x"},{label:W||Pt(h),accessor:h,role:"y"},...Q?[{label:Pt(Q),accessor:Q,role:"group"}]:[]]),[d,h,$,W,Q]),K=zt({componentName:"LineChart",data:R?(null===(r=_[0])||void 0===r?void 0:r[y])||[]:_,accessors:{xAccessor:d,yAccessor:h}});if(K)return e.createElement(Bt,{componentName:"LineChart",message:K,width:N,height:D});const ee=t(()=>R||g?F.flatMap(e=>{const t=e[y]||[];return g&&"string"==typeof g?t.map(t=>Object.assign(Object.assign({},t),{[g]:e[g]})):t}):_,[F,y,R,g,_]),te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:V,data:ee,xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,lineStyle:G},v&&{pointStyle:q}),{size:[N,D],margin:Z,showAxes:i.showAxes,xLabel:$,yLabel:W,xFormat:c,yFormat:u,enableHover:T,showGrid:B}),U&&{legend:U}),z&&{title:z}),l&&{className:l}),{tooltipContent:A?jt(A):J}),(j||P)&&{customHoverBehavior:I}),S&&{pointIdAccessor:S}),E&&E.length>0&&{annotations:E}),L);return e.createElement(Ve,Object.assign({},te))}function Ht(n){var o;const r=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",areaBy:h,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:f="category10",curve:p="monotoneX",areaOpacity:m=.7,showLine:v=!0,lineWidth:b=2,tooltip:x,annotations:w,frameProps:k={},selection:A,linkedHover:S,onObservation:E,chartId:L}=n,O=r.width,j=r.height,P=r.enableHover,M=r.showGrid,N=r.showLegend,D=r.title,T=r.xLabel,B=r.yLabel,C=i||[],{activeSelectionHook:z,customHoverBehavior:$}=xt({selection:A,linkedHover:S,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:E,chartType:"AreaChart",chartId:L}),W=void 0!==(null===(o=C[0])||void 0===o?void 0:o[g]),_=t(()=>{if(W)return C;if(h){const e=C.reduce((e,t)=>{const n="function"==typeof h?h(t):t[h];if(!e[n]){const t={[g]:[]};"string"==typeof h&&(t[h]=n),e[n]=t}return e[n][g].push(t),e},{});return Object.values(e)}return[{[g]:C}]},[C,h,g,W]),H=vt(C,y,f),I=t(()=>e=>{const t={},n=y?Je(e,y,H):pt;return t.fill=n,t.fillOpacity=m,v?(t.stroke=n,t.strokeWidth=b):t.stroke="none",t},[y,H,m,v,b]),R=t(()=>nt(I,z,A),[I,z,A]),{legend:F,margin:Y}=wt({data:_,colorBy:y,colorScale:H,showLegend:N,userMargin:a,defaults:r.marginDefaults}),X=h||y,G=t(()=>Dt([{label:T||Pt(u),accessor:u,role:"x"},{label:B||Pt(d),accessor:d,role:"y"},...X?[{label:Pt(X),accessor:X,role:"group"}]:[]]),[u,d,T,B,X]),q=zt({componentName:"AreaChart",data:C,accessors:{xAccessor:u,yAccessor:d}});if(q)return e.createElement(Bt,{componentName:"AreaChart",message:q,width:O,height:j});const V=t(()=>W||h?_.flatMap(e=>{const t=e[g]||[];return h&&"string"==typeof h?t.map(t=>Object.assign(Object.assign({},t),{[h]:e[h]})):t}):C,[_,g,W,h,C]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:V,xAccessor:u,yAccessor:d,groupAccessor:h||void 0,curve:p,lineStyle:R,size:[O,j],margin:Y,showAxes:r.showAxes,xLabel:T,yLabel:B,xFormat:l,yFormat:c,enableHover:P,showGrid:M},F&&{legend:F}),D&&{title:D}),s&&{className:s}),{tooltipContent:x?jt(x):G}),(S||E)&&{customHoverBehavior:$}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Ve,Object.assign({},U))}function It(n){var o;const r=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:i,margin:a,className:s,xFormat:l,yFormat:c,xAccessor:u="x",yAccessor:d="y",areaBy:h,lineDataAccessor:g="coordinates",colorBy:y,colorScheme:f="category10",curve:p="monotoneX",areaOpacity:m=.7,showLine:v=!0,lineWidth:b=2,normalize:x=!1,tooltip:w,annotations:k,frameProps:A={},selection:S,linkedHover:E,onObservation:L,chartId:O}=n,j=r.width,P=r.height,M=r.enableHover,N=r.showGrid,D=r.showLegend,T=r.title,B=r.xLabel,C=r.yLabel,z=i||[],{activeSelectionHook:$,customHoverBehavior:W}=xt({selection:S,linkedHover:E,fallbackFields:y?["string"==typeof y?y:""]:[],onObservation:L,chartType:"StackedAreaChart",chartId:O}),_=void 0!==(null===(o=z[0])||void 0===o?void 0:o[g]),H=t(()=>{if(_)return z;if(h){const e=z.reduce((e,t)=>{const n="function"==typeof h?h(t):t[h];if(!e[n]){const t={[g]:[]};"string"==typeof h&&(t[h]=n),e[n]=t}return e[n][g].push(t),e},{});return Object.values(e)}return[{[g]:z}]},[z,h,g,_]),I=vt(z,y,f),R=t(()=>e=>{const t={},n=y?Je(e,y,I):pt;return t.fill=n,t.fillOpacity=m,v?(t.stroke=n,t.strokeWidth=b):t.stroke="none",t},[y,I,m,v,b]),F=t(()=>nt(R,$,S),[R,$,S]),{legend:Y,margin:X}=wt({data:H,colorBy:y,colorScale:I,showLegend:D,userMargin:a,defaults:r.marginDefaults}),G=h||y,q=t(()=>Dt([{label:B||Pt(u),accessor:u,role:"x"},{label:C||Pt(d),accessor:d,role:"y"},...G?[{label:Pt(G),accessor:G,role:"group"}]:[]]),[u,d,B,C,G]),V=zt({componentName:"StackedAreaChart",data:z,accessors:{xAccessor:u,yAccessor:d}});if(V)return e.createElement(Bt,{componentName:"StackedAreaChart",message:V,width:j,height:P});const U=t(()=>_||h?H.flatMap(e=>{const t=e[g]||[];return h&&"string"==typeof h?t.map(t=>Object.assign(Object.assign({},t),{[h]:e[h]})):t}):z,[H,g,_,h,z]),Z=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:U,xAccessor:u,yAccessor:d,groupAccessor:h||void 0,curve:p,normalize:x,lineStyle:F,size:[j,P],margin:X,showAxes:r.showAxes,xLabel:B,yLabel:C,xFormat:l,yFormat:c,enableHover:M,showGrid:N},Y&&{legend:Y}),T&&{title:T}),s&&{className:s}),{tooltipContent:w?jt(w):q}),(E||L)&&{customHoverBehavior:W}),k&&k.length>0&&{annotations:k}),A);return e.createElement(Ve,Object.assign({},Z))}function Rt(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",colorBy:d,colorScheme:h="category10",sizeBy:g,sizeRange:y=[3,15],pointRadius:f=5,pointOpacity:p=.8,tooltip:m,marginalGraphics:v,pointIdAccessor:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,linkedBrush:S,onObservation:E,chartId:L}=n,O=o.width,j=o.height,P=o.enableHover,M=o.showGrid,N=o.showLegend,D=o.title,T=o.xLabel,B=o.yLabel,C=r||[],{activeSelectionHook:z,customHoverBehavior:$}=xt({selection:k,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],onObservation:E,chartType:"Scatterplot",chartId:L}),W=tt(S);ht({name:(null==W?void 0:W.name)||"__unused_brush__",xField:(null==W?void 0:W.xField)||("string"==typeof c?c:void 0),yField:(null==W?void 0:W.yField)||("string"==typeof u?u:void 0)});const _=vt(C,d,h),H=t(()=>{if(!g||0===C.length)return;const e=C.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[C,g]),I=t(()=>e=>{const t={fillOpacity:p};return t.fill=d?Je(e,d,_):pt,t.r=g?et(e,g,y,H):f,t},[d,_,g,y,H,f,p]),R=t(()=>nt(I,z,k),[I,z,k]),{legend:F,margin:Y}=wt({data:C,colorBy:d,colorScale:_,showLegend:N,userMargin:i,defaults:o.marginDefaults}),X=t(()=>Dt([{label:T||Pt(c),accessor:c,role:"x"},{label:B||Pt(u),accessor:u,role:"y"},...d?[{label:Pt(d),accessor:d,role:"color"}]:[],...g?[{label:Pt(g),accessor:g,role:"size"}]:[]]),[c,u,T,B,d,g]),G=zt({componentName:"Scatterplot",data:C,accessors:{xAccessor:c,yAccessor:u}});if(G)return e.createElement(Bt,{componentName:"Scatterplot",message:G,width:O,height:j});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:C,xAccessor:c,yAccessor:u,colorAccessor:d||void 0,sizeAccessor:g||void 0,sizeRange:y,pointStyle:R,colorScheme:h,size:[O,j],margin:Y,showAxes:o.showAxes,xLabel:T,yLabel:B,xFormat:s,yFormat:l,enableHover:P,showGrid:M},F&&{legend:F}),D&&{title:D}),a&&{className:a}),{tooltipContent:m?jt(m):X}),(A||E)&&{customHoverBehavior:$}),v&&{marginalGraphics:v}),b&&{pointIdAccessor:b}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Ve,Object.assign({},q))}function Ft(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:i,className:a,xFormat:s,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:g,colorScheme:y="category10",bubbleOpacity:f=.6,bubbleStrokeWidth:p=1,bubbleStrokeColor:m="white",tooltip:v,marginalGraphics:b,pointIdAccessor:x,annotations:w,frameProps:k={},selection:A,linkedHover:S,linkedBrush:E,onObservation:L,chartId:O}=n,j=o.width,P=o.height,M=o.enableHover,N=o.showGrid,D=o.showLegend,T=o.title,B=o.xLabel,C=o.yLabel,z=r||[],{activeSelectionHook:$,customHoverBehavior:W}=xt({selection:A,linkedHover:S,fallbackFields:g?["string"==typeof g?g:""]:[],onObservation:L,chartType:"BubbleChart",chartId:O}),_=tt(E);ht({name:(null==_?void 0:_.name)||"__unused_brush__",xField:(null==_?void 0:_.xField)||("string"==typeof c?c:void 0),yField:(null==_?void 0:_.yField)||("string"==typeof u?u:void 0)});const H=vt(z,g,y),I=t(()=>{const e=z.map(e=>"function"==typeof d?d(e):e[d]);return[Math.min(...e),Math.max(...e)]},[z,d]),R=t(()=>e=>{const t={fillOpacity:f,strokeWidth:p,stroke:m};return t.fill=g?Je(e,g,H):pt,t.r=et(e,d,h,I),t},[g,H,d,h,I,f,p,m]),F=t(()=>nt(R,$,A),[R,$,A]),{legend:Y,margin:X}=wt({data:z,colorBy:g,colorScale:H,showLegend:D,userMargin:i,defaults:o.marginDefaults}),G=t(()=>Dt([{label:B||Pt(c),accessor:c,role:"x"},{label:C||Pt(u),accessor:u,role:"y"},{label:Pt(d),accessor:d,role:"size"},...g?[{label:Pt(g),accessor:g,role:"color"}]:[]]),[c,u,B,C,d,g]),q=zt({componentName:"BubbleChart",data:z,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(q)return e.createElement(Bt,{componentName:"BubbleChart",message:q,width:j,height:P});const V=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:z,xAccessor:c,yAccessor:u,colorAccessor:g||void 0,sizeAccessor:d,sizeRange:h,pointStyle:F,colorScheme:y,size:[j,P],margin:X,showAxes:o.showAxes,xLabel:B,yLabel:C,xFormat:s,yFormat:l,enableHover:M,showGrid:N},Y&&{legend:Y}),T&&{title:T}),a&&{className:a}),{tooltipContent:v?jt(v):G}),(S||L)&&{customHoverBehavior:W}),b&&{marginalGraphics:b}),x&&{pointIdAccessor:x}),w&&w.length>0&&{annotations:w}),k);return e.createElement(Ve,Object.assign({},V))}function Yt(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:i,className:a,xAccessor:s="x",yAccessor:l="y",valueAccessor:c="value",xFormat:u,yFormat:d,colorScheme:h="blues",customColorScale:g,showValues:y=!1,valueFormat:f,cellBorderColor:p="#fff",cellBorderWidth:m=1,tooltip:b,annotations:x,frameProps:w={},selection:k,linkedHover:A,onObservation:S,chartId:E}=n,L=o.width,O=o.height,j=o.enableHover,P=o.title,M=o.xLabel,N=o.yLabel,D=r||[],{margin:T}=wt({data:D,colorBy:void 0,colorScale:void 0,showLegend:!1,userMargin:i,defaults:o.marginDefaults}),{activeSelectionHook:B,customHoverBehavior:C}=xt({selection:k,linkedHover:A,fallbackFields:[],onObservation:S,chartType:"Heatmap",chartId:E}),z=t(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),W=t(()=>{const e=D.map(z);return[Math.min(...e),Math.max(...e)]},[D,z]),_=t(()=>"custom"===h&&g?g:v({blues:R,reds:I,greens:H,viridis:$}[h]||R).domain(W),[h,g,W]);t(()=>{const e=mt(s),t=mt(l);return{xBinCount:new Set(D.map(e)).size,yBinCount:new Set(D.map(t)).size}},[D,s,l]),t(()=>({coordinates:D}),[D]);const F=t(()=>e=>{const t=z(e);return{fill:_(t),stroke:p,strokeWidth:m}},[z,_,p,m]);t(()=>nt(F,B,k),[F,B,k]),t(()=>{if(!y)return;const t=(W[0]+W[1])/2;return(n,o)=>{const r=z(n),i=f?f(r):r+"";return e.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:z(n)>t?"#fff":"#000",fontSize:"12px"},i)}},[y,z,f,W]);const Y=t(()=>Dt([{label:M||Pt(s),accessor:s,role:"x"},{label:N||Pt(l),accessor:l,role:"y"},{label:Pt(c),accessor:c,role:"value"}]),[s,l,M,N,c]),X=zt({componentName:"Heatmap",data:D,accessors:{xAccessor:s,yAccessor:l,valueAccessor:c}});if(X)return e.createElement(Bt,{componentName:"Heatmap",message:X,width:L,height:O});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:D,xAccessor:s,yAccessor:l,valueAccessor:c,size:[L,O],margin:T,showAxes:o.showAxes,xLabel:M,yLabel:N,xFormat:u,yFormat:d,enableHover:j},P&&{title:P}),a&&{className:a}),{tooltipContent:b?jt(b):Y}),(A||S)&&{customHoverBehavior:C}),x&&x.length>0&&{annotations:x}),w);return e.createElement(Ve,Object.assign({},G))}function Xt(e={}){const{limit:n=50,types:o,chartId:r}=e,i=ft(e=>e.version),a=ft(e=>e.observations),s=ft(e=>e.clearObservations),l=t(()=>{let e=a;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>n&&(e=e.slice(e.length-n)),e},[a,o,r,n,i]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:s}}function Gt({selections:e}){const t=ct(e=>e.setResolution);return a(()=>{for(const[n,o]of Object.entries(e))o.resolution&&t(n,o.resolution)},[]),null}function qt({children:t,selections:n}){return e.createElement(lt,null,e.createElement(yt,null,n&&e.createElement(Gt,{selections:n}),t))}_t.displayName="LineChart",Ht.displayName="AreaChart",It.displayName="StackedAreaChart",Rt.displayName="Scatterplot",Ft.displayName="BubbleChart",Yt.displayName="Heatmap";const Vt="__splomIdx",Ut={top:4,bottom:4,left:4,right:4};function Zt({frameRef:t,cellSize:n,onBrush:r}){const i=o(null),s=n-Ut.left-Ut.right,l=n-Ut.top-Ut.bottom;return a(()=>{if(!i.current)return;const e=f(i.current).select(".brush-g"),n=y().extent([[0,0],[s,l]]).on("brush end",e=>{var n;const o=null===(n=t.current)||void 0===n?void 0:n.getScales();if(!o)return;if(!e.selection)return void r(null);const[[i,a],[s,l]]=e.selection,c=[[o.x.invert(i),o.y.invert(a)],[o.x.invert(s),o.y.invert(l)]];r(c)});return e.call(n),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{n.on("brush end",null)}},[s,l,t,r]),e.createElement("svg",{ref:i,width:n,height:n,style:{position:"absolute",top:0,left:0}},e.createElement("g",{className:"brush-g",transform:`translate(${Ut.left},${Ut.top})`}))}function Qt({data:t,xField:n,yField:r,cellSize:a,pointRadius:s,pointOpacity:l,colorBy:c,colorScale:u,brushSelectionName:d,hoverSelectionName:h,unselectedOpacity:g,mode:y,onPointHover:f}){const p=o(null),m=ut({name:d,clientId:`splom-${n}-${r}`}),v=ht({name:d,xField:n,yField:r}),b=ut({name:h,clientId:"splom-hover-source"}),x=b.selectPoints,w=i(e=>{e?v.brushInteraction.during(e):v.brushInteraction.end(null)},[v.brushInteraction]),k=i(e=>{if(!e)return void(null==f||f(null));const t=e.data,n=null==t?void 0:t[Vt];void 0!==n&&(x({[Vt]:[n]}),null==f||f(t,e.x+Ut.left,e.y+Ut.top))},[x,f]),A=i(e=>{const t={opacity:l,r:s};return t.fill=c?Je(e,c,u):pt,"hover"===y?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*l):m.isActive&&!m.predicate(e)&&(t.opacity=g),t},[c,u,l,s,y,m.isActive,m.predicate,b.isActive,b.predicate,g]);return e.createElement("div",{style:{position:"relative",width:a,height:a}},e.createElement(Ve,{ref:p,chartType:"scatter",data:t,size:[a,a],xAccessor:n,yAccessor:r,pointStyle:A,margin:Ut,showAxes:!1,enableHover:"hover"===y,customHoverBehavior:"hover"===y?k:void 0,tooltipContent:"hover"===y?()=>null:void 0}),"brush"===y&&e.createElement(Zt,{frameRef:p,cellSize:a,xField:n,yField:r,onBrush:w}))}function Jt({data:n,field:o,label:r,cellSize:i,bins:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const u=ut({name:s,clientId:"splom-diag-"+o}),d=ut({name:l,clientId:`splom-diag-${o}-hover`}),h="hover"===c?d:u,g=h.isActive,y=h.predicate,f=t(()=>{const e=n.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const t=Math.min(...e),r=(Math.max(...e)-t)/a||1,s=Array(a).fill(0),l=Array(a).fill(0);for(const e of n){const n=e[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-t)/r),a-1);s[i]++,g&&!y(e)||l[i]++}const c=Math.max(...s,1);return{bars:s.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/c*(i-24),count:e})),selectedBars:l.map((e,t)=>({x:t/a*i,w:i/a-1,h:e/c*(i-24),count:e})),max:c}},[n,o,a,i,g,y]);return e.createElement("svg",{width:i,height:i,style:{overflow:"hidden"}},e.createElement("text",{x:i/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},r),f.bars.map((t,n)=>e.createElement("rect",{key:"bg-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:"#ccc",opacity:g?.3:.6})),g&&f.selectedBars.map((t,n)=>e.createElement("rect",{key:"sel-"+n,x:t.x,y:i-t.h,width:Math.max(t.w,1),height:t.h,fill:pt,opacity:.7})))}function Kt({label:t,cellSize:n}){return e.createElement("svg",{width:n,height:n},e.createElement("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},t))}function en(n){const{data:o,fields:a,fieldLabels:s={},colorBy:l,colorScheme:c="category10",cellSize:u=150,cellGap:d=4,pointRadius:h=2,pointOpacity:g=.5,diagonal:y="histogram",histogramBins:f=20,brushMode:p="crossfilter",hoverMode:m=!0,unselectedOpacity:v=.1,showGrid:b=!1,tooltip:x,showLegend:w,idAccessor:k,className:A,onObservation:S,chartId:E}=n,L="splom",O="splom-hover",j=m?"hover":p?"brush":"hover",P=ct(e=>e.clearSelection),[M,N]=r(null),D=i(()=>{P(O),N(null)},[P,O]),T=t(()=>(o||[]).map((e,t)=>void 0!==e[Vt]?e:Object.assign(Object.assign({},e),{[Vt]:t})),[o]),B=vt(T,l,c),C=void 0!==w?w:!!l,z=t(()=>{if(!C||!l)return null;const e="string"==typeof l?l:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:B?B(e+""):pt})):null},[C,l,T,B]),$=t(()=>({display:"grid",gridTemplateColumns:"40px "+a.map(()=>u+"px").join(" "),gridTemplateRows:a.map(()=>u+"px").join(" ")+" 40px",gap:d+"px",width:"fit-content"}),[a,u,d,40]);return e.createElement("div",{className:A,style:{position:"relative"}},z&&e.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},z.map(t=>e.createElement("div",{key:t.label,style:{display:"flex",alignItems:"center",gap:4}},e.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.createElement("span",{style:{fontSize:11}},t.label)))),e.createElement("div",{style:$,onMouseLeave:"hover"===j?D:void 0},a.map((t,n)=>e.createElement(e.Fragment,{key:"row-"+t},e.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t),a.map((o,r)=>n===r?"label"===y?e.createElement(Kt,{key:"diag-"+t,label:s[t]||t,cellSize:u}):e.createElement(Jt,{key:"diag-"+t,data:T,field:t,label:s[t]||t,cellSize:u,bins:f,colorBy:l,colorScale:B,brushSelectionName:L,hoverSelectionName:O,unselectedOpacity:v,mode:j}):e.createElement(Qt,{key:`cell-${t}-${o}`,data:T,xField:o,yField:t,fieldLabels:s,cellSize:u,pointRadius:h,pointOpacity:g,colorBy:l,colorScale:B,brushSelectionName:L,hoverSelectionName:O,unselectedOpacity:v,showGrid:b,tooltip:x,mode:j,onPointHover:"hover"===j?(e,i,a)=>{e?(N({datum:e,xField:o,yField:t,colIndex:r,rowIndex:n,px:null!=i?i:0,py:null!=a?a:0}),S&&S({type:"hover",datum:e,x:null!=i?i:0,y:null!=a?a:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E})):(N(null),S&&S({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:E}))}:void 0})))),e.createElement("div",null)," ",a.map(t=>e.createElement("div",{key:"col-label-"+t,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},s[t]||t))),M&&"hover"===j&&(()=>{const t=M.datum,n=s[M.xField]||M.xField,o=s[M.yField]||M.yField,r=l?"function"==typeof l?l(t):t[l]:null,i=k?"function"==typeof k?k(t):t[k]:"Row "+t[Vt];return e.createElement("div",{style:{position:"absolute",left:40+M.colIndex*(u+d)+M.px,top:M.rowIndex*(u+d)+M.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10}},e.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},i+""),e.createElement("div",null,n,": ",null!=t[M.xField]?Number(t[M.xField]).toFixed(1):"–"),e.createElement("div",null,o,": ",null!=t[M.yField]?Number(t[M.yField]).toFixed(1):"–"),null!=r&&e.createElement("div",{style:{opacity:.8}},"string"==typeof l?l:"group",": ",r+""))})())}function tn(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,r={};return!o&&n&&(r.splom={resolution:n}),o&&(r["splom-hover"]={resolution:"union"}),e.createElement(qt,{selections:r},e.createElement(en,Object.assign({},t)))}function nn(e,t){const{columns:n,config:o,resolvePieceStyle:r}=e,i=[],a=Math.min(t.width,t.height)/2-4,s="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=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:s,outerRadius:a,startAngle:t,endAngle:n,style:o,datum:e.pieceData,category:e.name})}return i}function on(e){var t,n,o;const r=e.length,i=e[0],a=e[r-1];return{n:r,min:i,q1:null!==(t=w(e,.25))&&void 0!==t?t:i,median:null!==(n=w(e,.5))&&void 0!==n?n:(i+a)/2,q3:null!==(o=w(e,.75))&&void 0!==o?o:a,max:a,mean:e.reduce((e,t)=>e+t,0)/r}}tn.displayName="ScatterplotMatrix";const rn={bar:function(e,t){const{scales:n,columns:o,config:r,getR:i,getStack:a,resolvePieceStyle:s}=e,{r:l,projection:c}=n,u=[],d="vertical"===c,h="horizontal"===c,g=r.normalize;for(const e of Object.values(o)){const t=new Map;for(const n of e.pieceData){const e=a?a(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const o=t.get(e);o.total+=i(n),o.pieces.push(n)}let n=0;if(g)for(const e of t.values())n+=Math.abs(e.total);let o=0,r=0;for(const[i,c]of t){let t=c.total;g&&n>0&&(t/=n);const y=s(c.pieces[0],a?i:e.name),f=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const n=l(0>t?r:o+t),a=0>t?l(r+t)-l(r):l(o)-l(o+t);u.push(ce(e.x,n,e.width,Math.abs(a),y,f,i)),0>t?r+=t:o+=t}else if(h){const n=l(0>t?r+t:o),a=0>t?l(r)-l(r+t):l(o+t)-l(o);u.push(ce(n,e.x,Math.abs(a),e.width,y,f,i)),0>t?r+=t:o+=t}}}return u},clusterbar:function(e,t){const{scales:n,columns:o,getR:r,getGroup:i,resolvePieceStyle:a}=e,{r:s,projection:l}=n,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(o))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const g=d.length||1;for(const e of Object.values(o)){const t=e.width/g,n=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let o=0;d.length>o;o++){const i=n.get(d[o])||[];for(const n of i){const i=r(n),l=a(n,e.name);if(u){const r=e.x+o*t,a=s(0),u=s(i);c.push(ce(r,Math.min(a,u),t,Math.abs(a-u),l,n,d[o]))}else{const r=e.x+o*t,a=s(0),u=s(i);c.push(ce(Math.min(a,u),r,Math.abs(u-a),t,l,n,d[o]))}}}}return c},point:function(e,t){var n,o;const{scales:r,columns:i,getR:a,multiScales:s,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,g="radial"===u,y=s.length>0,f=2*Math.PI,p=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(n=t.__rIndex)&&void 0!==n?n:0,i=null!==(o=t.__rValue)&&void 0!==o?o:a(t),u=y&&s[r]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=p+(e.pctStart+e.pct/2)*f,n=u(i);b=Math.cos(t)*n,x=Math.sin(t)*n}else h?(b=e.middle,x=u(i)):(b=u(i),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:n,columns:o,getR:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="vertical"===s;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],s=r(o),u=i(o,e.name),d=u.r||4,h=(7919*n%100/100-.5)*t*.8,g=c?e.middle+h:a(s),y=c?a(s):e.middle+h;l.push({type:"point",x:g,y:y,r:d,style:u,datum:o})}}return l},pie:nn,donut:nn,boxplot:function(e,t){var n,o,r,i,a;const{scales:s,columns:l,config:c,getR:u,resolveSummaryStyle:d}=e,{r:h,projection:g}=s,y=[],f="vertical"===g,p=!1!==c.showOutliers;for(const e of Object.values(l)){const t=e.pieceData.map(e=>u(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const s=t[0],l=t[t.length-1],c=null!==(n=w(t,.25))&&void 0!==n?n:s,g=null!==(o=w(t,.5))&&void 0!==o?o:(s+l)/2,m=null!==(r=w(t,.75))&&void 0!==r?r:l,v=m-c,b=c-1.5*v,x=m+1.5*v,k=null!==(i=t.find(e=>e>=b))&&void 0!==i?i:s,A=null!==(a=[...t].reverse().find(e=>x>=e))&&void 0!==a?a:l,S=d(e.pieceData[0],e.name),E=[];if(p)for(const t of e.pieceData){const n=u(t);if(b>n||n>x){const o=f?e.middle:h(n),r=f?h(n):e.middle;E.push({px:o,py:r,value:n,datum:t})}}if(y.push({type:"boxplot",x:f?e.middle:0,y:f?0:e.middle,projection:f?"vertical":"horizontal",columnWidth:.6*e.width,minPos:h(k),q1Pos:h(c),medianPos:h(g),q3Pos:h(m),maxPos:h(A),stats:{min:k,q1:c,median:g,q3:m,max:A},style:S,datum:e.pieceData,category:e.name,outliers:E}),p)for(const e of E)y.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:S.fill||"#999",opacity:.6},datum:e.datum})}return y},violin:function(e,t){var n,o,r;const{scales:i,columns:a,config:s,getR:l,resolveSummaryStyle:c}=e,{r:u,projection:d}=i,h=[],g="vertical"===d,y=s.bins||20,f=!1!==s.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>l(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const i=t[0],a=t[t.length-1],s=(a-i)/y||1,d=Array(y).fill(0);for(const e of t)d[Math.min(Math.floor((e-i)/s),y-1)]++;const p=Math.max(...d,1),m=e.width/2*.9;let v="";if(g){for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/p*m;v+=0===t?`M ${e.middle+o} ${n}`:` L ${e.middle+o} ${n}`}for(let t=y-1;t>=0;t--){const n=u(i+(t+.5)*s);v+=` L ${e.middle-d[t]/p*m} ${n}`}v+=" Z"}else{for(let t=0;y>t;t++){const n=u(i+(t+.5)*s),o=d[t]/p*m;v+=0===t?`M ${n} ${e.middle-o}`:` L ${n} ${e.middle-o}`}for(let t=y-1;t>=0;t--)v+=` L ${u(i+(t+.5)*s)} ${e.middle+d[t]/p*m}`;v+=" Z"}const b=c(e.pieceData[0],e.name);let x;if(f&&t.length>=4){const s=null!==(n=w(t,.25))&&void 0!==n?n:i,l=null!==(o=w(t,.5))&&void 0!==o?o:(i+a)/2,c=null!==(r=w(t,.75))&&void 0!==r?r:a;x={q1Pos:u(s),medianPos:u(l),q3Pos:u(c),centerPos:e.middle,isVertical:g}}const k=g?{x:e.x,y:Math.min(u(a),u(i)),width:e.width,height:Math.abs(u(a)-u(i))}:{x:Math.min(u(i),u(a)),y:e.x,width:Math.abs(u(a)-u(i)),height:e.width};h.push({type:"violin",pathString:v,translateX:0,translateY:0,bounds:k,iqrLine:x,stats:on(t),style:b,datum:e.pieceData,category:e.name})}return h},histogram:function(e,t){const{scales:n,columns:o,config:r,getR:i,resolveSummaryStyle:a}=e,{r:s}=n,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(o)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const n=Math.min(...t),o=(Math.max(...t)-n)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-n)/o),c-1)]++;const d=t.length,h=Math.max(...r,1),g=a(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===r[t])continue;const i=(u?r[t]/d:r[t]/h)*e.width*.9,a=s(n+t*o),c=s(n+(t+1)*o);l.push(ce(Math.min(a,c),e.x+e.width-i,Math.abs(c-a),i,g,{bin:t,count:r[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:r,config:i,getR:a,resolveSummaryStyle:s}=e,{r:l,projection:c}=o,u=[],d=i.bins||20,h="horizontal"===c,g=i.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>a(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],i=(r-o)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-o)/i),d-1)]++;const y=Math.max(...c,1),f=s(e.pieceData[0],e.name),p=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(o)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(o+(e+.5)*i)} ${t-c[e]/y*p}`;m+=` L ${l(r)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(o)}`;for(let e=0;d>e;e++){const n=l(o+(e+.5)*i);m+=` L ${t+c[e]/y*p} ${n}`}m+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(o),l(r)),y:e.x,width:Math.abs(l(r)-l(o)),height:e.width}:{x:e.x,y:Math.min(l(r),l(o)),width:e.width,height:Math.abs(l(r)-l(o))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:on(t),style:Object.assign(Object.assign({},f),{fillOpacity:null!==(n=f.fillOpacity)&&void 0!==n?n:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:n,columns:o,getRawRange:r,resolvePieceStyle:i}=e,{r:a,projection:s}=n,l=[],c="horizontal"===s;for(const e of Object.values(o))for(const t of e.pieceData){const n=r(t);if(!n)continue;const[o,s]=n,u=i(t,e.name);if(c){const n=a(Math.min(o,s)),r=a(Math.max(o,s));l.push(ce(n,e.x,r-n,e.width,u,t,e.name))}else{const n=a(Math.max(o,s)),r=a(Math.min(o,s));l.push(ce(e.x,n,e.width,r-n,u,t,e.name))}}return l}};class an{constructor(e){this.rExtent=new re,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 oe(e.windowSize),this.getO=he(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,n=e.rAccessor;Array.isArray(n)?(this.rAccessors=n.map(e=>de(e,"value")),this.getR=this.rAccessors[0],this.rExtents=n.map(()=>new re)):(this.getR=de(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||n,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=he(e.stackBy),this.getGroup=he(e.groupBy),this.getColor=he(e.colorAccessor),this.getConnector=he(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new oe(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:t,buffer:n}=this;if(0===n.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(n,this.getR);const o=n.toArray(),r=t.projection||"vertical",i=t.oExtent||this.resolveCategories(o),a=this.computeValueDomain(o,i),s="horizontal"===r,l=null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1;let c,u;if("radial"===r){c=b().domain(i).range([0,1]).padding(0);const n=Math.min(e.width,e.height)/2,o=t.innerRadius||0;u=p().domain(a).range([o,n])}else s?(c=b().domain(i).range([0,e.height]).padding(l),u=p().domain(a).range([0,e.width])):(c=b().domain(i).range([0,e.width]).padding(l),u=p().domain(a).range([e.height,0]));this.scales={o:c,r:u,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((o,r)=>{const i=this.rExtents[r];i.dirty&&i.recalculate(n,o);let[a,l]=i.extent;a===1/0&&(a=0,l=1);const c=l-a,u=c>0?c*(t.extentPadding||.05):1;return a-=u,l+=u,a>0&&(a=0),s?p().domain([a,l]).range([0,e.width]):p().domain([a,l]).range([e.height,0])}):[];let d=o;this.rAccessors.length>1&&(d=o.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,c,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(d,e),this.config.decay&&this.applyDecay(this.scene,o),this.config.pulse&&this.applyPulse(this.scene,o),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 r=this.config.chartType,i=this.config.extentPadding||.05;if("radial"===this.config.projection&&("pie"===r||"donut"===r))return[0,1];let a=0,s=0;if("bar"===r&&this.getStack){const t=new Map,n=new Map;for(const o of e){const e=this.getO(o),r=this.getR(o);0>r?n.set(e,(n.get(e)||0)+r):t.set(e,(t.get(e)||0)+r)}for(const e of t.values())e>s&&(s=e);for(const e of n.values())a>e&&(a=e)}else if("bar"===r){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>s&&(s=e),a>e&&(a=e)}else if("clusterbar"===r)for(const t of e){const e=this.getR(t);e>s&&(s=e),a>e&&(a=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(a=e),t!==-1/0&&(s=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(a=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(s=this.config.rExtent[1]));const l=s-a,c=l>0?l*i:1;return(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])||(a-=c),(null===(o=this.config.rExtent)||void 0===o?void 0:o[1])||(s+=c),"bar"!==r&&"clusterbar"!==r||(a>0&&(a=0),0>s&&(s=0)),[a,s]}buildColumns(e,t,n,o,r){var i;const a={},s=new Map;for(const t of e){const e=this.getO(t);s.has(e)||s.set(e,[]),s.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=s.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 i=("horizontal"===o?r.height:r.width)-n.padding()*n.step()*t.length;if(e>0)for(const[t,n]of u)u.set(t,n/e*i)}let d=0,h=0;for(const e of t){const t=s.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?o/l:0;let c,g;u?(c=h,g=u.get(e)||n.bandwidth(),h+=g+n.padding()*n.step()):(c=null!==(i=n(e))&&void 0!==i?i:0,g=n.bandwidth()),a[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:n.padding()*n.step(),pieceData:t,pct:r,pctStart:d},d+=r}return a}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=rn[this.config.chartType];let r=o?o(n,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:n,config:o,getConnector:r,getO:i}=e;if(!r||!n)return[];const a=[],{projection:s}=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=r(t);if(!n)continue;let o,a;"point"===e.type?(o=e.x,a=e.y):(o=e.x+e.w/2,a=e.y+("vertical"===s?0:e.h/2)),l.has(n)||l.set(n,[]),l.get(n).push({x:o,y:a,datum:t,category:i(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],r=t[n+1],i="function"==typeof u?u(o.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};a.push({type:"connector",x1:o.x,y1:o.y,x2:r.x,y2:r.y,style:i,datum:o.datum,group:e})}}return a}(n,r);r=[...e,...r]}return r}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,r;const i=this.config.decay;if(!i||1>=t)return 1;const a=null!==(n=i.minOpacity)&&void 0!==n?n:.1,s=t-1-e;switch(i.type){case"linear":return a+(1-s/(t-1))*(1-a);case"exponential":{const e=null!==(o=i.halfLife)&&void 0!==o?o:t/2;return a+Math.pow(.5,s/e)*(1-a)}case"step":return(null!==(r=i.stepThreshold)&&void 0!==r?r:.5*t)>s?1:a;default:return 1}}applyDecay(e,t){var n,o;if(!this.config.decay)return;const r=t.length;if(1>=r)return;const i=new Map;for(let e=0;t.length>e;e++)i.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=i.get(t.datum);if(null==e)continue;const a=this.computeDecayOpacity(e,r),s=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:s*a})}}applyPulse(e,t){var n,o,r;if(!this.config.pulse||!this.timestampBuffer)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(n=this.config.pulse.duration)&&void 0!==n?n:500,s=null!==(o=this.config.pulse.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",l=null!==(r=this.config.pulse.glowRadius)&&void 0!==r?r: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=i-n;a>o&&(t._pulseIntensity=1-o/a,t._pulseColor=s,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 r=`r:${o.group||""}:${null!==(t=null===(e=o.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:n}`;this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h})}}}startTransition(){var e,t,n,o,r;if(!this.config.transition||0===this.prevPositionMap.size)return;const i=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;let a=!1;for(let e=0;this.scene.length>e;e++){const i=this.scene[e];let s=null;if("point"===i.type?s="p:"+e:"rect"===i.type&&(s=`r:${i.group||""}:${null!==(n=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==n?n:e}`),!s)continue;const l=this.prevPositionMap.get(s);l&&("point"===i.type?l.x===i.x&&l.y===i.y||(i._targetX=i.x,i._targetY=i.y,i.x=l.x,i.y=l.y,a=!0):"rect"===i.type&&(l.x===i.x&&l.y===i.y&&l.w===i.w&&l.h===i.h||(i._targetX=i.x,i._targetY=i.y,i._targetW=i.w,i._targetH=i.h,i.x=l.x,i.y=l.y,i.w=null!==(o=l.w)&&void 0!==o?o:i.w,i.h=null!==(r=l.h)&&void 0!==r?r:i.h,a=!0)))}a&&(this.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:i})}advanceTransition(e){var t,n,o;if(!this.activeTransition)return!1;const r=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),i="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?r:1-Math.pow(1-r,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)*i,e.y=t.y+(e._targetY-t.y)*i}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}`,r=this.prevPositionMap.get(t);if(!r)continue;e.x=r.x+(e._targetX-r.x)*i,e.y=r.y+(e._targetY-r.y)*i,void 0!==r.w&&(e.w=r.w+(e._targetW-r.w)*i,e.h=r.h+(e._targetH-r.h)*i)}if(r>=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 sn(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 ln(e,t,n){const o=t-e.x,r=n-e.y,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function cn(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;let a=Math.atan2(r,o);0>a&&(a+=2*Math.PI);let s=e.startAngle%(2*Math.PI),l=e.endAngle%(2*Math.PI);if(0>s&&(s+=2*Math.PI),0>l&&(l+=2*Math.PI),!(s>l?a>=s||l>=a:a>=s&&l>=a))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 un(e,t,n){const o=e.columnWidth/2,r=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:r}}else{const i=e.y-o,a=e.y+o;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>n||n>a))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:r}}return null}function dn(e,t,n){if(!e.bounds)return null;const{x:o,y:r,width:i,height:a}=e.bounds;return o>t||t>o+i||r>n||n>r+a?null:{datum:e.datum,x:o+i/2,y:r+a/2,distance:0,category:e.category,stats:e.stats}}function hn(e){return Math.round(100*e)/100+""}function gn(n){const{width:o,height:r,totalWidth:i,totalHeight:a,margin:s,scales:l,showAxes:c,oLabel:u,rLabel:d,oFormat:h,rFormat:g,showGrid:y,title:f,legend:p,foregroundGraphics:m,annotations:v,svgAnnotationRules:b,annotationFrame:x,xAccessor:w,yAccessor:k,annotationData:A,children:S}=n,E="radial"===(null==l?void 0:l.projection),L="horizontal"===(null==l?void 0:l.projection),O=t(()=>c&&l&&!E?l.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=l.o(e))&&void 0!==t?t:0)+l.o.bandwidth()/2,label:h?h(e):e}}):[],[c,l,h,E]),j=t(()=>c&&l&&!E?l.r.ticks(5).map(e=>({value:e,pixel:l.r(e),label:(g||hn)(e)})):[],[c,l,g,E]),P=t(()=>{if(!v||0===v.length)return null;const e=Te(),t={scales:l?{x:l.r,y:l.r,time:l.r,value:l.r}:null,timeAxis:"x",xAccessor:w,yAccessor:k,width:o,height:r,data:A,frameType:"ordinal"};return v.map((n,o)=>{if(b){const r=b(n,o,t);return null!=r?r:e(n,o,t)}return e(n,o,t)}).filter(Boolean)},[v,b,o,r,x,w,k,A]);return c||f||p||m||P&&P.length>0||y||S?e.createElement("svg",{width:i,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${s.left},${s.top})`},y&&l&&!E&&e.createElement("g",{className:"ordinal-grid"},j.map((t,n)=>e.createElement("line",{key:"grid-"+n,x1:L?t.pixel:0,y1:L?0:t.pixel,x2:L?t.pixel:o,y2:L?r:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1}))),c&&l&&!E&&e.createElement("g",{className:"ordinal-axes"},L?e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),O.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},d)):e.createElement(e.Fragment,null,e.createElement("line",{x1:0,y1:r,x2:o,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),O.map((t,n)=>e.createElement("g",{key:"cat-"+n,transform:`translate(${t.pixel},${r})`},e.createElement("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),u&&e.createElement("text",{x:o/2,y:r+40,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},u),e.createElement("line",{x1:0,y1:0,x2:0,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),j.map((t,n)=>e.createElement("g",{key:"val-"+n,transform:`translate(0,${t.pixel})`},e.createElement("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none"}},t.label))),d&&e.createElement("text",{x:15-s.left,y:r/2,textAnchor:"middle",fontSize:12,fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-s.left}, ${r/2})`,style:{userSelect:"none"}},d))),P,m,S),f&&e.createElement("text",{x:i/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"var(--semiotic-text, #333)",style:{userSelect:"none"}},"string"==typeof f?f:null),p&&e.createElement("g",{transform:`translate(${i-s.right+10}, ${s.top})`},function(t){return"object"==typeof t&&null!==t&&!e.isValidElement(t)&&"legendGroups"in t}(p)?e.createElement(Ae,{legendGroups:p.legendGroups,title:"",width:100}):p)):null}const yn=(e,t,n,o)=>{const r=t.filter(e=>"wedge"===e.type);for(const t of r)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},fn=(e,t,n,o)=>{var r,i;const a=t.filter(e=>"violin"===e.type);for(const t of a){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const n=new Path2D(t.pathString);if(e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.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()}},pn=(e,t,n,o)=>{var r,i,a;const s=t.filter(e=>"connector"===e.type);if(0===s.length)return;const l=new Map;for(const e of s){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!==(i=null!==(r=n.fillOpacity)&&void 0!==r?r:n.opacity)&&void 0!==i?i:.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!==(a=n.style.opacity)&&void 0!==a?a:.5,e.stroke(),e.globalAlpha=1}},mn=e=>[pn,...e],vn={bar:mn([He]),clusterbar:mn([He]),point:mn([_e]),swarm:mn([_e]),pie:[yn],donut:[yn],boxplot:mn([(e,t,n,o)=>{var r,i;const a=t.filter(e=>"boxplot"===e.type);for(const t of a){const n=t.columnWidth/2,o="vertical"===t.projection,a=t.style.fill||"#007bff",s=t.style.stroke||"#333",l=t.style.strokeWidth||1,c=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.6;if(e.save(),e.strokeStyle=s,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=a,o){const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-n,o,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-n,o,t.columnWidth,r)}else{const o=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(o,t.y-n,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(o,t.y-n,r,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()}},_e]),violin:mn([fn]),histogram:mn([He]),ridgeline:mn([fn]),timeline:mn([He])},bn={top:50,right:40,bottom:60,left:70},xn={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 wn({hover:t}){var n,o,r,i;const a=t.data||{},s=t.stats,l=t.category;if(Array.isArray(a)){const t=l||(null===(n=a[0])||void 0===n?void 0:n.category)||"";if(s)return e.createElement("div",{className:"semiotic-tooltip",style:xn},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,"n = ",s.n),e.createElement("div",null,"Min: ",s.min.toLocaleString()),e.createElement("div",null,"Q1: ",s.q1.toLocaleString()),e.createElement("div",null,"Median: ",s.median.toLocaleString()),e.createElement("div",null,"Q3: ",s.q3.toLocaleString()),e.createElement("div",null,"Max: ",s.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",s.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const o=a.length;return e.createElement("div",{className:"semiotic-tooltip",style:xn},t&&e.createElement("div",{style:{fontWeight:"bold"}},t+""),e.createElement("div",null,o," items"))}if(null!=a.bin&&null!=a.count){const t=a.range||[];return e.createElement("div",{className:"semiotic-tooltip",style:xn},a.category&&e.createElement("div",{style:{fontWeight:"bold"}},a.category+""),e.createElement("div",null,"Count: ",a.count),2===t.length&&e.createElement("div",{style:{opacity:.8}},Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)))}const c=a.category||a.name||a.group||a.__rName||"",u=null!==(i=null!==(r=null!==(o=a.value)&&void 0!==o?o:a.__rValue)&&void 0!==r?r:a.pct)&&void 0!==i?i:"";if(!c&&""===u){const t=Object.entries(a).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.createElement("div",{className:"semiotic-tooltip",style:xn},t.map(([t,n])=>e.createElement("div",{key:t},e.createElement("span",{style:{opacity:.7}},t,":")," ","number"==typeof n?n.toLocaleString():n+"")))}return e.createElement("div",{className:"semiotic-tooltip",style:xn},c&&e.createElement("div",{style:{fontWeight:"bold"}},c+""),""!==u&&e.createElement("div",null,"number"==typeof u?u.toLocaleString():u+""))}const kn=n(function(n,l){var c;const{chartType:u,runtimeMode:d,data:h,oAccessor:g="category",rAccessor:y="value",colorAccessor:f,stackBy:p,groupBy:m,multiAxis:v,timeAccessor:b,valueAccessor:x,categoryAccessor:w,projection:k="vertical",size:A=[600,400],margin:S,barPadding:E,innerRadius:L,normalize:O,startAngle:j,dynamicColumnWidth:P,bins:M,showOutliers:N,showIQR:D,amplitude:T,connectorAccessor:B,connectorStyle:C,rExtent:z,oExtent:$,extentPadding:W=.05,oSort:_,windowMode:H="sliding",windowSize:I=200,pieceStyle:R,summaryStyle:F,colorScheme:Y,barColors:X,showAxes:G=!0,oLabel:q,rLabel:V,oFormat:U,rFormat:Z,enableHover:Q=!0,hoverAnnotation:J,tooltipContent:K,customHoverBehavior:ee,annotations:te,svgAnnotationRules:oe,showGrid:re=!1,legend:ie,backgroundGraphics:ae,foregroundGraphics:se,title:le,className:ce,background:ue,centerContent:de,decay:he,pulse:ge,transition:ye,staleness:fe}=n,pe=t(()=>Object.assign(Object.assign({},bn),S),[S]),me=A[0]-pe.left-pe.right,ve=A[1]-pe.top-pe.bottom,be=o(null),xe=o(!0),we=o(0),ke=o(null),Ae=o(()=>{}),[Se,Ee]=r(null),[Le,Oe]=r(null),[je,Pe]=r(0),[Me,Ne]=r(!1),De=Q||J,Te="streaming"===d,Be=t(()=>({chartType:u,runtimeMode:Te?"streaming":"bounded",windowSize:I,windowMode:H,extentPadding:W,projection:k,oAccessor:Te?void 0:g,rAccessor:Te?void 0:y,colorAccessor:f,stackBy:p,groupBy:m,multiAxis:v,timeAccessor:Te?b:void 0,valueAccessor:Te?x||("string"==typeof y||"function"==typeof y?y:void 0):void 0,categoryAccessor:Te?w||g:void 0,rExtent:z,oExtent:$,barPadding:E,innerRadius:L,normalize:O,startAngle:j,dynamicColumnWidth:P,bins:M,showOutliers:N,showIQR:D,amplitude:T,connectorAccessor:B,connectorStyle:C,oSort:_,pieceStyle:R,summaryStyle:F,colorScheme:Y,barColors:X,decay:he,pulse:ge,transition:ye,staleness:fe}),[u,I,H,W,k,g,y,f,p,m,v,b,x,w,z,$,E,L,O,j,P,M,N,D,T,B,C,_,R,F,Y,X,he,ge,ye,fe,Te]),Ce=o(null);Ce.current||(Ce.current=new an(Be));const ze=i(()=>{we.current||(we.current=requestAnimationFrame(()=>Ae.current()))},[]);a(()=>{var e;null===(e=Ce.current)||void 0===e||e.updateConfig(Be),xe.current=!0,ze()},[Be,ze]);const $e=o(null);$e.current||($e.current=new ne(e=>{const t=Ce.current;t&&t.ingest(e)&&(xe.current=!0,ze())}));const We=i(e=>{var t;null===(t=$e.current)||void 0===t||t.push(e)},[]),_e=i(e=>{var t;null===(t=$e.current)||void 0===t||t.pushMany(e)},[]),He=i(()=>{var e,t;null===(e=$e.current)||void 0===e||e.clear(),null===(t=Ce.current)||void 0===t||t.clear(),xe.current=!0,ze()},[ze]);s(l,()=>({push:We,pushMany:_e,clear:He,getData:()=>{var e,t;return null!==(t=null===(e=Ce.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Ce.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[We,_e,He]),a(()=>{var e;h&&(null===(e=$e.current)||void 0===e||e.setBoundedData(h))},[h]);const Ie=o(()=>{}),Re=o(()=>{});Ie.current=e=>{if(!De)return;const t=be.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return void(ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze()));const i=Ce.current;if(!i||0===i.scene.length)return;const a="radial"===k,s=function(e,t,n,o=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=sn(i,t,n);break;case"point":e=ln(i,t,n);break;case"wedge":e=cn(i,t,n);break;case"boxplot":e=un(i,t,n);break;case"violin":e=dn(i,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,a?o-me/2:o,a?r-ve/2:r);if(!s)return void(ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze()));const l=Object.assign(Object.assign({data:s.datum,time:s.x,value:s.y,x:s.x,y:s.y},s.stats&&{stats:s.stats}),s.category&&{category:s.category});ke.current=l,Ee(l),ee&&ee(l),ze()},Re.current=()=>{ke.current&&(ke.current=null,Ee(null),ee&&ee(null),ze())};const Fe=i(e=>Ie.current(e),[]),Ye=i(()=>Re.current(),[]);Ae.current=()=>{var e,t;we.current=0;const n=be.current;if(!n)return;const o=n.getContext("2d");if(!o)return;const r=Ce.current;if(!r)return;const i="undefined"!=typeof performance?performance.now():Date.now(),a=r.advanceTransition(i),s=xe.current;s&&!a&&(r.computeScene({width:me,height:ve}),xe.current=!1);const l="undefined"!=typeof window&&window.devicePixelRatio||1;n.width=A[0]*l,n.height=A[1]*l,n.style.width=A[0]+"px",n.style.height=A[1]+"px",o.scale(l,l),o.clearRect(0,0,A[0],A[1]);const c=null!==(e=null==fe?void 0:fe.threshold)&&void 0!==e?e:5e3,d=fe&&r.lastIngestTime>0&&i-r.lastIngestTime>c;d&&(o.globalAlpha=null!==(t=null==fe?void 0:fe.dimOpacity)&&void 0!==t?t:.5);const h=n?getComputedStyle(n).getPropertyValue("--semiotic-bg").trim():"",g=ue||(h&&"transparent"!==h?h:null);g&&(o.fillStyle=g,o.fillRect(0,0,A[0],A[1]));const y="radial"===k;y?(o.save(),o.translate(pe.left+me/2,pe.top+ve/2)):o.translate(pe.left,pe.top);const f=vn[u]||[],p={width:me,height:ve};for(const e of f)e(o,r.scene,r.scales,p);y&&o.restore(),d&&(o.globalAlpha=1),s&&r.scales&&(Oe(r.scales),Pe(e=>e+1)),(null==fe?void 0:fe.showBadge)&&Ne(!!d),(a||r.hasActivePulses)&&(we.current=requestAnimationFrame(()=>Ae.current()))},a(()=>(ze(),()=>{we.current&&cancelAnimationFrame(we.current)}),[ze]),a(()=>{xe.current=!0,ze()},[u,me,ve,G,ue,ze]),a(()=>{if(!fe)return;const e=setInterval(()=>{var e;const t=Ce.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=fe.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Me&&(Ne(r),xe.current=!0,ze())},1e3);return()=>clearInterval(e)},[fe,Me,ze]);const Xe=De&&Se?K?K(Se):e.createElement(wn,{hover:Se}):null,Ge="radial"===k,qe=Se?Ge?Se.x+me/2:Se.x:0,Ve=Se?Ge?Se.y+ve/2:Se.y:0,Ue=Xe?e.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:pe.left+qe,top:pe.top+Ve,transform:`translate(${qe>.7*me?"calc(-100% - 12px)":"12px"}, ${.3*ve>Ve?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Xe):null;return e.createElement("div",{className:"stream-ordinal-frame"+(ce?" "+ce:""),role:"img","aria-label":"string"==typeof le?le:"Ordinal chart",style:{position:"relative",width:A[0],height:A[1]},onMouseMove:De?Fe:void 0,onMouseLeave:De?Ye:void 0},ae&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:A[0],height:A[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${pe.left},${pe.top})`},ae)),e.createElement("canvas",{ref:be,style:{position:"absolute",top:0,left:0,width:A[0],height:A[1]}}),e.createElement(gn,{width:me,height:ve,totalWidth:A[0],totalHeight:A[1],margin:pe,scales:Le,showAxes:G,oLabel:q,rLabel:V,oFormat:U,rFormat:Z,showGrid:re,title:le,legend:ie,foregroundGraphics:se,annotations:te,svgAnnotationRules:oe,annotationFrame:je,xAccessor:"string"==typeof g?g:void 0,yAccessor:"string"==typeof y?y:void 0,annotationData:null===(c=Ce.current)||void 0===c?void 0:c.getData()}),de&&"radial"===k&&e.createElement("div",{style:{position:"absolute",left:pe.left+me/2,top:pe.top+ve/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},de),(null==fe?void 0:fe.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===fe.badgePosition?{top:4,left:4}:"bottom-left"===fe.badgePosition?{bottom:4,left:4}:"bottom-right"===fe.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Me?"#dc3545":"#28a745",color:"white"})},Me?"STALE":"LIVE"),Ue)});function An(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sort:g=!1,barPadding:y=5,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,L=o.showLegend,O=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=xt({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:x,chartType:"BarChart",chartId:w}),T=bt(M,g,l),B=vt(M,d,h),C=t(()=>e=>{const t={};return t.fill=d?Je(e,d,B):pt,t},[d,B]),z=t(()=>nt(C,N,v),[C,N,v]),{legend:$,margin:W}=wt({data:T,colorBy:d,colorScale:B,showLegend:L,userMargin:i,defaults:o.marginDefaults}),_=t(()=>Tt({categoryAccessor:s,valueAccessor:l,groupAccessor:d&&d!==s?d:void 0,groupLabel:"string"==typeof d?d:"group"}),[s,l,d]),H=zt({componentName:"BarChart",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(Bt,{componentName:"BarChart",message:H,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:T,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:z,size:[k,A],margin:W,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:u,showGrid:E,oSort:g},$&&{legend:$}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?jt(f):_}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(kn,Object.assign({},I))}function Sn(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",normalize:y=!1,barPadding:f=5,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,L=o.showGrid,O=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],D=h||l,{activeSelectionHook:T,customHoverBehavior:B}=xt({selection:b,linkedHover:x,fallbackFields:D?["string"==typeof D?D:""]:[],unwrapData:!0,onObservation:w,chartType:"StackedBarChart",chartId:k}),C=vt(N,D,g),z=t(()=>e=>D?{fill:Je(e,D,C)}:{fill:pt},[D,C]),$=t(()=>nt(z,T,b),[z,T,b]),{legend:W,margin:_}=wt({data:N,colorBy:D,colorScale:C,showLegend:O,userMargin:i,defaults:o.marginDefaults}),H=t(()=>Tt({categoryAccessor:l,valueAccessor:c,groupAccessor:s}),[l,s,c]),I=zt({componentName:"StackedBarChart",data:N,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{stackBy:l}});if(I)return e.createElement(Bt,{componentName:"StackedBarChart",message:I,width:A,height:S});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:N,oAccessor:s,rAccessor:c,stackBy:l,normalize:y,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:$,size:[A,S],margin:_,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:d,showGrid:L},W&&{legend:W}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?jt(p):H}),(x||w)&&{customHoverBehavior:B}),m&&m.length>0&&{annotations:m}),v);return e.createElement(kn,Object.assign({},R))}function En(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:g="category10",barPadding:y=5,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,L=o.showLegend,O=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],N=h||l,{activeSelectionHook:D,customHoverBehavior:T}=xt({selection:v,linkedHover:b,fallbackFields:N?["string"==typeof N?N:""]:[],unwrapData:!0,onObservation:x,chartType:"GroupedBarChart",chartId:w}),B=vt(M,N,g),C=t(()=>e=>N?{fill:Je(e,N,B)}:{fill:pt},[N,B]),z=t(()=>nt(C,D,v),[C,D,v]),{legend:$,margin:W}=wt({data:M,colorBy:N,colorScale:B,showLegend:L,userMargin:i,defaults:o.marginDefaults}),_=t(()=>Tt({categoryAccessor:l,valueAccessor:c,groupAccessor:s}),[l,s,c]),H=zt({componentName:"GroupedBarChart",data:M,accessors:{categoryAccessor:s,valueAccessor:c},requiredProps:{groupBy:l}});if(H)return e.createElement(Bt,{componentName:"GroupedBarChart",message:H,width:k,height:A});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:M,oAccessor:s,rAccessor:c,groupBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:z,size:[k,A],margin:W,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:E},$&&{legend:$}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?jt(f):_}),(b||x)&&{customHoverBehavior:T}),p&&p.length>0&&{annotations:p}),m);return e.createElement(kn,Object.assign({},I))}function Ln(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",sizeBy:g,sizeRange:y=[3,8],pointRadius:f=4,pointOpacity:p=.7,categoryPadding:m=20,tooltip:v,annotations:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:S}=n,E=o.width,L=o.height,O=o.enableHover,j=o.showGrid,P=o.showLegend,M=o.title,N=o.categoryLabel,D=o.valueLabel,T=r||[],{activeSelectionHook:B,customHoverBehavior:C}=xt({selection:w,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:A,chartType:"SwarmPlot",chartId:S}),z=vt(T,d,h),$=t(()=>{if(!g)return;const e=T.map(e=>"function"==typeof g?g(e):e[g]);return[Math.min(...e),Math.max(...e)]},[T,g]),W=t(()=>e=>{const t={fillOpacity:p};return t.fill=d?Je(e,d,z):pt,t.r=g?et(e,g,y,$):f,t},[d,z,g,y,$,f,p]),_=t(()=>nt(W,B,w),[W,B,w]),{legend:H,margin:I}=wt({data:T,colorBy:d,colorScale:z,showLegend:P,userMargin:i,defaults:o.marginDefaults}),R=t(()=>Tt({categoryAccessor:s,valueAccessor:l,groupAccessor:d||void 0}),[s,l,d]),F=zt({componentName:"SwarmPlot",data:T,accessors:{categoryAccessor:s,valueAccessor:l}});if(F)return e.createElement(Bt,{componentName:"SwarmPlot",message:F,width:E,height:L});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:T,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:_,size:[E,L],margin:I,barPadding:m,enableHover:O,showAxes:o.showAxes,oLabel:N,rLabel:D,rFormat:u,showGrid:j},H&&{legend:H}),M&&{title:M}),a&&{className:a}),{tooltipContent:v?jt(v):R}),(k||A)&&{customHoverBehavior:C}),b&&b.length>0&&{annotations:b}),x);return e.createElement(kn,Object.assign({},Y))}function On(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h="category10",showOutliers:g=!0,categoryPadding:y=20,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,L=o.showLegend,O=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=xt({selection:v,linkedHover:b,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"BoxPlot",chartId:w}),T=vt(M,d,h),B=t(()=>e=>{const t=d?Je(e,d,T):pt;return{fill:t,stroke:t,fillOpacity:.8}},[d,T]),C=t(()=>nt(B,N,v),[B,N,v]),{legend:z,margin:$}=wt({data:M,colorBy:d,colorScale:T,showLegend:L,userMargin:i,defaults:o.marginDefaults}),W=t(()=>t=>{const n=t.stats||(t.data||t).stats||{};return e.createElement("div",{className:"semiotic-tooltip",style:St},e.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||(t.data||t).category||"")+""),null!=n.median&&e.createElement(e.Fragment,null,null!=n.n&&e.createElement("div",null,"n = ",n.n),e.createElement("div",null,"Median: ",n.median.toLocaleString()),e.createElement("div",null,"Q1: ",n.q1.toLocaleString()),e.createElement("div",null,"Q3: ",n.q3.toLocaleString()),e.createElement("div",null,"Min: ",n.min.toLocaleString()),e.createElement("div",null,"Max: ",n.max.toLocaleString())))},[]),_=zt({componentName:"BoxPlot",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if(_)return e.createElement(Bt,{componentName:"BoxPlot",message:_,width:k,height:A});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:M,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:C,showOutliers:g,size:[k,A],margin:$,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:u,showGrid:E},z&&{legend:z}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?jt(f):W}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(kn,Object.assign({},H))}function jn(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:g="category10",categoryPadding:y=20,tooltip:f,annotations:p,frameProps:m={},selection:v,linkedHover:b,onObservation:x,chartId:w}=n,k=o.width,A=o.height,S=o.enableHover,E=o.showGrid,L=o.showLegend,O=o.title,j=o.categoryLabel,P=o.valueLabel,M=r||[],{activeSelectionHook:N,customHoverBehavior:D}=xt({selection:v,linkedHover:b,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:x,chartType:"Histogram",chartId:w}),T=vt(M,h,g),B=t(()=>e=>{const t=h?Je(e,h,T):pt;return{fill:t,stroke:t,fillOpacity:.8}},[h,T]),C=t(()=>nt(B,N,v),[B,N,v]),{legend:z,margin:$}=wt({data:M,colorBy:h,colorScale:T,showLegend:L,userMargin:i,defaults:o.marginDefaults}),W=t(()=>t=>{const n=t.data||t,o=n.category||t.category||"",r=n.count,i=n.range;return e.createElement("div",{className:"semiotic-tooltip",style:St},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=r&&e.createElement("div",null,"Count: ",r),i&&2===i.length&&e.createElement("div",{style:{opacity:.8}},Number(i[0]).toFixed(1)," – ",Number(i[1]).toFixed(1)))},[]),_=zt({componentName:"Histogram",data:M,accessors:{categoryAccessor:s,valueAccessor:l}});if(_)return e.createElement(Bt,{componentName:"Histogram",message:_,width:k,height:A});const H=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:M,oAccessor:s,rAccessor:l,projection:"horizontal",summaryStyle:C,bins:c,normalize:u,size:[k,A],margin:$,barPadding:y,enableHover:S,showAxes:o.showAxes,oLabel:j,rLabel:P,rFormat:d,showGrid:E},z&&{legend:z}),O&&{title:O}),a&&{className:a}),{tooltipContent:f?jt(f):W}),(b||x)&&{customHoverBehavior:D}),p&&p.length>0&&{annotations:p}),m);return e.createElement(kn,Object.assign({},H))}function Pn(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,showIQR:d=!0,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:f=20,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,L=o.showGrid,O=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],{activeSelectionHook:D,customHoverBehavior:T}=xt({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"ViolinPlot",chartId:k}),B=vt(N,g,y),C=t(()=>e=>{const t=g?Je(e,g,B):pt;return{fill:t,stroke:t,fillOpacity:.6}},[g,B]),z=t(()=>nt(C,D,b),[C,D,b]),{legend:$,margin:W}=wt({data:N,colorBy:g,colorScale:B,showLegend:O,userMargin:i,defaults:o.marginDefaults}),_=t(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;if(r)return e.createElement("div",{className:"semiotic-tooltip",style:St},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})));const i=(Array.isArray(t.data)?t.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=i.length,s=a>0?i[Math.floor(a/2)]:null;return e.createElement("div",{className:"semiotic-tooltip",style:St},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),a>0&&e.createElement("div",null,"n = ",a),null!=s&&e.createElement("div",null,"Median: ",s.toLocaleString()))},[l]),H=zt({componentName:"ViolinPlot",data:N,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(Bt,{componentName:"ViolinPlot",message:H,width:A,height:S});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:N,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:z,bins:u,showIQR:d,size:[A,S],margin:W,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:h,showGrid:L},$&&{legend:$}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?jt(p):_}),(x||w)&&{customHoverBehavior:T}),m&&m.length>0&&{annotations:m}),v);return e.createElement(kn,Object.assign({},I))}function Mn(n){var o;const r=At(n.mode,{width:n.width,height:n.height,showGrid:null===(o=n.showGrid)||void 0===o||o,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:i,margin:a,className:s,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:g="category10",sort:y=!0,dotRadius:f=5,categoryPadding:p=10,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:k,chartId:A}=n,S=r.width,E=r.height,L=r.enableHover,O=r.showGrid,j=r.showLegend,P=r.title,M=r.categoryLabel,N=r.valueLabel,D=i||[],{activeSelectionHook:T,customHoverBehavior:B}=xt({selection:x,linkedHover:w,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof l?l:""],unwrapData:!0,onObservation:k,chartType:"DotPlot",chartId:A}),C=bt(D,y,c),z=vt(D,h,g),$=t(()=>e=>{const t={r:f,fillOpacity:.8};return t.fill=h?Je(e,h,z):pt,t},[h,z,f]),W=t(()=>nt($,T,x),[$,T,x]),{legend:_,margin:H}=wt({data:C,colorBy:h,colorScale:z,showLegend:j,userMargin:a,defaults:r.marginDefaults}),I=t(()=>Tt({categoryAccessor:l,valueAccessor:c}),[l,c]),R=zt({componentName:"DotPlot",data:D,accessors:{categoryAccessor:l,valueAccessor:c}});if(R)return e.createElement(Bt,{componentName:"DotPlot",message:R,width:S,height:E});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point",data:C,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:W,size:[S,E],margin:H,barPadding:p,enableHover:L,showAxes:r.showAxes,oLabel:M,rLabel:N,rFormat:d,showGrid:O,oSort:y},_&&{legend:_}),P&&{title:P}),s&&{className:s}),{tooltipContent:m?jt(m):I}),(w||k)&&{customHoverBehavior:B}),v&&v.length>0&&{annotations:v}),b);return e.createElement(kn,Object.assign({},F))}function Nn(n){const o=At(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,categoryLabel:n.categoryLabel,valueLabel:n.valueLabel}),{data:r,margin:i,className:a,categoryAccessor:s="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:g,colorScheme:y="category10",categoryPadding:f=5,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=o.width,S=o.height,E=o.enableHover,L=o.showGrid,O=o.showLegend,j=o.title,P=o.categoryLabel,M=o.valueLabel,N=r||[],{activeSelectionHook:D,customHoverBehavior:T}=xt({selection:b,linkedHover:x,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof s?s:""],unwrapData:!0,onObservation:w,chartType:"RidgelinePlot",chartId:k}),B=vt(N,g,y),C=t(()=>e=>{const t=g?Je(e,g,B):pt;return{fill:t,stroke:t,fillOpacity:.5}},[g,B]),z=t(()=>nt(C,D,b),[C,D,b]),{legend:$,margin:W}=wt({data:N,colorBy:g,colorScale:B,showLegend:O,userMargin:i,defaults:o.marginDefaults}),_=t(()=>t=>{var n;const o=t.category||t.data&&(null===(n=t.data[0])||void 0===n?void 0:n.category)||"",r=t.stats;return r?e.createElement("div",{className:"semiotic-tooltip",style:St},o&&e.createElement("div",{style:{fontWeight:"bold"}},o+""),e.createElement("div",null,"n = ",r.n),e.createElement("div",null,"Min: ",r.min.toLocaleString()),e.createElement("div",null,"Q1: ",r.q1.toLocaleString()),e.createElement("div",null,"Median: ",r.median.toLocaleString()),e.createElement("div",null,"Q3: ",r.q3.toLocaleString()),e.createElement("div",null,"Max: ",r.max.toLocaleString()),e.createElement("div",{style:{opacity:.8}},"Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2}))):e.createElement("div",{className:"semiotic-tooltip",style:St},e.createElement("div",{style:{fontWeight:"bold"}},o+""))},[]),H=zt({componentName:"RidgelinePlot",data:N,accessors:{categoryAccessor:s,valueAccessor:l}});if(H)return e.createElement(Bt,{componentName:"RidgelinePlot",message:H,width:A,height:S});const I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:N,oAccessor:s,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:z,bins:u,size:[A,S],margin:W,barPadding:f,enableHover:E,showAxes:o.showAxes,oLabel:P,rLabel:M,rFormat:h,showGrid:L,oSort:!1},$&&{legend:$}),j&&{title:j}),a&&{className:a}),{tooltipContent:p?jt(p):_}),(x||w)&&{customHoverBehavior:T}),m&&m.length>0&&{annotations:m}),v);return I.amplitude=d,e.createElement(kn,Object.assign({},I))}function Dn(n){var o,r;const i=At(n.mode,{width:null!==(o=n.width)&&void 0!==o?o:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title}),{data:a,margin:s,className:l,categoryAccessor:c="category",valueAccessor:u="value",colorBy:d,colorScheme:h="category10",startAngle:g=0,tooltip:y,annotations:f,frameProps:p={},selection:m,linkedHover:v,onObservation:b,chartId:x}=n,w=i.width,k=i.height,A=i.enableHover,S=i.showLegend,E=i.title,L=a||[],O=d||c,{activeSelectionHook:j,customHoverBehavior:P}=xt({selection:m,linkedHover:v,fallbackFields:O?["string"==typeof O?O:""]:[],unwrapData:!0,onObservation:b,chartType:"PieChart",chartId:x}),M=vt(L,O,h),N=t(()=>e=>O?{fill:Je(e,O,M)}:{fill:pt},[O,M]),D=t(()=>nt(N,j,m),[N,j,m]),{legend:T,margin:B}=wt({data:L,colorBy:O,colorScale:M,showLegend:S,userMargin:s,defaults:i.marginDefaults}),C=t(()=>Tt({categoryAccessor:c,valueAccessor:u,groupAccessor:d&&d!==c?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[c,u,d]),z=zt({componentName:"PieChart",data:L,accessors:{categoryAccessor:c,valueAccessor:u}});if(z)return e.createElement(Bt,{componentName:"PieChart",message:z,width:w,height:k});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:L,oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:D,startAngle:g,size:[w,k],margin:B,enableHover:A,showAxes:!1},T&&{legend:T}),E&&{title:E}),l&&{className:l}),{tooltipContent:y?jt(y):C}),(v||b)&&{customHoverBehavior:P}),f&&f.length>0&&{annotations:f}),p);return e.createElement(kn,Object.assign({},$))}function Tn(n){var o,r;const i=At(n.mode,{width:null!==(o=n.width)&&void 0!==o?o:400,height:null!==(r=n.height)&&void 0!==r?r:400,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,linkedHover:n.linkedHover}),{data:a,margin:s,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d=60,centerContent:h,colorBy:g,colorScheme:y="category10",startAngle:f=0,tooltip:p,annotations:m,frameProps:v={},selection:b,linkedHover:x,onObservation:w,chartId:k}=n,A=i.width,S=i.height,E=i.enableHover,L=i.showLegend,O=i.title,j=a||[],P=g||c,{activeSelectionHook:M,customHoverBehavior:N}=xt({selection:b,linkedHover:x,fallbackFields:P?["string"==typeof P?P:""]:[],unwrapData:!0,onObservation:w,chartType:"DonutChart",chartId:k}),D=vt(j,P,y),T=t(()=>e=>P?{fill:Je(e,P,D)}:{fill:pt},[P,D]),B=t(()=>nt(T,M,b),[T,M,b]),{legend:C,margin:z}=wt({data:j,colorBy:P,colorScale:D,showLegend:L,userMargin:s,defaults:i.marginDefaults}),$=t(()=>Tt({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),W=zt({componentName:"DonutChart",data:j,accessors:{categoryAccessor:c,valueAccessor:u}});if(W)return e.createElement(Bt,{componentName:"DonutChart",message:W,width:A,height:S});const _=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:B,innerRadius:d,startAngle:f,centerContent:h,size:[A,S],margin:z,enableHover:E,showAxes:!1},C&&{legend:C}),O&&{title:O}),l&&{className:l}),{tooltipContent:p?jt(p):$}),(x||w)&&{customHoverBehavior:N}),m&&m.length>0&&{annotations:m}),v);return e.createElement(kn,Object.assign({},_))}kn.displayName="StreamOrdinalFrame",An.displayName="BarChart",Sn.displayName="StackedBarChart",En.displayName="GroupedBarChart",Ln.displayName="SwarmPlot",On.displayName="BoxPlot",jn.displayName="Histogram",Pn.displayName="ViolinPlot",Mn.displayName="DotPlot",Nn.displayName="RidgelinePlot",Dn.displayName="PieChart",Tn.displayName="DonutChart";const Bn={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Cn={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class zn{constructor(e){this.capacity=e,this.particles=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0}}spawn(e){for(let t=0;this.capacity>t;t++){const n=this.particles[t];if(!n.active)return n.active=!0,n.t=0,n.offset=Math.random()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}return null}step(e,t,n,o){var r;for(let i=0;this.capacity>i;i++){const a=this.particles[i];if(!a.active)continue;const s=n[a.edgeIndex];if(!s||!s.bezier){a.active=!1;continue}const l=o&&null!==(r=o[a.edgeIndex])&&void 0!==r?r:1;if(a.t+=e*t*l*(s.bezier.circular?.3:1),a.t>=1){a.active=!1;continue}const c=$n(s.bezier,a.t,a.offset);a.x=c.x,a.y=c.y}}countForEdge(e){let t=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let n=0;e>n;n++)this.particles[n]=t.length>n?t[n]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function $n(e,t,n){if(e.circular&&e.segments)return function(e,t,n,o){const r=e.length,i=t*r,a=Math.min(Math.floor(i),r-1),s=i-a,[l,c,u,d]=e[a],h=Wn(l,c,u,d,s),g=d.x-l.x,y=d.y-l.y,f=Math.sqrt(g*g+y*y);if(f>.001){const e=g/f;h.x+=-y/f*n*o*2,h.y+=e*n*o*2}return h}(e.segments,t,n,e.halfWidth);if(!e.points)return{x:0,y:0};const[o,r,i,a]=e.points,s=Wn(o,r,i,a,t),l=a.x-o.x,c=a.y-o.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;s.x+=-c/u*n*e.halfWidth*2,s.y+=t*n*e.halfWidth*2}return s}function Wn(e,t,n,o,r){const i=1-r,a=i*i,s=a*i,l=r*r,c=l*r;return{x:s*e.x+3*a*r*t.x+3*i*l*n.x+c*o.x,y:s*e.y+3*a*r*t.y+3*i*l*n.y+c*o.y}}function _n(e,t){var n=e.get(t);if(!n)throw Error("missing: "+t);return n}function Hn(e,t){var n,o=[],r=[],i=[],a={},s=[];function l(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&l(t)})}function c(e){var t,o,d=!1;for(r.push(e),i[e]=!0,t=0;s[e].length>t;t++)(o=s[e][t])===n?(u(n,r),d=!0):i[o]||(d=c(o));if(d)l(e);else for(t=0;s[e].length>t;t++){var h=a[o=s[e][t]];h||(a[o]=h={}),h[o]=!0}return r.pop(),d}function u(e,t){var n=[].concat(t).concat(e);o.push(n)}function d(t){!function(t){for(var n=0;e.length>n;n++)n>=t&&e[n]||(e[n]=[]),e[n]=e[n].filter(function(e){return e>=t})}(t);for(var n,o=function(e){for(var t=e.length,n=Array(t),o=Array(t),r=Array(t),i=Array(t),a=Array(t),s=Array(t),l=0;t>l;++l)n[l]=-1,o[l]=0,r[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(n[t]=o[t]=u,r[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>i[t]){for(var y=i[t];g.length>y;++y){var f=g[y];if(0>n[f]){n[f]=o[f]=u,r[f]=!0,u+=1,l.push(f),c.push(f);break}r[f]&&(o[t]=0|Math.min(o[t],o[f])),0>a[f]||s[t].push(a[f])}i[t]=y}else{if(o[t]===n[t]){var p=[],m=[],v=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(r[b]=!1,p.push(b),m.push(s[b]),v+=s[b].length,a[b]=d.length,b===t){l.length=y;break}}d.push(p);var x=Array(v);for(y=0;m.length>y;y++)for(var w=0;m[y].length>w;w++)x[--v]=m[y][w];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>n[l]&&g(l);for(l=0;h.length>l;l++){var y=h[l];if(0!==y.length){y.sort(function(e,t){return e-t}),c=[y[0]];for(var f=1;y.length>f;f++)y[f]!==y[f-1]&&c.push(y[f]);h[l]=c}}return{components:d,adjacencyList:h}}(e),r=o.components.filter(function(e){return e.length>1}),i=1/0,a=0;r.length>a;a++)for(var s=0;r[a].length>s;s++)i>r[a][s]&&(i=r[a][s],n=a);var l=r[n];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:i,adjList:c}}n=0;for(var h=e.length;h>n;){var g=d(n);if(n=g.leastVertex,s=g.adjList){for(var y=0;s.length>y;y++)for(var f=0;s[y].length>f;f++){var p=s[y][f];i[+p]=!1,a[p]={}}c(n),n+=1}else n=h}return o}function In(e){return e.y0-e.y1>0?"up":"down"}function Rn(e,t){return t(e.source)==t(e.target)}function Fn(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var n=0;return e.target.targetLinks.forEach(function(e){n=e.circular?n+1:n}),1>=t&&1>=n}function Yn(e){return e.target.x0-e.source.x1}function Xn(e,t){var n=qn(e),o=Yn(t)/Math.tan(n);return"up"==In(e)?e.y1-o:e.y1+o}function Gn(e,t){var n=qn(e),o=Yn(t)/Math.tan(n);return"up"==In(e)?e.y1+o:e.y1-o}function qn(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Vn(e,t){return t(e)}function Un(e){return Qn(e.source)}function Zn(e){return Qn(e.target)}function Qn(e){return(e.y0+e.y1)/2}function Jn(e){return e.virtual?0:e.value}function Kn(e,t){var n=0;e.sourceLinks.forEach(function(e){n=e.circular&&!Rn(e,t)?n+1:n});var o=0;return e.targetLinks.forEach(function(e){o=e.circular&&!Rn(e,t)?o+1:o}),n+o}function eo(e){return e.target.depth}function to(e,t){return e.sourceLinks.length?e.depth:t-1}function no(e,t){return e.y0-t.y0}function oo(e,t){return t.y0-e.y0}function ro(e,t){return e.y1-t.y1}function io(e,t){return t.y1-e.y1}function ao(e,t){return lo(e.source,t.source)||e.index-t.index}function so(e,t){return lo(e.target,t.target)||e.index-t.index}function lo(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function co(e,t){return uo(e)==uo(t)?"bottom"==e.circularLinkType?oo(e,t):no(e,t):uo(t)-uo(e)}function uo(e){return e.target.column-e.source.column}function ho(e,t){return go(e)==go(t)}function go(e){return e.y0-e.y1>0?"up":"down"}function yo(e,t,n,o,r){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=k(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),fo(i.links.filter(function(e){return"top"==e.circularLinkType}),t,n),fo(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,n),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+o,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Rn(e,t)&&Fn(e))e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?oo:no);var u=0;c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),a=e.target.column,(c=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?io:ro),u=0,c.forEach(function(t,r){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=o+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=o+e._circularWidth/2+r*n+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+r+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-r-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,n=e.y0,o=e.target.x0,r=e.y1,i=(t+o)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+o+","+r}(e)}),i}function fo(e,t,n){e.sort(co);var o=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,r){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Rn(e,t)&&Fn(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;o.length>a;a++){var s=o[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&po(e,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function po(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function mo(e){return function(){return e}}function vo(e){return e.index}function bo(e){return e.nodes}function xo(e){return e.links}function wo(e,t,n){var o=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});o.forEach(function(r){var i=r.length;r.sort(t||function(e,t){return e.circularLinkType==t.circularLinkType?Kn(t,n)-Kn(e,n):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0}),r.forEach(function(t,r){t.depth==o.length-1&&1==i||0==t.depth&&1==i?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Kn(t,n)?(t.y0=e.y1/2+r,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+r,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-r,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/i*r,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-i/2+r,t.y1=t.y0+t.value*e.ky)})})}function ko(e,t,n,o,r,i){var a=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(t,n){var o=a.length;a.forEach(function(r){var i=r.length,a=r[0].depth;r.forEach(function(r){var s;if(r.sourceLinks.length||r.targetLinks.length)if(r.partOfCycle&&Kn(r,n)>0){var l=L(r.sourceLinks,Zn),c=L(r.targetLinks,Un),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Qn(r))*t*.3;r.y0+=d,r.y1+=d}}else if(0==a&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(a==o-1&&1==i)r.y0=e.y1/2-(s=r.y1-r.y0)/2,r.y1=e.y1/2+s/2;else if(1==r.targetLinks.length&&1==r.targetLinks[0].source.sourceLinks.length)s=r.y1-r.y0,r.y0=r.targetLinks[0].source.y0,r.y1=r.y0+s;else{var h=L(r.sourceLinks,Zn),g=L(r.targetLinks,Un),y=((h&&g?(h+g)/2:h||g)-Qn(r))*t;r.y0+=y,r.y1+=y}})})}function u(){a.forEach(function(n){var i,a,s,l=e.y0,c=n.length;for(n.sort(t||lo),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+o;if((a=l-o-e.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+r-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function Ao(e){e.nodes.forEach(function(e){e.sourceLinks.sort(so),e.targetLinks.sort(ao)}),e.nodes.forEach(function(e){var t=e.y0,n=t,o=e.y1,r=o;e.sourceLinks.forEach(function(e){e.circular?(e.y0=o-e.width/2,o-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=r-e.width/2,r-=e.width):(e.y1=n+e.width/2,n+=e.width)})})}function So(){var e=0,t=0,n=1,o=1,r=24,i=8,a=null,s=vo,l=to,c=void 0,u=32,d=2,h=bo,g=xo;function y(){var y={nodes:h.apply(null,arguments),links:g.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=n,h.y1=o,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var n=function(e,t){var n=new Map;return O(e,t).forEach(function(e,t){n.set(t,e[0])}),n}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var o=e.source,r=e.target;"object"!=typeof o&&(o=e.source=_n(n,o)),"object"!=typeof r&&(r=e.target=_n(n,r)),o.sourceLinks.push(e),r.targetLinks.push(e)})}(h,s),function(e,t){var n=0;if(null==t){for(var o=[],r=0;e.links.length>r;r++){var i=e.links[r],a=i.source.index,s=i.target.index;o[a]||(o[a]=[]),o[s]||(o[s]=[]),-1===o[a].indexOf(s)&&o[a].push(s)}var l=Hn(o);l.sort(function(e,t){return e.length-t.length});var c={};for(r=0;l.length>r;r++){var u=l[r].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,o=e.source.index;t===o||c[o]&&c[o][t]?(e.circular=!0,e.circularLinkID=n++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=n++)})}(h,c),function(e,t){var n=0,o=0;e.links.forEach(function(r){r.circular&&(r.circularLinkType=r.source.circularLinkType||r.target.circularLinkType?r.source.circularLinkType?r.source.circularLinkType:r.target.circularLinkType:o>n?"top":"bottom","top"==r.circularLinkType?n++:o++,e.nodes.forEach(function(e){Vn(e,t)!=Vn(r.source,t)&&Vn(e,t)!=Vn(r.target,t)||(e.circularLinkType=r.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Rn(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(E(e.sourceLinks,Jn),E(e.targetLinks,Jn)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,n){var o,r,i;if(null!=t){e.nodes.sort(function(e,n){return t(e)<t(n)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>r.indexOf(e.target)&&!e.circular&&r.push(e.target)})});for(o=e.nodes,r=[],i=0;o.length;++i,o=r,r=[])o.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>r.indexOf(e.source)&&!e.circular&&r.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?n(e,i):e.column})}(h,c,l);var g=i;if(null!==a){var y=A(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),f=S(y,function(e){return e.length});f>1&&(g=Math.max(1,(o-t)*a/(f-1)))}(function(e,t,n){var o=A(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var r=k(o,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/E(t,function(e){return e.value})});e.ky=r,e.links.forEach(function(t){t.width=t.value*e.ky});var i=S(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-n)/i),t.x1=t.x0+n}:function(t){t.x0=e.x0,t.x1=t.x0+n})})(h,g,r),wo(h,c,s),ko(h,c,s,g,g,u),Ao(h),yo(h,s,d,10,8),wo(h,c,s),ko(h,c,s,g,g,u),Ao(h),yo(h,s,d,10,8),function(e,t){let n=e;n.nodes.forEach(function(e){e.y+(e.y1-e.y0)>n.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-n.y1));var o=n.links.filter(function(n){return Vn(n.source,t)==Vn(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!ho(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var n=Xn(t,e);return e.y1-n}if(t.target.column>e.target.column)return Xn(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let n=e;n.nodes.forEach(function(e){var o=n.links.filter(function(n){return Vn(n.target,t)==Vn(e,t)}),r=o.length;r>1&&o.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!ho(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var n=Gn(t,e);return e.y0-n}if(t.source.column>e.source.column)return Gn(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;o.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),o.forEach(function(t,n){if("bottom"==t.circularLinkType){for(var i=n+1,a=0;r>i;i++)a+=o[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,n=e.links,o=!1,r=!1;if(n.forEach(function(e){"top"==e.circularLinkType?o=!0:"bottom"==e.circularLinkType&&(r=!0)}),0==o||0==r){var i=k(t,function(e){return e.y0}),a=S(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);function l(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0}1>s?(t.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1)}),n.forEach(function(e){e.y0=l(e.y0),e.y1=l(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,n=l(e.y0)-e.y0;e.y0=l(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+n}),e.targetLinks.forEach(function(e){e.y1=e.y1+n})})}}(h),yo(h,s,d,10,8)}(y),y}return y.update=function(e){return Ao(e),yo(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(r=+e,y):r},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:mo(e),y):h},y.links=function(e){return arguments.length?(g="function"==typeof e?e:mo(e),y):g},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:mo(e),y):s},y.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:mo(e),y):l},y.nodeSort=function(e){return arguments.length?(c=e,y):c},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(r){return arguments.length?(e=+r[0][0],t=+r[0][1],n=+r[1][0],o=+r[1][1],y):[[e,t],[n,o]]},y.size=function(r){return arguments.length?(e=t=0,n=+r[0],o=+r[1],y):[n-e,o-t]},y}const Eo=e=>{let t,n,o,r,i,a,s,l,c;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,n=e.y1-e.sankeyWidth/2,o=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,i=e.source.y1,a=e.target.y0,s=G(i,a),l=s(.5),c=s(.5),`M${t},${i}C${t},${l} ${n},${c} ${n},${a}L${o},${a}C${o},${c} ${r},${l} ${r},${i}Z`):(t=e.source.x1,n=e.target.x0,s=G(t,n),o=s(.5),r=s(.5),i=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,l=e.y1+e.sankeyWidth/2,c=e.y0+e.sankeyWidth/2,`M${t},${i}C${o},${i} ${r},${a} ${n},${a}L${n},${l}C${r},${l} ${o},${c} ${t},${c}Z`)};function Lo(e){var t;const n=e.sankeyWidth/2,o=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const t=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${t},${o-n}L${t+s},${o-n}L${t+s},${o+n}L${t},${o+n}ZM${i},${a-n}L${i-l},${a-n}L${i-l},${a+n}L${i},${a+n}Z`}const i=r.sourceX,a=r.sourceY,s=r.targetX,l=r.targetY,c=r.rightFullExtent,u=r.leftFullExtent,d=r.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(o,15));return`M${i},${a-h*n}L${c},${a-h*n}L${c+o},${a-h*n+h*g}L${c+o},${d+h*o-h*g}L${c+o-g},${d+h*o}L${u-o+g},${d+h*o}L${u-o},${d+h*o-h*g}L${u-o},${l-h*n+h*g}L${u-o+g},${l-h*n}L${s},${l-h*n}L${s},${l+h*n}L${u},${l+h*n}L${u},${d-h*o}L${c},${d-h*o}L${c},${a+h*n}L${i},${a+h*n}Z`}const Oo={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(eo))-1:0},justify:to},jo={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,n,o){var r,i,a,s,l,c,u;if(0===e.length)return;const d="vertical"===n.orientation?"down":"right",h=n.nodeAlign||"justify",g=null!==(r=n.nodeWidth)&&void 0!==r?r:15,y=null!==(i=n.nodePaddingRatio)&&void 0!==i?i:.05,f=null!==(a=n.iterations)&&void 0!==a?a:100,p=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[o[1],o[0]]]:[[0,0],[o[0],o[1]]];const b=So().extent(v).links(m).nodes(p).nodeAlign(Oo[h]||to).nodeId(e=>e.id).nodeWidth(g).iterations(f);b.nodePaddingRatio&&b.nodePaddingRatio(y),b();{let e=1/0,t=-1/0,n=1/0,r=-1/0;for(const o of p)e>o.x0&&(e=o.x0),o.x1>t&&(t=o.x1),n>o.y0&&(n=o.y0),o.y1>r&&(r=o.y1);for(const o of m){if(!o.circular||!o.circularPathData)continue;const i=o.circularPathData,a=(null!==(l=null!==(s=o._circularWidth)&&void 0!==s?s:o.width)&&void 0!==l?l:0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>r&&(r=i.verticalFullExtent+a)}const i=t-e,a=r-n,u=o[0],d=o[1];if(i>0&&a>0&&(0>e||0>n||t>u||r>d)){const t=Math.min(u/i,d/a),o=-e*t+(u-i*t)/2,r=-n*t+(d-a*t)/2;for(const e of p)e.x0=e.x0*t+o,e.x1=e.x1*t+o,e.y0=e.y0*t+r,e.y1=e.y1*t+r;for(const e of m)if(e.y0=e.y0*t+r,e.y1=e.y1*t+r,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const n=e.circularPathData;n.sourceX=n.sourceX*t+o,n.targetX=n.targetX*t+o,n.sourceY=n.sourceY*t+r,n.targetY=n.targetY*t+r,n.rightFullExtent=n.rightFullExtent*t+o,n.leftFullExtent=n.leftFullExtent*t+o,n.verticalFullExtent=n.verticalFullExtent*t+r,n.rightInnerExtent=n.rightInnerExtent*t+o,n.leftInnerExtent=n.leftInnerExtent*t+o,n.verticalRightInnerExtent=n.verticalRightInnerExtent*t+r,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*t+r,n.rightSmallArcRadius*=t,n.rightLargeArcRadius*=t,n.leftSmallArcRadius*=t,n.leftLargeArcRadius*=t,n.sourceWidth*=t,n.rightNodeBuffer*=t,n.leftNodeBuffer*=t,n.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of p){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=e.source,n=e.target,o="object"==typeof t&&null!==t?t.id:t+"",r="object"==typeof n&&null!==n?n.id:n+"",i=w.get(`${o}\0${r}`);if(i){i.y0=e.y0,i.y1=e.y1,i.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,i.circular=!!e.circular,i.circularPathData=e.circularPathData,i._circularWidth=e._circularWidth,i._circularStub=e._circularStub,i.path=e.path,i.circularLinkType=e.circularLinkType,i.direction=d;const t=x.get(o),n=x.get(r);t&&(i.source=t),n&&(i.target=n)}}},buildScene(e,t,n,o){var r,i,a,s;const l="vertical"===n.orientation?"down":"right",c=n.nodeStyle,u=n.edgeStyle,d=null!==(r=n.edgeOpacity)&&void 0!==r?r:.5,h=n.edgeColorBy||"source",g=Array.isArray(n.colorScheme)?n.colorScheme:X,y=new Map;e.forEach((e,t)=>{y.set(e.id,g[t%g.length])});const f=[],p=[],m=[];for(const t of e){const e=t.x1-t.x0,n=t.y1-t.y0;if(0>=e||0>=n)continue;const o=c?c(t):{},r={fill:o.fill||y.get(t.id)||"#4d430c",stroke:o.stroke,strokeWidth:o.strokeWidth,opacity:o.opacity};f.push({type:"rect",x:t.x0,y:t.y0,w:e,h:n,style:r,datum:t,id:t.id,label:t.id})}const v=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of v){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o="#999";u?o=u(e).fill||o:"target"===h&&n?o=y.get(n.id)||o:t&&(o=y.get(t.id)||o);const r=u?u(e):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,n=e.sankeyWidth/2,s=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),l=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=r.fill||o;p.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-n}L${t.sourceX+s},${t.sourceY-n}L${t.sourceX+s},${t.sourceY+n}L${t.sourceX},${t.sourceY+n}Z`,style:{fill:c,fillOpacity:null!==(i=r.fillOpacity)&&void 0!==i?i:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+s}}),p.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-n}L${t.targetX-l},${t.targetY-n}L${t.targetX-l},${t.targetY+n}L${t.targetX},${t.targetY+n}Z`,style:{fill:c,fillOpacity:null!==(a=r.fillOpacity)&&void 0!==a?a:d,stroke:"none",opacity:r.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-l,x1:t.targetX}});continue}let l;if(l=e.circular&&e.circularPathData?Lo(e):Eo(e),!l)continue;const c={fill:r.fill||o,fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:d,stroke:r.stroke||"none",strokeWidth:r.strokeWidth,opacity:r.opacity};p.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:c,datum:e})}if(!1!==n.showLabels){const t=(b=n.nodeLabel)?"function"==typeof b?b:e=>e[b]||e.id:null;for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;const i=t?t(n):n.id;if(!i)continue;let a,s,c;"down"===l?(a=n.x0+e/2,s=n.y1+14,c="middle"):(o[0]/2>n.x0+e/2?(a=n.x0-6,c="end"):(a=n.x1+6,c="start"),s=n.y0+r/2),m.push({x:a,y:s,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var b;return{sceneNodes:f,sceneEdges:p,labels:m}}},Po={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){var r,i;if(0===e.length)return;const a=null!==(r=n.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),s=null!==(i=n.forceStrength)&&void 0!==i?i:.1,l=o[0]/2,c=o[1]/2;for(let t=0;e.length>t;t++){const n=e[t];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(t+.5),o=2.399963229728653*t;n.x=l+e*Math.cos(o),n.y=c+e*Math.sin(o)}}const u=Mo(n.nodeSize,n.nodeSizeRange,e),d=q().strength(e=>Math.min(2.5,e.weight?e.weight*s:s)).id(e=>e.id),h=o[1]/o[0],g=V().force("charge",U().strength(e=>-25*(e=>u(e))(e))).force("x",Z(o[0]/2).strength(.1*h)).force("y",Q(o[1]/2).strength(.1));if(g.nodes(e),t.length>0){const e=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));g.force("link",d),g.force("link").links(e)}.1>g.alpha()&&g.alpha(1),g.stop();for(let e=0;a>e;++e)g.tick();const y=new Map;for(const t of e)y.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=y.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=y.get(e.target);t&&(e.target=t)}}},buildScene(e,t,n,o){var r,i,a;const s=n.nodeStyle,l=n.edgeStyle,c=Mo(n.nodeSize,n.nodeSizeRange,e),u=Array.isArray(n.colorScheme)?n.colorScheme:X,d=new Map;e.forEach((e,t)=>{d.set(e.id,u[t%u.length])});const h=[],g=[],y=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=c(t),n=s?s(t):{},o={fill:n.fill||d.get(t.id)||"#007bff",stroke:n.stroke||"#fff",strokeWidth:null!==(r=n.strokeWidth)&&void 0!==r?r:2,opacity:n.opacity};h.push({type:"circle",cx:t.x,cy:t.y,r:e,style:o,datum:t,id:t.id,label:t.id})}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:f.get(e.source),n="object"==typeof e.target?e.target:f.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=l?l(e):{},r={stroke:o.stroke||"#999",strokeWidth:null!==(i=o.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=o.opacity)&&void 0!==a?a:.6};g.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==n.showLabels){const t=(p=n.nodeLabel)?"function"==typeof p?p:e=>e[p]||e.id:null;for(const n of e){if(null==n.x||null==n.y)continue;const e=t?t(n):n.id;if(!e)continue;const o=c(n);y.push({x:n.x,y:n.y-o-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:h,sceneEdges:g,labels:y}}};function Mo(e,t,n){var o,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const i=t||[5,20],a=n.map(t=>{var n;return null===(n=t.data)||void 0===n?void 0:n[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===a.length)return()=>i[0];const s=null!==(o=k(a))&&void 0!==o?o:0,l=null!==(r=S(a))&&void 0!==r?r:1;if(s===l)return()=>(i[0]+i[1])/2;const c=p().domain([s,l]).range(i).clamp(!0);return t=>{var n;const o=null===(n=t.data)||void 0===n?void 0:n[e];return null==o||"number"!=typeof o?i[0]:c(o)}}const No=X,Do={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,n,o){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(o[0],o[1])/2,l=s-i,c=o[0]/2,u=o[1]/2,d=(h=n.valueAccessor)?"function"==typeof h?h:e=>{var t;return null!==(t=e[h])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var h;const g=new Map;for(let t=0;e.length>t;t++)g.set(e[t].id,t);const y=e.length,f=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(void 0===n||void 0===o)continue;const r=d(e);f[n][o]=r}const p=K().padAngle(r);a&&p.sortGroups(a);const m=p(f),v=m.groups,b=ee().innerRadius(l).outerRadius(s);for(const t of v){const n=e[t.index],o=b.centroid(t);n.x=o[0]+c,n.y=o[1]+u,n.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,n=x.get("string"==typeof e.source?e.source:e.source.id),o=x.get(t);n&&(e.source=n),o&&(e.target=o)}const w=new Map;for(const e of t)w.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of m){const n=e[t.source.index].id,o=e[t.target.index].id,r=w.get(`${n}\0${o}`)||w.get(`${o}\0${n}`);r&&(r.chordData=t)}},buildScene(e,t,n,o){var r,i;const{groupWidth:a=20,edgeOpacity:s=.5}=n,l=Math.min(o[0],o[1])/2,c=l-a,u=o[0]/2,d=o[1]/2,h=n.nodeStyle,g=n.edgeStyle,y=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:No,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const m=J().radius(c),v=[],b=[],x=[];for(let t=0;e.length>t;t++){const n=e[t],o=n.arcData;if(!o)continue;let i;i=h?h(n).fill||p.get(n.id)||f[t%f.length]:p.get(n.id)||f[t%f.length];const a=h?h(n):{},s={fill:i,stroke:a.stroke||"black",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};v.push({type:"arc",cx:u,cy:d,innerR:c,outerR:l,startAngle:o.startAngle-Math.PI/2,endAngle:o.endAngle-Math.PI/2,style:s,datum:n,id:n.id,label:n.id})}for(const e of t){const t=e.chordData;if(!t)continue;const n=m(t);if(!n)continue;const o=To(n,u,d);let r="#999";if(g)r=g(e).fill||r;else{const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;"target"===y&&n?r=p.get(n.id)||r:t&&(r=p.get(t.id)||r)}const a=g?g(e):{},l={fill:r,fillOpacity:null!==(i=a.fillOpacity)&&void 0!==i?i:s,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity};b.push({type:"ribbon",pathD:o,style:l,datum:e})}if(!1!==n.showLabels){const t=(w=n.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,o=l+12;for(const n of e){const e=n.arcData;if(!e)continue;const r=t?t(n):n.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;x.push({x:u+Math.cos(a)*o,y:d+Math.sin(a)*o,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:v,sceneEdges:b,labels:x}}};function To(e,t,n){const o=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!o)return e;const r=[];let i=0;for(;o.length>i;){const e=o[i];if("M"===e||"L"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("C"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;3>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("Q"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)for(let e=0;2>e&&o.length>i&&!isNaN(Number(o[i]));e++)r.push(Number(o[i])+t+""),i++,o.length>i&&!isNaN(Number(o[i]))&&(r.push(Number(o[i])+n+""),i++);else if("A"===e)for(r.push(e),i++;o.length>i&&!isNaN(Number(o[i]));)r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&r.push(o[i++]),o.length>i&&(r.push(Number(o[i])+t+""),i++),o.length>i&&(r.push(Number(o[i])+n+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(o[i]),i++)}return r.join(" ")}const Bo={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,n,o){var r;const i=n.__hierarchyRoot;if(!i)return;const a=n.chartType,s=(l=n.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=n.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=P(i,s);u.sum(c),u.sort((e,t)=>{var n,o;return(null!==(n=t.value)&&void 0!==n?n:0)-(null!==(o=e.value)&&void 0!==o?o:0)});const[d,h]=o;switch(a){case"tree":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=C();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"cluster":!function(e,t,n,o){const r=t.treeOrientation||"vertical",i=B();i.size("horizontal"===r?[o,n]:"radial"===r?[2*Math.PI,Math.min(n,o)/2*.8]:[n,o]),i(e)}(u,n,d,h);break;case"treemap":!function(e,t,n,o){var r,i;const a=null!==(r=t.padding)&&void 0!==r?r:4,s=null!==(i=t.paddingTop)&&void 0!==i?i:0,l=D().size([n,o]).tile(T).padding(a);s>0&&l.paddingTop(s),l(e)}(u,n,d,h);break;case"circlepack":!function(e,t,n,o){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;N().size([n,o]).padding(i)(e)}(u,n,d,h);break;case"partition":!function(e,t,n,o){var r;M().size([n,o]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,n,d,h)}const g=u.descendants();e.length=0,t.length=0;const y=new Map;for(let t=0;g.length>t;t++){const o=g[t],i={id:_o(o,n,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=o.value)&&void 0!==r?r:0,depth:o.depth,data:o.data,createdByFrame:!0};"tree"===a||"cluster"===a?Co(i,o,n):"treemap"===a||"partition"===a?zo(i,o):"circlepack"===a&&$o(i,o),i.__hierarchyNode=o,e.push(i),y.set(o,i)}if("tree"===a||"cluster"===a)for(const e of g)if(e.parent){const n=y.get(e.parent),o=y.get(e);n&&o&&t.push({source:n,target:o,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,n,o){const r=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(e,t,n,o,r,i){var a,s,l,c,u;const d=[],h=[],g=[],y=n.treeOrientation||"vertical",f="radial"===y,p=o[0]/2,m=o[1]/2,v="number"==typeof(x=n.nodeSize)?x:5,b=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];var x;for(const t of e){let e=t.x,o=t.y;f&&(e+=p,o+=m);const i=r(t);let s=i.fill||"#4d430c";n.colorByDepth&&void 0!==t.depth&&(s=b[t.depth%b.length]);const l={fill:s,stroke:i.stroke||"#fff",strokeWidth:null!==(a=i.strokeWidth)&&void 0!==a?a:1,opacity:i.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:l,datum:t,id:t.id,label:t.id,depth:t.depth})}const w=null!==(s=n.edgeOpacity)&&void 0!==s?s:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,r=t.y,a=n.x,s=n.y;f&&(o+=p,r+=m,a+=p,s+=m);const u=Wo(o,r,a,s,y),d=i(e),g={fill:"none",stroke:d.stroke||"#999",strokeWidth:null!==(l=d.strokeWidth)&&void 0!==l?l:1.5,opacity:null!==(c=d.opacity)&&void 0!==c?c:w};h.push({type:"curved",pathD:u,style:g,datum:e})}if(!1!==n.showLabels){const t=Ho(n.nodeLabel);for(const n of e){const e=t?t(n):n.id;if(!e)continue;let o,r,i,a=n.x,s=n.y;if(f&&(a+=p,s+=m),f){const e=a-p,t=s-m,n=Math.sqrt(e*e+t*t);n>0?(o=a+e/n*10,r=s+t/n*10,i=0>e?"end":"start"):(o=a,r=s-12,i="middle")}else"horizontal"===y?((null===(u=n.data)||void 0===u?void 0:u.children)&&0!==n.data.children.length?(o=a-v-6,i="end"):(o=a+v+6,i="start"),r=s):(o=a,r=s+v+14,i="middle");g.push({x:o,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:g}}(e,t,n,o,r,i);case"treemap":case"partition":return function(e,t,n,o){var r,i;const a=[],s=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=n.x1-n.x0,i=n.y1-n.y0;if(0>=e||0>=i)continue;const s=o(n);let c=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(c=l[n.depth%l.length]);const u={fill:c,stroke:s.stroke||"#fff",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};a.push({type:"rect",x:n.x0,y:n.y0,w:e,h:i,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ho(t.nodeLabel);for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;if((null===(i=o.data)||void 0===i?void 0:i.children)&&o.data.children.length>0&&"partition"!==t.chartType)continue;const a=n?n(o):o.id;a&&(30>e||16>r||s.push({x:o.x0+e/2,y:o.y0+r/2,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,r)/6))}))}}return{sceneNodes:a,sceneEdges:[],labels:s}}(e,n,0,r);case"circlepack":return function(e,t,n,o){var r,i,a,s,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const n of e){const e=null!==(r=n.__radius)&&void 0!==r?r:5;if(0>=e)continue;const s=o(n);let l=s.fill||"#4d430c";t.colorByDepth&&void 0!==n.depth&&(l=d[n.depth%d.length]);const u={fill:l,stroke:s.stroke||"#fff",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:null!==(a=s.opacity)&&void 0!==a?a:.7};c.push({type:"circle",cx:n.x,cy:n.y,r:e,style:u,datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==t.showLabels){const n=Ho(t.nodeLabel);for(const t of e){const e=null!==(s=t.__radius)&&void 0!==s?s:5,o=n?n(t):t.id;if(!o)continue;if(15>e)continue;const r=!((null===(l=t.data)||void 0===l?void 0:l.children)&&t.data.children.length>0);u.push({x:t.x,y:r?t.y:t.y-e+14,text:o+"",anchor:"middle",baseline:r?"middle":"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:r?void 0:"#000",stroke:r?void 0:"#fff",strokeWidth:r?void 0:3,paintOrder:r?void 0:"stroke"})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,n,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Co(e,t,n){const o=n.treeOrientation||"vertical";if("radial"===o){const n=t.x,o=t.y;e.x=o*Math.cos(n-Math.PI/2),e.y=o*Math.sin(n-Math.PI/2)}else"horizontal"===o?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function zo(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function $o(e,t){var n;const o=null!==(n=t.r)&&void 0!==n?n:0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}function Wo(e,t,n,o,r){if("horizontal"===r){const r=(e+n)/2;return`M ${e},${t} C ${r},${t} ${r},${o} ${n},${o}`}if("radial"===r){const r=(e+n)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+o)/2} T ${n},${o}`}{const r=(t+o)/2;return`M ${e},${t} C ${e},${r} ${n},${r} ${n},${o}`}}function _o(e,t,n){const o=t.nodeIDAccessor;return"function"==typeof o?o(e.data)+"":"string"==typeof o&&void 0!==e.data[o]?e.data[o]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+n}function Ho(e){return e?"function"==typeof e?e:t=>{var n;return(null===(n=t.data)||void 0===n?void 0:n[e])||t[e]||t.id}:null}const Io={sankey:jo,force:Po,chord:Do,tree:Bo,cluster:Bo,treemap:Bo,circlepack:Bo,partition:Bo};function Ro(e){return Io[e]}class Fo{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.particlePool=null,this.transition=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.config=e,this.tensionConfig=Object.assign(Object.assign({},Bn),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new zn(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},Bn),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new zn(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,n){const{nodeIDAccessor:o="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:a="value"}=this.config,s="function"==typeof o?o:e=>e[o],l="function"==typeof r?r:e=>e[r],c="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>{var t;return null!==(t=e[a])&&void 0!==t?t:1};this.nodes.clear(),this.edges.clear();for(const t of e){const e=s(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Yo(e)),{data:t}))}for(const e of t){const t=l(e)+"",n=c(e)+"",o=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Yo(t)),{data:e})),this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Yo(n)),{data:e})),this.edges.set(`${t}\0${n}`,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(n)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:n,value:o}=e,r=0===this.nodes.size;let i=!1;const a="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=a,this.nodes.has(t)||(this.nodes.set(t,Yo(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(n)||(this.nodes.set(n,Yo(n)),this.nodeTimestamps.set(n,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,n),l=this.edges.get(s);return l?(l.value+=o,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange):(this.edges.set(s,{source:t,target:n,value:o,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=Ro(this.config.chartType);if(!t)return;let n=Array.from(this.nodes.values()),o=Array.from(this.edges.values());if(0===n.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.computeLayout(n,o,this.config,e),t.hierarchical&&n.length>0){this.nodes.clear(),this.edges.clear();for(const e of n)this.nodes.set(e.id,e);for(const e of o)this.edges.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e)}this.finalizeLayout(),this.saveTargetPositions(),n.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1))&&this.tensionConfig.transitionDuration>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:this.tensionConfig.transitionDuration});const r=new Set(this.nodes.keys()),i=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const e of r)this.previousNodeIds.has(e)||this.addedNodes.add(e);for(const e of this.previousNodeIds)r.has(e)||this.removedNodes.add(e);for(const e of i)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)i.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=r,this.previousEdgeKeys=i,this.layoutVersion++}buildScene(e){const t=Ro(this.config.chartType);if(!t)return;const n=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:a}=t.buildScene(n,o,this.config,e);this.sceneNodes=r,this.sceneEdges=i,this.labels=a}advanceTransition(e){if(!this.transition)return!1;const t=Math.min((e-this.transition.startTime)/this.transition.duration,1),n=1-Math.pow(1-t,3);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0+(e._targetX0-e._prevX0)*n,e.x1=e._prevX1+(e._targetX1-e._prevX1)*n,e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n);for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0+(e._targetY0-e._prevY0)*n,e.y1=e._prevY1+(e._targetY1-e._prevY1)*n,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*n);return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){for(const e of this.nodes.values())e._prevX0=e.x0,e._prevX1=e.x1,e._prevY0=e.y0,e._prevY1=e.y1;for(const e of this.edges.values())e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth);this.rebuildAllBeziers()}updateEdgeBezier(e){const t="string"==typeof e.source?this.nodes.get(e.source):e.source,n="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&n&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,n))}buildStandardBezier(e,t,n){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,i=n.y0,a=G(r,i);return{circular:!1,points:[{x:e.y0,y:r},{x:e.y0,y:a(.5)},{x:e.y1,y:a(.5)},{x:e.y1,y:i}],halfWidth:o}}const r=t.x1,i=n.x0,a=G(r,i);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:i,y:e.y1}],halfWidth:o}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,n=e.circularPathData;if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(n.rightFullExtent-n.sourceX))),o=Math.max(15,Math.min(40,.33*(n.targetX-n.leftFullExtent)));return{circular:!0,segments:[[{x:n.sourceX,y:n.sourceY},{x:n.sourceX+.33*e,y:n.sourceY},{x:n.sourceX+.66*e,y:n.sourceY},{x:n.sourceX+e,y:n.sourceY}],[{x:n.targetX-o,y:n.targetY},{x:n.targetX-.66*o,y:n.targetY},{x:n.targetX-.33*o,y:n.targetY},{x:n.targetX,y:n.targetY}]],halfWidth:t}}let o;o="down"===e.direction?[{x:n.sourceY,y:n.sourceX},{x:n.sourceY,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.rightFullExtent},{x:n.verticalFullExtent,y:n.leftFullExtent},{x:n.targetY,y:n.leftFullExtent},{x:n.targetY,y:n.targetX}]:[{x:n.sourceX,y:n.sourceY},{x:n.rightFullExtent,y:n.sourceY},{x:n.rightFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.verticalFullExtent},{x:n.leftFullExtent,y:n.targetY},{x:n.targetX,y:n.targetY}];const r=[];for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1],i=n.x-t.x,a=n.y-t.y;r.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},n])}return{circular:!0,segments:r,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,n,o,r,i;const a=this.config.pulse;if(!a)return;const s=null!==(t=a.duration)&&void 0!==t?t:500,l=null!==(n=a.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",c=null!==(o=a.glowRadius)&&void 0!==o?o:4;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const o=this.nodeTimestamps.get(n);if(!o)continue;const r=e-o;s>r&&(t._pulseIntensity=1-r/s,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const n=t.datum;if(!n)continue;const o="object"==typeof n.source?null===(r=n.source)||void 0===r?void 0:r.id:n.source,a="object"==typeof n.target?null===(i=n.target)||void 0===i?void 0:i.id:n.target;if(!o||!a)continue;const c=this.edgeTimestamps.get(`${o}\0${a}`);if(!c)continue;const u=e-c;s>u&&(t._pulseIntensity=1-u/s,t._pulseColor=l)}}applyDecay(){var e,t,n,o,r;const i=this.config.decay;if(!i)return;const a=null!==(e=i.minOpacity)&&void 0!==e?e:.1,s=this.nodeTimestamps.size;if(1>=s)return;const l=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]),c=new Map;for(let e=0;l.length>e;e++)c.set(l[e][0],e);for(const e of this.sceneNodes){const l=e.id;if(!l)continue;const u=c.get(l);if(void 0===u)continue;const d=s-1-u;let h;switch(i.type){case"linear":h=a+(1-d/(s-1))*(1-a);break;case"exponential":{const e=null!==(t=i.halfLife)&&void 0!==t?t:s/2;h=a+Math.pow(.5,d/e)*(1-a);break}case"step":h=(null!==(n=i.stepThreshold)&&void 0!==n?n:.5*s)>d?1:a;break;default:h=1}const g=null!==(r=null===(o=e.style)||void 0===o?void 0:o.opacity)&&void 0!==r?r:1;e.style=Object.assign(Object.assign({},e.style),{opacity:g*h})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const n=e-this.lastTopologyChangeTime;if(n>=2e3)return;const o=1-n/2e3;for(const e of this.sceneNodes){const n=e.id;n&&this.addedNodes.has(n)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,o),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,n;const o=this.config.thresholds;if(!o)return;const r=null!==(t=o.warningColor)&&void 0!==t?t:"#f59e0b",i=null!==(n=o.criticalColor)&&void 0!==n?n:"#ef4444",a=!1!==o.pulse;for(const t of this.sceneNodes){const n=t.id;if(!n)continue;const s=this.nodes.get(n);if(!s)continue;const l=o.metric(s);let c=null;void 0===o.critical||o.critical>l?void 0===o.warning||o.warning>l||(c=r):c=i,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),a&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const n=e.metric(t);if(void 0!==e.warning&&n>=e.warning||void 0!==e.critical&&n>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const n="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>n-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}clear(){this.nodes.clear(),this.edges.clear(),this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this.lastIngestTime=0,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.particlePool&&this.particlePool.clear()}}function Yo(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Xo(e,t,n,o,r=30){let i=null,a=r,s=1/0;for(const t of e){const e=Go(t,n,o);if(e)if("rect"===t.type){const n=t.w*t.h;s>n&&(i=e,s=n)}else a>e.distance&&(i=e,a=e.distance)}if(i)return i;for(const e of t){const t=qo(e,n,o);t&&a>t.distance&&(i=t,a=t.distance)}return i}function Go(e,t,n){switch(e.type){case"circle":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);return i>Math.max(e.r,5)+5?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:i}}(e,t,n);case"rect":return function(e,t,n){return e.x>t||t>e.x+e.w||e.y>n||n>e.y+e.h?null:{type:"node",datum:e.datum,x:e.x+e.w/2,y:e.y+e.h/2,distance:0}}(e,t,n);case"arc":return function(e,t,n){const o=t-e.cx,r=n-e.cy,i=Math.sqrt(o*o+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;let a=Math.atan2(r,o);0>a&&(a+=2*Math.PI);let s,l=e.startAngle,c=e.endAngle;if(0>l&&(l+=2*Math.PI),0>c&&(c+=2*Math.PI),s=l>c?a>=l||c>=a:a>=l&&c>=a,s){const t=(e.startAngle+e.endAngle)/2,n=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+n*Math.cos(t),y:e.cy+n*Math.sin(t),distance:0}}return null}(e,t,n);default:return null}}function qo(e,t,n){switch(e.type){case"bezier":return function(e,t,n){var o,r;if(!e.pathD)return null;try{const i=new Path2D(e.pathD),a=document.createElement("canvas").getContext("2d");if(!a)return null;if(a.isPointInPath(i,t,n)){const i="object"==typeof(null===(o=e.datum)||void 0===o?void 0:o.source)?e.datum.source:null,a="object"==typeof(null===(r=e.datum)||void 0===r?void 0:r.target)?e.datum.target:null;return{type:"edge",datum:e.datum,x:i&&a?(i.x1+a.x0)/2:t,y:e.datum?(e.datum.y0+e.datum.y1)/2:n,distance:0}}}catch(e){}return null}(e,t,n);case"line":return function(e,t,n){const o=e.x2-e.x1,r=e.y2-e.y1,i=o*o+r*r;if(0===i)return null;let a=((t-e.x1)*o+(n-e.y1)*r)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*o,l=e.y1+a*r,c=Math.sqrt(Math.pow(t-s,2)+Math.pow(n-l,2));return c>5?null:{type:"edge",datum:e.datum,x:s,y:l,distance:c}}(e,t,n);case"ribbon":case"curved":return function(e,t,n){if(!e.pathD)return null;try{const o=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(o,t,n))return{type:"edge",datum:e.datum,x:t,y:n,distance:0}}catch(e){}return null}(e,t,n);default:return null}}function Vo(t){const{width:n,height:o,totalWidth:r,totalHeight:i,margin:a,labels:s,title:l,legend:c,foregroundGraphics:u,annotations:d,svgAnnotationRules:h}=t;return e.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},e.createElement("g",{transform:`translate(${a.left},${a.top})`},s.map((t,n)=>e.createElement("text",{key:"label-"+n,x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"}},t.text)),d&&h&&d.map((t,r)=>{const i=h(t,r,{width:n,height:o});return i?e.createElement(e.Fragment,{key:"annotation-"+r},i):null}),u),l&&"string"==typeof l?e.createElement("text",{x:r/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},l):l?e.createElement("foreignObject",{x:0,y:0,width:r,height:a.top},l):null,c&&"object"==typeof c&&"legendGroups"in c?e.createElement("g",{transform:`translate(${r-a.right+10},${a.top})`},c.legendGroups.map((t,n)=>{var o;return e.createElement("g",{key:"legend-group-"+n},null===(o=t.items)||void 0===o?void 0:o.map((t,n)=>e.createElement("g",{key:"legend-item-"+n,transform:`translate(0,${20*n})`},e.createElement("rect",{x:0,y:0,width:12,height:12,fill:t.color,rx:2}),e.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},t.label))))})):c?e.createElement("g",{transform:`translate(${r-a.right+10},${a.top})`},c):null)}function Uo(e,t){var n,o,r,i,a,s;if(!t.pathD)return;e.save();const l=new Path2D(t.pathD);if(t.style.fill&&"none"!==t.style.fill){const a=t._gradient;if(a){const r=e.createLinearGradient(a.x0,0,a.x1,0),i=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,s=t.style.fill;r.addColorStop(0,1===a.from?s:"transparent"),r.addColorStop(1,1===a.to?s:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=t.style.fill,e.globalAlpha=null!==(i=null!==(r=t.style.fillOpacity)&&void 0!==r?r:t.style.opacity)&&void 0!==i?i:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(a=t.style.strokeWidth)&&void 0!==a?a:.5,e.globalAlpha=.5*(null!==(s=t.style.opacity)&&void 0!==s?s:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function Zo(e,t){var n,o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(o=t.style.strokeWidth)&&void 0!==o?o:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Qo(e,t){var n,o,r,i;if(!t.pathD)return;e.save();const a=new Path2D(t.pathD);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=null!==(n=t.style.fillOpacity)&&void 0!==n?n:t.style.opacity)&&void 0!==o?o:.5,e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(r=t.style.strokeWidth)&&void 0!==r?r:.5,e.globalAlpha=.3*(null!==(i=t.style.opacity)&&void 0!==i?i:1),e.stroke(a)),e.restore()}function Jo(e,t){var n,o;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=t.style.fill,e.globalAlpha=null!==(o=t.style.fillOpacity)&&void 0!==o?o:.1,e.fill(r)),e.restore()}Vo.displayName="NetworkSVGOverlay";const Ko={top:20,right:80,bottom:20,left:80},er={top:40,right:40,bottom:40,left:40},tr=new Set(["chord","force","circlepack"]),nr=[800,600],or={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function rr({data:t}){var n,o,r,i,a,s;if("edge"===t.type){const n=t.data;return e.createElement("div",{className:"semiotic-tooltip",style:or},e.createElement("div",{style:{fontWeight:600}},"object"==typeof n.source?n.source.id:n.source," → ","object"==typeof n.target?n.target.id:n.target),null!=n.value&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof n.value?n.value.toLocaleString():n.value+""))}const l=t.data,c=null==l?void 0:l.__hierarchyNode;if(c){const t=[];let a=c;for(;a;){const e=null!==(i=null!==(o=null===(n=a.data)||void 0===n?void 0:n.name)&&void 0!==o?o:null===(r=a.data)||void 0===r?void 0:r.id)&&void 0!==i?i:l.id;null!=e&&t.unshift(e+""),a=a.parent}t.length>1&&t.shift();const s=t.length-1;return e.createElement("div",{className:"semiotic-tooltip",style:or},e.createElement("div",null,t.map((t,n)=>e.createElement("span",{key:n},n>0&&e.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),n===s?e.createElement("strong",null,t):e.createElement("span",{style:{opacity:.7}},t)))),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof l.value?l.value.toLocaleString():l.value+""))}const u=((null===(a=l.sourceLinks)||void 0===a?void 0:a.length)||0)+((null===(s=l.targetLinks)||void 0===s?void 0:s.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.createElement("div",{className:"semiotic-tooltip",style:or},e.createElement("div",{style:{fontWeight:600}},l.id),null!=l.value&&l.value>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""),u>0&&e.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`))}const ir=n(function(n,l){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:g,nodeIDAccessor:y="id",sourceAccessor:f="source",targetAccessor:p="target",valueAccessor:m="value",childrenAccessor:v,hierarchySum:b,orientation:x="horizontal",nodeAlign:w="justify",nodePaddingRatio:k=.05,nodeWidth:A=15,iterations:S=300,forceStrength:E=.1,padAngle:L=.01,groupWidth:O=20,sortGroups:j,edgeSort:P,treeOrientation:M="vertical",edgeType:N="curve",padding:D,paddingTop:T,tensionConfig:B,showParticles:C=!1,particleStyle:z,nodeStyle:$,edgeStyle:W,colorBy:_,colorScheme:H="category10",edgeColorBy:I="source",edgeOpacity:R=.5,colorByDepth:F=!1,nodeSize:Y=8,nodeSizeRange:X=[5,20],nodeLabel:G,showLabels:q=!0,size:V=nr,margin:U,className:Z,background:Q,enableHover:J=!0,tooltipContent:K,customHoverBehavior:ee,customClickBehavior:te,onObservation:ne,chartId:oe,onTopologyChange:re,annotations:ie,svgAnnotationRules:ae,legend:se,title:le,foregroundGraphics:ce,backgroundGraphics:ue,decay:de,pulse:he,staleness:ge,thresholds:ye}=n,fe=tr.has(c)?er:Ko,pe=Object.assign(Object.assign({},fe),U),me=V[0]-pe.left-pe.right,ve=V[1]-pe.top-pe.bottom,be=t(()=>Object.assign(Object.assign({},Bn),B),[B]),xe=t(()=>Object.assign(Object.assign({},Cn),z),[z]),we=t(()=>({chartType:c,nodeIDAccessor:y,sourceAccessor:f,targetAccessor:p,valueAccessor:m,childrenAccessor:v,hierarchySum:b,orientation:x,nodeAlign:w,nodePaddingRatio:k,nodeWidth:A,iterations:S,forceStrength:E,padAngle:L,groupWidth:O,sortGroups:j,edgeSort:P,treeOrientation:M,edgeType:N,padding:D,paddingTop:T,tensionConfig:be,showParticles:C,particleStyle:xe,nodeStyle:$,edgeStyle:W,nodeLabel:G,showLabels:q,colorBy:_,colorScheme:H,edgeColorBy:I,edgeOpacity:R,colorByDepth:F,nodeSize:Y,nodeSizeRange:X,decay:de,pulse:he,staleness:ge,thresholds:ye}),[c,y,f,p,m,v,b,x,w,k,A,S,E,L,O,j,P,M,N,D,T,be,C,xe,$,W,G,q,_,H,I,R,F,Y,X,de,he,ge,ye]),ke=o(null),Ae=o(0),Se=o(0),Ee=o(!0),Le=o(()=>{}),Oe=o(null);Oe.current||(Oe.current=new Fo(we));const[je,Pe]=r(null),[Me,Ne]=r(0),[De,Te]=r(0),[Be,Ce]=r(!1),ze=o(null),$e=o(new Map),We=o(0),_e=i(e=>{if("function"==typeof _)return _(e);if("string"==typeof _&&e.data){const t=e.data[_];if(void 0!==t){if(!$e.current.has(t+"")){const e=Array.isArray(H)?H:Ze;$e.current.set(t+"",e[We.current++%e.length])}return $e.current.get(t+"")}}if(!$e.current.has(e.id)){const t=Array.isArray(H)?H:Ze;$e.current.set(e.id,t[We.current++%t.length])}return $e.current.get(e.id)},[_,H]),He=i(e=>{if("function"==typeof I)return I(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===I&&n?_e(n):t?_e(t):"#999"},[I,_e]),Ie=i(e=>{if(!(null==z?void 0:z.colorBy))return He(e);const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;return"target"===xe.colorBy&&n?_e(n):t?_e(t):"#999"},[null==z?void 0:z.colorBy,xe.colorBy,_e,He]),Re="sankey"===c&&C||!!he,Fe=i(()=>{Ae.current&&!Re||Ae.current||(Ae.current=requestAnimationFrame(()=>Le.current()))},[Re]);a(()=>{var e;null===(e=Oe.current)||void 0===e||e.updateConfig(we),Ee.current=!0,Fe()},[we,Fe]);const Ye=i(()=>{const e=Oe.current;if(!e)return;e.runLayout([me,ve]),e.buildScene([me,ve]),Ee.current=!0;const t=Array.isArray(H)?H:Ze,n=Array.from(e.nodes.values());for(let e=0;n.length>e;e++){const o=n[e];$e.current.has(o.id)||$e.current.set(o.id,t[e%t.length])}if(We.current=n.length,Ne(e.layoutVersion),re){const{nodes:t,edges:n}=e.getLayoutData();re(t,n)}},[me,ve,re,H]),Xe=i(e=>{const t=Oe.current;t&&(t.ingestEdge(e)&&Ye(),Fe())},[Ye,Fe]),Ge=i(e=>{const t=Oe.current;if(!t)return;let n=!1;for(const o of e)t.ingestEdge(o)&&(n=!0);n&&Ye(),Fe()},[Ye,Fe]),qe=i(()=>{var e;null===(e=Oe.current)||void 0===e||e.clear(),$e.current.clear(),We.current=0,Ne(0),Pe(null),ze.current=null,Ee.current=!0,Fe()},[Fe]),Ve=i(()=>{const e=Oe.current;e&&(e.tension+=999,Ye(),Fe())},[Ye,Fe]);s(l,()=>({push:Xe,pushMany:Ge,clear:qe,getTopology:()=>{var e,t;return null!==(t=null===(e=Oe.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Oe.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Ve,getTension:()=>{var e,t;return null!==(t=null===(e=Oe.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[Xe,Ge,qe,Ve]);const Ue=["tree","cluster","treemap","circlepack","partition"].includes(c),Qe=Ue?h||(Array.isArray(d)?void 0:d):void 0;a(()=>{const e=Oe.current;if(e)if(Ue&&Qe)e.ingestHierarchy(Qe,[me,ve]),e.buildScene([me,ve]),Ee.current=!0,Fe();else{const t=u||[],n=Array.isArray(d)?d:[];if(0===t.length&&0===n.length)return;e.ingestBounded(t,n,[me,ve]),e.buildScene([me,ve]);const o=Array.isArray(H)?H:Ze,r=Array.from(e.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];$e.current.has(t.id)||$e.current.set(t.id,o[e%o.length])}We.current=r.length,Ee.current=!0,Fe()}},[u,d,h,Qe,Ue,me,ve,we,Fe,H]),a(()=>{g&&g.length>0&&Ge(g)},[]);const Je=i(e=>{if(ee&&ee(e),ne){const t=Date.now();ne(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:oe}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:oe})}},[ee,ne,oe]),Ke=i(e=>{if(te&&te(e),ne){const t=Date.now();ne(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:oe}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:oe})}},[te,ne,oe]),et=o(()=>{}),tt=o(()=>{});et.current=e=>{if(!J)return;const t=ke.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return void(ze.current&&(ze.current=null,Pe(null),Je&&Je(null),Fe()));const i=Oe.current;if(!i)return;const a=Xo(i.sceneNodes,i.sceneEdges,o,r);if(!a)return void(ze.current&&(ze.current=null,Pe(null),Je&&Je(null),Fe()));const s={type:a.type,data:a.datum,x:a.x,y:a.y};ze.current=s,Pe(s),Je&&Je(s),Fe()},tt.current=()=>{ze.current&&(ze.current=null,Pe(null),Je&&Je(null),Fe())};const nt=o(()=>{});nt.current=e=>{if(!te&&!ne)return;const t=ke.current;if(!t)return;const n=t.getBoundingClientRect(),o=e.clientX-n.left-pe.left,r=e.clientY-n.top-pe.top;if(0>o||o>me||0>r||r>ve)return;const i=Oe.current;if(!i)return;const a=Xo(i.sceneNodes,i.sceneEdges,o,r);Ke(a?{type:a.type,data:a.datum,x:a.x,y:a.y}:null)};const ot=i(e=>et.current(e),[]),rt=i(()=>tt.current(),[]),it=i(e=>nt.current(e),[]);Le.current=()=>{var e,t,n;Ae.current=0;const o=ke.current;if(!o)return;const r=o.getContext("2d");if(!r)return;const i=Oe.current;if(!i)return;const a=performance.now(),s=Se.current?Math.min((a-Se.current)/1e3,.1):.016;Se.current=a;const l=i.advanceTransition(a);(l||Ee.current)&&i.buildScene([me,ve]);const c="undefined"!=typeof window&&window.devicePixelRatio||1;o.width=V[0]*c,o.height=V[1]*c,o.style.width=V[0]+"px",o.style.height=V[1]+"px",r.scale(c,c),r.translate(pe.left,pe.top),r.clearRect(-pe.left,-pe.top,V[0],V[1]),Q&&(r.fillStyle=Q,r.fillRect(0,0,me,ve)),de&&i.applyDecay(),he&&i.applyPulse(a),ye&&i.applyThresholds(a),i.applyTopologyDiff(a);const u=null!==(e=null==ge?void 0:ge.threshold)&&void 0!==e?e:5e3,d=ge&&i.lastIngestTime>0&&a-i.lastIngestTime>u;if(d&&(r.globalAlpha=null!==(t=null==ge?void 0:ge.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const n of t)switch(n.type){case"bezier":Uo(e,n);break;case"line":Zo(e,n);break;case"ribbon":Qo(e,n);break;case"curved":Jo(e,n)}}(r,i.sceneEdges),function(e,t){var n,o,r;for(const i of t){if("rect"!==i.type)continue;const t=i;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r: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.restore())}}(r,i.sceneNodes),function(e,t){var n,o,r,i;for(const a of t){if("circle"!==a.type)continue;const t=a;if(t.r>0){if(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),t._pulseIntensity&&t._pulseIntensity>0){const n=null!==(i=t._pulseGlowRadius)&&void 0!==i?i:4,o=t.r+n*t._pulseIntensity;e.beginPath(),e.arc(t.cx,t.cy,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.restore()}}}(r,i.sceneNodes),function(e,t){var n,o,r;for(const i of t){if("arc"!==i.type)continue;const t=i;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),t.style.fill&&(e.fillStyle=t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(r,i.sceneNodes),C&&i.particlePool&&!d){const e=Array.from(i.edges.values());if(e.length>0){!function(e,t,n,o){var r,i;const a=null!==(r=o.spawnRate)&&void 0!==r?r:Cn.spawnRate,s=null!==(i=o.maxPerEdge)&&void 0!==i?i:Cn.maxPerEdge;for(let o=0;t.length>o;o++){const r=t[o];if(!r.bezier)continue;if(e.countForEdge(o)>=s)continue;const i=r.value*a*n*(r.bezier.circular?.3:1),l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(o)<s;t++)e.spawn(o)}}(i.particlePool,e,s,xe);const t=.5*(null!==(n=xe.speedMultiplier)&&void 0!==n?n:1);let o;if(xe.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);o=e.map(e=>.3+(e.value||1)/t*1.7)}i.particlePool.step(s,t,e,o),function(e,t,n,o,r){var i,a;const s=null!==(i=o.radius)&&void 0!==i?i:Cn.radius,l=null!==(a=o.opacity)&&void 0!==a?a:Cn.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const a=t.particles[i];if(!a.active)continue;const l=n[a.edgeIndex];if(l){if("function"==typeof o.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?o.color(l,t):"#666"}else e.fillStyle=o.color&&"inherit"!==o.color?o.color:r(l);e.beginPath(),e.arc(a.x,a.y,s,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(r,i.particlePool,e,xe,Ie)}}d&&(r.globalAlpha=1);const h=Ee.current;Ee.current=!1,(h||l)&&Te(e=>e+1),(Re||l||i.hasActivePulses||i.hasActiveThresholds||i.hasActiveTopologyDiff)&&(Ae.current=requestAnimationFrame(()=>Le.current()))},a(()=>(Fe(),()=>{Ae.current&&cancelAnimationFrame(Ae.current)}),[Fe]),a(()=>{Ee.current=!0,Fe()},[c,me,ve,Q,Fe]),a(()=>{if(!ge)return;const e=setInterval(()=>{var e;const t=Oe.current;if(!t||0===t.lastIngestTime)return;const n="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=ge.threshold)&&void 0!==e?e:5e3,r=n-t.lastIngestTime>o;r!==Be&&(Ce(r),Ee.current=!0,Fe())},1e3);return()=>clearInterval(e)},[ge,Be,Fe]);const at=J&&je?e.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:pe.left+je.x,top:pe.top+je.y,transform:`translate(${je.x>.6*me?"calc(-100% - 12px)":"12px"}, ${.3*ve>je.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},K?K(je):e.createElement(rr,{data:je})):null,st=Oe.current;return e.createElement("div",{className:"stream-network-frame"+(Z?" "+Z:""),role:"img","aria-label":"string"==typeof le?le:"Network chart",style:{position:"relative",width:V[0],height:V[1]},onMouseMove:J?ot:void 0,onMouseLeave:J?rt:void 0,onClick:te||ne?it:void 0},ue&&e.createElement("svg",{style:{position:"absolute",top:0,left:0,width:V[0],height:V[1],pointerEvents:"none"}},e.createElement("g",{transform:`translate(${pe.left},${pe.top})`},ue)),e.createElement("canvas",{ref:ke,style:{position:"absolute",top:0,left:0}}),e.createElement(Vo,{width:me,height:ve,totalWidth:V[0],totalHeight:V[1],margin:pe,labels:(null==st?void 0:st.labels)||[],title:le,legend:se,foregroundGraphics:ce,annotations:ie,svgAnnotationRules:ae,annotationFrame:De}),at,(null==ge?void 0:ge.showBadge)&&e.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===ge.badgePosition?{top:4,left:4}:"bottom-left"===ge.badgePosition?{bottom:4,left:4}:"bottom-right"===ge.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{background:Be?"#dc3545":"#28a745",color:"white",fontSize:10,fontWeight:700,padding:"2px 6px",borderRadius:3,letterSpacing:"0.05em",zIndex:3,pointerEvents:"none"})},Be?"STALE":"LIVE"))});function ar(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLegend:n.showLegend,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:a,edges:s,margin:l,className:c,nodeIDAccessor:u="id",sourceAccessor:d="source",targetAccessor:h="target",nodeLabel:g,colorBy:y,colorScheme:f="category10",nodeSize:p=8,nodeSizeRange:m=[5,20],edgeWidth:v=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:w=300,forceStrength:k=.1,tooltip:A,frameProps:S={},onObservation:E,chartId:L}=n,O=r.width,j=r.height,P=r.enableHover,M=r.showLegend,N=null!==(o=r.showLabels)&&void 0!==o&&o,D=r.title,T=a||[],B=s||[],C=vt(T,y,f),z=t(()=>e=>{const t={};return t.fill=y?Je(e.data||e,y,C):pt,"number"==typeof p&&(t.r=p),t},[y,C,p]),$=t(()=>e=>({stroke:b,strokeWidth:"number"==typeof v?v:"function"==typeof v?v(e):e[v]||1,opacity:x}),[v,b,x]),W=t(()=>{if(N&&g)return"function"==typeof g?g:e=>e[g]},[N,g]),{legend:_,margin:H}=wt({data:T,colorBy:y,colorScale:C,showLegend:M,userMargin:l,defaults:r.marginDefaults}),I=i(e=>{if(!E)return;const t=Date.now();E(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"ForceDirectedGraph",chartId:L}:{type:"hover-end",timestamp:t,chartType:"ForceDirectedGraph",chartId:L})},[E,L]),R=Wt({componentName:"ForceDirectedGraph",nodes:a,edges:s,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:u}});return R?e.createElement(Bt,{componentName:"ForceDirectedGraph",message:R,width:O,height:j}):e.createElement(ir,Object.assign({chartType:"force",nodes:T,edges:B,size:[O,j],margin:H,nodeIDAccessor:u,sourceAccessor:d,targetAccessor:h,iterations:w,forceStrength:k,nodeStyle:z,edgeStyle:$,colorBy:y,colorScheme:f,nodeSize:p,nodeSizeRange:m,nodeLabel:W,showLabels:N,enableHover:P,tooltipContent:A?e=>jt(A)(e.data):void 0,customHoverBehavior:E?I:void 0,legend:_,className:c,title:D},S))}function sr(e,t){if(!e)return[];const n=[],o=e=>{n.push(e);const r="function"==typeof t?t(e):e[t];r&&Array.isArray(r)&&r.forEach(o)};return o(e),n}function lr(e,t,n,o){if(e&&e.length>0)return e;const r=new Set;return t.forEach(e=>{const t="function"==typeof n?n(e):e[n],i="function"==typeof o?o(e):e[o];r.add(t),r.add(i)}),Array.from(r).map(e=>({id:e}))}function cr(e){return"function"==typeof e?e:t=>t[e]||1}function ur({edgeColorBy:e,colorBy:t,colorScale:n,nodeStyleFn:o,edgeOpacity:r,baseStyle:i={}}){return a=>{const s=Object.assign({fillOpacity:r},i);if("function"==typeof e)s.fill=e(a);else if("source"===e){const e="object"==typeof a.source?a.source:null;t&&e?s.fill=Je(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else if("target"===e){const e="object"==typeof a.target?a.target:null;t&&e?s.fill=Je(e.data||e,t,n):e&&(s.fill=o(e,e.index).fill)}else"gradient"===e&&(s.fill="#999",s.fillOpacity=.7*r);return s}}function dr(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{nodes:a,edges:s,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:f="category10",edgeColorBy:p="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:w=.5,tooltip:k,frameProps:A={},onObservation:S,chartId:E}=n,L=r.width,O=r.height,j=r.enableHover,P=null===(o=r.showLabels)||void 0===o||o,M=r.title,N=s||[],D=t(()=>lr(a,N,u,d),[a,N,u,d]),T=vt(D,y,f),B=t(()=>(e,t)=>{var n,o;const r={stroke:"black",strokeWidth:1};if(y)r.fill=Je(e.data||e,y,T);else{const i=Array.isArray(f)?f:Ue[f]||Ze,a=Array.isArray(i)?i:Ze,s=null!==(o=null!==(n=e.index)&&void 0!==n?n:t)&&void 0!==o?o:0;r.fill=a[s%a.length]}return r},[y,T,f]),C=t(()=>ur({edgeColorBy:p,colorBy:y,colorScale:T,nodeStyleFn:B,edgeOpacity:w,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:w}}),[p,y,T,B,w]),z=t(()=>{if(!P)return;const e=x||g;return"function"==typeof e?e:t=>t[e]},[P,x,g]),$=Object.assign(Object.assign({},r.marginDefaults),l),W=i(e=>{if(!S)return;const t=Date.now();S(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"ChordDiagram",chartId:E}:{type:"hover-end",timestamp:t,chartType:"ChordDiagram",chartId:E})},[S,E]),_=Wt({componentName:"ChordDiagram",edges:s,edgesRequired:!0});return _?e.createElement(Bt,{componentName:"ChordDiagram",message:_,width:L,height:O}):e.createElement(ir,Object.assign({chartType:"chord",nodes:D,edges:N,size:[L,O],margin:$,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:B,edgeStyle:C,colorBy:y,colorScheme:f,edgeColorBy:p,edgeOpacity:w,nodeLabel:z,showLabels:P,enableHover:j,tooltipContent:k?e=>jt(k)(e.data):void 0,customHoverBehavior:S?W:void 0,className:c,title:M},A))}function hr(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:800,height:600}),{nodes:a,edges:s,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:y,colorScheme:f="category10",edgeColorBy:p="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:w,edgeOpacity:k=.5,edgeSort:A,tooltip:S,frameProps:E={},onObservation:L,chartId:O}=n,j=r.width,P=r.height,M=r.enableHover,N=null===(o=r.showLabels)||void 0===o||o,D=r.title,T=s||[],B=t(()=>lr(a,T,u,d),[a,T,u,d]),C=vt(B,y,f),z=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=y?Je(e.data||e,y,C):"#4d430c",t},[y,C]),$=t(()=>ur({edgeColorBy:p,colorBy:y,colorScale:C,nodeStyleFn:z,edgeOpacity:k,baseStyle:{stroke:"none",strokeWidth:0}}),[p,y,C,z,k]),W=t(()=>{if(!N)return;const e=w||g;return"function"==typeof e?e:t=>t[e]},[N,w,g]),_=Object.assign(Object.assign({},r.marginDefaults),l),H=ft(e=>e.pushObservation),I=i(e=>{const t=Date.now();if(e){const n={type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"SankeyDiagram",chartId:O};L&&L(n),H&&H(n)}else{const e={type:"hover-end",timestamp:t,chartType:"SankeyDiagram",chartId:O};L&&L(e),H&&H(e)}},[L,O,H]),R=i(e=>{const t=Date.now();if(e){const n={type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"SankeyDiagram",chartId:O};L&&L(n),H&&H(n)}else{const e={type:"click-end",timestamp:t,chartType:"SankeyDiagram",chartId:O};L&&L(e),H&&H(e)}},[L,O,H]),F=Wt({componentName:"SankeyDiagram",edges:s,edgesRequired:!0});return F?e.createElement(Bt,{componentName:"SankeyDiagram",message:F,width:j,height:P}):e.createElement(ir,Object.assign({chartType:"sankey",nodes:B,edges:T,size:[j,P],margin:_,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:z,edgeStyle:$,colorBy:y,colorScheme:f,edgeColorBy:p,edgeOpacity:k,edgeSort:A,nodeLabel:W,showLabels:N,enableHover:M,tooltipContent:S?e=>jt(S)(e.data):void 0,customHoverBehavior:L?I:void 0,customClickBehavior:L?R:void 0,className:c,title:D},E))}function gr(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{data:a,margin:s,className:l,layout:c="tree",orientation:u="vertical",childrenAccessor:d="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:y,colorScheme:f="category10",colorByDepth:p=!1,edgeStyle:m="curve",nodeLabel:v,nodeSize:b=5,tooltip:x,frameProps:w={},onObservation:k,chartId:A}=n,S=r.width,E=r.height,L=r.enableHover,O=null===(o=r.showLabels)||void 0===o||o,j=r.title,P=t(()=>sr(a,d),[a,d]),M=t(()=>{if(!p&&y&&"function"!=typeof y)return Ke(P,y,f)},[P,y,p,f]),N=t(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=p?Qe[(e.depth||0)%Qe.length]:y?Je(e.data||e,y,M):pt,t},[y,p,M]),D=t(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),T=t(()=>{if("treemap"===c||"circlepack"===c||"partition"===c)return cr(h)},[c,h]),B=Object.assign(Object.assign({},r.marginDefaults),s),C=i(e=>{if(!k)return;const t=Date.now();k(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"TreeDiagram",chartId:A}:{type:"hover-end",timestamp:t,chartType:"TreeDiagram",chartId:A})},[k,A]),z=$t({componentName:"TreeDiagram",data:a});return z?e.createElement(Bt,{componentName:"TreeDiagram",message:z,width:S,height:E}):e.createElement(ir,Object.assign({chartType:c,data:a,size:[S,E],margin:B,nodeIDAccessor:g,childrenAccessor:d,hierarchySum:T,treeOrientation:u,edgeType:m,nodeStyle:N,edgeStyle:D,colorBy:y,colorScheme:f,colorByDepth:p,nodeSize:b,nodeLabel:O?v||g:void 0,showLabels:O,enableHover:L,tooltipContent:x?e=>jt(x)(e.data):void 0,customHoverBehavior:k?C:void 0,className:l,title:j},w))}function yr(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title,linkedHover:n.linkedHover},{width:600,height:600}),{data:a,margin:s,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,labelMode:f="leaf",nodeLabel:p,padding:m=4,paddingTop:v,tooltip:b,frameProps:x={},selection:w,linkedHover:k,onObservation:A,chartId:S}=n,E=r.width,L=r.height,O=r.enableHover,j=null===(o=r.showLabels)||void 0===o||o,P=r.title,{activeSelectionHook:M,customHoverBehavior:N}=xt({selection:w,linkedHover:k,fallbackFields:h?["string"==typeof h?h:""]:[],onObservation:A,chartType:"Treemap",chartId:S}),D=i(e=>{if(!e)return N(null);const t=e.data||e;N({data:(null==t?void 0:t.data)||t})},[N]),T=t(()=>sr(a,c),[a,c]),B=t(()=>{if(y)return;if(!h||"function"==typeof h)return;const e=h;return Ke(T.filter(t=>null!=t[e]),e,g)},[T,h,y,g]),C=t(()=>e=>{const t={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return t.fill=y?Qe[(e.depth||0)%Qe.length]:h?Je(e.data||e,h,B):pt,t},[h,y,B]),z=t(()=>M?e=>{var t,n;const o=Object.assign({},C(e));return M.isActive&&(M.predicate(e.data||e)?(null==w?void 0:w.selectedStyle)&&Object.assign(o,w.selectedStyle):(o.fillOpacity=null!==(t=null==w?void 0:w.unselectedOpacity)&&void 0!==t?t:.2,o.strokeOpacity=null!==(n=null==w?void 0:w.unselectedOpacity)&&void 0!==n?n:.2,(null==w?void 0:w.unselectedStyle)&&Object.assign(o,w.unselectedStyle))),o}:C,[C,M,w]),$=t(()=>cr(u),[u]),W=void 0!==v?v:j&&"parent"===f?18:void 0,_=Object.assign(Object.assign({},r.marginDefaults),s),H=$t({componentName:"Treemap",data:a});return H?e.createElement(Bt,{componentName:"Treemap",message:H,width:E,height:L}):e.createElement(ir,Object.assign({chartType:"treemap",data:a,size:[E,L],margin:_,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:$,padding:m,paddingTop:W,nodeStyle:z,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:j?p||d:void 0,showLabels:j,enableHover:O,tooltipContent:b?e=>jt(b)(e.data):void 0},(k||A)&&{customHoverBehavior:D},{className:l,title:P},x))}function fr(n){var o;const r=At(n.mode,{width:n.width,height:n.height,enableHover:n.enableHover,showLabels:n.showLabels,title:n.title},{width:600,height:600}),{data:a,margin:s,className:l,childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g="category10",colorByDepth:y=!1,nodeLabel:f,circleOpacity:p=.7,padding:m=4,tooltip:v,frameProps:b={},onObservation:x,chartId:w}=n,k=r.width,A=r.height,S=r.enableHover,E=null===(o=r.showLabels)||void 0===o||o,L=r.title,O=t(()=>sr(a,c),[a,c]),j=t(()=>{if(!y&&h&&"function"!=typeof h)return Ke(O,h,g)},[O,h,y,g]),P=t(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:p};return t.fill=y?Qe[(e.depth||0)%Qe.length]:h?Je(e.data||e,h,j):pt,t},[h,y,j,p]),M=t(()=>cr(u),[u]),N=Object.assign(Object.assign({},r.marginDefaults),s),D=i(e=>{if(!x)return;const t=Date.now();x(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"CirclePack",chartId:w}:{type:"hover-end",timestamp:t,chartType:"CirclePack",chartId:w})},[x,w]),T=$t({componentName:"CirclePack",data:a});return T?e.createElement(Bt,{componentName:"CirclePack",message:T,width:k,height:A}):e.createElement(ir,Object.assign({chartType:"circlepack",data:a,size:[k,A],margin:N,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:M,padding:m,nodeStyle:P,colorBy:h,colorScheme:g,colorByDepth:y,nodeLabel:E?f||d:void 0,showLabels:E,enableHover:S,tooltipContent:v?e=>jt(v)(e.data):void 0,customHoverBehavior:x?D:void 0,className:l,title:L},b))}ir.displayName="StreamNetworkFrame",ar.displayName="ForceDirectedGraph",dr.displayName="ChordDiagram",hr.displayName="SankeyDiagram",gr.displayName="TreeDiagram",yr.displayName="Treemap",fr.displayName="CirclePack";const pr=n(function(t,n){var r,a,l,c;const u=At(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,stroke:A="#007bff",strokeWidth:S=2,strokeDasharray:E,background:L,tooltipContent:O,tooltip:j,onHover:P,annotations:M,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:T,decay:B,pulse:C,staleness:z,transition:$,linkedHover:W,onObservation:_,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=O?O:j,G=o(null),{customHoverBehavior:q}=xt({linkedHover:W,unwrapData:!0,onObservation:_,chartType:"RealtimeLineChart",chartId:H}),V=i(e=>{P&&P(e),q(e)},[P,q]);return s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Ve,{ref:G,chartType:"line",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,lineStyle:{stroke:A,strokeWidth:S,strokeDasharray:E},showAxes:I,background:L,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:M,svgAnnotationRules:N,tickFormatTime:D,tickFormatValue:T,decay:B,pulse:C,staleness:z,transition:$})});pr.displayName="RealtimeLineChart";const mr=n(function(t,n){var r,a,l,c;const u=At(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{binSize:d,size:h,margin:g,className:y,arrowOfTime:f="right",windowMode:p="sliding",windowSize:m=200,data:v,timeAccessor:b,valueAccessor:x,timeExtent:w,valueExtent:k,extentPadding:A,categoryAccessor:S,colors:E,fill:L,stroke:O,strokeWidth:j,gap:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:W,decay:_,pulse:H,staleness:I,transition:R,onObservation:F,chartId:Y}=t,X=u.showAxes,G=u.enableHover,q=null!=g?g:u.marginDefaults,V=null!=h?h:[u.width,u.height],U=null!=N?N:D,Z=o(null),{customHoverBehavior:Q}=xt({linkedHover:W,unwrapData:!0,onObservation:F,chartType:"RealtimeTemporalHistogram",chartId:Y}),J=i(e=>{T&&T(e),Q(e)},[T,Q]);s(n,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const K={};return null!=L&&(K.fill=L),null!=O&&(K.stroke=O),null!=j&&(K.strokeWidth=j),null!=P&&(K.gap=P),e.createElement(Ve,{ref:Z,chartType:"bar",runtimeMode:"streaming",size:V,margin:q,className:y,arrowOfTime:f,windowMode:p,windowSize:m,data:v,timeAccessor:b,valueAccessor:x,xExtent:w,yExtent:k,extentPadding:A,binSize:d,categoryAccessor:S,barColors:E,barStyle:K,showAxes:X,background:M,hoverAnnotation:G,tooltipContent:U,customHoverBehavior:J,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,decay:_,pulse:H,staleness:I,transition:R})});mr.displayName="RealtimeTemporalHistogram";const vr=mr,br=n(function(t,n){var r,a,l,c;const u=At(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,categoryAccessor:A,colors:S,radius:E,fill:L,opacity:O,stroke:j,strokeWidth:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:W,onObservation:_,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=N?N:D,G=o(null),{customHoverBehavior:q}=xt({linkedHover:W,unwrapData:!0,onObservation:_,chartType:"RealtimeSwarmChart",chartId:H}),V=i(e=>{T&&T(e),q(e)},[T,q]);s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const U={};return null!=E&&(U.radius=E),null!=L&&(U.fill=L),null!=O&&(U.opacity=O),null!=j&&(U.stroke=j),null!=P&&(U.strokeWidth=P),e.createElement(Ve,{ref:G,chartType:"swarm",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,categoryAccessor:A,barColors:S,swarmStyle:U,showAxes:I,background:M,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$})});br.displayName="RealtimeSwarmChart";const xr=n(function(t,n){var r,a,l,c;const u=At(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,timeExtent:x,valueExtent:w,extentPadding:k,positiveColor:A,negativeColor:S,connectorStroke:E,connectorWidth:L,gap:O,stroke:j,strokeWidth:P,background:M,tooltipContent:N,tooltip:D,onHover:T,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:W,onObservation:_,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=N?N:D,G=o(null),{customHoverBehavior:q}=xt({linkedHover:W,unwrapData:!0,onObservation:_,chartType:"RealtimeWaterfallChart",chartId:H}),V=i(e=>{T&&T(e),q(e)},[T,q]);s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const U={};return null!=A&&(U.positiveColor=A),null!=S&&(U.negativeColor=S),null!=E&&(U.connectorStroke=E),null!=L&&(U.connectorWidth=L),null!=O&&(U.gap=O),null!=j&&(U.stroke=j),null!=P&&(U.strokeWidth=P),e.createElement(Ve,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,xExtent:x,yExtent:w,extentPadding:k,waterfallStyle:U,showAxes:I,background:M,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:B,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$})});xr.displayName="RealtimeWaterfallChart";const wr=n(function(t,n){var r,a,l,c;const u=At(t.mode,{width:null!==(a=null===(r=t.size)||void 0===r?void 0:r[0])&&void 0!==a?a:t.width,height:null!==(c=null===(l=t.size)||void 0===l?void 0:l[1])&&void 0!==c?c:t.height,enableHover:null!=t.enableHover?!!t.enableHover:void 0}),{size:d,margin:h,className:g,arrowOfTime:y="right",windowMode:f="sliding",windowSize:p=200,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,timeExtent:w,valueExtent:k,extentPadding:A,heatmapXBins:S=20,heatmapYBins:E=20,aggregation:L="count",background:O,tooltipContent:j,tooltip:P,onHover:M,annotations:N,svgAnnotationRules:D,tickFormatTime:T,tickFormatValue:B,decay:C,pulse:z,staleness:$,linkedHover:W,onObservation:_,chartId:H}=t,I=u.showAxes,R=u.enableHover,F=null!=h?h:u.marginDefaults,Y=null!=d?d:[u.width,u.height],X=null!=j?j:P,G=o(null),{customHoverBehavior:q}=xt({linkedHover:W,unwrapData:!0,onObservation:_,chartType:"RealtimeHeatmap",chartId:H}),V=i(e=>{M&&M(e),q(e)},[M,q]);return s(n,()=>({push:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=G.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=G.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=G.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),e.createElement(Ve,{ref:G,chartType:"heatmap",runtimeMode:"streaming",size:Y,margin:F,className:g,arrowOfTime:y,windowMode:f,windowSize:p,data:m,timeAccessor:v,valueAccessor:b,categoryAccessor:x,xExtent:w,yExtent:k,extentPadding:A,heatmapXBins:S,heatmapYBins:E,heatmapAggregation:L,showAxes:I,background:O,hoverAnnotation:R,tooltipContent:X,customHoverBehavior:V,annotations:N,svgAnnotationRules:D,tickFormatTime:T,tickFormatValue:B,decay:C,pulse:z,staleness:$})});wr.displayName="RealtimeHeatmap";let[kr]=ot(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));const Ar={mode:"light",colors:{primary:"#00a2ce",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",background:"transparent",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},Sr={mode:"dark",colors:{primary:"#4fc3f7",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",background:"#1a1a2e",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:10}},[Er,Lr]=ot(e=>({theme:Ar,setTheme(t){e(e=>"light"===t?{theme:Ar}:"dark"===t?{theme:Sr}:{theme:Object.assign(Object.assign(Object.assign({},e.theme),t),{colors:Object.assign(Object.assign({},e.theme.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.theme.typography),t.typography||{})})})}}));function Or({theme:t}){const n=Lr(e=>e.setTheme);return e.useEffect(()=>{void 0!==t&&n(t)},[t,n]),null}function jr({children:t}){const n=Lr(e=>e.theme);return e.createElement("div",{style:{position:"relative","--semiotic-bg":n.colors.background,"--semiotic-text":n.colors.text,"--semiotic-text-secondary":n.colors.textSecondary,"--semiotic-grid":n.colors.grid,"--semiotic-border":n.colors.border,"--semiotic-primary":n.colors.primary,"--semiotic-font-family":n.typography.fontFamily}},t)}function Pr({theme:t,children:n}){return e.createElement(Er,null,e.createElement(Or,{theme:t}),e.createElement(jr,null,n))}function Mr(){return Lr(e=>e.theme)}function Nr(e,t,n,o){return new(n||(n=Promise))(function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){e.done?r(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(a,s)}l((o=o.apply(e,t||[])).next())})}function Dr(e,t){return Nr(this,void 0,void 0,function*(){const{format:n="svg",filename:o="chart",scale:r=2,background:i="white"}=t||{},a=e.querySelector("svg");if(!a)throw Error("No SVG element found in the container");const s=a.cloneNode(!0),l=a.getBoundingClientRect();if(s.getAttribute("width")||s.setAttribute("width",l.width+""),s.getAttribute("height")||s.setAttribute("height",l.height+""),s.getAttribute("xmlns")||s.setAttribute("xmlns","http://www.w3.org/2000/svg"),Tr(a,s),"svg"===n){const e=(new XMLSerializer).serializeToString(s);Br(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),o+".svg")}else{const e=l.width*r,t=l.height*r,n=(new XMLSerializer).serializeToString(s),a=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(a),u=new Image;u.width=l.width,u.height=l.height,yield new Promise((n,a)=>{u.onload=()=>{const s=document.createElement("canvas");s.width=e,s.height=t;const l=s.getContext("2d");l.fillStyle=i,l.fillRect(0,0,e,t),l.scale(r,r),l.drawImage(u,0,0),s.toBlob(e=>{e?(Br(e,o+".png"),n()):a(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(c)},u.onerror=()=>{URL.revokeObjectURL(c),a(Error("Failed to load SVG image"))},u.src=c})}})}function Tr(e,t){var n;const o=e.children,r=t.children,i=window.getComputedStyle(e),a=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of a){const o=i.getPropertyValue(e);o&&"none"!==o&&""!==o&&(null===(n=t.style)||void 0===n||n.setProperty(e,o))}for(let e=0;Math.min(o.length,r.length)>e;e++)Tr(o[e],r[e])}function Br(e,t){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(n)}"function"==typeof SuppressedError&&SuppressedError;const Cr={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["function","object"]},frameProps:{type:"object"}},zr={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},$r={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"}},Wr=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],_r=["vertical","horizontal"],Hr={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wr},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wr},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"}})},StackedAreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:Wr},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),zr),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},sort:{type:["boolean","string","function"]},barPadding:{type:"number"}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},normalize:{type:"boolean"},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},barPadding:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},Cr),$r),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:_r},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Cr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},Cr),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},slicePadding:{type:"number"}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Cr),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Cr),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:_r},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},Cr),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Cr),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Cr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},Cr),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}}};function Ir(e,t){return(Array.isArray(t)?t:[t]).includes(Array.isArray(e)?"array":typeof e)}function Rr(e,t){const n=[],o=Hr[e];if(!o)return{valid:!1,errors:[`Unknown component "${e}". Valid components: ${Object.keys(Hr).join(", ")}`]};for(const r of o.required)null==t[r]&&n.push(`"${r}" is required for ${e}.`);for(const[e,r]of Object.entries(t)){if(null==r)continue;const t=o.props[e];if(t){if(!Ir(r,t.type)){const o=Array.isArray(t.type)?t.type.join(" | "):t.type;n.push(`"${e}" should be ${o}, got ${Array.isArray(r)?"array":typeof r}.`);continue}t.enum&&"string"==typeof r&&!t.enum.includes(r)&&n.push(`"${e}" value "${r}" is not valid. Expected one of: ${t.enum.join(", ")}.`)}}const r=new Set(Object.keys(o.props));for(const o of Object.keys(t))void 0!==t[o]&&(r.has(o)||n.push(`Unknown prop "${o}" for ${e}. Check for typos.`));if("array"===o.dataShape){const r=t.data,i={};for(const e of o.dataAccessors){const n=t[e];"string"==typeof n&&(i[e]=n)}const a=zt({componentName:e,data:r,accessors:Object.keys(i).length>0?i:void 0});a&&n.push(a)}else if("object"===o.dataShape){const o=$t({componentName:e,data:t.data});o&&n.push(o)}else if("network"===o.dataShape){const r=Wt({componentName:e,nodes:t.nodes,edges:t.edges,nodesRequired:o.required.includes("nodes"),edgesRequired:o.required.includes("edges")});r&&n.push(r)}return{valid:0===n.length,errors:n}}const Fr=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),Yr=new Set(["data","nodes","edges"]),Xr="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function Gr(e,t,n){if(!Hr[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Hr).join(", ")}`);const o=!1!==(null==n?void 0:n.includeData),r={};for(const[e,n]of Object.entries(t))null!=n&&(Fr.has(e)||!o&&Yr.has(e)||"function"!=typeof n&&((null==n?void 0:n.$$typeof)||(r[e]=Xr(n))));return Object.assign({component:e,props:r,version:"1",createdAt:(new Date).toISOString()},(null==n?void 0:n.selections)?{selections:n.selections}:{})}function qr(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!Hr[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:Xr(e.props)}}function Vr(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ur(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const n=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(escape(atob(n)));return JSON.parse(o)}function Zr(e){return Nr(this,arguments,void 0,function*(e,t="json"){const n="jsx"===t?Qr(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(n)})}function Qr(e){const{component:t,props:n}=e,o=["<"+t];for(const[e,t]of Object.entries(n))if("string"==typeof t)o.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)o.push(" "+e);else if("boolean"==typeof t&&!1===t)o.push(` ${e}={false}`);else if("number"==typeof t)o.push(` ${e}={${t}}`);else{const n=JSON.stringify(t);o.push(80>n.length?` ${e}={${n}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return o.push("/>"),o.join("\n")}class Jr extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.createElement(Bt,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}const Kr={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function ei({height:t}){return e.createElement("div",{style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function ti({error:t}){return e.createElement("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"}},e.createElement("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5}},t))}const ni=e.forwardRef(function({title:t,subtitle:n,children:o,width:r="100%",height:i=400,actions:a,chartConfig:s,controls:l,loading:c=!1,error:u,errorBoundary:d=!1,status:h,detailsPanel:g,className:y,style:f},p){const m=e.useRef(null),v=e.useRef(null),[b,x]=e.useState(!1),w=!1!==(null==a?void 0:a.export)&&void 0!==(null==a?void 0:a.export),k=!1!==(null==a?void 0:a.fullscreen)&&void 0!==(null==a?void 0:a.fullscreen),A=!1!==(null==a?void 0:a.copyConfig)&&void 0!==(null==a?void 0:a.copyConfig)&&s,S="object"==typeof(null==a?void 0:a.export)?a.export:{},E="object"==typeof(null==a?void 0:a.copyConfig)?a.copyConfig.format:"json",L=e.useCallback(e=>Nr(this,void 0,void 0,function*(){v.current&&(yield Dr(v.current,Object.assign(Object.assign({},S),e)))}),[S]),O=e.useCallback(()=>{m.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):m.current.requestFullscreen().catch(()=>{}))},[]),j=e.useCallback(e=>Nr(this,void 0,void 0,function*(){s&&(yield Zr(s,e||E||"json"))}),[s,E]);e.useEffect(()=>{const e=()=>{x(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),e.useImperativeHandle(p,()=>({export:L,toggleFullscreen:O,copyConfig:j,element:m.current}),[L,O,j]);const P=t||n||l||w||k||A||h,M=c?e.createElement(ei,{height:i}):u?e.createElement(ti,{error:u}):d?e.createElement(Jr,null,o):o;return e.createElement(e.Fragment,null,e.createElement("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.createElement("div",{ref:m,className:"semiotic-chart-container"+(y?" "+y:""),style:Object.assign(Object.assign({width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:8,overflow:"hidden",background:"var(--semiotic-bg, #fff)",position:"relative"},b?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),f)},P&&e.createElement("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}},e.createElement("div",{className:"semiotic-chart-title-area"},t&&e.createElement("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"}},t),n&&e.createElement("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0}},n)),e.createElement("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4}},l,w&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>L(),title:"Export chart",style:oi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.createElement("path",{d:"M2 12h10"}))),k&&e.createElement("button",{className:"semiotic-chart-action",onClick:O,title:b?"Exit fullscreen":"Fullscreen",style:oi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b?e.createElement(e.Fragment,null,e.createElement("path",{d:"M9 1v4h4"}),e.createElement("path",{d:"M5 13V9H1"}),e.createElement("path",{d:"M13 5H9V1"}),e.createElement("path",{d:"M1 9h4v4"})):e.createElement(e.Fragment,null,e.createElement("path",{d:"M1 5V1h4"}),e.createElement("path",{d:"M13 9v4H9"}),e.createElement("path",{d:"M9 1h4v4"}),e.createElement("path",{d:"M5 13H1V9"})))),A&&e.createElement("button",{className:"semiotic-chart-action",onClick:()=>j(),title:"Copy config",style:oi},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.createElement("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"}))),h&&e.createElement("div",{className:"semiotic-chart-status",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Kr[h].bg,color:Kr[h].color,lineHeight:"18px"}},h))),e.createElement("div",{className:"semiotic-chart-body",ref:v,style:Object.assign({position:"relative",overflow:"hidden"},b?{flex:1}:{height:i})},M,g)))}),oi={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function ri({children:t,position:n="right",size:s=300,trigger:l="click",chartId:c,observation:u,dismissOnEmpty:d=!0,showClose:h=!0,onToggle:g,className:y,style:f}){const[p,m]=r(null),[v,b]=r(null),[x,w]=r(!1),[k,A]=r(!1),S=o(null),E=o(),L="click"===l?["click","click-end"]:["hover","hover-end"],{latest:O}=Xt({types:L,chartId:c,limit:1}),j=void 0!==u?u:O;a(()=>{if(j)if("click"===j.type||"hover"===j.type){const e=j;m(e.datum),b(e),x||(w(!0),A(!0),clearTimeout(E.current),E.current=setTimeout(()=>A(!1),200))}else!d||"click-end"!==j.type&&"hover-end"!==j.type||P()},[j]),a(()=>{null==g||g(x)},[x,g]);const P=i(()=>{A(!0),w(!1),clearTimeout(E.current),E.current=setTimeout(()=>{A(!1),m(null),b(null)},200)},[]);if(a(()=>()=>clearTimeout(E.current),[]),!p&&!k)return null;const M=p&&v?t(p,v):null;if(null===M&&!k)return null;const N=function(e,t,n,o){const r={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:o?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},r),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:n?"translateX(0)":`translateX(${t}px)`,opacity:n?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:n?"translateY(0)":`translateY(${t}px)`,opacity:n?1:0}:{top:"50%",left:"50%",transform:n?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:n?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,s,x,k);return e.createElement("div",{ref:S,className:`semiotic-details-panel semiotic-details-${n}${y?" "+y:""}`,style:Object.assign(Object.assign({},N),f)},h&&e.createElement("button",{className:"semiotic-details-close",onClick:P,"aria-label":"Close details",style:ii},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"},e.createElement("path",{d:"M2 2l8 8M10 2l-8 8"}))),e.createElement("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1}},M))}const ii={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function ai(e){const t={};for(const[n,o]of e){const e=[];for(const[,t]of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:Array.from(o.values)}:{type:"interval",range:o.range};e.push({clientId:t.clientId,type:t.type,fields:n})}t[n]={name:o.name,resolution:o.resolution,clauses:e}}return t}function si(e){const t=new Map;for(const[n,o]of Object.entries(e)){const e=new Map;for(const t of o.clauses){const n={};for(const[e,o]of Object.entries(t.fields))n[e]="point"===o.type?{type:"point",values:new Set(o.values)}:{type:"interval",range:o.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:n})}t.set(n,{name:o.name,resolution:o.resolution,clauses:e})}return t}function li(e){return"nominal"===e||"ordinal"===e}function ci(e){return"quantitative"===e||"temporal"===e}ri.displayName="DetailsPanel";const ui={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},di={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},hi={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function gi(e){var t,n,o,r,i,a,s,l,c,u,d,h,g,y;const f=[],{type:p,markProps:m}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["type"])}}(e.mark),v=e.encoding||{},b=v.x,x=v.y,w=v.color,k=v.size,A=v.theta,S=v.opacity;let E;(null===(t=e.data)||void 0===t?void 0:t.values)?E=e.data.values:(null===(n=e.data)||void 0===n?void 0:n.url)&&f.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&f.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite().");const L={};e.width&&(L.width=e.width),e.height&&(L.height=e.height);const O=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(O&&(L.title=O),(null==w?void 0:w.field)&&(L.colorBy=w.field,null===(o=w.scale)||void 0===o?void 0:o.scheme)){const e=ui[w.scale.scheme];e&&(L.colorScheme=e)}void 0!==(null==S?void 0:S.value)&&(L.pointOpacity=S.value);const j=null==b?void 0:b.aggregate,P=null==x?void 0:x.aggregate;if(E&&(j||P)){const e=P?x:b,t=P?b:x,n=hi[e.aggregate];if(n&&(null==t?void 0:t.field)&&e.field)E=function(e,t){const{groupBy:n,value:o,agg:r="sum"}=t,i=new Map;for(const t of e){const e=t[n]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const a=[];for(const[e,t]of i){let o;switch(r){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}a.push({[n]:e,value:o})}return a}(E,{groupBy:t.field,value:e.field,agg:n});else if(("count"===n||"count"===e.aggregate)&&(null==t?void 0:t.field)&&E){const e=new Map;for(const n of E){const o=n[t.field]+"";e.set(o,(e.get(o)||0)+1)}E=Array.from(e,([e,n])=>({[t.field]:e,value:n}))}}if((null==b?void 0:b.bin)||(null==x?void 0:x.bin)){const e="Histogram";E&&(L.data=E),(null==b?void 0:b.bin)?(L.valueAccessor=b.field,(null==x?void 0:x.field)&&(L.categoryAccessor=x.field),(null===(r=b.axis)||void 0===r?void 0:r.title)&&(L.valueLabel=b.axis.title)):(null==x?void 0:x.bin)&&(L.valueAccessor=x.field,(null==b?void 0:b.field)&&(L.categoryAccessor=b.field),(null===(i=x.axis)||void 0===i?void 0:i.title)&&(L.valueLabel=x.axis.title));const t="object"==typeof((null==b?void 0:b.bin)||(null==x?void 0:x.bin))?(null===(a=null==b?void 0:b.bin)||void 0===a?void 0:a.maxbins)||(null===(s=null==x?void 0:x.bin)||void 0===s?void 0:s.maxbins):void 0;return t&&(L.bins=t),fi(e,L,f)}let M;switch(p){case"bar":M=function(e,t,n,o,r,i,a){var s,l,c,u,d,h;let g;return(null==n?void 0:n.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",o.stackBy=n.field):g="BarChart",li(null==e?void 0:e.type)&&ci(null==t?void 0:t.type)?(o.categoryAccessor=e.field,o.valueAccessor=a?"value":t.field,(null===(s=null==e?void 0:e.axis)||void 0===s?void 0:s.title)&&(o.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(o.valueLabel=t.axis.title)):ci(null==e?void 0:e.type)&&li(null==t?void 0:t.type)?(o.categoryAccessor=t.field,o.valueAccessor=i?"value":e.field,o.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(o.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(o.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(o.categoryAccessor=e.field),(null==t?void 0:t.field)&&(o.valueAccessor=a?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(o.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(o.valueLabel=t.axis.title)),r&&(o.data=r),g}(b,x,w,L,E,j,P);break;case"line":if(M="LineChart",yi(b,x,L,j,P),(null==w?void 0:w.field)&&(L.lineBy=w.field),m.interpolate){const e=di[m.interpolate];e&&(L.curve=e)}!0===m.point&&(L.showPoints=!0),E&&(L.data=E);break;case"area":if((null==w?void 0:w.field)?(M="StackedAreaChart",L.areaBy=w.field):M="AreaChart",yi(b,x,L,j,P),m.interpolate){const e=di[m.interpolate];e&&(L.curve=e)}void 0!==m.opacity&&(L.areaOpacity=m.opacity),E&&(L.data=E);break;case"point":case"circle":case"square":(null==k?void 0:k.field)?(M="BubbleChart",L.sizeBy=k.field,(null===(l=k.scale)||void 0===l?void 0:l.range)&&(L.sizeRange=k.scale.range)):M="Scatterplot",yi(b,x,L,j,P),E&&(L.data=E);break;case"rect":M="Heatmap",(null==b?void 0:b.field)&&(L.xAccessor=b.field),(null==x?void 0:x.field)&&(L.yAccessor=x.field),(null==w?void 0:w.field)&&(L.valueAccessor=w.field,delete L.colorBy),(null===(c=null==b?void 0:b.axis)||void 0===c?void 0:c.title)&&(L.xLabel=b.axis.title),(null===(u=null==x?void 0:x.axis)||void 0===u?void 0:u.title)&&(L.yLabel=x.axis.title),E&&(L.data=E);break;case"arc":m.innerRadius&&m.innerRadius>0?(M="DonutChart",L.innerRadius=m.innerRadius):M="PieChart",(null==A?void 0:A.field)?L.valueAccessor=A.field:(null==x?void 0:x.field)&&(L.valueAccessor=P?"value":x.field),(null==w?void 0:w.field)&&(L.categoryAccessor=w.field),(null==b?void 0:b.field)&&!(null==A?void 0:A.field)&&(L.categoryAccessor=b.field),E&&(L.data=E);break;case"tick":M="DotPlot",li(null==b?void 0:b.type)?(L.categoryAccessor=b.field,(null==x?void 0:x.field)&&(L.valueAccessor=P?"value":x.field),(null===(d=null==b?void 0:b.axis)||void 0===d?void 0:d.title)&&(L.categoryLabel=b.axis.title),(null===(h=null==x?void 0:x.axis)||void 0===h?void 0:h.title)&&(L.valueLabel=x.axis.title)):li(null==x?void 0:x.type)?(L.categoryAccessor=x.field,(null==b?void 0:b.field)&&(L.valueAccessor=j?"value":b.field),L.orientation="horizontal",(null===(g=null==x?void 0:x.axis)||void 0===g?void 0:g.title)&&(L.categoryLabel=x.axis.title),(null===(y=null==b?void 0:b.axis)||void 0===y?void 0:y.title)&&(L.valueLabel=b.axis.title)):((null==b?void 0:b.field)&&(L.categoryAccessor=b.field),(null==x?void 0:x.field)&&(L.valueAccessor=P?"value":x.field)),E&&(L.data=E);break;default:f.push(`Unsupported mark type "${p}". Defaulting to Scatterplot.`),M="Scatterplot",yi(b,x,L,j,P),E&&(L.data=E)}return fi(M,L,f)}function yi(e,t,n,o,r){var i,a;(null==e?void 0:e.field)&&(n.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(n.yAccessor=r?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(n.xLabel=e.axis.title),(null===(a=null==t?void 0:t.axis)||void 0===a?void 0:a.title)&&(n.yLabel=t.axis.title)}function fi(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};return n.length>0&&(o.warnings=n),o}export{Ht as AreaChart,An as BarChart,On as BoxPlot,Ft as BubbleChart,ni as ChartContainer,dr as ChordDiagram,fr as CirclePack,ri as DetailsPanel,Tn as DonutChart,Mn as DotPlot,ar as ForceDirectedGraph,En as GroupedBarChart,Yt as Heatmap,jn as Histogram,_t as LineChart,qt as LinkedCharts,Ot as MultiLineTooltip,Dn as PieChart,wr as RealtimeHeatmap,vr as RealtimeHistogram,pr as RealtimeLineChart,br as RealtimeSwarmChart,xr as RealtimeWaterfallChart,Nn as RidgelinePlot,hr as SankeyDiagram,Rt as Scatterplot,tn as ScatterplotMatrix,It as StackedAreaChart,Sn as StackedBarChart,Ln as SwarmPlot,Pr as ThemeProvider,kr as TooltipProvider,gr as TreeDiagram,yr as Treemap,Pn as ViolinPlot,Qr as configToJSX,Zr as copyConfig,si as deserializeSelections,Dr as exportChart,qr as fromConfig,Ur as fromURL,gi as fromVegaLite,ai as serializeSelections,Gr as toConfig,Vr as toURL,ht as useBrushSelection,Xt as useChartObserver,gt as useFilteredData,dt as useLinkedHover,ut as useSelection,Mr as useTheme,Rr as validateProps};