semiotic 2.0.3 → 3.0.0-beta.2
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.
- package/CLAUDE.md +828 -0
- package/README.md +215 -37
- package/ai/cli.js +48 -0
- package/ai/dist/ai/componentRegistry.js +45 -0
- package/ai/dist/ai/mcp-server.js +99 -0
- package/ai/dist/ai/renderHOCToSVG.js +77 -0
- package/ai/dist/src/components/Annotation.js +358 -0
- package/ai/dist/src/components/AnnotationLayer/AnnotationLayer.js +369 -0
- package/ai/dist/src/components/Axis/Axis.js +374 -0
- package/ai/dist/src/components/Axis/axisTitle.js +14 -0
- package/ai/dist/src/components/Axis/index.js +7 -0
- package/ai/dist/src/components/Axis/summaryGraphic.js +37 -0
- package/ai/dist/src/components/Brush.js +84 -0
- package/ai/dist/src/components/ChartErrorBoundary.js +91 -0
- package/ai/dist/src/components/DividedLine.js +65 -0
- package/ai/dist/src/components/Legend.js +140 -0
- package/ai/dist/src/components/LinkedCharts.js +95 -0
- package/ai/dist/src/components/ThemeProvider.js +79 -0
- package/ai/dist/src/components/Tooltip/Tooltip.js +309 -0
- package/ai/dist/src/components/TooltipPositioner/index.js +132 -0
- package/ai/dist/src/components/annotationLayerBehavior/annotationHandling.js +73 -0
- package/ai/dist/src/components/annotationLayerBehavior/d3labeler.js +254 -0
- package/ai/dist/src/components/annotationRules/baseRules.js +150 -0
- package/ai/dist/src/components/annotationRules/networkframeRules.js +196 -0
- package/ai/dist/src/components/annotationRules/xyframeRules.js +297 -0
- package/ai/dist/src/components/batchWork.js +35 -0
- package/ai/dist/src/components/charts/index.js +109 -0
- package/ai/dist/src/components/charts/network/ChordDiagram.js +142 -0
- package/ai/dist/src/components/charts/network/CirclePack.js +108 -0
- package/ai/dist/src/components/charts/network/ForceDirectedGraph.js +121 -0
- package/ai/dist/src/components/charts/network/SankeyDiagram.js +155 -0
- package/ai/dist/src/components/charts/network/TreeDiagram.js +110 -0
- package/ai/dist/src/components/charts/network/Treemap.js +106 -0
- package/ai/dist/src/components/charts/ordinal/BarChart.js +156 -0
- package/ai/dist/src/components/charts/ordinal/BoxPlot.js +139 -0
- package/ai/dist/src/components/charts/ordinal/DonutChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/DotPlot.js +126 -0
- package/ai/dist/src/components/charts/ordinal/GroupedBarChart.js +129 -0
- package/ai/dist/src/components/charts/ordinal/Histogram.js +132 -0
- package/ai/dist/src/components/charts/ordinal/PieChart.js +128 -0
- package/ai/dist/src/components/charts/ordinal/RidgelinePlot.js +130 -0
- package/ai/dist/src/components/charts/ordinal/StackedBarChart.js +130 -0
- package/ai/dist/src/components/charts/ordinal/SwarmPlot.js +147 -0
- package/ai/dist/src/components/charts/ordinal/ViolinPlot.js +138 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHeatmap.js +79 -0
- package/ai/dist/src/components/charts/realtime/RealtimeHistogram.js +114 -0
- package/ai/dist/src/components/charts/realtime/RealtimeLineChart.js +93 -0
- package/ai/dist/src/components/charts/realtime/RealtimeSwarmChart.js +105 -0
- package/ai/dist/src/components/charts/realtime/RealtimeWaterfallChart.js +106 -0
- package/ai/dist/src/components/charts/shared/ChartError.js +72 -0
- package/ai/dist/src/components/charts/shared/colorUtils.js +138 -0
- package/ai/dist/src/components/charts/shared/formatUtils.js +213 -0
- package/ai/dist/src/components/charts/shared/hooks.js +49 -0
- package/ai/dist/src/components/charts/shared/legendUtils.js +57 -0
- package/ai/dist/src/components/charts/shared/selectionUtils.js +67 -0
- package/ai/dist/src/components/charts/shared/tooltipUtils.js +79 -0
- package/ai/dist/src/components/charts/shared/types.js +2 -0
- package/ai/dist/src/components/charts/shared/validateChartData.js +82 -0
- package/ai/dist/src/components/charts/shared/validateProps.js +736 -0
- package/ai/dist/src/components/charts/xy/AreaChart.js +230 -0
- package/ai/dist/src/components/charts/xy/BubbleChart.js +251 -0
- package/ai/dist/src/components/charts/xy/Heatmap.js +235 -0
- package/ai/dist/src/components/charts/xy/LineChart.js +307 -0
- package/ai/dist/src/components/charts/xy/MinimapChart.js +298 -0
- package/ai/dist/src/components/charts/xy/Scatterplot.js +172 -0
- package/ai/dist/src/components/charts/xy/ScatterplotMatrix.js +426 -0
- package/ai/dist/src/components/charts/xy/StackedAreaChart.js +231 -0
- package/ai/dist/src/components/constants/coordinateNames.js +11 -0
- package/ai/dist/src/components/constants/frame_props.js +251 -0
- package/ai/dist/src/components/data/dataFunctions.js +487 -0
- package/ai/dist/src/components/data/multiAccessorUtils.js +14 -0
- package/ai/dist/src/components/data/transforms.js +143 -0
- package/ai/dist/src/components/data/unflowedFunctions.js +5 -0
- package/ai/dist/src/components/export/exportChart.js +121 -0
- package/ai/dist/src/components/generic_utilities/functions.js +5 -0
- package/ai/dist/src/components/geometry/areaDrawing.js +312 -0
- package/ai/dist/src/components/geometry/contourLayout.js +73 -0
- package/ai/dist/src/components/geometry/hexbinLayout.js +163 -0
- package/ai/dist/src/components/geometry/lineDrawing.js +356 -0
- package/ai/dist/src/components/geometry/sankeyLinks.js +331 -0
- package/ai/dist/src/components/geometry/summaryLayouts.js +136 -0
- package/ai/dist/src/components/index.js +18 -0
- package/ai/dist/src/components/processing/InteractionItems.js +223 -0
- package/ai/dist/src/components/processing/hierarchyUtils.js +104 -0
- package/ai/dist/src/components/processing/layouts/chordLayout.js +58 -0
- package/ai/dist/src/components/processing/layouts/forceLayout.js +142 -0
- package/ai/dist/src/components/processing/layouts/hierarchyLayout.js +31 -0
- package/ai/dist/src/components/processing/layouts/index.js +32 -0
- package/ai/dist/src/components/processing/layouts/sankeyLayout.js +96 -0
- package/ai/dist/src/components/processing/layouts/simpleLayouts.js +34 -0
- package/ai/dist/src/components/processing/layouts/types.js +2 -0
- package/ai/dist/src/components/processing/networkDefaults.js +39 -0
- package/ai/dist/src/components/realtime/BinAccumulator.js +36 -0
- package/ai/dist/src/components/realtime/IncrementalExtent.js +55 -0
- package/ai/dist/src/components/realtime/RingBuffer.js +104 -0
- package/ai/dist/src/components/realtime/renderers/barRenderer.js +133 -0
- package/ai/dist/src/components/realtime/renderers/candlestickRenderer.js +7 -0
- package/ai/dist/src/components/realtime/renderers/lineRenderer.js +164 -0
- package/ai/dist/src/components/realtime/renderers/swarmRenderer.js +91 -0
- package/ai/dist/src/components/realtime/renderers/types.js +2 -0
- package/ai/dist/src/components/realtime/renderers/waterfallRenderer.js +163 -0
- package/ai/dist/src/components/realtime/types.js +2 -0
- package/ai/dist/src/components/semiotic-ai.js +89 -0
- package/ai/dist/src/components/semiotic-data.js +12 -0
- package/ai/dist/src/components/semiotic-network.js +38 -0
- package/ai/dist/src/components/semiotic-ordinal.js +28 -0
- package/ai/dist/src/components/semiotic-realtime.js +30 -0
- package/ai/dist/src/components/semiotic-server.js +8 -0
- package/ai/dist/src/components/semiotic-xy.js +35 -0
- package/ai/dist/src/components/semiotic.js +109 -0
- package/ai/dist/src/components/server/renderToStaticSVG.js +594 -0
- package/ai/dist/src/components/store/SelectionStore.js +91 -0
- package/ai/dist/src/components/store/ThemeStore.js +78 -0
- package/ai/dist/src/components/store/TooltipStore.js +13 -0
- package/ai/dist/src/components/store/createStore.js +81 -0
- package/ai/dist/src/components/store/useSelection.js +133 -0
- package/ai/dist/src/components/stream/CanvasHitTester.js +164 -0
- package/ai/dist/src/components/stream/DataSourceAdapter.js +99 -0
- package/ai/dist/src/components/stream/MarginalGraphics.js +266 -0
- package/ai/dist/src/components/stream/NetworkCanvasHitTester.js +228 -0
- package/ai/dist/src/components/stream/NetworkPipelineStore.js +498 -0
- package/ai/dist/src/components/stream/NetworkSVGOverlay.js +70 -0
- package/ai/dist/src/components/stream/NetworkSceneGraph.js +38 -0
- package/ai/dist/src/components/stream/OrdinalCanvasHitTester.js +146 -0
- package/ai/dist/src/components/stream/OrdinalPipelineStore.js +786 -0
- package/ai/dist/src/components/stream/OrdinalSVGOverlay.js +130 -0
- package/ai/dist/src/components/stream/ParticlePool.js +174 -0
- package/ai/dist/src/components/stream/PipelineStore.js +1243 -0
- package/ai/dist/src/components/stream/SVGOverlay.js +129 -0
- package/ai/dist/src/components/stream/SceneGraph.js +132 -0
- package/ai/dist/src/components/stream/StreamNetworkFrame.js +561 -0
- package/ai/dist/src/components/stream/StreamOrdinalFrame.js +492 -0
- package/ai/dist/src/components/stream/StreamXYFrame.js +590 -0
- package/ai/dist/src/components/stream/accessorUtils.js +20 -0
- package/ai/dist/src/components/stream/index.js +32 -0
- package/ai/dist/src/components/stream/layouts/chordLayoutPlugin.js +352 -0
- package/ai/dist/src/components/stream/layouts/forceLayoutPlugin.js +230 -0
- package/ai/dist/src/components/stream/layouts/hierarchyLayoutPlugin.js +568 -0
- package/ai/dist/src/components/stream/layouts/index.js +28 -0
- package/ai/dist/src/components/stream/layouts/sankeyLayoutPlugin.js +245 -0
- package/ai/dist/src/components/stream/networkTypes.js +17 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/barScene.js +126 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/connectorScene.js +62 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pieScene.js +33 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/pointScene.js +63 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/statisticalScene.js +278 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/timelineScene.js +30 -0
- package/ai/dist/src/components/stream/ordinalSceneBuilders/types.js +2 -0
- package/ai/dist/src/components/stream/ordinalTypes.js +2 -0
- package/ai/dist/src/components/stream/renderers/areaCanvasRenderer.js +48 -0
- package/ai/dist/src/components/stream/renderers/barCanvasRenderer.js +70 -0
- package/ai/dist/src/components/stream/renderers/boxplotCanvasRenderer.js +75 -0
- package/ai/dist/src/components/stream/renderers/candlestickCanvasRenderer.js +28 -0
- package/ai/dist/src/components/stream/renderers/connectorCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/heatmapCanvasRenderer.js +31 -0
- package/ai/dist/src/components/stream/renderers/lineCanvasRenderer.js +140 -0
- package/ai/dist/src/components/stream/renderers/networkArcRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/networkCircleRenderer.js +37 -0
- package/ai/dist/src/components/stream/renderers/networkEdgeRenderer.js +102 -0
- package/ai/dist/src/components/stream/renderers/networkParticleRenderer.js +63 -0
- package/ai/dist/src/components/stream/renderers/networkRectRenderer.js +35 -0
- package/ai/dist/src/components/stream/renderers/pointCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/swarmCanvasRenderer.js +10 -0
- package/ai/dist/src/components/stream/renderers/types.js +2 -0
- package/ai/dist/src/components/stream/renderers/violinCanvasRenderer.js +47 -0
- package/ai/dist/src/components/stream/renderers/waterfallCanvasRenderer.js +38 -0
- package/ai/dist/src/components/stream/renderers/wedgeCanvasRenderer.js +33 -0
- package/ai/dist/src/components/stream/types.js +2 -0
- package/ai/dist/src/components/types/annotationTypes.js +2 -0
- package/ai/dist/src/components/types/canvasTypes.js +2 -0
- package/ai/dist/src/components/types/generalTypes.js +2 -0
- package/ai/dist/src/components/types/interactionTypes.js +2 -0
- package/ai/dist/src/components/types/legendTypes.js +2 -0
- package/ai/dist/src/components/types/networkTypes.js +2 -0
- package/ai/dist/src/components/types/ordinalTypes.js +2 -0
- package/ai/dist/src/components/types/xyTypes.js +2 -0
- package/ai/dist/src/components/useBoundingRect.js +24 -0
- package/ai/dist/src/components/visualizationLayerBehavior/axis.js +301 -0
- package/ai/dist/src/components/visualizationLayerBehavior/general.js +435 -0
- package/ai/dist/src/setupTests.js +4 -0
- package/ai/examples.md +489 -0
- package/ai/schema.json +1338 -0
- package/ai/system-prompt.md +41 -0
- package/dist/AnnotationLayer/AnnotationLayer.d.ts +0 -1
- package/dist/Axis/axisTitle.d.ts +3 -3
- package/dist/Axis/summaryGraphic.d.ts +1 -1
- package/dist/ChartErrorBoundary.d.ts +39 -0
- package/dist/LinkedCharts.d.ts +42 -0
- package/dist/ThemeProvider.d.ts +12 -0
- package/dist/Tooltip/Tooltip.d.ts +141 -0
- package/dist/TooltipPositioner/index.d.ts +1 -1
- package/dist/annotationLayerBehavior/annotationHandling.d.ts +2 -2
- package/dist/annotationRules/networkframeRules.d.ts +2 -2
- package/dist/annotationRules/xyframeRules.d.ts +2 -2
- package/dist/batchWork.d.ts +1 -1
- package/dist/charts/index.d.ts +74 -0
- package/dist/charts/network/ChordDiagram.d.ts +36 -0
- package/dist/charts/network/CirclePack.d.ts +32 -0
- package/dist/charts/network/ForceDirectedGraph.d.ts +38 -0
- package/dist/charts/network/SankeyDiagram.d.ts +38 -0
- package/dist/charts/network/TreeDiagram.d.ts +34 -0
- package/dist/charts/network/Treemap.d.ts +33 -0
- package/dist/charts/ordinal/BarChart.d.ts +32 -0
- package/dist/charts/ordinal/BoxPlot.d.ts +27 -0
- package/dist/charts/ordinal/DonutChart.d.ts +23 -0
- package/dist/charts/ordinal/DotPlot.d.ts +27 -0
- package/dist/charts/ordinal/GroupedBarChart.d.ts +26 -0
- package/dist/charts/ordinal/Histogram.d.ts +26 -0
- package/dist/charts/ordinal/PieChart.d.ts +21 -0
- package/dist/charts/ordinal/RidgelinePlot.d.ts +34 -0
- package/dist/charts/ordinal/StackedBarChart.d.ts +27 -0
- package/dist/charts/ordinal/SwarmPlot.d.ts +29 -0
- package/dist/charts/ordinal/ViolinPlot.d.ts +28 -0
- package/dist/charts/realtime/RealtimeHeatmap.d.ts +95 -0
- package/dist/charts/realtime/RealtimeHistogram.d.ts +119 -0
- package/dist/charts/realtime/RealtimeLineChart.d.ts +98 -0
- package/dist/charts/realtime/RealtimeSwarmChart.d.ts +100 -0
- package/dist/charts/realtime/RealtimeWaterfallChart.d.ts +97 -0
- package/dist/charts/shared/ChartError.d.ts +19 -0
- package/dist/charts/shared/colorUtils.d.ts +62 -0
- package/dist/charts/shared/formatUtils.d.ts +94 -0
- package/dist/charts/shared/hooks.d.ts +20 -0
- package/dist/charts/shared/legendUtils.d.ts +32 -0
- package/dist/charts/shared/selectionUtils.d.ts +51 -0
- package/dist/charts/shared/tooltipUtils.d.ts +18 -0
- package/dist/charts/shared/types.d.ts +97 -0
- package/dist/charts/shared/validateChartData.d.ts +41 -0
- package/dist/charts/shared/validateProps.d.ts +18 -0
- package/dist/charts/xy/AreaChart.d.ts +130 -0
- package/dist/charts/xy/BubbleChart.d.ts +164 -0
- package/dist/charts/xy/Heatmap.d.ts +156 -0
- package/dist/charts/xy/LineChart.d.ts +196 -0
- package/dist/charts/xy/MinimapChart.d.ts +73 -0
- package/dist/charts/xy/Scatterplot.d.ts +55 -0
- package/dist/charts/xy/ScatterplotMatrix.d.ts +71 -0
- package/dist/charts/xy/StackedAreaChart.d.ts +134 -0
- package/dist/constants/frame_props.d.ts +9 -0
- package/dist/data/dataFunctions.d.ts +10 -11
- package/dist/data/transforms.d.ts +45 -0
- package/dist/export/exportChart.d.ts +16 -0
- package/dist/{svg → geometry}/areaDrawing.d.ts +3 -13
- package/dist/geometry/contourLayout.d.ts +6 -0
- package/dist/geometry/hexbinLayout.d.ts +7 -0
- package/dist/{svg → geometry}/lineDrawing.d.ts +7 -35
- package/dist/geometry/sankeyLinks.d.ts +2 -0
- package/dist/geometry/summaryLayouts.d.ts +45 -0
- package/dist/index.d.ts +1 -125
- package/dist/network.js +7495 -0
- package/dist/network.js.map +1 -0
- package/dist/network.min.js +1 -0
- package/dist/network.module.js +7458 -0
- package/dist/network.module.js.map +1 -0
- package/dist/network.module.min.js +1 -0
- package/dist/ordinal.js +6497 -0
- package/dist/ordinal.js.map +1 -0
- package/dist/ordinal.min.js +1 -0
- package/dist/ordinal.module.js +6465 -0
- package/dist/ordinal.module.js.map +1 -0
- package/dist/ordinal.module.min.js +1 -0
- package/dist/processing/InteractionItems.d.ts +5 -4
- package/dist/processing/hierarchyUtils.d.ts +16 -0
- package/dist/processing/layouts/chordLayout.d.ts +2 -0
- package/dist/processing/layouts/forceLayout.d.ts +3 -0
- package/dist/processing/layouts/hierarchyLayout.d.ts +10 -0
- package/dist/processing/layouts/index.d.ts +8 -0
- package/dist/processing/layouts/sankeyLayout.d.ts +8 -0
- package/dist/processing/layouts/simpleLayouts.d.ts +7 -0
- package/dist/processing/layouts/types.d.ts +17 -0
- package/dist/processing/networkDefaults.d.ts +36 -0
- package/dist/realtime/BinAccumulator.d.ts +8 -0
- package/dist/realtime/IncrementalExtent.d.ts +13 -0
- package/dist/realtime/RingBuffer.d.ts +19 -0
- package/dist/realtime/renderers/barRenderer.d.ts +2 -0
- package/dist/realtime/renderers/candlestickRenderer.d.ts +2 -0
- package/dist/realtime/renderers/lineRenderer.d.ts +2 -0
- package/dist/realtime/renderers/swarmRenderer.d.ts +2 -0
- package/dist/realtime/renderers/types.d.ts +9 -0
- package/dist/realtime/renderers/waterfallRenderer.d.ts +3 -0
- package/dist/realtime/types.d.ts +113 -0
- package/dist/realtime.js +7072 -0
- package/dist/realtime.js.map +1 -0
- package/dist/realtime.min.js +1 -0
- package/dist/realtime.module.js +7043 -0
- package/dist/realtime.module.js.map +1 -0
- package/dist/realtime.module.min.js +1 -0
- package/dist/semiotic-ai.d.ts +36 -0
- package/dist/semiotic-ai.js +13323 -0
- package/dist/semiotic-ai.js.map +1 -0
- package/dist/semiotic-ai.min.js +1 -0
- package/dist/semiotic-ai.module.js +13264 -0
- package/dist/semiotic-ai.module.js.map +1 -0
- package/dist/semiotic-ai.module.min.js +1 -0
- package/dist/semiotic-data.d.ts +5 -0
- package/dist/semiotic-data.js +141 -0
- package/dist/semiotic-data.js.map +1 -0
- package/dist/semiotic-data.min.js +1 -0
- package/dist/semiotic-data.module.js +136 -0
- package/dist/semiotic-data.module.js.map +1 -0
- package/dist/semiotic-data.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +23 -0
- package/dist/semiotic-ordinal.d.ts +19 -0
- package/dist/semiotic-realtime.d.ts +22 -0
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-xy.d.ts +21 -0
- package/dist/semiotic.d.ts +41 -28
- package/dist/semiotic.js +16257 -13130
- package/dist/semiotic.js.map +1 -0
- package/dist/semiotic.min.js +1 -0
- package/dist/semiotic.module.js +16198 -13100
- package/dist/semiotic.module.js.map +1 -0
- package/dist/semiotic.module.min.js +1 -0
- package/dist/server/renderToStaticSVG.d.ts +9 -0
- package/dist/server.js +5191 -0
- package/dist/server.js.map +1 -0
- package/dist/server.min.js +1 -0
- package/dist/server.module.js +5166 -0
- package/dist/server.module.js.map +1 -0
- package/dist/server.module.min.js +1 -0
- package/dist/store/SelectionStore.d.ts +29 -0
- package/dist/store/ThemeStore.d.ts +26 -0
- package/dist/store/useSelection.d.ts +66 -0
- package/dist/stream/CanvasHitTester.d.ts +18 -0
- package/dist/stream/DataSourceAdapter.d.ts +32 -0
- package/dist/stream/MarginalGraphics.d.ts +19 -0
- package/dist/stream/NetworkCanvasHitTester.d.ts +14 -0
- package/dist/stream/NetworkPipelineStore.d.ts +74 -0
- package/dist/stream/NetworkSVGOverlay.d.ts +40 -0
- package/dist/stream/NetworkSceneGraph.d.ts +14 -0
- package/dist/stream/OrdinalCanvasHitTester.d.ts +9 -0
- package/dist/stream/OrdinalPipelineStore.d.ts +65 -0
- package/dist/stream/OrdinalSVGOverlay.d.ts +34 -0
- package/dist/stream/ParticlePool.d.ts +28 -0
- package/dist/stream/PipelineStore.d.ts +161 -0
- package/dist/stream/SVGOverlay.d.ts +37 -0
- package/dist/stream/SceneGraph.d.ts +16 -0
- package/dist/stream/StreamNetworkFrame.d.ts +4 -0
- package/dist/stream/StreamOrdinalFrame.d.ts +4 -0
- package/dist/stream/StreamXYFrame.d.ts +4 -0
- package/dist/stream/accessorUtils.d.ts +2 -0
- package/dist/stream/index.d.ts +16 -0
- package/dist/stream/layouts/chordLayoutPlugin.d.ts +8 -0
- package/dist/stream/layouts/forceLayoutPlugin.d.ts +9 -0
- package/dist/stream/layouts/hierarchyLayoutPlugin.d.ts +17 -0
- package/dist/stream/layouts/index.d.ts +11 -0
- package/dist/stream/layouts/sankeyLayoutPlugin.d.ts +8 -0
- package/dist/stream/networkTypes.d.ts +346 -0
- package/dist/stream/ordinalSceneBuilders/barScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/connectorScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pieScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/pointScene.d.ts +4 -0
- package/dist/stream/ordinalSceneBuilders/statisticalScene.d.ts +6 -0
- package/dist/stream/ordinalSceneBuilders/timelineScene.d.ts +3 -0
- package/dist/stream/ordinalSceneBuilders/types.d.ts +21 -0
- package/dist/stream/ordinalTypes.d.ts +225 -0
- package/dist/stream/renderers/areaCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/barCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/boxplotCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/candlestickCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/connectorCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/heatmapCanvasRenderer.d.ts +6 -0
- package/dist/stream/renderers/lineCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/networkArcRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkCircleRenderer.d.ts +5 -0
- package/dist/stream/renderers/networkEdgeRenderer.d.ts +10 -0
- package/dist/stream/renderers/networkParticleRenderer.d.ts +11 -0
- package/dist/stream/renderers/networkRectRenderer.d.ts +5 -0
- package/dist/stream/renderers/pointCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/swarmCanvasRenderer.d.ts +7 -0
- package/dist/stream/renderers/types.d.ts +7 -0
- package/dist/stream/renderers/violinCanvasRenderer.d.ts +2 -0
- package/dist/stream/renderers/waterfallCanvasRenderer.d.ts +8 -0
- package/dist/stream/renderers/wedgeCanvasRenderer.d.ts +2 -0
- package/dist/stream/types.d.ts +307 -0
- package/dist/types/annotationTypes.d.ts +13 -18
- package/dist/types/canvasTypes.d.ts +1 -1
- package/dist/types/generalTypes.d.ts +41 -36
- package/dist/types/interactionTypes.d.ts +7 -9
- package/dist/types/legendTypes.d.ts +2 -2
- package/dist/types/networkTypes.d.ts +40 -30
- package/dist/types/ordinalTypes.d.ts +27 -18
- package/dist/types/xyTypes.d.ts +1 -95
- package/dist/visualizationLayerBehavior/axis.d.ts +3 -5
- package/dist/visualizationLayerBehavior/general.d.ts +8 -12
- package/dist/xy.js +6993 -0
- package/dist/xy.js.map +1 -0
- package/dist/xy.min.js +1 -0
- package/dist/xy.module.js +6957 -0
- package/dist/xy.module.js.map +1 -0
- package/dist/xy.module.min.js +1 -0
- package/package.json +123 -67
- package/dist/AnnotationLayer/helpers.d.ts +0 -6
- package/dist/AnnotationLayer/index.d.ts +0 -2
- package/dist/FacetController.d.ts +0 -12
- package/dist/Frame.d.ts +0 -2
- package/dist/InteractionLayer.d.ts +0 -3
- package/dist/Mark/Mark.d.ts +0 -3
- package/dist/Mark/Mark.types.d.ts +0 -10
- package/dist/Mark/constants/markTransition.d.ts +0 -10
- package/dist/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/MiniMap.d.ts +0 -14
- package/dist/MinimapXYFrame.d.ts +0 -10
- package/dist/NetworkFrame.d.ts +0 -4
- package/dist/OrdinalFrame.d.ts +0 -4
- package/dist/ResponsiveFrame.d.ts +0 -22
- package/dist/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/ResponsiveXYFrame.d.ts +0 -6
- package/dist/SpanOrDiv.d.ts +0 -10
- package/dist/SparkFrame.d.ts +0 -14
- package/dist/SparkNetworkFrame.d.ts +0 -5
- package/dist/SparkOrdinalFrame.d.ts +0 -5
- package/dist/SparkXYFrame.d.ts +0 -5
- package/dist/VisualizationLayer.d.ts +0 -33
- package/dist/XYFrame.d.ts +0 -4
- package/dist/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/Annotation.d.ts +0 -3
- package/dist/components/AnnotationLayer/AnnotationLayer.d.ts +0 -26
- package/dist/components/Axis/Axis.d.ts +0 -7
- package/dist/components/Axis/axisTitle.d.ts +0 -10
- package/dist/components/Axis/index.d.ts +0 -2
- package/dist/components/Axis/summaryGraphic.d.ts +0 -17
- package/dist/components/Brush.d.ts +0 -12
- package/dist/components/DividedLine.d.ts +0 -16
- package/dist/components/FacetController.d.ts +0 -12
- package/dist/components/Frame.d.ts +0 -2
- package/dist/components/InteractionLayer.d.ts +0 -3
- package/dist/components/Legend.d.ts +0 -3
- package/dist/components/Mark/Mark.d.ts +0 -3
- package/dist/components/Mark/Mark.types.d.ts +0 -10
- package/dist/components/Mark/markBehavior/drawing.d.ts +0 -13
- package/dist/components/MiniMap.d.ts +0 -14
- package/dist/components/MinimapXYFrame.d.ts +0 -10
- package/dist/components/NetworkFrame.d.ts +0 -4
- package/dist/components/OrdinalFrame.d.ts +0 -4
- package/dist/components/ResponsiveFrame.d.ts +0 -22
- package/dist/components/ResponsiveMinimapXYFrame.d.ts +0 -6
- package/dist/components/ResponsiveNetworkFrame.d.ts +0 -6
- package/dist/components/ResponsiveOrdinalFrame.d.ts +0 -6
- package/dist/components/ResponsiveXYFrame.d.ts +0 -6
- package/dist/components/SpanOrDiv.d.ts +0 -10
- package/dist/components/SparkFrame.d.ts +0 -14
- package/dist/components/SparkNetworkFrame.d.ts +0 -5
- package/dist/components/SparkOrdinalFrame.d.ts +0 -5
- package/dist/components/SparkXYFrame.d.ts +0 -5
- package/dist/components/TooltipPositioner/index.d.ts +0 -7
- package/dist/components/VisualizationLayer.d.ts +0 -33
- package/dist/components/XYFrame.d.ts +0 -4
- package/dist/components/annotationLayerBehavior/annotationHandling.d.ts +0 -19
- package/dist/components/annotationLayerBehavior/d3labeler.d.ts +0 -9
- package/dist/components/annotationRules/baseRules.d.ts +0 -25
- package/dist/components/annotationRules/networkframeRules.d.ts +0 -48
- package/dist/components/annotationRules/orframeRules.d.ts +0 -105
- package/dist/components/annotationRules/xyframeRules.d.ts +0 -117
- package/dist/components/batchWork.d.ts +0 -6
- package/dist/components/constants/coordinateNames.d.ts +0 -8
- package/dist/components/constants/frame_props.d.ts +0 -4
- package/dist/components/constants/jsx.d.ts +0 -19
- package/dist/components/data/dataFunctions.d.ts +0 -46
- package/dist/components/data/multiAccessorUtils.d.ts +0 -1
- package/dist/components/data/unflowedFunctions.d.ts +0 -1
- package/dist/components/generic_utilities/functions.d.ts +0 -1
- package/dist/components/index.d.ts +0 -125
- package/dist/components/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/components/processing/InteractionItems.d.ts +0 -12
- package/dist/components/processing/network.d.ts +0 -114
- package/dist/components/processing/ordinal.d.ts +0 -102
- package/dist/components/processing/xyDrawing.d.ts +0 -135
- package/dist/components/semiotic.d.ts +0 -35
- package/dist/components/store/TooltipStore.d.ts +0 -2
- package/dist/components/store/createStore.d.ts +0 -1
- package/dist/components/svg/SvgHelper.d.ts +0 -37
- package/dist/components/svg/areaDrawing.d.ts +0 -31
- package/dist/components/svg/ckmeans.d.ts +0 -69
- package/dist/components/svg/frameFunctions.d.ts +0 -119
- package/dist/components/svg/lineDrawing.d.ts +0 -99
- package/dist/components/svg/networkDrawing.d.ts +0 -134
- package/dist/components/svg/pieceDrawing.d.ts +0 -13
- package/dist/components/svg/pieceLayouts.d.ts +0 -71
- package/dist/components/svg/summaryLayouts.d.ts +0 -74
- package/dist/components/types/annotationTypes.d.ts +0 -140
- package/dist/components/types/canvasTypes.d.ts +0 -9
- package/dist/components/types/generalTypes.d.ts +0 -236
- package/dist/components/types/interactionTypes.d.ts +0 -74
- package/dist/components/types/legendTypes.d.ts +0 -20
- package/dist/components/types/networkTypes.d.ts +0 -165
- package/dist/components/types/ordinalTypes.d.ts +0 -103
- package/dist/components/types/xyTypes.d.ts +0 -118
- package/dist/components/useBoundingRect.d.ts +0 -2
- package/dist/components/useDerivedStateFromProps.d.ts +0 -1
- package/dist/components/useLegacyUnmountCallback.d.ts +0 -1
- package/dist/components/visualizationLayerBehavior/axis.d.ts +0 -38
- package/dist/components/visualizationLayerBehavior/general.d.ts +0 -84
- package/dist/constants/jsx.d.ts +0 -19
- package/dist/interactionLayerBehavior/InteractionCanvas.d.ts +0 -20
- package/dist/processing/network.d.ts +0 -114
- package/dist/processing/ordinal.d.ts +0 -102
- package/dist/processing/xyDrawing.d.ts +0 -135
- package/dist/setupTests.d.ts +0 -1
- package/dist/svg/SvgHelper.d.ts +0 -37
- package/dist/svg/ckmeans.d.ts +0 -69
- package/dist/svg/frameFunctions.d.ts +0 -119
- package/dist/svg/networkDrawing.d.ts +0 -134
- package/dist/svg/pieceDrawing.d.ts +0 -13
- package/dist/svg/pieceLayouts.d.ts +0 -71
- package/dist/svg/summaryLayouts.d.ts +0 -74
- package/dist/useDerivedStateFromProps.d.ts +0 -1
- package/dist/useLegacyUnmountCallback.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react"),t=require("d3-brush"),o=require("d3-selection"),n=require("d3-scale"),r=require("d3-array"),i=require("d3-interpolate"),s=require("d3-sankey-circular"),a=require("d3-scale-chromatic"),l=require("d3-shape"),c=require("d3-force"),u=require("d3-chord"),d=require("d3-hierarchy"),h=require("labella"),f=require("regression"),p=require("d3-contour"),m=require("d3-hexbin");function y(e){return e&&e.__esModule?e:{default:e}}function g(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const o in e)if("default"!==o){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}return t.default=e,Object.freeze(t)}const v=g(e),b=y(h),x=y(f),k=5e3;class w{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,k),bounded:!0,totalSize:e.length});let t=k;const o=()=>{if(t>=e.length)return;if(e!==this.lastBoundedData)return;const n=Math.min(t+k,e.length);this.callback({inserts:e.slice(t,n),bounded:!1}),t=n,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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 A{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 o of e){const e=this.push(o);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(),o=[];for(;t.length>e;)o.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 o}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 E{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 o of e){const e=t?t(o):o;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 M(e,t,o,n,r){const i=new Map;for(const s of e){const e=t(s),a=o(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/n)*n;let c=i.get(l);if(c||(c={start:l,end:l+n,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 S(e,t,o,n,r,i){const s=[],a=[];for(const r of e){const e=o(r),i=n(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 O(e,t,o,n,r,i,s){const a=[],l=[];for(const i of e){const e=o(i),s=n(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 P(e,t,o,n,r,i){const s=o(e),a=n(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 j(e,t,o,n,r,i,s){return{type:"rect",x:e,y:t,w:o,h:n,style:r,datum:i,group:s}}function N(e,t,o,n,r,i){return{type:"heatcell",x:e,y:t,w:o,h:n,fill:r,datum:i}}function _(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function C(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}class z{constructor(e){this.xExtent=new E,this.yExtent=new E,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 A(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=_(e.timeAccessor||e.xAccessor,"time"),this.getY=_(e.valueAccessor||e.yAccessor,"value")):(this.getX=_(e.xAccessor,"x"),this.getY=_(e.yAccessor,"y")),this.getGroup=C(e.groupAccessor),this.getCategory=C(e.categoryAccessor),this.getSize=e.sizeAccessor?_(e.sizeAccessor,"size"):void 0,this.getColor=C(e.colorAccessor),this.getBounds=e.boundsAccessor?_(e.boundsAccessor,"bounds"):void 0,"candlestick"===e.chartType&&(this.getOpen=_(e.openAccessor,"open"),this.getHigh=_(e.highAccessor,"high"),this.getLow=_(e.lowAccessor,"low"),this.getClose=_(e.closeAccessor,"close")),e.pulse&&(this.timestampBuffer=new A(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 o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):this.yExtent.push(this.getY(o))}else for(const o 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(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(o)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(o)),this.yExtent.push(this.getLow(o))):this.yExtent.push(this.getY(o)),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,o,r,i,s,a;const{config:l,buffer:c}=this;if(this.xExtent.dirty&&this.xExtent.recalculate(c,this.getX),this.yExtent.dirty)if("candlestick"===l.chartType&&this.getHigh&&this.getLow){this.yExtent.clear();for(const e of c)this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))}else this.yExtent.recalculate(c,this.getY);const u=this.xExtent.extent,d=this.yExtent.extent;let h=l.xExtent?[null!==(t=l.xExtent[0])&&void 0!==t?t:u[0],null!==(o=l.xExtent[1])&&void 0!==o?o:u[1]]:u,f=l.yExtent?[null!==(r=l.yExtent[0])&&void 0!==r?r:d[0],null!==(i=l.yExtent[1])&&void 0!==i?i:d[1]]:d;const p=l.yExtent&&null!=l.yExtent[0]&&null!=l.yExtent[1];if("stackedarea"===l.chartType&&!p&&c.size>0)if(l.normalize)f=[0,1+l.extentPadding];else{const e=c.toArray(),t=this.groupData(e),o=new Map;for(const e of t)for(const t of e.data){const e=this.getX(t),n=this.getY(t);null==e||null==n||Number.isNaN(e)||Number.isNaN(n)||o.set(e,(o.get(e)||0)+n)}let n=0;for(const e of o.values())e>n&&(n=e);f=[0,n+(n>0?n*l.extentPadding:1)]}else if("bar"===l.chartType&&l.binSize&&!p&&c.size>0){const[,e]=function(e,t,o,n,r){const i=M(e,t,o,n,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]}(c,this.getX,this.getY,l.binSize,this.getCategory);f=[0,e+e*l.extentPadding]}else if("waterfall"===l.chartType&&!p&&c.size>0){const[e,t]=function(e,t){let o=0,n=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,o>r&&(o=r),r>n&&(n=r))}return[o,n]}(c,this.getY),o=t-e,n=o>0?o*l.extentPadding:1;f=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!p&&f[0]!==1/0){if(this.getBounds){const e=c.toArray();for(const t of e){const e=this.getY(t),o=this.getBounds(t);null!=e&&!Number.isNaN(e)&&o&&(e+o>f[1]&&(f[1]=e+o),f[0]>e-o&&(f[0]=e-o))}}const e=f[1]-f[0],t=e>0?e*l.extentPadding:1,o=null===(s=l.yExtent)||void 0===s?void 0:s[0],n=null===(a=l.yExtent)||void 0===a?void 0:a[1];f=[null!=o?f[0]:f[0]-t,null!=n?f[1]:f[1]+t]}if(h[0]!==1/0&&h[1]!==-1/0||(h=[0,1]),f[0]!==1/0&&f[1]!==-1/0||(f=[0,1]),void 0!==l.arrowOfTime)if("x"==("up"===(m=l.arrowOfTime)||"down"===m?"y":"x")){const t="right"===l.arrowOfTime?[0,e.width]:[e.width,0];this.scales={x:n.scaleLinear().domain(h).range(t),y:n.scaleLinear().domain(f).range([e.height,0])}}else{const t="down"===l.arrowOfTime?[0,e.height]:[e.height,0];this.scales={x:n.scaleLinear().domain(f).range([0,e.width]),y:n.scaleLinear().domain(h).range(t)}}else this.scales={x:n.scaleLinear().domain(h).range([0,e.width]),y:n.scaleLinear().domain(f).range([e.height,0])};var m;this.config.transition&&this.scene.length>0&&this.snapshotPositions();const y=c.toArray();this.scene=this.buildSceneNodes(e),this.config.decay&&this.applyDecay(this.scene,y),this.config.pulse&&this.applyPulse(this.scene,y),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}buildSceneNodes(e){const{config:t,buffer:o,scales:n}=this;if(!n||0===o.size)return[];const r=o.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 o=this.groupData(e),n=[],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 o){const t=this.buildBoundsForGroup(e.data,e.key);t&&n.push(t)}for(const e of o){const t=this.resolveLineStyle(e.key,e.data[0]),o=S(e.data,this.scales,this.getX,this.getY,t,e.key);r&&r.length>0&&(o.colorThresholds=r),n.push(o)}return n}buildAreaScene(e){const t=this.groupData(e),o=[],n=this.scales.y.domain()[0];for(const e of t){const t=this.resolveAreaStyle(e.key,e.data[0]);o.push(O(e.data,this.scales,this.getX,this.getY,n,t,e.key))}return o}buildStackedAreaScene(e){return function(e,t,o,n,r,i){var s;const a=new Set;for(const t of e)for(const e of t.data){const t=o(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=o(r),i=n(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 o=0;for(const n of e)o+=(null===(s=c.get(n.key))||void 0===s?void 0:s.get(t))||0;u.set(t,o||1)}}const d=[],h=new Map;for(const e of l)h.set(e,0);for(const o of e){const e=c.get(o.key),n=[],s=[];for(const o of l){let r=e.get(o)||0;const a=h.get(o);i&&(r/=u.get(o));const l=t.x(o);s.push([l,t.y(a)]),n.push([l,t.y(a+r)]),h.set(o,a+r)}d.push({type:"area",topPath:n,bottomPath:s,style:r(o.key,o.data[0]),datum:o.data,group:o.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=[],o="bubble"===this.config.chartType?10:5,n=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),o=Math.max(...t);r=t=>e===o?(n[0]+n[1])/2:n[0]+(t-e)/(o-e)*(n[1]-n[0])}}let i=null;if(this.getColor&&!this.config.pointStyle){const t=new Set;for(const o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];i=new Map;let n=0;for(const e of t)i.set(e,o[n%o.length]),n++}for(const n of e){let e=this.config.pointStyle?this.config.pointStyle(n):{fill:"#4e79a7",opacity:.8},s=e.r||o;if(r&&this.getSize){const e=this.getSize(n);null==e||Number.isNaN(e)||(s=r(e))}if(i&&this.getColor){const t=this.getColor(n);t&&i.has(t)&&(e=Object.assign(Object.assign({},e),{fill:i.get(t)}))}const a=P(n,this.scales,this.getX,this.getY,s,e);a&&t.push(a)}return t}buildHeatmapScene(e,t){const o=[];if(this.config.heatmapAggregation)return this.buildStreamingHeatmapScene(e,t);const n=_(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 o;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:n(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 f=h-d||1;for(let e=0;s.length>e;e++)for(let t=0;a.length>t;t++){const n=u.get(`${s[e]}_${a[t]}`);if(!n)continue;const r=(n.val-d)/f;o.push(N(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)})`,n.datum))}return o}buildStreamingHeatmapScene(e,t){var o,n,r;const i=[],s=null!==(o=this.config.heatmapXBins)&&void 0!==o?o:20,a=null!==(n=this.config.heatmapYBins)&&void 0!==n?n:20,l=null!==(r=this.config.heatmapAggregation)&&void 0!==r?r:"count",c=_(this.config.valueAccessor,"value");if(!this.scales||0===e.length)return i;const[u,d]=this.scales.x.domain(),[h,f]=this.scales.y.domain(),p=(d-u||1)/s,m=(f-h||1)/a,y=new Map;for(const t of e){const e=this.getX(t),o=this.getY(t),n=Math.min(Math.floor((e-u)/p),s-1),r=Math.min(Math.floor((o-h)/m),a-1);if(0>n||0>r)continue;const i=`${n}_${r}`;let l=y.get(i);l||(l={sum:0,count:0,data:[]},y.set(i,l)),l.count++,l.sum+=c(t),l.data.push(t)}let g=1/0,v=-1/0;const b=new Map;for(const[e,t]of y){let o;switch(l){case"sum":o=t.sum;break;case"mean":o=t.count>0?t.sum/t.count:0;break;default:o=t.count}b.set(e,o),g>o&&(g=o),o>v&&(v=o)}const x=v-g||1,k=t.width/s,w=t.height/a;for(const[e,t]of b){const[o,n]=e.split("_"),r=+o,s=+n,l=(t-g)/x,c=`rgb(${Math.round(220-180*l)},${Math.round(220-100*l)},${Math.round(255-50*l)})`,u=y.get(e);i.push(N(r*k,(a-1-s)*w,k,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 o=M(e,this.getX,this.getY,this.config.binSize,this.getCategory);if(0===o.size)return[];let n=null;if(this.getCategory){const e=new Set;for(const t of o.values())for(const o of t.categories.keys())e.add(o);const t=this.config.barColors?Object.keys(this.config.barColors):[],r=new Set(t),i=Array.from(e).filter(e=>!r.has(e)).sort();n=[...t.filter(t=>e.has(t)),...i]}const r=[],i=this.scales,[s,a]=i.x.domain();for(const e of o.values()){const o=Math.max(e.start,s),l=Math.min(e.end,a);if(o>=l)continue;const c=i.x(o),u=i.x(l),d=Math.min(c,u)+.5,h=Math.max(c,u)-.5-d;if(h>0)if(n&&e.categories.size>0){let o=0;for(const s of n){const n=e.categories.get(s)||0;if(0===n)continue;const a=i.y(o),l=i.y(o+n);r.push(j(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:n},s)),o+=n}}else{const t=i.y(0),o=i.y(e.total);r.push(j(d,Math.min(t,o),h,Math.abs(t-o),{fill:"#007bff"},{binStart:e.start,binEnd:e.end,total:e.total}))}}return r}buildSwarmScene(e){var t,o,n,r;const i=[],s=this.config.swarmStyle||{},a=null!==(t=s.radius)&&void 0!==t?t:3,l=null!==(o=s.fill)&&void 0!==o?o:"#007bff",c=null!==(n=s.opacity)&&void 0!==n?n:.7,u=s.stroke,d=s.strokeWidth;for(const t of e){const e=this.getX(t),o=this.getY(t);if(null==o||Number.isNaN(o))continue;const n=this.scales.x(e),s=this.scales.y(o);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:n,y:s,r:a,style:{fill:h,opacity:c,stroke:u,strokeWidth:d},datum:t})}return i}buildWaterfallScene(e,t){const o=[],n=this.scales,r=e.filter(e=>{const t=this.getY(e);return null!=t&&!Number.isNaN(t)});if(0===r.length)return o;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=n.x(a),h=0!==u?n.x(a+u):d+t.width/10,f=Math.min(d,h)+.5,p=Math.max(d,h)-.5-f;if(0>=p){i=c;continue}const m=n.y(i),y=n.y(c);o.push(j(f,Math.min(m,y),p,Math.abs(m-y),{fill:0>l?"#dc3545":"#28a745"},Object.assign(Object.assign({},s),{baseline:i,cumEnd:c,delta:l}))),i=c}return o}buildCandlestickScene(e,t){if(!(this.getOpen&&this.getHigh&&this.getLow&&this.getClose&&this.scales))return[];const o=[],n=this.config.candlestickStyle||{},r=n.upColor||"#28a745",i=n.downColor||"#dc3545",s=n.wickColor||"#333",a=n.wickWidth||1,l=e.map(e=>this.getX(e)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let c=n.bodyWidth||6;if(!n.bodyWidth&&l.length>1){let e=1/0;for(let t=1;l.length>t;t++){const o=Math.abs(this.scales.x(l[t])-this.scales.x(l[t-1]));o>0&&e>o&&(e=o)}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 n=this.getOpen(t),l=this.getHigh(t),u=this.getLow(t),d=this.getClose(t);if([n,l,u,d].some(e=>null==e||Number.isNaN(e)))continue;const h=d>=n;o.push({type:"candlestick",x:this.scales.x(e),openY:this.scales.y(n),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 o}buildBoundsForGroup(e,t){if(!this.getBounds||!this.scales)return null;const o=[],n=[];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)o.push([s,this.scales.y(r+i)]),n.push([s,this.scales.y(r-i)]);else{const e=this.scales.y(r);o.push([s,e]),n.push([s,e])}}return 2>o.length?null:{type:"area",topPath:o,bottomPath:n,style:this.resolveBoundsStyle(t,e[0]),datum:e,group:t,interactive:!1}}resolveBoundsStyle(e,t){const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){var o,n,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(o=i.minOpacity)&&void 0!==o?o:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(n=i.halfLife)&&void 0!==n?n: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 o,n;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!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:e*s})}}}computePulseIntensity(e,t){var o;const n=this.config.pulse;if(!n)return 0;const r=null!==(o=n.duration)&&void 0!==o?o:500,i=t-e;return r>i?1-i/r:0}applyPulse(e,t){var o;if(!this.config.pulse||!this.timestampBuffer)return;const n="undefined"!=typeof performance?performance.now():Date.now(),r=null!==(o=this.config.pulse.color)&&void 0!==o?o:"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 o=this.timestampBuffer.get(e);if(null==o)continue;const s=this.computePulseIntensity(o,n);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(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}snapshotPositions(){this.prevPositionMap.clear();for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeIdentity(t,e);o&&("point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:t.r}):"rect"===t.type||"heatcell"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,w:t.w,h:t.h}):"candlestick"===t.type&&this.prevPositionMap.set(o,{x:t.x,y:t.openY}))}}getNodeIdentity(e,t){var o,n,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!==(n=null===(o=e.datum)||void 0===o?void 0:o.binStart)&&void 0!==n?n: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,o,n,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!==(o=c.w)&&void 0!==o?o:s.w,s.h=null!==(n=c.h)&&void 0!==n?n: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 o=Math.min((e-this.activeTransition.startTime)/this.activeTransition.duration,1),n="linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?o:1-Math.pow(1-o,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 o=this.prevPositionMap.get(t);if(!o)continue;e.x=o.x+(e._targetX-o.x)*n,e.y=o.y+(e._targetY-o.y)*n,void 0!==e._targetR&&void 0!==o.r&&(e.r=o.r+(e._targetR-o.r)*n)}else if("rect"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=o.x+(e._targetX-o.x)*n,e.y=o.y+(e._targetY-o.y)*n,void 0!==o.w&&(e.w=o.w+(e._targetW-o.w)*n),void 0!==o.h&&(e.h=o.h+(e._targetH-o.h)*n)}else if("heatcell"===e.type){if(void 0===e._targetX)continue;const t=this.getNodeIdentity(e,0);if(!t)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=o.x+(e._targetX-o.x)*n,e.y=o.y+(e._targetY-o.y)*n,void 0!==o.w&&(e.w=o.w+(e._targetW-o.w)*n),void 0!==o.h&&(e.h=o.h+(e._targetH-o.h)*n)}if(o>=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 o of e){const e=this.getGroup(o);t.has(e)||t.set(e,[]),t.get(e).push(o)}return Array.from(t.entries()).map(([e,t])=>({key:e,data:t}))}resolveLineStyle(e,t){const o=this.config.lineStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?{stroke:o.stroke||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o;if(this.config.areaStyle)return this.config.areaStyle(t||{});const n=this.config.lineStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?{fill:n.fill||n.stroke||"#4e79a7",fillOpacity:null!==(o=n.fillOpacity)&&void 0!==o?o:.7,stroke:n.stroke||"#4e79a7",strokeWidth:n.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 $(e,t,o){const n=t-e.x,r=o-e.y,i=Math.sqrt(n*n+r*r);return i>e.r+5?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:i}}function B(e,t,o){if(0===e.path.length)return null;const n=R(e.path,t);if(0>n)return null;const[r,i]=e.path[n],s=t-r,a=o-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:r,y:i,distance:l}}function L(e,t,o){return e.x>t||t>e.x+e.w||e.y>o||o>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 D(e,t,o){return e.x>t||t>e.x+e.w||e.y>o||o>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 T(e,t,o){const n=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-n-3>t||t>e.x+n+3||e.highY-3>o||o>e.lowY+3)){const n=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(i*i+s*s)}}return null}function W(e,t,o){if(0===e.topPath.length)return null;const n=R(e.topPath,t);if(0>n)return null;const[r,i]=e.topPath[n],s=t-r,a=o-i;return{node:e,datum:e.datum,x:r,y:i,distance:Math.sqrt(s*s+a*a)}}function R(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const r=o+n>>1;t>e[r][0]?o=r+1:n=r}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}const F={fill:e=>v.createElement("rect",{style:e,width:20,height:20}),line:e=>v.createElement("line",{style:e,x1:0,y1:0,x2:20,y2:20})};function H(e,t,o,n){let r;return r="function"==typeof o?o(e):(0,F[o])(n(e,t)),r}function I(e){const{legendGroups:t,customClickBehavior:o,title:n="Legend",width:r=100,height:i=20,orientation:s="vertical"}=e,a="vertical"===s?(({legendGroups:e,width:t,customClickBehavior:o})=>{let n=30;const r=[];return e.forEach((e,i)=>{n+=5,r.push(v.createElement("line",{key:"legend-top-line legend-symbol-"+i,stroke:"gray",x1:0,y1:n,x2:t,y2:n})),n+=10,e.label&&(n+=20,r.push(v.createElement("text",{key:"legend-text-"+i,y:n,className:"legend-group-label"},e.label)),n+=10),r.push(v.createElement("g",{key:"legend-group-"+i,className:"legend-item",transform:`translate(0,${n})`},((e,t)=>{const{type:o="fill",styleFn:n,items:r}=e,i=[];let s=0;return r.forEach((e,r)=>{const a=H(e,r,o,n);i.push(v.createElement("g",{key:"legend-item-"+r,transform:`translate(0,${s})`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},a,v.createElement("text",{y:15,x:30},e.label))),s+=25}),i})(e,o))),n+=25*e.items.length+10}),r})({legendGroups:t,width:r,customClickBehavior:o}):(({legendGroups:e,title:t,height:o,customClickBehavior:n})=>{let r=0;const i=[],s=!1===t?10:40;return e.forEach((t,a)=>{t.label&&(i.push(v.createElement("text",{key:"legend-text-"+a,transform:`translate(${r},${s}) rotate(90)`,textAnchor:"start",className:"legend-group-label"},t.label)),r+=20);const l=((e,t)=>{const{type:o="fill",styleFn:n,items:r}=e,i=[];let s=0;return r.forEach((e,r)=>{const a=H(e,r,o,n);i.push(v.createElement("g",{key:"legend-item-"+r,transform:`translate(${s},0)`,onClick:t?()=>t(e):void 0,style:{cursor:t?"pointer":"default"}},a,v.createElement("text",{y:15,x:25},e.label))),s+=35,s+=8*e.label.length}),{items:i,offset:s}})(t,n);i.push(v.createElement("g",{key:"legend-group-"+a,className:"legend-item",transform:`translate(${r},${s})`},l.items)),r+=l.offset+5,e[a+1]&&i.push(v.createElement("line",{key:"legend-top-line legend-symbol-"+a,stroke:"gray",x1:r,y1:s-10,x2:r,y2:o+s+10})),r+=15}),v.createElement("g",null,!1!==t&&v.createElement("line",{x1:0,x2:r+10,y1:s-10,y2:s-10,stroke:"gray",className:"title-neatline"}),i)})({legendGroups:t,title:n,height:i,customClickBehavior:o});return v.createElement("g",null,void 0!==n&&v.createElement("text",{className:"legend-title",y:20,x:"horizontal"===s?0:r/2,textAnchor:"horizontal"===s?"start":"middle"},n),a)}function Y(e){return"string"==typeof e?{type:e}:e}function X({orient:t,config:o,values:n,scale:i,size:s,length:a}){const l=function(e){var t,o,n,r,i;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(o=e.fill)&&void 0!==o?o:"#4e79a7",fillOpacity:null!==(n=e.fillOpacity)&&void 0!==n?n:.5,stroke:null!==(r=e.stroke)&&void 0!==r?r:"none",strokeWidth:null!==(i=e.strokeWidth)&&void 0!==i?i:1}}(o),c="top"===t||"bottom"===t,u=e.useMemo(()=>{if(0===n.length)return null;const e=i.domain(),o=s-8;if("boxplot"===l.type){const e=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const n=t[Math.floor(.25*o)],r=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],s=i-n;return{q1:n,median:r,q3:i,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],i+1.5*s)}}(n);if(!e)return null;const{q1:r,median:s,q3:a,whiskerLow:u,whiskerHigh:d}=e,h=Math.min(.5*o,20),f=(o-h)/2+4;if(c){const e=i(r),o=i(a),n=i(s),c=i(u),p=i(d),m="top"===t?-1:1,y=0;return v.createElement("g",{"data-testid":"marginal-boxplot-"+t},v.createElement("line",{x1:c,y1:y+m*(f+h/2),x2:p,y2:y+m*(f+h/2),stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:c,y1:y+m*f,x2:c,y2:y+m*(f+h),stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:p,y1:y+m*f,x2:p,y2:y+m*(f+h),stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("rect",{x:Math.min(e,o),y:"top"===t?y-f-h:y+f,width:Math.abs(o-e),height:h,fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:n,y1:"top"===t?y-f-h:y+f,x2:n,y2:"top"===t?y-f:y+f+h,stroke:l.fill,strokeWidth:2}))}{const e=i(r),o=i(a),n=i(s),c=i(u),p=i(d),m="left"===t?-1:1,y=0;return v.createElement("g",{"data-testid":"marginal-boxplot-"+t},v.createElement("line",{x1:y+m*(f+h/2),y1:c,x2:y+m*(f+h/2),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:y+m*f,y1:c,x2:y+m*(f+h),y2:c,stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:y+m*f,y1:p,x2:y+m*(f+h),y2:p,stroke:l.fill,strokeWidth:l.strokeWidth}),v.createElement("rect",{x:"left"===t?y-f-h:y+f,y:Math.min(e,o),width:h,height:Math.abs(o-e),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}),v.createElement("line",{x1:"left"===t?y-f-h:y+f,y1:n,x2:"left"===t?y-f:y+f+h,y2:n,stroke:l.fill,strokeWidth:2}))}}const u=r.bin().domain(e).thresholds(l.bins)(n);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 v.createElement("g",{"data-testid":"marginal-histogram-"+t},u.map((e,n)=>{if(null==e.x0||null==e.x1)return null;const r=e.length/d*o;if(c){const o=i(e.x0),s=i(e.x1)-i(e.x0);return v.createElement("rect",{key:n,x:o,y:"top"===t?-4-r:4,width:Math.max(s,.5),height:r,fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}{const o=i(e.x0),s=i(e.x1)-i(e.x0);return v.createElement("rect",{key:n,x:"left"===t?-4-r:4,y:Math.min(o,o+s),width:r,height:Math.abs(s),fill:l.fill,fillOpacity:l.fillOpacity,stroke:l.stroke,strokeWidth:l.strokeWidth})}}));if("violin"===l.type){const e=o/2+4,n=[];for(const r of u){if(null==r.x0||null==r.x1)continue;const s=r.length/d*(o/2),a=i((r.x0+r.x1)/2);n.push(c?`${a},${"top"===t?-(e-s):e-s}`:`${"left"===t?-(e-s):e-s},${a}`)}for(let r=u.length-1;r>=0;r--){const s=u[r];if(null==s.x0||null==s.x1)continue;const a=s.length/d*(o/2),l=i((s.x0+s.x1)/2);n.push(c?`${l},${"top"===t?-(e+a):e+a}`:`${"left"===t?-(e+a):e+a},${l}`)}return v.createElement("g",{"data-testid":"marginal-violin-"+t},v.createElement("polygon",{points:n.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}if("ridgeline"===l.type){const e=[];if(c){const n=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${r},${n}`);for(const n of u){if(null==n.x0||null==n.x1)continue;const r=n.length/d*o,s=i((n.x0+n.x1)/2);e.push(`L${s},${"top"===t?-r-4:r+4}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;e.push(`L${s},${n}`),e.push("Z")}else{const n=0,r=null!=u[0].x0?i(u[0].x0):0;e.push(`M${n},${r}`);for(const n of u){if(null==n.x0||null==n.x1)continue;const r=n.length/d*o,s=i((n.x0+n.x1)/2);e.push(`L${"left"===t?-r-4:r+4},${s}`)}const s=null!=u[u.length-1].x1?i(u[u.length-1].x1):a;e.push(`L${n},${s}`),e.push("Z")}return v.createElement("g",{"data-testid":"marginal-ridgeline-"+t},v.createElement("path",{d:e.join(" "),fill:l.fill,fillOpacity:l.fillOpacity,stroke:"none"===l.stroke?l.fill:l.stroke,strokeWidth:l.strokeWidth}))}return null},[n,i,l,s,a,t,c,4]);return u?v.createElement("g",{className:"marginal-"+t,"data-testid":"marginal-"+t},u):null}function G(e){return Math.round(100*e)/100+""}function q(t){const{width:o,height:n,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,showGrid:f,title:p,legend:m,foregroundGraphics:y,marginalGraphics:g,xValues:b,yValues:x,annotations:k,svgAnnotationRules:w,annotationFrame:A,children:E}=t,M=e.useMemo(()=>l&&a?a.x.ticks(5).map(e=>({value:e,pixel:a.x(e),label:(d||G)(e)})):[],[l,a,d]),S=e.useMemo(()=>l&&a?a.y.ticks(5).map(e=>({value:e,pixel:a.y(e),label:(h||G)(e)})):[],[l,a,h]),O=e.useMemo(()=>k&&0!==k.length&&w?k.map((e,t)=>w(e,t,{scales:a?{time:a.x,value:a.y}:null,timeAxis:"x",width:o,height:n})).filter(Boolean):null,[k,w,o,n,A]);return l||p||m||y||g||O&&O.length>0||f||E?v.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},v.createElement("g",{transform:`translate(${s.left},${s.top})`},f&&a&&v.createElement("g",{className:"stream-grid"},M.map((e,t)=>v.createElement("line",{key:"xgrid-"+t,x1:e.pixel,y1:0,x2:e.pixel,y2:n,stroke:"#e0e0e0",strokeWidth:1})),S.map((e,t)=>v.createElement("line",{key:"ygrid-"+t,x1:0,y1:e.pixel,x2:o,y2:e.pixel,stroke:"#e0e0e0",strokeWidth:1}))),l&&a&&v.createElement("g",{className:"stream-axes"},v.createElement("line",{x1:0,y1:n,x2:o,y2:n,stroke:"#ccc",strokeWidth:1}),M.map((e,t)=>v.createElement("g",{key:"xtick-"+t,transform:`translate(${e.pixel},${n})`},v.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&v.createElement("text",{x:o/2,y:n+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},c),v.createElement("line",{x1:0,y1:0,x2:0,y2:n,stroke:"#ccc",strokeWidth:1}),S.map((e,t)=>v.createElement("g",{key:"ytick-"+t,transform:`translate(0,${e.pixel})`},v.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&v.createElement("text",{x:15-s.left,y:n/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-s.left}, ${n/2})`,style:{userSelect:"none"}},u)),O,g&&a&&b&&x&&v.createElement(v.Fragment,null,g.top&&v.createElement("g",{transform:"translate(0, 0)"},v.createElement(X,{orient:"top",config:Y(g.top),values:b,scale:a.x,size:s.top,length:o})),g.bottom&&v.createElement("g",{transform:`translate(0, ${n})`},v.createElement(X,{orient:"bottom",config:Y(g.bottom),values:b,scale:a.x,size:s.bottom,length:o})),g.left&&v.createElement("g",{transform:"translate(0, 0)"},v.createElement(X,{orient:"left",config:Y(g.left),values:x,scale:a.y,size:s.left,length:n})),g.right&&v.createElement("g",{transform:`translate(${o}, 0)`},v.createElement(X,{orient:"right",config:Y(g.right),values:x,scale:a.y,size:s.right,length:n}))),y,E),p&&v.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof p?p:null),m&&v.createElement("g",{transform:`translate(${r-s.right+10}, ${s.top})`},"object"==typeof(P=m)&&null!==P&&!v.isValidElement(P)&&"legendGroups"in P?v.createElement(I,{legendGroups:m.legendGroups,title:"",width:100}):m)):null;var P}function V(e,t,o){let n=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(n=o.color):e>o.value&&(n=o.color);return n}const U=(e,t,o,n)=>{var r;const i=t.filter(e=>"area"===e.type);for(const t of i){if(2>t.topPath.length)continue;e.beginPath();const[o,n]=t.topPath[0];e.moveTo(o,n);for(let o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][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 o=1;t.topPath.length>o;o++)e.lineTo(t.topPath[o][0],t.topPath[o][1]);e.stroke()}e.globalAlpha=1}},K=(e,t,o,n)=>{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 o=null!==(r=t.style.opacity)&&void 0!==r?r:t.style.fillOpacity;if(null!=o&&(e.globalAlpha=o),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 o=4;e.beginPath(),e.arc(t.x,t.y,t.r+o*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}},Z=(e,t,o,n)=>{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?J(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 J(e,t){const o=t.style.icon,n=t.style.iconPadding||2,r=Math.min(t.w,t.w)-n;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+n,s=t.x+(t.w-r)/2;for(let n=t.y+t.h-r;n>=t.y-r;n-=i)e.drawImage(o,s,n,r,r)}else{const i=r+n,s=t.y+(t.h-r)/2;for(let n=t.x;t.x+t.w>n;n+=i)e.drawImage(o,n,s,r,r)}e.restore()}const Q={line:[U,(e,t,o,n)=>{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,f=null,p=!1;function m(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),p=!0}function y(){p&&(e.stroke(),p=!1)}for(let g=0;i.path.length>g;g++){const[v,b]=i.path[g],x=c[g],k=V(x,l,s);if(null!==u&&null!==f&&null!==h){if(k===f)e.lineTo(v,b);else{const w=[];for(const A of l){const E=A.value;(h>E||E>x)&&(E>h||x>E)||h===E||x===E||w.push({t:(E-h)/(x-h)})}w.sort((e,t)=>e.t-t.t);for(const M of w){const S=u+(v-u)*M.t,O=d+(b-d)*M.t,P=V(h+(x-h)*Math.min(M.t+1e-4,1),l,s);e.lineTo(S,O),y(),m(P,S,O)}e.lineTo(v,b)}u=v,d=b,h=x,f=k}else m(k,v,b),u=v,d=b,h=x,f=k}y()}else{e.beginPath(),e.strokeStyle=s;const[j,N]=i.path[0];e.moveTo(j,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[C,z]=i.path[0];e.moveTo(C,z);for(let B=1;i.path.length>B;B++)e.lineTo(i.path[B][0],i.path[B][1]);const $=i.path[0][0];e.lineTo(i.path[i.path.length-1][0],n.height),e.lineTo($,n.height),e.closePath(),e.fill()}e.globalAlpha=1,e.setLineDash([])}}],area:[U],stackedarea:[U],scatter:[K],bubble:[K],heatmap:[(e,t,o,n)=>{const r=t.filter(e=>"heatcell"===e.type);for(const t of r){const o=t.style;null!=(null==o?void 0:o.opacity)&&(e.globalAlpha=o.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:[Z],swarm:[K],waterfall:[(e,t,o,n)=>{var r,i;Z(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 n=s[t],a=s[t+1];if(!(null===(r=n.datum)||void 0===r?void 0:r.cumEnd)||!(null===(i=a.datum)||void 0===i?void 0:i.baseline))continue;const l=o.y(n.datum.cumEnd),c=n.x+n.w,u=a.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[(e,t,o,n)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;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 n=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,n,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(r,1))}}]},ee={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"},oe={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 ne({hover:e}){const t=e=>Number.isInteger(e)?e+"":e.toFixed(2);return v.createElement("div",{className:"semiotic-tooltip",style:oe},v.createElement("div",{style:{fontWeight:600,marginBottom:2}},t(e.value)),v.createElement("div",{style:{opacity:.7,fontSize:11}},t(e.time)))}function re({width:n,height:r,totalWidth:i,totalHeight:s,margin:a,dimension:l,scales:c,onBrush:u}){const d=e.useRef(null),h=e.useRef(null);return e.useEffect(()=>{if(!d.current)return;const e=o.select(d.current).select(".brush-g"),i="x"===l?t.brushX():"y"===l?t.brushY():t.brush();return i.extent([[0,0],[n,r]]),i.on("brush end",e=>{if(!c)return;if(!e.selection)return void u(null);let t,o;if("x"===l){const[n,i]=e.selection;t=[c.x.invert(n),c.x.invert(i)],o=[c.y.invert(r),c.y.invert(0)]}else if("y"===l){const[r,i]=e.selection;t=[c.x.invert(0),c.x.invert(n)],o=[c.y.invert(i),c.y.invert(r)]}else{const[[n,r],[i,s]]=e.selection;t=[c.x.invert(n),c.x.invert(i)],o=[c.y.invert(s),c.y.invert(r)]}u({x:t,y:o})}),e.call(i),h.current=i,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null),h.current=null}},[n,r,l,c,u]),v.createElement("svg",{ref:d,width:i,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},v.createElement("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`}))}const ie=e.forwardRef(function(t,o){var n;const{chartType:r,runtimeMode:i,data:s,xAccessor:a,yAccessor:l,colorAccessor:c,sizeAccessor:u,groupAccessor:d,lineDataAccessor:h,normalize:f,binSize:p,valueAccessor:m,arrowOfTime:y="right",windowMode:g="sliding",windowSize:b=200,timeAccessor:x,xExtent:k,yExtent:A,extentPadding:E=.1,sizeRange:M,size:S=[500,300],margin:O,className:P,background:j,lineStyle:N,pointStyle:_,areaStyle:C,swarmStyle:R,barColors:F,colorScheme:H,boundsAccessor:I,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:V,closeAccessor:U,candlestickStyle:K,showAxes:Z=!0,xLabel:J,yLabel:oe,xFormat:ie,yFormat:se,tickFormatTime:ae,tickFormatValue:le,hoverAnnotation:ce,tooltipContent:ue,customHoverBehavior:de,enableHover:he,annotations:fe,svgAnnotationRules:pe,showGrid:me,legend:ye,backgroundGraphics:ge,foregroundGraphics:ve,title:be,categoryAccessor:xe,brush:ke,onBrush:we,decay:Ae,pulse:Ee,transition:Me,staleness:Se,heatmapAggregation:Oe,heatmapXBins:Pe,heatmapYBins:je,marginalGraphics:Ne}=t,_e=Object.assign(Object.assign({},ee),O);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 Ce=S[0]-_e.left-_e.right,ze=S[1]-_e.top-_e.bottom,$e=null!=ce?ce:he,Be=e.useRef(null),Le=e.useRef(0),De=e.useRef(!1),[Te,We]=e.useState(0),[Re,Fe]=e.useState(null),He=e.useRef(null),[Ie,Ye]=e.useState(null),[Xe,Ge]=e.useState(!1),[qe,Ve]=e.useState([]),[Ue,Ke]=e.useState([]),Ze=e.useRef(()=>{}),Je="streaming"===i||["bar","swarm","waterfall"].includes(r),Qe=e.useMemo(()=>({chartType:r,runtimeMode:Je?"streaming":"bounded",windowSize:b,windowMode:g,arrowOfTime:Je?y:"right",extentPadding:E,xAccessor:Je?void 0:a,yAccessor:Je?void 0:l,timeAccessor:Je?x:void 0,valueAccessor:m,colorAccessor:c,sizeAccessor:u,groupAccessor:d,categoryAccessor:xe,lineDataAccessor:h,xExtent:k,yExtent:A,sizeRange:M,binSize:p,normalize:f,boundsAccessor:I,boundsStyle:Y,openAccessor:X,highAccessor:G,lowAccessor:V,closeAccessor:U,candlestickStyle:K,lineStyle:N,pointStyle:_,areaStyle:C,swarmStyle:R,colorScheme:H,barColors:F,annotations:fe,decay:Ae,pulse:Ee,transition:Me,staleness:Se,heatmapAggregation:Oe,heatmapXBins:Pe,heatmapYBins:je}),[r,b,g,y,E,a,l,x,m,c,u,d,xe,h,k,A,M,p,f,I,Y,X,G,V,U,K,N,_,C,R,H,F,fe,Ae,Ee,Me,Se,Oe,Pe,je,Je]),et=e.useRef(null);et.current||(et.current=new z(Qe));const tt=e.useCallback(()=>{Le.current||(Le.current=requestAnimationFrame(()=>Ze.current()))},[]);e.useEffect(()=>{var e;null===(e=et.current)||void 0===e||e.updateConfig(Qe),De.current=!0,tt()},[Qe,tt]);const ot=e.useRef(null);ot.current||(ot.current=new w(e=>{const t=et.current;t&&t.ingest(e)&&(De.current=!0,tt())}));const nt=e.useCallback(e=>{var t;null===(t=ot.current)||void 0===t||t.push(e)},[]),rt=e.useCallback(e=>{var t;null===(t=ot.current)||void 0===t||t.pushMany(e)},[]),it=e.useCallback(()=>{var e,t;null===(e=ot.current)||void 0===e||e.clear(),null===(t=et.current)||void 0===t||t.clear(),De.current=!0,tt()},[tt]);e.useImperativeHandle(o,()=>({push:nt,pushMany:rt,clear:it,getData:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=et.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[nt,rt,it]),e.useEffect(()=>{var e;s&&(null===(e=ot.current)||void 0===e||e.setBoundedData(s))},[s]);const st=e.useRef(()=>{}),at=e.useRef(()=>{});st.current=e=>{if(!$e)return;const t=Be.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-_e.left,r=e.clientY-o.top-_e.top;if(0>n||n>Ce||0>r||r>ze)return void(He.current&&(He.current=null,Ye(null),de&&de(null),tt()));const i=et.current;if(!i||0===i.scene.length)return;const s=function(e,t,o,n=30){let r=null;for(const i of e){let e=null;switch(i.type){case"point":e=$(i,t,o);break;case"line":e=B(i,t,o);break;case"rect":e=L(i,t,o);break;case"heatcell":e=D(i,t,o);break;case"area":if(!1===i.interactive)break;e=W(i,t,o);break;case"candlestick":e=T(i,t,o)}e&&n>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,n,r);if(!s)return void(He.current&&(He.current=null,Ye(null),de&&de(null),tt()));const a={data:s.datum,time:s.x,value:s.y,x:s.x,y:s.y};He.current=a,Ye(a),de&&de(a),tt()},at.current=()=>{He.current&&(He.current=null,Ye(null),de&&de(null),tt())};const lt=e.useCallback(e=>st.current(e),[]),ct=e.useCallback(()=>at.current(),[]);Ze.current=()=>{var e,t;Le.current=0;const o=Be.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=et.current;if(!i)return;const s="undefined"!=typeof performance?performance.now():Date.now(),c=i.advanceTransition(s);c||i.computeScene({width:Ce,height:ze});const u="undefined"!=typeof window&&window.devicePixelRatio||1;o.width=S[0]*u,o.height=S[1]*u,o.style.width=S[0]+"px",o.style.height=S[1]+"px",n.scale(u,u),n.translate(_e.left,_e.top),n.clearRect(-_e.left,-_e.top,S[0],S[1]);const d=function(e){if(!e)return te;const t=getComputedStyle(e),o=t.getPropertyValue("--text-secondary").trim(),n=t.getPropertyValue("--text-primary").trim(),r=t.getPropertyValue("--surface-3").trim(),i=t.getPropertyValue("--surface-0").trim();return o||n?{axisStroke:r||te.axisStroke,tickText:o||te.tickText,crosshair:o?o+"66":te.crosshair,hoverFill:i?i+"4D":te.hoverFill,hoverStroke:o?o+"99":te.hoverStroke,pointRing:i||te.pointRing}:te}(o),h=null!==(e=null==Se?void 0:Se.threshold)&&void 0!==e?e:5e3,f=Se&&i.lastIngestTime>0&&s-i.lastIngestTime>h;f&&(n.globalAlpha=null!==(t=null==Se?void 0:Se.dimOpacity)&&void 0!==t?t:.5),j&&(n.fillStyle=j,n.fillRect(0,0,Ce,ze));const p=Q[r];if(p&&i.scales)for(const e of p)e(n,i.scene,i.scales,{width:Ce,height:ze});f&&(n.globalAlpha=1),$e&&He.current&&i.scales&&function(e,t,o,n,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,n),e.stroke(),e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,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()}(n,He.current,Ce,ze,"object"==typeof $e?$e:{},0,d);const m=De.current;if(De.current=!1,m&&i.scales&&(Fe(i.scales),Ne)){const e=i.getData(),t="function"==typeof a?a:e=>e[a||"x"],o="function"==typeof l?l:e=>e[l||"y"];Ve(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Ke(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}m&&fe&&fe.length>0&&pe&&We(e=>e+1),(null==Se?void 0:Se.showBadge)&&Ge(!!f),(c||i.hasActivePulses)&&(Le.current=requestAnimationFrame(()=>Ze.current()))},e.useEffect(()=>(tt(),()=>{Le.current&&cancelAnimationFrame(Le.current)}),[tt]),e.useEffect(()=>{De.current=!0,tt()},[r,Ce,ze,Z,j,N,tt]),e.useEffect(()=>{if(!Se)return;const e=setInterval(()=>{var e;const t=et.current;if(!t||0===t.lastIngestTime)return;const o="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=Se.threshold)&&void 0!==e?e:5e3,r=o-t.lastIngestTime>n;r!==Xe&&(Ge(r),De.current=!0,tt())},1e3);return()=>clearInterval(e)},[Se,Xe,tt]);const ut=$e&&Ie?ue?ue(Ie):v.createElement(ne,{hover:Ie}):null,dt=ut?v.createElement("div",{className:"stream-frame-tooltip",style:{position:"absolute",left:_e.left+Ie.x,top:_e.top+Ie.y,transform:`translate(${Ie.x>.7*Ce?"calc(-100% - 12px)":"12px"}, ${.3*ze>Ie.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},ut):null;return v.createElement("div",{className:"stream-xy-frame"+(P?" "+P:""),style:{position:"relative",width:S[0],height:S[1]},onMouseMove:$e?lt:void 0,onMouseLeave:$e?ct:void 0},ge&&v.createElement("svg",{style:{position:"absolute",left:0,top:0,width:S[0],height:S[1],pointerEvents:"none"}},ge),v.createElement("canvas",{ref:Be,style:{position:"absolute",left:0,top:0}}),v.createElement(q,{width:Ce,height:ze,totalWidth:S[0],totalHeight:S[1],margin:_e,scales:Re,showAxes:Z,xLabel:J,yLabel:oe,xFormat:ie||ae,yFormat:se||le,showGrid:me,title:be,legend:ye,foregroundGraphics:ve,marginalGraphics:Ne,xValues:qe,yValues:Ue,annotations:fe,svgAnnotationRules:pe,annotationFrame:Te}),(ke||we)&&v.createElement(re,{width:Ce,height:ze,totalWidth:S[0],totalHeight:S[1],margin:_e,dimension:null!==(n=null==ke?void 0:ke.dimension)&&void 0!==n?n:"xy",scales:Re,onBrush:null!=we?we:()=>{}}),(null==Se?void 0:Se.showBadge)&&v.createElement("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===Se.badgePosition?{top:4,left:4}:"bottom-left"===Se.badgePosition?{bottom:4,left:4}:"bottom-right"===Se.badgePosition?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",background:Xe?"#dc3545":"#28a745",color:"white"})},Xe?"STALE":"LIVE"),dt)});function se(e,t){const{columns:o,config:n,resolvePieceStyle:r}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===n.chartType?n.innerRadius||60:0,l=-Math.PI/2+(n.startAngle||0)*Math.PI/180,c=2*Math.PI;for(const e of Object.values(o)){const t=l+e.pctStart*c,o=l+(e.pctStart+e.pct)*c,n=r(e.pieceData[0],e.name);i.push({type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:t,endAngle:o,style:n,datum:e.pieceData,category:e.name})}return i}ie.displayName="StreamXYFrame";const ae={bar:function(e,t){const{scales:o,columns:n,config:r,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,f=r.normalize;for(const e of Object.values(n)){const t=new Map;for(const o of e.pieceData){const e=s?s(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=i(o),n.pieces.push(o)}let o=0;if(f)for(const e of t.values())o+=Math.abs(e.total);let n=0,r=0;for(const[i,c]of t){let t=c.total;f&&o>0&&(t/=o);const p=a(c.pieces[0],s?i:e.name),m=Object.assign(Object.assign({},c.pieces[0]),{__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name});if(d){const o=l(0>t?r:n+t),s=0>t?l(r+t)-l(r):l(n)-l(n+t);u.push(j(e.x,o,e.width,Math.abs(s),p,m,i)),0>t?r+=t:n+=t}else if(h){const o=l(0>t?r+t:n),s=0>t?l(r)-l(r+t):l(n+t)-l(n);u.push(j(o,e.x,Math.abs(s),e.width,p,m,i)),0>t?r+=t:n+=t}}}return u},clusterbar:function(e,t){const{scales:o,columns:n,getR:r,getGroup:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=[],h=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=i?i(t):"_default";h.has(e)||(h.add(e),d.push(e))}const f=d.length||1;for(const e of Object.values(n)){const t=e.width/f,o=new Map;for(const t of e.pieceData){const e=i?i(t):"_default";o.has(e)||o.set(e,[]),o.get(e).push(t)}for(let n=0;d.length>n;n++){const i=o.get(d[n])||[];for(const o of i){const i=r(o),l=s(o,e.name);if(u){const r=e.x+n*t,s=a(0),u=a(i);c.push(j(r,Math.min(s,u),t,Math.abs(s-u),l,o,d[n]))}else{const r=e.x+n*t,s=a(0),u=a(i);c.push(j(Math.min(s,u),r,Math.abs(u-s),t,l,o,d[n]))}}}}return c},point:function(e,t){var o,n;const{scales:r,columns:i,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=r,d=[],h="vertical"===u,f="radial"===u,p=a.length>0,m=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(i))for(const t of e.pieceData){const r=null!==(o=t.__rIndex)&&void 0!==o?o:0,i=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=p&&a[r]||c,g=l(t,e.name),v=g.r||5;let b,x;if(f){const t=y+(e.pctStart+e.pct/2)*m,o=u(i);b=Math.cos(t)*o,x=Math.sin(t)*o}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:g,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a;for(const e of Object.values(n)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const n=e.pieceData[o],a=r(n),u=i(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,f=c?e.middle+h:s(a),p=c?s(a):e.middle+h;l.push({type:"point",x:f,y:p,r:d,style:u,datum:n})}}return l},pie:se,donut:se,boxplot:function(e,t){var o,n,i,s,a;const{scales:l,columns:c,config:u,getR:d,resolveSummaryStyle:h}=e,{r:f,projection:p}=l,m=[],y="vertical"===p,g=!1!==u.showOutliers;for(const e of Object.values(c)){const t=e.pieceData.map(e=>d(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===t.length)continue;const l=t[0],c=t[t.length-1],u=null!==(o=r.quantile(t,.25))&&void 0!==o?o:l,p=null!==(n=r.quantile(t,.5))&&void 0!==n?n:(l+c)/2,v=null!==(i=r.quantile(t,.75))&&void 0!==i?i:c,b=v-u,x=u-1.5*b,k=v+1.5*b,w=null!==(s=t.find(e=>e>=x))&&void 0!==s?s:l,A=null!==(a=[...t].reverse().find(e=>k>=e))&&void 0!==a?a:c,E=h(e.pieceData[0],e.name),M=[];if(g)for(const t of e.pieceData){const o=d(t);if(x>o||o>k){const n=y?e.middle:f(o),r=y?f(o):e.middle;M.push({px:n,py:r,value:o,datum:t})}}if(m.push({type:"boxplot",x:y?e.middle:0,y:y?0:e.middle,projection:y?"vertical":"horizontal",columnWidth:.6*e.width,minPos:f(w),q1Pos:f(u),medianPos:f(p),q3Pos:f(v),maxPos:f(A),stats:{min:w,q1:u,median:p,q3:v,max:A},style:E,datum:e.pieceData,category:e.name,outliers:M}),g)for(const e of M)m.push({type:"point",x:e.px,y:e.py,r:3,style:{fill:E.fill||"#999",opacity:.6},datum:e.datum})}return m},violin:function(e,t){var o,n,i;const{scales:s,columns:a,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=s,f=[],p="vertical"===h,m=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(a)){const t=e.pieceData.map(e=>c(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const s=t[0],a=t[t.length-1],l=(a-s)/m||1,h=Array(m).fill(0);for(const e of t)h[Math.min(Math.floor((e-s)/l),m-1)]++;const g=Math.max(...h,1),v=e.width/2*.9;let b="";if(p){for(let t=0;m>t;t++){const o=d(s+(t+.5)*l),n=h[t]/g*v;b+=0===t?`M ${e.middle+n} ${o}`:` L ${e.middle+n} ${o}`}for(let t=m-1;t>=0;t--){const o=d(s+(t+.5)*l);b+=` L ${e.middle-h[t]/g*v} ${o}`}b+=" Z"}else{for(let t=0;m>t;t++){const o=d(s+(t+.5)*l),n=h[t]/g*v;b+=0===t?`M ${o} ${e.middle-n}`:` L ${o} ${e.middle-n}`}for(let t=m-1;t>=0;t--)b+=` L ${d(s+(t+.5)*l)} ${e.middle+h[t]/g*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const e=null!==(o=r.quantile(t,.25))&&void 0!==o?o:s,l=null!==(n=r.quantile(t,.5))&&void 0!==n?n:(s+a)/2,c=null!==(i=r.quantile(t,.75))&&void 0!==i?i:a;k={q1Pos:d(e),medianPos:d(l),q3Pos:d(c)}}const w=p?{x:e.x,y:Math.min(d(a),d(s)),width:e.width,height:Math.abs(d(a)-d(s))}:{x:Math.min(d(s),d(a)),y:e.x,width:Math.abs(d(a)-d(s)),height:e.width};f.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:k,style:x,datum:e.pieceData,category:e.name})}return f},histogram:function(e,t){const{scales:o,columns:n,config:r,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=r.bins||25,u=r.normalize;for(const e of Object.values(n)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=Math.min(...t),n=(Math.max(...t)-o)/c||1,r=Array(c).fill(0);for(const e of t)r[Math.min(Math.floor((e-o)/n),c-1)]++;const d=t.length,h=Math.max(...r,1),f=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(o+t*n),c=a(o+(t+1)*n);l.push(j(Math.min(s,c),e.x+e.width-i,Math.abs(c-s),i,f,{bin:t,count:r[t],range:[o+t*n,o+(t+1)*n],category:e.name},e.name))}}return l},ridgeline:function(e,t){var o;const{scales:n,columns:r,config:i,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=i.bins||20,h="horizontal"===c,f=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 n=t[0],r=t[t.length-1],i=(r-n)/d||1,c=Array(d).fill(0);for(const e of t)c[Math.min(Math.floor((e-n)/i),d-1)]++;const p=Math.max(...c,1),m=a(e.pieceData[0],e.name),y=e.width*f;let g="";if(h){const t=e.x+e.width;g=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)g+=` L ${l(n+(e+.5)*i)} ${t-c[e]/p*y}`;g+=` L ${l(r)} ${t} Z`}else{const t=e.x;g=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*i);g+=` L ${t+c[e]/p*y} ${o}`}g+=` L ${t} ${l(r)} Z`}const v=h?{x:Math.min(l(n),l(r)),y:e.x,width:Math.abs(l(r)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(r),l(n)),width:e.width,height:Math.abs(l(r)-l(n))};u.push({type:"violin",pathString:g,translateX:0,translateY:0,bounds:v,style:Object.assign(Object.assign({},m),{fillOpacity:null!==(o=m.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:r,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(n))for(const t of e.pieceData){const o=r(t);if(!o)continue;const[n,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(n,a)),r=s(Math.max(n,a));l.push(j(o,e.x,r-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),r=s(Math.min(n,a));l.push(j(e.x,o,e.width,r-o,u,t,e.name))}}return l}};class le{constructor(e){this.rExtent=new E,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 A(e.windowSize),this.getO=C(e.oAccessor||e.categoryAccessor,"category");const t="streaming"===e.runtimeMode,o=e.rAccessor;Array.isArray(o)?(this.rAccessors=o.map(e=>_(e,"value")),this.getR=this.rAccessors[0],this.rExtents=o.map(()=>new E)):(this.getR=_(t&&(e.timeAccessor||e.valueAccessor)&&e.valueAccessor||o,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=C(e.stackBy),this.getGroup=C(e.groupBy),this.getColor=C(e.colorAccessor),this.getConnector=C(e.connectorAccessor),e.pulse&&(this.timestampBuffer=new A(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 o=e.totalSize||e.inserts.length;o>this.buffer.capacity&&(this.buffer.resize(o),this.timestampBuffer&&o>this.timestampBuffer.capacity&&this.timestampBuffer.resize(o));for(const o of e.inserts)this.buffer.push(o),this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else for(const o of e.inserts){const e=this.buffer.push(o);this.timestampBuffer&&this.timestampBuffer.push(t),this.categories.add(this.getO(o)),this.pushValueExtent(o),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 o="function"==typeof t?t(e):e[t];return Array.isArray(o)&&o.length>=2?[+o[0],+o[1]]:null}computeScene(e){const{config:t,buffer:o}=this;if(0===o.size)return this.scales=null,this.scene=[],this.columns={},void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const r=o.toArray(),i=t.projection||"vertical",s=t.oExtent||this.resolveCategories(r),a=this.computeValueDomain(r,s),l="horizontal"===i,c=null!=t.barPadding?t.barPadding/("vertical"===i?e.width:e.height):.1;let u,d;if("radial"===i){u=n.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;d=n.scaleLinear().domain(a).range([r,o])}else l?(u=n.scaleBand().domain(s).range([0,e.height]).padding(c),d=n.scaleLinear().domain(a).range([0,e.width])):(u=n.scaleBand().domain(s).range([0,e.width]).padding(c),d=n.scaleLinear().domain(a).range([e.height,0]));this.scales={o:u,r:d,projection:i},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,i)=>{const s=this.rExtents[i];s.dirty&&s.recalculate(o,r);let[a,c]=s.extent;a===1/0&&(a=0,c=1);const u=c-a,d=u>0?u*(t.extentPadding||.05):1;return a-=d,c+=d,a>0&&(a=0),l?n.scaleLinear().domain([a,c]).range([0,e.width]):n.scaleLinear().domain([a,c]).range([e.height,0])}):[];let h=r;this.rAccessors.length>1&&(h=r.flatMap(e=>this.rAccessors.map((t,o)=>Object.assign(Object.assign({},e),{__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(h,s,u,i,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(h,e),this.config.decay&&this.applyDecay(this.scene,r),this.config.pulse&&this.applyPulse(this.scene,r),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),o=this.config.oSort;if("streaming"===this.config.runtimeMode&&void 0===o)return t;if(!1===o)return t;if("function"==typeof o)return t.sort(o);const n=new Map;for(const t of e){const e=this.getO(t);n.set(e,(n.get(e)||0)+Math.abs(this.getR(t)))}return t.sort("asc"===o?(e,t)=>(n.get(e)||0)-(n.get(t)||0):(e,t)=>(n.get(t)||0)-(n.get(e)||0))}computeValueDomain(e,t){var o,n;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,o=new Map;for(const n of e){const e=this.getO(n),r=this.getR(n);0>r?o.set(e,(o.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 o.values())s>e&&(s=e)}else if("bar"===r){const t=new Map;for(const o of e){const e=this.getO(o),n=this.getR(o);t.set(e,(t.get(e)||0)+n)}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===(o=this.config.rExtent)||void 0===o?void 0:o[0])||(s-=c),(null===(n=this.config.rExtent)||void 0===n?void 0:n[1])||(a+=c),"bar"!==r&&"clusterbar"!==r||(s>0&&(s=0),0>a&&(a=0)),[s,a]}buildColumns(e,t,o,n,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"===n)for(const t of e)l+=Math.abs(this.getR(t));const c=this.config.dynamicColumnWidth;let u=null;if(c&&"radial"!==n){u=new Map;let e=0;for(const o of t){const t=a.get(o)||[];let n;n="string"==typeof c?t.reduce((e,t)=>e+(Number(t[c])||0),0):c(t),u.set(o,n),e+=n}const i=("horizontal"===n?r.height:r.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*i)}let d=0,h=0;for(const e of t){const t=a.get(e)||[],n=t.reduce((e,t)=>e+Math.abs(this.getR(t)),0),r=l>0?n/l:0;let c,f;u?(c=h,f=u.get(e)||o.bandwidth(),h+=f+o.padding()*o.step()):(c=null!==(i=o(e))&&void 0!==i?i:0,f=o.bandwidth()),s[e]={name:e,x:c,y:0,width:f,middle:c+f/2,padding:o.padding()*o.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 o=this.getSceneContext(),n=ae[this.config.chartType];let r=n?n(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:n,getConnector:r,getO:i}=e;if(!r||!o)return[];const s=[],{projection:a}=o,l=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=r(t);if(!o)continue;let n,s;"point"===e.type?(n=e.x,s=e.y):(n=e.x+e.w/2,s=e.y+("vertical"===a?0:e.h/2)),l.has(o)||l.set(o,[]),l.get(o).push({x:n,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=n.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 o=0;t.length-1>o;o++){const n=t[o],r=t[o+1],i="function"==typeof u?u(n.datum):u||{stroke:"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:n.x,y1:n.y,x2:r.x,y2:r.y,style:i,datum:n.datum,group:e})}}return s}(o,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 o=Array.isArray(this.config.colorScheme)?this.config.colorScheme:["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],n=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,n),n}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 o,n,r;const i=this.config.decay;if(!i||1>=t)return 1;const s=null!==(o=i.minOpacity)&&void 0!==o?o:.1,a=t-1-e;switch(i.type){case"linear":return s+(1-a/(t-1))*(1-s);case"exponential":{const e=null!==(n=i.halfLife)&&void 0!==n?n: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 o,n;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!==(n=null===(o=t.style)||void 0===o?void 0:o.opacity)&&void 0!==n?n:1;t.style=Object.assign(Object.assign({},t.style),{opacity:a*s})}}applyPulse(e,t){var o,n;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,s=null!==(n=this.config.pulse.color)&&void 0!==n?n:"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 o=this.timestampBuffer.get(e);if(null==o)continue;const n=r-o;i>n&&(t._pulseIntensity=1-n/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(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}snapshotPositions(){var e,t;this.prevPositionMap.clear();for(let o=0;this.scene.length>o;o++){const n=this.scene[o];if("point"===n.type)this.prevPositionMap.set("p:"+o,{x:n.x,y:n.y,r:n.r});else if("rect"===n.type){const r=`r:${n.group||""}:${null!==(t=null===(e=n.datum)||void 0===e?void 0:e.category)&&void 0!==t?t:o}`;this.prevPositionMap.set(r,{x:n.x,y:n.y,w:n.w,h:n.h})}}}startTransition(){var e,t,o,n,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!==(o=null===(t=i.datum)||void 0===t?void 0:t.category)&&void 0!==o?o: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!==(n=l.w)&&void 0!==n?n: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,o,n;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!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n: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 ce(e,t,o){return e.x>t||t>e.x+e.w||e.y>o||o>e.y+e.h?null:{datum:e.datum,x:e.x+e.w/2,y:e.y,distance:0,category:e.group}}function ue(e,t,o){const n=t-e.x,r=o-e.y,i=Math.sqrt(n*n+r*r);return i>Math.max(e.r,5)?null:{datum:e.datum,x:e.x,y:e.y,distance:i}}function de(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerRadius>i||i>e.outerRadius)return null;let s=Math.atan2(r,n);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 he(e,t,o){const n=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-n>t||t>e.x+n||Math.min(e.minPos,e.maxPos)>o||o>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-n,i=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||r>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category}}return null}function fe(e,t,o){if(!e.bounds)return null;const{x:n,y:r,width:i,height:s}=e.bounds;return n>t||t>n+i||r>o||o>r+s?null:{datum:e.datum,x:n+i/2,y:r+s/2,distance:0,category:e.category}}function pe(e){return Math.round(100*e)/100+""}function me(t){const{width:o,height:n,totalWidth:r,totalHeight:i,margin:s,scales:a,showAxes:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:f,title:p,legend:m,foregroundGraphics:y,annotations:g,svgAnnotationRules:b,annotationFrame:x,children:k}=t,w="radial"===(null==a?void 0:a.projection),A="horizontal"===(null==a?void 0:a.projection),E=e.useMemo(()=>l&&a&&!w?a.o.domain().map(e=>{var t;return{value:e,pixel:(null!==(t=a.o(e))&&void 0!==t?t:0)+a.o.bandwidth()/2,label:d?d(e):e}}):[],[l,a,d,w]),M=e.useMemo(()=>l&&a&&!w?a.r.ticks(5).map(e=>({value:e,pixel:a.r(e),label:(h||pe)(e)})):[],[l,a,h,w]),S=e.useMemo(()=>g&&0!==g.length&&b?g.map((e,t)=>b(e,t,{scales:a?{time:a.r,value:a.r}:null,timeAxis:"x",width:o,height:n})).filter(Boolean):null,[g,b,o,n,x]);return l||p||m||y||S&&S.length>0||f||k?v.createElement("svg",{width:r,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},v.createElement("g",{transform:`translate(${s.left},${s.top})`},f&&a&&!w&&v.createElement("g",{className:"ordinal-grid"},M.map((e,t)=>v.createElement("line",{key:"grid-"+t,x1:A?e.pixel:0,y1:A?0:e.pixel,x2:A?e.pixel:o,y2:A?n:e.pixel,stroke:"#e0e0e0",strokeWidth:1}))),l&&a&&!w&&v.createElement("g",{className:"ordinal-axes"},A?v.createElement(v.Fragment,null,v.createElement("line",{x1:0,y1:0,x2:0,y2:n,stroke:"#ccc",strokeWidth:1}),E.map((e,t)=>v.createElement("g",{key:"cat-"+t,transform:`translate(0,${e.pixel})`},v.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&v.createElement("text",{x:15-s.left,y:n/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-s.left}, ${n/2})`,style:{userSelect:"none"}},c),v.createElement("line",{x1:0,y1:n,x2:o,y2:n,stroke:"#ccc",strokeWidth:1}),M.map((e,t)=>v.createElement("g",{key:"val-"+t,transform:`translate(${e.pixel},${n})`},v.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&v.createElement("text",{x:o/2,y:n+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},u)):v.createElement(v.Fragment,null,v.createElement("line",{x1:0,y1:n,x2:o,y2:n,stroke:"#ccc",strokeWidth:1}),E.map((e,t)=>v.createElement("g",{key:"cat-"+t,transform:`translate(${e.pixel},${n})`},v.createElement("line",{y2:5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{y:18,textAnchor:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),c&&v.createElement("text",{x:o/2,y:n+40,textAnchor:"middle",fontSize:12,fill:"#333",style:{userSelect:"none"}},c),v.createElement("line",{x1:0,y1:0,x2:0,y2:n,stroke:"#ccc",strokeWidth:1}),M.map((e,t)=>v.createElement("g",{key:"val-"+t,transform:`translate(0,${e.pixel})`},v.createElement("line",{x2:-5,stroke:"#ccc",strokeWidth:1}),v.createElement("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fontSize:10,fill:"#666",style:{userSelect:"none"}},e.label))),u&&v.createElement("text",{x:15-s.left,y:n/2,textAnchor:"middle",fontSize:12,fill:"#333",transform:`rotate(-90, ${15-s.left}, ${n/2})`,style:{userSelect:"none"}},u))),S,y,k),p&&v.createElement("text",{x:r/2,y:20,textAnchor:"middle",fontSize:14,fontWeight:"bold",fill:"#333",style:{userSelect:"none"}},"string"==typeof p?p:null),m&&v.createElement("g",{transform:`translate(${r-s.right+10}, ${s.top})`},"object"==typeof(O=m)&&null!==O&&!v.isValidElement(O)&&"legendGroups"in O?v.createElement(I,{legendGroups:m.legendGroups,title:"",width:100}):m)):null;var O}const ye=(e,t,o,n)=>{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},ge=(e,t,o,n)=>{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 o=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(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),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()}},ve=(e,t,o,n)=>{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 o=t[0].style;if(o.fill&&"none"!==o.fill){e.beginPath(),e.moveTo(t[0].x1,t[0].y1);for(const o of t)e.lineTo(o.x2,o.y2);e.closePath(),e.globalAlpha=null!==(i=null!==(r=o.fillOpacity)&&void 0!==r?r:o.opacity)&&void 0!==i?i:.3,e.fillStyle=o.fill,e.fill(),e.globalAlpha=1}for(const o of t)e.beginPath(),e.moveTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.strokeStyle=o.style.stroke||o.style.fill||"#999",e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},be=e=>[ve,...e],xe={bar:be([Z]),clusterbar:be([Z]),point:be([K]),swarm:be([K]),pie:[ye],donut:[ye],boxplot:be([(e,t,o,n)=>{var r,i;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="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(),n?(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(),n?(e.moveTo(t.x-.4*o,t.minPos),e.lineTo(t.x+.4*o,t.minPos),e.moveTo(t.x-.4*o,t.maxPos),e.lineTo(t.x+.4*o,t.maxPos)):(e.moveTo(t.minPos,t.y-.4*o),e.lineTo(t.minPos,t.y+.4*o),e.moveTo(t.maxPos,t.y-.4*o),e.lineTo(t.maxPos,t.y+.4*o)),e.stroke(),e.globalAlpha=c,e.fillStyle=s,n){const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,r),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,r)}else{const n=Math.min(t.q1Pos,t.q3Pos),r=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,r,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,r,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),n?(e.moveTo(t.x-o,t.medianPos),e.lineTo(t.x+o,t.medianPos)):(e.moveTo(t.medianPos,t.y-o),e.lineTo(t.medianPos,t.y+o)),e.stroke(),e.restore()}},K]),violin:be([ge]),histogram:be([Z]),ridgeline:be([ge]),timeline:be([Z])},ke={top:50,right:40,bottom:60,left:70},we={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 Ae({hover:e}){var t,o,n,r;const i=e.data||{};if(Array.isArray(i)){const e=(null===(t=i[0])||void 0===t?void 0:t.category)||"",o=i.length;return v.createElement("div",{className:"semiotic-tooltip",style:we},e&&v.createElement("div",{style:{fontWeight:"bold"}},e+""),v.createElement("div",null,o," items"))}if(null!=i.bin&&null!=i.count){const e=i.range||[];return v.createElement("div",{className:"semiotic-tooltip",style:we},i.category&&v.createElement("div",{style:{fontWeight:"bold"}},i.category+""),v.createElement("div",null,"Count: ",i.count),2===e.length&&v.createElement("div",{style:{opacity:.8}},Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)))}const s=i.category||i.name||i.group||i.__rName||"",a=null!==(r=null!==(n=null!==(o=i.value)&&void 0!==o?o:i.__rValue)&&void 0!==n?n:i.pct)&&void 0!==r?r:"";if(!s&&""===a){const e=Object.entries(i).filter(([e])=>!e.startsWith("_")&&"data"!==e);return v.createElement("div",{className:"semiotic-tooltip",style:we},e.map(([e,t])=>v.createElement("div",{key:e},v.createElement("span",{style:{opacity:.7}},e,":")," ","number"==typeof t?t.toLocaleString():t+"")))}return v.createElement("div",{className:"semiotic-tooltip",style:we},s&&v.createElement("div",{style:{fontWeight:"bold"}},s+""),""!==a&&v.createElement("div",null,"number"==typeof a?a.toLocaleString():a+""))}const Ee=e.forwardRef(function(t,o){const{chartType:n,runtimeMode:r,data:i,oAccessor:s="category",rAccessor:a="value",colorAccessor:l,stackBy:c,groupBy:u,multiAxis:d,timeAccessor:h,valueAccessor:f,categoryAccessor:p,projection:m="vertical",size:y=[600,400],margin:g,barPadding:b,innerRadius:x,normalize:k,startAngle:A,dynamicColumnWidth:E,bins:M,showOutliers:S,showIQR:O,amplitude:P,connectorAccessor:j,connectorStyle:N,rExtent:_,oExtent:C,extentPadding:z=.05,oSort:$,windowMode:B="sliding",windowSize:L=200,pieceStyle:D,summaryStyle:T,colorScheme:W,barColors:R,showAxes:F=!0,oLabel:H,rLabel:I,oFormat:Y,rFormat:X,enableHover:G=!0,hoverAnnotation:q,tooltipContent:V,customHoverBehavior:U,annotations:K,svgAnnotationRules:Z,showGrid:J=!1,legend:Q,backgroundGraphics:ee,foregroundGraphics:te,title:oe,className:ne,background:re,centerContent:ie,decay:se,pulse:ae,transition:pe,staleness:ye}=t,ge=e.useMemo(()=>Object.assign(Object.assign({},ke),g),[g]),ve=y[0]-ge.left-ge.right,be=y[1]-ge.top-ge.bottom,we=e.useRef(null),Ee=e.useRef(!0),Me=e.useRef(0),Se=e.useRef(null),Oe=e.useRef(()=>{}),[Pe,je]=e.useState(null),[Ne,_e]=e.useState(null),[Ce,ze]=e.useState(0),[$e,Be]=e.useState(!1),Le=G||q,De="streaming"===r,Te=e.useMemo(()=>({chartType:n,runtimeMode:De?"streaming":"bounded",windowSize:L,windowMode:B,extentPadding:z,projection:m,oAccessor:De?void 0:s,rAccessor:De?void 0:a,colorAccessor:l,stackBy:c,groupBy:u,multiAxis:d,timeAccessor:De?h:void 0,valueAccessor:De?f||("string"==typeof a||"function"==typeof a?a:void 0):void 0,categoryAccessor:De?p||s:void 0,rExtent:_,oExtent:C,barPadding:b,innerRadius:x,normalize:k,startAngle:A,dynamicColumnWidth:E,bins:M,showOutliers:S,showIQR:O,amplitude:P,connectorAccessor:j,connectorStyle:N,oSort:$,pieceStyle:D,summaryStyle:T,colorScheme:W,barColors:R,decay:se,pulse:ae,transition:pe,staleness:ye}),[n,L,B,z,m,s,a,l,c,u,d,h,f,p,_,C,b,x,k,A,E,M,S,O,P,j,N,$,D,T,W,R,se,ae,pe,ye,De]),We=e.useRef(null);We.current||(We.current=new le(Te));const Re=e.useCallback(()=>{Me.current||(Me.current=requestAnimationFrame(()=>Oe.current()))},[]);e.useEffect(()=>{var e;null===(e=We.current)||void 0===e||e.updateConfig(Te),Ee.current=!0,Re()},[Te,Re]);const Fe=e.useRef(null);Fe.current||(Fe.current=new w(e=>{const t=We.current;t&&t.ingest(e)&&(Ee.current=!0,Re())}));const He=e.useCallback(e=>{var t;null===(t=Fe.current)||void 0===t||t.push(e)},[]),Ie=e.useCallback(e=>{var t;null===(t=Fe.current)||void 0===t||t.pushMany(e)},[]),Ye=e.useCallback(()=>{var e,t;null===(e=Fe.current)||void 0===e||e.clear(),null===(t=We.current)||void 0===t||t.clear(),Ee.current=!0,Re()},[Re]);e.useImperativeHandle(o,()=>({push:He,pushMany:Ie,clear:Ye,getData:()=>{var e,t;return null!==(t=null===(e=We.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=We.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[He,Ie,Ye]),e.useEffect(()=>{var e;i&&(null===(e=Fe.current)||void 0===e||e.setBoundedData(i))},[i]);const Xe=e.useRef(()=>{}),Ge=e.useRef(()=>{});Xe.current=e=>{if(!Le)return;const t=we.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ge.left,r=e.clientY-o.top-ge.top;if(0>n||n>ve||0>r||r>be)return void(Se.current&&(Se.current=null,je(null),U&&U(null),Re()));const i=We.current;if(!i||0===i.scene.length)return;const s="radial"===m,a=function(e,t,o,n=30){let r=null;for(const i of e){let e=null;switch(i.type){case"rect":e=ce(i,t,o);break;case"point":e=ue(i,t,o);break;case"wedge":e=de(i,t,o);break;case"boxplot":e=he(i,t,o);break;case"violin":e=fe(i,t,o)}e&&n>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}(i.scene,s?n-ve/2:n,s?r-be/2:r);if(!a)return void(Se.current&&(Se.current=null,je(null),U&&U(null),Re()));const l={data:a.datum,time:a.x,value:a.y,x:a.x,y:a.y};Se.current=l,je(l),U&&U(l),Re()},Ge.current=()=>{Se.current&&(Se.current=null,je(null),U&&U(null),Re())};const qe=e.useCallback(e=>Xe.current(e),[]),Ve=e.useCallback(()=>Ge.current(),[]);Oe.current=()=>{var e,t;Me.current=0;const o=we.current;if(!o)return;const r=o.getContext("2d");if(!r)return;const i=We.current;if(!i)return;const s="undefined"!=typeof performance?performance.now():Date.now(),a=i.advanceTransition(s),l=Ee.current;l&&!a&&(i.computeScene({width:ve,height:be}),Ee.current=!1);const c="undefined"!=typeof window&&window.devicePixelRatio||1;o.width=y[0]*c,o.height=y[1]*c,o.style.width=y[0]+"px",o.style.height=y[1]+"px",r.scale(c,c),r.clearRect(0,0,y[0],y[1]);const u=null!==(e=null==ye?void 0:ye.threshold)&&void 0!==e?e:5e3,d=ye&&i.lastIngestTime>0&&s-i.lastIngestTime>u;d&&(r.globalAlpha=null!==(t=null==ye?void 0:ye.dimOpacity)&&void 0!==t?t:.5),re&&(r.fillStyle=re,r.fillRect(0,0,y[0],y[1]));const h="radial"===m;h?(r.save(),r.translate(ge.left+ve/2,ge.top+be/2)):r.translate(ge.left,ge.top);const f=xe[n]||[],p={width:ve,height:be};for(const e of f)e(r,i.scene,i.scales,p);h&&r.restore(),d&&(r.globalAlpha=1),l&&i.scales&&(_e(i.scales),ze(e=>e+1)),(null==ye?void 0:ye.showBadge)&&Be(!!d),(a||i.hasActivePulses)&&(Me.current=requestAnimationFrame(()=>Oe.current()))},e.useEffect(()=>(Re(),()=>{Me.current&&cancelAnimationFrame(Me.current)}),[Re]),e.useEffect(()=>{Ee.current=!0,Re()},[n,ve,be,F,re,Re]),e.useEffect(()=>{if(!ye)return;const e=setInterval(()=>{var e;const t=We.current;if(!t||0===t.lastIngestTime)return;const o="undefined"!=typeof performance?performance.now():Date.now(),n=null!==(e=ye.threshold)&&void 0!==e?e:5e3,r=o-t.lastIngestTime>n;r!==$e&&(Be(r),Ee.current=!0,Re())},1e3);return()=>clearInterval(e)},[ye,$e,Re]);const Ue=Le&&Pe?V?V(Pe):v.createElement(Ae,{hover:Pe}):null,Ke="radial"===m,Ze=Pe?Ke?Pe.x+ve/2:Pe.x:0,Je=Pe?Ke?Pe.y+be/2:Pe.y:0,Qe=Ue?v.createElement("div",{className:"stream-ordinal-tooltip",style:{position:"absolute",left:ge.left+Ze,top:ge.top+Je,transform:`translate(${Ze>.7*ve?"calc(-100% - 12px)":"12px"}, ${.3*be>Je?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:1}},Ue):null;return v.createElement("div",{className:"stream-ordinal-frame"+(ne?" "+ne:""),style:{position:"relative",width:y[0],height:y[1]},onMouseMove:Le?qe:void 0,onMouseLeave:Le?Ve:void 0},ee&&v.createElement("svg",{style:{position:"absolute",top:0,left:0,width:y[0],height:y[1],pointerEvents:"none"}},v.createElement("g",{transform:`translate(${ge.left},${ge.top})`},ee)),v.createElement("canvas",{ref:we,style:{position:"absolute",top:0,left:0,width:y[0],height:y[1]}}),v.createElement(me,{width:ve,height:be,totalWidth:y[0],totalHeight:y[1],margin:ge,scales:Ne,showAxes:F,oLabel:H,rLabel:I,oFormat:Y,rFormat:X,showGrid:J,title:oe,legend:Q,foregroundGraphics:te,annotations:K,svgAnnotationRules:Z,annotationFrame:Ce}),ie&&"radial"===m&&v.createElement("div",{style:{position:"absolute",left:ge.left+ve/2,top:ge.top+be/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"}},ie),(null==ye?void 0:ye.showBadge)&&v.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:$e?"#dc3545":"#28a745",color:"white"})},$e?"STALE":"LIVE"),Qe)});Ee.displayName="StreamOrdinalFrame";const Me={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Se={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class Oe{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 o=this.particles[t];if(!o.active)return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}return null}step(e,t,o){for(let n=0;this.capacity>n;n++){const r=this.particles[n];if(!r.active)continue;const i=o[r.edgeIndex];if(!i||!i.bezier){r.active=!1;continue}if(r.t+=e*t,r.t>=1){r.active=!1;continue}const s=Pe(i.bezier,r.t,r.offset);r.x=s.x,r.y=s.y}}countForEdge(e){let t=0;for(let o=0;this.capacity>o;o++)this.particles[o].active&&this.particles[o].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 o=0;e>o;o++)this.particles[o]=t.length>o?t[o]:{t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0};this.capacity=e}}function Pe(e,t,o){if(e.circular&&e.segments)return function(e,t,o,n){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=je(l,c,u,d,a),f=d.x-l.x,p=d.y-l.y,m=Math.sqrt(f*f+p*p);if(m>.001){const e=f/m;h.x+=-p/m*o*n*2,h.y+=e*o*n*2}return h}(e.segments,t,o,e.halfWidth);if(!e.points)return{x:0,y:0};const[n,r,i,s]=e.points,a=je(n,r,i,s,t),l=s.x-n.x,c=s.y-n.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;a.x+=-c/u*o*e.halfWidth*2,a.y+=t*o*e.halfWidth*2}return a}function je(e,t,o,n,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*o.x+c*n.x,y:a*e.y+3*s*r*t.y+3*i*l*o.y+c*n.y}}const Ne=(e=1)=>(t,o)=>{const n=t[t.length-1];return n&&Math.round(n.x/e)===Math.round(o.x/e)&&Math.round(n.y/e)===Math.round(o.y/e)||t.push(o),t},_e=e=>{let t,o,n,r,s,a,l,c,u;return"down"===e.direction?(t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,r=e.y0+e.sankeyWidth/2,s=e.source.y1,a=e.target.y0,l=i.interpolateNumber(s,a),c=l(.5),u=l(.5),`M${t},${s}C${t},${c} ${o},${u} ${o},${a}L${n},${a}C${n},${u} ${r},${c} ${r},${s}Z`):(t=e.source.x1,o=e.target.x0,l=i.interpolateNumber(t,o),n=l(.5),r=l(.5),s=e.y0-e.sankeyWidth/2,a=e.y1-e.sankeyWidth/2,c=e.y1+e.sankeyWidth/2,u=e.y0+e.sankeyWidth/2,`M${t},${s}C${n},${s} ${r},${a} ${o},${a}L${o},${c}C${r},${c} ${n},${u} ${t},${u}Z`)};function Ce(e){const t=function(){const e=l.line();let t=function(e){return e.x},o=function(e){return e.y},n=function(e){return e.r},r=l.curveLinearClosed;function i(i){if(i.multiple){const s=n,l=i.multiple.reduce((e,t)=>e+t.weight,0);n=()=>l;let c=a(i.points).filter(e=>"forward"===e.direction).reduce(Ne(),[]);const u=[];return i.multiple.forEach((e,t)=>{n=()=>e.weight;const o=a(c);u.push(o);const r=i.multiple[t+1];if(r){const e=o.reverse().filter(e=>"back"===e.direction).reduce(Ne(),[]);n=()=>r.weight;const t=a(e);c=t.reverse().filter(e=>"back"===e.direction).reduce(Ne(),[])}}),n=s,u.map(n=>e.x(t).y(o).curve(r)(n))}const s=a(i).reduce(Ne(),[]);return e.x(t).y(o).curve(r)(s)}return i.x=function(e){return arguments.length?(t=e,i):t},i.y=function(e){return arguments.length?(o=e,i):o},i.r=function(e){return arguments.length?(n=e,i):n},i.interpolate=function(e){return arguments.length?(r=e,i):r},i;function s(e){const r=o(e.target)-o(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)+n(e.source)*Math.cos(a),y1:o(e.source)-n(e.source)*Math.sin(a),x2:t(e.target)+n(e.target)*Math.cos(l),y2:o(e.target)-n(e.target)*Math.sin(l)}}function a(e){const t=[];let o=0,n={x1:0,y1:0,x2:0,y2:0};for(;e.length>o;){if(o!==e.length-1&&(n=s({source:e[o],target:e[o+1]}),t.push({x:n.x1,y:n.y1,direction:"forward"},{x:n.x2,y:n.y2,direction:"forward"}),t.length>3)){const e=t.length-1,o={a:t[e-3],b:t[e-2]},n={a:t[e-1],b:t[e]},r=c(o.a.x,o.a.y,o.b.x,o.b.y,n.a.x,n.a.y,n.b.x,n.b.y);!0===r.found&&(o.b.x=r.x,o.b.y=r.y,n.a.x=r.x,n.a.y=r.y)}o++}for(o--;o>=0;){if(0!==o&&(n=s({source:e[o],target:e[o-1]}),t.push({x:n.x1,y:n.y1,direction:"back"},{x:n.x2,y:n.y2,direction:"back"}),t.length>3)){const e=t.length-1,o={a:t[e-3],b:t[e-2]},n={a:t[e-1],b:t[e]},r=c(o.a.x,o.a.y,o.b.x,o.b.y,n.a.x,n.a.y,n.b.x,n.b.y);!0===r.found&&(o.b.x=r.x,o.b.y=r.y,n.a.x=r.x,n.a.y=r.y)}o--}return t}function c(e,t,o,n,r,i,s,a){let l,c;const u={x:null,y:null,found:!1},d=(a-i)*(o-e)-(s-r)*(n-t);if(0===d)return u;l=t-i,c=e-r;const h=(o-e)*l-(n-t)*c;return l=((s-r)*l-(a-i)*c)/d,c=h/d,u.x=e+l*(o-e),u.y=t+l*(n-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 ze={left:s.sankeyLeft,right:s.sankeyRight,center:s.sankeyCenter,justify:s.sankeyJustify},$e={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var r,i,a,l;if(0===e.length)return;const c="vertical"===o.orientation?"down":"right",u=o.nodeAlign||"justify",d=null!==(r=o.nodeWidth)&&void 0!==r?r:15,h=null!==(i=o.nodePaddingRatio)&&void 0!==i?i:.05,f=null!==(a=o.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}));let y;y="down"===c?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const g=s.sankeyCircular().extent(y).links(m).nodes(p).nodeAlign(ze[u]||s.sankeyJustify).nodeId(e=>e.id).nodeWidth(d).iterations(f);g.nodePaddingRatio&&g.nodePaddingRatio(h),g();for(const t of p){const o=e.find(e=>e.id===t.id);o&&(o.x0=t.x0,o.x1=t.x1,o.y0=t.y0,o.y1=t.y1,o.value=t.value,o.depth=t.depth,o.sourceLinks=t.sourceLinks,o.targetLinks=t.targetLinks,o.width=t.x1-t.x0,o.height=t.y1-t.y0,o.x=t.x0+(t.x1-t.x0)/2,o.y=t.y0+(t.y1-t.y0)/2)}for(const o of m){const n=o.source,r=o.target,i="object"==typeof n&&null!==n?n.id:n+"",s="object"==typeof r&&null!==r?r.id:r+"",a=t.find(e=>("string"==typeof e.source?e.source:e.source.id)===i&&("string"==typeof e.target?e.target:e.target.id)===s);if(a){a.y0=o.y0,a.y1=o.y1,a.sankeyWidth=null!==(l=o.width)&&void 0!==l?l:0,a.circular=!!o.circular,a.circularPathData=o.circularPathData,a.direction=c;const t=e.find(e=>e.id===i),n=e.find(e=>e.id===s);t&&(a.source=t),n&&(a.target=n)}}},buildScene(e,t,o,n){var r,i;const s="vertical"===o.orientation?"down":"right",l=o.nodeStyle,c=o.edgeStyle,u=null!==(r=o.edgeOpacity)&&void 0!==r?r:.5,d=o.edgeColorBy||"source",h=Array.isArray(o.colorScheme)?o.colorScheme:a.schemeCategory10,f=new Map;e.forEach((e,t)=>{f.set(e.id,h[t%h.length])});const p=[],m=[],y=[];for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=l?l(t):{},r={fill:n.fill||f.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};p.push({type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:r,datum:t,id:t.id,label:t.id})}const g=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of g){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let n;n=e.circular&&e.circularPathData?Ce(e):_e(e);let r="#999";c?r=c(e).fill||r:"target"===d&&o?r=f.get(o.id)||r:t&&(r=f.get(t.id)||r);const s=c?c(e):{},a={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:u,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};m.push({type:"bezier",pathD:n,bezierCache:e.bezier,style:a,datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null;for(const o of e){const e=o.x1-o.x0,r=o.y1-o.y0;if(0>=e||0>=r)continue;const i=t?t(o):o.id;if(!i)continue;let a,l,c;"down"===s?(a=o.x0+e/2,l=o.y1+14,c="middle"):(n[0]/2>o.x0+e/2?(a=o.x0-6,c="end"):(a=o.x1+6,c="start"),l=o.y0+r/2),y.push({x:a,y:l,text:i+"",anchor:c,baseline:"middle",fontSize:11})}}var v;return{sceneNodes:p,sceneEdges:m,labels:y}}},Be={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){var r,i;if(0===e.length)return;const s=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),a=null!==(i=o.forceStrength)&&void 0!==i?i:.1,l=n[0]/2,u=n[1]/2;for(let t=0;e.length>t;t++){const o=e[t];if(null==o.x||null==o.y||0===o.x&&0===o.y){const e=10*Math.sqrt(t+.5),n=2.399963229728653*t;o.x=l+e*Math.cos(n),o.y=u+e*Math.sin(n)}}const d=De(o.nodeSize,o.nodeSizeRange,e),h=c.forceLink().strength(e=>Math.min(2.5,e.weight?e.weight*a:a)).id(e=>e.id),f=n[1]/n[0],p=c.forceSimulation().force("charge",c.forceManyBody().strength(e=>-25*(e=>d(e))(e))).force("x",c.forceX(n[0]/2).strength(.1*f)).force("y",c.forceY(n[1]/2).strength(.1));if(p.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}));p.force("link",h),p.force("link").links(e)}.1>p.alpha()&&p.alpha(1),p.stop();for(let e=0;s>e;++e)p.tick();for(const o of t){if("string"==typeof o.source){const t=e.find(e=>e.id===o.source);t&&(o.source=t)}if("string"==typeof o.target){const t=e.find(e=>e.id===o.target);t&&(o.target=t)}}},buildScene(e,t,o,n){var r,i,s;const l=o.nodeStyle,c=o.edgeStyle,u=De(o.nodeSize,o.nodeSizeRange,e),d=Array.isArray(o.colorScheme)?o.colorScheme:a.schemeCategory10,h=new Map;e.forEach((e,t)=>{h.set(e.id,d[t%d.length])});const f=[],p=[],m=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=u(t),o=l?l(t):{},n={fill:o.fill||h.get(t.id)||"#007bff",stroke:o.stroke||"#fff",strokeWidth:null!==(r=o.strokeWidth)&&void 0!==r?r:2,opacity:o.opacity};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:n,datum:t,id:t.id,label:t.id})}for(const o of t){const t="object"==typeof o.source?o.source:Le(e,o.source),n="object"==typeof o.target?o.target:Le(e,o.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const r=c?c(o):{},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};p.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:a,datum:o})}if(!1!==o.showLabels){const t=(y=o.nodeLabel)?"function"==typeof y?y:e=>e[y]||e.id:null;for(const o of e){if(null==o.x||null==o.y)continue;const e=t?t(o):o.id;if(!e)continue;const n=u(o);m.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:f,sceneEdges:p,labels:m}}};function Le(e,t){return e.find(e=>e.id===t)}function De(e,t,o){var i,s;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const a=t||[5,20],l=o.map(t=>{var o;return null===(o=t.data)||void 0===o?void 0:o[e]}).filter(e=>null!=e&&"number"==typeof e);if(0===l.length)return()=>a[0];const c=null!==(i=r.min(l))&&void 0!==i?i:0,u=null!==(s=r.max(l))&&void 0!==s?s:1;if(c===u)return()=>(a[0]+a[1])/2;const d=n.scaleLinear().domain([c,u]).range(a).clamp(!0);return t=>{var o;const n=null===(o=t.data)||void 0===o?void 0:o[e];return null==n||"number"!=typeof n?a[0]:d(n)}}const Te=a.schemeCategory10,We={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:r=.01,groupWidth:i=20,sortGroups:s}=o,a=Math.min(n[0],n[1])/2,c=a-i,d=n[0]/2,h=n[1]/2,f=(p=o.valueAccessor)?"function"==typeof p?p:e=>{var t;return null!==(t=e[p])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var p;const m=new Map;for(let t=0;e.length>t;t++)m.set(e[t].id,t);const y=e.length,g=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,o=m.get("string"==typeof e.source?e.source:e.source.id),n=m.get(t);if(void 0===o||void 0===n)continue;const r=f(e);g[o][n]=r}const v=u.chord().padAngle(r);s&&v.sortGroups(s);const b=v(g),x=b.groups,k=l.arc().innerRadius(c).outerRadius(a);for(const t of x){const o=e[t.index],n=k.centroid(t);o.x=n[0]+d,o.y=n[1]+h,o.arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(const o of t){const t="string"==typeof o.source?o.source:o.source.id,n="string"==typeof o.target?o.target:o.target.id,r=e.find(e=>e.id===t),i=e.find(e=>e.id===n);r&&(o.source=r),i&&(o.target=i)}for(const o of b){const n=e[o.source.index].id,r=e[o.target.index].id,i=t.find(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id;return t===n&&o===r||t===r&&o===n});i&&(i.chordData=o)}},buildScene(e,t,o,n){var r,i;const{groupWidth:s=20,edgeOpacity:a=.5}=o,l=Math.min(n[0],n[1])/2,c=l-s,d=n[0]/2,h=n[1]/2,f=o.nodeStyle,p=o.edgeStyle,m=o.edgeColorBy||"source",y=Array.isArray(o.colorScheme)?o.colorScheme:Te,g=new Map;e.forEach((e,t)=>{g.set(e.id,y[t%y.length])});const v=u.ribbon().radius(c),b=[],x=[],k=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.arcData;if(!n)continue;let i;i=f?f(o).fill||g.get(o.id)||y[t%y.length]:g.get(o.id)||y[t%y.length];const s=f?f(o):{},a={fill:i,stroke:s.stroke||"black",strokeWidth:null!==(r=s.strokeWidth)&&void 0!==r?r:1,opacity:s.opacity};b.push({type:"arc",cx:d,cy:h,innerR:c,outerR:l,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:a,datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.chordData;if(!t)continue;const o=v({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(!o)continue;const n=Re(o,d,h);let r="#999";if(p)r=p(e).fill||r;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===m&&o?r=g.get(o.id)||r:t&&(r=g.get(t.id)||r)}const s=p?p(e):{},l={fill:r,fillOpacity:null!==(i=s.fillOpacity)&&void 0!==i?i:a,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity};x.push({type:"ribbon",pathD:n,style:l,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null,n=l+12;for(const o of e){const e=o.arcData;if(!e)continue;const r=t?t(o):o.id;if(!r)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;k.push({x:d+Math.cos(s)*n,y:h+Math.sin(s)*n,text:r+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var w;return{sceneNodes:b,sceneEdges:x,labels:k}}};function Re(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const r=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("C"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("Q"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)r.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(r.push(Number(n[i])+o+""),i++);else if("A"===e)for(r.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&r.push(n[i++]),n.length>i&&(r.push(Number(n[i])+t+""),i++),n.length>i&&(r.push(Number(n[i])+o+""),i++);else"Z"===e||"z"===e?(r.push(e),i++):(r.push(n[i]),i++)}return r.join(" ")}const Fe={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var r;const i=o.__hierarchyRoot;if(!i)return;const s=o.chartType,a=(l=o.childrenAccessor)?"function"==typeof l?l:e=>e[l]:void 0;var l;const c=o.hierarchySum||(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}),u=d.hierarchy(i,a);u.sum(c),u.sort((e,t)=>{var o,n;return(null!==(o=t.value)&&void 0!==o?o:0)-(null!==(n=e.value)&&void 0!==n?n:0)});const[h,f]=n;switch(s){case"tree":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=d.tree();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(u,o,h,f);break;case"cluster":!function(e,t,o,n){const r=t.treeOrientation||"vertical",i=d.cluster();i.size("horizontal"===r?[n,o]:"radial"===r?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),i(e)}(u,o,h,f);break;case"treemap":!function(e,t,o,n){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=d.treemap().size([o,n]).tile(d.treemapBinary).padding(s);a>0&&l.paddingTop(a),l(e)}(u,o,h,f);break;case"circlepack":!function(e,t,o,n){var r;const i=null!==(r=t.padding)&&void 0!==r?r:4;d.pack().size([o,n]).padding(i)(e)}(u,o,h,f);break;case"partition":!function(e,t,o,n){var r;d.partition().size([o,n]).padding(null!==(r=t.padding)&&void 0!==r?r:1)(e)}(u,o,h,f)}const p=u.descendants();e.length=0,t.length=0;const m=new Map;for(let t=0;p.length>t;t++){const n=p[t],i={id:Ge(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(r=n.value)&&void 0!==r?r:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?He(i,n,o):"treemap"===s||"partition"===s?Ie(i,n):"circlepack"===s&&Ye(i,n),i.__hierarchyNode=n,e.push(i),m.set(n,i)}if("tree"===s||"cluster"===s)for(const e of p)if(e.parent){const o=m.get(e.parent),n=m.get(e);o&&n&&t.push({source:o,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,n){const r=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,r,i){var s,a,l,c,u;const d=[],h=[],f=[],p=o.treeOrientation||"vertical",m="radial"===p,y=n[0]/2,g=n[1]/2,v="number"==typeof(b=o.nodeSize)?b:5;var b;for(const t of e){let e=t.x,o=t.y;m&&(e+=y,o+=g);const n=r(t),i={fill:n.fill||"#4d430c",stroke:n.stroke||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:n.opacity};d.push({type:"circle",cx:e,cy:o,r:v,style:i,datum:t,id:t.id,label:t.id,depth:t.depth})}const x=null!==(a=o.edgeOpacity)&&void 0!==a?a:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;if(!t||!o)continue;let n=t.x,r=t.y,s=o.x,a=o.y;m&&(n+=y,r+=g,s+=y,a+=g);const u=Xe(n,r,s,a,p),d=i(e),f={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:f,datum:e})}if(!1!==o.showLabels){const t=qe(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,r,i,s=o.x,a=o.y;if(m&&(s+=y,a+=g),m){const e=s-y,t=a-g,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,r=a+t/o*10,i=0>e?"end":"start"):(n=s,r=a-12,i="middle")}else"horizontal"===p?((null===(u=o.data)||void 0===u?void 0:u.children)&&0!==o.data.children.length?(n=s-v-6,i="end"):(n=s+v+6,i="start"),r=a):(n=s,r=a+v+14,i="middle");f.push({x:n,y:r,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}(e,t,o,n,r,i);case"treemap":case"partition":return function(e,t,o,n){var r,i;const s=[],a=[],l=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const a=n(o);let c=a.fill||"#4d430c";t.colorByDepth&&void 0!==o.depth&&(c=l[o.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:o.x0,y:o.y0,w:e,h:i,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=qe(t.nodeLabel);for(const n of e){const e=n.x1-n.x0,r=n.y1-n.y0;if(0>=e||0>=r)continue;if((null===(i=n.data)||void 0===i?void 0:i.children)&&n.data.children.length>0&&"partition"!==t.chartType)continue;const s=o?o(n):n.id;s&&(30>e||16>r||a.push({x:n.x0+e/2,y:n.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,o,0,r);case"circlepack":return function(e,t,o,n){var r,i,s,a,l;const c=[],u=[],d=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];for(const o of e){const e=null!==(r=o.__radius)&&void 0!==r?r:5;if(0>=e)continue;const a=n(o);let l=a.fill||"#4d430c";t.colorByDepth&&void 0!==o.depth&&(l=d[o.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:o.x,cy:o.y,r:e,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=qe(t.nodeLabel);for(const t of e){const e=null!==(a=t.__radius)&&void 0!==a?a:5,n=o?o(t):t.id;if(!n)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:n+"",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,o,0,r);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function He(e,t,o){const n=o.treeOrientation||"vertical";if("radial"===n){const o=t.x,n=t.y;e.x=n*Math.cos(o-Math.PI/2),e.y=n*Math.sin(o-Math.PI/2)}else"horizontal"===n?(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 Ie(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 Ye(e,t){var o;const n=null!==(o=t.r)&&void 0!==o?o:0;e.x=t.x,e.y=t.y,e.x0=t.x-n,e.x1=t.x+n,e.y0=t.y-n,e.y1=t.y+n,e.width=2*n,e.height=2*n,e.__radius=n}function Xe(e,t,o,n,r){if("horizontal"===r){const r=(e+o)/2;return`M ${e},${t} C ${r},${t} ${r},${n} ${o},${n}`}if("radial"===r){const r=(e+o)/2;return`M ${e},${t} Q ${r},${t} ${r},${(t+n)/2} T ${o},${n}`}{const r=(t+n)/2;return`M ${e},${t} C ${e},${r} ${o},${r} ${o},${n}`}}function Ge(e,t,o){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function qe(e){return e?"function"==typeof e?e:t=>{var o;return(null===(o=t.data)||void 0===o?void 0:o[e])||t[e]||t.id}:null}const Ve={sankey:$e,force:Be,chord:We,tree:Fe,cluster:Fe,treemap:Fe,circlepack:Fe,partition:Fe};function Ue(e){return Ve[e]}class Ke{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({},Me),e.tensionConfig),"sankey"===e.chartType&&e.showParticles&&(this.particlePool=new Oe(2e3))}updateConfig(e){this.config=e,this.tensionConfig=Object.assign(Object.assign({},Me),e.tensionConfig),"sankey"===e.chartType&&e.showParticles?this.particlePool||(this.particlePool=new Oe(2e3)):this.particlePool=null}ingestHierarchy(e,t){this.nodes.clear(),this.edges.clear(),this.config.__hierarchyRoot=e,this.runLayout(t)}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:r="source",targetAccessor:i="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],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({},Ze(e)),{data:t}))}for(const e of t){const t=l(e)+"",o=c(e)+"",n=Number(u(e))||1;this.nodes.has(t)||this.nodes.set(t,Object.assign(Object.assign({},Ze(t)),{data:e})),this.nodes.has(o)||this.nodes.set(o,Object.assign(Object.assign({},Ze(o)),{data:e})),this.edges.set(`${t}\0${o}`,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0,data:e})}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,r=0===this.nodes.size;let i=!1;this.nodes.has(t)||(this.nodes.set(t,Ze(t)),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,Ze(o)),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,o),a=this.edges.get(s);return a?(a.value+=n,this.tension+=this.tensionConfig.weightChange):(this.edges.set(s,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.tension+=this.tensionConfig.newEdge,i=!0),r||i||this.tension>=this.tensionConfig.threshold}runLayout(e){const t=Ue(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values()),n=Array.from(this.edges.values());if(0!==o.length||t.hierarchical){if(this.prepareForRelayout(),t.computeLayout(o,n,this.config,e),t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear();for(const e of o)this.nodes.set(e.id,e);for(const e of n)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(),o.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=Ue(this.config.chartType);if(!t)return;const o=Array.from(this.nodes.values()),n=Array.from(this.edges.values()),{sceneNodes:r,sceneEdges:i,labels:s}=t.buildScene(o,n,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),o=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)*o,e.x1=e._prevX1+(e._targetX1-e._prevX1)*o,e.y0=e._prevY0+(e._targetY0-e._prevY0)*o,e.y1=e._prevY1+(e._targetY1-e._prevY1)*o);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)*o,e.y1=e._prevY1+(e._targetY1-e._prevY1)*o,e.sankeyWidth=e._prevSankeyWidth+(e._targetSankeyWidth-e._prevSankeyWidth)*o);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,o="string"==typeof e.target?this.nodes.get(e.target):e.target;t&&o&&(e.bezier=e.circular&&e.circularPathData?this.buildCircularBezier(e):this.buildStandardBezier(e,t,o))}buildStandardBezier(e,t,o){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const r=t.y1,s=o.y0,a=i.interpolateNumber(r,s);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:s}],halfWidth:n}}const r=t.x1,s=o.x0,a=i.interpolateNumber(r,s);return{circular:!1,points:[{x:r,y:e.y0},{x:a(.5),y:e.y0},{x:a(.5),y:e.y1},{x:s,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e.sankeyWidth||1)/2,o=e.circularPathData;let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.leftFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.targetY,y:o.rightFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.leftFullExtent,y:o.sourceY},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.rightFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const r=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],i=o.x-t.x,s=o.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},o])}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 Ze(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 Je(e,t,o){switch(e.type){case"circle":return function(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+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,o);case"rect":return function(e,t,o){return e.x>t||t>e.x+e.w||e.y>o||o>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,o);case"arc":return function(e,t,o){const n=t-e.cx,r=o-e.cy,i=Math.sqrt(n*n+r*r);if(e.innerR-2>i||i>e.outerR+2)return null;let s=Math.atan2(r,n);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,o=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+o*Math.cos(t),y:e.cy+o*Math.sin(t),distance:0}}return null}(e,t,o);default:return null}}function Qe(e,t,o){switch(e.type){case"bezier":return function(e,t,o){var n,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,o)){const i="object"==typeof(null===(n=e.datum)||void 0===n?void 0:n.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:o,distance:0}}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,r=e.y2-e.y1,i=n*n+r*r;if(0===i)return null;let s=((t-e.x1)*n+(o-e.y1)*r)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*r,c=Math.sqrt(Math.pow(t-a,2)+Math.pow(o-l,2));return c>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:c}}(e,t,o);case"ribbon":case"curved":return function(e,t,o){if(!e.pathD)return null;try{const n=new Path2D(e.pathD),r=document.createElement("canvas").getContext("2d");if(!r)return null;if(r.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0}}catch(e){}return null}(e,t,o);default:return null}}function et(e){const{width:t,height:o,totalWidth:n,totalHeight:r,margin:i,labels:s,title:a,legend:l,foregroundGraphics:c,annotations:u,svgAnnotationRules:d}=e;return v.createElement("svg",{width:n,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"}},v.createElement("g",{transform:`translate(${i.left},${i.top})`},s.map((e,t)=>v.createElement("text",{key:"label-"+t,x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"currentColor",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"}},e.text)),u&&d&&u.map((e,n)=>{const r=d(e,n,{width:t,height:o});return r?v.createElement(v.Fragment,{key:"annotation-"+n},r):null}),c),a&&"string"==typeof a?v.createElement("text",{x:n/2,y:16,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"currentColor"},a):a?v.createElement("foreignObject",{x:0,y:0,width:n,height:i.top},a):null,l&&"object"==typeof l&&"legendGroups"in l?v.createElement("g",{transform:`translate(${n-i.right+10},${i.top})`},l.legendGroups.map((e,t)=>{var o;return v.createElement("g",{key:"legend-group-"+t},null===(o=e.items)||void 0===o?void 0:o.map((e,t)=>v.createElement("g",{key:"legend-item-"+t,transform:`translate(0,${20*t})`},v.createElement("rect",{x:0,y:0,width:12,height:12,fill:e.color,rx:2}),v.createElement("text",{x:18,y:10,fontSize:11,fill:"currentColor"},e.label))))})):l?v.createElement("g",{transform:`translate(${n-i.right+10},${i.top})`},l):null)}function tt(e,t){var o,n,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!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.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 ot(e,t){var o;e.save(),e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o: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 nt(e,t){var o,n,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!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.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 rt(e,t){var o,n;if(!t.pathD)return;e.save();const r=new Path2D(t.pathD);e.strokeStyle=t.style.stroke||"#999",e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o: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!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(r)),e.restore()}et.displayName="NetworkSVGOverlay";const it={category10:a.schemeCategory10,tableau10:a.schemeTableau10,set3:a.schemeSet3,blues:a.interpolateBlues,reds:a.interpolateReds,greens:a.interpolateGreens,oranges:a.interpolateOranges,purples:a.interpolatePurples,viridis:a.interpolateViridis,plasma:a.interpolatePlasma},st=a.schemeCategory10;function at(e,t,o){if("function"==typeof t)return t(e);const n=e[t];return o?o(n):st[Math.abs(function(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o),t&=t;return Math.abs(t)}(n+""))%st.length]}function lt(e,t,o="category10"){const r=Array.from(new Set(e.map(e=>e[t]))),i=r.every(e=>"number"==typeof e||!isNaN(Number(e)));if(Array.isArray(o))return n.scaleOrdinal().domain(r).range(o).unknown("#999");const s=it[o]||it.category10;if(i&&"function"==typeof s)return e=>s(Number(e)/Math.max(...r.map(Number)));{const e=Array.isArray(s)?s:st;return n.scaleOrdinal().domain(r).range(e).unknown("#999")}}function ct(e,t,o=[3,20],n){let r;if(r="function"==typeof t?t(e):e[t],!n)return r;const[i,s]=n,[a,l]=o;return s===i?(a+l)/2:a+(r-i)/(s-i)*(l-a)}const ut={top:20,right:80,bottom:20,left:80},dt={top:40,right:40,bottom:40,left:40},ht=new Set(["chord","force","circlepack"]),ft=[800,600],pt={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 mt({data:e}){var t,o,n,r,i,s;if("edge"===e.type){const t=e.data;return v.createElement("div",{className:"semiotic-tooltip",style:pt},v.createElement("div",{style:{fontWeight:600}},"object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target),null!=t.value&&v.createElement("div",{style:{marginTop:4,opacity:.8}},"Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""))}const a=e.data,l=null==a?void 0:a.__hierarchyNode;if(l){const e=[];let i=l;for(;i;){const s=null!==(r=null!==(o=null===(t=i.data)||void 0===t?void 0:t.name)&&void 0!==o?o:null===(n=i.data)||void 0===n?void 0:n.id)&&void 0!==r?r:a.id;null!=s&&e.unshift(s+""),i=i.parent}e.length>1&&e.shift();const s=e.length-1;return v.createElement("div",{className:"semiotic-tooltip",style:pt},v.createElement("div",null,e.map((e,t)=>v.createElement("span",{key:t},t>0&&v.createElement("span",{style:{margin:"0 3px",opacity:.5}}," → "),t===s?v.createElement("strong",null,e):v.createElement("span",{style:{opacity:.7}},e)))),null!=a.value&&a.value>0&&v.createElement("div",{style:{marginTop:4,opacity:.8}},"number"==typeof a.value?a.value.toLocaleString():a.value+""))}const c=((null===(i=a.sourceLinks)||void 0===i?void 0:i.length)||0)+((null===(s=a.targetLinks)||void 0===s?void 0:s.length)||0),u=(a.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(a.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return v.createElement("div",{className:"semiotic-tooltip",style:pt},v.createElement("div",{style:{fontWeight:600}},a.id),null!=a.value&&a.value>0&&v.createElement("div",{style:{marginTop:4,opacity:.8}},"Total:"," ","number"==typeof a.value?a.value.toLocaleString():a.value+""),c>0&&v.createElement("div",{style:{marginTop:4,opacity:.8}},"Connections: ",c,u!==c&&` (weighted: ${u.toLocaleString()})`))}const yt=e.forwardRef(function(t,o){const{chartType:n,nodes:r,edges:i,data:s,initialEdges:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",childrenAccessor:h,hierarchySum:f,orientation:p="horizontal",nodeAlign:m="justify",nodePaddingRatio:y=.05,nodeWidth:g=15,iterations:b=300,forceStrength:x=.1,padAngle:k=.01,groupWidth:w=20,sortGroups:A,edgeSort:E,treeOrientation:M="vertical",edgeType:S="curve",padding:O,paddingTop:P,tensionConfig:j,showParticles:N=!1,particleStyle:_,nodeStyle:C,edgeStyle:z,colorBy:$,colorScheme:B="category10",edgeColorBy:L="source",edgeOpacity:D=.5,colorByDepth:T=!1,nodeSize:W=8,nodeSizeRange:R=[5,20],nodeLabel:F,showLabels:H=!0,size:I=ft,margin:Y,className:X,background:G,enableHover:q=!0,tooltipContent:V,onTopologyChange:U,annotations:K,svgAnnotationRules:Z,legend:J,title:Q,foregroundGraphics:ee,backgroundGraphics:te}=t,oe=ht.has(n)?dt:ut,ne=Object.assign(Object.assign({},oe),Y),re=I[0]-ne.left-ne.right,ie=I[1]-ne.top-ne.bottom,se=e.useMemo(()=>Object.assign(Object.assign({},Me),j),[j]),ae=e.useMemo(()=>Object.assign(Object.assign({},Se),_),[_]),le=e.useMemo(()=>({chartType:n,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,valueAccessor:d,childrenAccessor:h,hierarchySum:f,orientation:p,nodeAlign:m,nodePaddingRatio:y,nodeWidth:g,iterations:b,forceStrength:x,padAngle:k,groupWidth:w,sortGroups:A,edgeSort:E,treeOrientation:M,edgeType:S,padding:O,paddingTop:P,tensionConfig:se,showParticles:N,particleStyle:ae,nodeStyle:C,edgeStyle:z,nodeLabel:F,showLabels:H,colorBy:$,colorScheme:B,edgeColorBy:L,edgeOpacity:D,colorByDepth:T,nodeSize:W,nodeSizeRange:R}),[n,l,c,u,d,h,f,p,m,y,g,b,x,k,w,A,E,M,S,O,P,se,N,ae,C,z,F,H,$,B,L,D,T,W,R]),ce=e.useRef(null),ue=e.useRef(0),de=e.useRef(0),he=e.useRef(!0),fe=e.useRef(()=>{}),pe=e.useRef(null);pe.current||(pe.current=new Ke(le));const[me,ye]=e.useState(null),[ge,ve]=e.useState(0),[be,xe]=e.useState(0),ke=e.useRef(null),we=e.useRef(new Map),Ae=e.useRef(0),Ee=e.useCallback(e=>{if("function"==typeof $)return $(e);if("string"==typeof $&&e.data){const t=e.data[$];if(void 0!==t){if(!we.current.has(t+"")){const e=Array.isArray(B)?B:st;we.current.set(t+"",e[Ae.current++%e.length])}return we.current.get(t+"")}}if(!we.current.has(e.id)){const t=Array.isArray(B)?B:st;we.current.set(e.id,t[Ae.current++%t.length])}return we.current.get(e.id)},[$,B]);e.useCallback(e=>{if("function"==typeof L)return L(e);const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===L&&o?Ee(o):t?Ee(t):"#999"},[L,Ee]);const Oe=e.useCallback(e=>{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;return"target"===(ae.colorBy||"source")&&o?Ee(o):t?Ee(t):"#999"},[ae.colorBy,Ee]),Pe="sankey"===n&&N,je=e.useCallback(()=>{ue.current&&!Pe||ue.current||(ue.current=requestAnimationFrame(()=>fe.current()))},[Pe]);e.useEffect(()=>{var e;null===(e=pe.current)||void 0===e||e.updateConfig(le),he.current=!0,je()},[le,je]);const Ne=e.useCallback(()=>{const e=pe.current;if(e&&(e.runLayout([re,ie]),e.buildScene([re,ie]),he.current=!0,ve(e.layoutVersion),U)){const{nodes:t,edges:o}=e.getLayoutData();U(t,o)}},[re,ie,U]),_e=e.useCallback(e=>{const t=pe.current;t&&(t.ingestEdge(e)&&Ne(),je())},[Ne,je]),Ce=e.useCallback(e=>{const t=pe.current;if(!t)return;let o=!1;for(const n of e)t.ingestEdge(n)&&(o=!0);o&&Ne(),je()},[Ne,je]),ze=e.useCallback(()=>{var e;null===(e=pe.current)||void 0===e||e.clear(),we.current.clear(),Ae.current=0,ve(0),ye(null),ke.current=null,he.current=!0,je()},[je]),$e=e.useCallback(()=>{const e=pe.current;e&&(e.tension+=999,Ne(),je())},[Ne,je]);e.useImperativeHandle(o,()=>({push:_e,pushMany:Ce,clear:ze,getTopology:()=>{var e,t;return null!==(t=null===(e=pe.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},relayout:$e,getTension:()=>{var e,t;return null!==(t=null===(e=pe.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[_e,Ce,ze,$e]);const Be=["tree","cluster","treemap","circlepack","partition"].includes(n),Le=Be?s||(Array.isArray(i)?void 0:i):void 0;e.useEffect(()=>{const e=pe.current;if(e)if(Be&&Le)e.ingestHierarchy(Le,[re,ie]),e.buildScene([re,ie]),he.current=!0,je();else{const t=r||[],o=Array.isArray(i)?i:[];if(0===t.length&&0===o.length)return;e.ingestBounded(t,o,[re,ie]),e.buildScene([re,ie]),he.current=!0,je()}},[r,i,s,Le,Be,re,ie,le,je]),e.useEffect(()=>{a&&a.length>0&&Ce(a)},[]);const De=e.useRef(()=>{}),Te=e.useRef(()=>{});De.current=e=>{if(!q)return;const t=ce.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ne.left,r=e.clientY-o.top-ne.top;if(0>n||n>re||0>r||r>ie)return void(ke.current&&(ke.current=null,ye(null),je()));const i=pe.current;if(!i)return;const s=function(e,t,o,n,r=30){let i=null,s=r,a=1/0;for(const t of e){const e=Je(t,o,n);if(e)if("rect"===t.type){const o=t.w*t.h;a>o&&(i=e,a=o)}else s>e.distance&&(i=e,s=e.distance)}if(i)return i;for(const e of t){const t=Qe(e,o,n);t&&s>t.distance&&(i=t,s=t.distance)}return i}(i.sceneNodes,i.sceneEdges,n,r);if(!s)return void(ke.current&&(ke.current=null,ye(null),je()));const a={type:s.type,data:s.datum,x:s.x,y:s.y};ke.current=a,ye(a),je()},Te.current=()=>{ke.current&&(ke.current=null,ye(null),je())};const We=e.useCallback(e=>De.current(e),[]),Re=e.useCallback(()=>Te.current(),[]);fe.current=()=>{var e;ue.current=0;const t=ce.current;if(!t)return;const o=t.getContext("2d");if(!o)return;const n=pe.current;if(!n)return;const r=performance.now(),i=de.current?Math.min((r-de.current)/1e3,.1):.016;de.current=r;const s=n.advanceTransition(r);(s||he.current)&&n.buildScene([re,ie]);const a="undefined"!=typeof window&&window.devicePixelRatio||1;if(t.width=I[0]*a,t.height=I[1]*a,t.style.width=I[0]+"px",t.style.height=I[1]+"px",o.scale(a,a),o.translate(ne.left,ne.top),o.clearRect(-ne.left,-ne.top,I[0],I[1]),G&&(o.fillStyle=G,o.fillRect(0,0,re,ie)),function(e,t){for(const o of t)switch(o.type){case"bezier":tt(e,o);break;case"line":ot(e,o);break;case"ribbon":nt(e,o);break;case"curved":rt(e,o)}}(o,n.sceneEdges),function(e,t){var o,n,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!==(o=t.style.opacity)&&void 0!==o?o: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!==(n=t.style.strokeWidth)&&void 0!==n?n: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())}}(o,n.sceneNodes),function(e,t){var o,n,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!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore())}}(o,n.sceneNodes),function(e,t){var o,n,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!==(o=t.style.opacity)&&void 0!==o?o:1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(r=t.style.opacity)&&void 0!==r?r:1,e.stroke()),e.restore()}}(o,n.sceneNodes),N&&n.particlePool){const t=Array.from(n.edges.values());if(t.length>0){!function(e,t,o,n){var r,i;const s=null!==(r=n.spawnRate)&&void 0!==r?r:Se.spawnRate,a=null!==(i=n.maxPerEdge)&&void 0!==i?i:Se.maxPerEdge;for(let n=0;t.length>n;n++){const r=t[n];if(!r.bezier)continue;if(e.countForEdge(n)>=a)continue;const i=r.value*s*o,l=Math.floor(i),c=i-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(n.particlePool,t,i,ae);const r=.5*(null!==(e=ae.speedMultiplier)&&void 0!==e?e:1);n.particlePool.step(i,r,t),function(e,t,o,n,r){var i,s;const a=null!==(i=n.radius)&&void 0!==i?i:Se.radius,l=null!==(s=n.opacity)&&void 0!==s?s:Se.opacity;e.globalAlpha=l;for(let i=0;t.particles.length>i;i++){const s=t.particles[i];if(!s.active)continue;const l=o[s.edgeIndex];if(l){if("function"==typeof n.color){const t="object"==typeof l.source?l.source:null;e.fillStyle=t?n.color(l,t):"#666"}else e.fillStyle=n.color&&"inherit"!==n.color?n.color:r(l);e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}}e.globalAlpha=1}(o,n.particlePool,t,ae,Oe)}}const l=he.current;he.current=!1,(l||s)&&xe(e=>e+1),(Pe||s)&&(ue.current=requestAnimationFrame(()=>fe.current()))},e.useEffect(()=>(je(),()=>{ue.current&&cancelAnimationFrame(ue.current)}),[je]),e.useEffect(()=>{he.current=!0,je()},[n,re,ie,G,je]);const Fe=q&&me?v.createElement("div",{className:"stream-network-tooltip",style:{position:"absolute",left:ne.left+me.x,top:ne.top+me.y,transform:`translate(${me.x>.6*re?"calc(-100% - 12px)":"12px"}, ${.3*ie>me.y?"4px":"calc(-100% - 4px)"})`,pointerEvents:"none",zIndex:2}},V?V(me):v.createElement(mt,{data:me})):null,He=pe.current;return v.createElement("div",{className:"stream-network-frame"+(X?" "+X:""),style:{position:"relative",width:I[0],height:I[1]},onMouseMove:q?We:void 0,onMouseLeave:q?Re:void 0},te&&v.createElement("svg",{style:{position:"absolute",top:0,left:0,width:I[0],height:I[1],pointerEvents:"none"}},v.createElement("g",{transform:`translate(${ne.left},${ne.top})`},te)),v.createElement("canvas",{ref:ce,style:{position:"absolute",top:0,left:0}}),v.createElement(et,{width:re,height:ie,totalWidth:I[0],totalHeight:I[1],margin:ne,labels:(null==He?void 0:He.labels)||[],title:Q,legend:J,foregroundGraphics:ee,annotations:K,svgAnnotationRules:Z,annotationFrame:be}),Fe)});yt.displayName="StreamNetworkFrame";const gt=(e,t,o,n)=>{const r=(e.note.label||e.note.title).length;return[Math.min(e.note.wrap||120,r*t)+2*n,Math.ceil(r*t/120)*o+2*n]};function vt(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function bt(e,t,o,n){return"curly"===e?n?`M0,0 C${.6*o},0 ${.4*o},${t/2} ${o},${t/2} C${.4*o},${t/2} ${.6*o},${t} 0,${t}`:`M0,0 C0,${.6*o} ${t/2},${.4*o} ${t/2},${o} C${t/2},${.4*o} ${t},${.6*o} ${t},0`:n?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function xt(e){const{x:t=0,y:o=0,dx:n,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:f,events:p={},"data-testid":m}=e,y=new Set(Array.isArray(f)?f:[]);let g=n||0,b=r||0;null!=i&&(g=i-t),null!=s&&(b=s-o);const x="string"==typeof u?u:"label";if("bracket"===x&&c&&0===g&&0===b)if(void 0!==c.width){g=c.width/2;const e=c.depth||30;b=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;g=e+(0>e?-5:5),b=c.height/2}return v.createElement("g",Object.assign({className:("annotation "+(h||"")).trim(),transform:`translate(${t},${o})`,"data-testid":m},p),!y.has("connector")&&function(e,t,o,n,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!(null==i?void 0:i.radius)){if("callout-rect"===r&&i){const o=i.width||0,n=i.height||0;if(o>0||n>0){const r=o/2,i=n/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=n/2,h=e*d>t*u?u/e:d/t;a=r+s*h,l=i+c*h}}}else if("bracket"===r&&i){const e=i.width,t=i.height,o=i.depth||30;void 0!==e?(a=e/2,l=o):void 0!==t&&(a=o,l=t/2)}}else{const o=(i.radius||0)+(i.radiusPadding||0);if(o>0&&(0!==e||0!==t)){const n=Math.atan2(t,e);a=Math.cos(n)*o,l=Math.sin(n)*o}}if(Math.sqrt(Math.pow(e-a,2)+Math.pow(t-l,2))>.5&&(s.push(v.createElement("line",{key:"connector-line",x1:a,y1:l,x2:e,y2:t,stroke:n||"currentColor"})),"arrow"===(null==o?void 0:o.end))){const o=10,r=16/180*Math.PI,i=Math.atan2(t-l,e-a);s.push(v.createElement("path",{key:"connector-arrow",d:`M${a},${l}L${a+o*Math.cos(i+r)},${l+o*Math.sin(i+r)}L${a+o*Math.cos(i-r)},${l+o*Math.sin(i-r)}Z`,fill:n||"currentColor",stroke:"none"}))}return v.createElement("g",{className:"annotation-connector"},s)}(g,b,l,d,x,c),!y.has("subject")&&function(e,t,o,n,r){var i;const s=[];switch(e){case"callout-circle":{const e=((null==t?void 0:t.radius)||0)+((null==t?void 0:t.radiusPadding)||0);e>0&&s.push(v.createElement("circle",{key:"subject-circle",r:e,fill:"none",stroke:o||"currentColor"}));break}case"callout-rect":{const e=(null==t?void 0:t.width)||0,n=(null==t?void 0:t.height)||0;(e>0||n>0)&&s.push(v.createElement("rect",{key:"subject-rect",width:e,height:n,fill:"none",stroke:o||"currentColor"}));break}case"callout-custom":(null==t?void 0:t.custom)&&s.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=n||0,i=r||0;if(void 0!==(null==t?void 0:t.x)){const n=(t.x||0)-e;s.push(v.createElement("line",{key:"threshold-line",x1:n,y1:(t.y1||0)-i,x2:n,y2:(t.y2||0)-i,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else if(void 0!==(null==t?void 0:t.y)){const n=(t.y||0)-i;s.push(v.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:n,x2:(t.x2||0)-e,y2:n,stroke:o||"currentColor",strokeDasharray:"5,5"}))}else void 0!==(null==t?void 0:t.x1)||void 0!==(null==t?void 0:t.x2)?s.push(v.createElement("line",{key:"threshold-line",x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"currentColor",strokeDasharray:"5,5"})):void 0===(null==t?void 0:t.y1)&&void 0===(null==t?void 0:t.y2)||s.push(v.createElement("line",{key:"threshold-line",x1:0,y1:(t.y1||0)-i,x2:0,y2:(t.y2||0)-i,stroke:o||"currentColor",strokeDasharray:"5,5"}));break}case"bracket":{const e=null!==(i=null==t?void 0:t.width)&&void 0!==i?i:null==t?void 0:t.height;void 0!==e&&s.push(v.createElement("path",{key:"bracket-path",d:bt((null==t?void 0:t.type)||"curly",e,(null==t?void 0:t.depth)||30,void 0===(null==t?void 0:t.width)),fill:"none",stroke:o||"currentColor"}));break}}return v.createElement("g",{className:"annotation-subject"},s)}(x,c,d,t,o),!y.has("note")&&function(e,t,o,n){if(!e)return v.createElement("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return v.createElement("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(o)?"leftRight":"topBottom");let d=a;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>o?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,p=i?c?[i]:vt(i,l):[],m=r?c?[r]:vt(r,l):[],y="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[];p.length>0&&(b.push(v.createElement("text",{key:"annotation-note-title",className:"annotation-note-title",fill:n||void 0,textAnchor:h,fontWeight:"bold"},p.map((e,t)=>v.createElement("tspan",{key:t,x:y,dy:0===t?0:f},e)))),g=p.length*f),m.length>0&&b.push(v.createElement("text",{key:"annotation-note-label",className:"annotation-note-label",fill:n||void 0,textAnchor:h,y:g},m.map((e,t)=>v.createElement("tspan",{key:t,x:y,dy:f},e))));let x=null;if((i||r)&&(0!==t||0!==o))if("topBottom"===u){const e=Math.min(l,120);let t=0,o=e;"end"===h?(t=-e,o=0):"middle"===h&&(t=-e/2,o=e/2),x=v.createElement("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:n||"currentColor"})}else{const e=(p.length+m.length)*f+(m.length>0?f:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=v.createElement("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:n||"currentColor"})}const k=(p.length+m.length)*f+(m.length>0?f:0);let w=0;return"topBottom"===u?0>o&&(w=-k):"leftRight"===u&&("middle"===d?w=-k/2:("bottom"===d||0>o)&&(w=-k)),v.createElement("g",{className:"annotation-note",transform:`translate(${t},${o})`},v.createElement("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0},b),x)}(a,g,b,d))}function kt(e){const{noteData:t}=e,{screenCoordinates:o}=t,n="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+t.dx,r=t.ny||o[0][1]+t.dy,i=o.map((o,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:o[0],y:o[1],nx:e,ny:r});return v.createElement(xt,Object.assign({"data-testid":"semiotic-annotation",key:"multi-annotation-"+i},s,{type:n}))});return v.createElement("g",null,i)}const i=t.note||{title:"none",label:t.label};return v.createElement(xt,Object.assign({"data-testid":"semiotic-annotation",key:`${i.label}-${i.title}-${t.i}`,events:r},t,{type:n}))}function wt(t){let o=e.createContext(null),n=At(t);return[function({children:n}){let r=e.useMemo(()=>At(t),[]);return v.createElement(o.Provider,{value:r,children:n})},t=>{var r;let i=null!==(r=e.useContext(o))&&void 0!==r?r:n;return function(t,o){const[n,r]=e.useState(o);return e.useLayoutEffect(()=>t(()=>r(o)),[t]),n}(i.subscribe,()=>t(i.getState()))}]}function At(e){let t=new EventTarget,o=e(function(e){o=Object.assign(o,e(o)),t.dispatchEvent(new CustomEvent("update"))});return{getState:()=>o,subscribe:function(e){return t.addEventListener("update",e),()=>t.removeEventListener("update",e)}}}let[Et,Mt]=wt(e=>({tooltip:null,changeTooltip(t){e(()=>({tooltip:t}))}}));function St(e,t,o){return"number"==typeof o?o:t&&t.find(t=>t.props.orient===e)?50:10}const Ot=(e,t,o)=>`${e.map(Pt).join(",")}${JSON.stringify(t)}${o.join(",")}`;function Pt(e){if(!e||!e.props||!e.props.noteData)return"";const{note:t={}}=e.props.noteData,{label:o,title:n}=t;return`${e.props.noteData.id||`${e.props.noteData.x}-${e.props.noteData.y}`}-${o}=${n}`}function jt(e,t=8,o){const{noteWidth:n=o}=e;let r=n;"number"==typeof n&&(r=()=>n);const i=e.note&&e.note.wrap||120,s=e.note.label||e.note.label||"";return n&&r(e)||(v.default.isValidElement(e.note)?100:Math.min(i,s.length*t))}function Nt(e,t=8,o=20,n){const{noteHeight:r=n}=e;let i=r;"number"==typeof r&&(i=()=>r);const s=e.note&&e.note.wrap||120,a=e.note.label||e.note.title||"";return r&&i(e)||(v.default.isValidElement(e.note)?30:Math.ceil(a.length*t/s)*o+(e.note.label&&e.note.title?o:0))}const _t=(e,t)=>t.map((t,o)=>e.svgAnnotationRule(t,o,e)).filter(e=>null!=e),Ct=(e,t)=>{let o=t.adjustedAnnotations,n=t.adjustedAnnotationsKey,r=t.adjustableAnnotations,i=t.fixedAnnotations,s=[],a=[];const l=t.adjustedAnnotationsKey,c=t.adjustedAnnotationsDataVersion,{annotations:u,annotationHandling:d=!1,size:h,svgAnnotationRule:f,htmlAnnotationRule:p}=e,m="object"==typeof d?d:{layout:{type:d},dataVersion:""},{dataVersion:y=""}=m;if(f){const t=_t(e,u);n=Ot(t,m,h),!1===d&&(o=r),o=o.length!==r.length||l!==n||c!==y?((e,t,o)=>{const{layout:n={type:!1,noteHeight:void 0,noteWidth:void 0}}=t;if(!1===n.type)return e;const{noteWidth:r,noteHeight:i}=n;let{margin:s={top:0,bottom:0,left:0,right:0}}=o;const{size:a,axes:l=[]}=o;if(s="number"==typeof s?{top:s,left:s,right:s,bottom:s}:s,"bump"===n.type)return function(e,t,o,n,r){const{padding:i=1,characterWidth:s=8,lineHeight:a=20,iterations:l=500,pointSizeFunction:c=n,labelSizeFunction:u=r||gt}=t,d=e.map((e,t)=>{const o=(e.props.noteData.x[0]||e.props.noteData.x)+(void 0!==e.props.noteData.dx?e.props.noteData.dx:-10*(t%3-1)),n=(e.props.noteData.y[0]||e.props.noteData.y)+(void 0!==e.props.noteData.dy?e.props.noteData.dy:10*(t%3-1)),[r,l]=u(e.props.noteData,s,a,i);return{x:o,y:n,above:e.props.noteData.y>n,left:e.props.noteData.x>o,width:r,height:l,type:"label",name:"",originalNote:e}}),h=e.map(e=>({x:e.props.noteData.x,y:e.props.noteData.y,fx:e.props.noteData.x,fy:e.props.noteData.y,r:c&&c(e.props.noteData)||5,type:"point",originalNote:e})),f=function(){let e,t=[],o=[],n=1,r=1,i={start:e=>{},width:e=>{},height:e=>{},label:e=>{},anchor:e=>{},alt_energy:e=>{},alt_schedule:e=>{}},s=!1;const a=function(e){let n=t.length,r=0,i=t[e].x-o[e].x,s=o[e].y-t[e].y,a=Math.sqrt(i*i+s*s);a>0&&(r+=.2*a),i/=a,s/=a,r+=i>0&&s>0?0:0>i&&s>0?3:0>i&&0>s?6:9;let l,c,d,h,f,p,m,y=t[e].x,g=t[e].y-t[e].height+2,v=t[e].x+t[e].width,b=t[e].y+2;for(let i=0;n>i;i++)i!==e&&(u(o[e].x,t[e].x,o[i].x,t[i].x,o[e].y,t[e].y,o[i].y,t[i].y)&&(r+=1),l=t[i].x,d=t[i].y-t[i].height+2,c=t[i].x+t[i].width,h=t[i].y+2,f=Math.max(0,Math.min(c,v)-Math.max(l,y)),p=Math.max(0,Math.min(h,b)-Math.max(d,g)),m=f*p,r+=30*m),l=o[i].x-o[i].r,d=o[i].y-o[i].r,c=o[i].x+o[i].r,h=o[i].y+o[i].r,f=Math.max(0,Math.min(c,v)-Math.max(l,y)),p=Math.max(0,Math.min(h,b)-Math.max(d,g)),m=f*p,r+=30*m;return r},l=function(i){let l,c,u=Math.floor(Math.random()*t.length),d=t[u].x,h=t[u].y;l=s?e(u,t,o):a(u),t[u].x+=5*(Math.random()-.5),t[u].y+=5*(Math.random()-.5),t[u].x>n&&(t[u].x=d),0>t[u].x&&(t[u].x=d),t[u].y>r&&(t[u].y=h),0>t[u].y&&(t[u].y=h),c=s?e(u,t,o):a(u);let f=c-l;Math.random()<Math.exp(-f/i)||(t[u].x=d,t[u].y=h)},c=function(i){let l,c=Math.floor(Math.random()*t.length),u=t[c].x,d=t[c].y;l=s?e(c,t,o):a(c);let h=.5*(Math.random()-.5),f=Math.sin(h),p=Math.cos(h);t[c].x-=o[c].x,t[c].y-=o[c].y;let m,y=t[c].x*f+t[c].y*p;t[c].x=t[c].x*p-t[c].y*f+o[c].x,t[c].y=y+o[c].y,t[c].x>n&&(t[c].x=u),0>t[c].x&&(t[c].x=u),t[c].y>r&&(t[c].y=d),0>t[c].y&&(t[c].y=d),m=s?e(c,t,o):a(c);let g=m-l;Math.random()<Math.exp(-g/i)||(t[c].x=u,t[c].y=d)},u=function(e,t,o,n,r,i,s,a){let l,c,u,d,h;return u=(a-s)*(t-e)-(n-o)*(i-r),d=(n-o)*(r-s)-(a-s)*(e-o),h=(t-e)*(r-s)-(i-r)*(e-o),l=d/u,c=h/u,!(0>l||l>1||0>c||c>1)},d=function(e,t,o){return e-t/o};return i.start=function(e){let o=t.length,n=1;for(let t=0;e>t;t++){for(let e=0;o>e;e++).5>Math.random()?l(n):c(n);n=d(n,1,e)}},i.width=function(e){return arguments.length?(n=e,i):n},i.height=function(e){return arguments.length?(r=e,i):r},i.label=function(e){return arguments.length?(t=e,i):t},i.anchor=function(e){return arguments.length?(o=e,i):o},i.alt_energy=function(t){return arguments.length?(e=t,s=!0,i):a},i.alt_schedule=function(e){return arguments.length?i:d},i}();return f.label(d),f.anchor(h),f.width(o[0]),f.height(o[1]),f.start(l),d.forEach(e=>{if("label"===e.type){const t=function(e,t,o){return e.y>t.y?[t.x+t.width/2+o/2,t.y-t.height+o/2]:[t.x+t.width/2,t.y]}(e.originalNote.props.noteData,e,i);e.originalNote.props.noteData.nx=t[0],e.originalNote.props.noteData.ny=t[1]}}),e}(e,n,a,o.pointSizeFunction,o.labelSizeFunction);if("marginalia"===n.type){const{marginOffset:t,orient:o="nearest",characterWidth:c=8,lineHeight:u=20,padding:d=2,axisMarginOverride:h={}}=n,f="nearest"===o?["left","right","top","bottom"]:Array.isArray(o)?o:[o],p=f.find(e=>"left"===e),m=f.find(e=>"right"===e),y=f.find(e=>"top"===e),g=f.find(e=>"bottom"===e),x=[],k=[],w=[],A=[];for(const t of e){const e=t.props.noteData,o=e.x[0]||e.x,n=e.y[0]||e.y,r=p?o:1/0,i=m?a[0]-o:1/0,s=y?n:1/0,l=Math.min(r,i,s,g?a[1]-n:1/0);r===l?x.push(t):i===l?k.push(t):s===l?w.push(t):A.push(t)}const E=new b.default.Force({minPos:void 0!==h.top?0+h.top:0-s.top,maxPos:void 0!==h.bottom?a[1]-h.bottom:g?a[1]:a[1]+s.bottom}).nodes(x.map(e=>new b.default.Node(e.props.noteData.y[0]||e.props.noteData.y,Nt(e.props.noteData,c,u,r)+d))).compute(),M=new b.default.Force({minPos:void 0!==h.top?0+h.top:y?0:0-s.top,maxPos:void 0!==h.bottom?a[1]-h.bottom:a[1]+s.bottom}).nodes(k.map(e=>new b.default.Node(e.props.noteData.y[0]||e.props.noteData.y,Nt(e.props.noteData,c,u,r)+d))).compute(),S=new b.default.Force({minPos:void 0!==h.left?0+h.left:p?0:0-s.left,maxPos:void 0!==h.right?a[0]-h.right:a[0]+s.right}).nodes(w.map(e=>new b.default.Node(e.props.noteData.x[0]||e.props.noteData.x,jt(e.props.noteData,c,i)+d))).compute(),O=new b.default.Force({minPos:void 0!==h.left?0+h.left:0-s.left,maxPos:void 0!==h.right?a[0]-h.right:m?a[0]:a[0]+s.right}).nodes(A.map(e=>new b.default.Node(e.props.noteData.x[0]||e.props.noteData.x,jt(e.props.noteData,c,i)+d))).compute(),P=Math.max(...A.map(e=>Nt(e.props.noteData,c,u,r)+d)),j=Math.max(...w.map(e=>Nt(e.props.noteData,c,u,r)+d)),N=Math.max(...x.map(e=>jt(e.props.noteData,c,i)+d)),_=Math.max(...k.map(e=>jt(e.props.noteData,c,i)+d)),C=E.nodes(),z=M.nodes(),$=S.nodes(),B=O.nodes();return x.forEach((e,o)=>{const n=0-C[o].layerIndex*N-St("left",l,t),r=C[o].currentPos;e.props.noteData.nx=n,e.props.noteData.ny=r,e.props.noteData.note&&!v.isValidElement(e)&&(e.props.noteData.note.orientation=e.props.noteData.note.orientation||"leftRight",e.props.noteData.note.align=e.props.noteData.note.align||"right")}),k.forEach((e,o)=>{const n=a[0]+z[o].layerIndex*_+St("right",l,t),r=z[o].currentPos;e.props.noteData.nx=n,e.props.noteData.ny=r,e.props.noteData.note&&!v.isValidElement(e)&&(e.props.noteData.note.orientation=e.props.noteData.note.orientation||"leftRight",e.props.noteData.note.align=e.props.noteData.note.align||"left")}),w.forEach((e,o)=>{const n=$[o].currentPos,r=0-$[o].layerIndex*j-St("top",l,t);e.props.noteData.nx=n,e.props.noteData.ny=r}),A.forEach((e,o)=>{const n=B[o].currentPos,r=a[1]+B[o].layerIndex*P+St("bottom",l,t);e.props.noteData.nx=n,e.props.noteData.ny=r}),e}return e})(r,m,e):r.map((e,t)=>{const n=Object.assign(Object.assign({},o[t].props.noteData),e.props.noteData);return v.createElement(kt,{key:e.key,noteData:n})}),s=[...o,...i]}return p&&(a=((e,t)=>t.map((t,o)=>e.htmlAnnotationRule(t,o,e)).filter(e=>null!=e))(e,u)),{svgAnnotations:s,htmlAnnotations:a,adjustedAnnotations:o,adjustedAnnotationsKey:n,adjustedAnnotationsDataVersion:y}};function zt(e,t){var o={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(o[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);n.length>r;r++)0>t.indexOf(n[r])&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(o[n[r]]=e[n[r]])}return o}"function"==typeof SuppressedError&&SuppressedError;const $t=e=>e instanceof Date?e.getTime():e,Bt=({data:e,lineDataAccessor:t,xProp:o,xPropTop:n,xPropBottom:r,yProp:i,yPropTop:s,yPropBottom:a,xAccessor:l,yAccessor:c})=>{Array.isArray(e)||(e=[e]);const u=[];return t.forEach((t,d)=>{l.forEach((l,h)=>{c.forEach((c,f)=>{e.forEach(e=>{const p=Object.assign(Object.assign({},e),{xIndex:h,yIndex:f,lineIndex:d});p.data=t(e).map((e,t)=>{const u={data:e};return u[o]=l(e,t),u[n]=u[o],u[r]=u[o],u[i]=c(e,t),u[s]=u[i],u[a]=u[i],u}),p.key=p.key||u.length,u.push(p)})})})}),u},Lt=({type:e="stackedarea",data:t,xProp:o,yProp:n,yPropMiddle:i,sort:s,yPropTop:a,yPropBottom:l})=>{const c=new Map,u=t.map(()=>0);let d=0;for(const e of t){e.__lineIndex=d;for(const t of e.data){const e=$t(t[o]);u[d]+=t[n],c.has(e)||c.set(e,[]),c.get(e)[d]=t}d++}let h=(e,t)=>u[t.key]-u[e.key];"stackedpercent-invert"!==e&&"stackedarea-invert"!==e||(h=(e,t)=>u[e.key]-u[t.key]),null!==(s=void 0===s?h:s)&&(t=t.sort(s));const f=t.map(e=>e.__lineIndex);for(const[,t]of c){let o=0,s=0;const c=r.sum(t,e=>(null==e?void 0:e[n])>0?e[n]:0),u=r.sum(t,e=>0>(null==e?void 0:e[n])?e[n]:0);for(const r of f){const d=t[r];if(d)if(0>d[n]){if("linepercent"===e||"stackedpercent"===e||"stackedpercent-invert"===e){const t=d[n]/u;if(d.percent=t,"linepercent"===e)d[l]=d[l]=d[a]=d[i]=t;else{const e=0>u?t:0;d[l]=0===u?0:-o/u,d[a]=d[l]-e,d[i]=d[l]-e/2}}else d[l]=o,d[a]=o+d[n],d[i]=o+d[n]/2;o+=d[n]}else{if("linepercent"===e||"stackedpercent"===e||"stackedpercent-invert"===e){const t=d[n]/c;if(d.percent=t,"linepercent"===e)d[l]=d[a]=d[i]=t;else{const e=c>0?t:0;d[l]=0===c?0:s/c,d[a]=d[l]+e,d[i]=d[l]+e/2}}else d[l]=s,d[a]=s+d[n],d[i]=s+d[n]/2;s+=d[n]}}}return t},Dt=({data:e,y1:t,x1:o,yPropTop:n,yPropMiddle:r,yPropBottom:i,xPropTop:s,xPropMiddle:a,xPropBottom:l})=>{if(t)for(const o of e)for(const e of o.data)e[i]=t(e),e[r]=e[n];if(o)for(const t of e)for(const e of t.data)e[l]=o(e),e[a]=(e[l]+e[s])/2;return e},Tt=({data:e,y1:t,yPropTop:o,yPropMiddle:n,yPropBottom:r,type:i="cumulative"})=>{for(const s of e){let e=0;const a="cumulative-reverse"===i?s.data.reverse():s.data;for(const i of a)e+=i[o],i[r]=i[o]=i[n]=e,t&&(i[r]=t(i),i[n]=i[r]+i[o]/2)}return e},Wt=({type:e="bumpline",data:t,xProp:o,yProp:n,yPropMiddle:r,yPropTop:i,yPropBottom:s})=>{const a=new Map;for(const e of t)for(const t of e.data){const e=$t(t[o]);a.has(e)||a.set(e,[]),a.get(e).push(t)}let l=(e,t)=>e[n]>t[n]?1:-1;"bumparea-invert"!==e&&"bumpline-invert"!==e||(l=(e,t)=>t[n]>e[n]?1:-1);for(const[,t]of a){let o=0,a=0;t.sort(l);let c=1;for(const l of t)"bumparea"===e||"bumparea-invert"===e?0>l[n]?(l[i]=o+l[n],l[r]=o+l[n]/2,l[s]=o,o+=l[n]):(l[i]=a+l[n],l[r]=a+l[n]/2,l[s]=a,a+=l[n]):(l[n]=c,l[i]=c,l[s]=c),c++}return t};function Rt({pointA:e,pointB:t,currentParameters:o,parameters:n,keys:r}){const i={};return r.forEach(o=>{i[o]="number"==typeof e[o]?(e[o]+t[o])/2:void 0}),JSON.stringify(n(i))===JSON.stringify(o)?[i,t]:[e,i]}const Ft=({xy:e,orient:t,i:o,className:n="",jaggedBase:r})=>{let i=`M${e.x1},${e.y1}L${e.x2},${e.y2}`;return r&&0===o&&(i=((e,t)=>{let o="";const{x1:n,x2:r,y1:i,y2:s}=t;if("left"===e||"right"===e){const t=Math.abs(r-n);o=((e,t,o,n)=>{const r=e/t;let i=0,s="M0,"+o;const a="right"===n?-1:1;for(;e>=i;)s+=`L${i},${o}`,e>i&&(s+=`L${i+r/2},${o+10*a}`),i+=r;return s})(t,Math.ceil(t/40),"right"===e?0:i,e)}else{const t=Math.abs(s-i);o=((e,t,o,n)=>{const r=e/t;let i=0,s=`M${o},0`;const a="bottom"===n?-1:1;for(;e>=i;)s+=`L${o},${i}`,e>i&&(s+=`L${o+10*a},${i+r/2}`),i+=r;return s})(t,Math.ceil(t/40),n,e)}return o})(t,e)),v.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:i,className:`tick-line tick ${t} ${n}`})};function Ht(e,t,o){const n=Math.abs(o.range()[1]-o.range()[0]);return e||(t||(t=Math.max(1,Math.floor(n/40))),e=o.ticks&&o.ticks(t)||o.domain()),e}function It({t:e,o:t,w:o}){return"contour"!==e&&"boxplot"!==e||"left"!==t&&"right"!==t?0:o/2}function Yt({t:e,o:t,w:o}){return"contour"!==e&&"boxplot"!==e||"top"!==t&&"bottom"!==t?0:o/2}function Xt(e){const{translation:t,orient:o,decoratedSummaryType:n,summaryWidth:r,renderedSummary:i,points:s}=e;return v.default.createElement("g",{className:"marginal-graphics",transform:`translate(${t[o]})`},v.default.createElement("g",{transform:`translate(${It({t:n.type,o:o,w:r})},${Yt({t:n.type,o:o,w:r})})`},i),s)}function Gt(e){const{className:t,translation:o,position:n,rotation:r,labelName:i,anchorMod:s}=e;return v.default.createElement("g",{className:"axis-title "+t,transform:`translate(${[o[0]+n[0],o[1]+n[1]]}) rotate(${r})`},v.default.isValidElement(i)?i:v.default.createElement("text",{textAnchor:s},i))}function qt(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),o=Math.abs(t);return 1e9>o?1e6>o?1e4>o?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}const Vt=e=>e.reduce((e,t)=>e.concat(Array.isArray(t)?Vt(t.slice().sort((e,t)=>e-t)):t),[]);function Ut(e=[]){if(!Array.isArray(e))return"not-array";let t=e.slice();return Array.isArray(t[0])||(t=t.slice().sort((e,t)=>e-t)),""+Vt(t).map(e=>e instanceof Date&&""+e||void 0!==e&&e.toFixed&&e.toFixed(2)||"empty")}const Kt="x",Zt="y",Jt="yMiddle",Qt="yTop",eo="yBottom",to="xMiddle",oo="xTop",no="xBottom";function ro({preprocess:e=!0,processedData:t=!1,summaryType:o,data:r,finalXExtent:i,finalYExtent:s,size:a,xScaleType:l=n.scaleLinear(),yScaleType:c=n.scaleLinear(),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p}){let y=i,g=s;if(!y){const e=r.coordinates.map(e=>e.x);y=[Math.min(...e),Math.max(...e)]}if(!g){const e=r.coordinates.map(e=>e.y);g=[Math.min(...e),Math.max(...e)]}if(t&&r)return r.coordinates;let b,x=[];b=o.type?o:{type:b};const{bins:k=.05,cellPx:w,binValue:A=e=>e.length,binMax:E,customMark:M}=b;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(e=>[e.x,e.y]));const S=Array.isArray(r)?r:[r],O=l.domain(y).range([0,a[0]]),P=c.domain(g).range([0,a[1]]),j=w&&w/2||(k>1?1/k:k)*a[0]/2,N=m.hexbin().x(e=>O(e._xyfPoint[0])).y(e=>P(e._xyfPoint[1])).radius(j).size(a);let _;const C=N.centers();return S.forEach(e=>{_=0;const t=N(e._xyfCoordinates.map((t,o)=>Object.assign({_xyfPoint:t},e.coordinates[o]))),o={};t.forEach(e=>{o[`${parseInt(e.x)}-${parseInt(e.y)}`]=!0}),C.forEach(e=>{if(!o[`${parseInt(e[0])}-${parseInt(e[1])}`]){const o=[];o.x=e[0],o.y=e[1],t.push(o)}}),_=Math.max(...t.map(e=>A(e))),E&&E(_);const n=[[0,-1],[.866,-.5],[.866,.5],[0,1],[-.866,.5],[-.866,-.5]],r=O.invert(j)-y[0],i=P.invert(j)-g[0],s=n.map(e=>[e[0]*r,e[1]*i]),l=t.map(t=>{const o=A(t),r=t.x,i=t.y;t.x=O.invert(t.x),t.y=P.invert(t.y);const l=o/_;return{customMark:M&&v.createElement("g",{transform:`translate(${r},${a[1]-i})`},M({d:Object.assign(Object.assign({},t),{binItems:t,percent:l,value:o,radius:j,hexCoordinates:n.map(e=>[e[0]*j,e[1]*j])}),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p,adjustedSize:a})),_xyfCoordinates:s.map(e=>[e[0]+t.x,e[1]+t.y]),value:o,percent:l,data:t,parentSummary:e,centroid:!0}});x=[...x,...l]}),e?(x.forEach(e=>{e.x=e.data.x,e.y=e.data.y}),{type:"hexbin",processedData:!0,coordinates:x,binMax:_}):x}const io=(e,t,o,n)=>[...e.map((e,n)=>[e[0],e[1]+o(t[n])]),...e.map((e,o)=>[e[0],e[1]-n(t[o])]).reverse()];function so({preprocess:e=!0,processedData:t=!1,summaryType:o,data:r,finalXExtent:i=[Math.min(...r.coordinates.map(e=>e.x)),Math.max(...r.coordinates.map(e=>e.x))],finalYExtent:s=[Math.min(...r.coordinates.map(e=>e.y)),Math.max(...r.coordinates.map(e=>e.y))],size:a,xScaleType:l=n.scaleLinear(),yScaleType:c=n.scaleLinear(),margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p}){if(t&&r)return r.coordinates;r.coordinates&&!r._xyfCoordinates&&(r._xyfCoordinates=r.coordinates.map(e=>[e.x,e.y]));const m=Array.isArray(r)?r:[r];let y,g=[];y=o.type?o:{type:y};const{binValue:b=e=>e.length,xBins:x=y.yBins||.05,yBins:k=x,xCellPx:w=!y.xBins&&y.xCellPx,yCellPx:A=!y.yBins&&y.yCellPx,customMark:E,binMax:M}=y,S=1>x?x:1/x,O=1>k?k:1/k,P=l.domain(i).range([0,a[0]]),j=c.domain(s).range([a[1],0]),N=[Math.ceil((w&&w/a[0]||S)*a[0]*10)/10,Math.ceil((A&&A/a[1]||O)*a[1]*10)/10];let _=-1/0;return m.forEach(e=>{const t=[],o=[];let n,r;for(let i=0;a[0]>Math.ceil(i);i+=N[0]){const s=P.invert(i),l=P.invert(i+N[0]);r=[],t.push(r);for(let t=0;a[1]>Math.ceil(t);t+=N[1]){const a=j.invert(t),c=j.invert(t+N[1]);n={gx:i,gy:t,gw:N[0],gh:N[1],x:(s+l)/2,y:(a+c)/2,binItems:[],value:0,_xyfCoordinates:[[s,a],[l,a],[l,c],[s,c]],parentSummary:e},r.push(n),o.push(n)}r.push(n)}t.push(r),e._xyfCoordinates.forEach((o,n)=>{const r=P(o[0]),i=j(o[1]),s=Math.floor(r/N[0]),a=Math.floor(i/N[1]);t[s][a]&&t[s][a].binItems.push(e.coordinates[n])}),o.forEach(e=>{e.value=b(e.binItems),_=Math.max(_,e.value)}),o.forEach(e=>{e.percent=e.value/_,e.customMark=E&&v.createElement("g",{transform:`translate(${e.gx},${e.gy})`},E({d:e,margin:u,styleFn:d,classFn:h,renderFn:f,chartSize:p,adjustedSize:a}))}),g=[...g,...o]}),M&&M(_),e?{type:"heatmap",processedData:!0,_baseData:[],_xyfCoordinates:[],data:[],bounds:[],x:0,y:0,coordinates:g,binMax:_}:g}const ao=e=>e&&e.extent||Array.isArray(e)&&e||[],lo=()=>!0,co={top:Qt,bottom:eo,orphan:Zt},uo={top:oo,bottom:no,orphan:Kt},ho={stackedarea:Lt,"stackedarea-invert":Lt,stackedpercent:Lt,"stackedpercent-invert":Lt,linepercent:Lt,difference:({data:e,yProp:t,yPropTop:o,yPropBottom:n})=>(e.forEach((r,i)=>{r.data.forEach((r,s)=>{const a=0===i?1:0;r[t]>e[a].data[s][t]?(r[n]=e[a].data[s][t],r[o]=r[t]):(r[o]=r[t],r[n]=r[t])})}),e),bumparea:Wt,bumpline:Wt,"bumparea-invert":Wt,line:Dt,area:Dt,cumulative:Tt,"cumulative-reverse":Tt};function fo(e,t){const o=[];for(const e of t)o.push(Object.assign({},e));for(const t of e)t.parentSummary||o.push(t);return o}function po(e,t,o){return t.parent&&(o=`${o}-${po(e,Object.assign(Object.assign({},t.parent),t.parent.data),o)}`),`${o}-${e(Object.assign(Object.assign({},t),t.data))}`}const mo=e=>e.id||e.descendantIndex;function yo({data:e,colorBy:t,colorScale:o,getColor:n,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?n(i,t,o):o?o(r):"#000000";return{label:r+"",color:s}}),label:""}]}}const go={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 vo(e,t){return"function"==typeof t?t(e):e[t]}function bo(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 xo(e={}){const{fields:t,title:o,format:n,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=vo(e,o);s=bo(t,n)}if(t&&t.length>0)t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const s=vo(e,r);a.push({label:o,value:bo(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=bo(e[o],n);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=bo(e[t[0]],n))}}const l=Object.assign(Object.assign({},go),r);return v.createElement("div",{className:("semiotic-tooltip "+i).trim(),style:l},s&&v.createElement("div",{style:{fontWeight:a.length>0?"bold":"normal"}},s),a.map((e,t)=>v.createElement("div",{key:t,style:{marginTop:0===t&&s?"4px":0}},e.label&&v.createElement("span",null,e.label,": "),e.value)))}}function ko(e){return!0===e||("function"==typeof e?e:!1!==e&&void 0!==e&&("object"!=typeof e||null===e||!("fields"in e)&&!("title"in e)||xo(e)))}function wo(e){return"string"==typeof e?e:"value"}function Ao(e){return t=>{const o=t.data;return o?v.createElement("div",{className:"semiotic-tooltip",style:go},e.map((e,t)=>{const n=function(e,t){return"function"==typeof t?t(e):e[t]}(o,e.accessor),r=null==(i=n)?"–":"number"==typeof i?i.toLocaleString():i instanceof Date?i.toLocaleDateString():i+"";var i;return v.createElement("div",{key:t,style:t>0?{marginTop:2}:void 0},v.createElement("span",{style:{opacity:.8}},e.label,": "),v.createElement("span",{style:{fontWeight:"color"===e.role||"group"===e.role?"bold":"normal"}},r))})):null}}const Eo="#007bff";function Mo(e){return"function"==typeof e?e:t=>t[e]}function So(t,o,n="category10"){return e.useMemo(()=>{if(o&&"function"!=typeof o)return lt(t,o,n)},[t,o,n])}function Oo(t,o,n){return e.useMemo(()=>{if(!o)return t;const e=[...t];if("function"==typeof o)return e.sort(o);const r=Mo(n);return e.sort("asc"===o?(e,t)=>r(e)-r(t):(e,t)=>r(t)-r(e))},[t,o,n])}function Po({componentName:e,message:t,width:o,height:n}){return v.createElement("div",{role:"alert",style:{width:o,height:Math.max(n,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"}},v.createElement("div",{style:{textAlign:"center",maxWidth:400}},v.createElement("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"}},e),v.createElement("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5}},t)))}function jo({data:e,accessors:t,requiredProps:o}){if(o)for(const[e,t]of Object.entries(o))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 o=e[0];if(o&&"object"==typeof o)for(const[e,n]of Object.entries(t))if(n&&"string"==typeof n&&!(n in o))return`${e} "${n}" not found in data. Available fields: ${Object.keys(o).join(", ")}.`}return null}function No({data:e,dataLabel:t="data"}){return null==e?`No ${t} provided. Pass a hierarchical data object to the ${t} prop.`:null}function _o({nodes:e,edges:t,nodesRequired:o=!1,edgesRequired:n=!0,accessors:r}){if(n&&(!t||!Array.isArray(t)||0===t.length))return"No edges provided. Pass a non-empty array to the edges prop.";if(o&&(!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,o]of Object.entries(r))if(o&&"string"==typeof o&&!(o in t))return`${e} "${o}" not found in node data. Available fields: ${Object.keys(t).join(", ")}.`}return null}function Co(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 zo(e){return e?"string"==typeof e?{name:e}:e:null}function $o(e,t,o){return t?n=>{var r,i;const s=Object.assign({},e(n));return t.isActive&&(t.predicate(n)?(null==o?void 0:o.selectedStyle)&&Object.assign(s,o.selectedStyle):(s.fillOpacity=null!==(r=null==o?void 0:o.unselectedOpacity)&&void 0!==r?r:.2,s.strokeOpacity=null!==(i=null==o?void 0:o.unselectedOpacity)&&void 0!==i?i:.2,(null==o?void 0:o.unselectedStyle)&&Object.assign(s,o.unselectedStyle))),s}:e}function Bo(e){const t=[];for(const[o,n]of Object.entries(e.fields))if("point"===n.type)t.push(e=>n.values.has(e[o]));else{const[e,r]=n.range;t.push(t=>{const n=t[o];return n>=e&&r>=n})}return e=>t.every(t=>t(e))}function Lo(e,t){const o=[];for(const[n,r]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Bo(r));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Do(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}const[To,Wo]=wt(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),r=Do(n,t),i=new Map(r.clauses);return i.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},r),{clauses:i})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const r=new Map(e.selections),i=new Map(n.clauses);return i.delete(o),r.set(t,Object.assign(Object.assign({},n),{clauses:i})),{selections:r}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),r=Do(n,t);return n.set(t,Object.assign(Object.assign({},r),{resolution:o})),{selections:n}})},clearSelection(t){e(e=>{const o=new Map(e.selections),n=o.get(t);return n&&o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}}));function Ro(t){const o=e.useId(),n=t.clientId||o,{name:r}=t,i=Wo(e=>e.selections.get(r)),s=Wo(e=>e.setClause),a=Wo(e=>e.clearClause),l=e.useMemo(()=>!!i&&i.clauses.size>0,[i]);return{predicate:e.useMemo(()=>i&&0!==i.clauses.size?Lo(i,n):()=>!0,[i,n]),isActive:l,selectPoints:e.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(r,{clientId:n,type:"point",fields:t})},[n,r,s]),selectInterval:e.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(r,{clientId:n,type:"interval",fields:t})},[n,r,s]),clear:e.useCallback(()=>{a(r,n)},[a,r,n]),clientId:n}}function Fo(t){const o=t.name||"hover",{fields:n}=t,{predicate:r,isActive:i,selectPoints:s,clear:a}=Ro({name:o});return{onHover:e.useCallback(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:r,isActive:i}}function Ho(t){const{name:o,xField:n,yField:r}=t,{predicate:i,isActive:s,selectInterval:a,clear:l}=Ro({name:o}),c=n&&r?"xyBrush":n?"xBrush":"yBrush",u=e.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&Array.isArray(e)&&2===e.length?(n&&(t[n]=[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"===c&&Array.isArray(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Array.isArray(e)&&r&&(t[r]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,r,a,l]);return{brushInteraction:e.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:i,isActive:s,clear:l}}function Io(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,xLabel:l,yLabel:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",colorBy:p,colorScheme:m="category10",sizeBy:y,sizeRange:g=[3,15],pointRadius:b=5,pointOpacity:x=.8,enableHover:k=!0,showGrid:w=!1,showLegend:A,tooltip:E,marginalGraphics:M,frameProps:S={},selection:O,linkedHover:P,linkedBrush:j}=t,N=o||[],_=Co(P,p?["string"==typeof p?p:""]:[]),C=zo(j),z=Ro({name:(null==O?void 0:O.name)||"__unused__"}),$=Fo({name:(null==_?void 0:_.name)||"hover",fields:(null==_?void 0:_.fields)||[]});Ho({name:(null==C?void 0:C.name)||"__unused_brush__",xField:(null==C?void 0:C.xField)||("string"==typeof h?h:void 0),yField:(null==C?void 0:C.yField)||("string"==typeof f?f:void 0)});const B=O?{isActive:z.isActive,predicate:z.predicate}:null,L=So(N,p,m),D=e.useMemo(()=>{if(!y||0===N.length)return;const e=N.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[N,y]),T=e.useMemo(()=>e=>{const t={fillOpacity:x};return t.fill=p?at(e,p,L):Eo,t.r=y?ct(e,y,g,D):b,t},[p,L,y,g,D,b,x]),W=e.useMemo(()=>$o(T,B,O),[T,B,O]),R=void 0!==A?A:!!p,F=e.useMemo(()=>{if(R&&p)return yo({data:N,colorBy:p,colorScale:L,getColor:at})},[R,p,N,L]),H=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return F&&120>e.right&&(e.right=120),e},[i,F]),I=e.useCallback(e=>{P&&$.onHover(e)},[P,$]),Y=e.useMemo(()=>Ao([{label:l||wo(h),accessor:h,role:"x"},{label:c||wo(f),accessor:f,role:"y"},...p?[{label:wo(p),accessor:p,role:"color"}]:[],...y?[{label:wo(y),accessor:y,role:"size"}]:[]]),[h,f,l,c,p,y]),X=jo({componentName:"Scatterplot",data:N,accessors:{xAccessor:h,yAccessor:f}});if(X)return v.createElement(Po,{componentName:"Scatterplot",message:X,width:n,height:r});const G=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter",data:N,xAccessor:h,yAccessor:f,colorAccessor:p||void 0,sizeAccessor:y||void 0,sizeRange:g,pointStyle:W,colorScheme:m,size:[n,r],margin:H,showAxes:!0,xLabel:l,yLabel:c,xFormat:u,yFormat:d,enableHover:k,showGrid:w},F&&{legend:F}),a&&{title:a}),s&&{className:s}),{tooltipContent:E?ko(E):Y}),P&&{customHoverBehavior:I}),M&&{marginalGraphics:M}),S);return v.createElement(ie,Object.assign({},G))}function Yo(t){var o;const{data:n,width:r=600,height:i=400,margin:s,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",lineBy:m,lineDataAccessor:y="coordinates",colorBy:g,colorScheme:b="category10",curve:x="linear",showPoints:k=!1,pointRadius:w=3,fillArea:A=!1,areaOpacity:E=.3,lineWidth:M=2,enableHover:S=!0,showGrid:O=!1,showLegend:P,tooltip:j,frameProps:N={},selection:_,linkedHover:C}=t,z=n||[],$=Co(C,g?["string"==typeof g?g:""]:[]),B=Ro({name:(null==_?void 0:_.name)||"__unused__"}),L=Fo({name:(null==$?void 0:$.name)||"hover",fields:(null==$?void 0:$.fields)||[]}),D=_?{isActive:B.isActive,predicate:B.predicate}:null,T=void 0!==(null===(o=z[0])||void 0===o?void 0:o[y]),W=e.useMemo(()=>{if(T)return z;if(m){const e=z.reduce((e,t)=>{const o="function"==typeof m?m(t):t[m];if(!e[o]){const t={[y]:[]};"string"==typeof m&&(t[m]=o),e[o]=t}return e[o][y].push(t),e},{});return Object.values(e)}return[{[y]:z}]},[z,m,y,T]),R=So(z,g,b),F=e.useMemo(()=>e=>{const t={strokeWidth:M};return t.stroke=g?at(e,g,R):Eo,A&&(t.fill=t.stroke,t.fillOpacity=E),t},[g,R,M,A,E]),H=e.useMemo(()=>$o(F,D,_),[F,D,_]),I=e.useMemo(()=>{if(k)return e=>{const t={r:w,fillOpacity:1};return t.fill=g?at(e.parentLine||e,g,R):Eo,t}},[k,w,g,R]),Y=A?"area":"line",X=void 0!==P?P:W.length>1,G=e.useMemo(()=>{if(X&&g)return yo({data:W,colorBy:g,colorScale:R,getColor:at})},[X,g,W,R]),q=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),s);return G&&120>e.right&&(e.right=120),e},[s,G]),V=e.useCallback(e=>{C&&L.onHover(e)},[C,L]),U=m||g,K=e.useMemo(()=>Ao([{label:c||wo(f),accessor:f,role:"x"},{label:u||wo(p),accessor:p,role:"y"},...U?[{label:wo(U),accessor:U,role:"group"}]:[]]),[f,p,c,u,U]),Z=jo({componentName:"LineChart",data:z,accessors:{xAccessor:f,yAccessor:p}});if(Z)return v.createElement(Po,{componentName:"LineChart",message:Z,width:r,height:i});const J=e.useMemo(()=>T||m?W.flatMap(e=>{const t=e[y]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):z,[W,y,T,m,z]),Q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Y,data:J,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:x,lineStyle:H},k&&{pointStyle:I}),{size:[r,i],margin:q,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:S,showGrid:O}),G&&{legend:G}),l&&{title:l}),a&&{className:a}),{tooltipContent:j?ko(j):K}),C&&{customHoverBehavior:V}),N);return v.createElement(ie,Object.assign({},Q))}function Xo(t){var o;const{data:n,width:r=600,height:i=400,margin:s,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",areaBy:m,lineDataAccessor:y="coordinates",colorBy:g,colorScheme:b="category10",curve:x="monotoneX",areaOpacity:k=.7,showLine:w=!0,lineWidth:A=2,enableHover:E=!0,showGrid:M=!1,showLegend:S,tooltip:O,frameProps:P={},selection:j,linkedHover:N}=t,_=n||[],C=Co(N,g?["string"==typeof g?g:""]:[]),z=Ro({name:(null==j?void 0:j.name)||"__unused__"}),$=Fo({name:(null==C?void 0:C.name)||"hover",fields:(null==C?void 0:C.fields)||[]}),B=j?{isActive:z.isActive,predicate:z.predicate}:null,L=void 0!==(null===(o=_[0])||void 0===o?void 0:o[y]),D=e.useMemo(()=>{if(L)return _;if(m){const e=_.reduce((e,t)=>{const o="function"==typeof m?m(t):t[m];if(!e[o]){const t={[y]:[]};"string"==typeof m&&(t[m]=o),e[o]=t}return e[o][y].push(t),e},{});return Object.values(e)}return[{[y]:_}]},[_,m,y,L]),T=So(_,g,b),W=e.useMemo(()=>e=>{const t={},o=g?at(e,g,T):Eo;return t.fill=o,t.fillOpacity=k,w?(t.stroke=o,t.strokeWidth=A):t.stroke="none",t},[g,T,k,w,A]),R=e.useMemo(()=>$o(W,B,j),[W,B,j]),F=void 0!==S?S:D.length>1,H=e.useMemo(()=>{if(F&&g)return yo({data:D,colorBy:g,colorScale:T,getColor:at})},[F,g,D,T]),I=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),s);return H&&120>e.right&&(e.right=120),e},[s,H]),Y=e.useCallback(e=>{N&&$.onHover(e)},[N,$]),X=m||g,G=e.useMemo(()=>Ao([{label:c||wo(f),accessor:f,role:"x"},{label:u||wo(p),accessor:p,role:"y"},...X?[{label:wo(X),accessor:X,role:"group"}]:[]]),[f,p,c,u,X]),q=jo({componentName:"AreaChart",data:_,accessors:{xAccessor:f,yAccessor:p}});if(q)return v.createElement(Po,{componentName:"AreaChart",message:q,width:r,height:i});const V=e.useMemo(()=>L||m?D.flatMap(e=>{const t=e[y]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):_,[D,y,L,m,_]),U=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area",data:V,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:x,lineStyle:R,size:[r,i],margin:I,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:E,showGrid:M},H&&{legend:H}),l&&{title:l}),a&&{className:a}),{tooltipContent:O?ko(O):G}),N&&{customHoverBehavior:Y}),P);return v.createElement(ie,Object.assign({},U))}function Go(t){var o;const{data:n,width:r=600,height:i=400,margin:s,className:a,title:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:p="y",areaBy:m,lineDataAccessor:y="coordinates",colorBy:g,colorScheme:b="category10",curve:x="monotoneX",areaOpacity:k=.7,showLine:w=!0,lineWidth:A=2,normalize:E=!1,enableHover:M=!0,showGrid:S=!1,showLegend:O,tooltip:P,frameProps:j={},selection:N,linkedHover:_}=t,C=n||[],z=Co(_,g?["string"==typeof g?g:""]:[]),$=Ro({name:(null==N?void 0:N.name)||"__unused__"}),B=Fo({name:(null==z?void 0:z.name)||"hover",fields:(null==z?void 0:z.fields)||[]}),L=N?{isActive:$.isActive,predicate:$.predicate}:null,D=void 0!==(null===(o=C[0])||void 0===o?void 0:o[y]),T=e.useMemo(()=>{if(D)return C;if(m){const e=C.reduce((e,t)=>{const o="function"==typeof m?m(t):t[m];if(!e[o]){const t={[y]:[]};"string"==typeof m&&(t[m]=o),e[o]=t}return e[o][y].push(t),e},{});return Object.values(e)}return[{[y]:C}]},[C,m,y,D]),W=So(C,g,b),R=e.useMemo(()=>e=>{const t={},o=g?at(e,g,W):Eo;return t.fill=o,t.fillOpacity=k,w?(t.stroke=o,t.strokeWidth=A):t.stroke="none",t},[g,W,k,w,A]),F=e.useMemo(()=>$o(R,L,N),[R,L,N]),H=void 0!==O?O:T.length>1,I=e.useMemo(()=>{if(H&&g)return yo({data:T,colorBy:g,colorScale:W,getColor:at})},[H,g,T,W]),Y=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),s);return I&&120>e.right&&(e.right=120),e},[s,I]),X=e.useCallback(e=>{_&&B.onHover(e)},[_,B]),G=m||g,q=e.useMemo(()=>Ao([{label:c||wo(f),accessor:f,role:"x"},{label:u||wo(p),accessor:p,role:"y"},...G?[{label:wo(G),accessor:G,role:"group"}]:[]]),[f,p,c,u,G]),V=jo({componentName:"StackedAreaChart",data:C,accessors:{xAccessor:f,yAccessor:p}});if(V)return v.createElement(Po,{componentName:"StackedAreaChart",message:V,width:r,height:i});const U=e.useMemo(()=>D||m?T.flatMap(e=>{const t=e[y]||[];return m&&"string"==typeof m?t.map(t=>Object.assign(Object.assign({},t),{[m]:e[m]})):t}):C,[T,y,D,m,C]),K=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea",data:U,xAccessor:f,yAccessor:p,groupAccessor:m||void 0,curve:x,normalize:E,lineStyle:F,size:[r,i],margin:Y,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:M,showGrid:S},I&&{legend:I}),l&&{title:l}),a&&{className:a}),{tooltipContent:P?ko(P):q}),_&&{customHoverBehavior:X}),j);return v.createElement(ie,Object.assign({},K))}function qo(t){const{data:o,width:r=600,height:i=400,margin:s={top:50,bottom:60,left:70,right:80},className:l,title:c,xAccessor:u="x",yAccessor:d="y",valueAccessor:h="value",xLabel:f,yLabel:p,xFormat:m,yFormat:y,colorScheme:g="blues",customColorScale:b,showValues:x=!1,valueFormat:k,cellBorderColor:w="#fff",cellBorderWidth:A=1,enableHover:E=!0,tooltip:M,frameProps:S={},selection:O,linkedHover:P}=t,j=o||[],N=Co(P,[]),_=Ro({name:(null==O?void 0:O.name)||"__unused__"}),C=Fo({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),z=O?{isActive:_.isActive,predicate:_.predicate}:null,$=e.useMemo(()=>"function"==typeof h?e=>h(e):e=>e[h],[h]),B=e.useMemo(()=>{const e=j.map($);return[Math.min(...e),Math.max(...e)]},[j,$]),L=e.useMemo(()=>"custom"===g&&b?b:n.scaleSequential({blues:a.interpolateBlues,reds:a.interpolateReds,greens:a.interpolateGreens,viridis:a.interpolateViridis}[g]||a.interpolateBlues).domain(B),[g,b,B]);e.useMemo(()=>{const e=Mo(u),t=Mo(d);return{xBinCount:new Set(j.map(e)).size,yBinCount:new Set(j.map(t)).size}},[j,u,d]),e.useMemo(()=>({coordinates:j}),[j]);const D=e.useMemo(()=>e=>{const t=$(e);return{fill:L(t),stroke:w,strokeWidth:A}},[$,L,w,A]);e.useMemo(()=>$o(D,z,O),[D,z,O]),e.useMemo(()=>{if(!x)return;const e=(B[0]+B[1])/2;return(t,o)=>{const n=$(t),r=k?k(n):n+"";return v.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fill:$(t)>e?"#fff":"#000",fontSize:"12px"},r)}},[x,$,k,B]);const T=e.useCallback(e=>{P&&C.onHover(e)},[P,C]),W=e.useMemo(()=>Ao([{label:f||wo(u),accessor:u,role:"x"},{label:p||wo(d),accessor:d,role:"y"},{label:wo(h),accessor:h,role:"value"}]),[u,d,f,p,h]),R=jo({componentName:"Heatmap",data:j,accessors:{xAccessor:u,yAccessor:d,valueAccessor:h}});if(R)return v.createElement(Po,{componentName:"Heatmap",message:R,width:r,height:i});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap",data:j,xAccessor:u,yAccessor:d,valueAccessor:h,size:[r,i],margin:s,showAxes:!0,xLabel:f,yLabel:p,xFormat:m,yFormat:y,enableHover:E},c&&{title:c}),l&&{className:l}),{tooltipContent:M?ko(M):W}),P&&{customHoverBehavior:T}),S);return v.createElement(ie,Object.assign({},F))}function Vo(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,xLabel:l,yLabel:c,xFormat:u,yFormat:d,xAccessor:h="x",yAccessor:f="y",sizeBy:p,sizeRange:m=[5,40],colorBy:y,colorScheme:g="category10",bubbleOpacity:b=.6,bubbleStrokeWidth:x=1,bubbleStrokeColor:k="white",enableHover:w=!0,showGrid:A=!1,showLegend:E,tooltip:M,marginalGraphics:S,frameProps:O={},selection:P,linkedHover:j,linkedBrush:N}=t,_=o||[],C=Co(j,y?["string"==typeof y?y:""]:[]),z=zo(N),$=Ro({name:(null==P?void 0:P.name)||"__unused__"}),B=Fo({name:(null==C?void 0:C.name)||"hover",fields:(null==C?void 0:C.fields)||[]});Ho({name:(null==z?void 0:z.name)||"__unused_brush__",xField:(null==z?void 0:z.xField)||("string"==typeof h?h:void 0),yField:(null==z?void 0:z.yField)||("string"==typeof f?f:void 0)});const L=P?{isActive:$.isActive,predicate:$.predicate}:null,D=So(_,y,g),T=e.useMemo(()=>{const e=_.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[_,p]),W=e.useMemo(()=>e=>{const t={fillOpacity:b,strokeWidth:x,stroke:k};return t.fill=y?at(e,y,D):Eo,t.r=ct(e,p,m,T),t},[y,D,p,m,T,b,x,k]),R=e.useMemo(()=>$o(W,L,P),[W,L,P]),F=void 0!==E?E:!!y,H=e.useMemo(()=>{if(F&&y)return yo({data:_,colorBy:y,colorScale:D,getColor:at,strokeColor:k,strokeWidth:x})},[F,y,_,D,k,x]),I=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),i);return H&&120>e.right&&(e.right=120),e},[i,H]),Y=e.useCallback(e=>{j&&B.onHover(e)},[j,B]),X=e.useMemo(()=>Ao([{label:l||wo(h),accessor:h,role:"x"},{label:c||wo(f),accessor:f,role:"y"},{label:wo(p),accessor:p,role:"size"},...y?[{label:wo(y),accessor:y,role:"color"}]:[]]),[h,f,l,c,p,y]),G=jo({componentName:"BubbleChart",data:_,accessors:{xAccessor:h,yAccessor:f},requiredProps:{sizeBy:p}});if(G)return v.createElement(Po,{componentName:"BubbleChart",message:G,width:n,height:r});const q=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble",data:_,xAccessor:h,yAccessor:f,colorAccessor:y||void 0,sizeAccessor:p,sizeRange:m,pointStyle:R,colorScheme:g,size:[n,r],margin:I,showAxes:!0,xLabel:l,yLabel:c,xFormat:u,yFormat:d,enableHover:w,showGrid:A},H&&{legend:H}),a&&{title:a}),s&&{className:s}),{tooltipContent:M?ko(M):X}),j&&{customHoverBehavior:Y}),S&&{marginalGraphics:S}),O);return v.createElement(ie,Object.assign({},q))}function Uo({selections:t}){const o=Wo(e=>e.setResolution);return e.useEffect(()=>{for(const[e,n]of Object.entries(t))n.resolution&&o(e,n.resolution)},[]),null}function Ko({children:e,selections:t}){return v.createElement(To,null,t&&v.createElement(Uo,{selections:t}),e)}Io.displayName="Scatterplot",Yo.displayName="LineChart",Xo.displayName="AreaChart",Go.displayName="StackedAreaChart",qo.displayName="Heatmap",Vo.displayName="BubbleChart";const Zo="__splomIdx",Jo={top:4,bottom:4,left:4,right:4};function Qo({frameRef:n,cellSize:r,onBrush:i}){const s=e.useRef(null),a=r-Jo.left-Jo.right,l=r-Jo.top-Jo.bottom;return e.useEffect(()=>{if(!s.current)return;const e=o.select(s.current).select(".brush-g"),r=t.brush().extent([[0,0],[a,l]]).on("brush end",e=>{var t;const o=null===(t=n.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void i(null);const[[r,s],[a,l]]=e.selection,c=[[o.x.invert(r),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];i(c)});return e.call(r),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null)}},[a,l,n,i]),v.createElement("svg",{ref:s,width:r,height:r,style:{position:"absolute",top:0,left:0}},v.createElement("g",{className:"brush-g",transform:`translate(${Jo.left},${Jo.top})`}))}function en({data:t,xField:o,yField:n,cellSize:r,pointRadius:i,pointOpacity:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,unselectedOpacity:d,mode:h,onPointHover:f}){const p=e.useRef(null),m=Ro({name:c,clientId:`splom-${o}-${n}`}),y=Ho({name:c,xField:o,yField:n}),g=Ro({name:u,clientId:"splom-hover-source"}),b=g.selectPoints,x=e.useCallback(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),k=e.useCallback(e=>{if(!e)return void(null==f||f(null));const t=e.data,o=null==t?void 0:t[Zo];void 0!==o&&(b({[Zo]:[o]}),null==f||f(t,e.x+Jo.left,e.y+Jo.top))},[b,f]),w=e.useCallback(e=>{const t={opacity:s,r:i};return t.fill=a?at(e,a,l):Eo,"hover"===h?g.isActive&&g.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):g.isActive&&(t.opacity=.6*s):m.isActive&&!m.predicate(e)&&(t.opacity=d),t},[a,l,s,i,h,m.isActive,m.predicate,g.isActive,g.predicate,d]);return v.createElement("div",{style:{position:"relative",width:r,height:r}},v.createElement(ie,{ref:p,chartType:"scatter",data:t,size:[r,r],xAccessor:o,yAccessor:n,pointStyle:w,margin:Jo,showAxes:!1,enableHover:"hover"===h,customHoverBehavior:"hover"===h?k:void 0,tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&v.createElement(Qo,{frameRef:p,cellSize:r,xField:o,yField:n,onBrush:x}))}function tn({data:t,field:o,label:n,cellSize:r,bins:i,brushSelectionName:s,hoverSelectionName:a,mode:l}){const c=Ro({name:s,clientId:"splom-diag-"+o}),u=Ro({name:a,clientId:`splom-diag-${o}-hover`}),d="hover"===l?u:c,h=d.isActive,f=d.predicate,p=e.useMemo(()=>{const e=t.map(e=>e[o]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],max:0};const n=Math.min(...e),s=(Math.max(...e)-n)/i||1,a=Array(i).fill(0),l=Array(i).fill(0);for(const e of t){const t=e[o];if(null==t||isNaN(t))continue;const r=Math.min(Math.floor((t-n)/s),i-1);a[r]++,h&&!f(e)||l[r]++}const c=Math.max(...a,1);return{bars:a.map((e,t)=>({x:t/i*r,w:r/i-1,h:e/c*(r-24),count:e})),selectedBars:l.map((e,t)=>({x:t/i*r,w:r/i-1,h:e/c*(r-24),count:e})),max:c}},[t,o,i,r,h,f]);return v.createElement("svg",{width:r,height:r,style:{overflow:"hidden"}},v.createElement("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333"},n),p.bars.map((e,t)=>v.createElement("rect",{key:"bg-"+t,x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:"#ccc",opacity:h?.3:.6})),h&&p.selectedBars.map((e,t)=>v.createElement("rect",{key:"sel-"+t,x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:Eo,opacity:.7})))}function on({label:e,cellSize:t}){return v.createElement("svg",{width:t,height:t},v.createElement("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333"},e))}function nn(t){const{data:o,fields:n,fieldLabels:r={},colorBy:i,colorScheme:s="category10",cellSize:a=150,cellGap:l=4,pointRadius:c=2,pointOpacity:u=.5,diagonal:d="histogram",histogramBins:h=20,brushMode:f="crossfilter",hoverMode:p=!0,unselectedOpacity:m=.1,showGrid:y=!1,tooltip:g,showLegend:b,idAccessor:x,className:k}=t,w="splom",A="splom-hover",E=p?"hover":f?"brush":"hover",M=Wo(e=>e.clearSelection),[S,O]=e.useState(null),P=e.useCallback(()=>{M(A),O(null)},[M,A]),j=e.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[Zo]?e:Object.assign(Object.assign({},e),{[Zo]:t})),[o]),N=So(j,i,s),_=void 0!==b?b:!!i,C=e.useMemo(()=>{if(!_||!i)return null;const e="string"==typeof i?i:null;return e?[...new Set(j.map(t=>t[e]))].map(e=>({label:e+"",color:N?N(e+""):Eo})):null},[_,i,j,N]),z=e.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>a+"px").join(" "),gridTemplateRows:n.map(()=>a+"px").join(" ")+" 40px",gap:l+"px",width:"fit-content"}),[n,a,l,40]);return v.createElement("div",{className:k,style:{position:"relative"}},C&&v.createElement("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"}},C.map(e=>v.createElement("div",{key:e.label,style:{display:"flex",alignItems:"center",gap:4}},v.createElement("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),v.createElement("span",{style:{fontSize:11}},e.label)))),v.createElement("div",{style:z,onMouseLeave:"hover"===E?P:void 0},n.map((e,t)=>v.createElement(v.Fragment,{key:"row-"+e},v.createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"}},r[e]||e),n.map((o,n)=>t===n?"label"===d?v.createElement(on,{key:"diag-"+e,label:r[e]||e,cellSize:a}):v.createElement(tn,{key:"diag-"+e,data:j,field:e,label:r[e]||e,cellSize:a,bins:h,colorBy:i,colorScale:N,brushSelectionName:w,hoverSelectionName:A,unselectedOpacity:m,mode:E}):v.createElement(en,{key:`cell-${e}-${o}`,data:j,xField:o,yField:e,fieldLabels:r,cellSize:a,pointRadius:c,pointOpacity:u,colorBy:i,colorScale:N,brushSelectionName:w,hoverSelectionName:A,unselectedOpacity:m,showGrid:y,tooltip:g,mode:E,onPointHover:"hover"===E?(r,i,s)=>{O(r?{datum:r,xField:o,yField:e,colIndex:n,rowIndex:t,px:null!=i?i:0,py:null!=s?s:0}:null)}:void 0})))),v.createElement("div",null)," ",n.map(e=>v.createElement("div",{key:"col-label-"+e,style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"}},r[e]||e))),S&&"hover"===E&&(()=>{const e=S.datum,t=r[S.xField]||S.xField,o=r[S.yField]||S.yField,n=i?"function"==typeof i?i(e):e[i]:null,s=x?"function"==typeof x?x(e):e[x]:"Row "+e[Zo];return v.createElement("div",{style:{position:"absolute",left:40+S.colIndex*(a+l)+S.px,top:S.rowIndex*(a+l)+S.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}},v.createElement("div",{style:{fontWeight:"bold",marginBottom:2}},s+""),v.createElement("div",null,t,": ",null!=e[S.xField]?Number(e[S.xField]).toFixed(1):"–"),v.createElement("div",null,o,": ",null!=e[S.yField]?Number(e[S.yField]).toFixed(1):"–"),null!=n&&v.createElement("div",{style:{opacity:.8}},"string"==typeof i?i:"group",": ",n+""))})())}function rn(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),v.createElement(Ko,{selections:n},v.createElement(nn,Object.assign({},e)))}function sn({width:n,height:r,margin:i,scales:s,brushDirection:a,extent:l,onBrush:c}){const u=e.useRef(null),d=e.useRef(null),h=e.useRef(!1),f=n+i.left+i.right,p=r+i.top+i.bottom;return e.useEffect(()=>{if(!u.current||!s)return;const e=o.select(u.current).select(".brush-group"),i="x"===a?t.brushX().extent([[0,0],[n,r]]):t.brushY().extent([[0,0],[n,r]]);return i.on("brush end",e=>{if(h.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void c(null);const o=("x"===a?s.x:s.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];c(n)}),e.call(i),d.current=i,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null)}},[s,n,r,a,c]),e.useEffect(()=>{if(!d.current||!s||!u.current)return;const e=o.select(u.current).select(".brush-group"),t="x"===a?s.x:s.y;if(h.current=!0,l){const o=[t(l[0]),t(l[1])];e.call(d.current.move,o)}else e.call(d.current.move,null);h.current=!1},[l,s,a]),v.createElement("svg",{ref:u,width:f,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"}},v.createElement("g",{className:"brush-group",transform:`translate(${i.left},${i.top})`}))}function an(t){var o,n;const{data:r,width:i=600,height:s=400,margin:a,className:l,title:c,xLabel:u,yLabel:d,xFormat:h,yFormat:f,xAccessor:p="x",yAccessor:m="y",lineBy:y,lineDataAccessor:g="coordinates",colorBy:b,colorScheme:x="category10",curve:k="linear",lineWidth:w=2,fillArea:A=!1,areaOpacity:E=.3,showPoints:M=!1,pointRadius:S=3,enableHover:O=!0,showGrid:P=!1,showLegend:j,tooltip:N,minimap:_={},renderBefore:C=!1,onBrush:z,brushExtent:$,frameProps:B={}}=t,L=r||[],[D,T]=e.useState(null),W=null!=$?$:D,R=e.useCallback(e=>{$||T(e),null==z||z(e)},[$,z]),F=e.useRef(null),[H,I]=e.useState(null);e.useEffect(()=>{const e=()=>{var t,o;const n=null===(o=null===(t=F.current)||void 0===t?void 0:t.getScales)||void 0===o?void 0:o.call(t);n?I(n):requestAnimationFrame(e)};requestAnimationFrame(e)},[r]);const Y=void 0!==(null===(o=L[0])||void 0===o?void 0:o[g]),X=e.useMemo(()=>{if(Y)return L;if(y){const e=L.reduce((e,t)=>{const o="function"==typeof y?y(t):t[y];if(!e[o]){const t={[g]:[]};"string"==typeof y&&(t[y]=o),e[o]=t}return e[o][g].push(t),e},{});return Object.values(e)}return[{[g]:L}]},[L,y,g,Y]),G=e.useMemo(()=>Y||y?X.flatMap(e=>{const t=e[g]||[];return y&&"string"==typeof y?t.map(t=>Object.assign(Object.assign({},t),{[y]:e[y]})):t}):L,[X,g,Y,y,L]),q=So(L,b,x),V=e.useMemo(()=>e=>{const t={strokeWidth:w};return t.stroke=b?at(e,b,q):Eo,A&&(t.fill=t.stroke,t.fillOpacity=E),t},[b,q,w,A,E]),U=e.useMemo(()=>_.lineStyle?_.lineStyle:e=>{const t={strokeWidth:1};return t.stroke=b?at(e,b,q):Eo,t},[b,q,_.lineStyle]),K=e.useMemo(()=>{if(M)return e=>{const t={r:S,fillOpacity:1};return t.fill=b?at(e.parentLine||e,b,q):Eo,t}},[M,S,b,q]),Z=void 0!==j?j:X.length>1,J=e.useMemo(()=>{if(Z&&b)return yo({data:X,colorBy:b,colorScale:q,getColor:at})},[Z,b,X,q]),Q=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:50,bottom:60,left:70,right:40}),a);return J&&120>e.right&&(e.right=120),e},[a,J]),ee=_.height||60,te=e.useMemo(()=>{var e,t,o,n,r,i,s,a;return{top:null!==(t=null===(e=_.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=_.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(i=null===(r=_.margin)||void 0===r?void 0:r.left)&&void 0!==i?i:Q.left,right:null!==(a=null===(s=_.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:Q.right}},[_.margin,Q]),oe=_.brushDirection||"x",ne=jo({componentName:"MinimapChart",data:L,accessors:{xAccessor:p,yAccessor:m}});if(ne)return v.createElement(Po,{componentName:"MinimapChart",message:ne,width:i,height:s});const re=A?"area":"line",se=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:re,data:G,xAccessor:p,yAccessor:m,groupAccessor:y||void 0,curve:k,lineStyle:V},M&&{pointStyle:K}),{size:[i,s],margin:Q,showAxes:!0,xLabel:u,yLabel:d,xFormat:h,yFormat:f,enableHover:O,showGrid:P}),J&&{legend:J}),c&&{title:c}),N&&{tooltipContent:ko(N)}),W&&{xExtent:W}),B),ae={chartType:re,data:G,xAccessor:p,yAccessor:m,groupAccessor:y||void 0,curve:k,lineStyle:U,size:[i,ee+te.top+te.bottom],margin:te,showAxes:null!==(n=_.showAxes)&&void 0!==n&&n,background:_.background,enableHover:!1},le=v.createElement("div",{key:"minimap",style:{position:"relative",width:i}},v.createElement(ie,Object.assign({ref:F},ae)),v.createElement(sn,{width:i-te.left-te.right,height:ee,margin:te,scales:H,brushDirection:oe,extent:W,onBrush:R})),ce=v.createElement("div",{key:"main"},v.createElement(ie,Object.assign({},se)));return v.createElement("div",{className:"minimap-chart"+(l?" "+l:"")},C?le:ce,C?ce:le)}function ln(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:f,colorBy:p,colorScheme:m="category10",sort:y=!1,barPadding:g=5,enableHover:b=!0,showGrid:x=!1,showLegend:k,tooltip:w,frameProps:A={},selection:E,linkedHover:M}=t,S=o||[],O=Co(M,p?["string"==typeof p?p:""]:[]),P=Ro({name:(null==E?void 0:E.name)||"__unused__"}),j=Fo({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=E?{isActive:P.isActive,predicate:P.predicate}:null,_=Oo(S,y,c),C=So(S,p,m),z=e.useMemo(()=>e=>{const t={};return t.fill=p?at(e,p,C):Eo,t},[p,C]),$=e.useMemo(()=>$o(z,N,E),[z,N,E]),B=void 0!==k?k:!!p,L=e.useMemo(()=>{if(B&&p)return yo({data:_,colorBy:p,colorScale:C,getColor:at})},[B,p,_,C]),D=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return L&&120>e.right&&(e.right=120),e},[i,L]),T=e.useCallback(e=>{M&&j.onHover(e?e.data||e:null)},[M,j]),W=e.useMemo(()=>{const e=p&&p!==l;return t=>{const o=t.data||t,n="function"==typeof l?l(o):o[l],r="function"==typeof c?c(o):o[c],i=e?"function"==typeof p?p(o):o[p]:null;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},n+""),v.createElement("div",{style:{marginTop:"4px"}},"number"==typeof r?r.toLocaleString():r+""),null!=i&&v.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof p?p:"group",": ",i+""))}},[l,c,p]),R=jo({componentName:"BarChart",data:S,accessors:{categoryAccessor:l,valueAccessor:c}});if(R)return v.createElement(Po,{componentName:"BarChart",message:R,width:n,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:_,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:$,size:[n,r],margin:D,barPadding:g,enableHover:b,showAxes:!0,oLabel:d,rLabel:h,rFormat:f,showGrid:x,oSort:y},L&&{legend:L}),a&&{title:a}),s&&{className:s}),{tooltipContent:w?ko(w):W}),M&&{customHoverBehavior:T}),A);return v.createElement(Ee,Object.assign({},F))}function cn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",stackBy:c,valueAccessor:u="value",orientation:d="vertical",categoryLabel:h,valueLabel:f,valueFormat:p,colorBy:m,colorScheme:y="category10",normalize:g=!1,barPadding:b=5,enableHover:x=!0,showGrid:k=!1,showLegend:w=!0,tooltip:A,frameProps:E={},selection:M,linkedHover:S}=t,O=o||[],P=m||c,j=Co(S,P?["string"==typeof P?P:""]:[]),N=Ro({name:(null==M?void 0:M.name)||"__unused__"}),_=Fo({name:(null==j?void 0:j.name)||"hover",fields:(null==j?void 0:j.fields)||[]}),C=M?{isActive:N.isActive,predicate:N.predicate}:null,z=So(O,P,y),$=e.useMemo(()=>e=>P?{fill:at(e,P,z)}:{fill:Eo},[P,z]),B=e.useMemo(()=>$o($,C,M),[$,C,M]),L=e.useMemo(()=>{if(w)return yo({data:O,colorBy:P,colorScale:z,getColor:at})},[w,O,P,z]),D=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:120},i);return L&&120>e.right&&(e.right=120),e},[i,L]),T=e.useCallback(e=>{S&&_.onHover(e)},[S,_]),W=e.useMemo(()=>{const e=Mo(c),t=Mo(l),o=Mo(u);return n=>{const r=n.data||n;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},e(r)+""),v.createElement("div",{style:{marginTop:"4px"}},t(r)+""," · ",Number(o(r)).toLocaleString()))}},[c,l,u]),R=jo({componentName:"StackedBarChart",data:O,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{stackBy:c}});if(R)return v.createElement(Po,{componentName:"StackedBarChart",message:R,width:n,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar",data:O,oAccessor:l,rAccessor:u,stackBy:c,normalize:g,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:B,size:[n,r],margin:D,barPadding:b,enableHover:x,showAxes:!0,oLabel:h,rLabel:f,rFormat:p,showGrid:k},L&&{legend:L}),a&&{title:a}),s&&{className:s}),{tooltipContent:A?ko(A):W}),S&&{customHoverBehavior:T}),E);return v.createElement(Ee,Object.assign({},F))}function un(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:f,colorBy:p,colorScheme:m="category10",sizeBy:y,sizeRange:g=[3,8],pointRadius:b=4,pointOpacity:x=.7,categoryPadding:k=20,enableHover:w=!0,showGrid:A=!1,showLegend:E,tooltip:M,frameProps:S={},selection:O,linkedHover:P}=t,j=o||[],N=Co(P,p?["string"==typeof p?p:""]:["string"==typeof l?l:""]),_=Ro({name:(null==O?void 0:O.name)||"__unused__"}),C=Fo({name:(null==N?void 0:N.name)||"hover",fields:(null==N?void 0:N.fields)||[]}),z=O?{isActive:_.isActive,predicate:_.predicate}:null,$=So(j,p,m),B=e.useMemo(()=>{if(!y)return;const e=j.map(e=>"function"==typeof y?y(e):e[y]);return[Math.min(...e),Math.max(...e)]},[j,y]),L=e.useMemo(()=>e=>{const t={fillOpacity:x};return t.fill=p?at(e,p,$):Eo,t.r=y?ct(e,y,g,B):b,t},[p,$,y,g,B,b,x]),D=e.useMemo(()=>$o(L,z,O),[L,z,O]),T=void 0!==E?E:!!p,W=e.useMemo(()=>{if(T&&p)return yo({data:j,colorBy:p,colorScale:$,getColor:at})},[T,p,j,$]),R=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return W&&120>e.right&&(e.right=120),e},[i,W]),F=e.useCallback(e=>{P&&C.onHover(e)},[P,C]),H=e.useMemo(()=>{const e=Mo(c),t=Mo(l);return o=>{const n=o.data||o,r=t(n),i=e(n),s=p?"function"==typeof p?p(n):n[p]:null,a=y?"function"==typeof y?y(n):n[y]:null;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},r+""),v.createElement("div",{style:{marginTop:"4px"}},"number"==typeof i?i.toLocaleString():i+""),null!=s&&v.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof p?p:"color",": ",s+""),null!=a&&v.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof y?y:"size",": ","number"==typeof a?a.toLocaleString():a+""))}},[l,c,p,y]),I=jo({componentName:"SwarmPlot",data:j,accessors:{categoryAccessor:l,valueAccessor:c}});if(I)return v.createElement(Po,{componentName:"SwarmPlot",message:I,width:n,height:r});const Y=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm",data:j,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:D,size:[n,r],margin:R,barPadding:k,enableHover:w,showAxes:!0,oLabel:d,rLabel:h,rFormat:f,showGrid:A},W&&{legend:W}),a&&{title:a}),s&&{className:s}),{tooltipContent:M?ko(M):H}),P&&{customHoverBehavior:F}),S);return v.createElement(Ee,Object.assign({},Y))}function dn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",categoryLabel:d,valueLabel:h,valueFormat:f,colorBy:p,colorScheme:m="category10",showOutliers:y=!0,categoryPadding:g=20,enableHover:b=!0,showGrid:x=!1,showLegend:k,tooltip:w,frameProps:A={},selection:E,linkedHover:M}=t,S=o||[],O=Co(M,p?["string"==typeof p?p:""]:["string"==typeof l?l:""]),P=Ro({name:(null==E?void 0:E.name)||"__unused__"}),j=Fo({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=E?{isActive:P.isActive,predicate:P.predicate}:null,_=So(S,p,m),C=e.useMemo(()=>e=>{const t=p?at(e,p,_):Eo;return{fill:t,stroke:t,fillOpacity:.8}},[p,_]),z=e.useMemo(()=>$o(C,N,E),[C,N,E]),$=void 0!==k?k:!!p,B=e.useMemo(()=>{if($&&p)return yo({data:S,colorBy:p,colorScale:_,getColor:at})},[$,p,S,_]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return B&&120>e.right&&(e.right=120),e},[i,B]),D=e.useCallback(e=>{M&&j.onHover(e)},[M,j]),T=e.useMemo(()=>e=>{const t=e.data||e,o=t.stats||{};return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold",marginBottom:"4px"}},(t.category||e.category||"")+""),null!=o.median&&v.createElement(v.Fragment,null,v.createElement("div",null,"Median: ",o.median.toLocaleString()),v.createElement("div",null,"Q1: ",o.q1.toLocaleString()),v.createElement("div",null,"Q3: ",o.q3.toLocaleString()),v.createElement("div",null,"Min: ",o.min.toLocaleString()),v.createElement("div",null,"Max: ",o.max.toLocaleString())))},[]),W=jo({componentName:"BoxPlot",data:S,accessors:{categoryAccessor:l,valueAccessor:c}});if(W)return v.createElement(Po,{componentName:"BoxPlot",message:W,width:n,height:r});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot",data:S,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:z,showOutliers:y,size:[n,r],margin:L,barPadding:g,enableHover:b,showAxes:!0,oLabel:d,rLabel:h,rFormat:f,showGrid:x},B&&{legend:B}),a&&{title:a}),s&&{className:s}),{tooltipContent:w?ko(w):T}),M&&{customHoverBehavior:D}),A);return v.createElement(Ee,Object.assign({},R))}function hn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",bins:u=25,relative:d=!1,categoryLabel:h,valueLabel:f,valueFormat:p,colorBy:m,colorScheme:y="category10",categoryPadding:g=20,enableHover:b=!0,showGrid:x=!1,showLegend:k,tooltip:w,frameProps:A={},selection:E,linkedHover:M}=t,S=o||[],O=Co(M,m?["string"==typeof m?m:""]:["string"==typeof l?l:""]),P=Ro({name:(null==E?void 0:E.name)||"__unused__"}),j=Fo({name:(null==O?void 0:O.name)||"hover",fields:(null==O?void 0:O.fields)||[]}),N=E?{isActive:P.isActive,predicate:P.predicate}:null,_=So(S,m,y),C=e.useMemo(()=>e=>{const t=m?at(e,m,_):Eo;return{fill:t,stroke:t,fillOpacity:.8}},[m,_]),z=e.useMemo(()=>$o(C,N,E),[C,N,E]),$=void 0!==k?k:!!m,B=e.useMemo(()=>{if($&&m)return yo({data:S,colorBy:m,colorScale:_,getColor:at})},[$,m,S,_]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return B&&120>e.right&&(e.right=120),e},[i,B]),D=e.useCallback(e=>{M&&j.onHover(e)},[M,j]),T=e.useMemo(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=t.count,r=t.range;return v.createElement("div",{className:"semiotic-tooltip",style:go},o&&v.createElement("div",{style:{fontWeight:"bold"}},o+""),null!=n&&v.createElement("div",null,"Count: ",n),r&&2===r.length&&v.createElement("div",{style:{opacity:.8}},Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)))},[]),W=jo({componentName:"Histogram",data:S,accessors:{categoryAccessor:l,valueAccessor:c}});if(W)return v.createElement(Po,{componentName:"Histogram",message:W,width:n,height:r});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram",data:S,oAccessor:l,rAccessor:c,projection:"horizontal",summaryStyle:z,bins:u,normalize:d,size:[n,r],margin:L,barPadding:g,enableHover:b,showAxes:!0,oLabel:h,rLabel:f,rFormat:p,showGrid:x},B&&{legend:B}),a&&{title:a}),s&&{className:s}),{tooltipContent:w?ko(w):T}),M&&{customHoverBehavior:D}),A);return v.createElement(Ee,Object.assign({},R))}function fn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="vertical",bins:d=25,showIQR:h=!0,categoryLabel:f,valueLabel:p,valueFormat:m,colorBy:y,colorScheme:g="category10",categoryPadding:b=20,enableHover:x=!0,showGrid:k=!1,showLegend:w,tooltip:A,frameProps:E={},selection:M,linkedHover:S}=t,O=o||[],P=Co(S,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),j=Ro({name:(null==M?void 0:M.name)||"__unused__"}),N=Fo({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),_=M?{isActive:j.isActive,predicate:j.predicate}:null,C=So(O,y,g),z=e.useMemo(()=>e=>{const t=y?at(e,y,C):Eo;return{fill:t,stroke:t,fillOpacity:.6}},[y,C]),$=e.useMemo(()=>$o(z,_,M),[z,_,M]),B=void 0!==w?w:!!y,L=e.useMemo(()=>{if(B&&y)return yo({data:O,colorBy:y,colorScale:C,getColor:at})},[B,y,O,C]),D=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return L&&120>e.right&&(e.right=120),e},[i,L]),T=e.useCallback(e=>{S&&N.onHover(e)},[S,N]),W=e.useMemo(()=>e=>{const t=e.data||e,o=t.category||e.category||"",n=(Array.isArray(t)?t:[]).map(e=>{const t="function"==typeof c?c(e):e[c];return Number(t)}).filter(e=>!isNaN(e)).sort((e,t)=>e-t),r=n.length,i=r>0?n[Math.floor(r/2)]:null;return v.createElement("div",{className:"semiotic-tooltip",style:go},o&&v.createElement("div",{style:{fontWeight:"bold"}},o+""),r>0&&v.createElement("div",null,"n = ",r),null!=i&&v.createElement("div",null,"Median: ",i.toLocaleString()))},[c]),R=jo({componentName:"ViolinPlot",data:O,accessors:{categoryAccessor:l,valueAccessor:c}});if(R)return v.createElement(Po,{componentName:"ViolinPlot",message:R,width:n,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin",data:O,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:$,bins:d,showIQR:h,size:[n,r],margin:D,barPadding:b,enableHover:x,showAxes:!0,oLabel:f,rLabel:p,rFormat:m,showGrid:k},L&&{legend:L}),a&&{title:a}),s&&{className:s}),{tooltipContent:A?ko(A):W}),S&&{customHoverBehavior:T}),E);return v.createElement(Ee,Object.assign({},F))}function pn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",bins:d=20,amplitude:h=1.5,categoryLabel:f,valueLabel:p,valueFormat:m,colorBy:y,colorScheme:g="category10",categoryPadding:b=5,enableHover:x=!0,showGrid:k=!1,showLegend:w,tooltip:A,frameProps:E={},selection:M,linkedHover:S}=t,O=o||[],P=Co(S,y?["string"==typeof y?y:""]:["string"==typeof l?l:""]),j=Ro({name:(null==M?void 0:M.name)||"__unused__"}),N=Fo({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),_=M?{isActive:j.isActive,predicate:j.predicate}:null,C=So(O,y,g),z=e.useMemo(()=>e=>{const t=y?at(e,y,C):Eo;return{fill:t,stroke:t,fillOpacity:.5}},[y,C]),$=e.useMemo(()=>$o(z,_,M),[z,_,M]),B=void 0!==w?w:!!y,L=e.useMemo(()=>{if(B&&y)return yo({data:O,colorBy:y,colorScale:C,getColor:at})},[B,y,O,C]),D=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:"horizontal"===u?120:70,right:40},i);return L&&120>e.right&&(e.right=120),e},[i,L,u]),T=e.useCallback(e=>{S&&N.onHover(e)},[S,N]),W=e.useMemo(()=>e=>v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},((e.data||e).category||e.category||"")+"")),[]),R=jo({componentName:"RidgelinePlot",data:O,accessors:{categoryAccessor:l,valueAccessor:c}});if(R)return v.createElement(Po,{componentName:"RidgelinePlot",message:R,width:n,height:r});const F=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline",data:O,oAccessor:l,rAccessor:c,projection:"horizontal"===u?"horizontal":"vertical",summaryStyle:$,bins:d,size:[n,r],margin:D,barPadding:b,enableHover:x,showAxes:!0,oLabel:f,rLabel:p,rFormat:m,showGrid:k,oSort:!1},L&&{legend:L}),a&&{title:a}),s&&{className:s}),{tooltipContent:A?ko(A):W}),S&&{customHoverBehavior:T}),E);return F.amplitude=h,v.createElement(Ee,Object.assign({},F))}function mn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",orientation:u="horizontal",categoryLabel:d,valueLabel:h,valueFormat:f,colorBy:p,colorScheme:m="category10",sort:y=!0,dotRadius:g=5,categoryPadding:b=10,enableHover:x=!0,showGrid:k=!0,showLegend:w,tooltip:A,frameProps:E={},selection:M,linkedHover:S}=t,O=o||[],P=Co(S,p?["string"==typeof p?p:""]:["string"==typeof l?l:""]),j=Ro({name:(null==M?void 0:M.name)||"__unused__"}),N=Fo({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),_=M?{isActive:j.isActive,predicate:j.predicate}:null,C=Oo(O,y,c),z=So(O,p,m),$=e.useMemo(()=>e=>{const t={r:g,fillOpacity:.8};return t.fill=p?at(e,p,z):Eo,t},[p,z,g]),B=e.useMemo(()=>$o($,_,M),[$,_,M]),L=void 0!==w?w:!!p,D=e.useMemo(()=>{if(L&&p)return yo({data:C,colorBy:p,colorScale:z,getColor:at})},[L,p,C,z]),T=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:120,right:40},i);return D&&120>e.right&&(e.right=120),e},[i,D]),W=e.useCallback(e=>{S&&N.onHover(e)},[S,N]),R=e.useMemo(()=>e=>{const t=e.data||e,o="function"==typeof l?l(t):t[l],n="function"==typeof c?c(t):t[c];return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},o+""),v.createElement("div",{style:{marginTop:"4px"}},"number"==typeof n?n.toLocaleString():n+""))},[l,c]),F=jo({componentName:"DotPlot",data:O,accessors:{categoryAccessor:l,valueAccessor:c}});if(F)return v.createElement(Po,{componentName:"DotPlot",message:F,width:n,height:r});const H=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:B,size:[n,r],margin:T,barPadding:b,enableHover:x,showAxes:!0,oLabel:d,rLabel:h,rFormat:f,showGrid:k,oSort:y},D&&{legend:D}),a&&{title:a}),s&&{className:s}),{tooltipContent:A?ko(A):R}),S&&{customHoverBehavior:W}),E);return v.createElement(Ee,Object.assign({},H))}function yn(t){const{data:o,width:n=400,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",colorBy:u,colorScheme:d="category10",startAngle:h=0,enableHover:f=!0,showLegend:p=!0,tooltip:m,frameProps:y={},selection:g,linkedHover:b}=t,x=o||[],k=u||l,w=Co(b,k?["string"==typeof k?k:""]:[]),A=Ro({name:(null==g?void 0:g.name)||"__unused__"}),E=Fo({name:(null==w?void 0:w.name)||"hover",fields:(null==w?void 0:w.fields)||[]}),M=g?{isActive:A.isActive,predicate:A.predicate}:null,S=So(x,k,d),O=e.useMemo(()=>e=>k?{fill:at(e,k,S)}:{fill:Eo},[k,S]),P=e.useMemo(()=>$o(O,M,g),[O,M,g]),j=e.useMemo(()=>{if(p)return yo({data:x,colorBy:k,colorScale:S,getColor:at})},[p,x,k,S]),N=e.useMemo(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},i);return j&&120>e.right&&(e.right=120),e},[i,j]),_=e.useCallback(e=>{b&&E.onHover(e)},[b,E]),C=e.useMemo(()=>{const e=u&&u!==l;return t=>{var o;const n=(null===(o=t.data)||void 0===o?void 0:o[0])||t.data||t,r="function"==typeof l?l(n):n[l],i="function"==typeof c?c(n):n[c],s=e?"function"==typeof u?u(n):n[u]:null;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},r+""),v.createElement("div",{style:{marginTop:"4px"}},"number"==typeof i?i.toLocaleString():i+""),null!=s&&v.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof u?u:"group",": ",s+""))}},[l,c,u]),z=jo({componentName:"PieChart",data:x,accessors:{categoryAccessor:l,valueAccessor:c}});if(z)return v.createElement(Po,{componentName:"PieChart",message:z,width:n,height:r});const $=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie",data:x,oAccessor:l,rAccessor:c,projection:"radial",pieceStyle:P,startAngle:h,size:[n,r],margin:N,enableHover:f,showAxes:!1},j&&{legend:j}),a&&{title:a}),s&&{className:s}),{tooltipContent:m?ko(m):C}),b&&{customHoverBehavior:_}),y);return v.createElement(Ee,Object.assign({},$))}function gn(t){const{data:o,width:n=400,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",valueAccessor:c="value",innerRadius:u=60,centerContent:d,colorBy:h,colorScheme:f="category10",startAngle:p=0,enableHover:m=!0,showLegend:y=!0,tooltip:g,frameProps:b={},selection:x,linkedHover:k}=t,w=o||[],A=h||l,E=Co(k,A?["string"==typeof A?A:""]:[]),M=Ro({name:(null==x?void 0:x.name)||"__unused__"}),S=Fo({name:(null==E?void 0:E.name)||"hover",fields:(null==E?void 0:E.fields)||[]}),O=x?{isActive:M.isActive,predicate:M.predicate}:null,P=So(w,A,f),j=e.useMemo(()=>e=>A?{fill:at(e,A,P)}:{fill:Eo},[A,P]),N=e.useMemo(()=>$o(j,O,x),[j,O,x]),_=e.useMemo(()=>{if(y)return yo({data:w,colorBy:A,colorScale:P,getColor:at})},[y,w,A,P]),C=e.useMemo(()=>{const e=Object.assign({top:20,bottom:20,left:20,right:20},i);return _&&120>e.right&&(e.right=120),e},[i,_]),z=e.useCallback(e=>{k&&S.onHover(e)},[k,S]),$=e.useMemo(()=>{const e=h&&h!==l;return t=>{var o;const n=(null===(o=t.data)||void 0===o?void 0:o[0])||t.data||t,r="function"==typeof l?l(n):n[l],i="function"==typeof c?c(n):n[c],s=e?"function"==typeof h?h(n):n[h]:null;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},r+""),v.createElement("div",{style:{marginTop:"4px"}},"number"==typeof i?i.toLocaleString():i+""),null!=s&&v.createElement("div",{style:{marginTop:"2px",opacity:.8}},"string"==typeof h?h:"group",": ",s+""))}},[l,c,h]),B=jo({componentName:"DonutChart",data:w,accessors:{categoryAccessor:l,valueAccessor:c}});if(B)return v.createElement(Po,{componentName:"DonutChart",message:B,width:n,height:r});const L=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:w,oAccessor:l,rAccessor:c,projection:"radial",pieceStyle:N,innerRadius:u,startAngle:p,centerContent:d,size:[n,r],margin:C,enableHover:m,showAxes:!1},_&&{legend:_}),a&&{title:a}),s&&{className:s}),{tooltipContent:g?ko(g):$}),k&&{customHoverBehavior:z}),b);return v.createElement(Ee,Object.assign({},L))}function vn(t){const{data:o,width:n=600,height:r=400,margin:i,className:s,title:a,categoryAccessor:l="category",groupBy:c,valueAccessor:u="value",orientation:d="vertical",categoryLabel:h,valueLabel:f,valueFormat:p,colorBy:m,colorScheme:y="category10",barPadding:g=5,enableHover:b=!0,showGrid:x=!1,showLegend:k=!0,tooltip:w,frameProps:A={},selection:E,linkedHover:M}=t,S=o||[],O=m||c,P=Co(M,O?["string"==typeof O?O:""]:[]),j=Ro({name:(null==E?void 0:E.name)||"__unused__"}),N=Fo({name:(null==P?void 0:P.name)||"hover",fields:(null==P?void 0:P.fields)||[]}),_=E?{isActive:j.isActive,predicate:j.predicate}:null,C=So(S,O,y),z=e.useMemo(()=>e=>O?{fill:at(e,O,C)}:{fill:Eo},[O,C]),$=e.useMemo(()=>$o(z,_,E),[z,_,E]),B=e.useMemo(()=>{if(k)return yo({data:S,colorBy:O,colorScale:C,getColor:at})},[k,S,O,C]),L=e.useMemo(()=>{const e=Object.assign({top:50,bottom:60,left:70,right:40},i);return B&&120>e.right&&(e.right=120),e},[i,B]),D=e.useCallback(e=>{M&&N.onHover(e)},[M,N]),T=e.useMemo(()=>{const e=Mo(c),t=Mo(l),o=Mo(u);return n=>{const r=n.data||n;return v.createElement("div",{className:"semiotic-tooltip",style:go},v.createElement("div",{style:{fontWeight:"bold"}},e(r)+""),v.createElement("div",{style:{marginTop:"4px"}},t(r)+""," · ",Number(o(r)).toLocaleString()))}},[c,l,u]),W=jo({componentName:"GroupedBarChart",data:S,accessors:{categoryAccessor:l,valueAccessor:u},requiredProps:{groupBy:c}});if(W)return v.createElement(Po,{componentName:"GroupedBarChart",message:W,width:n,height:r});const R=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar",data:S,oAccessor:l,rAccessor:u,groupBy:c,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:$,size:[n,r],margin:L,barPadding:g,enableHover:b,showAxes:!0,oLabel:h,rLabel:f,rFormat:p,showGrid:x},B&&{legend:B}),a&&{title:a}),s&&{className:s}),{tooltipContent:w?ko(w):T}),M&&{customHoverBehavior:D}),A);return v.createElement(Ee,Object.assign({},R))}function bn(t){const{nodes:o,edges:n,width:r=600,height:i=600,margin:s,className:a,title:l,nodeIDAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:f,colorScheme:p="category10",nodeSize:m=8,nodeSizeRange:y=[5,20],edgeWidth:g=1,edgeColor:b="#999",edgeOpacity:x=.6,iterations:k=300,forceStrength:w=.1,showLabels:A=!1,enableHover:E=!0,showLegend:M,tooltip:S,frameProps:O={}}=t,P=o||[],j=n||[],N=So(P,f,p),_=e.useMemo(()=>e=>{const t={};return t.fill=f?at(e.data||e,f,N):Eo,"number"==typeof m&&(t.r=m),t},[f,N,m]),C=e.useMemo(()=>e=>({stroke:b,strokeWidth:"number"==typeof g?g:"function"==typeof g?g(e):e[g]||1,opacity:x}),[g,b,x]),z=e.useMemo(()=>{if(A&&h)return"function"==typeof h?h:e=>e[h]},[A,h]),$=void 0!==M?M:!!f,B=e.useMemo(()=>{if($&&f)return yo({data:P,colorBy:f,colorScale:N,getColor:at})},[$,f,P,N]),L=e.useMemo(()=>{const e=Object.assign(Object.assign({},{top:20,bottom:20,left:20,right:20}),s);return B&&120>e.right&&(e.right=120),e},[s,B]),D=_o({componentName:"ForceDirectedGraph",nodes:o,edges:n,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:c}});return D?v.createElement(Po,{componentName:"ForceDirectedGraph",message:D,width:r,height:i}):v.createElement(yt,Object.assign({chartType:"force",nodes:P,edges:j,size:[r,i],margin:L,nodeIDAccessor:c,sourceAccessor:u,targetAccessor:d,iterations:k,forceStrength:w,nodeStyle:_,edgeStyle:C,colorBy:f,colorScheme:p,nodeSize:m,nodeSizeRange:y,nodeLabel:z,showLabels:A,enableHover:E,tooltipContent:S?e=>ko(S)(e.data):void 0,legend:B,className:a,title:l},O))}function xn(t){const{nodes:o,edges:n,width:r=600,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:a,title:l,sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",nodeIdAccessor:h="id",colorBy:f,colorScheme:p="category10",edgeColorBy:m="source",padAngle:y=.01,groupWidth:g=20,sortGroups:b,nodeLabel:x,showLabels:k=!0,enableHover:w=!0,edgeOpacity:A=.5,tooltip:E,frameProps:M={}}=t,S=n||[],O=e.useMemo(()=>{if(o&&o.length>0)return o;const e=new Set;return S.forEach(t=>{const o="function"==typeof c?c(t):t[c],n="function"==typeof u?u(t):t[u];e.add(o),e.add(n)}),Array.from(e).map(e=>({id:e}))},[o,S,c,u]),P=So(O,f,p),j=e.useMemo(()=>(e,t)=>{var o,n;const r={stroke:"black",strokeWidth:1};if(f)r.fill=at(e.data||e,f,P);else{const i=Array.isArray(p)?p:it[p]||st,s=Array.isArray(i)?i:st,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;r.fill=s[a%s.length]}return r},[f,P,p]),N=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:.5,fillOpacity:A,strokeOpacity:A};if("function"==typeof m)t.fill=m(e);else if("source"===m){const o="object"==typeof e.source?e.source:null;f&&o?t.fill=at(o.data||o,f,P):o&&(t.fill=j(o,o.index).fill)}else if("target"===m){const o="object"==typeof e.target?e.target:null;f&&o?t.fill=at(o.data||o,f,P):o&&(t.fill=j(o,o.index).fill)}return t},[m,f,P,j,A]),_=e.useMemo(()=>{if(!k)return;const e=x||h;return"function"==typeof e?e:t=>t[e]},[k,x,h]),C=_o({componentName:"ChordDiagram",edges:n,edgesRequired:!0});return C?v.createElement(Po,{componentName:"ChordDiagram",message:C,width:r,height:i}):v.createElement(yt,Object.assign({chartType:"chord",nodes:O,edges:S,size:[r,i],margin:s,nodeIDAccessor:h,sourceAccessor:c,targetAccessor:u,valueAccessor:d,padAngle:y,groupWidth:g,sortGroups:b,nodeStyle:j,edgeStyle:N,colorBy:f,colorScheme:p,edgeColorBy:m,edgeOpacity:A,nodeLabel:_,showLabels:k,enableHover:w,tooltipContent:E?e=>ko(E)(e.data):void 0,className:a,title:l},M))}function kn(t){const{nodes:o,edges:n,width:r=800,height:i=600,margin:s={top:50,bottom:50,left:50,right:50},className:a,title:l,sourceAccessor:c="source",targetAccessor:u="target",valueAccessor:d="value",nodeIdAccessor:h="id",colorBy:f,colorScheme:p="category10",edgeColorBy:m="source",orientation:y="horizontal",nodeAlign:g="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,showLabels:w=!0,enableHover:A=!0,edgeOpacity:E=.5,edgeSort:M,tooltip:S,frameProps:O={}}=t,P=n||[],j=e.useMemo(()=>{if(o&&o.length>0)return o;const e=new Set;return P.forEach(t=>{const o="function"==typeof c?c(t):t[c],n="function"==typeof u?u(t):t[u];e.add(o),e.add(n)}),Array.from(e).map(e=>({id:e}))},[o,P,c,u]),N=So(j,f,p),_=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?at(e.data||e,f,N):"#4d430c",t},[f,N]),C=e.useMemo(()=>e=>{const t={stroke:"none",strokeWidth:0,fillOpacity:E};if("function"==typeof m)t.fill=m(e);else if("source"===m){const o="object"==typeof e.source?e.source:null;f&&o?t.fill=at(o.data||o,f,N):o&&(t.fill=_(o).fill)}else if("target"===m){const o="object"==typeof e.target?e.target:null;f&&o?t.fill=at(o.data||o,f,N):o&&(t.fill=_(o).fill)}else"gradient"===m&&(t.fill="#999",t.fillOpacity=.7*E);return t},[m,f,N,_,E]),z=e.useMemo(()=>{if(!w)return;const e=k||h;return"function"==typeof e?e:t=>t[e]},[w,k,h]),$=e.useMemo(()=>{if("function"==typeof S)return S},[S]),B=_o({componentName:"SankeyDiagram",edges:n,edgesRequired:!0});return B?v.createElement(Po,{componentName:"SankeyDiagram",message:B,width:r,height:i}):v.createElement(yt,Object.assign({chartType:"sankey",nodes:j,edges:P,size:[r,i],margin:s,nodeIDAccessor:h,sourceAccessor:c,targetAccessor:u,valueAccessor:d,orientation:y,nodeAlign:g,nodePaddingRatio:b,nodeWidth:x,nodeStyle:_,edgeStyle:C,colorBy:f,colorScheme:p,edgeColorBy:m,edgeOpacity:E,edgeSort:M,nodeLabel:z,showLabels:w,enableHover:A,tooltipContent:$?e=>$(e.data):void 0,className:a,title:l},O))}function wn(t){const{data:o,width:n=600,height:r=600,margin:i={top:50,bottom:50,left:50,right:50},className:s,title:a,layout:l="tree",orientation:c="vertical",childrenAccessor:u="children",valueAccessor:d="value",nodeIdAccessor:h="name",colorBy:f,colorScheme:p="category10",colorByDepth:m=!1,edgeStyle:y="curve",nodeLabel:g,showLabels:b=!0,nodeSize:x=5,enableHover:k=!0,tooltip:w,frameProps:A={}}=t,E=e.useMemo(()=>{if(!o)return[];const e=[],t=o=>{e.push(o);const n="function"==typeof u?u(o):o[u];n&&Array.isArray(n)&&n.forEach(t)};return t(o),e},[o,u]),M=e.useMemo(()=>m?lt(E.map((e,t)=>({depth:t%5})),"depth",p):f&&"function"!=typeof f?lt(E,f,p):void 0,[E,f,m,p]),S=e.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=m?at({depth:e.depth||0},"depth",M):f?at(e.data||e,f,M):Eo,t},[f,m,M]),O=e.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),P=e.useMemo(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return"function"==typeof d?d:e=>e[d]||1},[l,d]),j=No({componentName:"TreeDiagram",data:o});return j?v.createElement(Po,{componentName:"TreeDiagram",message:j,width:n,height:r}):v.createElement(yt,Object.assign({chartType:l,data:o,size:[n,r],margin:i,nodeIDAccessor:h,childrenAccessor:u,hierarchySum:P,treeOrientation:c,edgeType:y,nodeStyle:S,edgeStyle:O,colorBy:f,colorScheme:p,colorByDepth:m,nodeSize:x,nodeLabel:b?g||h:void 0,showLabels:b,enableHover:k,tooltipContent:w?e=>ko(w)(e.data):void 0,className:s,title:a},A))}function An(t){const{data:o,width:n=600,height:r=600,margin:i={top:10,bottom:10,left:10,right:10},className:s,title:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:f=!1,showLabels:p=!0,labelMode:m="leaf",nodeLabel:y,padding:g=4,paddingTop:b,enableHover:x=!0,tooltip:k,frameProps:w={}}=t,A=e.useMemo(()=>{if(!o)return[];const e=[],t=o=>{e.push(o);const n="function"==typeof l?l(o):o[l];n&&Array.isArray(n)&&n.forEach(t)};return t(o),e},[o,l]),E=e.useMemo(()=>{if(!f&&d&&"function"!=typeof d)return lt(A,d,h)},[A,d,f,h]),M=e.useMemo(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const o={stroke:"#fff",strokeWidth:1,strokeOpacity:.8};return o.fill=f?e[(t.depth||0)%e.length]:d?at(t.data||t,d,E):Eo,o}},[d,f,E]),S=e.useMemo(()=>"function"==typeof c?c:e=>e[c]||1,[c]),O=void 0!==b?b:p&&"parent"===m?18:void 0,P=No({componentName:"Treemap",data:o});return P?v.createElement(Po,{componentName:"Treemap",message:P,width:n,height:r}):v.createElement(yt,Object.assign({chartType:"treemap",data:o,size:[n,r],margin:i,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:S,padding:g,paddingTop:O,nodeStyle:M,colorBy:d,colorScheme:h,colorByDepth:f,nodeLabel:p?y||u:void 0,showLabels:p,enableHover:x,tooltipContent:k?e=>ko(k)(e.data):void 0,className:s,title:a},w))}function En(t){const{data:o,width:n=600,height:r=600,margin:i={top:10,bottom:10,left:10,right:10},className:s,title:a,childrenAccessor:l="children",valueAccessor:c="value",nodeIdAccessor:u="name",colorBy:d,colorScheme:h="category10",colorByDepth:f=!1,showLabels:p=!0,nodeLabel:m,circleOpacity:y=.7,padding:g=4,enableHover:b=!0,tooltip:x,frameProps:k={}}=t,w=e.useMemo(()=>{if(!o)return[];const e=[],t=o=>{e.push(o);const n="function"==typeof l?l(o):o[l];n&&Array.isArray(n)&&n.forEach(t)};return t(o),e},[o,l]),A=e.useMemo(()=>{if(!f&&d&&"function"!=typeof d)return lt(w,d,h)},[w,d,f,h]),E=e.useMemo(()=>{const e=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"];return t=>{const o={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:y};return o.fill=f?e[(t.depth||0)%e.length]:d?at(t.data||t,d,A):Eo,o}},[d,f,A,y]),M=e.useMemo(()=>"function"==typeof c?c:e=>e[c]||1,[c]),S=No({componentName:"CirclePack",data:o});return S?v.createElement(Po,{componentName:"CirclePack",message:S,width:n,height:r}):v.createElement(yt,Object.assign({chartType:"circlepack",data:o,size:[n,r],margin:i,nodeIDAccessor:u,childrenAccessor:l,hierarchySum:M,padding:g,nodeStyle:E,colorBy:d,colorScheme:h,colorByDepth:f,nodeLabel:p?m||u:void 0,showLabels:p,enableHover:b,tooltipContent:x?e=>ko(x)(e.data):void 0,className:s,title:a},k))}rn.displayName="ScatterplotMatrix",an.displayName="MinimapChart",ln.displayName="BarChart",cn.displayName="StackedBarChart",un.displayName="SwarmPlot",dn.displayName="BoxPlot",hn.displayName="Histogram",fn.displayName="ViolinPlot",pn.displayName="RidgelinePlot",mn.displayName="DotPlot",yn.displayName="PieChart",gn.displayName="DonutChart",vn.displayName="GroupedBarChart",bn.displayName="ForceDirectedGraph",xn.displayName="ChordDiagram",kn.displayName="SankeyDiagram",wn.displayName="TreeDiagram",An.displayName="Treemap",En.displayName="CirclePack";const Mn=e.forwardRef(function(t,o){const{size:n,width:r,height:i,margin:s,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:f,timeExtent:p,valueExtent:m,extentPadding:y,stroke:g="#007bff",strokeWidth:b=2,strokeDasharray:x,showAxes:k=!0,background:w,enableHover:A,tooltipContent:E,tooltip:M,onHover:S,annotations:O,svgAnnotationRules:P,tickFormatTime:j,tickFormatValue:N,decay:_,pulse:C,staleness:z,transition:$,linkedHover:B}=t,L=null!=r&&null!=i?[r,i]:n||[500,300],D=null!=E?E:M,T=e.useRef(null),W=Co(B),R=Fo({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]}),F=e.useCallback(e=>{S&&S(e),B&&R.onHover(e?e.data||e:null)},[S,B,R]);return e.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),v.createElement(ie,{ref:T,chartType:"line",runtimeMode:"streaming",size:L,margin:s,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:f,xExtent:p,yExtent:m,extentPadding:y,lineStyle:{stroke:g,strokeWidth:b,strokeDasharray:x},showAxes:k,background:w,hoverAnnotation:A,tooltipContent:D,customHoverBehavior:F,annotations:O,svgAnnotationRules:P,tickFormatTime:j,tickFormatValue:N,decay:_,pulse:C,staleness:z,transition:$})});Mn.displayName="RealtimeLineChart";const Sn=e.forwardRef(function(t,o){const{binSize:n,size:r,width:i,height:s,margin:a,className:l,arrowOfTime:c="right",windowMode:u="sliding",windowSize:d=200,data:h,timeAccessor:f,valueAccessor:p,timeExtent:m,valueExtent:y,extentPadding:g,categoryAccessor:b,colors:x,fill:k,stroke:w,strokeWidth:A,gap:E,showAxes:M=!0,background:S,enableHover:O,tooltipContent:P,tooltip:j,onHover:N,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:B}=t,L=null!=i&&null!=s?[i,s]:r||[500,300],D=null!=P?P:j,T=e.useRef(null),W=Co(B),R=Fo({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]}),F=e.useCallback(e=>{N&&N(e),B&&R.onHover(e?e.data||e:null)},[N,B,R]);e.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=k&&(H.fill=k),null!=w&&(H.stroke=w),null!=A&&(H.strokeWidth=A),null!=E&&(H.gap=E),v.createElement(ie,{ref:T,chartType:"bar",runtimeMode:"streaming",size:L,margin:a,className:l,arrowOfTime:c,windowMode:u,windowSize:d,data:h,timeAccessor:f,valueAccessor:p,xExtent:m,yExtent:y,extentPadding:g,binSize:n,categoryAccessor:b,barColors:x,barStyle:H,showAxes:M,background:S,hoverAnnotation:O,tooltipContent:D,customHoverBehavior:F,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$})});Sn.displayName="RealtimeTemporalHistogram";const On=Sn,Pn=e.forwardRef(function(t,o){const{size:n,width:r,height:i,margin:s,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:f,timeExtent:p,valueExtent:m,extentPadding:y,categoryAccessor:g,colors:b,radius:x,fill:k,opacity:w,stroke:A,strokeWidth:E,showAxes:M=!0,background:S,enableHover:O,tooltipContent:P,tooltip:j,onHover:N,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:B}=t,L=null!=r&&null!=i?[r,i]:n||[500,300],D=null!=P?P:j,T=e.useRef(null),W=Co(B),R=Fo({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]}),F=e.useCallback(e=>{N&&N(e),B&&R.onHover(e?e.data||e:null)},[N,B,R]);e.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=x&&(H.radius=x),null!=k&&(H.fill=k),null!=w&&(H.opacity=w),null!=A&&(H.stroke=A),null!=E&&(H.strokeWidth=E),v.createElement(ie,{ref:T,chartType:"swarm",runtimeMode:"streaming",size:L,margin:s,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:f,xExtent:p,yExtent:m,extentPadding:y,categoryAccessor:g,barColors:b,swarmStyle:H,showAxes:M,background:S,hoverAnnotation:O,tooltipContent:D,customHoverBehavior:F,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$})});Pn.displayName="RealtimeSwarmChart";const jn=e.forwardRef(function(t,o){const{size:n,width:r,height:i,margin:s,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:f,timeExtent:p,valueExtent:m,extentPadding:y,positiveColor:g,negativeColor:b,connectorStroke:x,connectorWidth:k,gap:w,stroke:A,strokeWidth:E,showAxes:M=!0,background:S,enableHover:O,tooltipContent:P,tooltip:j,onHover:N,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$,linkedHover:B}=t,L=null!=r&&null!=i?[r,i]:n||[500,300],D=null!=P?P:j,T=e.useRef(null),W=Co(B),R=Fo({name:(null==W?void 0:W.name)||"hover",fields:(null==W?void 0:W.fields)||[]}),F=e.useCallback(e=>{N&&N(e),B&&R.onHover(e?e.data||e:null)},[N,B,R]);e.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=T.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=T.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=T.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}}));const H={};return null!=g&&(H.positiveColor=g),null!=b&&(H.negativeColor=b),null!=x&&(H.connectorStroke=x),null!=k&&(H.connectorWidth=k),null!=w&&(H.gap=w),null!=A&&(H.stroke=A),null!=E&&(H.strokeWidth=E),v.createElement(ie,{ref:T,chartType:"waterfall",runtimeMode:"streaming",size:L,margin:s,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:f,xExtent:p,yExtent:m,extentPadding:y,waterfallStyle:H,showAxes:M,background:S,hoverAnnotation:O,tooltipContent:D,customHoverBehavior:F,annotations:_,svgAnnotationRules:C,tickFormatTime:z,tickFormatValue:$})});jn.displayName="RealtimeWaterfallChart";const Nn=e.forwardRef(function(t,o){const{size:n,width:r,height:i,margin:s,className:a,arrowOfTime:l="right",windowMode:c="sliding",windowSize:u=200,data:d,timeAccessor:h,valueAccessor:f,categoryAccessor:p,timeExtent:m,valueExtent:y,extentPadding:g,heatmapXBins:b=20,heatmapYBins:x=20,aggregation:k="count",showAxes:w=!0,background:A,enableHover:E,tooltipContent:M,tooltip:S,onHover:O,annotations:P,svgAnnotationRules:j,tickFormatTime:N,tickFormatValue:_,decay:C,pulse:z,staleness:$}=t,B=null!=r&&null!=i?[r,i]:n||[500,300],L=null!=M?M:S,D=e.useRef(null);return e.useImperativeHandle(o,()=>({push:e=>{var t;return null===(t=D.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=D.current)||void 0===t?void 0:t.pushMany(e)},clear:()=>{var e;return null===(e=D.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=D.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]}})),v.createElement(ie,{ref:D,chartType:"heatmap",runtimeMode:"streaming",size:B,margin:s,className:a,arrowOfTime:l,windowMode:c,windowSize:u,data:d,timeAccessor:h,valueAccessor:f,categoryAccessor:p,xExtent:m,yExtent:y,extentPadding:g,heatmapXBins:b,heatmapYBins:x,heatmapAggregation:k,showAxes:w,background:A,hoverAnnotation:E,tooltipContent:L,customHoverBehavior:O,annotations:P,svgAnnotationRules:j,tickFormatTime:N,tickFormatValue:_,decay:C,pulse:z,staleness:$})});Nn.displayName="RealtimeHeatmap";const _n={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}},Cn={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}},[zn,$n]=wt(e=>({theme:_n,setTheme(t){e(e=>"light"===t?{theme:_n}:"dark"===t?{theme:Cn}:{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 Bn({theme:e}){const t=$n(e=>e.setTheme);return v.useEffect(()=>{void 0!==e&&t(e)},[e,t]),null}function Ln({children:e}){const t=$n(e=>e.theme);return v.createElement("div",{style:{position:"relative","--semiotic-bg":t.colors.background,"--semiotic-text":t.colors.text,"--semiotic-text-secondary":t.colors.textSecondary,"--semiotic-grid":t.colors.grid,"--semiotic-border":t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily}},e)}function Dn(e,t){var o;const n=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 n=i.getPropertyValue(e);n&&"none"!==n&&""!==n&&(null===(o=t.style)||void 0===o||o.setProperty(e,n))}for(let e=0;Math.min(n.length,r.length)>e;e++)Dn(n[e],r[e])}function Tn(e,t){const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(o)}exports.Annotation=kt,exports.AnnotationLayer=function(t){const{legendSettings:o,margin:n,size:r,annotations:i,annotationHandling:s}=t,a=Mt(e=>e.tooltip);let l=null!=a?i.concat(a):i,c=Mt(e=>e.changeTooltip);const u=Object.assign(Object.assign({},t),{annotations:l,voronoiHover:e=>{c(e)}}),d="object"==typeof s?s:{layout:{type:s},dataVersion:""},{dataVersion:h=""}=d,[f,p]=e.useState([]),[m,y]=e.useState([]),[g,b]=e.useState([]),[x,k]=e.useState(""),[w,A]=e.useState(h),E=_t(u,l),M=E.filter(e=>e.props&&e.props.noteData&&!e.props.noteData.fixedPosition),S=Ot(M,d,r);let O;if(e.useEffect(()=>{const e=E.filter(e=>!e.props||!e.props.noteData||e.props.noteData.fixedPosition),t=Ct(u,{adjustedAnnotations:f,adjustedAnnotationsKey:x,adjustedAnnotationsDataVersion:w,adjustableAnnotations:M,fixedAnnotations:e});p(t.adjustedAnnotations),k(t.adjustedAnnotationsKey),A(t.adjustedAnnotationsDataVersion),y(t.svgAnnotations),b(t.htmlAnnotations)},[S,h,l.length,l.map(e=>function(e){const t=new Set;return JSON.stringify(e,(e,o)=>t.has(o)?"...":"object"==typeof o?(t.add(o),"note"===e?`${o.label}-${o.title}`:"connector"===e?`${o.end}-${o.type}`:"subject"===e?""+o.radius:"object"==typeof o.column?`${o.column.x}-${o.column.y}-${o.column.name}`:o.voronoiX||o.voronoiY||o.x||o.y||o.dx||o.dy||o.label||o.type||o.key||o.hierarchicalID||o.id||o.name?`${o.voronoiX}-${o.voronoiY}-${o.dx}-${o.dy}-${o.x}-${o.y}-${o.label}-${o.type}-${o.key}-${o.hierarchicalID}-${o.id}-${o.name}`:"..."):o)}(e)).join("-")]),o){const e={left:[15,15],right:[r[0]+15,15]},{position:t="right",title:n="Legend"}=o;O=v.createElement("g",{transform:`translate(${e[t].join(",")})`},v.createElement(I,Object.assign({},o,{title:n,position:t})))}return 0!==l.length||o?v.createElement("div",{className:"annotation-layer",style:{position:"absolute",pointerEvents:"none",background:"none"}},v.createElement("svg",{className:"annotation-layer-svg",height:r[1],width:r[0],style:{background:"none",pointerEvents:"none",position:"absolute",left:n.left+"px",top:n.top+"px",overflow:"visible"}},v.createElement("g",null,O,m)),v.createElement("div",{className:"annotation-layer-html",style:{background:"none",pointerEvents:"none",position:"absolute",height:r[1]+"px",width:r[0]+"px",left:n.left+"px",top:n.top+"px"}},g)):null},exports.AreaChart=Xo,exports.Axis=function(t){const{rotate:o,label:n,dynamicLabelPosition:r,orient:i="left",marginalSummaryType:s,tickFormat:a=(s?()=>"":qt),size:l,width:c=l&&l[0]||0,height:u=l&&l[1]||0,className:d,padding:h,tickValues:f,scale:p,ticks:m,footer:y,tickSize:g,tickLineGenerator:b,baseline:x=!0,margin:k={top:0,bottom:0,left:0,right:0},center:w=!1,annotationFunction:A,glyphFunction:E,xyPoints:M}=t,[S,O]=e.useState(0),[P,j]=e.useState(void 0),N=e.useRef(null);e.useEffect(()=>{if(!(null==n?void 0:n.position)&&r){const e=((e,t)=>{const o=e.current;if(!o)return 30;const n="left"===t||"right"===t?"width":"height";return Math.max(...[...o.querySelectorAll(".axis-label")].map(e=>e.getBBox&&e.getBBox()||{height:30,width:30}).map(e=>e[n]))+25})(N,i);e!==P&&j(e)}},[n,r]);let _,{axisParts:C,position:z=[0,0]}=t;if(C||(C=function({renderMode:e=()=>{},padding:t=5,scale:o,ticks:n,tickValues:r=Ht(void 0,n,o),orient:i="left",size:s,footer:a=!1,tickSize:l=(a?-10:["top","bottom"].find(e=>e===i)?s?s[1]:0:s?s[0]:0),jaggedBase:c}){let u,d,h,f,p,m,y=[],g=0,v=0,b="middle";switch(i){case"top":u="x1",d="x2",h="y1",f="y2",y=[0,l],p="tx",m="ty",g-=20-t;break;case"bottom":u="x1",d="x2",h="y2",f="y1",y=s?[s[1],s[1]-l]:[0,-l],p="tx",m="ty",g+=20+t;break;case"right":u="y2",d="y1",h="x2",f="x1",y=s?[s[0],s[0]-l]:[0,-l],p="ty",m="tx",g+=5+t,v+=5,b="start";break;default:u="y1",d="y2",h="x1",f="x2",y=[0,l],p="ty",m="tx",g-=5+t,v+=5,b="end"}let x=r instanceof Function?r({orient:i}):r;return c&&void 0===x.find(e=>e===o.domain()[0])&&(x=[o.domain()[0],...x]),x.map((t,n)=>{const r=o(t);return{[u]:r,[d]:r,[h]:y[0],[f]:y[1],[p]:r+v,[m]:y[0]+g,defaultAnchor:b,renderMode:e(t,n),value:t}})}({padding:h,tickValues:f,scale:p,ticks:m,orient:i,size:[c,u],footer:y,tickSize:g}),_=v.createElement("g",{className:"axis "+d},(({axisParts:e,orient:t,tickLineGenerator:o=Ft,className:n,jaggedBase:r,scale:i,showOutboundTickLines:s=!1})=>{const a=e.map((e,s)=>o({xy:e,orient:t,i:s,className:n,jaggedBase:r,scale:i})),l=s?e.map((e,o)=>(({xy:e,orient:t,i:o,className:n=""})=>{let r=`M-4,${e.y1}L${e.x1},${e.y2}`;return"left"===t?r=`M${e.x1-8},${e.y1}L${e.x1},${e.y2}`:"right"===t?r=`M${e.x2},${e.y1}L${e.x2+8},${e.y2}`:"top"===t?r=`M${e.x1},${e.y1-8}L${e.x1},${e.y1}`:"bottom"===t&&(r=`M${e.x1},${e.y2}L${e.x1},${e.y2+8}`),v.createElement("path",{key:o,fill:"none",stroke:"currentColor",strokeWidth:"1px",d:r,className:`outbound-tick-line tick ${t} ${n}`})})({xy:e,orient:t,i:o,className:n})):[];return[...a,l]})({axisParts:C,orient:i,tickLineGenerator:b,className:d,scale:p}))),0===C.length)return null;let $,B,L,D,T=50,W=u,R=-50,F=0,H=0,I=0,Y=0,X=u,G=25,q=-25,V=18,U=c+25,K=0,Z=S,J=0,Q="y";switch(i){case"right":z=[z[0],z[1]],R=c,Y=H=c,J=k.top,U=-c-25,q=5,$=e=>{O(e.nativeEvent.offsetY-J)},!0===w&&(Y=H=c/2);break;case"top":z=[z[0],0],T=c,W=50,F=-50,R=0,J=k.left,Q="x",Y=c,X=0,!0===w&&(X=I=u/2),$=e=>{O(e.nativeEvent.offsetX-J)},G=S,Z=25,q=0,V=-10,U=0,K=u+25;break;case"bottom":z=[z[0],0],T=c,W=50,I=X=F=u,H=R=0,Y=c,J=k.left,$=e=>{O(e.nativeEvent.offsetX-J)},G=S,Z=25,q=0,V=15,U=0,K=-u-25,Q="x",!0===w&&(X=I=u/2);break;default:z=[z[0],z[1]],J=k.top,!0===w&&(Y=H=c/2),$=e=>{O(e.nativeEvent.offsetY-J)}}if(A){const e=function(e,t){return t.tickFormat?t.tickFormat(e):e.toString?""+e:e}(p.invert(S),t),o=E?E({lineHeight:K,lineWidth:U,value:p.invert(S)}):v.createElement("g",null,v.isValidElement(e)?v.createElement("g",{transform:`translate(${q},${V})`},e):v.createElement("text",{x:q,y:V},e),v.createElement("circle",{r:5}),v.createElement("line",{x1:U,y1:K,style:{stroke:"black"}})),n=S?v.createElement("g",{style:{pointerEvents:"none"},transform:`translate(${G},${Z})`},o):null;B=v.createElement("g",{className:"annotation-brush",transform:`translate(${R},${F})`},v.createElement("rect",{style:{fillOpacity:0},height:W,width:T,onMouseMove:$,onClick:e=>A({className:"dynamic-axis-annotation",type:Q,value:p.invert(S),e:e}),onMouseOut:()=>{O(void 0)}}),n)}if(s&&M){const e=Math.max(k[i]-6,5),t="string"==typeof s?{type:s}:s;void 0!==t.flip||"bottom"!==i&&"right"!==i||(t.flip=!0);const o=t.summaryStyle?()=>t.summaryStyle:()=>({fill:"black",fillOpacity:.5,stroke:"black",strokeDasharray:"0"}),n=t.renderMode?()=>t.renderMode:()=>{},r=t.summaryClass?()=>t.summaryClass:()=>"",a=t.filter||(()=>!0),c=M.filter(e=>void 0!==e.x&&void 0!==e.y&&a(e.data)).map(e=>Object.assign(Object.assign({},e),{xy:{x:"top"===i||"bottom"===i?p(e.x):0,y:"left"===i||"right"===i?p(e.y):0},piece:{scaledVerticalValue:p(e.y),scaledValue:p(e.x)},value:p("top"===i||"bottom"===i?e.y:e.x),scaledValue:p(e.x),scaledVerticalValue:p(e.y)})),u=function(e){const t=[];for(const o of e){const e=[],{elements:n,containerProps:r}=o;if(o.Mark)t.push(o.Mark);else{for(let t=0;n.length>t;t++){const o=n[t],{markType:r,style:i={}}=o,s=zt(o,["markType","style"]),a=Object.assign({},s);void 0!==i.fill&&(a.fill=i.fill),void 0!==i.stroke&&(a.stroke=i.stroke),void 0!==i.strokeWidth&&(a.strokeWidth=i.strokeWidth),void 0!==i.opacity&&(a.opacity=i.opacity),void 0!==i.fillOpacity&&(a.fillOpacity=i.fillOpacity),void 0!==i.strokeOpacity&&(a.strokeOpacity=i.strokeOpacity);const l=Object.assign({},i);delete l.fill,delete l.stroke,delete l.strokeWidth,delete l.opacity,delete l.fillOpacity,delete l.strokeOpacity,Object.keys(l).length>0&&(a.style=l),a.key=o.key||t,r&&e.push(v.createElement(r,a))}r?t.push(v.createElement("g",Object.assign({},r),e)):t.push(...e)}}return t}((({data:e,type:t,renderMode:o,eventListenersGenerator:n,styleFn:r,classFn:i,projection:s,adjustedSize:a,margin:l,axisCreator:c})=>{if(t&&t.type)return function({data:e,type:t,renderMode:o,eventListenersGenerator:n,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:l,margin:c,axisCreator:u}){return"function"==typeof t.type?t.type({data:e,type:t,renderMode:o,eventListenersGenerator:n,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:l,margin:c,axisCreator:u}):(console.error(`Invalid summary type: ${t.type} - Must be a function`),{})}({data:e,type:t="string"==typeof t?{type:t}:t,renderMode:o,eventListenersGenerator:n,styleFn:r,classFn:i,projection:s,adjustedSize:a,chartSize:"vertical"===s?a[1]:a[0],margin:l,axisCreator:c})})({data:{column:{middle:e/2,pieceData:c,width:e,xyData:c}},type:t,renderMode:n,eventListenersGenerator:t.eventListenersGenerator||(()=>({})),styleFn:o,classFn:r,projection:"top"===i||"bottom"===i?"horizontal":"vertical",adjustedSize:l,margin:{top:0,bottom:0,left:0,right:0}}).marks);let d;if(!0===t.showPoints){const o=((e,t,o)=>{const n="left"===e||"right"===e?t/2:0,r="bottom"===e||"top"===e?t/2:0;return o.map(e=>[e.xy.x+n,e.xy.y+r])})(i,e,c);d=o.map((e,o)=>v.createElement("circle",{key:"axis-summary-point-"+o,cx:e[0],cy:e[1],r:t.r||3,style:t.pointStyle||{fill:"black",fillOpacity:.1}}))}L=v.createElement(Xt,{translation:{left:[2-k.left,0],right:[l[0]+2,0],top:[0,2-k.top],bottom:[0,l[1]+2]},orient:i,decoratedSummaryType:t,summaryWidth:e,renderedSummary:u,points:d})}const ee=(({axisParts:e,tickFormat:t,rotate:o=0,center:n=!1,orient:r})=>{const i=e.map((e,o)=>({axisPart:e,i:o,formatted:t(e.value,o)})),s="left"===r||"right"===r;let a=i;if(!o&&i.length>1){const e=8,t=14,o=8,n=e=>"string"==typeof e?e:"number"==typeof e?e+"":null;if("top"===r||"bottom"===r){const t=[...i].sort((e,t)=>e.axisPart.tx-t.axisPart.tx);let r=-1/0;const s=new Set;for(const i of t){const t=n(i.formatted);if(!t){s.add(i.i);continue}const a=t.length*e/2;r+o>i.axisPart.tx-a||(s.add(i.i),r=i.axisPart.tx+a)}a=i.filter(e=>s.has(e.i))}else if(s){const e=[...i].sort((e,t)=>e.axisPart.ty-t.axisPart.ty);let n=-1/0;const r=new Set;for(const i of e)n+t+o>i.axisPart.ty||(r.add(i.i),n=i.axisPart.ty);a=i.filter(e=>r.has(e.i))}}return a.map(({axisPart:e,i:t,formatted:i})=>{("object"!=typeof i||i instanceof Date)&&(i=v.createElement("text",{textAnchor:e.defaultAnchor,className:"axis-label"},i.toString?""+i:i));let s=e.tx,a=e.ty;if(n)switch(r){case"right":s-=(e.x2-e.x1)/2;break;case"left":s+=(e.x2-e.x1)/2;break;case"top":a+=(e.y2-e.y1)/2;break;case"bottom":a-=(e.y2-e.y1)/2}return v.createElement("g",{key:t,pointerEvents:"none",transform:`translate(${s},${a}) rotate(${o})`,className:"axis-label"},i)})})({tickFormat:a,axisParts:C,orient:i,rotate:o,center:w});if(n){const e=n.name||n,t=n.position||{};let o=t.anchor||"middle";const r=n.locationDistance||P,s=t.rotation||{left:-90,right:90,top:0,bottom:0}[i],a={left:{start:[0,l[1]],middle:[0,l[1]/2],end:[0,0],inside:[r||15,0],outside:[-(r||45),0]},right:{start:[l[0]+0,l[1]],middle:[l[0]+0,l[1]/2],end:[l[0]+0,0],inside:[-(r||15),0],outside:[r||45,0]},top:{start:[0,0],middle:[0+l[0]/2,0],end:[0+l[0],0],inside:[0,r||15],outside:[0,-(r||40)]},bottom:{start:[0,l[1]],middle:[0+l[0]/2,l[1]],end:[0+l[0],l[1]],inside:[0,-(r||5)],outside:[0,r||50]}},c=a[i][o],u=a[i][t.location||"outside"];c[0]=c[0]+u[0],c[1]=c[1]+u[1],"start"===o&&"right"===i?o="end":"end"===o&&"right"===i&&(o="start"),D=v.createElement(Gt,{className:d,translation:c,position:z,rotation:s,labelName:e,anchorMod:o})}const te=`${i} axis ${C&&C.length>0&&`from ${a(C[0].value,0)} to ${a(C[C.length-1].value,C.length-1)}`||"without ticks"}`;return v.createElement("g",{className:d,"aria-label":te,ref:N},B,ee,_,!0===x?v.createElement("line",{key:"baseline",className:"axis-baseline "+d,stroke:"black",strokeLinecap:"square",x1:H,x2:Y,y1:I,y2:X}):null,D,L)},exports.BarChart=ln,exports.BoxPlot=dn,exports.Brush=function(t){const{extent:n,selectedExtent:r}=t,i=e.useRef(null),s=Ut(n),a=Ut(r);e.useEffect(()=>{(null==i?void 0:i.current)&&((e,t)=>{const{svgBrush:n,selectedExtent:r}=t;if(o.select(e).call(n),r){let t=r;if(Array.isArray(r[0])){const e=[t[0][1],t[1][1]].sort((e,t)=>e-t);t=[[t[0][0],e[0]],[t[1][0],e[1]]]}o.select(e).call(n.move,t)}})(i.current,t)},[s,a,i]);const{position:l=[0,0]}=t;return v.createElement("g",{transform:`translate(${l})`,ref:i,className:"xybrush"})},exports.BubbleChart=Vo,exports.ChartErrorBoundary=class extends v.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var o,n;null===(n=(o=this.props).onError)||void 0===n||n.call(o,e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:v.createElement(Po,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},exports.ChordDiagram=xn,exports.CirclePack=En,exports.DARK_THEME=Cn,exports.DividedLine=function(e){const t=(e=>{const{parameters:t,className:o,interpolate:n=l.curveLinear,customAccessors:r,lineDataAccessor:i,data:s,searchIterations:a}=e,c=zt(e,["parameters","className","interpolate","customAccessors","lineDataAccessor","data","searchIterations"]),{x:u,y:d}=r,h=Bt({data:s,lineDataAccessor:[i],xProp:"x",yProp:"y",xAccessor:[u],yAccessor:[d]});for(const e of h)e.data=e.data.map(e=>Object.assign(Object.assign({},e.data),e));const f=((e,t,o=10)=>{let n=e(t[0],0),r=[];const i=[{key:n,points:r}];return t.forEach((t,s)=>{const a=e(t,s);let l=a===n;const c=JSON.stringify(a),u=JSON.stringify(n);if("object"==typeof n&&(l=c===u),l)r.push(t);else{let s=r[r.length-1],l=t,u=c,d=0;for(;o>d&&c===u;){const t=Rt({pointA:s,pointB:l,currentParameters:n,parameters:e,keys:Object.keys(s)});s=t[0],l=t[1],u=JSON.stringify(e(l)),d++}r.push(l),r=[l,t],i.push({key:a,points:r}),n=a}}),i})(t,h[0].data,a),p=l.line().curve(n).x(e=>e.x).y(e=>e.y);return f.map((e,t)=>v.createElement("path",Object.assign({},c,{className:o,key:"DividedLine-"+t,style:e.key,d:p(e.points)})))})(e);return v.createElement("g",null,t)},exports.DonutChart=gn,exports.DotPlot=mn,exports.ForceDirectedGraph=bn,exports.GroupedBarChart=vn,exports.Heatmap=qo,exports.Histogram=hn,exports.IncrementalExtent=E,exports.LIGHT_THEME=_n,exports.Legend=I,exports.LineChart=Yo,exports.LinkedCharts=Ko,exports.MinimapChart=an,exports.MultiLineTooltip=function(e={}){const{fields:t=[],title:o,format:n,style:r={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=vo(e,o);l.push({value:bo(t,n)})}t&&Array.isArray(t)&&t.length>0?t.forEach(t=>{let o,r,i;"string"==typeof t?(o=t,r=t,i=n):(o=t.label,r=t.accessor||t.key||"",i=t.format||n);const a=bo(vo(e,r),i);l.push({label:s?o:void 0,value:a})}):Object.keys(e).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(t=>{l.push({label:s?t:void 0,value:bo(e[t],n)})});const c=Object.assign(Object.assign({},go),r);return Array.isArray(l)&&0!==l.length?v.createElement("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c},l.map((e,t)=>v.createElement("div",{key:t,style:{marginBottom:l.length-1>t?"4px":0}},e.label&&v.createElement("strong",null,e.label,a),e.value))):null}},exports.PieChart=yn,exports.RealtimeHeatmap=Nn,exports.RealtimeHistogram=On,exports.RealtimeLineChart=Mn,exports.RealtimeSwarmChart=Pn,exports.RealtimeTemporalHistogram=Sn,exports.RealtimeWaterfallChart=jn,exports.RidgelinePlot=pn,exports.RingBuffer=A,exports.SankeyDiagram=kn,exports.Scatterplot=Io,exports.ScatterplotMatrix=rn,exports.StackedAreaChart=Go,exports.StackedBarChart=cn,exports.StreamNetworkFrame=yt,exports.StreamOrdinalFrame=Ee,exports.StreamXYFrame=ie,exports.SwarmPlot=un,exports.ThemeProvider=function({theme:e,children:t}){return v.createElement(zn,null,v.createElement(Bn,{theme:e}),v.createElement(Ln,null,t))},exports.Tooltip=xo,exports.TreeDiagram=wn,exports.Treemap=An,exports.ViolinPlot=fn,exports.calculateDataExtent=({lineDataAccessor:e,xAccessor:t,yAccessor:o,summaries:r,points:i,lines:s,lineType:a,showLinePoints:c,showSummaryPoints:u,xExtent:d,yExtent:h,invertX:f,invertY:m,summaryDataAccessor:y,summaryType:g,adjustedSize:v,margin:b,summaryStyleFn:k,summaryClassFn:w,summaryRenderModeFn:A,chartSize:E,filterRenderedLines:M,filterRenderedSummaries:S,filterRenderedPoints:O,defined:P=lo,annotations:j=[]})=>{let N=[],_=[],C=[],z=[],$=[];if(i){t.forEach((e,t)=>{o.forEach((o,n)=>{let r=0;for(const s of i){const i=e(s,r),a=o(s,r),l={x:i,y:a,data:s,xIndex:t,yIndex:n};Array.isArray(a)&&(l[eo]=Math.min(...a),l[Qt]=Math.max(...a),l[Jt]=(l[eo]+l[Qt])/2),Array.isArray(i)&&(l[no]=Math.min(...i),l[oo]=Math.max(...i),l[to]=(l[no]+l[oo])/2),C.push(l),r++}})});for(const e of C)N.push(Object.assign(Object.assign({},e),{[Kt]:e[oo]||e[no]||e.x,[Zt]:e[Qt]||e[eo]||e.y}))}if(s){_=Bt({data:s,lineDataAccessor:e,xProp:Kt,xPropTop:oo,xPropBottom:no,yProp:Zt,yPropTop:Qt,yPropBottom:eo,xAccessor:t,yAccessor:o}),z=function(e,t){return o=>ho[((e,t)=>!ho[e]||"difference"===e&&2!==t.length?"line":e)(e.type,o)](Object.assign(Object.assign(Object.assign({},e),t),{data:o}))}(a,{xProp:Kt,yProp:Zt,yPropMiddle:Jt,yPropTop:Qt,yPropBottom:eo,xPropMiddle:to,xPropTop:oo,xPropBottom:no})(_);for(const e of z)for(let t=0;e.data.length>t;t++){const o=e.data[t];if(!P(Object.assign({},o.data,o),t))continue;const n={parentLine:e,y:o.y,x:o.x,xTop:o.xTop,xMiddle:o.xMiddle,xBottom:o.xBottom,yTop:o.yTop,yMiddle:o.yMiddle,yBottom:o.yBottom,data:o.data};o.percent&&(n.percent=o.percent),N.push(n)}if(c){const e=!0===c?to:uo[c],t=!0===c?Jt:co[c];z.forEach(o=>{o.data.filter((e,t)=>{if(P(Object.assign({},e.data,e))){if("orphan"===c){const e=o.data[t-1],n=o.data[t+1];return!(e&&P(Object.assign({},e.data,e))||n&&P(Object.assign({},n.data,n)))}return!0}return!1}).forEach(n=>{C.push(Object.assign(Object.assign({},n),{parentLine:o,[Zt]:void 0!==n[t]?n[t]:void 0!==n[Jt]?n[Jt]:void 0!==n[eo]?n[eo]:n.y,[Kt]:void 0!==n[e]?n[e]:void 0!==n[to]?n[to]:void 0!==n[no]?n[no]:n.y}))})})}}r&&($=(({data:e,summaryDataAccessor:t,xAccessor:o,yAccessor:n})=>{const r=[];return t.forEach(t=>{o.forEach(o=>{n.forEach(n=>{const i=e=>t(e).map((e,t)=>[o(e,t),n(e,t)]);e.forEach(e=>{r.push(Object.assign(Object.assign({},e),{_baseData:t(e),_xyfCoordinates:i(e)}))})})})}),r})({data:r,summaryDataAccessor:y,xAccessor:t,yAccessor:o}),$.forEach(e=>{const t=e._baseData;e._xyfCoordinates.length>0&&e._xyfCoordinates[0][0][0]?e._xyfCoordinates[0].forEach(o=>{Array.isArray(o)&&o.map((o,n)=>Object.assign({parentSummary:e},t[n],{[Kt]:o[0],[Zt]:o[1]})).forEach(e=>{u&&C.push(Object.assign(Object.assign({x:0},e),{[Zt]:e[Qt]||e[eo]||e[Zt]})),N.push(Object.assign({x:0,y:0},e))})}):e._xyfCoordinates.length>0&&Array.isArray(e._xyfCoordinates)&&e._xyfCoordinates.map((o,n)=>Object.assign(Object.assign({parentSummary:e},t[n]),{[Kt]:o[0],[Zt]:o[1]})).forEach(e=>{u&&C.push(Object.assign(Object.assign({x:0},e),{[Zt]:e[Qt]||e[eo]||e[Zt]})),N.push(Object.assign({x:0,y:0},e))})}));let B,L,D,T,W=[],R=[];d&&!Array.isArray(d)&&!0===d.includeAnnotations&&t.forEach(e=>{j.forEach((t,o)=>{const n=e(t,o);isFinite(n)&&W.push({[Kt]:n})})}),h&&!Array.isArray(h)&&!0===h.includeAnnotations&&o.forEach(e=>{j.forEach((t,o)=>{const n=e(t,o);isFinite(n)&&R.push({[Zt]:n})})});for(const e of N){const t=void 0===e[no]?e[Kt]:Math.min(e[oo],e[no]),o=void 0===e[oo]?e[Kt]:Math.max(e[no],e[oo]),n=void 0===e[eo]?e[Zt]:Math.min(e[Qt],e[eo]),r=void 0===e[Qt]?e[Zt]:Math.max(e[eo],e[Qt]);void 0===t||void 0!==B&&t>=B||(B=t),void 0===o||void 0!==L&&L>=o||(L=o),void 0===n||void 0!==D&&n>=D||(D=n),void 0===r||void 0!==T&&T>=r||(T=r)}for(const e of W){const t=e[Kt];void 0===t||void 0!==B&&t>=B||(B=t),void 0===t||void 0!==L&&L>=t||(L=t)}for(const e of R){const t=e[Zt];void 0===t||void 0!==D&&t>=D||(D=t),void 0===t||void 0!==T&&T>=t||(T=t)}const F=[B,L],H=[D,T],I=ao(d),Y=ao(h);let X=[Y&&void 0!==Y[0]?Y[0]:H[0],Y&&void 0!==Y[1]?Y[1]:H[1]],G=[I&&void 0!==I[0]?I[0]:F[0],I&&void 0!==I[1]?I[1]:F[1]];if(!f||I&&2===I.length||(G=[G[1],G[0]]),"bumpline"!==a.type&&!m||Y&&2===Y.length||(X=[X[1],X[0]]),g.type&&"contour"===g.type)$=function({summaryType:e,data:t,finalXExtent:o,finalYExtent:r}){let i=[];e.type||(e={type:e});const{resolution:s=500,thresholds:a=10,bandwidth:l=20,neighborhood:c}=e,u=n.scaleLinear().domain(o).rangeRound([0,s]).nice(),d=n.scaleLinear().domain(r).rangeRound([s,0]).nice();return t.forEach(e=>{let t=p.contourDensity().size([s,s]).x(e=>u(e[0])).y(e=>d(e[1])).thresholds(a).bandwidth(l)(e._xyfCoordinates);c&&(t=[t[0]]);const o=Math.max(...t.map(e=>e.value));t.forEach(t=>{t.parentSummary=e,t.bounds=[],t.percent=t.value/o,t.coordinates.forEach(e=>{e.forEach((o,n)=>{e[n]=o.map(e=>[u.invert(e[0]),d.invert(e[1])]),0===n&&t.bounds.push(function(e){let t=[1/0,0],o=[-1/0,0],n=[0,1/0],r=[0,-1/0];return e.forEach(e=>{t=t[0]>e[0]?e:t,o=e[0]>o[0]?e:o,r=e[1]>r[1]?e:r,n=n[1]>e[1]?e:n}),{center:[(t[0]+o[0])/2,(n[1]+r[1])/2],top:n,left:t,right:o,bottom:r}}(e[n]))})})}),i=[...i,...t]}),i}({summaryType:g,data:$,finalXExtent:G,finalYExtent:X});else if(g.type&&"linebounds"===g.type){if($=function({summaryType:e,data:t,defined:o}){let n=[];e.type||(e={type:e});const{boundingAccessor:r,topBoundingAccessor:i=r,bottomBoundingAccessor:s=r}=e;return t.forEach(e=>{const t=e._baseData.map(o);let r=[],a=[];const l=[{xyf:a,base:r}];t.forEach((o,n)=>{!0===o?(r.push(e._baseData[n]),a.push(e._xyfCoordinates[n])):t[n+1]&&(r=[],a=[],l.push({xyf:a,base:r}))}),l.forEach(({xyf:t,base:o})=>{const r={data:e,parentSummary:e,_xyfCoordinates:io(t,o,i,s)};n=[...n,r]})}),n}({summaryType:g,data:$,defined:P}),!Y||2!==Y.length)for(const e of $)for(const t of e._xyfCoordinates){const e=t[1];void 0!==e&&isFinite(e)&&(X[0]>e&&(X[0]=e),e>X[1]&&(X[1]=e))}}else g.type&&"hexbin"===g.type?($=ro({summaryType:g,data:$[0],processedData:r&&!!r[0].processedData,preprocess:!1,finalXExtent:G,finalYExtent:X,size:v,margin:b,styleFn:k,classFn:w,renderFn:A,chartSize:E}),N=fo(N,$)):g.type&&"heatmap"===g.type?($=so({summaryType:g,data:$[0],processedData:r&&!!r[0].processedData,preprocess:!1,finalXExtent:G,finalYExtent:X,size:v,margin:b,styleFn:k,classFn:w,renderFn:A,chartSize:E}),N=fo(N,$)):g.type&&"trendline"===g.type&&($=function({preprocess:e=!1,summaryType:t,data:o,finalXExtent:r=[Math.min(...o.coordinates.map(e=>e.x)),Math.max(...o.coordinates.map(e=>e.x))],xScaleType:i=n.scaleLinear()}){if(e)return o[0].coordinates;let s,a=[];s=t.type?t:{type:s};const{regressionType:c="linear",order:u=2,precision:d=4,controlPoints:h=20,curve:f=l.curveCardinal}=s;let p=c;r[0]>=0||"logarithmic"!==c&&"power"!==c&&"exponential"!==c||(console.error(`Cannot use this ${c} regressionType type with value range that goes below 0, defaulting to linear`),p="linear"),o.coordinates&&!o._xyfCoordinates&&(o._xyfCoordinates=o.coordinates.map(e=>[e.x,e.y]));const m=Array.isArray(o)?o:[o],y=i.domain([0,1]).range(r);return a=[],m.forEach(e=>{const t=x.default[p](e._xyfCoordinates.map(e=>{let t=e[0],o=e[1];return"number"!=typeof t&&(t=t.getTime()),"number"!=typeof o&&(o=o.getTime()),[t,o]}),{order:u,precision:d}),o=1/h;let n=[0,1];if("linear"!==p){n=[];for(let e=0;1+o>e;e+=o)n.push(e)}const r=[];n.forEach(e=>{r.push(t.predict(y(e)))}),a.push({centroid:!1,customMark:void 0,data:e,parentSummary:e,value:t.string,r2:t.r2,curve:f,_xyfCoordinates:r})}),a}({summaryType:g,data:$[0],preprocess:r&&!!r[0].processedData,finalXExtent:G}),N=fo(N,$));return M&&(z=z.filter(M),N=N.filter((e,t)=>!e.parentLine||M(e.parentLine,t,[]))),O&&(N=N.filter(O)),S&&($=$.filter(S),N=N.filter((e,t)=>!e.parentSummary||S(e.parentSummary,t,[]))),{xExtent:G,yExtent:X,projectedLines:z,projectedPoints:C,projectedSummaries:$,fullDataset:N,calculatedXExtent:F,calculatedYExtent:H}},exports.exportChart=function(e,t){return o=this,n=void 0,i=function*(){const{format:o="svg",filename:n="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"),Dn(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);Tn(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const e=l.width*r,t=l.height*r,o=(new XMLSerializer).serializeToString(a),s=new Blob([o],{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((o,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?(Tn(e,n+".png"),o()):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 o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r(function(e){e(o)})).then(s,a)}l((i=i.apply(o,n||[])).next())});var o,n,r,i},exports.funnelize=function({data:e,steps:t,key:o}){const n=[];return Array.isArray(e)||(e=[e]),t||(t=e.map(e=>Object.keys(e)).reduce((e,t)=>e.concat(t),[])),e.forEach((e,r)=>{const i=o?e[o]:r;t.forEach(t=>{const o={funnelKey:i,stepName:"",stepValue:0};o.stepName=t,o.stepValue=e[t]?e[t]:0,n.push(o)})}),n},exports.heatmapping=so,exports.hexbinning=ro,exports.nodesEdgesFromHierarchy=(e,t=mo)=>{var o,n;const r=[],i=[],s=(e.descendants?e:d.hierarchy(e)).descendants();let a=0;for(const e of s)e.descendantIndex=a,a++;for(const e of s){const s=`${null!==(o=t(Object.assign(Object.assign({},e),e.data)))&&void 0!==o?o:mo(e)}-${e.parent?null!==(n=po(t,Object.assign(Object.assign({},e.parent),e.parent.data),""))&&void 0!==n?n:e.parent.name:"root"}`,a=Object.assign(e,e.data||{},{hierarchicalID:s});if(i.push(a),null!==e.parent){const t=Object.assign(e.parent,e.parent.data||{});r.push({source:t,target:a,depth:e.depth,weight:1,value:1,_NWFEdgeKey:s})}}return{edges:r,nodes:i}},exports.normalizeTooltip=ko,exports.smartTickFormat=qt,exports.useBrushSelection=Ho,exports.useFilteredData=function(t,o,n){const r=Wo(e=>e.selections.get(o));return e.useMemo(()=>{if(!r||0===r.clauses.size)return t;const e=Lo(r,n);return t.filter(e)},[t,r,n])},exports.useLinkedHover=Fo,exports.useSelection=Ro,exports.useTheme=function(){return $n(e=>e.theme)};
|