semiotic 3.7.4 → 3.8.0
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 +60 -15
- package/README.md +135 -24
- package/agent-skill/semiotic-charts/SKILL.md +146 -0
- package/ai/cli.js +133 -45
- package/ai/componentMetadata.cjs +6 -1
- package/ai/dist/mcp-server.js +1651 -154
- package/ai/examples.md +174 -0
- package/ai/schema.json +2934 -517
- package/ai/surface-manifest.json +200 -0
- package/ai/system-prompt.md +19 -3
- package/dist/components/Annotation.d.ts +4 -0
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartContainer.d.ts +91 -0
- package/dist/components/ChartGrid.d.ts +11 -1
- package/dist/components/CircularBrush.d.ts +61 -0
- package/dist/components/ContextLayout.d.ts +5 -1
- package/dist/components/DataSummaryContext.d.ts +1 -0
- package/dist/components/DirectManipulationControl.d.ts +63 -0
- package/dist/components/LinkedCharts.d.ts +3 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
- package/dist/components/MobileChartContainer.d.ts +51 -0
- package/dist/components/MobileStandardControls.d.ts +68 -0
- package/dist/components/SmallMultipleChart.d.ts +84 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
- package/dist/components/ai/ChartRecipe.d.ts +16 -0
- package/dist/components/ai/IntentMark.d.ts +15 -0
- package/dist/components/ai/chartCapabilities.d.ts +8 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +42 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
- package/dist/components/ai/chartRecipes.d.ts +278 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +203 -0
- package/dist/components/ai/dataQualityBridge.d.ts +201 -0
- package/dist/components/ai/describeChart.d.ts +9 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +170 -0
- package/dist/components/ai/intentManifest.d.ts +62 -0
- package/dist/components/ai/navigationTree.d.ts +3 -0
- package/dist/components/ai/observedSceneAudit.d.ts +72 -0
- package/dist/components/ai/readerGrounding.d.ts +83 -0
- package/dist/components/ai/recipeCapability.d.ts +8 -0
- package/dist/components/ai/recipeNavigation.d.ts +13 -0
- package/dist/components/ai/recipeSemantics.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +9 -0
- package/dist/components/ai/suggestCharts.d.ts +11 -1
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +22 -3
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/geo/FlowMap.d.ts +1 -1
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +1 -1
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +29 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +1 -1
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +15 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +1 -1
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +1 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +8 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
- package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
- package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +47 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +53 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +66 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +120 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +53 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +41 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +30 -1
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
- package/dist/components/charts/realtime/aggregate.d.ts +51 -0
- package/dist/components/charts/realtime/eventTime.d.ts +26 -0
- package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
- package/dist/components/charts/shared/colorUtils.d.ts +17 -13
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +4 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/hooks.d.ts +28 -5
- package/dist/components/charts/shared/minMax.d.ts +3 -0
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +12 -2
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +49 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +10 -3
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +15 -6
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +1 -1
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/validateChartData.d.ts +1 -1
- package/dist/components/charts/shared/validationMap.d.ts +0 -11
- package/dist/components/charts/xy/AreaChart.d.ts +1 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +1 -1
- package/dist/components/charts/xy/LineChart.d.ts +1 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +10 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +9 -4
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromArrow.d.ts +54 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromMermaid.d.ts +47 -0
- package/dist/components/data/fromObservablePlot.d.ts +69 -0
- package/dist/components/data/fromVegaLite.d.ts +27 -0
- package/dist/components/data/portability/index.d.ts +17 -0
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +160 -0
- package/dist/components/data/portability/vegaLite.d.ts +80 -0
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
- package/dist/components/realtime/RunningStats.d.ts +66 -0
- package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
- package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
- package/dist/components/realtime/types.d.ts +11 -0
- package/dist/components/recipes/annotationLayout.d.ts +29 -0
- package/dist/components/recipes/axisFixedForce.d.ts +119 -0
- package/dist/components/recipes/boba.d.ts +23 -0
- package/dist/components/recipes/customTooltip.d.ts +31 -0
- package/dist/components/recipes/cyclical.d.ts +39 -0
- package/dist/components/recipes/edgeRouter.d.ts +103 -0
- package/dist/components/recipes/forceLayout.d.ts +48 -0
- package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
- package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
- package/dist/components/recipes/gofishIR.d.ts +215 -0
- package/dist/components/recipes/gofishIRExamples.d.ts +38 -0
- package/dist/components/recipes/intervalLanes.d.ts +87 -0
- package/dist/components/recipes/intervals.d.ts +80 -0
- package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
- package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
- package/dist/components/recipes/mermaidDag.d.ts +44 -0
- package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
- package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
- package/dist/components/recipes/networkAnalysis.d.ts +102 -0
- package/dist/components/recipes/networkLayouts.d.ts +83 -0
- package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
- package/dist/components/recipes/physics.d.ts +122 -0
- package/dist/components/recipes/physicsReference.d.ts +102 -0
- package/dist/components/recipes/processAggregates.d.ts +32 -0
- package/dist/components/recipes/processChrome.d.ts +67 -0
- package/dist/components/recipes/processJourney.d.ts +54 -0
- package/dist/components/recipes/processPhysics.d.ts +300 -0
- package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
- package/dist/components/recipes/radialCoords.d.ts +69 -0
- package/dist/components/recipes/random.d.ts +2 -0
- package/dist/components/recipes/recipeChrome.d.ts +191 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +109 -0
- package/dist/components/recipes/recipeUtils.d.ts +157 -0
- package/dist/components/recipes/runs.d.ts +59 -0
- package/dist/components/recipes/tokenEncoding.d.ts +157 -0
- package/dist/components/recipes/tokenLayer.d.ts +79 -0
- package/dist/components/recipes/unitize.d.ts +108 -0
- package/dist/components/recipes/vector.d.ts +28 -0
- package/dist/components/recipes/waffle.d.ts +43 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +52 -4
- package/dist/components/semiotic-controls.d.ts +18 -0
- package/dist/components/semiotic-data.d.ts +2 -0
- package/dist/components/semiotic-experimental.d.ts +49 -0
- package/dist/components/semiotic-geo.d.ts +11 -0
- package/dist/components/semiotic-network.d.ts +14 -1
- package/dist/components/semiotic-ordinal.d.ts +10 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +56 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -22
- package/dist/components/semiotic-recipes-core.d.ts +92 -0
- package/dist/components/semiotic-recipes-react.d.ts +7 -0
- package/dist/components/semiotic-recipes.d.ts +4 -26
- package/dist/components/semiotic-server-edge.d.ts +8 -0
- package/dist/components/semiotic-server-node.d.ts +5 -0
- package/dist/components/semiotic-server.d.ts +2 -2
- package/dist/components/semiotic-themes-core.d.ts +53 -0
- package/dist/components/semiotic-themes-react.d.ts +4 -0
- package/dist/components/semiotic-themes.d.ts +6 -74
- package/dist/components/semiotic-utils-core.d.ts +46 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +10 -0
- package/dist/components/semiotic.d.ts +39 -7
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +17 -0
- package/dist/components/server/serverChartConfigs.d.ts +19 -9
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +1 -1
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +23 -3
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/ThemeStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/createStore.d.ts +1 -1
- package/dist/components/store/designTokens.d.ts +15 -0
- package/dist/components/store/themeSerialization.d.ts +32 -0
- package/dist/components/store/useChartInterrogation.d.ts +9 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +3 -13
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +28 -0
- package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +62 -25
- package/dist/components/stream/NetworkSVGOverlay.d.ts +15 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +64 -2
- package/dist/components/stream/PipelineStore.d.ts +100 -162
- package/dist/components/stream/SceneGraph.d.ts +14 -2
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +23 -10
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayout.d.ts +20 -0
- package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/customLayoutSelection.d.ts +52 -0
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoTypes.d.ts +56 -7
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hoverUtils.d.ts +3 -0
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +57 -0
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayout.d.ts +66 -1
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFramePaint.d.ts +43 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +104 -5
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
- package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
- package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/ordinalDomain.d.ts +38 -0
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +12 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +56 -8
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +84 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +72 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +302 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +9 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +16 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +177 -0
- package/dist/components/stream/pipelineDecay.d.ts +20 -2
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +16 -2
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +12 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +2 -0
- package/dist/components/stream/pipelineUpdateContract.d.ts +62 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +18 -0
- package/dist/components/stream/stalenessBands.d.ts +28 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/symbolPath.d.ts +24 -0
- package/dist/components/stream/types.d.ts +206 -9
- package/dist/components/stream/useFrame.d.ts +21 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useStalenessCheck.d.ts +6 -1
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +9 -4
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +52 -4
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +18 -0
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +49 -0
- package/dist/semiotic-experimental.min.js +1 -0
- package/dist/semiotic-experimental.module.min.js +1 -0
- package/dist/semiotic-geo.d.ts +11 -0
- package/dist/semiotic-network.d.ts +14 -1
- package/dist/semiotic-ordinal.d.ts +10 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +56 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -22
- package/dist/semiotic-recipes-core.d.ts +92 -0
- package/dist/semiotic-recipes-core.min.js +1 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -0
- package/dist/semiotic-recipes-react.d.ts +7 -0
- package/dist/semiotic-recipes-react.min.js +2 -0
- package/dist/semiotic-recipes-react.module.min.js +2 -0
- package/dist/semiotic-recipes.d.ts +4 -26
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +8 -0
- package/dist/semiotic-server-edge.min.js +1 -0
- package/dist/semiotic-server-edge.module.min.js +1 -0
- package/dist/semiotic-server-node.d.ts +5 -0
- package/dist/semiotic-server-node.min.js +1 -0
- package/dist/semiotic-server-node.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +2 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +53 -0
- package/dist/semiotic-themes-core.min.js +1 -0
- package/dist/semiotic-themes-core.module.min.js +1 -0
- package/dist/semiotic-themes-react.d.ts +4 -0
- package/dist/semiotic-themes-react.min.js +2 -0
- package/dist/semiotic-themes-react.module.min.js +2 -0
- package/dist/semiotic-themes.d.ts +6 -74
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +46 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +10 -0
- package/dist/semiotic.d.ts +39 -7
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +246 -86
- package/spec/README.md +152 -0
- package/spec/bindings/README.md +35 -0
- package/spec/bindings/vega-lite.mjs +112 -0
- package/spec/v0.1/annotation-provenance.schema.json +127 -0
- package/spec/v0.1/audience-profile.schema.json +67 -0
- package/spec/v0.1/chart-capability.schema.json +186 -0
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
package/dist/semiotic.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),o=require("d3-selection"),n=require("d3-brush"),i=require("d3-scale"),r=require("d3-quadtree"),s=require("d3-shape"),a=require("d3-array"),l=require("d3-hierarchy"),c=require("regression"),u=require("d3-interpolate"),d=require("d3-force"),h=require("d3-chord");function g(e){return e&&e.__esModule?e:{default:e}}function f(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 p=f(t),y=g(c);function m(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n+1>>1;t[i]>e?n=i-1:o=i}return t[o]}function v(e,t){let o=0,n=t.length-1;for(;n>o;){const i=o+n>>1;e>t[i]?o=i+1:n=i}return t[o]}function b({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,dimension:c,scales:u,onBrush:d,binSize:h,snap:g,binBoundaries:f,snapDuring:p,streaming:y}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const A=t.useMemo(()=>f?[...f].sort((e,t)=>e-t):void 0,[f]),j=t.useRef(A);j.current=A;const S=t.useRef(!1),O=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=o.select(b.current).select(".brush-g"),t="x"===c?n.brushX():"y"===c?n.brushY():n.brush();return t.extent([[0,0],[i,r]]),t.on("brush end",o=>{if(S.current)return;const n=w.current;if(!n)return;if(!o.selection)return O.current=null,void k.current(null);let s,a;if("x"===c){const[e,t]=o.selection;s=[n.x.invert(e),n.x.invert(t)],a=[n.y.invert(r),n.y.invert(0)]}else if("y"===c){const[e,t]=o.selection;s=[n.x.invert(0),n.x.invert(i)],a=[n.y.invert(t),n.y.invert(e)]}else{const[[e,t],[i,r]]=o.selection;s=[n.x.invert(e),n.x.invert(i)],a=[n.y.invert(r),n.y.invert(t)]}if("bin"===g&&"y"!==c&&("end"===o.type||"brush"===o.type&&p)){const i=j.current;i&&i.length>0?s=function(e,t){return 0===t.length?e:[m(e[0],t),v(e[1],t)]}(s,i):h&&h>0&&(s=[Math.floor(s[0]/h)*h,Math.ceil(s[1]/h)*h]);const r=n.x(s[0]),a=n.x(s[1]);if(S.current=!0,"x"===c)e.call(t.move,[r,a]);else if("xy"===c){const n=o.selection;e.call(t.move,[[r,n[0][1]],[a,n[1][1]]])}S.current=!1}const l={x:s,y:a};O.current=l,k.current(l)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,r,c,g,h,p]),t.useEffect(()=>{if(!(y&&u&&x.current&&O.current))return;if(!b.current)return;if("y"===c)return;const e=O.current,t=u.x.domain()[0],n=o.select(b.current).select(".brush-g");if(t>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);let i=e.x[0],r=!1;if(t>e.x[0]){if(i=t,"bin"===g){const e=j.current;e&&e.length>0?i=v(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return S.current=!0,n.call(x.current.move,null),S.current=!1,O.current=null,void k.current(null);r=!0}const s=u.x(i),a=u.x(e.x[1]);if(S.current=!0,"x"===c)n.call(x.current.move,[s,a]);else{const t=u.y(e.y[1]),o=u.y(e.y[0]);n.call(x.current.move,[[s,t],[a,o]])}if(S.current=!1,r){const t={x:[i,e.x[1]],y:e.y};O.current=t,k.current(t)}},[u,y,c,g,h]),e.jsx("svg",{ref:b,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`})})}const x=Object.freeze([]);function k(e){if(!e)return x;let t=!1;for(let o=0;e.length>o;o++){const n=e[o];if(null==n||"object"!=typeof n){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}class w{constructor(e,t){var o,n;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(o=null==t?void 0:t.chunkThreshold)&&void 0!==o?o:5e3,this.chunkSize=null!==(n=null==t?void 0:t.chunkSize)&&void 0!==n?n:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=k(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,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)}setReplacementData(e){if(e=k(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const n=Math.min(t+this.chunkSize,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)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const n=e[o];null!=n&&"object"==typeof n&&(this.pushBuffer.push(n),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function A(o){let n=null;const i=()=>(n||(n=t.createContext(null)),n),r=j(o);return[function({children:n,initialState:r}){const s=t.useRef(r),a=t.useMemo(()=>j(o,s.current),[]),l=i();return e.jsx(l.Provider,{value:a,children:n})},e=>{var o;const n=i(),s=null!==(o=t.useContext(n))&&void 0!==o?o:r,a=t.useRef(e);a.current=e;const l=t.useCallback(()=>a.current(s.getState()),[s]),c=t.useCallback(()=>a.current(s.getState()),[s]);return t.useSyncExternalStore(s.subscribe,l,c)}]}function j(e,t){const o=new EventTarget;let n=Object.assign(Object.assign({},e(function(e){n=Object.assign(Object.assign({},n),e(n)),o.dispatchEvent(new Event("update"))})),null!=t?t:{});return{getState:()=>n,subscribe:function(e){return o.addEventListener("update",e),()=>o.removeEventListener("update",e)}}}function S(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function O(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:M})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const M=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],C={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},_={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},P={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:M,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function L(e,t){if("light"===t)return C;if("dark"===t)return _;if("high-contrast"===t)return P;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?_:C;return O(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return O(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[T,$]=A(e=>({theme:C,setTheme(t){e(e=>({theme:L(e.theme,t)}))}}));class R{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;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];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}update(e,t){const o=[],n=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const r=(n+i)%this._capacity,s=this.buffer[r];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:Object.assign({},s),o.push(e),this.buffer[r]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(n=>{e(n)?o.push(n):t.push(n)}),0===o.length)return o;this.buffer=Array(this._capacity),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 N{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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.isFinite(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 B(e,t,o,n,i){const r=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=r.get(l);if(c||(c={start:l,end:l+n,total:0,categories:new Map},r.set(l,c)),c.total+=a,i){const e=i(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return r}function E(e,t,o,n,i,r){const s=[];for(const i of e){const e=o(i),r=n(i);Number.isFinite(e)&&Number.isFinite(r)&&s.push({px:t.x(e),py:t.y(r),rawY:r,d:i})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:i,datum:c,group:r}}function D(e,t,o,n,i,r,s,a){const l=[];for(const r of e){const e=o(r),s=n(r);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(r):i;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:r,datum:e,group:s}}function I(e,t,o,n){var i,r,s;const a=new Map;if("silhouette"===n)for(const n of e){let e=0;for(const i of t)e+=o(i,n)||0;a.set(n,-e/2)}else if("wiggle"===n){e.length>0&&a.set(e[0],0);for(let n=1;e.length>n;n++){const r=e[n-1],s=e[n];let l=0,c=0,u=0;for(const e of t){const t=o(e,s)||0;l+=(2*u+t)*(t-(o(e,r)||0)),c+=t,u+=t}const d=null!==(i=a.get(r))&&void 0!==i?i:0;a.set(s,d-(c>0?l/(2*c):0))}if(e.length>0){let n=0;for(const i of e){let e=0;for(const n of t)e+=o(n,i)||0;n+=(null!==(r=a.get(i))&&void 0!==r?r:0)+e/2}const i=n/e.length;for(const t of e)a.set(t,(null!==(s=a.get(t))&&void 0!==s?s:0)-i)}}else for(const t of e)a.set(t,0);return a}function H(e,t,o,n,i,r,s){const a=o(e),l=n(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:i,style:r,datum:e};return void 0!==s&&(c.pointId=s),c}function F(e,t,o,n,i,r,s){return{type:"rect",x:e,y:t,w:o,h:n,style:i,datum:r,group:s}}function W(e,t,o,n,i,r,s){const a={type:"heatcell",x:e,y:t,w:o,h:n,fill:i,datum:r};return(null==s?void 0:s.showValues)&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function z(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function Y(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function G(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function q(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}function X(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function V(e,t,o){const n=e=>e.toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function U(e){const t=e.map(X),o=t.length-1;return e=>{if(0>=e){const[e,o,n]=t[0];return V(e,o,n)}if(e>=1){const[e,n,i]=t[o];return V(e,n,i)}const n=e*o,i=Math.floor(n),r=n-i,[s,a,l]=t[i],[c,u,d]=t[i+1];return V(Math.round(s+(c-s)*r),Math.round(a+(u-a)*r),Math.round(l+(d-l)*r))}}const Q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],K=U(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),Z=U(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),J=U(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ee=U(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),te=U(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),oe=U(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ne=U(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ie=U(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),re=U(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),se=U(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ae=U(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),le=U(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),ce=U(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),ue=U(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),de=U(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),he=U(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),ge=U(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fe=U(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),pe=U(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),ye={category10:Q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],blues:K,reds:Z,greens:J,oranges:ee,purples:te,viridis:ne,plasma:ie},me=Q,ve=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],be=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],xe=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function ke(e,t,o){if("function"==typeof t){const n=t(e);return o&&n&&"string"==typeof n&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||xe.has(t)}(n)?o(n):n}const n=(null==e?void 0:e[t])+"";return o?o(n):me[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))%me.length]}function we(e,t,o="category10"){const n=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),r=n.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return i.scaleOrdinal().domain(n).range(o).unknown("#999");const s=ye[o]||ye.category10;if(r&&"function"==typeof s){let e=-1/0;for(const t of n){const o=Number(t);o>e&&(e=o)}return t=>s(Number(t)/e)}{const e=Array.isArray(s)?s:me;return i.scaleOrdinal().domain(n).range(e).unknown("#999")}}function Ae(e,t,o=[3,20],n){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!n)return i;const[r,s]=n,[a,l]=o;if(s===r)return(a+l)/2;let c=(i-r)/(s-r);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function je(e,t,o){var n,i,r;if(1>=o)return 1;const s=null!==(n=e.minOpacity)&&void 0!==n?n:.1,a=o-1-t;switch(e.type){case"linear":return s+(1-a/(o-1))*(1-s);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:o/2;return s+Math.pow(.5,a/t)*(1-s)}case"step":return(null!==(r=e.stepThreshold)&&void 0!==r?r:.5*o)>a?1:s;default:return 1}}function Se(e,t,o){var n;const i=null!==(n=e.duration)&&void 0!==n?n:500,r=o-t;return i>r?1-r/i:0}function Oe(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Me(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Ce(e,t,o){return e+(t-e)*o}function _e(){return"undefined"!=typeof performance?performance.now():Date.now()}function Pe(e,t,o){var n,i,r,s;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),n=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${n}`;if(null!=o&&null!=n)return`p:${o}:${n}`}return"p:"+o;case"rect":return`r:${t.group||""}:${null!==(s=null!==(i=null===(n=t.datum)||void 0===n?void 0:n.binStart)&&void 0!==i?i:null===(r=t.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Le(e,t,o,n){return"function"==typeof t.style?t.style(n||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,n)}function Te(e,t,o,n){if(!e.scales)return null;const i=[],r=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=n.getTop(o),a=n.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([l,c]),r.push([l,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:r,style:Le(e,n,o,t[0]),datum:t,group:o,interactive:n.interactive}}function $e(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const n of e)n.perSeries?t.push(n):o.push(n);return{perSeries:t,aggregate:o}}function Re(e,t,o){const n=[];for(const i of o){const o=Te(e,t,"__ribbon_aggregate",i);o&&n.push(o)}return n}function Ne(e,t,o,n){const i=[];for(const r of n){const n=Te(e,t,o,r);n&&i.push(n)}return i}function Be(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const n of t){if("band"!==n.kind)continue;const t=n.getTop(e),i=n.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&o.push({y0:i,y1:t})}return 0===o.length?e:Object.assign(Object.assign({},e),{band:o[0],bands:o})}function Ee(e,t,o,n){var i;if(!e.config.pointStyle)return;const r=null!=n?n:e.getY;for(const n of t){const t=e.resolveGroupColor(n.key);for(const s of n.data){let n=e.config.pointStyle(s);!n.fill&&t&&(n=Object.assign(Object.assign({},n),{fill:t}));const a=null!==(i=n.r)&&void 0!==i?i:3,l=e.getPointId?e.getPointId(s)+"":void 0,c=H(s,e.scales,e.getX,r,a,n,l);c&&o.push(c)}}}const De={topOpacity:.8,bottomOpacity:.05};function Ie(e){var t,o;if(e)return!0===e?De:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:De.topOpacity,bottomOpacity:null!==(o=e.bottomOpacity)&&void 0!==o?o:De.bottomOpacity}}const He={blues:K,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le},Fe=new Map;function We(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function ze(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,n=We(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=Y(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=n(e);if(!Number.isFinite(t))return NaN;const i=o(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:We(e.y1Accessor,"y1"),getBottom:We(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ye{constructor(e){if(this.xExtent=new N,this.yExtent=new N,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new R(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Y(e.timeAccessor||e.xAccessor,"time"),this.getY=Y(e.valueAccessor||e.yAccessor,"value")):(this.getX=Y(e.xAccessor,"x"),this.getY=Y(e.yAccessor,"y")),this.getGroup=q(e.groupAccessor),this.getCategory=q(e.categoryAccessor),this.getSize=e.sizeAccessor?Y(e.sizeAccessor,"size"):void 0,this.getColor=q(e.colorAccessor),this.getY0=e.y0Accessor?Y(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=ze(e),this.getPointId=q(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?Y(e.openAccessor,"open"):void 0,this.getHigh=Y(e.highAccessor,"high"),this.getLow=Y(e.lowAccessor,"low"),this.getClose=o?Y(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new R(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(n)&&this.yExtent.push(n)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?Y(this.config.timeAccessor||this.config.xAccessor,"time"):Y(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,n="function"==typeof o?o(t):t[o||"x"],i=n instanceof Date,r="string"==typeof n&&n.length>=10&&!isNaN(new Date(n).getTime())&&isNaN(Number(n));if(this.xIsDate=i||r,r){const e="string"==typeof o?o:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(o(e)instanceof Date?o(e):new Date(o(e)))}}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)if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(o);if(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));else{this.yExtent.push(this.getY(o)),this.getY0&&this.yExtent.push(this.getY0(o));for(const e of this.resolvedRibbons){const t=e.getTop(o),n=e.getBottom(o);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(n)&&this.yExtent.push(n)}}if(null!=e)if(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));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(n)&&this.yExtent.evict(n)}}}return!0}computeScene(e){var t,o,n,r,s,a,l,c,u,d,h,g,f,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(o=y.xExtent[0])&&void 0!==o?o:b[0],null!==(n=y.xExtent[1])&&void 0!==n?n:b[1]]:b,w=y.yExtent?[null!==(r=y.yExtent[0])&&void 0!==r?r:x[0],null!==(s=y.yExtent[1])&&void 0!==s?s:x[1]]:x;const A=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],j="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!A&&m.size>0)if(y.normalize)w=[0,j?1:1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(a=y.baseline)&&void 0!==a?a:"zero"}:${null!==(l=y.stackOrder)&&void 0!==l?l:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),o=new Map,n=new Set;let i=0;const r=new Map,s=new Map;for(const e of t){const t=new Map;let a=0;for(const o of e.data){const e=this.getX(o),s=this.getY(o);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),n.add(e),a+=s;const l=(r.get(e)||0)+s;r.set(e,l),l>i&&(i=l)}o.set(e.key,t),s.set(e.key,a)}const a=null!==(c=y.stackOrder)&&void 0!==c?c:"key",l=(e,t)=>t>e?-1:e>t?1:0;let f;if("insideOut"===a){const e=[...t].map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:l(e,t)}),o=[],n=[];let i=0,r=0;for(const t of e)r>i?(o.push(t),i+=null!==(u=s.get(t))&&void 0!==u?u:0):(n.push(t),r+=null!==(d=s.get(t))&&void 0!==d?d:0);f=[...n.reverse(),...o]}else f="asc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(e))&&void 0!==o?o:0)-(null!==(n=s.get(t))&&void 0!==n?n:0);return 0!==i?i:l(e,t)}):"desc"===a?t.map(e=>e.key).sort((e,t)=>{var o,n;const i=(null!==(o=s.get(t))&&void 0!==o?o:0)-(null!==(n=s.get(e))&&void 0!==n?n:0);return 0!==i?i:l(e,t)}):t.map(e=>e.key).sort(l);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(n).sort((e,t)=>e-t),t=I(e,f,(e,t)=>{var n;return(null===(n=o.get(e))||void 0===n?void 0:n.get(t))||0},y.baseline);let i=1/0,s=-1/0;for(const o of e){const e=null!==(h=t.get(o))&&void 0!==h?h:0,n=null!==(g=r.get(o))&&void 0!==g?g:0;i>e&&(i=e),e+n>s&&(s=e+n)}Number.isFinite(i)&&Number.isFinite(s)||(i=0,s=0);const a=s-i,l=j?0:a>0?a*y.extentPadding:1;w=[i-l,s+l]}else w=[0,i+(j?0:i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!A&&m.size>0){const[,e]=function(e,t,o,n,i){const r=B(e,t,o,n,i);if(0===r.size)return[0,0];let s=0;for(const e of r.values())e.total>s&&(s=e.total);return[0,s]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,j?e:e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!A&&m.size>0){const[e,t]=function(e,t){let o=0,n=0,i=0;for(const r of e){const e=t(r);null==e||Number.isNaN(e)||(i+=e,o>i&&(o=i),i>n&&(n=i))}return[o,n]}(m,this.getY),o=t-e,n=j?0:o>0?o*y.extentPadding:1;w=[Math.min(0,e-Math.abs(n)),Math.max(0,t+Math.abs(n))]}else if(!A&&w[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of v)for(const t of this.resolvedRibbons){const o=t.getTop(e),n=t.getBottom(e);Number.isFinite(o)&&(w[0]>o&&(w[0]=o),o>w[1]&&(w[1]=o)),Number.isFinite(n)&&(w[0]>n&&(w[0]=n),n>w[1]&&(w[1]=n))}const e=w[1]-w[0],t=j?0:e>0?e*y.extentPadding:1,o=null===(f=y.yExtent)||void 0===f?void 0:f[0],n=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=o?w[0]:w[0]-t,null!=n?w[1]:w[1]+t],"log"!==y.yScaleType||w[0]>0||0>=x[0]||j||(w[0]=null!=o?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!A){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const S="streaming"===y.runtimeMode,O=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(S)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[O,e.width-O]:[e.width-O,O];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-O,O])}}else{const t="down"===y.arrowOfTime?[O,e.height-O]:[e.height-O,O];this.scales={x:i.scaleLinear().domain(w).range([O,e.width-O]),y:i.scaleLinear().domain(k).range(t)}}else{const t=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)};this.scales={x:t(y.xScaleType,k,[O,e.width-O]),y:t(y.yScaleType,w,[e.height-O,O])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,o=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxPointRadius=o,Ye.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const n=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(n[i++]=e);this._quadtree=r.quadtree().x(e=>e.x).y(e=>e.y).addAll(n)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const n of e.path)n[0]*=t,n[1]*=o;break;case"area":for(const n of e.topPath)n[0]*=t,n[1]*=o;for(const n of e.bottomPath)n[0]*=t,n[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const n=this.scales.x.domain(),r=this.scales.y.domain(),s=this.scales.x.range(),a=this.scales.y.range(),l=(e,t,o)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(o).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(o):i.scaleLinear().domain(t).range(o)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=a[1]>a[0];this.scales={x:l(this.config.xScaleType,n,s[0]>s[1]?[e.width-c,c]:[c,e.width-c]),y:l(this.config.yScaleType,r,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var o,n,i,r,s,a,l;const{config:c,scales:u}=this;if(!u)return[];if(c.customLayout){const l=null!==(o=c.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},d={data:t,scales:u,dimensions:{width:e.width,height:e.height,margin:l,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(n=c.themeSemantic)&&void 0!==n?n:{},categorical:null!==(i=c.themeCategorical)&&void 0!==i?i:ve},resolveColor:(e,t)=>{var o,n;const i=this.resolveGroupColor(e);if(i)return i;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:null!==(n=null===(o=c.themeSemantic)||void 0===o?void 0:o.primary)&&void 0!==n?n:"#4e79a7"},config:null!==(r=c.layoutConfig)&&void 0!==r?r:{}};let h;try{h=c.customLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(s=h.overlays)&&void 0!==s?s:null,null!==(a=h.nodes)&&void 0!==a?a:[]}if(this.customLayoutOverlays=null,0===t.length)return[];const d={scales:u,config:c,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(c.chartType){case"line":return function(e,t){var o;const n=e.groupData(t),i=[],r=null===(o=e.config.annotations)||void 0===o?void 0:o.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:o,aggregate:r}=$e(e.ribbons);if(r.length>0&&i.push(...Re(e,t,r)),o.length>0)for(const t of n)i.push(...Ne(e,t.data,t.key,o))}for(const t of n){const o=e.resolveLineStyle(t.key,t.data[0]),n=E(t.data,e.scales,e.getX,e.getY,o,t.key);r&&r.length>0&&(n.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),i.push(n)}return Ee(e,n,i),i}(d,t);case"area":return function(e,t){const o=e.groupData(t),n=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=$e(e.ribbons);if(r.length>0&&n.push(...Re(e,t,r)),i.length>0)for(const t of o)n.push(...Ne(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],r=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=D(t.data,e.scales,e.getX,e.getY,i,o,t.key,r),a=Ie(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),n.push(s)}return Ee(e,o,n),n}(d,t);case"mixed":return function(e,t){const o=e.groupData(t),n=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:r}=$e(e.ribbons);if(r.length>0&&n.push(...Re(e,t,r)),i.length>0)for(const t of o)n.push(...Ne(e,t.data,t.key,i))}const r=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?r:o}:void 0;for(const t of o)if(i.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),i=D(t.data,e.scales,e.getX,e.getY,r,o,t.key,s),a=Ie(e.config.gradientFill);a&&(i.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}else{const o=e.resolveLineStyle(t.key,t.data[0]),i=E(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),n.push(i)}return Ee(e,o,n),n}(d,t);case"stackedarea":return function(e,t){var o,n,i,r;const s=e.groupData(t),a=null!==(o=e.config.stackOrder)&&void 0!==o?o:"key",l=()=>s.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===a)l();else if("asc"===a||"desc"===a||"insideOut"===a){const t=new Map;for(const o of s){let n=0;for(const t of o.data){const o=e.getX(t),i=e.getY(t);Number.isFinite(o)&&Number.isFinite(i)&&(n+=i)}t.set(o.key,n)}const o=(e,t)=>t>e?-1:e>t?1:0;if("asc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(r=t.get(n.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else if("desc"===a)s.sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)});else{const e=[...s].sort((e,n)=>{var i,r;const s=(null!==(i=t.get(n.key))&&void 0!==i?i:0)-(null!==(r=t.get(e.key))&&void 0!==r?r:0);return 0!==s?s:o(e.key,n.key)}),r=[],a=[];let l=0,c=0;for(const o of e)c>l?(r.push(o),l+=null!==(n=t.get(o.key))&&void 0!==n?n:0):(a.push(o),c+=null!==(i=t.get(o.key))&&void 0!==i?i:0);s.length=0,s.push(...a.reverse(),...r)}}else l();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(r=e.config.baseline)&&void 0!==r?r:"zero",{nodes:d,stackedTops:h}=function(e,t,o,n,i,r,s,a="zero"){var l,c;const u=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=o(i),r=n(i);Number.isFinite(t)&&Number.isFinite(r)&&e.set(t,(e.get(t)||0)+r)}h.set(t.key,e)}let g;if(r){g=new Map;for(const t of d){let o=0;for(const n of e)o+=(null===(l=h.get(n.key))||void 0===l?void 0:l.get(t))||0;g.set(t,o||1)}}const f=I(d,e.map(e=>e.key),(e,t)=>{var o;return(null===(o=h.get(e))||void 0===o?void 0:o.get(t))||0},a),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=f.get(e))&&void 0!==c?c:0);for(const o of e){const e=h.get(o.key),n=[],a=[],l=new Map;for(const o of d){let i=e.get(o)||0;const s=m.get(o);r&&(i/=g.get(o));const c=s+i,u=t.x(o);a.push([u,t.y(s)]),n.push([u,t.y(c)]),m.set(o,c),l.set(o,c)}y.set(o.key,l);const c={type:"area",topPath:n,bottomPath:a,style:i(o.key,o.data[0]),datum:o.data,group:o.key};s&&(c.curve=s),p.push(c)}return{nodes:p,stackedTops:y}}(s,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,c,u),g=d;if(e.config.pointStyle){const t=new WeakMap;for(const o of s){const n=h.get(o.key);if(n)for(const i of o.data){const o=e.getX(i),r=e.getY(i);null==o||Number.isNaN(o)||null==r||Number.isNaN(r)||!n.has(o)||t.set(i,n.get(o))}}const o=o=>{var n;return null!==(n=t.get(o))&&void 0!==n?n:e.getY(o)};Ee(e,s,g,o)}return g}(d,t);case"scatter":case"bubble":return function(e,t){var o;const n=[],i="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let s=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const n of o)e>n&&(e=n),n>t&&(t=n);s=o=>e===t?(r[0]+r[1])/2:r[0]+(o-e)/(t-e)*(r[1]-r[0])}}const a=e.getColor?e.resolveColorMap(t):null,l=(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7";for(const o of t){let t=e.config.pointStyle?e.config.pointStyle(o):{fill:l,opacity:.8},r=t.r||i;if(s&&e.getSize){const t=e.getSize(o);null==t||Number.isNaN(t)||(r=s(t))}if(a&&e.getColor&&!t.fill){const n=e.getColor(o);n&&a.has(n)&&(t=Object.assign(Object.assign({},t),{fill:a.get(n)}))}const c=e.getPointId?e.getPointId(o)+"":void 0,u=H(o,e.scales,e.getX,e.getY,r,t,c);u&&n.push(u)}return n}(d,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){var n,i,r;const s=Math.max(1,Math.floor(null!==(n=e.config.heatmapXBins)&&void 0!==n?n:20)),a=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),l=null!==(r=e.config.heatmapAggregation)&&void 0!==r?r:"count",c=Y(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,g]=e.scales.y.domain(),f=(d-u||1)/s,p=(g-h||1)/a,y=s*a;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let o=0;t.length>o;o++){const n=t[o],i=e.getX(n),r=e.getY(n);if(!isFinite(i)||!isFinite(r))continue;const l=Math.min(Math.floor((i-u)/f),s-1),d=Math.min(Math.floor((r-h)/p),a-1);if(0>l||0>d)continue;const g=d*s+l;m[g]++;const y=c(n);v[g]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(l){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=o.width/s,A=o.height/a,j=e.config.showValues,S=e.config.heatmapValueFormat,O=[];for(let e=0;a>e;e++){const t=e*s;for(let o=0;s>o;o++){const n=t+o;if(0===m[n])continue;let i;switch(l){case"sum":i=v[n];break;case"mean":i=v[n]/m[n];break;default:i=m[n]}const r=(i-b)/k;O.push(W(o*w,(a-1-e)*A,w,A,`rgb(${220-(180*r+.5)|0},${220-(100*r+.5)|0},${255-(50*r+.5)|0})`,{xi:o,yi:e,value:i,count:m[n],sum:v[n],xCenter:u+(o+.5)*f,yCenter:h+(e+.5)*p,agg:l},j?{value:i,showValues:!0,valueFormat:S}:void 0))}}return O}(e,t,o);if(0===t.length)return[];const n=Y(e.config.valueAccessor,"value"),i=G(e.config.xAccessor,"x"),r=G(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],n=i(o),u=r(o);l[e]=n,c[e]=u,s.has(n)||s.set(n,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),g=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),p=g.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(p){g.sort((e,t)=>e-t),a.clear();for(let e=0;g.length>e;e++)a.set(g[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],i=s.get(l[e]),r=a.get(c[e]);if(void 0===i||void 0===r)continue;const d=n(o),h=r*u+i,g=b.get(h);let f;void 0!==g?f=g:(f=x++,b.set(h,f)),y[f]=h,m[f]=d,v[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in He?e:"blues";let o=Fe.get(t);if(o)return o;o=Array(256);const n=He[t]||K;for(let e=0;256>e;e++)o[e]=n(e/255);return Fe.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),j=255/(w-k||1),S=o.width/u,O=o.height/d,M=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const o=y[e],n=o%u;_.push(W(n*S,(d-1-(o-n)/u)*O,S,O,A[Math.min((t-k)*j+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(d,t,e);case"bar":{const e=function(e,t){var o,n;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=B(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const o of e.categories.keys())t.add(o);const o=e.config.barColors?Object.keys(e.config.barColors):[],n=new Set(o),s=Array.from(t).filter(e=>!n.has(e)).sort(),a=o.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const s=[],a=e.scales,[l,c]=a.x.domain(),u=e.config.barStyle,d=null===(o=e.config.themeSemantic)||void 0===o?void 0:o.primary,h=null==u?void 0:u.gap,g="number"!=typeof h||0>h?1:h,f={};(null==u?void 0:u.stroke)&&(f.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(f.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(f.opacity=u.opacity);for(const t of i.values()){const o=Math.max(t.start,l),i=Math.min(t.end,c);if(o>=i)continue;const h=a.x(o),p=a.x(i),y=Math.abs(p-h),m=y>g+1?g:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const i of r){const r=t.categories.get(i)||0;if(0===r)continue;const l=a.y(o),c=a.y(o+r),h=(null===(n=e.config.barColors)||void 0===n?void 0:n[i])||(null==u?void 0:u.fill)||d||"#4e79a7";s.push(F(v,Math.min(l,c),b,Math.abs(l-c),Object.assign({fill:h},f),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:r},i)),o+=r}}else{const e=a.y(0),o=a.y(t.total);s.push(F(v,Math.min(e,o),b,Math.abs(e-o),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},f),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:s,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(d,t);return this._barCategoryCache=null!==(l=d.barCategoryCache)&&void 0!==l?l:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var o,n,i,r,s,a;const l=[],c=e.config.swarmStyle||{},u=null!==(o=c.radius)&&void 0!==o?o:3,d=null!==(r=null!==(n=c.fill)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==r?r:"#007bff",h=null!==(s=c.opacity)&&void 0!==s?s:.7,g=c.stroke,f=c.strokeWidth;for(const o of t){const t=e.getX(o),n=e.getY(o);if(null==n||Number.isNaN(n))continue;const i=e.scales.x(t),r=e.scales.y(n);let s=d;if(e.getCategory){const t=e.getCategory(o);s=(null===(a=e.config.barColors)||void 0===a?void 0:a[t])||s}const c={type:"point",x:i,y:r,r:u,style:{fill:s,opacity:h,stroke:g,strokeWidth:f},datum:o};e.getPointId&&(c.pointId=e.getPointId(o)+""),l.push(c)}return l}(d,t);case"waterfall":return function(e,t,o){var n,i,r,s,a,l,c;const u=[],d=e.scales,h=e.config.waterfallStyle,g=t.filter(t=>{const o=e.getY(t),n=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=n&&isFinite(n)});if(0===g.length)return u;const f=null!==(r=null!==(n=null==h?void 0:h.positiveColor)&&void 0!==n?n:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==r?r:"#28a745",p=null!==(l=null!==(s=null==h?void 0:h.negativeColor)&&void 0!==s?s:null===(a=e.config.themeSemantic)||void 0===a?void 0:a.danger)&&void 0!==l?l:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;g.length>t;t++){const n=g[t],i=e.getX(n),r=e.getY(n),s=x+r;let a;a=g.length-1>t?e.getX(g[t+1])-i:t>0?i-e.getX(g[t-1]):0;const l=d.x(i),c=0!==a?d.x(i+a):l+o.width/10,k=Math.min(l,c)+y/2,w=Math.max(l,c)-y/2-k;if(0>=w){x=s;continue}const A=d.y(x),j=d.y(s),S=Math.min(A,j),O=Math.abs(A-j),M={fill:0>r?p:f,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(F(k,S,w,O,M,Object.assign(Object.assign({},n),{baseline:x,cumEnd:s,delta:r,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=s}return u}(d,t,e);case"candlestick":return function(e,t){var o,n;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(o=e.config.candlestickRangeMode)&&void 0!==o&&o;if(!(i||e.getOpen&&e.getClose))return[];const r=[],s=e.config.candlestickStyle||{},a=s.rangeColor||"#6366f1",l=i?a:s.upColor||"#28a745",c=i?a:s.downColor||"#dc3545",u=i?a:s.wickColor||"#333",d=s.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let g=null!==(n=s.bodyWidth)&&void 0!==n?n:0;if(null==s.bodyWidth)if(h.length>1){let t=1/0;for(let o=1;h.length>o;o++){const n=Math.abs(e.scales.x(h[o])-e.scales.x(h[o-1]));n>0&&t>n&&(t=n)}g=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else g=6;for(const o of t){const t=e.getX(o);if(null==t||Number.isNaN(t))continue;const n=e.getHigh(o),s=e.getLow(o);if(null==n||Number.isNaN(n)||null==s||Number.isNaN(s))continue;const a=i?n:e.getOpen(o),h=i?s:e.getClose(o);if(!i&&[a,h].some(e=>null==e||Number.isNaN(e)))continue;const f=h>=a,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(a),closeY:e.scales.y(h),highY:e.scales.y(n),lowY:e.scales.y(s),bodyWidth:g,upColor:l,downColor:c,wickColor:u,wickWidth:d,isUp:f,datum:o};i&&(p.isRange=!0),r.push(p)}return r}(d,t);default:return[]}}resolveBoundsStyle(e,t){var o;const n=this.config.boundsStyle;return"function"==typeof n?n(t||{},e):n&&"object"==typeof n?n:{fill:this.resolveLineStyle(e,t).stroke||(null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?je(o,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,o){var n,i;const r=o.length;if(1>=r)return;const s=new Map;for(let e=0;o.length>e;e++)s.set(o[e],e);for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const n=Array(t.length);let i=!1;for(let o=0;t.length>o;o++){const a=s.get(t[o]);null!=a?(n[o]=je(e,a,r),1>n[o]&&(i=!0)):n[o]=1}i&&(o._decayOpacities=n);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],n=o.topPath?o.topPath.length:t.length;if(2>n)continue;if(t.length===n){const i=Array(n);let a=!1;for(let o=0;t.length>o;o++){const n=s.get(t[o]);null!=n?(i[o]=je(e,n,r),1>i[o]&&(a=!0)):i[o]=1}a&&(o._decayOpacities=i)}else{let i=1;for(const o of t){const t=s.get(o);if(null!=t){const o=je(e,t,r);i>o&&(i=o)}}if(1>i){const e=Array(n);e.fill(i),o._decayOpacities=e}}continue}const t=s.get(o.datum);if(null==t)continue;const a=je(e,t,r);if("heatcell"===o.type)o.style={opacity:a};else if("candlestick"===o.type)o._decayOpacity=a;else{const e=null!==(i=null===(n=o.style)||void 0===n?void 0:n.opacity)&&void 0!==i?i:1;o.style=Object.assign(Object.assign({},o.style),{opacity:e*a})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,o,n){var i,r;const s="undefined"!=typeof performance?performance.now():Date.now(),a=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",l=null!==(r=e.glowRadius)&&void 0!==r?r:4,c=new Map;for(let e=0;o.length>e;e++)c.set(o[e],e);for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let i=0;for(const o of t){const t=c.get(o);if(null==t)continue;const r=n.get(t);if(null==r)continue;const a=Se(e,r,s);a>i&&(i=a)}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const t=c.get(o.datum);if(null==t)continue;const i=n.get(t);if(null==i)continue;const r=Se(e,i,s);r>0&&(o._pulseIntensity=r,o._pulseColor=a,o._pulseGlowRadius=l)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var o;if(!t||0===t.size)return!1;const n="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(o=e.duration)&&void 0!==o?o:500,r=t.peek();return null!=r&&i>n-r}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,n){var i,r,s,a;o.clear(),n.clear();for(let l=0;t.length>l;l++){const c=t[l],u=Pe(e,c,l);u&&("point"===c.type?o.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?o.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?o.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"line"===c.type?n.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"area"===c.type&&n.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(a=c.style)||void 0===a?void 0:a.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,o;this.prevPositionMap.clear(),this.prevPathMap.clear();const n=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=Pe(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:n,w:t.w,h:0,opacity:null!==(o=t.style.opacity)&&void 0!==o?o:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,n,i){var r,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x,k,w,A,j,S,O,M,C,_,P,L,T,$,R,N,B,E,D,I,H,F,W,z,Y,G;if(0===n.size&&0===i.size)return o;const q=null!==(r=t.duration)&&void 0!==r?r:300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let X=!1;const V=new Set,U=new Set;for(let t=0;o.scene.length>t;t++){const r=o.scene[t],P=Pe(e,r,t);if(!P)continue;if(r._transitionKey=P,"line"===r.type||"area"===r.type){const e=i.get(P);if(e){if(U.add(P),"line"===r.type&&e.path&&e.path.length===r.path.length){r._targetPath=r.path.map(e=>[e[0],e[1]]),r._prevPath=e.path;for(let t=0;r.path.length>t;t++)r.path[t]=[e.path[t][0],e.path[t][1]];X=!0}else if("area"===r.type&&e.topPath&&e.bottomPath&&e.topPath.length===r.topPath.length&&e.bottomPath.length===r.bottomPath.length){r._targetTopPath=r.topPath.map(e=>[e[0],e[1]]),r._targetBottomPath=r.bottomPath.map(e=>[e[0],e[1]]),r._prevTopPath=e.topPath,r._prevBottomPath=e.bottomPath;for(let t=0;r.topPath.length>t;t++)r.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;r.bottomPath.length>t;t++)r.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];X=!0}r._targetOpacity=null!==(s=r.style.opacity)&&void 0!==s?s:1,r._startOpacity=null!==(l=null!==(a=e.opacity)&&void 0!==a?a:r.style.opacity)&&void 0!==l?l:1}else r._targetOpacity=null!==(c=r.style.opacity)&&void 0!==c?c:1,r._startOpacity=0,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;continue}const L=n.get(P);if("point"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,r:r.r};r._targetOpacity=null!==(u=r.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(r._targetX=e.x,r._targetY=e.y,r._targetR=e.r,r.x=L.x,r.y=L.y,r.r=null!==(d=L.r)&&void 0!==d?d:r.r,X=!0)}else r._targetOpacity=null!==(h=r.style.opacity)&&void 0!==h?h:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("rect"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(g=r.style.opacity)&&void 0!==g?g:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(f=L.w)&&void 0!==f?f:r.w,r.h=null!==(p=L.h)&&void 0!==p?p:r.h,X=!0)}else r._targetOpacity=null!==(y=r.style.opacity)&&void 0!==y?y:1,r.style=Object.assign(Object.assign({},r.style),{opacity:0}),X=!0;else if("heatcell"===r.type)if(L){V.add(P);const e={x:r.x,y:r.y,w:r.w,h:r.h};r._targetOpacity=null!==(v=null===(m=r.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(r._targetX=e.x,r._targetY=e.y,r._targetW=e.w,r._targetH=e.h,r.x=L.x,r.y=L.y,r.w=null!==(b=L.w)&&void 0!==b?b:r.w,r.h=null!==(x=L.h)&&void 0!==x?x:r.h,X=!0)}else r._targetOpacity=null!==(w=null===(k=r.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0;else if("candlestick"===r.type)if(L&&null!=L.openY){V.add(P);const e={x:r.x,openY:r.openY,closeY:r.closeY,highY:r.highY,lowY:r.lowY};r._targetOpacity=null!==(j=null===(A=r.style)||void 0===A?void 0:A.opacity)&&void 0!==j?j:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(r._targetX=e.x,r._targetOpenY=e.openY,r._targetCloseY=e.closeY,r._targetHighY=e.highY,r._targetLowY=e.lowY,r.x=L.x,r.openY=L.openY,r.closeY=null!==(S=L.closeY)&&void 0!==S?S:r.closeY,r.highY=null!==(O=L.highY)&&void 0!==O?O:r.highY,r.lowY=null!==(M=L.lowY)&&void 0!==M?M:r.lowY,X=!0)}else r._targetOpacity=null!==(_=null===(C=r.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,r.style=Object.assign(Object.assign({},r.style||{}),{opacity:0}),X=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const n={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const n={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(n),X=!0}for(const[e,t]of n)if(!V.has(e)){if(e.startsWith("p:")){const n={type:"point",x:t.x,y:t.y,r:null!==(T=t.r)&&void 0!==T?T:3,style:{opacity:null!==($=t.opacity)&&void 0!==$?$:1},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("r:")){const n={type:"rect",x:t.x,y:t.y,w:null!==(R=t.w)&&void 0!==R?R:0,h:null!==(N=t.h)&&void 0!==N?N:0,style:{opacity:null!==(B=t.opacity)&&void 0!==B?B:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("h:")){const n={type:"heatcell",x:t.x,y:t.y,w:null!==(E=t.w)&&void 0!==E?E:0,h:null!==(D=t.h)&&void 0!==D?D:0,fill:"#999",datum:null,style:{opacity:null!==(I=t.opacity)&&void 0!==I?I:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(n)}else if(e.startsWith("c:")){const n=null!==(H=t.openY)&&void 0!==H?H:t.y,i={type:"candlestick",x:t.x,openY:n,closeY:null!==(F=t.closeY)&&void 0!==F?F:n,highY:null!==(W=t.highY)&&void 0!==W?W:n,lowY:null!==(z=t.lowY)&&void 0!==z?z:n,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};o.exitNodes.push(i)}X=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),X&&(o.activeTransition={startTime:_e(),duration:q}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,n){var i,r,s,a,l,c;if(!o.activeTransition)return!1;const u=Me(e,o.activeTransition),d=Oe(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,r=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style.opacity=Ce(r,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==e._targetR&&void 0!==o.r&&(e.r=Ce(o.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(r=o.opacity)&&void 0!==r?r:1:0;e.style.opacity=Ce(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(s=o.opacity)&&void 0!==s?s:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),e.y=Ce(o.y,e._targetY,d),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,d)),void 0!==o.h&&(e.h=Ce(o.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?n.get(t):void 0,i=o?null!==(a=o.opacity)&&void 0!==a?a:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:Ce(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const o=n.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,d),void 0!==o.openY&&(e.openY=Ce(o.openY,e._targetOpenY,d)),void 0!==o.closeY&&(e.closeY=Ce(o.closeY,e._targetCloseY,d)),void 0!==o.highY&&(e.highY=Ce(o.highY,e._targetHighY,d)),void 0!==o.lowY&&(e.lowY=Ce(o.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(l=e._startOpacity)&&void 0!==l?l:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let n=0;e.path.length>n;n++)e.path[n][0]=Ce(t[n][0],o[n][0],d),e.path[n][1]=Ce(t[n][1],o[n][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Ce(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,o=e._prevBottomPath,n=e._targetTopPath,i=e._targetBottomPath;if(t&&n&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Ce(t[o][0],n[o][0],d),e.topPath[o][1]=Ce(t[o][1],n[o][1],d);if(o&&i&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Ce(o[t][0],i[t][0],d),e.bottomPath[t][1]=Ce(o[t][1],i[t][1],d)}}if(u>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}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}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(this._groupDataCache&&this._groupDataCache.version===this._ingestVersion&&this._groupDataCache.group===this.getGroup&&this._groupDataCache.data===e)return this._groupDataCache.result;let t;if(this.getGroup){const o=new Map;for(const t of e){const e=this.getGroup(t);o.has(e)||o.set(e,[]),o.get(e).push(t)}t=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else t=[{key:"_default",data:e}];return this._groupDataCache={version:this._ingestVersion,group:this.getGroup,data:e,result:t},t}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const o of e){const e=this.getColor(o);e&&t.add(e)}const o=Array.from(t).sort(),n=o.join("\0");if(this._colorMapCache&&this._colorMapCache.key===n)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||ve,r=new Map;for(let e=0;o.length>e;e++)r.set(o[e],i[e%i.length]);return this._colorMapCache={key:n,map:r,version:this._ingestVersion},r}resolveLineStyle(e,t){var o;const n=this.config.lineStyle;if("function"==typeof n){const o=n(t||{},e);if(o&&!o.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{stroke:t})}return o}const i=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var o,n;if(this.config.areaStyle){const o=this.config.areaStyle(t||{});if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const i=this.config.lineStyle;if("function"==typeof i){const o=i(t||{},e);if(o&&!o.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},o),{fill:t,stroke:o.stroke||t})}return o}const r=null===(o=this.config.themeSemantic)||void 0===o?void 0:o.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||r||"#4e79a7",fillOpacity:null!==(n=i.fillOpacity)&&void 0!==n?n:.7,stroke:i.stroke||r||"#4e79a7",strokeWidth:i.strokeWidth||2};const s=this.resolveGroupColor(e)||r||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const o=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||ve;if(0===o.length)return null;const n=o[this._groupColorCounter%o.length];if(this._groupColorCounter++,this._groupColorMap.set(e,n),this._groupColorMap.size>Ye.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)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)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)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)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,r}getBinBoundaries(){return this._binBoundaries}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._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,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){var t,o,n,i;const r=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let s=!1,a=!1;Object.assign(this.config,e);const l="chartType"in e&&e.chartType!==r.chartType||"runtimeMode"in e&&e.runtimeMode!==r.runtimeMode;if(l||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=l||!z(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(o=r.xAccessor)&&void 0!==o?o:r.timeAccessor),u=l||!z(null!==(n=e.yAccessor)&&void 0!==n?n:e.valueAccessor,null!==(i=r.yAccessor)&&void 0!==i?i:r.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=Y(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Y(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Y(this.config.xAccessor,"x"),this.getY=Y(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=ze(this.config)),s=!0,a=!0)}if("groupAccessor"in e&&!z(e.groupAccessor,r.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?q(this.config.groupAccessor):void 0,s=!0),"categoryAccessor"in e&&!z(e.categoryAccessor,r.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?q(this.config.categoryAccessor):void 0,s=!0),"sizeAccessor"in e&&!z(e.sizeAccessor,r.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Y(this.config.sizeAccessor,"size"):void 0,s=!0),"colorAccessor"in e&&!z(e.colorAccessor,r.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0,s=!0),"y0Accessor"in e&&!z(e.y0Accessor,r.y0Accessor)&&(this.getY0=this.config.y0Accessor?Y(this.config.y0Accessor,"y0"):void 0,s=!0,a=!0),("boundsAccessor"in e&&!z(e.boundsAccessor,r.boundsAccessor)||"band"in e&&e.band!==r.band||"boundsStyle"in e&&e.boundsStyle!==r.boundsStyle)&&(this.resolvedRibbons=ze(this.config),s=!0,a=!0),"pointIdAccessor"in e&&!z(e.pointIdAccessor,r.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?q(this.config.pointIdAccessor):void 0,s=!0),"candlestick"===this.config.chartType&&(l||"openAccessor"in e&&!z(e.openAccessor,r.openAccessor)||"closeAccessor"in e&&!z(e.closeAccessor,r.closeAccessor)||"highAccessor"in e&&!z(e.highAccessor,r.highAccessor)||"lowAccessor"in e&&!z(e.lowAccessor,r.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Y(this.config.openAccessor,"open"):void 0,this.getHigh=Y(this.config.highAccessor,"high"),this.getLow=Y(this.config.lowAccessor,"low"),this.getClose=t?Y(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,s=!0,a=!0}if(!s){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const o of t)if(e[o]!==r[o]){s=!0;break}}s&&(a&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function Ge(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:p.createElement(p.Fragment,null,...t)}function qe(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function Xe(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Ve(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ue(e,t){const o=Ve(e);if(!o)return!1;const n=Ve(t);return!n||o.getFullYear()!==n.getFullYear()||o.getMonth()!==n.getMonth()}function Qe(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Ke(e,t,o,n,i,r=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(n,i+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let g=null,f=1/0;return e.visit((e,i,l,p,y)=>{if(i>u||c>p||l>h||d>y)return!0;if(!e.length){let i=e;do{const e=i.data,l=r(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);Xe(a(e),n)>=u&&f>u&&(g=e,f=u),i=i.next}while(i)}return!1}),g?{node:g,distance:f}:null}Ye.GROUP_COLOR_MAP_CAP=1e3,Ye.QUADTREE_THRESHOLD=500;const Ze=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Je=new WeakMap;let et=0,tt=!1,ot=null,nt=null,it=null;function rt(e,t){var o,n;if(!t)return t;const i=Ze.exec(t);if(!i)return t;const r=e.canvas;if(!r)return(null===(o=i[2])||void 0===o?void 0:o.trim())||t;!function(){if(tt)return;if("undefined"==typeof window||"undefined"==typeof document)return;tt=!0;const e=()=>{et++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(ot=new MutationObserver(e),ot.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{nt=window.matchMedia("(prefers-color-scheme: dark)"),it=e,"function"==typeof nt.addEventListener?nt.addEventListener("change",it):"function"==typeof nt.addListener&&nt.addListener(it)}catch(e){}}();let s=Je.get(r);s&&s.version===et||(s={version:et,map:new Map},Je.set(r,s));const a=s.map.get(t);if(void 0!==a)return a;const l=getComputedStyle(r).getPropertyValue(i[1]).trim()||(null===(n=i[2])||void 0===n?void 0:n.trim())||t;return s.map.set(t,l),l}function st(e,t){const o=e.fillStyle,n="#010203";try{e.fillStyle=n,e.fillStyle=t}catch(t){return e.fillStyle=o,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=o,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===n&&t.trim().toLowerCase()!==n)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const r=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return r?[+r[1],+r[2],+r[3]]:[78,121,167]}function at(e){switch(e){case"monotoneX":return s.curveMonotoneX;case"monotoneY":return s.curveMonotoneY;case"cardinal":return s.curveCardinal;case"catmullRom":return s.curveCatmullRom;case"step":return s.curveStep;case"stepBefore":return s.curveStepBefore;case"stepAfter":return s.curveStepAfter;case"basis":return s.curveBasis;case"natural":return s.curveNatural;default:return null}}function lt(e,t,o){return null==t?o:"string"!=typeof t?t:rt(e,t)||o}function ct(e,t,o,n,i,r,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(n,i,r,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(n,i,r,s),[h,g,f]=st(e,o);return d.addColorStop(0,`rgba(${h},${g},${f},${c})`),d.addColorStop(1,`rgba(${h},${g},${f},${u})`),d}function ut(e,t,o,n,i,r){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,n,i,r);for(const e of s)a.addColorStop(e.offset,e.color);return a}const dt=new WeakMap;function ht(e,t){const o=at(t);if(!o)return e;const n=dt.get(e);if(n)return n;const i=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const n=[];let i=null;const r={moveTo(e,t){i=[e,t],n.push([e,t])},lineTo(e,t){i=[e,t],n.push([e,t])},bezierCurveTo(e,t,r,s,a,l){if(!i)return i=[a,l],void n.push([a,l]);const[c,u]=i;for(let i=1;o>=i;i++){const d=i/o,h=1-d;n.push([h*h*h*c+3*h*h*d*e+3*h*d*d*r+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}i=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,r){i=[o,r],n.push([o,r])}};return s.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(r)(e),n}(e,o);return dt.set(e,i),i}function gt(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Ke(i,t,o,n,r);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"point":if(i)break;e=pt(r,t,o,n);break;case"line":e=yt(r,t,o,n);break;case"rect":if(null==r.datum)break;e=vt(r,t,o);break;case"heatcell":e=bt(r,t,o);break;case"area":if(!1===r.interactive)break;e=kt(r,t,o);break;case"candlestick":e=xt(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function ft(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const n=wt(e,t);if(0>n)return null;if(Math.abs(e[n][0]-t)>o)return null;let i=n,r=n;n>0&&e[n][0]>=t?(i=n-1,r=n):e.length-1>n&&(i=n,r=n+1);const[s,a]=e[i],[l,c]=e[r];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function pt(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function yt(e,t,o,n=30){var i,r;if(0===e.path.length)return null;const s=wt(e.path,t);if(0>s)return null;const[a,l]=e.path[s];let c;if(e.path.length>1){let n=1/0;const i=Math.max(0,s-1),r=Math.min(e.path.length-2,s);for(let s=i;r>=s;s++){const[i,r]=e.path[s],[a,l]=e.path[s+1],c=mt(t,o,i,r,a,l);n>c&&(n=c)}c=n}else{const e=t-a,n=o-l;c=Math.sqrt(e*e+n*n)}const u=e.style,d=null!==(r=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==r?r:1;return c>Math.max(5,d/2+2,n)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:a,y:l,distance:c}}function mt(e,t,o,n,i,r){const s=i-o,a=r-n,l=s*s+a*a;if(0===l)return Math.sqrt(Math.pow(e-o,2)+Math.pow(t-n,2));let c=((e-o)*s+(t-n)*a)/l;c=Math.max(0,Math.min(1,c));const u=n+c*a;return Math.sqrt(Math.pow(e-(o+c*s),2)+Math.pow(t-u,2))}function vt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function bt(e,t,o){const n=qe(t,o,e);return n.hit?{node:e,datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}function xt(e,t,o){const n=e.bodyWidth/2,i=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=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,r=t-e.x,s=o-n;return{node:e,datum:e.datum,x:e.x,y:n,distance:Math.sqrt(r*r+s*s)}}return null}function kt(e,t,o){if(0===e.topPath.length)return null;const n=wt(e.topPath,t);if(0>n)return null;const[i,r]=e.topPath[n],s=t-i,a=o-r,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:r,distance:l}}function wt(e,t){if(0===e.length)return-1;let o=0,n=e.length-1;for(;n>o;){const i=o+n>>1;t>e[i][0]?o=i+1:n=i}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function At(e){var t,o;const n=new Map;for(const o of e){const e=null!==(t=o.group)&&void 0!==t?t:"_default";let i=n.get(e);i||(i=[],n.set(e,i)),i.push(o)}for(const e of n.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(n.keys()).sort((e,t)=>{const o=n.get(e),i=n.get(t);return(o.length>0?o[0].y:0)-(i.length>0?i[0].y:0)}),r=Array.from(n.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const s=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=null===(o=r[e].datum)||void 0===o?void 0:o.id;null!=t&&s.set(t+"",e)}return{flat:r,groups:i,byGroup:n,idToIdx:s}}function jt(e,t){var o,n;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[i];return{flatIndex:i,group:null!==(o=r.group)&&void 0!==o?o:"_default",indexInGroup:null!==(n=r._groupIndex)&&void 0!==n?n:0}}function St(e,t,o){const{group:n,indexInGroup:i}=t,r=o.byGroup.get(n);switch(e){case"ArrowRight":return r.length-1>i?r[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?r[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(n);return o.groups.length-1>e?Ot(o,o.groups[e+1],r[i]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(n);return e>0?Ot(o,o.groups[e-1],r[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function Ot(e,t,o){const n=e.byGroup.get(t);let i=0,r=Math.abs(n[0].x-o.x);for(let e=1;n.length>e;e++){const t=Math.abs(n[e].x-o.x);r>t&&(r=t,i=e)}return n[i]._flatIndex}function Mt(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function Ct(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function _t(e,o,n,i,r,s){t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{var t;const a=o.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=null!==(t=e.threshold)&&void 0!==t?t:5e3,u=l-a.lastIngestTime>c;u!==r&&(s(u),n.current=!0,i())},1e3);return()=>clearInterval(t)},[e,r,i])}function Pt({isStale:t,position:o}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===o?{top:4,left:4}:"bottom-left"===o?{bottom:4,left:4}:"bottom-right"===o?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const Lt={fill:(t,o)=>e.jsx("rect",{style:t,width:o,height:o}),line:(t,o)=>e.jsx("line",{style:t,x1:0,y1:0,x2:o,y2:o})};function Tt(e,t,o,n,i){let r;return r="function"==typeof o?o(e):(0,Lt[o])(n(e,t),i),r}function $t({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Rt(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const Nt=(t,o,n,i,r,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:g,items:f}=t,p=[];let y=0;const m=!(!o&&!n),v="isolate"===u||void 0===u&&null!=r,{swatchSize:b,labelGap:x,rowHeight:k}=d;return f.forEach((t,u)=>{const d=Tt(t,u,h,g,b),w=Rt(t,i,r),A=r&&r.size>0&&r.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${y})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===s&&u===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?A||!1:void 0,"aria-current":m&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+f.length)%f.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:m?e=>{c(l,u),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,A&&e.jsx($t,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k}),p};function Bt({config:t,orientation:o="vertical",width:n=100}){const{colorFn:i,domain:r,label:s,format:a}=t,l=a||(e=>Math.round(100*e)/100+""),c="grad-legend-"+p.useId();if("horizontal"===o){const t=12,o=Math.min(n,200),a=Math.max(0,(n-o)/2),u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[0]+o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),s&&e.jsx("text",{x:a+o/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("rect",{x:a,y:0,width:o,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])}),e.jsx("text",{x:a+o,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])})]})}const u=[];for(let t=0;64>=t;t++){const o=t/64;u.push(e.jsx("stop",{offset:100*o+"%",stopColor:i(r[1]-o*(r[1]-r[0]))},t))}return e.jsxs("g",{"aria-label":s||"Gradient legend",children:[s&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:s}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(r[0])})]})}function Et(t){const{legendGroups:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,legendInteraction:a,title:l="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:h}=t,g=function(e){var t,o,n,i,r;const s=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),a=Math.max(s,null!==(o=null==e?void 0:e.rowHeight)&&void 0!==o?o:22);return{swatchSize:s,labelGap:Math.max(0,null!==(n=null==e?void 0:e.labelGap)&&void 0!==n?n:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:a,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(r=null==e?void 0:e.align)&&void 0!==r?r:"start",maxWidth:null==e?void 0:e.maxWidth}}(h),[f,y]=p.useState(0),[m,v]=p.useState(0),b=p.useCallback((e,t)=>{y(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:o,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const g=[];return t.forEach((t,f)=>{h+=5,g.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:o,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,t.label&&(h+=16,g.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h+=8),g.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:Nt(t,n,i,r,s,a,l,f,c,u,d)},"legend-group-"+f)),h+=t.items.length*d.rowHeight+8}),g})({legendGroups:o||[],width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}):(({legendGroups:t,height:o,width:n,customClickBehavior:i,customHoverBehavior:r,highlightedCategory:s,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var g;let f=0;const p=[];t.forEach((t,o)=>{var g;let y=0;t.label&&(y+=16);const m=((t,o,n,i,r,s,a,l,c,u,d,h)=>{const{type:g="fill",styleFn:f,items:p}=t,y=[],{swatchSize:m,labelGap:v,itemGap:b,rowHeight:x,align:k}=d,w=!(!o&&!n),A="isolate"===u||void 0===u&&null!=r,j=p.map(e=>m+v+7*e.label.length),S=[];let O=0,M=0;j.forEach((e,t)=>{const o=0===M?e:M+b+e;h&&h>0&&M>0&&o>h?(S.push({start:O,end:t,width:M}),O=t,M=e):M=o}),p.length>0&&S.push({start:O,end:p.length,width:M}),S.forEach((t,u)=>{let d="center"===k?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===k?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=p[h],k=Tt(t,h,g,f,m),S=Rt(t,i,r),O=r&&r.size>0&&r.has(t.label);y.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:o?()=>o(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:w?l===s&&h===a?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&A?O||!1:void 0,"aria-current":w&&!A&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:w?e=>{var n;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o&&o(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(l,t);const o=null===(n=e.currentTarget.parentElement)||void 0===n?void 0:n.children[t];o instanceof SVGElement&&o.focus()}}:void 0,onFocus:w?e=>{c(l,h),n&&n(t);const o=e.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+v+2+7*t.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,O&&e.jsx($t,{swatchSize:m}),e.jsx("text",{y:m/2,x:m+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=j[h]+b}});const C=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:C,totalRows:_,totalHeight:_*x}})(t,i,r,s,a,l,c,o,u,d,h,null!==(g=h.maxWidth)&&void 0!==g?g:n);y+=m.offset+5,p.push(Object.assign(Object.assign({label:t.label},m),{offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight})),f+=y+12});const y=null!==(g=h.maxWidth)&&void 0!==g?g:n;let m=f>y?0:"center"===h.align?Math.max(0,(y-f)/2):"end"===h.align?Math.max(0,y-f):0;const v=[];return p.forEach((n,i)=>{const r=t[i];r.label&&(v.push(e.jsx("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+i)),m+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+i)),m+=n.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||o)+0+8},"legend-top-line legend-symbol-"+i)),m+=12}),e.jsx("g",{children:v})})({legendGroups:o||[],title:l,height:u,width:c,customClickBehavior:n,customHoverBehavior:i,highlightedCategory:r,isolatedCategories:s,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:a,metrics:g}),k=!(!n&&!i);return e.jsxs("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==a&&(void 0!==a||null==s))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}function Dt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function It(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Ht(t){var o;const{legend:n,totalWidth:i,totalHeight:r,margin:s,legendPosition:a="right",legendLayout:l,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendInteraction:f}=t;if(!n)return null;const p="top"===a||"bottom"===a,y=!!c,m=Math.max(1,p?null!==(o=null==l?void 0:l.maxWidth)&&void 0!==o?o:Math.max(0,i-s.left-s.right):100);let v,b;return"left"===a?(v=Math.max(4,s.left-m-10),b=s.top):"top"===a?(v=s.left,b=y?32:8):"bottom"===a?(v=s.left,b=r-s.bottom+38):(v=i-s.right+10,b=s.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:It(n)?e.jsx(Bt,{config:n.gradient,orientation:p?"horizontal":"vertical",width:m}):Dt(n)?e.jsx(Et,{legendGroups:n.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:l,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:g,legendInteraction:f}):n})}function Ft(e){return"string"==typeof e?{type:e}:e}function Wt({orient:o,config:n,values:i,scale:r,size:s,length:l}){const c=function(e){var t,o,n,i,r;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!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(r=e.strokeWidth)&&void 0!==r?r:1}}(n),u="top"===o||"bottom"===o,d=t.useMemo(()=>{if(0===i.length)return null;const t=r.domain(),n=s-8;if("boxplot"===c.type){const t=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)],i=t[Math.floor(.5*o)],r=t[Math.floor(.75*o)],s=r-n;return{q1:n,median:i,q3:r,whiskerLow:Math.max(t[0],n-1.5*s),whiskerHigh:Math.min(t[o-1],r+1.5*s)}}(i);if(!t)return null;const{q1:s,median:a,q3:l,whiskerLow:d,whiskerHigh:h}=t,g=Math.min(.5*n,20),f=(n-g)/2+4;if(u){const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="top"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:u,y1:m+y*(f+g/2),x2:p,y2:m+y*(f+g/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*f,x2:u,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+g),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,n),y:"top"===o?m-f-g:m+f,width:Math.abs(n-t),height:g,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===o?m-f-g:m+f,x2:i,y2:"top"===o?m-f:m+f+g,stroke:c.fill,strokeWidth:2})]})}{const t=r(s),n=r(l),i=r(a),u=r(d),p=r(h),y="left"===o?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+o,children:[e.jsx("line",{x1:m+y*(f+g/2),y1:u,x2:m+y*(f+g/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:u,x2:m+y*(f+g),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*f,y1:p,x2:m+y*(f+g),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===o?m-f-g:m+f,y:Math.min(t,n),width:g,height:Math.abs(n-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===o?m-f-g:m+f,y1:i,x2:"left"===o?m-f:m+f+g,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=a.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Math.max(...d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+o,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const s=t.length/h*n;if(u){const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:n,y:"top"===o?-4-s:4,width:Math.max(a,.5),height:s,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const n=r(t.x0),a=r(t.x1)-r(t.x0);return e.jsx("rect",{x:"left"===o?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=n/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const s=e.length/h*(n/2),a=r((e.x0+e.x1)/2);i.push(u?`${a},${"top"===o?-(t-s):t-s}`:`${"left"===o?-(t-s):t-s},${a}`)}for(let e=d.length-1;e>=0;e--){const s=d[e];if(null==s.x0||null==s.x1)continue;const a=s.length/h*(n/2),l=r((s.x0+s.x1)/2);i.push(u?`${l},${"top"===o?-(t+a):t+a}`:`${"left"===o?-(t+a):t+a},${l}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+o,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${s},${"top"===o?-i-4:i+4}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${s},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?r(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*n,s=r((e.x0+e.x1)/2);t.push(`L${"left"===o?-i-4:i+4},${s}`)}const s=null!=d[d.length-1].x1?r(d[d.length-1].x1):l;t.push(`L${e},${s}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+o,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,r,c,s,l,o,u,4]);return d?e.jsx("g",{className:"marginal-"+o,"data-testid":"marginal-"+o,children:d}):null}function zt(e,t=120,o=8){if(!e)return[];const n=Math.max(1,Math.floor(t/o)),i=e.split(/\s+/),r=[];let s="";for(const e of i)s&&s.length+1+e.length>n?(r.push(s),s=e):s=s?`${s} ${e}`:e;return s&&r.push(s),r}function Yt(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 Gt(t,o,n,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:r,title:s,orientation:a,align:l,wrap:c=120,noWrap:u}=t;if(!r&&!s)return e.jsx("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(o)>Math.abs(n)?"leftRight":"topBottom");let h=l;h&&"dynamic"!==h||(h="topBottom"===d?0>o?"right":"left":0>n?"bottom":"top");let g="start";"topBottom"===d?"right"===h?g="end":"middle"===h&&(g="middle"):g=0>o?"end":"start";const f=16,p=s?u?[s]:zt(s,c):[],y=r?u?[r]:zt(r,c):[],m="leftRight"===d?"end"===g?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:g,fontWeight:"bold",children:p.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-title")),v=p.length*f),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:g,y:v,children:y.map((t,o)=>e.jsx("tspan",{x:m,dy:0===o?0:f,children:t},o))},"annotation-note-label"));let k=null;if((s||r)&&(0!==o||0!==n))if("topBottom"===d){const t=Math.min(c,120);let o=0,n=t;"end"===g?(o=-t,n=0):"middle"===g&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:o,x2:n,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*f+(y.length>0?f:0);let o=0,n=t;"bottom"===h?(o=-t,n=0):"middle"===h&&(o=-t/2,n=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:o,y2:n,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*f;let A=0;return"topBottom"===d?A=0>n?-(w+2):18:"leftRight"===d&&(A="middle"===h?-(w+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${o},${n})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==A?`translate(0,${A})`:void 0,children:b}),k]})}function qt(t,o,n,i,r){var s;const a=[];switch(t){case"callout-circle":{const t=((null==o?void 0:o.radius)||0)+((null==o?void 0:o.radiusPadding)||0);t>0&&a.push(e.jsx("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==o?void 0:o.width)||0,i=(null==o?void 0:o.height)||0;(t>0||i>0)&&a.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==o?void 0:o.custom)&&a.push(...Array.isArray(o.custom)?o.custom:[o.custom]);break;case"xy-threshold":{const t=i||0,s=r||0;if(void 0!==(null==o?void 0:o.x)){const i=(o.x||0)-t;a.push(e.jsx("line",{x1:i,y1:(o.y1||0)-s,x2:i,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==o?void 0:o.y)){const i=(o.y||0)-s;a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:i,x2:(o.x2||0)-t,y2:i,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==o?void 0:o.x1)||void 0!==(null==o?void 0:o.x2)?a.push(e.jsx("line",{x1:(o.x1||0)-t,y1:0,x2:(o.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==o?void 0:o.y1)&&void 0===(null==o?void 0:o.y2)||a.push(e.jsx("line",{x1:0,y1:(o.y1||0)-s,x2:0,y2:(o.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(s=null==o?void 0:o.width)&&void 0!==s?s:null==o?void 0:o.height;void 0!==t&&a.push(e.jsx("path",{d:Yt((null==o?void 0:o.type)||"curly",t,(null==o?void 0:o.depth)||30,void 0===(null==o?void 0:o.width)),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:a})}function Xt(t,o,n,i,r,s){var a;const l=[];let c=0,u=0;if("callout-circle"!==r&&"label"!==r||!(null==s?void 0:s.radius)){if("callout-rect"===r&&s){const e=s.width||0,n=s.height||0;if(e>0||n>0){const i=e/2,r=n/2,s=t-i,a=o-r;if(0!==s||0!==a){const t=Math.abs(s),o=Math.abs(a),l=e/2,d=n/2,h=t*d>o*l?l/t:d/o;c=i+s*h,u=r+a*h}}}else if("bracket"===r&&s){const e=s.width,t=s.height,o=s.depth||30;void 0!==e?(c=e/2,u=o):void 0!==t&&(c=o,u=t/2)}}else{const e=(s.radius||0)+(s.radiusPadding||0);if(e>0&&(0!==t||0!==o)){const n=Math.atan2(o,t);c=Math.cos(n)*e,u=Math.sin(n)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(o-u,2));if(d>.5){const r=i||"var(--semiotic-text-secondary, currentColor)",s="curve"===(null==n?void 0:n.type);let h=Math.atan2(o-u,t-c);if(s){const i=(null!==(a=null==n?void 0:n.curve)&&void 0!==a?a:.25)*d,s=(c+t)/2+-(o-u)/d*i,g=(u+o)/2+(t-c)/d*i;l.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${s},${g} ${t},${o}`,fill:"none",stroke:r},"connector-line")),h=Math.atan2(g-u,s-c)}else l.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:o,stroke:r},"connector-line"));if("arrow"===(null==n?void 0:n.end)){const t=10,o=16/180*Math.PI;l.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+o)},${u+t*Math.sin(h+o)}L${c+t*Math.cos(h-o)},${u+t*Math.sin(h-o)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:l})}function Vt(t){var o,n;const{x:i=0,y:r=0,dx:s,dy:a,nx:l,ny:c,note:u,connector:d,subject:h,type:g,color:f,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=t,k=Array.isArray(i)?null!==(o=i[0])&&void 0!==o?o:0:i,w=Array.isArray(r)?null!==(n=r[0])&&void 0!==n?n:0:r,A=new Set(Array.isArray(y)?y:[]);let j=s||0,S=a||0;null!=l&&(j=l-k),null!=c&&(S=c-w);const O="string"==typeof g?g:"label";if("bracket"===O&&h&&0===j&&0===S)if(void 0!==h.width){j=h.width/2;const e=h.depth||30;S=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;j=e+(0>e?-5:5),S=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${k},${w})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!A.has("connector")&&Xt(j,S,d,f,O,h),!A.has("subject")&&qt(O,h,f,k,w),!A.has("note")&&Gt(u,j,S,f)]}))}function Ut(t){var o,n;const{noteData:i}=t,{screenCoordinates:r}=i,s="string"==typeof i.type?i.type:"label",a=i.eventListeners||i.events||{};if(i.coordinates&&r){const t=i.nx||r[0][0]+(null!==(o=i.dx)&&void 0!==o?o:0),a=i.ny||r[0][1]+(null!==(n=i.dy)&&void 0!==n?n:0),l=r.map((o,n)=>{const r=Object.assign({},i,{note:0===n?i.note:{label:""},x:o[0],y:o[1],nx:t,ny:a});return e.jsx(Vt,Object.assign({"data-testid":"semiotic-annotation"},r,{type:s}),"multi-annotation-"+n)});return e.jsx("g",{children:l})}const l=i.note||{title:"none",label:i.label},c=`${l.label}-${l.title}-${i.i}`;return e.jsx(Vt,Object.assign({"data-testid":"semiotic-annotation",events:a},i,{type:s}),c)}function Qt(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.x)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function Kt(e,t){var o,n,i;const r=null!==(n=null===(o=t.scales)||void 0===o?void 0:o.y)&&void 0!==n?n:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function Zt(e){return null==e?null:e+""}function Jt(e,t,o){var n;return null===(n=t.stickyPositionCache)||void 0===n||n.set(e,o),o}function eo(e,t,o){var n,i;const r=e.anchor||(null===(n=e.lifecycle)||void 0===n?void 0:n.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let n=o.pointNodes.length-1;n>=0;n--){const i=o.pointNodes[n];if(i.pointId===e.pointId)return Jt(t,o,{x:i.x,y:i.y})}const n=function(e){var t,o,n,i,r,s;const a=e.data;if(!a||0===a.length)return null;const l=a[a.length-1],c=null!==(o=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==o?o:null===(n=e.scales)||void 0===n?void 0:n.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(s=e.scales)||void 0===s?void 0:s.value;if(!c||!u)return null;const d=l[e.xAccessor||"x"],h=l[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(o);return n?Jt(t,o,n):null}if("semantic"===r){const n=function(e,t,o){var n,i;const r=function(e){var t,o;return Zt(null!==(o=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==o?o:e.stableId)}(e);if(!r)return null;const s=null===(n=o.pointNodes)||void 0===n?void 0:n.find(e=>Zt(e.pointId)===r);if(s)return Jt(t,o,{x:s.x,y:s.y});const a=null===(i=o.data)||void 0===i?void 0:i.find(e=>function(e){var t,o,n;return Zt(null!==(o=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==o?o:null===(n=e.provenance)||void 0===n?void 0:n.stableId)}(e)===r);if(!a)return null;const l=Qt(a,o),c=Kt(a,o);return null==l||null==c?null:Jt(t,o,{x:l,y:c})}(e,t,o);if(n)return n}let s=null,a=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,a=t.y)}if(null!=s&&null!=a||(s=Qt(e,o),a=Kt(e,o)),null!=s&&null!=a)return Jt(t,o,{x:s,y:a});if("sticky"===r){const e=null===(i=o.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function to(e,t,o,n=50){return!(-n>e||e>(o.width||0)+n||-n>t||t>(o.height||0)+n)}const oo={secondary:0,primary:3},no=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function io(e){return!0===(null==e?void 0:e._annotationDeferred)}function ro(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function so(e){var t;const o=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof o&&Number.isFinite(o)?Math.max(0,Math.min(1,o)):null}function ao(e){return Math.max(.72,.95-.06*e)}function lo(t){const o=t.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===(null==o?void 0:o.emphasis)||"secondary"===(null==o?void 0:o.emphasis)?o.emphasis:null),confidence:so(e.annotation),readingOrder:null,rank:1};var o}),n=o.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>io(e.annotation)),r=t.some(e=>null!=ro(e.annotation)),s=t.some(e=>"layer"===ro(e.annotation));if(!n&&!i&&!r)return t.map(e=>e.node);const a=o.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var o,n;return(null!==(o=t.confidence)&&void 0!==o?o:0)-(null!==(n=e.confidence)&&void 0!==n?n:0)||e.i-t.i});a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of o)e.emphasis&&(e.rank=oo[e.emphasis]);const l=o.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:o,i:n,emphasis:i,readingOrder:r}=t,s=io(o.annotation);let a=o.node;if("primary"===i||"secondary"===i||null!=r){const t=null==i&&null!=r;a=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:ao(r),"data-annotation-reading-order":r}:{},{children:o.node}),"annotation-emphasis-"+n)}const l=ro(o.annotation);return l&&(a=e.jsx("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+n)),s&&(a=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return i&&l.unshift(e.jsx("style",{children:no},"annotation-disclosure-style")),s&&l.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}const co={linear:s.curveLinear,monotoneX:s.curveMonotoneX,monotoneY:s.curveMonotoneY,step:s.curveStep,stepAfter:s.curveStepAfter,stepBefore:s.curveStepBefore,basis:s.curveBasis,cardinal:s.curveCardinal,catmullRom:s.curveCatmullRom};function uo(e,t,o,n){const i=[];return e.forEach((e,r)=>{let s;if(o){const i=o(e,r,n);s=null!=i?i:t(e,r,n)}else s=t(e,r,n);s&&i.push({node:s,annotation:e})}),lo(i)}function ho(t){return function(t,o,n){var i,r,a,c,u,d,h,g,f,m,v,b,x,k,w,A,j,S,O,M,C,_,P,L,T,$,R,N,B,E,D,I,H,F,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,oe,ne,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const s=eo(t,o,n);if(!s)return null;const{x:l,y:c}=s;if(!to(l,c,n))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(Ut,{noteData:Object.assign(Object.assign({x:l,y:c,dx:null!==(r=t.dx)&&void 0!==r?r:30,dy:null!==(a=t.dy)&&void 0!==a?a:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+o)}case"x-threshold":{const i=Qt(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"top";let a;return a="bottom"===s?(n.height||0)-4:"center"===s?(n.height||0)/2:12,e.jsxs("g",{children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:n.height||0,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:i+4,y:a,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"y-threshold":{const i=Kt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,n);if(null==i)return null;const r=t.color||"#f97316",s=t.labelPosition||"right";let a,l;return"left"===s?(a=4,l="start"):"center"===s?(a=(n.width||0)/2,l="middle"):(a=(n.width||0)-4,l="end"),e.jsxs("g",{children:[e.jsx("line",{x1:0,y1:i,x2:n.width||0,y2:i,stroke:r,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:a,y:i-4,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",children:t.label})]},"ann-"+o)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Qt(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=l.packEnclose(i),s=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:r.x,cy:r.y,r:r.r+s,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:r.x,y:r.y-r.r-s-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Qt(Object.assign(Object.assign({},e),{type:"point"}),n),y:Kt(Object.assign(Object.assign({},e),{type:"point"}),n)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const r=t.padding||10,s=i.map(e=>e.x),a=i.map(e=>e.y),l=Math.min(...s)-r,c=Math.max(...s)+r,u=Math.min(...a)-r,d=Math.max(...a)+r;return e.jsxs("g",{children:[e.jsx("rect",{x:l,y:u,width:c-l,height:d-u,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(l+c)/2,y:u-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+o)}case"highlight":{const i=n.data||[],r="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],s={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:r.map((o,i)=>{const r=Qt(o,n),a=Kt(o,n);if(null==r||null==a)return null;const l="function"==typeof t.r?t.r(o):t.r||6,c="function"==typeof t.style?t.style(o):t.style||s;return e.jsx("circle",Object.assign({cx:r,cy:a,r:l},c),"hl-"+i)})},"ann-"+o)}case"bracket":{const i=Qt(t,n),r=Kt(t,n);return e.jsx(Ut,{noteData:{x:null!=i?i:0,y:null!=r?r:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a="ordinal"===n.frameType,l="horizontal"===n.projection,p=a?r:null,v=a?s:null;let b;const x=[],k=new Map;if(a&&p&&v){for(const e of i){const t=e[p];if(null==t)continue;const o=t+"";k.has(o)||(k.set(o,x.length),x.push(o))}b=i.map(e=>{const t=e[p],o=e[v];if(null==t||null==o)return null;const n=k.get(t+"");return null!=n?[n,+o]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(u=null===(c=n.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=n.scales)||void 0===d?void 0:d.time,A=null!==(g=null===(h=n.scales)||void 0===h?void 0:h.y)&&void 0!==g?g:null===(f=n.scales)||void 0===f?void 0:f.value;if(!w||!A)return null;const j=e=>t=>{const o=Math.max(0,Math.floor(t)),n=Math.min(x.length-1,o+1),i=t-o,r=e(x[o]);return r+(e(x[n])-r)*i},S=w,O=A;let M;if(a)if(l){const e=j(O);M=(t,o)=>[S(o),e(t)]}else{const e=j(S);M=(t,o)=>[e(t),O(o)]}else M=(e,t)=>[S(e),O(t)];const C=t.method||"linear";let _;_="loess"===C?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const n=e.slice().sort((e,t)=>e[0]-t[0]),i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=i[e],n=i.map(e=>Math.abs(e-t)),l=n.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:n[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,g=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*r[e],g+=t*i[e]*i[e],f+=t*i[e]*r[e])}if(0===u){a.push([t,r[e]]);continue}const p=u*g-d*d;if(1e-12>Math.abs(p))a.push([t,h/u]);else{const e=(u*f-d*h)/p;a.push([t,(h-e*d)/u+e*t])}}return a}(b,null!==(m=t.bandwidth)&&void 0!==m?m:.3):("polynomial"===C?y.default.polynomial(b,{order:t.order||2}):y.default.linear(b)).points;const P=_.map(([e,t])=>{const[o,n]=M(e,t);return`${o},${n}`}).join(" "),L=t.color||"#6366f1",T=_[_.length-1],[$,R]=M(T[0],T[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:$+4,y:R-4,fill:L,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const i=null!==(b=null===(v=n.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=n.scales)||void 0===x?void 0:x.value,r=null!==(k=null==i?void 0:i(t.y0))&&void 0!==k?k:0,s=null!==(w=null==i?void 0:i(t.y1))&&void 0!==w?w:n.height||0;return e.jsxs("g",{children:[e.jsx("rect",{x:0,y:Math.min(r,s),width:n.width||0,height:Math.abs(s-r),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(r,s)-4,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,children:t.label})]},"ann-"+o)}case"envelope":{const i=n.data||[];if(2>i.length)return null;const r=n.xAccessor||"x",a=null!==(j=null===(A=n.scales)||void 0===A?void 0:A.x)&&void 0!==j?j:null===(S=n.scales)||void 0===S?void 0:S.time,l=null!==(M=null===(O=n.scales)||void 0===O?void 0:O.y)&&void 0!==M?M:null===(C=n.scales)||void 0===C?void 0:C.value;if(!a||!l)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[r]-t[r]);if(2>h.length)return null;const g=co[n.curve||"linear"]||s.curveLinear,f=s.area().x(e=>a(e[r])).y0(e=>l(e[u])).y1(e=>l(e[c])).curve(g)(h);if(!f)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:f,fill:p,fillOpacity:null!==(_=t.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:a(h[h.length-1][r])+4,y:l(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const i=n.data||[];if(2>i.length)return null;const r=n.yAccessor||"y",s=null!==(L=null===(P=n.scales)||void 0===P?void 0:P.x)&&void 0!==L?L:null===(T=n.scales)||void 0===T?void 0:T.time,a=null!==(R=null===($=n.scales)||void 0===$?void 0:$.y)&&void 0!==R?R:null===(N=n.scales)||void 0===N?void 0:N.value;if(!s||!a)return null;const l=i.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const c=l.reduce((e,t)=>e+t,0)/l.length,u=l.reduce((e,t)=>e+Math.pow(t-c,2),0)/l.length,d=Math.sqrt(u),h=null!==(B=t.threshold)&&void 0!==B?B:2,g=c-h*d,f=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(E=t.fillOpacity)&&void 0!==E?E:.1,m=t.anomalyColor||"#ef4444",v=null!==(D=t.anomalyRadius)&&void 0!==D?D:6,b=a(c+h*d),x=a(g),k=i.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[f&&e.jsx("rect",{x:0,y:Math.min(b,x),width:n.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,o)=>{const i=Qt(t,n),r=Kt(t,n);return null==i||null==r?null:e.jsx("circle",{cx:i,cy:r,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+o)}),t.label&&e.jsx("text",{x:(n.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const i=n.data||[];if(3>i.length)return null;const r=n.xAccessor||"x",s=n.yAccessor||"y",a=null!==(H=null===(I=n.scales)||void 0===I?void 0:I.x)&&void 0!==H?H:null===(F=n.scales)||void 0===F?void 0:F.time,l=null!==(z=null===(W=n.scales)||void 0===W?void 0:W.y)&&void 0!==z?z:null===(Y=n.scales)||void 0===Y?void 0:Y.value;if(!a||!l)return null;const c=i.map(e=>[e[r],e[s]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=y.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,o,n)=>e+o*Math.pow(t,n),0)}else{const e=c.length;let t=0,o=0,n=0,i=0;for(const[e,r]of c)t+=e,o+=r,n+=e*e,i+=e*r;const r=e*n-t*t;if(1e-12>Math.abs(r))return null;const s=(e*i-t*o)/r,a=(o-s*t)/e;u=e=>a+s*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),f=c.reduce((e,t)=>e+t[0],0)/d,p=c.reduce((e,t)=>e+Math.pow(t[0]-f,2),0),m=null!==(G=t.confidence)&&void 0!==G?G:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(q=t.steps)&&void 0!==q?q:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const A=[];for(const e of w){const t=u(e),o=g*Math.sqrt(1+1/d+(p>0?Math.pow(e-f,2)/p:0))*v;A.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const j=`M${A.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${A.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,S=A.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),O=`${a(x)},${l(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:j,fill:t.fill||"#6366f1",fillOpacity:null!==(X=t.fillOpacity)&&void 0!==X?X:.15,stroke:"none"}),e.jsx("polyline",{points:`${O} ${S}`,fill:"none",stroke:M,strokeWidth:null!==(V=t.strokeWidth)&&void 0!==V?V:2,strokeDasharray:null!==(U=t.strokeDasharray)&&void 0!==U?U:"6,3"}),t.label&&A.length>0&&e.jsx("text",{x:a(A[A.length-1].x)+4,y:l(A[A.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let i=null,r=null;if(null!=t.px&&null!=t.py)i=t.px,r=t.py;else{const e=eo(t,o,n);if(!e)return null;i=e.x,r=e.y}if(null==i||null==r)return null;if(!to(i,r,n))return null;const s=null!==(Q=t.dx)&&void 0!==Q?Q:0,a=null!==(K=t.dy)&&void 0!==K?K:0,l=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+s-l/2,y:r+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+o)}case"text":{const i=eo(t,o,n);if(!i)return null;const{x:r,y:s}=i,a=r+(t.dx||0),l=s+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:a,y:l,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?p.cloneElement(u,{key:"ann-text-"+o}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:r,y1:s,x2:a,y2:l,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),p.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const i=t.category;if(null==i)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,s=null===(te=n.scales)||void 0===te?void 0:te.o,a=null===(oe=n.scales)||void 0===oe?void 0:oe.x,l=null===(ne=n.scales)||void 0===ne?void 0:ne.y,c=r(s)?s:r(a)?a:r(l)?l:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",g=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,f=t.label;return e.jsxs("g",(n.projection?"vertical"===n.projection:c===a)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:n.height||0,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]}:{children:[e.jsx("rect",{x:0,y:u,width:n.width||0,height:d,fill:h,fillOpacity:g}),f&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:f})]},"ann-"+o)}default:return null}}}const go=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function fo(e){return!!e&&"object"==typeof e&&go.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function po(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function yo(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function mo(e){var t,o;let n;const i=null==e?void 0:e.emphasis;n="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(n+=15*function(e){return Math.max(0,Math.min(1,e))}(r)),null===(o=null==e?void 0:e.lifecycle)||void 0===o?void 0:o.freshness){case"fresh":n+=8;break;case"aging":n+=4;break;case"stale":n+=1;break;case"expired":n-=200}return n}new Set(["label","callout","callout-circle","callout-rect"]);const vo=32,bo=6,xo=4,ko=8,wo=72;const Ao={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function jo(e){return fo(e)}function So(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),n=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of n)r&&r.length+e.length+1>o?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function Oo(e,t,o,n,i){const r=e+o,s=t+n;return Math.abs(o)>Math.abs(n)?{x:0>o?r-i.width-4:r+4,y:0>n?s-i.height:s,width:i.width,height:i.height}:{x:0>o?r-i.width:r,y:0>n?s-i.height-4:s+4,width:i.width,height:i.height}}function Mo(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Co(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function _o(e,t,o,n,i,r,s,a){const l=Mo(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,n){const i=Math.max(0,n-e.x),r=Math.max(0,n-e.y);return(i+Math.max(0,e.x+e.width-(t-n)))*e.height+(r+Math.max(0,e.y+e.height-(o-n)))*e.width}(l,i,r,a);for(const e of o)c+=12*Co(l,e);for(const e of n)c+=4*Co(l,e);return c}function Po(e){var t;const{annotations:o,context:n,defaultOffset:i=vo,notePadding:r=bo,markPadding:s=xo,edgePadding:a=ko,preserveManualOffsets:l=!0,routeLongConnectors:c=!0,connectorThreshold:u=wo,density:d,progressiveDisclosure:h=!1,redundantCues:g=!1,responsive:f,cohesion:p,audience:y}=e,m=n.width||0,v=n.height||0;if(0===o.length||0>=m||0>=v)return o.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(n,s);let k=!1;const w=o.map((e,t)=>{if(!jo(e))return e;const o=function(e,t,o){var n,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(n=e.pointId)&&void 0!==n?n:e.nodeId;if(null!=r&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const s=e.coordinates,a=null===(i=o.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(s)&&s.length>=2&&a){const e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){const o=a([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?eo(e,t,o):{x:e.x,y:e.y}}(e,t,n);if(!o)return e;const s=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...So("string"==typeof e.title?e.title:void 0,t),...So("string"==typeof e.label?e.label:void 0,t)],n=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*n)+10),height:Math.max(18,16*o.length+6)}}(e);if(l&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(Mo(Oo(o.x,o.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,s),r)),e}var d;let h=null,g=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=_o(Oo(o.x,o.y,e.dx,e.dy,s),e,b,x,m,v,r,a);g>t&&(h=e,g=t)}if(!h)return e;const f=Mo(Oo(o.x,o.y,h.dx,h.dy,s),r);b.push(f);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return k=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),A=k?w:o.slice();let j=A;if(g){let e=!1;const t=A.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return o!==t&&(e=!0),o});j=e?t:A}{let e=!1;const t=j.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const o=function(e){var t;const o=null==e?void 0:e.provenance;if(!o||"object"!=typeof o)return e;const n="string"==typeof o.source?null!==(t=Ao[o.source])&&void 0!==t?t:o.source:null,i="number"==typeof o.confidence&&Number.isFinite(o.confidence)?Math.round(100*Math.max(0,Math.min(1,o.confidence)))+"%":null;if(!n&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,i].filter(Boolean).join(" · "),s="string"==typeof e.label?e.label:"";return s.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:s?`${s} (${r})`:`(${r})`})}(t);return o!==t&&(e=!0),o});j=e?t:j}const S=new Set;if(d){const e="object"==typeof d?d:{},o=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(y),n=1===o?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:yo(m,v,e))*o))}),{deferred:i}=function(e){var t;const{annotations:o,width:n,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),s=yo(n,i,e),a=o.map((e,t)=>{return{annotation:e,index:t,note:(o=e,fo(o))};var o}),l=a.filter(e=>e.note);if(0===l.length||s>=l.length)return{visible:o.slice(),deferred:[],budget:s};const c=l.filter(e=>po(e.annotation)),u=l.filter(e=>!po(e.annotation)).sort((e,t)=>mo(t.annotation)-mo(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,s-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),g=[],f=[];for(const{annotation:e,index:t,note:o}of a)!o||h.has(t)?g.push(e):f.push(e);return{visible:g,deferred:f,budget:s}}(Object.assign({annotations:j,width:m,height:v},n));for(const e of i)S.add(e)}if(f&&("object"==typeof f&&"number"==typeof f.minWidth?f.minWidth:480)>=m)for(const e of j)jo(e)&&"secondary"===e.emphasis&&S.add(e);if(S.size>0)for(const e of j)!0===(null==e?void 0:e.defensive)&&S.delete(e);let O;return O=0===S.size?j:h?j.map(e=>S.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):j.filter(e=>!S.has(e)),p?function(e,t){let o=!1;const n=e.map(e=>jo(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return o?n:e}(O,p):O}let Lo={positions:new Map};const To=new Set;function $o(){for(const e of To)e()}function Ro(e,t){const o=Lo.positions.get(e);if(null==o?void 0:o.locked)return;if(!o||o.sourceId!==t)return;const n=new Map(Lo.positions);n.delete(e),Lo={positions:n},$o()}function No(e,t){const o=Lo.positions.get(e);if(!(null==o?void 0:o.locked))return;if(t&&o.sourceId!==t)return;const n=new Map(Lo.positions);n.delete(e),Lo={positions:n},$o()}function Bo(){return Lo}function Eo(e){return To.add(e),()=>To.delete(e)}const Do={positions:new Map};function Io(){return()=>{}}function Ho(){return Do}function Fo(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),n=o[0],i=o[o.length-1],r=n instanceof Date,s=n instanceof Date?n.getTime():n,a=i instanceof Date?i.getTime():i;if(2>t||s===a)return r?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=r?new Date(o):o}return c}(e,t):e.ticks(t)}function Wo(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function zo(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function Yo(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const n of e)t>n.pixel&&(t=n.pixel),n.pixel>o&&(o=n.pixel);return{min:t,max:o}}function Go(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function qo(e,t,o){if("left"===e||"right"===e){const n="left"===e?o:0,i="left"===e?-1:1,r=Math.ceil(t/8);let s="M0,"+n;for(let e=0;r>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${n+4*i}`,s+=`L${Math.min(o,t)},${n}`}return s}{const n="bottom"===e?0:t,i="bottom"===e?1:-1,r=Math.ceil(o/8);let s=`M${n},0`;for(let e=0;r>e;e++){const t=8*(e+1);s+=`L${n+4*i},${Math.min(8*e+4,o)}`,s+=`L${n},${Math.min(t,o)}`}return s}}function Xo(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:g,axisExtent:f}=o,p=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==o?void 0:o.tickFormat)||h||Vo,r=Math.max(2,Math.floor(n/70)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,a=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Fo(l.x,"exact"===f?Math.max(2,s):Math.min(s,r),f),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:l.x(e),label:i(e,t,c)})),g=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Uo(d,Math.max(55,g+8))},[l,u,h,n,f]),y=t.useMemo(()=>{var e,t;if(!l)return[];const o=null==u?void 0:u.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||g||Vo,r=Math.max(2,Math.floor(i/30)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;return Uo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Fo(l.y,"exact"===f?Math.max(2,s):Math.min(s,r),f)).map(e=>({value:e,pixel:l.y(e),label:n(e)})),22)},[l,u,g,i,f]),m=d&&l,v=c&&l;if(!m&&!v)return null;const b=null==u?void 0:u.find(e=>"bottom"===e.orient),x=null==u?void 0:u.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),A=(null==b?void 0:b.jaggedBase)||!1,j=(null==x?void 0:x.jaggedBase)||!1,S="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:r,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&(()=>{var t,o;const r=Go(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),s=Go(null===(o=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"xgrid-"+o)),y.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:n,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"ygrid-"+o))]})})(),k&&!A&&e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:S,strokeWidth:1}),A&&e.jsx("path",{d:qo("bottom",n,i),fill:"none",stroke:S,strokeWidth:1}),w&&!j&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:S,strokeWidth:1}),j&&e.jsx("path",{d:qo("left",n,i),fill:"none",stroke:S,strokeWidth:1})]})})}function Vo(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Uo(e,t){if(2>=e.length)return e;const o=[e[0]];for(let n=1;e.length-1>n;n++)t>Math.abs(e[n].pixel-o[o.length-1].pixel)||o.push(e[n]);const n=e[e.length-1];return t>Math.abs(n.pixel-o[o.length-1].pixel)?o[o.length-1]=n:o.push(n),o}function Qo(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,axes:h,xLabel:g,yLabel:f,yLabelRight:p,xFormat:y,yFormat:m,axisExtent:v,showGrid:b,title:x,legend:k,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:j,legendIsolatedCategories:S,legendPosition:O="right",legendLayout:M,foregroundGraphics:C,marginalGraphics:_,xValues:P,yValues:L,annotations:T,autoPlaceAnnotations:$,svgAnnotationRules:R,xAccessor:N,yAccessor:B,annotationData:E,pointNodes:D,curve:I,underlayRendered:H,canvasObscuresUnderlay:F=!0,linkedCrosshairName:W,linkedCrosshairSourceId:z,children:Y}=o,G=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=(null==o?void 0:o.tickFormat)||y||Vo,i=Math.max(2,Math.floor(r/70)),s=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5,a=null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Fo(u.x,"exact"===v?Math.max(2,s):Math.min(s,i),v),l=a.map(e=>e.valueOf()),c=a.map((e,t)=>({value:e,pixel:u.x(e),label:n(e,t,l)})),g=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),f=(null==o?void 0:o.autoRotate)?Math.max(20,Math.min(g+8,55)):Math.max(55,g+8);let p=Uo(c,f);if(p.length>1&&(p=p.filter((e,t)=>0===t||e.label+""!=p[t-1].label+"")),(null==o?void 0:o.includeMax)&&p.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.x.domain()[1],t=u.x(e),o=p[p.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e,p.length,l);f>t-o&&p.length>1&&(p=p.slice(0,-1)),p.push({value:e,pixel:t,label:i})}}return p},[d,u,h,y,r,v]),q=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"left"===e.orient),n=(null==o?void 0:o.tickFormat)||m||Vo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=null==o?void 0:o.ticks)&&void 0!==e?e:5;let a=Uo((null!==(t=null==o?void 0:o.tickValues)&&void 0!==t?t:Fo(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22);if(a.length>1&&(a=a.filter((e,t)=>0===t||e.label+""!=a[t-1].label+"")),(null==o?void 0:o.includeMax)&&a.length>0&&"exact"!==v&&!(null==o?void 0:o.tickValues)){const e=u.y.domain()[1],t=u.y(e),o=a[a.length-1].pixel;if(Math.abs(t-o)>1){const i=n(e);22>Math.abs(t-o)&&a.length>1&&(a=a.slice(0,-1)),a.push({value:e,pixel:t,label:i})}}return a},[d,u,h,m,s,v]),X=t.useMemo(()=>{var e,t;if(!d||!u)return[];const o=null==h?void 0:h.find(e=>"right"===e.orient);if(!o)return[];const n=o.tickFormat||m||Vo,i=Math.max(2,Math.floor(s/30)),r=null!==(e=o.ticks)&&void 0!==e?e:5;return Uo((null!==(t=o.tickValues)&&void 0!==t?t:Fo(u.y,"exact"===v?Math.max(2,r):Math.min(r,i),v)).map(e=>({value:e,pixel:u.y(e),label:n(e)})),22)},[d,u,h,m,s,v]),V=t.useRef(new Map),U=t.useRef(null!==(n=null==T?void 0:T.length)&&void 0!==n?n:0),Q=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;U.current!==Q&&(U.current=Q,V.current=new Map);const K=t.useMemo(()=>{if(!T||0===T.length)return null;const e=ho(),t={scales:u?{x:u.x,y:u.y,time:u.x,value:u.y}:null,timeAxis:"x",xAccessor:N,yAccessor:B,width:r,height:s,data:E,frameType:"xy",pointNodes:D,curve:I,stickyPositionCache:V.current};return uo($?Po(Object.assign({annotations:T,context:t},"object"==typeof $?$:{})):T,e,R,t)},[T,$,R,r,s,N,B,E,u,D,I]),Z=function(e){var o;const n=t.useSyncExternalStore(e?Eo:Io,e?Bo:Ho,e?Bo:Ho);return e&&null!==(o=n.positions.get(e))&&void 0!==o?o:null}(W);return t.useEffect(()=>{if(!(null==Z?void 0:Z.locked)||!W)return;const e=e=>{"Escape"===e.key&&No(W)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==Z?void 0:Z.locked,W]),d||x||k||C||_||K&&K.length>0||b||Y||Z?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof x?x:"XY Chart"}),e.jsx("desc",{children:"string"==typeof x?x+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[b&&u&&(!H||F)&&(()=>{var t,o;const n=Go(null===(t=null==h?void 0:h.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Go(null===(o=null==h?void 0:h.find(e=>"left"===e.orient))||void 0===o?void 0:o.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[G.map((t,o)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:s,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:n},"xgrid-"+o)),q.map((t,o)=>e.jsx("line",{x1:0,y1:t.pixel,x2:r,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+o))]})})(),d&&u&&(()=>{const t=null==h?void 0:h.find(e=>"left"===e.orient),o=null==h?void 0:h.find(e=>"bottom"===e.orient),n=!t||!1!==t.baseline,i=!o||!1!==o.baseline,a=(null==t?void 0:t.jaggedBase)||!1,l=(null==o?void 0:o.jaggedBase)||!1,u=null==o?void 0:o.landmarkTicks,d=null==t?void 0:t.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",v="var(--semiotic-text, #333)",b=!!(null==o?void 0:o.autoRotate)&&G.length>1&&(()=>{const e=r/Math.max(G.length-1,1);return G.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=null==o?void 0:o.tickAnchor,j=null==t?void 0:t.tickAnchor,S=Yo(G),O=Yo(q);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||F)&&i&&!l&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:y,strokeWidth:1}),(!H||F)&&l&&e.jsx("path",{d:qo("bottom",r,s),fill:"none",stroke:y,strokeWidth:1}),G.map((t,o)=>{const n=!!u&&("function"==typeof u?u(t.value,o):Ue(t.value,o>0?G[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:b?10:18,textAnchor:b?"end":Wo(A,t.pixel===S.min,t.pixel===S.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),transform:b?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+o)}),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:v,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||F)&&n&&!a&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:y,strokeWidth:1}),(!H||F)&&a&&e.jsx("path",{d:qo("left",r,s),fill:"none",stroke:y,strokeWidth:1}),q.map((t,o)=>{const n=!!d&&("function"==typeof d?d(t.value,o):Ue(t.value,o>0?q[o-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:zo(j,t.pixel===O.min,t.pixel===O.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},n?k:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+o)}),(()=>{const o=(null==t?void 0:t.label)||f;return o?e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:o}):null})()]}),(()=>{const t=null==h?void 0:h.find(e=>"right"===e.orient);if(!t||0===X.length)return null;const o=!1!==t.baseline,n=t.landmarkTicks,i=t.label||p,a=t.tickAnchor,l=Yo(X);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&e.jsx("line",{x1:r,y1:0,x2:r,y2:s,stroke:y,strokeWidth:1}),X.map((t,o)=>{const i=!!n&&("function"==typeof n?n(t.value,o):Ue(t.value,o>0?X[o-1].value:void 0));return e.jsxs("g",{transform:`translate(${r},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:zo(a,t.pixel===l.min,t.pixel===l.max),fontWeight:i?600:400,fill:m,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+o)}),i&&e.jsx("text",{x:r+c.right-15,y:s/2,textAnchor:"middle",fill:v,transform:`rotate(90, ${r+c.right-15}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:i})]})})()]})})(),K,_&&u&&P&&L&&e.jsxs(e.Fragment,{children:[_.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Wt,{orient:"top",config:Ft(_.top),values:P,scale:u.x,size:c.top,length:r})}),_.bottom&&e.jsx("g",{transform:`translate(0, ${s})`,children:e.jsx(Wt,{orient:"bottom",config:Ft(_.bottom),values:P,scale:u.x,size:c.bottom,length:r})}),_.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Wt,{orient:"left",config:Ft(_.left),values:L,scale:u.y,size:c.left,length:s})}),_.right&&e.jsx("g",{transform:`translate(${r}, 0)`,children:e.jsx(Wt,{orient:"right",config:Ft(_.right),values:L,scale:u.y,size:c.right,length:s})})]}),C,Z&&Z.sourceId!==z&&(null==u?void 0:u.x)&&(()=>{const t=u.x(Z.xValue);if(null==t||0>t||t>r)return null;const o=Z.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),Y]}),x&&e.jsx("text",{x:a/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof x?x:null}),Ht({legend:k,totalWidth:a,totalHeight:l,margin:c,legendPosition:O,title:x,legendLayout:M,legendHoverBehavior:w,legendClickBehavior:A,legendHighlightedCategory:j,legendIsolatedCategories:S})]}):null}function Ko(e){var t,o,n,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(o=e.tr)&&void 0!==o?o:0)>0||(null!==(n=e.br)&&void 0!==n?n:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function Zo(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,n=e=>Math.max(0,Math.min(null!=e?e:0,o));return{tl:n(t.tl),tr:n(t.tr),br:n(t.br),bl:n(t.bl)}}const Jo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function en(e){var t,o;const{innerRadius:n,outerRadius:i,startAngle:r,endAngle:s}=e,a=0>=n;if(0>=(null!==(t=e.cornerRadius)&&void 0!==t?t:0)||!e.roundStart&&!e.roundEnd){if(a){const e=Jo(i,r),t=Jo(i,s);return`M0,0 L${e.x},${e.y} A${i},${i} 0 ${s-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=Jo(i,r),t=Jo(i,s),o=Jo(n,s),l=Jo(n,r),c=s-r>Math.PI?1:0;return`M${e.x},${e.y} A${i},${i} 0 ${c} 1 ${t.x},${t.y} L${o.x},${o.y} A${n},${n} 0 ${c} 0 ${l.x},${l.y} Z`}const l=Math.max(0,Math.min(null!==(o=e.cornerRadius)&&void 0!==o?o:0,(i-n)/2));if(0===l)return en(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const c=Math.asin(Math.min(1,l/Math.max(1e-9,i-l))),u=a?0:Math.asin(Math.min(1,l/Math.max(1e-9,n+l))),d=s-r,h=e.roundStart&&e.roundEnd?d/2:d,g=!!e.roundStart&&h>c,f=!!e.roundEnd&&h>c;if(!g&&!f)return en(Object.assign(Object.assign({},e),{cornerRadius:0,roundStart:!1,roundEnd:!1}));const p=r+(g?c:0),y=s-(f?c:0),m=r+(g?u:0),v=s-(f?u:0),b=Jo(i,p),x=Jo(i,y),k=(i-l)*Math.cos(c),w=Jo(k,r),A=Jo(k,s),j=a?null:Jo(n,v),S=a?null:Jo(n,m),O=a?0:(n+l)*Math.cos(u),M=a?null:Jo(O,r),C=a?null:Jo(O,s),_=y-p>Math.PI?1:0,P=a?0:v-m>Math.PI?1:0;let L="";if(g)L+=`M${w.x},${w.y}`,L+=` A${l},${l} 0 0 1 ${b.x},${b.y}`;else{const e=Jo(i,r);L+=`M${e.x},${e.y}`}if(f)L+=` A${i},${i} 0 ${_} 1 ${x.x},${x.y}`,L+=` A${l},${l} 0 0 1 ${A.x},${A.y}`;else{const e=Jo(i,s);L+=` A${i},${i} 0 ${_} 1 ${e.x},${e.y}`}if(a)L+=" L0,0";else{if(f)L+=` L${C.x},${C.y}`,L+=` A${l},${l} 0 0 1 ${j.x},${j.y}`;else{const e=Jo(n,s);L+=` L${e.x},${e.y}`}if(g)L+=` A${n},${n} 0 ${P} 0 ${S.x},${S.y}`,L+=` A${l},${l} 0 0 1 ${M.x},${M.y}`;else{const e=Jo(n,r);L+=` A${n},${n} 0 ${P} 0 ${e.x},${e.y}`}}return L+=" Z",L}function tn(e){const t=en({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],n=e.colors;if(n.length>0){const t=(e.endAngle-e.startAngle)/n.length;for(let i=0;n.length>i;i++)o.push({d:en({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+i*t,endAngle:e.endAngle}),color:n[i]})}return{clipPath:t,slices:o}}const on={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function nn(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function rn(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}const sn="undefined"==typeof window||"undefined"==typeof document,an="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function ln(){const[e,o]=t.useState(!1);return an(()=>{o(!0)},[]),e}const cn=()=>()=>{},un=()=>!1,dn=()=>!0;function hn(){const e=t.useSyncExternalStore(cn,un,dn);return t.useRef(e).current}function gn(e){const{hydrated:o,wasHydratingFromSSR:n,storeRef:i,dirtyRef:r,renderFnRef:s,cleanup:a}=e;an(()=>{var e,t;o&&n&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),r.current=!0,s.current()},[o,n]);const l=t.useRef(a);l.current=a,t.useEffect(()=>()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.call(l)},[])}function fn(e){const o=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return yn(e,t);if(!mn(e)||!mn(t))return!1;const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;const o=e[n],i=t[n];if(!Object.is(o,i))if(Array.isArray(o)&&Array.isArray(i)){if(!yn(o,i))return!1}else{if(!mn(o)||!mn(i))return!1;if(!pn(o,i))return!1}}return!0}(o.current,e)||(o.current=e),o.current}function pn(e,t){const o=Object.keys(e);if(o.length!==Object.keys(t).length)return!1;for(const n of o){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;if(!Object.is(e[n],t[n]))return!1}return!0}function yn(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function mn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const vn=p.createContext(null);function bn({children:t}){const[o,n]=p.useState(!1),i=p.useMemo(()=>({visible:o,setVisible:n}),[o]);return e.jsx(vn.Provider,{value:i,children:t})}function xn(){return p.useContext(vn)}const kn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function wn(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const n=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},r=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=r.indexOf(e),n=r.indexOf(t);return(-1===o?999:o)-(-1===n?999:n)});for(const e of s)n.push(`${o[e]} ${i[e]||e}`);return`${t}, ${n.join(", ")}`}function An(e,t,o){const n=[];return e>0&&n.push(e+" nodes"),t>0&&n.push(t+" edges"),0===n.length?o+", empty":`${o}, ${n.join(", ")}`}const jn=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function Sn(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,n]of Object.entries(e))o.startsWith("_")||null!=n&&""!==n&&("number"==typeof n?Number.isFinite(n)&&(t[o]=n):"string"==typeof n?t[o]=n:"boolean"==typeof n?t[o]=n+"":n instanceof Date&&(t[o]=n.toISOString().slice(0,10)));return t}const On="semiotic-accessible-data-table",Mn=On+" semiotic-accessible-data-table-hidden",Cn=On+" semiotic-accessible-data-table-visible",_n=Cn+" semiotic-accessible-data-table-network",Pn={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ln={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Tn={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},$n={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Rn={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Nn={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Bn={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},En={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Dn({scene:t,chartType:o,tableId:n,chartTitle:i}){var r;const[s,a]=p.useState(!1),[l,c]=p.useState(5),u=xn(),d=null!==(r=null==u?void 0:u.visible)&&void 0!==r&&r,h=s||d,g=p.useRef(null),f=i?"Data summary for "+i:n?`Data summary for ${o} ${n}`:"Data summary for "+o;p.useEffect(()=>{h||c(5)},[h]);const y=p.useCallback(e=>{e.target===e.currentTarget&&(s||d||a(!0))},[s,d]),m=p.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||a(!1)},[d]);if(!t||0===t.length)return n?e.jsx("span",{id:n,tabIndex:-1,style:kn}):null;if(!h)return e.jsx("div",{id:n,className:Mn,tabIndex:-1,onFocus:y,style:kn,role:"region","aria-label":f,children:e.jsxs("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:Sn(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const o of e)v.push({label:t,values:Sn(o)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},r=null!==(o=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==o?o:"",s=null!==(i=null!==(n=e.value)&&void 0!==n?n:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:r,value:null!=s?s:""}});break}case"heatcell":{const e=Sn(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(l=null!==(s=null===(r=x.datum)||void 0===r?void 0:r.category)&&void 0!==s?s:null===(a=x.datum)||void 0===a?void 0:a.label)&&void 0!==l?l:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:Sn(x.datum)});break;case"arc":v.push({label:"Arc",values:Sn(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:Sn(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(g=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==g?g:null===(f=x.datum)||void 0===f?void 0:f.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const n of t){const t=[],i=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[n];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],r=0;for(const o of t)e>o&&(e=o),o>i&&(i=o),r+=o;o.push({name:n,count:t.length,numeric:!0,min:e,max:i,mean:r/t.length})}else if(i.size>0){const e=Array.from(i);o.push({name:n,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(v),x=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${jn(e.min)} to ${jn(e.max)}, mean ${jn(e.mean)}.`);else{const t=e.uniqueValues,n=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${n}.`)}return o.join(" ")}(v.length,b),k=Math.min(l,v.length),w=v.slice(0,k),A=v.length-k,j=new Set;for(const e of w)for(const t of Object.keys(e.values))j.add(t);const S=Array.from(j);return e.jsxs("div",{ref:g,id:n,className:Cn,tabIndex:-1,onBlur:m,style:Pn,role:"region","aria-label":f,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ln,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+o,style:$n,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Bn,children:A>0?`First ${k} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:Rn,children:"type"}),S.map(t=>e.jsx("th",{style:Rn,children:t},t))]})}),e.jsx("tbody",{children:w.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:Nn,children:t.label}),S.map(o=>{return e.jsx("td",{style:Nn,children:(n=t.values[o],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":jn(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},o);var n})]},o))})]}),A>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:En,children:["Show ",Math.min(25,A)," more"," ",1===A?"row":"rows"," (",A," remaining)"]})]})}function In({nodes:t,edges:o,chartType:n,tableId:i,chartTitle:r}){var s,a,l,c,u,d,h,g,f,y,m,v,b,x;const[k,w]=p.useState(!1),[A,j]=p.useState(5),S=xn(),O=null!==(s=null==S?void 0:S.visible)&&void 0!==s&&s,M=k||O,C=r?"Data summary for "+r:i?`Data summary for ${n} ${i}`:"Data summary for "+n,_=p.useRef(null);p.useEffect(()=>{M||j(5)},[M]);const P=p.useCallback(e=>{e.target===e.currentTarget&&(k||O||w(!0))},[k,O]),L=p.useCallback(e=>{var t;O||(null===(t=_.current)||void 0===t?void 0:t.contains(e.relatedTarget))||w(!1)},[O]);if(!t||0===t.length)return i?e.jsx("span",{id:i,tabIndex:-1,style:kn}):null;if(!M)return e.jsx("div",{id:i,className:Mn,tabIndex:-1,onFocus:P,style:kn,role:"region","aria-label":C,children:e.jsxs("button",{type:"button",onClick:()=>w(!0),children:["View data summary (",t.length," nodes, ",o.length," edges)"]})});const T=Array.isArray(t)?t:[],$=Array.isArray(o)?o:[],R=new Map,N=new Map,B=new Map,E=new Map;for(const e of $){if(!e||"object"!=typeof e)continue;const t=null!==(a=e.datum)&&void 0!==a?a:e,o="object"==typeof t.source?null===(l=t.source)||void 0===l?void 0:l.id:t.source,n="object"==typeof t.target?null===(c=t.target)||void 0===c?void 0:c.id:t.target,i="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";N.set(e,(null!==(u=N.get(e))&&void 0!==u?u:0)+1),E.set(e,(null!==(d=E.get(e))&&void 0!==d?d:0)+i)}if(null!=n&&""!==n){const e=n+"";R.set(e,(null!==(h=R.get(e))&&void 0!==h?h:0)+1),B.set(e,(null!==(g=B.get(e))&&void 0!==g?g:0)+i)}}const D=[];for(let e=0;T.length>e;e++){const t=T[e];if(!t||"object"!=typeof t)continue;const o=null!==(y=null===(f=t.datum)||void 0===f?void 0:f.id)&&void 0!==y?y:t.id,n=null!=o?o+"":"node-"+e,i=null!==(m=R.get(n))&&void 0!==m?m:0,r=null!==(v=N.get(n))&&void 0!==v?v:0,s=null!==(b=B.get(n))&&void 0!==b?b:0,a=null!==(x=E.get(n))&&void 0!==x?x:0;D.push({id:n,degree:i+r,inDeg:i,outDeg:r,wDegree:s+a,wInDeg:s,wOutDeg:a})}D.sort((e,t)=>t.degree-e.degree);let I=0,H=0;if(D.length>0){let e=0;for(const t of D)e+=t.degree,t.degree>H&&(H=t.degree);I=e/D.length}const F=$.some(e=>{var t;const o=null!==(t=null==e?void 0:e.datum)&&void 0!==t?t:e;return"number"==typeof(null==o?void 0:o.value)&&Number.isFinite(o.value)}),W=[`${D.length} nodes, ${$.length} edges.`];D.length>0&&W.push(`Mean degree: ${jn(I)}, max degree: ${H}.`);const z=Math.min(A,D.length),Y=D.slice(0,z),G=D.length-z;return e.jsxs("div",{ref:_,id:i,className:_n,tabIndex:-1,onBlur:L,style:Pn,role:"region","aria-label":C,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{O&&S&&S.setVisible(!1),w(!1)},"aria-label":"Close data summary",style:Tn,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ln,children:W.join(" ")}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:$n,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:Bn,children:G>0?`Top ${z} of ${D.length} nodes by degree`:`All ${D.length} nodes by degree`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:Rn,children:"id"}),e.jsx("th",{style:Rn,children:"degree"}),e.jsx("th",{style:Rn,children:"in"}),e.jsx("th",{style:Rn,children:"out"}),F&&e.jsx("th",{style:Rn,children:"w. degree"}),F&&e.jsx("th",{style:Rn,children:"w. in"}),F&&e.jsx("th",{style:Rn,children:"w. out"})]})}),e.jsx("tbody",{children:Y.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:Nn,children:t.id}),e.jsx("td",{style:Nn,children:t.degree}),e.jsx("td",{style:Nn,children:t.inDeg}),e.jsx("td",{style:Nn,children:t.outDeg}),F&&e.jsx("td",{style:Nn,children:jn(t.wDegree)}),F&&e.jsx("td",{style:Nn,children:jn(t.wInDeg)}),F&&e.jsx("td",{style:Nn,children:jn(t.wOutDeg)})]},o))})]}),G>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>j(e=>e+25),style:En,children:["Show ",Math.min(25,G)," more"," ",1===G?"node":"nodes"," (",G," remaining)"]})]})}function Hn({summary:t}){return t?e.jsx("div",{role:"note",style:kn,children:t}):null}function Fn({tableId:t}){return e.jsx("a",{href:"#"+t,style:kn,onClick:e=>{e.preventDefault();const o=document.getElementById(t);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,kn)},children:"Skip to data table"})}function Wn({hoverPoint:t}){let o="";if(t){const e=t.data||t;o="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:kn,children:o})}const zn="var(--semiotic-focus, #005fcc)";function Yn({active:t,hoverPoint:o,margin:n,size:i,shape:r="circle",width:s,height:a}){if(!t||!o)return null;const l=o.x+n.left,c=o.y+n.top;let u;if("rect"===r&&null!=s&&null!=a){const t=Math.max(s,4),o=Math.max(a,4);u=e.jsx("rect",{x:l-t/2-3,y:c-o/2-3,width:t+6,height:o+6,rx:3,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:zn,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:zn,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function Gn(e){return Array.isArray(e)?e[0]:e}function qn(e,t,o,n){return Object.assign({data:Gn(e),x:t,y:o,__semioticHoverData:!0},n)}const Xn={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Vn(e,t){return"function"==typeof t?t(e):e[t]}function Un(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return 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 Qn(t={}){const{fields:o,title:n,format:i,style:r={},className:s=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let a;const l=[];if(n){const e=Vn(t,n);a=Un(e,i)}if(o&&o.length>0)o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=Vn(t,n);l.push({label:o,value:Un(s,r)})});else if(!n){const e=["value","y","name","id","label"];for(const o of e)if(void 0!==t[o]){a=Un(t[o],i);break}if(!a){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(a=Un(t[e[0]],i))}}const c=Object.assign(Object.assign({},Xn),r);return e.jsxs("div",{className:("semiotic-tooltip "+s).trim(),style:c,children:[a&&e.jsx("div",{style:{fontWeight:l.length>0?"bold":"normal"},children:a}),l.map((t,o)=>e.jsxs("div",{style:{marginTop:0===o&&a?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},o))]})}}function Kn(){return t=>{var o,n,i,r,s,a,l;const c=t.allSeries;if(!c||0===c.length){const r=null!==(n=null===(o=t.data)||void 0===o?void 0:o.value)&&void 0!==n?n:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:Xn,children:e.jsx("div",{children:Un(r)})})}const u=null!==(a=null!==(r=t.xValue)&&void 0!==r?r:null===(s=t.data)||void 0===s?void 0:s.time)&&void 0!==a?a:null===(l=t.data)||void 0===l?void 0:l.x;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Un(u)}),c.map((t,o)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Un(t.value)})]},o))]})}}function Zn(t){if(!0!==t){if("function"==typeof t){const o=t;return t=>{var n;const i=Gn(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(n=t.data)&&void 0!==n?n:{}:t),r=o(i);return null==r?null:e.jsx("div",{className:"semiotic-tooltip",style:Xn,children:r})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?Qn(t):Qn())}}function Jn({x:t,y:o,containerWidth:n,containerHeight:i,margin:r,children:s,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(o),u=p.useRef(null),[d,h]=p.useState(null);p.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();h(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[s,a,n,i]);let g;g=d?`translate(${d.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-o?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*i>o?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!p.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if("string"==typeof o.className&&o.className.trim().length>0)return!0;const n=o.style;if(n&&"object"==typeof n){if(null!=n.background&&""!==n.background)return!0;if(null!=n.backgroundColor&&""!==n.backgroundColor)return!0}return!1}(s),y=f?null:Xn;return c?e.jsx("div",{ref:u,className:f?a:(a+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:r.left+t,top:r.top+o,transform:g,pointerEvents:"none",zIndex:l,width:"max-content"}),children:s}):null}function ei(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}function ti(e,o,n){const i=t.useRef(null),[r,s]=t.useState(null);return t.useEffect(()=>{if(!o&&!n)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;s(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return t.observe(e),()=>t.disconnect()},[o,n]),[i,[o&&r?r.w:e[0],n&&r?r.h:e[1]]]}const oi="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function ni(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function ii(e){const o=function(){const[e,o]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return o(e.matches),ei(e,e=>o(e.matches))},[]),e}(),n=t.useRef(o);n.current=o;const[i,r]=ti(e.sizeProp,e.responsiveWidth,e.responsiveHeight),s=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),a=r[0]-s.left-s.right,l=r[1]-s.top-s.bottom,c=ni(e.foregroundGraphics,r,s),u=ni(e.backgroundGraphics,r,s),d=$(e=>e.theme),{transition:h,introEnabled:g}=function(e,t){var o,n;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(o=window.matchMedia)||void 0===o?void 0:o.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(n=e.duration)&&void 0!==n?n:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),f="semiotic-table-"+p.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),A=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),j=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(A))},[A]),S=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const O=e.themeDirtyRef;return oi(()=>{O&&(et++,O.current=!0,v())},[d,v,O]),{reducedMotion:o,reducedMotionRef:n,responsiveRef:i,size:r,margin:s,adjustedWidth:a,adjustedHeight:l,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:h,introEnabled:g,tableId:f,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:j,onPointerLeave:S}}function ri(e,t,o,n){const i=e.getContext("2d");if(!i)return null;const r=t[0]*n,s=t[1]*n,a=t[0]+"px",l=t[1]+"px";return e.style.width!==a&&(e.style.width=a),e.style.height!==l&&(e.style.height=l),e.width===r&&e.height===s||(e.width=r,e.height=s),i.setTransform(n,0,0,n,0,0),i.translate(o.left,o.top),i}function si(){return"undefined"!=typeof window&&window.devicePixelRatio||1}function ai(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}function li(e,t,o,n,i,r){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],n=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+n*n))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=n,e.lineCap=r;for(let o=0;t.length-1>o;o++){const n=(s[o]+s[o+1])/2;let r=i;l>n&&(r*=n/l),l>a-n&&(r*=(a-n)/l),e.globalAlpha=Math.max(0,r),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}const ci=(e,t,o,n)=>{var i,r;const a=t.filter(e=>"line"===e.type);for(const l of a){if(2>l.path.length)continue;const c=l._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,n.width*c,n.height),e.clip());const u=l.style.stroke||"#007bff",d=rt(e,u)||u,h=l.style.strokeWidth||2,g=l.colorThresholds,f=l.rawValues;if(e.setLineDash(l.style.strokeDasharray?l.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=l.style.opacity&&(e.globalAlpha=l.style.opacity),e.lineWidth=h,e.lineCap=l.style.strokeLinecap||"butt",l.style._edgeFade){const v=null!==(i=l.style.opacity)&&void 0!==i?i:1;li(e,l.path,d,h,v,l.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=at(l.curve),y=g&&g.length>0&&f&&f.length===l.path.length,m=l._decayOpacities;if(m&&m.length===l.path.length&&!y){e.strokeStyle=d;const b=null!==(r=l.style.opacity)&&void 0!==r?r:1;for(let x=0;l.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(l.path[x][0],l.path[x][1]),e.lineTo(l.path[x+1][0],l.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,A=null,j=null,S=!1;function O(t,o,n){e.beginPath(),e.strokeStyle=t,e.moveTo(o,n),S=!0}function M(){S&&(e.stroke(),S=!1)}for(let C=0;l.path.length>C;C++){const[_,P]=l.path[C],L=f[C],T=ai(L,g,d);if(null!==k&&null!==j&&null!==A){if(T===j)e.lineTo(_,P);else{const $=[];for(const R of g){const N=R.value;(A>N||N>L)&&(N>A||L>N)||A===N||L===N||$.push({t:(N-A)/(L-A)})}$.sort((e,t)=>e.t-t.t);for(const B of $){const E=k+(_-k)*B.t,D=w+(P-w)*B.t,I=ai(A+(L-A)*Math.min(B.t+1e-4,1),g,d);e.lineTo(E,D),M(),O(I,E,D)}e.lineTo(_,P)}k=_,w=P,A=L,j=T}else O(T,_,P),k=_,w=P,A=L,j=T}M()}else{e.beginPath();const H=l.strokeGradient&&l.path.length>=2?ut(e,l.strokeGradient,l.path[0][0],0,l.path[l.path.length-1][0],0):null;if(e.strokeStyle=H||d,p)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[F,W]=l.path[0];e.moveTo(F,W);for(let z=1;l.path.length>z;z++)e.lineTo(l.path[z][0],l.path[z][1])}e.stroke()}if(l.style.fill&&l.style.fillOpacity&&l.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=l.style.fillOpacity,e.fillStyle=lt(e,l.style.fill,l.style.fill),p&&!y)s.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(l.path);else{const[G,q]=l.path[0];e.moveTo(G,q);for(let X=1;l.path.length>X;X++)e.lineTo(l.path[X][0],l.path[X][1])}const Y=l.path[0][0];e.lineTo(l.path[l.path.length-1][0],n.height),e.lineTo(Y,n.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ui(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function di(e,t,o=.3){ui(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function hi(e,t,o=.6){var n,i,r,s,a;if(!ui(t))return;const l=null!==(n=t._pulseGlowRadius)&&void 0!==n?n:4,c=t.r+l*t._pulseIntensity,u=null!==(r=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==r?r:0,d=null!==(a=null!==(s=t.cy)&&void 0!==s?s:t.y)&&void 0!==a?a:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function gi(e,t,o,n=.35){ui(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function fi(e,t){const o=at(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){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]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const n=s.area().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),n(t.topPath)}}const pi=(e,t,o,n)=>{var i,r,a;const l=t.filter(e=>"area"===e.type);for(const t of l){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const l=t._introClipFraction;void 0!==l&&1>l&&(e.save(),e.beginPath(),e.rect(0,0,n.width*l,n.height),e.clip());const c=lt(e,t.style.fill,"#4e79a7"),u=t._decayOpacities;if(u&&u.length===t.topPath.length){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(u[n]+u[n+1])*o,e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.lineTo(t.bottomPath[n+1][0],t.bottomPath[n+1][1]),e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const d=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(fi(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let n=-1/0;for(const e of t.bottomPath)e[1]>n&&(n=e[1]);const i=ct(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,o,0,n);e.fillStyle=i||c,e.globalAlpha=d}else{const o=null!==(a=t.style.fillOpacity)&&void 0!==a?a:.7;e.globalAlpha=o*d,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(fi(e,t),gi(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const o=t.strokeGradient&&t.topPath.length>=2?ut(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const n=at(t.curve);if(e.beginPath(),n)s.line().x(e=>e[0]).y(e=>e[1]).curve(n).context(e)(t.topPath);else{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()}void 0!==l&&1>l&&e.restore(),o&&e.restore(),e.globalAlpha=1}},yi=(e,t,o,n)=>{var i;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{for(const t of r){e.beginPath(),e.arc(t.x,t.y,t.r,0,2*Math.PI);const o=null!==(i=t.style.opacity)&&void 0!==i?i:t.style.fillOpacity;null!=o&&(e.globalAlpha=o),e.fillStyle=lt(e,t.style.fill,"#4e79a7"),e.fill(),t.style.stroke&&(e.strokeStyle=lt(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth||1,e.stroke()),hi(e,t),e.globalAlpha=1}}finally{e.restore()}}};function mi(e,t){const{x:o,y:n,w:i,h:r}=t,{tl:s,tr:a,br:l,bl:c}=Zo(t);e.beginPath(),e.moveTo(o+s,n),e.lineTo(o+i-a,n),a>0&&e.arcTo(o+i,n,o+i,n+a,a),e.lineTo(o+i,n+r-l),l>0&&e.arcTo(o+i,n+r,o+i-l,n+r,l),e.lineTo(o+c,n+r),c>0&&e.arcTo(o,n+r,o,n+r-c,c),e.lineTo(o,n+s),s>0&&e.arcTo(o,n,o+s,n,s),e.closePath()}function vi(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const bi=(e,t,o,n)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)xi(e,t);else if(t.cornerRadii&&Ko(t.cornerRadii)){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=vi(t),i=t.fillGradient&&"string"==typeof o?ct(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,mi(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=vi(t),i=t.fillGradient&&"string"==typeof o?ct(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o;const r=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+r,a),e.arcTo(s,a,s,a+r,r),e.lineTo(s,a+c-r),e.arcTo(s,a+c,s+r,a+c,r),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-r),e.arcTo(s+l,a+c,s+l-r,a+c,r),e.lineTo(s+r,a+c),e.arcTo(s,a+c,s,a+c-r,r);break;default:e.moveTo(s,a+c),e.lineTo(s,a+r),e.arcTo(s,a,s+r,a,r),e.lineTo(s+l-r,a),e.arcTo(s+l,a,s+l,a+r,r),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=lt(e,t.style.fill,rt(e,"var(--semiotic-primary, #007bff)")),n=vi(t),i=t.fillGradient&&"string"==typeof o?ct(e,t.fillGradient,o,n.x0,n.y0,n.x1,n.y1):null;e.fillStyle=i||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}di(e,t),e.globalAlpha=1}};function xi(e,t){const o=t.style.icon,n=t.style.iconPadding||2,i=Math.min(t.w,t.h)-n;if(0>=i)return;const r=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),r){const r=i+n,s=t.x+(t.w-i)/2;for(let n=t.y+t.h-i;n>=t.y-i;n-=r)e.drawImage(o,s,n,i,i)}else{const r=i+n,s=t.y+(t.h-i)/2;for(let n=t.x;t.x+t.w>n;n+=r)e.drawImage(o,n,s,i,i)}e.restore()}function ki(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>128?"#000":"#fff"}function wi(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const Ai=(e,t,o,n)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const o=t.style;if(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=rt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),di(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):wi(t.value),n=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,r=t.y+t.h/2;e.fillStyle=ki(t.fill),e.font=n+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,i,r)}}}finally{e.restore()}},ji=(e,t,o,n)=>{var i,r,s;for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const a=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(s=null===(r=t.style)||void 0===r?void 0:r.opacity)&&void 0!==s?s:1);1!==a&&(e.globalAlpha=a);const l=rt(e,t.wickColor)||t.wickColor,c=60>n.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=l,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*n.height));e.fillStyle=l,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),n=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,r=rt(e,i)||i;e.fillStyle=r,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1)),e.strokeStyle=r,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(n,1))}c&&d(),e.restore()}};function Si(e,t){if(!t)return[];const o=new Set,n=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const r=e+"";o.has(r)||(o.add(r),n.push(r))}return n}function Oi(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function Mi(e,t,o,n){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:{key:void 0,fn:null}}function Ci(e,t,o){return n=>{if(!n||!o||!e.fn&&!t.fn)return n;let i=!1;const r=n.map(o=>{const n=e.fn&&e.key&&!(e.key in o),r=t.fn&&t.key&&!(t.key in o);if(!n&&!r)return o;i=!0;const s=Object.assign({},o);return n&&(s[e.key]=e.fn(o)),r&&(s[t.key]=t.fn(o)),s});return i?r:n}}const _i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Pi(e){const t=e[1]-e[0],o=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:o>t?e=>{const t=new Date(e);return`${_i[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*o>t?e=>{const t=new Date(e);return`${_i[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const Li={line:[pi,ci,yi],area:[pi,yi],stackedarea:[pi,yi],scatter:[yi],bubble:[yi],heatmap:[Ai],bar:[bi],swarm:[yi],waterfall:[(e,t,o,n)=>{var i;bi(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const s=r[0].datum,a=null==s?void 0:s._connectorStroke;if(a){e.save(),e.strokeStyle=rt(e,a)||a,e.lineWidth=null!==(i=null==s?void 0:s._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const n=r[t],i=r[t+1],s=n.datum,a=i.datum;if(null==(null==s?void 0:s.cumEnd)||null==(null==a?void 0:a.baseline))continue;const l=o.y(s.cumEnd),c=n.x+n.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[ji],mixed:[pi,ci,yi],custom:[pi,bi,Ai,ci,yi,ji]},Ti={top:20,right:20,bottom:30,left:40},$i={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",primary:"#007bff"};function Ri(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],n=o[2],i=o[3];return`#${e}${e}${n}${n}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const n=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return n?`rgba(${n[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}const Ni={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 Bi({hover:t}){var o,n,i;const r=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",s=null!==(o=t.data)&&void 0!==o?o:{},a=null!==(n=s.y)&&void 0!==n?n:s.value,l=null!==(i=s.x)&&void 0!==i?i:s.time;return e.jsxs("div",{className:"semiotic-tooltip",style:Ni,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:r(a)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:r(l)})]})}Bi.ownsChrome=!0;const Ei=t.forwardRef(function(o,n){var i,r,s,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:x,data:A,chunkThreshold:j,chunkSize:O,xAccessor:M,yAccessor:C,colorAccessor:_,sizeAccessor:P,groupAccessor:L,lineDataAccessor:T,curve:$,normalize:R,baseline:N,stackOrder:B,binSize:E,valueAccessor:D,arrowOfTime:I="right",windowMode:H="sliding",windowSize:F=200,timeAccessor:W,xExtent:z,yExtent:Y,extentPadding:G=.1,scalePadding:q,sizeRange:X,size:V=[500,300],responsiveWidth:U,responsiveHeight:Q,margin:K,className:Z,background:J,lineStyle:ee,pointStyle:te,areaStyle:oe,barStyle:ne,waterfallStyle:ie,swarmStyle:re,barColors:se,colorScheme:ae,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:he,lineGradient:ge,areaGroups:fe,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,showAxes:xe=!0,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:je,xFormat:Se,yFormat:Oe,axisExtent:Me,tickFormatTime:Ce,tickFormatValue:_e,hoverAnnotation:Pe,tooltipContent:Le,customHoverBehavior:Te,customClickBehavior:$e,enableHover:Re,hoverRadius:Ne=30,tooltipMode:Ee,annotations:De,autoPlaceAnnotations:Ie,svgAnnotationRules:He,showGrid:Fe,legend:We,legendHoverBehavior:ze,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,legendCategoryAccessor:Ke,onCategoriesChange:Ze,backgroundGraphics:Je,foregroundGraphics:et,canvasPreRenderers:tt,svgPreRenderers:ot,title:nt,categoryAccessor:it,brush:st,onBrush:at,decay:lt,pulse:ct,transition:ut,animate:dt,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,marginalGraphics:kt,pointIdAccessor:Ot,xScaleType:Mt,yScaleType:Lt,accessibleTable:Tt=!0,description:$t,summary:Rt,linkedCrosshairName:Nt,linkedCrosshairSourceId:Bt,customLayout:Et,layoutConfig:Dt}=o,It=t.useId().replace(/:/g,""),Ht=t.useRef(!1),Ft=ii({sizeProp:V,responsiveWidth:U,responsiveHeight:Q,userMargin:K,marginDefault:Ti,animate:dt,transitionProp:ut,themeDirtyRef:Ht}),Wt=ln(),zt=hn(),{reducedMotionRef:Yt,responsiveRef:Gt,size:qt,currentTheme:Xt,transition:Vt,introEnabled:Ut,tableId:Qt,rafRef:Kt,renderFnRef:Zt,scheduleRender:Jt}=Ft;let eo=Ft.margin;if(kt){const e=60,t=Object.assign({},Ft.margin);kt.top&&e>t.top&&(t.top=e),kt.bottom&&e>t.bottom&&(t.bottom=e),kt.left&&e>t.left&&(t.left=e),kt.right&&e>t.right&&(t.right=e),eo=t}const to="function"==typeof et?et({size:qt,margin:eo}):et,oo="function"==typeof Je?Je({size:qt,margin:eo}):Je,no=qt[0]-eo.left-eo.right,io=qt[1]-eo.top-eo.bottom,ro=t.useMemo(()=>k(A),[A]),so=null!=Pe?Pe:Re,ao=t.useRef(null),lo=t.useRef(null),[co,uo]=t.useState(0),[ho,go]=t.useState(null),fo=t.useRef(null),po=t.useRef(null),[yo,mo]=t.useState(null),vo=t.useRef($i.primary),bo=t.useRef([]),xo=t.useRef(Ke),ko=t.useRef(Ze);xo.current=Ke,ko.current=Ze;const[wo,Ao]=t.useState(!1),[jo,So]=t.useState([]),[Oo,Mo]=t.useState([]),Co="streaming"===x||["bar","swarm","waterfall"].includes(v),_o=t.useMemo(()=>{var e,t,o;return{chartType:v,runtimeMode:Co?"streaming":"bounded",windowSize:F,windowMode:H,arrowOfTime:Co?I:"right",extentPadding:G,scalePadding:q,axisExtent:Me,xAccessor:M,yAccessor:C,timeAccessor:Co?W:void 0,valueAccessor:D,colorAccessor:_,sizeAccessor:P,groupAccessor:L||(T?"_lineGroup":void 0),categoryAccessor:it,lineDataAccessor:T,xScaleType:Mt,yScaleType:Lt,xExtent:z,yExtent:Y,sizeRange:X,binSize:E,normalize:R,baseline:N,stackOrder:B,boundsAccessor:le,boundsStyle:ce,y0Accessor:ue,band:de,gradientFill:!0===he?{topOpacity:.8,bottomOpacity:.05}:!1===he?void 0:he,areaGroups:fe?new Set(fe):void 0,lineGradient:ge,openAccessor:pe,highAccessor:ye,lowAccessor:me,closeAccessor:ve,candlestickStyle:be,lineStyle:ee,pointStyle:te,areaStyle:oe,swarmStyle:re,waterfallStyle:ie,colorScheme:ae,barColors:se,barStyle:ne,annotations:De,decay:lt,pulse:ct,transition:Vt,introAnimation:Ut,staleness:pt,heatmapAggregation:yt,heatmapXBins:mt,heatmapYBins:vt,showValues:bt,heatmapValueFormat:xt,pointIdAccessor:Ot,curve:$,themeCategorical:null===(e=null==Xt?void 0:Xt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Xt),themeSequential:null===(t=null==Xt?void 0:Xt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==Xt?void 0:Xt.colors)||void 0===o?void 0:o.diverging,customLayout:Et,layoutConfig:Dt,layoutMargin:eo}},[v,F,H,I,G,q,Me,M,C,W,D,Mt,Lt,_,P,L,it,T,z,Y,X,E,R,N,B,le,ce,ue,de,he,ge,fe,pe,ye,me,ve,be,ee,te,oe,re,ie,ne,ae,se,De,lt,ct,null==Vt?void 0:Vt.duration,null==Vt?void 0:Vt.easing,Ut,pt,yt,mt,vt,bt,xt,Co,Ot,$,Xt,Et,Dt,eo]),Po=fn(_o),Lo=t.useRef(null);Lo.current||(Lo.current=new Ye(Po));const To=t.useCallback(()=>{var e,t;const o=xo.current,n=ko.current;if(!n||!o)return;const i=Si(null!==(t=null===(e=Lo.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Oi(i,bo.current)||(bo.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=Lo.current)||void 0===e||e.updateConfig(Po),Ht.current=!0,Jt()},[Po,Jt]);const $o=t.useRef(null);$o.current||($o.current=new w(e=>{const t=Lo.current;t&&t.ingest(e)&&(Ht.current=!0,Jt())},{chunkThreshold:j,chunkSize:O})),t.useEffect(()=>{var e;null===(e=$o.current)||void 0===e||e.updateChunkOptions({chunkThreshold:j,chunkSize:O})},[j,O]);const Ro=t.useCallback(e=>{var t;null===(t=$o.current)||void 0===t||t.push(e)},[]),No=t.useCallback(e=>{var t;null===(t=$o.current)||void 0===t||t.pushMany(e)},[]),Bo=t.useCallback(()=>{var e,t;null===(e=$o.current)||void 0===e||e.clear(),null===(t=Lo.current)||void 0===t||t.clear(),Ht.current=!0,Jt()},[Jt]);t.useImperativeHandle(n,()=>({push:Ro,pushMany:No,remove:e=>{var t,o,n;null===(t=$o.current)||void 0===t||t.flush();const i=null!==(n=null===(o=Lo.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];return i.length>0&&(fo.current&&i.some(e=>{var t;return e===(null===(t=fo.current)||void 0===t?void 0:t.data)})&&(fo.current=null,mo(null)),Ht.current=!0,Jt()),i},update:(e,t)=>{var o,n,i;null===(o=$o.current)||void 0===o||o.flush();const r=null!==(i=null===(n=Lo.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(Ht.current=!0,Jt()),r},clear:Bo,getData:()=>{var e,t,o;return null===(e=$o.current)||void 0===e||e.flush(),null!==(o=null===(t=Lo.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Lo.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Lo.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[Ro,No,Bo,Jt]),t.useEffect(()=>{var e,t;if(A){if(T&&ro.length>0&&"object"==typeof ro[0]&&null!==ro[0]){const t="string"==typeof T?T:"coordinates";if(Array.isArray(ro[0][t])){const o=[];for(const e of ro){const n=e[t];if(Array.isArray(n)){const t=e.label||e.id||e.key;if(null!=t)for(const e of n)o.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of n)o.push(e)}}return void(null===(e=$o.current)||void 0===e||e.setBoundedData(o))}}null===(t=$o.current)||void 0===t||t.setBoundedData(ro)}},[A,ro,T]);const{hoverHandlerRef:Eo,hoverLeaveRef:Do,onPointerMove:Io,onPointerLeave:Ho}=Ft;Eo.current=e=>{var t,o,n,i;if(!so)return;const r=ao.current;if(!r)return;const s=r.getBoundingClientRect(),a=e.clientX-s.left-eo.left,l=e.clientY-s.top-eo.top;if(0>a||a>no||0>l||l>io)return void(fo.current&&(fo.current=null,po.current=null,mo(null),Te&&(Te(null),Ht.current=!0),Jt()));const c=Lo.current;if(!c||0===c.scene.length)return;const u=gt(c.scene,a,l,Ne,c.quadtree,c.maxPointRadius),d="multi"===Ee,h=()=>{fo.current&&(fo.current=null,po.current=null,mo(null),Te&&Te(null),Jt())};if(!u&&!d)return void h();const g=d||!u?a:u.x,f=d||!u?l:u.y,p=(null==u?void 0:u.datum)?Be(u.datum,c.resolvedRibbons):{},y=null===(o=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===o?void 0:o.invert,m="function"==typeof y?y(g):void 0;let b=qn(p,g,f,null!=m?{xValue:m,xPx:g}:void 0);if(d&&c.scene.length>0&&c.scales){const e=function(e,t,o=30){const n=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const r=ft(ht(e.path,e.curve),t,o);if(null===r)continue;const s=wt(e.path,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:r,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const r=ht(e.topPath,e.curve),s=ht(e.bottomPath,e.curve),a=ft(r,t,o);if(null===a)continue;const l=ft(s,t,o),c=wt(e.topPath,t);n.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:null!=l?l:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return n}(c.scene,g,Math.max(Ne,no));if(e.length>0){const t=c.scales.y.invert,o=vo.current,n=y?y(g):g;if(u)b.xValue=n,b.xPx=g;else{const e={xValue:n};"string"==typeof M&&(e[M]=n),b=qn(e,g,f,{xValue:n,xPx:g})}b.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===v&&null!=i?n-i:n,valuePx:e.y,color:e.color||o,datum:Be(e.datum,c.resolvedRibbons)}})}}u||(null===(n=b.allSeries)||void 0===n?void 0:n.length)?(fo.current=b,po.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,mo(b),Te&&(Te(b),Ht.current=!0),Jt()):h()},Do.current=()=>{fo.current&&(fo.current=null,po.current=null,mo(null),Te&&(Te(null),Ht.current=!0),Jt())};const Fo=t.useRef(()=>{});Fo.current=e=>{var t,o;if(!$e)return;const n=ao.current;if(!n)return;const i=n.getBoundingClientRect(),r=e.clientX-i.left-eo.left,s=e.clientY-i.top-eo.top;if(0>r||r>no||0>s||s>io)return void $e(null);const a=Lo.current;if(!a||0===a.scene.length)return void $e(null);const l=gt(a.scene,r,s,Ne,a.quadtree,a.maxPointRadius);if(!l)return void $e(null);const c=l.datum||{},u=null===(o=null===(t=a.scales)||void 0===t?void 0:t.x)||void 0===o?void 0:o.invert,d="function"==typeof u?u(l.x):void 0;$e(qn(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0))};const Wo=t.useCallback(e=>Fo.current(e),[]),zo=t.useRef(-1),Yo=t.useRef(null),Go=t.useRef(null),qo=t.useCallback(e=>{const t=Lo.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(Go.current&&Go.current.version===o)n=Go.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)switch(r.type){case"point":i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"line":{const e=r,o=Array.isArray(e.datum)?e.datum:[],n=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&o.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:o[t],shape:"circle",group:n});break}case"area":{const e=r,t=Array.isArray(e.datum)?e.datum:[],n=null!==(o=e.group)&&void 0!==o?o:"_default";for(let o=0;e.topPath.length>o&&t.length>o;o++)i.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:t[o],shape:"circle",group:n});break}case"rect":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:"_default"});break;case"heatcell":i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=At(e),Go.current={version:o,graph:n}}const i=zo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),zo.current=0;const o=n.flat[0];Yo.current={shape:o.shape,w:o.w,h:o.h};const i=Ct(Object.assign(Object.assign({},o),{datum:Be(o.datum,t.resolvedRibbons)}));return fo.current=i,mo(i),Te&&Te(i),void Jt()}const r=jt(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return zo.current=-1,Yo.current=null,fo.current=null,po.current=null,mo(null),Te&&Te(null),void Jt();zo.current=s;const a=n.flat[s];Yo.current={shape:a.shape,w:a.w,h:a.h};const l=Ct(Object.assign(Object.assign({},a),{datum:Be(a.datum,t.resolvedRibbons)}));fo.current=l,mo(l),Te&&Te(l),Jt()},[Te,Jt]),Vo=t.useCallback(e=>{zo.current=-1,Yo.current=null,Io(e)},[Io]);Zt.current=()=>{var e,t;Kt.current=0;const o=ao.current,n=lo.current;if(!o||!n)return;const i=Lo.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(Yt.current?r+1e6:r),a=!Yt.current&&s,l=Ht.current||s;l&&!a&&(i.computeScene({width:no,height:io}),To());const c=si(),u=function(e){if(!e)return $i;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),n=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),r=t.getPropertyValue("--semiotic-primary").trim(),s=n||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return s||a||o||r?{axisStroke:l||$i.axisStroke,tickText:s||$i.tickText,crosshair:s?Ri(s,"66"):$i.crosshair,hoverFill:c?Ri(c,"4D"):$i.hoverFill,hoverStroke:s?Ri(s,"99"):$i.hoverStroke,pointRing:c||$i.pointRing,primary:r||$i.primary}:$i}(o);vo.current=u.primary;const d=null!==(e=null==pt?void 0:pt.threshold)&&void 0!==e?e:5e3,h=pt&&i.lastIngestTime>0&&r-i.lastIngestTime>d;if(l){const e=ri(o,qt,eo,c);if(e){if(e.clearRect(-eo.left,-eo.top,qt[0],qt[1]),h&&(e.globalAlpha=null!==(t=null==pt?void 0:pt.dimOpacity)&&void 0!==t?t:.5),"transparent"!==J&&!Je){const t=getComputedStyle(o).getPropertyValue("--semiotic-bg").trim(),n=J||(t&&"transparent"!==t?t:null),i=n?rt(e,n):null;i&&(e.fillStyle=i,e.fillRect(-eo.left,-eo.top,qt[0],qt[1]))}if(e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,no,io),e.clip()),tt&&i.scales)for(const t of tt)e.save(),t(e,i.scene,i.scales,{width:no,height:io}),e.restore();const n=Et?Li.custom:Li[v];if(n&&i.scales)for(const t of n)t(e,i.scene,i.scales,{width:no,height:io});e.restore(),h&&(e.globalAlpha=1)}}{const e=ri(n,qt,eo,c);if(e&&(e.clearRect(-eo.left,-eo.top,qt[0],qt[1]),so&&fo.current&&i.scales&&function(e,t,o,n,i,r,s){var a;if(!1===i.crosshair)return;const l=t.allSeries,c=l&&l.length>0,u=null!==(a=t.xPx)&&void 0!==a?a:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||s.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,n),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of l)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(r)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,fo.current,no,io,"object"==typeof so?so:{},po.current,u),po.current&&Array.isArray(Pe))){const t=Pe.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,n,i){var r;if(!o)return;const s="group"in o?o.group:void 0;if(void 0!==s)for(const o of t){if("line"!==o.type)continue;if(o.group!==s)continue;if(2>o.path.length)continue;const t="function"==typeof n.style?o.datum?n.style(o.datum):{}:n.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=null!==(r=t.opacity)&&void 0!==r?r:1,e.stroke(),e.restore()}}(e,i.scene,po.current,t,u)}}l&&o&&o.setAttribute("aria-label",wn(i.scene,v+" chart"));const g=Ht.current;if(Ht.current=!1,g&&i.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!ho||e(ho.x.domain()[0])!==e(i.scales.x.domain()[0])||e(ho.x.domain()[1])!==e(i.scales.x.domain()[1])||e(ho.y.domain()[0])!==e(i.scales.y.domain()[0])||e(ho.y.domain()[1])!==e(i.scales.y.domain()[1])||ho.x.range()[0]!==i.scales.x.range()[0]||ho.x.range()[1]!==i.scales.x.range()[1]||ho.y.range()[0]!==i.scales.y.range()[0]||ho.y.range()[1]!==i.scales.y.range()[1])&&go(i.scales),kt){const e=i.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof C?C:e=>e[C||"y"];So(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Mo(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}g&&De&&De.length>0&&uo(e=>e+1),(null==pt?void 0:pt.showBadge)&&Ao(!!h),(a||null!=i.activeTransition||i.hasActivePulses)&&(Kt.current=requestAnimationFrame(()=>Zt.current()))},gn({hydrated:Wt,wasHydratingFromSSR:zt,storeRef:Lo,dirtyRef:Ht,renderFnRef:Zt,cleanup:()=>{var e;return null===(e=$o.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{Ht.current=!0,Jt()},[v,no,io,xe,J,ee,tt,Jt]),_t(pt,Lo,Ht,Jt,wo,Ao);const Uo=t.useMemo(()=>{if(Se||Ce)return;const e=Lo.current;return(null==e?void 0:e.xIsDate)&&ho?Pi(ho.x.domain()):void 0},[Se,Ce,ho]),Ko=Se||Ce||Uo,Zo=so&&yo?Le?Le(yo):e.jsx(Bi,{hover:yo}):null,Jo=Zo?e.jsx(Jn,{x:yo.x,y:yo.y,containerWidth:no,containerHeight:io,margin:eo,className:"stream-frame-tooltip",children:Zo}):null,en=Yo.current,tn=e.jsx(Yn,{active:zo.current>=0,hoverPoint:yo,margin:eo,size:qt,shape:null==en?void 0:en.shape,width:null==en?void 0:en.w,height:null==en?void 0:en.h}),on=Mi(M,W,"__semiotic_resolvedX","__semiotic_resolvedTime"),rn=Mi(C,D,"__semiotic_resolvedY","__semiotic_resolvedValue"),an=on.key,cn=rn.key,un=Ci(on,rn,De&&De.length>0||!1);if(sn||!Wt&&zt){const t=Lo.current;t&&A&&(t.ingest({inserts:ro,bounded:!0}),t.computeScene({width:no,height:io}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,a=Ko||(()=>{if((null==t?void 0:t.xIsDate)&&n)return Pi(n.x.domain())})();return e.jsxs("div",{ref:Gt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"img","aria-label":$t||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:U?"100%":qt[0],height:Q?"100%":qt[1]},children:[e.jsx(Hn,{summary:Rt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:qt[0],height:qt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${eo.left},${eo.top})`,children:oo}),e.jsxs("g",{transform:`translate(${eo.left},${eo.top})`,children:[J&&e.jsx("rect",{x:0,y:0,width:no,height:io,fill:J}),ot&&n&&ot.map((t,i)=>e.jsx(p.Fragment,{children:t(o,n,{width:no,height:io})},"svgpre-"+i)),o.map((t,o)=>function(t,o,n){var i,r,s,a,l;switch(t.type){case"line":{const n=t;if(0===n.path.length)return null;const i="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+o)}case"area":{const l=t;if(0===l.topPath.length)return null;const c=`M${l.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...l.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(l.clipRect){const t=`${n?n+"-":""}area-clip-${o}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:l.clipRect.x,y:l.clipRect.y,width:l.clipRect.width,height:l.clipRect.height})})}),e.jsx("path",{d:c,fill:nn(l.style.fill),fillOpacity:null!==(r=null!==(i=l.style.fillOpacity)&&void 0!==i?i:l.style.opacity)&&void 0!==r?r:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+o)}return e.jsx("path",{d:c,fill:nn(l.style.fill),fillOpacity:null!==(a=null!==(s=l.style.fillOpacity)&&void 0!==s?s:l.style.opacity)&&void 0!==a?a:.7,stroke:l.style.stroke,strokeWidth:l.style.strokeWidth},"area-"+o)}case"point":{const n=t;return e.jsx("circle",{cx:n.x,cy:n.y,r:n.r,fill:nn(n.style.fill),opacity:null!==(l=n.style.opacity)&&void 0!==l?l:.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"point-"+o)}case"rect":{const n=t;return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:nn(n.style.fill),opacity:n.style.opacity,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth},"rect-"+o)}case"heatcell":{const n=t;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const t=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[i,r,s]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*i+.587*r+.114*s>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),e.jsx("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:t})]},"heatcell-"+o)}return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+o)}case"candlestick":{const n=t,i=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),s=n.isUp?n.upColor:n.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),e.jsx("rect",{x:n.x-n.bodyWidth/2,y:i,width:n.bodyWidth,height:r,fill:s,stroke:s,strokeWidth:1})]},"candle-"+o)}default:return null}}(t,o,It)).filter(Boolean)]})]}),e.jsx(Qo,{width:no,height:io,totalWidth:qt[0],totalHeight:qt[1],margin:eo,scales:n,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:je,xFormat:a,yFormat:Oe||_e,axisExtent:Me,showGrid:Fe,title:nt,legend:We,legendHoverBehavior:ze,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,foregroundGraphics:Ge(to,null===(s=Lo.current)||void 0===s?void 0:s.customLayoutOverlays),marginalGraphics:kt,xValues:[],yValues:[],annotations:De,autoPlaceAnnotations:Ie,svgAnnotationRules:He,annotationFrame:0,xAccessor:an,yAccessor:cn,annotationData:un(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof $?$:void 0,linkedCrosshairName:Nt,linkedCrosshairSourceId:Bt})]})}return e.jsxs("div",{ref:Gt,className:"stream-xy-frame"+(Z?" "+Z:""),role:"group","aria-label":$t||("string"==typeof nt?nt:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":qt[0],height:Q?"100%":qt[1],overflow:"visible"},onKeyDown:qo,children:[Tt&&e.jsx(Fn,{tableId:Qt}),Tt&&e.jsx(Dn,{scene:null!==(l=null===(a=Lo.current)||void 0===a?void 0:a.scene)&&void 0!==l?l:[],chartType:v+" chart",tableId:Qt,chartTitle:"string"==typeof nt?nt:void 0}),e.jsx(Hn,{summary:Rt}),e.jsx(Wn,{hoverPoint:yo}),e.jsxs("div",{role:"img","aria-label":$t||("string"==typeof nt?nt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:so?Vo:void 0,onMouseLeave:so?Ho:void 0,onClick:$e?Wo:void 0,children:[oo&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:qt[0],height:qt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${eo.left},${eo.top})`,children:oo})}),e.jsx(Xo,{width:no,height:io,totalWidth:qt[0],totalHeight:qt[1],margin:eo,scales:ho,showAxes:xe,axes:ke,showGrid:Fe,xFormat:Ko,yFormat:Oe||_e,axisExtent:Me}),e.jsx("canvas",{ref:ao,"aria-label":wn(null!==(u=null===(c=Lo.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],v+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:lo,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(Qo,{width:no,height:io,totalWidth:qt[0],totalHeight:qt[1],margin:eo,scales:ho,showAxes:xe,axes:ke,xLabel:we,yLabel:Ae,yLabelRight:je,xFormat:Ko,yFormat:Oe||_e,axisExtent:Me,showGrid:Fe,title:nt,legend:We,legendHoverBehavior:ze,legendClickBehavior:qe,legendHighlightedCategory:Xe,legendIsolatedCategories:Ve,legendPosition:Ue,legendLayout:Qe,foregroundGraphics:Ge(to,null===(d=Lo.current)||void 0===d?void 0:d.customLayoutOverlays),marginalGraphics:kt,xValues:jo,yValues:Oo,annotations:De,autoPlaceAnnotations:Ie,svgAnnotationRules:He,annotationFrame:co,xAccessor:an,yAccessor:cn,annotationData:un(null===(h=Lo.current)||void 0===h?void 0:h.getData()),pointNodes:null===(g=Lo.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof $?$:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==J&&!Je,linkedCrosshairName:Nt,linkedCrosshairSourceId:Bt}),(st||at)&&e.jsx(b,{width:no,height:io,totalWidth:qt[0],totalHeight:qt[1],margin:eo,dimension:null!==(f=null==st?void 0:st.dimension)&&void 0!==f?f:"xy",scales:ho,onBrush:null!=at?at:()=>{},binSize:E,snap:null==st?void 0:st.snap,binBoundaries:null!==(y=null==st?void 0:st.binBoundaries)&&void 0!==y?y:"bar"===v?null===(m=Lo.current)||void 0===m?void 0:m.getBinBoundaries():void 0,snapDuring:null==st?void 0:st.snapDuring,streaming:"streaming"===x}),(null==pt?void 0:pt.showBadge)&&e.jsx(Pt,{isStale:wo,position:pt.badgePosition}),tn,Jo]})]})});function Di(e,t){var o;const{columns:n,config:i,resolvePieceStyle:r}=e,s=[],a=Math.min(t.width,t.height)/2-4,l="donut"===i.chartType?i.innerRadius||60:0,c=-Math.PI/2+(i.startAngle||0)*Math.PI/180,u=null!=i.sweepAngle?i.sweepAngle*Math.PI/180:2*Math.PI,d=null!=i.sweepAngle&&360>i.sweepAngle,h=Object.values(n),g=h.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),f=d&&!g&&h.length>1&&(null!==(o=i.cornerRadius)&&void 0!==o?o:0)>0;for(let e=0;h.length>e;e++){const t=h[e],o=t.pieceData[0],n="number"==typeof(null==o?void 0:o._pctStart)?o._pctStart:t.pctStart,d=c+n*u,g=c+(n+("number"==typeof(null==o?void 0:o._pct)?o._pct:t.pct))*u,p=r(t.pieceData[0],t.name),y=0===e,m=e===h.length-1,v=Object.assign(Object.assign({type:"wedge",cx:0,cy:0,innerRadius:l,outerRadius:a,startAngle:d,endAngle:g},i.cornerRadius&&{cornerRadius:i.cornerRadius}),{style:p,datum:(null==o?void 0:o._nonInteractive)?null:t.pieceData,category:t.name});(null==o?void 0:o._roundedEnds)?v.roundedEnds=o._roundedEnds:f&&(v.roundedEnds={start:y,end:m}),(null==o?void 0:o._gradientBand)&&(v._gradientBand=o._gradientBand),s.push(v)}return s}function Ii(e){var t,o,n;const i=e.length,r=e[0],s=e[i-1];return{n:i,min:r,q1:null!==(t=a.quantile(e,.25))&&void 0!==t?t:r,median:null!==(o=a.quantile(e,.5))&&void 0!==o?o:(r+s)/2,q3:null!==(n=a.quantile(e,.75))&&void 0!==n?n:s,max:s,mean:e.reduce((e,t)=>e+t,0)/i}}function Hi(e,t,o){if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=ye[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function Fi(e){return 0===e.length?()=>"#4e79a7":t=>{var o;let n=0;for(let e=0;t.length>e;e++)n=31*n+t.charCodeAt(e)|0;return null!==(o=e[Math.abs(n)%e.length])&&void 0!==o?o:"#4e79a7"}}Ei.displayName="StreamXYFrame";const Wi={bar:function(e,t){var o,n,i;const{scales:r,columns:s,config:a,getR:l,getStack:c,resolvePieceStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p="horizontal"===h,y=a.normalize,m=[];if(c){const e=new Set;for(const t of Object.values(s))for(const o of t.pieceData){const t=c(o);e.has(t)||(e.add(t),m.push(t))}}else m.push("_default");for(const e of Object.values(s)){const t=new Map;for(const o of e.pieceData){const e=c?c(o):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const n=t.get(e);n.total+=l(o),n.pieces.push(o)}let o=0;if(y)for(const e of t.values())o+=Math.abs(e.total);let n=0,i=0;for(const r of m){const s=t.get(r);if(!s)continue;let a=s.total;y&&o>0&&(a/=o);const l=u(s.pieces[0],c?r:e.name),h=Object.assign(Object.assign({},s.pieces[0]),{__aggregateValue:s.total,__pieceCount:s.pieces.length,category:e.name});if(f){const t=d(0>a?i:n+a),o=0>a?d(i+a)-d(i):d(n)-d(n+a);g.push(F(e.x,t,e.width,Math.abs(o),l,h,r)),0>a?i+=a:n+=a}else if(p){const t=d(0>a?i+a:n),o=0>a?d(i)-d(i+a):d(n+a)-d(n);g.push(F(t,e.x,Math.abs(o),e.width,l,h,r)),0>a?i+=a:n+=a}}}const v="vertical"===h,b=a.roundedTop&&a.roundedTop>0?Math.max(0,a.roundedTop):0;for(const e of g){if("rect"!==e.type)continue;const t=null!==(n=null===(o=e.datum)||void 0===o?void 0:o.__aggregateValue)&&void 0!==n?n:0;e.roundedEdge=v?0>t?"bottom":"top":0>t?"left":"right",a.gradientFill&&(e.fillGradient=a.gradientFill)}if(b>0){const e=new Map;for(const t of g){if("rect"!==t.type)continue;const o=(null===(i=t.datum)||void 0===i?void 0:i.category)||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>{var t,o;return(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)>=0}),o=t.filter(e=>{var t,o;return 0>(null!==(o=null===(t=e.datum)||void 0===t?void 0:t.__aggregateValue)&&void 0!==o?o:0)});e.length>0&&(e.reduce(v?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=b),o.length>0&&(o.reduce(v?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=b)}}return g},clusterbar:function(e,t){const{scales:o,columns:n,config:i,getR:r,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],g=new Set;for(const e of Object.values(n))for(const t of e.pieceData){const e=s?s(t):"_default";g.has(e)||(g.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(n)){const t=e.width/f,o=.2*t,n=t-o,i=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";i.has(e)||i.set(e,[]),i.get(e).push(t)}for(let s=0;h.length>s;s++){const c=i.get(h[s])||[];for(const i of c){const c=r(i),g=a(i,h[s]);if(d){const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(r,Math.min(a,d),n,Math.abs(a-d),g,i,h[s]))}else{const r=e.x+s*t+o/2,a=l(0),d=l(c);u.push(F(Math.min(a,d),r,Math.abs(d-a),n,g,i,h[s]))}}}}const p=i.roundedTop&&i.roundedTop>0?Math.max(0,i.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=r(e.datum);p>0&&(e.roundedTop=p),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",i.gradientFill&&(e.fillGradient=i.gradientFill)}return u},point:function(e,t){var o,n;const{scales:i,columns:r,getR:s,multiScales:a,resolvePieceStyle:l}=e,{r:c,projection:u}=i,d=[],h="vertical"===u,g="radial"===u,f=a.length>0,p=2*Math.PI,y=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const i=null!==(o=t.__rIndex)&&void 0!==o?o:0,r=null!==(n=t.__rValue)&&void 0!==n?n:s(t),u=f&&a[i]||c,m=l(t,e.name),v=m.r||5;let b,x;if(g){const t=y+(e.pctStart+e.pct/2)*p,o=u(r);b=Math.cos(t)*o,x=Math.sin(t)*o}else h?(b=e.middle,x=u(r)):(b=u(r),x=e.middle);d.push({type:"point",x:b,y:x,r:v,style:m,datum:t})}return d},swarm:function(e,t){const{scales:o,columns:n,getR:i,resolvePieceStyle:r}=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=i(n),u=r(n,e.name),d=u.r||4,h=(7919*o%100/100-.5)*t*.8,g=c?e.middle+h:s(a),f=c?s(a):e.middle+h;l.push({type:"point",x:g,y:f,r:d,style:u,datum:n})}}return l},pie:Di,donut:Di,boxplot:function(e,t){var o,n,i,r,s,l;const{scales:c,columns:u,config:d,getR:h,resolveSummaryStyle:g}=e,{r:f,projection:p}=c,y=[],m="vertical"===p,v=!1!==d.showOutliers;for(const t of Object.values(u)){const c=t.pieceData.map(e=>h(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===c.length)continue;const u=c[0],d=c[c.length-1],p=null!==(o=a.quantile(c,.25))&&void 0!==o?o:u,b=null!==(n=a.quantile(c,.5))&&void 0!==n?n:(u+d)/2,x=null!==(i=a.quantile(c,.75))&&void 0!==i?i:d,k=x-p,w=p-1.5*k,A=x+1.5*k,j=null!==(r=c.find(e=>e>=w))&&void 0!==r?r:u,S=null!==(s=[...c].reverse().find(e=>A>=e))&&void 0!==s?s:d,O=g(t.pieceData[0],t.name),M=[];if(v)for(const e of t.pieceData){const o=h(e);if(w>o||o>A){const n=m?t.middle:f(o),i=m?f(o):t.middle;M.push({px:n,py:i,value:o,datum:e})}}if(y.push({type:"boxplot",x:m?t.middle:0,y:m?0:t.middle,projection:m?"vertical":"horizontal",columnWidth:.6*t.width,minPos:f(j),q1Pos:f(p),medianPos:f(b),q3Pos:f(x),maxPos:f(S),stats:{n:c.length,min:j,q1:p,median:b,q3:x,max:S,mean:c.reduce((e,t)=>e+t,0)/c.length},style:O,datum:t.pieceData,category:t.name,outliers:M}),v)for(const t of M)y.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:O.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:.6},datum:t.datum})}return y},violin:function(e,t){var o,n,i;const{scales:r,columns:s,config:l,getR:c,resolveSummaryStyle:u}=e,{r:d,projection:h}=r,g=[],f="vertical"===h,p=l.bins||20,y=!1!==l.showIQR;for(const e of Object.values(s)){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 r=t[0],s=t[t.length-1],l=(s-r)/p||1,h=Array(p).fill(0);for(const e of t)h[Math.min(Math.floor((e-r)/l),p-1)]++;const m=Math.max(...h,1),v=e.width/2*.9;let b="";if(f){b=`M ${e.middle} ${d(r)}`;for(let t=0;p>t;t++){const o=d(r+(t+.5)*l);b+=` L ${e.middle+h[t]/m*v} ${o}`}b+=` L ${e.middle} ${d(s)}`;for(let t=p-1;t>=0;t--){const o=d(r+(t+.5)*l);b+=` L ${e.middle-h[t]/m*v} ${o}`}b+=" Z"}else{b=`M ${d(r)} ${e.middle}`;for(let t=0;p>t;t++)b+=` L ${d(r+(t+.5)*l)} ${e.middle-h[t]/m*v}`;b+=` L ${d(s)} ${e.middle}`;for(let t=p-1;t>=0;t--)b+=` L ${d(r+(t+.5)*l)} ${e.middle+h[t]/m*v}`;b+=" Z"}const x=u(e.pieceData[0],e.name);let k;if(y&&t.length>=4){const l=null!==(o=a.quantile(t,.25))&&void 0!==o?o:r,c=null!==(n=a.quantile(t,.5))&&void 0!==n?n:(r+s)/2,u=null!==(i=a.quantile(t,.75))&&void 0!==i?i:s;k={q1Pos:d(l),medianPos:d(c),q3Pos:d(u),centerPos:e.middle,isVertical:f}}const w=f?{x:e.x,y:Math.min(d(s),d(r)),width:e.width,height:Math.abs(d(s)-d(r))}:{x:Math.min(d(r),d(s)),y:e.x,width:Math.abs(d(s)-d(r)),height:e.width};g.push({type:"violin",pathString:b,translateX:0,translateY:0,bounds:w,iqrLine:k,stats:Ii(t),style:x,datum:e.pieceData,category:e.name})}return g},histogram:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l}=n,c=[],u=r.bins||25,d=r.normalize,h=null===(o=l.domain)||void 0===o?void 0:o.call(l),g=h?+h[0]:void 0,f=h?+h[1]:void 0;for(const e of Object.values(i)){const t=e.pieceData.map(e=>s(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const o=null!=g&&isFinite(g)?g:Math.min(...t),n=null!=f&&isFinite(f)?f:Math.max(...t),i=(n-o)/u||1,r=Array(u).fill(0);for(const e of t)o>e||e>n||r[Math.min(Math.floor((e-o)/i),u-1)]++;const h=t.length,p=Math.max(...r,1),y=a(e.pieceData[0],e.name);for(let t=0;u>t;t++){if(0===r[t])continue;const n=(d?r[t]/h:r[t]/p)*e.width*.9,s=l(o+t*i),a=l(o+(t+1)*i);c.push(F(Math.min(s,a),e.x+e.width-n,Math.abs(a-s),n,y,{bin:t,count:r[t],range:[o+t*i,o+(t+1)*i],category:e.name},e.name))}}return c},ridgeline:function(e,t){var o;const{scales:n,columns:i,config:r,getR:s,resolveSummaryStyle:a}=e,{r:l,projection:c}=n,u=[],d=r.bins||20,h="horizontal"===c,g=r.amplitude||1.5;for(const e of Object.values(i)){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],i=t[t.length-1],r=(i-n)/d||1,c=Array(d).fill(0);for(const e of t)n>e||e>i||c[Math.min(Math.floor((e-n)/r),d-1)]++;const f=Math.max(...c,1),p=a(e.pieceData[0],e.name),y=e.width*g;let m="";if(h){const t=e.x+e.width;m=`M ${l(n)} ${t}`;for(let e=0;d>e;e++)m+=` L ${l(n+(e+.5)*r)} ${t-c[e]/f*y}`;m+=` L ${l(i)} ${t} Z`}else{const t=e.x;m=`M ${t} ${l(n)}`;for(let e=0;d>e;e++){const o=l(n+(e+.5)*r);m+=` L ${t+c[e]/f*y} ${o}`}m+=` L ${t} ${l(i)} Z`}const v=h?{x:Math.min(l(n),l(i)),y:e.x,width:Math.abs(l(i)-l(n)),height:e.width}:{x:e.x,y:Math.min(l(i),l(n)),width:e.width,height:Math.abs(l(i)-l(n))};u.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,stats:Ii(t),style:Object.assign(Object.assign({},p),{fillOpacity:null!==(o=p.fillOpacity)&&void 0!==o?o:.5}),datum:e.pieceData,category:e.name})}return u},timeline:function(e,t){const{scales:o,columns:n,getRawRange:i,resolvePieceStyle:r}=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=i(t);if(!o)continue;const[n,a]=o,u=r(t,e.name);if(c){const o=s(Math.min(n,a)),i=s(Math.max(n,a));l.push(F(o,e.x,i-o,e.width,u,t,e.name))}else{const o=s(Math.max(n,a)),i=s(Math.min(n,a));l.push(F(e.x,o,e.width,i-o,u,t,e.name))}}return l},funnel:function(e,t){var o,n,r,s,a,l,c,u;const{columns:d,getR:h,getStack:g,resolvePieceStyle:f}=e,p=[],y=t.width/2,m=!1!==e.config.showLabels,v=e.scales.o.domain().map(e=>d[e]).filter(Boolean);if(0===v.length)return p;const b=[],x=new Set;for(const e of v)for(const t of e.pieceData){const e=g?g(t):"_default";x.has(e)||(x.add(e),b.push(e))}const k=b.length>1&&"_default"!==b[0],w=[];let A=0;for(const e of v){const t=new Map;let o=0;for(const n of e.pieceData){const e=g?g(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=h(n);i.total+=r,i.pieces.push(n),o+=r}w.push({col:e,groups:t,stepTotal:o}),k||o>A&&(A=o)}if(k)for(const e of w){let t=0,o=0;for(let n=0;b.length>n;n++){const i=e.groups.get(b[n]);i&&(n%2==0?t+=i.total:o+=i.total)}const n=Math.max(t,o);n>A&&(A=n)}if(0===A)return p;const j=new Map;for(const e of b){const t=w[0].groups.get(e);j.set(e,null!==(o=null==t?void 0:t.total)&&void 0!==o?o:0)}const S=w[0].stepTotal,O=k?.95*y:.9*t.width,M=i.scaleLinear().domain([0,A]).range([0,O]),C=null!==(n=e.config.connectorOpacity)&&void 0!==n?n:.3;let _=new Map;for(let t=0;w.length>t;t++){const o=w[t],n=o.col,i=0===t,d=n.width,h=.55*d,g=n.x+(d-h)/2,v=new Map;if(k){let e=0;for(const t of b){const n=o.groups.get(t);n&&(e+=M(n.total))}let t=y,r=y;for(let s=0;b.length>s;s++){const l=b[s],c=o.groups.get(l);if(!c)continue;const u=M(c.total),d=s%2==0,x=d?t:r-u;d?t+=u:r-=u;const k=f(c.pieces[0],l),w=null!==(a=j.get(l))&&void 0!==a?a:c.total,A=w>0?c.total/w*100:0,S=Object.assign(Object.assign({},c.pieces[0]),{__funnelValue:c.total,__funnelPercent:A,__funnelStep:n.name,__funnelIsFirstStep:i,__aggregateValue:c.total,__pieceCount:c.pieces.length,category:l});m&&(0===s&&(S.__funnelStepLabel=n.name,S.__funnelStepLabelX=y,S.__funnelStepLabelY=g,S.__funnelRowWidth=e),S.__funnelValueLabelX=x+u/2,S.__funnelValueLabelY=g,S.__funnelBarW=u),p.push(F(x,g,u,h,k,S,l)),v.set(l,{x:x,y:g,w:u,h:h})}}else{const e=o.stepTotal,t=M(e),a=y-t/2,l=b[0],c="_default"!==l,u=null!==(s=null===(r=o.groups.get(l))||void 0===r?void 0:r.pieces[0])&&void 0!==s?s:n.pieceData[0],d=c?l:n.name,x=f(u,d),k=S>0?e/S*100:0,w=Object.assign(Object.assign({},u),{__funnelValue:e,__funnelPercent:k,__funnelStep:n.name,__funnelIsFirstStep:i,category:c?l:n.name});m&&(w.__funnelStepLabel=n.name,w.__funnelStepLabelX=y,w.__funnelStepLabelY=g,w.__funnelRowWidth=t,w.__funnelValueLabelX=y,w.__funnelValueLabelY=g,w.__funnelBarW=t),p.push(F(a,g,t,h,x,w,d)),v.set(l,{x:a,y:g,w:t,h:h})}if(t>0&&_.size>0){const t=k?b:[b[0]];for(const i of t){const t=_.get(i),r=v.get(i);if(!t||!r)continue;const s=(()=>{const e=o.groups.get(i);return f(e?e.pieces[0]:n.pieceData[0],"_default"===i?n.name:i)})(),a={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[r.x+r.w,r.y],[r.x,r.y]],style:{fill:s.fill||(null===(l=e.config.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",opacity:C},datum:null!==(u=null===(c=o.groups.get(i))||void 0===c?void 0:c.pieces[0])&&void 0!==u?u:n.pieceData[0],category:"_default"===i?n.name:i};p.push(a)}}_=v}return p},"bar-funnel":function(e,t){var o,n,i,r;const{columns:s,getR:a,getStack:l,resolvePieceStyle:c,scales:u}=e,d=[],h=u.o.domain().map(e=>s[e]).filter(Boolean);if(0===h.length)return d;const g=[],f=new Set;for(const e of h)for(const t of e.pieceData){const e=l?l(t):"_default";f.has(e)||(f.add(e),g.push(e))}const p=g.length>1&&"_default"!==g[0],y=[];for(const e of h){const t=new Map;let o=0;for(const n of e.pieceData){const e=l?l(n):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const i=t.get(e),r=a(n);i.total+=r,i.pieces.push(n),o+=r}y.push({col:e,groups:t,stepTotal:o})}const m=new Map;for(const e of g){const t=null===(o=y[0])||void 0===o?void 0:o.groups.get(e);m.set(e,null!==(n=null==t?void 0:t.total)&&void 0!==n?n:0)}const v=u.r,b=p?g.length:1,x=p?.15:0;for(let e=0;y.length>e;e++){const t=y[e],o=t.col,n=0===e,s=e>0?y[e-1]:null,a=o.width/b,l=a*x,u=a-l;for(let e=0;g.length>e;e++){const h=g[e],f=t.groups.get(h);if(!f)continue;const y=f.total,b=null!==(i=m.get(h))&&void 0!==i?i:y,x=b>0?y/b*100:0,k=null==s?void 0:s.groups.get(h),w=null!==(r=null==k?void 0:k.total)&&void 0!==r?r:y,A=n?0:Math.max(0,w-y),j=o.x+e*a+l/2,S=v(y),O=v(0)-S,M=c(f.pieces[0],p?h:o.name),C=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:y,__barFunnelPercent:x,__barFunnelIsFirstStep:n,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:A,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name,__barFunnelLabelX:j+u/2,__barFunnelLabelY:v(y+A)});if(d.push(F(j,S,u,O,M,C,p?h:o.name)),A>0){const e=v(y+A),t=S-e,n=Object.assign({},M),i=Object.assign(Object.assign({},f.pieces[0]),{__barFunnelValue:A,__barFunnelPercent:b>0?A/b*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:p?h:o.name});d.push(F(j,e,u,t,n,i,p?h:o.name))}}}return d},swimlane:function(e,t){var o;const{scales:n,columns:i,getR:r,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=n,u=[],d="horizontal"===c,h=e.config.gradientFill,g=d?"left":"bottom",f=e.config.trackFill;if(f){const e="string"==typeof f?f:f.color,t="string"==typeof f?1:null!==(o=f.opacity)&&void 0!==o?o:1,[n,r]=l.range(),s=Math.min(n,r),a=Math.abs(r-n);for(const o of Object.values(i)){const n={fill:e,opacity:t},i=d?F(s,o.x,a,o.width,n,null,"__track__"):F(o.x,s,o.width,a,n,null,"__track__");u.push(i)}}const p=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(i)){let t=0;const o=u.length;for(const o of e.pieceData){const n=Math.abs(r(o));if(0===n)continue;const i=s?s(o):e.name,c=a(o,i);let f;if(d){const r=l(t),s=l(t+n);f=F(r,e.x,s-r,e.width,c,o,i)}else{const r=l(t+n),s=l(t);f=F(e.x,r,e.width,s-r,c,o,i)}h&&(f.fillGradient=h,f.roundedEdge=g),u.push(f),t+=n}if(p>0&&u.length>o){const e=u.slice(o),t=e[0],n=e[e.length-1];1===e.length?t.cornerRadii={tl:p,tr:p,br:p,bl:p}:d?(t.cornerRadii={tl:p,bl:p},n.cornerRadii={tr:p,br:p}):(t.cornerRadii={bl:p,br:p},n.cornerRadii={tl:p,tr:p})}}return u}};class zi{constructor(e){this.rExtent=new N,this.rExtents=[],this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.version=0,this._dataVersion=0,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new R(e.windowSize),this.getO=q(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new N)):(this.getR=Y(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=q(e.stackBy),this.getGroup=q(e.groupBy),this.getColor=q(e.colorAccessor),this.getConnector=q(e.connectorAccessor),this.getDataId=q(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new R(e.windowSize))}ingest(e){const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0: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{this._hasStreamingData=!0;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.valueAccessor||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 n=o.toArray(),r=t.projection||"vertical",s=t.oExtent||this.resolveCategories(n),a=this.computeValueDomain(n,s),l="horizontal"===r,c="radial"===r,u=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===r?e.width:e.height):.1));let d,h;if(c){d=i.scaleBand().domain(s).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,n=t.innerRadius||0;h=i.scaleLinear().domain(a).range([n,o])}else l?(d=i.scaleBand().domain(s).range([0,e.height]).padding(u),h=i.scaleLinear().domain(a).range([0,e.width])):(d=i.scaleBand().domain(s).range([0,e.width]).padding(u),h=i.scaleLinear().domain(a).range([e.height,0]));this.scales={o:d,r:h,projection:r},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((n,r)=>{var s;const a=this.rExtents[r];a.dirty&&a.recalculate(o,n);let[c,u]=a.extent;c===1/0&&(c=0,u=1);const d=null!==(s=t.extentPadding)&&void 0!==s?s:.05,h=u-c,g=h>0?h*d:1;return c-=g,u+=g,c>0&&(c=0),l?i.scaleLinear().domain([c,u]).range([0,e.width]):i.scaleLinear().domain([c,u]).range([e.height,0])}):[];let g=n;this.rAccessors.length>1&&(g=n.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(g,s,d,r,e),this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(g,e),this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,n="auto"===t?void 0:t;let i=null;if(o){i=new Set;for(const t of e)i.add(this.getO(t))}const r=i?Array.from(this.categories).filter(e=>i.has(e)):Array.from(this.categories);if(o&&void 0===n){const e=Math.max(50,3*i.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;i.has(e)||(this.categories.delete(e),t--)}}return r}if(!1===n)return r;if("function"==typeof n)return r.sort(n);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return r.sort("asc"===n?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){var o,n,i,r,s;const a=this.config.chartType,l=null!==(o=this.config.extentPadding)&&void 0!==o?o:.05;if("radial"===this.config.projection&&("pie"===a||"donut"===a))return[0,1];let c=0,u=0;if("bar"===a&&this.getStack&&this.config.normalize)c=0,u=1;else if("bar"===a&&this.getStack){const t=new Map,o=new Map;for(const n of e){const e=this.getO(n),i=this.getR(n);0>i?o.set(e,(o.get(e)||0)+i):t.set(e,(t.get(e)||0)+i)}for(const e of t.values())e>u&&(u=e);for(const e of o.values())c>e&&(c=e)}else if("bar"===a){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>u&&(u=e),c>e&&(c=e)}else if("swimlane"===a){const t=new Map;for(const o of e){const e=this.getO(o),n=Math.abs(this.getR(o));t.set(e,(t.get(e)||0)+n)}for(const e of t.values())e>u&&(u=e)}else if("clusterbar"===a||"bar-funnel"===a)for(const t of e){const e=this.getR(t);e>u&&(u=e),c>e&&(c=e)}else{const e=this.rExtent.extent[0],t=this.rExtent.extent[1];e!==1/0&&(c=e),t!==-1/0&&(u=t)}this.config.rExtent&&(null!=this.config.rExtent[0]&&(c=this.config.rExtent[0]),null!=this.config.rExtent[1]&&(u=this.config.rExtent[1]));const d="bar"===a||"clusterbar"===a||"bar-funnel"===a||"swimlane"===a;if(d&&null==(null===(n=this.config.rExtent)||void 0===n?void 0:n[0])&&null==(null===(i=this.config.rExtent)||void 0===i?void 0:i[1])&&(c>0&&(c=0),0>u&&(u=0)),"bar-funnel"!==a&&"exact"!==this.config.axisExtent){const e=u-c,t=e>0?e*l:1;null!=(null===(r=this.config.rExtent)||void 0===r?void 0:r[0])||d&&!this.config.baselinePadding&&0===c||(c-=t),null!=(null===(s=this.config.rExtent)||void 0===s?void 0:s[1])||d&&!this.config.baselinePadding&&0===u||"swimlane"===a||(u+=t)}return[c,u]}buildColumns(e,t,o,n,i){var r;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 r=("horizontal"===n?i.height:i.width)-o.padding()*o.step()*t.length;if(e>0)for(const[t,o]of u)u.set(t,o/e*r)}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),i=l>0?n/l:0;let c,g;u?(c=h,g=u.get(e)||o.bandwidth(),h+=g+o.padding()*o.step()):(c=null!==(r=o(e))&&void 0!==r?r:0,g=o.bandwidth()),s[e]={name:e,x:c,y:0,width:g,middle:c+g/2,padding:o.padding()*o.step(),pieceData:t,pct:i,pctStart:d},d+=i}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){var o,n;if(!this.scales)return[];if(this.config.customLayout){const i=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(i)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e),this.customLayoutOverlays=null,[]}return this.customLayoutOverlays=null!==(o=r.overlays)&&void 0!==o?o:null,null!==(n=r.nodes)&&void 0!==n?n:[]}this.customLayoutOverlays=null;const i=this.getSceneContext(),r=Wi[this.config.chartType];let s=r?r(i,t):[];if(this.getConnector&&this.scales){const e=function(e,t){var o,n;const{scales:i,config:r,getConnector:s,getO:a}=e;if(!s||!i)return[];const l=[],{projection:c}=i,u=new Map;for(const e of t){if("point"!==e.type&&"rect"!==e.type)continue;const t=e.datum;if(!t)continue;const o=s(t);if(!o)continue;let n,i;"point"===e.type?(n=e.x,i=e.y):(n=e.x+e.w/2,i=e.y+("vertical"===c?0:e.h/2)),u.has(o)||u.set(o,[]),u.get(o).push({x:n,y:i,datum:t,category:a(t)})}const d=i.o.domain(),h=r.connectorStyle;for(const[t,i]of u)if(i.length>=2){i.sort((e,t)=>d.indexOf(e.category)-d.indexOf(t.category));for(let r=0;i.length-1>r;r++){const s=i[r],a=i[r+1],c="function"==typeof h?h(s.datum):h||{stroke:(null===(o=e.config.themeSemantic)||void 0===o?void 0:o.border)||(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.secondary)||"#999",strokeWidth:1,opacity:.5};l.push({type:"connector",x1:s.x,y1:s.y,x2:a.x,y2:a.y,style:c,datum:s.datum,group:t})}}return l}(i,s);s=[...e,...s]}return s}buildLayoutContext(e,t){var o,n,i;const r=this.config,s=null!==(o=r.layoutMargin)&&void 0!==o?o:{top:0,right:0,bottom:0,left:0},a=Hi(r.colorScheme,r.themeCategorical,ve),l=this.scales;return{data:e,scales:{o:l.o,r:l.r,projection:l.projection},dimensions:{width:t.width,height:t.height,margin:s,plot:"radial"===l.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:null!==(n=r.themeSemantic)&&void 0!==n?n:{},categorical:[...a]},resolveColor:Fi(a),config:null!==(i=r.layoutConfig)&&void 0!==i?i:{}}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?Object.assign(Object.assign({},o),{fill:this.getColorFromScheme(t)}):o}return 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:this.config.themeCategorical||ve,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){const o=this.config.decay;return o&&t>1?je(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=this.config.categoryAccessor||this.config.oAccessor,o="function"==typeof t,n=o?null:t||"category",i=new Map;for(let r=0;e.length>r;r++){const s=e[r],a=o?t(s):s[n];let l=i.get(a);l||(l=[],i.set(a,l)),l.push(r)}return this._categoryIndexCache={version:this._dataVersion,map:i},i}rebuildPointQuadtree(){let e=0,t=0;for(const o of this.scene)"point"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxPointRadius=t,zi.QUADTREE_THRESHOLD>=e)return void(this._pointQuadtree=null);const o=Array(e);let n=0;for(const e of this.scene)"point"===e.type&&(o[n++]=e);this._pointQuadtree=r.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){var o,n;if(!this.config.decay)return;const i=t.length;if(1>=i)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const s=this.computeDecayOpacity(e,i),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,i;if(!this.config.pulse||!this.timestampBuffer)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=null!==(o=this.config.pulse.duration)&&void 0!==o?o:500,a=null!==(n=this.config.pulse.color)&&void 0!==n?n:"rgba(255,255,255,0.6)",l=null!==(i=this.config.pulse.glowRadius)&&void 0!==i?i:4,c=this.getDatumIndexMap(t);let u=null;for(const o of e){if("connector"===o.type||"violin"===o.type||"boxplot"===o.type)continue;if("wedge"===o.type){const e=o.category;if(!e)continue;u||(u=this.getCategoryIndexMap(t));const n=u.get(e);if(!n)continue;let i=0;for(let e=0;n.length>e;e++){const t=this.timestampBuffer.get(n[e]);if(null==t)continue;const o=r-t;if(s>o){const e=1-o/s;e>i&&(i=e)}}i>0&&(o._pulseIntensity=i,o._pulseColor=a);continue}const e=c.get(o.datum);if(null==e)continue;const n=this.timestampBuffer.get(e);if(null==n)continue;const i=r-n;s>i&&(o._pulseIntensity=1-i/s,o._pulseColor=a,o._pulseGlowRadius=l)}}get hasActivePulses(){var e;if(!this.config.pulse||!this.timestampBuffer||0===this.timestampBuffer.size)return!1;const t="undefined"!=typeof performance?performance.now():Date.now(),o=null!==(e=this.config.pulse.duration)&&void 0!==e?e:500,n=this.timestampBuffer.peek();return null!=n&&o>t-n}synthesizeIntroPositions(){var e,t,o,n,i;this.prevPositionMap.clear();const r=new Map,s=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.r(0))&&void 0!==t?t:0,a="horizontal"!==(null===(o=this.scales)||void 0===o?void 0:o.projection);let l;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],o=this.getNodeKey(t,r);o&&("rect"===t.type?this.prevPositionMap.set(o,a?{x:t.x,y:s,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}:{x:s,y:t.y,w:0,h:t.h,opacity:null!==(i=t.style.opacity)&&void 0!==i?i:1}):"point"===t.type?this.prevPositionMap.set(o,{x:t.x,y:t.y,r:0,opacity:0}):"wedge"===t.type&&(void 0===l&&(l=t.startAngle),this.prevPositionMap.set(o,{x:t.cx,y:t.cy,startAngle:l,endAngle:l,innerRadius:t.innerRadius,outerRadius:t.outerRadius,opacity:0})))}}getNodeKey(e,t){var o,n,i;if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,n=t.get(o)||0;return t.set(o,n+1),`${o}:${n}`}return"rect"===e.type?`r:${e.group||""}:${null!==(n=null===(o=e.datum)||void 0===o?void 0:o.category)&&void 0!==n?n:""}`:"wedge"===e.type?"w:"+(null!==(i=e.category)&&void 0!==i?i:""):null}snapshotPositions(){var e;this.prevPositionMap.clear();const t=new Map;for(let o=0;this.scene.length>o;o++){const n=this.scene[o],i=this.getNodeKey(n,t);i&&("point"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,r:n.r,opacity:n.style.opacity}):"rect"===n.type?this.prevPositionMap.set(i,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:n.style.opacity}):"wedge"===n.type&&this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:null!==(e=n.style.opacity)&&void 0!==e?e:1}))}}startTransition(){var e,t,o,n,i,r,s,a,l,c,u,d,h,g,f,p,y,m,v,b,x;if(!this.config.transition||0===this.prevPositionMap.size)return;const k=null!==(e=this.config.transition.duration)&&void 0!==e?e:300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let w=!1;const A=new Set,j=new Map;for(let e=0;this.scene.length>e;e++){const c=this.scene[e],u=this.getNodeKey(c,j);if(!u)continue;c._transitionKey=u;const d=this.prevPositionMap.get(u);if("point"===c.type)d?(A.add(u),c._targetOpacity=null!==(t=c.style.opacity)&&void 0!==t?t:1,(d.x!==c.x||d.y!==c.y||void 0!==d.r&&d.r!==c.r)&&(c._targetX=c.x,c._targetY=c.y,c._targetR=c.r,c.x=d.x,c.y=d.y,void 0!==d.r&&(c.r=d.r),w=!0)):(c._targetOpacity=null!==(o=c.style.opacity)&&void 0!==o?o:1,c._targetR=c.r,c.r=0,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("rect"===c.type)d?(A.add(u),c._targetOpacity=null!==(n=c.style.opacity)&&void 0!==n?n:1,d.x===c.x&&d.y===c.y&&d.w===c.w&&d.h===c.h||(c._targetX=c.x,c._targetY=c.y,c._targetW=c.w,c._targetH=c.h,c.x=d.x,c.y=d.y,c.w=null!==(i=d.w)&&void 0!==i?i:c.w,c.h=null!==(r=d.h)&&void 0!==r?r:c.h,w=!0)):(c._targetOpacity=null!==(s=c.style.opacity)&&void 0!==s?s:1,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),w=!0);else if("wedge"===c.type)if(d)A.add(u),c._targetOpacity=null!==(a=c.style.opacity)&&void 0!==a?a:1,d.startAngle===c.startAngle&&d.endAngle===c.endAngle||(c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle,c.startAngle=d.startAngle,c.endAngle=d.endAngle,w=!0);else{c._targetOpacity=null!==(l=c.style.opacity)&&void 0!==l?l:1,c._targetStartAngle=c.startAngle,c._targetEndAngle=c.endAngle;const e=c.startAngle;c.startAngle=e,c.endAngle=e,c.style=Object.assign(Object.assign({},c.style),{opacity:0}),this.prevPositionMap.set(u,{x:c.cx,y:c.cy,startAngle:e,endAngle:e,innerRadius:c.innerRadius,outerRadius:c.outerRadius,opacity:0}),w=!0}}this.exitNodes=[];for(const[e,t]of this.prevPositionMap)if(!A.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:t.x,y:t.y,r:null!==(c=t.r)&&void 0!==c?c:3,style:{opacity:null!==(u=t.opacity)&&void 0!==u?u:1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:t.x,y:t.y,w:null!==(d=t.w)&&void 0!==d?d:0,h:null!==(h=t.h)&&void 0!==h?h:0,style:{opacity:null!==(g=t.opacity)&&void 0!==g?g:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const o=((null!==(f=t.startAngle)&&void 0!==f?f:0)+(null!==(p=t.endAngle)&&void 0!==p?p:0))/2,n={type:"wedge",cx:t.x,cy:t.y,innerRadius:null!==(y=t.innerRadius)&&void 0!==y?y:0,outerRadius:null!==(m=t.outerRadius)&&void 0!==m?m:100,startAngle:null!==(v=t.startAngle)&&void 0!==v?v:0,endAngle:null!==(b=t.endAngle)&&void 0!==b?b:0,style:{opacity:null!==(x=t.opacity)&&void 0!==x?x:1},datum:null,category:e.slice(2),_targetStartAngle:o,_targetEndAngle:o,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(n)}w=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),w&&(this.activeTransition={startTime:_e(),duration:k})}advanceTransition(e){var t,o,n,i;if(!this.activeTransition)return!1;const r=Me(e,this.activeTransition),s=Oe(r,"linear"===(null===(t=this.config.transition)||void 0===t?void 0:t.easing)?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const n=this.prevPositionMap.get(t),i=n?null!==(o=n.opacity)&&void 0!==o?o:1:0;e.style.opacity=Ce(i,e._targetOpacity,s)}const n=this.prevPositionMap.get(t);void 0!==e._targetX&&n&&(e.x=Ce(n.x,e._targetX,s),e.y=Ce(n.y,e._targetY,s)),void 0!==e._targetR&&void 0!==(null==n?void 0:n.r)&&(e.r=Ce(n.r,e._targetR,s))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),i=o?null!==(n=o.opacity)&&void 0!==n?n:1:0;e.style.opacity=Ce(i,e._targetOpacity,s)}if(void 0===e._targetX)continue;const o=this.prevPositionMap.get(t);if(!o)continue;e.x=Ce(o.x,e._targetX,s),e.y=Ce(o.y,e._targetY,s),void 0!==o.w&&(e.w=Ce(o.w,e._targetW,s),e.h=Ce(o.h,e._targetH,s))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const o=this.prevPositionMap.get(t),n=o?null!==(i=o.opacity)&&void 0!==i?i:1:0;e.style=Object.assign(Object.assign({},e.style),{opacity:Ce(n,e._targetOpacity,s)})}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const o=this.prevPositionMap.get(t);o&&void 0!==o.startAngle&&(e.startAngle=Ce(o.startAngle,e._targetStartAngle,s),e.endAngle=Ce(o.endAngle,e._targetEndAngle,s))}}}if(r>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style=Object.assign(Object.assign({},e.style||{}),{opacity:0===e._targetOpacity?0:e._targetOpacity}),e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getData(){return this.buffer.toArray()}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),o=this.getDataId,n=e=>t.has(o(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,o)=>{n(e)&&t.add(o)}),this.timestampBuffer.clear();for(let o=0;e.length>o;o++)t.has(o)||this.timestampBuffer.push(e[o])}const i=this.buffer.remove(n);if(0===i.length)return i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,i}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=new Set(Array.isArray(e)?e:[e]),n=this.getDataId,i=new Set;this.buffer.forEach((e,t)=>{o.has(n(e))&&i.add(t)});const r=this.buffer.update(e=>o.has(n(e)),t);if(0===r.length)return r;for(const e of r)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),i.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,r}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}updateConfig(e){const t=Object.assign({},this.config);if(("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!z(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!z(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),("categoryAccessor"in e||"oAccessor"in e)&&(z(e.categoryAccessor||e.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=q(this.config.categoryAccessor||this.config.oAccessor,"category"),this.categories.clear())),"valueAccessor"in e||"rAccessor"in e){const o=e.valueAccessor||e.rAccessor,n=t.valueAccessor||t.rAccessor,i=Array.isArray(o)?o:[o],r=Array.isArray(n)?n:[n];if(i.length!==r.length||i.some((e,t)=>!z(e,r[t]))){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>Y(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new N)):(this.getR=Y(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!z(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?q(this.config.stackBy):void 0),"groupBy"in e&&!z(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?q(this.config.groupBy):void 0),"colorAccessor"in e&&!z(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?q(this.config.colorAccessor):void 0),"connectorAccessor"in e&&!z(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?q(this.config.connectorAccessor):void 0)}}function Yi(e,t,o){const n=qe(t,o,e);return n.hit?{datum:e.datum,x:n.cx,y:e.y,distance:0,category:e.group}:null}function Gi(e,t,o,n=30){const i=t-e.x,r=o-e.y,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function qi(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerRadius>r||r>e.outerRadius)return null;const s=Qe(Math.atan2(i,n)),a=Qe(e.startAngle),l=Qe(e.endAngle);if(!(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 Xi(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,stats:e.stats}}else{const i=e.y-n,r=e.y+n;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||i>o||o>r))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Vi(e,t,o){if(!e.bounds)return null;const{x:n,y:i,width:r,height:s}=e.bounds;return n>t||t>n+r||i>o||o>i+s?null:{datum:e.datum,x:n+r/2,y:i+s/2,distance:0,category:e.category,stats:e.stats}}function Ui(o){const{width:n,height:i,totalWidth:r,totalHeight:s,margin:a,scales:l,showAxes:c,showGrid:u,rFormat:d}=o,{rTickValues:h,axisExtent:g}=o,f="radial"===(null==l?void 0:l.projection),p="horizontal"===(null==l?void 0:l.projection),y=t.useMemo(()=>!l||f?[]:(h||Fo(l.r,5,g)).map(e=>({value:e,pixel:l.r(e),label:(d||Qi)(e)})),[l,d,f,h,g]),m=u&&l&&!f,v=c&&l&&!f;return m||v?e.jsx("svg",{width:r,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:e.jsxs("g",{transform:`translate(${a.left},${a.top})`,children:[m&&e.jsx("g",{className:"ordinal-grid",children:y.map((t,o)=>e.jsx("line",{x1:p?t.pixel:0,y1:p?0:t.pixel,x2:p?t.pixel:n,y2:p?i:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),v&&e.jsx(e.Fragment,{children:e.jsxs(e.Fragment,p?{children:[e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[e.jsx("line",{x1:0,y1:i,x2:n,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function Qi(e){return Math.round(100*e)/100+""}function Ki(o){var n,i;const{width:r,height:s,totalWidth:a,totalHeight:l,margin:c,scales:u,showAxes:d,showCategoryTicks:h,oLabel:g,rLabel:f,oFormat:p,rFormat:y,showGrid:m,title:v,legend:b,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:j="right",legendLayout:S,foregroundGraphics:O,annotations:M,autoPlaceAnnotations:C,svgAnnotationRules:_,xAccessor:P,yAccessor:L,annotationData:T,underlayRendered:$,children:R}=o,N="radial"===(null==u?void 0:u.projection),B="horizontal"===(null==u?void 0:u.projection),E=!1!==h,D=t.useMemo(()=>d&&E&&u&&!N?u.o.domain().map((e,t)=>{var o;return{value:e,pixel:(null!==(o=u.o(e))&&void 0!==o?o:0)+u.o.bandwidth()/2,label:p?p(e,t):e}}):[],[d,E,u,p,N]),I=o.rTickValues,H=o.tickLabelEdgeAlign,F=o.axisExtent,W=t.useMemo(()=>d&&u&&!N?(I||Fo(u.r,5,F)).map(e=>({value:e,pixel:u.r(e),label:(y||Qi)(e)})):[],[d,u,y,N,I,F]),z=t.useRef(new Map),Y=t.useRef(null!==(n=null==M?void 0:M.length)&&void 0!==n?n:0),G=null!==(i=null==M?void 0:M.length)&&void 0!==i?i:0;Y.current!==G&&(Y.current=G,z.current=new Map);const q=t.useMemo(()=>{if(!M||0===M.length)return null;const e=ho(),t="horizontal"===(null==u?void 0:u.projection),o=(null==u?void 0:u.o)?e=>{var t;return(null!==(t=u.o(e))&&void 0!==t?t:0)+u.o.bandwidth()/2}:null,n={scales:u?{x:t?u.r:o||u.r,y:t&&o||u.r,time:u.r,value:u.r,o:u.o}:null,timeAxis:"x",xAccessor:P,yAccessor:L,width:r,height:s,data:T,frameType:"ordinal",projection:t?"horizontal":"vertical",stickyPositionCache:z.current};return uo(C?Po(Object.assign({annotations:M,context:n},"object"==typeof C?C:{})):M,e,_,n)},[M,C,_,r,s,u,P,L,T]);return d||v||b||O||q&&q.length>0||m||R?e.jsxs("svg",{role:"img",width:a,height:l,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof v?v:"Ordinal Chart"}),e.jsx("desc",{children:"string"==typeof v?v+" — ordinal data visualization":"Ordinal data visualization"}),e.jsxs("g",{transform:`translate(${c.left},${c.top})`,children:[m&&u&&!N&&!$&&e.jsx("g",{className:"ordinal-grid",children:W.map((t,o)=>e.jsx("line",{x1:B?t.pixel:0,y1:B?0:t.pixel,x2:B?t.pixel:r,y2:B?s:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+o))}),d&&u&&!N&&(()=>{const t={fontSize:"var(--semiotic-tick-font-size, 12px)"},o={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return e.jsx("g",{className:"ordinal-axes",children:e.jsxs(e.Fragment,B?{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&e.jsx("line",{x1:0,y1:s,x2:r,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!$&&(null==u?void 0:u.r)&&(()=>{const t=u.r(0);return t>1&&r-1>t?e.jsx("line",{x1:t,y1:0,x2:t,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),W.map((o,n)=>{const i=H?0===n?"start":n===W.length-1?"end":"middle":"middle";return e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{y:18,textAnchor:i,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)}),f&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]}:{children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!$&&(()=>{const t=(null==u?void 0:u.r)?u.r(0):s,o=0>t||t>s?s:t;return e.jsx("line",{x1:0,y1:o,x2:r,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),D.map((o,n)=>e.jsxs("g",{transform:`translate(${o.pixel},${s})`,children:[e.jsx("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof o.label||"number"==typeof o.label?e.jsx("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},t),children:o.label})})]},"cat-"+n)),g&&e.jsx("text",{x:r/2,y:s+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:g})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!$&&e.jsx("line",{x1:0,y1:0,x2:0,y2:s,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),W.map((o,n)=>e.jsxs("g",{transform:`translate(0,${o.pixel})`,children:[e.jsx("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},t),children:o.label})]},"val-"+n)),f&&e.jsx("text",{x:15-c.left,y:s/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-c.left}, ${s/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},o),children:f})]})]})})})(),q,O,R]}),v&&e.jsx("text",{x:a/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof v?v:null}),Ht({legend:b,totalWidth:a,totalHeight:l,margin:c,legendPosition:j,title:v,legendLayout:S,legendHoverBehavior:x,legendClickBehavior:k,legendHighlightedCategory:w,legendIsolatedCategories:A})]}):null}function Zi({width:i,height:r,totalWidth:s,totalHeight:a,margin:l,scales:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(u);g.current=u;const f=t.useRef(c);f.current=c;const p=t.useRef(!1),y=t.useRef(null),m="horizontal"===(null==c?void 0:c.projection),v=t.useRef(m);return v.current=m,t.useEffect(()=>{if(!d.current)return;const e=o.select(d.current).select(".brush-g"),t=m?n.brushX():n.brushY();return t.extent([[0,0],[i,r]]),t.on("brush end",e=>{if(p.current)return;const t=f.current;if(!t)return;if(!e.selection)return y.current=null,void g.current(null);const[o,n]=e.selection;let i;i=v.current?[t.r.invert(o),t.r.invert(n)]:[t.r.invert(n),t.r.invert(o)];const r={r:i};y.current=r,g.current(r)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),h.current=null}},[i,r,m]),t.useEffect(()=>{if(!c||!h.current||!y.current)return;if(!d.current)return;const e=y.current,t=o.select(d.current).select(".brush-g"),n=c.r(e.r[0]),i=c.r(e.r[1]);m?(p.current=!0,t.call(h.current.move,[n,i]),p.current=!1):(p.current=!0,t.call(h.current.move,[i,n]),p.current=!1)},[c,m]),e.jsx("svg",{ref:d,width:s,height:a,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsx("g",{className:"brush-g",transform:`translate(${l.left},${l.top})`,style:{pointerEvents:"all"}})})}function Ji(e,t){var o,n,i,r;const s=t._gradientBand.colors;if(0===s.length)return;const{clipPath:a,slices:l}=tn({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:null===(n=null===(o=t.roundedEnds)||void 0===o?void 0:o.start)||void 0===n||n,roundEnd:null===(r=null===(i=t.roundedEnds)||void 0===i?void 0:i.end)||void 0===r||r,colors:s}),c=new Path2D(a);e.save(),e.translate(t.cx,t.cy),e.clip(c);for(const t of l)e.fillStyle=rt(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(c),e.restore())}function er(e,t){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()}function tr(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},n=s.arc().cornerRadius(t.cornerRadius)(o);if(!n)return;e.save(),e.translate(t.cx,t.cy);const i=new Path2D(n);e.fill(i),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(i),e.restore()}zi.QUADTREE_THRESHOLD=500;const or=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"wedge"===e.type);for(const t of s){const o=null!==(i=t.style.fillOpacity)&&void 0!==i?i:1,n=null!==(r=t.style.opacity)&&void 0!==r?r:1;if(e.globalAlpha=o*n,t._gradientBand&&t._gradientBand.colors.length>0)Ji(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(er(e,t),gi(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?rt(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=en({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const n=new Path2D(o);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),tr(e,t)):(er(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(er(e,t),gi(e,t)),e.globalAlpha=1}}},nr=(e,t,o,n)=>{var i,r;const s=t.filter(e=>"boxplot"===e.type);for(const t of s){const o=t.columnWidth/2,n="vertical"===t.projection,s=rt(e,"var(--semiotic-primary, #007bff)"),a=rt(e,"var(--semiotic-text, #333)"),l=t.style.fill,c="string"==typeof l?rt(e,l)||l:null!=l?l:s,u=t.style.stroke,d="string"==typeof u?rt(e,u)||u:a,h=t.style.strokeWidth||1,g=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6;if(e.save(),e.strokeStyle=d,e.lineWidth=h,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=g,e.fillStyle=c,n){const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,n,t.columnWidth,i),e.globalAlpha=1,e.strokeRect(t.x-o,n,t.columnWidth,i)}else{const n=Math.min(t.q1Pos,t.q3Pos),i=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(n,t.y-o,i,t.columnWidth),e.globalAlpha=1,e.strokeRect(n,t.y-o,i,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()}},ir=(e,t,o,n)=>{var i,r;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);if(e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.6,e.fillStyle=("string"==typeof t.style.fill?rt(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,n=!1!==t.iqrLine.isVertical;e.beginPath(),n?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),n?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},rr=(e,t,o,n)=>{var i,r,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!==(r=null!==(i=o.fillOpacity)&&void 0!==i?i:o.opacity)&&void 0!==r?r:.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=rt(e,o.style.stroke)||("string"==typeof o.style.fill?rt(e,o.style.fill):o.style.fill)||rt(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=null!==(s=o.style.opacity)&&void 0!==s?s:.5,e.stroke(),e.globalAlpha=1}},sr=(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"trapezoid"===e.type);for(const t of l){const o=t.points;if(o.length>=4){e.globalAlpha=null!==(r=null===(i=t.style)||void 0===i?void 0:i.opacity)&&void 0!==r?r:1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=(null===(s=t.style)||void 0===s?void 0:s.fill)||"#999",e.fill(),(null===(a=t.style)||void 0===a?void 0:a.stroke)&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function ar(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function lr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}let cr=null;function ur(e={},t){const{background:o="transparent",stroke:n="#000",lineWidth:i=1.5,spacing:r=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*r));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(cr||(cr=document.createElement("canvas")),cr.width=e,cr.height=e,cr)}(a)}catch(e){return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=n,c.lineWidth=i,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=r)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=r)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}const dr=new Map;function hr(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,n=dr.get(o);if(void 0!==n)return n;const i=ur({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return dr.set(o,i),i}function gr(e,t,o,n,i,r){e.moveTo(t+r,o),e.lineTo(t+n-r,o),e.quadraticCurveTo(t+n,o,t+n,o+r),e.lineTo(t+n,o+i-r),e.quadraticCurveTo(t+n,o+i,t+n-r,o+i),e.lineTo(t+r,o+i),e.quadraticCurveTo(t,o+i,t,o+i-r),e.lineTo(t,o+r),e.quadraticCurveTo(t,o,t+r,o),e.closePath()}function fr(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function pr(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}const yr=e=>[rr,...e],mr={bar:yr([bi]),clusterbar:yr([bi]),point:yr([yi]),swarm:yr([yi]),pie:[or],donut:[or],boxplot:yr([nr,yi]),violin:yr([ir]),histogram:yr([bi]),ridgeline:yr([ir]),timeline:yr([bi]),funnel:[bi,sr,(e,t,o,n)=>{var i,r,s,a;const l=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==l.length&&l.some(e=>{var t,o;return null!=(null===(t=e.datum)||void 0===t?void 0:t.__funnelStepLabel)||null!=(null===(o=e.datum)||void 0===o?void 0:o.__funnelValueLabelX)})){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const n=o.__funnelStepLabel;if(e.measureText(n).width+16>(null!==(r=null!==(i=o.__funnelRowWidth)&&void 0!==i?i:o.__funnelBarW)&&void 0!==r?r:0))continue;const s=o.__funnelStepLabelX,a=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(n,s,a),e.fillStyle="#fff",e.fillText(n,s,a)}e.font="bold 13px sans-serif";for(const t of l){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const n=null!==(s=o.__funnelBarW)&&void 0!==s?s:0;if(60>n)continue;const i=o.__funnelValue;if(null==i||0===i)continue;const r=o.__funnelPercent,l=!0===o.__funnelIsFirstStep;let c;if(c=l?ar(i):null!=r?`${ar(i)} (${lr(r)})`:ar(i),e.measureText(c).width+16>n){if(l||null==r)continue;if(c=ar(i),e.measureText(c).width+16>n)continue}const u=o.__funnelValueLabelX,d=(null!==(a=o.__funnelValueLabelY)&&void 0!==a?a:t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(c,u,d),e.fillStyle="#fff",e.fillText(c,u,d)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[bi,(e,t,o,n)=>{var i,r;const s=t.filter(e=>{var t;return"rect"===e.type&&!0===(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)});for(const t of s){const o=("string"==typeof t.style.fill?t.style.fill:null)||rt(e,"var(--semiotic-border, #999)"),n=hr(o,e);e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),n?e.fillStyle=n:(e.fillStyle=o,e.globalAlpha=.4*(null!==(r=t.style.opacity)&&void 0!==r?r:1)),e.fill(),e.globalAlpha=1}},(e,t,o,n)=>{const i=t.filter(e=>{var t,o;return"rect"===e.type&&!0!==(null===(t=e.datum)||void 0===t?void 0:t.__barFunnelIsDropoff)&&null!=(null===(o=e.datum)||void 0===o?void 0:o.__barFunnelLabelX)});if(0===i.length)return;const r=function(e,t){const[o,n,i]=st(e,t);return(.2126*o+.7152*n+.0722*i)/255>.6}(e,rt(e,"var(--semiotic-text, #333)")),s=r?"#1f2937":"#ffffff",a=r?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=r?"#f3f4f6":"#1a1a1a",c=l;for(const t of i){const o=t.datum;if(!o)continue;const n=o.__barFunnelValue;if(null==n)continue;if(25>t.w)continue;const i=o.__barFunnelPercent,r=!(!0===o.__barFunnelIsFirstStep)&&null!=i,u=r?pr(i):"",d=fr(n);e.font="bold 13px sans-serif";const h=r?e.measureText(u).width:0;e.font="11px sans-serif";const g=e.measureText(d).width,f=Math.max(h,g)+12,p=r?32:17,y=o.__barFunnelLabelX,m=y-f/2,v=o.__barFunnelLabelY-p-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),gr(e,m,v,f,p,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),gr(e,m,v,f,p,4),e.stroke(),e.textAlign="center",e.textBaseline="top",r?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,y,v+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,y,v+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,y,v+3))}e.lineWidth=1}],swimlane:yr([bi]),custom:yr([bi,yi,or,nr,ir,sr])},vr={top:50,right:40,bottom:60,left:70},br={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 xr({hover:t}){var o,n,i,r,s,a;const l=t.data||{},c=t.stats,u=t.category;if(Array.isArray(l)){const t=u||(null===(o=l[0])||void 0===o?void 0:o.category)||"";if(c)return e.jsxs("div",{className:"semiotic-tooltip",style:br,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:["n = ",c.n]}),e.jsxs("div",{children:["Min: ",c.min.toLocaleString()]}),e.jsxs("div",{children:["Q1: ",c.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",c.median.toLocaleString()]}),e.jsxs("div",{children:["Q3: ",c.q3.toLocaleString()]}),e.jsxs("div",{children:["Max: ",c.max.toLocaleString()]}),e.jsxs("div",{style:{opacity:.8},children:["Mean: ",c.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=l.length;return e.jsxs("div",{className:"semiotic-tooltip",style:br,children:[t&&e.jsx("div",{style:{fontWeight:"bold"},children:t+""}),e.jsxs("div",{children:[n," items"]})]})}if(null!=l.bin&&null!=l.count){const t=l.range||[];return e.jsxs("div",{className:"semiotic-tooltip",style:br,children:[l.category&&e.jsx("div",{style:{fontWeight:"bold"},children:l.category+""}),e.jsxs("div",{children:["Count: ",l.count]}),2===t.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(t[0]).toFixed(1)," – ",Number(t[1]).toFixed(1)]})]})}const d=t.__oAccessor,h=t.__rAccessor,g=t.__chartType;if("swarm"===g||"point"===g){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:br,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}const f=(d&&null!=l[d]?l[d]:null)||l.category||l.name||l.group||l.__rName||"",p=null!==(a=null!==(s=null!==(r=null!==(i=null!==(n=l.__aggregateValue)&&void 0!==n?n:h&&null!=l[h]?l[h]:null)&&void 0!==i?i:l.value)&&void 0!==r?r:l.__rValue)&&void 0!==s?s:l.pct)&&void 0!==a?a:"";if(!f&&""===p){const t=Object.entries(l).filter(([e])=>!e.startsWith("_")&&"data"!==e);return e.jsx("div",{className:"semiotic-tooltip",style:br,children:t.map(([t,o])=>e.jsxs("div",{children:[e.jsxs("span",{style:{opacity:.7},children:[t,":"]})," ","number"==typeof o?o.toLocaleString():o+""]},t))})}return e.jsxs("div",{className:"semiotic-tooltip",style:br,children:[f&&e.jsx("div",{style:{fontWeight:"bold"},children:f+""}),""!==p&&e.jsx("div",{children:"number"==typeof p?p.toLocaleString():p+""})]})}xr.ownsChrome=!0;const kr=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,y,m;const{chartType:v,runtimeMode:b,data:x,oAccessor:A="category",rAccessor:j="value",colorAccessor:O,stackBy:M,groupBy:C,multiAxis:_,timeAccessor:P,valueAccessor:L,categoryAccessor:T,projection:$="vertical",size:R=[600,400],responsiveWidth:N,responsiveHeight:B,margin:E,barPadding:D,roundedTop:I,gradientFill:H,trackFill:F,baselinePadding:W,innerRadius:z,cornerRadius:Y,normalize:G,startAngle:q,sweepAngle:X,dynamicColumnWidth:V,bins:U,showOutliers:Q,showIQR:K,amplitude:Z,connectorOpacity:J,showLabels:ee,connectorAccessor:te,connectorStyle:oe,dataIdAccessor:ne,rExtent:ie,oExtent:re,extentPadding:se=.05,oSort:ae,windowMode:le="sliding",windowSize:ce=200,pieceStyle:ue,summaryStyle:de,colorScheme:he,barColors:ge,showAxes:fe=!0,showCategoryTicks:pe,categoryLabel:ye,valueLabel:me,categoryFormat:ve,valueFormat:be,oLabel:xe,rLabel:ke,oFormat:we,rFormat:Ae,rTickValues:je,tickLabelEdgeAlign:Se,axisExtent:Oe,enableHover:Me=!0,hoverAnnotation:Ce,tooltipContent:_e,customHoverBehavior:Pe,annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,showGrid:Re=!1,legend:Ne,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:He,legendLayout:Fe,legendCategoryAccessor:We,onCategoriesChange:ze,backgroundGraphics:Ye,foregroundGraphics:qe,title:Xe,className:Ve,background:Ue,centerContent:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:ot,brush:nt,onBrush:it,accessibleTable:st=!0,description:at,summary:lt,customLayout:ct,layoutConfig:ut}=o,dt=t.useRef(!0),ht=ii({sizeProp:R,responsiveWidth:N,responsiveHeight:B,userMargin:E,marginDefault:vr,foregroundGraphics:qe,backgroundGraphics:Ye,animate:tt,transitionProp:et,themeDirtyRef:dt}),{reducedMotionRef:gt,responsiveRef:ft,size:pt,margin:yt,adjustedWidth:mt,adjustedHeight:vt,resolvedForeground:bt,resolvedBackground:xt,currentTheme:kt,transition:wt,introEnabled:Ot,tableId:Mt,rafRef:Lt,renderFnRef:Tt,scheduleRender:$t}=ht,Rt=ln(),Nt=hn(),Bt=t.useMemo(()=>k(x),[x]),Et=null!=ye?ye:xe,Dt=null!=me?me:ke,It=null!=ve?ve:we,Ht=null!=be?be:Ae,Ft=t.useRef(null),Wt=t.useRef(null),zt=t.useRef([]),Yt=t.useRef(We),Gt=t.useRef(ze);Yt.current=We,Gt.current=ze;const[qt,Xt]=t.useState(null),[Vt,Ut]=t.useState(null),[Qt,Kt]=t.useState(0),[Zt,Jt]=t.useState(!1),eo=Me||Ce,to="streaming"===b,oo=t.useMemo(()=>{var e,t,o;return{chartType:v,runtimeMode:to?"streaming":"bounded",windowSize:ce,windowMode:le,extentPadding:se,projection:$,oAccessor:to?void 0:A,rAccessor:to?void 0:j,colorAccessor:O,stackBy:M,groupBy:C,multiAxis:_,timeAccessor:to?P:void 0,valueAccessor:to?L||("string"==typeof j||"function"==typeof j?j:void 0):void 0,categoryAccessor:to?T||A:void 0,rExtent:ie,oExtent:re,axisExtent:Oe,barPadding:D,roundedTop:I,gradientFill:H,trackFill:F,baselinePadding:W,innerRadius:z,cornerRadius:Y,normalize:G,startAngle:q,sweepAngle:X,dynamicColumnWidth:V,bins:U,showOutliers:Q,showIQR:K,amplitude:Z,connectorOpacity:J,showLabels:ee,connectorAccessor:te,connectorStyle:oe,dataIdAccessor:ne,oSort:ae,pieceStyle:ue,summaryStyle:de,colorScheme:he,themeCategorical:null===(e=null==kt?void 0:kt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(kt),themeSequential:null===(t=null==kt?void 0:kt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(o=null==kt?void 0:kt.colors)||void 0===o?void 0:o.diverging,barColors:ge,decay:Ze,pulse:Je,transition:wt,introAnimation:Ot,staleness:ot,customLayout:ct,layoutConfig:ut,layoutMargin:yt}},[v,ce,le,se,$,A,j,O,M,C,_,P,L,T,ie,re,Oe,D,I,H,F,W,z,Y,G,q,X,V,U,Q,K,Z,J,ee,te,oe,ne,ae,ue,de,he,ge,Ze,Je,null==wt?void 0:wt.duration,null==wt?void 0:wt.easing,Ot,ot,to,kt,ct,ut,yt]),no=fn(oo),io=t.useRef(null);io.current||(io.current=new zi(no));const ro=t.useCallback(()=>{var e,t;const o=Yt.current,n=Gt.current;if(!n||!o)return;const i=Si(null!==(t=null===(e=io.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],o);Oi(i,zt.current)||(zt.current=i,n(i))},[]);t.useEffect(()=>{var e;null===(e=io.current)||void 0===e||e.updateConfig(no),dt.current=!0,$t()},[no,$t]);const so=t.useRef(null);so.current||(so.current=new w(e=>{const t=io.current;t&&t.ingest(e)&&(dt.current=!0,$t())}));const ao=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.push(e)},[]),lo=t.useCallback(e=>{var t;null===(t=so.current)||void 0===t||t.pushMany(e)},[]),co=t.useCallback(()=>{var e,t;null===(e=so.current)||void 0===e||e.clear(),null===(t=io.current)||void 0===t||t.clear(),dt.current=!0,$t()},[$t]),uo=t.useCallback(e=>{var t,o;null===(t=so.current)||void 0===t||t.clearLastData(),null===(o=so.current)||void 0===o||o.setReplacementData(e)},[]);t.useImperativeHandle(n,()=>({push:ao,pushMany:lo,replace:uo,remove:e=>{var t,o,n,i;null===(t=so.current)||void 0===t||t.flush();const r=null!==(n=null===(o=io.current)||void 0===o?void 0:o.remove(e))&&void 0!==n?n:[];if(r.length>0){const e=null===(i=Wt.current)||void 0===i?void 0:i.data;!!Wt.current&&r.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(Wt.current=null,Xt(null)),dt.current=!0,$t()}return r},update:(e,t)=>{var o,n,i;null===(o=so.current)||void 0===o||o.flush();const r=null!==(i=null===(n=io.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[];return r.length>0&&(dt.current=!0,$t()),r},clear:co,getData:()=>{var e,t,o;return null===(e=so.current)||void 0===e||e.flush(),null!==(o=null===(t=io.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var e,t;return null!==(t=null===(e=io.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null}}),[ao,lo,uo,co,$t]),t.useEffect(()=>{var e;x&&(null===(e=so.current)||void 0===e||e.setBoundedData(Bt))},[x,Bt]);const{hoverHandlerRef:ho,hoverLeaveRef:go,onPointerMove:fo,onPointerLeave:po}=ht;ho.current=e=>{if(!eo)return;const t=Ft.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-yt.left,i=e.clientY-o.top-yt.top;if(0>n||n>mt||0>i||i>vt)return void(Wt.current&&(Wt.current=null,Xt(null),Pe&&Pe(null),$t()));const r=io.current;if(!r||0===r.scene.length)return;const s="radial"===$,a=function(e,t,o,n=30,i,r=0){let s=null;if(i){const e=Ke(i,t,o,n,r);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const r of e){let e=null;switch(r.type){case"rect":if(null==r.datum)break;e=Yi(r,t,o);break;case"point":if(i)break;e=Gi(r,t,o,n);break;case"wedge":if(null===r.datum)break;e=qi(r,t,o);break;case"boxplot":e=Xi(r,t,o);break;case"violin":e=Vi(r,t,o)}e&&n>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}(r.scene,s?n-mt/2:n,s?i-vt/2:i,30,r.pointQuadtree,r.maxPointRadius);if(!a)return void(Wt.current&&(Wt.current=null,Xt(null),Pe&&Pe(null),$t()));const l=qn(a.datum||{},a.x,a.y,Object.assign(Object.assign(Object.assign({},a.stats&&{stats:a.stats}),a.category&&{category:a.category}),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v}));Wt.current=l,Xt(l),Pe&&(Pe(l),dt.current=!0),$t()},go.current=()=>{Wt.current&&(Wt.current=null,Xt(null),Pe&&(Pe(null),dt.current=!0),$t())};const yo=t.useRef(-1),mo=t.useRef(null),vo=t.useRef(null),bo=t.useCallback(e=>{const t=io.current;if(!t||0===t.scene.length)return;const o=t.version;let n;if(vo.current&&vo.current.version===o)n=vo.current.graph;else{const e=function(e){var t,o,n;const i=[];for(const r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;const e=null!==(o=null===(t=r.datum)||void 0===t?void 0:t.category)&&void 0!==o?o:"";i.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:null!==(n=r.group)&&void 0!==n?n:e})}else if("point"===r.type)i.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;const e=((r.startAngle||0)+(r.endAngle||0))/2,t=((r.innerRadius||0)+(r.outerRadius||50))/2;i.push({x:r.cx+Math.cos(e)*t,y:r.cy+Math.sin(e)*t,datum:r.datum,shape:"wedge",group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;n=At(e),vo.current={version:o,graph:n}}const i=yo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),yo.current=0;const t=n.flat[0];mo.current={shape:t.shape,w:t.w,h:t.h};const o=Object.assign(Object.assign({},Ct(t)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v});return Wt.current=o,Xt(o),Pe&&Pe(o),void $t()}const r=jt(n,i),s=St(e.key,r,n);if(null===s)return;if(e.preventDefault(),0>s)return yo.current=-1,mo.current=null,Wt.current=null,Xt(null),Pe&&Pe(null),void $t();yo.current=s;const a=n.flat[s];mo.current={shape:a.shape,w:a.w,h:a.h};const l=Object.assign(Object.assign({},Ct(a)),{__oAccessor:"string"==typeof A?A:void 0,__rAccessor:"string"==typeof j?j:void 0,__chartType:v});Wt.current=l,Xt(l),Pe&&Pe(l),$t()},[Pe,$t]),xo=t.useCallback(e=>{yo.current=-1,mo.current=null,fo(e)},[fo]);Tt.current=()=>{var e,t;Lt.current=0;const o=Ft.current;if(!o)return;const n=o.getContext("2d");if(!n)return;const i=io.current;if(!i)return;const r="undefined"!=typeof performance?performance.now():Date.now(),s=i.advanceTransition(gt.current?r+1e6:r),a=!gt.current&&s,l=dt.current;l&&!s&&(i.computeScene({width:mt,height:vt}),ro(),dt.current=!1),(l||a)&&o.setAttribute("aria-label",wn(i.scene,v+" chart"));const c=si(),u=pt[0]*c,d=pt[1]*c;o.width===u&&o.height===d||(o.width=u,o.height=d,o.style.width=pt[0]+"px",o.style.height=pt[1]+"px"),n.setTransform(c,0,0,c,0,0),n.clearRect(0,0,pt[0],pt[1]);const h=null!==(e=null==ot?void 0:ot.threshold)&&void 0!==e?e:5e3,g=ot&&i.lastIngestTime>0&&r-i.lastIngestTime>h;if(g&&(n.globalAlpha=null!==(t=null==ot?void 0:ot.dimOpacity)&&void 0!==t?t:.5),"transparent"!==Ue&&!Ye){const e=o?getComputedStyle(o).getPropertyValue("--semiotic-bg").trim():"",t=Ue||(e&&"transparent"!==e?e:null),i=t?rt(n,t):null;i&&(n.fillStyle=i,n.fillRect(0,0,pt[0],pt[1]))}const f="radial"===$;n.save(),n.beginPath(),n.rect(yt.left,yt.top,mt,vt),n.clip(),f?(n.save(),n.translate(yt.left+mt/2,yt.top+vt/2)):n.translate(yt.left,yt.top);const p=ct?mr.custom:mr[v]||[],y={width:mt,height:vt};for(const e of p)e(n,i.scene,i.scales,y);f&&n.restore(),n.restore(),g&&(n.globalAlpha=1),l&&i.scales&&(Ut(i.scales),Kt(e=>e+1)),(null==ot?void 0:ot.showBadge)&&Jt(!!g),(a||null!=i.activeTransition||i.hasActivePulses)&&(Lt.current=requestAnimationFrame(()=>Tt.current()))},gn({hydrated:Rt,wasHydratingFromSSR:Nt,storeRef:io,dirtyRef:dt,renderFnRef:Tt,cleanup:()=>{var e;return null===(e=so.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{dt.current=!0,$t()},[v,mt,vt,fe,Ue,$t]),_t(ot,io,dt,$t,Zt,Jt);const ko=eo&&qt?_e?_e(qt):e.jsx(xr,{hover:qt}):null,wo="radial"===$,Ao=ko?e.jsx(Jn,{x:qt?wo?qt.x+mt/2:qt.x:0,y:qt?wo?qt.y+vt/2:qt.y:0,containerWidth:mt,containerHeight:vt,margin:yt,className:"stream-ordinal-tooltip",children:ko}):null,jo=Mi(A,void 0,"__semiotic_resolvedO",""),So=Mi(j,void 0,"__semiotic_resolvedR",""),Oo=jo.key,Mo=So.key,Co=Ci(jo,So,Le&&Le.length>0||!1);if(sn||!Rt&&Nt){const t=io.current;t&&x&&(t.ingest({inserts:Bt,bounded:!0}),t.computeScene({width:mt,height:vt}));const o=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],n=null!==(r=null==t?void 0:t.scales)&&void 0!==r?r:null,l="radial"===$,c=l?yt.left+mt/2:yt.left,u=l?yt.top+vt/2:yt.top;return e.jsxs("div",{ref:ft,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"img","aria-label":at||("string"==typeof Xe?Xe:"Ordinal chart"),style:{position:"relative",width:N?"100%":pt[0],height:B?"100%":pt[1]},children:[e.jsx(Hn,{summary:lt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:pt[0],height:pt[1],style:{position:"absolute",left:0,top:0},children:[xt&&e.jsx("g",{transform:`translate(${yt.left},${yt.top})`,children:xt}),e.jsxs("g",{transform:`translate(${c},${u})`,children:[Ue&&e.jsx("rect",{x:0,y:0,width:mt,height:vt,fill:Ue}),o.map((t,o)=>function(t,o,n){var i,r,a,l,c,u,d,h,g;const f=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",y=e=>`ord-${t.type}-${f}-${o}-${e}`,m=`ord-${t.type}-${f}-${o}`;switch(t.type){case"rect":{const o=t,n=rn(m)+"-grad",i=function(t,o){const n=t.fillGradient;if(!n)return null;let i=t.x,r=t.y,s=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(r=t.y+t.h,a=t.y):"right"===t.roundedEdge?(i=t.x+t.w,r=t.y,s=t.x,a=t.y):"left"===t.roundedEdge&&(i=t.x,r=t.y,s=t.x+t.w,a=t.y);const l=[];if("colorStops"in n){const t=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>t.length)return null;for(let o=0;t.length>o;o++)l.push(e.jsx("stop",{offset:t[o].offset,stopColor:t[o].color},o))}else{const o=nn(t.style.fill);l.push(e.jsx("stop",{offset:0,stopColor:o,stopOpacity:n.topOpacity},"0")),l.push(e.jsx("stop",{offset:1,stopColor:o,stopOpacity:n.bottomOpacity},"1"))}return e.jsx("linearGradient",{id:o,gradientUnits:"userSpaceOnUse",x1:i,y1:r,x2:s,y2:a,children:l})}(o,n),r=i?`url(#${n})`:nn(o.style.fill);if(o.cornerRadii&&Ko(o.cornerRadii)){const t=function(e){const{x:t,y:o,w:n,h:i}=e,{tl:r,tr:s,br:a,bl:l}=Zo(e);let c=`M${t+r},${o}`;return c+=` L${t+n-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+n},${o+s}`),c+=` L${t+n},${o+i-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+n-a},${o+i}`),c+=` L${t+l},${o+i}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+i-l}`),c+=` L${t},${o+r}`,r>0&&(c+=` A${r},${r} 0 0 1 ${t+r},${o}`),c+=" Z",c}(o);return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:t,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}if(o.roundedTop&&o.roundedTop>0){const t=Math.min(o.roundedTop,o.w/2,o.h/2),{x:n,y:s,w:a,h:l}=o;let c;switch(o.roundedEdge){case"right":c=`M${n},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n},${s+l} Z`;break;case"left":c=`M${n+a},${s} L${n+t},${s} A${t},${t} 0 0 0 ${n},${s+t} L${n},${s+l-t} A${t},${t} 0 0 0 ${n+t},${s+l} L${n+a},${s+l} Z`;break;case"bottom":c=`M${n},${s} L${n+a},${s} L${n+a},${s+l-t} A${t},${t} 0 0 1 ${n+a-t},${s+l} L${n+t},${s+l} A${t},${t} 0 0 1 ${n},${s+l-t} Z`;break;default:c=`M${n},${s+l} L${n},${s+t} A${t},${t} 0 0 1 ${n+t},${s} L${n+a-t},${s} A${t},${t} 0 0 1 ${n+a},${s+t} L${n+a},${s+l} Z`}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("path",{d:c,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}return e.jsxs(p.Fragment,{children:[i&&e.jsx("defs",{children:i}),e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:r,opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},m)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:nn(o.style.fill),opacity:null!==(i=o.style.opacity)&&void 0!==i?i:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}case"wedge":{const i=t;if(i._gradientBand&&i._gradientBand.colors.length>0){const t=rn(`${n?n+"-":""}gauge-grad-${i.category||m}-${o}`),{clipPath:s,slices:u}=tn({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:null===(a=null===(r=i.roundedEnds)||void 0===r?void 0:r.start)||void 0===a||a,roundEnd:null===(c=null===(l=i.roundedEnds)||void 0===l?void 0:l.end)||void 0===c||c,colors:i._gradientBand.colors});return e.jsxs("g",{transform:`translate(${i.cx},${i.cy})`,opacity:i.style.opacity,fillOpacity:i.style.fillOpacity,children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("path",{d:s})})}),e.jsx("g",{clipPath:`url(#${t})`,children:u.map((t,o)=>e.jsx("path",{d:t.d,fill:nn(t.color)},o))}),i.style.stroke&&"none"!==i.style.stroke&&e.jsx("path",{d:s,fill:"none",stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},m)}let u;if(i.roundedEnds)u=en({innerRadius:i.innerRadius,outerRadius:i.outerRadius,startAngle:i.startAngle,endAngle:i.endAngle,cornerRadius:i.cornerRadius,roundStart:i.roundedEnds.start,roundEnd:i.roundedEnds.end});else{const e=s.arc().innerRadius(i.innerRadius).outerRadius(i.outerRadius).startAngle(i.startAngle+Math.PI/2).endAngle(i.endAngle+Math.PI/2);i.cornerRadius&&e.cornerRadius(i.cornerRadius),u=e(on)||""}return e.jsx("path",{d:u,transform:`translate(${i.cx},${i.cy})`,fill:nn(i.style.fill),stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,opacity:i.style.opacity},m)}case"boxplot":{const o=t,n=o.columnWidth/2;return e.jsxs("g","vertical"===o.projection?{children:[e.jsx("line",{x1:o.x,y1:o.minPos,x2:o.x,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:o.x-n,y:Math.min(o.q1Pos,o.q3Pos),width:o.columnWidth,height:Math.abs(o.q3Pos-o.q1Pos),fill:nn(o.style.fill),fillOpacity:null!==(u=o.style.fillOpacity)&&void 0!==u?u:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-n,y1:o.medianPos,x2:o.x+n,y2:o.medianPos,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.x-.5*n,y1:o.minPos,x2:o.x+.5*n,y2:o.minPos,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.x-.5*n,y1:o.maxPos,x2:o.x+.5*n,y2:o.maxPos,stroke:o.style.stroke||"#333",strokeWidth:1})]}:{children:[e.jsx("line",{x1:o.minPos,y1:o.y,x2:o.maxPos,y2:o.y,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("rect",{x:Math.min(o.q1Pos,o.q3Pos),y:o.y-n,width:Math.abs(o.q3Pos-o.q1Pos),height:o.columnWidth,fill:nn(o.style.fill),fillOpacity:null!==(d=o.style.fillOpacity)&&void 0!==d?d:.6,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.medianPos,y1:o.y-n,x2:o.medianPos,y2:o.y+n,stroke:o.style.stroke||"#333",strokeWidth:2}),e.jsx("line",{x1:o.minPos,y1:o.y-.5*n,x2:o.minPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1}),e.jsx("line",{x1:o.maxPos,y1:o.y-.5*n,x2:o.maxPos,y2:o.y+.5*n,stroke:o.style.stroke||"#333",strokeWidth:1})]},m)}case"violin":{const o=t,n=[e.jsx("path",{d:o.pathString,transform:o.translateX||o.translateY?`translate(${o.translateX},${o.translateY})`:void 0,fill:nn(o.style.fill),fillOpacity:null!==(h=o.style.fillOpacity)&&void 0!==h?h:.6,stroke:o.style.stroke||"#333",strokeWidth:o.style.strokeWidth||1},y("path"))];if(o.iqrLine&&o.bounds){const t=o.bounds,i=t.x+t.width/2,r=t.y+t.height/2;t.height>t.width?n.push(e.jsx("line",{x1:i,y1:o.iqrLine.q1Pos,x2:i,y2:o.iqrLine.q3Pos,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:i,cy:o.iqrLine.medianPos,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med"))):n.push(e.jsx("line",{x1:o.iqrLine.q1Pos,y1:r,x2:o.iqrLine.q3Pos,y2:r,stroke:o.style.stroke||"#333",strokeWidth:2},y("iqr")),e.jsx("circle",{cx:o.iqrLine.medianPos,cy:r,r:3,fill:"white",stroke:o.style.stroke||"#333",strokeWidth:1},y("med")))}return e.jsx("g",{children:n},m)}case"connector":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:null!==(g=t.style.opacity)&&void 0!==g?g:.5},m);case"trapezoid":{const o=t,n=o.points.map(e=>`${e[0]},${e[1]}`).join(" ");return e.jsx("polygon",{points:n,fill:nn(o.style.fill,"#999"),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},m)}default:return null}}(t,o,Mt)).filter(Boolean)]})]}),e.jsx(Ki,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:n,showAxes:fe,showCategoryTicks:pe,oLabel:Et,rLabel:Dt,oFormat:It,rFormat:Ht,rTickValues:je,tickLabelEdgeAlign:Se,axisExtent:Oe,showGrid:Re,title:Xe,legend:Ne,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:He,legendLayout:Fe,foregroundGraphics:Ge(bt,null===(a=io.current)||void 0===a?void 0:a.customLayoutOverlays),annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,annotationFrame:0,xAccessor:Oo,yAccessor:Mo,annotationData:Co(null==t?void 0:t.getData())}),Qe&&"radial"===$&&e.jsx("div",{style:{position:"absolute",left:yt.left+mt/2,top:yt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe})]})}return e.jsxs("div",{ref:ft,className:"stream-ordinal-frame"+(Ve?" "+Ve:""),role:"group","aria-label":at||("string"==typeof Xe?Xe:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:N?"100%":pt[0],height:B?"100%":pt[1],overflow:"visible"},onKeyDown:bo,children:[st&&e.jsx(Fn,{tableId:Mt}),st&&e.jsx(Dn,{scene:null!==(c=null===(l=io.current)||void 0===l?void 0:l.scene)&&void 0!==c?c:[],chartType:v+" chart",tableId:Mt,chartTitle:"string"==typeof Xe?Xe:void 0}),e.jsx(Hn,{summary:lt}),e.jsx(Wn,{hoverPoint:qt}),e.jsxs("div",{role:"img","aria-label":at||("string"==typeof Xe?Xe:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:eo?xo:void 0,onMouseLeave:eo?po:void 0,children:[xt&&e.jsx("svg",{style:{position:"absolute",top:0,left:0,width:pt[0],height:pt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${yt.left},${yt.top})`,children:xt})}),e.jsx(Ui,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Vt,showAxes:fe,showGrid:Re,rFormat:Ht,rTickValues:je,axisExtent:Oe}),e.jsx("canvas",{ref:Ft,"aria-label":wn(null!==(d=null===(u=io.current)||void 0===u?void 0:u.scene)&&void 0!==d?d:[],v+" chart"),style:{position:"absolute",top:0,left:0,width:pt[0],height:pt[1]}}),e.jsx(Ki,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Vt,showAxes:fe,showCategoryTicks:pe,oLabel:Et,rLabel:Dt,oFormat:It,rFormat:Ht,rTickValues:je,axisExtent:Oe,showGrid:Re,title:Xe,legend:Ne,legendHoverBehavior:Be,legendClickBehavior:Ee,legendHighlightedCategory:De,legendIsolatedCategories:Ie,legendPosition:He,legendLayout:Fe,foregroundGraphics:Ge(bt,null===(h=io.current)||void 0===h?void 0:h.customLayoutOverlays),annotations:Le,autoPlaceAnnotations:Te,svgAnnotationRules:$e,annotationFrame:Qt,xAccessor:Oo,yAccessor:Mo,annotationData:Co(null===(g=io.current)||void 0===g?void 0:g.getData()),underlayRendered:!0}),(nt||it)&&"radial"!==$&&e.jsx(Zi,{width:mt,height:vt,totalWidth:pt[0],totalHeight:pt[1],margin:yt,scales:Vt,onBrush:it||(()=>{})}),Qe&&"radial"===$&&e.jsx("div",{style:{position:"absolute",left:yt.left+mt/2,top:yt.top+vt/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Qe}),(null==ot?void 0:ot.showBadge)&&e.jsx(Pt,{isStale:Zt,position:ot.badgePosition}),e.jsx(Yn,{active:yo.current>=0,hoverPoint:qt,margin:yt,size:pt,shape:null===(f=mo.current)||void 0===f?void 0:f.shape,width:null===(y=mo.current)||void 0===y?void 0:y.w,height:null===(m=mo.current)||void 0===m?void 0:m.h}),Ao]})]})});kr.displayName="StreamOrdinalFrame";const wr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Ar={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1};class jr{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,n){var i;for(let r=0;this.capacity>r;r++){const s=this.particles[r];if(!s.active)continue;const a=o[s.edgeIndex];if(!a||!a.bezier){s.active=!1,this._freeIndices.push(r);continue}const l=n&&null!==(i=n[s.edgeIndex])&&void 0!==i?i:1;s.t+=e*t*l*(a.bezier.circular?.3:1),1>s.t?Sr(a.bezier,s.t,s.offset,s):(s.active=!1,this._freeIndices.push(r))}}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;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}}function Sr(e,t,o,n){if(e.circular&&e.segments)return void function(e,t,o,n,i){const r=e.length,s=t*r,a=Math.min(Math.floor(s),r-1),l=s-a,[c,u,d,h]=e[a];Or(c,u,d,h,l,i);const g=h.x-c.x,f=h.y-c.y,p=Math.sqrt(g*g+f*f);if(p>.001){const e=g/p;i.x+=-f/p*o*n*2,i.y+=e*o*n*2}}(e.segments,t,o,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[i,r,s,a]=e.points;Or(i,r,s,a,t,n);const l=a.x-i.x,c=a.y-i.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;n.x+=-c/u*o*e.halfWidth*2,n.y+=t*o*e.halfWidth*2}}function Or(e,t,o,n,i,r){const s=1-i,a=s*s,l=a*s,c=i*i,u=c*i;r.x=l*e.x+3*a*i*t.x+3*s*c*o.x+u*n.x,r.y=l*e.y+3*a*i*t.y+3*s*c*o.y+u*n.y}function Mr(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function Cr(e,t){var o,n=[],i=[],r=[],s={},a=[];function l(e){r[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],r[t]&&l(t)})}function c(e){var t,n,d=!1;for(i.push(e),r[e]=!0,t=0;a[e].length>t;t++)(n=a[e][t])===o?(u(o,i),d=!0):r[n]||(d=c(n));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[n=a[e][t]];h||(s[n]=h={}),h[n]=!0}return i.pop(),d}function u(e,t){var o=[].concat(t).concat(e);n.push(o)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,n=function(e){for(var t=e.length,o=Array(t),n=Array(t),i=Array(t),r=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,n[l]=0,i[l]=!1,r[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function g(t){var l=[t],c=[t];for(o[t]=n[t]=u,i[t]=!0,u+=1;c.length>0;){var g=e[t=c[c.length-1]];if(g.length>r[t]){for(var f=r[t];g.length>f;++f){var p=g[f];if(0>o[p]){o[p]=n[p]=u,i[p]=!0,u+=1,l.push(p),c.push(p);break}i[p]&&(n[t]=0|Math.min(n[t],n[p])),0>s[p]||a[t].push(s[p])}r[t]=f}else{if(n[t]===o[t]){var y=[],m=[],v=0;for(f=l.length-1;f>=0;--f){var b=l[f];if(i[b]=!1,y.push(b),m.push(a[b]),v+=a[b].length,s[b]=d.length,b===t){l.length=f;break}}d.push(y);var x=Array(v);for(f=0;m.length>f;f++)for(var k=0;m[f].length>k;k++)x[--v]=m[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&g(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var p=1;f.length>p;p++)f[p]!==f[p-1]&&c.push(f[p]);h[l]=c}}return{components:d,adjacencyList:h}}(e),i=n.components.filter(function(e){return e.length>1}),r=1/0,s=0;i.length>s;s++)for(var a=0;i[s].length>a;a++)r>i[s][a]&&(r=i[s][a],o=s);var l=i[o];if(!l)return!1;var c=e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})});return{leastVertex:r,adjList:c}}o=0;for(var h=e.length;h>o;){var g=d(o);if(o=g.leastVertex,a=g.adjList){for(var f=0;a.length>f;f++)for(var p=0;a[f].length>p;p++){var y=a[f][p];r[+y]=!1,s[y]={}}c(o),o+=1}else o=h}return n}function _r(e){return e.y0-e.y1>0?"up":"down"}function Pr(e,t){return t(e.source)==t(e.target)}function Lr(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function Tr(e){return e.target.x0-e.source.x1}function $r(e,t){var o=Nr(e),n=Tr(t)/Math.tan(o);return"up"==_r(e)?e.y1-n:e.y1+n}function Rr(e,t){var o=Nr(e),n=Tr(t)/Math.tan(o);return"up"==_r(e)?e.y1+n:e.y1-n}function Nr(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function Br(e,t){return t(e)}function Er(e){return Ir(e.source)}function Dr(e){return Ir(e.target)}function Ir(e){return(e.y0+e.y1)/2}function Hr(e){return e.virtual?0:e.value}function Fr(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!Pr(e,t)?o+1:o});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Pr(e,t)?n+1:n}),o+n}function Wr(e){return e.target.depth}function zr(e,t){return e.sourceLinks.length?e.depth:t-1}function Yr(e,t){return e.y0-t.y0}function Gr(e,t){return t.y0-e.y0}function qr(e,t){return e.y1-t.y1}function Xr(e,t){return t.y1-e.y1}function Vr(e,t){return Qr(e.source,t.source)||e.index-t.index}function Ur(e,t){return Qr(e.target,t.target)||e.index-t.index}function Qr(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Kr(e,t){return Zr(e)==Zr(t)?"bottom"==e.circularLinkType?Gr(e,t):Yr(e,t):Zr(t)-Zr(e)}function Zr(e){return e.target.column-e.source.column}function Jr(e,t){return es(e)==es(t)}function es(e){return e.y0-e.y1>0?"up":"down"}function ts(e,t,o,n,i){let r=e;var s=Math.max(8,.15*(r.y1-r.y0));r.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var l=a.min(r.links,function(e){return e.source.y0});r.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=r.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),os(r.links.filter(function(e){return"top"==e.circularLinkType}),t,o),os(r.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),r.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Pr(e,t)&&Lr(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,a=e.circularLinkType,c=r.links.filter(function(e){return e.source.column==s&&e.circularLinkType==a});c.sort("bottom"==e.circularLinkType?Gr:Yr);var u=0;c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=r.links.filter(function(e){return e.target.column==s&&e.circularLinkType==a})).sort("bottom"==e.circularLinkType?Xr:qr),u=0,c.forEach(function(t,i){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+i*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(r.y1,e.source.y1,e.target.y1)+i+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=l-i-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,n=e.target.x0,i=e.y1,r=(t+n)/2;return"M"+t+","+o+"C"+r+","+o+" "+r+","+i+" "+n+","+i}(e)}),r}function os(e,t,o){e.sort(Kr);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,i){var r=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Pr(e,t)&&Lr(e))e.circularPathData.verticalBuffer=r+e._circularWidth/2;else{for(var s=0;n.length>s;s++){var a=n[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&ns(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;r=l>r?l:r}}e.circularPathData.verticalBuffer=r+e._circularWidth/2}}),e}function ns(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}function is(e){return function(){return e}}function rs(e){return e.index}function ss(e){return e.nodes}function as(e){return e.links}function ls(e,t,o){var n=a.groups(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(i,r){var s=i.length;if(t)i.sort(t);else if(r>0){var a=new Map;i.forEach(function(e,t){var o,n,i,r=(n=0,i=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ir(e.source)*t,n+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;i+=Ir(e.target)*t,n+=t}}),n>0?i/n:NaN);a.set(e,{bc:r,idx:t})}),i.sort(function(e,t){var o=a.get(e),n=a.get(t),i=o.bc,r=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(i)||isNaN(r)?isNaN(i)?isNaN(r)?o.idx-n.idx:1:-1:i-r})}else i.sort(function(e,t){return e.circularLinkType==t.circularLinkType?Fr(t,o)-Fr(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});i.forEach(function(t,i){t.depth==n.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==Fr(t,o)?(t.y0=e.y1/2+i,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+i,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-i,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*i,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+i,t.y1=t.y0+t.value*e.ky)})})}function cs(e,t,o,n,i,r){var s=a.groups(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});d();for(var l=1,c=r;c>0;--c)u(l*=.99,o),d();function u(t,o){var n=s.length;s.forEach(function(i){var r=i.length,s=i[0].depth;i.forEach(function(i){var l;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&Fr(i,o)>0){var c=a.mean(i.sourceLinks,Dr),u=a.mean(i.targetLinks,Er),d=c&&u?(c+u)/2:c||u;if(d){var h=(d-Ir(i))*t*.3;i.y0+=h,i.y1+=h}}else if(0==s&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(s==n-1&&1==r)i.y0=e.y1/2-(l=i.y1-i.y0)/2,i.y1=e.y1/2+l/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)l=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+l;else{var g=a.mean(i.sourceLinks,Dr),f=a.mean(i.targetLinks,Er),p=((g&&f?(g+f)/2:g||f)-Ir(i))*t;i.y0+=p,i.y1+=p}})})}function d(){s.forEach(function(o){var r,s,a,l=e.y0,c=o.length;for(o.sort(t||Qr),a=0;c>a;++a)(s=l-(r=o[a]).y0)>0&&(r.y0+=s,r.y1+=s),l=r.y1+n;if((s=l-n-e.y1)>0)for(l=r.y0-=s,r.y1-=s,a=c-2;a>=0;--a)(s=(r=o[a]).y1+i-l)>0&&(r.y0-=s,r.y1-=s),l=r.y0})}}function us(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Ur),e.targetLinks.sort(Vr)}),e.nodes.forEach(function(e){var t=e.y0,o=t,n=e.y1,i=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=i-e.width/2,i-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function ds(){var e=0,t=0,o=1,n=1,i=24,r=8,s=null,l=rs,c=zr,u=void 0,d=32,h=2,g=ss,f=as;function p(){var p={nodes:g.apply(null,arguments),links:f.apply(null,arguments)};return function(g){g.x0=e,g.y0=t,g.x1=o,g.y1=n,g.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return a.group(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,i=e.target;"object"!=typeof n&&(n=e.source=Mr(o,n)),"object"!=typeof i&&(i=e.target=Mr(o,i)),n.sourceLinks.push(e),i.targetLinks.push(e)})}(g,l),function(e,t){var o=0;if(null==t){for(var n=[],i=0;e.links.length>i;i++){var r=e.links[i],s=r.source.index,a=r.target.index;n[s]||(n[s]=[]),n[a]||(n[a]=[]),-1===n[s].indexOf(a)&&n[s].push(a)}var l=Cr(n);l.sort(function(e,t){return e.length-t.length});var c={};for(i=0;l.length>i;i++){var u=l[i].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||c[n]&&c[n][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(g,u),function(e,t){var o=0,n=0;e.links.forEach(function(i){i.circular&&(i.circularLinkType=i.source.circularLinkType||i.target.circularLinkType?i.source.circularLinkType?i.source.circularLinkType:i.target.circularLinkType:n>o?"top":"bottom","top"==i.circularLinkType?o++:n++,e.nodes.forEach(function(e){Br(e,t)!=Br(i.source,t)&&Br(e,t)!=Br(i.target,t)||(e.circularLinkType=i.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Pr(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(g,l),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(a.sum(e.sourceLinks,Hr),a.sum(e.targetLinks,Hr)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(g),function(e,t,o){var n,i,r;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.depth=r,e.sourceLinks.forEach(function(e){0>i.indexOf(e.target)&&!e.circular&&i.push(e.target)})});for(n=e.nodes,i=[],r=0;n.length;++r,n=i,i=[])n.forEach(function(e){e.height=r,e.targetLinks.forEach(function(e){0>i.indexOf(e.source)&&!e.circular&&i.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,r):e.column})}(g,u,c);var f=r;if(null!==s){var p=a.groups(g.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),y=a.max(p,function(e){return e.length});y>1&&(f=Math.max(1,(n-t)*s/(y-1)))}(function(e,t,o){var n=a.groups(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var i=a.min(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/a.sum(t,function(e){return e.value})});e.ky=i,e.links.forEach(function(t){t.width=t.value*e.ky});var r=a.max(e.nodes,function(e){return e.column});e.nodes.forEach(r>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/r),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(g,f,i),ls(g,u,l),cs(g,u,l,f,f,d),us(g),ts(g,l,h,10,8),ls(g,u,l),cs(g,u,l,f,f,d),us(g),ts(g,l,h,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var n=o.links.filter(function(o){return Br(o.source,t)==Br(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Jr(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=$r(t,e);return e.y1-o}if(t.target.column>e.target.column)return $r(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y0=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y0=e.y1-s-t.width/2}})})}(g,l),function(e,t){let o=e;o.nodes.forEach(function(e){var n=o.links.filter(function(o){return Br(o.target,t)==Br(e,t)}),i=n.length;i>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Jr(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=Rr(t,e);return e.y0-o}if(t.source.column>e.source.column)return Rr(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var r=e.y0;n.forEach(function(e){e.y1=r+e.width/2,r+=e.width}),n.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var r=o+1,s=0;i>r;r++)s+=n[r].width;t.y1=e.y1-s-t.width/2}})})}(g,l),function(e){var t=e.nodes,o=e.links,n=!1,i=!1;if(o.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(i=!0)}),0==n||0==i){var r=a.min(t,function(e){return e.y0}),s=a.max(t,function(e){return e.y1}),l=(e.y1-e.y0)/(s-r);function c(t){return(t-r)/(s-r)*(e.y1-e.y0)+e.y0}1>l?(t.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1)}),o.forEach(function(e){e.y0=c(e.y0),e.y1=c(e.y1),e.width=e.width*l})):t.forEach(function(e){var t=e.y1-e.y0,o=c(e.y0)-e.y0;e.y0=c(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(g),ts(g,l,h,10,8)}(p),p}return p.update=function(e){return us(e),ts(e,l,h,10,8),e},p.nodeWidth=function(e){return arguments.length?(i=+e,p):i},p.nodePadding=function(e){return arguments.length?(r=+e,p):r},p.nodePaddingRatio=function(e){return arguments.length?(s=+e,p):s},p.nodes=function(e){return arguments.length?(g="function"==typeof e?e:is(e),p):g},p.links=function(e){return arguments.length?(f="function"==typeof e?e:is(e),p):f},p.nodeId=function(e){return arguments.length?(l="function"==typeof e?e:is(e),p):l},p.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:is(e),p):c},p.nodeSort=function(e){return arguments.length?(u=e,p):u},p.iterations=function(e){return arguments.length?(d=+e,p):d},p.circularLinkGap=function(e){return arguments.length?(h=+e,p):h},p.extent=function(i){return arguments.length?(e=+i[0][0],t=+i[0][1],o=+i[1][0],n=+i[1][1],p):[[e,t],[o,n]]},p.size=function(i){return arguments.length?(e=t=0,o=+i[0],n=+i[1],p):[o-e,n-t]},p}function hs(e){const{sx:t,sTop:o,sBot:n,tx:i,tTop:r,tBot:s,cp1X:a,cp2X:l}=e,c=(o+n)/2,u=(r+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${r} ${i},${r}`,`L${i},${s}`,`C${l},${s} ${a},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:i,y:u}],halfWidth:(n-o)/2}}}const gs=e=>{let t,o,n,i,r,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,i=e.y0+e.sankeyWidth/2,r=e.source.x1,s=e.target.x0,a=u.interpolateNumber(r,s),l=a(.5),c=a(.5),`M${t},${r}C${t},${l} ${o},${c} ${o},${s}L${n},${s}C${n},${c} ${i},${l} ${i},${r}Z`;const d=e.sankeyWidth/2,h=u.interpolateNumber(e.source.x1,e.target.x0),{pathD:g}=hs({sx:e.source.x1,sTop:e.y0-d,sBot:e.y0+d,tx:e.target.x0,tTop:e.y1-d,tBot:e.y1+d,cp1X:h(.5),cp2X:h(.5)});return g};function fs(e){var t;const o=e.sankeyWidth/2,n=(null!==(t=e._circularWidth)&&void 0!==t?t:e.sankeyWidth)/2,i=e.circularPathData;if(!i)return null;if("down"===e.direction)return null;if(e._circularStub){const t=i.sourceX,n=i.sourceY,r=i.targetX,s=i.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(i.rightFullExtent-t))),l=Math.max(15,Math.min(40,.33*(r-i.leftFullExtent)));return`M${t},${n-o}L${t+a},${n-o}L${t+a},${n+o}L${t},${n+o}ZM${r},${s-o}L${r-l},${s-o}L${r-l},${s+o}L${r},${s+o}Z`}const r=i.sourceX,s=i.sourceY,a=i.targetX,l=i.targetY,c=i.rightFullExtent,u=i.leftFullExtent,d=i.verticalFullExtent,h="bottom"===e.circularLinkType?1:-1,g=Math.max(4,Math.min(n,15));return`M${r},${s-h*o}L${c},${s-h*o}L${c+n},${s-h*o+h*g}L${c+n},${d+h*n-h*g}L${c+n-g},${d+h*n}L${u-n+g},${d+h*n}L${u-n},${d+h*n-h*g}L${u-n},${l-h*o+h*g}L${u-n+g},${l-h*o}L${a},${l-h*o}L${a},${l+h*o}L${u+n},${l+h*o}L${u+n},${d-h*n}L${c-n},${d-h*n}L${c-n},${s+h*o}L${r},${s+h*o}Z`}const ps=new Set,ys=new WeakMap;function ms(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=ys.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,ys.set(e,o);const n=new Proxy(e,{get(e,o,n){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;ps.has(e)||(ps.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,n)}});return o.set(t,n),n}const vs={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Wr))-1:0},justify:zr};function bs(e){return"string"==typeof e?e:e.id}const xs={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r,s,a,l,c,u;if(0===e.length)return;const d="vertical"===o.orientation?"down":"right",h=o.nodeAlign||"justify",g=null!==(i=o.nodeWidth)&&void 0!==i?i:15,f=null!==(r=o.nodePaddingRatio)&&void 0!==r?r:.05,p=null!==(s=o.iterations)&&void 0!==s?s:100,y=e.map(e=>Object.assign({},e)),m=t.map(e=>Object.assign(Object.assign({},e),{source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let v;v="down"===d?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const b=ds().extent(v).links(m).nodes(y).nodeAlign(vs[h]||zr).nodeId(e=>e.id).nodeWidth(g).iterations(p);b.nodePaddingRatio&&b.nodePaddingRatio(f),b();{let e=1/0,t=-1/0,o=1/0,i=-1/0;for(const n of y)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),o>n.y0&&(o=n.y0),n.y1>i&&(i=n.y1);for(const n of m){if(!n.circular||!n.circularPathData)continue;const r=n.circularPathData,s=(null!==(l=null!==(a=n._circularWidth)&&void 0!==a?a:n.width)&&void 0!==l?l:0)/2;e>r.leftFullExtent-s&&(e=r.leftFullExtent-s),r.rightFullExtent+s>t&&(t=r.rightFullExtent+s),o>r.verticalFullExtent-s&&(o=r.verticalFullExtent-s),r.verticalFullExtent+s>i&&(i=r.verticalFullExtent+s)}const r=t-e,s=i-o,u=n[0],d=n[1];if(r>0&&s>0&&(0>e||0>o||t>u||i>d)){const t=Math.min(u/r,d/s),n=-e*t+(u-r*t)/2,i=-o*t+(d-s*t)/2;for(const e of y)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+i,e.y1=e.y1*t+i;for(const e of m)if(e.y0=e.y0*t+i,e.y1=e.y1*t+i,e.width=(null!==(c=e.width)&&void 0!==c?c:0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+n,o.targetX=o.targetX*t+n,o.sourceY=o.sourceY*t+i,o.targetY=o.targetY*t+i,o.rightFullExtent=o.rightFullExtent*t+n,o.leftFullExtent=o.leftFullExtent*t+n,o.verticalFullExtent=o.verticalFullExtent*t+i,o.rightInnerExtent=o.rightInnerExtent*t+n,o.leftInnerExtent=o.leftInnerExtent*t+n,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+i,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+i,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of y){const t=x.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const k=new Map;for(const e of t)k.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of m){const t=bs(e.source),o=bs(e.target),n=k.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=null!==(u=e.width)&&void 0!==u?u:0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=d;const i=x.get(t),r=x.get(o);i&&(n.source=i),r&&(n.target=r)}}},buildScene(e,t,o,n){var i,r,s,a,l,c;const u="vertical"===o.orientation?"down":"right",d=o.nodeStyle,h=o.edgeStyle,g=null!==(i=o.edgeOpacity)&&void 0!==i?i:.5,f=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Q,y=new Map;e.forEach((e,t)=>{y.set(e.id,p[t%p.length])});const m=[],v=[],b=[],x=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const n=d?d(ms(t,"nodeStyle")):{},i={fill:n.fill||y.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};x.set(t.id,("string"==typeof i.fill?i.fill:null)||y.get(t.id)||"#4d430c"),m.push("down"===u?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:i,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:i,datum:t,id:t.id,label:t.id})}const k=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of k){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";i="function"==typeof f?f(e)||i:"target"===f?x.get(n.id)||y.get(n.id)||i:x.get(t.id)||y.get(t.id)||i;const u=h?h(ms(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),r=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),s=u.fill||i;v.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+n},${t.sourceY-o}L${t.sourceX+n},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:s,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),v.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-r},${t.targetY-o}L${t.targetX-r},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:s,fillOpacity:null!==(l=u.fillOpacity)&&void 0!==l?l:g,stroke:"none",opacity:u.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-r,x1:t.targetX}});continue}let d;if(d=e.circular&&e.circularPathData?fs(e):gs(e),!d)continue;const p={fill:u.fill||i,fillOpacity:null!==(c=u.fillOpacity)&&void 0!==c?c:g,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};v.push({type:"bezier",pathD:d,bezierCache:e.bezier,style:p,datum:e})}if(!1!==o.showLabels){const t=(w=o.nodeLabel)?"function"==typeof w?w:e=>e[w]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const r=t?t(o):o.id;if(!r)continue;let s,a,l;"down"===u?(s=o.y0+(o.y1-o.y0)/2,a=o.x1+14,l="start"):(n[0]/2>o.x0+e/2?(s=o.x0-6,l="end"):(s=o.x1+6,l="start"),a=o.y0+i/2),b.push({x:s,y:a,text:r+"",anchor:"down"===u?"middle":l,baseline:"middle",fontSize:11})}}var w;return{sceneNodes:m,sceneEdges:v,labels:b}}},ks={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,n){var i,r;if(0===e.length)return;const s=null!==(i=o.forceStrength)&&void 0!==i?i:.1,a=n[0]/2,l=n[1]/2,c=o.__previousPositions;let u=0;const h=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=null==c?void 0:c.get(t.id);e?u++:o?(t.x=o.x,t.y=o.y,u++):h.push(t)}const g=u>0&&.3>=(e.length>0?h.length/e.length:1);if(g){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of h){const n=ws(e.id,t,o);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const i=As(e.id),r=i%360*(Math.PI/180),s=10+i%20;e.x=t/n.length+s*Math.cos(r),e.y=o/n.length+s*Math.sin(r)}else{const t=As(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=a+n*Math.cos(o),e.y=l+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),i=o*t;n.x=a+e*Math.cos(i),n.y=l+e*Math.sin(i)}}}const f=null!==(r=o.iterations)&&void 0!==r?r:Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),p=0===o.iterations?0:g?40:f,y=js(o.nodeSize,o.nodeSizeRange,e),m=e=>y(e);if(p>0){const o=d.forceLink().strength(e=>{const t=e.weight;return Math.min(2.5,t?t*s:s)}).id(e=>e.id),n=d.forceSimulation().force("charge",d.forceManyBody().strength(e=>-25*m(e))).force("center",d.forceCenter(a,l).strength(.8)).force("x",d.forceX(a).strength(.15)).force("y",d.forceY(l).strength(.15));if(n.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}));o.links(e),n.force("link",o)}g?n.alpha(.3):.1>n.alpha()&&n.alpha(1),n.stop();for(let e=0;p>e;++e)n.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=m(t);t.x=Math.max(e,Math.min(n[0]-e,t.x)),t.y=Math.max(e,Math.min(n[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=v.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=v.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.edgeStyle,g=js(o.nodeSize,o.nodeSizeRange,e),f=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Q,p=new Map;e.forEach((e,t)=>{p.set(e.id,f[t%f.length])});const y=[],m=[],v=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=g(ms(t,"nodeSize")),n=d?d(ms(t,"nodeStyle")):{},a={fill:n.fill||p.get(t.id)||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#007bff",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:2,opacity:n.opacity};y.push({type:"circle",cx:t.x,cy:t.y,r:e,style:a,datum:t,id:t.id,label:t.id})}const b=new Map;for(const t of e)b.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:b.get(e.source),n="object"==typeof e.target?e.target:b.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const i=h?h(ms(e,"edgeStyle")):{},r={stroke:i.stroke||(null===(a=o.themeSemantic)||void 0===a?void 0:a.border)||(null===(l=o.themeSemantic)||void 0===l?void 0:l.secondary)||"#999",strokeWidth:null!==(c=i.strokeWidth)&&void 0!==c?c:1,opacity:null!==(u=i.opacity)&&void 0!==u?u:.6};m.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:r,datum:e})}if(!1!==o.showLabels){const t=(x=o.nodeLabel)?"function"==typeof x?x:e=>e[x]||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=g(ms(o,"nodeSize"));v.push({x:o.x,y:o.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var x;return{sceneNodes:y,sceneEdges:m,labels:v}}};function ws(e,t,o){const n=[];for(const i of t){const t="string"==typeof i.source?i.source:i.source.id,r="string"==typeof i.target?i.target:i.target.id;let s=null;if(t===e?s=r:r===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function As(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function js(e,t,o){var n,r;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const s=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()=>s[0];const c=null!==(n=a.min(l))&&void 0!==n?n:0,u=null!==(r=a.max(l))&&void 0!==r?r:1;if(c===u)return()=>(s[0]+s[1])/2;const d=i.scaleLinear().domain([c,u]).range(s).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?s[0]:d(n)}}const Ss=Q,Os={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,n){if(0===e.length)return;const{padAngle:i=.01,groupWidth:r=20,sortGroups:a}=o,l=Math.min(n[0],n[1])/2,c=l-r,u=n[0]/2,d=n[1]/2,g=(f=o.valueAccessor)?"function"==typeof f?f:e=>{var t;return null!==(t=e[f])&&void 0!==t?t:1}:e=>{var t;return null!==(t=e.value)&&void 0!==t?t:1};var f;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const y=e.length,m=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=p.get("string"==typeof e.source?e.source:e.source.id),n=p.get(t);if(void 0===o||void 0===n)continue;const i=g(e);m[o][n]=i}const v=h.chord().padAngle(i);a&&v.sortGroups(a);const b=v(m),x=b.groups,k=s.arc().innerRadius(c).outerRadius(l);for(const t of x){const o=e[t.index],n=k.centroid({innerRadius:c,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle});o.x=n[0]+u,o.y=n[1]+d,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const w=new Map;for(const t of e)w.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=w.get("string"==typeof e.source?e.source:e.source.id),n=w.get(t);o&&(e.source=o),n&&(e.target=n)}const A=new Map;for(const e of t)A.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of b){const o=e[t.source.index].id,n=e[t.target.index].id,i=A.get(`${o}\0${n}`)||A.get(`${n}\0${o}`);i&&(i.__chordData=t)}},buildScene(e,t,o,n){var i,r,s,a;const{groupWidth:l=20,edgeOpacity:c=.5}=o,u=Math.min(n[0],n[1])/2,d=u-l,g=n[0]/2,f=n[1]/2,p=o.nodeStyle,y=o.edgeStyle,m=o.edgeColorBy||"source",v=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:Ss,b=new Map;e.forEach((e,t)=>{b.set(e.id,v[t%v.length])});const x=h.ribbon().radius(d),k=[],w=[],A=[];for(let t=0;e.length>t;t++){const o=e[t],n=o.__arcData;if(!n)continue;let r;r=p?p(ms(o,"nodeStyle")).fill||b.get(o.id)||v[t%v.length]:b.get(o.id)||v[t%v.length];const s=p?p(ms(o,"nodeStyle")):{},a={fill:r,stroke:s.stroke||"black",strokeWidth:null!==(i=s.strokeWidth)&&void 0!==i?i:1,opacity:s.opacity};k.push({type:"arc",cx:g,cy:f,innerR:d,outerR:u,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 n=x(t);if(!n)continue;const i=Ms(n,g,f);let l=(null===(r=o.themeSemantic)||void 0===r?void 0:r.border)||(null===(s=o.themeSemantic)||void 0===s?void 0:s.secondary)||"#999";if(y)l=y(ms(e,"edgeStyle")).fill||l;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===m&&o?l=b.get(o.id)||l:t&&(l=b.get(t.id)||l)}const u=y?y(ms(e,"edgeStyle")):{},d={fill:l,fillOpacity:null!==(a=u.fillOpacity)&&void 0!==a?a:c,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,opacity:u.opacity};w.push({type:"ribbon",pathD:i,style:d,datum:e})}if(!1!==o.showLabels){const t=(j=o.nodeLabel)?"function"==typeof j?j:e=>e[j]||e.id:null,n=u+12;for(const o of e){const e=o.__arcData;if(!e)continue;const i=t?t(o):o.id;if(!i)continue;const r=(e.startAngle+e.endAngle)/2,s=r-Math.PI/2;A.push({x:g+Math.cos(s)*n,y:f+Math.sin(s)*n,text:i+"",anchor:r>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var j;return{sceneNodes:k,sceneEdges:w,labels:A}}};function Ms(e,t,o){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const i=[];let r=0;for(;n.length>r;){const e=n[r];if("M"===e||"L"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("C"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;3>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("Q"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)for(let e=0;2>e&&n.length>r&&!isNaN(Number(n[r]));e++)i.push(Number(n[r])+t+""),r++,n.length>r&&!isNaN(Number(n[r]))&&(i.push(Number(n[r])+o+""),r++);else if("A"===e)for(i.push(e),r++;n.length>r&&!isNaN(Number(n[r]));)i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&i.push(n[r++]),n.length>r&&(i.push(Number(n[r])+t+""),r++),n.length>r&&(i.push(Number(n[r])+o+""),r++);else"Z"===e||"z"===e?(i.push(e),r++):(i.push(n[r]),r++)}return i.join(" ")}const Cs=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function _s(e){const[t,o,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*n>150?"#222":"#fff"}function Ps(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 Ls(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}function Ts(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:Cs}function $s(e){var t;return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:(null===(t=e.themeSemantic)||void 0===t?void 0:t.primary)?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Rs(e,t,o,n,i){if("horizontal"===i){const i=(e+o)/2;return`M ${e},${t} C ${i},${t} ${i},${n} ${o},${n}`}if("radial"===i){const i=(e+o)/2;return`M ${e},${t} Q ${i},${t} ${i},${(t+n)/2} T ${o},${n}`}{const i=(t+n)/2;return`M ${e},${t} C ${e},${i} ${o},${i} ${o},${n}`}}const Ns={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,n){var i;const r=o.__hierarchyRoot;if(!r)return;const s=o.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),c=o.hierarchySum,u="function"==typeof c?c:"string"==typeof c?e=>Number(e[c])||0:e=>Number(e.value)||0,d=l.hierarchy(r,a);d.sum(u),d.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,g]=n;switch(s){case"tree":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.tree();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);break;case"cluster":!function(e,t,o,n){const i=t.treeOrientation||"vertical",r=l.cluster();r.size("horizontal"===i?[n,o]:"radial"===i?[2*Math.PI,Math.min(o,n)/2*.8]:[o,n]),r(e)}(d,o,h,g);break;case"treemap":!function(e,t,o,n){var i,r;const s=null!==(i=t.padding)&&void 0!==i?i:4,a=null!==(r=t.paddingTop)&&void 0!==r?r:0,c=l.treemap().size([o,n]).tile(l.treemapBinary).padding(s);a>0&&c.paddingTop(a),c(e)}(d,o,h,g);break;case"circlepack":!function(e,t,o,n){var i;const r=null!==(i=t.padding)&&void 0!==i?i:4;l.pack().size([o,n]).padding(r)(e)}(d,o,h,g);break;case"partition":!function(e,t,o,n){var i;l.partition().size([o,n]).padding(null!==(i=t.padding)&&void 0!==i?i:1)(e)}(d,o,h,g)}const f=d.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;f.length>t;t++){const n=f[t],r={id:Ps(n,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:null!==(i=n.value)&&void 0!==i?i:0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===s||"cluster"===s?Bs(r,n,o):"treemap"===s||"partition"===s?Es(r,n):"circlepack"===s&&Ds(r,n),r.__hierarchyNode=n,e.push(r),p.set(n,r)}if("tree"===s||"cluster"===s)for(const e of f)if(e.parent){const o=p.get(e.parent),n=p.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 i=o.nodeStyle||(()=>({})),r=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,n,i,r){var s,a,l,c,u,d,h,g;const f=[],p=[],y=[],m=o.treeOrientation||"vertical",v="radial"===m,b=n[0]/2,x=n[1]/2,k="number"==typeof(w=o.nodeSize)?w:5;var w;for(const t of e){let e=t.x,n=t.y;v&&(e+=b,n+=x);const r=i(ms(t,"nodeStyle"));let l=r.fill||$s(o);if(o.colorByDepth&&void 0!==t.depth){const e=Ts(o);l=e[t.depth%e.length]}const c={fill:l,stroke:r.stroke||(null===(s=o.themeSemantic)||void 0===s?void 0:s.surface)||"#fff",strokeWidth:null!==(a=r.strokeWidth)&&void 0!==a?a:1,opacity:r.opacity};f.push({type:"circle",cx:e,cy:n,r:k,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const A=null!==(l=o.edgeOpacity)&&void 0!==l?l:.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let i=t.x,s=t.y,a=n.x,l=n.y;v&&(i+=b,s+=x,a+=b,l+=x);const g=Rs(i,s,a,l,m),f=r(ms(e,"edgeStyle")),y={fill:"none",stroke:f.stroke||(null===(c=o.themeSemantic)||void 0===c?void 0:c.border)||(null===(u=o.themeSemantic)||void 0===u?void 0:u.secondary)||"#999",strokeWidth:null!==(d=f.strokeWidth)&&void 0!==d?d:1.5,opacity:null!==(h=f.opacity)&&void 0!==h?h:A};p.push({type:"curved",pathD:g,style:y,datum:e})}if(!1!==o.showLabels){const t=Ls(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let n,i,r,s=o.x,a=o.y;if(v&&(s+=b,a+=x),v){const e=s-b,t=a-x,o=Math.sqrt(e*e+t*t);o>0?(n=s+e/o*10,i=a+t/o*10,r=0>e?"end":"start"):(n=s,i=a-12,r="middle")}else"horizontal"===m?((null===(g=o.data)||void 0===g?void 0:g.children)&&0!==o.data.children.length?(n=s-k-6,r="end"):(n=s+k+6,r="start"),i=a):(n=s,i=a+k+14,r="middle");y.push({x:n,y:i,text:e+"",anchor:r,baseline:"middle",fontSize:11})}}return{sceneNodes:f,sceneEdges:p,labels:y}}(e,t,o,n,i,r);case"treemap":case"partition":return function(e,t,o,n){var i,r,s,a,l;const c=[],u=[];for(const o of e){const e=o.x1-o.x0,s=o.y1-o.y0;if(0>=e||0>=s)continue;const a=n(ms(o,"nodeStyle"));let l=a.fill||$s(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ts(t);l=e[o.depth%e.length]}const u={fill:l,stroke:a.stroke||(null===(i=t.themeSemantic)||void 0===i?void 0:i.surface)||"#fff",strokeWidth:null!==(r=a.strokeWidth)&&void 0!==r?r:1,opacity:a.opacity};c.push({type:"rect",x:o.x0,y:o.y0,w:e,h:s,style:u,datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Ls(t.nodeLabel),i=t.labelMode||"leaf",r="partition"===t.chartType;for(const c of e){const e=c.x1-c.x0,d=c.y1-c.y0;if(0>=e||0>=d)continue;const h=!((null===(s=c.data)||void 0===s?void 0:s.children)&&c.data.children.length>0);if(!r){if("leaf"===i&&!h)continue;if("parent"===i&&h)continue}const g=o?o(c):c.id;if(!g)continue;if((h?30:40)>e||(h?16:14)>d)continue;let f=n(ms(c,"nodeStyle")).fill||$s(t);if(t.colorByDepth&&void 0!==c.depth){const e=Ts(t);f=e[c.depth%e.length]}const p="string"==typeof f?_s(f):null!==(l=null===(a=t.themeSemantic)||void 0===a?void 0:a.text)&&void 0!==l?l:"#000";u.push(h?{x:c.x0+e/2,y:c.y0+d/2,text:g+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,d)/6)),fill:p}:{x:c.x0+4,y:c.y0+12,text:g+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:p})}}return{sceneNodes:c,sceneEdges:[],labels:u}}(e,o,0,i);case"circlepack":return function(e,t,o,n){var i,r,s,a,l,c,u,d,h,g;const f=[],p=[];for(const o of e){const e=null!==(i=o.__radius)&&void 0!==i?i:5;if(0>=e)continue;const l=n(ms(o,"nodeStyle"));let c=l.fill||$s(t);if(t.colorByDepth&&void 0!==o.depth){const e=Ts(t);c=e[o.depth%e.length]}const u={fill:c,stroke:l.stroke||(null===(r=t.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=l.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=l.opacity)&&void 0!==a?a:.7};f.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=Ls(t.nodeLabel);for(const i of e){const e=null!==(l=i.__radius)&&void 0!==l?l:5,r=o?o(i):i.id;if(!r)continue;if(15>e)continue;const s=!((null===(c=i.data)||void 0===c?void 0:c.children)&&i.data.children.length>0);let a=n(ms(i,"nodeStyle")).fill||$s(t);if(t.colorByDepth&&void 0!==i.depth){const e=Ts(t);a=e[i.depth%e.length]}if(s){const o="string"==typeof a?_s(a):null!==(d=null===(u=t.themeSemantic)||void 0===u?void 0:u.text)&&void 0!==d?d:"#000";p.push({x:i.x,y:i.y,text:r+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else p.push({x:i.x,y:i.y-e+14,text:r+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:(null===(h=t.themeSemantic)||void 0===h?void 0:h.text)||"#000",stroke:(null===(g=t.themeSemantic)||void 0===g?void 0:g.surface)||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:f,sceneEdges:[],labels:p}}(e,o,0,i);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Bs(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 Es(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 Ds(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 Is(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}const Hs={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,n){const i=o.__hierarchyRoot;i&&function(e,t,o,n,i){var r,a;const l=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),c=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>{var o;return(null!==(o=e[t])&&void 0!==o?o:"")+""}}(o.nodeIDAccessor),u=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),d=null!==(r=o.orbitSize)&&void 0!==r?r:2.95,h=null!==(a=o.orbitEccentricity)&&void 0!==a?a:1,g="number"==typeof d?()=>d:d,f="number"==typeof h?()=>h:h,p=Is(o);p.metaMap.clear(),n.length=0,i.length=0;const y=new Map;function m(e){var t;const o=null!==(t=y.get(e))&&void 0!==t?t:0;return y.set(e,o+1),0===o?e:`${e}__${o}`}const v=t[0]/2,b=t[1]/2,x=Math.min(t[0],t[1])/2*.85,k=m(c(e));n.push({id:k,x:v,y:b,x0:v,x1:v,y0:b,y1:b,width:0,height:0,value:0,depth:0,data:e}),p.metaMap.set(k,{ring:x,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,r,a,d,h,y){const v=l(t);if(!(null==v?void 0:v.length))return;const b=v.length;let x=0,k=0,w=0;for(;b>k;)k+=u[Math.min(w,u.length-1)],w++,x++;let A=0;for(let b=0;x>b;b++){const k=u[Math.min(b,u.length-1)],w=v.slice(A,A+k);if(!w.length)break;const j=(b+1)/x,S={id:o,depth:h,data:t,parentId:o},O=y?d/g(S)*j:d*j,M=s.pie().value(e=>{var t;return(null===(t=l(e))||void 0===t?void 0:t.length)?4:1}).sort(null),C=M(w),_=f(S);for(let t=0;w.length>t;t++){const s=(C[t].startAngle+C[t].endAngle)/2,l=w[t],u=m(c(l)),d=r+O*Math.sin(s),g=a+O*Math.cos(s)*_;n.push({id:u,x:d,y:g,x0:d,x1:d,y0:g,y1:g,width:0,height:0,value:0,depth:h,data:l}),p.metaMap.set(u,{ring:O,angle:s,depth:h,parentId:o,eccentricity:_}),i.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(l,u,d,g,O,h+1,!0)}A+=k}}(e,k,v,b,x,1,!1)}(i,n,o,e,t)},buildScene(e,t,o,n){var i,r,s,a,l,c,u;const d=o.nodeStyle,h=o.nodeSize,g="number"==typeof h?()=>h:"function"==typeof h?h:()=>6,f=[],p=[],y=[];if(!1!==o.orbitShowRings){const t=Is(o),n=new Map;for(const t of e)n.set(t.id,t);const i=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;i.has(o)||i.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const r=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:n}]of i)for(let i=0;r>i;i++){const a=i/r*Math.PI*2,l=(i+1)/r*Math.PI*2;p.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*n,x2:e+o*Math.sin(l),y2:t+o*Math.cos(l)*n,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(ms(t,"nodeSize")),n=d?d(ms(t,"nodeStyle")):{},c={fill:n.fill||(null===(i=o.themeSemantic)||void 0===i?void 0:i.primary)||"#6366f1",stroke:n.stroke||(null===(r=o.themeSemantic)||void 0===r?void 0:r.surface)||"#fff",strokeWidth:null!==(s=n.strokeWidth)&&void 0!==s?s:1,opacity:null!==(a=n.opacity)&&void 0!==a?a:0===(null!==(l=t.depth)&&void 0!==l?l:0)?1:.85};f.push({type:"circle",cx:t.x,cy:t.y,r:e,style:c,datum:t,id:t.id,label:t.id,depth:t.depth})}const m=new Map;for(const t of e)m.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:m.get(e.source),o="object"==typeof e.target?e.target:m.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&p.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=g(ms(o,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(o):t&&null!==(u=null===(c=o.data)||void 0===c?void 0:c[t])&&void 0!==u?u:o.id;y.push({x:o.x,y:o.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:f,sceneEdges:p,labels:y}},tick:(e,t,o,n,i)=>!1!==o.orbitAnimated&&(function(e,t){var o,n;const i=Is(t),r=null!==(o=t.orbitSpeed)&&void 0!==o?o:.25,s=null!==(n=t.orbitRevolution)&&void 0!==n?n:function(e){switch(e){case"decay":return e=>{var t;return Math.pow(.6,null!==(t=e.depth)&&void 0!==t?t:0)};case"alternate":return e=>{var t;const o=null!==(t=e.depth)&&void 0!==t?t:0;return(o%2==0?1:-1)/(o+1)};default:return e=>{var t;return 1/((null!==(t=e.depth)&&void 0!==t?t:0)+1)}}}(t.orbitRevolutionStyle),a=(("undefined"!=typeof performance?performance.now():Date.now())-i.startTime)/1e3,l=r*(Math.PI/6),c=new Map;for(const t of e)c.set(t.id,t);for(const t of e){const e=i.metaMap.get(t.id);if(!e||!e.parentId)continue;const o=c.get(e.parentId);if(!o)continue;const n=e.angle+a*l*s({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=o.x+e.ring*Math.sin(n),t.y=o.y+e.ring*Math.cos(n)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)},Fs={sankey:xs,force:ks,chord:Os,tree:Ns,cluster:Ns,treemap:Ns,circlepack:Ns,partition:Ns,orbit:Hs};function Ws(e){return Fs[e]}class zs{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig=Object.assign(Object.assign({},wr),e.tensionConfig),e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new jr(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),this.config=e,this.tensionConfig=Object.assign(Object.assign({},wr),e.tensionConfig),!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new jr(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:r="target",valueAccessor:s="value"}=this.config,a="function"==typeof n?n:e=>e[n],l="function"==typeof i?i:e=>e[i],c="function"==typeof r?r:e=>e[r],u="function"==typeof s?s:e=>{var t;return null!==(t=e[s])&&void 0!==t?t:1};this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const t of e){const e=a(t)+"";this.nodes.set(e,Object.assign(Object.assign({},Ys(e)),{data:t}))}for(let e=0;t.length>e;e++){const o=t[e],n=l(o)+"",i=c(o)+"",r=u(o),s=null==r?NaN:Number(r),a=Number.isFinite(s)?s:1;this.nodes.has(n)||this.nodes.set(n,Object.assign(Object.assign({},Ys(n)),{data:o})),this.nodes.has(i)||this.nodes.set(i,Object.assign(Object.assign({},Ys(i)),{data:o}));const d=`${n}\0${i}\0${e}`,h={source:n,target:i,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:d};o&&"object"==typeof o&&Gs(o.bezier)&&(h.bezier=o.bezier),this.edges.set(d,h)}this.runLayout(o)}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:n}=e,i=0===this.nodes.size;let r=!1;const s="undefined"!=typeof performance?performance.now():Date.now();this.lastIngestTime=s,this._decaySortedNodes=null,this.nodes.has(t)||(this.nodes.set(t,Ys(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,r=!0),this.nodes.has(o)||(this.nodes.set(o,Ys(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,r=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=n,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,r=!0),i||r||c||this.tension>=this.tensionConfig.threshold}runLayout(e){var t,o,n,i,r,s,a,l;if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const c=Ws(this.config.chartType);if(!c)return;let u=Array.from(this.nodes.values());const d=Array.from(this.edges.values());if(0===u.length&&!c.hierarchical)return;if(this.prepareForRelayout(),c.supportsStreaming&&!c.hierarchical){const e=new Map;for(const a of u)if(void 0!==a._prevX0){const l=(null!==(t=a._prevX1)&&void 0!==t?t:0)-(null!==(o=a._prevX0)&&void 0!==o?o:0),c=(null!==(n=a._prevY1)&&void 0!==n?n:0)-(null!==(i=a._prevY0)&&void 0!==i?i:0);e.set(a.id,{x:(null!==(r=a._prevX0)&&void 0!==r?r:0)+l/2,y:(null!==(s=a._prevY0)&&void 0!==s?s:0)+c/2})}else 0===a.x&&0===a.y||e.set(a.id,{x:a.x,y:a.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(c.computeLayout(u,d,this.config,e),this.config.__previousPositions=void 0,c.hierarchical&&u.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null;for(const e of u)this.nodes.set(e.id,e);for(let e=0;d.length>e;e++){const t=d[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,u=Array.from(this.nodes.values())}this.finalizeLayout();const h=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||h.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=h,this.saveTargetPositions();const g=u.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),f=null!==(l=null===(a=this.config.transition)||void 0===a?void 0:a.duration)&&void 0!==l?l:this.tensionConfig.transitionDuration;if(!this._hasRenderedOnce&&this.config.introAnimation&&["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType)&&u.length>0&&f>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f}}else g&&f>0&&(this.restorePreviousPositions(),this.transition={startTime:performance.now(),duration:f});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime="undefined"!=typeof performance?performance.now():Date.now()),this.previousNodeIds=e,this.previousEdgeKeys=t}buildScene(e){var t,o,n,i,r,s,a;if(this._sceneNodesRevision++,this.config.customNetworkLayout){const l=Array.from(this.nodes.values()),c=Array.from(this.edges.values()),u=Hi(this.config.colorScheme,this.config.themeCategorical,Q),d={nodes:l,edges:c,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:null!==(t=this.config.themeSemantic)&&void 0!==t?t:{},categorical:[...u]},resolveColor:Fi(u),config:null!==(o=this.config.layoutConfig)&&void 0!==o?o:{},selection:null!==(n=this.config.layoutSelection)&&void 0!==n?n:null};let h;try{h=this.config.customNetworkLayout(d)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e),this.sceneNodes=[],this.sceneEdges=[],this.labels=[],void(this.customLayoutOverlays=null)}return this.sceneNodes=null!==(i=h.sceneNodes)&&void 0!==i?i:[],this.sceneEdges=null!==(r=h.sceneEdges)&&void 0!==r?r:[],this.labels=null!==(s=h.labels)&&void 0!==s?s:[],void(this.customLayoutOverlays=null!==(a=h.overlays)&&void 0!==a?a:null)}this.customLayoutOverlays=null;const l=Ws(this.config.chartType);if(!l)return;const c=l.hierarchical?Array.from(this.nodes.values()):this.nodesArray,u=l.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:d,sceneEdges:h,labels:g}=l.buildScene(c,u,this.config,e);this.sceneNodes=d,this.sceneEdges=h,this.labels=g}rebuildNodeQuadtree(){let e=0,t=0;for(const o of this.sceneNodes)"circle"===o.type&&(e++,o.r>t&&(t=o.r));if(this._maxNodeRadius=t,zs.QUADTREE_THRESHOLD>=e)return void(this._nodeQuadtree=null);const o=Array(e);let n=0;for(const e of this.sceneNodes)"circle"===e.type&&(o[n++]=e);this._nodeQuadtree=r.quadtree().x(e=>e.cx).y(e=>e.cy).addAll(o)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Ws(this.config.chartType);return!!(null==e?void 0:e.supportsAnimation)&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Ws(this.config.chartType);if(!(null==o?void 0:o.tick))return!1;const n=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,i=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(n,i,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Me(e,this.transition),o=Oe(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Ce(e._prevX0,e._targetX0,o),e.x1=Ce(e._prevX1,e._targetX1,o),e.y0=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Ce(e._prevY0,e._targetY0,o),e.y1=Ce(e._prevY1,e._targetY1,o),e.sankeyWidth=Ce(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=null==e?void 0:e.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}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),e._introFromZero=void 0;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 i=t.x1,r=o.x0,s=u.interpolateNumber(i,r);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(.5)},{x:e.y1,y:s(.5)},{x:e.y1,y:r}],halfWidth:n}}const i=t.x1,r=o.x0,s=u.interpolateNumber(i,r);return{circular:!1,points:[{x:i,y:e.y0},{x:s(.5),y:e.y0},{x:s(.5),y:e.y1},{x:r,y:e.y1}],halfWidth:n}}buildCircularBezier(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),n=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-n,y:o.targetY},{x:o.targetX-.66*n,y:o.targetY},{x:o.targetX-.33*n,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const i=[];for(let e=0;n.length-1>e;e++){const t=n[e],o=n[e+1],r=o.x-t.x,s=o.y-t.y;i.push([t,{x:t.x+r/3,y:t.y+s/3},{x:t.x+2*r/3,y:t.y+2*s/3},o])}return{circular:!0,segments:i,halfWidth:t}}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){var t,o,n,i,r;const s=this.config.pulse;if(!s)return;const a=null!==(t=s.duration)&&void 0!==t?t:500,l=null!==(o=s.color)&&void 0!==o?o:"rgba(255,255,255,0.6)",c=null!==(n=s.glowRadius)&&void 0!==n?n:4;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const n=this.nodeTimestamps.get(o);if(!n)continue;const i=e-n;a>i&&(t._pulseIntensity=1-i/a,t._pulseColor=l,t._pulseGlowRadius=c)}for(const t of this.sceneEdges){const o=t.datum;if(!o)continue;const n="object"==typeof o.source?null===(i=o.source)||void 0===i?void 0:i.id:o.source,s="object"==typeof o.target?null===(r=o.target)||void 0===r?void 0:r.id:o.target;if(!n||!s)continue;const c=this.edgeTimestamps.get(`${n}\0${s}`);if(!c)continue;const u=e-c;a>u&&(t._pulseIntensity=1-u/a,t._pulseColor=l)}}applyDecay(){var e,t;const o=this.config.decay;if(!o)return;const n=this.nodeTimestamps.size;if(1>=n)return;if(!this._decaySortedNodes){this._decaySortedNodes=Array.from(this.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const e=new Map;for(let t=0;this._decaySortedNodes.length>t;t++)e.set(this._decaySortedNodes[t][0],t);this._decayAgeMap=e}const i=this._decayAgeMap;for(const r of this.sceneNodes){const s=r.id;if(!s)continue;const a=i.get(s);if(void 0===a)continue;const l=je(o,a,n),c=null!==(t=null===(e=r.style)||void 0===e?void 0:e.opacity)&&void 0!==t?t:1;r.style=Object.assign(Object.assign({},r.style),{opacity:c*l})}}applyTopologyDiff(e){var t;if(0===this.addedNodes.size)return;const o=e-this.lastTopologyChangeTime;if(o>=2e3)return;const n=1-o/2e3;for(const e of this.sceneNodes){const o=e.id;o&&this.addedNodes.has(o)&&(e._pulseIntensity=Math.max(null!==(t=e._pulseIntensity)&&void 0!==t?t:0,n),e._pulseColor="rgba(34, 197, 94, 0.7)",e._pulseGlowRadius=8)}}get hasActiveTopologyDiff(){return 0!==this.addedNodes.size&&2e3>("undefined"!=typeof performance?performance.now():Date.now())-this.lastTopologyChangeTime}applyThresholds(e){var t,o;const n=this.config.thresholds;if(!n)return;const i=null!==(t=n.warningColor)&&void 0!==t?t:"#f59e0b",r=null!==(o=n.criticalColor)&&void 0!==o?o:"#ef4444",s=!1!==n.pulse;for(const t of this.sceneNodes){const o=t.id;if(!o)continue;const a=this.nodes.get(o);if(!a)continue;const l=n.metric(a);let c=null;void 0===n.critical||n.critical>l?void 0===n.warning||n.warning>l||(c=i):c=r,c&&(t.style=Object.assign(Object.assign({},t.style),{fill:c}),s&&(t._pulseIntensity=.6+.4*Math.sin(e/300),t._pulseColor=c,t._pulseGlowRadius=6))}}get hasActiveThresholds(){const e=this.config.thresholds;if(!e)return!1;for(const t of this.nodes.values()){const o=e.metric(t);if(void 0!==e.warning&&o>=e.warning||void 0!==e.critical&&o>=e.critical)return!0}return!1}get hasActivePulses(){var e;const t=this.config.pulse;if(!t||0===this.lastIngestTime)return!1;const o="undefined"!=typeof performance?performance.now():Date.now();return(null!==(e=t.duration)&&void 0!==e?e:500)>o-this.lastIngestTime}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){var o;const n=this.nodes.get(e);if(!n)return null;const i=n.data?Object.assign({},n.data):{};return n.data=t(null!==(o=n.data)&&void 0!==o?o:{}),this.layoutVersion++,i}updateEdge(e,t,o){var n;const i=this.config.valueAccessor,r="function"==typeof i?i:i?e=>e[i]:e=>e.value,s=[];for(const[,i]of this.edges)if(("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t){s.push(i.data?Object.assign({},i.data):{}),i.data=o(null!==(n=i.data)&&void 0!==n?n:{});const e=r(i.data);null!=e&&(i.value=Number(e))}return s.length>0&&this.layoutVersion++,s}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>null==e?void 0:e[t];for(const[t,i]of this.edges)i.data&&n(i.data)===e&&o.push(t)}else for(const[n,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&o.push(n);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&this.layoutVersion++,o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear()}}function Ys(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 Gs(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!qs(e))return!1;return!0}return qs(t.points)}function qs(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function Xs(e,t,o,n,i=30,r,s=0){let a=null,l=i,c=1/0;if(r){const e=Ke(r,o,n,i,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(r&&"circle"===t.type)continue;const e=Vs(t,o,n,i);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Js(e,o,n);t&&l>t.distance&&(a=t,l=t.distance)}return a}function Vs(e,t,o,n=30){switch(e.type){case"circle":return function(e,t,o,n=30){const i=t-e.cx,r=o-e.cy,s=Math.sqrt(i*i+r*r);return s>Xe(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,n);case"rect":return function(e,t,o){const n=qe(t,o,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const n=t-e.cx,i=o-e.cy,r=Math.sqrt(n*n+i*i);if(e.innerR-2>r||r>e.outerR+2)return null;const s=Qe(Math.atan2(i,n)),a=Qe(e.startAngle),l=Qe(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){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}}zs.QUADTREE_THRESHOLD=500;let Us=null,Qs=null;function Ks(){return Qs||(Us=document.createElement("canvas"),Us.width=1,Us.height=1,Qs=Us.getContext("2d")),Qs}function Zs(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch(e){return null}}function Js(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const n=Zs(e),i=Ks();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);case"line":return function(e,t,o){const n=e.x2-e.x1,i=e.y2-e.y1,r=n*n+i*i;if(0===r)return null;let s=((t-e.x1)*n+(o-e.y1)*i)/r;s=Math.max(0,Math.min(1,s));const a=e.x1+s*n,l=e.y1+s*i,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;const n=Zs(e),i=Ks();if(!n||!i)return null;try{if(i.isPointInPath(n,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const r=i.lineWidth;i.lineWidth=10;const s=i.isPointInStroke(n,t,o);if(i.lineWidth=r,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch(e){}return null}(e,t,o);default:return null}}function ea(t){const{width:o,height:n,totalWidth:i,totalHeight:r,margin:s,labels:a,title:l,legend:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g,legendPosition:f="right",legendLayout:y,foregroundGraphics:m,sceneNodes:v,annotations:b,autoPlaceAnnotations:x,svgAnnotationRules:k}=t,w=p.useMemo(()=>{const e=(v||[]).flatMap(e=>{const t=function(e){var t,o,n,i;const r=null!==(t=e.cx)&&void 0!==t?t:null!=e.x&&null!=e.w?e.x+e.w/2:e.x,s=null!==(o=e.cy)&&void 0!==o?o:null!=e.y&&null!=e.h?e.y+e.h/2:e.y;return"number"!=typeof r||"number"!=typeof s?null:{x:r,y:s,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):Math.max(1,null!==(n=e.w)&&void 0!==n?n:0,null!==(i=e.h)&&void 0!==i?i:0)/2}}(e),o=function(e){var t,o,n,i,r,s,a,l;const c=null!==(s=null!==(n=null!==(t=e.id)&&void 0!==t?t:null===(o=e.datum)||void 0===o?void 0:o.id)&&void 0!==n?n:null===(r=null===(i=e.datum)||void 0===i?void 0:i.data)||void 0===r?void 0:r.id)&&void 0!==s?s:null===(l=null===(a=e.datum)||void 0===a?void 0:a.data)||void 0===l?void 0:l.name;return null==c?void 0:c+""}(e);return t?[Object.assign({pointId:o},t)]:[]});return{scales:null,width:o,height:n,frameType:"network",pointNodes:e,sceneNodes:v}},[n,v,o]),A=p.useMemo(()=>b&&x?Po(Object.assign({annotations:b,context:w},"object"==typeof x?x:{})):b,[b,x,w]),j=A?lo(A.reduce((t,o,n)=>{if("widget"===o.type||!k)return t;const i=k(o,n,w);return i&&t.push({node:e.jsx(p.Fragment,{children:i},"annotation-"+n),annotation:o}),t},[])):null,S=!0===(null==A?void 0:A.some(e=>"widget"===e.type&&!0===e._annotationDeferred));return e.jsxs(e.Fragment,{children:[S&&e.jsx("style",{children:no},"annotation-widget-disclosure-style"),e.jsxs("svg",{role:"img",width:i,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[e.jsx("title",{children:"string"==typeof l?l:"Network Chart"}),e.jsx("desc",{children:"string"==typeof l?l+" — network data visualization":"Network data visualization"}),e.jsxs("g",{transform:`translate(${s.left},${s.top})`,children:[a.map((t,o)=>e.jsx("text",{x:t.x,y:t.y,textAnchor:t.anchor||"start",dominantBaseline:t.baseline||"middle",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"currentColor",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,style:{pointerEvents:"none"},children:t.text},"label-"+o)),j,m]}),l&&"string"==typeof l?e.jsx("text",{x:i/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:l}):l?e.jsx("foreignObject",{x:0,y:0,width:i,height:s.top,children:l}):null,Ht({legend:c,totalWidth:i,totalHeight:r,margin:s,legendPosition:f,title:l,legendLayout:y,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:g})]}),null==A?void 0:A.filter(e=>"widget"===e.type&&e.nodeId&&v).map((t,o)=>{var n,i,r,a,l,c,u,d,h;const g=!0===t._annotationDeferred,f=v.find(e=>{var o,n,i,r,s;return e.id===t.nodeId||(null===(o=e.datum)||void 0===o?void 0:o.id)===t.nodeId||(null===(i=null===(n=e.datum)||void 0===n?void 0:n.data)||void 0===i?void 0:i.id)===t.nodeId||(null===(s=null===(r=e.datum)||void 0===r?void 0:r.data)||void 0===s?void 0:s.name)===t.nodeId});if(!f)return null;const p=s.left+(null!==(n=f.cx)&&void 0!==n?n:null!=f.x&&null!=f.w?f.x+f.w/2:null!==(i=f.x)&&void 0!==i?i:0),y=s.top+(null!==(r=f.cy)&&void 0!==r?r:null!=f.y&&null!=f.h?f.y+f.h/2:null!==(a=f.y)&&void 0!==a?a:0),m=null!==(l=t.dx)&&void 0!==l?l:0,b=null!==(c=t.dy)&&void 0!==c?c:-16,x=null!==(u=t.width)&&void 0!==u?u:32,k=null!==(d=t.height)&&void 0!==d?d:32,w=null!==(h=t.content)&&void 0!==h?h:e.jsx("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return e.jsx("div",{className:g?"annotation-deferred":void 0,"data-annotation-disclosure":g?"deferred":void 0,style:{position:"absolute",left:p+m-x/2,top:y+b-k/2,width:x,height:k,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:w},"widget-"+o)})]})}function ta(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function oa(e,t){var o,n,i,r,s,a;if(!t.pathD)return;e.save();const l=ta(t);if(t.style.fill&&"none"!==t.style.fill){const s=t._gradient;if(s){const i=e.createLinearGradient(s.x0,0,s.x1,0),r=null!==(n=null!==(o=t.style.fillOpacity)&&void 0!==o?o:t.style.opacity)&&void 0!==n?n:.5,a="string"==typeof t.style.fill?t.style.fill:"#999",l=rt(e,a)||a;i.addColorStop(0,1===s.from?l:"transparent"),i.addColorStop(1,1===s.to?l:"transparent"),e.fillStyle=i,e.globalAlpha=r}else e.fillStyle="string"==typeof t.style.fill&&rt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(r=null!==(i=t.style.fillOpacity)&&void 0!==i?i:t.style.opacity)&&void 0!==r?r:.5;e.fill(l)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:.5,e.globalAlpha=.5*(null!==(a=t.style.opacity)&&void 0!==a?a:1),e.stroke(l)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(l)),e.restore()}function na(e,t){var o,n;e.save();const i=t.style.stroke||"#999";e.strokeStyle=rt(e,i)||i,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(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(null!==(n=t.style.strokeWidth)&&void 0!==n?n:1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function ia(e,t){var o,n,i,r;if(!t.pathD)return;e.save();const s=ta(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&rt(e,t.style.fill)||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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(i=t.style.strokeWidth)&&void 0!==i?i:.5,e.globalAlpha=.3*(null!==(r=t.style.opacity)&&void 0!==r?r:1),e.stroke(s)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(s)),e.restore()}function ra(e,t){var o,n;if(!t.pathD)return;e.save();const i=ta(t),r=t.style.stroke||"#999";e.strokeStyle=rt(e,r)||r,e.lineWidth=null!==(o=t.style.strokeWidth)&&void 0!==o?o:1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(i),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&rt(e,t.style.fill)||t.style.fill,e.globalAlpha=null!==(n=t.style.fillOpacity)&&void 0!==n?n:.1,e.fill(i)),e.restore()}ea.displayName="NetworkSVGOverlay";const sa={top:20,right:80,bottom:20,left:80},aa={top:40,right:40,bottom:40,left:40},la=new Set(["chord","force","circlepack","orbit"]),ca=[800,600],ua={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 da({data:t}){var o,n,i,r,s,a;if("edge"===t.nodeOrEdge){const o=t.data;return o?e.jsxs("div",{className:"semiotic-tooltip",style:ua,children:[e.jsxs("div",{style:{fontWeight:600},children:["object"==typeof o.source?o.source.id:o.source," → ","object"==typeof o.target?o.target.id:o.target]}),null!=o.value&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof o.value?o.value.toLocaleString():o.value+""]})]}):null}const l=t.data;if(!l)return null;const c=l.__hierarchyNode;if(c){const t=[];let s=c;for(;s;){const e=null!==(r=null!==(n=null===(o=s.data)||void 0===o?void 0:o.name)&&void 0!==n?n:null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:l.id;null!=e&&t.unshift(e+""),s=s.parent}t.length>1&&t.shift();const a=t.length-1;return e.jsxs("div",{className:"semiotic-tooltip",style:ua,children:[e.jsx("div",{children:t.map((t,o)=>e.jsxs("span",{children:[o>0&&e.jsx("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),o===a?e.jsx("strong",{children:t}):e.jsx("span",{style:{opacity:.7},children:t})]},o))}),null!=l.value&&l.value>0&&e.jsx("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof l.value?l.value.toLocaleString():l.value+""})]})}const u=((null===(s=l.sourceLinks)||void 0===s?void 0:s.length)||0)+((null===(a=l.targetLinks)||void 0===a?void 0:a.length)||0),d=(l.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(l.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0);return e.jsxs("div",{className:"semiotic-tooltip",style:ua,children:[e.jsx("div",{style:{fontWeight:600},children:l.id}),null!=l.value&&l.value>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof l.value?l.value.toLocaleString():l.value+""]}),u>0&&e.jsxs("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",u,d!==u&&` (weighted: ${d.toLocaleString()})`]})]})}da.ownsChrome=!0;const ha=t.forwardRef(function(o,n){var i,r,a,l,c,u,d,h,g,f,p,y,m,v,b,x,w,A,j;const{chartType:O,nodes:M,edges:C,data:_,initialEdges:P,nodeIDAccessor:L="id",sourceAccessor:T="source",targetAccessor:$="target",valueAccessor:R="value",edgeIdAccessor:N,childrenAccessor:B,hierarchySum:E,orientation:D="horizontal",nodeAlign:I="justify",nodePaddingRatio:H=.05,nodeWidth:F=15,iterations:W=300,forceStrength:z=.1,padAngle:Y=.01,groupWidth:G=20,sortGroups:q,edgeSort:X,treeOrientation:V="vertical",edgeType:U="curve",padding:Q,paddingTop:K,tensionConfig:Z,showParticles:J=!1,particleStyle:ee,nodeStyle:te,edgeStyle:oe,colorBy:ne,colorScheme:ie="category10",edgeColorBy:re="source",edgeOpacity:se=.5,colorByDepth:ae=!1,nodeSize:le=8,nodeSizeRange:ce=[5,20],nodeLabel:ue,showLabels:de=!0,labelMode:he,size:ge=ca,responsiveWidth:fe,responsiveHeight:pe,margin:ye,className:ve,background:be,enableHover:xe=!0,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:je,chartId:Se,onTopologyChange:Oe,annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:$e,legendClickBehavior:Re,legendHighlightedCategory:Ne,legendIsolatedCategories:Be,title:Ee,foregroundGraphics:De,backgroundGraphics:Ie,decay:He,pulse:Fe,transition:We,animate:ze,staleness:Ye,thresholds:qe,accessibleTable:Xe=!0,description:Ve,summary:Ue,orbitMode:Qe,orbitSize:Ke,orbitSpeed:Ze,orbitRevolution:Je,orbitRevolutionStyle:et,orbitEccentricity:tt,orbitShowRings:ot,orbitAnimated:nt,customNetworkLayout:it,layoutConfig:st,layoutSelection:at}=o,lt=la.has(O)?aa:sa,ct=t.useRef(!0),ut=ii({sizeProp:ge,responsiveWidth:fe,responsiveHeight:pe,userMargin:ye,marginDefault:lt,foregroundGraphics:De,backgroundGraphics:Ie,animate:ze,transitionProp:We,themeDirtyRef:ct}),{reducedMotionRef:dt,responsiveRef:ht,size:gt,margin:ft,adjustedWidth:pt,adjustedHeight:yt,resolvedForeground:mt,resolvedBackground:vt,transition:bt,introEnabled:xt,tableId:kt,rafRef:wt,renderFnRef:Ot,scheduleRender:Ct,currentTheme:Lt}=ut,Tt=ln(),$t=hn(),Rt=t.useMemo(()=>k(M),[M]),Nt=t.useMemo(()=>Array.isArray(C)?k(C):C,[C]),Bt=t.useMemo(()=>Object.assign(Object.assign({},wr),Z),[Z]),Et=t.useMemo(()=>Object.assign(Object.assign({},Ar),ee),[ee]),Dt=t.useMemo(()=>{var e;return{chartType:O,nodeIDAccessor:L,sourceAccessor:T,targetAccessor:$,valueAccessor:R,edgeIdAccessor:N,childrenAccessor:B,hierarchySum:E,orientation:D,nodeAlign:I,nodePaddingRatio:H,nodeWidth:F,iterations:W,forceStrength:z,padAngle:Y,groupWidth:G,sortGroups:q,edgeSort:X,treeOrientation:V,edgeType:U,padding:Q,paddingTop:K,tensionConfig:Bt,showParticles:J,particleStyle:Et,nodeStyle:te,edgeStyle:oe,nodeLabel:ue,showLabels:de,labelMode:he,colorBy:ne,colorScheme:ie,themeCategorical:null===(e=null==Lt?void 0:Lt.colors)||void 0===e?void 0:e.categorical,themeSemantic:S(Lt),edgeColorBy:re,edgeOpacity:se,colorByDepth:ae,nodeSize:le,nodeSizeRange:ce,decay:He,pulse:Fe,transition:bt,introAnimation:xt,staleness:Ye,thresholds:qe,orbitMode:Qe,orbitSize:Ke,orbitSpeed:Ze,orbitRevolution:Je,orbitRevolutionStyle:et,orbitEccentricity:tt,orbitShowRings:ot,orbitAnimated:nt,customNetworkLayout:it,layoutConfig:st,layoutSelection:at}},[O,L,T,$,R,B,E,D,I,H,F,W,z,Y,G,q,X,V,U,Q,K,Bt,J,Et,te,oe,ue,de,he,ne,ie,re,se,ae,le,ce,He,Fe,null==bt?void 0:bt.duration,null==bt?void 0:bt.easing,xt,Ye,qe,Qe,Ke,Ze,Je,et,tt,ot,nt,Lt,it,st,at]),It=fn(Dt),Ht=fn({chartType:O,nodeIDAccessor:L,sourceAccessor:T,targetAccessor:$,valueAccessor:R,childrenAccessor:B,hierarchySum:E,orientation:D,nodeAlign:I,nodePaddingRatio:H,nodeWidth:F,iterations:W,forceStrength:z,padAngle:Y,groupWidth:G,sortGroups:q,edgeSort:X,treeOrientation:V,edgeType:U,padding:Q,paddingTop:K,tensionConfig:Bt,orbitMode:Qe,orbitSize:Ke,orbitEccentricity:tt,customNetworkLayout:it}),Ft=t.useRef(null),Wt=t.useRef(0),zt=t.useRef(0),Yt=t.useRef(!1),Gt=t.useRef(null);Gt.current||(Gt.current=new zs(It));const[qt,Xt]=t.useState(null),[Vt,Ut]=t.useState(0),[Qt,Kt]=t.useState(0),[Zt,Jt]=t.useState(!1),eo=t.useRef(null),to=t.useRef(new Map),oo=t.useRef(0),no=t.useCallback(e=>{if("function"==typeof ne)return ne(e)+"";if("string"==typeof ne&&e.data){const t=e.data[ne];if(void 0!==t){if(!to.current.has(t+"")){const e=Array.isArray(ie)?ie:me;to.current.set(t+"",e[oo.current++%e.length])}return to.current.get(t+"")}}if(to.current.has(e.id))return to.current.get(e.id);const t=Array.isArray(ie)?ie:me,o=ne?t[oo.current++%t.length]:t[0];return to.current.set(e.id,o),o},[ne,ie]),io=(null===(i=null==Lt?void 0:Lt.colors)||void 0===i?void 0:i.border)||(null===(r=null==Lt?void 0:Lt.colors)||void 0===r?void 0:r.secondary)||(null===(a=null==Lt?void 0:Lt.colors)||void 0===a?void 0:a.primary)||"#999",ro=t.useCallback(e=>{var t,o;return e?"object"==typeof e?e:null!==(o=null===(t=Gt.current)||void 0===t?void 0:t.nodes.get(e))&&void 0!==o?o:null:null},[]),so=t.useCallback(e=>{if("function"==typeof re)return re(e);const t=ro(e.source),o=ro(e.target);return"target"===re&&o?no(o):t?no(t):io},[re,no,io,ro]),ao=t.useCallback(e=>{if("function"==typeof Et.color){const t=ro(e.source);return t?Et.color(e,t):io}if(!(null==ee?void 0:ee.colorBy))return so(e);const t=Et.colorBy,o=ro(e.source),n=ro(e.target);return"target"===t&&n?no(n):o?no(o):io},[null==ee?void 0:ee.colorBy,Et.color,Et.colorBy,no,so,io,ro]),lo=("sankey"===O||!!it)&&J||!!Fe||null!==(c=null===(l=Gt.current)||void 0===l?void 0:l.isAnimating)&&void 0!==c&&c;t.useEffect(()=>{var e;null===(e=Gt.current)||void 0===e||e.updateConfig(It),ct.current=!0,Ct()},[It,Ct]),t.useEffect(()=>{var e;const t=Gt.current;if(t){t.buildScene([pt,yt]);for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&to.current.set(o.id,o.style.fill);ct.current=!0,Ct()}},[Lt,pt,yt,Ct]);const co=t.useCallback(()=>{var e;const t=Gt.current;if(!t)return;t.runLayout([pt,yt]),t.buildScene([pt,yt]),ct.current=!0;for(const o of t.sceneNodes)o.id&&"string"==typeof(null===(e=o.style)||void 0===e?void 0:e.fill)&&to.current.set(o.id,o.style.fill);const o=Array.isArray(ie)?ie:me,n=Array.from(t.nodes.values());for(let e=0;n.length>e;e++){const t=n[e];to.current.has(t.id)||to.current.set(t.id,o[e%o.length])}if(oo.current=n.length,Ut(t.layoutVersion),Oe){const{nodes:e,edges:o}=t.getLayoutData();Oe(e,o)}},[pt,yt,Oe,ie]),uo=t.useCallback(e=>{if(null==e||"object"!=typeof e)return;const t=Gt.current;t&&(t.ingestEdge(e)&&co(),Ct())},[co,Ct]),ho=t.useCallback(e=>{const t=Gt.current;if(!t)return;let o=!1;for(const n of e)null!=n&&"object"==typeof n&&t.ingestEdge(n)&&(o=!0);o&&co(),Ct()},[co,Ct]),go=t.useCallback(()=>{var e,t,o;null===(e=Gt.current)||void 0===e||e.clear(),to.current.clear(),oo.current=0,Ut(null!==(o=null===(t=Gt.current)||void 0===t?void 0:t.layoutVersion)&&void 0!==o?o:0),Xt(null),eo.current=null,ct.current=!0,Ct()},[Ct]),fo=t.useCallback(()=>{const e=Gt.current;e&&(e.tension+=999,co(),Ct())},[co,Ct]);t.useImperativeHandle(n,()=>({push:uo,pushMany:ho,removeNode:e=>{var t,o,n;const i=null!==(o=null===(t=Gt.current)||void 0===t?void 0:t.removeNode(e))&&void 0!==o&&o;if(i){const t=(null===(n=eo.current)||void 0===n?void 0:n.data)?"function"==typeof L?L(eo.current.data):eo.current.data[L]:void 0;eo.current&&"node"===eo.current.nodeOrEdge&&t===e&&(eo.current=null,Xt(null)),to.current.delete(e),co(),ct.current=!0,Ct()}return i},removeEdge:(e,t)=>{var o,n;const i=null!==(n=null===(o=Gt.current)||void 0===o?void 0:o.removeEdge(e,t))&&void 0!==n&&n;if(i){if(eo.current&&"edge"===eo.current.nodeOrEdge){const o=eo.current.data;let n;n=void 0!==t?("object"==typeof(null==o?void 0:o.source)?o.source.id:null==o?void 0:o.source)===e&&("object"==typeof(null==o?void 0:o.target)?o.target.id:null==o?void 0:o.target)===t:!N||!o||("function"==typeof N?N:e=>null==e?void 0:e[N])(o)===e,n&&(eo.current=null,Xt(null))}co(),ct.current=!0,Ct()}return i},updateNode:(e,t)=>{var o,n;const i=null!==(n=null===(o=Gt.current)||void 0===o?void 0:o.updateNode(e,t))&&void 0!==n?n:null;return i&&(ct.current=!0,Ct()),i},updateEdge:(e,t,o)=>{var n,i;const r=null!==(i=null===(n=Gt.current)||void 0===n?void 0:n.updateEdge(e,t,o))&&void 0!==i?i:[];return r.length>0&&(co(),ct.current=!0,Ct()),r},clear:go,getTopology:()=>{var e,t;return null!==(t=null===(e=Gt.current)||void 0===e?void 0:e.getLayoutData())&&void 0!==t?t:{nodes:[],edges:[]}},getTopologyDiff:()=>{const e=Gt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:fo,getTension:()=>{var e,t;return null!==(t=null===(e=Gt.current)||void 0===e?void 0:e.tension)&&void 0!==t?t:0}}),[uo,ho,go,fo,co,Ct]);const po=["tree","cluster","treemap","circlepack","partition","orbit"].includes(O),yo=po?_||(Array.isArray(C)?void 0:C):void 0;t.useEffect(()=>{var e;const t=Gt.current;if(t)if(po&&yo)t.ingestHierarchy(yo,[pt,yt]),t.buildScene([pt,yt]),ct.current=!0,Ct();else{const o=Rt,n=Array.isArray(Nt)?Nt:[];if(0===o.length&&0===n.length)return;t.ingestBounded(o,n,[pt,yt]),t.buildScene([pt,yt]);for(const o of t.sceneNodes)o.id&&(null===(e=o.style)||void 0===e?void 0:e.fill)&&to.current.set(o.id,o.style.fill+"");const i=Array.isArray(ie)?ie:me,r=Array.from(t.nodes.values());for(let e=0;r.length>e;e++){const t=r[e];to.current.has(t.id)||to.current.set(t.id,i[e%i.length])}oo.current=r.length,ct.current=!0,Ct()}},[Rt,Nt,_,yo,po,pt,yt,Ht,Ct,ie]),t.useEffect(()=>{P&&P.length>0&&ho(P)},[]);const mo=t.useCallback(e=>{if(we&&we(e),je){const t=Date.now();je(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Se}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Se})}},[we,je,Se]),vo=t.useCallback(e=>{if(Ae&&Ae(e),je){const t=Date.now();je(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:Se}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:Se})}},[Ae,je,Se]),{hoverHandlerRef:bo,hoverLeaveRef:xo,onPointerMove:ko,onPointerLeave:wo}=ut;bo.current=e=>{if(!xe)return;const t=Ft.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return void(eo.current&&(eo.current=null,Xt(null),mo&&(mo(null),ct.current=!0),Ct()));const r=Gt.current;if(!r)return;const s=Xs(r.sceneNodes,r.sceneEdges,n,i,30,r.nodeQuadtree,r.maxNodeRadius);if(!s)return void(eo.current&&(eo.current=null,Xt(null),mo&&(mo(null),ct.current=!0),Ct()));const a=qn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type});eo.current=a,Xt(a),mo&&(mo(a),ct.current=!0),Ct()},xo.current=()=>{eo.current&&(eo.current=null,Xt(null),mo&&(mo(null),ct.current=!0),Ct())};const Ao=t.useRef(()=>{});Ao.current=e=>{if(!Ae&&!je)return;const t=Ft.current;if(!t)return;const o=t.getBoundingClientRect(),n=e.clientX-o.left-ft.left,i=e.clientY-o.top-ft.top;if(0>n||n>pt||0>i||i>yt)return;const r=Gt.current;if(!r)return;const s=Xs(r.sceneNodes,r.sceneEdges,n,i,30,r.nodeQuadtree,r.maxNodeRadius);vo(s?qn(s.datum||{},s.x,s.y,{nodeOrEdge:s.type}):null)};const jo=t.useCallback(e=>Ao.current(e),[]),So=t.useRef(-1),Oo=t.useRef(null),Mo=t.useRef(-1),Co=t.useCallback(e=>{var t;const o=Gt.current;if(!o)return;const n=function(e){var t,o,n,i,r,s;const a=[];for(const l of e)if("circle"===l.type&&null!=l.cx){if(0>=l.r)continue;a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(o=null===(t=l.datum)||void 0===t?void 0:t.id)&&void 0!==o?o:"_default"})}else if("rect"===l.type&&null!=l.x){if(0>=l.w||0>=l.h)continue;a.push({x:l.x+l.w/2,y:l.y+l.h/2,datum:l.datum,shape:"rect",w:l.w,h:l.h,group:null!==(i=null===(n=l.datum)||void 0===n?void 0:n.id)&&void 0!==i?i:"_default"})}else"arc"===l.type&&null!=l.cx&&a.push({x:l.cx,y:l.cy,datum:l.datum,shape:"circle",group:null!==(s=null===(r=l.datum)||void 0===r?void 0:r.id)&&void 0!==s?s:"_default"});return a.sort((e,t)=>e.x-t.x||e.y-t.y),a}(o.sceneNodes);if(0===n.length)return;const i=At(n),r=So.current;if(0>r){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),So.current=0,Mo.current=-1;const t=i.flat[0];Oo.current={shape:t.shape,w:t.w,h:t.h};const o=qn(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return eo.current=o,Xt(o),mo&&(mo(o),ct.current=!0),void Ct()}const s=jt(i,r),a=function(e,t,o,n,i){var r,s,a;const l=o.flat[t.flatIndex];if(!l)return St(e,t,o);const c=null===(r=l.datum)||void 0===r?void 0:r.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const n=null!==(s=function(e,t,o){let n=null,i=1/0;for(let r=0;e.flat.length>r;r++){const s=e.flat[r];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;i>u&&(i=u,n=r)}return n}(o,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up"))&&void 0!==s?s:t.flatIndex;return n!==t.flatIndex&&(i.current=-1),n}case"Enter":{if(null==c)return t.flatIndex;const e=function(e,t){var o;const n=e+"",i=[];for(const e of t){const t=null!==(o=e.datum)&&void 0!==o?o:e,r=Mt(t.source),s=Mt(t.target),a=null!=r,l=null!=s;a&&r+""===n&&l?i.push(s+""):l&&s+""===n&&a&&i.push(r+"")}return i}(c,n);if(0===e.length)return t.flatIndex;const r=null!==(a=o.idToIdx.get(e[(i.current+1)%e.length]))&&void 0!==a?a:-1;return 0>r?t.flatIndex:(i.current=-1,r)}default:{const n=St(e,t,o);return null!==n&&n!==t.flatIndex&&(i.current=-1),n}}}(e.key,s,i,null!==(t=o.sceneEdges)&&void 0!==t?t:[],Mo);if(null===a)return;if(e.preventDefault(),0>a)return So.current=-1,Oo.current=null,Mo.current=-1,eo.current=null,Xt(null),mo&&(mo(null),ct.current=!0),void Ct();So.current=a;const l=i.flat[a];Oo.current={shape:l.shape,w:l.w,h:l.h};const c={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};eo.current=c,Xt(c),mo&&(mo(c),ct.current=!0),Ct()},[mo,Ct]),_o=t.useCallback(e=>{So.current=-1,Oo.current=null,ko(e)},[ko]);Ot.current=()=>{var e,t,o,n,i,r,s;wt.current=0;const a=Ft.current;if(!a)return;const l=a.getContext("2d");if(!l)return;const c=Gt.current;if(!c)return;const u=performance.now(),d=Wt.current?Math.min((u-Wt.current)/1e3,.1):.016;Wt.current=u;const h=c.advanceTransition(dt.current?u+1e6:u),g=!dt.current&&h,f=!dt.current&&c.tickAnimation([pt,yt],d);(h||ct.current||f)&&c.buildScene([pt,yt]);const p=si();if(!ri(a,gt,ft,p))return;if(l.clearRect(-ft.left,-ft.top,gt[0],gt[1]),be){const e=rt(l,be);e&&(l.fillStyle=e,l.fillRect(0,0,pt,yt))}He&&c.applyDecay(),Fe&&c.applyPulse(u),qe&&c.applyThresholds(u),c.applyTopologyDiff(u);const y=null!==(e=null==Ye?void 0:Ye.threshold)&&void 0!==e?e:5e3,m=Ye&&c.lastIngestTime>0&&u-c.lastIngestTime>y;if(m&&(l.globalAlpha=null!==(t=null==Ye?void 0:Ye.dimOpacity)&&void 0!==t?t:.5),function(e,t){for(const o of t)switch(o.type){case"bezier":oa(e,o);break;case"line":na(e,o);break;case"ribbon":ia(e,o);break;case"curved":ra(e,o)}}(l,c.sceneEdges),function(e,t){var o,n,i;for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&rt(e,t.style.fill)||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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.strokeRect(t.x,t.y,t.w,t.h)),di(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("circle"!==r.type)continue;const t=r;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="string"==typeof t.style.fill&&rt(e,t.style.fill)||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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),hi(e,t),e.restore())}}(l,c.sceneNodes),function(e,t){var o,n,i;for(const r of t){if("arc"!==r.type)continue;const t=r;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="string"==typeof t.style.fill&&rt(e,t.style.fill)||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=rt(e,t.style.stroke)||t.style.stroke,e.lineWidth=null!==(n=t.style.strokeWidth)&&void 0!==n?n:1,e.globalAlpha=null!==(i=t.style.opacity)&&void 0!==i?i:1,e.stroke()),e.restore()}}(l,c.sceneNodes),J&&c.particlePool&&!m){const e=c.edgesArray;if(e.length>0){!function(e,t,o,n){var i,r;const s=null!==(i=n.spawnRate)&&void 0!==i?i:Ar.spawnRate,a=null!==(r=n.maxPerEdge)&&void 0!==r?r:Ar.maxPerEdge;for(let n=0;t.length>n;n++){const i=t[n];if(!i.bezier)continue;if(e.countForEdge(n)>=a)continue;const r=i.value*s*o*(i.bezier.circular?.3:1),l=Math.floor(r),c=r-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(n)<a;t++)e.spawn(n)}}(c.particlePool,e,d,Et);const t=.5*(null!==(o=Et.speedMultiplier)&&void 0!==o?o:1);let n;if(Et.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);n=e.map(e=>.3+(e.value||1)/t*1.7)}c.particlePool.step(d,t,e,n),function(e,t,o,n,i){var r,s;const a=null!==(r=n.radius)&&void 0!==r?r:Ar.radius,l=null!==(s=n.opacity)&&void 0!==s?s:Ar.opacity;e.globalAlpha=l;for(let r=0;t.particles.length>r;r++){const s=t.particles[r];if(!s.active)continue;const l=o[s.edgeIndex];if(!l)continue;let c;c="string"==typeof n.color&&"inherit"!==n.color?n.color:i(l),e.fillStyle=rt(e,c)||c,e.beginPath(),e.arc(s.x,s.y,a,0,2*Math.PI),e.fill()}e.globalAlpha=1}(l,c.particlePool,e,Et,ao)}}m&&(l.globalAlpha=1);const v=ct.current;if(ct.current=!1,v||g||f){const e=Ft.current;e&&e.setAttribute("aria-label",An(null!==(i=null===(n=c.sceneNodes)||void 0===n?void 0:n.length)&&void 0!==i?i:0,null!==(s=null===(r=c.sceneEdges)||void 0===r?void 0:r.length)&&void 0!==s?s:0,"Network chart"))}const b=v||g||f||Yt.current;b&&u-zt.current>=33?(Kt(e=>e+1),zt.current=u,Yt.current=!1):Yt.current=!!b,(lo||g||null!=c.transition||f||c.hasActivePulses||c.hasActiveThresholds||c.hasActiveTopologyDiff||Yt.current)&&(wt.current=requestAnimationFrame(()=>Ot.current()))},gn({hydrated:Tt,wasHydratingFromSSR:$t,storeRef:Gt,dirtyRef:ct,renderFnRef:Ot}),t.useEffect(()=>{ct.current=!0,Ct()},[O,pt,yt,be,Ct]),_t(Ye,Gt,ct,Ct,Zt,Jt);const Po=xe&&qt?e.jsx(Jn,{x:qt.x,y:qt.y,containerWidth:pt,containerHeight:yt,margin:ft,className:"stream-network-tooltip",zIndex:2,children:ke?ke(qt):e.jsx(da,{data:qt})}):null;if(sn||!Tt&&$t){const t=Gt.current;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(O),o=e?_||(Array.isArray(C)?void 0:C):void 0;if(e&&o)t.ingestHierarchy(o,[pt,yt]),t.buildScene([pt,yt]);else{const e=Rt,o=Array.isArray(Nt)?Nt:[];(e.length>0||o.length>0)&&(t.ingestBounded(e,o,[pt,yt]),t.buildScene([pt,yt]))}}const o=null!==(u=null==t?void 0:t.sceneNodes)&&void 0!==u?u:[],n=null!==(d=null==t?void 0:t.sceneEdges)&&void 0!==d?d:[],i=null!==(h=null==t?void 0:t.labels)&&void 0!==h?h:[];return e.jsxs("div",{ref:ht,className:"stream-network-frame"+(ve?" "+ve:""),role:"img","aria-label":Ve||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:fe?"100%":gt[0],height:pe?"100%":gt[1]},children:[e.jsx(Hn,{summary:Ue}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:gt[0],height:gt[1],style:{position:"absolute",left:0,top:0},children:[vt&&e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt}),e.jsxs("g",{transform:`translate(${ft.left},${ft.top})`,children:[be&&e.jsx("rect",{x:0,y:0,width:pt,height:yt,fill:be}),n.map((t,o)=>function(t,o){switch(t.type){case"line":return e.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+o);case"bezier":{const n=t;return e.jsx("path",{d:n.pathD,fill:nn(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"ribbon":{const n=t;return e.jsx("path",{d:n.pathD,fill:nn(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+o)}case"curved":{const n=t;return e.jsx("path",{d:n.pathD,fill:nn(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+o)}default:return null}}(t,o)).filter(Boolean),o.map((t,o)=>function(t,o){switch(t.type){case"circle":{const n=t;return e.jsx("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:nn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-circle-"+o)}case"rect":{const n=t;return e.jsx("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:nn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-rect-"+o)}case"arc":{const n=t,i=s.arc().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(on)||"";return e.jsx("path",{d:i,transform:`translate(${n.cx},${n.cy})`,fill:nn(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-arc-"+o)}default:return null}}(t,o)).filter(Boolean),i.map((t,o)=>function(t,o){return e.jsx("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"#333",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+o)}(t,o)).filter(Boolean)]})]}),e.jsx(ea,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,labels:i,sceneNodes:o,title:Ee,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:$e,legendClickBehavior:Re,legendHighlightedCategory:Ne,legendIsolatedCategories:Be,foregroundGraphics:Ge(mt,null===(g=Gt.current)||void 0===g?void 0:g.customLayoutOverlays),annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,annotationFrame:0})]})}const Lo=Gt.current;return e.jsxs("div",{ref:ht,className:"stream-network-frame"+(ve?" "+ve:""),role:"group","aria-label":Ve||("string"==typeof Ee?Ee:"Network chart"),tabIndex:0,style:{position:"relative",width:fe?"100%":gt[0],height:pe?"100%":gt[1],overflow:"visible"},onKeyDown:Co,children:[Xe&&e.jsx(Fn,{tableId:kt}),Xe&&e.jsx(In,{nodes:null!==(f=null==Lo?void 0:Lo.sceneNodes)&&void 0!==f?f:[],edges:null!==(p=null==Lo?void 0:Lo.sceneEdges)&&void 0!==p?p:[],chartType:"Network chart",tableId:kt,chartTitle:"string"==typeof Ee?Ee:void 0}),e.jsx(Hn,{summary:Ue}),e.jsx(Wn,{hoverPoint:qt}),e.jsxs("div",{role:"img","aria-label":Ve||("string"==typeof Ee?Ee:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:xe?_o:void 0,onMouseLeave:xe?wo:void 0,onClick:Ae||je?jo:void 0,children:[vt&&e.jsx("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:gt[0],height:gt[1],pointerEvents:"none",overflow:"visible"},children:e.jsx("g",{transform:`translate(${ft.left},${ft.top})`,children:vt})}),e.jsx("canvas",{ref:Ft,"aria-label":An(null!==(m=null===(y=null==Lo?void 0:Lo.sceneNodes)||void 0===y?void 0:y.length)&&void 0!==m?m:0,null!==(b=null===(v=null==Lo?void 0:Lo.sceneEdges)||void 0===v?void 0:v.length)&&void 0!==b?b:0,"Network chart"),style:{position:"absolute",top:0,left:0}}),e.jsx(ea,{width:pt,height:yt,totalWidth:gt[0],totalHeight:gt[1],margin:ft,labels:(null==Lo?void 0:Lo.labels)||[],sceneNodes:null==Lo?void 0:Lo.sceneNodes,title:Ee,legend:Pe,legendPosition:Le,legendLayout:Te,legendHoverBehavior:$e,legendClickBehavior:Re,legendHighlightedCategory:Ne,legendIsolatedCategories:Be,foregroundGraphics:Ge(mt,null===(x=Gt.current)||void 0===x?void 0:x.customLayoutOverlays),annotations:Me,autoPlaceAnnotations:Ce,svgAnnotationRules:_e,annotationFrame:Qt}),e.jsx(Yn,{active:So.current>=0,hoverPoint:qt,margin:ft,size:gt,shape:null===(w=Oo.current)||void 0===w?void 0:w.shape,width:null===(A=Oo.current)||void 0===A?void 0:A.w,height:null===(j=Oo.current)||void 0===j?void 0:j.h}),Po,(null==Ye?void 0:Ye.showBadge)&&e.jsx(Pt,{isStale:Zt,position:Ye.badgePosition})]})]})});function ga(e){const{title:t,description:o,summary:n,accessibleTable:i,className:r,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),n&&(c.summary=n),void 0!==i&&(c.accessibleTable=i),r&&(c.className=r),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function fa(e){const{linkedHover:t,onObservation:o,onClick:n,hoverHighlight:i,customHoverBehavior:r,customClickBehavior:s,linkedHoverInClickPredicate:a=!0}=e,l={};return(t||o||n||i)&&(l.customHoverBehavior=r),(a?o||n||t:o||n)&&(l.customClickBehavior=s),l}function pa(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Zn(t)||o}}function ya(e){return"string"==typeof e?e:"value"}function ma(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function va(e,t){if(!t)return ma(e);try{const o=t(e);return null==o?ma(e):o}catch(t){return ma(e)}}function ba(e,t){return"function"==typeof t?t(e):e[t]}function xa(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,n)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";o.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y0)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y0:void 0},format:t}),o.push({label:i,accessor:e=>{var t,o,i,r;return null!==(i=null===(o=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[n])||void 0===o?void 0:o.y1)&&void 0!==i?i:0===n?null===(r=null==e?void 0:e.band)||void 0===r?void 0:r.y1:void 0},format:t})}),o}function ka(t){const o=t.find(e=>"title"===e.role),n=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const r=o?va(ba(i,o.accessor),o.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[null!=r&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((t,o)=>{const n=va(ba(i,t.accessor),t.format);return e.jsxs("div",{style:o>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:n})]},o)})]})}}function wa({categoryAccessor:t,valueAccessor:o,groupAccessor:n,groupLabel:i,pieData:r=!1,valueFormat:s}){return a=>{var l;const c=r?(null===(l=a.data)||void 0===l?void 0:l[0])||a.data||a:a.data||a,u=ba(c,t),d=ba(c,o),h=n?ba(c,n):void 0;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[e.jsx("div",{style:{fontWeight:"bold"},children:ma(u)}),e.jsx("div",{style:{marginTop:4},children:va(d,s)}),null!=h&&e.jsxs("div",{style:{marginTop:2,opacity:.8},children:[i||ya(n),": ",ma(h)]})]})}}ha.displayName="StreamNetworkFrame";const Aa=t.createContext(null);function ja({colors:o,categories:n,colorScheme:i="category10",children:r}){const s=t.useMemo(()=>{if(o)return o;if(n){const e=Array.isArray(i)?i:ye[i]||me,t={};for(let o=0;n.length>o;o++)t[n[o]]=e[o%e.length];return t}return{}},[o,n,i]);return e.jsx(Aa.Provider,{value:s,children:r})}function Sa(){return t.useContext(Aa)}function Oa(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,i]=n.range;t.push(t=>{const n=t[o];return n>=e&&i>=n})}return e=>t.every(t=>t(e))}function Ma(e,t){const o=[];for(const[n,i]of e.clauses)"crossfilter"===e.resolution&&n===t||o.push(Oa(i));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function Ca(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}ja.displayName="CategoryColorProvider";const[_a,Pa]=A(e=>({selections:new Map,setClause(t,o){e(e=>{const n=new Map(e.selections),i=Ca(n,t),r=new Map(i.clauses);return r.set(o.clientId,o),n.set(t,Object.assign(Object.assign({},i),{clauses:r})),{selections:n}})},clearClause(t,o){e(e=>{const n=e.selections.get(t);if(!n)return{};const i=new Map(e.selections),r=new Map(n.clauses);return r.delete(o),i.set(t,Object.assign(Object.assign({},n),{clauses:r})),{selections:i}})},setResolution(t,o){e(e=>{const n=new Map(e.selections),i=Ca(n,t);return n.set(t,Object.assign(Object.assign({},i),{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}})}})),[La,Ta]=A(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function $a(e){const o=t.useId(),n=e.clientId||o,{name:i}=e,r=Pa(e=>e.selections.get(i)),s=Pa(e=>e.setClause),a=Pa(e=>e.clearClause),l=t.useMemo(()=>!!r&&r.clauses.size>0,[r]);return{predicate:t.useMemo(()=>r&&0!==r.clauses.size?Ma(r,n):()=>!0,[r,n]),isActive:l,selectPoints:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"point",values:new Set(n)};s(i,{clientId:n,type:"point",fields:t})},[n,i,s]),selectInterval:t.useCallback(e=>{const t={};for(const[o,n]of Object.entries(e))t[o]={type:"interval",range:n};s(i,{clientId:n,type:"interval",fields:t})},[n,i,s]),clear:t.useCallback(()=>{a(i,n)},[a,i,n]),clientId:n}}function Ra(e){const o=e.name||"hover",{fields:n}=e,{predicate:i,isActive:r,selectPoints:s,clear:a}=$a({name:o});return{onHover:t.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,o]),predicate:i,isActive:r}}function Na(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ba(e){const{name:o,xField:n,yField:i}=e,{predicate:r,isActive:s,selectInterval:a,clear:l}=$a({name:o}),c=n&&i?"xyBrush":n?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void l();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Na(e)?n&&(t[n]=[Math.min(...e),Math.max(...e)]):"yBrush"===c&&Na(e)&&i&&(t[i]=[Math.min(...e),Math.max(...e)]),Object.keys(t).length>0&&a(t)},[c,n,i,a,l]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:r,isActive:s,clear:l}}function Ea(e={}){const{limit:o=50,types:n,chartId:i}=e,r=Ta(e=>e.version),s=Ta(e=>e.observations),a=Ta(e=>e.clearObservations),l=t.useMemo(()=>{let e=s;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return i&&(e=e.filter(e=>e.chartId===i)),e.length>o&&(e=e.slice(e.length-o)),e},[s,n,i,o,r]);return{observations:l,latest:l.length>0?l[l.length-1]:null,clear:a}}const Da=t.createContext(!1),Ia=t.createContext(null),Ha="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Fa(e){const t=new Set,o=[];for(const n of e)t.has(n)||(t.add(n),o.push(n));return o}function Wa(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function za(e){const o=t.useContext(Ia),n=t.useId(),i=Fa(e),r=t.useRef([]);Wa(r.current,i)||(r.current=i);const s=r.current;Ha(()=>{if(o)return()=>o.unregisterCategories(n)},[o,n]),Ha(()=>{o&&o.registerCategories(n,s)},[o,n,s])}function Ya({selections:e}){const o=Pa(e=>e.setResolution);return t.useEffect(()=>{for(const[t,n]of Object.entries(e))n.resolution&&o(t,n.resolution)},[e,o]),null}function Ga({categoryColors:o,interaction:n,selectionName:i,field:r}){const s=Object.entries(o),a=s.map(([e])=>e),l=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:s.map(([e,t])=>({label:e,color:t})),label:""}],c=Ra({name:i,fields:[r]}),u=$a({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[g,f]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===n&&(d.size>0?p.current({[r]:Array.from(d)}):y.current())},[n,d,r]);const m=t.useCallback(e=>{"highlight"===n&&(e?(f(e.label),c.onHover({[r]:e.label})):(f(null),c.onHover(null)))},[n,r,c]),v=t.useCallback(e=>{"isolate"===n&&h(t=>{const o=new Set(t);return o.has(e.label)?o.delete(e.label):o.add(e.label),o.size===a.length?new Set:o})},[n,a.length]),[b,[x]]=ti([0,0],!0,!1),k=t.useMemo(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,n=1;for(const i of e){const e=26+7*i.length;o>0&&o+e>t&&(n++,o=0),o+=e}return n}(s.map(([e])=>e),x),[s,x]);return 0===s.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(Et,{legendGroups:l,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===n?m:void 0,customClickBehavior:"isolate"===n?v:void 0,highlightedCategory:g,isolatedCategories:d})})})}function qa({children:o,selections:n,showLegend:i,legendPosition:r="top",legendInteraction:s="none",legendSelectionName:a="legend",legendField:l="category"}){const c=Sa(),[u,d]=t.useState({}),h=t.useRef({}),g=t.useMemo(()=>({registerCategories:(e,t)=>{const o=Fa(t);d(t=>{var n;return Wa(null!==(n=t[e])&&void 0!==n?n:[],o)?t:Object.assign(Object.assign({},t),{[e]:o})})},unregisterCategories:e=>{d(t=>{if(!(e in t))return t;const o=Object.assign({},t);return delete o[e],o})}}),[]),f=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const o of t)e.push(o);return Fa(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},o=h.current;let n=Object.keys(t).length+Object.keys(o).length;for(const e of f)t[e]||o[e]||(o[e]=me[n%me.length],n++);const i=Object.assign({},t);for(const n of f)i[n]=null!==(e=t[n])&&void 0!==e?e:o[n];return i},[c,f]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(_a,{children:e.jsxs(La,{children:[n&&e.jsx(Ya,{selections:n}),e.jsx(Ia.Provider,{value:g,children:e.jsx(ja,{colors:p,children:e.jsxs(Da.Provider,{value:m,children:[y&&"top"===r&&e.jsx(Ga,{categoryColors:p,interaction:s,selectionName:a,field:l}),o,y&&"bottom"===r&&e.jsx(Ga,{categoryColors:p,interaction:s,selectionName:a,field:l})]})})})]})})}function Xa({data:e,colorBy:t,colorScale:o,getColor:n,strokeColor:i,strokeWidth:r,categories:s}){const a=(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,r)=>{const s=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),a=s?n(s,t,o):o?o(i):ve[r%ve.length];return{label:i+"",color:a}});return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==i&&(o.stroke=i),void 0!==r&&(o.strokeWidth=r),o},type:"fill",items:a,label:""}]}}function Va(e){return e?"string"==typeof e?{name:e}:e:null}function Ua(e,t,o){return t?(n,...i)=>{var r;const s=Object.assign({},e(n,...i));if(t.isActive)if(t.predicate(n))(null==o?void 0:o.selectedStyle)&&Object.assign(s,o.selectedStyle);else{const e=null!==(r=null==o?void 0:o.unselectedOpacity)&&void 0!==r?r:.5;s.opacity=e,s.fillOpacity=e,s.strokeOpacity=e,(null==o?void 0:o.unselectedStyle)&&Object.assign(s,o.unselectedStyle)}return s}:e}const Qa={light:C,dark:_,"high-contrast":P,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function Ka(e){return Qa[e]}const Za=p.createContext(void 0),Ja="undefined"==typeof window?p.useEffect:p.useLayoutEffect;function el(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return Ka(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function tl({theme:e}){const t=$(e=>e.setTheme),o=$(e=>e.theme),n=p.useRef(o);n.current=o;const i=p.useRef(null);p.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(i.current=n.current===P?C:n.current,t("high-contrast")),ei(o,e=>{var o,r;e.matches?(i.current=n.current===P?null!==(o=i.current)&&void 0!==o?o:C:n.current,t("high-contrast")):(function(e,t){e(t===C?"light":t===_?"dark":t===P?"high-contrast":t)}(t,null!==(r=i.current)&&void 0!==r?r:C),i.current=null)})},[e,t]);const r=p.useRef(!1);return Ja(()=>{r.current?void 0!==e&&t(el(e)):r.current=!0},[e,t]),null}function ol({children:t}){var o,n,i,r,s;const a=$(e=>e.theme),l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({position:"relative","--semiotic-bg":a.colors.background,"--semiotic-text":a.colors.text,"--semiotic-text-secondary":a.colors.textSecondary,"--semiotic-grid":a.colors.grid,"--semiotic-border":a.colors.border,"--semiotic-cell-border":a.colors.cellBorder||a.colors.border,"--semiotic-primary":a.colors.primary,"--semiotic-font-family":a.typography.fontFamily},a.colors.focus?{"--semiotic-focus":a.colors.focus}:{}),(null===(o=a.tooltip)||void 0===o?void 0:o.background)?{"--semiotic-tooltip-bg":a.tooltip.background}:{}),(null===(n=a.tooltip)||void 0===n?void 0:n.text)?{"--semiotic-tooltip-text":a.tooltip.text}:{}),(null===(i=a.tooltip)||void 0===i?void 0:i.borderRadius)?{"--semiotic-tooltip-radius":a.tooltip.borderRadius}:{}),(null===(r=a.tooltip)||void 0===r?void 0:r.fontSize)?{"--semiotic-tooltip-font-size":a.tooltip.fontSize}:{}),(null===(s=a.tooltip)||void 0===s?void 0:s.shadow)?{"--semiotic-tooltip-shadow":a.tooltip.shadow}:{}),a.borderRadius?{"--semiotic-border-radius":a.borderRadius}:{}),a.colors.selection?{"--semiotic-selection-color":a.colors.selection}:{}),null!=a.colors.selectionOpacity?{"--semiotic-selection-opacity":a.colors.selectionOpacity+""}:{}),a.colors.diverging?{"--semiotic-diverging":a.colors.diverging}:{}),a.colors.annotation?{"--semiotic-annotation-color":a.colors.annotation}:{}),null!=a.typography.legendSize?{"--semiotic-legend-font-size":a.typography.legendSize+"px"}:{}),null!=a.typography.titleFontSize?{"--semiotic-title-font-size":a.typography.titleFontSize+"px"}:{}),null!=a.typography.tickFontFamily?{"--semiotic-tick-font-family":a.typography.tickFontFamily}:{}),null!=a.typography.tickSize?{"--semiotic-tick-font-size":a.typography.tickSize+"px"}:{}),null!=a.typography.labelSize?{"--semiotic-axis-label-font-size":a.typography.labelSize+"px"}:{}),{"--semiotic-secondary":a.colors.secondary||a.colors.primary,"--semiotic-surface":a.colors.surface||a.colors.background}),a.colors.success?{"--semiotic-success":a.colors.success}:{}),a.colors.danger?{"--semiotic-danger":a.colors.danger}:{}),a.colors.warning?{"--semiotic-warning":a.colors.warning}:{}),a.colors.error?{"--semiotic-error":a.colors.error}:{}),a.colors.info?{"--semiotic-info":a.colors.info}:{}),c=p.useContext(Za),u={};return c&&(u["data-semiotic-theme"]=c),e.jsx("div",Object.assign({style:l},u,{children:t}))}function nl(){return $(e=>e.theme)}const il="#007bff";function rl(e,t,o){var n;const i=null!==(n=e.xValue)&&void 0!==n?n:null==t?void 0:t[o];if(null==i)return null;const r=Number(i);return Number.isFinite(r)?r:null}function sl(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function al(){var e;const t=nl(),o=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return o&&o.length>0?o:void 0}function ll(e,t,o,n,i){if(e)return e;let r;if(Array.isArray(o))r=o;else if(t&&t.length>0)r=t;else if("string"==typeof o){const e=ye[o];Array.isArray(e)&&(r=e)}return r&&0!==r.length?null!=n?(i.has(n)||i.set(n,i.size),r[i.get(n)%r.length]):r[0]:il}function cl(e,o,n){const i=Sa(),r=al();return t.useMemo(()=>{var t;if(!o)return;const s=null!==(t=null!=n?n:r&&r.length>0?r:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof o){const t=Array.from(new Set(e.map(e=>o(e)+"")));if(i&&Object.keys(i).length>0){const e=we(t.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return we(t.map(e=>({_cat:e})),"_cat",s)}if(i&&Object.keys(i).length>0){const t=we(e,o,s);return e=>i[e]||t(e)}return we(e,o,s)}if(i&&Object.keys(i).length>0){const e=we([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,o,n,i,r])}function ul(e,o,n){return t.useMemo(()=>{if(!o||"auto"===o||"function"==typeof o)return e;const t=[...e],i=function(e){return"function"==typeof e?e:t=>t[e]}(n);return t.sort("asc"===o?(e,t)=>i(e)-i(t):(e,t)=>i(t)-i(e))},[e,o,n])}function dl({selection:e,linkedHover:o,fallbackFields:n=[],unwrapData:i=!1,onObservation:r,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(o,n),g="series"===(null==h?void 0:h.mode)?[h.seriesField||u||n[0]].filter(e=>!!e):(null==h?void 0:h.fields)||n||[],f=$a({name:(null==e?void 0:e.name)||"__unused__"}),p=Ra({name:(null==h?void 0:h.name)||"hover",fields:g}),y=Ta(e=>e.pushObservation),m=e?{isActive:f.isActive,predicate:f.predicate}:null,[v,b]=t.useState(null),x=u||n[0],k=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:o=>{var n;return("string"==typeof o[t]?o[t]:(null!==(n=o[t])&&void 0!==n?n:"")+"")===e}}},[c,v,x]),w=t.useCallback(e=>{var t,n;if(o)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const o=rl(e,t,h.xField);null!=o&&function(e,t,o){const n=Lo.positions.get(e);(null==n?void 0:n.locked)||n&&n.xValue===t&&n.sourceId===o||(Lo={positions:new Map(Lo.positions).set(e,{xValue:t,sourceId:o})},$o())}(h.name||"hover",o,d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&Ro(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=null==t?void 0:t[x];b(null!=o?o+"":null)}else b(null);if(r||y){const o={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const i=sl(e),s=Object.assign(Object.assign({},o),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0});r&&r(s),y&&y(s)}else{const e=Object.assign(Object.assign({},o),{type:"hover-end"});r&&r(e),y&&y(e)}}},[o,p,h,d,r,s,a,y,c,x]),A=t.useCallback(e=>{var t,o,n,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=rl(e,t,h.xField);null!=o&&function(e,t,o){const n=Lo.positions.get(e);if(null==n?void 0:n.locked){const t=new Map(Lo.positions);return t.delete(e),Lo={positions:t},$o(),!1}Lo={positions:new Map(Lo.positions).set(e,{xValue:t,sourceId:o,locked:!0})},$o()}(h.name||"hover",o,d)}if(e&&l){let n=e.data||e.datum||e;Array.isArray(n)&&(n=n[0]),l(n,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0})}if(r||y){const t={timestamp:Date.now(),chartType:s||"unknown",chartId:a};if(e){const o=sl(e),s=Object.assign(Object.assign({},t),{type:"click",datum:o||{},x:null!==(n=e.x)&&void 0!==n?n:0,y:null!==(i=e.y)&&void 0!==i?i:0});r&&r(s),y&&y(s)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});r&&r(e),y&&y(e)}}},[l,r,y,s,a,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{No(e,d),Ro(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:k,customHoverBehavior:w,customClickBehavior:A,crosshairSourceId:d}}function hl(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==o?void 0:o.mode))return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function gl({data:e,colorBy:o,colorScale:n,showLegend:i,legendPosition:r="right",userMargin:s,defaults:a={top:50,bottom:60,left:70,right:40},categories:l}){const c=t.useContext(Da),u=null!==t.useContext(Ia),d=void 0!==i?i:!c&&!!o,h=!!o&&(d||u),g=t.useMemo(()=>{if(!h)return[];if(void 0!==l)return l;const t=new Set;for(const n of e){const e="function"==typeof o?o(n):n[o];null!=e&&t.add(e+"")}return Array.from(t)},[l,o,e,h]);za(u&&o?g:[]);const f=t.useMemo(()=>{if(!d||!o)return;const t=Xa({data:e,colorBy:o,colorScale:n,getColor:ke,categories:g});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,o,e,n,g]),p=t.useMemo(()=>{const e="number"==typeof s?{top:s,bottom:s,left:s,right:s}:null!=s?s:{},t=t=>{const o=e[t];return"number"==typeof o?o:a[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},n=t=>"number"==typeof e[t];return f&&("right"===r&&!n("right")&&110>o.right?o.right=110:"left"===r&&!n("left")&&110>o.left?o.left=110:"top"===r&&!n("top")&&50>o.top?o.top=50:"bottom"===r&&!n("bottom")&&80>o.bottom&&(o.bottom=80)),o},[a,s,f,r]);return{legend:f,margin:p,legendPosition:r}}function fl(e,o,n){const[i,r]=t.useState(null),[s,a]=t.useState(new Set),l=t.useCallback(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=t.useCallback(t=>{"isolate"===e&&a(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=t.useMemo(()=>{if(!e||"none"===e||!o)return null;const t="string"==typeof o?o:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof o?o(e):null)===i}:"isolate"===e&&s.size>0?{isActive:!0,predicate:e=>{const n=t?e[t]:"function"==typeof o?o(e):null;return s.has(n)}}:null},[e,o,i,s]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?s:new Set,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}const pl={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function yl(e,t,o){var n,i,r,s,a,l,c;const u=pl[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(n=t.width)&&void 0!==n?n:e&&"primary"!==e||!(null==o?void 0:o.width)?u.width:o.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==o?void 0:o.height)?u.height:o.height,showAxes:null!==(r=t.showAxes)&&void 0!==r?r:u.showAxes,showGrid:null!==(s=t.showGrid)&&void 0!==s?s:u.showGrid,enableHover:null!==(a=t.enableHover)&&void 0!==a?a:!!t.linkedHover||u.enableHover,showLegend:null!==(l=t.showLegend)&&void 0!==l?l:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:ml(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function ml(e,t,o){if(!1!==t)return e;const n=Object.assign({},e);return"horizontal"===o?n.left=Math.min(n.left,15):n.bottom=Math.min(n.bottom,15),n}function vl({componentName:t,message:o,diagnosticHint:n,width:i,height:r}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:o}),n&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}class bl extends p.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:t}=this.props,o=this.state.error;return"function"==typeof t?t(o):void 0!==t?t:e.jsx(vl,{componentName:"ChartErrorBoundary",message:o.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var xl;const kl="undefined"!=typeof process&&"production"!==(null===(xl=process.env)||void 0===xl?void 0:xl.NODE_ENV);function wl({componentName:t,width:o,height:n,children:i}){return e.jsx(bl,{fallback:i=>e.jsx(vl,{componentName:t,message:i.message,width:o,height:n}),children:i})}const Al={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},jl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Sl(t,o,n,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},Al),{width:o,height:n}),children:i||"No data available"}):null}function Ol(t,o,n,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:o,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const r=Math.min(5,Math.floor(n/40)),s=Math.max(8,Math.floor(n/(3*r))),a=Math.max(6,Math.floor(n/(2.5*r))),l=Math.floor((n-(r*(s+a)-a))/2);return e.jsx("div",{style:{width:o,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(t,n)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},jl),{position:"absolute",top:l+n*(s+a),left:Math.floor(.1*o),width:30+(37*n+13)%50+"%",height:s,opacity:.5+n%2*.2})},n))})}function Ml(e,t,o,n){if(!kl)return;if(!t||0===t.length)return;if("string"!=typeof n)return;const i=t[0];if(!i||"object"!=typeof i)return;if(n in i)return;const r=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${o} "${n}" not found in data. Available keys: ${r}`)}function Cl(e,t){const o=e.length,n=t.length,i=Array(n+1);for(let e=0;n>=e;e++)i[e]=e;for(let r=1;o>=r;r++){let o=i[0];i[0]=r;for(let s=1;n>=s;s++){const n=i[s];i[s]=e[r-1]===t[s-1]?o:1+Math.min(o,i[s],i[s-1]),o=n}}return i[n]}function _l(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function Pl(e,t){var o;if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(null!==(o=function(e,t,o=3){let n,i=o+1;for(const o of t){const t=Cl(e.toLowerCase(),o.toLowerCase());i>t&&(i=t,n=o)}return i>o?void 0:n}(e,t,3))&&void 0!==o?o:null)}function Ll({componentName:e,data:t,accessors:o,requiredProps:n}){if(n)for(const[t,o]of Object.entries(n))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(o){const n=_l(t).find(e=>e&&"object"==typeof e);if(n){const t=Object.keys(n);for(const[i,r]of Object.entries(o))if(r&&"string"==typeof r&&!(r in n)){const o=Pl(r,t),n=o?` Try ${i}="${o}".`:"";return`${e}: ${i} "${r}" not found in data. Available fields: ${t.join(", ")}.${n}`}}}return null}function Tl({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function $l({componentName:e,nodes:t,edges:o,nodesRequired:n=!1,edgesRequired:i=!0,accessors:r}){if(null==t&&null==o)return null;if(i&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(n&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(r&&t&&t.length>0){const o=_l(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[n,i]of Object.entries(r))if(i&&"string"==typeof i&&!(i in o)){const o=Pl(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in node data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Rl(e){const o=$(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,n;if(void 0!==e||void 0!==o)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(n=null==e?void 0:e.unselectedOpacity)&&void 0!==n?n:o})},[e,o])}function Nl(e){const{data:o,rawData:n,colorBy:i,colorScheme:r,legendInteraction:s,legendPosition:a,selection:l,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:g,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:v,hoverHighlight:b,loading:x,loadingContent:w,emptyContent:A,width:j,height:S}=e,O=void 0===n,M=t.useMemo(()=>k(o),[o]),[C,_]=t.useState([]),P=t.useCallback(e=>{_(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:T,hoverSelectionHook:$,customHoverBehavior:R,customClickBehavior:N,crosshairSourceId:B}=dl({selection:l,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:g,chartId:f,onClick:v,hoverHighlight:b,colorByField:L}),E=hl(c,B),D=cl(M,i,r),I=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const o="function"==typeof i?i(t):t[i];null!=o&&e.add(o+"")}return Array.from(e)},[M,i]),H=t.useMemo(()=>O&&C.length>0?C:I,[O,C,I]),F=fl(s,i,H),W=t.useMemo(()=>$||(F.legendSelectionHook?F.legendSelectionHook:T),[$,F.legendSelectionHook,T]),z=Rl(l),Y=al(),G=Sa(),q=t.useMemo(()=>{if(D)return D;if(!i||0===H.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:Y&&Y.length>0?Y:ve,t="__streamCat",o=we(H.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||o(e)||"#999"},[D,i,H,r,Y,G]),{legend:X,margin:V,legendPosition:U}=gl({data:M,colorBy:i,colorScale:q,showLegend:p,legendPosition:a,userMargin:y,defaults:m,categories:H}),Q=t.useMemo(()=>{const e={};return X&&(e.legend=X,e.legendPosition=U),s&&"none"!==s&&(e.legendHoverBehavior=F.onLegendHover,e.legendClickBehavior=F.onLegendClick,e.legendHighlightedCategory=F.highlightedCategory,e.legendIsolatedCategories=F.isolatedCategories),O&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[X,U,s,F.onLegendHover,F.onLegendClick,F.highlightedCategory,F.isolatedCategories,O,i,P]),K=Array.isArray(n)?k(n):n,Z=Ol(x,j,S,w),J=Z?null:Sl(K,j,S,A);return{data:M,colorScale:D,allCategories:H,legendState:F,effectiveSelectionHook:W,activeSelectionHook:T,customHoverBehavior:R,customClickBehavior:N,legend:X,margin:V,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:Q,crosshairProps:E,resolvedSelection:z}}function Bl(e,o){const{variant:n,frameRef:i,overrides:r,deps:s}=o;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.remove(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i;return null!==(i=null===(n=e.current)||void 0===n?void 0:n.update(t,o))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]},getScales:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==o?o:null}}}if("network"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n,i,r,s;const a=Array.isArray(t)?t:[t],l=null!==(i=null===(n=null===(o=e.current)||void 0===o?void 0:o.getTopology())||void 0===n?void 0:n.nodes)&&void 0!==i?i:[],c=[];for(const t of a){const o=l.find(e=>e.id===t);o&&c.push(Object.assign(Object.assign({},null!==(r=o.data)&&void 0!==r?r:{}),{id:t})),null===(s=e.current)||void 0===s||s.removeNode(t)}return c},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var n;const i=null===(n=e.current)||void 0===n?void 0:n.updateNode(t,o);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o,n,i;return null!==(i=null===(n=null===(o=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===o?void 0:o.nodes)||void 0===n?void 0:n.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.push(t)},pushMany:t=>{var o;return null===(o=e.current)||void 0===o?void 0:o.pushMany(t)},remove:t=>{var o,n;return null!==(n=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==n?n:[]},update:(t,o)=>{var n,i,r;const s=null!==(i=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==i?i:[];for(const t of s)null===(r=e.current)||void 0===r||r.push(o(t));return s},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,o;return null!==(o=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==o?o:[]}}}const o=t;return{push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i,r;const s=null!==(i=null===(n=o.current)||void 0===n?void 0:n.removeLine(e))&&void 0!==i?i:[];for(const e of s)null===(r=o.current)||void 0===r||r.pushLine(t(e));return s},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(n,i);return Object.assign(Object.assign({},e),r)},null!=s?s:[])}function El(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>{const n=e(...t)||{};return Object.assign(Object.assign({},n),o)}:(...e)=>Object.assign({},o)}function Dl(e){const{colorBy:o,colorScale:n,color:i,pointRadius:r=5,radiusFn:s,fillOpacity:a=1,fallbackFill:l,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,colorDatumAccessor:p}=e,y=t.useMemo(()=>e=>{const t="function"==typeof c?c(e):c,u=t?Object.assign({},t):{};if(void 0===u.fillOpacity&&(u.fillOpacity=a),void 0===u.fill)if(o){if(n){const t=p?p(e):e;u.fill=ke(t,o,n)}}else u.fill=l?l(e):i||il;return void 0===u.r&&(u.r=s?s(e):r),u},[o,n,i,r,s,a,l,c,p]),m=t.useMemo(()=>El(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return t.useMemo(()=>Ua(m,null!=g?g:null,f),[m,g,f])}function Il(e){const{accessor:o,data:n,isPushMode:i}=e,r=t.useRef(null),[s,a]=t.useState(0),l=t.useCallback(e=>{if(!i||!o)return;let t=!1;for(const n of e){const e="function"==typeof o?o(n):n[o];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,t=!0),i>r.current[1]&&(r.current[1]=i,t=!0)):(r.current=[i,i],t=!0))}t&&a(e=>e+1)},[i,o]),c=t.useCallback(()=>{i&&(r.current=null,a(e=>e+1))},[i]),u=t.useMemo(()=>{var e;if(i)return null!==(e=r.current)&&void 0!==e?e:void 0;if(!o||0===n.length)return;const t="function"==typeof o?o:e=>e[o];let s=1/0,a=-1/0;for(const e of n){const o=t(e);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(s>n&&(s=n),n>a&&(a=n))}return Number.isFinite(s)&&Number.isFinite(a)?[s,a]:void 0},[n,o,i,s]);return{domain:u,trackPushed:l,reset:c}}function Hl(e){var t;if(!e)return;const o="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=o.method)&&void 0!==t?t:"linear"},null!=o.bandwidth&&{bandwidth:o.bandwidth}),null!=o.order&&{order:o.order}),null!=o.color&&{color:o.color}),null!=o.strokeWidth&&{strokeWidth:o.strokeWidth}),null!=o.strokeDasharray&&{strokeDasharray:o.strokeDasharray}),null!=o.label&&{label:o.label})}function Fl(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 i=0;for(n=Object.getOwnPropertySymbols(e);n.length>i;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(o[n[i]]=e[n[i]])}return o}function Wl(e,t,o,n){return new(o||(o=Promise))(function(i,r){function s(e){try{l(n.next(e))}catch(e){r(e)}}function a(e){try{l(n.throw(e))}catch(e){r(e)}}function l(e){e.done?i(e.value):function(e){return e instanceof o?e:new o(function(t){t(e)})}(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const zl="__forecastSegment";let Yl=null;function Gl(){return Wl(this,void 0,void 0,function*(){return Yl||(Yl=yield Promise.resolve().then(function(){return mh})),Yl})}const ql="__semiotic_resolvedX",Xl="__semiotic_resolvedY";function Vl(e){const{data:o,xAccessor:n,yAccessor:i,forecast:r,anomaly:s,groupBy:a}=e,l="string"==typeof n?n:ql,c="string"==typeof i?i:Xl,u=t.useMemo(()=>{if(!r&&!s)return o;const e="function"==typeof n,t="function"==typeof i;return e||t?o.map(o=>{const r=Object.assign({},o);return e&&(r[ql]=n(o)),t&&(r[Xl]=i(o)),r}):o},[o,r,s,n,i]),[d,h]=t.useState(null),[g,f]=t.useState([]),p=t.useRef(r),y=t.useRef(s);return t.useEffect(()=>{if(!r&&!s)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=s));let e=!1;const t=r!==p.current||s!==y.current;if(p.current=r,y.current=s,t&&(h(null),f([])),r){const t=a&&"string"==typeof a&&"object"==typeof r?Object.assign(Object.assign({},r),{_groupBy:a}):r;(function(...e){return Wl(this,void 0,void 0,function*(){return(yield Gl()).buildForecast(...e)})})(u,l,c,t,s).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else s&&function(...e){return Wl(this,void 0,void 0,function*(){return(yield Gl()).buildAnomalyAnnotations(...e)})}(s).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[u,r,s,l,c,a]),{effectiveData:d?d.processedData:o,statisticalAnnotations:g,hasForecast:!!d,xAccessorKey:l,yAccessorKey:c}}const Ul=t.forwardRef(function(o,n){const i=t.useRef(null),r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xScaleType:g,yScaleType:f,colorBy:y,colorScheme:m,sizeBy:v,sizeRange:b=[3,15],pointRadius:x=5,pointOpacity:w=.8,tooltip:A,marginalGraphics:j,pointIdAccessor:S,annotations:O,regression:M,forecast:C,anomaly:_,xExtent:P,yExtent:L,frameProps:T={},selection:$,linkedHover:R,linkedBrush:N,onObservation:B,onClick:E,hoverHighlight:D,chartId:I,loading:H,loadingContent:F,emptyContent:W,legendInteraction:z,legendPosition:Y,color:G,stroke:q,strokeWidth:X,opacity:V}=o,{width:U,height:Q,enableHover:K,showGrid:Z,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:ne,xLabel:ie,yLabel:re}=r,se=t.useMemo(()=>k(s),[s]),ae=void 0===s,{domain:le,trackPushed:ce,reset:ue}=Il({accessor:v,data:se,isPushMode:ae}),de=t.useCallback(e=>{var t;ce([e]),null===(t=i.current)||void 0===t||t.push(e)},[ce]),he=t.useCallback(e=>{var t;ce(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[ce]);Bl(n,{variant:"xy",frameRef:i,overrides:{push:de,pushMany:he,clear:()=>{var e;ue(),null===(e=i.current)||void 0===e||e.clear()}},deps:[de,he,ue]});const ge=Nl({data:se,rawData:s,colorBy:y,colorScheme:m,legendInteraction:z,legendPosition:Y,selection:$,linkedHover:R,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:B,onClick:E,hoverHighlight:D,chartType:"Scatterplot",chartId:I,showLegend:J,userMargin:a,marginDefaults:r.marginDefaults,loading:H,loadingContent:F,emptyContent:W,width:U,height:Q}),fe=Va(N),pe=Ba({name:(null==fe?void 0:fe.name)||"__unused_brush__",xField:(null==fe?void 0:fe.xField)||("string"==typeof d?d:void 0),yField:(null==fe?void 0:fe.yField)||("string"==typeof h?h:void 0)}),ye=fe?"xyBrush"===pe.brushInteraction.brush?"xy":"xBrush"===pe.brushInteraction.brush?"x":"y":void 0,me=p.useRef(pe.brushInteraction);me.current=pe.brushInteraction;const ve=t.useCallback(e=>{const t=me.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);Ml("Scatterplot",se,"xAccessor",d),Ml("Scatterplot",se,"yAccessor",h);const be=t.useMemo(()=>v?null!=le?le:[0,1]:void 0,[v,le]),xe=t.useMemo(()=>v?e=>Ae(e,v,b,be):void 0,[v,b,be]),ke=Dl({colorBy:y,colorScale:ge.colorScale,color:G,pointRadius:x,fillOpacity:w,radiusFn:xe,stroke:q,strokeWidth:X,opacity:V,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection}),we=t.useMemo(()=>ka([{label:ie||ya(d),accessor:d,role:"x",format:c},{label:re||ya(h),accessor:h,role:"y",format:u},...y?[{label:ya(y),accessor:y,role:"color"}]:[],...v?[{label:ya(v),accessor:v,role:"size"}]:[]]),[d,h,ie,re,y,v,c,u]),{effectiveData:je,statisticalAnnotations:Se}=Vl({data:se,xAccessor:d,yAccessor:h,forecast:C,anomaly:_}),Oe=t.useMemo(()=>{const e=Hl(M);return e||0!==Se.length?[...e?[e]:[],...O||[],...Se]:O},[M,O,Se]);if(ge.earlyReturn)return ge.earlyReturn;const Me=Ll({componentName:"Scatterplot",data:s,accessors:{xAccessor:d,yAccessor:h}});if(Me)return e.jsx(vl,{componentName:"Scatterplot",message:Me,width:U,height:Q});const Ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:je}),{xAccessor:d,yAccessor:h,xScaleType:g,yScaleType:f,colorAccessor:y||void 0,sizeAccessor:v||void 0,sizeRange:b,pointStyle:ke,colorScheme:m,size:[U,Q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:ie,yLabel:re,xFormat:c,yFormat:u,enableHover:K,showGrid:Z}),ge.legendBehaviorProps),ga({title:ee,description:te,summary:oe,accessibleTable:ne,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:A,defaultTooltipContent:we})),fa({linkedHover:R,onObservation:B,onClick:E,hoverHighlight:D,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),j&&{marginalGraphics:j}),S&&{pointIdAccessor:S}),Oe&&Oe.length>0&&{annotations:Oe}),P&&{xExtent:P}),L&&{yExtent:L}),fe&&{brush:{dimension:ye},onBrush:ve}),ge.crosshairProps),T);return e.jsx(wl,{componentName:"Scatterplot",width:U,height:Q,children:e.jsx(Ei,Object.assign({ref:i},Ce))})});function Ql(e,t){return ne(1===t?.5:e/(t-1))}Ul.displayName="Scatterplot";const Kl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);Bl(n,{variant:"xy",frameRef:s});const a=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:g="x",yAccessor:f="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,regression:k,forecast:w,anomaly:A,xExtent:j,yExtent:S,frameProps:O={},selection:M,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:T,loading:$,loadingContent:R,emptyContent:N,legendInteraction:B,stroke:E,strokeWidth:D,opacity:I}=o,{width:H,height:F,enableHover:W,showGrid:z,title:Y,description:G,summary:q,accessibleTable:X,xLabel:V,yLabel:U}=a,Q=l||[],{safeData:K,orderMap:Z}=t.useMemo(()=>{const e="function"==typeof g?g:e=>e[g],t="function"==typeof f?f:e=>e[f];let o=Q;if(p&&Q.length>0){const e="function"==typeof p?p:e=>e[p];o=[...Q].sort((t,o)=>{const n=e(t),i=e(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const n=new WeakMap;let i=0;for(const n of o){const o=e(n),r=t(n);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i++}let r=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&n.set(s,{idx:r++,total:i})}return{safeData:o,orderMap:n}},[Q,p,g,f]);Ml("ConnectedScatterplot",K,"xAccessor",g),Ml("ConnectedScatterplot",K,"yAccessor",f);const J=Nl({data:K,rawData:l,colorBy:void 0,colorScheme:void 0,legendInteraction:B,selection:M,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"ConnectedScatterplot",chartId:T,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:$,loadingContent:R,emptyContent:N,width:H,height:F}),ee=null!==(r=null===(i=J.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==r?r:.5,te=t.useMemo(()=>(e,t)=>{var o,n,i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return;const a=null===(o=J.effectiveSelectionHook)||void 0===o?void 0:o.isActive,l=null===(n=J.effectiveSelectionHook)||void 0===n?void 0:n.predicate,c=100>s.length,u=s.length;e.lineCap="round";for(let t=0;u-1>t;t++){const o=s[t],n=s[t+1],d=Ql(t,u),h=!a||!l||l(null!==(i=o.datum)&&void 0!==i?i:o)||l(null!==(r=n.datum)&&void 0!==r?r:n),g=a?h?1:ee:1;c&&(e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*g,e.stroke()),e.beginPath(),e.moveTo(o.x,o.y),e.lineTo(n.x,n.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=g,e.stroke()}e.globalAlpha=1},[m,J.effectiveSelectionHook,ee]),oe=t.useMemo(()=>[te],[te]),ne=t.useMemo(()=>(t,o,n)=>{var i,r;const s=t.filter(e=>"point"===e.type);if(2>s.length)return null;const a=s.length,l=100>a,c=[];for(let t=0;a-1>t;t++){const o=s[t],n=s[t+1],u=Ql(t,a),d="number"==typeof(null===(i=o.style)||void 0===i?void 0:i.opacity)?o.style.opacity:1,h="number"==typeof(null===(r=n.style)||void 0===r?void 0:r.opacity)?n.style.opacity:1,g=Math.min(d,h);l&&c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*g},"halo-"+t)),c.push(e.jsx("line",{x1:o.x,y1:o.y,x2:n.x,y2:n.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:g},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ie=t.useMemo(()=>[ne],[ne]),re=t.useMemo(()=>e=>{var t,o;const n=Z.get(e),i=null!==(t=null==n?void 0:n.idx)&&void 0!==t?t:0,r=null!==(o=null==n?void 0:n.total)&&void 0!==o?o:1;return{fill:r>0?Ql(i,r):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,Z]),se=Dl({colorScale:void 0,baseStyleExtras:re,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),ae=y||("string"==typeof p?p:"Order"),le=t.useMemo(()=>ka([{label:V||ya(g),accessor:g,role:"x",format:d},{label:U||ya(f),accessor:f,role:"y",format:h},...p?[{label:ae,accessor:p,role:"group"}]:[]]),[g,f,V,U,p,ae,d,h]),ce=Ll({componentName:"ConnectedScatterplot",data:l,accessors:{xAccessor:g,yAccessor:f}}),{effectiveData:ue,statisticalAnnotations:de}=Vl({data:K,xAccessor:g,yAccessor:f,forecast:w,anomaly:A});if(J.earlyReturn)return J.earlyReturn;const he=Hl(k),ge=he||de.length>0?[...he?[he]:[],...x||[],...de]:x,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=l&&{data:ue}),{xAccessor:g,yAccessor:f,pointStyle:se,size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,showAxes:a.showAxes,xLabel:V,yLabel:U,xFormat:d,yFormat:h,enableHover:W,showGrid:z}),ga({title:Y,description:G,summary:q,accessibleTable:X,className:u,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:v,defaultTooltipContent:le})),fa({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:oe,svgPreRenderers:ie}),ge&&ge.length>0&&{annotations:ge}),j&&{xExtent:j}),S&&{yExtent:S}),J.crosshairProps),O);return ce?e.jsx(vl,{componentName:"ConnectedScatterplot",message:ce,width:H,height:F}):e.jsx(wl,{componentName:"ConnectedScatterplot",width:H,height:F,children:e.jsx(Ei,Object.assign({ref:s},fe))})});function Zl(e){const{lineWidth:o=2,colorBy:n,colorScale:i,color:r,resolveStroke:s,fillArea:a,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g}=e,f=t.useMemo(()=>(e,t)=>{const c={strokeWidth:o},u=!0===a||Array.isArray(a)&&null!=t&&a.includes(t);let d;return s?d=s(e,t):n?i&&(d=ke(e,n,i)):d=r||il,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=l)),c},[o,n,i,r,s,a,l]),p=t.useMemo(()=>El(f,{stroke:c,strokeWidth:u,opacity:d}),[f,c,u,d]);return t.useMemo(()=>Ua(p,null!=h?h:null,g),[p,h,g])}Kl.displayName="ConnectedScatterplot";const Jl=t.forwardRef(function(o,n){var i,r;const s=t.useRef(null);Bl(n,{variant:"xy",frameRef:s});const a=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xFormat:d,yFormat:h,axisExtent:g,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="linear",showPoints:w=!1,pointRadius:A=3,fillArea:j=!1,areaOpacity:S=.3,lineWidth:O=2,lineGradient:M,tooltip:C,pointIdAccessor:_,annotations:P,directLabel:L,gapStrategy:T="break",anomaly:$,forecast:R,band:N,xExtent:B,yExtent:E,frameProps:D={},selection:I,linkedHover:H,onObservation:F,onClick:W,hoverHighlight:z,hoverRadius:Y,chartId:G,loading:q,loadingContent:X,emptyContent:V,legendInteraction:U,legendPosition:Q,xScaleType:K,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:oe}=o,{width:ne,height:ie,enableHover:re,showGrid:se,showLegend:ae,title:le,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=a,fe=t.useMemo(()=>k(l),[l]);Ml("LineChart",fe,"xAccessor",f),Ml("LineChart",fe,"yAccessor",p);const{effectiveData:pe,statisticalAnnotations:ye}=Vl({data:fe,xAccessor:f,yAccessor:p,forecast:R,anomaly:$,groupBy:y}),me="__compoundGroup",ve=!(!R||!y),be=ve?me:R?zl:y,xe=t.useMemo(()=>{if(!ve)return pe;const e="function"==typeof y?y:e=>e[y];return pe.map(t=>{const o=Object.assign({},t);return o[me]=`${e(t)}__${t[zl]||"observed"}`,o})},[pe,ve,y]),we=ve?xe:pe,Ae=v||y,je=t.useMemo(()=>{if(!R)return;const e=R.upperBounds,t=R.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const s=pe;for(const e of s){const t="function"==typeof p?p(e):+e[p];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[R,pe,p]),Se=t.useCallback(e=>{const t="function"==typeof f?f(e):e[f],o="function"==typeof p?p(e):e[p];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[f,p]),Oe=void 0!==(null===(i=we[0])||void 0===i?void 0:i[m]),Me=t.useMemo(()=>{if(Oe)return we;if(be){const e=we.reduce((e,t)=>{const o="function"==typeof be?be(t):t[be];if(!e[o]){const n={[m]:[]};"string"==typeof be&&(n[be]=o),ve&&(n[zl]=t[zl],"string"==typeof y&&(n[y]=t[y])),e[o]=n}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:we}]},[we,be,m,Oe]),{gapProcessedLineData:Ce,hasGaps:_e}=t.useMemo(()=>{if("interpolate"===T){let e=!1;const t=[];for(const o of Me){const n=(o[m]||[]).filter(t=>!Se(t)||(e=!0,!1));n.length>0&&t.push(Object.assign(Object.assign({},o),{[m]:n}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===T){let e=!1;const t=[];for(const o of Me){const n=o[m]||[];let i=[],r=0;const s=be&&"string"==typeof be?o[be]:void 0;for(const a of n)if(Se(a))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},o),{[m]:i})),i=[],r++);else{const e=null!=s?`${s}__seg${r}`:"__seg"+r;i.push(Object.assign(Object.assign({},a),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},o),{[m]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===T){let e=!1;const t="string"==typeof p?p:"y",o=[];for(const n of Me){const i=n[m]||[],r=[];for(const o of i)Se(o)?(e=!0,r.push(Object.assign(Object.assign({},o),{[t]:0}))):r.push(o);o.push(Object.assign(Object.assign({},n),{[m]:r}))}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,T,m,Se,be,p]),Pe="object"==typeof L?L:{},Le=Pe.position||"end",Te=Pe.fontSize||11,$e=t.useMemo(()=>{var e;if(!L||!Ae)return[];const t="function"==typeof Ae?Ae:e=>e[Ae],o=new Set;for(const n of Ce){const i=n[m]||[];if(0===i.length)continue;const r=null!==(e=t("end"===Le?i[i.length-1]:i[0]))&&void 0!==e?e:t(n);if(null==r)continue;const s=r+"";""!==s&&o.add(s)}return Array.from(o)},[L,Ae,Ce,m,Le]),Re=t.useMemo(()=>{if(!L)return a.marginDefaults;const e=$e.reduce((e,t)=>Math.max(e,t.length*(.6*Te)),0)+10,t="end"===Le?"right":"left";return Object.assign(Object.assign({},a.marginDefaults),{[t]:Math.max(a.marginDefaults[t]||0,e)})},[L,$e,Te,Le,a.marginDefaults]),Ne=Nl({data:pe,rawData:l,colorBy:Ae,colorScheme:b,legendInteraction:U,legendPosition:Q,selection:I,linkedHover:H,fallbackFields:Ae?["string"==typeof Ae?Ae:""]:[],unwrapData:!1,onObservation:F,onClick:W,hoverHighlight:z,chartType:"LineChart",chartId:G,showLegend:(!L||void 0!==ae)&&ae,userMargin:c,marginDefaults:Re,loading:q,loadingContent:X,emptyContent:V,width:ne,height:ie}),Be=Ne.colorScale,Ee=Ne.customHoverBehavior,De=Ne.customClickBehavior,Ie=Ne.crosshairProps,He=Zl({lineWidth:O,colorBy:Ae,colorScale:Be,color:J,fillArea:j,areaOpacity:S,stroke:ee,strokeWidth:te,opacity:oe,effectiveSelectionHook:Ne.effectiveSelectionHook,resolvedSelection:Ne.resolvedSelection}),[Fe,We]=t.useState(null);t.useEffect(()=>{if(!R)return void We(null);let e=!1;return function(...e){return Wl(this,void 0,void 0,function*(){return(yield Gl()).createSegmentLineStyle(...e)})}(He,R).then(t=>{e||We(()=>t)}).catch(()=>{e||We(null)}),()=>{e=!0}},[He,R]);const ze=Fe||He,Ye=t.useMemo(()=>{if(w)return e=>{const t={r:A,fillOpacity:1};return Ae?Be&&(t.fill=ke(e.parentLine||e,Ae,Be)):t.fill=J||il,t}},[w,A,Ae,Be,J]),Ge=Array.isArray(j)?"mixed":j?"area":"line",qe=t.useMemo(()=>{var e;if(!L||!Ae)return[];const t="function"==typeof f?f:e=>e[f],o="function"==typeof p?p:e=>e[p],n="function"==typeof Ae?Ae:e=>e[Ae],i=new Map;for(const t of Ce){const o=t[m]||[];if(0===o.length)continue;const r="end"===Le?o[o.length-1]:o[0],s=null!==(e=n(r))&&void 0!==e?e:n(t);if(null==s)continue;const a=s+"";""===a||i.has(a)||i.set(a,r)}const r=Array.from(i.entries()).map(([e,n])=>({type:"text",label:e,["string"==typeof f?f:"x"]:t(n),["string"==typeof p?p:"y"]:o(n),dx:"end"===Le?6:-6,dy:0,color:Be?Be(e):il,fontSize:Te}));r.sort((e,t)=>{const o="string"==typeof p?p:"y";return e[o]-t[o]});for(let e=1;r.length>e;e++){const t="string"==typeof p?p:"y",o=r[e-1],n=r[e];Te+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=Te+2)}return r},[L,Ae,Be,Ce,m,f,p,Le,Te]),Xe=Ne.margin,Ve=y||v,Ue=t.useMemo(()=>ka([{label:he||ya(f),accessor:f,role:"x",format:d},{label:ge||ya(p),accessor:p,role:"y",format:h},...Ve?[{label:ya(Ve),accessor:Ve,role:"group"}]:[],...xa(N,h)]),[f,p,he,ge,Ve,d,h,N]),Qe=Ll({componentName:"LineChart",data:Oe?(null===(r=pe[0])||void 0===r?void 0:r[m])||[]:l,accessors:{xAccessor:f,yAccessor:p}}),Ke=t.useMemo(()=>Oe||be||_e?Ce.flatMap(e=>{const t=e[m]||[];return be&&"string"==typeof be?t.map(t=>Object.assign(Object.assign({},t),{[be]:e[be]})):t}):we,[Ce,m,Oe,be,we,_e]),Ze=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ge},Array.isArray(j)&&{areaGroups:j}),M&&{lineGradient:M}),null!=Y&&{hoverRadius:Y}),null!=l&&{data:Ke}),{xAccessor:f,yAccessor:p,xScaleType:K,yScaleType:Z}),B&&{xExtent:B}),!E||null==E[0]&&null==E[1]?je?{yExtent:je}:{}:{yExtent:E}),{groupAccessor:"break"===T&&_e?"_gapSegment":be||void 0}),N&&{band:N}),{curve:x,lineStyle:ze}),w&&{pointStyle:Ye}),{size:[ne,ie],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Xe,showAxes:a.showAxes,xLabel:he,yLabel:ge,xFormat:d,yFormat:h}),void 0!==g&&{axisExtent:g}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{enableHover:re,showGrid:se}),Ne.legendBehaviorProps),le&&{title:le}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),u&&{className:u}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===C?()=>null:"multi"===C?Kn():Zn(C)||Ue}),"multi"===C&&{tooltipMode:"multi"}),(H||F||W||z)&&{customHoverBehavior:Ee}),(F||W||H)&&{customClickBehavior:De}),_&&{pointIdAccessor:_}),((null==P?void 0:P.length)||ye.length||qe.length)&&{annotations:[...P||[],...ye,...qe]}),Ie),D);return Ne.earlyReturn?Ne.earlyReturn:Qe?e.jsx(vl,{componentName:"LineChart",message:Qe,width:ne,height:ie}):e.jsx(wl,{componentName:"LineChart",width:ne,height:ie,children:e.jsx(Ei,Object.assign({ref:s},Ze))})});function ec(e){var o;const{safeData:n,data:i,areaBy:r,lineDataAccessor:s,colorBy:a,colorScale:l,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:g,resolvedSelection:f,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:A,xFormat:j,yFormat:S,groupField:O}=e,M=void 0!==(null===(o=n[0])||void 0===o?void 0:o[s]),C=t.useMemo(()=>{if(null==i)return[];if(!M&&!r)return n;let e;if(M)e=n;else{const t=r,o=n.reduce((e,o)=>{const n="function"==typeof t?t(o):o[t];if(!e[n]){const o={[s]:[]};"string"==typeof t&&(o[t]=n),e[n]=o}return e[n][s].push(o),e},{});e=Object.values(o)}return e.flatMap(e=>{const t=e[s]||[];return r&&"string"==typeof r?t.map(t=>Object.assign(Object.assign({},t),{[r]:e[r]})):t})},[i,n,r,s,M]),_=t.useMemo(()=>e=>{const t={};if(a){if(l){const o=ke(e,a,l);t.fill=o,y?(t.stroke=o,t.strokeWidth=m):t.stroke="none"}}else{const e=c||il;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[a,l,c,p,y,m]),P=t.useMemo(()=>El(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:C,lineStyle:t.useMemo(()=>Ua(P,null!=g?g:null,f),[P,g,f]),pointStyle:t.useMemo(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return a?l&&(t.fill=ke(e.parentLine||e,a,l)):t.fill=c||il,t}},[v,b,a,l,c]),defaultTooltipContent:t.useMemo(()=>ka([{label:w||ya(x),accessor:x,role:"x",format:j},{label:A||ya(k),accessor:k,role:"y",format:S},...O?[{label:ya(O),accessor:O,role:"group"}]:[],...xa(e.band,S)]),[x,k,w,A,O,j,S,e.band])}}function tc(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}Jl.displayName="LineChart";const oc=t.forwardRef(function(o,n){const i=t.useRef(null);Bl(n,{variant:"xy",frameRef:i});const r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,y0Accessor:f,gradientFill:p=!1,semanticGradient:y,lineDataAccessor:m="coordinates",colorBy:v,colorScheme:b,curve:x="monotoneX",areaOpacity:w=.7,lineGradient:A,showLine:j=!0,lineWidth:S=2,showPoints:O=!1,pointRadius:M=3,tooltip:C,annotations:_,forecast:P,anomaly:L,band:T,xExtent:$,yExtent:R,frameProps:N={},selection:B,linkedHover:E,onObservation:D,onClick:I,hoverHighlight:H,chartId:F,loading:W,loadingContent:z,emptyContent:Y,legendInteraction:G,legendPosition:q,color:X,stroke:V,strokeWidth:U,opacity:Q}=o,{width:K,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:oe,description:ne,summary:ie,accessibleTable:re,xLabel:se,yLabel:ae}=r,le=t.useMemo(()=>k(s),[s]),ce=v||g,ue=t.useMemo(()=>{return y&&y.length>0?{colorStops:(e=y,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:tc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[y,p]);Ml("AreaChart",le,"xAccessor",d),Ml("AreaChart",le,"yAccessor",h);const de=Nl({data:le,rawData:s,colorBy:ce,colorScheme:b,legendInteraction:G,legendPosition:q,selection:B,linkedHover:E,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:D,onClick:I,hoverHighlight:H,chartType:"AreaChart",chartId:F,showLegend:te,userMargin:a,marginDefaults:r.marginDefaults,loading:W,loadingContent:z,emptyContent:Y,width:K,height:Z}),{effectiveData:he,statisticalAnnotations:ge}=Vl({data:le,xAccessor:d,yAccessor:h,forecast:P,anomaly:L,groupBy:g}),{flattenedData:fe,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=ec({safeData:he,data:s,areaBy:g,lineDataAccessor:m,colorBy:ce,colorScale:de.colorScale,color:X,stroke:V,strokeWidth:U,opacity:Q,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:j,lineWidth:S,showPoints:O,pointRadius:M,xAccessor:d,yAccessor:h,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,groupField:g||v,band:T}),ve=Ll({componentName:"AreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=s&&{data:fe}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0}),f&&{y0Accessor:f}),T&&{band:T}),ue&&{gradientFill:ue}),A&&{lineGradient:A}),{curve:x,lineStyle:pe}),O&&ye&&{pointStyle:ye}),{size:[K,Z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:se,yLabel:ae,xFormat:c,yFormat:u,enableHover:J}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),ga({title:oe,description:ne,summary:ie,accessibleTable:re,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),"multi"===C?{tooltipContent:Kn(),tooltipMode:"multi"}:pa({tooltip:C,defaultTooltipContent:me})),fa({linkedHover:E,onObservation:D,onClick:I,hoverHighlight:H,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||ge.length>0)&&{annotations:[..._||[],...ge]}),$&&{xExtent:$}),R&&{yExtent:R}),de.crosshairProps),N);return de.earlyReturn?de.earlyReturn:ve?e.jsx(vl,{componentName:"AreaChart",message:ve,width:K,height:Z}):e.jsx(wl,{componentName:"AreaChart",width:K,height:Z,children:e.jsx(Ei,Object.assign({ref:i},be))})});function nc(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}oc.displayName="AreaChart";const ic=t.forwardRef(function(o,n){const i=t.useRef(null),r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",seriesAAccessor:h="a",seriesBAccessor:g="b",seriesALabel:f="A",seriesBLabel:p="B",seriesAColor:y="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:v=!0,lineWidth:b=1.5,showPoints:x=!1,pointRadius:w=3,curve:A="linear",areaOpacity:j=.6,gradientFill:S,tooltip:O,annotations:M,xExtent:C,yExtent:_,frameProps:P={},selection:L,linkedHover:T,onObservation:$,onClick:R,hoverHighlight:N,chartId:B,loading:E,loadingContent:D,emptyContent:I,legendInteraction:H,legendPosition:F,pointIdAccessor:W,windowSize:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:Q,summary:K,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=t.useMemo(()=>"function"==typeof d?e=>nc(d(e)):e=>nc(e[d]),[d]),oe=t.useMemo(()=>"function"==typeof h?e=>nc(h(e)):e=>nc(e[h]),[h]),ne=t.useMemo(()=>"function"==typeof g?e=>nc(g(e)):e=>nc(e[g]),[g]),[ie,re]=t.useState([]),se=t.useRef([]),ae=null==s,le=t.useMemo(()=>k(ae?ie:s),[ae,ie,s]),ce=t.useMemo(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>r.push(e),g=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],f=t(r),p=o(r),y=n(r);if(!Number.isFinite(f)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=a){if(l&&l.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=p-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(f-l.x),t=l.a+n*(p-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)g(c[e],a)}else for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else{a=m;for(const e of c)g(e,a);c=[],h({__x:f,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(a),__diffWinner:a,__valA:p,__valB:y,__sourceDatum:r}),l={x:f,a:p,b:y,w:m}}else c.push({x:f,y:p,datum:r})}for(const e of c)g(e,null!=a?a:"A");return r}(le,te,oe,ne),[le,te,oe,ne]),ue=t.useMemo(()=>v?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),s=o(e),a=n(e);Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-B"})}return r}(le,te,oe,ne):[],[v,le,te,oe,ne]),de=t.useMemo(()=>[...ce,...ue],[ce,ue]),he=t.useMemo(()=>{const e=new Set;for(const t of ce)e.add(t.__diffSegment);return Array.from(e)},[ce]);t.useImperativeHandle(n,()=>{const e=e=>{const t=z&&e.length>z?e.slice(e.length-z):e;se.current=t,re(t)},t=W?"function"==typeof W?W:e=>e[W]:null;return{push:t=>e([...se.current,t]),pushMany:t=>e([...se.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of se.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],s=se.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(s),r},clear:()=>e([]),getData:()=>ae?se.current:le,getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[ae,le,W,z]);const ge=Nl({data:le,rawData:s,colorBy:"__diffWinner",colorScheme:[y,m],legendInteraction:H,legendPosition:F,selection:L,linkedHover:T,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:$,onClick:R,hoverHighlight:N,chartType:"DifferenceChart",chartId:B,showLegend:V,userMargin:a,marginDefaults:r.marginDefaults,loading:E,loadingContent:D,emptyContent:I,width:Y,height:G}),fe=t.useMemo(()=>{if(!1!==V)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:f,color:y},{label:p,color:m}]}]}},[V,f,p,y,m]),pe=t.useCallback(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?y:m,stroke:"none",fillOpacity:j}},[y,m,j]),ye=t.useCallback(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,strokeWidth:b,fill:"none"}),[y,m,b]),me=t.useCallback(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,r:w}),[y,m,w]),ve=t.useCallback(t=>{var o;const n=t.data,i=t.allSeries,r=null!==(o=t.xValue)&&void 0!==o?o:null==n?void 0:n.__x;let s=null==n?void 0:n.__valA,a=null==n?void 0:n.__valB;if(i&&i.length>0){const e=i.find(e=>"line-A"===e.group),t=i.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(s=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(a=t.value)}if(null!=r&&(null==s||null==a)){const e=le.find(e=>te(e)===r);e&&(null==s&&(s=oe(e)),null==a&&(a=ne(e)))}const l=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=c&&null!=r?c(r):null!=r?r+"":"";return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:u}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[f,": ",l(s)]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[p,": ",l(a)]})]}),null!=s&&null!=a&&Number.isFinite(s)&&Number.isFinite(a)&&e.jsxs("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",l(s-a)]})]})},[le,te,oe,ne,c,y,m,f,p]),be="multi"===O,xe=t.useMemo(()=>!1===O?()=>null:be?ve:Zn(O)||ve,[O,be,ve]);if(ge.earlyReturn)return ge.earlyReturn;const ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:de,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:he,curve:A,areaStyle:pe,lineStyle:ye},x&&{pointStyle:me}),{size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:q,showGrid:X}),S&&{gradientFill:!0===S?{topOpacity:.85,bottomOpacity:.15}:S}),fe&&{legend:fe,legendPosition:ge.legendPosition}),ga({title:U,description:Q,summary:K,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),{tooltipContent:xe}),be&&{tooltipMode:"multi"}),fa({linkedHover:T,onObservation:$,onClick:R,hoverHighlight:N,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior})),M&&M.length>0&&{annotations:M}),C&&{xExtent:C}),_&&{yExtent:_}),ge.crosshairProps),P);return e.jsx(wl,{componentName:"DifferenceChart",width:Y,height:G,children:e.jsx(Ei,Object.assign({ref:i},ke))})});"function"==typeof ic&&(ic.displayName="DifferenceChart");const rc=t.forwardRef(function(o,n){const i=t.useRef(null),r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:g,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,curve:m="monotoneX",areaOpacity:v=.7,showLine:b=!0,lineWidth:x=2,showPoints:w=!1,pointRadius:A=3,normalize:j=!1,baseline:S="zero",stackOrder:O,tooltip:M,annotations:C,xExtent:_,yExtent:P,frameProps:L={},selection:T,linkedHover:$,onObservation:R,onClick:N,hoverHighlight:B,chartId:E,loading:D,loadingContent:I,emptyContent:H,legendInteraction:F,legendPosition:W,color:z,stroke:Y,strokeWidth:G,opacity:q}=o,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:oe,yLabel:ne}=r,ie=t.useMemo(()=>k(s),[s]),re=p||g;Bl(n,{variant:"xy",frameRef:i});const se=Nl({data:ie,rawData:s,colorBy:re,colorScheme:y,legendInteraction:F,legendPosition:W,selection:T,linkedHover:$,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:R,onClick:N,hoverHighlight:B,chartType:"StackedAreaChart",chartId:E,showLegend:K,userMargin:a,marginDefaults:r.marginDefaults,loading:D,loadingContent:I,emptyContent:H,width:X,height:V}),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=ec({safeData:ie,data:s,areaBy:g,lineDataAccessor:f,colorBy:re,colorScale:se.colorScale,color:z,stroke:Y,strokeWidth:G,opacity:q,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection,areaOpacity:v,showLine:b,lineWidth:x,showPoints:w,pointRadius:A,xAccessor:d,yAccessor:h,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,groupField:g||p}),de=Ll({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=s&&{data:ae}),{xAccessor:d,yAccessor:h,groupAccessor:g||void 0,curve:m,normalize:j,baseline:j?"zero":S,stackOrder:O,lineStyle:le}),w&&ce&&{pointStyle:ce}),{size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:se.margin,showAxes:r.showAxes,xLabel:oe,yLabel:ne,xFormat:c,yFormat:u,enableHover:U}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:Q}),se.legendBehaviorProps),ga({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),"multi"===M?{tooltipContent:Kn(),tooltipMode:"multi"}:pa({tooltip:M,defaultTooltipContent:ue})),fa({linkedHover:$,onObservation:R,onClick:N,hoverHighlight:B,customHoverBehavior:se.customHoverBehavior,customClickBehavior:se.customClickBehavior})),C&&C.length>0&&{annotations:C}),_&&{xExtent:_}),P&&{yExtent:P}),se.crosshairProps),L);return se.earlyReturn?se.earlyReturn:de?e.jsx(vl,{componentName:"StackedAreaChart",message:de,width:X,height:V}):e.jsx(wl,{componentName:"StackedAreaChart",width:X,height:V,children:e.jsx(Ei,Object.assign({ref:i},he))})});rc.displayName="StackedAreaChart";const sc=t.forwardRef(function(o,n){var r;const s=t.useRef(null);Bl(n,{variant:"xy",frameRef:s});const a=yl(o.mode,{width:o.width,height:o.height,showGrid:void 0,enableHover:o.enableHover,showLegend:void 0,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:l,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:g="value",xFormat:f,yFormat:p,colorScheme:y,customColorScale:m,showValues:v=!1,valueFormat:b,tooltip:x,annotations:w,xExtent:A,yExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:R,showLegend:N,legendPosition:B,legendInteraction:E}=o,{width:D,height:I,enableHover:H,title:F,description:W,summary:z,accessibleTable:Y,xLabel:G,yLabel:q}=a,X=Ol(T,D,I,$),V=X?null:Sl(l,D,I,R),U=t.useMemo(()=>k(l),[l]),Q=function(){var e;const t=nl();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),ce=null!==(r=null!=y?y:Q)&&void 0!==r?r:"blues",ue=null!=N&&N,de=null!=B?B:"right",{margin:he}=gl({data:U,colorBy:ue?"value":void 0,colorScale:void 0,showLegend:ue,legendPosition:de,userMargin:c,defaults:a.marginDefaults}),{customHoverBehavior:ge,customClickBehavior:fe,crosshairSourceId:pe}=dl({selection:O,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});Rl(O);const ye=hl(M,pe);fl(E,void 0,[]);const me=t.useMemo(()=>"function"==typeof g?e=>g(e):e=>e[g],[g]),ve=t.useMemo(()=>{const e=U.map(me);return[Math.min(...e),Math.max(...e)]},[U,me]),be=t.useMemo(()=>"custom"===ce&&m?m:i.scaleSequential({blues:K,reds:Z,greens:J,viridis:ne,oranges:ee,purples:te,greys:oe,plasma:ie,inferno:re,magma:se,cividis:ae,turbo:le}[ce]||K).domain(ve),[ce,m,ve]),xe=t.useMemo(()=>ka([{label:G||ya(d),accessor:d,role:"x",format:f},{label:q||ya(h),accessor:h,role:"y",format:p},{label:ya(g),accessor:g,role:"value",format:b}]),[d,h,G,q,g,f,p,b]),ke=Ll({componentName:"Heatmap",data:l,accessors:{xAccessor:d,yAccessor:h,valueAccessor:g}}),we=t.useMemo(()=>{if(ue)return{gradient:{colorFn:e=>be(e),domain:ve,label:"string"==typeof g?g:"value",format:b}}},[ue,be,ve,g,b]),Ae=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=l&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:g,colorScheme:"custom"!==ce?ce:void 0,showValues:v,heatmapValueFormat:b,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:he,showAxes:a.showAxes,xLabel:G,yLabel:q,xFormat:f,yFormat:p,enableHover:H}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),we&&{legend:we,legendPosition:de}),ga({title:F,description:W,summary:z,accessibleTable:Y,className:u,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:x,defaultTooltipContent:xe})),fa({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:ge,customClickBehavior:fe})),w&&w.length>0&&{annotations:w}),A&&{xExtent:A}),j&&{yExtent:j}),ye),S);return X||V||(ke?e.jsx(vl,{componentName:"Heatmap",message:ke,width:D,height:I}):e.jsx(wl,{componentName:"Heatmap",width:D,height:I,children:e.jsx(Ei,Object.assign({ref:s},Ae))}))});sc.displayName="Heatmap";const ac=t.forwardRef(function(o,n){const i=t.useRef(null),r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:g,sizeRange:f=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:v=1,bubbleStrokeColor:b="white",tooltip:x,marginalGraphics:w,pointIdAccessor:A,annotations:j,regression:S,xExtent:O,yExtent:M,frameProps:C={},selection:_,linkedHover:P,linkedBrush:L,onObservation:T,onClick:$,hoverHighlight:R,chartId:N,loading:B,loadingContent:E,emptyContent:D,legendInteraction:I,legendPosition:H,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>k(s),[s]),ne=void 0===s,ie=Nl({data:oe,rawData:s,colorBy:p,colorScheme:y,legendInteraction:I,legendPosition:H,selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:T,onClick:$,hoverHighlight:R,chartType:"BubbleChart",chartId:N,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:B,loadingContent:E,emptyContent:D,width:G,height:q}),{domain:re,trackPushed:se,reset:ae}=Il({accessor:g,data:oe,isPushMode:ne}),le=t.useCallback(e=>{var t;se([e]),null===(t=i.current)||void 0===t||t.push(e)},[se]),ce=t.useCallback(e=>{var t;se(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[se]);Bl(n,{variant:"xy",frameRef:i,overrides:{push:le,pushMany:ce,clear:()=>{var e;ae(),null===(e=i.current)||void 0===e||e.clear()}},deps:[le,ce,ae]});const ue=Va(L);Ba({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof d?d:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof h?h:void 0)});const de=t.useMemo(()=>({stroke:b,strokeWidth:v}),[b,v]),he=t.useMemo(()=>null!=re?re:[0,1],[re]),ge=t.useCallback(e=>Ae(e,g,f,he),[g,f,he]),fe=Dl({colorBy:p,colorScale:ie.colorScale,color:F,fillOpacity:m,radiusFn:ge,baseStyleExtras:de,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),pe=t.useMemo(()=>ka([{label:ee||ya(d),accessor:d,role:"x",format:c},{label:te||ya(h),accessor:h,role:"y",format:u},{label:ya(g),accessor:g,role:"size"},...p?[{label:ya(p),accessor:p,role:"color"}]:[]]),[d,h,ee,te,g,p,c,u]);if(ie.earlyReturn)return ie.earlyReturn;const ye=Ll({componentName:"BubbleChart",data:s,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:g}});if(ye)return e.jsx(vl,{componentName:"BubbleChart",message:ye,width:G,height:q});const me=Hl(S),ve=me?[me,...j||[]]:j,be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=s&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:g,sizeRange:f,pointStyle:fe,colorScheme:y,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),ie.legendBehaviorProps),ga({title:Q,description:K,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:x,defaultTooltipContent:pe})),fa({linkedHover:P,onObservation:T,onClick:$,hoverHighlight:R,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),w&&{marginalGraphics:w}),A&&{pointIdAccessor:A}),ve&&ve.length>0&&{annotations:ve}),O&&{xExtent:O}),M&&{yExtent:M}),ie.crosshairProps),C);return e.jsx(wl,{componentName:"BubbleChart",width:G,height:q,children:e.jsx(Ei,Object.assign({ref:i},be))})});ac.displayName="BubbleChart";const lc="__splomIdx",cc={top:4,bottom:4,left:4,right:4};function uc({frameRef:i,cellSize:r,onBrush:s}){const a=t.useRef(null),l=r-cc.left-cc.right,c=r-cc.top-cc.bottom;return t.useEffect(()=>{if(!a.current)return;const e=o.select(a.current).select(".brush-g"),t=n.brush().extent([[0,0],[l,c]]).on("brush end",e=>{var t;const o=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!o)return;if(!e.selection)return void s(null);const[[n,r],[a,l]]=e.selection,c=[[o.x.invert(n),o.y.invert(r)],[o.x.invert(a),o.y.invert(l)]];s(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,c,i,s]),e.jsx("svg",{ref:a,width:r,height:r,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${cc.left},${cc.top})`})})}function dc({data:o,xField:n,yField:i,cellSize:r,pointRadius:s,pointOpacity:a,colorBy:l,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:g,onPointHover:f}){const p=t.useRef(null),y=$a({name:u,clientId:`splom-${n}-${i}`}),m=Ba({name:u,xField:n,yField:i}),v=$a({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==f||f(null));const t=e.data,o=null==t?void 0:t[lc];void 0!==o&&(b({[lc]:[o]}),null==f||f(t,e.x+cc.left,e.y+cc.top))},[b,f]),w=t.useCallback(e=>{const t={opacity:a,r:s};return t.fill=l?ke(e,l,c):il,"hover"===g?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*s,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*a):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[l,c,a,s,g,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:r,height:r},children:[e.jsx(Ei,{ref:p,chartType:"scatter",data:o,size:[r,r],xAccessor:n,yAccessor:i,pointStyle:w,margin:cc,showAxes:!1,enableHover:"hover"===g,customHoverBehavior:"hover"===g?k:void 0,tooltipContent:"hover"===g?()=>null:void 0}),"brush"===g&&e.jsx(uc,{frameRef:p,cellSize:r,xField:n,yField:i,onBrush:x})]})}function hc({data:o,field:n,label:i,cellSize:r,bins:s,colorBy:a,colorScale:l,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=$a({name:c,clientId:"splom-diag-"+n}),g=$a({name:u,clientId:`splom-diag-${n}-hover`}),f="hover"===d?g:h,p=f.isActive,y=f.predicate,m=t.useMemo(()=>{const e=o.map(e=>e[n]).filter(e=>null!=e&&!isNaN(e));if(0===e.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const t=Math.min(...e),i=(Math.max(...e)-t)/s||1,l="string"==typeof a?a:null,c=l?[...new Set(o.map(e=>e[l]).filter(e=>null!=e).map(String))]:[],u=new Map(c.map((e,t)=>[e,t])),d=Array(s).fill(0),h=Array(s).fill(0),g=Array.from({length:s},()=>Array(c.length).fill(0)),f=Array.from({length:s},()=>Array(c.length).fill(0));for(const e of o){const o=e[n];if(null==o||isNaN(o))continue;const r=Math.min(Math.floor((o-t)/i),s-1);if(d[r]++,p&&!y(e)||h[r]++,l){const t=u.get(e[l]+"");void 0!==t&&(g[r][t]++,p&&!y(e)||f[r][t]++)}}const m=Math.max(...d,1),v=g.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})}),b=f.map((e,t)=>{let o=0;return e.map((e,n)=>{const i=e/m*(r-24),a={x:t/s*r,w:r/s-1,h:i,y0:o,category:c[n]};return o+=i,a})});return{bars:d.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),selectedBars:h.map((e,t)=>({x:t/s*r,w:r/s-1,h:e/m*(r-24),count:e})),categoryBars:v,selectedCategoryBars:b,max:m,categories:c}},[o,n,s,r,p,y,a]);return e.jsxs("svg",{width:r,height:r,style:{overflow:"hidden"},children:[e.jsx("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,o)=>t.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):il,opacity:p?.3:.6},`bg-${o}-${n}`))):m.bars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:il,opacity:p?.3:.6},"bg-"+o)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,o)=>t.map((t,n)=>e.jsx("rect",{x:t.x,y:r-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:l?l(t.category):il,opacity:.7},`sel-${o}-${n}`))):m.selectedBars.map((t,o)=>e.jsx("rect",{x:t.x,y:r-t.h,width:Math.max(t.w,1),height:t.h,fill:il,opacity:.7},"sel-"+o)))]})}function gc({label:t,cellSize:o}){return e.jsx("svg",{width:o,height:o,children:e.jsx("text",{x:o/2,y:o/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function fc(o){const{data:n,fields:i,fieldLabels:r={},colorBy:s,colorScheme:a,cellSize:l=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:h="histogram",histogramBins:g=20,brushMode:f="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:A,chartId:j}=o,S="splom",O="splom-hover",M=y?"hover":f?"brush":"hover",C=Pa(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(O),P(null)},[C,O]),T=t.useMemo(()=>(n||[]).map((e,t)=>void 0!==e[lc]?e:Object.assign(Object.assign({},e),{[lc]:t})),[n]),$=cl(T,s,a),R=void 0!==x?x:!!s,N=t.useMemo(()=>{if(!R||!s)return null;const e="string"==typeof s?s:null;return e?[...new Set(T.map(t=>t[e]))].map(e=>({label:e+"",color:$?$(e+""):il})):null},[R,s,T,$]),B=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>l+"px").join(" "),gridTemplateRows:i.map(()=>l+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,l,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[N&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:N.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:B,onMouseLeave:"hover"===M?L:void 0,children:[i.map((t,o)=>e.jsxs(p.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t}),i.map((n,i)=>o===i?"label"===h?e.jsx(gc,{label:r[t]||t,cellSize:l},"diag-"+t):e.jsx(hc,{data:T,field:t,label:r[t]||t,cellSize:l,bins:g,colorBy:s,colorScale:$,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,mode:M},"diag-"+t):e.jsx(dc,{data:T,xField:n,yField:t,fieldLabels:r,cellSize:l,pointRadius:u,pointOpacity:d,colorBy:s,colorScale:$,brushSelectionName:S,hoverSelectionName:O,unselectedOpacity:m,showGrid:v,tooltip:b,mode:M,onPointHover:"hover"===M?(e,r,s)=>{e?(P({datum:e,xField:n,yField:t,colIndex:i,rowIndex:o,px:null!=r?r:0,py:null!=s?s:0}),A&&A({type:"hover",datum:e,x:null!=r?r:0,y:null!=s?s:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j})):(P(null),A&&A({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:j}))}:void 0},`cell-${t}-${n}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[t]||t},"col-label-"+t))]}),_&&"hover"===M&&(()=>{const t=_.datum,o=r[_.xField]||_.xField,n=r[_.yField]||_.yField,i=s?"function"==typeof s?s(t):t[s]:null,a=k?"function"==typeof k?k(t):t[k]:"Row "+t[lc];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(l+c)+_.px,top:_.rowIndex*(l+c)+_.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},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:a+""}),e.jsxs("div",{children:[o,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[n,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof s?s:"group",": ",i+""]})]})})()]})}function pc(t){const{brushMode:o="crossfilter",hoverMode:n=!0}=t,i={};return!n&&o&&(i.splom={resolution:o}),n&&(i["splom-hover"]={resolution:"union"}),e.jsx(qa,{selections:i,children:e.jsx(fc,Object.assign({},t))})}function yc({width:i,height:r,margin:s,scales:a,brushDirection:l,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),g=t.useRef(!1),f=i+s.left+s.right,p=r+s.top+s.bottom;return t.useEffect(()=>{if(!d.current||!a)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?n.brushX().extent([[0,0],[i,r]]):n.brushY().extent([[0,0],[i,r]]);return t.on("brush end",e=>{if(g.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const o=("x"===l?a.x:a.y).invert;if(!o)return;const n=[o(t[0]),o(t[1])];u(n)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,i,r,l,u]),t.useEffect(()=>{if(!h.current||!a||!d.current)return;const e=o.select(d.current).select(".brush-group"),t="x"===l?a.x:a.y;if(g.current=!0,c){const o=[t(c[0]),t(c[1])];e.call(h.current.move,o)}else e.call(h.current.move,null);g.current=!1},[c,a,l]),e.jsx("svg",{ref:d,width:f,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${s.left},${s.top})`})})}function mc(o){var n,i;const{data:r,width:s=600,height:a=400,margin:l,className:c,title:u,description:d,summary:h,xLabel:g,yLabel:f,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:v="y",lineBy:b,lineDataAccessor:x="coordinates",colorBy:w,colorScheme:A,curve:j="linear",lineWidth:S=2,fillArea:O=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:T,legendPosition:$,tooltip:R,minimap:N={},renderBefore:B=!1,onBrush:E,brushExtent:D,yExtent:I,frameProps:H={},loading:F,loadingContent:W,emptyContent:z}=o,Y=Ol(F,s,a,W),G=Y?null:Sl(r,s,a,z),q=t.useMemo(()=>k(r),[r]),[X,V]=t.useState(null),U=null!=D?D:X,Q=t.useCallback(e=>{D||V(e),null==E||E(e)},[D,E]),K=t.useRef(null),[Z,J]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const o=()=>{var n,i;if(t)return;const r=null===(i=null===(n=K.current)||void 0===n?void 0:n.getScales)||void 0===i?void 0:i.call(n);r?J(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[r]);const ee=void 0!==(null===(n=q[0])||void 0===n?void 0:n[x]),te=t.useMemo(()=>{if(ee)return q;if(b){const e=q.reduce((e,t)=>{const o="function"==typeof b?b(t):t[b];if(!e[o]){const t={[x]:[]};"string"==typeof b&&(t[b]=o),e[o]=t}return e[o][x].push(t),e},{});return Object.values(e)}return[{[x]:q}]},[q,b,x,ee]),oe=t.useMemo(()=>ee||b?te.flatMap(e=>{const t=e[x]||[];return b&&"string"==typeof b?t.map(t=>Object.assign(Object.assign({},t),{[b]:e[b]})):t}):q,[te,x,ee,b,q]),ne=cl(q,w,A),ie=Zl({lineWidth:S,colorBy:w,colorScale:ne,fillArea:O,areaOpacity:M}),re=t.useMemo(()=>{if(N.lineStyle)return N.lineStyle},[N.lineStyle]),se=Zl({lineWidth:1,colorBy:w,colorScale:ne}),ae=null!=re?re:se,le=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?ke(e.parentLine||e,w,ne):il,t}},[C,_,w,ne]),{legend:ce,margin:ue,legendPosition:de}=gl({data:te,colorBy:w,colorScale:ne,showLegend:T,legendPosition:$,userMargin:l}),he=N.height||60,ge=t.useMemo(()=>{var e,t,o,n,i,r,s,a;return{top:null!==(t=null===(e=N.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(n=null===(o=N.margin)||void 0===o?void 0:o.bottom)&&void 0!==n?n:20,left:null!==(r=null===(i=N.margin)||void 0===i?void 0:i.left)&&void 0!==r?r:ue.left,right:null!==(a=null===(s=N.margin)||void 0===s?void 0:s.right)&&void 0!==a?a:ue.right}},[N.margin,ue]),fe=N.brushDirection||"x",pe=t.useMemo(()=>ka([{label:g||ya(m),accessor:m,role:"x",format:p},{label:f||ya(v),accessor:v,role:"y",format:y}]),[m,v,g,f,p,y]),ye=Ll({componentName:"MinimapChart",data:r,accessors:{xAccessor:m,yAccessor:v}});if(ye)return e.jsx(vl,{componentName:"MinimapChart",message:ye,width:s,height:a});const me=O?"area":"line",ve=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:me,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:ie},C&&{pointStyle:le}),{size:[s,a],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue,showAxes:!0,xLabel:g,yLabel:f,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),ce&&{legend:ce,legendPosition:de}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),{tooltipContent:!1===R?()=>null:Zn(R)||pe}),U&&{xExtent:U}),I&&{yExtent:I}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),H),be=Object.assign({chartType:me,data:oe,xAccessor:m,yAccessor:v,groupAccessor:b||void 0,curve:j,lineStyle:ae,size:[s,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(i=N.showAxes)&&void 0!==i&&i,background:N.background,enableHover:!1},I&&{yExtent:I}),xe=e.jsxs("div",{style:{position:"relative",width:s,overflow:"hidden"},children:[e.jsx(Ei,Object.assign({ref:K},be)),e.jsx(yc,{width:s-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:fe,extent:U,onBrush:Q})]},"minimap"),we=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(Ei,Object.assign({},ve))},"main");return Y||G||e.jsx(wl,{componentName:"MinimapChart",width:s,height:a,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[B?xe:we,B?we:xe]})})}pc.displayName="ScatterplotMatrix",mc.displayName="MinimapChart";const vc={label:"Low / High",color:"#E9C46A",opacity:.08},bc={label:"High / High",color:"#2A9D8F",opacity:.08},xc={label:"Low / Low",color:"#E76F51",opacity:.08},kc={label:"High / Low",color:"#86BBD8",opacity:.08};function wc(e,t){var o,n,i;return{label:null!==(o=null==t?void 0:t.label)&&void 0!==o?o:e.label,color:null!==(n=null==t?void 0:t.color)&&void 0!==n?n:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const Ac=t.forwardRef(function(o,n){const i=t.useRef(null);Bl(n,{variant:"xy",frameRef:i});const r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:g,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:v=12,colorBy:b,colorScheme:x,sizeBy:w,sizeRange:A=[3,15],pointRadius:j=5,pointOpacity:S=.8,tooltip:O,pointIdAccessor:M,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:T,onClick:$,hoverHighlight:R,chartId:N,loading:B,loadingContent:E,emptyContent:D,legendInteraction:I,legendPosition:H,color:F,stroke:W,strokeWidth:z,opacity:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=t.useMemo(()=>({topLeft:wc(vc,null==p?void 0:p.topLeft),topRight:wc(bc,null==p?void 0:p.topRight),bottomLeft:wc(xc,null==p?void 0:p.bottomLeft),bottomRight:wc(kc,null==p?void 0:p.bottomRight)}),[p]),ne=t.useMemo(()=>k(s),[s]),ie=Nl({data:ne,rawData:s,colorBy:b,colorScheme:x,legendInteraction:I,legendPosition:H,selection:P,linkedHover:L,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:T,onClick:$,hoverHighlight:R,chartType:"QuadrantChart",chartId:N,showLegend:U,userMargin:a,marginDefaults:r.marginDefaults,loading:B,loadingContent:E,emptyContent:D,width:G,height:q});Ml("QuadrantChart",ne,"xAccessor",d),Ml("QuadrantChart",ne,"yAccessor",h);const re=t.useMemo(()=>{if(!ne.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const s of ne){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>n&&(n=a)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=g&&isFinite(g)&&(o>g&&(o=g),g>n&&(n=g)),null!=f&&isFinite(f)&&(i>f&&(i=f),f>r&&(r=f)),o===1/0)return;const s=.1*(n-o)||1,a=.1*(r-i)||1;return{xExtent:[o-s,n+s],yExtent:[i-a,r+a]}},[ne,d,h,g,f]),se=t.useMemo(()=>{if(!w||0===ne.length)return;const e=ne.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?[Math.min(...e),Math.max(...e)]:void 0},[ne,w]),ae=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),le=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),ce=t.useMemo(()=>e=>{const t=ae(e),o=le(e),n=null!=g?t>=g:void 0,i=null!=f?o>=f:void 0;return void 0===i||void 0===n?F||il:i&&n?oe.topRight.color:i&&!n?oe.topLeft.color:!i&&n?oe.bottomRight.color:oe.bottomLeft.color},[ae,le,g,f,oe,F]),ue=t.useMemo(()=>w?e=>Ae(e,w,A,se):void 0,[w,A,se]),de=Dl({colorBy:b,colorScale:ie.colorScale,color:F,pointRadius:j,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:W,strokeWidth:z,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),he=t.useMemo(()=>{if(!ne.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof b&&e.add(b),"string"==typeof w&&e.add(w);const t=ne[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ne,d,h,b,w]),ge=t.useMemo(()=>ka([...he?[{label:he,accessor:he,role:"title"}]:[],{label:ee||ya(d),accessor:d,role:"x",format:c},{label:te||ya(h),accessor:h,role:"y",format:u},...b?[{label:ya(b),accessor:b,role:"color"}]:[],...w?[{label:ya(w),accessor:w,role:"size"}]:[]]),[he,d,h,ee,te,b,w,c,u]),fe=Ll({componentName:"QuadrantChart",data:s,accessors:{xAccessor:d,yAccessor:h}}),pe=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,o,n,i)=>{var r;if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const s=i.width,a=i.height,l=null!=g?n.x(g):s/2,c=null!=f?n.y(f):a/2;if(null!=g&&!isFinite(l))return;if(null!=f&&!isFinite(c))return;const u=Math.max(0,Math.min(s,l)),d=Math.max(0,Math.min(a,c)),h=[{config:oe.topLeft,x:0,y:0,w:u,h:d},{config:oe.topRight,x:u,y:0,w:s-u,h:d},{config:oe.bottomLeft,x:0,y:d,w:u,h:a-d},{config:oe.bottomRight,x:u,y:d,w:s-u,h:a-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(r=t.config.opacity)&&void 0!==r?r:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,a),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(s,d),e.stroke(),e.setLineDash([])}]},[g,f,oe,y]),ye=t.useMemo(()=>m?[...pe,(e,t,o,n)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const i=n.width,r=n.height,s=null!=g?o.x(g):i/2,a=null!=f?o.y(f):r/2;(null==g||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${v}px sans-serif`,e.globalAlpha=.5,e.fillStyle=oe.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(oe.topLeft.label,8,8),e.fillStyle=oe.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(oe.topRight.label,i-8,8),e.fillStyle=oe.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(oe.bottomLeft.label,8,r-8),e.fillStyle=oe.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(oe.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:pe,[pe,m,v,oe,g,f]),me=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...ye,...e]},[ye,_.canvasPreRenderers]),ve=t.useMemo(()=>{var t;const o={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,n,i)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return null;const r=i.width,s=i.height,a=null!=g?n.x(g):r/2,l=null!=f?n.y(f):s/2;if(null!=g&&!isFinite(a))return null;if(null!=f&&!isFinite(l))return null;const c=Math.max(0,Math.min(r,a)),u=Math.max(0,Math.min(s,l));return e.jsxs(e.Fragment,{children:[[{config:oe.topLeft,x:0,y:0,w:c,h:u},{config:oe.topRight,x:c,y:0,w:r-c,h:u},{config:oe.bottomLeft,x:0,y:u,w:c,h:s-u},{config:oe.bottomRight,x:c,y:u,w:r-c,h:s-u}].map((t,o)=>{var n;return t.w>0&&t.h>0?e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(n=t.config.opacity)&&void 0!==n?n:.08},"qf-"+o):null}),e.jsx("line",{x1:c,y1:0,x2:c,y2:s,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),e.jsx("line",{x1:0,y1:u,x2:r,y2:u,stroke:o.stroke,strokeWidth:o.strokeWidth,strokeDasharray:o.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+v,fill:oe.topLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:oe.topLeft.label}),e.jsx("text",{x:r-8,y:8+v,fill:oe.topRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:oe.topRight.label}),e.jsx("text",{x:8,y:s-8,fill:oe.bottomLeft.color,fontWeight:600,fontSize:v,opacity:.5,children:oe.bottomLeft.label}),e.jsx("text",{x:r-8,y:s-8,fill:oe.bottomRight.color,fontWeight:600,fontSize:v,opacity:.5,textAnchor:"end",children:oe.bottomRight.label})]})]})}]},[g,f,oe,y,m,v]);if(ie.earlyReturn)return ie.earlyReturn;const be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=s&&{data:ne}),{xAccessor:d,yAccessor:h,colorAccessor:b||void 0,sizeAccessor:w||void 0,sizeRange:A,pointStyle:de,colorScheme:x,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),re&&{xExtent:re.xExtent,yExtent:re.yExtent}),ie.legendBehaviorProps),Q&&{title:Q}),K&&{description:K}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===O?()=>null:!0===O||void 0===O?ge:Zn(O)||ge}),(L||T||$||R)&&{customHoverBehavior:ie.customHoverBehavior}),(T||$||L)&&{customClickBehavior:ie.customClickBehavior}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:me}),ie.crosshairProps),_),me.length>0&&{canvasPreRenderers:me}),{svgPreRenderers:ve});return fe?e.jsx(vl,{componentName:"QuadrantChart",message:fe,width:G,height:q}):e.jsx(wl,{componentName:"QuadrantChart",width:G,height:q,children:e.jsx(Ei,Object.assign({ref:i},be))})});Ac.displayName="QuadrantChart";const jc="__ma_unitized",Sc="__ma_series";function Oc(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function Mc(e,t){return t[0]+e*(t[1]-t[0])}const Cc=t.forwardRef(function(o,n){var i;const r=t.useRef(null),s=t.useRef([]),a=t.useRef(o.series);a.current=o.series,t.useImperativeHandle(n,()=>{const e=()=>{var e;return(null!==(e=a.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!r.current)return;const o=e(),n=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],i=t.extent||s.current[e];if(!i)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(n);null!=a&&isFinite(a)&&r.current.push(Object.assign(Object.assign({},n),{[jc]:Oc(a,i),[Sc]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!r.current)return;const o=e(),n=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const i=o[t],r=i.extent||s.current[t];if(!r)continue;const a=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=a&&isFinite(a)&&n.push(Object.assign(Object.assign({},e),{[jc]:Oc(a,r),[Sc]:i.label||"Series "+(t+1)}))}r.current.pushMany(n)},remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=r.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const l=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,accessibleTable:o.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:h,xAccessor:g="x",series:f,colorScheme:y,curve:m="monotoneX",lineWidth:v=2,tooltip:b,annotations:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,stroke:R,strokeWidth:N,opacity:B}=o,{width:E,height:D,enableHover:I,showGrid:H,showLegend:F=!0,title:W,description:z,summary:Y,accessibleTable:G,xLabel:q}=l,X=t.useMemo(()=>k(c),[c]),V=t.useMemo(()=>k(f),[f]),U=V,Q=2===V.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||Q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${V.length}. Rendering as a standard multi-line chart.`);const K=Ol(_,E,D,P),Z=K?null:Sl(c,E,D,L),J=al(),ee=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(J&&J.length>0)e=J;else{const t=ye[y];e=Array.isArray(t)?t:me}return U.map((t,o)=>t.color||e[o%e.length])},[U,y,J]),te=t.useMemo(()=>V.map((e,t)=>e.label||"Series "+(t+1)),[V]),{unitizedData:oe,extents:ne}=t.useMemo(()=>{if(0===X.length){const e=V.map(e=>e.extent||null).filter(Boolean);return e.length===V.length&&(s.current=e),{unitizedData:[],extents:e.length===V.length?e:[]}}const e=V.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(X,e.yAccessor));if(s.current=e,!Q){const t=[];for(const e of X)for(let o=0;V.length>o;o++){const n=V[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[jc]:i,[Sc]:te[o]}))}return{unitizedData:t,extents:e}}const t=[];for(const o of X)for(let n=0;2>n;n++){const i=V[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push(Object.assign(Object.assign({},o),{[jc]:Oc(r,e[n]),[Sc]:te[n]}))}return{unitizedData:t,extents:e}},[X,V,Q,te]),ie=t.useMemo(()=>{if(Q&&ne.length>=2)return[{orient:"left",label:te[0],tickFormat:V[0].format||(e=>{const t=Mc(e,ne[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:V[1].format||(e=>{const t=Mc(e,ne[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[Q,ne,V,te]),re=Nl({data:t.useMemo(()=>oe.length>0?oe:te.map(e=>({[Sc]:e})),[oe,te]),rawData:c,colorBy:Sc,colorScheme:ee,legendInteraction:T,legendPosition:$,selection:A,linkedHover:j,fallbackFields:[Sc],unwrapData:!1,onObservation:S,onClick:O,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:C,showLegend:F,userMargin:u,marginDefaults:Q?Object.assign(Object.assign({},l.marginDefaults),{left:70,right:70}):l.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:E,height:D}),se=t.useMemo(()=>{const e=new Map;return te.forEach((t,o)=>e.set(t,ee[o])),e},[te,ee]),ae=Zl({lineWidth:v,resolveStroke:t.useCallback(e=>se.get(e[Sc])||ee[0],[se,ee]),stroke:R,strokeWidth:N,opacity:B,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),le=t.useMemo(()=>{if(!1===b)return()=>null;return Zn(b)||(e=>{var t;const o=e.data||e,n=o[Sc],i=te.indexOf(n),r=o[jc],s=Q&&i>=0&&ne[i]?Mc(r,ne[i]):r,a=i>=0&&(null===(t=V[i])||void 0===t?void 0:t.format)?V[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),l="function"==typeof g?g(o):o[g];return p.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},p.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[i]||"inherit"}},n),p.createElement("div",null,`${"string"==typeof g?g:"x"}: ${l}`),p.createElement("div",null,`${n}: ${a(s)}`))})},[b,te,ee,ne,Q,V,g]);if(re.earlyReturn)return re.earlyReturn;const ce=Ll({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),ue=Q?[0,1]:void 0,de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:oe}),{xAccessor:g,yAccessor:jc,groupAccessor:Sc,lineStyle:ae,colorScheme:ee,size:[E,D],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:re.margin,showAxes:l.showAxes}),ie&&{axes:ie}),{xLabel:q}),Q?{}:{yLabel:te[0]}),{xFormat:h}),Q&&ue&&{yExtent:ue}),{enableHover:I}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),{showGrid:H,curve:m}),re.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:le}),x&&{annotations:x}),(j||S||O||M)&&{customHoverBehavior:re.customHoverBehavior}),(S||O||j)&&{customClickBehavior:re.customClickBehavior}),re.crosshairProps),w);return K||Z||(ce?e.jsx(vl,{componentName:"MultiAxisLineChart",message:ce,width:E,height:D}):e.jsx(wl,{componentName:"MultiAxisLineChart",width:E,height:D,children:e.jsx(Ei,Object.assign({ref:r},de))}))});function _c(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}Cc.displayName="MultiAxisLineChart";const Pc=t.forwardRef(function(o,n){const i=t.useRef(null);Bl(n,{variant:"xy",frameRef:i});const r=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,description:o.description,summary:o.summary,accessibleTable:o.accessibleTable}),{data:s,margin:a,className:l,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:g="low",openAccessor:f,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:v,xExtent:b,yExtent:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,chartId:M,loading:C,loadingContent:_,emptyContent:P}=o,{width:L,height:T,enableHover:$,showGrid:R,title:N,description:B,summary:E,accessibleTable:D,xLabel:I,yLabel:H}=r,F=Ol(C,L,T,_),W=F?null:Sl(s,L,T,P),z=t.useMemo(()=>k(s),[s]),Y=null==f||null==p;Ml("CandlestickChart",z,"xAccessor",d),Ml("CandlestickChart",z,"highAccessor",h),Ml("CandlestickChart",z,"lowAccessor",g),Y||(Ml("CandlestickChart",z,"openAccessor",f),Ml("CandlestickChart",z,"closeAccessor",p));const{customHoverBehavior:G,customClickBehavior:q,crosshairSourceId:X}=dl({selection:A,linkedHover:j,onObservation:S,onClick:O,chartType:"CandlestickChart",chartId:M}),V=hl(j,X),U=t.useMemo(()=>{const e=r.marginDefaults,t="sparkline"===o.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==a?t:Object.assign(Object.assign({},t),_c(a))},[a,r.marginDefaults,o.mode]),Q=t.useMemo(()=>{const e=[{label:I||ya(d),accessor:d,role:"x",format:c}];return Y?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:g,format:u})):(e.push({label:"Open",accessor:f,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:g,format:u}),e.push({label:"Close",accessor:p,format:u})),ka(e)},[d,I,c,u,h,g,f,p,Y]),K=Ll({componentName:"CandlestickChart",data:s,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:g},!Y&&{openAccessor:f,closeAccessor:p})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=s&&{data:z}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:g}),!Y&&{openAccessor:f,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Z,extentPadding:J,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:U,showAxes:r.showAxes,xLabel:I,yLabel:H,xFormat:c,yFormat:u,enableHover:$,showGrid:R}),o.pointIdAccessor&&{pointIdAccessor:o.pointIdAccessor}),ga({title:N,description:B,summary:E,accessibleTable:D,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:Q})),fa({linkedHover:j,onObservation:S,onClick:O,customHoverBehavior:G,customClickBehavior:q})),v&&v.length>0&&{annotations:v}),b&&{xExtent:b}),x&&{yExtent:x}),V),w);return F||W||(K?e.jsx(vl,{componentName:"CandlestickChart",message:K,width:L,height:T}):e.jsx(wl,{componentName:"CandlestickChart",width:L,height:T,children:e.jsx(Ei,Object.assign({ref:i},ee))}))});function Lc(e){const o=t.useRef(null);return Bl(e.imperativeRef,{variant:e.imperativeVariant,frameRef:o}),{frameRef:o,resolved:yl(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>_c(e.margin),[e.margin])}}function Tc(e){var t;const o=Lc(e),{resolved:n,normalizedMargin:i}=o,r=Nl({data:null!==(t=e.data)&&void 0!==t?t:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:i,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}Pc.displayName="CandlestickChart";const $c=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:g,selection:f,linkedHover:p,chartId:y,loading:m,loadingContent:v,emptyContent:b,colorScheme:x,frameProps:k={}}=t,{frameRef:w,resolved:A,safeData:j,setup:S,earlyReturn:O}=Tc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorScheme:x,selection:f,linkedHover:p,onObservation:h,onClick:g,chartId:y,loading:m,loadingContent:v,emptyContent:b,margin:c,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,showLegend:t.showLegend,title:t.title,mode:t.mode,xLabel:t.xLabel,yLabel:t.yLabel});if(O)return O;const{width:M,height:C,enableHover:_,showGrid:P,title:L,description:T,summary:$,accessibleTable:R,xLabel:N,yLabel:B}=A,E=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:j}),{customLayout:i,layoutConfig:r,xExtent:s,yExtent:a,colorScheme:x,size:[M,C],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:S.margin,showAxes:l,xLabel:N,yLabel:B,enableHover:_,showGrid:P}),S.legendBehaviorProps),ga({title:L,description:T,summary:$,accessibleTable:R,className:u,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),null!=t.tooltip&&{tooltipContent:t.tooltip}),fa({linkedHover:p,onObservation:h,onClick:g,hoverHighlight:!1,customHoverBehavior:S.customHoverBehavior,customClickBehavior:S.customClickBehavior})),d&&d.length>0&&{annotations:d}),S.crosshairProps),k);return e.jsx(wl,{componentName:"XYCustomChart",width:M,height:C,children:e.jsx(Ei,Object.assign({ref:w},E))})});$c.displayName="XYCustomChart";const Rc=t.forwardRef(function(o,n){const{nodes:i,edges:r,layout:s,layoutConfig:a,nodeIDAccessor:l="id",sourceAccessor:c="source",targetAccessor:u="target",margin:d,className:h,colorScheme:g,selection:f,linkedHover:p,onObservation:y,onClick:m,chartId:v,frameProps:b={}}=o,{frameRef:x,resolved:w,normalizedMargin:A}=Lc({imperativeRef:n,imperativeVariant:"network",margin:d,width:o.width,height:o.height,enableHover:o.enableHover,title:o.title,mode:o.mode}),j=t.useMemo(()=>k(null!=i?i:[]),[i]),S=t.useMemo(()=>k(null!=r?r:[]),[r]),{customHoverBehavior:O,customClickBehavior:M,activeSelectionHook:C}=dl({selection:f,linkedHover:p,fallbackFields:[],onObservation:y,onClick:m,chartType:"NetworkCustomChart",chartId:v}),_=t.useMemo(()=>(null==C?void 0:C.isActive)?{isActive:!0,predicate:C.predicate}:null,[null==C?void 0:C.isActive,null==C?void 0:C.predicate]),{width:P,height:L,enableHover:T,title:$,description:R,summary:N,accessibleTable:B}=w,E=Object.assign(Object.assign(Object.assign(Object.assign({chartType:"force"},null!=i&&{nodes:j}),null!=r&&{edges:S}),{customNetworkLayout:s,layoutConfig:a,nodeIDAccessor:l,sourceAccessor:c,targetAccessor:u,colorScheme:g,size:[P,L],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:A,className:h,title:$,description:R,summary:N,accessibleTable:B,enableHover:T,customHoverBehavior:p||y||m?O:void 0,customClickBehavior:y||m?M:void 0,layoutSelection:_}),b);return e.jsx(wl,{componentName:"NetworkCustomChart",width:P,height:L,children:e.jsx(ha,Object.assign({ref:x},E))})});Rc.displayName="NetworkCustomChart";const Nc=t.forwardRef(function(t,o){const{data:n,layout:i,layoutConfig:r,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorScheme:g,showAxes:f=!1,annotations:p,onObservation:y,onClick:m,selection:v,linkedHover:b,chartId:x,loading:k,loadingContent:w,emptyContent:A,frameProps:j={}}=t,{frameRef:S,resolved:O,safeData:M,setup:C,earlyReturn:_}=Tc({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:n,colorScheme:g,selection:v,linkedHover:b,onObservation:y,onClick:m,chartId:x,loading:k,loadingContent:w,emptyContent:A,margin:d,width:t.width,height:t.height,showGrid:t.showGrid,enableHover:t.enableHover,title:t.title,mode:t.mode});if(_)return _;const{width:P,height:L,enableHover:T,showGrid:$,title:R,description:N,summary:B,accessibleTable:E}=O,D=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=n&&{data:M}),{customLayout:i,layoutConfig:r,oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorScheme:g,size:[P,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:C.margin,enableHover:T,showAxes:f,showGrid:$,annotations:p}),ga({title:R,description:N,summary:B,accessibleTable:E,className:h,animate:t.animate,axisExtent:t.axisExtent,autoPlaceAnnotations:t.autoPlaceAnnotations})),fa({linkedHover:b,onObservation:y,onClick:m,hoverHighlight:!1,customHoverBehavior:C.customHoverBehavior,customClickBehavior:C.customClickBehavior})),j);return e.jsx(wl,{componentName:"OrdinalCustomChart",width:P,height:L,children:e.jsx(kr,Object.assign({ref:S},D))})});function Bc({ref:e,frameRef:o,setup:n}){return t.useImperativeHandle(e,()=>({push:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=o.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,n;return null!==(n=null===(t=o.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,i;return null!==(i=null===(n=o.current)||void 0===n?void 0:n.update(e,t))&&void 0!==i?i:[]},clear:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=o.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[o]),{effectiveLegendProps:n.legendBehaviorProps,effectiveMargin:n.margin}}function Ec(e){const{colorBy:o,colorScale:n,color:i,themeCategorical:r,colorScheme:s,categoryIndexMap:a,userPieceStyle:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:g,cycleByCategory:f=!1,baseStyleExtras:p,linkStrokeToFill:y=!1}=e,m=t.useMemo(()=>(e,t)=>{const l="function"==typeof p?p(e,t):p,c=l?Object.assign({},l):{};if(void 0===c.fill)if(o){if(!n)return c;c.fill=ke(e,o,n)}else c.fill=ll(i,r,s,f?t:void 0,a);return y&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[o,n,i,r,s,a,f,p,y]),v=t.useMemo(()=>El(l?"function"==typeof l?(e,t)=>Object.assign(Object.assign({},m(e,t)),l(e,t)||{}):(e,t)=>Object.assign(Object.assign({},m(e,t)),l):m,{stroke:c,strokeWidth:u,opacity:d}),[m,l,c,u,d]);return t.useMemo(()=>Ua(v,null!=h?h:null,g),[v,h,g])}Nc.displayName="OrdinalCustomChart";const Dc=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sort:p=!1,barPadding:y=40,roundedTop:m,gradientFill:v=!1,baselinePadding:b=!1,tooltip:x,annotations:w,regression:A,valueExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:R,legendInteraction:N,legendPosition:B,color:E,stroke:D,strokeWidth:I,opacity:H,showCategoryTicks:F,categoryFormat:W,dataIdAccessor:z}=o,{width:Y,height:G,enableHover:q,showGrid:X,showLegend:V,title:U,description:Q,summary:K,accessibleTable:Z,categoryLabel:J,valueLabel:ee}=i,te=t.useMemo(()=>k(s),[s]),oe=Nl({data:te,rawData:s,colorBy:g,colorScheme:f,legendInteraction:N,legendPosition:B,selection:O,linkedHover:M,fallbackFields:g?["string"==typeof g?g:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"BarChart",chartId:L,showLegend:V,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:$,emptyContent:R,width:Y,height:G}),{effectiveLegendProps:ne,effectiveMargin:ie}=Bc({ref:n,frameRef:r,setup:oe});Ml("BarChart",te,"categoryAccessor",c),Ml("BarChart",te,"valueAccessor",u);const re=ul(te,p,u),se=al(),ae=t.useMemo(()=>new Map,[te]),le=Ec({colorBy:g,colorScale:oe.colorScale,color:E,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:I,opacity:H,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ce=t.useMemo(()=>wa({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",valueFormat:h}),[c,u,g,h]);if(oe.earlyReturn)return oe.earlyReturn;const ue=Ll({componentName:"BarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(vl,{componentName:"BarChart",message:ue,width:Y,height:G});const de=Hl(A),he=de?[de,...w||[]]:w,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:re}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[Y,G],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ie,barPadding:y}),null!=m&&{roundedTop:m}),v&&{gradientFill:!0===v?{topOpacity:.8,bottomOpacity:.05}:v}),z&&{dataIdAccessor:z}),{baselinePadding:b,enableHover:q,showAxes:i.showAxes,oLabel:J,rLabel:ee,rFormat:h}),W&&{oFormat:W}),{showGrid:X,showCategoryTicks:F,oSort:p}),ne),ga({title:U,description:Q,summary:K,accessibleTable:Z,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:x,defaultTooltipContent:ce})),fa({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior})),he&&he.length>0&&{annotations:he}),j&&{rExtent:j}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"BarChart",width:Y,height:G,children:e.jsx(kr,Object.assign({ref:r},ge))})});Dc.displayName="BarChart";const Ic=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",stackBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,normalize:y=!1,sort:m=!1,barPadding:v=40,roundedTop:b,baselinePadding:x=!1,tooltip:w,annotations:A,valueExtent:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:R,legendInteraction:N,legendPosition:B,color:E,stroke:D,strokeWidth:I,opacity:H,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=f||u,te=Nl({data:J,rawData:s,colorBy:ee,colorScheme:p,legendInteraction:N,legendPosition:B,selection:O,linkedHover:M,fallbackFields:ee?["string"==typeof ee?ee:""]:[],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"StackedBarChart",chartId:L,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:$,emptyContent:R,width:W,height:z}),oe=al(),ne=t.useMemo(()=>new Map,[J]),ie=Ec({colorBy:ee,colorScale:te.colorScale,color:E,themeCategorical:oe,colorScheme:p,categoryIndexMap:ne,userPieceStyle:null==S?void 0:S.pieceStyle,stroke:D,strokeWidth:I,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=t.useMemo(()=>wa({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),se=Ll({componentName:"StackedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{stackBy:u}}),{effectiveLegendProps:ae,effectiveMargin:le}=Bc({ref:n,frameRef:r,setup:te});if(te.earlyReturn)return te.earlyReturn;const ce=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:J}),{oAccessor:c,rAccessor:d,stackBy:u,normalize:y,oSort:m,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ie,size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:le,barPadding:v}),null!=b&&{roundedTop:b}),{baselinePadding:x,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G}),ae),ga({title:X,description:V,summary:U,accessibleTable:Q,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:w,defaultTooltipContent:re})),fa({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),A&&A.length>0&&{annotations:A}),j&&{rExtent:j}),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return se?e.jsx(vl,{componentName:"StackedBarChart",message:se,width:W,height:z}):e.jsx(wl,{componentName:"StackedBarChart",width:W,height:z,children:e.jsx(kr,Object.assign({ref:r},ce))})});Ic.displayName="StackedBarChart";const Hc={RdBu:ce,PiYG:ue,PRGn:de,BrBG:he,RdYlBu:ge,RdYlGn:fe,Spectral:pe},Fc="__likert_neutral_neg",Wc="__likert_neutral_pos";function zc(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Yc(e,t,o,n,i,r){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(n){const e=n(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const i=t[o];c.set(i,(c.get(i)||0)+1)}else if(i&&r){const e=i(l),t=r(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let n=0;for(const e of t)n+=o.get(e)||0;if(0!==n)for(let i=0;t.length>i;i++){const r=t[i],s=o.get(r)||0;l.push({__likertCategory:e,__likertLevel:r,__likertLevelLabel:r,__likertCount:s,__likertPct:s/n*100,__likertLevelIndex:i})}}return l}function Gc(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=[];for(const t of e){const e=t.__likertLevelIndex;if(n&&e===i){const e=t.__likertPct/2;r.push(Object.assign(Object.assign({},t),{__likertLevel:Fc,__likertPct:-e})),r.push(Object.assign(Object.assign({},t),{__likertLevel:Wc,__likertPct:e}))}else r.push(i>e?Object.assign(Object.assign({},t),{__likertPct:-t.__likertPct}):t)}return r}function qc(e,t){const o=t.length,n=o%2!=0,i=Math.floor(o/2),r=new Map;for(const t of e){const e=r.get(t.__likertCategory)||[];e.push(t),r.set(t.__likertCategory,e)}const s=[];for(const[,e]of r){const t=new Map;let r,a;for(const o of e)o.__likertLevel===Fc?r=o:o.__likertLevel===Wc?a=o:t.set(o.__likertLevelIndex,o);n&&r&&s.push(r);for(let e=i-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}n&&a&&s.push(a);for(let e=n?i+1:i;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}const Xc=["Very Low","Low","Neutral","High","Very High"],Vc=new Map,Uc=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="question",valueAccessor:u,levelAccessor:d,countAccessor:h="count",levels:g=Xc,orientation:f="horizontal",colorScheme:y,barPadding:m=20,tooltip:v,annotations:b,valueExtent:x,frameProps:k={},selection:w,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,chartId:M,valueFormat:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,categoryFormat:R,stroke:N,strokeWidth:B,opacity:E}=o,{width:D,height:I,enableHover:H,showGrid:F,showLegend:W,title:z,description:Y,summary:G,accessibleTable:q,categoryLabel:X,valueLabel:V}=i,U="horizontal"===f,Q=void 0===s,K=!d,Z=function(){var e;const t=nl();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.diverging)||void 0}(),J=t.useMemo(()=>y&&Array.isArray(y)&&y.length>=g.length?y:function(e,t){if(0>=e)return[];if(t){const o=Hc[t];if(o){if(1===e)return[o(.5)];const t=[];for(let n=0;e>n;n++)t.push(o(n/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],n=["#a6c8ff","#4589ff","#0043ce"],i="#a8a8a8";if(1===e)return[i];const r=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);r&&a.push(i);for(let e=0;s>e;e++)a.push(n[Math.min(Math.floor(e*n.length/s),n.length-1)]);return a}(g.length,Z),[y,g.length,Z]),ee=t.useMemo(()=>{const e=new Map;for(let t=0;g.length>t;t++)e.set(g[t],J[t]||"#888");return e},[g,J]),{processedData:te,reAggregate:oe,accumulatorRef:ne}=function({data:e,levels:o,categoryAccessor:n,valueAccessor:i,levelAccessor:r,countAccessor:s,isDiverging:a,frameRef:l}){const c=!r,u=t.useMemo(()=>zc(n,"question"),[n]),d=t.useMemo(()=>c?zc(i,"score"):null,[c,i]),h=t.useMemo(()=>c?null:zc(r,"level"),[c,r]),g=t.useMemo(()=>c?null:zc(s,"count"),[c,s]),f=e||[],p=t.useRef([]),y=t.useMemo(()=>{if(0===f.length)return[];let e=Yc(f,o,u,d,h,g);return a&&(e=Gc(e,o),e=qc(e,o)),e},[f,o,u,d,h,g,a]),m=t.useCallback(e=>{var t;let n=Yc(e,o,u,d,h,g);a&&(n=Gc(n,o),n=qc(n,o)),null===(t=l.current)||void 0===t||t.replace(n)},[o,u,d,h,g,a,l]);return{processedData:y,reAggregate:m,accumulatorRef:p}}({data:s,levels:g,categoryAccessor:c,valueAccessor:u,levelAccessor:d,countAccessor:h,isDiverging:U,frameRef:r}),ie="__likertLevelLabel",re=function({isPushMode:e,colorBy:o,colorScheme:n,showLegend:i,legendPosition:r="right"}){const s=t.useRef(new Set),a=t.useRef([]),[l,c]=t.useState(0),u=Sa(),d=al(),h=t.useCallback(e=>{const t=e[o];return null!=t?t+"":null},[o]),g=t.useCallback(t=>{if(!e||!o)return;let n=!1;for(const e of t){if(!e||"object"!=typeof e)continue;const t=h(e);null==t||s.current.has(t)||(s.current.add(t),a.current.push(t),n=!0)}n&&c(e=>e+1)},[e,o,h]),f=t.useCallback(t=>{if(!e||!o)return;const n=Array.from(new Set(t.map(String))),i=a.current;i.length===n.length&&i.every((e,t)=>e===n[t])||(s.current=new Set(n),a.current=n,c(e=>e+1))},[e,o]),p=t.useCallback(e=>t=>{g([t]),e(t)},[g]),y=t.useCallback(e=>t=>{g(t),e(t)},[g]),m=t.useCallback(()=>{s.current=new Set,a.current=[],c(e=>e+1)},[]);za(e&&o?a.current:[]);const v=t.useMemo(()=>{if(!e||!o||!1===i)return;const t=a.current;if(0===t.length)return;const r=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:d&&d.length>0?d:ve,s=o,l=t.map(e=>({[s]:e})),c=we(l,s,r);return Xa({data:l,colorBy:s,colorScale:e=>(null==u?void 0:u[e])||c(e)||"#999",getColor:ke})},[e,o,i,n,u,d,l]),b=t.useMemo(()=>{if(v)return"right"===r?{right:110}:"left"===r?{left:110}:"top"===r?{top:50}:"bottom"===r?{bottom:80}:{right:110}},[v,r]);return{wrapPush:p,wrapPushMany:y,resetCategories:m,categories:a.current,categoryDomainProps:e&&o?{legendCategoryAccessor:o,onCategoriesChange:f}:{},streamingLegend:v,streamingMarginAdjust:b}}({isPushMode:Q,colorBy:ie,colorScheme:J,showLegend:W,legendPosition:$}),se=t.useCallback(re.wrapPush(e=>{ne.current.push(e),oe(ne.current)}),[re.wrapPush,oe,ne]),ae=t.useCallback(re.wrapPushMany(e=>{ne.current.push(...e),oe(ne.current)}),[re.wrapPushMany,oe,ne]);t.useImperativeHandle(n,()=>({push:se,pushMany:ae,remove:e=>{var t,o;return null!==(o=null===(t=r.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=r.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;ne.current=[],re.resetCategories(),null===(e=r.current)||void 0===e||e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=r.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[se,ae,re.resetCategories,ne]);const le=Nl({data:te,rawData:s,colorBy:ie,colorScheme:J,legendInteraction:T,legendPosition:$,selection:w,linkedHover:A,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:O,chartType:"LikertChart",chartId:M,showLegend:W,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:D,height:I}),ce=t.useMemo(()=>{const e=g.length;return e%2!=0&&ee.get(g[Math.floor(e/2)])||"#888"},[g,ee]),ue=Ec({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Vc,userPieceStyle:null==k?void 0:k.pieceStyle,stroke:N,strokeWidth:B,opacity:E,effectiveSelectionHook:le.effectiveSelectionHook,resolvedSelection:le.resolvedSelection,baseStyleExtras:e=>{var t,o;const n=e.__likertLevelLabel||(null===(t=e.data)||void 0===t?void 0:t.__likertLevelLabel),i=e.__likertLevel||(null===(o=e.data)||void 0===o?void 0:o.__likertLevel);if(i===Fc||i===Wc)return{fill:ce};const r=n||i;return r&&ee.has(r)?{fill:ee.get(r)}:{fill:"#888"}}}),de=t.useMemo(()=>{const e=g.length;return e%2!=0?g[Math.floor(e/2)]:""},[g]),he=t.useMemo(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",n=o===Fc||o===Wc?de:o,i=t.__likertCategory||"",r=Math.abs(t.__likertPct||0),s=o===Fc||o===Wc?2*r:r,a=t.__likertCount||0;return p.createElement("div",{className:"semiotic-tooltip",style:Xn},p.createElement("div",{style:{fontWeight:"bold"}},i),p.createElement("div",{style:{marginTop:4}},`${n}: ${s.toFixed(1)}% (n=${a})`))},[de]),ge=t.useMemo(()=>{if(!g||2>g.length)return"LikertChart requires `levels` with at least 2 entries.";if(u&&d)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(d&&!h)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==s&&0===s.length)return null;const e={categoryAccessor:c};return K?u&&(e.valueAccessor=u):(d&&(e.levelAccessor=d),h&&(e.countAccessor=h)),Ll({componentName:"LikertChart",data:s,accessors:e,requiredProps:{levels:g}})},[s,c,u,d,h,g,K]),fe=t.useMemo(()=>[{styleFn:e=>({fill:ee.get(e.label)||"#888"}),items:g.map(e=>({label:e})),label:""}],[g,ee]),pe=t.useMemo(()=>!1!==W?Object.assign(Object.assign({},le.legendBehaviorProps),{legend:{legendGroups:fe},legendPosition:$||le.legendPosition||"bottom"}):le.legendBehaviorProps,[le.legendBehaviorProps,le.legendPosition,$,W,fe]),ye=t.useMemo(()=>{const e=Object.assign({},le.margin);if(Q&&!1!==W){const t=$||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(re.streamingMarginAdjust)for(const[t,o]of Object.entries(re.streamingMarginAdjust))o>e[t]&&(e[t]=o);return U&&100>e.left&&(e.left=100),e},[le.margin,re.streamingMarginAdjust,U,Q,W,$]),me=t.useMemo(()=>C||(U?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[U,C]);if(le.earlyReturn)return le.earlyReturn;const be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bar"},null!=s&&{data:te}),{oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:U?"horizontal":"vertical",pieceStyle:ue,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ye,barPadding:m,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:X,rLabel:V||(U?void 0:"Percentage"),rFormat:me}),R&&{oFormat:R}),{showGrid:F}),pe),z&&{title:z}),Y&&{description:Y}),G&&{summary:G}),void 0!==q&&{accessibleTable:q}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),void 0!==o.axisExtent&&{axisExtent:o.axisExtent}),void 0!==o.autoPlaceAnnotations&&{autoPlaceAnnotations:o.autoPlaceAnnotations}),{tooltipContent:!1===v?()=>null:!0===v?he:Zn(v)||he}),(A||j||S||O)&&{customHoverBehavior:le.customHoverBehavior}),(j||S||A)&&{customClickBehavior:le.customClickBehavior}),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(vl,{componentName:"LikertChart",message:ge,width:D,height:I}):e.jsx(wl,{componentName:"LikertChart",width:D,height:I,children:e.jsx(kr,Object.assign({ref:r},be))})});function Qc({brushProp:e,onBrushProp:o,linkedBrush:n,valueAccessor:i}){const r=Va("string"==typeof n?n:n?{name:n.name,xField:n.rField}:void 0),s=Ba({name:(null==r?void 0:r.name)||"__unused_ordinal_brush__",xField:(null==r?void 0:r.xField)||("string"==typeof i?i:"value")}),a=t.useRef(s.brushInteraction);a.current=s.brushInteraction;const l=t.useCallback(e=>{if(r){a.current.end(e?e.r:null)}null==o||o(e)},[o,r]),c=!!(e||n||o);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}Uc.displayName="LikertChart";const Kc=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,sizeBy:p,sizeRange:y=[3,8],pointRadius:m=4,pointOpacity:v=.7,categoryPadding:b=20,tooltip:x,annotations:w,valueExtent:A,brush:j,onBrush:S,linkedBrush:O,frameProps:M={},selection:C,linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,chartId:$,loading:R,loadingContent:N,emptyContent:B,legendInteraction:E,legendPosition:D,color:I,stroke:H,strokeWidth:F,opacity:W,showCategoryTicks:z,categoryFormat:Y}=o,{width:G,height:q,enableHover:X,showGrid:V,showLegend:U,title:Q,description:K,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=i,oe=t.useMemo(()=>k(s),[s]),ne=Nl({data:oe,rawData:s,colorBy:g,colorScheme:f,legendInteraction:E,legendPosition:D,selection:C,linkedHover:_,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:P,onClick:L,hoverHighlight:T,chartType:"SwarmPlot",chartId:$,showLegend:U,userMargin:a,marginDefaults:i.marginDefaults,loading:R,loadingContent:N,emptyContent:B,width:G,height:q}),ie=Qc({brushProp:j,onBrushProp:S,linkedBrush:O,valueAccessor:u}),re=t.useMemo(()=>{if(!p)return;const e=oe.map(e=>"function"==typeof p?p(e):e[p]);return[Math.min(...e),Math.max(...e)]},[oe,p]),se=al(),ae=t.useMemo(()=>new Map,[oe]),le=Ec({colorBy:g,colorScale:ne.colorScale,color:I,themeCategorical:se,colorScheme:f,categoryIndexMap:ae,userPieceStyle:null==M?void 0:M.pieceStyle,stroke:H,strokeWidth:F,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:p?Ae(e,p,y,re):m})}),ce=t.useMemo(()=>wa({categoryAccessor:c,valueAccessor:u,groupAccessor:g||void 0,valueFormat:h}),[c,u,g,h]);if(ne.earlyReturn)return ne.earlyReturn;const ue=Ll({componentName:"SwarmPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ue)return e.jsx(vl,{componentName:"SwarmPlot",message:ue,width:G,height:q});const de=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swarm"},null!=s&&{data:oe}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",pieceStyle:le,size:[G,q],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ne.margin,barPadding:b,enableHover:X}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:ee,rLabel:te,rFormat:h}),Y&&{oFormat:Y}),{showGrid:V,showCategoryTicks:z}),ne.legendBehaviorProps),ga({title:Q,description:K,summary:Z,accessibleTable:J,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:x,defaultTooltipContent:ce})),fa({linkedHover:_,onObservation:P,onClick:L,hoverHighlight:T,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),ie.brushStreamProps),Object.fromEntries(Object.entries(M).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"SwarmPlot",width:G,height:q,children:e.jsx(kr,Object.assign({ref:r},de))})});function Zc(t){return o=>{var n;const i=o.category||o.data&&(null===(n=o.data[0])||void 0===n?void 0:n.category)||"",r=o.stats||(o.data||o).stats;if(r&&null!=r.median)return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),null!=r.n&&e.jsxs("div",{children:["n = ",r.n]}),null!=r.min&&e.jsxs("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&e.jsxs("div",{children:["Q1: ",r.q1.toLocaleString()]}),e.jsxs("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&e.jsxs("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&e.jsxs("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&e.jsxs("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(null==t?void 0:t.valueAccessor){const n=t.valueAccessor,r=(Array.isArray(o.data)?o.data:[]).map(e=>Number("function"==typeof n?n(e):e[n])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),s=r.length,a=s>0?s%2!=0?r[Math.floor(s/2)]:(r[s/2-1]+r[s/2])/2:null;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[i&&e.jsx("div",{style:{fontWeight:"bold"},children:i+""}),s>0&&e.jsxs("div",{children:["n = ",s]}),null!=a&&e.jsxs("div",{children:["Median: ",a.toLocaleString()]})]})}return e.jsx("div",{className:"semiotic-tooltip",style:Xn,children:e.jsx("div",{style:{fontWeight:"bold"},children:i+""})})}}Kc.displayName="SwarmPlot";const Jc=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",valueFormat:h,colorBy:g,colorScheme:f,showOutliers:p=!0,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,frameProps:x={},selection:w,linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,chartId:M,loading:C,loadingContent:_,emptyContent:P,legendInteraction:L,legendPosition:T,color:$,stroke:R,strokeWidth:N,opacity:B,showCategoryTicks:E,categoryFormat:D}=o,{width:I,height:H,enableHover:F,showGrid:W,showLegend:z,title:Y,description:G,summary:q,accessibleTable:X,categoryLabel:V,valueLabel:U}=i,Q=t.useMemo(()=>k(s),[s]),K=Nl({data:Q,rawData:s,colorBy:g,colorScheme:f,legendInteraction:L,legendPosition:T,selection:w,linkedHover:A,fallbackFields:g?["string"==typeof g?g:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:j,onClick:S,hoverHighlight:O,chartType:"BoxPlot",chartId:M,showLegend:z,userMargin:a,marginDefaults:i.marginDefaults,loading:C,loadingContent:_,emptyContent:P,width:I,height:H}),Z=al(),J=t.useMemo(()=>new Map,[Q]),ee=Ec({colorBy:g,colorScale:K.colorScale,color:$,themeCategorical:Z,colorScheme:f,categoryIndexMap:J,userPieceStyle:void 0,stroke:R,strokeWidth:N,opacity:B,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),te=t.useMemo(()=>Zc(),[]);if(K.earlyReturn)return K.earlyReturn;const oe=Ll({componentName:"BoxPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(oe)return e.jsx(vl,{componentName:"BoxPlot",message:oe,width:I,height:H});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"boxplot"},null!=s&&{data:Q}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:ee,showOutliers:p,size:[I,H],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:K.margin,barPadding:y,enableHover:F}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:V,rLabel:U,rFormat:h}),D&&{oFormat:D}),{showGrid:W,showCategoryTicks:E}),K.legendBehaviorProps),ga({title:Y,description:G,summary:q,accessibleTable:X,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:te})),fa({linkedHover:A,onObservation:j,onClick:S,hoverHighlight:O,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior})),v&&v.length>0&&{annotations:v}),b&&{rExtent:b}),Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"BoxPlot",width:I,height:H,children:e.jsx(kr,Object.assign({ref:r},ne))})});Jc.displayName="BoxPlot";const eu=e=>{const t=null==e?void 0:e.category;return null==t?"All":t+""},tu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:"horizontal"}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c=eu,valueAccessor:u="value",bins:d=25,relative:h=!1,valueFormat:g,colorBy:f,colorScheme:p,categoryPadding:y=20,tooltip:m,annotations:v,valueExtent:b,brush:x,onBrush:w,linkedBrush:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:R,legendPosition:N,color:B,stroke:E,strokeWidth:D,opacity:I,showCategoryTicks:H,categoryFormat:F}=o,{width:W,height:z,enableHover:Y,showGrid:G,showLegend:q,title:X,description:V,summary:U,accessibleTable:Q,categoryLabel:K,valueLabel:Z}=i,J=t.useMemo(()=>k(s),[s]),ee=Nl({data:J,rawData:s,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:N,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"Histogram",chartId:P,showLegend:q,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:W,height:z}),te=Qc({brushProp:x,onBrushProp:w,linkedBrush:A,valueAccessor:u}),oe=t.useMemo(()=>{if(0===J.length)return;const e="function"==typeof u?u:e=>e[u];let t=1/0,o=-1/0;for(const n of J){const i=e(n);null!=i&&isFinite(i)&&(t>i&&(t=i),i>o&&(o=i))}return t>o?void 0:[t,o]},[J,u]),ne=al(),ie=t.useMemo(()=>new Map,[J]),re=Ec({colorBy:f,colorScale:ee.colorScale,color:B,themeCategorical:ne,colorScheme:p,categoryIndexMap:ie,userPieceStyle:void 0,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),se=t.useMemo(()=>t=>{const o=t.data||t,n=o.category||t.category||"",i=o.count,r=o.range;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[n&&e.jsx("div",{style:{fontWeight:"bold"},children:n+""}),null!=i&&e.jsxs("div",{children:["Count: ",i]}),r&&2===r.length&&e.jsxs("div",{style:{opacity:.8},children:[Number(r[0]).toFixed(1)," – ",Number(r[1]).toFixed(1)]})]})},[]);if(ee.earlyReturn)return ee.earlyReturn;const ae=Ll({componentName:"Histogram",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(vl,{componentName:"Histogram",message:ae,width:W,height:z});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"histogram"},null!=s&&{data:J}),{oAccessor:c,rAccessor:u,projection:"horizontal",summaryStyle:re,bins:d,normalize:h}),b?{rExtent:b}:oe&&{rExtent:oe}),{size:[W,z],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee.margin,barPadding:y,enableHover:Y}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:K,rLabel:Z,rFormat:g}),F&&{oFormat:F}),{showGrid:G,showCategoryTicks:H}),ee.legendBehaviorProps),ga({title:X,description:V,summary:U,accessibleTable:Q,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:se})),fa({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),v&&v.length>0&&{annotations:v}),te.brushStreamProps),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"Histogram",width:W,height:z,children:e.jsx(kr,Object.assign({ref:r},le))})});tu.displayName="Histogram";const ou=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="vertical",bins:h=25,showIQR:g=!0,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=20,tooltip:v,annotations:b,valueExtent:x,brush:w,onBrush:A,linkedBrush:j,frameProps:S={},selection:O,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:T,loadingContent:$,emptyContent:R,legendInteraction:N,legendPosition:B,color:E,stroke:D,strokeWidth:I,opacity:H,showCategoryTicks:F,categoryFormat:W}=o,{width:z,height:Y,enableHover:G,showGrid:q,showLegend:X,title:V,description:U,summary:Q,accessibleTable:K,categoryLabel:Z,valueLabel:J}=i,ee=t.useMemo(()=>k(s),[s]),te=Nl({data:ee,rawData:s,colorBy:p,colorScheme:y,legendInteraction:N,legendPosition:B,selection:O,linkedHover:M,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:C,onClick:_,hoverHighlight:P,chartType:"ViolinPlot",chartId:L,showLegend:X,userMargin:a,marginDefaults:i.marginDefaults,loading:T,loadingContent:$,emptyContent:R,width:z,height:Y}),oe=Qc({brushProp:w,onBrushProp:A,linkedBrush:j,valueAccessor:u}),ne=al(),ie=t.useMemo(()=>new Map,[ee]),re=Ec({colorBy:p,colorScale:te.colorScale,color:E,themeCategorical:ne,colorScheme:y,categoryIndexMap:ie,userPieceStyle:void 0,stroke:D,strokeWidth:I,opacity:H,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),se=t.useMemo(()=>Zc({valueAccessor:u}),[u]);if(te.earlyReturn)return te.earlyReturn;const ae=Ll({componentName:"ViolinPlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ae)return e.jsx(vl,{componentName:"ViolinPlot",message:ae,width:z,height:Y});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"violin"},null!=s&&{data:ee}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:re,bins:h,showIQR:g,size:[z,Y],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:te.margin,barPadding:m,enableHover:G}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Z,rLabel:J,rFormat:f}),W&&{oFormat:W}),{showGrid:q,showCategoryTicks:F}),te.legendBehaviorProps),ga({title:V,description:U,summary:Q,accessibleTable:K,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:v,defaultTooltipContent:se})),fa({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),oe.brushStreamProps),Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"ViolinPlot",width:z,height:Y,children:e.jsx(kr,Object.assign({ref:r},le))})});ou.displayName="ViolinPlot";const nu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",orientation:d="horizontal",bins:h=20,amplitude:g=1.5,valueFormat:f,colorBy:p,colorScheme:y,categoryPadding:m=5,tooltip:v,annotations:b,valueExtent:x,frameProps:w={},selection:A,linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,legendPosition:$,color:R,stroke:N,strokeWidth:B,opacity:E,showCategoryTicks:D,categoryFormat:I}=o,{width:H,height:F,enableHover:W,showGrid:z,showLegend:Y,title:G,description:q,summary:X,accessibleTable:V,categoryLabel:U,valueLabel:Q}=i,K=t.useMemo(()=>k(s),[s]),Z=Nl({data:K,rawData:s,colorBy:p,colorScheme:y,legendInteraction:T,legendPosition:$,selection:A,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof c?c:""],unwrapData:!0,onObservation:S,onClick:O,hoverHighlight:M,chartType:"RidgelinePlot",chartId:C,showLegend:Y,userMargin:a,marginDefaults:i.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:H,height:F}),J=al(),ee=t.useMemo(()=>new Map,[K]),te=Ec({colorBy:p,colorScale:Z.colorScale,color:R,themeCategorical:J,colorScheme:y,categoryIndexMap:ee,userPieceStyle:void 0,stroke:N,strokeWidth:B,opacity:E,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),oe=t.useMemo(()=>Zc(),[]);if(Z.earlyReturn)return Z.earlyReturn;const ne=Ll({componentName:"RidgelinePlot",data:s,accessors:{categoryAccessor:c,valueAccessor:u}});if(ne)return e.jsx(vl,{componentName:"RidgelinePlot",message:ne,width:H,height:F});const ie=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"ridgeline"},null!=s&&{data:K}),{oAccessor:c,rAccessor:u,projection:"horizontal"===d?"horizontal":"vertical",summaryStyle:te,bins:h,size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Z.margin,barPadding:m,enableHover:W}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:U,rLabel:Q,rFormat:f}),I&&{oFormat:I}),{showGrid:z,showCategoryTicks:D,oSort:!1,amplitude:g}),Z.legendBehaviorProps),ga({title:G,description:q,summary:X,accessibleTable:V,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:v,defaultTooltipContent:oe})),fa({linkedHover:j,onObservation:S,onClick:O,hoverHighlight:M,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior})),b&&b.length>0&&{annotations:b}),x&&{rExtent:x}),Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"RidgelinePlot",width:H,height:F,children:e.jsx(kr,Object.assign({ref:r},ie))})});nu.displayName="RidgelinePlot";const iu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:!1,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:!1}),r=t.useRef(null);Bl(n,{variant:"xy",frameRef:r});const{data:s,margin:a,className:l,stepAccessor:c="step",valueAccessor:u="value",categoryAccessor:d,colorBy:h,colorScheme:g,orientation:f="horizontal",connectorOpacity:p=.3,showLabels:y=!0,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:R,opacity:N,categoryFormat:B}=o,E="vertical"===f,{width:D,height:I,enableHover:H,showLegend:F,title:W,description:z,summary:Y,accessibleTable:G}=i,q=E?{top:W?60:40,right:20,bottom:60,left:60}:{top:W?40:10,right:10,bottom:10,left:10},X=t.useMemo(()=>k(s),[s]),V=h||d,U=!V,Q=Nl({data:X,rawData:s,colorBy:V,colorScheme:g,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:V?["string"==typeof V?V:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"FunnelChart",chartId:O,showLegend:F,userMargin:a,marginDefaults:q,loading:M,loadingContent:C,emptyContent:_,width:D,height:I});Ml("FunnelChart",X,"stepAccessor",c),Ml("FunnelChart",X,"valueAccessor",u);const K=al(),Z=t.useMemo(()=>new Map,[X]),J=t.useMemo(()=>{if(U)return T||((null==K?void 0:K[0])?K[0]:Array.isArray(g)&&g[0]?g[0]:"#4e79a7")},[U,T,K,g]),ee=Ec({colorBy:J?void 0:V,colorScale:Q.colorScale,color:null!=J?J:T,themeCategorical:K,colorScheme:g,categoryIndexMap:Z,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:$,strokeWidth:R,opacity:N,effectiveSelectionHook:Q.effectiveSelectionHook,resolvedSelection:Q.resolvedSelection}),te=t.useMemo(()=>t=>{var o,n,i,r,s,a;const l=(null==t?void 0:t.data)||t,c=(null==l?void 0:l.__funnelStep)||(null==l?void 0:l.__barFunnelStep)||(null==l?void 0:l.step)||"",u=null!==(i=null!==(n=null!==(o=null==l?void 0:l.__funnelValue)&&void 0!==o?o:null==l?void 0:l.__barFunnelValue)&&void 0!==n?n:null==l?void 0:l.value)&&void 0!==i?i:"",d=null!==(r=null==l?void 0:l.__funnelPercent)&&void 0!==r?r:null==l?void 0:l.__barFunnelPercent,h=null!==(s=null==l?void 0:l.__funnelIsFirstStep)&&void 0!==s?s:null==l?void 0:l.__barFunnelIsFirstStep,g=null==l?void 0:l.__barFunnelIsDropoff,f=null!==(a=null==l?void 0:l.__barFunnelCategory)&&void 0!==a?a:null==l?void 0:l.category,p=null==d||h?"":` (${.05>Math.abs(d-Math.round(d))?Math.round(d)+"%":d.toFixed(1)+"%"})`;return e.jsxs("div",{className:"semiotic-tooltip",style:Xn,children:[c&&e.jsx("div",{style:{fontWeight:"bold"},children:c+""}),f&&f!==c&&e.jsx("div",{style:{marginTop:2,opacity:.8},children:f+""}),g&&e.jsx("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),e.jsxs("div",{style:{marginTop:4},children:[u+"",p]})]})},[]);if(Q.earlyReturn)return Q.earlyReturn;const oe=Ll({componentName:"FunnelChart",data:s,accessors:{stepAccessor:c,valueAccessor:u}});if(oe)return e.jsx(vl,{componentName:"FunnelChart",message:oe,width:D,height:I});const ne=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:E?"bar-funnel":"funnel"},null!=s&&{data:X}),{oAccessor:c,rAccessor:u}),d&&{stackBy:d}),{projection:E?"vertical":"horizontal",barPadding:E?40:0,pieceStyle:ee,size:[D,I],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,enableHover:H}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:E,showCategoryTicks:E}),B&&{oFormat:B}),{showGrid:E}),!E&&{connectorOpacity:p}),{showLabels:y}),Q.legendBehaviorProps),W&&{title:W}),z&&{description:z}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),l&&{className:l}),null!=o.animate&&{animate:o.animate}),{tooltipContent:!1===m?()=>null:!0===m||null==m?te:Zn(m)||te}),(w||A||j||S)&&{customHoverBehavior:Q.customHoverBehavior}),(A||j||w)&&{customClickBehavior:Q.customClickBehavior}),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"FunnelChart",width:D,height:I,children:e.jsx(kr,Object.assign({ref:r},ne))})});iu.displayName="FunnelChart";const ru=t.forwardRef(function(o,n){var i;const r=yl(o.mode,{width:o.width,height:o.height,showGrid:null===(i=o.showGrid)||void 0===i||i,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),s=t.useRef(null);Bl(n,{variant:"xy",frameRef:s});const{data:a,margin:l,className:c,categoryAccessor:u="category",valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,sort:y="auto",dotRadius:m=5,categoryPadding:v=10,tooltip:b,annotations:x,regression:w,valueExtent:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:R,legendPosition:N,color:B,stroke:E,strokeWidth:D,opacity:I,categoryFormat:H}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=r,Z=t.useMemo(()=>k(a),[a]),J=Nl({data:Z,rawData:a,colorBy:f,colorScheme:p,legendInteraction:R,legendPosition:N,selection:S,linkedHover:O,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof u?u:""],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"DotPlot",chartId:P,showLegend:G,userMargin:l,marginDefaults:r.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),ee=ul(Z,y,d),te=al(),oe=t.useMemo(()=>new Map,[Z]),ne=Ec({colorBy:f,colorScale:J.colorScale,color:B,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:null==j?void 0:j.pieceStyle,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection,baseStyleExtras:{r:m,fillOpacity:.8}}),ie=t.useMemo(()=>wa({categoryAccessor:u,valueAccessor:d,valueFormat:g}),[u,d,g]);if(J.earlyReturn)return J.earlyReturn;const re=Ll({componentName:"DotPlot",data:a,accessors:{categoryAccessor:u,valueAccessor:d}});if(re)return e.jsx(vl,{componentName:"DotPlot",message:re,width:F,height:W});const se=Hl(w),ae=se?[se,...x||[]]:x,le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"point"},null!=a&&{data:ee}),{oAccessor:u,rAccessor:d,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J.margin,barPadding:v,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:r.showAxes,oLabel:Q,rLabel:K,rFormat:g}),H&&{oFormat:H}),{showGrid:Y,oSort:y}),J.legendBehaviorProps),ga({title:q,description:X,summary:V,accessibleTable:U,className:c,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:b,defaultTooltipContent:ie})),fa({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),ae&&ae.length>0&&{annotations:ae}),A&&{rExtent:A}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return e.jsx(wl,{componentName:"DotPlot",width:F,height:W,children:e.jsx(kr,Object.assign({ref:s},le))})});ru.displayName="DotPlot";const su=t.forwardRef(function(o,n){var i,r;const s=yl(o.mode,{width:null!==(i=o.width)&&void 0!==i?i:400,height:null!==(r=o.height)&&void 0!==r?r:400,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,showCategoryTicks:o.showCategoryTicks}),a=t.useRef(null),{data:l,margin:c,className:u,categoryAccessor:d="category",valueAccessor:h="value",colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:R,opacity:N}=o,{width:B,height:E,enableHover:D,showLegend:I,title:H,description:F,summary:W,accessibleTable:z}=s,Y=t.useMemo(()=>k(l),[l]),G=g||d,q=Nl({data:Y,rawData:l,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"PieChart",chartId:O,showLegend:I,userMargin:c,marginDefaults:s.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:E}),X=al(),V=t.useMemo(()=>new Map,[Y]),U=Ec({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:X,colorScheme:f,categoryIndexMap:V,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:$,strokeWidth:R,opacity:N,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),Q=t.useMemo(()=>wa({categoryAccessor:d,valueAccessor:h,groupAccessor:g&&g!==d?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[d,h,g]),K=Ll({componentName:"PieChart",data:l,accessors:{categoryAccessor:d,valueAccessor:h}}),{effectiveLegendProps:Z,effectiveMargin:J}=Bc({ref:n,frameRef:a,setup:q});if(q.earlyReturn)return q.earlyReturn;const ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"pie"},null!=l&&{data:Y}),{oAccessor:d,rAccessor:h,projection:"radial",pieceStyle:U,startAngle:p}),null!=y&&{cornerRadius:y}),{size:[B,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:J,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),Z),ga({title:H,description:F,summary:W,accessibleTable:z,className:u,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:Q})),fa({linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return K?e.jsx(vl,{componentName:"PieChart",message:K,width:B,height:E}):e.jsx(wl,{componentName:"PieChart",width:B,height:E,children:e.jsx(kr,Object.assign({ref:a},ee))})});su.displayName="PieChart";const au=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover,showCategoryTicks:o.showCategoryTicks},{width:400,height:400}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",valueAccessor:u="value",innerRadius:d,centerContent:h,colorBy:g,colorScheme:f,startAngle:p=0,cornerRadius:y,tooltip:m,annotations:v,frameProps:b={},selection:x,linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,chartId:O,loading:M,loadingContent:C,emptyContent:_,legendInteraction:P,legendPosition:L,color:T,stroke:$,strokeWidth:R,opacity:N}=o,{width:B,height:E,enableHover:D,showLegend:I,title:H,description:F,summary:W,accessibleTable:z}=i,Y=t.useMemo(()=>k(s),[s]),G=g||c,q=Nl({data:Y,rawData:s,colorBy:G,colorScheme:f,legendInteraction:P,legendPosition:L,selection:x,linkedHover:w,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:A,onClick:j,hoverHighlight:S,chartType:"DonutChart",chartId:O,showLegend:I,userMargin:a,marginDefaults:i.marginDefaults,loading:M,loadingContent:C,emptyContent:_,width:B,height:E}),X=null!=d?d:Math.max(2,.15*Math.min(B,E)),V=al(),U=t.useMemo(()=>new Map,[Y]),Q=Ec({colorBy:G,colorScale:q.colorScale,color:T,themeCategorical:V,colorScheme:f,categoryIndexMap:U,userPieceStyle:null==b?void 0:b.pieceStyle,stroke:$,strokeWidth:R,opacity:N,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),K=t.useMemo(()=>wa({categoryAccessor:c,valueAccessor:u,groupAccessor:g&&g!==c?g:void 0,groupLabel:"string"==typeof g?g:"group",pieData:!0}),[c,u,g]),Z=Ll({componentName:"DonutChart",data:s,accessors:{categoryAccessor:c,valueAccessor:u}}),{effectiveLegendProps:J,effectiveMargin:ee}=Bc({ref:n,frameRef:r,setup:q});if(q.earlyReturn)return q.earlyReturn;const te=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut"},null!=s&&{data:Y}),{oAccessor:c,rAccessor:u,projection:"radial",pieceStyle:Q,innerRadius:X,startAngle:p}),null!=y&&{cornerRadius:y}),{centerContent:h,size:[B,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ee,enableHover:D}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:!1}),J),ga({title:H,description:F,summary:W,accessibleTable:z,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:K})),fa({linkedHover:w,onObservation:A,onClick:j,hoverHighlight:S,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior})),v&&v.length>0&&{annotations:v}),Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e)));return Z?e.jsx(vl,{componentName:"DonutChart",message:Z,width:B,height:E}):e.jsx(wl,{componentName:"DonutChart",width:B,height:E,children:e.jsx(kr,Object.assign({ref:r},te))})});function lu(e=240){const t=360-e,o=180+t/2,n=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:n,offsetRad:-Math.PI/2+n}}function cu(e){return Math.max(0,Math.min(1,e))}function uu(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function du(e,t,o){const n=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${n(e)}${n(t)}${n(o)}`}function hu(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:cu(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const n=cu(t);if(o[0].offset>=n)return o[0].color;if(n>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],i=o[e+1];if(t.offset>n||n>i.offset)continue;const r=i.offset-t.offset,s=r>0?(n-t.offset)/r:0,a=uu(t.color),l=uu(i.color);if(!a||!l)return.5>s?t.color:i.color;const[c,u,d]=a,[h,g,f]=l;return du(c+(h-c)*s,u+(g-u)*s,d+(f-d)*s)}return o[o.length-1].color}function gu(e,t,o){return`${e}-${t}`}au.displayName="DonutChart";const fu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:!1,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:300,height:250}),r=t.useRef(null),s="context"===o.mode,{compactMode:a}=i,{value:l,min:c=0,max:u=100,thresholds:d,gradientFill:h,color:g,backgroundColor:f="var(--semiotic-grid, #e0e0e0)",arcWidth:p=.3,cornerRadius:y,showNeedle:m=!0,needleColor:v="var(--semiotic-text, #333)",centerContent:b,valueFormat:x,showScaleLabels:k=!a,sweep:w=240,fillZones:A=!0,tooltip:j,annotations:S,frameProps:O={},className:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,title:$,description:R,summary:N,accessibleTable:B}=i,E=h&&"object"==typeof h?h:void 0,D=Math.max(c,Math.min(u,l)),I=u-c||1,H=(D-c)/I,{gaugeData:F,pieceStyle:W,gaugeAnnotations:z}=t.useMemo(()=>function(e){const{min:t,max:o,value:n,thresholds:i,fillColor:r,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,n))-t)/d;let g=i&&i.length>0?[...i].sort((e,t)=>e.value-t.value):[{value:o,color:r||"#007bff"}];g=g.map(e=>Object.assign(Object.assign({},e),{value:Math.max(t,Math.min(o,e.value))})),o>g[g.length-1].value&&g.push({value:o,color:g[g.length-1].color});const f=!!c&&c.colorStops.length>=2,p=[],y=new Map,m=[];if(f){const e=a?h:1,t=gu("bg",0);if(p.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),y.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),n=[];for(let t=0;o>t;t++)n.push(hu(c.colorStops,e*(t+.5)/o));const i=gu("fill",0);p.push({category:i,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:n}}),y.set(i,{fill:n[0]||s})}}else{let e=t;for(let o=0;g.length>o;o++){const n=g[o],i=(n.value-e)/d,r=(e-t)/d,l=(n.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-r),u=a?Math.max(0,i-c):0;if(c>0){const e=gu("fill",o);p.push({category:e,value:c,_zone:n.label||"Zone "+(o+1),_isFill:!0}),y.set(e,{fill:n.color})}if(u>0){const e=gu("bg",o);p.push({category:e,value:u,_zone:n.label||"Zone "+(o+1),_isFill:!1}),y.set(e,{fill:s,opacity:.4})}e=n.value}}if(l&&i&&i.length>0)for(const e of i)e.value>t&&o>e.value&&m.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:p,pieceStyle:(e,t)=>y.get(t||e.category)||{fill:s},gaugeAnnotations:m}}({min:c,max:u,value:l,thresholds:d,fillColor:g,backgroundColor:f,fillZones:A,showScaleLabels:k,gradientFill:E}),[l,c,u,d,g,f,k,A,E]),Y=t.useMemo(()=>El(W,{stroke:C,strokeWidth:_,opacity:P}),[W,C,_,P]),{sweepRad:G,startAngleDeg:q}=lu(w),X=function(e=240){const{sweepRad:t,offsetRad:o}=lu(e),n=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||n.push([Math.cos(e),Math.sin(e)]);const i=n.map(e=>e[0]),r=n.map(e=>e[1]),s=Math.min(...i),a=Math.max(...i),l=Math.min(...r),c=Math.max(...r);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(w),V=Math.min(10,Math.max(1,Math.min(L,T)/12)),U=X.cx,Q=X.cy,K=Math.max(4,Math.min((L-2*V)/X.width,(T-2*V)/X.height)-2),Z=Math.max(0,Math.min(K-1.5,K*(1-p))),J=L/2-U*K,ee=T/2-Q*K,te=2*(K+4),oe=t.useMemo(()=>{if(a&&null==b)return null;if(null!=b)return"function"==typeof b?b(D,c,u):b;const t=x?x(D):Math.round(D)+"";return e.jsxs("div",{style:{textAlign:"center",lineHeight:1.2},children:[e.jsx("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:t}),k&&e.jsxs("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[c," – ",u]})]})},[b,D,c,u,x,k,K,a]),ne=t.useMemo(()=>s&&null==b?{type:"gauge-value",text:x?x(D):Math.round(D)+""}:null,[s,b,D,x]),ie=t.useMemo(()=>{if(!m)return null;const e=-Math.PI/2+q*Math.PI/180+H*G,t=Z>20?Z-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:v}},[m,H,q,G,Z,v]),re=t.useMemo(()=>(t,o,n)=>{if("gauge-needle"===t.type){const i=(n.width||L)/2,r=(n.height||T)/2,s=Math.max(1,K-Z),a=Math.max(1,Math.min(2.5,.4*s)),l=Math.max(1,Math.min(5,.6*s));return e.jsxs("g",{transform:`translate(${i},${r})`,children:[e.jsx("line",{x1:0,y1:0,x2:t.tipX,y2:t.tipY,stroke:t.color,strokeWidth:a,strokeLinecap:"round"}),e.jsx("circle",{cx:0,cy:0,r:l,fill:t.color})]},"gauge-needle-"+o)}if("gauge-label"===t.type){const i=-Math.PI/2+q*Math.PI/180+(t.value-c)/I*G,r=(n.width||L)/2,s=(n.height||T)/2,a=Z-1,l=K+1,u=Math.cos(i)*a,d=Math.sin(i)*a,h=Math.cos(i)*l,g=Math.sin(i)*l,f=K+10,p=Math.cos(i)*f,y=Math.sin(i)*f,m=((i+Math.PI/2)/(2*Math.PI)*12+12)%12;let v="middle",b="middle";return m>=11||1>m?(v="middle",b="auto"):m>=1&&5>m?(v="start",b="middle"):m>=5&&7>m?(v="middle",b="hanging"):(v="end",b="middle"),e.jsxs("g",{transform:`translate(${r},${s})`,children:[e.jsx("line",{x1:u,y1:d,x2:h,y2:g,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),e.jsx("text",{x:p,y:y,textAnchor:v,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:t.label})]},"gauge-label-"+o)}return"gauge-value"===t.type?e.jsx("text",{x:(n.width||L)/2,y:(n.height||T)/2-.2*Z,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:t.text},"gauge-value-"+o):null},[L,T,c,I,q,G,Z,K]),se=t.useMemo(()=>{const e=[...z,...S||[]];return ie&&e.push(ie),ne&&e.push(ne),e},[z,S,ie,ne]),ae=t.useMemo(()=>t=>{var o;const n=(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o[0])||(null==t?void 0:t.data)||t,i=null==n?void 0:n._isFill;return e.jsxs("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[e.jsx("div",{style:{fontWeight:600},children:(null==n?void 0:n._zone)||""}),e.jsx("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:i?"Current: "+Math.round(D):"Remaining"})]})},[D]);if(0===F.length)return e.jsx(vl,{componentName:"GaugeChart",message:"No data to display",width:L,height:T});const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"donut",data:F,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:Y,innerRadius:Z,startAngle:q,sweepAngle:w},null!=y&&{cornerRadius:y}),{centerContent:oe,size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:{top:ee-te/2,bottom:T-ee-te/2,left:J-te/2,right:L-J-te/2},enableHover:i.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===j?()=>null:Zn(j)||ae,svgAnnotationRules:re}),se.length>0&&{annotations:se}),$&&{title:$}),R&&{description:R}),N&&{summary:N}),void 0!==B&&{accessibleTable:B}),M&&{className:M}),null!=o.animate&&{animate:o.animate}),O);return e.jsx(wl,{componentName:"GaugeChart",width:L,height:T,children:e.jsx(kr,Object.assign({ref:r},le))})});fu.displayName="GaugeChart";const pu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",groupBy:u,valueAccessor:d="value",orientation:h="vertical",valueFormat:g,colorBy:f,colorScheme:p,sort:y=!1,barPadding:m=60,roundedTop:v,baselinePadding:b=!1,tooltip:x,annotations:w,valueExtent:A,frameProps:j={},selection:S,linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,chartId:P,loading:L,loadingContent:T,emptyContent:$,legendInteraction:R,legendPosition:N,color:B,stroke:E,strokeWidth:D,opacity:I,categoryFormat:H}=o,{width:F,height:W,enableHover:z,showGrid:Y,showLegend:G,title:q,description:X,summary:V,accessibleTable:U,categoryLabel:Q,valueLabel:K}=i,Z=t.useMemo(()=>k(s),[s]),J=f||u,ee=Nl({data:Z,rawData:s,colorBy:J,colorScheme:p,legendInteraction:R,legendPosition:N,selection:S,linkedHover:O,fallbackFields:J?["string"==typeof J?J:""]:[],unwrapData:!0,onObservation:M,onClick:C,hoverHighlight:_,chartType:"GroupedBarChart",chartId:P,showLegend:G,userMargin:a,marginDefaults:i.marginDefaults,loading:L,loadingContent:T,emptyContent:$,width:F,height:W}),te=al(),oe=t.useMemo(()=>new Map,[Z]),ne=Ec({colorBy:J,colorScale:ee.colorScale,color:B,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:j.pieceStyle,stroke:E,strokeWidth:D,opacity:I,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ie=t.useMemo(()=>wa({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),re=Ll({componentName:"GroupedBarChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d},requiredProps:{groupBy:u}}),{effectiveLegendProps:se,effectiveMargin:ae}=Bc({ref:n,frameRef:r,setup:ee});if(ee.earlyReturn)return ee.earlyReturn;const le=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"clusterbar"},null!=s&&{data:Z}),{oAccessor:c,rAccessor:d,groupBy:u,oSort:y,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:ne,size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ae,barPadding:m}),null!=v&&{roundedTop:v}),{baselinePadding:b,enableHover:z}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:Q,rLabel:K,rFormat:g}),H&&{oFormat:H}),{showGrid:Y}),se),ga({title:q,description:X,summary:V,accessibleTable:U,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:x,defaultTooltipContent:ie})),fa({linkedHover:O,onObservation:M,onClick:C,hoverHighlight:_,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior})),w&&w.length>0&&{annotations:w}),A&&{rExtent:A}),Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e)));return re?e.jsx(vl,{componentName:"GroupedBarChart",message:re,width:F,height:W}):e.jsx(wl,{componentName:"GroupedBarChart",width:F,height:W,children:e.jsx(kr,Object.assign({ref:r},le))})});pu.displayName="GroupedBarChart";const yu=t.forwardRef(function(o,n){const i=yl(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,categoryLabel:o.categoryLabel,valueLabel:o.valueLabel,showCategoryTicks:o.showCategoryTicks,orientation:o.orientation}),r=t.useRef(null),{data:s,margin:a,className:l,categoryAccessor:c="category",subcategoryAccessor:u,valueAccessor:d="value",orientation:h="horizontal",valueFormat:g,colorBy:f,colorScheme:p,barPadding:y,tooltip:m,annotations:v,brush:b,onBrush:x,linkedBrush:w,frameProps:A={},selection:j,linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,chartId:_,loading:P,loadingContent:L,emptyContent:T,legendInteraction:$,legendPosition:R,color:N,stroke:B,strokeWidth:E,opacity:D,categoryFormat:I,rTickValues:H,tickLabelEdgeAlign:F,showCategoryTicks:W,gradientFill:z,trackFill:Y,roundedTop:G,valueExtent:q}=o,{width:X,height:V,enableHover:U,showGrid:Q,showLegend:K,title:Z,description:J,summary:ee,accessibleTable:te,categoryLabel:oe,valueLabel:ne}=i,ie=t.useMemo(()=>k(s),[s]),re=f||u,se=t.useMemo(()=>{if(null!=y)return y;if("sparkline"!==o.mode)return 40;const e=new Set(ie.map(e=>"function"==typeof c?c(e):e[c])),t=Math.max(1,e.size);return t>1?Math.max(0,Math.min(1,(("horizontal"===h?V:X)-2*t)/(t-1))):1},[y,o.mode,ie,c,h,X,V]),ae=Nl({data:ie,rawData:s,colorBy:re,colorScheme:p,legendInteraction:$,legendPosition:R,selection:j,linkedHover:S,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:O,onClick:M,hoverHighlight:C,chartType:"SwimlaneChart",chartId:_,showLegend:K,userMargin:a,marginDefaults:i.marginDefaults,loading:P,loadingContent:L,emptyContent:T,width:X,height:V}),le=Qc({brushProp:b,onBrushProp:x,linkedBrush:w,valueAccessor:d}),ce=al(),ue=t.useMemo(()=>new Map,[ie]),de=Ec({colorBy:re,colorScale:ae.colorScale,color:N,themeCategorical:ce,colorScheme:p,categoryIndexMap:ue,userPieceStyle:null==A?void 0:A.pieceStyle,stroke:B,strokeWidth:E,opacity:D,effectiveSelectionHook:ae.effectiveSelectionHook,resolvedSelection:ae.resolvedSelection,cycleByCategory:!0}),he=t.useMemo(()=>wa({categoryAccessor:u,valueAccessor:d,groupAccessor:c,valueFormat:g}),[u,c,d,g]),ge=Ll({componentName:"SwimlaneChart",data:s,accessors:{categoryAccessor:c,valueAccessor:d,subcategoryAccessor:u},requiredProps:{subcategoryAccessor:u}}),{effectiveLegendProps:fe,effectiveMargin:pe}=Bc({ref:n,frameRef:r,setup:ae});if(ae.earlyReturn)return ae.earlyReturn;const ye=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"swimlane"},null!=s&&{data:ie}),{oAccessor:c,rAccessor:d,stackBy:u,projection:"horizontal"===h?"horizontal":"vertical",pieceStyle:de,size:[X,V],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:pe,barPadding:se,enableHover:U}),o.dataIdAccessor&&{dataIdAccessor:o.dataIdAccessor}),{showAxes:i.showAxes,oLabel:!1===W?void 0:oe,rLabel:ne,rFormat:g}),H&&{rTickValues:H}),null!=F&&{tickLabelEdgeAlign:F}),I&&{oFormat:I}),void 0!==W&&{showCategoryTicks:W}),{showGrid:Q}),fe),ga({title:Z,description:J,summary:ee,accessibleTable:te,className:l,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations})),pa({tooltip:m,defaultTooltipContent:he})),fa({linkedHover:S,onObservation:O,onClick:M,hoverHighlight:C,customHoverBehavior:ae.customHoverBehavior,customClickBehavior:ae.customClickBehavior})),v&&v.length>0&&{annotations:v}),z&&{gradientFill:!0===z?{topOpacity:.8,bottomOpacity:.05}:z}),null!=Y&&{trackFill:Y}),null!=G&&{roundedTop:G}),q&&{rExtent:q}),le.brushStreamProps),Object.fromEntries(Object.entries(A).filter(([e])=>"pieceStyle"!==e)));return ge?e.jsx(vl,{componentName:"SwimlaneChart",message:ge,width:X,height:V}):e.jsx(wl,{componentName:"SwimlaneChart",width:X,height:V,children:e.jsx(kr,Object.assign({ref:r},ye))})});function mu(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function vu(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function bu(e){return"function"==typeof e?e:t=>t[e]||1}function xu({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a=Object.assign({fillOpacity:i},r);if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=ke(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=ke(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function ku(e){const{nodes:o,edges:n,inferNodes:i=!0,sourceAccessor:r="source",targetAccessor:s="target",colorBy:a,colorScheme:l,showLegend:c,legendPosition:u,legendInteraction:d,selection:h,linkedHover:g,onObservation:f,onClick:p,chartType:y,chartId:m,marginDefaults:v,userMargin:b,width:x,height:w,loading:A,loadingContent:j,emptyContent:S,emptyDataKey:O="edges"}=e,M=t.useMemo(()=>k(n),[n]),C=t.useMemo(()=>k(o),[o]),_=Ol(A,x,w,j),P=_?null:Sl("nodes"===O?void 0===o?void 0:C:void 0===n?void 0:M,x,w,S),L=t.useMemo(()=>i?vu(C,M,r,s):C,[i,C,M,r,s]),T=cl(L,a,l),$=al(),R=t.useMemo(()=>{if(Array.isArray(l))return l;if($&&$.length>0)return $;if("string"==typeof l){const e=ye[l];if(Array.isArray(e)&&e.length>0)return e}return me},[l,$]),N=t.useMemo(()=>{if(!a)return[];const e=new Set;for(const t of L){const o="function"==typeof a?a(t):t[a];null!=o&&e.add(o+"")}return Array.from(e)},[L,a]),B=fl(d,a,N),{legend:E,margin:D,legendPosition:I}=gl({data:L,colorBy:a,colorScale:T,showLegend:c,legendPosition:u,userMargin:b,defaults:v,categories:N}),H=dl({selection:h,linkedHover:g,fallbackFields:a?["string"==typeof a?a:""]:[],unwrapData:!0,onObservation:f,onClick:p,chartType:y,chartId:m}),{customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G}=H;return{safeNodes:L,safeEdges:M,colorScale:T,effectivePalette:R,themeCategorical:$,allCategories:N,legendState:B,legend:E,margin:D,legendPosition:I,customHoverBehavior:F,customClickBehavior:W,activeSelectionHook:z,hoverSelectionHook:Y,crosshairSourceId:G,loadingEl:_,emptyEl:P}}yu.displayName="SwimlaneChart";const wu=t.forwardRef(function(o,n){var i;const r=t.useRef(null);Bl(n,{variant:"network",frameRef:r});const s=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLegend:o.showLegend,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:a,edges:l,margin:c,className:u,nodeIdAccessor:d,nodeIDAccessor:h,sourceAccessor:g="source",targetAccessor:f="target",nodeLabel:p,colorBy:y,colorScheme:m,nodeSize:v=8,nodeSizeRange:b=[5,20],edgeWidth:x=1,edgeColor:k="#999",edgeOpacity:w=.6,iterations:A=300,forceStrength:j=.1,tooltip:S,frameProps:O={},onObservation:M,onClick:C,chartId:_,selection:P,linkedHover:L,loading:T,loadingContent:$,emptyContent:R,legendInteraction:N,legendPosition:B,stroke:E,strokeWidth:D,opacity:I}=o,H=null!==(i=null!=d?d:h)&&void 0!==i?i:"id",{width:F,height:W,enableHover:z,showLegend:Y,showLabels:G=!1,title:q,description:X,summary:V,accessibleTable:U}=s,Q=ku({nodes:a,edges:l,inferNodes:!1,sourceAccessor:g,targetAccessor:f,colorBy:y,colorScheme:m,showLegend:Y,legendPosition:B,legendInteraction:N,selection:P,linkedHover:L,onObservation:M,onClick:C,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:s.marginDefaults,userMargin:c,width:F,height:W,loading:T,loadingContent:$,emptyContent:R,emptyDataKey:"nodes"}),K=t.useMemo(()=>new Map,[]),Z=t.useMemo(()=>e=>{const t={};return t.fill=y?ke(e.data||e,y,Q.colorScale):ll(void 0,Q.themeCategorical,m,void 0,K),"number"==typeof v&&(t.r=v),t},[y,Q.colorScale,v,Q.themeCategorical,m,K]),J=t.useMemo(()=>El(Z,{stroke:E,strokeWidth:D,opacity:I}),[Z,E,D,I]),ee=t.useMemo(()=>e=>({stroke:k,strokeWidth:"number"==typeof x?x:"function"==typeof x?x(e):e[x]||1,opacity:w}),[x,k,w]),te=t.useMemo(()=>El(ee,{stroke:E,strokeWidth:D,opacity:I}),[ee,E,D,I]),oe=t.useMemo(()=>{if(G&&p)return"function"==typeof p?p:e=>{var t,o,n;return null!==(n=null!==(o=null===(t=e.data)||void 0===t?void 0:t[p])&&void 0!==o?o:e[p])&&void 0!==n?n:e.id}},[G,p]),ne=$l({componentName:"ForceDirectedGraph",nodes:a,edges:l,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:H}});return ne?e.jsx(vl,{componentName:"ForceDirectedGraph",message:ne,width:F,height:W}):Q.loadingEl?Q.loadingEl:Q.emptyEl?Q.emptyEl:e.jsx(wl,{componentName:"ForceDirectedGraph",width:F,height:W,children:e.jsx(ha,Object.assign({ref:r,chartType:"force"},null!=a&&{nodes:Q.safeNodes},null!=l&&{edges:Q.safeEdges},{size:[F,W],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Q.margin,nodeIDAccessor:H,sourceAccessor:g,targetAccessor:f,iterations:A,forceStrength:j,nodeStyle:J,edgeStyle:te,colorBy:y,colorScheme:Q.effectivePalette,nodeSize:v,nodeSizeRange:b,nodeLabel:oe,showLabels:G,enableHover:z,tooltipContent:!1===S?()=>null:Zn(S)||void 0,customHoverBehavior:L||M||C?Q.customHoverBehavior:void 0,customClickBehavior:M||C?Q.customClickBehavior:void 0,legend:Q.legend,legendPosition:Q.legendPosition},N&&"none"!==N&&{legendHoverBehavior:Q.legendState.onLegendHover,legendClickBehavior:Q.legendState.onLegendClick,legendHighlightedCategory:Q.legendState.highlightedCategory,legendIsolatedCategories:Q.legendState.isolatedCategories},{className:u,title:q,description:X,summary:V,accessibleTable:U},null!=o.animate&&{animate:o.animate},O))})});wu.displayName="ForceDirectedGraph";const Au=t.forwardRef(function(o,n){const i=t.useRef(null);Bl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==n?n:[]}}});const r=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",padAngle:m=.01,groupWidth:v=20,sortGroups:b,nodeLabel:x,edgeOpacity:k=.5,tooltip:w,frameProps:A={},onObservation:j,onClick:S,chartId:O,selection:M,linkedHover:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:T,stroke:$,strokeWidth:R,opacity:N}=o,{width:B,height:E,enableHover:D,showLabels:I=!0,title:H,description:F,summary:W,accessibleTable:z}=r,Y=ku({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:!1,legendInteraction:T,selection:M,linkedHover:C,onObservation:j,onClick:S,chartType:"ChordDiagram",chartId:O,marginDefaults:r.marginDefaults,userMargin:l,width:B,height:E,loading:_,loadingContent:P,emptyContent:L}),G=t.useMemo(()=>new Map,[]),q=Y.safeNodes.length>0,X=t.useMemo(()=>{if(q)return(e,t)=>{var o,n;const i={stroke:"black",strokeWidth:1};if(f)i.fill=ke(e.data||e,f,Y.colorScale);else{const r=Array.isArray(p)?p:ye[p]||me,s=Array.isArray(r)?r:me,a=null!==(n=null!==(o=e.index)&&void 0!==o?o:t)&&void 0!==n?n:0;i.fill=s[a%s.length]}return i}},[q,f,Y.colorScale,p]),V=t.useMemo(()=>X?El(X,{stroke:$,strokeWidth:R,opacity:N}):void 0,[X,$,R,N]),U=t.useMemo(()=>{if(q)return xu({edgeColorBy:y,colorBy:f,colorScale:Y.colorScale,nodeStyleFn:V||(e=>({fill:ll(void 0,Y.themeCategorical,p,void 0,G)})),edgeOpacity:k,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:k}})},[q,y,f,Y.colorScale,V,k,Y.themeCategorical,p,G]),Q=t.useMemo(()=>U?El(U,{stroke:$,strokeWidth:R,opacity:N}):void 0,[U,$,R,N]),K=t.useMemo(()=>{if(!I)return;const e=x||g;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[I,x,g]),Z=$l({componentName:"ChordDiagram",edges:a,edgesRequired:!0});return Z?e.jsx(vl,{componentName:"ChordDiagram",message:Z,width:B,height:E}):Y.loadingEl?Y.loadingEl:Y.emptyEl?Y.emptyEl:e.jsx(wl,{componentName:"ChordDiagram",width:B,height:E,children:e.jsx(ha,Object.assign({ref:i,chartType:"chord"},Y.safeNodes.length>0&&{nodes:Y.safeNodes},null!=a&&{edges:Y.safeEdges},{size:[B,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Y.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,padAngle:m,groupWidth:v,sortGroups:b,nodeStyle:V,edgeStyle:Q,colorBy:f,colorScheme:Y.effectivePalette,edgeColorBy:y,edgeOpacity:k,nodeLabel:K,showLabels:I,enableHover:D,tooltipContent:!1===w?()=>null:Zn(w)||void 0,customHoverBehavior:C||j||S?Y.customHoverBehavior:void 0,customClickBehavior:j||S?Y.customClickBehavior:void 0},T&&"none"!==T&&{legendHoverBehavior:Y.legendState.onLegendHover,legendClickBehavior:Y.legendState.onLegendClick,legendHighlightedCategory:Y.legendState.highlightedCategory,legendIsolatedCategories:Y.legendState.isolatedCategories},{className:c,title:H,description:F,summary:W,accessibleTable:z},null!=o.animate&&{animate:o.animate},A))})});Au.displayName="ChordDiagram";const ju=t.forwardRef(function(o,n){const i=t.useRef(null);Bl(n,{variant:"network",frameRef:i,overrides:{getData:()=>{var e,t,o,n;return null!==(n=null===(o=null===(t=null===(e=i.current)||void 0===e?void 0:e.getTopology())||void 0===t?void 0:t.edges)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==n?n:[]}}});const r=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:800,height:600}),{nodes:s,edges:a,margin:l,className:c,sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",nodeIdAccessor:g="id",colorBy:f,colorScheme:p,edgeColorBy:y="source",orientation:m="horizontal",nodeAlign:v="justify",nodePaddingRatio:b=.05,nodeWidth:x=15,nodeLabel:k,edgeOpacity:w=.5,edgeSort:A,tooltip:j,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,emptyContent:$,showLegend:R,legendPosition:N,legendInteraction:B,stroke:E,strokeWidth:D,opacity:I}=o,{width:H,height:F,enableHover:W,showLabels:z=!0,title:Y,description:G,summary:q,accessibleTable:X}=r,V=ku({nodes:s,edges:a,inferNodes:!0,sourceAccessor:u,targetAccessor:d,colorBy:f,colorScheme:p,showLegend:R,legendPosition:N,legendInteraction:B,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"SankeyDiagram",chartId:C,marginDefaults:r.marginDefaults,userMargin:l,width:H,height:F,loading:L,loadingContent:T,emptyContent:$}),U=t.useMemo(()=>new Map,[]),Q=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?ke(e.data||e,f,V.colorScale):ll(void 0,V.themeCategorical,p,void 0,U),t},[f,V.colorScale,V.themeCategorical,p,U]),K=t.useMemo(()=>El(Q,{stroke:E,strokeWidth:D,opacity:I}),[Q,E,D,I]),Z=t.useMemo(()=>xu({edgeColorBy:y,colorBy:f,colorScale:V.colorScale,nodeStyleFn:K,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[y,f,V.colorScale,K,w]),J=t.useMemo(()=>El(Z,{stroke:E,strokeWidth:D,opacity:I}),[Z,E,D,I]),ee=t.useMemo(()=>{if(!z)return;const e=k||g;return"function"==typeof e?e:t=>{var o,n,i;return null!==(i=null!==(n=null===(o=t.data)||void 0===o?void 0:o[e])&&void 0!==n?n:t[e])&&void 0!==i?i:t.id}},[z,k,g]),te=$l({componentName:"SankeyDiagram",edges:a,edgesRequired:!0});return te?e.jsx(vl,{componentName:"SankeyDiagram",message:te,width:H,height:F}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:e.jsx(wl,{componentName:"SankeyDiagram",width:H,height:F,children:e.jsx(ha,Object.assign({ref:i,chartType:"sankey"},V.safeNodes.length>0&&{nodes:V.safeNodes},null!=a&&{edges:V.safeEdges},{size:[H,F],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:V.margin,nodeIDAccessor:g,sourceAccessor:u,targetAccessor:d,valueAccessor:h,orientation:m,nodeAlign:v,nodePaddingRatio:b,nodeWidth:x,nodeStyle:K,edgeStyle:J,colorBy:f,colorScheme:V.effectivePalette,edgeColorBy:y,edgeOpacity:w,edgeSort:A,nodeLabel:ee,showLabels:z,enableHover:W,tooltipContent:!1===j?()=>null:Zn(j)||void 0,customHoverBehavior:P||O||M?V.customHoverBehavior:void 0,customClickBehavior:O||M?V.customClickBehavior:void 0,legend:V.legend,legendPosition:V.legendPosition},B&&"none"!==B&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},{className:c,title:Y,description:G,summary:q,accessibleTable:X},null!=o.animate&&{animate:o.animate},S))})});function Su(e,t,o){const n=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of n)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>{var o,n;return e.time-t.time||(null!==(o=s[e.kind])&&void 0!==o?o:99)-(null!==(n=s[t.kind])&&void 0!==n?n:99)})},l=r.length?Math.min(...r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};a();const f=[];let p=0,y=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:y);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:y);if(n>0){const i=g(e.time);f.push({time:i,delta:-n,kind:"transfer-out",side:t}),f.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:y-=n,"top"===e.side?p+=n:y+=n,o-=n}o>0&&null!==u&&(f.push({time:u,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:y+=o)}"top"===e.side?p-=t:y-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:y+=t}r.push(...f),a();let m=0,v=0,b=0,x=0,k=0;const w=[],A=new Map;for(const e of r){if(w.push({t:e.time,topMass:m,botMass:v}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?m:v;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?m+=e.delta:v+=e.delta,m+v>b&&(b=m+v),m>x&&(x=m),v>k&&(k=v),w.push({t:e.time,topMass:m,botMass:v})}const j=[];let S=0;for(;w.length>S;){let e=S;for(;w.length>e+1&&w[e+1].t===w[S].t;)e++;j.push(w[S]);for(let t=S+1;e>=t;t++){const e=j[j.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||j.push(w[t])}S=e+1}const O=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let C=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===C||e.systemOutTime>C)&&(C=e.systemOutTime);if(j.length>0){const e=j[j.length-1],t=Math.max(null!=O?O:-1/0,null!=C?C:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&j.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=j[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&j.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:j,peak:b,topPeak:x,botPeak:k,localAttachments:A}}function Ou(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function Mu(e,t){return e.map(e=>({t:Ou(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function Cu(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function _u(e,t){let o=0;for(let n=0;t.length>n;n++)for(let i=n+1;t.length>i;i++){const r=t[n],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&o++)}return o}function Pu(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function Lu(e,t){return 1e3*_u(e,t)+Pu(e,t)}function Tu(e,t){return{slots:e.map(e=>({peak:Object.assign({},e.peak),occupants:e.occupants.slice()})),map:Object.assign({},t)}}function $u(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=Tu(e,t),s=Lu(t,o);for(let a=0;n>a;a++){const n=Array(i).fill(0),a=Array(i).fill(0);for(const e of o){const o=t[e.source],i=t[e.target];n[o]+=i*(e.value||1),a[o]+=e.value||1,n[i]+=o*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=Lu(t,o);if(s>d)s=d,r=Tu(e,t);else if(d===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,r)}(e,t,o,6),function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=Lu(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=Lu(t,o);if(r>a)r=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const i=Object.assign({},t),r=Object.keys(i),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l=Object.assign({},i);let c=s.slice(),u=1/0;const d=()=>{for(const e of r)l[e]=a[i[e]];const e=Lu(l,o);u>e&&(u=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};d();const g=Array(n).fill(0);let f=0;for(;n>f;)f>g[f]?(h(f%2==0?0:g[f],f),d(),g[f]++,f=0):(g[f]=0,f++);const p=c.map(t=>e[t]),y=new Map;c.forEach((e,t)=>y.set(e,t));for(const e of Object.keys(t))t[e]=y.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function Ru(e,t,o,n,i){var r,s,a,l,c,u,d,h;const{plotH:g,padding:f,valueScale:p,packing:y,laneOrder:m,lifetimeMode:v="full"}=i,b={},x={};for(const t of e)b[t.id]=o[t.id].topPeak||0,x[t.id]=o[t.id].botPeak||0;const k="half"===v,w={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=k?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=k?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}w[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const A={},j=[];if("reuse"===y){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(null!==(r=i.get(e.target))&&void 0!==r?r:0)+1);const d=[];for(const t of e)0===(null!==(s=i.get(t.id))&&void 0!==s?s:0)&&d.push(t.id);for(;d.length;){const e=d.shift();for(const t of null!==(a=n.outgoing[e])&&void 0!==a?a:[]){const n=(null!==(l=o.get(e))&&void 0!==l?l:0)+1;n>(null!==(c=o.get(t.target))&&void 0!==c?c:0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&d.push(t.target)}}const h=[...e].filter(e=>null!==w[e.id].start).sort((e,t)=>{var n,i;const r=null!==(n=o.get(e.id))&&void 0!==n?n:0,s=null!==(i=o.get(t.id))&&void 0!==i?i:0;return r!==s?r-s:w[e.id].start-w[t.id].start}),g=e.filter(e=>null===w[e.id].start);for(const e of[...h,...g]){const t=w[e.id];let o=-1;for(let e=0;j.length>e;e++){const n=j[e].occupants[j[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(j.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=j.length-1),j[o].occupants.push({id:e.id,end:null!==(u=null==t?void 0:t.end)&&void 0!==u?u:-1/0}),j[o].peak.topPeak=Math.max(j[o].peak.topPeak,b[e.id]),j[o].peak.botPeak=Math.max(j[o].peak.botPeak,x[e.id]),A[e.id]=o}}else e.forEach((e,t)=>{var o,n;j.push({occupants:[{id:e.id,end:null!==(n=null===(o=w[e.id])||void 0===o?void 0:o.end)&&void 0!==n?n:-1/0}],peak:{topPeak:b[e.id],botPeak:x[e.id]}}),A[e.id]=t});let S=null,O=null,M=null,C=null;const _=()=>{S=_u(A,t),M=Pu(A,t)},P=()=>{O=_u(A,t),C=Pu(A,t)};"crossing-min"===m?(_(),$u(j,A,t),P()):"inside-out"===m?(_(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),u=new Map;r.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(j,A),P()):"crossing-min+inside-out"===m&&(_(),$u(j,A,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=Lu(t,o);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const u=new Map;for(let e=0;n>e;e++)u.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)u.set(e,e-1);u.set(i,l)}else{for(let e=l;i>e;e++)u.set(e,e+1);u.set(i,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=Lu(t,o);if(d>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=d}}(j,A,t),P());const L=j.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},$=[];for(let e=0;j.length-1>e;e++){const t=L[e],o=L[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}$.push(i)}const R=[];let N=f+(null!==(h=null===(d=j[0])||void 0===d?void 0:d.peak.topPeak)&&void 0!==h?h:0)*p;j.length>0&&R.push(N);for(let e=1;j.length>e;e++)N+=$[e-1]*p+f,R.push(N);if(j.length>0&&(N+=j[j.length-1].peak.botPeak*p+f),N>g){const e=g/N;for(let t=0;R.length>t;t++)R[t]*=e}const B=0===j.length?0:j[0].peak.topPeak+$.reduce((e,t)=>e+t,0)+j[j.length-1].peak.botPeak,E={};for(const t of e)E[t.id]=R[A[t.id]];return{effectiveSlotsHeight:B,centerlines:E,laneLifetime:w,slots:j,slotByNode:A,slotCenter:R,crossingsBefore:S,crossingsAfter:O,lengthBefore:M,lengthAfter:C}}ju.displayName="SankeyDiagram";const Nu=e=>{var t,o;const{bands:n=[],ribbons:i=[],showLabels:r=!0}=e.config,s=[];for(const e of i)s.push(Object.assign(Object.assign({type:"bezier",pathD:e.pathD},e.bezier&&{bezierCache:e.bezier}),{style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}}));for(const e of n)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];s.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of n)s.push({type:"bezier",pathD:e.pathD,style:Object.assign(Object.assign({},e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86}),{stroke:null!==(t=e.stroke)&&void 0!==t?t:e.fill,strokeWidth:null!==(o=e.strokeWidth)&&void 0!==o?o:.5}),datum:{__kind:"band",data:e.rawDatum,id:e.id}});const a=r?n.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:n.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:s,labels:a}};function Bu(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function Eu(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Du(e,t){return"function"==typeof e?e(t):t[e]}const Iu=t.forwardRef(function(o,n){const{nodes:r,edges:s,domain:a,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:u="source",targetAccessor:d="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:f="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:y,xExtentAccessor:m="xExtent",edgeIdAccessor:v="id",colorBy:b,colorScheme:x,showLegend:w,legendPosition:A="right",pairing:j="temporal",packing:S="reuse",laneOrder:O="crossing-min",ribbonLane:M="both",lifetimeMode:C="half",showLaneRails:_=!1,showQualityReadout:P=!1,showLabels:L=!0,width:T=600,height:$=400,margin:R,title:N,description:B,summary:E,accessibleTable:D,responsiveWidth:I,responsiveHeight:H,loading:F,loadingContent:W,emptyContent:z,edgeOpacity:Y=.35,timeFormat:G,valueFormat:q,tooltip:X,enableHover:V=!0,onObservation:U,onClick:Q,showParticles:K=!1,particleStyle:Z,chartId:J,frameProps:ee={}}=o,[te,oe]=t.useState([]),[ne,ie]=t.useState([]),re=t.useRef(te),se=t.useRef(ne);re.current=te,se.current=ne;const ae=t.useCallback(e=>{re.current=e,oe(e)},[]),le=t.useCallback(e=>{se.current=e,ie(e)},[]),ce=void 0!==s,ue=k(ce?s:te),de=t.useMemo(()=>{const e=k(null!=r?r:[]),t=ne;if(0===e.length&&0===t.length)return vu([],ue,u,d);const o=new Set,n=[];for(const t of e){const e=Du(c,t)+"";o.has(e)||(o.add(e),n.push(t))}for(const e of t){const t=Du(c,e)+"";o.has(t)||(o.add(t),n.push(e))}const i=vu([],ue,u,d);for(const e of i)o.has(e.id)||(o.add(e.id),n.push(e));return n},[r,ne,ue,c,u,d]),he=t.useRef(null),ge=t.useCallback((e,t)=>{const o=Du(v,e);return null!=o?o+"":`${Du(u,e)}-${Du(d,e)}-${t}`},[v,u,d]),fe=t.useCallback(e=>{if(null==e)return!1;const t=e;return null!=Du(u,t)&&null!=Du(d,t)},[u,d]);Bl(n,{variant:"network",frameRef:he,overrides:{push(e){if(fe(e)){if(ce)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ae([...re.current,e])}else le([...se.current,e])},pushMany(e){const t=[],o=[];for(const n of e)fe(n)?t.push(n):o.push(n);t.length>0&&(ce?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ae([...re.current,...t])),o.length>0&&le([...se.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!ce){const e=re.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(ge(r,i))?o.push(r):n.push(r)}n.length!==e.length&&ae(n)}const n=se.current,i=[];for(const e of n){const n=Du(c,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&le(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!ce){let e=!1;const i=re.current.map((i,r)=>o.has(ge(i,r))?(n.push(i),e=!0,t(i)):i);e&&ae(i)}let i=!1;const r=se.current.map(e=>{const r=Du(c,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&le(r),n},clear(){var e;ce||ae([]),le([]),null===(e=he.current)||void 0===e||e.clear()},getData:()=>null!=ue?ue:[],getScales:()=>null},deps:[ce,fe,ge,c,ue,ae,le]});const pe=ge,ye=t.useCallback(e=>Du(c,e)+"",[c]),{nodes:me,edges:ve,domain:be,rawNodeById:xe,rawEdgeById:we}=t.useMemo(()=>{const e=(null!=de?de:[]).map(e=>{const t={id:ye(e),__raw:e},o=m?Du(m,e):null;if(Array.isArray(o)&&2===o.length){const e=Eu(o[0]),n=Eu(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(null!=ue?ue:[]).map((e,t)=>{const o={id:pe(e,t),source:Du(u,e)+"",target:Du(d,e)+"",value:Number(Du(h,e)),startTime:Eu(Du(g,e)),endTime:Eu(Du(f,e)),__raw:e};if(p){const t=Eu(Du(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(y){const t=Eu(Du(y,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[Eu(a[0]),Eu(a[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[de,ue,a,ye,pe,m,u,d,h,g,f,p,y]),Ae=ku({nodes:de,edges:ue,inferNodes:!1,sourceAccessor:u,targetAccessor:d,colorBy:b,colorScheme:x,showLegend:!1,legendPosition:A,selection:void 0,linkedHover:void 0,onObservation:U,onClick:Q,chartType:"ProcessSankey",chartId:J,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:R,width:T,height:$,loading:F,loadingContent:W,emptyContent:z}),je=(null!=w?w:!!b)&&!!b,Se=t.useCallback(e=>null!=R&&("number"==typeof R||null!=R[e]),[R]),Oe=t.useMemo(()=>{const e=Object.assign({},Ae.margin);return je&&("right"===A&&!Se("right")&&140>e.right?e.right=140:"bottom"===A&&!Se("bottom")&&80>e.bottom&&(e.bottom=80)),e},[Ae.margin,je,A,Se]),Me=T-Oe.left-Oe.right,Ce=$-Oe.top-Oe.bottom,_e=t.useMemo(()=>function(e,t,o){const n=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(o)&&2===o.length,s=r&&Number.isFinite(o[0])&&Number.isFinite(o[1]);r&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}(me,ve,be),[me,ve,be]),Pe=t.useMemo(()=>_e.length>0?null:function(e,t,o){var n;const{plotH:i,pairing:r="temporal",packing:s="reuse",laneOrder:a="crossing-min",lifetimeMode:l="half"}=o,c=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),u=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,c,r);let d={};for(const t of e)d[t.id]=Su(t,c,u);const h=Ru(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),g=new Set;for(const e of t){const t=h.slotByNode[e.source],o=h.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=u.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(g.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=c.outgoing[t.id],o=c.incoming[t.id],n=new Set(e.map(e=>u.get(e.id).sourceSide)),i=new Set(o.map(e=>u.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)h.slotByNode[t.source]===h.slotByNode[t.target]&&(u.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)h.slotByNode[o.source]===h.slotByNode[o.target]&&(u.get(o.id).sourceSide=t)}}for(const t of e){const e=c.incoming[t.id],o=c.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===u.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===u.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=n(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=o.filter(t=>!g.has(t.id)&&u.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(u.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=Su(t,c,u);const f=Ru(e,t,d,c,{plotH:i,padding:12,valueScale:1,packing:s,laneOrder:a,lifetimeMode:l}),p=null!==(n=f.effectiveSlotsHeight)&&void 0!==n?n:f.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),y=Math.min(12,.35*i/Math.max(f.slots.length+1,1)),m=p>0?Math.max(0,(i-y*(f.slots.length+1))/p):1,v=Ru(e,t,d,c,{plotH:i,padding:y,valueScale:m,packing:s,laneOrder:a,lifetimeMode:l});return{nodeData:d,sides:u,valueScale:m,padding:y,compressedPadding:12>y,centerlines:v.centerlines,laneLifetime:v.laneLifetime,slots:v.slots,slotByNode:v.slotByNode,crossingsBefore:v.crossingsBefore,crossingsAfter:v.crossingsAfter,lengthBefore:v.lengthBefore,lengthAfter:v.lengthAfter}}(me,ve,{plotH:Ce,pairing:j,packing:S,laneOrder:O,lifetimeMode:C}),[_e,me,ve,Ce,j,S,O,C]),Le=t.useMemo(()=>i.scaleTime().domain(be).range([0,Me]),[be,Me]),Te=t.useCallback((e,t)=>{if(b&&de){const t=xe.get(e);if(t)return ke(t,b,Ae.colorScale)}return Ae.effectivePalette[t%Ae.effectivePalette.length]||"#475569"},[b,de,xe,Ae.colorScale,Ae.effectivePalette]),$e=t.useMemo(()=>{const e=new Map;return me.forEach((t,o)=>e.set(t.id,o)),e},[me]),Re=t.useMemo(()=>{if(!Pe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Pe,n=[],i=[];return me.forEach((i,r)=>{var s;const a=t[i.id];if(!a||0===a.samples.length)return;const l=function(e,t,o,n,i){if(0===e.length)return null;const r=Mu(e,i),s=e=>t-r[e].topMass*o,a=e=>t+r[e].botMass*o;let l=`M${n(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${n(r[e].t)},${s(e)}`;l+=` L${n(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${n(r[e].t)},${a(e)}`;return l+" Z"}(a.samples,e[i.id],o,Le,be);if(!l)return;const c=Mu(a.samples,be),u=c.find(e=>e.topMass+e.botMass>0)||c[0],d=e[i.id]+(u.botMass-u.topMass)*o/2,h=Te(i.id,r),g=null!==(s=xe.get(i.id))&&void 0!==s?s:i,f=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=Mu(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=n(c.t),h=n(u.t),g=e=>n(Ou(e,i)),f=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(d,i);if(n>r){const[o,l]=Cu(e,a,s);f.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=Cu(e,a,s);f.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return f}(i.id,ve,Pe,Le,be);n.push(Object.assign(Object.assign({id:i.id,pathD:l,fill:h,stroke:h,strokeWidth:.5},f.length>0&&{gradientStubs:f}),{rawDatum:g,labelX:Le(u.t)-4,labelY:d,labelText:i.id}))}),ve.forEach(n=>{var r,s,a,l;const c=null===(r=t[n.source])||void 0===r?void 0:r.localAttachments.get(n.id),u=null===(s=t[n.target])||void 0===s?void 0:s.localAttachments.get(n.id);if(!c||!u)return;const d=null!==(a=$e.get(n.source))&&void 0!==a?a:0,h=Te(n.source,d),g=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,u=r(c(e.time)),d=r(c(o.time)),h=e.value*l,g=o.value*l,f=e.sideMassBefore*l,p=o.sideMassAfter*l;let y,m,v,b;"top"===e.side?(y=t-f,m=y+h):(m=t+f,y=m-h),"top"===o.side?(v=n-p,b=v+g):(b=n+p,v=b-g);const x="source"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:y,sBot:m,tx:d,tTop:v,tBot:b,cp1X:x,cp2X:x}}(c,e[n.source],u,e[n.target],o,Le,M,be),{pathD:f,bezier:p}=hs(g),y=null!==(l=we.get(n.id))&&void 0!==l?l:n;i.push({id:n.id,pathD:f,fill:h,opacity:Y,rawDatum:y,bezier:p})}),{bands:n,ribbons:i}},[Pe,me,ve,Le,be,Te,xe,we,M,Y,$e]),Ne=t.useMemo(()=>({bands:Re.bands,ribbons:Re.ribbons,showLabels:L}),[Re,L]),Be=t.useMemo(()=>{if(!je||!b)return;const e=new Map;(null!=de?de:[]).forEach((t,o)=>{const n=Du(b,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:Te(ye(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[je,b,de,Te,ye]),Ee=t.useMemo(()=>!1!==X&&V?void 0===X||!0===X?null:Zn(X)||null:null,[X,V]),De=t.useCallback(e=>G?G(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[G]),Ie=t.useCallback(e=>q?q(e):e+"",[q]),He=t.useCallback(t=>{if(!t||!t.data)return null;const o=t.data;if(!Bu(o))return null;const n=o.data;if(Ee)return Ee(n);if("band"===o.__kind){const t=o.id,n=Pe?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,i=`${n.t}:${e}`;t.has(i)||(t.add(i),o.push({t:n.t,total:e}))}return o}(Pe.nodeData[t]):[],i=5,r=n.length>i?n.length:null,s=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,i=[Object.assign(Object.assign({},o[0]),{mark:"min"}),Object.assign(Object.assign({},o[Math.floor(.25*n)]),{mark:"q25"}),Object.assign(Object.assign({},o[Math.floor(.5*n)]),{mark:"median"}),Object.assign(Object.assign({},o[Math.floor(.75*n)]),{mark:"q75"}),Object.assign(Object.assign({},o[n]),{mark:"max"})],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(n,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:t}),s.length>0&&e.jsxs("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{opacity:.6},children:[e.jsx("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),e.jsx("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=r&&e.jsx("th",{})]})}),e.jsx("tbody",{children:s.map((t,o)=>e.jsxs("tr",{children:[e.jsx("td",{style:{paddingRight:8},children:De(t.t)}),e.jsx("td",{style:{textAlign:"right"},children:Ie(t.total)}),null!=r&&e.jsx("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:t.mark})]},o))})]}),null!=r&&e.jsxs("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",s.length," of ",r," samples"]})]})}const i=n,r=Du(u,i),s=Du(d,i),a=Du(h,i),l=Du(g,i),c=Du(f,i);return e.jsxs("div",{style:{minWidth:160},children:[e.jsxs("div",{style:{fontWeight:600,marginBottom:4},children:[r+""," → ",s+""]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"value"}),e.jsx("span",{style:{textAlign:"right"},children:Ie(Number(a))})]}),null!=l&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"start"}),e.jsx("span",{style:{textAlign:"right"},children:De(Eu(l))})]}),null!=c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{opacity:.6},children:"end"}),e.jsx("span",{style:{textAlign:"right"},children:De(Eu(c))})]})]})]})},[Pe,Ee,De,Ie,u,d,h,g,f]),Fe=t.useMemo(()=>{if(!Pe)return null;const{centerlines:t,laneLifetime:o,nodeData:n,valueScale:i,compressedPadding:r,crossingsBefore:s,crossingsAfter:a,lengthBefore:c,lengthAfter:u}=Pe;let d=null,h=null;for(const e of me){const t=o[e.id];if(!t||null===t.start||null===t.end)continue;const n=Le(t.start),i=Le(t.end);(null===d||d>n)&&(d=n),(null===h||i>h)&&(h=i)}const g=e=>Math.max(0,Math.min(Me,e)),f=g(null!=d?d:0),p=Math.max(f,g(null!=h?h:Me));return e.jsxs("g",{children:[P&&null!==(null!=a?a:null)&&e.jsxs("text",{x:Me,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(c)," → ",Math.round(u)]}),r&&e.jsx("text",{x:Me,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((t,o)=>{const n=Le(Eu(t.date));return f-.5>n||n>p+.5?null:e.jsx("line",{x1:n,y1:0,x2:n,y2:Ce,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+o)}),_&&me.map((r,s)=>{const a=o[r.id];if(!a||null===a.start)return null;const l=n[r.id],c=l?{topPeak:l.topPeak,botPeak:l.botPeak}:{topPeak:0,botPeak:0},u=t[r.id]+(c.botPeak-c.topPeak)*i/2,d=Le(a.start),h=Le(a.end),g=Te(r.id,s);return e.jsxs("g",{children:[e.jsx("line",{x1:d,y1:u,x2:h,y2:u,stroke:g,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),e.jsx("line",{x1:d,y1:u-4,x2:d,y2:u+4,stroke:g,strokeOpacity:.5}),e.jsx("line",{x1:h,y1:u-4,x2:h,y2:u+4,stroke:g,strokeOpacity:.5})]},"lane-"+r.id)}),e.jsx("line",{x1:f,y1:Ce+4,x2:p,y2:Ce+4,stroke:"#94a3b8"}),l.map((t,o)=>{const n=Eu(t.date),i=Le(n);if(f-.5>i||i>p+.5)return null;const r=null!=t.label?t.label:G?G(new Date(n)):"";return e.jsxs("g",{transform:`translate(${i},${Ce+4})`,children:[e.jsx("line",{y2:6,stroke:"#94a3b8"}),e.jsx("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:r})]},o)})]})},[Pe,l,Le,Me,Ce,_,me,Te,P,G]),We=t.useMemo(()=>(null!=de?de:[]).map(e=>({id:ye(e),data:e})),[de,ye]),ze=t.useMemo(()=>{const e=new Map;for(const t of Re.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Re]),Ye=t.useMemo(()=>(null!=ue?ue:[]).map((e,t)=>{const o=pe(e,t),n=Number(Du(h,e));return{id:o,source:Du(u,e)+"",target:Du(d,e)+"",value:Number.isFinite(n)?n:0,bezier:ze.get(o),data:e}}),[ue,pe,u,d,h,ze]),Ge=Ae.loadingEl,qe=Ae.emptyEl;return _e.length>0?e.jsxs("svg",{width:T,height:$,role:"img","aria-label":null!=N?N:"Process Sankey validation failed",children:[e.jsx("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),_e.map((t,o)=>{return e.jsx("text",{x:20,y:56+18*o,fontSize:12,fill:"#64748b",children:"• "+(n=t,"invalid-node-time"===n.kind?`node ${n.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===n.kind?`edge ${n.id} has an invalid startTime or endTime`:"invalid-domain"===n.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===n.kind?`edge ${n.id} must have a positive finite value`:"missing-node"===n.kind?`edge ${n.id} references missing ${n.endpoint} node "${n.nodeId}"`:"backward-edge"===n.kind?`edge ${n.id} (${n.source}->${n.target}) ends before it starts`:n.kind)},o);var n})]}):Ge||qe||e.jsx(ha,Object.assign({ref:he,chartType:"force",nodes:We,edges:Ye,customNetworkLayout:Nu,layoutConfig:Ne,size:[T,$],responsiveWidth:I,responsiveHeight:H,margin:Oe,title:N,description:null!=B?B:"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:E,accessibleTable:D,enableHover:V,tooltipContent:!1===X?()=>null:He,backgroundGraphics:Fe,showParticles:K,particleStyle:Z,legend:Be,legendPosition:A,onObservation:U,customClickBehavior:Q?e=>{if(!e||!e.data)return;const t=e.data;Bu(t)&&Q(t.data,{x:e.x,y:e.y})}:void 0,chartId:J,colorScheme:Array.isArray(x)?x:void 0},ee))});function Hu(o){const n=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,layout:a="tree",orientation:l="vertical",childrenAccessor:c="children",valueAccessor:u="value",nodeIdAccessor:d="name",colorBy:h,colorScheme:g,colorByDepth:f=!1,edgeStyle:p="curve",nodeLabel:y,nodeSize:m=5,tooltip:v,frameProps:b={},onObservation:x,onClick:k,chartId:w,selection:A,linkedHover:j,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{width:L,height:T,enableHover:$,showLabels:R=!0,title:N,description:B,summary:E,accessibleTable:D}=n,I=ku({nodes:t.useMemo(()=>mu(null!=i?i:null,c),[i,c]),edges:void 0,inferNodes:!1,colorBy:f?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:M,selection:A,linkedHover:j,onObservation:x,onClick:k,chartType:"TreeDiagram",chartId:w,marginDefaults:n.marginDefaults,userMargin:r,width:L,height:T,loading:S,loadingContent:O}),H=t.useMemo(()=>new Map,[]),F=t.useMemo(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=f?be[(e.depth||0)%be.length]:h?ke(e.data||e,h,I.colorScale):ll(void 0,I.themeCategorical,g,void 0,H),t},[h,f,I.colorScale,I.themeCategorical,g,H]),W=t.useMemo(()=>El(F,{stroke:C,strokeWidth:_,opacity:P}),[F,C,_,P]),z=t.useMemo(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),Y=t.useMemo(()=>El(z,{stroke:C,strokeWidth:_,opacity:P}),[z,C,_,P]),G=t.useMemo(()=>{if("treemap"===a||"circlepack"===a||"partition"===a)return bu(u)},[a,u]),q=Tl({componentName:"TreeDiagram",data:i});return q?e.jsx(vl,{componentName:"TreeDiagram",message:q,width:L,height:T}):I.loadingEl?I.loadingEl:e.jsx(wl,{componentName:"TreeDiagram",width:L,height:T,children:e.jsx(ha,Object.assign({chartType:a},null!=i&&{data:i},{size:[L,T],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:I.margin,nodeIDAccessor:d,childrenAccessor:c,hierarchySum:G,treeOrientation:l,edgeType:p,nodeStyle:W,edgeStyle:Y,colorBy:h,colorScheme:I.effectivePalette,colorByDepth:f,nodeSize:m,nodeLabel:R?y||d:void 0,showLabels:R,enableHover:$,tooltipContent:!1===v?()=>null:Zn(v)||void 0,customHoverBehavior:j||x||k?I.customHoverBehavior:void 0,customClickBehavior:x||k?I.customClickBehavior:void 0},M&&"none"!==M&&{legendHoverBehavior:I.legendState.onLegendHover,legendClickBehavior:I.legendState.onLegendClick,legendHighlightedCategory:I.legendState.highlightedCategory,legendIsolatedCategories:I.legendState.isolatedCategories},{className:s,title:N,description:B,summary:E,accessibleTable:D},null!=o.animate&&{animate:o.animate},b))})}function Fu(o){const n=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary,linkedHover:o.linkedHover},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,labelMode:g="leaf",nodeLabel:f,padding:p=4,paddingTop:y,nodeStyle:m,tooltip:v,frameProps:b={},selection:x,linkedHover:k,onObservation:w,onClick:A,chartId:j,loading:S,loadingContent:O,legendInteraction:M,stroke:C,strokeWidth:_,opacity:P}=o,{nodeStyle:L}=b,T=Fl(b,["nodeStyle"]),{width:$,height:R,enableHover:N,showLabels:B=!0,title:E,description:D,summary:I,accessibleTable:H}=n,F=ku({nodes:t.useMemo(()=>mu(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:M,selection:x,linkedHover:k,onObservation:w,onClick:A,chartType:"Treemap",chartId:j,marginDefaults:n.marginDefaults,userMargin:r,width:$,height:R,loading:S,loadingContent:O}),W=Rl(x),z=F.customHoverBehavior,Y=t.useCallback(e=>{if(!e)return z(null);const t=e.data||e;z({data:(null==t?void 0:t.data)||t})},[z]),G=t.useMemo(()=>new Map,[]),q=t.useMemo(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,F.colorScale):ll(void 0,F.themeCategorical,d,void 0,G),t},[u,h,F.colorScale,F.themeCategorical,d,G]),X=t.useMemo(()=>m||L?e=>{var t,o;return Object.assign(Object.assign(Object.assign({},q(e)),L&&null!==(t=L(e))&&void 0!==t?t:{}),m&&null!==(o=m(e))&&void 0!==o?o:{})}:q,[q,m,L]),V=t.useMemo(()=>El(X,{stroke:C,strokeWidth:_,opacity:P}),[X,C,_,P]),U=t.useMemo(()=>F.activeSelectionHook?e=>{var t;const o=Object.assign({},V(e));if(F.activeSelectionHook.isActive)if(F.activeSelectionHook.predicate(e.data||e))(null==W?void 0:W.selectedStyle)&&Object.assign(o,W.selectedStyle);else{const e=null!==(t=null==W?void 0:W.unselectedOpacity)&&void 0!==t?t:.5;o.opacity=e,o.fillOpacity=e,o.strokeOpacity=e,(null==W?void 0:W.unselectedStyle)&&Object.assign(o,W.unselectedStyle)}return o}:V,[V,F.activeSelectionHook,W]),Q=t.useMemo(()=>bu(l),[l]),K=void 0!==y?y:!B||"parent"!==g&&"all"!==g?void 0:18,Z=Tl({componentName:"Treemap",data:i});return Z?e.jsx(vl,{componentName:"Treemap",message:Z,width:$,height:R}):F.loadingEl?F.loadingEl:e.jsx(wl,{componentName:"Treemap",width:$,height:R,children:e.jsx(ha,Object.assign({chartType:"treemap"},null!=i&&{data:i},{size:[$,R],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:F.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:Q,padding:p,paddingTop:K,nodeStyle:U,colorBy:u,colorScheme:F.effectivePalette,colorByDepth:h,nodeLabel:B?f||c:void 0,showLabels:B,labelMode:g,enableHover:N,tooltipContent:!1===v?()=>null:Zn(v)||void 0},(k||w||A)&&{customHoverBehavior:Y},(w||A)&&{customClickBehavior:F.customClickBehavior},M&&"none"!==M&&{legendHoverBehavior:F.legendState.onLegendHover,legendClickBehavior:F.legendState.onLegendClick,legendHighlightedCategory:F.legendState.highlightedCategory,legendIsolatedCategories:F.legendState.isolatedCategories},{className:s,title:E,description:D,summary:I,accessibleTable:H},null!=o.animate&&{animate:o.animate},T))})}function Wu(o){const n=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,nodeLabel:g,circleOpacity:f=.7,padding:p=4,tooltip:y,frameProps:m={},onObservation:v,onClick:b,chartId:x,selection:k,linkedHover:w,loading:A,loadingContent:j,legendInteraction:S,stroke:O,strokeWidth:M,opacity:C}=o,{width:_,height:P,enableHover:L,showLabels:T=!0,title:$,description:R,summary:N,accessibleTable:B}=n,E=ku({nodes:t.useMemo(()=>mu(null!=i?i:null,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:S,selection:k,linkedHover:w,onObservation:v,onClick:b,chartType:"CirclePack",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:_,height:P,loading:A,loadingContent:j}),D=t.useMemo(()=>new Map,[]),I=t.useMemo(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:f};return t.fill=h?be[(e.depth||0)%be.length]:u?ke(e.data||e,u,E.colorScale):ll(void 0,E.themeCategorical,d,void 0,D),t},[u,h,E.colorScale,f,E.themeCategorical,d,D]),H=t.useMemo(()=>El(I,{stroke:O,strokeWidth:M,opacity:C}),[I,O,M,C]),F=t.useMemo(()=>bu(l),[l]),W=Tl({componentName:"CirclePack",data:i});return W?e.jsx(vl,{componentName:"CirclePack",message:W,width:_,height:P}):E.loadingEl?E.loadingEl:e.jsx(wl,{componentName:"CirclePack",width:_,height:P,children:e.jsx(ha,Object.assign({chartType:"circlepack"},null!=i&&{data:i},{size:[_,P],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:E.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:F,padding:p,nodeStyle:H,colorBy:u,colorScheme:E.effectivePalette,colorByDepth:h,nodeLabel:T?g||c:void 0,showLabels:T,enableHover:L,tooltipContent:!1===y?()=>null:Zn(y)||void 0,customHoverBehavior:w||v||b?E.customHoverBehavior:void 0,customClickBehavior:v||b?E.customClickBehavior:void 0},S&&"none"!==S&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},{className:s,title:$,description:R,summary:N,accessibleTable:B},null!=o.animate&&{animate:o.animate},m))})}Iu.displayName="ProcessSankey",Hu.displayName="TreeDiagram",Fu.displayName="Treemap",Wu.displayName="CirclePack";const zu=be;function Yu(o){const n=yl(o.mode,{width:o.width,height:o.height,enableHover:o.enableHover,showLabels:o.showLabels,title:o.title,description:o.description,accessibleTable:o.accessibleTable,summary:o.summary},{width:600,height:600}),{data:i,margin:r,className:s,childrenAccessor:a="children",nodeIdAccessor:l="name",colorBy:c,colorScheme:u,colorByDepth:d=!1,orbitMode:h="flat",orbitSize:g=2.95,speed:f=.25,revolution:p,revolutionStyle:y,eccentricity:m=1,showRings:v=!0,nodeRadius:b=6,showLabels:x=!1,animated:k=!0,tooltip:w,foregroundGraphics:A,annotations:j,frameProps:S={},onObservation:O,onClick:M,chartId:C,selection:_,linkedHover:P,loading:L,loadingContent:T,stroke:$,strokeWidth:R,opacity:N}=o,{width:B,height:E,enableHover:D,title:I,description:H,summary:F,accessibleTable:W}=n,z=ku({nodes:t.useMemo(()=>mu(i,a),[i,a]),edges:void 0,inferNodes:!1,colorBy:d?void 0:c,colorScheme:u,showLegend:!1,legendInteraction:void 0,selection:_,linkedHover:P,onObservation:O,onClick:M,chartType:"OrbitDiagram",chartId:C,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:B,height:E,loading:L,loadingContent:T}),Y=t.useMemo(()=>new Map,[]),{colorScale:G,customClickBehavior:q,customHoverBehavior:X,themeCategorical:V}=z,U=t.useMemo(()=>{if(Array.isArray(u))return u;const e=ye[u];return Array.isArray(e)?e:me},[u]),Q=t.useMemo(()=>e=>{var t;const o={stroke:"#fff",strokeWidth:1},n=0===(null!==(t=e.depth)&&void 0!==t?t:0);return o.fill=d?n?U[0]:zu[(e.depth||0)%zu.length]:c?ke(e.data||e,c,G):ll(void 0,V,u,void 0,Y),o.opacity=n?1:.85,o},[c,d,G,U,V,u,Y]),K=t.useMemo(()=>El(Q,{stroke:$,strokeWidth:R,opacity:N}),[Q,$,R,N]),Z=t.useMemo(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),J=t.useMemo(()=>{if(X)return e=>{X(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[X]),ee=t.useMemo(()=>{if(q)return e=>{q(e&&e.data&&void 0!==e.data.data?Object.assign(Object.assign({},e),{data:e.data.data}):e)}},[q]),te=Tl({componentName:"OrbitDiagram",data:i});return te?e.jsx(vl,{componentName:"OrbitDiagram",message:te,width:B,height:E}):z.loadingEl?z.loadingEl:e.jsx(wl,{componentName:"OrbitDiagram",width:B,height:E,children:e.jsx(ha,Object.assign({chartType:"orbit"},null!=i&&{data:i},{size:[B,E],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:z.margin,nodeIDAccessor:l,childrenAccessor:a,nodeStyle:K,edgeStyle:Z,colorBy:c,colorScheme:z.effectivePalette,colorByDepth:d,nodeSize:b,nodeLabel:x?l:void 0,showLabels:x,enableHover:!k&&D,tooltipContent:k?void 0:!1===w?()=>null:Zn(w)||void 0,customHoverBehavior:P||O||M?J:void 0,customClickBehavior:O||M?ee:void 0,foregroundGraphics:A,annotations:j,className:s,title:I,description:H,summary:F,orbitMode:h,orbitSize:g,orbitSpeed:f,orbitRevolution:p,orbitRevolutionStyle:y,orbitEccentricity:m,orbitShowRings:v,orbitAnimated:k,accessibleTable:W},null!=o.animate&&{animate:o.animate},S))})}Yu.displayName="OrbitDiagram";const Gu={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},qu={opacity:.7,marginRight:4};function Xu(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Vu(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Uu(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s;const a=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,l=Xu(a,o,"time"),c=Xu(a,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:Gu,children:[e.jsxs("div",{children:[e.jsxs("span",{style:qu,children:[i,":"]}),Vu(l)]}),e.jsxs("div",{children:[e.jsxs("span",{style:qu,children:[r,":"]}),Vu(c)]})]})}}function Qu(e,t){var o;return null!=e?e:Math.max(null!==(o=null==t?void 0:t.length)&&void 0!==o?o:0,200)}const Ku=t.forwardRef(function(o,n){var i,r,s,a,l;const c=yl(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,stroke:w="#007bff",strokeWidth:A=2,strokeDasharray:j,opacity:S,background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:$,tickFormatValue:R,decay:N,pulse:B,staleness:E,transition:D,linkedHover:I,selection:H,onObservation:F,chartId:W,loading:z,loadingContent:Y,emptyContent:G,emphasis:q,legendPosition:X}=o,V=c.showAxes,U=c.enableHover,Q=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Z=null!==(l=null!=M?M:C)&&void 0!==l?l:Uu({timeAccessor:m,valueAccessor:v}),J=t.useRef(null),{customHoverBehavior:ee}=dl({selection:H,linkedHover:I,unwrapData:!0,onObservation:F,chartType:"RealtimeLineChart",chartId:W}),te=t.useCallback(e=>{_&&_(e),ee(e)},[_,ee]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Ol(z,K[0],K[1],Y),ne=oe?null:Sl(y,K[0],K[1],G),ie={stroke:w,strokeWidth:A,strokeDasharray:j};null!=S&&(ie.opacity=S);const re=Qu(p,y);return oe||ne||e.jsx(Ei,{ref:J,chartType:"line",runtimeMode:"streaming",size:K,margin:Q,className:q?`${h||""} semiotic-emphasis-${q}`.trim():h,arrowOfTime:g,windowMode:f,windowSize:re,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,lineStyle:ie,showAxes:V,background:O,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:$,tickFormatValue:R,decay:N,pulse:B,staleness:E,transition:D,pointIdAccessor:o.pointIdAccessor,legendPosition:X})});function Zu(e,t,o){const n="function"==typeof t?t(e):e[null!=t?t:o];if(null==n)return null;if(n instanceof Date)return n.getTime();if("string"==typeof n&&""===n.trim())return null;const i=Number(n);return Number.isFinite(i)?i:null}Ku.displayName="RealtimeLineChart";const Ju=t.forwardRef(function(o,n){var i,r,s,a,l;const c=yl(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,showAxes:o.showAxes,enableHover:null!=o.enableHover?!!o.enableHover:void 0,linkedHover:o.linkedHover}),{binSize:u,size:d,margin:h,className:g,arrowOfTime:f="right",windowMode:p="sliding",windowSize:y,data:m,timeAccessor:v,valueAccessor:b,direction:x="up",timeExtent:k,valueExtent:w,extentPadding:A,categoryAccessor:j,colors:S,fill:O,stroke:M,strokeWidth:C,opacity:_,gap:P,background:L,tooltipContent:T,tooltip:$,onHover:R,annotations:N,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:D,tickFormatValue:I,linkedHover:H,selection:F,decay:W,pulse:z,staleness:Y,transition:G,onObservation:q,chartId:X,loading:V,loadingContent:U,emptyContent:Q,emphasis:K,legendPosition:Z,brush:J,onBrush:ee,linkedBrush:te}=o,oe=c.showAxes,ne=c.enableHover,ie=null!=h?h:c.marginDefaults,re=null!=d?d:[c.width,c.height],se=null!==(l=null!=T?T:$)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i;const r=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null;if(null==(null==r?void 0:r.binStart)||null==(null==r?void 0:r.binEnd)){const t=Xu(r,o,"time"),i=Xu(r,n,"value");return e.jsxs("div",{className:"semiotic-tooltip",style:Gu,children:[e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"x:"}),Vu(t)]}),e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"y:"}),Vu(i)]})]})}return e.jsxs("div",{className:"semiotic-tooltip",style:Gu,children:[e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"range:"}),Vu(r.binStart),"–",Vu(r.binEnd)]}),null!=r.total&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"count:"}),Vu(r.total)]}),null!=r.category&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"category:"}),Vu(r.category)]})]})}}({timeAccessor:v,valueAccessor:b}),ae=t.useRef(null),{customHoverBehavior:le}=dl({selection:F,linkedHover:H,unwrapData:!0,onObservation:q,chartType:"RealtimeHistogram",chartId:X}),ce=t.useCallback(e=>{R&&R(e),le(e)},[R,le]),ue=!0===J?{dimension:"x",snap:"bin"}:"x"===J?{dimension:"x"}:"object"==typeof J?J:void 0,de=Va(te),he=Ba(Object.assign({name:(null==de?void 0:de.name)||"__unused_hist_brush__",xField:(null==de?void 0:de.xField)||("string"==typeof v?v:"time")},(null==de?void 0:de.yField)?{yField:de.yField}:{})),ge=t.useRef(he.brushInteraction);ge.current=he.brushInteraction;const fe=t.useCallback(e=>{if(ee&&ee(e),q&&q(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:X}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:X}),de){const t=ge.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ee,q,X,de]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=ae.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=ae.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=ae.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=ae.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=ae.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const pe=Ol(V,re[0],re[1],U),ye=pe?null:Sl(m,re[0],re[1],Q),me={};null!=O&&(me.fill=O),null!=M&&(me.stroke=M),null!=C&&(me.strokeWidth=C),null!=_&&(me.opacity=_),null!=P&&(me.gap=P);const ve=K?`${g||""} semiotic-emphasis-${K}`.trim():g,be=Qu(y,m),xe=t.useMemo(()=>"down"!==x?w:function({data:e,valueAccessor:t,timeAccessor:o,binSize:n,valueExtent:i,extentPadding:r}){var s;if(i)return[i[1],i[0]];if(!e||0===e.length)return;const a=new Map;for(const i of e){const e=Zu(i,o,"time"),r=Zu(i,t,"value");if(null==e||null==r)continue;const l=Math.floor(e/n)*n;a.set(l,(null!==(s=a.get(l))&&void 0!==s?s:0)+r)}let l=0;for(const e of a.values())e>l&&(l=e);return[l>0?l+l*(null!=r?r:.1):1,0]}({data:m,valueAccessor:b,timeAccessor:v,binSize:u,valueExtent:w,extentPadding:A}),[x,m,b,v,u,w,A]);return pe||ye||e.jsx(Ei,{ref:ae,chartType:"bar",runtimeMode:"streaming",size:re,margin:ie,className:ve,arrowOfTime:f,windowMode:p,windowSize:be,data:m,timeAccessor:v,valueAccessor:b,xExtent:k,yExtent:xe,extentPadding:A,binSize:u,categoryAccessor:j,barColors:S,barStyle:me,showAxes:oe,background:L,hoverAnnotation:ne,tooltipContent:se,customHoverBehavior:ce,annotations:N,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:D,tickFormatValue:I,decay:W,pulse:z,staleness:Y,transition:G,pointIdAccessor:o.pointIdAccessor,legendPosition:Z,brush:ue||(te?{dimension:"x"}:void 0),onBrush:ue||te?fe:void 0})});function ed(t){return e.jsx(Ju,Object.assign({},t,{windowMode:"growing"}))}Ju.displayName="RealtimeHistogram",ed.displayName="TemporalHistogram";const td=Ju,od=t.forwardRef(function(o,n){var i,r,s,a,l;const c=yl(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,categoryAccessor:w,colors:A,radius:j,fill:S,opacity:O,stroke:M,strokeWidth:C,background:_,tooltipContent:P,tooltip:L,onHover:T,annotations:$,autoPlaceAnnotations:R,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:E,linkedHover:D,selection:I,onObservation:H,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,Q=null!=u?u:[c.width,c.height],K=null!==(l=null!=P?P:L)&&void 0!==l?l:Uu({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=dl({selection:I,linkedHover:D,unwrapData:!0,onObservation:H,chartType:"RealtimeSwarmChart",chartId:F}),ee=t.useCallback(e=>{T&&T(e),J(e)},[T,J]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=Ol(W,Q[0],Q[1],z),oe=te?null:Sl(y,Q[0],Q[1],Y),ne={};null!=j&&(ne.radius=j),null!=S&&(ne.fill=S),null!=O&&(ne.opacity=O),null!=M&&(ne.stroke=M),null!=C&&(ne.strokeWidth=C);const ie=G?`${h||""} semiotic-emphasis-${G}`.trim():h,re=Qu(p,y);return te||oe||e.jsx(Ei,{ref:Z,chartType:"swarm",runtimeMode:"streaming",size:Q,margin:U,className:ie,arrowOfTime:g,windowMode:f,windowSize:re,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,categoryAccessor:w,barColors:A,swarmStyle:ne,showAxes:X,background:_,hoverAnnotation:V,tooltipContent:K,customHoverBehavior:ee,annotations:$,autoPlaceAnnotations:R,svgAnnotationRules:N,tickFormatTime:B,tickFormatValue:E,legendPosition:q,pointIdAccessor:o.pointIdAccessor})});od.displayName="RealtimeSwarmChart";const nd=t.forwardRef(function(o,n){var i,r,s,a,l;const c=yl(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,timeExtent:b,valueExtent:x,extentPadding:k,positiveColor:w,negativeColor:A,connectorStroke:j,connectorWidth:S,gap:O,stroke:M,strokeWidth:C,opacity:_,background:P,tooltipContent:L,tooltip:T,onHover:$,annotations:R,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:D,linkedHover:I,selection:H,onObservation:F,chartId:W,loading:z,loadingContent:Y,emptyContent:G,emphasis:q,legendPosition:X}=o,V=c.showAxes,U=c.enableHover,Q=null!=d?d:c.marginDefaults,K=null!=u?u:[c.width,c.height],Z=null!==(l=null!=L?L:T)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n}=t;return t=>{var i,r;const s=null!==(i=null==t?void 0:t.data)&&void 0!==i?i:null,a=Xu(s,o,"time"),l=null!==(r=null==s?void 0:s.delta)&&void 0!==r?r:Xu(s,n,"value"),c=null==s?void 0:s.cumEnd,u="number"==typeof l?0>l?Vu(l):"+"+Vu(l):Vu(l);return e.jsxs("div",{className:"semiotic-tooltip",style:Gu,children:[e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"x:"}),Vu(a)]}),e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"Δ:"}),u]}),null!=c&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"total:"}),Vu(c)]})]})}}({timeAccessor:m,valueAccessor:v}),J=t.useRef(null),{customHoverBehavior:ee}=dl({selection:H,linkedHover:I,unwrapData:!0,onObservation:F,chartType:"RealtimeWaterfallChart",chartId:W}),te=t.useCallback(e=>{$&&$(e),ee(e)},[$,ee]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=J.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=J.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=J.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=J.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const oe=Ol(z,K[0],K[1],Y),ne=oe?null:Sl(y,K[0],K[1],G),ie={};null!=w&&(ie.positiveColor=w),null!=A&&(ie.negativeColor=A),null!=j&&(ie.connectorStroke=j),null!=S&&(ie.connectorWidth=S),null!=O&&(ie.gap=O),null!=M&&(ie.stroke=M),null!=C&&(ie.strokeWidth=C),null!=_&&(ie.opacity=_);const re=q?`${h||""} semiotic-emphasis-${q}`.trim():h,se=Qu(p,y);return oe||ne||e.jsx(Ei,{ref:J,chartType:"waterfall",runtimeMode:"streaming",size:K,margin:Q,className:re,arrowOfTime:g,windowMode:f,windowSize:se,data:y,timeAccessor:m,valueAccessor:v,xExtent:b,yExtent:x,extentPadding:k,waterfallStyle:ie,showAxes:V,background:P,hoverAnnotation:U,tooltipContent:Z,customHoverBehavior:te,annotations:R,autoPlaceAnnotations:N,svgAnnotationRules:B,tickFormatTime:E,tickFormatValue:D,legendPosition:X,pointIdAccessor:o.pointIdAccessor})});nd.displayName="RealtimeWaterfallChart";const id=t.forwardRef(function(o,n){var i,r,s,a,l;const c=yl(o.mode,{width:null!==(r=null===(i=o.size)||void 0===i?void 0:i[0])&&void 0!==r?r:o.width,height:null!==(a=null===(s=o.size)||void 0===s?void 0:s[1])&&void 0!==a?a:o.height,enableHover:null!=o.enableHover?!!o.enableHover:void 0}),{size:u,margin:d,className:h,arrowOfTime:g="right",windowMode:f="sliding",windowSize:p,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,timeExtent:x,valueExtent:k,extentPadding:w,heatmapXBins:A=20,heatmapYBins:j=20,aggregation:S="count",background:O,tooltipContent:M,tooltip:C,onHover:_,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:$,tickFormatValue:R,decay:N,pulse:B,staleness:E,linkedHover:D,selection:I,onObservation:H,chartId:F,loading:W,loadingContent:z,emptyContent:Y,emphasis:G,legendPosition:q}=o,X=c.showAxes,V=c.enableHover,U=null!=d?d:c.marginDefaults,Q=null!=u?u:[c.width,c.height],K=null!==(l=null!=M?M:C)&&void 0!==l?l:function(t={}){const{timeAccessor:o,valueAccessor:n,xLabel:i="x",yLabel:r="y"}=t;return t=>{var s,a,l,c;const u=null!==(s=null==t?void 0:t.data)&&void 0!==s?s:null,d=null!==(a=null==u?void 0:u.xCenter)&&void 0!==a?a:Xu(u,o,"time"),h=null!==(l=null==u?void 0:u.yCenter)&&void 0!==l?l:Xu(u,n,"value"),g=null==u?void 0:u.count,f=null==u?void 0:u.sum,p=null==u?void 0:u.value,y=null!==(c=null==u?void 0:u.agg)&&void 0!==c?c:"count";return e.jsxs("div",{className:"semiotic-tooltip",style:Gu,children:[e.jsxs("div",{children:[e.jsxs("span",{style:qu,children:[i,":"]}),Vu(d)]}),e.jsxs("div",{children:[e.jsxs("span",{style:qu,children:[r,":"]}),Vu(h)]}),null!=g&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"count:"}),Vu(g)]}),"sum"===y&&null!=f&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"sum:"}),Vu(f)]}),"mean"===y&&null!=p&&e.jsxs("div",{children:[e.jsx("span",{style:qu,children:"mean:"}),Vu(p)]})]})}}({timeAccessor:m,valueAccessor:v}),Z=t.useRef(null),{customHoverBehavior:J}=dl({selection:I,linkedHover:D,unwrapData:!0,onObservation:H,chartType:"RealtimeHeatmap",chartId:F}),ee=t.useCallback(e=>{_&&_(e),J(e)},[_,J]);t.useImperativeHandle(n,()=>({push:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.push(e)},pushMany:e=>{var t;return null===(t=Z.current)||void 0===t?void 0:t.pushMany(e)},remove:e=>{var t,o;return null!==(o=null===(t=Z.current)||void 0===t?void 0:t.remove(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,n;return null!==(n=null===(o=Z.current)||void 0===o?void 0:o.update(e,t))&&void 0!==n?n:[]},clear:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Z.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}),[]);const te=Ol(W,Q[0],Q[1],z),oe=te?null:Sl(y,Q[0],Q[1],Y),ne=G?`${h||""} semiotic-emphasis-${G}`.trim():h,ie=Qu(p,y);return te||oe||e.jsx(Ei,{ref:Z,chartType:"heatmap",runtimeMode:"streaming",size:Q,margin:U,className:ne,arrowOfTime:g,windowMode:f,windowSize:ie,data:y,timeAccessor:m,valueAccessor:v,categoryAccessor:b,xExtent:x,yExtent:k,extentPadding:w,heatmapXBins:A,heatmapYBins:j,heatmapAggregation:S,showAxes:X,background:O,hoverAnnotation:V,tooltipContent:K,customHoverBehavior:ee,annotations:P,autoPlaceAnnotations:L,svgAnnotationRules:T,tickFormatTime:$,tickFormatValue:R,decay:N,pulse:B,staleness:E,legendPosition:q,pointIdAccessor:o.pointIdAccessor})});id.displayName="RealtimeHeatmap";const rd=864e5;function sd(e){return 10>e?"0"+e:e+""}const ad=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ld(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)*(1-t)),i=Math.round(parseInt(o[2],16)*(1-t)),r=Math.round(parseInt(o[3],16)*(1-t));return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function cd(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const n=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),i=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),r=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function ud(e,t){return Wl(this,void 0,void 0,function*(){const{format:o="png",filename:n="chart",scale:i=2,background:r="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"),dd(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);hd(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),n+".svg")}else{const t=l.width*i,o=l.height*i,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,o),c.scale(i,i);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),g=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,yield new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(hd(o,n+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(g)},f.onerror=()=>{URL.revokeObjectURL(g),t(Error("Failed to load SVG image"))},f.src=g})}})}function dd(e,t){var o;const n=e.children,i=t.children,r=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=r.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,i.length)>e;e++)dd(n[e],i[e])}function hd(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)}const gd={width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean"},showLegend:{type:"boolean"},showGrid:{type:"boolean"},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"]},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},axisExtent:{type:"string",enum:["nice","exact"]},frameProps:{type:"object"},onClick:{type:"function"}},fd={xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function"},yFormat:{type:"function"}},pd={categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function"}},yd=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"],md=["vertical","horizontal"],vd={LineChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},lineBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yd},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},fillArea:{type:"boolean"},areaOpacity:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},AreaChart:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yd},gradientFill:{type:["boolean","object"]},semanticGradient:{type:"array"},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},forecast:{type:"object"},anomaly:{type:"object"},band:{type:["object","array"]}})},DifferenceChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},seriesAAccessor:{type:["string","function"]},seriesBAccessor:{type:["string","function"]},seriesALabel:{type:"string"},seriesBLabel:{type:"string"},seriesAColor:{type:"string"},seriesBColor:{type:"string"},showLines:{type:"boolean"},lineWidth:{type:"number"},showPoints:{type:"boolean"},pointRadius:{type:"number"},curve:{type:"string",enum:yd},areaOpacity:{type:"number"},gradientFill:{type:["boolean","object"]},xExtent:{type:"array"},yExtent:{type:"array"},pointIdAccessor:{type:["string","function"]},windowSize:{type:"number"}})},StackedAreaChart:{required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},areaBy:{type:["string","function"]},lineDataAccessor:{type:"string"},curve:{type:"string",enum:yd},areaOpacity:{type:"number"},showLine:{type:"boolean"},lineWidth:{type:"number"},normalize:{type:"boolean"}})},Scatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BubbleChart:{required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},bubbleOpacity:{type:"number"},bubbleStrokeWidth:{type:"number"},bubbleStrokeColor:{type:"string"},regression:{type:["boolean","string","object"]}})},Heatmap:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"]},showValues:{type:"boolean"},valueFormat:{type:"function"},cellBorderColor:{type:"string"},cellBorderWidth:{type:"number"},showLegend:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},QuadrantChart:{required:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},quadrants:{type:"object"},xCenter:{type:"number"},yCenter:{type:"number"},centerlineStyle:{type:"object"},showQuadrantLabels:{type:"boolean"},quadrantLabelSize:{type:"number"},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"}})},MultiAxisLineChart:{required:["series"],dataShape:"array",dataAccessors:["xAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},series:{type:"array"},colorScheme:{type:["string","array"]},curve:{type:"string"},lineWidth:{type:"number"},annotations:{type:"array"}})},CandlestickChart:{required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},highAccessor:{type:["string","function"]},lowAccessor:{type:["string","function"]},openAccessor:{type:["string","function"]},closeAccessor:{type:["string","function"]},candlestickStyle:{type:"object"},mode:{type:"string",enum:["primary","context","sparkline"]},annotations:{type:"array"}})},ConnectedScatterplot:{required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),fd),{data:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},orderAccessor:{type:["string","function"]},orderLabel:{type:"string"},pointRadius:{type:"number"},pointIdAccessor:{type:["string","function"]},annotations:{type:"array"},regression:{type:["boolean","string","object"]},forecast:{type:"object"},anomaly:{type:"object"}})},BarChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"},regression:{type:["boolean","string","object"]}})},StackedBarChart:{required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},stackBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},normalize:{type:"boolean"},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},LikertChart:{required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},levelAccessor:{type:["string","function"]},countAccessor:{type:["string","function"]},levels:{type:"array"},orientation:{type:"string",enum:md},barPadding:{type:"number"}})},GroupedBarChart:{required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},groupBy:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},sort:{type:["boolean","string","function"]},barPadding:{type:"number"},roundedTop:{type:"number"}})},SwarmPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},sizeBy:{type:["string","function"]},sizeRange:{type:"array"},pointRadius:{type:"number"},pointOpacity:{type:"number"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},BoxPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},showOutliers:{type:"boolean"},outlierRadius:{type:"number"},categoryPadding:{type:"number"}})},Histogram:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},relative:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},ViolinPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},bins:{type:"number"},curve:{type:"string"},showIQR:{type:"boolean"},categoryPadding:{type:"number"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}})},RidgelinePlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},bins:{type:"number"},amplitude:{type:"number"},categoryPadding:{type:"number"}})},DotPlot:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:md},sort:{type:["boolean","string","function"]},dotRadius:{type:"number"},categoryPadding:{type:"number"},regression:{type:["boolean","string","object"]}})},PieChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},gd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},DonutChart:{required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],props:Object.assign(Object.assign({},gd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},innerRadius:{type:"number"},centerContent:{type:["object","string","number"]},startAngle:{type:"number"},cornerRadius:{type:"number"}})},GaugeChart:{required:["value"],dataShape:"none",dataAccessors:[],props:Object.assign(Object.assign({},gd),{value:{type:"number"},min:{type:"number"},max:{type:"number"},thresholds:{type:"array"},gradientFill:{type:"object"},arcWidth:{type:"number"},cornerRadius:{type:"number"},sweep:{type:"number"},fillZones:{type:"boolean"},showNeedle:{type:"boolean"},needleColor:{type:"string"},color:{type:"string"},centerContent:{type:["object","string","number","function"]},valueFormat:{type:"function"},showScaleLabels:{type:"boolean"},backgroundColor:{type:"string"}})},FunnelChart:{required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},stepAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},connectorOpacity:{type:"number"},showCategoryTicks:{type:"boolean"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},SwimlaneChart:{required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],props:Object.assign(Object.assign(Object.assign({},gd),pd),{data:{type:"array"},categoryAccessor:{type:["string","function"]},subcategoryAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},orientation:{type:"string",enum:["horizontal","vertical"]},barPadding:{type:"number"},roundedTop:{type:"number"},showCategoryTicks:{type:"boolean"},brush:{type:"boolean"},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:["right","left","top","bottom"]}})},ForceDirectedGraph:{required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},gd),{nodes:{type:"array"},edges:{type:"array"},nodeIDAccessor:{type:["string","function"]},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},nodeLabel:{type:["string","function"]},nodeSize:{type:["number","string","function"]},nodeSizeRange:{type:"array"},edgeWidth:{type:["number","string","function"]},edgeColor:{type:"string"},edgeOpacity:{type:"number"},iterations:{type:"number"},forceStrength:{type:"number"},showLabels:{type:"boolean"}})},SankeyDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},gd),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"]},orientation:{type:"string",enum:md},nodeAlign:{type:"string",enum:["justify","left","right","center"]},nodePaddingRatio:{type:"number"},nodeWidth:{type:"number"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"},edgeSort:{type:"function"}})},ProcessSankey:{required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},gd),{nodes:{type:"array"},edges:{type:"array"},domain:{type:"array"},axisTicks:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},startTimeAccessor:{type:["string","function"]},endTimeAccessor:{type:["string","function"]},xExtentAccessor:{type:["string","function"]},edgeIdAccessor:{type:["string","function"]},legendPosition:{type:"string",enum:["right","left","top","bottom"]},pairing:{type:"string",enum:["value","temporal"]},packing:{type:"string",enum:["off","reuse"]},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"]},ribbonLane:{type:"string",enum:["source","target","both"]},lifetimeMode:{type:"string",enum:["full","half"]},showLaneRails:{type:"boolean"},showQualityReadout:{type:"boolean"},edgeOpacity:{type:"number"},timeFormat:{type:"function"},valueFormat:{type:"function"},showParticles:{type:"boolean"},particleStyle:{type:"object"}})},ChordDiagram:{required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],props:Object.assign(Object.assign({},gd),{nodes:{type:"array"},edges:{type:"array"},sourceAccessor:{type:["string","function"]},targetAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},edgeColorBy:{type:["string","function"],enum:["source","target"]},padAngle:{type:"number"},groupWidth:{type:"number"},sortGroups:{type:"function"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},edgeOpacity:{type:"number"}})},TreeDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"object"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"]},orientation:{type:"string",enum:["vertical","horizontal","radial"]},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},edgeStyle:{type:"string",enum:["line","curve"]},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean"},nodeSize:{type:"number"}})},Treemap:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},nodeStyle:{type:"function"}})},CirclePack:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"object"},childrenAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},colorByDepth:{type:"boolean"},showLabels:{type:"boolean"},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number"}})},OrbitDiagram:{required:["data"],dataShape:"object",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"object"},childrenAccessor:{type:["string","function"]},nodeIdAccessor:{type:["string","function"]},orbitMode:{type:["string","array"]},speed:{type:"number"},revolution:{type:"function"},eccentricity:{type:["number","function"]},orbitSize:{type:["number","function"]},nodeRadius:{type:["number","function"]},showRings:{type:"boolean"},showLabels:{type:"boolean"},animated:{type:"boolean"},colorByDepth:{type:"boolean"},annotations:{type:"array"},foregroundGraphics:{type:"object"}})},RealtimeLineChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHistogram:{required:["binSize"],dataShape:"realtime",dataAccessors:[],props:{binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},TemporalHistogram:{required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],props:{data:{type:"array"},binSize:{type:"number"},direction:{type:"string",enum:["up","down"]},size:{type:"array"},width:{type:"number"},height:{type:"number"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},brush:{type:["boolean","string","object"]},onBrush:{type:"function"},linkedBrush:{type:["string","object"]}}},RealtimeSwarmChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},categoryAccessor:{type:["string","function"]},colors:{type:"object"},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeWaterfallChart:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"},transition:{type:"object"}}},RealtimeHeatmap:{required:[],dataShape:"realtime",dataAccessors:[],props:{size:{type:"array"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"]},valueAccessor:{type:["string","function"]},heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]},windowSize:{type:"number"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltipContent:{type:"function"},tooltip:{type:["function","object"]},onHover:{type:"function"},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"]},svgAnnotationRules:{type:"function"},tickFormatTime:{type:"function"},tickFormatValue:{type:"function"},width:{type:"number"},height:{type:"number"},decay:{type:"object"},pulse:{type:"object"},staleness:{type:"object"}}},ScatterplotMatrix:{required:["data","fields"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"array"},fields:{type:"array"}})},MinimapChart:{required:["data"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gd),{data:{type:"array"}})},ChoroplethMap:{required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],props:Object.assign(Object.assign({},gd),{areas:{type:["array","string"]},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string"}})},ProportionalSymbolMap:{required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],props:Object.assign(Object.assign({},gd),{points:{type:"array"},xAccessor:{type:["string","function"]},yAccessor:{type:["string","function"]},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}})},FlowMap:{required:["flows"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gd),{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}})},DistanceCartogram:{required:["points"],dataShape:"array",dataAccessors:[],props:Object.assign(Object.assign({},gd),{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}})},BigNumber:{required:[],dataShape:"none",dataAccessors:[],props:{width:{type:["number","string"]},height:{type:["number","string"]},className:{type:"string"},onClick:{type:"function"},value:{type:"number"},label:{type:"string"},caption:{type:"string"},format:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},locale:{type:"string"},currency:{type:"string"},precision:{type:"number"},prefix:{type:"string"},suffix:{type:"string"},unit:{type:"string"},comparison:{type:"object"},target:{type:"object"},delta:{type:"number"},deltaFormat:{type:["string","function"],enum:["number","currency","percent","compact","duration"]},showDeltaPercent:{type:"boolean"},direction:{type:"string",enum:["higher-is-better","lower-is-better","neutral"]},sentiment:{type:"string",enum:["auto","positive","negative","neutral"]},thresholds:{type:"array"},chartSlot:{type:["string","number","array","object","function"]},chartSize:{type:"number"},windowSize:{type:"number"},mode:{type:"string",enum:["tile","presentation","inline","thumbnail"]},align:{type:"string",enum:["start","center","end"]},padding:{type:["number","object"]},emphasis:{type:"string",enum:["primary","secondary"]},color:{type:"string"},background:{type:"string"},borderColor:{type:"string"},borderRadius:{type:["number","string"]},animate:{type:["boolean","object"]},stalenessThreshold:{type:"number"},staleLabel:{type:"string"},headerSlot:{type:["string","number","array","object","function"]},valueSlot:{type:["string","number","array","object","function"]},deltaSlot:{type:["string","number","array","object","function"]},trendSlot:{type:["string","number","array","object","function"]},footerSlot:{type:["string","number","array","object","function"]},onObservation:{type:"function"}}}},bd=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend"]),xd=new Set(["data","nodes","edges"]),kd="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function wd(e){return Wl(this,arguments,void 0,function*(e,t="json"){const o="jsx"===t?Ad(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");yield navigator.clipboard.writeText(o)})}function Ad(e){const{component:t,props:o}=e,n=["<"+t];for(const[e,t]of Object.entries(o))if("string"==typeof t)n.push(` ${e}="${t}"`);else if("boolean"==typeof t&&!0===t)n.push(" "+e);else if("boolean"==typeof t&&!1===t)n.push(` ${e}={false}`);else if("number"==typeof t)n.push(` ${e}={${t}}`);else{const o=JSON.stringify(t);n.push(80>o.length?` ${e}={${o}}`:` ${e}={${JSON.stringify(t,null,2)}}`)}return n.push("/>"),n.join("\n")}function jd(e){return"nominal"===e||"ordinal"===e}function Sd(e){return"quantitative"===e||"temporal"===e}const Od={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},Md={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},Cd={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function _d(e,t,o,n,i){var r,s;(null==e?void 0:e.field)&&(o.xAccessor=n?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(r=null==e?void 0:e.axis)||void 0===r?void 0:r.title)&&(o.xLabel=e.axis.title),(null===(s=null==t?void 0:t.axis)||void 0===s?void 0:s.title)&&(o.yLabel=t.axis.title)}function Pd(e,t,o){const n={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){n.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return n}const Ld=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),Td=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),$d=new Set(["PieChart","DonutChart","FunnelChart"]),Rd=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Nd(e,t){var o,n;return Td.has(e)||$d.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:null!==(o=t.categoryAccessor)&&void 0!==o?o:t.stepAccessor,dimensionFallback:"category"}:{measure:null!==(n=t.yAccessor)&&void 0!==n?n:t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Bd(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function Ed(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Dd(e,t={}){var o,n;const i=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,s=new Set;for(const t of e){const e=null===(o=null==t?void 0:t.lifecycle)||void 0===o?void 0:o.supersedes;e&&"retracted"!==(null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.status)&&s.add(e)}return e.filter(e=>{var t,o;if("retracted"===(null===(t=null==e?void 0:e.lifecycle)||void 0===t?void 0:t.status)&&!i)return!1;const n=null===(o=null==e?void 0:e.provenance)||void 0===o?void 0:o.stableId;return!(n&&s.has(n)&&!r)})}const Id={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value"},Hd=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]);function Fd(e){return Id[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}const Wd=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),zd={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Yd={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Gd=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],qd={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};function Xd(e="en"){let t,o;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch(e){t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?o.format(e):t.format(e):e+""}const Vd={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Ud(e){const t=Vd["string"==typeof e.type?e.type:"annotation"]||"an annotation",o=function(e){var t,o;const n=e.provenance&&"object"==typeof e.provenance?e.provenance:null,i=null!==(o=null!==(t=null==n?void 0:n.authorKind)&&void 0!==t?t:null==n?void 0:n.source)&&void 0!==o?o:null==n?void 0:n.basis;return"watcher"===i?"a watcher-flagged ":"agent"===i||"ai"===i||"llm-inference"===i?"an AI-suggested ":""}(e),n=o?o+t.replace(/^an? /,""):t,i="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return i?`${n} labeled "${i}"`:n}function Qd(e,t,o={}){var n,i;const r=void 0!==o.levels,s=new Set(null!==(n=o.levels)&&void 0!==n?n:["l1","l2","l3"]);!r&&o.capability&&s.add("l4");const a=Xd(null!==(i=o.locale)&&void 0!==i?i:"en"),l=Fd(e),c=Array.isArray(t.data)?t.data:null,u=Bd(t),{measure:d,measureFallback:h,dimension:g,dimensionFallback:f}=Nd(e,t),p="string"==typeof d&&d?d:h,y="string"==typeof g&&g?g:f,m={};if(s.has("l1"))if(Ld.has(e)||Td.has(e))m.l1=`A ${l} of ${p} by ${y}`+(u?`, split by ${u}.`:".");else if($d.has(e))m.l1=`A ${l} showing ${p} across ${y} categories.`;else if(Rd.has(e))m.l1=`A ${l} of the distribution of ${p}`+(u?` by ${u}.`:".");else if(Hd.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,n=[null!=e?`${e} ${Zd(e,"node")}`:null,null!=o?`${o} ${Zd(o,"edge")}`:null].filter(Boolean);m.l1=`A ${l}${n.length?" with "+n.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:p;m.l1=`A single value${e?" for "+e:""}.`}else m.l1=`A ${l}.`;const v=Ld.has(e)||Td.has(e)||$d.has(e)||Rd.has(e);let b=null;if((s.has("l2")||s.has("l3")||s.has("l4"))&&v&&c&&c.length>0&&(b=function(e,t,o,n){let i=0,r=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,g=null,f=NaN,p=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===i&&(f=e,h=o),p=e,g=o,s>e&&(s=e,l=o,u=i),e>a&&(a=e,c=o,d=i),i++,r+=e)}return 0===i?null:{count:i,min:s,max:a,mean:r/i,minLabel:Ed(null!=l?o(l):null,n),maxLabel:Ed(null!=c?o(c):null,n),first:f,last:p,firstLabel:Ed(null!=h?o(h):null,n),lastLabel:Ed(null!=g?o(g):null,n),minIndex:u,maxIndex:d}}(c,Y(d,h),G(g,f),a)),s.has("l2")&&v&&(c&&0!==c.length?b&&(m.l2=$d.has(e)?`${b.count} segments totaling ${a(function(e){return e.mean*e.count}(b))}. Largest is ${b.maxLabel} at ${a(b.max)}; smallest is ${b.minLabel} at ${a(b.min)}.`:`${p} ranges from ${a(b.min)} (${b.minLabel}) to ${a(b.max)} (${b.maxLabel}), with a mean of ${a(b.mean)} across ${b.count} points.`):m.l2="No data is loaded yet."),s.has("l3")&&b&&Ld.has(e)?m.l3=function(e,t,o){const{first:n,last:i,min:r,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:g}=e,f=s-r,p=i-n;if(0===f)return`${Kd(t)} is constant at ${o(n)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Kd(t)} ends roughly where it started (${o(n)} at ${c} to ${o(i)} at ${u}), ranging between ${o(r)} and ${o(s)}.`;const y=h>0&&g-1>h,m=d>0&&g-1>d,v=(s-Math.max(n,i))/f,b=(Math.min(n,i)-r)/f;return y&&v>.15?`Overall ${t} climbs to a peak of ${o(s)} (${a}), then falls to ${o(i)} (${u}).`:m&&b>.15?`Overall ${t} drops to a low of ${o(r)} (${l}), then recovers to ${o(i)} (${u}).`:.05>Math.abs(p)/f?`${Kd(t)} ends roughly where it started (${o(n)} at ${c} to ${o(i)} at ${u}), ranging between ${o(r)} and ${o(s)}.`:p>0?h===g-1?`Overall ${t} rises from ${o(n)} (${c}) to a peak of ${o(i)} (${u}).`:`Overall ${t} rises from ${o(n)} (${c}) to ${o(i)} (${u}), after peaking at ${o(s)} (${a}).`:d===g-1?`Overall ${t} falls from ${o(n)} (${c}) to a low of ${o(i)} (${u}).`:`Overall ${t} falls from ${o(n)} (${c}) to ${o(i)} (${u}), after dipping to ${o(r)} (${l}).`}(b,p,a):s.has("l3")&&b&&Td.has(e)&&(m.l3=`The highest ${y} is ${b.maxLabel} and the lowest is ${b.minLabel}.`),s.has("l4")){const n=function(e,t){var o;const n=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,o={};for(const[e,n]of Object.entries(t.intentScores))"number"==typeof n&&Number.isFinite(n)&&(o[e]=n);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(null==n?void 0:n.act)return n.act;if(null==n?void 0:n.intentScores){const e=function(e){let t,o=0;for(const[n,i]of Object.entries(e))if("number"==typeof i&&i>0)if(i>o)t=n,o=i;else if(i===o&&void 0!==t){const e=Gd.indexOf(n),o=Gd.indexOf(t);-1===e||-1!==o&&e>=o||(t=n)}return t}(n.intentScores);if(e&&zd[e]&&(null!==(o=n.intentScores[e])&&void 0!==o?o:0)>=3)return zd[e]}return(null==n?void 0:n.family)?Yd[n.family]:function(e){return $d.has(e)||"StackedAreaChart"===e?"apportioning":Wd.has(e)?"relating":Td.has(e)?"comparing":Rd.has(e)?"characterizing":Ld.has(e)?"tracking":Hd.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);n&&(m.l4=function(e,t,o,n,i,r,s,a){const l=qd[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof o.label&&o.label?o.label:i} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${r} and ${i} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,n,i,r){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+o;case"comparing":return`compare ${o} across ${n}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${n}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(Td.has(o)||$d.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:n,last:i,min:r,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,g=s-r;if(g>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,f=(s-Math.max(n,i))/g,p=(Math.min(n,i)-r)/g;if(e&&f>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(o&&p>.15)return`the dip to ${t(r)} at ${a} is the point to investigate`;if(i>=s)return`the climb to ${t(i)} at ${c} warrants a closer look`;if(r>=i)return`the drop to ${t(i)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(r)}) — are the points to check`}(t,i,r);case"tracking":return`read it for the trajectory of ${o}, which ${function(e){const t=e.max-e.min,o=e.last-e.first;return 0===t||.05>Math.abs(o)/t?"holds roughly steady":o>0?"rises":"falls"}(t)} from ${i(t.first)} (${t.firstLabel}) to ${i(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${n}; ${t.maxLabel} leads at ${i(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${i(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${n}'s share of the ${i(e)} total; ${t.maxLabel} is the largest at ${i(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${i(t.min)} to ${i(t.max)}`;default:return"read the highlighted features"}}(e,n,i,r,s,t)}return`${u}; ${d}.${function(e,t){var o;if(!t)return"";const n=null===(o=t.familiarity)||void 0===o?void 0:o[e];return"number"!=typeof n||n>2?"":` This ${Fd(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(n,e,t,b,p,y,a,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>s.has(e)&&m[e]).map(e=>m[e]).join(" "),k=function(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=Dd(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const n=o.map(Ud),i=n.slice(0,5),r=n.length-i.length,s=function(e){var t;return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:null!==(t=e[0])&&void 0!==t?t:""}(i)+(r>0?`, and ${r} more`:""),a=o.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}(t);return Object.assign({text:k?`${k} ${x}`.trim():x,levels:m},k?{annotations:k}:{})}function Kd(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Zd(e,t){return 1===e?t:t+"s"}function Jd(e,t,o={}){var n,i,r;const s=null!==(n=o.locale)&&void 0!==n?n:"en",a=Math.max(1,null!==(i=o.maxLeaves)&&void 0!==i?i:200),l=Xd(s),c={id:"root",role:"chart",label:Qd(e,t,{locale:s}).text||"Chart.",level:1,children:[]},u=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const n=Dd(o.filter(e=>!!e&&"object"==typeof e));if(0===n.length)return null;let i=0;const r=n.slice(0,t).map(e=>{var t;const o=null===(t=e.lifecycle)||void 0===t?void 0:t.status,n=o&&"accepted"!==o?` (${o})`:"";return{id:"annotation-"+i++,role:"annotation",level:3,label:`${r=Ud(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${n}.`,datum:e};var r});n.length>t&&r.push({id:"annotation-"+i++,role:"annotation",level:3,label:`…and ${n.length-t} more annotations.`});const s=n.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:r}}(t,a),d=Array.isArray(t.data)?t.data:null,h=Ld.has(e)||Td.has(e)||$d.has(e)||Rd.has(e);if(!d||0===d.length||!h)return u&&(c.children=[u]),c;const{measure:g,measureFallback:f,dimension:p,dimensionFallback:y}=Nd(e,t),m=Y(g,f),v=G(p,y),b="string"==typeof g&&g?g:f,x="string"==typeof p&&p?p:y,k=Bd(t);let w=0;const A=e=>`${e}-${w++}`,j=(e,t)=>{const o=e.slice(0,a).map(e=>((e,t)=>{const o=m(e),n=Ed(v(e),l);return{id:A("datum"),role:"datum",level:t,label:`${n}: ${Number.isFinite(o)?l(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>a&&o.push({id:A("more"),role:"datum",level:t,label:`…and ${e.length-a} more points`}),o},S=[];if(Ld.has(e)||Td.has(e)){let t=1/0,o=-1/0,n=1/0,i=-1/0;const r=[];let s=!0;for(const e of d){const a=m(e);Number.isFinite(a)&&(t>a&&(t=a),a>o&&(o=a));const l=v(e);r.push(l),"number"==typeof l&&Number.isFinite(l)?(n>l&&(n=l),l>i&&(i=l)):s=!1}const a=new Set,c=[];for(const e of r){const t=e+"";a.has(t)||(a.add(t),c.push(e))}const u=s?`${l(n)} to ${l(i)}`:`${Ed(c[0],l)} to ${Ed(c[c.length-1],l)} (${Td.has(e)?c.length+" categories":d.length+" points"})`;S.push({id:A("axis"),role:"axis",level:2,label:`${Td.has(e)?"Category axis":"X axis"}: ${x}, ${u}.`}),t>o||S.push({id:A("axis"),role:"axis",level:2,label:`Value axis: ${b}, ${l(t)} to ${l(o)}.`})}if(k){const o=G(k,k),n=new Map;for(const e of d){const t=(null!==(r=o(e))&&void 0!==r?r:"—")+"",i=n.get(t);i?i.push(e):n.set(t,[e])}const i=[];for(const[o,r]of n){const n=Qd(e,Object.assign(Object.assign({},t),{data:r}),{levels:["l2","l3"],locale:s}).text;i.push({id:A("series"),role:"series",level:2,label:`Series ${o}: ${n}`,children:j(r,3)})}c.children=[...S,...i]}else c.children=[...S,...j(d,2)];return u&&c.children.push(u),c}const eh={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function th({tree:t,label:o,visible:n=!1,className:i,onActiveChange:r,activeId:s,chartId:a}){const[l,c]=p.useState(()=>new Set([t.id])),[u,d]=p.useState(t.id),h=void 0!==s,g=h?s:u,f=p.useRef(null),y=p.useRef(new Map),m=p.useMemo(()=>function(e){const t=new Map,o=e=>{var n;for(const i of null!==(n=e.children)&&void 0!==n?n:[])t.set(i.id,e),o(i)};return o(e),t}(t),[t]),v=p.useMemo(()=>function(e,t){const o=[],n=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)n(t)};return n(e),o}(t,l),[t,l]);p.useEffect(()=>{h||v.some(e=>e.id===u)||d(t.id)},[v,u,t.id,h]),p.useEffect(()=>{const e=[];let t=m.get(g);for(;t;)e.push(t.id),t=m.get(t.id);e.length>0&&c(t=>{if(e.every(e=>t.has(e)))return t;const o=new Set(t);for(const t of e)o.add(t);return o})},[g,m]),p.useEffect(()=>{var e,t;(null===(e=f.current)||void 0===e?void 0:e.contains(document.activeElement))&&(null===(t=y.current.get(g))||void 0===t||t.focus())},[g]);const b=p.useCallback((e,t,o)=>{},[a]),x=p.useCallback(e=>{e.id!==g&&(h||d(e.id),null==r||r(e),b(e,"focus"))},[r,h,b,g]),k=e=>{c(t=>new Set(t).add(e.id)),b(e,"toggle",!0)},w=e=>{c(t=>{const o=new Set(t);return o.delete(e.id),o}),b(e,"toggle",!1)},A=(t,o,i)=>{const r=!!t.children&&t.children.length>0,s=l.has(t.id);return e.jsxs("li",{role:"treeitem","aria-label":t.label,"aria-level":t.level,"aria-posinset":o,"aria-setsize":i,"aria-expanded":r?s:void 0,"aria-selected":t.id===g,tabIndex:t.id===g?0:-1,ref:e=>{y.current.set(t.id,e)},onClick:e=>{e.stopPropagation(),x(t),r&&(s?w:k)(t)},style:n?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(t.level-1),cursor:r?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:t.id===g?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[e.jsxs("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+t.role,children:[n&&r?s?"▾ ":"▸ ":"",t.label]}),r&&s&&e.jsx("ul",{role:"group",style:n?{margin:0,padding:0}:void 0,children:t.children.map((e,o)=>A(e,o+1,t.children.length))})]},t.id)};return e.jsx("div",{ref:f,className:"semiotic-nav-tree"+(i?" "+i:""),style:n?void 0:eh,onKeyDown:e=>{const t=v.findIndex(e=>e.id===g);if(-1===t)return;const o=v[t],n=!!o.children&&o.children.length>0,i=l.has(o.id);let r=!0;switch(e.key){case"ArrowDown":x(v[Math.min(t+1,v.length-1)]);break;case"ArrowUp":x(v[Math.max(t-1,0)]);break;case"Home":x(v[0]);break;case"End":x(v[v.length-1]);break;case"ArrowRight":n&&!i?k(o):n&&i?x(o.children[0]):r=!1;break;case"ArrowLeft":if(n&&i)w(o);else{const e=m.get(o.id);e?x(e):r=!1}break;case"Enter":case" ":n?(i?w:k)(o):r=!1;break;default:r=!1}r&&(e.preventDefault(),e.stopPropagation())},children:e.jsx("ul",{role:"tree","aria-label":o||"Chart navigation",style:n?{margin:0,padding:0}:void 0,children:A(t,1,1)})})}const oh={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function nh(){const t=function(){const e=p.useContext(vn);return e?()=>e.setVisible(e=>!e):null}();return t?e.jsx("button",{className:"semiotic-chart-action",onClick:t,title:"Data summary","aria-label":"Toggle data summary",style:lh,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),e.jsx("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}const ih={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function rh({height:t}){return e.jsx("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:t,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function sh({error:t}){return e.jsx("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:e.jsx("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:t})})}const ah=p.forwardRef(function({title:t,subtitle:o,children:n,width:i="100%",height:r=400,actions:s,chartConfig:a,describe:l,navigable:c,controls:u,loading:d=!1,error:h,errorBoundary:g=!1,status:f,detailsPanel:y,className:m,style:v},b){var x;const k=p.useRef(null),w=p.useRef(null),[A,j]=p.useState(!1),S=!1!==(null==s?void 0:s.export)&&void 0!==(null==s?void 0:s.export),O=!1!==(null==s?void 0:s.fullscreen)&&void 0!==(null==s?void 0:s.fullscreen),M=!1!==(null==s?void 0:s.copyConfig)&&void 0!==(null==s?void 0:s.copyConfig)&&a,C=!0===(null==s?void 0:s.dataSummary),_=p.useMemo(()=>{if(!l||!(null==a?void 0:a.component)||!(null==a?void 0:a.props))return"";const e="object"==typeof l?l.levels:void 0;try{return Qd(a.component,a.props,e?{levels:e}:{}).text}catch(e){return""}},[l,a]),P="object"==typeof l&&!0===l.visible,L=p.useMemo(()=>{if(!c||!(null==a?void 0:a.component)||!(null==a?void 0:a.props))return null;const e="object"==typeof c?c.maxLeaves:void 0;try{return Jd(a.component,a.props,e?{maxLeaves:e}:{})}catch(e){return null}},[c,a]),T="object"==typeof c&&!0===c.visible,$=p.useMemo(()=>"object"==typeof(null==s?void 0:s.export)?s.export:{},[null==s?void 0:s.export]),R="object"==typeof(null==s?void 0:s.copyConfig)?s.copyConfig.format:"json",N=p.useCallback(e=>Wl(this,void 0,void 0,function*(){w.current&&(yield ud(w.current,Object.assign(Object.assign({},$),e)))}),[$]),B=p.useCallback(()=>{k.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):k.current.requestFullscreen().catch(()=>{}))},[]),E=p.useCallback(e=>Wl(this,void 0,void 0,function*(){var t,o;a&&(yield wd(Object.assign(Object.assign({},a),{version:null!==(t=a.version)&&void 0!==t?t:"1",createdAt:null!==(o=a.createdAt)&&void 0!==o?o:(new Date).toISOString()}),e||R||"json"))}),[a,R]);p.useEffect(()=>{const e=()=>{j(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),p.useImperativeHandle(b,()=>({export:N,toggleFullscreen:B,copyConfig:E,element:k.current}),[N,B,E]);const D=t||o||u||S||O||M||C||f,I=d?e.jsx(rh,{height:r}):h?e.jsx(sh,{error:h}):g?e.jsx(bl,{children:n}):n;return H=e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}"}}),e.jsxs("div",{ref:k,className:"semiotic-chart-container"+(m?" "+m:""),style:Object.assign(Object.assign({width:i,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative"},A?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{}),v),children:[D&&e.jsxs("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[e.jsxs("div",{className:"semiotic-chart-title-area",children:[t&&e.jsx("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:t}),o&&e.jsx("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:t?2:0},children:o})]}),e.jsxs("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4},children:[u,S&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>N(),title:"Export chart","aria-label":"Export chart",style:lh,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),e.jsx("path",{d:"M2 12h10"})]})}),C&&e.jsx(nh,{}),O&&e.jsx("button",{className:"semiotic-chart-action",onClick:B,title:A?"Exit fullscreen":"Fullscreen","aria-label":A?"Exit fullscreen":"Enter fullscreen",style:lh,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsxs(e.Fragment,A?{children:[e.jsx("path",{d:"M9 1v4h4"}),e.jsx("path",{d:"M5 13V9H1"}),e.jsx("path",{d:"M13 5H9V1"}),e.jsx("path",{d:"M1 9h4v4"})]}:{children:[e.jsx("path",{d:"M1 5V1h4"}),e.jsx("path",{d:"M13 9v4H9"}),e.jsx("path",{d:"M9 1h4v4"}),e.jsx("path",{d:"M5 13H1V9"})]})})}),M&&e.jsx("button",{className:"semiotic-chart-action",onClick:()=>E(),title:"Copy config","aria-label":"Copy chart configuration",style:lh,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),e.jsx("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),f&&e.jsx("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:ih[f].bg,color:ih[f].color,lineHeight:"18px"},children:f})]})]}),_&&e.jsx("div",{className:"semiotic-chart-description",role:"note",style:P?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:oh,children:_}),L&&e.jsx("div",{className:"semiotic-chart-nav",style:T?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:e.jsx(th,{tree:L,label:"string"==typeof t&&t?t+" — navigable structure":"Chart navigable structure",visible:T,chartId:"string"==typeof(null===(x=null==a?void 0:a.props)||void 0===x?void 0:x.chartId)?a.props.chartId:void 0})}),e.jsxs("div",{className:"semiotic-chart-body",ref:w,style:Object.assign({position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},A?{flex:1}:{height:r}),children:[I,y]})]})]}),C?e.jsx(bn,{children:H}):H;var H}),lh={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0};function ch({children:t,columns:o="auto",minCellWidth:n=300,gap:i=16,className:r,style:s}){const a="number"==typeof o?o:void 0;return e.jsx("div",{className:"semiotic-chart-grid"+(r?" "+r:""),style:Object.assign({display:"grid",gridTemplateColumns:"auto"===o?`repeat(auto-fill, minmax(${n}px, 1fr))`:`repeat(${o}, 1fr)`,gap:i,width:"100%"},s),children:p.Children.map(t,t=>p.isValidElement(t)?"primary"!==t.props.emphasis||void 0!==a&&2>a?t:e.jsx("div",{style:{gridColumn:"span 2"},children:t}):t)})}function uh({children:t,context:o,position:n="right",contextSize:i=250,gap:r=12,className:s,style:a}){const l="left"===n||"right"===n,c="left"===n||"top"===n,u=Object.assign({display:"flex",flexDirection:l?c?"row-reverse":"row":c?"column-reverse":"column",gap:r,width:"100%"},a),d=l?{flex:`0 0 ${i}px`,width:i,minHeight:0}:{flex:`0 0 ${i}px`,height:i,minWidth:0};return e.jsxs("div",{className:"semiotic-context-layout"+(s?" "+s:""),style:u,children:[e.jsx("div",{style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:t}),e.jsx("div",{style:d,children:o})]})}ch.displayName="ChartGrid",uh.displayName="ContextLayout";function dh({children:o,position:n="right",size:i=300,trigger:r="click",chartId:s,observation:a,dismissOnEmpty:l=!0,showClose:c=!0,onToggle:u,className:d,style:h}){const[g,f]=t.useState(null),[p,y]=t.useState(null),[m,v]=t.useState(!1),[b,x]=t.useState(!1),k=t.useRef(null),w=t.useRef(void 0),A="click"===r?["click","click-end"]:["hover","hover-end"],{latest:j}=Ea({types:A,chartId:s,limit:1}),S=void 0!==a?a:j,O=t.useCallback(()=>{x(!0),v(!1),clearTimeout(w.current),w.current=setTimeout(()=>{x(!1),f(null),y(null)},200)},[]);if(t.useEffect(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;f(e.datum),y(e),v(e=>(e||(x(!0),clearTimeout(w.current),w.current=setTimeout(()=>x(!1),200)),!0))}else!l||"click-end"!==S.type&&"hover-end"!==S.type||O()},[l,O,S]),t.useEffect(()=>{null==u||u(m)},[m,u]),t.useEffect(()=>()=>clearTimeout(w.current),[]),!g&&!b)return null;const M=g&&p?o(g,p):null;if(null===M&&!b)return null;const C=function(e,t,o,n){const i={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:n?"transform 200ms ease-out, opacity 200ms ease-out":void 0};return Object.assign(Object.assign({},i),"right"===e?{top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"})}(n,i,m,b);return e.jsxs("div",{ref:k,className:`semiotic-details-panel semiotic-details-${n}${d?" "+d:""}`,style:Object.assign(Object.assign({},C),h),children:[c&&e.jsx("button",{className:"semiotic-details-close",onClick:O,"aria-label":"Close details",style:hh,children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:e.jsx("path",{d:"M2 2l8 8M10 2l-8 8"})})}),e.jsx("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:M})]})}const hh={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};function gh(e){var t;if("datum"===e.role&&e.datum)return e.datum;for(const o of null!==(t=e.children)&&void 0!==t?t:[]){const e=gh(o);if(e)return e}return null}function fh(e,t){return e?t.map(t=>e[t]+"").join(""):""}dh.displayName="DetailsPanel";const ph="__forecastSegment";function yh(e,t){return"function"==typeof t?t(e):!!e[t]}const mh=Object.freeze({__proto__:null,SEGMENT_FIELD:ph,buildAnomalyAnnotations:function(e){var t,o,n;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(o=e.bandOpacity)&&void 0!==o?o:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(n=e.anomalyRadius)&&void 0!==n?n:6,label:e.label}]},buildForecast:function(e,t,o,n,i){return(r=n).isTraining||r.isForecast||r.isAnomaly||r.upperBounds||r.lowerBounds?function(e,t,o,n,i){var r,s,a,l;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:g,color:f="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=n,b=e.map(e=>{let t="observed";return u&&yh(e,u)?t="forecast":c&&yh(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[ph]:t})}),x=n._groupBy,k=[];if(x){const e=new Map;for(const t of b){const o=null!==(r=t[x])&&void 0!==r?r:"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][ph]!==o[e+1][ph]&&(t.push(Object.assign(Object.assign({},o[e+1]),{[ph]:o[e][ph]})),t.push(Object.assign(Object.assign({},o[e]),{[ph]:o[e+1][ph]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][ph]!==b[e+1][ph]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[ph]:b[e][ph]})),k.push(Object.assign(Object.assign({},b[e]),{[ph]:b[e+1][ph]})));if(n.trainUnderline){const e=[];for(const t of k)"training"===t[ph]&&e.push(Object.assign(Object.assign({},t),{[ph]:"training-base"}));k.unshift(...e)}const w=[];if(h&&g){const e="string"==typeof h?h:"__envUpper",t="string"==typeof g?g:"__envLower";if("function"==typeof h||"function"==typeof g)for(const o of k)"function"==typeof h&&(o[e]=h(o)),"function"==typeof g&&(o[t]=g(o));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:f,fillOpacity:p,label:v})}if(d){const e=n.anomalyStyle,t={type:"highlight",filter:e=>yh(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(a=i.bandOpacity)&&void 0!==a?a:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,n,i):function(e,t,o,n,i){var r,s,a;const{trainEnd:l,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:g}=n;if(null==l)return{processedData:e,annotations:[]};const f=[],p=[];for(const o of e)o[t]>l?p.push(Object.assign(Object.assign({},o),{[ph]:"observed"})):f.push(Object.assign(Object.assign({},o),{[ph]:"training"}));const y=f.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const n=y.length;let i=0,r=0,s=0,a=0;for(const[e,t]of y)i+=e,r+=t,s+=e*e,a+=e*t;const l=n*s-i*i;if(Math.abs(l)>1e-12){const s=(n*a-i*r)/l,f=(r-s*i)/n,p=e=>f+s*e,b=y.map(([e,t])=>t-p(e)).reduce((e,t)=>e+t*t,0),x=Math.sqrt(b/Math.max(n-2,1)),k=y.reduce((e,t)=>e+t[0],0)/n,w=y.reduce((e,t)=>e+Math.pow(t[0]-k,2),0),A=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,j=e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e)),S=Math.max(...j),O=y.length>1?(y[n-1][0]-y[0][0])/(n-1):1;for(let e=1;c>=e;e++){const i=S+e*O,r=p(i),s=x*Math.sqrt(1+1/n+(w>0?Math.pow(i-k,2)/w:0))*A;v.push({[t]:i,[o]:r,[ph]:"forecast",__forecastUpper:r+s,__forecastLower:r-s})}m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:g})}}m.push({type:"x-threshold",x:l,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(s=i.bandOpacity)&&void 0!==s?s:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label});const b=[];if(b.push(...f),f.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},f[f.length-1]),{[ph]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:f[f.length-1];e&&b.push(Object.assign(Object.assign({},e),{[ph]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,o,n,i);var r},createSegmentLineStyle:function(e,t){var o,n;const i=null!==(o=t.trainDasharray)&&void 0!==o?o:"8,4",r=null!==(n=t.forecastDasharray)&&void 0!==n?n:"4,4",s=t.color||"#6366f1",a=t.trainOpacity,l=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const o=e(t),n=t[ph];if("training"===n){let e=o.stroke;return"darken"===c?e=ld(o.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=a&&{strokeOpacity:a})}if("training-base"===n){let e=o.stroke||"#666";return"lighten"===d&&(e=cd(e,.4)),Object.assign(Object.assign({},o),{stroke:e,strokeDasharray:void 0})}return"forecast"===n?Object.assign(Object.assign(Object.assign({},o),{stroke:s,strokeDasharray:r}),null!=l&&{strokeOpacity:l}):o}},darkenColor:ld,lightenColor:cd});exports.AccessibleNavTree=th,exports.AreaChart=oc,exports.BarChart=Dc,exports.BoxPlot=Jc,exports.BubbleChart=ac,exports.CARBON_ALERT={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},exports.CARBON_CATEGORICAL_14=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],exports.COLOR_BLIND_SAFE_CATEGORICAL=M,exports.CandlestickChart=Pc,exports.CategoryColorProvider=ja,exports.ChartContainer=ah,exports.ChartErrorBoundary=bl,exports.ChartGrid=ch,exports.ChordDiagram=Au,exports.CirclePack=Wu,exports.ConnectedScatterplot=Kl,exports.ContextLayout=uh,exports.DARK_THEME=_,exports.DetailsPanel=dh,exports.DifferenceChart=ic,exports.DonutChart=au,exports.DotPlot=ru,exports.ForceDirectedGraph=wu,exports.FunnelChart=iu,exports.GaugeChart=fu,exports.GroupedBarChart=pu,exports.HIGH_CONTRAST_THEME=P,exports.Heatmap=sc,exports.Histogram=tu,exports.IncrementalExtent=N,exports.LIGHT_THEME=C,exports.LikertChart=Uc,exports.LineChart=Jl,exports.LinkedCharts=qa,exports.MinimapChart=mc,exports.MultiAxisLineChart=Cc,exports.MultiLineTooltip=function(t={}){const{fields:o=[],title:n,format:i,style:r={},className:s="",showLabels:a=!0,separator:l=": "}=t;return t=>{if(!t||"object"!=typeof t)return null;const c=[];if(n){const e=Vn(t,n);c.push({value:Un(e,i)})}o&&Array.isArray(o)&&o.length>0?o.forEach(e=>{let o,n,r;"string"==typeof e?(o=e,n=e,r=i):(o=e.label,n=e.accessor||e.key||"",r=e.format||i);const s=Un(Vn(t,n),r);c.push({label:a?o:void 0,value:s})}):Object.keys(t).filter(e=>!e.startsWith("_")&&"data"!==e).forEach(e=>{c.push({label:a?e:void 0,value:Un(t[e],i)})});const u=Object.assign(Object.assign({},Xn),r);return Array.isArray(c)&&0!==c.length?e.jsx("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+s).trim(),style:u,children:c.map((t,o)=>e.jsxs("div",{style:{marginBottom:c.length-1>o?"4px":0},children:[t.label&&e.jsxs("strong",{children:[t.label,l]}),t.value]},o))}):null}},exports.NetworkCustomChart=Rc,exports.OrbitDiagram=Yu,exports.OrdinalCustomChart=Nc,exports.PieChart=su,exports.ProcessSankey=Iu,exports.QuadrantChart=Ac,exports.RealtimeHeatmap=id,exports.RealtimeHistogram=Ju,exports.RealtimeLineChart=Ku,exports.RealtimeSwarmChart=od,exports.RealtimeTemporalHistogram=td,exports.RealtimeWaterfallChart=nd,exports.RidgelinePlot=nu,exports.RingBuffer=R,exports.SankeyDiagram=ju,exports.Scatterplot=Ul,exports.ScatterplotMatrix=pc,exports.StackedAreaChart=rc,exports.StackedBarChart=Ic,exports.StreamNetworkFrame=ha,exports.StreamOrdinalFrame=kr,exports.StreamXYFrame=Ei,exports.SwarmPlot=Kc,exports.SwimlaneChart=yu,exports.THEME_PRESETS=Qa,exports.TemporalHistogram=ed,exports.ThemeProvider=function({theme:t,children:o}){const n="string"==typeof t&&Ka(t)?t:void 0,i=p.useMemo(()=>function(e){return void 0!==e?L(C,el(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?P:C}(t),[t]);return e.jsx(T,{initialState:{theme:i},children:e.jsxs(Za.Provider,{value:n,children:[e.jsx(tl,{theme:t}),e.jsx(ol,{children:o})]})})},exports.Tooltip=Qn,exports.TreeDiagram=Hu,exports.Treemap=Fu,exports.ViolinPlot=ou,exports.XYCustomChart=$c,exports.adaptiveTimeTicks=function(e){let t,o=e;return(n,i,r)=>{const s=n instanceof Date?n:new Date(n);e||!r||2>r.length||r===t||(t=r,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 12e4>o?"seconds":72e5>o?"minutes":2*rd>o?"hours":60*rd>o?"days":400*rd>o?"months":"years"}(r));const a=o||"days";return null!=i&&0!==i&&r&&0!==r.length?function(e,t,o){const n=e.getUTCFullYear()!==t.getUTCFullYear(),i=n||e.getUTCMonth()!==t.getUTCMonth(),r=i||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=ad[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=sd(e.getUTCHours()),h=sd(e.getUTCMinutes()),g=sd(e.getUTCSeconds());switch(o){case"seconds":return n?`${l} ${c}, ${u} ${d}:${h}:${g}`:r?`${l} ${c} ${d}:${h}:${g}`:s?`${d}:${h}:${g}`:a?`${h}:${g}`:":"+g;case"minutes":return n?`${l} ${c}, ${u} ${d}:${h}`:r?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return n?`${l} ${c}, ${u} ${d}:00`:i?`${l} ${c} ${d}:${h}`:r?`${l} ${c} ${d}:00`:d+":00";case"days":return n?`${l} ${c}, ${u}`:i?`${l} ${c}`:""+c;case"months":return n?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(r[i-1]),a):function(e,t){const o=ad[e.getUTCMonth()],n=e.getUTCDate(),i=e.getUTCFullYear(),r=sd(e.getUTCHours()),s=sd(e.getUTCMinutes()),a=sd(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${n}, ${i} ${r}:${s}:${a}`;case"minutes":case"hours":return`${o} ${n}, ${i} ${r}:${s}`;case"days":return`${o} ${n}, ${i}`;case"months":return`${o} ${i}`;case"years":return""+i}}(s,a)}},exports.buildNavigationTree=Jd,exports.configToJSX=Ad,exports.copyConfig=wd,exports.createHatchPattern=ur,exports.darkenColor=ld,exports.deserializeSelections=function(e){const t=new Map;for(const[o,n]of Object.entries(e)){const e=new Map;for(const t of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:new Set(n.values)}:{type:"interval",range:n.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:n.name,resolution:n.resolution,clauses:e})}return t},exports.exportChart=ud,exports.fromConfig=function(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if(!vd[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:kd(e.props)}},exports.fromURL=function(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(escape(atob(o)));return JSON.parse(n)},exports.fromVegaLite=function(e){var t,o,n,i,r,s,a,l,c,u,d,h;const g=[],{type:f,markProps:p}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:Fl(e,["type"])}}(e.mark),y=e.encoding||{},m=y.x,v=y.y,b=y.color,x=y.size,k=y.theta,w=y.opacity;let A;(null===(t=e.data)||void 0===t?void 0:t.values)?A=e.data.values:(null===(o=e.data)||void 0===o?void 0:o.url)&&g.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&g.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&g.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&g.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||y.facet||y.row||y.column)&&g.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&g.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&g.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const j={};e.width&&(j.width=e.width),e.height&&(j.height=e.height);const S=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(S&&(j.title=S),(null==b?void 0:b.field)&&(j.colorBy=b.field,null===(n=b.scale)||void 0===n?void 0:n.scheme)){const e=Od[b.scale.scheme];e&&(j.colorScheme=e)}void 0!==(null==w?void 0:w.value)&&(j.pointOpacity=w.value);const O=null==m?void 0:m.aggregate,M=null==v?void 0:v.aggregate;if(A&&(O||M)){const e=M?v:m,t=M?m:v,o=Cd[e.aggregate];if(o&&(null==t?void 0:t.field)&&e.field)A=function(e,t){const{groupBy:o,value:n,agg:i="sum"}=t,r=new Map;for(const t of e){const e=t[o]+"";r.has(e)||r.set(e,[]),r.get(e).push(Number(t[n]))}const s=[];for(const[e,t]of r){let n;switch(i){case"count":n=t.length;break;case"mean":n=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":n=Math.min(...t);break;case"max":n=Math.max(...t);break;default:n=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:n})}return s}(A,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&(null==t?void 0:t.field)&&A){const e=new Map;for(const o of A){const n=o[t.field]+"";e.set(n,(e.get(n)||0)+1)}A=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==m?void 0:m.bin)||(null==v?void 0:v.bin)){const e="Histogram";A&&(j.data=A),(null==m?void 0:m.bin)?(j.valueAccessor=m.field,(null==v?void 0:v.field)&&(j.categoryAccessor=v.field),(null===(i=m.axis)||void 0===i?void 0:i.title)&&(j.valueLabel=m.axis.title)):(null==v?void 0:v.bin)&&(j.valueAccessor=v.field,(null==m?void 0:m.field)&&(j.categoryAccessor=m.field),(null===(r=v.axis)||void 0===r?void 0:r.title)&&(j.valueLabel=v.axis.title));const t=(null==m?void 0:m.bin)||(null==v?void 0:v.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(j.bins=o),Pd(e,j,g)}let C;switch(f){case"bar":C=function(e,t,o,n,i,r,s){var a,l,c,u,d,h;let g;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(g="StackedBarChart",n.stackBy=o.field):g="BarChart",jd(null==e?void 0:e.type)&&Sd(null==t?void 0:t.type)?(n.categoryAccessor=e.field,n.valueAccessor=s?"value":t.field,(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(n.categoryLabel=e.axis.title),(null===(l=null==t?void 0:t.axis)||void 0===l?void 0:l.title)&&(n.valueLabel=t.axis.title)):Sd(null==e?void 0:e.type)&&jd(null==t?void 0:t.type)?(n.categoryAccessor=t.field,n.valueAccessor=r?"value":e.field,n.orientation="horizontal",(null===(c=null==t?void 0:t.axis)||void 0===c?void 0:c.title)&&(n.categoryLabel=t.axis.title),(null===(u=null==e?void 0:e.axis)||void 0===u?void 0:u.title)&&(n.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(n.categoryAccessor=e.field),(null==t?void 0:t.field)&&(n.valueAccessor=s?"value":t.field),(null===(d=null==e?void 0:e.axis)||void 0===d?void 0:d.title)&&(n.categoryLabel=e.axis.title),(null===(h=null==t?void 0:t.axis)||void 0===h?void 0:h.title)&&(n.valueLabel=t.axis.title)),i&&(n.data=i),g}(m,v,b,j,A,O,M);break;case"line":if(C="LineChart",_d(m,v,j,O,M),(null==b?void 0:b.field)&&(j.lineBy=b.field),p.interpolate){const e=Md[p.interpolate];e&&(j.curve=e)}!0===p.point&&(j.showPoints=!0),A&&(j.data=A);break;case"area":if((null==b?void 0:b.field)?(C="StackedAreaChart",j.areaBy=b.field):C="AreaChart",_d(m,v,j,O,M),p.interpolate){const e=Md[p.interpolate];e&&(j.curve=e)}void 0!==p.opacity&&(j.areaOpacity=p.opacity),A&&(j.data=A);break;case"point":case"circle":case"square":(null==x?void 0:x.field)?(C="BubbleChart",j.sizeBy=x.field,(null===(s=x.scale)||void 0===s?void 0:s.range)&&(j.sizeRange=x.scale.range)):C="Scatterplot",_d(m,v,j,O,M),A&&(j.data=A);break;case"rect":C="Heatmap",(null==m?void 0:m.field)&&(j.xAccessor=m.field),(null==v?void 0:v.field)&&(j.yAccessor=v.field),(null==b?void 0:b.field)&&(j.valueAccessor=b.field,delete j.colorBy),(null===(a=null==m?void 0:m.axis)||void 0===a?void 0:a.title)&&(j.xLabel=m.axis.title),(null===(l=null==v?void 0:v.axis)||void 0===l?void 0:l.title)&&(j.yLabel=v.axis.title),A&&(j.data=A);break;case"arc":p.innerRadius&&p.innerRadius>0?(C="DonutChart",j.innerRadius=p.innerRadius):C="PieChart",(null==k?void 0:k.field)?j.valueAccessor=k.field:(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field),(null==b?void 0:b.field)&&(j.categoryAccessor=b.field),(null==m?void 0:m.field)&&!(null==k?void 0:k.field)&&(j.categoryAccessor=m.field),A&&(j.data=A);break;case"tick":C="DotPlot",jd(null==m?void 0:m.type)?(j.categoryAccessor=m.field,(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field),(null===(c=null==m?void 0:m.axis)||void 0===c?void 0:c.title)&&(j.categoryLabel=m.axis.title),(null===(u=null==v?void 0:v.axis)||void 0===u?void 0:u.title)&&(j.valueLabel=v.axis.title)):jd(null==v?void 0:v.type)?(j.categoryAccessor=v.field,(null==m?void 0:m.field)&&(j.valueAccessor=O?"value":m.field),j.orientation="horizontal",(null===(d=null==v?void 0:v.axis)||void 0===d?void 0:d.title)&&(j.categoryLabel=v.axis.title),(null===(h=null==m?void 0:m.axis)||void 0===h?void 0:h.title)&&(j.valueLabel=m.axis.title)):((null==m?void 0:m.field)&&(j.categoryAccessor=m.field),(null==v?void 0:v.field)&&(j.valueAccessor=M?"value":v.field)),A&&(j.data=A);break;default:g.push(`Unsupported mark type "${f}". Defaulting to Scatterplot.`),C="Scatterplot",_d(m,v,j,O,M),A&&(j.data=A)}return Pd(C,j,g)},exports.lightenColor=cd,exports.normalizeTooltip=Zn,exports.resolveThemePreset=Ka,exports.serializeSelections=function(e){const t={};for(const[o,n]of e){const e=[];for(const[,t]of n.clauses){const o={};for(const[e,n]of Object.entries(t.fields))o[e]="point"===n.type?{type:"point",values:Array.from(n.values)}:{type:"interval",range:n.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:n.name,resolution:n.resolution,clauses:e}}return t},exports.smartTickFormat=function(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"},exports.themeToCSS=function(e,t=":root"){var o,n,i,r,s;const a=[];return a.push(` --semiotic-bg: ${e.colors.background};`),a.push(` --semiotic-text: ${e.colors.text};`),a.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),a.push(` --semiotic-grid: ${e.colors.grid};`),a.push(` --semiotic-border: ${e.colors.border};`),a.push(` --semiotic-primary: ${e.colors.primary};`),a.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&a.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&a.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&a.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&a.push(` --semiotic-diverging: ${e.colors.diverging};`),(null===(o=e.tooltip)||void 0===o?void 0:o.background)&&a.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),(null===(n=e.tooltip)||void 0===n?void 0:n.text)&&a.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),(null===(i=e.tooltip)||void 0===i?void 0:i.borderRadius)&&a.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),(null===(r=e.tooltip)||void 0===r?void 0:r.fontSize)&&a.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),(null===(s=e.tooltip)||void 0===s?void 0:s.shadow)&&a.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&a.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&a.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&a.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&a.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&a.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&a.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&a.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),a.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),a.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&a.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&a.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&a.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&a.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&a.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${a.join("\n")}\n}`},exports.themeToTokens=function(e){var t,o,n,i,r,s;return{semiotic:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:(null===(t=e.tooltip)||void 0===t?void 0:t.background)||e.colors.background,$type:"color"},text:{$value:(null===(o=e.tooltip)||void 0===o?void 0:o.text)||e.colors.text,$type:"color"},radius:{$value:(null===(n=e.tooltip)||void 0===n?void 0:n.borderRadius)||"6px",$type:"dimension"},"font-size":{$value:(null===(i=e.tooltip)||void 0===i?void 0:i.fontSize)||"14px",$type:"dimension"},shadow:{$value:(null===(r=e.tooltip)||void 0===r?void 0:r.shadow)||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:null!==(s=e.colors.selectionOpacity)&&void 0!==s?s:.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"}},e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{}),e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{}),null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{}),null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{}),null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{}),null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{}),null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{}),{secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"}}),e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{}),e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{}),e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{}),e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{}),e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{})}},exports.toConfig=function(e,t,o){if(!vd[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(vd).join(", ")}`);const n=!1!==(null==o?void 0:o.includeData),i={};for(const[e,o]of Object.entries(t))null!=o&&(bd.has(e)||!n&&xd.has(e)||"function"!=typeof o&&((null==o?void 0:o.$$typeof)||(i[e]=kd(o))));return Object.assign({component:e,props:i,version:"1",createdAt:(new Date).toISOString()},(null==o?void 0:o.selections)?{selections:o.selections}:{})},exports.toURL=function(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},exports.useBrushSelection=Ba,exports.useCategoryColors=Sa,exports.useChartObserver=Ea,exports.useFilteredData=function(e,o,n){const i=Pa(e=>e.selections.get(o));return t.useMemo(()=>{if(!i||0===i.clauses.size)return e;const t=Ma(i,n);return e.filter(t)},[e,i,n])},exports.useLinkedHover=Ra,exports.useNavigationSync=function(e){var o;const{tree:n,chartId:i,observe:r=["hover","click"]}=e,s=null!==(o=e.selectionName)&&void 0!==o?o:"__semiotic-nav-sync"+(i?":"+i:""),a=t.useMemo(()=>{if(e.matchFields)return e.matchFields;const t=gh(n);return t?Object.keys(t).filter(e=>{return!e.startsWith("_")&&(null==(o=t[e])||"string"==typeof o||"number"==typeof o||"boolean"==typeof o);var o}):[]},[e.matchFields,n]),l=t.useMemo(()=>{const e=new Map,t=o=>{var n;if("datum"===o.role&&o.datum){const t=fh(o.datum,a);e.has(t)||e.set(t,o.id)}for(const e of null!==(n=o.children)&&void 0!==n?n:[])t(e)};return t(n),e},[n,a]),{selectPoints:c,clear:u}=$a({name:s}),{latest:d}=Ea({chartId:i,types:[...r,"hover-end"],limit:1}),[h,g]=t.useState(n.id);t.useEffect(()=>{g(n.id),u()},[n,u]);const f=t.useCallback(e=>{if(g(e.id),"datum"===e.role&&e.datum&&a.length>0){const t={};for(const o of a)t[o]=[e.datum[o]];c(t)}else u()},[a,c,u]),p=e.annotations,y=t.useMemo(()=>{const e=new Set;if(0===a.length||!p)return e;for(const t of p){const o=l.get(fh(t,a));o&&e.add(o)}return e},[p,l,a]),m=t.useCallback(e=>{const t="number"==typeof e?null==p?void 0:p[e]:e;if(!t||0===a.length)return!1;const o=l.get(fh(t,a));if(!o)return!1;g(o);const n={};for(const e of a)n[e]=[t[e]];return c(n),!0},[p,l,a,c]),v=t.useRef(null);return t.useEffect(()=>{if(!d||d===v.current)return;if(v.current=d,"hover-end"===d.type)return;const e=d.datum;if(!e||0===a.length)return;const t=l.get(fh(e,a));t&&t!==h&&g(t)},[d,l,a,h]),{activeId:h,onActiveChange:f,selection:{name:s},annotatedIds:y,focusAnnotation:m}},exports.useSelection=$a,exports.useSelectionActions=function(e,o){const n=t.useId(),i=o||n,r=Pa(e=>e.setClause),s=Pa(e=>e.clearClause);return{selectPoints:t.useCallback(t=>{const o={};for(const[e,n]of Object.entries(t))o[e]={type:"point",values:new Set(n)};r(e,{clientId:i,type:"point",fields:o})},[e,i,r]),clear:t.useCallback(()=>s(e,i),[e,i,s]),clientId:i}},exports.useTheme=nl;
|
|
2
|
+
"use strict";var e=Object.create,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,o)=>function(){if(o)throw o[0];try{return e&&(t=(0,e[r(e)[0]])(e=0)),t}catch(e){throw o=[e],e}},a=(e,o)=>{for(var r in o)t(e,r,{get:o[r],enumerable:!0})},l=(e,n,s,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let l of r(n))i.call(e,l)||l===s||t(e,l,{get:()=>n[l],enumerable:!(a=o(n,l))||a.enumerable});return e},c=(o,r,i)=>(i=null!=o?e(n(o)):{},l(!r&&o&&o.__esModule?i:t(i,"default",{value:o,enumerable:!0}),o));function u(e){let t=1/0,o=-1/0;for(const r of e)t>r&&(t=r),r>o&&(o=r);return[t,o]}function d(e,t=-1/0){let o=t;for(const t of e)t>o&&(o=t);return o}var h=s({"src/components/charts/shared/minMax.ts"(){}});function p(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const r=Math.round(parseInt(o[1],16)*(1-t)),n=Math.round(parseInt(o[2],16)*(1-t)),i=Math.round(parseInt(o[3],16)*(1-t));return`#${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function f(e,t=.5){const o=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!o)return e;const r=Math.round(parseInt(o[1],16)+(255-parseInt(o[1],16))*t),n=Math.round(parseInt(o[2],16)+(255-parseInt(o[2],16))*t),i=Math.round(parseInt(o[3],16)+(255-parseInt(o[3],16))*t);return`#${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var g,m,y=s({"src/components/charts/shared/colorManipulation.ts"(){}}),b={};function v(e,t,o,r){const n=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!n&&!i)return;const s="object"==typeof n?n:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const o of e){const e=t(o);null!=e&&Number.isFinite(e)&&(o[m]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=o(e),n=r(e);return null!=t&&null!=n&&Number.isFinite(t)&&Number.isFinite(n)?Math.abs(t-n):NaN}),d=c.filter(e=>Number.isFinite(e));if(0===d.length)return;const[h,p]=u(d),f=p-h;e.forEach((e,t)=>{const o=c[t];Number.isFinite(o)&&(e[m]=l-(f>0?(o-h)/f:0)*(l-a))})}function x(e,t){return"function"==typeof t?t(e):!!e[t]}function k(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function w(e,t,o,r,n){return(i=r).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,o,r,n){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:d=.15,anomalyColor:h="#ef4444",anomalyRadius:p=6,label:f}=r,m=e.map(e=>{let t="observed";return s&&x(e,s)?t="forecast":i&&x(e,i)&&(t="training"),{...e,[g]:t}}),y=r._groupBy,b=[];if(y){const e=new Map;for(const t of m){const o=t[y]??"__default";e.has(o)||e.set(o,[]),e.get(o).push(t)}const t=[];for(const[,o]of e)for(let e=0;o.length-1>e;e++)o[e][g]!==o[e+1][g]&&(t.push({...o[e+1],[g]:o[e][g]}),t.push({...o[e],[g]:o[e+1][g]}));b.push(...m,...t)}else for(let e=0;m.length>e;e++)b.push(m[e]),m.length-1>e&&m[e][g]!==m[e+1][g]&&(b.push({...m[e+1],[g]:m[e][g]}),b.push({...m[e],[g]:m[e+1][g]}));if(r.trainUnderline){const e=[];for(const t of b)"training"===t[g]&&e.push({...t,[g]:"training-base"});b.unshift(...e)}const k=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const o of b)"function"==typeof l&&(o[e]=l(o)),"function"==typeof c&&(o[t]=c(o));k.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:d,label:f})}if(r.uncertaintyOpacity||r.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};v(b.filter(e=>"forecast"===e[g]),r,e,t)}if(a){const e=r.anomalyStyle,t={type:"highlight",filter:e=>x(e,a)};e?(t.style=e,t.r=p):"function"==typeof h?(t.style=e=>{const t=h(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=p):(t.color=h,t.r=p,t.style={stroke:h,strokeWidth:1.5,fill:h,fillOpacity:.7}),k.push(t)}return n&&k.push({type:"anomaly-band",threshold:n.threshold??2,showBand:!1!==n.showBand,fill:n.bandColor||"#6366f1",fillOpacity:n.bandOpacity??.1,anomalyColor:n.anomalyColor||"#ef4444",anomalyRadius:n.anomalyRadius??6,label:n.label}),{processedData:b,annotations:k}}(e,0,0,r,n):function(e,t,o,r,n){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=r;if(null==i)return{processedData:e,annotations:[]};const h=[],p=[];for(const o of e)o[t]>i?p.push({...o,[g]:"observed"}):h.push({...o,[g]:"training"});const f=h.map(e=>[e[t],e[o]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],y=[];if(f.length>=3){const n=f.length;let i=0,h=0,p=0,b=0;for(const[e,t]of f)i+=e,h+=t,p+=e*e,b+=e*t;const x=n*p-i*i;if(Math.abs(x)>1e-12){const p=(n*b-i*h)/x,k=(h-p*i)/n,w=e=>k+p*e,S=f.map(([e,t])=>t-w(e)).reduce((e,t)=>e+t*t,0),A=Math.sqrt(S/Math.max(n-2,1)),C=f.reduce((e,t)=>e+t[0],0)/n,M=f.reduce((e,t)=>e+(t[0]-C)**2,0),j=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,P=d(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),_=f.length>1?(f[n-1][0]-f[0][0])/(n-1):1;for(let e=1;s>=e;e++){const r=P+e*_,i=w(r),s=A*Math.sqrt(1+1/n+(M>0?(r-C)**2/M:0))*j;y.push({[t]:r,[o]:i,[g]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}v(y,r,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}m.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),n&&m.push({type:"anomaly-band",threshold:n.threshold??2,showBand:!1!==n.showBand,fill:n.bandColor||"#6366f1",fillOpacity:n.bandOpacity??.1,anomalyColor:n.anomalyColor||"#ef4444",anomalyRadius:n.anomalyRadius??6,label:n.label});const b=[];if(b.push(...h),h.length>0&&p.length>0&&b.push({...h[h.length-1],[g]:"observed"}),b.push(...p),y.length>0){const e=p.length>0?p[p.length-1]:h[h.length-1];e&&b.push({...e,[g]:"forecast"}),b.push(...y)}return{processedData:b,annotations:m}}(e,t,o,r,n);var i}function S(e,t){const o=t.trainDasharray??"8,4",r=t.forecastDasharray??"4,4",n=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),d=t[g];if("training"===d){let e=u.stroke;return"darken"===a?e=p(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:o,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===d){let e=u.stroke||"#666";return"lighten"===c&&(e=f(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===d){const e=t[m],o=null!=e?e:s;return{...u,stroke:n,strokeDasharray:r,...null!=o&&{strokeOpacity:o}}}return u}}a(b,{FORECAST_OPACITY_FIELD:()=>m,SEGMENT_FIELD:()=>g,buildAnomalyAnnotations:()=>k,buildForecast:()=>w,createSegmentLineStyle:()=>S,darkenColor:()=>p,lightenColor:()=>f,stampForecastOpacity:()=>v});var A,C=s({"src/components/charts/shared/statisticalOverlays.ts"(){h(),y(),y(),g="__forecastSegment",m="__forecastOpacity"}}),M={};a(M,{AccessibleNavTree:()=>gx,AreaChart:()=>cf,BarChart:()=>Cg,BoxPlot:()=>Jg,BubbleChart:()=>Sf,CARBON_ALERT:()=>Oh,CARBON_CATEGORICAL_14:()=>Hh,COLOR_BLIND_SAFE_CATEGORICAL:()=>X,CandlestickChart:()=>sg,CategoryColorProvider:()=>eh,ChartContainer:()=>tk,ChartErrorBoundary:()=>rd,ChartGrid:()=>gk,ChordDiagram:()=>Xm,CirclePack:()=>Cy,CircularBrush:()=>Mk,ConnectedScatterplot:()=>Kp,ContextLayout:()=>bk,DARK_THEME:()=>K,DetailsPanel:()=>Nk,DifferenceChart:()=>pf,DirectManipulationControl:()=>Rk,DonutChart:()=>km,DotPlot:()=>gm,ForceDirectedGraph:()=>Ym,FunnelChart:()=>hm,GaugeChart:()=>Lm,GroupedBarChart:()=>Im,HIGH_CONTRAST_THEME:()=>Q,Heatmap:()=>xf,Histogram:()=>rm,IncrementalExtent:()=>oe,IntentMark:()=>Qk,LIGHT_THEME:()=>U,LikertChart:()=>Wg,LineChart:()=>of,LinkedCharts:()=>Ih,MinimapChart:()=>Wf,MobileAnnotationCalloutList:()=>aw,MobileChartContainer:()=>ik,MobileStandardControls:()=>Px,MultiAxisLineChart:()=>og,MultiLineTooltip:()=>Ns,NetworkCustomChart:()=>gg,OrbitDiagram:()=>_y,OrdinalCustomChart:()=>bg,PieChart:()=>bm,ProcessSankey:()=>my,QuadrantChart:()=>Xf,RealtimeHeatmap:()=>yb,RealtimeHistogram:()=>sb,RealtimeLineChart:()=>ob,RealtimeSwarmChart:()=>db,RealtimeTemporalHistogram:()=>lb,RealtimeWaterfallChart:()=>fb,RidgelinePlot:()=>cm,RingBuffer:()=>te,SankeyDiagram:()=>Qm,Scatterplot:()=>Gp,ScatterplotMatrix:()=>Bf,SmallMultipleChart:()=>hk,StackedAreaChart:()=>mf,StackedBarChart:()=>Pg,StreamNetworkFrame:()=>qd,StreamOrdinalFrame:()=>sc,StreamXYFrame:()=>Ka,SwarmPlot:()=>Xg,SwimlaneChart:()=>Fm,THEME_PRESETS:()=>Wh,TemporalHistogram:()=>ab,ThemeProvider:()=>Qh,Tooltip:()=>$s,TreeDiagram:()=>vy,Treemap:()=>wy,VISUALIZATION_CONTROL_TYPES:()=>Fb,ViolinPlot:()=>sm,XYCustomChart:()=>hg,adaptiveTimeTicks:()=>Ab,auditVisualizationControls:()=>Eb,buildNavigationTree:()=>Zv,clampMobileRange:()=>bx,compileMotionEncoding:()=>Je,configToJSX:()=>lv,copyConfig:()=>av,createControlObservationAdapter:()=>Bb,createHatchPattern:()=>Gl,darkenColor:()=>p,deriveMotionVector:()=>rt,deserializeSelections:()=>uv,exportChart:()=>Cb,fromConfig:()=>nv,fromURL:()=>sv,fromVegaLite:()=>yv,intentManifestFromRecipe:()=>Uk,lightenColor:()=>f,normalizeTooltip:()=>Bs,opacityFromAge:()=>tt,resolveMotionAccessor:()=>Ze,resolveMotionAge:()=>et,resolveMotionVector:()=>ot,resolveResponsiveRules:()=>tp,resolveThemePreset:()=>qh,responsiveRuleMatches:()=>ep,serializeSelections:()=>cv,smartTickFormat:()=>bb,smartTooltipEntries:()=>_s,summarizeIntentManifest:()=>Xk,syncPushBuffer:()=>nw,themeToCSS:()=>Eh,themeToTokens:()=>zh,toConfig:()=>rv,toURL:()=>iv,useBrushSelection:()=>mh,useCategoryColors:()=>th,useChartObserver:()=>xh,useCustomLayoutSelection:()=>mo,useFilteredData:()=>bh,useForceLayout:()=>Gk,useLinkedChartsActive:()=>Ah,useLinkedHover:()=>fh,useMobileRangeControls:()=>xx,useNavigationSync:()=>ow,useSelection:()=>hh,useSelectionActions:()=>ph,useSyncedPushData:()=>iw,useTheme:()=>Zh,zoomMobileRange:()=>vx}),module.exports=(A=M,l(t({},"__esModule",{value:!0}),A));var j=c(require("react")),P=require("react"),_=require("react"),L=require("d3-selection"),R=require("d3-brush"),T=c(require("react"));function I({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:o}={}){const r=T.useId().replace(/:/g,""),n=T.useRef(o);return n.current=o,{description:t,descriptionId:"semiotic-brush-description-"+r,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+r,onKeyDown:T.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),n.current?.(t))},[])}}}var $=require("react/jsx-runtime");function N(e,t,o,r){const[n,i]=[Math.min(...t),Math.max(...t)],s=(i-n)/20;let[a,l]=e;if(r)0>o?a=Math.max(n,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(n,Math.min(i-e,a+o*s)),l=a+e}return[a,l]}function F(e,t){let o=0,r=t.length-1;for(;r>o;){const n=o+r+1>>1;t[n]>e?r=n-1:o=n}return t[o]}function B(e,t){let o=0,r=t.length-1;for(;r>o;){const n=o+r>>1;e>t[n]?o=n+1:r=n}return t[o]}function D({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:d,streaming:h}){const p=(0,_.useRef)(null),f=(0,_.useRef)(null),g=(0,_.useRef)(a);g.current=a;const m=(0,_.useRef)(s);m.current=s;const y=(0,_.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),b=(0,_.useRef)(y);b.current=y;const v=(0,_.useRef)(!1),x=(0,_.useRef)(null),k=I({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=m.current,o=f.current;if(!t||!o||!p.current)return;const r=(0,L.select)(p.current).select(".brush-g");if("clear"===e.type)return v.current=!0,r.call(o.move,null),v.current=!1,x.current=null,void g.current(null);const n=t.x.domain(),s=t.y.domain(),a=x.current;let l=a?.x??[n[0]+.4*(n[1]-n[0]),n[0]+.6*(n[1]-n[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,d="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=N(l,n,d,e.resize)),u||"x"===i||(c=N(c,s,d,e.resize)),u&&"y"===i||!u&&"x"===i)return;const h={x:l,y:c};v.current=!0,r.call(o.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),v.current=!1,x.current=h,g.current(h)}});return(0,_.useEffect)(()=>{if(!p.current)return;const o=(0,L.select)(p.current).select(".brush-g"),r="x"===i?(0,R.brushX)():"y"===i?(0,R.brushY)():(0,R.brush)();return r.extent([[0,0],[e,t]]),r.on("brush end",n=>{if(v.current)return;const s=m.current;if(!s)return;if(!n.selection)return x.current=null,void g.current(null);let a,u;if("x"===i){const[e,o]=n.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,o]=n.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(o),s.y.invert(t)]}else{const[[e,t],[o,r]]=n.selection;a=[s.x.invert(e),s.x.invert(o)],u=[s.y.invert(r),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===n.type||"brush"===n.type&&d)){const e=b.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[F(e[0],t),B(e[1],t)]}(a,e):l&&l>0&&(a=[Math.floor(a[0]/l)*l,Math.ceil(a[1]/l)*l]);const t=s.x(a[0]),c=s.x(a[1]);if(v.current=!0,"x"===i)o.call(r.move,[t,c]);else if("xy"===i){const e=n.selection;o.call(r.move,[[t,e[0][1]],[c,e[1][1]]])}v.current=!1}const h={x:a,y:u};x.current=h,g.current(h)}),o.call(r),f.current=r,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null),f.current=null}},[e,t,i,c,l,d]),(0,_.useEffect)(()=>{if(!(h&&s&&f.current&&x.current))return;if(!p.current)return;if("y"===i)return;const e=x.current,t=s.x.domain()[0],o=(0,L.select)(p.current).select(".brush-g");if(t>=e.x[1])return v.current=!0,o.call(f.current.move,null),v.current=!1,x.current=null,void g.current(null);let r=e.x[0],n=!1;if(t>e.x[0]){if(r=t,"bin"===c){const e=b.current;e&&e.length>0?r=B(t,e):l&&l>0&&(r=Math.ceil(t/l)*l)}if(r>=e.x[1])return v.current=!0,o.call(f.current.move,null),v.current=!1,x.current=null,void g.current(null);n=!0}const a=s.x(r),u=s.x(e.x[1]);if(v.current=!0,"x"===i)o.call(f.current.move,[a,u]);else{const t=s.y(e.y[1]),r=s.y(e.y[0]);o.call(f.current.move,[[a,t],[u,r]])}if(v.current=!1,n){const t={x:[r,e.x[1]],y:e.y};x.current=t,g.current(t)}},[s,h,i,c,l]),(0,$.jsxs)("svg",{ref:p,width:o,height:r,...k.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,$.jsx)("title",{children:k.svgProps["aria-label"]}),(0,$.jsx)("desc",{id:k.descriptionId,children:k.description}),(0,$.jsx)("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`})]})}var E=Object.freeze([]);function z(e){if(!e)return E;let t=!1;for(let o=0;e.length>o;o++){const r=e[o];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const o=[];for(const t of e)null!=t&&"object"==typeof t&&o.push(t);return o}var H=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=z(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(e){if(e=z(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const o=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,r),bounded:!1}),t=r,this.chunkTimer=e.length>t?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let o=0;e.length>o;o++){const r=e[o];null!=r&&"object"==typeof r&&(this.pushBuffer.push(r),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},O=require("react"),W=require("react/jsx-runtime");function q(e){let t=null;const o=()=>(t||(t=(0,O.createContext)(null)),t),r=Y(e);return[function({children:t,initialState:r}){const n=(0,O.useRef)(r),i=(0,O.useMemo)(()=>Y(e,n.current),[]),s=o();return(0,W.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const n=o(),i=(0,O.useContext)(n)??r,s=(0,O.useRef)(e);s.current=e;const a=(0,O.useRef)({hasValue:!1,value:void 0}),l=(0,O.useCallback)(()=>{const e=s.current(i.getState()),o=a.current;return o.hasValue&&t&&t(o.value,e)?o.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,O.useCallback)(()=>s.current(i.getState()),[i]);return(0,O.useSyncExternalStore)(i.subscribe,l,c)}]}function Y(e,t){const o=new Set;let r={...e(function(e){const t=e(r);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){r={...r,...t};for(const e of o)e()}}),...t??{}};return{getState:()=>r,subscribe:function(e){return o.add(e),()=>{o.delete(e)}}}}function G(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function V(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:X}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var X=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],U={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},K={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Q={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:X,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Z(e,t){if("light"===t)return U;if("dark"===t)return K;if("high-contrast"===t)return Q;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?K:U;return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return V({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[J,ee]=q(e=>({theme:U,setTheme(t){e(e=>({theme:Z(e.theme,t)}))}})),te=class{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;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e(this.buffer[(t+o)%this._capacity],o)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let o=0;this._size>o;o++)e[o]=this.buffer[(t+o)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let o=0,r=[];t.length>e&&(o=t.length-e,r=t.slice(0,o)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=o;t.length>e;e++)this.push(t[e]);return r}update(e,t){const o=[],r=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++){const i=(r+n)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},o.push(e),this.buffer[i]=t(s)}}return o}remove(e){const t=[],o=[];if(this.forEach(r=>{e(r)?o.push(r):t.push(r)}),0===o.length)return o;this.buffer=Array(this._capacity),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}},oe=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(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.isFinite(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 re(e,t){return e===t}function ne(e,t){if("function"==typeof e)return t=>+e(t);const o=e||t;return e=>+e[o]}function ie(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function se(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var ae=/^\d{4}-\d{1,2}$/;function le(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const o=ae.test(t)?t+"-01":t;if(o===t&&10>t.length)return NaN;const r=Date.parse(o);return Number.isFinite(r)?r:NaN}function ce(e){return e instanceof Date?e.getTime():"string"==typeof e?le(e):+e}function ue(e){return new Set(Array.isArray(e)?e:[e])}var de=require("d3-scale");function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function pe(e,t,o){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(o)}`}function fe(e){const t=e.map(he),o=t.length-1;return e=>{if(0>=e){const[e,o,r]=t[0];return pe(e,o,r)}if(e>=1){const[e,r,n]=t[o];return pe(e,r,n)}const r=e*o,n=Math.floor(r),i=r-n,[s,a,l]=t[n],[c,u,d]=t[n+1];return pe(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(d-l)*i))}}var ge=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],me=fe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),ye=fe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),be=fe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ve=fe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),xe=fe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ke=fe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),we=fe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),Se=fe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ae=fe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Ce=fe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Me=fe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),je=fe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),Pe={blues:me,reds:ye,greens:be,viridis:we,oranges:ve,purples:xe,greys:ke,plasma:Se,inferno:Ae,magma:Ce,cividis:Me,turbo:je};function _e(e){return e&&Pe[e]||me}var Le=fe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Re=fe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),Te=fe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Ie=fe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),$e=fe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ne=fe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Fe=fe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Be={category10:ge,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...Pe},De=ge,Ee=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ze=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],He=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Oe(e,t,o){if("function"==typeof t){const r=t(e);return o&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||He.has(t)}(r)?o(r):r}const r=e?.[t]+"";return o?o(r):De[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)}(r))%De.length]}function We(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const o=e[t];return"string"==typeof o&&o.length>0?o:void 0}function qe(e,t,o="category10"){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o;return t=>We(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),n=r.every(e=>!isNaN(Number(e)));if(Array.isArray(o))return(0,de.scaleOrdinal)().domain(r).range(o).unknown("#999");const i=Be[o]||Be.category10;if(n&&"function"==typeof i){let e=-1/0;for(const t of r){const o=Number(t);o>e&&(e=o)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:De;return(0,de.scaleOrdinal)().domain(r).range(e).unknown("#999")}}function Ye(e,t,o=[3,20],r){let n;if(n="function"==typeof t?t(e):e?.[t],!r)return n;const[i,s]=r,[a,l]=o;if(s===i)return(a+l)/2;let c=(n-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Ge(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Ve(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Xe(e,t,o){return e+(t-e)*o}function Ue(){return"undefined"!=typeof performance?performance.now():Date.now()}var Ke={fresh:1,aging:1.5,stale:3};function Qe(e,t,o={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(o.fresh??Ke.fresh)>e?"fresh":t*(o.aging??Ke.aging)>e?"aging":t*(o.stale??Ke.stale)>e?"stale":"expired":"fresh"}function Ze(e,t,o){if(null!=e)return"function"==typeof e?e(t,o):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function Je(e){const{data:t,encoding:o}=e,r=[],n=new Map;return t.forEach((e,t)=>{const i=Ze(o.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const s=i+"";if(n.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=Ze(o.process?.group,e,t),l=Ze(o.process?.stage,e,t),c=Ze(o.accessible?.group,e,t)??(null!=a?a+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(o.evidence??{}))u[r]=Ze(o.evidence?.[r],e,t);const d={id:s,datum:e,time:{arrival:Ze(o.time?.arrival,e,t),basis:o.time?.basis,unit:o.time?.unit},placement:{x:Ze(o.placement?.x,e,t),y:Ze(o.placement?.y,e,t),lane:Ze(o.placement?.lane,e,t),space:o.placement?.space},kinematics:{velocityX:Ze(o.kinematics?.velocityX,e,t),velocityY:Ze(o.kinematics?.velocityY,e,t),space:o.kinematics?.space},process:{group:a,stage:l,target:Ze(o.process?.target,e,t),work:Ze(o.process?.work,e,t)},evidence:u,accessible:{description:Ze(o.accessible?.description,e,t),group:c,label:Ze(o.accessible?.label,e,t)??s}};r.push(d),n.set(s,d)}),{rows:r,byId:n}}function et(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:Qe(t,e.ttl,e.thresholds)}}function tt(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const o=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>o?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,o/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-o/e.extent))*(1-t)}function ot(e,t){const o=Number.isFinite(e)?e:0,r=Number.isFinite(t)?t:0;return{velocityX:o,velocityY:r,speed:Math.hypot(o,r),direction:Math.atan2(r,o)}}function rt(e,t,o){return Number.isFinite(o)&&o>0?ot((t.x-e.x)/o,(t.y-e.y)/o):ot(0,0)}function nt(e,t,o){if(1>=o)return 1;const r=o-1;return tt({age:r-t,extent:r,type:e.type,halfLife:e.halfLife??o/2,threshold:e.stepThreshold??.5*o,minOpacity:e.minOpacity??.1})}function it(e){const t=new Map;for(let o=0;e.length>o;o++)t.set(e[o],o);return t}function st(e,t,o){const r=e.duration??500,n=o-t;return r>n?1-n/r:0}function at(e,t,o,r){let n=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,n=!0),e._pulseColor!==o&&(e._pulseColor=o,n=!0),e._pulseGlowRadius!==r&&(e._pulseGlowRadius=r,n=!0),n):(0!==e._pulseIntensity&&(e._pulseIntensity=0,n=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,n=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,n=!0),n)}function lt(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const r=e.duration??500,n=t.peek();return null!=n&&r>o-n}function ct(e,t,o){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const o=e.getX(t.datum),r=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${o}:${r}`;if(null!=o&&null!=r)return`p:${o}:${r}`}return"p:"+o;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+o;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??o}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+o:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function ut(e,t,o,r,n,i){const s=[];for(const n of e){const e=o(n),i=r(n);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:n})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:n,datum:c,group:i}}function dt(e,t,o,r,n,i,s,a){const l=[];for(const i of e){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):n;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function ht(e,t,o,r){const n=new Map;if("silhouette"===r)for(const r of e){let e=0;for(const n of t)e+=o(n,r)||0;n.set(r,-e/2)}else if("wiggle"===r){e.length>0&&n.set(e[0],0);for(let r=1;e.length>r;r++){const i=e[r-1],s=e[r];let a=0,l=0,c=0;for(const e of t){const t=o(e,s)||0;a+=(2*c+t)*(t-(o(e,i)||0)),l+=t,c+=t}const u=n.get(i)??0;n.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let r=0;for(const i of e){let e=0;for(const r of t)e+=o(r,i)||0;r+=(n.get(i)??0)+e/2}const i=r/e.length;for(const t of e)n.set(t,(n.get(t)??0)-i)}}else for(const t of e)n.set(t,0);return n}function pt(e,t,o,r,n,i,s){const a=o(e),l=r(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:n,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function ft(e,t,o,r,n,i,s,a){const l=o(e),c=r(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:n,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function gt(e,t,o,r,n,i,s){return{type:"rect",x:e,y:t,w:o,h:r,style:n,datum:i,group:s}}function mt(e,t,o,r,n,i,s){const a={type:"heatcell",x:e,y:t,w:o,h:r,fill:n,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function yt(e,t,o,r){return"function"==typeof t.style?t.style(r||{},o):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(o,r)}function bt(e,t,o,r){if(!e.scales)return null;const n=[],i=[];for(const o of t){const t=e.getX(o);if(!Number.isFinite(t))continue;const s=r.getTop(o),a=r.getBottom(o);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(n.push([l,c]),i.push([l,u]))}return 2>n.length?null:{type:"area",topPath:n,bottomPath:i,style:yt(e,r,o,t[0]),datum:t,group:o,interactive:r.interactive}}function vt(e){const t=[],o=[];if(!e)return{perSeries:t,aggregate:o};for(const r of e)r.perSeries?t.push(r):o.push(r);return{perSeries:t,aggregate:o}}function xt(e,t,o){const r=[];for(const n of o){const o=bt(e,t,"__ribbon_aggregate",n);o&&r.push(o)}return r}function kt(e,t,o,r){const n=[];for(const i of r){const r=bt(e,t,o,i);r&&n.push(r)}return n}function wt(e,t){if(!e)return{};if(!t||0===t.length)return e;const o=[];for(const r of t){if("band"!==r.kind)continue;const t=r.getTop(e),n=r.getBottom(e);Number.isFinite(n)&&Number.isFinite(t)&&o.push({y0:n,y1:t})}return 0===o.length?e:{...e,band:o[0],bands:o}}function St(e,t,o,r){if(!e.config.pointStyle)return;const n=r??e.getY;for(const r of t){const t=e.resolveGroupColor(r.key);for(const i of r.data){let r=e.config.pointStyle(i);!r.fill&&t&&(r={...r,fill:t});const s=r.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=pt(i,e.scales,e.getX,n,s,r,a);l&&o.push(l)}}}var At={topOpacity:.8,bottomOpacity:.05};function Ct(e){if(e)return!0===e?At:"colorStops"in e?e:{topOpacity:e.topOpacity??At.topOpacity,bottomOpacity:e.bottomOpacity??At.bottomOpacity}}var Mt=require("d3-shape"),jt={circle:Mt.symbolCircle,square:Mt.symbolSquare,triangle:Mt.symbolTriangle,diamond:Mt.symbolDiamond,star:Mt.symbolStar,cross:Mt.symbolCross,wye:Mt.symbolWye},Pt=["circle","triangle","diamond","star","square","chevron","cross","wye"];function _t(e,t,o){if(o)return o;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*Lt(e),o=.92*t;return`M0,${-t}L${o},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-o},${(.78*t).toFixed(3)}Z`}(t):(0,Mt.symbol)(jt[r]??Mt.symbolCircle,Math.max(1,t))()??""}function Lt(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var Rt=new Map;function Tt(e,t,o,r,n){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/r)*r;let c=i.get(l);if(c||(c={start:l,end:l+r,total:0,categories:new Map},i.set(l,c)),c.total+=a,n){const e=n(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function It(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:o,overlays:r,warned:n}=e;$t(r)&&0===o.length&&Nt(n,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),o.length>0&&o.every(e=>null==e.datum)&&Nt(n,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function $t(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some($t))}function Nt(e,t,o){e.has(t)||(e.add(t),console.warn(o))}function Ft(e,t,o,r){const n=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${n.message}`,error:n,recovery:o?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:o,affectedRevision:r}}function Bt(e,t){const o="function"==typeof e?e:o=>o[e||t];return e=>{const t=o(e);return null==t?NaN:+t}}function Dt(e){const t=[],o=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,r=Bt(o&&e.valueAccessor||e.yAccessor,o?"value":"y");if(e.boundsAccessor){const o=ne(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const n=o(e);return Number.isFinite(n)&&0!==n?t+n:t},getBottom:e=>{const t=r(e);if(!Number.isFinite(t))return NaN;const n=o(e);return Number.isFinite(n)&&0!==n?t-n:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const o=Array.isArray(e.band)?e.band:[e.band];for(const e of o)t.push({kind:"band",getTop:Bt(e.y1Accessor,"y1"),getBottom:Bt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var Et=require("d3-scale");function zt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function Ht(e,t,o){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,Et.scaleLog)().domain(e).range(o).clamp(!0)}return"symlog"===e?(0,Et.scaleSymlog)().domain(t).range(o):"time"===e?(0,Et.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(o):(0,Et.scaleLinear)().domain(t).range(o)}function Ot(e,t,o){t>e.capacity&&(e.resize(t),o&&t>o.capacity&&o.resize(t))}function Wt(e,t){const o=new te(e.capacity);return e.forEach(()=>o.push(t)),o}function qt(e,t,o,r){const n=e.push(t);return o&&o.push(r),n}function Yt(e,t,o){if(!t||0===t.size)return;const r=new Set;if(e.forEach((e,t)=>{o(e)&&r.add(t)}),0===r.size)return;const n=t.toArray();t.clear();for(let e=0;n.length>e;e++)r.has(e)||t.push(n[e])}var Gt={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function Vt(e,t){const o={...e};for(const e of t)o[Gt[e]]++;return o}function Xt(e,t,o){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:Vt(o,r)}}var Ut=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Xt({kind:"initialize"},[],this.revisions)}get last(){return this.latest}record(e,t){const o=Xt(e,t,this.revisions);return this.revisions=o.revisions,this.latest=o,o}},Kt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qt=["scene-style","data-paint","accessibility","evidence"],Zt=new Set(["lineStyle","pointStyle","areaStyle","barStyle","swarmStyle","waterfallStyle","candlestickStyle","boundsStyle","colorScheme","themeCategorical","themeSemantic","barColors"]),Jt=class{constructor(){this.tracker=new Ut}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Kt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Qt):this.recordNoop("restyle")}recordConfig(e,t,o){return this.tracker.record({kind:"config",keys:e},t?function(e,t){const o=new Set(["layout","scene-geometry","data-paint","overlay","accessibility","evidence"]);return t&&o.add("domain"),e.some(e=>Zt.has(e))&&o.add("scene-style"),o}(e,o):[])}},eo=require("d3-quadtree"),to=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let o=0,r=0;for(const e of t)"point"===e.type&&(o++,e.r>r&&(r=e.r));if(this.maxRadius=r,500>=o)return void(this.tree=null);const n=Array(o);let i=0;for(const e of t)"point"===e.type&&(n[i++]=e);this.tree=(0,eo.quadtree)().x(e=>e.x).y(e=>e.y).addAll(n)}},oo=class e{constructor(e){if(this.xExtent=new oe,this.yExtent=new oe,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new Jt,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new to,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,o)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,r,n,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=n??(()=>{const e=new Map;for(let t=0;o.length>t;t++)e.set(o[t],t);return e})();for(const o of t){if("line"===o.type)continue;if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[o.datum];let n=0,a=!1;for(const o of t){const t=c.get(o);if(null==t)continue;a=!0;const s=r.get(t);if(null==s)continue;const l=st(e,s,i);l>n&&(n=l)}a&&(l=at(o,n,s)||l);continue}const t=c.get(o.datum);if(null==t)continue;const n=r.get(t);l=at(o,null==n?0:st(e,n,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),o),this._stylePaintPending=!1,this.config=e,this.buffer=new te(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=ne(e.timeAccessor||e.xAccessor,"time"),this.getY=ne(e.valueAccessor||e.yAccessor,"value")):(this.getX=ne(e.xAccessor,"x"),this.getY=ne(e.yAccessor,"y")),this.getGroup=se(e.groupAccessor),this.getCategory=se(e.categoryAccessor),this.getSize=e.sizeAccessor?ne(e.sizeAccessor,"size"):void 0,this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getY0=e.y0Accessor?ne(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=Dt(e),this.getPointId=se(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,o=null!=e.closeAccessor;this.getOpen=t?ne(e.openAccessor,"open"):void 0,this.getHigh=ne(e.highAccessor,"high"),this.getLow=ne(e.lowAccessor,"low"),this.getClose=o?ne(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!o}e.pulse&&(this.timestampBuffer=new te(e.windowSize))}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Wt(this.buffer,Ue())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),r=t.getBottom(e);Number.isFinite(o)&&this.yExtent.push(o),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const o=t.getTop(e),r=t.getBottom(e);Number.isFinite(o)&&this.yExtent.evict(o),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=Ue();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const o=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=o?ne(this.config.timeAccessor||this.config.xAccessor,"time"):ne(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],o=this.config.xAccessor,r="function"==typeof o?o(t):t[o||"x"],n=r instanceof Date,i="string"==typeof r&&Number.isFinite(le(r));if(this.xIsDate=n||i,i){const e="string"==typeof o?o:void 0;this.getX=e?t=>ce(t[e]):e=>ce(o(e))}}Ot(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)qt(this.buffer,o,this.timestampBuffer,t),this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o)}else for(const o of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=qt(this.buffer,o,this.timestampBuffer,t);this.xExtent.push(this.getX(o)),this.pushDatumYExtent(o),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:o}=this,r=this.scales,n=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(o,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=zt(this.xExtent.extent,t.xExtent),l=zt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const d="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&o.size>0){const e=function(e){const{config:t,groups:o,getX:r,getY:n}=e,i="exact"===t.axisExtent;if(t.normalize){const o=[0,i?1:1+t.extentPadding];return{yDomain:o,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:o}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,d=new Map;for(const e of o){const t=new Map;let o=0;for(const i of e.data){const e=r(i),s=n(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),o+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),d.set(e.key,o)}const h=t.stackOrder??"key",p=(e,t)=>t>e?-1:e>t?1:0;let f,g;if("input"===h)f=o.map(e=>e.key);else if("insideOut"===h){const e=[...o].map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:p(e,t)}),t=[],r=[];let n=0,i=0;for(const o of e)i>n?(t.push(o),n+=d.get(o)??0):(r.push(o),i+=d.get(o)??0);f=[...r.reverse(),...t]}else f="asc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(e)??0)-(d.get(t)??0);return 0!==o?o:p(e,t)}):"desc"===h?o.map(e=>e.key).sort((e,t)=>{const o=(d.get(t)??0)-(d.get(e)??0);return 0!==o?o:p(e,t)}):o.map(e=>e.key).sort(p);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),o=ht(e,f,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let r=1/0,n=-1/0;for(const t of e){const e=o.get(t)??0,i=u.get(t)??0;r>e&&(r=e),e+i>n&&(n=e+i)}Number.isFinite(r)&&Number.isFinite(n)||(r=0,n=0);const s=n-r,c=i?0:s>0?s*t.extentPadding:1;g=[r-c,n+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[o,r]=function(e,t,o){let r=0,n=0;for(const i of e){let e=0,s=0;for(const r of t){const t=o(r,i)||0;0>t?s+=t:e+=t}r>s&&(r=s),e>n&&(n=e)}return[r,n]}(e,f,(e,t)=>a.get(e)?.get(t)||0),n=r-o,s=i?0:n>0?n*t.extentPadding:1;g=[o-s,r+s]}else g=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:g,stackExtentCache:{key:s,yDomain:g}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:o.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&o.size>0?l=function(e,t,o,r,n,i,s){const[,a]=function(e,t,o,r,n){const i=Tt(e,t,o,r,n);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]}(e,t,o,r,n);return[0,s?a:a+a*i]}(o,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,d):"waterfall"===t.chartType&&!c&&o.size>0?l=function(e,t,o,r){const[n,i]=function(e,t){let o=0,r=0,n=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(n+=e,o>n&&(o=n),n>r&&(r=n))}return[o,r]}(e,t),s=i-n,a=r?0:s>0?s*o:1;return[Math.min(0,n-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(o,this.getY,t.extentPadding,d):c||l[0]===1/0||(l=function(e,t,o){if(!o.length)return e;let[r,n]=e;for(const e of t)for(const t of o){const o=t.getTop(e),i=t.getBottom(e);Number.isFinite(o)&&(r>o&&(r=o),o>n&&(n=o)),Number.isFinite(i)&&(r>i&&(r=i),i>n&&(n=i))}return[r,n]}(l,i,this.resolvedRibbons),l=function(e,t){const o=e[1]-e[0],r=t.exactMode?0:o>0?o*t.extentPadding:1,n=[null!=t.userMin?e[0]:e[0]-r,null!=t.userMax?e[1]:e[1]+r];return"log"!==t.yScaleType||n[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(n[0]=t.dataYDomain[0]/(1+t.extentPadding)),n}(l,{exactMode:d,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,o){if(!t||o)return e;const r=t[0],n=t[1];return null==r&&null==n?e:[null!=r?r:e[0],null!=n?n:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,o){let r=e,n=t;if(r[0]===1/0||r[1]===-1/0)if("time"===o){const e=Date.now();r=[e-864e5,e]}else r=[0,1];return n[0]!==1/0&&n[1]!==-1/0||(n=[0,1]),{xDomain:r,yDomain:n}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:o,xDomain:r,yDomain:n}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(o.width,o.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,o.width-s]:[o.width-s,s];return{x:(0,Et.scaleLinear)().domain(r).range(e),y:Ht(t.yScaleType,n,[o.height-s,s])}}const e="down"===t.arrowOfTime?[s,o.height-s]:[o.height-s,s];return{x:Ht(t.yScaleType,n,[s,o.width-s]),y:(0,Et.scaleLinear)().domain(r).range(e)}}var a;return{x:Ht(t.xScaleType,r,[s,o.width-s]),y:Ht(t.yScaleType,n,[o.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const h=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=n):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=h,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,o=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const r of e.path)r[0]*=t,r[1]*=o;break;case"area":for(const r of e.topPath)r[0]*=t,r[1]*=o;for(const r of e.bottomPath)r[0]*=t,r[1]*=o;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*o,width:e.clipRect.width*t,height:e.clipRect.height*o});break;case"point":case"glyph":e.x*=t,e.y*=o;break;case"rect":case"heatcell":e.x*=t,e.y*=o,e.w*=t,e.h*=o;break;case"candlestick":e.x*=t,e.openY*=o,e.closeY*=o,e.highY*=o,e.lowY*=o}const r=this.scales.x.domain(),n=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=Ht,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,r,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,n,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:o,scales:r}=this;if(!r)return[];if(o.customLayout){const n={data:t,scales:r,dimensions:{width:e.width,height:e.height,margin:o.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:o.themeSemantic??{},categorical:o.themeCategorical??Ee},resolveColor:(e,t)=>{const r=this.resolveGroupColor(e);if(r)return r;const n=this.resolveLineStyle(e,t);return n.stroke?n.stroke:"string"==typeof n.fill?n.fill:o.themeSemantic?.primary??"#4e79a7"},config:o.layoutConfig??{},selection:o.layoutSelection??null};let i;try{i=o.customLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,r=Ft("xy",e,t,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{o.onLayoutError?.(r)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,o.layoutSelection??null)}return It({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const n={scales:r,config:o,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(o.chartType){case"line":return function(e,t){const o=e.groupData(t),r=[],n=e.config.annotations?.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}for(const t of o){const o=e.resolveLineStyle(t.key,t.data[0]),i=ut(t.data,e.scales,e.getX,e.getY,o,t.key);n&&n.length>0&&(i.colorThresholds=n),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),r.push(i)}return St(e,o,r),r}(n,t);case"area":return function(e,t){const o=e.groupData(t),r=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}const n=e.scales.y.domain()[0],i=e.getY0?t=>{const o=e.getY0(t);return null==o?n:o}:void 0;for(const t of o){const o=e.resolveAreaStyle(t.key,t.data[0]),s=dt(t.data,e.scales,e.getX,e.getY,n,o,t.key,i),a=Ct(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),r.push(s)}return St(e,o,r),r}(n,t);case"mixed":return function(e,t){const o=e.groupData(t),r=[],n=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:i}=vt(e.ribbons);if(i.length>0&&r.push(...xt(e,t,i)),n.length>0)for(const t of o)r.push(...kt(e,t.data,t.key,n))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const o=e.getY0(t);return null==o?i:o}:void 0;for(const t of o)if(n.has(t.key)){const o=e.resolveAreaStyle(t.key,t.data[0]),n=dt(t.data,e.scales,e.getX,e.getY,i,o,t.key,s),a=Ct(e.config.gradientFill);a&&(n.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),r.push(n)}else{const o=e.resolveLineStyle(t.key,t.data[0]),n=ut(t.data,e.scales,e.getX,e.getY,o,t.key);e.config.curve&&"linear"!==e.config.curve&&(n.curve=e.config.curve),e.config.lineGradient&&(n.strokeGradient=e.config.lineGradient),r.push(n)}return St(e,o,r),r}(n,t);case"stackedarea":return function(e,t){const o=e.groupData(t),r=e.config.stackOrder??"key",n=()=>o.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===r);else if("key"===r)n();else if("asc"===r||"desc"===r||"insideOut"===r){const t=new Map;for(const r of o){let o=0;for(const t of r.data){const r=e.getX(t),n=e.getY(t);Number.isFinite(r)&&Number.isFinite(n)&&(o+=n)}t.set(r.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===r)o.sort((e,o)=>{const r=(t.get(e.key)??0)-(t.get(o.key)??0);return 0!==r?r:n(e.key,o.key)});else if("desc"===r)o.sort((e,o)=>{const r=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==r?r:n(e.key,o.key)});else{const e=[...o].sort((e,o)=>{const r=(t.get(o.key)??0)-(t.get(e.key)??0);return 0!==r?r:n(e.key,o.key)}),r=[],i=[];let s=0,a=0;for(const o of e)a>s?(r.push(o),s+=t.get(o.key)??0):(i.push(o),a+=t.get(o.key)??0);o.length=0,o.push(...i.reverse(),...r)}}else n();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,o,r,n,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=o(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const n of t.data){const t=o(n),i=r(n);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let d;if(i){d=new Map;for(const t of c){let o=0;for(const r of e)o+=u.get(r.key)?.get(t)||0;d.set(t,o||1)}}const h=ht(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),p="diverging"===a&&!i,f=[],g=new Map,m=new Map,y=new Map,b=new Map;for(const e of c)m.set(e,h.get(e)??0),y.set(e,0),b.set(e,0);for(const o of e){const e=u.get(o.key),r=new Map;let a=[],l=[];const h=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:n(o.key,o.data[0]),datum:o.data,group:o.key};s&&(e.curve=s),f.push(e)}a=[],l=[]};for(const o of c){const n=e.has(o);let s,c,u=n?e.get(o):0;if(i&&n&&(u/=d.get(o)),!n||!Number.isFinite(u)||0===u){h();continue}p?u>0?(s=y.get(o),c=s+u,y.set(o,c)):(s=b.get(o),c=s+u,b.set(o,c)):(s=m.get(o),c=s+u,m.set(o,c));const f=t.x(o);l.push([f,t.y(s)]),a.push([f,t.y(c)]),r.set(o,c)}h(),g.set(o.key,r)}return{nodes:f,stackedTops:g}}(o,e.scales,e.getX,e.getY,(t,o)=>e.resolveAreaStyle(t,o),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const r of o){const o=l.get(r.key);if(o)for(const n of r.data){const r=e.getX(n),i=e.getY(n);null==r||Number.isNaN(r)||null==i||Number.isNaN(i)||!o.has(r)||t.set(n,o.get(r))}}const r=o=>t.get(o)??e.getY(o);St(e,o,c,r)}return c}(n,t);case"scatter":case"bubble":return function(e,t){const o=[],r="bubble"===e.config.chartType?10:5,n=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const o=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(o.length>0){let e=1/0,t=-1/0;for(const r of o)e>r&&(e=r),r>t&&(t=r);i=o=>e===t?(n[0]+n[1])/2:n[0]+(o-e)/(t-e)*(n[1]-n[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let d=0;const h=e=>{const t=c?.[e];if(t)return t;let o=u.get(e);return o||(o=Pt[d%Pt.length],d++,u.set(e,o)),o};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},c=t.r||r;if(i&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const o=e.getColor(n);o&&s.has(o)&&(t={...t,fill:s.get(o)})}const u=e.getPointId?e.getPointId(n)+"":void 0;if(l){const r=h(l(n)+""),i=ft(n,e.scales,e.getX,e.getY,Math.PI*c*c,r,t,u);i&&o.push(i)}else{const r=pt(n,e.scales,e.getX,e.getY,c,t,u);r&&o.push(r)}}return o}(n,t);case"heatmap":return function(e,t,o){if(e.config.heatmapAggregation)return function(e,t,o){const r=Math.max(1,Math.floor(e.config.heatmapXBins??20)),n=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=ne(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),d=(l-a||1)/r,h=(u-c||1)/n,p=r*n;if(p>1e6)return[];const f=new Int32Array(p),g=new Float64Array(p);for(let o=0;t.length>o;o++){const i=t[o],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const p=Math.min(Math.floor((l-a)/d),r-1),m=Math.min(Math.floor((u-c)/h),n-1);if(0>p||0>m)continue;const y=m*r+p;f[y]++;const b=s(i);g[y]+=isFinite(b)?b:0}let m=1/0,y=-1/0;for(let e=0;p>e;e++){if(0===f[e])continue;let t;switch(i){case"sum":t=g[e];break;case"mean":t=g[e]/f[e];break;default:t=f[e]}m>t&&(m=t),t>y&&(y=t)}if(!isFinite(m))return[];const b=y-m||1,v=o.width/r,x=o.height/n,k=e.config.showValues,w=e.config.heatmapValueFormat,S=[];for(let e=0;n>e;e++){const t=e*r;for(let o=0;r>o;o++){const r=t+o;if(0===f[r])continue;let s;switch(i){case"sum":s=g[r];break;case"mean":s=g[r]/f[r];break;default:s=f[r]}const l=(s-m)/b;S.push(mt(o*v,(n-1-e)*x,v,x,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:o,yi:e,value:s,count:f[r],sum:g[r],xCenter:a+(o+.5)*d,yCenter:c+(e+.5)*h,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return S}(e,t,o);if(0===t.length)return[];const r=ne(e.config.valueAccessor,"value"),n=ie(e.config.xAccessor,"x"),i=ie(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const o=t[e],r=n(o),u=i(o);l[e]=r,c[e]=u,s.has(r)||s.set(r,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,d=a.size;if(0===u||0===d)return[];const h=Array.from(s.keys()),p=Array.from(a.keys()),f=h.every(e=>"number"==typeof e&&!isNaN(e)),g=p.every(e=>"number"==typeof e&&!isNaN(e));if(f){h.sort((e,t)=>e-t),s.clear();for(let e=0;h.length>e;e++)s.set(h[e],e)}if(g){p.sort((e,t)=>e-t),a.clear();for(let e=0;p.length>e;e++)a.set(p[e],e)}const m=new Float64Array(t.length),y=new Float64Array(t.length),b=Array(t.length),v=new Map;let x=0;for(let e=0;t.length>e;e++){const o=t[e],n=s.get(l[e]),i=a.get(c[e]);if(void 0===n||void 0===i)continue;const d=r(o),h=i*u+n,p=v.get(h);let f;void 0!==p?f=p:(f=x++,v.set(h,f)),m[f]=h,y[f]=d,b[f]=o}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=y[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const S=function(e){const t=e in Pe?e:"blues";let o=Rt.get(t);if(o)return o;o=Array(256);const r=_e(t);for(let e=0;256>e;e++)o[e]=r(e/255);return Rt.set(t,o),o}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),C=o.width/u,M=o.height/d,j=e.config.showValues,P=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=y[e];if(!isFinite(t))continue;const o=m[e],r=o%u;_.push(mt(r*C,(d-1-(o-r)/u)*M,C,M,S[Math.min((t-k)*A+.5|0,255)],b[e],j?{value:t,showValues:!0,valueFormat:P}:void 0))}return _}(n,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const o=Tt(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===o.size)return{nodes:[],binBoundaries:[]};let r=null;if(e.getCategory){const t=new Set;for(const e of o.values())for(const o of e.categories.keys())t.add(o);const n=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(n),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=n.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?r=e.barCategoryCache.order:(r=[...a,...s],e.barCategoryCache={key:l,order:r})}const n=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,d="number"!=typeof u||0>u?1:u,h={};l?.stroke&&(h.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(h.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(h.opacity=l.opacity);for(const t of o.values()){const o=Math.max(t.start,s),u=Math.min(t.end,a);if(o>=u)continue;const p=i.x(o),f=i.x(u),g=Math.abs(f-p),m=g>d+1?d:0,y=Math.min(p,f)+m/2,b=Math.max(g-m,1);if(b>0)if(r&&t.categories.size>0){let o=0;for(const s of r){const r=t.categories.get(s)||0;if(0===r)continue;const a=i.y(o),u=i.y(o+r);n.push(gt(y,Math.min(a,u),b,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...h},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:r},s)),o+=r}}else{const e=i.y(0),o=i.y(t.total);n.push(gt(y,Math.min(e,o),b,Math.abs(e-o),{fill:l?.fill||c||"#007bff",...h},{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of o.values())p.add(e.start),p.add(e.end);return{nodes:n,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(n,t);return this._barCategoryCache=n.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const o=[],r=e.config.swarmStyle||{},n=r.radius??3,i=r.fill??e.config.themeSemantic?.primary??"#007bff",s=r.opacity??.7,a=r.stroke,l=r.strokeWidth;for(const r of t){const t=e.getX(r),c=e.getY(r);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),d=e.scales.y(c);let h=i;if(e.getCategory){const t=e.getCategory(r);h=e.config.barColors?.[t]||h}const{r:p,...f}=e.config.pointStyle?.(r)??{},g={type:"point",x:u,y:d,r:p??n,style:{fill:h,opacity:s,stroke:a,strokeWidth:l,...f},datum:r};e.getPointId&&(g.pointId=e.getPointId(r)+""),o.push(g)}return o}(n,t);case"waterfall":return function(e,t,o){const r=[],n=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const o=e.getY(t),r=e.getX(t);return null!=o&&!Number.isNaN(o)&&null!=r&&isFinite(r)});if(0===s.length)return r;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,d=i?.strokeWidth,h=i?.opacity;let p=0;for(let t=0;s.length>t;t++){const f=s[t],g=e.getX(f),m=e.getY(f),y=p+m;let b;b=s.length-1>t?e.getX(s[t+1])-g:t>0?g-e.getX(s[t-1]):0;const v=n.x(g),x=0!==b?n.x(g+b):v+o.width/10,k=Math.min(v,x)+c/2,w=Math.max(v,x)-c/2-k;if(0>=w){p=y;continue}const S=n.y(p),A=n.y(y),C=Math.min(S,A),M=Math.abs(S-A),j={fill:0>m?l:a,stroke:u,strokeWidth:d};null!=h&&(j.opacity=h),r.push(gt(k,C,w,M,j,{...f,baseline:p,cumEnd:y,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),p=y}return r}(n,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];const r=[],n=e.config.candlestickStyle||{},i=n.rangeColor||"#6366f1",s=o?i:n.upColor||"#28a745",a=o?i:n.downColor||"#dc3545",l=o?i:n.wickColor||"#333",c=n.wickWidth||(o?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let d=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let t=1/0;for(let o=1;u.length>o;o++){const r=Math.abs(e.scales.x(u[o])-e.scales.x(u[o-1]));r>0&&t>r&&(t=r)}d=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else d=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(n),u=e.getLow(n);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const h=o?i:e.getOpen(n),p=o?u:e.getClose(n);if(!o&&[h,p].some(e=>null==e||Number.isNaN(e)))continue;const f=p>=h,g={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(p),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:d,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:f,datum:n};o&&(g.isRange=!0),r.push(g)}return r}(n,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,o,r){const n=e.boundsStyle;return"function"==typeof n?n(o||{},t):n&&"object"==typeof n?n:{fill:r(t,o).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const o=this.config.decay;return o&&t>1?nt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,o,r=it(o)){const n=o.length;if(n>1)for(const o of t){if("line"===o.type){const t=Array.isArray(o.datum)?o.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let o=0;t.length>o;o++){const a=r.get(t[o]);null!=a?(i[o]=nt(e,a,n),1>i[o]&&(s=!0)):i[o]=1}s&&(o._decayOpacities=i);continue}if("area"===o.type){const t=Array.isArray(o.datum)?o.datum:[],i=o.topPath?o.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let o=0;t.length>o;o++){const i=r.get(t[o]);null!=i?(s[o]=nt(e,i,n),1>s[o]&&(a=!0)):s[o]=1}a&&(o._decayOpacities=s)}else{let s=1;for(const o of t){const t=r.get(o);if(null!=t){const o=nt(e,t,n);s>o&&(s=o)}}if(1>s){const e=Array(i);e.fill(s),o._decayOpacities=e}}continue}const t=r.get(o.datum);if(null==t)continue;const i=nt(e,t,n);"heatcell"===o.type?o.style={opacity:i}:"candlestick"===o.type?o._decayOpacity=i:o.style={...o.style,opacity:(o.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ue())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,o,r){o.clear(),r.clear();for(let n=0;t.length>n;n++){const i=t[n],s=ct(e,i,n);s&&("point"===i.type?o.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?o.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?o.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?o.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?r.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&r.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],r=ct(this.transitionContext,o,t);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:0,opacity:0}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:e,w:o.w,h:0,opacity:o.style.opacity??1}):"heatcell"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:0}):"line"===o.type?(o._introClipFraction=0,this.prevPathMap.set(r,{path:o.path.map(e=>[e[0],e[1]]),opacity:o.style.opacity})):"area"===o.type&&(o._introClipFraction=0,this.prevPathMap.set(r,{topPath:o.topPath.map(e=>[e[0],e[1]]),bottomPath:o.bottomPath.map(e=>[e[0],e[1]]),opacity:o.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,o,r,n){if(0===r.size&&0===n.size)return o;const i=t.duration??300;if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}let s=!1;const a=new Set,l=new Set;for(let t=0;o.scene.length>t;t++){const i=o.scene[t],c=ct(e,i,t);if(!c)continue;if(i._transitionKey=c,"line"===i.type||"area"===i.type){const e=n.get(c);if(e){if(l.add(c),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];s=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];s=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},s=!0;continue}const u=r.get(c);if("point"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("glyph"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("rect"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("heatcell"===i.type)if(u){a.add(c);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){a.add(c);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0}for(const[e,t]of n)if(!l.has(e))if(e.startsWith("l:")&&t.path){const r={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(r),s=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const r={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};o.exitNodes.push(r),s=!0}for(const[e,t]of r)if(!a.has(e)){if(e.startsWith("p:"))o.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)o.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))o.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))o.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const r=t.openY??t.y;o.exitNodes.push({type:"candlestick",x:t.x,openY:r,closeY:t.closeY??r,highY:t.highY??r,lowY:t.lowY??r,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}s=!0}return o.exitNodes.length>0&&(o.scene=[...o.scene,...o.exitNodes]),s&&(o.activeTransition={startTime:Ue(),duration:i}),o}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},o=function(e,t,o,r){if(!o.activeTransition)return!1;const n=Ve(e,o.activeTransition),i=Ge(n,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of o.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.r=Xe(o.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==e._targetR&&void 0!==o.r&&(e.size=Xe(o.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style.opacity=Xe(o?o.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),e.y=Xe(o.y,e._targetY,i),void 0!==o.w&&(e.w=Xe(o.w,e._targetW,i)),void 0!==o.h&&(e.h=Xe(o.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const o=t?r.get(t):void 0;e.style={...e.style||{},opacity:Xe(o?o.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const o=r.get(t);if(!o)continue;e.x=Xe(o.x,e._targetX,i),void 0!==o.openY&&(e.openY=Xe(o.openY,e._targetOpenY,i)),void 0!==o.closeY&&(e.closeY=Xe(o.closeY,e._targetCloseY,i)),void 0!==o.highY&&(e.highY=Xe(o.highY,e._targetHighY,i)),void 0!==o.lowY&&(e.lowY=Xe(o.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,o=e._targetPath;if(t&&o&&t.length===e.path.length)for(let r=0;e.path.length>r;r++)e.path[r][0]=Xe(t[r][0],o[r][0],i),e.path[r][1]=Xe(t[r][1],o[r][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Xe(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,o=e._prevBottomPath,r=e._targetTopPath,n=e._targetBottomPath;if(t&&r&&t.length===e.topPath.length)for(let o=0;e.topPath.length>o;o++)e.topPath[o][0]=Xe(t[o][0],r[o][0],i),e.topPath[o][1]=Xe(t[o][1],r[o][1],i);if(o&&n&&o.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Xe(o[t][0],n[t][0],i),e.bottomPath[t][1]=Xe(o[t][1],n[t][1],i)}}if(n>=1){for(const e of o.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}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("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=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}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let o=0;e.path.length>o;o++)e.path[o]=t[o];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,o=e._targetBottomPath;if(t)for(let o=0;e.topPath.length>o;o++)e.topPath[o]=t[o];if(o)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=o[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(o.exitNodes.length>0){const e=new Set(o.exitNodes);o.scene=o.scene.filter(t=>!e.has(t)),o.exitNodes=[]}return o.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,o}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:o}=function(e,t,o,r){if(r&&r.version===o&&r.group===t&&r.data===e)return{result:r.result,cache:r};let n;if(t){const o=new Map;for(const r of e){const e=t(r);o.has(e)||o.set(e,[]),o.get(e).push(r)}n=Array.from(o.entries()).map(([e,t])=>({key:e,data:t}))}else n=[{key:"_default",data:e}];return{result:n,cache:{version:o,group:t,data:e,result:n}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=o,t}resolveColorMap(e){const{map:t,cache:o}=function(e,t,o,r,n){if(n&&n.version===r)return{map:n.map,cache:n};const i=new Set;if(t)for(const o of e){const e=t(o);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(n&&n.key===a){const e={...n,version:r};return{map:e.map,cache:e}}const l=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical||Ee,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:r}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=o,t}resolveLineStyle(e,t){return function(e,t,o,r){const n=e.lineStyle;if("function"==typeof n){const e=n(o||{},t);if(e&&!e.stroke&&t){const o=r(t);if(o)return{...e,stroke:o}}return e}const i=e.themeSemantic?.primary;return n&&"object"==typeof n?{stroke:n.stroke||i||"#007bff",strokeWidth:n.strokeWidth||2,strokeDasharray:n.strokeDasharray,fill:n.fill,fillOpacity:n.fillOpacity,opacity:n.opacity}:{stroke:r(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,o,r){if(e.areaStyle){const n=e.areaStyle(o||{});if(n&&!n.fill&&t){const e=r(t);if(e)return{...n,fill:e,stroke:n.stroke||e}}return n}const n=e.lineStyle;if("function"==typeof n){const e=n(o||{},t);if(e&&!e.fill&&t){const o=r(t);if(o)return{...e,fill:o,stroke:e.stroke||o}}return e}const i=e.themeSemantic?.primary;if(n&&"object"==typeof n)return{fill:n.fill||n.stroke||i||"#4e79a7",fillOpacity:n.fillOpacity??.7,stroke:n.stroke||i||"#4e79a7",strokeWidth:n.strokeWidth||2};const s=r(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:o,groupColorCounter:r}=function(e){const{group:t,colorMapCache:o,groupColorMap:r,groupColorMapCap:n,config:i}=e;let{groupColorCounter:s}=e;if(o){const e=o.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=r.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Ee;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,r.set(t,c),r.size>n){const e=r.keys().next().value;void 0!==e&&r.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ue(e),o=this.getPointId,r=e=>t.has(o(e));Yt(this.buffer,this.timestampBuffer,r);const n=this.buffer.remove(r);if(0===n.length)return this.updateResults.recordNoop("remove"),n;for(const e of n)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=Ue(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const o=ue(e),r=this.getPointId,n=new Set;this.buffer.forEach((e,t)=>{o.has(r(e))&&n.add(t)});const i=this.buffer.update(e=>o.has(r(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{n.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=Ue(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}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._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const r of e){const e=this._baseStyles.get(r)??r.style??{},n=o(r,t);r.style=n?{...e,...n}:e}}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this._stylePaintPending=!0,this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,n=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,o=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!re(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!re(o,s);(a||l)&&(e?(this.getX=ne(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ne(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ne(this.config.xAccessor,"x"),this.getY=ne(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=Dt(this.config)),r=!0,n=!0)}if("groupAccessor"in e&&!re(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?se(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!re(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?se(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!re(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ne(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!re(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!re(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?ne(this.config.y0Accessor,"y0"):void 0,r=!0,n=!0),("boundsAccessor"in e&&!re(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=Dt(this.config),r=!0,n=!0),"pointIdAccessor"in e&&!re(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?se(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!re(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!re(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!re(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!re(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?ne(this.config.openAccessor,"open"):void 0,this.getHigh=ne(this.config.highAccessor,"high"),this.getLow=ne(this.config.lowAccessor,"low"),this.getClose=t?ne(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,n=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(r=!0,n=!0),!r){const o=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of o)if(e[n]!==t[n]){r=!0;break}}r&&(n&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(o,r,n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};oo.GROUP_COLOR_MAP_CAP=1e3;var ro=oo,no={sceneGeometry:0,layout:0,domain:0},io="production"!==process.env.NODE_ENV,so={revisions:no,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},ao=class{constructor(){this.lastConsumed=no,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}beforeCompute(e,t){if(!io)return so;const o=function(e){const{domain:t,layout:o,sceneGeometry:r}=e.revisions;return{domain:t,layout:o,sceneGeometry:r}}(e),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(o),n=!((i=o).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:o,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:n,warnUnconsumed:!t&&n&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,o){if(io){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] StreamXYFrame observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!o&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] StreamXYFrame performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},lo=c(require("react"));function co(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:lo.createElement(lo.Fragment,null,...t)}var uo=c(require("react")),ho=require("react/jsx-runtime"),po={isActive:!1,predicate:()=>!0},fo=uo.createContext(null);function go({value:e,children:t}){return(0,ho.jsx)(fo.Provider,{value:e,children:t})}function mo(){return uo.useContext(fo)??po}function yo(e,t){return null!=e?(0,ho.jsx)(go,{value:t,children:e}):e}var bo=require("react");function vo(e,t,o,r){(0,bo.useEffect)(()=>{e.current?.updateConfig(t),o.current=!0,r()},[t,r,e,o])}function xo(e,t,o,r){const n=(0,bo.useRef)(null);(0,bo.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;n.current!==s&&(n.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):o.current=!0,r())},[t,r,e,o])}function ko(e,t,o){return o.x>e||e>o.x+o.w||o.y>t||t>o.y+o.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:o.x+o.w/2,cy:o.y+o.h/2}}function wo(e,t=30){return Math.max((e??4)+5,12,t)}function So(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ao(e,t){const o=So(e);if(!o)return!1;const r=So(t);return!r||o.getFullYear()!==r.getFullYear()||o.getMonth()!==r.getMonth()}function Co(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}var Mo=[40,40],jo=[.5,.5];function Po(e,t){const[o,r]=e.viewBox??Mo,[n,i]=e.anchor??jo,s=r>0?r:1,a=Math.max(0,t)/s,l=(o>0?o:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-n*l,offsetY:-i*c}}function _o(e,t,o,r){if("none"!==e)return"color"===e||null==e?t??r:"accent"===e?o:e}var Lo=null;function Ro(e){if("undefined"==typeof Path2D)return null;Lo||(Lo=new Map);const t=Lo.get(e);if(t)return t;const o=new Path2D(e);return Lo.size>1024&&Lo.clear(),Lo.set(e,o),o}function To(e,t,o=0,r="horizontal"){const[n,i]=e.viewBox??Mo,s=Math.min(1,Math.max(0,o)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===r?{x:0,y:i*(1-a),width:n,height:i*(a-s)}:{x:n*s,y:0,width:n*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function Io(e,t){const o=Po(e,t);return{centerDx:o.offsetX+o.width/2,centerDy:o.offsetY+o.height/2,halfWidth:o.width/2,halfHeight:o.height/2,radius:Math.hypot(o.width,o.height)/2}}function $o(e,t,o,r,n,i=e=>e){for(const s of t.parts){const t=Ro(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=n?"none"===s.fill?void 0:n:_o(s.fill,o,r);c&&(e.fillStyle=i(c),e.fill(t));const u=n?s.stroke&&"none"!==s.stroke?n:void 0:_o(s.stroke??"none",o,r);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}function No(e,t,o,r,n,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(r,n+5,12),c=t-l,u=t+l,d=o-l,h=o+l;let p=null,f=1/0;return e.visit((e,n,l,g,m)=>{if(n>u||c>g||l>h||d>m)return!0;if(!e.length){let n=e;do{const e=n.data,l=i(e)-t,c=s(e)-o,u=Math.sqrt(l*l+c*c);wo(a(e),r)>=u&&f>u&&(p=e,f=u),n=n.next}while(n)}return!1}),p?{node:p,distance:f}:null}var Fo=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Bo=new WeakMap,Do=0,Eo=!1,zo=null,Ho=null;function Oo(e,t){if(!t)return t;const o=Fo.exec(t);if(!o)return t;const r=e.canvas;if(!r)return o[2]?.trim()||t;!function(){if(Eo)return;if("undefined"==typeof window||"undefined"==typeof document)return;Eo=!0;const e=()=>{Do++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{zo=window.matchMedia("(prefers-color-scheme: dark)"),Ho=e,"function"==typeof zo.addEventListener?zo.addEventListener("change",Ho):"function"==typeof zo.addListener&&zo.addListener(Ho)}catch{}}();let n=Bo.get(r);n&&n.version===Do||(n={version:Do,map:new Map},Bo.set(r,n));const i=n.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(r).getPropertyValue(o[1]).trim()||o[2]?.trim()||t;return n.map.set(t,s),s}function Wo(e,t){const o=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=o,[78,121,167]}const n=e.fillStyle;if(e.fillStyle=o,"string"!=typeof n)return[78,121,167];if(n.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(n.startsWith("#"))return[parseInt(n.slice(1,3),16),parseInt(n.slice(3,5),16),parseInt(n.slice(5,7),16)];const i=n.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}var qo=require("d3-shape");function Yo(e){switch(e){case"monotoneX":return qo.curveMonotoneX;case"monotoneY":return qo.curveMonotoneY;case"cardinal":return qo.curveCardinal;case"catmullRom":return qo.curveCatmullRom;case"step":return qo.curveStep;case"stepBefore":return qo.curveStepBefore;case"stepAfter":return qo.curveStepAfter;case"basis":return qo.curveBasis;case"natural":return qo.curveNatural;default:return null}}function Go(e,t,o){return null==t?o:"string"!=typeof t?t:Oo(e,t)||o}function Vo(e,t,o,r,n,i,s){if("colorStops"in t){const o=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>o.length)return null;const a=e.createLinearGradient(r,n,i,s);for(const e of o)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(r,n,i,s),[h,p,f]=Wo(e,o);return d.addColorStop(0,`rgba(${h},${p},${f},${c})`),d.addColorStop(1,`rgba(${h},${p},${f},${u})`),d}function Xo(e,t,o,r,n,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(o,r,n,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var Uo=require("d3-shape"),Ko=new WeakMap;function Qo(e,t){const o=Yo(t);if(!o)return e;const r=Ko.get(e);if(r)return r;const n=function(e,t,o=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const r=[];let n=null;const i={moveTo(e,t){n=[e,t],r.push([e,t])},lineTo(e,t){n=[e,t],r.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!n)return n=[a,l],void r.push([a,l]);const[c,u]=n;for(let n=1;o>=n;n++){const d=n/o,h=1-d;r.push([h*h*h*c+3*h*h*d*e+3*h*d*d*i+d*d*d*a,h*h*h*u+3*h*h*d*t+3*h*d*d*s+d*d*d*l])}n=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,o,i){n=[o,i],r.push([o,i])}};return(0,Uo.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),r}(e,o);return Ko.set(e,n),n}function Zo(e,t,o,r=30,n,i=0){let s=null;if(n){const e=No(n,t,o,r,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(n)break;e=er(i,t,o,r);break;case"symbol":e=tr(i,t,o,r);break;case"glyph":e=or(i,t,o,r);break;case"line":e=rr(i,t,o,r);break;case"rect":if(null==i.datum)break;e=ir(i,t,o);break;case"heatcell":e=sr(i,t,o);break;case"area":if(!1===i.interactive)break;e=lr(i,t,o);break;case"candlestick":e=ar(i,t,o)}e&&r>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Jo(e,t,o){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const r=cr(e,t);if(0>r)return null;if(Math.abs(e[r][0]-t)>o)return null;let n=r,i=r;r>0&&e[r][0]>=t?(n=r-1,i=r):e.length-1>r&&(n=r,i=r+1);const[s,a]=e[n],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function er(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function tr(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function or(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.x+n.centerDx,s=e.y+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function rr(e,t,o,r=30){if(0===e.path.length)return null;const n=cr(e.path,t);if(0>n)return null;const[i,s]=e.path[n];let a;if(e.path.length>1){let r=1/0;const i=Math.max(0,n-1),s=Math.min(e.path.length-2,n);for(let n=i;s>=n;n++){const[i,s]=e.path[n],[a,l]=e.path[n+1],c=nr(t,o,i,s,a,l);r>c&&(r=c)}a=r}else{const e=t-i,r=o-s;a=Math.sqrt(e*e+r*r)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,r)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[n]?e.datum[n]:e.datum,x:i,y:s,distance:a}}function nr(e,t,o,r,n,i){const s=n-o,a=i-r,l=s*s+a*a;if(0===l)return Math.sqrt((e-o)**2+(t-r)**2);let c=((e-o)*s+(t-r)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(o+c*s))**2+(t-(r+c*a))**2)}function ir(e,t,o){const r=ko(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function sr(e,t,o){const r=ko(t,o,e);return r.hit?{node:e,datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}function ar(e,t,o){const r=e.bodyWidth/2,n=Math.min(e.openY,e.closeY);if(!(e.x-r-3>t||t>e.x+r+3||e.highY-3>o||o>e.lowY+3)){const r=n+Math.max(Math.max(e.openY,e.closeY)-n,1)/2,i=t-e.x,s=o-r;return{node:e,datum:e.datum,x:e.x,y:r,distance:Math.sqrt(i*i+s*s)}}return null}function lr(e,t,o){if(0===e.topPath.length)return null;const r=cr(e.topPath,t);if(0>r)return null;const[n,i]=e.topPath[r],s=t-n,a=o-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:n,y:i,distance:l}}function cr(e,t){if(0===e.length)return-1;let o=0,r=e.length-1;for(;r>o;){const n=o+r>>1;t>e[n][0]?o=n+1:r=n}return o>0&&Math.abs(e[o][0]-t)>=Math.abs(e[o-1][0]-t)?o-1:o}function ur(e){const t=new Map;for(const o of e){const e=o.group??"_default";let r=t.get(e);r||(r=[],t.set(e,r)),r.push(o)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const o=Array.from(t.keys()).sort((e,o)=>{const r=t.get(e),n=t.get(o);return(r.length>0?r[0].y:0)-(n.length>0?n[0].y:0)}),r=Array.from(t.values()).flat();r.sort((e,t)=>e.x-t.x||e.y-t.y);const n=new Map;for(let e=0;r.length>e;e++){r[e]._flatIndex=e;const t=r[e].datum?.id;null!=t&&n.set(t+"",e)}return{flat:r,groups:o,byGroup:t,idToIdx:n}}function dr(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const o=Math.max(0,Math.min(t,e.flat.length-1)),r=e.flat[o];return{flatIndex:o,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function hr(e,t,o){const{group:r,indexInGroup:n}=t,i=o.byGroup.get(r);switch(e){case"ArrowRight":return i.length-1>n?i[n+1]._flatIndex:t.flatIndex;case"ArrowLeft":return n>0?i[n-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=o.groups.indexOf(r);return o.groups.length-1>e?pr(o,o.groups[e+1],i[n]):t.flatIndex}case"ArrowUp":{const e=o.groups.indexOf(r);return e>0?pr(o,o.groups[e-1],i[n]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*o.flat.length)),o.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*o.flat.length)),0);case"Home":return 0;case"End":return o.flat.length-1;case"Escape":return-1;default:return null}}function pr(e,t,o){const r=e.byGroup.get(t);let n=0,i=Math.abs(r[0].x-o.x);for(let e=1;r.length>e;e++){const t=Math.abs(r[e].x-o.x);i>t&&(i=t,n=e)}return r[n]._flatIndex}function fr(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function gr(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}var mr=require("react"),yr={fresh:1,aging:.7,stale:.45,expired:.25},br={alpha:1,band:"fresh",isStale:!1};function vr(e,t){if(!e||0>=t)return br;const o=null!=e.threshold&&e.threshold>0?e.threshold:5e3,r=e.graded;if(r){const e="object"==typeof r?r:{},n=Qe(t,o,e.thresholds);return{alpha:{...yr,...e.opacities??{}}[n],band:n,isStale:"fresh"!==n}}return t>o?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:br}function xr(e,t,o,r,n,i){const s=(0,mr.useRef)("fresh");(0,mr.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=vr(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===n||(s.current=c.band,c.isStale!==n&&i(c.isStale),o.current=!0,r())},1e3);return()=>clearInterval(a)},[e,n,r])}var kr=require("react/jsx-runtime");function wr({isStale:e,position:t}){return(0,kr.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var Sr=require("react"),Ar=c(require("react")),Cr=require("react/jsx-runtime"),Mr=16,jr=6,Pr=10,_r=22,Lr={fill:(e,t)=>(0,Cr.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,Cr.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Rr(e,t,o,r,n){let i;return i="function"==typeof o?o(e):(0,Lr[o])(r(e,t),n),i}function Tr({swatchSize:e}){return(0,Cr.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ir(e,t,o){return o&&o.size>0?o.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var $r=(e,t,o,r,n,i,s,a,l,c,u)=>{const{type:d="fill",styleFn:h,items:p}=e,f=[];let g=0;const m=!(!t&&!o),y="isolate"===c||void 0===c&&null!=n,{swatchSize:b,labelGap:v,rowHeight:x}=u;return p.forEach((e,c)=>{const u=Rr(e,c,d,h,b),k=Ir(e,r,n),w=n&&n.size>0&&n.has(e.label);f.push((0,Cr.jsxs)("g",{transform:`translate(0,${g})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&y?w||!1:void 0,"aria-current":m&&!y&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:m?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowDown"===o.key||"ArrowUp"===o.key){o.preventDefault();const e=(c+("ArrowDown"===o.key?1:-1)+p.length)%p.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,Cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+v+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,Cr.jsx)(Tr,{swatchSize:b}),(0,Cr.jsx)("text",{y:b/2,x:b+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),g+=x}),f},Nr=({legendGroups:e,width:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,p)=>{d+=5,h.push((0,Cr.jsx)("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+p)),d+=8,e.label&&(d+=16,h.push((0,Cr.jsx)("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+p)),d+=8),h.push((0,Cr.jsx)("g",{className:"legend-item",transform:`translate(0,${d})`,children:$r(e,o,r,n,i,s,a,p,l,c,u)},"legend-group-"+p)),d+=e.items.length*u.rowHeight+8}),h},Fr=({legendGroups:e,height:t,width:o,customClickBehavior:r,customHoverBehavior:n,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const p=[];e.forEach((e,t)=>{let f=0;e.label&&(f+=16);const g=((e,t,o,r,n,i,s,a,l,c,u,d)=>{const{type:h="fill",styleFn:p,items:f}=e,g=[],{swatchSize:m,labelGap:y,itemGap:b,rowHeight:v,align:x}=u,k=!(!t&&!o),w="isolate"===c||void 0===c&&null!=n,S=f.map(e=>m+y+7*e.label.length),A=[];let C=0,M=0;S.forEach((e,t)=>{const o=0===M?e:M+b+e;d&&d>0&&M>0&&o>d?(A.push({start:C,end:t,width:M}),C=t,M=e):M=o}),f.length>0&&A.push({start:C,end:f.length,width:M}),A.forEach((e,c)=>{let u="center"===x?Math.max(0,((d??e.width)-e.width)/2):"end"===x?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=f[d],x=Rr(e,d,h,p,m),A=Ir(e,r,n),C=n&&n.size>0&&n.has(e.label);g.push((0,Cr.jsxs)("g",{transform:`translate(${u},${c*v})`,onClick:t?()=>t(e):void 0,onMouseEnter:o?()=>o(e):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:k?a===i&&d===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?o=>{if("Enter"!==o.key&&" "!==o.key||(o.preventDefault(),t&&t(e)),"ArrowRight"===o.key||"ArrowLeft"===o.key){o.preventDefault();const e=(d+("ArrowRight"===o.key?1:-1)+f.length)%f.length;l(a,e);const t=o.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,d),o&&o(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:A,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,Cr.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+y+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),x,C&&(0,Cr.jsx)(Tr,{swatchSize:m}),(0,Cr.jsx)("text",{y:m/2,x:m+y,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=S[d]+b}});const j=Math.max(0,...A.map(e=>e.width)),P=A.length;return{items:g,offset:j,totalRows:P,totalHeight:P*v}})(e,r,n,i,s,a,l,t,c,u,d,d.maxWidth??o);f+=g.offset+5,p.push({label:e.label,...g,offset:f,totalRows:g.totalRows,totalHeight:g.totalHeight}),h+=f+12});const f=d.maxWidth??o;let g=h>f?0:"center"===d.align?Math.max(0,(f-h)/2):"end"===d.align?Math.max(0,f-h):0;const m=[];return p.forEach((o,r)=>{const n=e[r];n.label&&(m.push((0,Cr.jsx)("text",{transform:`translate(${g},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:n.label},"legend-text-"+r)),g+=16),m.push((0,Cr.jsx)("g",{className:"legend-item",transform:`translate(${g},0)`,children:o.items},"legend-group-"+r)),g+=o.offset+5,e[r+1]&&m.push((0,Cr.jsx)("line",{stroke:"gray",x1:g,y1:-8,x2:g,y2:(o.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),g+=12}),(0,Cr.jsx)("g",{children:m})};function Br({config:e,orientation:t="vertical",width:o=100}){const{colorFn:r,domain:n,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+Ar.useId();if("horizontal"===t){const e=12,t=Math.min(o,200),s=Math.max(0,(o-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Cr.jsx)("stop",{offset:100*t+"%",stopColor:r(n[0]+t*(n[1]-n[0]))},e))}return(0,Cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,Cr.jsx)("defs",{children:(0,Cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,Cr.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Cr.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,Cr.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[0])}),(0,Cr.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,Cr.jsx)("stop",{offset:100*t+"%",stopColor:r(n[1]-t*(n[1]-n[0]))},e))}return(0,Cr.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,Cr.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,Cr.jsx)("defs",{children:(0,Cr.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,Cr.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,Cr.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[1])}),(0,Cr.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(n[0])})]})}function Dr(e){const{legendGroups:t,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??Mr),o=Math.max(t,e?.rowHeight??_r);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??jr),itemGap:Math.max(0,e?.itemGap??Pr),rowHeight:o,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[p,f]=Ar.useState(0),[g,m]=Ar.useState(0),y=Ar.useCallback((e,t)=>{f(e),m(t)},[]),b="vertical"===u?Nr({legendGroups:t||[],width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:s,metrics:h}):Fr({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:n,isolatedCategories:i,focusedGroupIndex:p,focusedItemIndex:g,onFocusedIndexChange:y,legendInteraction:s,metrics:h}),v=!(!o&&!r);return(0,Cr.jsxs)("g",{role:v?"listbox":void 0,"aria-multiselectable":!(!v||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,Cr.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),b]})}function Er(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var zr=require("react/jsx-runtime");function Hr(e){const{legend:t,totalWidth:o,totalHeight:r,margin:n,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const p="top"===i||"bottom"===i,f=!!a,g=Math.max(0,o-n.left-n.right),m=Math.max(1,p?s?.maxWidth??g:100);let y,b;return"left"===i?(y=Math.max(4,n.left-m-10),b=n.top):"top"===i?(y=n.left,b=f?32:8):"bottom"===i?(y=n.left,b=r-n.bottom+38):(y=o-n.right+10,b=n.top),(0,zr.jsx)("g",{transform:`translate(${y}, ${b})`,children:(v=t,"object"==typeof v&&null!==v&&"gradient"in v?(0,zr.jsx)(Br,{config:t.gradient,orientation:p?"horizontal":"vertical",width:m}):Er(t)?(0,zr.jsx)(Dr,{legendGroups:t.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var v}var Or=require("react"),Wr=require("d3-array");h();var qr=require("react/jsx-runtime");function Yr(e){return"string"==typeof e?{type:e}:e}function Gr({orient:e,config:t,values:o,scale:r,size:n,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,Or.useMemo)(()=>{if(0===o.length)return null;const t=r.domain(),l=n-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),o=t.length;if(0===o)return null;const r=t[Math.floor(.25*o)],n=t[Math.floor(.5*o)],i=t[Math.floor(.75*o)],s=i-r;return{q1:r,median:n,q3:i,whiskerLow:Math.max(t[0],r-1.5*s),whiskerHigh:Math.min(t[o-1],i+1.5*s)}}(o);if(!t)return null;const{q1:n,median:i,q3:c,whiskerLow:u,whiskerHigh:d}=t,h=Math.min(.5*l,20),p=(l-h)/2+4;if(a){const t=r(n),o=r(c),a=r(i),l=r(u),f=r(d),g="top"===e?-1:1,m=0;return(0,qr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,qr.jsx)("line",{x1:l,y1:m+g*(p+h/2),x2:f,y2:m+g*(p+h/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:l,y1:m+g*p,x2:l,y2:m+g*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:f,y1:m+g*p,x2:f,y2:m+g*(p+h),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("rect",{x:Math.min(t,o),y:"top"===e?m-p-h:m+p,width:Math.abs(o-t),height:h,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:a,y1:"top"===e?m-p-h:m+p,x2:a,y2:"top"===e?m-p:m+p+h,stroke:s.fill,strokeWidth:2})]})}{const t=r(n),o=r(c),a=r(i),l=r(u),f=r(d),g="left"===e?-1:1,m=0;return(0,qr.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,qr.jsx)("line",{x1:m+g*(p+h/2),y1:l,x2:m+g*(p+h/2),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:m+g*p,y1:l,x2:m+g*(p+h),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:m+g*p,y1:f,x2:m+g*(p+h),y2:f,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,qr.jsx)("rect",{x:"left"===e?m-p-h:m+p,y:Math.min(t,o),width:h,height:Math.abs(o-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,qr.jsx)("line",{x1:"left"===e?m-p-h:m+p,y1:a,x2:"left"===e?m-p:m+p+h,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,Wr.bin)().domain(t).thresholds(s.bins)(o);if(0===c.length)return null;const u=d(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,qr.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,o)=>{if(null==t.x0||null==t.x1)return null;const n=t.length/u*l;if(a){const i=r(t.x0),a=r(t.x1)-r(t.x0);return(0,qr.jsx)("rect",{x:i,y:"top"===e?-4-n:4,width:Math.max(a,.5),height:n,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}{const i=r(t.x0),a=r(t.x1)-r(t.x0);return(0,qr.jsx)("rect",{x:"left"===e?-4-n:4,y:Math.min(i,i+a),width:n,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},o)}})});if("violin"===s.type){const t=l/2+4,o=[];for(const n of c){if(null==n.x0||null==n.x1)continue;const i=n.length/u*(l/2),s=r((n.x0+n.x1)/2);o.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let n=c.length-1;n>=0;n--){const i=c[n];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),d=r((i.x0+i.x1)/2);o.push(a?`${d},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${d}`)}return(0,qr.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,qr.jsx)("polygon",{points:o.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const o=0,n=null!=c[0].x0?r(c[0].x0):0;t.push(`M${n},${o}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const n=o.length/u*l,i=r((o.x0+o.x1)/2);t.push(`L${i},${"top"===e?-n-4:n+4}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;t.push(`L${s},${o}`),t.push("Z")}else{const o=0,n=null!=c[0].x0?r(c[0].x0):0;t.push(`M${o},${n}`);for(const o of c){if(null==o.x0||null==o.x1)continue;const n=o.length/u*l,i=r((o.x0+o.x1)/2);t.push(`L${"left"===e?-n-4:n+4},${i}`)}const s=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;t.push(`L${o},${s}`),t.push("Z")}return(0,qr.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,qr.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[o,r,s,n,i,e,a,4]);return l?(0,qr.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Vr=c(require("react")),Xr=require("react/jsx-runtime");function Ur(e,t=120,o=8){if(!e)return[];const r=Math.max(1,Math.floor(t/o)),n=e.split(/\s+/),i=[];let s="";for(const e of n)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Kr(e,t,o,r){return"curly"===e?r?`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`:r?`M0,0 L${o},0 L${o},${t} L0,${t}`:`M0,0 L0,${o} L${t},${o} L${t},0`}function Qr(e,t,o,r){if(!e)return(0,Xr.jsx)("g",{className:"annotation-note"});const{label:n,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!n&&!i)return(0,Xr.jsx)("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 p=16,f=i?c?[i]:Ur(i,l):[],g=n?c?[n]:Ur(n,l):[],m="leftRight"===u?"end"===h?-4:4:0;let y=0;const b=[],v=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push((0,Xr.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===h?m-l:"middle"===h?m-l/2:m,y:-16,width:l,height:Math.max(p,(f.length+g.length)*p+(i&&n?2:0))+p,style:{overflow:"visible"},children:(0,Xr.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:v,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Xr.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),n&&(0,Xr.jsx)("div",{className:"annotation-note-label",children:n})]})},"annotation-note-html")):(f.length>0&&(b.push((0,Xr.jsx)("text",{className:"annotation-note-title",fill:v,textAnchor:h,fontWeight:"bold",children:f.map((e,t)=>(0,Xr.jsx)("tspan",{x:m,dy:0===t?0:p,children:e},t))},"annotation-note-title")),y=f.length*p),g.length>0&&b.push((0,Xr.jsx)("text",{className:"annotation-note-label",fill:v,textAnchor:h,y:y,children:g.map((e,t)=>(0,Xr.jsx)("tspan",{x:m,dy:0===t?0:p,children:e},t))},"annotation-note-label")));let x=null;if((i||n)&&(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=(0,Xr.jsx)("line",{className:"note-line",x1:t,x2:o,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(f.length+g.length)*p+(g.length>0?p:0);let t=0,o=e;"bottom"===d?(t=-e,o=0):"middle"===d&&(t=-e/2,o=e/2),x=(0,Xr.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:o,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,f.length+g.length-1)*p;let w=0;return"topBottom"===u?w=0>o?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+p+(g.length>0&&f.length>0?2:0))/2+8:"bottom"===d||0>o?-(k+2):18),(0,Xr.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${o})`,children:[(0,Xr.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),x]})}function Zr(e,t,o,r,n){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Xr.jsx)("circle",{r:e,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push((0,Xr.jsx)("rect",{width:e,height:r,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=n||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push((0,Xr.jsx)("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push((0,Xr.jsx)("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Xr.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Xr.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push((0,Xr.jsx)("path",{d:Kr(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Xr.jsx)("g",{className:"annotation-subject",children:i})}function Jr(e,t,o,r,n,i){const s=[];let a=0,l=0;if("callout-circle"!==n&&"label"!==n||!i?.radius){if("callout-rect"===n&&i){const o=i.width||0,r=i.height||0;if(o>0||r>0){const n=o/2,i=r/2,s=e-n,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=o/2,d=r/2,h=e*d>t*u?u/e:d/t;a=n+s*h,l=i+c*h}}}else if("bracket"===n&&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 r=Math.atan2(t,e);a=Math.cos(r)*o,l=Math.sin(r)*o}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const n=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===o?.type;let u=Math.atan2(t-l,e-a);if(i){const r=(a+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-a)/c,p=(o?.curve??.25)*c,f=r+d*p,g=i+h*p;s.push((0,Xr.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${f},${g} ${e},${t}`,fill:"none",stroke:n},"connector-line")),u=Math.atan2(g-l,f-a)}else s.push((0,Xr.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:n},"connector-line"));if("arrow"===o?.end){const e=10,t=16/180*Math.PI;s.push((0,Xr.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:n,stroke:"none"},"connector-arrow"))}}return(0,Xr.jsx)("g",{className:"annotation-connector",children:s})}function en(e){const{x:t=0,y:o=0,dx:r,dy:n,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:d,className:h,disable:p,opacity:f,strokeDasharray:g,events:m={},"data-testid":y}=e,b=Array.isArray(t)?t[0]??0:t,v=Array.isArray(o)?o[0]??0:o,x=new Set(Array.isArray(p)?p:[]);let k=r||0,w=n||0;null!=i&&(k=i-b),null!=s&&(w=s-v);const S="string"==typeof u?u:"label";if("bracket"===S&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,Xr.jsxs)("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${v})`,"data-testid":y,...null!=f&&{opacity:f},...g&&{strokeDasharray:g},...m,children:[!x.has("connector")&&Jr(k,w,l,d,S,c),!x.has("subject")&&Zr(S,c,d,b,v),!x.has("note")&&Qr(a,k,w,d)]})}function tn(e){const{noteData:t}=e,{screenCoordinates:o}=t,r="string"==typeof t.type?t.type:"label",n=t.eventListeners||t.events||{};if(t.coordinates&&o){const e=t.nx||o[0][0]+(t.dx??0),n=t.ny||o[0][1]+(t.dy??0),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:n});return(0,Xr.jsx)(en,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return(0,Xr.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Xr.jsx)(en,{"data-testid":"semiotic-annotation",events:n,...t,type:r},s)}var on=require("d3-hierarchy"),rn=require("d3-shape"),nn=c(require("regression"));function sn(e,t){const o=t.scales?.x??t.scales?.time;return o?null!=e.x?o(e.x):t.xAccessor&&null!=e[t.xAccessor]?o(e[t.xAccessor]):null:null}function an(e,t){const o=t.scales?.y??t.scales?.value;return o?null!=e.y?o(e.y):t.yAccessor&&null!=e[t.yAccessor]?o(e[t.yAccessor]):null:null}function ln(e){return null==e?null:e+""}function cn(e,t,o){return t.stickyPositionCache?.set(e,o),o}function un(e,t,o){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&o.pointNodes&&o.pointNodes.length>0)for(let r=o.pointNodes.length-1;r>=0;r--){const n=o.pointNodes[r];if(n.pointId===e.pointId)return cn(t,o,{x:n.x,y:n.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const o=t[t.length-1],r=e.scales?.x??e.scales?.time,n=e.scales?.y??e.scales?.value;if(!r||!n)return null;const i=o[e.xAccessor||"x"],s=o[e.yAccessor||"y"];return null==i||null==s?null:{x:r(i),y:n(s)}}(o);return r?cn(t,o,r):null}if("semantic"===r){const r=function(e,t,o){const r=function(e){return ln(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const n=o.pointNodes?.find(e=>ln(e.pointId)===r);if(n)return cn(t,o,{x:n.x,y:n.y});const i=o.data?.find(e=>function(e){return ln(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const s=sn(i,o),a=an(i,o);return null==s||null==a?null:cn(t,o,{x:s,y:a})}(e,t,o);if(r)return r}let n=null,i=null;if(null!=e.pointId&&o.pointNodes){const t=o.pointNodes.find(t=>t.pointId===e.pointId);t&&(n=t.x,i=t.y)}if(null!=n&&null!=i||(n=sn(e,o),i=an(e,o)),null!=n&&null!=i)return cn(t,o,{x:n,y:i});if("sticky"===r){const e=o.stickyPositionCache?.get(t);if(e)return e}return null}function dn(e,t,o,r=50){return!(-r>e||e>(o.width||0)+r||-r>t||t>(o.height||0)+r)}var hn=require("react/jsx-runtime"),pn={secondary:0,primary:3},fn=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function gn(e){return!0===e?._annotationDeferred}function mn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function yn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function bn(e){return Math.max(.72,.95-.06*e)}h();var vn=require("react/jsx-runtime"),xn={linear:rn.curveLinear,monotoneX:rn.curveMonotoneX,monotoneY:rn.curveMonotoneY,step:rn.curveStep,stepAfter:rn.curveStepAfter,stepBefore:rn.curveStepBefore,basis:rn.curveBasis,cardinal:rn.curveCardinal,catmullRom:rn.curveCatmullRom};function kn(e,t,o,r){const n=[];return e.forEach((e,i)=>{let s;if(o){const n=o(e,i,r);s=null!=n?n:t(e,i,r)}else s=t(e,i,r);s&&n.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(o=e.annotation,"primary"===o?.emphasis||"secondary"===o?.emphasis?o.emphasis:null),confidence:yn(e.annotation),readingOrder:null,rank:1};var o}),o=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>gn(e.annotation)),n=e.some(e=>null!=mn(e.annotation)),i=e.some(e=>"layer"===mn(e.annotation));if(!o&&!r&&!n)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=pn[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:o,emphasis:r,readingOrder:n}=e,i=gn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=n){const e=null==r&&null!=n;s=(0,hn.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:bn(n),"data-annotation-reading-order":n}:{},children:t.node},"annotation-emphasis-"+o)}const a=mn(t.annotation);return a&&(s=(0,hn.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+o)),i&&(s=(0,hn.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+o)),s});return r&&a.unshift((0,hn.jsx)("style",{children:fn},"annotation-disclosure-style")),i&&a.unshift((0,hn.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(n)}function wn(e){return function(e,t,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const r=un(e,t,o);if(!r)return null;const{x:n,y:i}=r;if(!dn(n,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,vn.jsx)(tn,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+t)}case"x-threshold":{const r=sn(null!=e.value?{...e,x:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:12;const a=r>.6*(o.width||0),l=a?r-4:r+4,c=a?"end":"start";return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:r,y1:0,x2:r,y2:o.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:l,y:s,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"y-threshold":{const r=an(null!=e.value?{...e,y:e.value}:e,o);if(null==r)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let s,a;return"left"===i?(s=4,a="start"):"center"===i?(s=(o.width||0)/2,a="middle"):(s=(o.width||0)-4,a="end"),(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("line",{x1:0,y1:r,x2:o.width||0,y2:r,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:s,y:r-4,textAnchor:a,fill:n,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"enclose":{const r=(e.coordinates||[]).map(e=>({x:sn({...e,type:"point"},o),y:an({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const n=(0,on.packEnclose)(r),i=e.padding||10;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)("text",{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"rect-enclose":{const r=(e.coordinates||[]).map(e=>({x:sn({...e,type:"point"},o),y:an({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>r.length)return null;const n=e.padding||10,i=r.map(e=>e.x),s=r.map(e=>e.y),[a,l]=u(i),[c,d]=u(s),h=a-n,p=l+n,f=c-n;return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("rect",{x:h,y:f,width:p-h,height:d+n-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,vn.jsx)("text",{x:(h+p)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:e.label})]},"ann-"+t)}case"highlight":{const r=o.data||[],n="function"==typeof e.filter?r.filter(e.filter):e.field&&null!=e.value?r.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,vn.jsx)("g",{children:n.map((t,r)=>{const n=sn(t,o),s=an(t,o);if(null==n||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,vn.jsx)("circle",{cx:n,cy:s,r:a,...l},"hl-"+r)})},"ann-"+t)}case"bracket":{const r=sn(e,o),n=an(e,o);return(0,vn.jsx)(tn,{noteData:{x:r??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+t)}case"trend":{const r=o.data||[];if(2>r.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?n:null,c=s?i:null;let u;const d=[],h=new Map;if(s&&l&&c){for(const e of r){const t=e[l];if(null==t)continue;const o=t+"";h.has(o)||(h.set(o,d.length),d.push(o))}u=r.map(e=>{const t=e[l],o=e[c];if(null==t||null==o)return null;const r=h.get(t+"");return null!=r?[r,+o]:null}).filter(e=>null!==e)}else u=r.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const p=o.scales?.x??o.scales?.time,f=o.scales?.y??o.scales?.value;if(!p||!f)return null;const g=e=>t=>{const o=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,o+1),n=t-o,i=e(d[o]);return i+(e(d[r])-i)*n},m=p,y=f;let b;if(s)if(a){const e=g(y);b=(t,o)=>[m(o),e(t)]}else{const e=g(m);b=(t,o)=>[e(t),y(o)]}else b=(e,t)=>[m(e),y(t)];const v=e.method||"linear";let x;x="loess"===v?function(e,t=.3){const o=e.length;if(2>o)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),n=r.map(e=>e[0]),i=r.map(e=>e[1]),s=Math.max(2,Math.ceil(t*o)),a=[];for(let e=0;o>e;e++){const t=n[e],r=n.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(s-1,o-1)]||1,c=[];for(let e=0;o>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,p=0,f=0;for(let e=0;o>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*n[e],h+=t*i[e],p+=t*n[e]*n[e],f+=t*n[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const g=u*p-d*d;if(1e-12>Math.abs(g))a.push([t,h/u]);else{const e=(u*f-d*h)/g;a.push([t,(h-e*d)/u+e*t])}}return a}(u,e.bandwidth??.3):("polynomial"===v?nn.default.polynomial(u,{order:e.order||2}):nn.default.linear(u)).points;const k=x.map(([e,t])=>{const[o,r]=b(e,t);return`${o},${r}`}).join(" "),w=e.color||"#6366f1",S=x[x.length-1],[A,C]=b(S[0],S[1]);return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,vn.jsx)("text",{x:A+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+t)}case"band":{const r=o.scales?.y??o.scales?.value,n=r?.(e.y0)??0,i=r?.(e.y1)??(o.height||0);return(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("rect",{x:0,y:Math.min(n,i),width:o.width||0,height:Math.abs(i-n),fill:e.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity||.1}),e.label&&(0,vn.jsx)("text",{x:(o.width||0)-4,y:Math.max(Math.min(n,i),0)+13,textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"x-band":{const r=o.scales?.x??o.scales?.time,n=null!=e.x0&&r?r(e.x0):null,i=null!=e.x1&&r?r(e.x1):null;return null==n||null==i?null:(0,vn.jsxs)("g",{opacity:e.opacity,children:[(0,vn.jsx)("rect",{x:Math.min(n,i),y:0,width:Math.abs(i-n),height:o.height||0,fill:e.fill||e.color||"var(--semiotic-primary, #6366f1)",fillOpacity:e.fillOpacity??.1}),e.label&&(0,vn.jsx)("text",{x:Math.min(n,i)+4,y:13,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:e.label})]},"ann-"+t)}case"envelope":{const r=o.data||[];if(2>r.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=r.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=xn[o.curve||"linear"]||rn.curveLinear,h=(0,rn.area)().x(e=>i(e[n])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(d)(u);if(!h)return null;const p=e.fill||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:h,fill:p,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,vn.jsx)("text",{x:i(u[u.length-1][n])+4,y:s(u[u.length-1][a])-4,fill:p,fontSize:11,children:e.label})]},"ann-"+t)}case"anomaly-band":{const r=o.data||[];if(2>r.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=r.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),d=e.threshold??2,h=l-d*u,p=!1!==e.showBand,f=e.fill||"#6366f1",g=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",y=e.anomalyRadius??6,b=s(l+d*u),v=s(h),x=r.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return(0,vn.jsxs)("g",{children:[p&&(0,vn.jsx)("rect",{x:0,y:Math.min(b,v),width:o.width||0,height:Math.abs(v-b),fill:f,fillOpacity:g}),x.map((e,t)=>{const r=sn(e,o),n=an(e,o);return null==r||null==n?null:(0,vn.jsx)("circle",{cx:r,cy:n,r:y,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,vn.jsx)("text",{x:(o.width||0)-4,y:Math.min(b,v)-4,textAnchor:"end",fill:f,fontSize:11,children:e.label})]},"ann-"+t)}case"forecast":{const r=o.data||[];if(3>r.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=r.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=nn.default.polynomial(l,{order:e.order||2}).equation;c=e=>t.reduce((t,o,r)=>t+o*Math.pow(e,r),0)}else{const e=l.length;let t=0,o=0,r=0,n=0;for(const[e,i]of l)t+=e,o+=i,r+=e*e,n+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const s=(e*n-t*o)/i,a=(o-s*t)/e;c=e=>a+s*e}const u=l.length,d=l.map(([e,t])=>t-c(e)).reduce((e,t)=>e+t*t,0),h=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,f=l.reduce((e,t)=>e+(t[0]-p)**2,0),g=e.confidence??.95,m=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,y=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),x=[];for(let e=1;y>=e;e++)x.push(b+e*v);const k=[];for(const e of x){const t=c(e),o=h*Math.sqrt(1+1/u+(f>0?(e-p)**2/f:0))*m;k.push({x:e,yCenter:t,yUpper:t+o,yLower:t-o})}const w=`M${k.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=k.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),A=`${s(b)},${a(c(b))}`,C=e.strokeColor||"#6366f1";return(0,vn.jsxs)("g",{children:[(0,vn.jsx)("path",{d:w,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,vn.jsx)("polyline",{points:`${A} ${S}`,fill:"none",stroke:C,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&k.length>0&&(0,vn.jsx)("text",{x:s(k[k.length-1].x)+4,y:a(k[k.length-1].yCenter)-4,fill:C,fontSize:11,children:e.label})]},"ann-"+t)}case"widget":{let r,n;if(null!=e.px&&null!=e.py)r=e.px,n=e.py;else{const i=un(e,t,o);if(!i)return null;r=i.x,n=i.y}if(!dn(r,n,o))return null;const i=e.width??32,s=e.height??32;return(0,vn.jsx)("foreignObject",{x:r+(e.dx??0)-i/2,y:n+(e.dy??0)-s/2,width:i,height:s,style:{overflow:"visible",pointerEvents:"auto"},children:(0,vn.jsx)("div",{style:{width:i,height:s,display:"flex",alignItems:"center",justifyContent:"center"},children:e.content??(0,vn.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"})})},"ann-"+t)}case"text":{const r=un(e,t,o);if(!r)return null;const{x:n,y:i}=r,s=n+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,vn.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Vr.cloneElement(c,{key:"ann-text-"+t}):(0,vn.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,vn.jsx)("line",{x1:n,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Vr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+t)}case"category-highlight":{const r=e.category;if(null==r)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=n(i)?i:n(s)?s:n(a)?a:null;if(!l)return null;const c=l(r+"");if(null==c)return null;const u=l.bandwidth(),d=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,p=e.label;return(0,vn.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,vn.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),p&&(0,vn.jsx)("text",{x:c+u/2,y:12,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]}:{children:[(0,vn.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),p&&(0,vn.jsx)("text",{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",children:p})]},"ann-"+t)}default:return null}}}var Sn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function An(e){return!!e&&"object"==typeof e&&Sn.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function Cn(e){return"primary"===e?.emphasis||!0===e?.defensive}function Mn(e,t,o={}){return"number"==typeof o.maxAnnotations&&Number.isFinite(o.maxAnnotations)?Math.max(0,Math.floor(o.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(o.areaPerAnnotation&&o.areaPerAnnotation>0?o.areaPerAnnotation:2e4))):1/0}function jn(e){let t;const o=e?.emphasis;t="primary"===o?100:"secondary"===o?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var Pn=32,_n=6,Ln=4,Rn=8,Tn=72;var In={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function $n(e){if(!Nn(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Nn(e){return An(e)}function Fn(e,t){if(!e)return[];const o=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),n=[];let i="";for(const e of r)i&&i.length+e.length+1>o?(n.push(i),i=e):i=i?`${i} ${e}`:e;return i&&n.push(i),n}function Bn(e,t,o,r,n){const i=e+o,s=t+r;return Math.abs(o)>Math.abs(r)?{x:0>o?i-n.width-4:i+4,y:0>r?s-n.height:s,width:n.width,height:n.height}:{x:0>o?i-n.width:i,y:0>r?s-n.height-4:s+4,width:n.width,height:n.height}}function Dn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function En(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function zn(e,t,o,r,n,i,s,a){const l=Dn(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,o,r){const n=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(n+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(o-r)))*e.width}(l,n,i,a);for(const e of o)c+=12*En(l,e);for(const e of r)c+=4*En(l,e);return c}function Hn(e){const{annotations:t,context:o,defaultOffset:r=Pn,notePadding:n=_n,markPadding:i=Ln,edgePadding:s=Rn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Tn,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:p,mobile:f,cohesion:g,audience:m}=e,y=o.width||0,b=o.height||0,v="object"==typeof f?f:{},x=v.breakpoint??480,k=!!f&&x>=y,w=k&&!1!==v.preferShortText?t.map($n):t,S=k&&!u?{maxAnnotations:v.maxAnnotations??("callout-list"===v.strategy?1:2),minVisible:v.minVisible??1}:u,A=d||k&&(!1!==v.progressiveDisclosure||"callout-list"===v.strategy),C=k&&!p?v.responsive??{minWidth:x}:p,M=k&&!g?v.cohesion:g;if(0===w.length||0>=y||0>=b)return w.slice();const j=[],P=function(e,t){return(e.pointNodes||[]).map(e=>{const o=Math.max(1,e.r||1)+t;return{x:e.x-o,y:e.y-o,width:2*o,height:2*o}})}(o,i);let _=!1;const L=w.map((e,t)=>{if(!Nn(e))return e;const i=function(e,t,o){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&o.pointNodes){const e=o.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const n=e.coordinates,i=o.scales?.geoProjection;if(Array.isArray(n)&&n.length>=2&&i){const e=n[0],t=n[1];if("number"==typeof e&&"number"==typeof t){const o=i([e,t]);if(o&&"number"==typeof o[0]&&"number"==typeof o[1])return{x:o[0],y:o[1]}}}return o.scales||"number"!=typeof e.x||"number"!=typeof e.y?un(e,t,o):{x:e.x,y:e.y}}(e,t,o);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,o=[...Fn("string"==typeof e.title?e.title:void 0,t),...Fn("string"==typeof e.label?e.label:void 0,t)],r=o.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*o.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(Dn(Bn(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),n)),e}var d;let h=null,p=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=zn(Bn(i.x,i.y,e.dx,e.dy,u),e,j,P,y,b,n,s);p>t&&(h=e,p=t)}if(!h)return e;const f=Dn(Bn(i.x,i.y,h.dx,h.dy,u),n);j.push(f);const g=Math.hypot(h.dx,h.dy),m=l&&g>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return _=!0,{...e,dx:h.dx,dy:h.dy,...m?{connector:m}:{}}}),R=_?L:w.slice();let T=R;if(h){let e=!1;const t=R.map(t=>{const o=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return o!==t&&(e=!0),o});T=e?t:R}{let e=!1;const t=T.map(t=>{if(!0!==t?.defensive)return t;const o=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const o="string"==typeof t.source?In[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const n=[o,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${n})`)?e:{...e,label:i?`${i} (${n})`:`(${n})`}}(t);return o!==t&&(e=!0),o});T=e?t:T}const I=new Set;if(S){const e="object"==typeof S?S:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const o=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===o.length?3:o.reduce((e,t)=>e+t,0)/o.length}(e);return t>2?4>t?1:.6:1.5}(m),o=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??Mn(y,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:o,height:r}=e,n=Math.max(0,e.minVisible??1),i=Mn(o,r,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(o=e,An(o))};var o}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>Cn(e.annotation)),c=a.filter(e=>!Cn(e.annotation)).sort((e,t)=>jn(t.annotation)-jn(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,n-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],p=[];for(const{annotation:e,index:t,note:o}of s)!o||d.has(t)?h.push(e):p.push(e);return{visible:h,deferred:p,budget:i}}({annotations:T,width:y,height:b,...o});for(const e of r)I.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=y)for(const e of T)Nn(e)&&"secondary"===e.emphasis&&I.add(e);if(I.size>0)for(const e of T)!0===e?.defensive&&I.delete(e);let $;return $=0===I.size?T:A?T.map(e=>I.has(e)?{...e,_annotationDeferred:!0}:e):T.filter(e=>!I.has(e)),M?function(e,t){let o=!1;const r=e.map(e=>Nn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(o=!0,{...e,cohesion:t}):e);return o?r:e}($,M):$}var On=require("react"),Wn={positions:new Map},qn=new Set;function Yn(){for(const e of qn)e()}function Gn(e,t){const o=Wn.positions.get(e);if(o?.locked)return;if(!o||o.sourceId!==t)return;const r=new Map(Wn.positions);r.delete(e),Wn={positions:r},Yn()}function Vn(e,t){const o=Wn.positions.get(e);if(!o?.locked)return;if(t&&o.sourceId!==t)return;const r=new Map(Wn.positions);r.delete(e),Wn={positions:r},Yn()}function Xn(){return Wn}function Un(e){return qn.add(e),()=>qn.delete(e)}var Kn={positions:new Map};function Qn(){return()=>{}}function Zn(){return Kn}function Jn(e,t,o){return"exact"===o?function(e,t){const o=e.domain(),r=o[0],n=o[o.length-1],i=r instanceof Date,s=r instanceof Date?r.getTime():r,a=n instanceof Date?n.getTime():n;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const o=e===t-1?a:s+e*l;c[e]=i?new Date(o):o}return c}(e,t):e.ticks(t)}var ei=require("react/jsx-runtime");function ti(e,t,o){if("edges"===e){if(t)return"start";if(o)return"end"}return"middle"}function oi(e,t,o){if("edges"===e){if(t)return"hanging";if(o)return"auto"}return"middle"}function ri(e){if(0===e.length)return{min:null,max:null};let t=1/0,o=-1/0;for(const r of e)t>r.pixel&&(t=r.pixel),r.pixel>o&&(o=r.pixel);return{min:t,max:o}}function ni(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function ii(e,t,o){if("left"===e||"right"===e){const r="left"===e?o:0,n="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+r;for(let e=0;i>e;e++){const o=8*(e+1);s+=`L${Math.min(8*e+4,t)},${r+4*n}`,s+=`L${Math.min(o,t)},${r}`}return s}{const r="bottom"===e?0:t,n="bottom"===e?1:-1,i=Math.ceil(o/8);let s=`M${r},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${r+4*n},${Math.min(8*e+4,o)}`,s+=`L${r},${Math.min(t,o)}`}return s}}function si(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:d,axisExtent:h}=e,p=(0,Sr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||u||ai,r=Math.max(2,Math.floor(t/70)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r),a=e?.tickValues??Jn(s.x,i,h),c=a.map(e=>e.valueOf()),d=a.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,c)})),p=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return li(d,Math.max(55,p+8))},[s,l,u,t,h]),f=(0,Sr.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||d||ai,r=Math.max(2,Math.floor(o/30)),n=e?.ticks??5,i="exact"===h?Math.max(2,n):Math.min(n,r);return li((e?.tickValues??Jn(s.y,i,h)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,d,o,h]),g=c&&s,m=a&&s;if(!g&&!m)return null;const y=l?.find(e=>"bottom"===e.orient),b=l?.find(e=>"left"===e.orient),v=m&&(!y||!1!==y.baseline),x=m&&(!b||!1!==b.baseline),k=y?.jaggedBase||!1,w=b?.jaggedBase||!1,S="var(--semiotic-border, #ccc)";return(0,ei.jsx)("svg",{width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(()=>{const e=ni(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=ni(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,ei.jsxs)("g",{className:"stream-grid",children:[p.map((t,r)=>(0,ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),f.map((e,o)=>(0,ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),v&&!k&&(0,ei.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:S,strokeWidth:1}),k&&(0,ei.jsx)("path",{d:ii("bottom",t,o),fill:"none",stroke:S,strokeWidth:1}),x&&!w&&(0,ei.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:S,strokeWidth:1}),w&&(0,ei.jsx)("path",{d:ii("left",t,o),fill:"none",stroke:S,strokeWidth:1})]})})}function ai(e,t,o){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function li(e,t){if(2>=e.length)return e;const o=[e[0]];for(let r=1;e.length-1>r;r++)t>Math.abs(e[r].pixel-o[o.length-1].pixel)||o.push(e[r]);const r=e[e.length-1];return t>Math.abs(r.pixel-o[o.length-1].pixel)?o[o.length-1]=r:o.push(r),o}function ci(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:u,yLabelRight:d,xFormat:h,yFormat:p,axisExtent:f,showGrid:g,title:m,legend:y,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k,legendPosition:w="right",legendLayout:S,foregroundGraphics:A,marginalGraphics:C,xValues:M,yValues:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,xAccessor:R,yAccessor:T,annotationData:I,pointNodes:$,curve:N,underlayRendered:F,canvasObscuresUnderlay:B=!0,linkedCrosshairName:D,linkedCrosshairSourceId:E,children:z}=e,H=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),o=e?.tickFormat||h||ai,r=Math.max(2,Math.floor(t/70)),n=e?.ticks??5,i="exact"===f?Math.max(2,n):Math.min(n,r),c=e?.tickValues??Jn(s.x,i,f),u=c.map(e=>e.valueOf()),d=c.map((e,t)=>({value:e,pixel:s.x(e),label:o(e,t,u)})),p=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),g=e?.autoRotate?Math.max(20,Math.min(p+8,55)):Math.max(55,p+8);let m=li(d,g);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==f&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),r=m[m.length-1].pixel;if(Math.abs(t-r)>1){const n=o(e,m.length,u);g>t-r&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:n})}}return m},[a,s,l,h,t,f]),O=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||p||ai,r=Math.max(2,Math.floor(o/30)),n=e?.ticks??5,i="exact"===f?Math.max(2,n):Math.min(n,r);let c=li((e?.tickValues??Jn(s.y,i,f)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==f&&!e?.tickValues){const e=s.y.domain()[1],o=s.y(e),r=c[c.length-1].pixel;if(Math.abs(o-r)>1){const n=t(e);22>Math.abs(o-r)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:o,label:n})}}return c},[a,s,l,p,o,f]),W=(0,Sr.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||p||ai,r=Math.max(2,Math.floor(o/30)),n=e.ticks??5;return li((e.tickValues??Jn(s.y,"exact"===f?Math.max(2,n):Math.min(n,r),f)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,p,o,f]),q=(0,Sr.useRef)(new Map),Y=(0,Sr.useRef)(P?.length??0),G=P?.length??0;Y.current!==G&&(Y.current=G,q.current=new Map);const V=(0,Sr.useMemo)(()=>{if(!P||0===P.length)return null;const e=wn(),r={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:R,yAccessor:T,width:t,height:o,data:I,frameType:"xy",pointNodes:$,curve:N,stickyPositionCache:q.current};return kn(_?Hn({annotations:P,context:r,..."object"==typeof _?_:{}}):P,e,L,r)},[P,_,L,t,o,R,T,I,s,$,N]),X=function(e){const t=(0,On.useSyncExternalStore)(e?Un:Qn,e?Xn:Zn,e?Xn:Zn);return e?t.positions.get(e)??null:null}(D);return(0,Sr.useEffect)(()=>{if(!X?.locked||!D)return;const e=e=>{"Escape"===e.key&&Vn(D)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[X?.locked,D]),a||m||y||A||C||V&&V.length>0||g||z||X?(0,ei.jsxs)("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,ei.jsx)("title",{children:"string"==typeof m?m:"XY Chart"}),(0,ei.jsx)("desc",{children:"string"==typeof m?m+" — XY data visualization":"XY data visualization"}),(0,ei.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&s&&(!F||B)&&(()=>{const e=ni(l?.find(e=>"bottom"===e.orient)?.gridStyle),r=ni(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,ei.jsxs)("g",{className:"stream-grid",children:[H.map((t,r)=>(0,ei.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:o,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+r)),O.map((e,o)=>(0,ei.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+o))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),r=l?.find(e=>"bottom"===e.orient),n=!e||!1!==e.baseline,s=!r||!1!==r.baseline,a=e?.jaggedBase||!1,h=r?.jaggedBase||!1,p=r?.landmarkTicks,f=e?.landmarkTicks,g="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",b=!!r?.autoRotate&&H.length>1&&(()=>{const e=t/Math.max(H.length-1,1);return H.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),v=b?12:18,x=o+(b?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},S={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},A=r?.tickAnchor,C=e?.tickAnchor,M=ri(H),j=ri(O);return(0,ei.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!F||B)&&s&&!h&&(0,ei.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:g,strokeWidth:1}),(!F||B)&&h&&(0,ei.jsx)("path",{d:ii("bottom",t,o),fill:"none",stroke:g,strokeWidth:1}),H.map((e,t)=>{const r=!!p&&("function"==typeof p?p(e.value,t):Ao(e.value,t>0?H[t-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(${e.pixel},${o})`,children:[(0,ei.jsx)("line",{y2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{y:v,textAnchor:b?"end":ti(A,e.pixel===M.min,e.pixel===M.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},transform:b?"rotate(-45)":void 0,children:e.label}):(0,ei.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,ei.jsx)("text",{x:t/2,y:x,textAnchor:"middle",fill:y,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:c})]}),(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!F||B)&&n&&!a&&(0,ei.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:g,strokeWidth:1}),(!F||B)&&a&&(0,ei.jsx)("path",{d:ii("left",t,o),fill:"none",stroke:g,strokeWidth:1}),O.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):Ao(e.value,t>0?O[t-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,ei.jsx)("line",{x2:-5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:oi(C,e.pixel===j.min,e.pixel===j.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,ei.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||u;return t?(0,ei.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===W.length)return null;const r=!1!==e.baseline,n=e.landmarkTicks,s=e.label||d,a=e.tickAnchor,c=ri(W);return(0,ei.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&(0,ei.jsx)("line",{x1:t,y1:0,x2:t,y2:o,stroke:g,strokeWidth:1}),W.map((e,o)=>{const r=!!n&&("function"==typeof n?n(e.value,o):Ao(e.value,o>0?W[o-1].value:void 0));return(0,ei.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,ei.jsx)("line",{x2:5,stroke:g,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,ei.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:oi(a,e.pixel===c.min,e.pixel===c.max),fontWeight:r?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},children:e.label}):(0,ei.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,ei.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+o)}),s&&(0,ei.jsx)("text",{x:t+i.right-15,y:o/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${t+i.right-15}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...S},children:s})]})})()]})})(),V,C&&s&&M&&j&&(0,ei.jsxs)(ei.Fragment,{children:[C.top&&(0,ei.jsx)("g",{transform:"translate(0, 0)",children:(0,ei.jsx)(Gr,{orient:"top",config:Yr(C.top),values:M,scale:s.x,size:i.top,length:t})}),C.bottom&&(0,ei.jsx)("g",{transform:`translate(0, ${o})`,children:(0,ei.jsx)(Gr,{orient:"bottom",config:Yr(C.bottom),values:M,scale:s.x,size:i.bottom,length:t})}),C.left&&(0,ei.jsx)("g",{transform:"translate(0, 0)",children:(0,ei.jsx)(Gr,{orient:"left",config:Yr(C.left),values:j,scale:s.y,size:i.left,length:o})}),C.right&&(0,ei.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,ei.jsx)(Gr,{orient:"right",config:Yr(C.right),values:j,scale:s.y,size:i.right,length:o})})]}),A,X&&X.sourceId!==E&&s?.x&&(()=>{const e=s.x(X.xValue);if(null==e||0>e||e>t)return null;const r=X.locked;return(0,ei.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),z]}),m&&(0,ei.jsx)("text",{x:r/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof m?m:null}),Hr({legend:y,totalWidth:r,totalHeight:n,margin:i,legendPosition:w,title:m,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:x,legendIsolatedCategories:k})]}):null}var ui=c(require("react")),di=require("d3-shape");function hi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function pi(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const o=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,o));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var fi=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function gi(e){const{innerRadius:t,outerRadius:o,startAngle:r,endAngle:n}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=fi(o,r),t=fi(o,n);return`M0,0 L${e.x},${e.y} A${o},${o} 0 ${n-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=fi(o,r),s=fi(o,n),a=fi(t,n),l=fi(t,r),c=n-r>Math.PI?1:0;return`M${e.x},${e.y} A${o},${o} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(o-t)/2));if(0===s)return gi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,o-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=n-r,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>a,h=!!e.roundEnd&&u>a;if(!d&&!h)return gi({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const p=r+(d?a:0),f=n-(h?a:0),g=r+(d?l:0),m=n-(h?l:0),y=fi(o,p),b=fi(o,f),v=(o-s)*Math.cos(a),x=fi(v,r),k=fi(v,n),w=i?null:fi(t,m),S=i?null:fi(t,g),A=i?0:(t+s)*Math.cos(l),C=i?null:fi(A,r),M=i?null:fi(A,n),j=f-p>Math.PI?1:0,P=i?0:m-g>Math.PI?1:0;let _="";if(d)_+=`M${x.x},${x.y}`,_+=` A${s},${s} 0 0 1 ${y.x},${y.y}`;else{const e=fi(o,r);_+=`M${e.x},${e.y}`}if(h)_+=` A${o},${o} 0 ${j} 1 ${b.x},${b.y}`,_+=` A${s},${s} 0 0 1 ${k.x},${k.y}`;else{const e=fi(o,n);_+=` A${o},${o} 0 ${j} 1 ${e.x},${e.y}`}if(i)_+=" L0,0";else{if(h)_+=` L${M.x},${M.y}`,_+=` A${s},${s} 0 0 1 ${w.x},${w.y}`;else{const e=fi(t,n);_+=` L${e.x},${e.y}`}if(d)_+=` A${t},${t} 0 ${P} 0 ${S.x},${S.y}`,_+=` A${s},${s} 0 0 1 ${C.x},${C.y}`;else{const e=fi(t,r);_+=` A${t},${t} 0 ${P} 0 ${e.x},${e.y}`}}return _+=" Z",_}function mi(e){const t=gi({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),o=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let n=0;r.length>n;n++)o.push({d:gi({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+n*t,endAngle:e.endAngle}),color:r[n]})}return{clipPath:t,slices:o}}var yi=require("react/jsx-runtime"),bi={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function vi(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}function xi(e,t,o){const r=_t(e.symbolType,e.size,e.path);return(0,yi.jsx)("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?vi(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${o??""}symbol-${t}`)}function ki(e,t,o,r){const n=e.glyph;if(!n?.parts?.length||0>=e.size)return null;const i=Po(n,e.size);if(0>=i.scale)return null;const s=`translate(${t},${o})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=To(n,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?wi(r+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),d=t=>n.parts.map((o,r)=>{const n=t?"none"===o.fill?void 0:t:_o(o.fill,a,e.accent),i=t?o.stroke&&"none"!==o.stroke?t:void 0:_o(o.stroke??"none",a,e.accent);return n||i?(0,yi.jsx)("path",{d:o.d,fill:n??"none",stroke:i,strokeWidth:i?o.strokeWidth??1:void 0,strokeLinecap:o.strokeLinecap,strokeLinejoin:o.strokeLinejoin,opacity:o.opacity},r):null});return(0,yi.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,yi.jsx)("clipPath",{id:c,children:(0,yi.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,yi.jsx)("g",{children:d(e.ghostColor)}):null,l&&c?(0,yi.jsx)("g",{clipPath:`url(#${c})`,children:d()}):d()]},r)}function wi(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}var Si="undefined"==typeof window||"undefined"==typeof document,Ai=require("react"),Ci="undefined"!=typeof window?Ai.useLayoutEffect:Ai.useEffect;function Mi(){const[e,t]=(0,Ai.useState)(!1);return Ci(()=>{t(!0)},[]),e}var ji=()=>()=>{},Pi=()=>!1,_i=()=>!0;function Li(){const e=(0,Ai.useSyncExternalStore)(ji,Pi,_i);return(0,Ai.useRef)(e).current}function Ri(e){const{hydrated:t,wasHydratingFromSSR:o,storeRef:r,dirtyRef:n,renderFnRef:i,cancelRender:s,cleanup:a}=e;Ci(()=>{t&&o&&r.current?.cancelIntroAnimation?.(),n.current=!0,s?.(),i.current()},[t,o]);const l=(0,Ai.useRef)(a);l.current=a,(0,Ai.useEffect)(()=>()=>l.current?.(),[])}var Ti=require("react");function Ii(e){const t=(0,Ti.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Ni(e,t);if(!Fi(e)||!Fi(t))return!1;const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(const r of o){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;const o=e[r],n=t[r];if(!Object.is(o,n))if(Array.isArray(o)&&Array.isArray(n)){if(!Ni(o,n))return!1}else{if(!Fi(o)||!Fi(n))return!1;if(!$i(o,n))return!1}}return!0}(t.current,e)||(t.current=e),t.current}function $i(e,t){const o=Object.keys(e),r=Object.keys(t);if(o.length!==r.length)return!1;for(const r of o){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(!Object.is(e[r],t[r]))return!1}return!0}function Ni(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(!Object.is(e[o],t[o]))return!1;return!0}function Fi(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Bi(e,t){const{background:o,hasBackgroundGraphics:r=!1,themeBackground:n="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===o)return!1;if(r)return!1;const c=o||(n&&"transparent"!==n?n:"")||null;if(!c)return!1;const u=Oo(e,c);return!!u&&(e.fillStyle=u,e.fillRect(i,s,a,l),!0)}var Di={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",primary:"#007bff",background:""};function Ei(e,t){const o=e.trim();if(/^#[0-9a-f]{3}$/i.test(o)){const e=o[1],r=o[2],n=o[3];return`#${e}${e}${r}${r}${n}${n}${t}`}if(/^#[0-9a-f]{6}$/i.test(o))return`${o}${t}`;const r=o.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return r?`rgba(${r[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:o}var zi=c(require("react")),Hi=c(require("react")),Oi=require("react/jsx-runtime"),Wi=Hi.createContext(null);function qi({children:e}){const[t,o]=Hi.useState(!1),r=Hi.useCallback(()=>o(e=>!e),[]),n=Hi.useMemo(()=>({visible:t,setVisible:o,toggle:r}),[t,r]);return(0,Oi.jsx)(Wi.Provider,{value:n,children:e})}function Yi(){return Hi.useContext(Wi)}function Gi(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[o,r]of Object.entries(e))o.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[o]=r):"string"==typeof r?t[o]=r:"boolean"==typeof r?t[o]=r+"":r instanceof Date&&(t[o]=r.toISOString().slice(0,10)));return t}function Vi(e){return e&&"object"==typeof e?e:{}}function Xi(e){return Vi(e.accessibility).tableFields??e.accessibleDatum??e.datum}var Ui=require("react/jsx-runtime"),Ki={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Qi(e,t){if(!e||0===e.length)return t+", empty";const o={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";o[e]=(o[e]||0)+1}if(0===Object.keys(o).length)return t+", empty";const r=[],n={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(o).sort((e,t)=>{const o=i.indexOf(e),r=i.indexOf(t);return(-1===o?999:o)-(-1===r?999:r)});for(const e of s)r.push(`${o[e]} ${n[e]||e}`);return`${t}, ${r.join(", ")}`}function Zi(e,t,o){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?o+", empty":`${o}, ${r.join(", ")}`}var Ji=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},es="semiotic-accessible-data-table",ts=es+" semiotic-accessible-data-table-hidden",os=es+" semiotic-accessible-data-table-visible",rs=os+" semiotic-accessible-data-table-network",ns={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},is={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ss={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},as={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},ls={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},cs={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},us={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ds={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function hs({scene:e,chartType:t,tableId:o,chartTitle:r}){const[n,i]=zi.useState(!1),[s,a]=zi.useState(5),l=Yi(),c=l?.visible??!1,u=n||c,d=zi.useRef(null),h=r?"Data summary for "+r:o?`Data summary for ${t} ${o}`:"Data summary for "+t;zi.useEffect(()=>{u||a(5)},[u]);const p=zi.useCallback(e=>{e.target===e.currentTarget&&(n||c||i(!0))},[n,c]),f=zi.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return o?(0,Ui.jsx)("span",{id:o,tabIndex:-1,style:Ki}):null;if(!u)return(0,Ui.jsx)("div",{id:o,className:ts,tabIndex:-1,onFocus:p,style:Ki,role:"region","aria-label":h,children:(0,Ui.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const g=function(e){const t=[];if(!Array.isArray(e))return t;const o=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(o)break;t.push({label:"Point",values:Gi(Xi(r))});break;case"line":case"area":{const e=Xi(r),o=Array.isArray(e)?e:[],n="line"===r.type?"Line point":"Area point";for(const e of o)t.push({label:n,values:Gi(e)});break}case"rect":{const e=Xi(r),o=null!=e&&"object"==typeof e?e:{},n=o.category??r.group??"",i=o.value??o.__aggregateValue??o.total,s=Gi(o);null==s.category&&""!==n&&(s.category=n+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Gi(Xi(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Xi(r),o=Gi(e);if(null==o.category){const t=Vi(e),r=t.category??t.label;null!=r&&(o.category=r+"")}t.push({label:"Wedge",values:o});break}case"circle":t.push({label:"Node",values:Gi(Xi(r))});break;case"arc":t.push({label:"Arc",values:Gi(Xi(r))});break;case"candlestick":t.push({label:"Candlestick",values:Gi(Xi(r))});break;case"geoarea":{const e=Vi(Xi(r)),o=Gi(e);if(null==o.name){const t=Vi(e.properties).name??e.name;null!=t&&(o.name=t+"")}t.push({label:"Region",values:o});break}}}catch{}return t}(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const o of e)if(o&&o.values)for(const e of Object.keys(o.values))t.add(e);const o=[];for(const r of t){const t=[],n=new Set;for(const o of e){if(!o||!o.values)continue;const e=o.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&n.add(e+""))}if(t.length>0){let e=t[0],n=t[0],i=0;for(const o of t)e>o&&(e=o),o>n&&(n=o),i+=o;o.push({name:r,count:t.length,numeric:!0,min:e,max:n,mean:i/t.length})}else if(n.size>0){const e=Array.from(n);o.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return o}(g),y=function(e,t){const o=[e+" data points."];for(const e of t)if(e.numeric)o.push(`${e.name}: ${Ji(e.min)} to ${Ji(e.max)}, mean ${Ji(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");o.push(`${e.name}: ${r}.`)}return o.join(" ")}(g.length,m),b=Math.min(s,g.length),v=g.slice(0,b),x=g.length-b,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,Ui.jsxs)("div",{ref:d,id:o,className:os,tabIndex:-1,onBlur:f,style:ns,role:"region","aria-label":h,children:[(0,Ui.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:ss,children:"×"}),(0,Ui.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:is,children:y}),(0,Ui.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:as,children:[(0,Ui.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:us,children:x>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),(0,Ui.jsx)("thead",{children:(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("th",{style:ls,children:"type"}),w.map(e=>(0,Ui.jsx)("th",{style:ls,children:e},e))]})}),(0,Ui.jsx)("tbody",{children:v.map((e,t)=>(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("td",{style:cs,children:e.label}),w.map(t=>{return(0,Ui.jsx)("td",{style:cs,children:(o=e.values[t],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":Ji(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},t);var o})]},t))})]}),x>0&&(0,Ui.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:ds,children:["Show ",Math.min(25,x)," more"," ",1===x?"row":"rows"," (",x," remaining)"]})]})}function ps({nodes:e,edges:t,chartType:o,tableId:r,chartTitle:n}){const[i,s]=zi.useState(!1),[a,l]=zi.useState(5),c=Yi(),u=c?.visible??!1,d=i||u,h=n?"Data summary for "+n:r?`Data summary for ${o} ${r}`:"Data summary for "+o,p=zi.useRef(null);zi.useEffect(()=>{d||l(5)},[d]);const f=zi.useCallback(e=>{e.target===e.currentTarget&&(i||u||s(!0))},[i,u]),g=zi.useCallback(e=>{u||p.current?.contains(e.relatedTarget)||s(!1)},[u]);if(!e||0===e.length)return r?(0,Ui.jsx)("span",{id:r,tabIndex:-1,style:Ki}):null;if(!d)return(0,Ui.jsx)("div",{id:r,className:ts,tabIndex:-1,onFocus:f,style:Ki,role:"region","aria-label":h,children:(0,Ui.jsxs)("button",{type:"button",onClick:()=>s(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const m=Array.isArray(e)?e:[],y=Array.isArray(t)?t:[],b=new Map,v=new Map,x=new Map,k=new Map;for(const e of y){if(!e||"object"!=typeof e)continue;const t=e.datum??e,o="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,n="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=o&&""!==o){const e=o+"";v.set(e,(v.get(e)??0)+1),k.set(e,(k.get(e)??0)+n)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),x.set(e,(x.get(e)??0)+n)}}const w=[];for(let e=0;m.length>e;e++){const t=m[e];if(!t||"object"!=typeof t)continue;const o=t.datum?.id??t.id,r=null!=o?o+"":"node-"+e,n=b.get(r)??0,i=v.get(r)??0,s=x.get(r)??0,a=k.get(r)??0;w.push({id:r,degree:n+i,inDeg:n,outDeg:i,wDegree:s+a,wInDeg:s,wOutDeg:a})}w.sort((e,t)=>t.degree-e.degree);let S=0,A=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>A&&(A=t.degree);S=e/w.length}const C=y.some(e=>{const t=e?.datum??e;return"number"==typeof t?.value&&Number.isFinite(t.value)}),M=[`${w.length} nodes, ${y.length} edges.`];w.length>0&&M.push(`Mean degree: ${Ji(S)}, max degree: ${A}.`);const j=Math.min(a,w.length),P=w.slice(0,j),_=w.length-j;return(0,Ui.jsxs)("div",{ref:p,id:r,className:rs,tabIndex:-1,onBlur:g,style:ns,role:"region","aria-label":h,children:[(0,Ui.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),s(!1)},"aria-label":"Close data summary",style:ss,children:"×"}),(0,Ui.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:is,children:M.join(" ")}),(0,Ui.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+o,style:as,children:[(0,Ui.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:us,children:_>0?`Top ${j} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),(0,Ui.jsx)("thead",{children:(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("th",{style:ls,children:"id"}),(0,Ui.jsx)("th",{style:ls,children:"degree"}),(0,Ui.jsx)("th",{style:ls,children:"in"}),(0,Ui.jsx)("th",{style:ls,children:"out"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. degree"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. in"}),C&&(0,Ui.jsx)("th",{style:ls,children:"w. out"})]})}),(0,Ui.jsx)("tbody",{children:P.map((e,t)=>(0,Ui.jsxs)("tr",{children:[(0,Ui.jsx)("td",{style:cs,children:e.id}),(0,Ui.jsx)("td",{style:cs,children:e.degree}),(0,Ui.jsx)("td",{style:cs,children:e.inDeg}),(0,Ui.jsx)("td",{style:cs,children:e.outDeg}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wDegree)}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wInDeg)}),C&&(0,Ui.jsx)("td",{style:cs,children:Ji(e.wOutDeg)})]},t))})]}),_>0&&(0,Ui.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:ds,children:["Show ",Math.min(25,_)," more"," ",1===_?"node":"nodes"," (",_," remaining)"]})]})}function fs({summary:e}){return e?(0,Ui.jsx)("div",{role:"note",style:Ki,children:e}):null}function gs({tableId:e}){return(0,Ui.jsx)("a",{href:"#"+e,style:Ki,onClick:t=>{t.preventDefault();const o=document.getElementById(e);o&&requestAnimationFrame(()=>o.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ki)},children:"Skip to data table"})}function ms({hoverPoint:e}){let t="";if(e){const o=e.data||e;t="object"==typeof o?"Data point: "+Object.entries(o).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+o}return(0,Ui.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:Ki,children:t})}var ys=require("react/jsx-runtime"),bs="var(--semiotic-focus, #005fcc)";function vs({active:e,hoverPoint:t,margin:o,size:r,shape:n="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+o.left,c=t.y+o.top;let u;if("geoarea"!==n&&"path"!==n||!a)if("rect"===n&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,ys.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:bs,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,ys.jsx)("circle","wedge"===n?{cx:l,cy:c,r:12,fill:"none",stroke:bs,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:bs,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,ys.jsx)("g",{transform:`translate(${o.left},${o.top})`,children:(0,ys.jsx)("path",{d:a,fill:"none",stroke:bs,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,ys.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var xs=c(require("react"));function ks(e,t){return"touch"===t?Math.max(e,24):e}function ws(e){return Array.isArray(e)?e[0]:e}function Ss(e,t,o,r){return{data:ws(e),x:t,y:o,__semioticHoverData:!0,...r}}var As=["name","label","title"],Cs=["type","kind","category","group","class","status","role","shape"],Ms=["value","amount","total","count","weight","score"],js=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function Ps(e,t){for(const o of t){const t=e.find(e=>e.lower===o);if(t)return t}}function _s(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const o=t.maxEntries??6,r=!1!==t.skipPositional,n=[];for(const[t,o]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&js.has(t.toLowerCase()))continue;if(null==o)continue;const e=typeof o;("string"===e||"number"===e||"boolean"===e||o instanceof Date)&&n.push({key:t,lower:t.toLowerCase(),value:o})}if(0===n.length)return{entries:[]};let i=n.findIndex(e=>As.includes(e.lower));const s=i>=0;0>i&&(i=n.findIndex(e=>"id"===e.lower)),0>i&&(i=n.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:n[i];let l=n.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=Ps(l,Cs),u=Ps(l,Ms),d=new Set(Cs),h=new Set(Ms),p=[];c&&p.push({key:c.key,value:c.value}),u&&p.push({key:u.key,value:u.value});for(const e of l){if(p.length>=o)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||p.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:p}}var Ls=require("react/jsx-runtime"),Rs={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ts(e,t){return"function"==typeof t?t(e):e[t]}function Is(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return 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 $s(e={}){const{fields:t,title:o,format:r,style:n={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(o){const t=Ts(e,o);s=Is(t,r)}if(t&&t.length>0)t.forEach(t=>{let o,n,i;"string"==typeof t?(o=t,n=t,i=r):(o=t.label,n=t.accessor||t.key||"",i=t.format||r);const s=Ts(e,n);a.push({label:o,value:Is(s,i)})});else if(!o){const t=["value","y","name","id","label"];for(const o of t)if(void 0!==e[o]){s=Is(e[o],r);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=Is(e[t[0]],r))}}const l={...Rs,...n};return(0,Ls.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,Ls.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,Ls.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,Ls.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function Ns(e={}){const{fields:t=[],title:o,format:r,style:n={},className:i="",showLabels:s=!0,separator:a=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(o){const t=Ts(e,o);l.push({value:Is(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let o,n,i;"string"==typeof t?(o=t,n=t,i=r):(o=t.label,n=t.accessor||t.key||"",i=t.format||r);const a=Is(Ts(e,n),i);l.push({label:s?o:void 0,value:a})});else{const t=_s(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:Is(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:s?e.key:void 0,value:Is(e.value,r)})})}const c={...Rs,...n};return Array.isArray(l)&&0!==l.length?(0,Ls.jsx)("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>(0,Ls.jsxs)("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&(0,Ls.jsxs)("strong",{children:[e.label,a]}),e.value]},t))}):null}}function Fs(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,Ls.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:(0,Ls.jsx)("div",{children:Is(e.data?.value??e.data?.y)})});const o=e.xValue??e.data?.time??e.data?.x;return(0,Ls.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=o&&(0,Ls.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Is(o)}),t.map((e,t)=>(0,Ls.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,Ls.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,Ls.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,Ls.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Is(e.value)})]},t))]})}}function Bs(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let o=ws(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);("node"===e?.nodeOrEdge&&"number"==typeof o?.x0&&"number"==typeof o?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof o?.sankeyWidth)&&o.data&&"object"==typeof o.data&&(o=o.data);const r=t(o);return null==r?null:(0,Ls.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?$s(e):$s())}}var Ds=require("react/jsx-runtime");function Es({x:e,y:t,containerWidth:o,containerHeight:r,margin:n,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=xs.useRef(null),[u,d]=xs.useState(null);xs.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=e.getBoundingClientRect();d(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[i,s,o,r]);let h;h=u?`translate(${u.width+12>o-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!xs.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const o=e.props;if(!0===o["data-semiotic-tooltip-chrome"])return!0;if("true"===o["data-semiotic-tooltip-chrome"])return!0;const r=o.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),f=p?null:Rs;return l?(0,Ds.jsx)("div",{ref:c,className:p?s:(s+" semiotic-tooltip").trim(),style:{...f||{},position:"absolute",left:n.left+e,top:n.top+t,transform:h,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var zs=c(require("react")),Hs=require("react"),Os=require("react");function Ws(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const o=e;return o.addListener(t),()=>o.removeListener(t)}var qs=require("react");function Ys(e,t,o){const r=(0,qs.useRef)(null),[n,i]=(0,qs.useState)(null);return(0,qs.useEffect)(()=>{if(!t&&!o)return;const e=r.current;if(!e)return;const n=new ResizeObserver(e=>{for(const t of e){const{width:e,height:o}=t.contentRect;i(t=>t&&t.w===e&&t.h===o?t:{w:e,h:o})}});return n.observe(e),()=>n.disconnect()},[t,o]),[r,[t&&n?n.w:e[0],o&&n?n.h:e[1]]]}var Gs="undefined"==typeof window?Hs.useEffect:Hs.useLayoutEffect,Vs={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Xs(e,t,o){return"function"==typeof e?e({size:t,margin:o}):e}function Us(e){const t=function(){const[e,t]=(0,Os.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Os.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),Ws(e,e=>t(e.matches))},[]),e}(),o=(0,Hs.useRef)(t);o.current=t;const[r,n]=Ys(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=(0,Hs.useMemo)(()=>({...e.marginDefault,...e.userMargin}),[e.marginDefault,e.userMargin]),s=n[0]-i.left-i.right,a=n[1]-i.top-i.bottom,l=Xs(e.foregroundGraphics,n,i),c=Xs(e.backgroundGraphics,n,i),u=ee(e=>e.theme),{transition:d,introEnabled:h}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const o="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(o||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+zs.useId(),f=(0,Hs.useRef)(null),g=(0,Hs.useRef)(e.frameScheduler??Vs);g.current=e.frameScheduler??Vs;const m=(0,Hs.useRef)(null),y=(0,Hs.useRef)(!1),b=(0,Hs.useRef)(()=>{}),v=(0,Hs.useCallback)(()=>{if(null!==f.current||y.current)return;const e=g.current;let t=!1,o=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!o;e&&(y.current=!0),f.current=null,m.current=null;try{b.current()}finally{e&&(y.current=!1)}});o=!0,t||(f.current=r,m.current=e)},[]),x=(0,Hs.useCallback)(()=>{null!==f.current&&((m.current??g.current).cancelAnimationFrame(f.current),f.current=null,m.current=null)},[]);(0,Hs.useEffect)(()=>()=>{x()},[x]);const k=(0,Hs.useRef)(()=>{}),w=(0,Hs.useRef)(()=>{}),S=(0,Hs.useRef)(null),A=(0,Hs.useRef)(null),C=(0,Hs.useRef)(null),M=(0,Hs.useCallback)(()=>{const e=S.current;S.current=null,e&&k.current(e)},[]),j=(0,Hs.useCallback)(e=>{if(S.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===A.current){const e=g.current;let t=!1;const o=e.requestAnimationFrame(()=>{t=!0,A.current=null,C.current=null,M()});t||(A.current=o,C.current=e)}},[M]),P=(0,Hs.useCallback)(()=>{S.current=null,null!==A.current&&((C.current??g.current).cancelAnimationFrame(A.current),A.current=null,C.current=null),w.current()},[]);(0,Hs.useEffect)(()=>()=>{S.current=null,null!==A.current&&((C.current??g.current).cancelAnimationFrame(A.current),A.current=null,C.current=null)},[]);const _=e.themeDirtyRef;return Gs(()=>{_&&(Do++,_.current=!0,v())},[u,v,_]),{reducedMotion:t,reducedMotionRef:o,responsiveRef:r,size:n,margin:i,adjustedWidth:s,adjustedHeight:a,resolvedForeground:l,resolvedBackground:c,currentTheme:u,transition:d,introEnabled:h,tableId:p,rafRef:f,renderFnRef:b,scheduleRender:v,cancelRender:x,hoverHandlerRef:k,hoverLeaveRef:w,onPointerMove:j,onPointerLeave:P}}function Ks(e,t,o,r){const n=r.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(o||i||!s&&!n)&&e.refreshPulse(t);return r.current=s,{changed:a,pending:s}}function Qs(e,t,o,r){const n=e.getContext("2d");if(!n)return null;const i=Math.round(t[0]*r),s=Math.round(t[1]*r),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),n.setTransform(a,0,0,l,0,0),n.translate(o.left,o.top),n}function Zs(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}var Js=require("react");function ea(e,t){if(!t)return[];const o=new Set,r=[];for(const n of e){if(!n||"object"!=typeof n)continue;const e="function"==typeof t?t(n):n[t];if(null==e)continue;const i=e+"";o.has(i)||(o.add(i),r.push(i))}return r}function ta(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function oa(e,t,o,r){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:o,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:r,fn:t}:{key:void 0,fn:null}}function ra(e,t,o){return r=>{if(!r||!o||!e.fn&&!t.fn)return r;let n=!1;const i=r.map(o=>{const r=e.fn&&e.key&&!(e.key in o),i=t.fn&&t.key&&!(t.key in o);if(!r&&!i)return o;n=!0;const s={...o};return r&&(s[e.key]=e.fn(o)),i&&(s[t.key]=t.fn(o)),s});return n?i:r}}var na=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ia=3156e7;function sa(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:ia>t?e=>{const t=new Date(e);return`${na[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*ia>t?e=>{const t=new Date(e);return`${na[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function aa(e){if(!e)return;const t=[];for(const o of e)if("point"===o.type)t.push(o);else if("symbol"===o.type)t.push({pointId:o.pointId,x:o.x,y:o.y,r:Lt(o.size)});else if("glyph"===o.type){const e=Io(o.glyph,o.size);t.push({pointId:o.pointId,x:o.x+e.centerDx,y:o.y+e.centerDy,r:e.radius})}return t}var la=require("d3-shape");function ca(e,t,o){let r=o;for(const o of t)"lesser"===o.thresholdType?o.value>e&&(r=o.color):e>o.value&&(r=o.color);return r}function ua(e,t,o,r,n,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const o=t[e][0]-t[e-1][0],r=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(o*o+r*r))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=o,e.lineWidth=r,e.lineCap=i;for(let o=0;t.length-1>o;o++){const r=(s[o]+s[o+1])/2;let i=n;l>r&&(i*=r/l),l>a-r&&(i*=(a-r)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[o][0],t[o][1]),e.lineTo(t[o+1][0],t[o+1][1]),e.stroke()}}var da=(e,t,o,r)=>{const n=t.filter(e=>"line"===e.type);for(const t of n){if(2>t.path.length)continue;const o=t._introClipFraction;void 0!==o&&1>o&&(e.save(),e.beginPath(),e.rect(0,0,r.width*o,r.height),e.clip());const n=t.style.stroke||"#007bff",i=Oo(e,n)||n,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){ua(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Yo(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,d=t._decayOpacities;if(d&&d.length===t.path.length&&!u){e.strokeStyle=i;const o=t.style.opacity??1;for(let r=0;t.path.length-1>r;r++)e.globalAlpha=.5*(d[r]+d[r+1])*o,e.beginPath(),e.moveTo(t.path[r][0],t.path[r][1]),e.lineTo(t.path[r+1][0],t.path[r+1][1]),e.stroke()}else if(u){let o=function(t,o,r){e.beginPath(),e.strokeStyle=t,e.moveTo(o,r),d=!0},r=function(){d&&(e.stroke(),d=!1)},n=null,s=null,c=null,u=null,d=!1;for(let d=0;t.path.length>d;d++){const[h,p]=t.path[d],f=l[d],g=ca(f,a,i);if(null!==n&&null!==u&&null!==c){if(g===u)e.lineTo(h,p);else{const t=[];for(const e of a){const o=e.value;(c>o||o>f)&&(o>c||f>o)||c===o||f===o||t.push({t:(o-c)/(f-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=n+(h-n)*l.t,u=s+(p-s)*l.t,d=ca(c+(f-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),r(),o(d,t,u)}e.lineTo(h,p)}n=h,s=p,c=f,u=g}else o(g,h,p),n=h,s=p,c=f,u=g}r()}else{e.beginPath();const o=t.strokeGradient&&t.path.length>=2?Xo(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=o||i,c)(0,la.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,r]=t.path[0];e.moveTo(o,r);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=Go(e,t.style.fill,t.style.fill),c&&!u)(0,la.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[o,r]=t.path[0];e.moveTo(o,r);for(let o=1;t.path.length>o;o++)e.lineTo(t.path[o][0],t.path[o][1])}const o=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],r.height),e.lineTo(o,r.height),e.closePath(),e.fill()}void 0!==o&&1>o&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function ha(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function pa(e,t,o=.3){ha(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function fa(e,t,o=.6){if(!ha(t))return;const r=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,n=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(n,i,r,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*o,e.stroke()}function ga(e,t,o,r=.35){ha(t)&&(e.globalAlpha=t._pulseIntensity*r,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",o?e.fill(o):e.fill())}var ma=require("d3-shape");function ya(e,t){const o=Yo(t.curve);if(!o||2>t.topPath.length||2>t.bottomPath.length){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]);for(let o=t.bottomPath.length-1;o>=0;o--)e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]);e.closePath()}else{const r=(0,ma.area)().x(e=>e[0]).y0((e,o)=>t.bottomPath[o][1]).y1(e=>e[1]).curve(o).context(e);e.beginPath(),r(t.topPath)}}var ba=(e,t,o,r)=>{const n=t.filter(e=>"area"===e.type);for(const t of n){if(2>t.topPath.length)continue;let o=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),o=!0);const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,r.width*n,r.height),e.clip());const i=Go(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const o=t.style.fillOpacity??.7;e.fillStyle=i;for(let r=0;t.topPath.length-1>r;r++)e.globalAlpha=.5*(s[r]+s[r+1])*o,e.beginPath(),e.moveTo(t.topPath[r][0],t.topPath[r][1]),e.lineTo(t.topPath[r+1][0],t.topPath[r+1][1]),e.lineTo(t.bottomPath[r+1][0],t.bottomPath[r+1][1]),e.lineTo(t.bottomPath[r][0],t.bottomPath[r][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1]),e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if(ya(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let o=1/0;for(const e of t.topPath)o>e[1]&&(o=e[1]);let r=-1/0;for(const e of t.bottomPath)e[1]>r&&(r=e[1]);const n=Vo(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,o,0,r);e.fillStyle=n||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(ya(e,t),ga(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const o=t.strokeGradient&&t.topPath.length>=2?Xo(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=o||Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const r=Yo(t.curve);if(e.beginPath(),r)(0,ma.line)().x(e=>e[0]).y(e=>e[1]).curve(r).context(e)(t.topPath);else{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()}void 0!==n&&1>n&&e.restore(),o&&e.restore(),e.globalAlpha=1}},va=(e,t,o,r)=>{const n=t.filter(e=>"point"===e.type);if(0!==n.length){e.save();try{const t=e.globalAlpha;for(const o of n)e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.globalAlpha=t*(o.style.opacity??o.style.fillOpacity??1),e.fillStyle=Go(e,o.style.fill,"#4e79a7"),e.fill(),o.style.stroke&&(e.strokeStyle=Go(e,o.style.stroke,o.style.stroke),e.lineWidth=o.style.strokeWidth||1,e.stroke()),fa(e,o)}finally{e.restore()}}},xa=new Map;function ka(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=xa.get(t);return o||(o=new Path2D(_t(e.symbolType,e.size)),xa.size>256&&xa.clear(),xa.set(t,o)),o}catch{return null}}var wa=(e,t)=>{const o=e.globalAlpha;for(const r of t){if("symbol"!==r.type)continue;const t=r;if(0>=t.size)continue;const n=ka(t);if(!n)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle=Go(e,t.style.fill,"#4e79a7"),e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Go(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(n)),e.restore()}e.globalAlpha=o};function Sa(e,t,o,r,n){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=Po(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const o=Go(e,t,t);return"string"==typeof o?o:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(o,r),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=n*a*(t.style.fillOpacity??1);const u=To(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&$o(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),$o(e,i,c,t.accent,void 0,l),e.restore()}var Aa=(e,t)=>{const o=e.globalAlpha;for(const r of t)"glyph"===r.type&&Sa(e,r,r.x,r.y,o);e.globalAlpha=o};function Ca(e,t){const{x:o,y:r,w:n,h:i}=t,{tl:s,tr:a,br:l,bl:c}=pi(t);e.beginPath(),e.moveTo(o+s,r),e.lineTo(o+n-a,r),a>0&&e.arcTo(o+n,r,o+n,r+a,a),e.lineTo(o+n,r+i-l),l>0&&e.arcTo(o+n,r+i,o+n-l,r+i,l),e.lineTo(o+c,r+i),c>0&&e.arcTo(o,r+i,o,r+i-c,c),e.lineTo(o,r+s),s>0&&e.arcTo(o,r,o+s,r,s),e.closePath()}function Ma(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var ja=(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type);for(const t of n){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Pa(e,t);else if(t.cornerRadii&&hi(t.cornerRadii)){const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o,Ca(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const o=Go(e,t.style.fill,Oo(e,"var(--semiotic-primary, #007bff)")),r=Ma(t),n=t.fillGradient&&"string"==typeof o?Vo(e,t.fillGradient,o,r.x0,r.y0,r.x1,r.y1):null;e.fillStyle=n||o,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}pa(e,t),e.globalAlpha=1}};function Pa(e,t){const o=t.style.icon,r=t.style.iconPadding||2,n=Math.min(t.w,t.h)-r;if(0>=n)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=n+r,s=t.x+(t.w-n)/2;for(let r=t.y+t.h-n;r>=t.y-n;r-=i)e.drawImage(o,s,r,n,n)}else{const i=n+r,s=t.y+(t.h-n)/2;for(let r=t.x;t.x+t.w>r;r+=i)e.drawImage(o,r,s,n,n)}e.restore()}function _a(e){const[t,o,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*r>128?"#000":"#fff"}function La(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var Ra=(e,t,o,r)=>{const n=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of n){const o=t.style;if(null!=o?.opacity&&(e.globalAlpha=o.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Oo(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),pa(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const o=t.valueFormat?t.valueFormat(t.value):La(t.value),r=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),n=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=_a(t.fill),e.font=r+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(o,n,i)}}}finally{e.restore()}},Ta=(e,t,o,r)=>{for(const o of t){if("candlestick"!==o.type)continue;const t=o;e.save();const n=(t._decayOpacity??1)*(t.style?.opacity??1);1!==n&&(e.globalAlpha=n);const i=Oo(e,t.wickColor)||t.wickColor,s=60>r.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const o=Math.max(2,Math.min(t.bodyWidth/2,.12*r.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,o,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,o,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const o=Math.min(t.openY,t.closeY),r=Math.abs(t.openY-t.closeY),n=t.isUp?t.upColor:t.downColor,i=Oo(e,n)||n;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,o,t.bodyWidth,Math.max(r,1))}s&&l(),e.restore()}},Ia={line:[ba,da,va],area:[ba,va],stackedarea:[ba,va],scatter:[va,wa],bubble:[va,wa],heatmap:[Ra],bar:[ja],swarm:[va],waterfall:[(e,t,o,r)=>{ja(e,t);const n=t.filter(e=>"rect"===e.type);if(2>n.length)return;const i=n[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=Oo(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;n.length-1>t;t++){const r=n[t],i=n[t+1],s=r.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=o.y(s.cumEnd),c=r.x+r.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[Ta],mixed:[ba,da,va],custom:[ba,ja,Ra,da,va,wa,Aa,Ta]},$a=require("react/jsx-runtime");function Na(e){return"string"==typeof e?e:"value"}function Fa(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ba(e,t){if(!t)return Fa(e);try{const o=t(e);return null==o?Fa(e):o}catch{return Fa(e)}}function Da(e,t){return"function"==typeof t?t(e):e[t]}function Ea(e,t){if(!e)return[];const o=[];return(Array.isArray(e)?e:[e]).forEach((e,r)=>{const n="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";o.push({label:n,accessor:e=>e?.bands?.[r]?.y0??(0===r?e?.band?.y0:void 0),format:t}),o.push({label:i,accessor:e=>e?.bands?.[r]?.y1??(0===r?e?.band?.y1:void 0),format:t})}),o}function za(e){const t=e.find(e=>"title"===e.role),o=e.filter(e=>"title"!==e.role);return e=>{const r=e.data;if(!r)return null;const n=t?Ba(Da(r,t.accessor),t.format):null;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=n&&(0,$a.jsx)("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:n}),o.map((e,t)=>{const o=Ba(Da(r,e.accessor),e.format);return(0,$a.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,$a.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,$a.jsx)("span",{children:o})]},t)})]})}}function Ha({categoryAccessor:e,valueAccessor:t,groupAccessor:o,groupLabel:r,pieData:n=!1,valueFormat:i}){return s=>{const a=n?s.data?.[0]||s.data||s:s.data||s,l=Da(a,e),c=Da(a,t),u=o?Da(a,o):void 0;return(0,$a.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,$a.jsx)("div",{style:{fontWeight:"bold"},children:Fa(l)}),(0,$a.jsx)("div",{style:{marginTop:4},children:Ba(c,i)}),null!=u&&(0,$a.jsxs)("div",{style:{marginTop:2,opacity:.8},children:[r||Na(o),": ",Fa(u)]})]})}}var Oa=require("react/jsx-runtime");function Wa(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function qa({hover:e}){const t=e.data??{},o=t.y??t.value,r=t.x??t.time;if(void 0===o&&void 0===r){const e=_s(t);if(null!=e.title||e.entries.length>0)return(0,Oa.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=e.title&&(0,Oa.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,Oa.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,Oa.jsx)("span",{style:{fontWeight:600},children:Wa(e.value)})]},e.key))]})}return(0,Oa.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,Oa.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:Wa(o)}),(0,Oa.jsx)("div",{style:{opacity:.7,fontSize:11},children:Wa(r)})]})}qa.ownsChrome=!0;var Ya=require("react/jsx-runtime"),Ga={top:20,right:20,bottom:30,left:40},Va=Di;function Xa(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var Ua=(0,P.memo)((0,P.forwardRef)(function(e,t){const{chartType:o,runtimeMode:r,data:n,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:p,groupAccessor:f,lineDataAccessor:g,curve:m,normalize:y,baseline:b,stackOrder:v,binSize:x,valueAccessor:k,arrowOfTime:w="right",windowMode:S="sliding",windowSize:A=200,timeAccessor:C,xExtent:M,yExtent:_,extentPadding:L=.1,scalePadding:R,sizeRange:T,size:I=[500,300],responsiveWidth:$,responsiveHeight:N,margin:F,className:B,background:E,lineStyle:O,pointStyle:W,areaStyle:q,barStyle:Y,waterfallStyle:V,swarmStyle:X,barColors:U,colorScheme:K,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:te,lineGradient:oe,areaGroups:re,openAccessor:ne,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,showAxes:ce=!0,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:fe,yFormat:ge,axisExtent:me,tickFormatTime:ye,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:xe,customHoverBehavior:ke,customClickBehavior:we,enableHover:Se,hoverRadius:Ae=30,tooltipMode:Ce,annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,showGrid:_e,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,legendCategoryAccessor:Be,onCategoriesChange:De,backgroundGraphics:Ee,foregroundGraphics:ze,canvasPreRenderers:He,svgPreRenderers:Oe,title:We,categoryAccessor:qe,brush:Ye,onBrush:Ge,decay:Ve,pulse:Xe,transition:Ue,animate:Ke,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,marginalGraphics:rt,pointIdAccessor:nt,xScaleType:it,yScaleType:st,accessibleTable:at=!0,description:lt,summary:ct,linkedCrosshairName:ut,linkedCrosshairSourceId:dt,customLayout:ht,onLayoutError:pt,layoutConfig:ft,layoutSelection:gt}=e,mt=(0,P.useId)().replace(/:/g,""),yt=(0,P.useRef)(!1),bt=(0,P.useRef)({w:-1,h:-1}),vt=(0,P.useRef)(!1),xt=Us({sizeProp:I,responsiveWidth:$,responsiveHeight:N,userMargin:F,marginDefault:Ga,animate:Ke,transitionProp:Ue,themeDirtyRef:yt}),kt=Mi(),St=Li(),{reducedMotionRef:At,responsiveRef:Ct,size:Mt,currentTheme:jt,transition:Pt,introEnabled:_t,tableId:Lt,rafRef:Rt,renderFnRef:Tt,scheduleRender:It,cancelRender:$t}=xt;let Nt=xt.margin;if(rt){const e=60,t={...xt.margin};rt.top&&e>t.top&&(t.top=e),rt.bottom&&e>t.bottom&&(t.bottom=e),rt.left&&e>t.left&&(t.left=e),rt.right&&e>t.right&&(t.right=e),Nt=t}const Ft=Mt[0]-Nt.left-Nt.right,Bt=Mt[1]-Nt.top-Nt.bottom,Dt=(0,P.useMemo)(()=>z(n),[n]),Et=ve??Se,zt=(0,P.useRef)(null),Ht=(0,P.useRef)(null),[Ot,Wt]=(0,P.useState)(0),qt=(0,P.useRef)(0),[Yt,Gt]=(0,P.useState)(null),Vt=(e,t)=>"function"==typeof e?e({size:Mt,margin:Nt,scales:t}):e,Xt=Vt(ze,Yt),Ut=Vt(Ee,Yt),Kt=(0,P.useRef)(null),Qt=(0,P.useRef)(null),Zt=(0,P.useRef)(void 0),[Jt,eo]=(0,P.useState)(null),to=(0,P.useRef)(Va.primary),oo=(0,P.useRef)(function(){let e=-1,t=Di;return{resolve(o){if(!o)return Di;const r=Do;return r===e||(t=function(e){if(!e)return Di;const t=getComputedStyle(e),o=t.getPropertyValue("--semiotic-border").trim(),r=t.getPropertyValue("--semiotic-text-secondary").trim(),n=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=r||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=o||t.getPropertyValue("--surface-3").trim(),c=n||t.getPropertyValue("--surface-0").trim();return s||a||o||i?{axisStroke:l||Di.axisStroke,tickText:s||Di.tickText,crosshair:s?Ei(s,"66"):Di.crosshair,hoverFill:c?Ei(c,"4D"):Di.hoverFill,hoverStroke:s?Ei(s,"99"):Di.hoverStroke,pointRing:c||Di.pointRing,primary:i||Di.primary,background:c||Di.background}:Di}(o),e=r),t},invalidate(){e=-1}}}()),no=(0,P.useRef)(!1),io=(0,P.useRef)(new ao),so=(0,P.useRef)([]),lo=(0,P.useRef)(Be),uo=(0,P.useRef)(De);lo.current=Be,uo.current=De;const[ho,po]=(0,P.useState)(!1),[fo,go]=(0,P.useState)([]),[mo,bo]=(0,P.useState)([]),ko="streaming"===r||["bar","swarm","waterfall"].includes(o),wo=Ii((0,P.useMemo)(()=>({chartType:o,runtimeMode:ko?"streaming":"bounded",windowSize:A,windowMode:S,arrowOfTime:ko?w:"right",extentPadding:L,scalePadding:R,axisExtent:me,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:ko?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:h,symbolMap:p,groupAccessor:f||(g?"_lineGroup":void 0),categoryAccessor:qe,lineDataAccessor:g,xScaleType:it,yScaleType:st,xExtent:M,yExtent:_,sizeRange:T,binSize:x,normalize:y,baseline:b,stackOrder:v,boundsAccessor:Q,boundsStyle:Z,y0Accessor:J,band:ee,gradientFill:!0===te?{topOpacity:.8,bottomOpacity:.05}:!1===te?void 0:te,areaGroups:re?new Set(re):void 0,lineGradient:oe,openAccessor:ne,highAccessor:ie,lowAccessor:se,closeAccessor:ae,candlestickStyle:le,lineStyle:O,pointStyle:W,areaStyle:q,swarmStyle:X,waterfallStyle:V,colorScheme:K,barColors:U,barStyle:Y,annotations:Me,decay:Ve,pulse:Xe,transition:Pt,introAnimation:_t,staleness:Qe,heatmapAggregation:Ze,heatmapXBins:Je,heatmapYBins:et,showValues:tt,heatmapValueFormat:ot,pointIdAccessor:nt,curve:m,themeCategorical:jt?.colors?.categorical,themeSemantic:G(jt),themeSequential:jt?.colors?.sequential,themeDiverging:jt?.colors?.diverging,customLayout:ht,onLayoutError:pt,layoutConfig:ft,layoutMargin:Nt}),[o,A,S,w,L,R,me,a,l,c,C,k,it,st,u,d,h,p,f,qe,g,M,_,T,x,y,b,v,Q,Z,J,ee,te,oe,re,ne,ie,se,ae,le,O,W,q,X,V,Y,K,U,Me,Ve,Xe,Pt?.duration,Pt?.easing,_t,Qe,Ze,Je,et,tt,ot,ko,nt,m,jt,ht,pt,ft,Nt])),So=(0,P.useRef)(null);So.current||(So.current=new ro(wo));const Ao=function(e,t,o,r){return(0,Js.useCallback)(()=>{const n=t.current,i=o.current;if(!i||!n)return;const s=ea(e.current?.getData()??[],n);ta(s,r.current)||(r.current=s,i(s))},[t,o,r,e])}(So,lo,uo,so);vo(So,wo,yt,It),xo(So,gt,yt,It);const Co=(0,P.useRef)(null);Co.current||(Co.current=new H(e=>{const t=So.current;t&&t.ingest(e)&&(yt.current=!0,It())},{chunkThreshold:i,chunkSize:s})),(0,P.useEffect)(()=>{Co.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const Mo=(0,P.useCallback)(e=>{Co.current?.push(e)},[]),jo=(0,P.useCallback)(e=>{Co.current?.pushMany(e)},[]),Po=(0,P.useCallback)(()=>{Co.current?.clear(),So.current?.clear(),yt.current=!0,It()},[It]);(0,P.useImperativeHandle)(t,()=>({push:Mo,pushMany:jo,remove:e=>{Co.current?.flush();const t=So.current?.remove(e)??[];return t.length>0&&(Kt.current&&t.some(e=>e===Kt.current?.data)&&(Kt.current=null,eo(null)),yt.current=!0,It()),t},update:(e,t)=>{Co.current?.flush();const o=So.current?.update(e,t)??[];return o.length>0&&(yt.current=!0,It()),o},clear:Po,getData:()=>(Co.current?.flush(),So.current?.getData()??[]),getScales:()=>So.current?.scales??null,getExtents:()=>So.current?.getExtents()??null,getCustomLayout:()=>So.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>So.current?.lastCustomLayoutFailure??null}),[Mo,jo,Po,It]),(0,P.useEffect)(()=>{if(n){if(g&&Dt.length>0&&"object"==typeof Dt[0]&&null!==Dt[0]){const e="string"==typeof g?g:"coordinates";if(Array.isArray(Dt[0][e])){const t=[];for(const o of Dt){const r=o[e];if(Array.isArray(r)){const e=o.label||o.id||o.key;if(null!=e)for(const o of r)t.push({...o,_lineGroup:e});else for(const e of r)t.push(e)}}return void Co.current?.setBoundedData(t)}}Co.current?.setBoundedData(Dt)}},[n,Dt,g]);const{hoverHandlerRef:_o,hoverLeaveRef:Lo,onPointerMove:Ro,onPointerLeave:To}=xt;_o.current=e=>{if(!Et)return;const t=zt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-Nt.left,i=e.clientY-r.top-Nt.top;if(0>n||n>Ft||0>i||i>Bt)return void(Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&(ke(null),yt.current=!0),It()));const s=So.current;if(!s||0===s.scene.length)return;const l=ks(Ae,e.pointerType),c=Zo(s.scene,n,i,l,s.quadtree,s.maxPointRadius),u="multi"===Ce,d=()=>{Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&ke(null),It())};if(!c&&!u)return void d();const h=u||!c?n:c.x,p=u||!c?i:c.y,f=c?.datum?wt(c.datum,s.resolvedRibbons):{},g=s.scales?.x?.invert,m="function"==typeof g?g(h):void 0;let y=Ss(f,h,p,null!=m?{xValue:m,xPx:h}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,o=30){const r=[];for(const n of e)if("line"===n.type){const e=n;if(2>e.path.length)continue;const i=Jo(Qo(e.path,e.curve),t,o);if(null===i)continue;const s=cr(e.path,t);r.push({node:n,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===n.type){const e=n;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Qo(e.topPath,e.curve),s=Qo(e.bottomPath,e.curve),a=Jo(i,t,o);if(null===a)continue;const l=Jo(s,t,o),c=cr(e.topPath,t);r.push({node:n,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return r}(s.scene,h,Math.max(l,Ft));if(e.length>0){const t=s.scales.y.invert,r=to.current,n=g?g(h):h;if(c)y.xValue=n,y.xPx=h;else{const e={xValue:n};"string"==typeof a&&(e[a]=n),y=Ss(e,h,p,{xValue:n,xPx:h})}y.allSeries=e.map(e=>{const n=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===o&&null!=i?n-i:n,valuePx:e.y,color:e.color||r,datum:wt(e.datum,s.resolvedRibbons)}})}}c||y.allSeries?.length?(Kt.current=y,Qt.current=c?.node??null,eo(y),ke&&(ke(y),yt.current=!0),It()):d()},Lo.current=()=>{Kt.current&&(Kt.current=null,Qt.current=null,eo(null),ke&&(ke(null),yt.current=!0),It())};const $o=(0,P.useRef)(()=>{});$o.current=e=>{if(!we)return;const t=zt.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-Nt.left,n=e.clientY-o.top-Nt.top;if(0>r||r>Ft||0>n||n>Bt)return void we(null);const i=So.current;if(!i||0===i.scene.length)return void we(null);const s=ks(Ae,Zt.current),a=Zo(i.scene,r,n,s,i.quadtree,i.maxPointRadius);if(!a)return void we(null);const l=a.datum||{},c=i.scales?.x?.invert,u="function"==typeof c?c(a.x):void 0;we(Ss(l,a.x,a.y,null!=u?{xValue:u,xPx:a.x}:void 0))};const No=(0,P.useCallback)(e=>$o.current(e),[]),Fo=(0,P.useRef)(-1),Bo=(0,P.useRef)(null),Eo=(0,P.useRef)(null),zo=(0,P.useCallback)(e=>{const t=So.current;if(!t||0===t.scene.length)return;const o=t.version;let r;if(Eo.current&&Eo.current.version===o)r=Eo.current.graph;else{const e=function(e){const t=[];for(const o of e)switch(o.type){case"point":t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=o.size)break;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=o.size||null==o.datum)break;const e=Io(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=o,r=Array.isArray(e.datum)?e.datum:[],n=e.group??"_default";for(let o=0;e.path.length>o&&r.length>o;o++)t.push({x:e.path[o][0],y:e.path[o][1],datum:r[o],shape:"circle",group:n});break}case"area":{const e=o,r=Array.isArray(e.datum)?e.datum:[],n=e.group??"_default";for(let o=0;e.topPath.length>o&&r.length>o;o++)t.push({x:e.topPath[o][0],y:e.topPath[o][1],datum:r[o],shape:"circle",group:n});break}case"rect":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??"_default"});break;case"heatcell":t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;r=ur(e),Eo.current={version:o,graph:r}}const n=Fo.current;if(0>n){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),Fo.current=0;const o=r.flat[0];Bo.current={shape:o.shape,w:o.w,h:o.h};const n=gr({...o,datum:wt(o.datum,t.resolvedRibbons)});return Kt.current=n,eo(n),ke&&ke(n),void It()}const i=dr(r,n),s=hr(e.key,i,r);if(null===s)return;if(e.preventDefault(),0>s)return Fo.current=-1,Bo.current=null,Kt.current=null,Qt.current=null,eo(null),ke&&ke(null),void It();Fo.current=s;const a=r.flat[s];Bo.current={shape:a.shape,w:a.w,h:a.h};const l=gr({...a,datum:wt(a.datum,t.resolvedRibbons)});Kt.current=l,eo(l),ke&&ke(l),It()},[ke,It]),Ho=(0,P.useCallback)(e=>{Zt.current=e.pointerType,Fo.current=-1,Bo.current=null,Ro(e)},[Ro]),Oo=(0,P.useCallback)(e=>{Zt.current="mouse",Fo.current=-1,Bo.current=null,Ro({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[Ro]),Wo=(0,P.useCallback)(e=>{Zt.current=e.pointerType},[]);Tt.current=()=>{Rt.current=null;const e=zt.current,t=Ht.current;if(!e||!t)return;const r=So.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(At.current?n+1e6:n),s=!At.current&&i,c=bt.current.w!==Ft||bt.current.h!==Bt,u=yt.current||i||c,d=r.consumeStylePaintPending();let h=!1;const p=r.getLastUpdateResult(),f=io.current.beforeCompute(p,s);!u||s&&!c||(r.computeScene({width:Ft,height:Bt}),bt.current={w:Ft,h:Bt},h=!0,Ao()),io.current.afterCompute(f,h,c);const g=Ks(r,n,h,vt),m=Zs(),y=oo.current.resolve(e);to.current=y.primary;const b=vr(Qe,r.lastIngestTime>0?n-r.lastIngestTime:0),v=Qe&&b.isStale;if(u||d||g.changed){const t=Qs(e,Mt,Nt,m);if(t){if(t.clearRect(-Nt.left,-Nt.top,Mt[0],Mt[1]),Qe&&1>b.alpha&&(t.globalAlpha=b.alpha),Bi(t,{background:E,hasBackgroundGraphics:!!Ee,themeBackground:y.background,x:-Nt.left,y:-Nt.top,width:Mt[0],height:Mt[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,Ft,Bt),t.clip()),He&&r.scales)for(const e of He)t.save(),e(t,r.scene,r.scales,{width:Ft,height:Bt}),t.restore();const e=ht?Ia.custom:Ia[o];if(e&&r.scales)for(const o of e)o(t,r.scene,r.scales,{width:Ft,height:Bt});t.restore(),Qe&&1>b.alpha&&(t.globalAlpha=1)}}const x=!!(Et&&Kt.current&&r.scales),k=!!(Qt.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=x||k;if(w||no.current){const e=Qs(t,Mt,Nt,m);if(e&&(e.clearRect(-Nt.left,-Nt.top,Mt[0],Mt[1]),x&&Kt.current&&function(e,t,o,r,n,i,s){if(!1===n.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,r),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(o,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const o=n.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const o="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||o||null:o||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,Kt.current,Ft,Bt,"object"==typeof Et?Et:{},Qt.current,y),k&&Qt.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,o,r,n){if(!o)return;const i="group"in o?o.group:void 0;if(void 0!==i)for(const o of t){if("line"!==o.type)continue;if(o.group!==i)continue;if(2>o.path.length)continue;const t="function"==typeof r.style?o.datum?r.style(o.datum):{}:r.style||{};e.save(),e.beginPath(),e.moveTo(o.path[0][0],o.path[0][1]);for(let t=1;o.path.length>t;t++)e.lineTo(o.path[t][0],o.path[t][1]);e.strokeStyle=t.stroke||o.style.stroke||n.primary,e.lineWidth=t.strokeWidth||(o.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,r.scene,Qt.current,t,y)}no.current=w}u&&e&&e.setAttribute("aria-label",Qi(r.scene,o+" chart"));const S=yt.current;if(yt.current=S&&s&&!h,S&&r.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!Yt||e(Yt.x.domain()[0])!==e(r.scales.x.domain()[0])||e(Yt.x.domain()[1])!==e(r.scales.x.domain()[1])||e(Yt.y.domain()[0])!==e(r.scales.y.domain()[0])||e(Yt.y.domain()[1])!==e(r.scales.y.domain()[1])||Yt.x.range()[0]!==r.scales.x.range()[0]||Yt.x.range()[1]!==r.scales.x.range()[1]||Yt.y.range()[0]!==r.scales.y.range()[0]||Yt.y.range()[1]!==r.scales.y.range()[1])&&Gt(r.scales),rt){const e=r.getData(),t="function"==typeof a?a:e=>e[a||"x"],o="function"==typeof l?l:e=>e[l||"y"];go(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),bo(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Me&&Me.length>0||ht)&&(h||s))||!h&&33>n-qt.current||(Wt(e=>e+1),qt.current=n),Qe?.showBadge&&po(!!v),(s||null!=r.activeTransition||g.pending)&&It()},Ri({hydrated:kt,wasHydratingFromSSR:St,storeRef:So,dirtyRef:yt,renderFnRef:Tt,cancelRender:$t,cleanup:()=>Co.current?.clear()}),(0,P.useEffect)(()=>{yt.current=!0,It()},[o,Ft,Bt,ce,E,Ee,O,He,It]),xr(Qe,So,yt,It,ho,po);const qo=(0,P.useMemo)(()=>{if(fe||ye)return;const e=So.current;return e?.xIsDate&&Yt?sa(Yt.x.domain()):void 0},[fe,ye,Yt]),Yo=fe||ye||qo,Go=Et&&Jt?xe?xe(Jt):(0,Ya.jsx)(qa,{hover:Jt}):null,Vo=Go?(0,Ya.jsx)(Es,{x:Jt.x,y:Jt.y,containerWidth:Ft,containerHeight:Bt,margin:Nt,className:"stream-frame-tooltip",children:Go}):null,Xo=Bo.current,Uo=(0,Ya.jsx)(vs,{active:Fo.current>=0,hoverPoint:Jt,margin:Nt,size:Mt,shape:Xo?.shape,width:Xo?.w,height:Xo?.h}),Ko=oa(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),er=oa(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),tr=Ko.key,or=er.key,rr=ra(Ko,er,Me&&Me.length>0||!1);if(Si||!kt&&St){const e=So.current;e&&n&&(e.ingest({inserts:Dt,bounded:!0}),e.computeScene({width:Ft,height:Bt}));const t=e?.scene??[],o=e?.scales??null,r=Vt(ze,o),i=Vt(Ee,o),s=Yo||(()=>{if(e?.xIsDate&&o)return sa(o.x.domain())})();return(0,Ya.jsxs)("div",{ref:Ct,className:"stream-xy-frame"+(B?" "+B:""),role:"img","aria-label":lt||("string"==typeof We?We:"XY chart"),style:{position:"relative",width:$?"100%":Mt[0],height:N?"100%":Mt[1]},children:[(0,Ya.jsx)(fs,{summary:ct}),(0,Ya.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Mt[0],height:Mt[1],style:{position:"absolute",left:0,top:0},children:[(0,Ya.jsx)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:i}),(0,Ya.jsxs)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:[E&&(0,Ya.jsx)("rect",{x:0,y:0,width:Ft,height:Bt,fill:E}),Oe&&o&&Oe.map((e,r)=>(0,Ya.jsx)(j.Fragment,{children:e(t,o,{width:Ft,height:Bt})},"svgpre-"+r)),t.map((e,t)=>function(e,t,o){switch(e.type){case"line":{const o=e;if(0===o.path.length)return null;const r="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return(0,yi.jsx)("path",{d:r,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const n=`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(r.clipRect){const e=`${o?o+"-":""}area-clip-${t}`;return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("defs",{children:(0,yi.jsx)("clipPath",{id:e,children:(0,yi.jsx)("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})}),(0,yi.jsx)("path",{d:n,fill:vi(r.style.fill),fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,yi.jsx)("path",{d:n,fill:vi(r.style.fill),fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth},"area-"+t)}case"point":{const o=e;return(0,yi.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:vi(o.style.fill),opacity:o.style.opacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+t)}case"symbol":return xi(e,t);case"glyph":return ki(e,e.x,e.y,`${o??""}glyph-${e.pointId??t}`);case"rect":{const o=e;return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:vi(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+t)}case"heatcell":{const o=e;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const e=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[r,n,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),s=.299*r+.587*n+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),(0,yi.jsx)("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+t)}case"candlestick":{const o=e,r=Math.min(o.openY,o.closeY),n=Math.max(Math.abs(o.openY-o.closeY),1),i=o.isUp?o.upColor:o.downColor;return(0,yi.jsxs)("g",{children:[(0,yi.jsx)("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),(0,yi.jsx)("rect",{x:o.x-o.bodyWidth/2,y:r,width:o.bodyWidth,height:n,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,mt)).filter(Boolean)]})]}),(0,Ya.jsx)(ci,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:o,showAxes:ce,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:s,yFormat:ge||be,axisExtent:me,showGrid:_e,title:We,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,foregroundGraphics:co(r,yo(So.current?.customLayoutOverlays,gt??null)),marginalGraphics:rt,xValues:[],yValues:[],annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,annotationFrame:0,xAccessor:tr,yAccessor:or,annotationData:rr(e?.getData()),pointNodes:aa(e?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:ut,linkedCrosshairSourceId:dt})]})}return(0,Ya.jsxs)("div",{ref:Ct,className:"stream-xy-frame"+(B?" "+B:""),role:"group","aria-label":lt||("string"==typeof We?We:"XY chart"),tabIndex:0,style:{position:"relative",width:$?"100%":Mt[0],height:N?"100%":Mt[1],overflow:"visible",touchAction:Xa(Ye)},onKeyDown:zo,children:[at&&(0,Ya.jsx)(gs,{tableId:Lt}),at&&(0,Ya.jsx)(hs,{scene:So.current?.scene??[],chartType:o+" chart",tableId:Lt,chartTitle:"string"==typeof We?We:void 0}),(0,Ya.jsx)(fs,{summary:ct}),(0,Ya.jsx)(ms,{hoverPoint:Jt}),(0,Ya.jsxs)("div",{role:"img","aria-label":lt||("string"==typeof We?We:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:Et?Ho:void 0,onMouseMove:Et?Oo:void 0,onPointerLeave:Et?To:void 0,onMouseLeave:Et?To:void 0,onPointerDown:Et||we?Wo:void 0,onClick:we?No:void 0,children:[Ut&&(0,Ya.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:Mt[0],height:Mt[1],pointerEvents:"none"},children:(0,Ya.jsx)("g",{transform:`translate(${Nt.left},${Nt.top})`,children:Ut})}),(0,Ya.jsx)(si,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:Yt,showAxes:ce,axes:ue,showGrid:_e,xFormat:Yo,yFormat:ge||be,axisExtent:me}),(0,Ya.jsx)("canvas",{ref:zt,"aria-label":Qi(So.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Ya.jsx)("canvas",{ref:Ht,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Ya.jsx)(ci,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,scales:Yt,showAxes:ce,axes:ue,xLabel:de,yLabel:he,yLabelRight:pe,xFormat:Yo,yFormat:ge||be,axisExtent:me,showGrid:_e,title:We,legend:Le,legendHoverBehavior:Re,legendClickBehavior:Te,legendHighlightedCategory:Ie,legendIsolatedCategories:$e,legendPosition:Ne,legendLayout:Fe,foregroundGraphics:co(Xt,yo(So.current?.customLayoutOverlays,gt??null)),marginalGraphics:rt,xValues:fo,yValues:mo,annotations:Me,autoPlaceAnnotations:je,svgAnnotationRules:Pe,annotationFrame:Ot,xAccessor:tr,yAccessor:or,annotationData:rr(So.current?.getData()),pointNodes:aa(So.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==E&&!Ee,linkedCrosshairName:ut,linkedCrosshairSourceId:dt}),(Ye||Ge)&&(0,Ya.jsx)(D,{width:Ft,height:Bt,totalWidth:Mt[0],totalHeight:Mt[1],margin:Nt,dimension:Ye?.dimension??"xy",scales:Yt,onBrush:Ge??(()=>{}),binSize:x,snap:Ye?.snap,binBoundaries:Ye?.binBoundaries??("bar"===o?So.current?.getBinBoundaries():void 0),snapDuring:Ye?.snapDuring,streaming:"streaming"===r}),Qe?.showBadge&&(0,Ya.jsx)(wr,{isStale:ho,position:Qe.badgePosition}),Uo,Vo]})]})}));Ua.displayName="StreamXYFrame";var Ka=Ua,Qa=require("react"),Za=require("d3-scale");function Ja(e){const t=e.getSymbol;if(!t)return null;const o=e.config.symbolMap,r=new Map;let n=0;return e=>{const i=t(e)+"",s=o?.[i];if(s)return s;let a=r.get(i);return a||(a=Pt[n%Pt.length],n++,r.set(i,a)),a}}function el(e,t,o,r,n,i,s){e.push(t?{type:"symbol",x:r,y:n,size:Math.PI*i*i,symbolType:t(o),style:s,datum:o}:{type:"point",x:r,y:n,r:i,style:s,datum:o})}function tl(e,t){const{columns:o,config:r,resolvePieceStyle:n}=e,i=[],s=Math.min(t.width,t.height)/2-4,a="donut"===r.chartType?r.innerRadius||60:0,l=-Math.PI/2+(r.startAngle||0)*Math.PI/180,c=null!=r.sweepAngle?r.sweepAngle*Math.PI/180:2*Math.PI,u=null!=r.sweepAngle&&360>r.sweepAngle,d=Object.values(o),h=d.some(e=>{const t=e.pieceData[0];return t&&("number"==typeof t._pct||"number"==typeof t._pctStart||null!=t._roundedEnds)}),p=u&&!h&&d.length>1&&(r.cornerRadius??0)>0;for(let e=0;d.length>e;e++){const t=d[e],o=t.pieceData[0],u="number"==typeof o?._pctStart?o._pctStart:t.pctStart,h=l+u*c,f=l+(u+("number"==typeof o?._pct?o._pct:t.pct))*c,g=n(t.pieceData[0],t.name),m=0===e,y=e===d.length-1,b={type:"wedge",cx:0,cy:0,innerRadius:a,outerRadius:s,startAngle:h,endAngle:f,...r.cornerRadius&&{cornerRadius:r.cornerRadius},style:g,datum:o?._nonInteractive?null:t.pieceData,category:t.name};o?._roundedEnds?b.roundedEnds=o._roundedEnds:p&&(b.roundedEnds={start:m,end:y}),o?._gradientBand&&(b._gradientBand=o._gradientBand),i.push(b)}return i}var ol=require("d3-array");function rl(e){const t=e.length,o=e[0],r=e[t-1];return{n:t,min:o,q1:(0,ol.quantile)(e,.25)??o,median:(0,ol.quantile)(e,.5)??(o+r)/2,q3:(0,ol.quantile)(e,.75)??r,max:r,mean:e.reduce((e,t)=>e+t,0)/t}}h();var nl=require("d3-scale"),il={bar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getStack:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h="horizontal"===c,p=n.normalize,f=[];if(s){const e=new Set;for(const t of Object.values(r))for(const o of t.pieceData){const t=s(o);e.has(t)||(e.add(t),f.push(t))}}else f.push("_default");for(const e of Object.values(r)){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 r=t.get(e);r.total+=i(o),r.pieces.push(o)}let o=0;if(p)for(const e of t.values())o+=Math.abs(e.total);let r=0,n=0;for(const i of f){const c=t.get(i);if(!c)continue;let f=c.total;p&&o>0&&(f/=o);const g=a(c.pieces[0],s?i:e.name),m={...c.pieces[0],__aggregateValue:c.total,__pieceCount:c.pieces.length,category:e.name};if(d){const t=l(0>f?n:r+f),o=0>f?l(n+f)-l(n):l(r)-l(r+f);u.push(gt(e.x,t,e.width,Math.abs(o),g,m,i)),0>f?n+=f:r+=f}else if(h){const t=l(0>f?n+f:r),o=0>f?l(n)-l(n+f):l(r+f)-l(r);u.push(gt(t,e.x,Math.abs(o),e.width,g,m,i)),0>f?n+=f:r+=f}}}const g="vertical"===c,m=n.roundedTop&&n.roundedTop>0?Math.max(0,n.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;const t=e.datum?.__aggregateValue??0;e.roundedEdge=g?0>t?"bottom":"top":0>t?"left":"right",n.gradientFill&&(e.fillGradient=n.gradientFill)}if(m>0){const e=new Map;for(const t of u){if("rect"!==t.type)continue;const o=t.datum?.category||"";e.has(o)||e.set(o,[]),e.get(o).push(t)}for(const t of e.values()){if(0===t.length)continue;const e=t.filter(e=>(e.datum?.__aggregateValue??0)>=0),o=t.filter(e=>0>(e.datum?.__aggregateValue??0));e.length>0&&(e.reduce(g?(e,t)=>t.y>e.y?e:t:(e,t)=>e.x+e.w>t.x+t.w?e:t).roundedTop=m),o.length>0&&(o.reduce(g?(e,t)=>e.y+e.h>t.y+t.h?e:t:(e,t)=>t.x>e.x?e:t).roundedTop=m)}}return u},clusterbar:function(e,t){const{scales:o,columns:r,config:n,getR:i,getGroup:s,resolvePieceStyle:a}=e,{r:l,projection:c}=o,u=[],d="vertical"===c,h=[],p=new Set;for(const e of Object.values(r))for(const t of e.pieceData){const e=s?s(t):"_default";p.has(e)||(p.add(e),h.push(e))}const f=h.length||1;for(const e of Object.values(r)){const t=e.width/f,o=.2*t,r=t-o,n=new Map;for(const t of e.pieceData){const e=s?s(t):"_default";n.has(e)||n.set(e,[]),n.get(e).push(t)}for(let s=0;h.length>s;s++){const c=n.get(h[s])||[];for(const n of c){const c=i(n),p=a(n,h[s]);if(d){const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(gt(i,Math.min(a,d),r,Math.abs(a-d),p,n,h[s]))}else{const i=e.x+s*t+o/2,a=l(0),d=l(c);u.push(gt(Math.min(a,d),i,Math.abs(d-a),r,p,n,h[s]))}}}}const g=n.roundedTop&&n.roundedTop>0?Math.max(0,n.roundedTop):0;for(const e of u){if("rect"!==e.type)continue;if(null==e.datum)continue;const t=i(e.datum);g>0&&(e.roundedTop=g),e.roundedEdge=d?0>t?"bottom":"top":0>t?"left":"right",n.gradientFill&&(e.fillGradient=n.gradientFill)}return u},point:function(e,t){const{scales:o,columns:r,getR:n,multiScales:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d="radial"===l,h=i.length>0,p=Ja(e),f=2*Math.PI,g=-Math.PI/2;for(const e of Object.values(r))for(const t of e.pieceData){const o=t.__rIndex??0,r=t.__rValue??n(t),l=h&&i[o]||a,m=s(t,e.name),y=m.r||5;let b,v;if(d){const t=g+(e.pctStart+e.pct/2)*f,o=l(r);b=Math.cos(t)*o,v=Math.sin(t)*o}else u?(b=e.middle,v=l(r)):(b=l(r),v=e.middle);el(c,p,t,b,v,y,m)}return c},swarm:function(e,t){const{scales:o,columns:r,getR:n,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="vertical"===a,u=Ja(e);for(const e of Object.values(r)){const t=e.width/2;for(let o=0;e.pieceData.length>o;o++){const r=e.pieceData[o],a=n(r),d=i(r,e.name),h=d.r||4,p=(7919*o%100/100-.5)*t*.8;el(l,u,r,c?e.middle+p:s(a),c?s(a):e.middle+p,h,d)}}return l},pie:tl,donut:tl,boxplot:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,d=!1!==n.showOutliers;for(const t of Object.values(r)){const o=t.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(0===o.length)continue;const r=o[0],n=o[o.length-1],l=(0,ol.quantile)(o,.25)??r,h=(0,ol.quantile)(o,.5)??(r+n)/2,p=(0,ol.quantile)(o,.75)??n,f=p-l,g=l-1.5*f,m=p+1.5*f,y=o.find(e=>e>=g)??r,b=[...o].reverse().find(e=>m>=e)??n,v=s(t.pieceData[0],t.name),x=[];if(d)for(const e of t.pieceData){const o=i(e);if(g>o||o>m){const r=u?t.middle:a(o),n=u?a(o):t.middle;x.push({px:r,py:n,value:o,datum:e})}}if(c.push({type:"boxplot",x:u?t.middle:0,y:u?0:t.middle,projection:u?"vertical":"horizontal",columnWidth:.6*t.width,minPos:a(y),q1Pos:a(l),medianPos:a(h),q3Pos:a(p),maxPos:a(b),stats:{n:o.length,min:y,q1:l,median:h,q3:p,max:b,mean:o.reduce((e,t)=>e+t,0)/o.length},style:v,datum:t.pieceData,category:t.name,outliers:x}),d)for(const t of x)c.push({type:"point",x:t.px,y:t.py,r:3,style:{fill:v.fill||e.config.themeSemantic?.secondary||"#999",opacity:.6},datum:t.datum})}return c},violin:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u="vertical"===l,h=n.bins||20,p=!1!==n.showIQR;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],n=(r-o)/h||1,l=Array(h).fill(0);for(const e of t)l[Math.min(Math.floor((e-o)/n),h-1)]++;const f=d(l,1),g=e.width/2*.9;let m;if(u){m=`M ${e.middle} ${a(o)}`;for(let t=0;h>t;t++){const r=a(o+(t+.5)*n);m+=` L ${e.middle+l[t]/f*g} ${r}`}m+=` L ${e.middle} ${a(r)}`;for(let t=h-1;t>=0;t--){const r=a(o+(t+.5)*n);m+=` L ${e.middle-l[t]/f*g} ${r}`}m+=" Z"}else{m=`M ${a(o)} ${e.middle}`;for(let t=0;h>t;t++)m+=` L ${a(o+(t+.5)*n)} ${e.middle-l[t]/f*g}`;m+=` L ${a(r)} ${e.middle}`;for(let t=h-1;t>=0;t--)m+=` L ${a(o+(t+.5)*n)} ${e.middle+l[t]/f*g}`;m+=" Z"}const y=s(e.pieceData[0],e.name);let b;if(p&&t.length>=4){const n=(0,ol.quantile)(t,.25)??o,i=(0,ol.quantile)(t,.5)??(o+r)/2,s=(0,ol.quantile)(t,.75)??r;b={q1Pos:a(n),medianPos:a(i),q3Pos:a(s),centerPos:e.middle,isVertical:u}}const v=u?{x:e.x,y:Math.min(a(r),a(o)),width:e.width,height:Math.abs(a(r)-a(o))}:{x:Math.min(a(o),a(r)),y:e.x,width:Math.abs(a(r)-a(o)),height:e.width};c.push({type:"violin",pathString:m,translateX:0,translateY:0,bounds:v,iqrLine:b,stats:rl(t),style:y,datum:e.pieceData,category:e.name})}return c},histogram:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a}=o,l=[],c=n.bins||25,h=n.normalize,p=a.domain?.(),f=p?+p[0]:void 0,g=p?+p[1]:void 0;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e));if(0===t.length)continue;const[o,r]=u(t),n=null!=f&&isFinite(f)?f:o,p=null!=g&&isFinite(g)?g:r,m=(p-n)/c||1,y=Array(c).fill(0);for(const e of t)n>e||e>p||y[Math.min(Math.floor((e-n)/m),c-1)]++;const b=t.length,v=d(y,1),x=s(e.pieceData[0],e.name);for(let t=0;c>t;t++){if(0===y[t])continue;const o=(h?y[t]/b:y[t]/v)*e.width*.9,r=a(n+t*m),i=a(n+(t+1)*m);l.push(gt(Math.min(r,i),e.x+e.width-o,Math.abs(i-r),o,x,{bin:t,count:y[t],range:[n+t*m,n+(t+1)*m],category:e.name},e.name))}}return l},ridgeline:function(e,t){const{scales:o,columns:r,config:n,getR:i,resolveSummaryStyle:s}=e,{r:a,projection:l}=o,c=[],u=n.bins||20,h="horizontal"===l,p=n.amplitude||1.5;for(const e of Object.values(r)){const t=e.pieceData.map(e=>i(e)).filter(e=>null!=e&&!isNaN(e)).sort((e,t)=>e-t);if(2>t.length)continue;const o=t[0],r=t[t.length-1],n=(r-o)/u||1,l=Array(u).fill(0);for(const e of t)o>e||e>r||l[Math.min(Math.floor((e-o)/n),u-1)]++;const f=d(l,1),g=s(e.pieceData[0],e.name),m=e.width*p;let y;if(h){const t=e.x+e.width;y=`M ${a(o)} ${t}`;for(let e=0;u>e;e++)y+=` L ${a(o+(e+.5)*n)} ${t-l[e]/f*m}`;y+=` L ${a(r)} ${t} Z`}else{const t=e.x;y=`M ${t} ${a(o)}`;for(let e=0;u>e;e++){const r=a(o+(e+.5)*n);y+=` L ${t+l[e]/f*m} ${r}`}y+=` L ${t} ${a(r)} Z`}const b=h?{x:Math.min(a(o),a(r)),y:e.x,width:Math.abs(a(r)-a(o)),height:e.width}:{x:e.x,y:Math.min(a(r),a(o)),width:e.width,height:Math.abs(a(r)-a(o))};c.push({type:"violin",pathString:y,translateX:0,translateY:0,bounds:b,stats:rl(t),style:{...g,fillOpacity:g.fillOpacity??.5},datum:e.pieceData,category:e.name})}return c},timeline:function(e,t){const{scales:o,columns:r,getRawRange:n,resolvePieceStyle:i}=e,{r:s,projection:a}=o,l=[],c="horizontal"===a;for(const e of Object.values(r))for(const t of e.pieceData){const o=n(t);if(!o)continue;const[r,a]=o,u=i(t,e.name);if(c){const o=s(Math.min(r,a)),n=s(Math.max(r,a));l.push(gt(o,e.x,n-o,e.width,u,t,e.name))}else{const o=s(Math.max(r,a)),n=s(Math.min(r,a));l.push(gt(e.x,o,e.width,n-o,u,t,e.name))}}return l},funnel:function(e,t){const{columns:o,getR:r,getStack:n,resolvePieceStyle:i}=e,s=[],a=t.width/2,l=!1!==e.config.showLabels,c=e.scales.o.domain().map(e=>o[e]).filter(Boolean);if(0===c.length)return s;const u=[],d=new Set;for(const e of c)for(const t of e.pieceData){const e=n?n(t):"_default";d.has(e)||(d.add(e),u.push(e))}const h=u.length>1&&"_default"!==u[0],p=[];let f=0;for(const e of c){const t=new Map;let o=0;for(const i of e.pieceData){const e=n?n(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=r(i);s.total+=a,s.pieces.push(i),o+=a}p.push({col:e,groups:t,stepTotal:o}),h||o>f&&(f=o)}if(h)for(const e of p){let t=0,o=0;for(let r=0;u.length>r;r++){const n=e.groups.get(u[r]);n&&(r%2==0?t+=n.total:o+=n.total)}const r=Math.max(t,o);r>f&&(f=r)}if(0===f)return s;const g=new Map;for(const e of u){const t=p[0].groups.get(e);g.set(e,t?.total??0)}const m=p[0].stepTotal,y=h?.95*a:.9*t.width,b=(0,nl.scaleLinear)().domain([0,f]).range([0,y]),v=e.config.connectorOpacity??.3;let x=new Map;for(let t=0;p.length>t;t++){const o=p[t],r=o.col,n=0===t,c=r.width,d=.55*c,f=r.x+(c-d)/2,y=new Map;if(h){let e=0;for(const t of u){const r=o.groups.get(t);r&&(e+=b(r.total))}let t=a,c=a;for(let h=0;u.length>h;h++){const p=u[h],m=o.groups.get(p);if(!m)continue;const v=b(m.total),x=h%2==0,k=x?t:c-v;x?t+=v:c-=v;const w=i(m.pieces[0],p),S=g.get(p)??m.total,A={...m.pieces[0],__funnelValue:m.total,__funnelPercent:S>0?m.total/S*100:0,__funnelStep:r.name,__funnelIsFirstStep:n,__aggregateValue:m.total,__pieceCount:m.pieces.length,category:p};l&&(0===h&&(A.__funnelStepLabel=r.name,A.__funnelStepLabelX=a,A.__funnelStepLabelY=f,A.__funnelRowWidth=e),A.__funnelValueLabelX=k+v/2,A.__funnelValueLabelY=f,A.__funnelBarW=v),s.push(gt(k,f,v,d,w,A,p)),y.set(p,{x:k,y:f,w:v,h:d})}}else{const e=o.stepTotal,t=b(e),c=a-t/2,h=u[0],p="_default"!==h,g=o.groups.get(h)?.pieces[0]??r.pieceData[0],v=p?h:r.name,x=i(g,v),k=m>0?e/m*100:0,w={...g,__funnelValue:e,__funnelPercent:k,__funnelStep:r.name,__funnelIsFirstStep:n,category:p?h:r.name};l&&(w.__funnelStepLabel=r.name,w.__funnelStepLabelX=a,w.__funnelStepLabelY=f,w.__funnelRowWidth=t,w.__funnelValueLabelX=a,w.__funnelValueLabelY=f,w.__funnelBarW=t),s.push(gt(c,f,t,d,x,w,v)),y.set(h,{x:c,y:f,w:t,h:d})}if(t>0&&x.size>0){const t=h?u:[u[0]];for(const n of t){const t=x.get(n),a=y.get(n);if(!t||!a)continue;const l=(()=>{const e=o.groups.get(n);return i(e?e.pieces[0]:r.pieceData[0],"_default"===n?r.name:n)})(),c={type:"trapezoid",points:[[t.x,t.y+t.h],[t.x+t.w,t.y+t.h],[a.x+a.w,a.y],[a.x,a.y]],style:{fill:l.fill||e.config.themeSemantic?.secondary||"#999",opacity:v},datum:o.groups.get(n)?.pieces[0]??r.pieceData[0],category:"_default"===n?r.name:n};s.push(c)}}x=y}return s},"bar-funnel":function(e,t){const{columns:o,getR:r,getStack:n,resolvePieceStyle:i,scales:s}=e,a=[],l=s.o.domain().map(e=>o[e]).filter(Boolean);if(0===l.length)return a;const c=[],u=new Set;for(const e of l)for(const t of e.pieceData){const e=n?n(t):"_default";u.has(e)||(u.add(e),c.push(e))}const d=c.length>1&&"_default"!==c[0],h=[];for(const e of l){const t=new Map;let o=0;for(const i of e.pieceData){const e=n?n(i):"_default";t.has(e)||t.set(e,{total:0,pieces:[]});const s=t.get(e),a=r(i);s.total+=a,s.pieces.push(i),o+=a}h.push({col:e,groups:t,stepTotal:o})}const p=new Map;for(const e of c){const t=h[0]?.groups.get(e);p.set(e,t?.total??0)}const f=s.r,g=d?c.length:1,m=d?.15:0;for(let e=0;h.length>e;e++){const t=h[e],o=t.col,r=0===e,n=e>0?h[e-1]:null,s=o.width/g,l=s*m,u=s-l;for(let e=0;c.length>e;e++){const h=c[e],g=t.groups.get(h);if(!g)continue;const m=g.total,y=p.get(h)??m,b=y>0?m/y*100:0,v=n?.groups.get(h),x=r?0:Math.max(0,(v?.total??m)-m),k=o.x+e*s+l/2,w=f(m),S=f(0)-w,A=i(g.pieces[0],d?h:o.name),C={...g.pieces[0],__barFunnelValue:m,__barFunnelPercent:b,__barFunnelIsFirstStep:r,__barFunnelIsDropoff:!1,__barFunnelStep:o.name,__barFunnelDropoffValue:x,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name,__barFunnelLabelX:k+u/2,__barFunnelLabelY:f(m+x)};if(a.push(gt(k,w,u,S,A,C,d?h:o.name)),x>0){const e=f(m+x),t=w-e,r={...A},n={...g.pieces[0],__barFunnelValue:x,__barFunnelPercent:y>0?x/y*100:0,__barFunnelIsFirstStep:!1,__barFunnelIsDropoff:!0,__barFunnelStep:o.name,__barFunnelCategory:"_default"===h?void 0:h,category:d?h:o.name};a.push(gt(k,e,u,t,r,n,d?h:o.name))}}}return a},swimlane:function(e,t){const{scales:o,columns:r,getR:n,getStack:i,resolvePieceStyle:s}=e,{r:a,projection:l}=o,c=[],u="horizontal"===l,d=e.config.gradientFill,h=u?"left":"bottom",p=e.config.trackFill;if(p){const e="string"==typeof p?p:p.color,t="string"==typeof p?1:p.opacity??1,[o,n]=a.range(),i=Math.min(o,n),s=Math.abs(n-o);for(const o of Object.values(r)){const r={fill:e,opacity:t},n=u?gt(i,o.x,s,o.width,r,null,"__track__"):gt(o.x,i,o.width,s,r,null,"__track__");c.push(n)}}const f=e.config.roundedTop&&e.config.roundedTop>0?Math.max(0,e.config.roundedTop):0;for(const e of Object.values(r)){let t=0;const o=c.length;for(const o of e.pieceData){const r=Math.abs(n(o));if(0===r)continue;const l=i?i(o):e.name,p=s(o,l);let f;if(u){const n=a(t),i=a(t+r);f=gt(n,e.x,i-n,e.width,p,o,l)}else{const n=a(t+r),i=a(t);f=gt(e.x,n,e.width,i-n,p,o,l)}d&&(f.fillGradient=d,f.roundedEdge=h),c.push(f),t+=r}if(f>0&&c.length>o){const e=c.slice(o),t=e[0],r=e[e.length-1];1===e.length?t.cornerRadii={tl:f,tr:f,br:f,bl:f}:u?(t.cornerRadii={tl:f,bl:f},r.cornerRadii={tr:f,br:f}):(t.cornerRadii={bl:f,br:f},r.cornerRadii={tl:f,tr:f})}}return c}};function sl(e,t,o){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=Be[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:o}function al(e,t){const o=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>o&&We(o,e)||"#4e79a7":t=>{if(o){const e=We(o,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}var ll=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],cl=["scene-style","data-paint","accessibility","evidence"],ul=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],dl=new Set(["accessorRevision","axisExtent","categoryAccessor","chartType","extentPadding","groupBy","multiAxis","normalize","oAccessor","oExtent","oSort","rAccessor","rExtent","runtimeMode","stackBy","timeAccessor","valueAccessor"]),hl=new Set(["barColors","colorScheme","connectorStyle","pieceStyle","summaryStyle","themeCategorical","themeDiverging","themeSemantic","themeSequential"]),pl=class{constructor(){this.tracker=new Ut}get last(){return this.tracker.last}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},ll)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},cl):this.recordNoop("restyle")}recordConfig(e){if(0===e.length)return this.tracker.record({kind:"config",keys:e},[]);const t=new Set(ul);return e.some(e=>dl.has(e))&&t.add("domain"),e.some(e=>hl.has(e))&&t.add("scene-style"),this.tracker.record({kind:"config",keys:e},t)}},fl=require("d3-quadtree"),gl=class{constructor(e){this.rExtent=new oe,this.rExtents=[],this.windowSizeWarned=!1,this.updateResults=new pl,this.rAccessors=[],this.categories=new Set,this._hasStreamingData=!1,this._colorSchemeMap=null,this._colorSchemeIndex=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositionMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.version=0,this._dataVersion=0,this._bufferArrayCache=null,this._pointQuadtree=null,this._maxPointRadius=0,this._datumIndexCache=null,this._categoryIndexCache=null,this._hasRenderedOnce=!1,this.config=e,this.buffer=new te(e.windowSize),this.getO=se(e.categoryAccessor||e.oAccessor,"category");const t=e.valueAccessor||e.rAccessor;Array.isArray(t)?(this.rAccessors=t.map(e=>ne(e,"value")),this.getR=this.rAccessors[0],this.rExtents=t.map(()=>new oe)):(this.getR=ne(t,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent]),this.getStack=se(e.stackBy),this.getGroup=se(e.groupBy),this.getColor=se(e.colorAccessor),this.getSymbol=se(e.symbolAccessor),this.getConnector=se(e.connectorAccessor),this.getDataId=se(e.dataIdAccessor),e.pulse&&(this.timestampBuffer=new te(e.windowSize))}syncPulseTimestampBuffer(){var e,t,o,r;this.timestampBuffer=(e=!!this.config.pulse,t=this.buffer,o=this.timestampBuffer,r=Ue(),e?null!=o&&o.capacity===t.capacity&&o.size===t.size?o:Wt(t,r):null)}ingest(e){const t=Ue();if(this.lastIngestTime=t,this._dataVersion++,e.bounded){this.buffer.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();e.preserveCategoryOrder?this._hasStreamingData=!0:this.categories.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),Ot(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(const o of e.inserts)qt(this.buffer,o,this.timestampBuffer,t),this.categories.add(this.getO(o)),this.pushValueExtent(o)}else{this._hasStreamingData=!0;for(const o of e.inserts){const e=qt(this.buffer,o,this.timestampBuffer,t);this.categories.add(this.getO(o)),this.pushValueExtent(o),null!=e&&this.evictValueExtent(e)}}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}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.valueAccessor||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,r=this.scales,n=this.multiScales,i=this.columns;if(0===o.size)return this.scales=null,this.multiScales=[],this.scene=[],this.columns={},this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,void this.version++;this.rExtent.dirty&&this.rExtent.recalculate(o,this.getR);const s=this.getBufferArray(),a=t.projection||"vertical",l=t.oExtent||this.resolveCategories(s),c=this.computeValueDomain(s,l),u="horizontal"===a,d="radial"===a,h=Math.min(.9,Math.max(0,null!=t.barPadding?t.barPadding/("vertical"===a?e.width:e.height):.1));let p,f;if(d){p=(0,Za.scaleBand)().domain(l).range([0,1]).padding(0);const o=Math.min(e.width,e.height)/2,r=t.innerRadius||0;f=(0,Za.scaleLinear)().domain(c).range([r,o])}else u?(p=(0,Za.scaleBand)().domain(l).range([0,e.height]).padding(h),f=(0,Za.scaleLinear)().domain(c).range([0,e.width])):(p=(0,Za.scaleBand)().domain(l).range([0,e.width]).padding(h),f=(0,Za.scaleLinear)().domain(c).range([e.height,0]));this.scales={o:p,r:f,projection:a},this.multiScales=this.rAccessors.length>1&&t.multiAxis?this.rAccessors.map((r,n)=>{const i=this.rExtents[n];i.dirty&&i.recalculate(o,r);let[s,a]=i.extent;s===1/0&&(s=0,a=1);const l=a-s,c=l>0?l*(t.extentPadding??.05):1;return s-=c,a+=c,s>0&&(s=0),u?(0,Za.scaleLinear)().domain([s,a]).range([0,e.width]):(0,Za.scaleLinear)().domain([s,a]).range([e.height,0])}):[];let g=s;this.rAccessors.length>1&&(g=s.flatMap(e=>this.rAccessors.map((t,o)=>({...e,__rIndex:o,__rValue:t(e),__rName:this.resolveRAccessorName(o)})))),this.columns=this.buildColumns(g,l,p,a,e),this._customLayoutFailedThisBuild=!1;const m=this.buildSceneNodes(g,e);this._customLayoutFailedThisBuild?!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.multiScales=n,this.columns=i):(this.scene=[],this.rebuildPointQuadtree()):(this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=m,this.rebuildPointQuadtree(),this.config.decay&&this.applyDecay(this.scene,s),this.config.pulse&&this.applyPulse(this.scene,s),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&this.prevPositionMap.size>0&&this.startTransition(),this.version++)}resolveRAccessorName(e){const t=this.config.valueAccessor||this.config.rAccessor,o=Array.isArray(t)?t[e]:t;return"string"==typeof o?o:"value"+e}resolveCategories(e){const t=this.config.oSort,o="streaming"===this.config.runtimeMode||this._hasStreamingData,r="auto"===t?void 0:t;let n=null;if(o){n=new Set;for(const t of e)n.add(this.getO(t))}const i=n?Array.from(this.categories).filter(e=>n.has(e)):Array.from(this.categories);if(o&&void 0===r){const e=Math.max(50,3*n.size);if(this.categories.size>e){let t=this.categories.size-e;for(const e of this.categories){if(0>=t)break;n.has(e)||(this.categories.delete(e),t--)}}return i}if(!1===r)return i;if("function"==typeof r)return i.sort(r);const s=new Map;for(const t of e){const e=this.getO(t);s.set(e,(s.get(e)||0)+Math.abs(this.getR(t)))}return i.sort("asc"===r?(e,t)=>(s.get(e)||0)-(s.get(t)||0):(e,t)=>(s.get(t)||0)-(s.get(e)||0))}computeValueDomain(e,t){return function(e){const{data:t,chartType:o,projection:r,normalize:n,rExtent:i,extentPadding:s=.05,baselinePadding:a,axisExtent:l,getO:c,getR:u,getStack:d,rawRExtent:h}=e,p=s;if("radial"===r&&("pie"===o||"donut"===o))return[0,1];let f=0,g=0;if("bar"===o&&d&&n)f=0,g=1;else if("bar"===o&&d){const e=new Map,o=new Map;for(const r of t){const t=c(r),n=u(r);0>n?o.set(t,(o.get(t)||0)+n):e.set(t,(e.get(t)||0)+n)}for(const t of e.values())t>g&&(g=t);for(const e of o.values())f>e&&(f=e)}else if("bar"===o){const e=new Map;for(const o of t){const t=c(o),r=u(o);e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t),f>t&&(f=t)}else if("swimlane"===o){const e=new Map;for(const o of t){const t=c(o),r=Math.abs(u(o));e.set(t,(e.get(t)||0)+r)}for(const t of e.values())t>g&&(g=t)}else if("clusterbar"===o||"bar-funnel"===o)for(const e of t){const t=u(e);t>g&&(g=t),f>t&&(f=t)}else{const e=h[0],t=h[1];e!==1/0&&(f=e),t!==-1/0&&(g=t)}i&&(null!=i[0]&&(f=i[0]),null!=i[1]&&(g=i[1]));const m="bar"===o||"clusterbar"===o||"bar-funnel"===o||"swimlane"===o;if(m&&null==i?.[0]&&null==i?.[1]&&(f>0&&(f=0),0>g&&(g=0)),"bar-funnel"!==o&&"exact"!==l){const e=g-f,t=e>0?e*p:1,r=m&&!a&&0===f,n=m&&!a&&0===g||"swimlane"===o;null!=i?.[0]||r||(f-=t),null!=i?.[1]||n||(g+=t)}return[f,g]}({data:e,chartType:this.config.chartType,projection:this.config.projection,normalize:this.config.normalize,rExtent:this.config.rExtent,extentPadding:this.config.extentPadding,baselinePadding:this.config.baselinePadding,axisExtent:this.config.axisExtent,getO:this.getO,getR:this.getR,getStack:this.getStack,rawRExtent:this.rExtent.extent})}buildColumns(e,t,o,r,n){return function(e){const{data:t,oExtent:o,oScale:r,projection:n,layout:i,dynamicColumnWidth:s,getO:a,getR:l}=e,c={},u=new Map;for(const e of t){const t=a(e);u.has(t)||u.set(t,[]),u.get(t).push(e)}let d=0;if("radial"===n)for(const e of t)d+=Math.abs(l(e));let h=null;if(s&&"radial"!==n){h=new Map;let e=0;for(const t of o){const o=u.get(t)||[];let r;r="string"==typeof s?o.reduce((e,t)=>e+(Number(t[s])||0),0):s(o),h.set(t,r),e+=r}const t=("horizontal"===n?i.height:i.width)-r.padding()*r.step()*o.length;if(e>0)for(const[o,r]of h)h.set(o,r/e*t)}let p=0,f=0;for(const e of o){const t=u.get(e)||[],o=t.reduce((e,t)=>e+Math.abs(l(t)),0),n=d>0?o/d:0;let i,s;h?(i=f,s=h.get(e)||r.bandwidth(),f+=s+r.padding()*r.step()):(i=r(e)??0,s=r.bandwidth()),c[e]={name:e,x:i,y:0,width:s,middle:i+s/2,padding:r.padding()*r.step(),pieceData:t,pct:n,pctStart:p},p+=n}return c}({data:e,oExtent:t,oScale:o,projection:r,layout:n,dynamicColumnWidth:this.config.dynamicColumnWidth,getO:this.getO,getR:this.getR})}getSceneContext(){return{scales:this.scales,columns:this.columns,config:this.config,getR:this.getR,getStack:this.getStack,getGroup:this.getGroup,getColor:this.getColor,getSymbol:this.getSymbol,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[];if(this.config.customLayout){const o=this.buildLayoutContext(e,t);let r;try{r=this.config.customLayout(o)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Ft("ordinal",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] ordinal customLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=r.overlays??null,this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null;const n=r.nodes??[];if(this._customRestyle=r.restyle,this.hasCustomRestyle=!!r.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of n)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(n,this.config.layoutSelection??null)}return It({label:"ordinal customLayout",nodes:n,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),n}this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1;const o=this.getSceneContext(),r=il[this.config.chartType];let n=r?r(o,t):[];if(this.getConnector&&this.scales){const e=function(e,t){const{scales:o,config:r,getConnector:n,getO:i}=e;if(!n||!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=n(t);if(!o)continue;let r,s;"point"===e.type?(r=e.x,s=e.y):(r=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:r,y:s,datum:t,category:i(t)})}const c=o.o.domain(),u=r.connectorStyle;for(const[t,o]of l)if(o.length>=2){o.sort((e,t)=>c.indexOf(e.category)-c.indexOf(t.category));for(let r=0;o.length-1>r;r++){const n=o[r],i=o[r+1],a="function"==typeof u?u(n.datum):u||{stroke:e.config.themeSemantic?.border||e.config.themeSemantic?.secondary||"#999",strokeWidth:1,opacity:.5};s.push({type:"connector",x1:n.x,y1:n.y,x2:i.x,y2:i.y,style:a,datum:n.datum,group:t})}}return s}(o,n);n=[...e,...n]}return n}buildLayoutContext(e,t){const o=this.config,r=o.layoutMargin??{top:0,right:0,bottom:0,left:0},n=sl(o.colorScheme,o.themeCategorical,Ee),i=this.scales;return{data:e,scales:{o:i.o,r:i.r,projection:i.projection},dimensions:{width:t.width,height:t.height,margin:r,plot:"radial"===i.projection?{x:-t.width/2,y:-t.height/2,width:t.width,height:t.height}:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:o.themeSemantic??{},categorical:[...n]},resolveColor:al(n,o.colorScheme),config:o.layoutConfig??{},selection:o.layoutSelection??null}}resolvePieceStyle(e,t){if("function"==typeof this.config.pieceStyle){const o=this.config.pieceStyle(e,t);return o&&!o.fill&&t?{...o,fill:this.getColorFromScheme(t)}:o}return 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:this.config.themeCategorical||Ee,r=o[this._colorSchemeIndex%o.length];return this._colorSchemeIndex++,this._colorSchemeMap.set(e,r),r}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){const o=this.config.decay;return o&&t>1?nt(o,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._dataVersion)return this._datumIndexCache.map;const t=it(e);return this._datumIndexCache={version:this._dataVersion,map:t},t}getCategoryIndexMap(e){if(this._categoryIndexCache&&this._categoryIndexCache.version===this._dataVersion)return this._categoryIndexCache.map;const t=function(e,t){const o="function"==typeof t,r=o?null:t||"category",n=new Map;for(let i=0;e.length>i;i++){const s=e[i],a=o?t(s):s[r],l=n.get(a);l?l.push(i):n.set(a,[i])}return n}(e,this.config.categoryAccessor||this.config.oAccessor);return this._categoryIndexCache={version:this._dataVersion,map:t},t}rebuildPointQuadtree(){const e=function(e){let t=0,o=0;for(const r of e)"point"===r.type&&(t++,r.r>o&&(o=r.r));if(500>=t)return{quadtree:null,maxRadius:o};const r=Array(t);let n=0;for(const t of e)"point"===t.type&&(r[n++]=t);return{maxRadius:o,quadtree:(0,fl.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}}(this.scene);this._pointQuadtree=e.quadtree,this._maxPointRadius=e.maxRadius}get pointQuadtree(){return this._pointQuadtree}get maxPointRadius(){return this._maxPointRadius}applyDecay(e,t){if(!this.config.decay)return;const o=t.length;if(1>=o)return;const r=this.getDatumIndexMap(t);for(const t of e){if("connector"===t.type||"violin"===t.type||"boxplot"===t.type||"wedge"===t.type)continue;const e=r.get(t.datum);if(null==e)continue;const n=this.computeDecayOpacity(e,o);t.style={...t.style,opacity:(t.style?.opacity??1)*n}}}applyPulse(e,t,o=Ue()){return!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,o,r,n,i){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;for(const c of t){if("connector"===c.type||"violin"===c.type||"boxplot"===c.type)continue;if("wedge"===c.type){const t=c.category;if(!t)continue;let r=0;for(const s of n(t)??[]){const t=o.get(s);null!=t&&(r=Math.max(r,st(e,t,i)))}l=at(c,r,s)||l;continue}if(null==c.datum)continue;const t=r.get(c.datum);if(null==t)continue;const u=o.get(t);l=at(c,null==u?0:st(e,u,i),s,a)||l}return l}(this.config.pulse,e,this.timestampBuffer,this.getDatumIndexMap(t),e=>this.getCategoryIndexMap(t).get(e),o)}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&<(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(Ue())}synthesizeIntroPositions(){this.prevPositionMap.clear();const e=new Map,t=this.scales?.r(0)??0,o="horizontal"!==this.scales?.projection;let r;for(let n=0;this.scene.length>n;n++){const i=this.scene[n],s=this.getNodeKey(i,e);s&&("rect"===i.type?this.prevPositionMap.set(s,o?{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}:{x:t,y:i.y,w:0,h:i.h,opacity:i.style.opacity??1}):"point"===i.type?this.prevPositionMap.set(s,{x:i.x,y:i.y,r:0,opacity:0}):"wedge"===i.type&&(void 0===r&&(r=i.startAngle),this.prevPositionMap.set(s,{x:i.cx,y:i.cy,startAngle:r,endAngle:r,innerRadius:i.innerRadius,outerRadius:i.outerRadius,opacity:0})))}}getNodeKey(e,t){if("point"===e.type){const o=`p:${e.datum?this.getO(e.datum):""}:${e.datum?this.getR(e.datum):0}`,r=t.get(o)||0;return t.set(o,r+1),`${o}:${r}`}return"rect"===e.type?`r:${e.group||""}:${e.datum?.category??""}`:"wedge"===e.type?"w:"+(e.category??""):null}snapshotPositions(){this.prevPositionMap.clear();const e=new Map;for(let t=0;this.scene.length>t;t++){const o=this.scene[t],r=this.getNodeKey(o,e);r&&("point"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,r:o.r,opacity:o.style.opacity}):"rect"===o.type?this.prevPositionMap.set(r,{x:o.x,y:o.y,w:o.w,h:o.h,opacity:o.style.opacity}):"wedge"===o.type&&this.prevPositionMap.set(r,{x:o.cx,y:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius,opacity:o.style.opacity??1}))}}startTransition(){if(!this.config.transition||0===this.prevPositionMap.size)return;const e=this.config.transition.duration??300;if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}let t=!1;const o=new Set,r=new Map;for(let e=0;this.scene.length>e;e++){const n=this.scene[e],i=this.getNodeKey(n,r);if(!i)continue;n._transitionKey=i;const s=this.prevPositionMap.get(i);if("point"===n.type)s?(o.add(i),n._targetOpacity=n.style.opacity??1,(s.x!==n.x||s.y!==n.y||void 0!==s.r&&s.r!==n.r)&&(n._targetX=n.x,n._targetY=n.y,n._targetR=n.r,n.x=s.x,n.y=s.y,void 0!==s.r&&(n.r=s.r),t=!0)):(n._targetOpacity=n.style.opacity??1,n._targetR=n.r,n.r=0,n.style={...n.style,opacity:0},t=!0);else if("rect"===n.type)s?(o.add(i),n._targetOpacity=n.style.opacity??1,s.x===n.x&&s.y===n.y&&s.w===n.w&&s.h===n.h||(n._targetX=n.x,n._targetY=n.y,n._targetW=n.w,n._targetH=n.h,n.x=s.x,n.y=s.y,n.w=s.w??n.w,n.h=s.h??n.h,t=!0)):(n._targetOpacity=n.style.opacity??1,n.style={...n.style,opacity:0},t=!0);else if("wedge"===n.type)if(s)o.add(i),n._targetOpacity=n.style.opacity??1,s.startAngle===n.startAngle&&s.endAngle===n.endAngle||(n._targetStartAngle=n.startAngle,n._targetEndAngle=n.endAngle,n.startAngle=s.startAngle,n.endAngle=s.endAngle,t=!0);else{n._targetOpacity=n.style.opacity??1,n._targetStartAngle=n.startAngle,n._targetEndAngle=n.endAngle;const e=n.startAngle;n.startAngle=e,n.endAngle=e,n.style={...n.style,opacity:0},this.prevPositionMap.set(i,{x:n.cx,y:n.cy,startAngle:e,endAngle:e,innerRadius:n.innerRadius,outerRadius:n.outerRadius,opacity:0}),t=!0}}this.exitNodes=[];for(const[e,r]of this.prevPositionMap)if(!o.has(e)){if(e.startsWith("p:"))this.exitNodes.push({type:"point",x:r.x,y:r.y,r:r.r??3,style:{opacity:r.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))this.exitNodes.push({type:"rect",x:r.x,y:r.y,w:r.w??0,h:r.h??0,style:{opacity:r.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("w:")){const t=((r.startAngle??0)+(r.endAngle??0))/2,o={type:"wedge",cx:r.x,cy:r.y,innerRadius:r.innerRadius??0,outerRadius:r.outerRadius??100,startAngle:r.startAngle??0,endAngle:r.endAngle??0,style:{opacity:r.opacity??1},datum:null,category:e.slice(2),_targetStartAngle:t,_targetEndAngle:t,_targetOpacity:0,_transitionKey:e};this.exitNodes.push(o)}t=!0}this.exitNodes.length>0&&(this.scene=[...this.scene,...this.exitNodes]),t&&(this.activeTransition={startTime:Ue(),duration:e})}advanceTransition(e){if(!this.activeTransition)return!1;const t=Ve(e,this.activeTransition),o=Ge(t,"linear"===this.config.transition?.easing?"linear":"ease-out-cubic");for(const e of this.scene){const t=e._transitionKey;if(t)if("point"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style.opacity=Xe(r?r.opacity??1:0,e._targetOpacity,o)}const r=this.prevPositionMap.get(t);void 0!==e._targetX&&r&&(e.x=Xe(r.x,e._targetX,o),e.y=Xe(r.y,e._targetY,o)),void 0!==e._targetR&&void 0!==r?.r&&(e.r=Xe(r.r,e._targetR,o))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style.opacity=Xe(r?r.opacity??1:0,e._targetOpacity,o)}if(void 0===e._targetX)continue;const r=this.prevPositionMap.get(t);if(!r)continue;e.x=Xe(r.x,e._targetX,o),e.y=Xe(r.y,e._targetY,o),void 0!==r.w&&(e.w=Xe(r.w,e._targetW,o),e.h=Xe(r.h,e._targetH,o))}else if("wedge"===e.type){if(void 0!==e._targetOpacity){const r=this.prevPositionMap.get(t);e.style={...e.style,opacity:Xe(r?r.opacity??1:0,e._targetOpacity,o)}}if(void 0!==e._targetStartAngle&&void 0!==e._targetEndAngle){const r=this.prevPositionMap.get(t);r&&void 0!==r.startAngle&&(e.startAngle=Xe(r.startAngle,e._targetStartAngle,o),e.endAngle=Xe(r.endAngle,e._targetEndAngle,o))}}}if(t>=1){for(const e of this.scene)if(void 0!==e._targetOpacity&&(e.style={...e.style||{},opacity:0===e._targetOpacity?0:e._targetOpacity},e._targetOpacity=void 0),"point"===e.type){if(void 0===e._targetX&&void 0===e._targetR)continue;void 0!==e._targetX&&(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"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0);if(this.exitNodes.length>0){const e=new Set(this.exitNodes);this.scene=this.scene.filter(t=>!e.has(t)),this.exitNodes=[]}return this.activeTransition=null,!1}return!0}cancelIntroAnimation(){this.prevPositionMap.clear(),this.activeTransition=null}getBufferArray(){return this._bufferArrayCache?.version!==this._dataVersion&&(this._bufferArrayCache={version:this._dataVersion,data:this.buffer.toArray()}),this._bufferArrayCache.data}getData(){return this.buffer.toArray()}getLastUpdateResult(){return this.updateResults.last}remove(e){if(!this.getDataId)throw Error("remove() requires dataIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ue(e),o=this.getDataId,r=e=>t.has(o(e));Yt(this.buffer,this.timestampBuffer,r);const n=this.buffer.remove(r);if(0===n.length)return this.updateResults.recordNoop("remove"),n;for(const e of n)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach(e=>this.categories.add(this.getO(e))),this._dataVersion++,this.version++,this.lastIngestTime=Ue(),this.updateResults.recordData("remove",n.length),n}update(e,t){if(!this.getDataId)throw Error("update() requires dataIdAccessor to be configured");const o=ue(e),r=this.getDataId,n=new Set;this.buffer.forEach((e,t)=>{o.has(r(e))&&n.add(t)});const i=this.buffer.update(e=>o.has(r(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.evictValueExtent(e);return this.categories.clear(),this.buffer.forEach((e,t)=>{this.categories.add(this.getO(e)),n.has(t)&&this.pushValueExtent(e)}),this._dataVersion++,this.version++,this.lastIngestTime=Ue(),this.updateResults.recordData("update",i.length),i}clear(){this.buffer.clear(),this.rExtent.clear(),this.categories.clear(),this._hasStreamingData=!1,this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this.scales=null,this.scene=[],this.columns={},this.multiScales=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._pointQuadtree=null,this._maxPointRadius=0,this._colorSchemeMap=null,this._colorSchemeIndex=0,this._dataVersion++,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getOAccessor(){return this.getO}getRAccessor(){return this.getR}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){const o=this._customRestyle;if(o)for(const r of e){const e=this._baseStyles.get(r)??r.style??{},n=o(r,t);r.style=n?{...e,...n}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}rebuildAccessorDerivedState(){this.categories.clear(),this.rExtent.clear();for(const e of this.rExtents)e.clear();this._categoryIndexCache=null,this.buffer.forEach(e=>{this.categories.add(this.getO(e)),this.pushValueExtent(e)})}updateConfig(e){const t={...this.config},o=Object.keys(e).filter(o=>e[o]!==t[o]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e&&e.colorScheme!==t.colorScheme||"themeCategorical"in e&&e.themeCategorical!==t.themeCategorical||"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor))&&(this._colorSchemeMap=null,this._colorSchemeIndex=0),("categoryAccessor"in e&&!re(e.categoryAccessor,t.categoryAccessor)||"oAccessor"in e&&!re(e.oAccessor,t.oAccessor))&&(this._categoryIndexCache=null),Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let r=!1;("categoryAccessor"in e||"oAccessor"in e)&&(re(this.config.categoryAccessor||this.config.oAccessor,t.categoryAccessor||t.oAccessor)||(this.getO=se(this.config.categoryAccessor||this.config.oAccessor,"category"),r=!0));let n=!1;if("valueAccessor"in e||"rAccessor"in e){const e=this.config.valueAccessor||this.config.rAccessor,o=t.valueAccessor||t.rAccessor,r=Array.isArray(e)?e:[e],i=Array.isArray(o)?o:[o];if(n=r.length!==i.length||r.some((e,t)=>!re(e,i[t])),n){const e=this.config.valueAccessor||this.config.rAccessor;Array.isArray(e)?(this.rAccessors=e.map(e=>ne(e,"value")),this.getR=this.rAccessors[0],this.rExtents=e.map(()=>new oe)):(this.getR=ne(e,"value"),this.rAccessors=[this.getR],this.rExtents=[this.rExtent])}}"stackBy"in e&&!re(e.stackBy,t.stackBy)&&(this.getStack=null!=this.config.stackBy?se(this.config.stackBy):void 0),"groupBy"in e&&!re(e.groupBy,t.groupBy)&&(this.getGroup=null!=this.config.groupBy?se(this.config.groupBy):void 0),"colorAccessor"in e&&!re(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?se(this.config.colorAccessor):void 0),"symbolAccessor"in e&&!re(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?se(this.config.symbolAccessor):void 0),"connectorAccessor"in e&&!re(e.connectorAccessor,t.connectorAccessor)&&(this.getConnector=null!=this.config.connectorAccessor?se(this.config.connectorAccessor):void 0),(r||n||"accessorRevision"in e&&e.accessorRevision!==t.accessorRevision)&&this.rebuildAccessorDerivedState(),this.updateResults.recordConfig(o)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};function ml(e,t,o,r=30,n,i=0){let s=null;if(n){const e=No(n,t,o,r,i);e&&(s={datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"rect":if(null==i.datum)break;e=yl(i,t,o);break;case"point":if(n)break;e=bl(i,t,o,r);break;case"symbol":e=vl(i,t,o,r);break;case"glyph":e=xl(i,t,o,r);break;case"wedge":if(null===i.datum)break;e=kl(i,t,o);break;case"boxplot":e=wl(i,t,o);break;case"violin":e=Sl(i,t,o)}e&&r>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function yl(e,t,o){const r=ko(t,o,e);return r.hit?{datum:e.datum,x:r.cx,y:e.y,distance:0,category:e.group}:null}function bl(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function vl(e,t,o,r=30){const n=t-e.x,i=o-e.y,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{datum:e.datum,x:e.x,y:e.y,distance:s}}function xl(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.x+n.centerDx,s=e.y+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{datum:e.datum,x:i,y:s,distance:c}}function kl(e,t,o){const r=t-e.cx,n=o-e.cy,i=Math.sqrt(r*r+n*n);if(e.innerRadius>i||i>e.outerRadius)return null;const s=Co(Math.atan2(n,r)),a=Co(e.startAngle),l=Co(e.endAngle);if(!(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 wl(e,t,o){const r=e.columnWidth/2;if("vertical"===e.projection){if(!(e.x-r>t||t>e.x+r||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,stats:e.stats}}else{const n=e.y-r,i=e.y+r;if(!(Math.min(e.minPos,e.maxPos)>t||t>Math.max(e.minPos,e.maxPos)||n>o||o>i))return{datum:e.datum,x:e.medianPos,y:e.y,distance:0,category:e.category,stats:e.stats}}return null}function Sl(e,t,o){if(!e.bounds)return null;const{x:r,y:n,width:i,height:s}=e.bounds;return r>t||t>r+i||n>o||o>n+s?null:{datum:e.datum,x:r+i/2,y:n+s/2,distance:0,category:e.category,stats:e.stats}}var Al=require("react"),Cl=require("react/jsx-runtime");function Ml(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,showGrid:l,rFormat:c}=e,{rTickValues:u,axisExtent:d}=e,h="radial"===s?.projection,p="horizontal"===s?.projection,f=(0,Al.useMemo)(()=>!s||h?[]:(u||Jn(s.r,5,d)).map(e=>({value:e,pixel:s.r(e),label:(c||jl)(e)})),[s,c,h,u,d]),g=l&&s&&!h,m=a&&s&&!h;return g||m?(0,Cl.jsx)("svg",{width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:(0,Cl.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[g&&(0,Cl.jsx)("g",{className:"ordinal-grid",children:f.map((e,r)=>(0,Cl.jsx)("line",{x1:p?e.pixel:0,y1:p?0:e.pixel,x2:p?e.pixel:t,y2:p?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+r))}),m&&(0,Cl.jsx)(Cl.Fragment,{children:(0,Cl.jsxs)(Cl.Fragment,p?{children:[(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]}:{children:[(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})]})})]})}):null}function jl(e){return Math.round(100*e)/100+""}function Pl(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,scales:s,showAxes:a,showCategoryTicks:l,oLabel:c,rLabel:u,oFormat:d,rFormat:h,showGrid:p,title:f,legend:g,legendHoverBehavior:m,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v,legendPosition:x="right",legendLayout:k,foregroundGraphics:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,xAccessor:M,yAccessor:j,annotationData:P,underlayRendered:_,children:L}=e,R="radial"===s?.projection,T="horizontal"===s?.projection,I=!1!==l,$=(0,Al.useMemo)(()=>{if(!a||!I||!s||R)return[];const e=s.o.bandwidth(),t=s.o.domain().map((t,o)=>({value:t,pixel:(s.o(t)??0)+e/2,label:d?d(t,o):t}));if(2>=t.length)return t;const o=Math.abs(t[1].pixel-t[0].pixel)||e;let r,n=0,i=!1;for(const e of t)"string"==typeof e.label?n=Math.max(n,e.label.length):"number"==typeof e.label?n=Math.max(n,(e.label+"").length):i=!0;r=T?i?24:16:Math.max(6.5*n,i?60:0)+6;const l=Math.max(1,Math.ceil(r/o));return 1===l?t:t.filter((e,t)=>t%l===0)},[a,I,s,d,R,T]),N=e.rTickValues,F=e.tickLabelEdgeAlign,B=e.axisExtent,D=(0,Al.useMemo)(()=>a&&s&&!R?(N||Jn(s.r,5,B)).map(e=>({value:e,pixel:s.r(e),label:(h||jl)(e)})):[],[a,s,h,R,N,B]),E=(0,Al.useRef)(new Map),z=(0,Al.useRef)(S?.length??0),H=S?.length??0;z.current!==H&&(z.current=H,E.current=new Map);const O=(0,Al.useMemo)(()=>{if(!S||0===S.length)return null;const e=wn(),r="horizontal"===s?.projection,n=s?.o?e=>(s.o(e)??0)+s.o.bandwidth()/2:null,i={scales:s?{x:r?s.r:n||s.r,y:r&&n||s.r,time:s.r,value:s.r,o:s.o}:null,timeAxis:"x",xAccessor:M,yAccessor:j,width:t,height:o,data:P,frameType:"ordinal",projection:r?"horizontal":"vertical",stickyPositionCache:E.current};return kn(A?Hn({annotations:S,context:i,..."object"==typeof A?A:{}}):S,e,C,i)},[S,A,C,t,o,s,M,j,P]);return a||f||g||w||O&&O.length>0||p||L?(0,Cl.jsxs)("svg",{role:"img",width:r,height:n,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Cl.jsx)("title",{children:"string"==typeof f?f:"Ordinal Chart"}),(0,Cl.jsx)("desc",{children:"string"==typeof f?f+" — ordinal data visualization":"Ordinal data visualization"}),(0,Cl.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[p&&s&&!R&&!_&&(0,Cl.jsx)("g",{className:"ordinal-grid",children:D.map((e,r)=>(0,Cl.jsx)("line",{x1:T?e.pixel:0,y1:T?0:e.pixel,x2:T?e.pixel:t,y2:T?o:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1},"grid-"+r))}),a&&s&&!R&&(()=>{const e={fontSize:"var(--semiotic-tick-font-size, 12px)"},r={fontSize:"var(--semiotic-axis-label-font-size, 12px)"};return(0,Cl.jsx)("g",{className:"ordinal-axes",children:(0,Cl.jsxs)(Cl.Fragment,T?{children:[(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),$.map((t,o)=>(0,Cl.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Cl.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Cl.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Cl.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Cl.jsx)("div",{style:{textAlign:"right",userSelect:"none",...e},children:t.label})})]},"cat-"+o)),c&&(0,Cl.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...r},children:c})]}),(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:o,x2:t,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),!_&&s?.r&&(()=>{const e=s.r(0);return e>1&&t-1>e?(0,Cl.jsx)("line",{x1:e,y1:0,x2:e,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1,strokeDasharray:"4,4"}):null})(),D.map((t,r)=>{const n=F?0===r?"start":r===D.length-1?"end":"middle":"middle";return(0,Cl.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Cl.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("text",{y:18,textAnchor:n,fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+r)}),u&&(0,Cl.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...r},children:u})]})]}:{children:[(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[!_&&(()=>{const e=s?.r?s.r(0):o,r=0>e||e>o?o:e;return(0,Cl.jsx)("line",{x1:0,y1:r,x2:t,y2:r,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1})})(),$.map((t,r)=>(0,Cl.jsxs)("g",{transform:`translate(${t.pixel},${o})`,children:[(0,Cl.jsx)("line",{y2:5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?(0,Cl.jsx)("text",{y:18,textAnchor:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label}):(0,Cl.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Cl.jsx)("div",{style:{textAlign:"center",userSelect:"none",...e},children:t.label})})]},"cat-"+r)),c&&(0,Cl.jsx)("text",{x:t/2,y:o+40,textAnchor:"middle",fill:"var(--semiotic-text, #333)",className:"semiotic-axis-label",style:{userSelect:"none",...r},children:c})]}),(0,Cl.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[!_&&(0,Cl.jsx)("line",{x1:0,y1:0,x2:0,y2:o,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),D.map((t,o)=>(0,Cl.jsxs)("g",{transform:`translate(0,${t.pixel})`,children:[(0,Cl.jsx)("line",{x2:-5,stroke:"var(--semiotic-border, #ccc)",strokeWidth:1}),(0,Cl.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:"middle",fill:"var(--semiotic-text-secondary, #666)",className:"semiotic-axis-tick",style:{userSelect:"none",...e},children:t.label})]},"val-"+o)),u&&(0,Cl.jsx)("text",{x:15-i.left,y:o/2,textAnchor:"middle",fill:"var(--semiotic-text, #333)",transform:`rotate(-90, ${15-i.left}, ${o/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...r},children:u})]})]})})})(),O,w,L]}),f&&(0,Cl.jsx)("text",{x:r/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof f?f:null}),Hr({legend:g,totalWidth:r,totalHeight:n,margin:i,legendPosition:x,title:f,legendLayout:k,legendHoverBehavior:m,legendClickBehavior:y,legendHighlightedCategory:b,legendIsolatedCategories:v})]}):null}var _l=require("react"),Ll=require("d3-selection"),Rl=require("d3-brush"),Tl=require("react/jsx-runtime");function Il({width:e,height:t,totalWidth:o,totalHeight:r,margin:n,scales:i,onBrush:s}){const a=(0,_l.useRef)(null),l=(0,_l.useRef)(null),c=(0,_l.useRef)(s);c.current=s;const u=(0,_l.useRef)(i);u.current=i;const d=(0,_l.useRef)(!1),h=(0,_l.useRef)(null),p="horizontal"===i?.projection,f=(0,_l.useRef)(p);f.current=p;const g=I({label:"Ordinal value range brush",onAction:e=>{const t=u.current,o=l.current;if(!t||!o||!a.current)return;const r=(0,Ll.select)(a.current).select(".brush-g");if("clear"===e.type)return d.current=!0,r.call(o.move,null),d.current=!1,h.current=null,void c.current(null);if(("left"===e.direction||"right"===e.direction)!=!!f.current)return;const n=t.r.domain(),[i,s]=[Math.min(...n),Math.max(...n)],p=(s-i)/20,g=h.current?.r??[i+.4*(s-i),i+.6*(s-i)],m="left"===e.direction||"down"===e.direction?-1:1;let[y,b]=g;if(e.resize)0>m?y=Math.max(i,y-p):b=Math.min(s,b+p);else{const e=b-y;y=Math.max(i,Math.min(s-e,y+m*p)),b=y+e}const v={r:[y,b]};d.current=!0,r.call(o.move,f.current?[t.r(y),t.r(b)]:[t.r(b),t.r(y)]),d.current=!1,h.current=v,c.current(v)}});return(0,_l.useEffect)(()=>{if(!a.current)return;const o=(0,Ll.select)(a.current).select(".brush-g"),r=p?(0,Rl.brushX)():(0,Rl.brushY)();return r.extent([[0,0],[e,t]]),r.on("brush end",e=>{if(d.current)return;const t=u.current;if(!t)return;if(!e.selection)return h.current=null,void c.current(null);const[o,r]=e.selection;let n;n=f.current?[t.r.invert(o),t.r.invert(r)]:[t.r.invert(r),t.r.invert(o)];const i={r:n};h.current=i,c.current(i)}),o.call(r),l.current=r,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{r.on("brush end",null),l.current=null}},[e,t,p]),(0,_l.useEffect)(()=>{if(!i||!l.current||!h.current)return;if(!a.current)return;const e=h.current,t=(0,Ll.select)(a.current).select(".brush-g"),o=i.r(e.r[0]),r=i.r(e.r[1]);p?(d.current=!0,t.call(l.current.move,[o,r]),d.current=!1):(d.current=!0,t.call(l.current.move,[r,o]),d.current=!1)},[i,p]),(0,Tl.jsxs)("svg",{ref:a,width:o,height:r,...g.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Tl.jsx)("title",{children:g.svgProps["aria-label"]}),(0,Tl.jsx)("desc",{id:g.descriptionId,children:g.description}),(0,Tl.jsx)("g",{className:"brush-g",transform:`translate(${n.left},${n.top})`,style:{pointerEvents:"all"}})]})}var $l=require("d3-shape");function Nl(e,t){const o=t._gradientBand.colors;if(0===o.length)return;const{clipPath:r,slices:n}=mi({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:o}),i=new Path2D(r);e.save(),e.translate(t.cx,t.cy),e.clip(i);for(const t of n)e.fillStyle=Oo(e,t.color)||t.color||"#007bff",e.fill(new Path2D(t.d));e.restore(),t.style.stroke&&"none"!==t.style.stroke&&(e.save(),e.translate(t.cx,t.cy),e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(i),e.restore())}function Fl(e,t){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()}function Bl(e,t){const o={innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+Math.PI/2,endAngle:t.endAngle+Math.PI/2},r=(0,$l.arc)().cornerRadius(t.cornerRadius)(o);if(!r)return;e.save(),e.translate(t.cx,t.cy);const n=new Path2D(r);e.fill(n),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(n),e.restore()}var Dl=(e,t,o,r)=>{const n=t.filter(e=>"wedge"===e.type);for(const t of n)if(e.globalAlpha=(t.style.fillOpacity??1)*(t.style.opacity??1),t._gradientBand&&t._gradientBand.colors.length>0)Nl(e,t),t._pulseIntensity&&t._pulseIntensity>0&&(Fl(e,t),ga(e,t)),e.globalAlpha=1;else{if(e.fillStyle=("string"==typeof t.style.fill?Oo(e,t.style.fill):t.style.fill)||"#007bff",t.roundedEnds){t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1);const o=gi({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});e.save(),e.translate(t.cx,t.cy);const r=new Path2D(o);e.fill(r),t.style.stroke&&"none"!==t.style.stroke&&e.stroke(r),e.restore()}else t.cornerRadius?(t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1),Bl(e,t)):(Fl(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()));t._pulseIntensity&&t._pulseIntensity>0&&(Fl(e,t),ga(e,t)),e.globalAlpha=1}},El=(e,t,o,r)=>{const n=t.filter(e=>"boxplot"===e.type);for(const t of n){const o=t.columnWidth/2,r="vertical"===t.projection,n=Oo(e,"var(--semiotic-primary, #007bff)"),i=Oo(e,"var(--semiotic-text, #333)"),s=t.style.fill,a="string"==typeof s?Oo(e,s)||s:s??n,l=t.style.stroke,c="string"==typeof l?Oo(e,l)||l:i,u=t.style.strokeWidth||1,d=t.style.fillOpacity??t.style.opacity??.6;if(e.save(),e.strokeStyle=c,e.lineWidth=u,e.beginPath(),r?(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(),r?(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=d,e.fillStyle=a,r){const r=Math.min(t.q1Pos,t.q3Pos),n=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(t.x-o,r,t.columnWidth,n),e.globalAlpha=1,e.strokeRect(t.x-o,r,t.columnWidth,n)}else{const r=Math.min(t.q1Pos,t.q3Pos),n=Math.abs(t.q3Pos-t.q1Pos);e.fillRect(r,t.y-o,n,t.columnWidth),e.globalAlpha=1,e.strokeRect(r,t.y-o,n,t.columnWidth)}e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),r?(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()}},zl=(e,t,o,r)=>{const n=t.filter(e=>"violin"===e.type);for(const t of n){e.save(),(t.translateX||t.translateY)&&e.translate(t.translateX,t.translateY);const o=new Path2D(t.pathString);if(e.globalAlpha=t.style.fillOpacity??t.style.opacity??.6,e.fillStyle=("string"==typeof t.style.fill?Oo(e,t.style.fill):t.style.fill)||"#007bff",e.fill(o),e.globalAlpha=1,t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke(o)),t.iqrLine){e.strokeStyle="#333",e.lineWidth=2,e.globalAlpha=.8;const o=t.iqrLine.centerPos,r=!1!==t.iqrLine.isVertical;e.beginPath(),r?(e.moveTo(o,t.iqrLine.q1Pos),e.lineTo(o,t.iqrLine.q3Pos)):(e.moveTo(t.iqrLine.q1Pos,o),e.lineTo(t.iqrLine.q3Pos,o)),e.stroke(),e.beginPath(),r?e.arc(o,t.iqrLine.medianPos,3,0,2*Math.PI):e.arc(t.iqrLine.medianPos,o,3,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.strokeStyle="#333",e.lineWidth=1,e.stroke(),e.globalAlpha=1}e.restore()}},Hl=(e,t,o,r)=>{const n=t.filter(e=>"connector"===e.type);if(0===n.length)return;const i=new Map;for(const e of n){const t=e.group||"_default";i.has(t)||i.set(t,[]),i.get(t).push(e)}for(const[,t]of i){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=o.fillOpacity??o.opacity??.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=Oo(e,o.style.stroke)||("string"==typeof o.style.fill?Oo(e,o.style.fill):o.style.fill)||Oo(e,"var(--semiotic-border, #999)"),e.lineWidth=o.style.strokeWidth||1,e.globalAlpha=o.style.opacity??.5,e.stroke(),e.globalAlpha=1}},Ol=(e,t,o,r)=>{const n=t.filter(e=>"trapezoid"===e.type);for(const t of n){const o=t.points;if(o.length>=4){e.globalAlpha=t.style?.opacity??1,e.beginPath(),e.moveTo(o[0][0],o[0][1]);for(let t=1;o.length>t;t++)e.lineTo(o[t][0],o[t][1]);e.closePath(),e.fillStyle=t.style?.fill||"#999",e.fill(),t.style?.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke()),e.globalAlpha=1}}};function Wl(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ql(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Yl=null;function Gl(e={},t){const{background:o="transparent",stroke:r="#000",lineWidth:n=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Yl||(Yl=document.createElement("canvas")),Yl.width=e,Yl.height=e,Yl)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;o&&"transparent"!==o?(c.fillStyle=o,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=r,c.lineWidth=n,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}var Vl=new Map;function Xl(e,t){const o=`${e}@${"undefined"!=typeof window&&window.devicePixelRatio||1}`,r=Vl.get(o);if(void 0!==r)return r;const n=Gl({background:e,stroke:"rgba(255,255,255,0.5)",lineWidth:1.5,spacing:6,angle:45},t);return Vl.set(o,n),n}function Ul(e,t,o,r,n,i){e.moveTo(t+i,o),e.lineTo(t+r-i,o),e.quadraticCurveTo(t+r,o,t+r,o+i),e.lineTo(t+r,o+n-i),e.quadraticCurveTo(t+r,o+n,t+r-i,o+n),e.lineTo(t+i,o+n),e.quadraticCurveTo(t,o+n,t,o+n-i),e.lineTo(t,o+i),e.quadraticCurveTo(t,o,t+i,o),e.closePath()}function Kl(e){return 1e6>e?1e4>e?1e3>e?Math.round(e)+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function Ql(e){return.05>Math.abs(e-Math.round(e))?Math.round(e)+"%":e.toFixed(1)+"%"}var Zl=e=>[Hl,...e],Jl={bar:Zl([ja]),clusterbar:Zl([ja]),point:Zl([va,wa]),swarm:Zl([va,wa]),pie:[Dl],donut:[Dl],boxplot:Zl([El,va]),violin:Zl([zl]),histogram:Zl([ja]),ridgeline:Zl([zl]),timeline:Zl([ja]),funnel:[ja,Ol,(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&null!=e.datum);if(0!==n.length&&n.some(e=>null!=e.datum?.__funnelStepLabel||null!=e.datum?.__funnelValueLabelX)){e.textBaseline="top",e.lineJoin="round",e.textAlign="center",e.font="bold 14px sans-serif";for(const t of n){const o=t.datum;if(!o)continue;if(!o.__funnelStepLabel)continue;const r=o.__funnelStepLabel;if(e.measureText(r).width+16>(o.__funnelRowWidth??o.__funnelBarW??0))continue;const n=o.__funnelStepLabelX,i=o.__funnelStepLabelY+3;e.strokeStyle="rgba(0,0,0,0.6)",e.lineWidth=3,e.strokeText(r,n,i),e.fillStyle="#fff",e.fillText(r,n,i)}e.font="bold 13px sans-serif";for(const t of n){const o=t.datum;if(!o)continue;if(null==o.__funnelValueLabelX)continue;const r=o.__funnelBarW??0;if(60>r)continue;const n=o.__funnelValue;if(null==n||0===n)continue;const i=o.__funnelPercent,s=!0===o.__funnelIsFirstStep;let a;if(a=s?Wl(n):null!=i?`${Wl(n)} (${ql(i)})`:Wl(n),e.measureText(a).width+16>r){if(s||null==i)continue;if(a=Wl(n),e.measureText(a).width+16>r)continue}const l=o.__funnelValueLabelX,c=(o.__funnelValueLabelY??t.y)+14+5;e.textAlign="center",e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=3,e.strokeText(a,l,c),e.fillStyle="#fff",e.fillText(a,l,c)}e.lineWidth=1,e.lineJoin="miter"}}],"bar-funnel":[ja,(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&!0===e.datum?.__barFunnelIsDropoff);for(const t of n){const o=("string"==typeof t.style.fill?t.style.fill:null)||Oo(e,"var(--semiotic-border, #999)"),r=Xl(o,e);e.globalAlpha=t.style.opacity??1,e.beginPath(),e.rect(t.x,t.y,t.w,t.h),r?e.fillStyle=r:(e.fillStyle=o,e.globalAlpha=.4*(t.style.opacity??1)),e.fill(),e.globalAlpha=1}},(e,t,o,r)=>{const n=t.filter(e=>"rect"===e.type&&!0!==e.datum?.__barFunnelIsDropoff&&null!=e.datum?.__barFunnelLabelX);if(0===n.length)return;const i=function(e,t){const[o,r,n]=Wo(e,t);return(.2126*o+.7152*r+.0722*n)/255>.6}(e,Oo(e,"var(--semiotic-text, #333)")),s=i?"#1f2937":"#ffffff",a=i?"rgba(255,255,255,0.18)":"rgba(0,0,0,0.12)",l=i?"#f3f4f6":"#1a1a1a",c=l;for(const t of n){const o=t.datum;if(!o)continue;const r=o.__barFunnelValue;if(null==r)continue;if(25>t.w)continue;const n=o.__barFunnelPercent,i=!(!0===o.__barFunnelIsFirstStep)&&null!=n,u=i?Ql(n):"",d=Kl(r);e.font="bold 13px sans-serif";const h=i?e.measureText(u).width:0;e.font="11px sans-serif";const p=e.measureText(d).width,f=Math.max(h,p)+12,g=i?32:17,m=o.__barFunnelLabelX,y=m-f/2,b=o.__barFunnelLabelY-g-4;e.save(),e.shadowColor="rgba(0,0,0,0.15)",e.shadowBlur=4,e.shadowOffsetY=1,e.fillStyle=s,e.beginPath(),Ul(e,y,b,f,g,4),e.fill(),e.restore(),e.strokeStyle=a,e.lineWidth=.5,e.beginPath(),Ul(e,y,b,f,g,4),e.stroke(),e.textAlign="center",e.textBaseline="top",i?(e.font="bold 13px sans-serif",e.fillStyle=l,e.fillText(u,m,b+3),e.font="11px sans-serif",e.fillStyle=c,e.fillText(d,m,b+3+13+2)):(e.font="bold 11px sans-serif",e.fillStyle=l,e.fillText(d,m,b+3))}e.lineWidth=1}],swimlane:Zl([ja]),custom:Zl([ja,va,wa,Aa,Dl,El,zl,Ol])},ec=require("react/jsx-runtime");function tc(e){const t=_s(e,{skipPositional:!1});return null==t.title&&0===t.entries.length?null:(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[null!=t.title&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:t.title+""}),t.entries.map(e=>(0,ec.jsxs)("div",{children:[(0,ec.jsxs)("span",{style:{opacity:.7},children:[e.key,":"]})," ","number"==typeof e.value?e.value.toLocaleString():e.value+""]},e.key))]})}function oc({hover:e}){const t=e.data||{},o=e.stats,r=e.category;if(Array.isArray(t)){const e=r||t[0]?.category||"";if(o)return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[e&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,ec.jsxs)("div",{children:["n = ",o.n]}),(0,ec.jsxs)("div",{children:["Min: ",o.min.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Q1: ",o.q1.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Median: ",o.median.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Q3: ",o.q3.toLocaleString()]}),(0,ec.jsxs)("div",{children:["Max: ",o.max.toLocaleString()]}),(0,ec.jsxs)("div",{style:{opacity:.8},children:["Mean: ",o.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});const n=t.length;return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[e&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:e+""}),(0,ec.jsxs)("div",{children:[n," items"]})]})}if(null!=t.bin&&null!=t.count){const e=t.range||[];return(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[t.category&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:t.category+""}),(0,ec.jsxs)("div",{children:["Count: ",t.count]}),2===e.length&&(0,ec.jsxs)("div",{style:{opacity:.8},children:[Number(e[0]).toFixed(1)," – ",Number(e[1]).toFixed(1)]})]})}const n=e.__oAccessor,i=e.__rAccessor,s=e.__chartType;if("swarm"===s||"point"===s)return tc(t);const a=(n&&null!=t[n]?t[n]:null)||t.category||t.name||t.group||t.__rName||"",l=t.__aggregateValue??(i&&null!=t[i]?t[i]:null)??t.value??t.__rValue??t.pct??"";return a||""!==l?(0,ec.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[a&&(0,ec.jsx)("div",{style:{fontWeight:"bold"},children:a+""}),""!==l&&(0,ec.jsx)("div",{children:"number"==typeof l?l.toLocaleString():l+""})]}):tc(t)}oc.ownsChrome=!0;var rc=require("react/jsx-runtime"),nc={top:50,right:40,bottom:60,left:70},ic=(0,Qa.memo)((0,Qa.forwardRef)(function(e,t){const{chartType:o,runtimeMode:r,data:n,oAccessor:i="category",rAccessor:s="value",colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:p,valueAccessor:f,categoryAccessor:g,accessorRevision:m,projection:y="vertical",size:b=[600,400],responsiveWidth:v,responsiveHeight:x,margin:k,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:j,cornerRadius:P,normalize:_,startAngle:L,sweepAngle:R,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:F,connectorOpacity:B,showLabels:D,connectorAccessor:E,connectorStyle:O,dataIdAccessor:W,rExtent:q,oExtent:Y,extentPadding:V=.05,oSort:X,windowMode:U="sliding",windowSize:K=200,pieceStyle:Q,summaryStyle:Z,colorScheme:J,barColors:ee,showAxes:te=!0,showCategoryTicks:oe,categoryLabel:re,valueLabel:ne,categoryFormat:ie,valueFormat:se,oLabel:ae,rLabel:le,oFormat:ce,rFormat:ue,rTickValues:de,tickLabelEdgeAlign:he,axisExtent:pe,enableHover:fe=!0,hoverAnnotation:ge,tooltipContent:me,customHoverBehavior:ye,customClickBehavior:be,annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,showGrid:we=!1,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,legendCategoryAccessor:Le,onCategoriesChange:Re,backgroundGraphics:Te,foregroundGraphics:Ie,title:$e,className:Ne,background:Fe,centerContent:Be,decay:De,pulse:Ee,transition:ze,animate:He,staleness:Oe,brush:We,onBrush:qe,accessibleTable:Ye=!0,description:Ge,summary:Ve,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutSelection:Qe}=e,Ze=(0,Qa.useRef)(!0),Je=Us({sizeProp:b,responsiveWidth:v,responsiveHeight:x,userMargin:k,marginDefault:nc,animate:He,transitionProp:ze,themeDirtyRef:Ze}),{reducedMotionRef:et,responsiveRef:tt,size:ot,margin:rt,adjustedWidth:nt,adjustedHeight:it,currentTheme:st,transition:at,introEnabled:lt,tableId:ct,rafRef:ut,renderFnRef:dt,scheduleRender:ht,cancelRender:pt}=Je,ft=Mi(),gt=Li(),mt=(0,Qa.useMemo)(()=>z(n),[n]),yt=re??ae,bt=ne??le,vt=ie??ce,xt=se??ue,kt=(0,Qa.useRef)(null),wt=(0,Qa.useRef)(null),St=(0,Qa.useRef)([]),At=(0,Qa.useRef)(Le),Ct=(0,Qa.useRef)(Re);At.current=Le,Ct.current=Re;const[Mt,jt]=(0,Qa.useState)(null),[Pt,_t]=(0,Qa.useState)(null),Lt=(e,t)=>"function"==typeof e?e({size:ot,margin:rt,scales:t}):e,Rt=Lt(Ie,Pt),Tt=Lt(Te,Pt),[It,$t]=(0,Qa.useState)(0),Nt=(0,Qa.useRef)(0),[Ft,Bt]=(0,Qa.useState)(!1),Dt=(0,Qa.useRef)({w:-1,h:-1}),Et=(0,Qa.useRef)(!1),zt=fe||ge,Ht="streaming"===r,Ot=Ii((0,Qa.useMemo)(()=>({chartType:o,runtimeMode:Ht?"streaming":"bounded",windowSize:K,windowMode:U,extentPadding:V,projection:y,oAccessor:Ht?void 0:i,rAccessor:Ht?void 0:s,accessorRevision:m,colorAccessor:a,symbolAccessor:l,symbolMap:c,stackBy:u,groupBy:d,multiAxis:h,timeAccessor:Ht?p:void 0,valueAccessor:Ht?f||("string"==typeof s||"function"==typeof s?s:void 0):void 0,categoryAccessor:Ht?g||i:void 0,rExtent:q,oExtent:Y,axisExtent:pe,barPadding:w,roundedTop:S,gradientFill:A,trackFill:C,baselinePadding:M,innerRadius:j,cornerRadius:P,normalize:_,startAngle:L,sweepAngle:R,dynamicColumnWidth:T,bins:I,showOutliers:$,showIQR:N,amplitude:F,connectorOpacity:B,showLabels:D,connectorAccessor:E,connectorStyle:O,dataIdAccessor:W,oSort:X,pieceStyle:Q,summaryStyle:Z,colorScheme:J,themeCategorical:st?.colors?.categorical,themeSemantic:G(st),themeSequential:st?.colors?.sequential,themeDiverging:st?.colors?.diverging,barColors:ee,decay:De,pulse:Ee,transition:at,introAnimation:lt,staleness:Oe,customLayout:Xe,onLayoutError:Ue,layoutConfig:Ke,layoutMargin:rt}),[o,K,U,V,y,i,s,m,a,l,c,u,d,h,p,f,g,q,Y,pe,w,S,A,C,M,j,P,_,L,R,T,I,$,N,F,B,D,E,O,W,X,Q,Z,J,ee,De,Ee,at?.duration,at?.easing,lt,Oe,Ht,st,Xe,Ue,Ke,rt])),Wt=(0,Qa.useRef)(null);Wt.current||(Wt.current=new gl(Ot));const qt=(0,Qa.useCallback)(()=>{const e=At.current,t=Ct.current;if(!t||!e)return;const o=ea(Wt.current?.getData()??[],e);ta(o,St.current)||(St.current=o,t(o))},[]);vo(Wt,Ot,Ze,ht),xo(Wt,Qe,Ze,ht);const Yt=(0,Qa.useRef)(null);Yt.current||(Yt.current=new H(e=>{const t=Wt.current;t&&t.ingest(e)&&(Ze.current=!0,ht())}));const Gt=(0,Qa.useCallback)(e=>{Yt.current?.push(e)},[]),Vt=(0,Qa.useCallback)(e=>{Yt.current?.pushMany(e)},[]),Xt=(0,Qa.useCallback)(()=>{Yt.current?.clear(),Wt.current?.clear(),Ze.current=!0,ht()},[ht]),Ut=(0,Qa.useCallback)(e=>{Yt.current?.clearLastData(),Yt.current?.setReplacementData(e)},[]);(0,Qa.useImperativeHandle)(t,()=>({push:Gt,pushMany:Vt,replace:Ut,remove:e=>{Yt.current?.flush();const t=Wt.current?.remove(e)??[];if(t.length>0){const e=wt.current?.data;!!wt.current&&t.some(Array.isArray(e)?t=>e.includes(t):t=>t===e)&&(wt.current=null,jt(null)),Ze.current=!0,ht()}return t},update:(e,t)=>{Yt.current?.flush();const o=Wt.current?.update(e,t)??[];return o.length>0&&(Ze.current=!0,ht()),o},clear:Xt,getData:()=>(Yt.current?.flush(),Wt.current?.getData()??[]),getScales:()=>Wt.current?.scales??null,getCustomLayout:()=>Wt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Wt.current?.lastCustomLayoutFailure??null}),[Gt,Vt,Ut,Xt,ht]),(0,Qa.useEffect)(()=>{n&&Yt.current?.setBoundedData(mt)},[n,mt]);const{hoverHandlerRef:Kt,hoverLeaveRef:Qt,onPointerMove:Zt,onPointerLeave:Jt}=Je;Kt.current=e=>{if(!zt)return;const t=kt.current;if(!t)return;const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,a=e.clientY-r.top-rt.top;if(0>n||n>nt||0>a||a>it)return void(wt.current&&(wt.current=null,jt(null),ye&&ye(null),ht()));const l=Wt.current;if(!l||0===l.scene.length)return;const c="radial"===y,u=ml(l.scene,c?n-nt/2:n,c?a-it/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return void(wt.current&&(wt.current=null,jt(null),ye&&ye(null),ht()));const d=Ss(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o});wt.current=d,jt(d),ye&&(ye(d),Ze.current=!0),ht()},Qt.current=()=>{wt.current&&(wt.current=null,jt(null),ye&&(ye(null),Ze.current=!0),ht())};const eo=(0,Qa.useCallback)(e=>{if(!be)return;const t=kt.current;if(!t)return be(null),Ze.current=!0,void ht();const r=t.getBoundingClientRect(),n=e.clientX-r.left-rt.left,a=e.clientY-r.top-rt.top;if(0>n||n>nt||0>a||a>it)return be(null),Ze.current=!0,void ht();const l=Wt.current;if(!l||0===l.scene.length)return be(null),Ze.current=!0,void ht();const c="radial"===y,u=ml(l.scene,c?n-nt/2:n,c?a-it/2:a,30,l.pointQuadtree,l.maxPointRadius);if(!u)return be(null),Ze.current=!0,void ht();be(Ss(u.datum||{},u.x,u.y,{...u.stats&&{stats:u.stats},...u.category&&{category:u.category},__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o})),Ze.current=!0,ht()},[it,nt,o,be,rt,i,y,s,ht]),to=(0,Qa.useRef)(-1),oo=(0,Qa.useRef)(null),ro=(0,Qa.useRef)(null),no=(0,Qa.useCallback)(e=>{const t=Wt.current;if(!t||0===t.scene.length)return;const r=t.version;let n;if(ro.current&&ro.current.version===r)n=ro.current.graph;else{const e=function(e){const t=[];for(const o of e)if("rect"===o.type&&null!=o.x){if(null==o.datum)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.group??o.datum?.category??""})}else if("point"===o.type)t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"});else if("symbol"===o.type){if(0>=o.size)continue;t.push({x:o.x,y:o.y,datum:o.datum,shape:"circle",group:"_default"})}else if("glyph"===o.type){if(0>=o.size||null==o.datum)continue;const e=Io(o.glyph,o.size);t.push({x:o.x+e.centerDx,y:o.y+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===o.type&&null!=o.cx){if(null===o.datum)continue;const e=((o.startAngle||0)+(o.endAngle||0))/2,r=((o.innerRadius||0)+(o.outerRadius||50))/2;t.push({x:o.cx+Math.cos(e)*r,y:o.cy+Math.sin(e)*r,datum:o.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.scene);if(0===e.length)return;n=ur(e),ro.current={version:r,graph:n}}const a=to.current;if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),to.current=0;const t=n.flat[0];oo.current={shape:t.shape,w:t.w,h:t.h};const r={...gr(t),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};return wt.current=r,jt(r),ye&&ye(r),void ht()}const l=dr(n,a),c=hr(e.key,l,n);if(null===c)return;if(e.preventDefault(),0>c)return to.current=-1,oo.current=null,wt.current=null,jt(null),ye&&ye(null),void ht();to.current=c;const u=n.flat[c];oo.current={shape:u.shape,w:u.w,h:u.h};const d={...gr(u),__oAccessor:"string"==typeof i?i:void 0,__rAccessor:"string"==typeof s?s:void 0,__chartType:o};wt.current=d,jt(d),ye&&ye(d),ht()},[ye,ht]),io=(0,Qa.useCallback)(e=>{to.current=-1,oo.current=null,Zt(e)},[Zt]);dt.current=()=>{ut.current=null;const e=kt.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const r=Wt.current;if(!r)return;const n="undefined"!=typeof performance?performance.now():Date.now(),i=r.advanceTransition(et.current?n+1e6:n),s=!et.current&&i,a=Dt.current.w!==nt||Dt.current.h!==it,l=Ze.current;let c=!1;!l&&!a||s&&!a||(r.computeScene({width:nt,height:it}),Dt.current={w:nt,h:it},c=!0,qt()),Ze.current=l&&s&&!c;const u=Ks(r,n,c,Et);(c||s)&&e.setAttribute("aria-label",Qi(r.scene,o+" chart"));const d=Zs(),h=ot[0]*d,p=ot[1]*d;e.width===h&&e.height===p||(e.width=h,e.height=p,e.style.width=ot[0]+"px",e.style.height=ot[1]+"px"),t.setTransform(d,0,0,d,0,0),t.clearRect(0,0,ot[0],ot[1]);const f=Oe&&r.lastIngestTime>0&&n-r.lastIngestTime>(Oe?.threshold??5e3);f&&(t.globalAlpha=Oe?.dimOpacity??.5),Bi(t,{background:Fe,hasBackgroundGraphics:!!Te,themeBackground:Te||"transparent"===Fe||Fe?"":getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),width:ot[0],height:ot[1]});const g="radial"===y;t.save(),t.beginPath(),t.rect(rt.left,rt.top,nt,it),t.clip(),g?(t.save(),t.translate(rt.left+nt/2,rt.top+it/2)):t.translate(rt.left,rt.top);const m=Xe?Jl.custom:Jl[o]||[],b={width:nt,height:it};for(const e of m)e(t,r.scene,r.scales,b);g&&t.restore(),t.restore(),f&&(t.globalAlpha=1),c&&r.scales?(_t(r.scales),$t(e=>e+1),Nt.current=n):s&&r.scales&&n-Nt.current>=33&&($t(e=>e+1),Nt.current=n),Oe?.showBadge&&Bt(!!f),(s||null!=r.activeTransition||u.pending)&&ht()},Ri({hydrated:ft,wasHydratingFromSSR:gt,storeRef:Wt,dirtyRef:Ze,renderFnRef:dt,cancelRender:pt,cleanup:()=>Yt.current?.clear()}),(0,Qa.useEffect)(()=>{Ze.current=!0,ht()},[o,nt,it,te,Fe,ht]),xr(Oe,Wt,Ze,ht,Ft,Bt);const so=zt&&Mt?me?me(Mt):(0,rc.jsx)(oc,{hover:Mt}):null,ao="radial"===y,lo=so?(0,rc.jsx)(Es,{x:Mt?ao?Mt.x+nt/2:Mt.x:0,y:Mt?ao?Mt.y+it/2:Mt.y:0,containerWidth:nt,containerHeight:it,margin:rt,className:"stream-ordinal-tooltip",children:so}):null,uo=oa(i,void 0,"__semiotic_resolvedO",""),ho=oa(s,void 0,"__semiotic_resolvedR",""),po=uo.key,fo=ho.key,go=ra(uo,ho,ve&&ve.length>0||!1);if(Si||!ft&>){const e=Wt.current;e&&n&&(e.ingest({inserts:mt,bounded:!0}),e.computeScene({width:nt,height:it}));const t=e?.scene??[],o=e?.scales??null,r=Lt(Ie,o),i=Lt(Te,o),s="radial"===y,a=s?rt.left+nt/2:rt.left,l=s?rt.top+it/2:rt.top;return(0,rc.jsxs)("div",{ref:tt,className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"img","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1]},children:[(0,rc.jsx)(fs,{summary:Ve}),(0,rc.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:ot[0],height:ot[1],style:{position:"absolute",left:0,top:0},children:[i&&(0,rc.jsx)("g",{transform:`translate(${rt.left},${rt.top})`,children:i}),(0,rc.jsxs)("g",{transform:`translate(${a},${l})`,children:[Fe&&(0,rc.jsx)("rect",{x:0,y:0,width:nt,height:it,fill:Fe}),t.map((e,t)=>function(e,t,o){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",n=o=>`ord-${e.type}-${r}-${t}-${o}`,i=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,o=wi(i)+"-grad",r=function(e,t){const o=e.fillGradient;if(!o)return null;let r=e.x,n=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(n=e.y+e.h,s=e.y):"right"===e.roundedEdge?(r=e.x+e.w,n=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(r=e.x,n=e.y,i=e.x+e.w,s=e.y);const a=[];if("colorStops"in o){const e=o.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)a.push((0,yi.jsx)("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=vi(e.style.fill);a.push((0,yi.jsx)("stop",{offset:0,stopColor:t,stopOpacity:o.topOpacity},"0")),a.push((0,yi.jsx)("stop",{offset:1,stopColor:t,stopOpacity:o.bottomOpacity},"1"))}return(0,yi.jsx)("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:n,x2:i,y2:s,children:a})}(t,o),n=r?`url(#${o})`:vi(t.style.fill);if(t.cornerRadii&&hi(t.cornerRadii)){const e=function(e){const{x:t,y:o,w:r,h:n}=e,{tl:i,tr:s,br:a,bl:l}=pi(e);let c=`M${t+i},${o}`;return c+=` L${t+r-s},${o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r},${o+s}`),c+=` L${t+r},${o+n-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r-a},${o+n}`),c+=` L${t+l},${o+n}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${o+n-l}`),c+=` L${t},${o+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${o}`),c+=" Z",c}(t);return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("path",{d:e,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:o,y:s,w:a,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${o},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o},${s+l} Z`;break;case"left":c=`M${o+a},${s} L${o+e},${s} A${e},${e} 0 0 0 ${o},${s+e} L${o},${s+l-e} A${e},${e} 0 0 0 ${o+e},${s+l} L${o+a},${s+l} Z`;break;case"bottom":c=`M${o},${s} L${o+a},${s} L${o+a},${s+l-e} A${e},${e} 0 0 1 ${o+a-e},${s+l} L${o+e},${s+l} A${e},${e} 0 0 1 ${o},${s+l-e} Z`;break;default:c=`M${o},${s+l} L${o},${s+e} A${e},${e} 0 0 1 ${o+e},${s} L${o+a-e},${s} A${e},${e} 0 0 1 ${o+a},${s+e} L${o+a},${s+l} Z`}return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("path",{d:c,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return(0,yi.jsxs)(ui.Fragment,{children:[r&&(0,yi.jsx)("defs",{children:r}),(0,yi.jsx)("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:n,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return(0,yi.jsx)("circle",{cx:t.x,cy:t.y,r:t.r,fill:vi(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return xi(e,t,o);case"glyph":return ki(e,e.x,e.y,`${o??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=wi(`${o?o+"-":""}gauge-grad-${r.category||i}-${t}`),{clipPath:n,slices:s}=mi({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return(0,yi.jsxs)("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[(0,yi.jsx)("defs",{children:(0,yi.jsx)("clipPath",{id:e,children:(0,yi.jsx)("path",{d:n})})}),(0,yi.jsx)("g",{clipPath:`url(#${e})`,children:s.map((e,t)=>(0,yi.jsx)("path",{d:e.d,fill:vi(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&(0,yi.jsx)("path",{d:n,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let n;if(r.roundedEnds)n=gi({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=(0,di.arc)().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),n=e(bi)||""}return(0,yi.jsx)("path",{d:n,transform:`translate(${r.cx},${r.cy})`,fill:vi(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},i)}case"boxplot":{const t=e,o=t.columnWidth/2;return(0,yi.jsxs)("g","vertical"===t.projection?{children:[(0,yi.jsx)("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("rect",{x:t.x-o,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.x-o,y1:t.medianPos,x2:t.x+o,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,yi.jsx)("line",{x1:t.x-.5*o,y1:t.minPos,x2:t.x+.5*o,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.x-.5*o,y1:t.maxPos,x2:t.x+.5*o,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[(0,yi.jsx)("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-o,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.medianPos,y1:t.y-o,x2:t.medianPos,y2:t.y+o,stroke:t.style.stroke||"#333",strokeWidth:2}),(0,yi.jsx)("line",{x1:t.minPos,y1:t.y-.5*o,x2:t.minPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1}),(0,yi.jsx)("line",{x1:t.maxPos,y1:t.y-.5*o,x2:t.maxPos,y2:t.y+.5*o,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,o=[(0,yi.jsx)("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:vi(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},n("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?o.push((0,yi.jsx)("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),(0,yi.jsx)("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med"))):o.push((0,yi.jsx)("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},n("iqr")),(0,yi.jsx)("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},n("med")))}return(0,yi.jsx)("g",{children:o},i)}case"connector":return(0,yi.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,o=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return(0,yi.jsx)("polygon",{points:o,fill:vi(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}(e,t,ct)).filter(Boolean)]})]}),(0,rc.jsx)(Pl,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:o,showAxes:te,showCategoryTicks:oe,oLabel:yt,rLabel:bt,oFormat:vt,rFormat:xt,rTickValues:de,tickLabelEdgeAlign:he,axisExtent:pe,showGrid:we,title:$e,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,foregroundGraphics:co(r,yo(Wt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,annotationFrame:0,xAccessor:po,yAccessor:fo,annotationData:go(e?.getData())}),Be&&"radial"===y&&(0,rc.jsx)("div",{style:{position:"absolute",left:rt.left+nt/2,top:rt.top+it/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Be})]})}return(0,rc.jsxs)("div",{ref:tt,className:"stream-ordinal-frame"+(Ne?" "+Ne:""),role:"group","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),tabIndex:0,style:{position:"relative",width:v?"100%":ot[0],height:x?"100%":ot[1],overflow:"visible"},onKeyDown:no,children:[Ye&&(0,rc.jsx)(gs,{tableId:ct}),Ye&&(0,rc.jsx)(hs,{scene:Wt.current?.scene??[],chartType:o+" chart",tableId:ct,chartTitle:"string"==typeof $e?$e:void 0}),(0,rc.jsx)(fs,{summary:Ve}),(0,rc.jsx)(ms,{hoverPoint:Mt}),(0,rc.jsxs)("div",{role:"img","aria-label":Ge||("string"==typeof $e?$e:"Ordinal chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:zt?io:void 0,onMouseLeave:zt?Jt:void 0,onClick:be?eo:void 0,children:[Tt&&(0,rc.jsx)("svg",{style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1],pointerEvents:"none"},children:(0,rc.jsx)("g",{transform:`translate(${rt.left},${rt.top})`,children:Tt})}),(0,rc.jsx)(Ml,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,showAxes:te,showGrid:we,rFormat:xt,rTickValues:de,axisExtent:pe}),(0,rc.jsx)("canvas",{ref:kt,"aria-label":Qi(Wt.current?.scene??[],o+" chart"),style:{position:"absolute",top:0,left:0,width:ot[0],height:ot[1]}}),(0,rc.jsx)(Pl,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,showAxes:te,showCategoryTicks:oe,oLabel:yt,rLabel:bt,oFormat:vt,rFormat:xt,rTickValues:de,axisExtent:pe,showGrid:we,title:$e,legend:Se,legendHoverBehavior:Ae,legendClickBehavior:Ce,legendHighlightedCategory:Me,legendIsolatedCategories:je,legendPosition:Pe,legendLayout:_e,foregroundGraphics:co(Rt,yo(Wt.current?.customLayoutOverlays,Qe??null)),annotations:ve,autoPlaceAnnotations:xe,svgAnnotationRules:ke,annotationFrame:It,xAccessor:po,yAccessor:fo,annotationData:go(Wt.current?.getData()),underlayRendered:!0}),(We||qe)&&"radial"!==y&&(0,rc.jsx)(Il,{width:nt,height:it,totalWidth:ot[0],totalHeight:ot[1],margin:rt,scales:Pt,onBrush:qe||(()=>{})}),Be&&"radial"===y&&(0,rc.jsx)("div",{style:{position:"absolute",left:rt.left+nt/2,top:rt.top+it/2,transform:"translate(-50%, -50%)",pointerEvents:"none",textAlign:"center"},children:Be}),Oe?.showBadge&&(0,rc.jsx)(wr,{isStale:Ft,position:Oe.badgePosition}),(0,rc.jsx)(vs,{active:to.current>=0,hoverPoint:Mt,margin:rt,size:ot,shape:oo.current?.shape,width:oo.current?.w,height:oo.current?.h}),lo]})]})}));ic.displayName="StreamOrdinalFrame";var sc=ic,ac=require("react"),lc={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},cc={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},uc=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e){const t=this._freeIndices.pop();if(void 0===t)return null;const o=this.particles[t];return o.active=!0,o.t=0,o.offset=Math.random()-.5,o.edgeIndex=e,o.x=0,o.y=0,o}step(e,t,o,r){for(let n=0;this.capacity>n;n++){const i=this.particles[n];if(!i.active)continue;const s=o[i.edgeIndex];s&&s.bezier?(i.t+=e*t*(r?r[i.edgeIndex]??1:1)*(s.bezier.circular?.3:1),1>i.t?dc(s.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(n))):(i.active=!1,this._freeIndices.push(n))}}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;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let o=0;e>o;o++)t.length>o?this.particles[o]=t[o]:(this.particles[o]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(o));this.capacity=e}};function dc(e,t,o,r){if(e.circular&&e.segments)return void function(e,t,o,r,n){const i=e.length,s=t*i,a=Math.min(Math.floor(s),i-1),l=s-a,[c,u,d,h]=e[a];hc(c,u,d,h,l,n);const p=h.x-c.x,f=h.y-c.y,g=Math.sqrt(p*p+f*f);if(g>.001){const e=p/g;n.x+=-f/g*o*r*2,n.y+=e*o*r*2}}(e.segments,t,o,e.halfWidth,r);if(!e.points)return r.x=0,void(r.y=0);const[n,i,s,a]=e.points;hc(n,i,s,a,t,r);const l=a.x-n.x,c=a.y-n.y,u=Math.sqrt(l*l+c*c);if(u>.001){const t=l/u;r.x+=-c/u*o*e.halfWidth*2,r.y+=t*o*e.halfWidth*2}}function hc(e,t,o,r,n,i){const s=1-n,a=s*s,l=a*s,c=n*n,u=c*n;i.x=l*e.x+3*a*n*t.x+3*s*c*o.x+u*r.x,i.y=l*e.y+3*a*n*t.y+3*s*c*o.y+u*r.y}function pc(e,t){var o=e.get(t);if(!o)throw Error("missing: "+t);return o}function fc(e,t){var o,r=[],n=[],i=[],s={},a=[];function l(e){i[e]=!1,s.hasOwnProperty(e)&&Object.keys(s[e]).forEach(function(t){delete s[e][t],i[t]&&l(t)})}function c(e){var t,r,d=!1;for(n.push(e),i[e]=!0,t=0;a[e].length>t;t++)(r=a[e][t])===o?(u(o,n),d=!0):i[r]||(d=c(r));if(d)l(e);else for(t=0;a[e].length>t;t++){var h=s[r=a[e][t]];h||(s[r]=h={}),h[r]=!0}return n.pop(),d}function u(e,o){var n=[].concat(o).concat(e);t?t(n):r.push(n)}function d(t){!function(t){for(var o=0;e.length>o;o++)o>=t&&e[o]||(e[o]=[]),e[o]=e[o].filter(function(e){return e>=t})}(t);for(var o,r=function(e){for(var t=e.length,o=Array(t),r=Array(t),n=Array(t),i=Array(t),s=Array(t),a=Array(t),l=0;t>l;++l)o[l]=-1,r[l]=0,n[l]=!1,i[l]=0,s[l]=-1,a[l]=[];var c,u=0,d=[],h=[];function p(t){var l=[t],c=[t];for(o[t]=r[t]=u,n[t]=!0,u+=1;c.length>0;){var p=e[t=c[c.length-1]];if(p.length>i[t]){for(var f=i[t];p.length>f;++f){var g=p[f];if(0>o[g]){o[g]=r[g]=u,n[g]=!0,u+=1,l.push(g),c.push(g);break}n[g]&&(r[t]=0|Math.min(r[t],r[g])),0>s[g]||a[t].push(s[g])}i[t]=f}else{if(r[t]===o[t]){var m=[],y=[],b=0;for(f=l.length-1;f>=0;--f){var v=l[f];if(n[v]=!1,m.push(v),y.push(a[v]),b+=a[v].length,s[v]=d.length,v===t){l.length=f;break}}d.push(m);var x=Array(b);for(f=0;y.length>f;f++)for(var k=0;y[f].length>k;k++)x[--b]=y[f][k];h.push(x)}c.pop()}}}for(l=0;t>l;++l)0>o[l]&&p(l);for(l=0;h.length>l;l++){var f=h[l];if(0!==f.length){f.sort(function(e,t){return e-t}),c=[f[0]];for(var g=1;f.length>g;g++)f[g]!==f[g-1]&&c.push(f[g]);h[l]=c}}return{components:d,adjacencyList:h}}(e),n=r.components.filter(function(e){return e.length>1}),i=1/0,s=0;n.length>s;s++)for(var a=0;n[s].length>a;a++)i>n[s][a]&&(i=n[s][a],o=s);var l=n[o];return!!l&&{leastVertex:i,adjList:e.map(function(e,t){return-1===l.indexOf(t)?[]:e.filter(function(e){return-1!==l.indexOf(e)})})}}o=0;for(var h=e.length;h>o;){var p=d(o);if(o=p.leastVertex,a=p.adjList){for(var f=0;a.length>f;f++)for(var g=0;a[f].length>g;g++){var m=a[f][g];i[+m]=!1,s[m]={}}c(o),o+=1}else o=h}return t?void 0:r}function gc(e){return e.y0-e.y1>0?"up":"down"}function mc(e,t){return t(e.source)==t(e.target)}function yc(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var o=0;return e.target.targetLinks.forEach(function(e){o=e.circular?o+1:o}),1>=t&&1>=o}function bc(e){return e.target.x0-e.source.x1}function vc(e,t){var o=kc(e),r=bc(t)/Math.tan(o);return"up"==gc(e)?e.y1-r:e.y1+r}function xc(e,t){var o=kc(e),r=bc(t)/Math.tan(o);return"up"==gc(e)?e.y1+r:e.y1-r}function kc(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function wc(e,t){return t(e)}function Sc(e){return Cc(e.source)}function Ac(e){return Cc(e.target)}function Cc(e){return(e.y0+e.y1)/2}function Mc(e){return e.virtual?0:e.value}function jc(e,t){var o=0;e.sourceLinks.forEach(function(e){o=e.circular&&!mc(e,t)?o+1:o});var r=0;return e.targetLinks.forEach(function(e){r=e.circular&&!mc(e,t)?r+1:r}),o+r}function Pc(e){return e.target.depth}function _c(e,t){return e.sourceLinks.length?e.depth:t-1}function Lc(e,t){return e.y0-t.y0}function Rc(e,t){return t.y0-e.y0}function Tc(e,t){return e.y1-t.y1}function Ic(e,t){return t.y1-e.y1}function $c(e,t){return Fc(e.source,t.source)||e.index-t.index}function Nc(e,t){return Fc(e.target,t.target)||e.index-t.index}function Fc(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function Bc(e,t){return Dc(e)==Dc(t)?"bottom"==e.circularLinkType?Rc(e,t):Lc(e,t):Dc(t)-Dc(e)}function Dc(e){return e.target.column-e.source.column}function Ec(e,t){return zc(e)==zc(t)}function zc(e){return e.y0-e.y1>0?"up":"down"}var Hc=require("d3-array");function Oc(e,t,o,r,n){let i=e;var s=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,s))});var a=(0,Hc.min)(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var l=i.links.filter(function(e){return e.circular});return l.sort(function(e,t){return t.value-e.value}),l.forEach(function(e,t){e._circularStub=t>=4}),Wc(i.links.filter(function(e){return"top"==e.circularLinkType}),t,o),Wc(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,o),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+r,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,mc(e,t)&&yc(e))e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+n+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-n-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var s=e.source.column,l=e.circularLinkType,c=i.links.filter(function(e){return e.source.column==s&&e.circularLinkType==l});c.sort("bottom"==e.circularLinkType?Rc:Lc);var u=0;c.forEach(function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=r+e._circularWidth/2+n*o+u),u+=t._circularWidth||t.width}),s=e.target.column,(c=i.links.filter(function(e){return e.target.column==s&&e.circularLinkType==l})).sort("bottom"==e.circularLinkType?Ic:Tc),u=0,c.forEach(function(t,n){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=r+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=r+e._circularWidth/2+n*o+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+n+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=a-n-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,o=e.y0,r=e.target.x0,n=e.y1,i=(t+r)/2;return"M"+t+","+o+"C"+i+","+o+" "+i+","+n+" "+r+","+n}(e)}),i}function Wc(e,t,o){e.sort(Bc);var r=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,n){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(mc(e,t)&&yc(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var s=0;r.length>s;s++){var a=r[s];if(a!==e&&a.circularPathData&&void 0!==a.circularPathData.verticalBuffer&&qc(e,a)){var l=a.circularPathData.verticalBuffer+(a._circularWidth||a.width)/2+o;i=l>i?l:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function qc(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}var Yc=require("d3-array");function Gc(e){return function(){return e}}function Vc(e){return e.index}function Xc(e){return e.nodes}function Uc(e){return e.links}function Kc(e,t,o){var r=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});r.forEach(function(n,i){var s=n.length;if(t)n.sort(t);else if(i>0){var a=new Map;n.forEach(function(e,t){var o,r,n,i=(r=0,n=0,(o=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;n+=Cc(e.source)*t,r+=t}}),o.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;n+=Cc(e.target)*t,r+=t}}),r>0?n/r:NaN);a.set(e,{bc:i,idx:t})}),n.sort(function(e,t){var o=a.get(e),r=a.get(t),n=o.bc,i=r.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(n)||isNaN(i)?isNaN(n)?isNaN(i)?o.idx-r.idx:1:-1:n-i})}else n.sort(function(e,t){return e.circularLinkType==t.circularLinkType?jc(t,o)-jc(e,o):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});n.forEach(function(t,n){t.depth==r.length-1&&1==s||0==t.depth&&1==s?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==jc(t,o)?(t.y0=e.y1/2+n,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+n,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-n,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/s*n,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-s/2+n,t.y1=t.y0+t.value*e.ky)})})}function Qc(e,t,o,r,n,i){var s=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var a=1,l=i;l>0;--l)c(a*=.99,o),u();function c(t,o){var r=s.length;s.forEach(function(n){var i=n.length,s=n[0].depth;n.forEach(function(n){var a;if(n.sourceLinks.length||n.targetLinks.length)if(n.partOfCycle&&jc(n,o)>0){var l=(0,Yc.mean)(n.sourceLinks,Ac),c=(0,Yc.mean)(n.targetLinks,Sc),u=l&&c?(l+c)/2:l||c;if(u){var d=(u-Cc(n))*t*.3;n.y0+=d,n.y1+=d}}else if(0==s&&1==i)n.y0=e.y1/2-(a=n.y1-n.y0)/2,n.y1=e.y1/2+a/2;else if(s==r-1&&1==i)n.y0=e.y1/2-(a=n.y1-n.y0)/2,n.y1=e.y1/2+a/2;else if(1==n.targetLinks.length&&1==n.targetLinks[0].source.sourceLinks.length)a=n.y1-n.y0,n.y0=n.targetLinks[0].source.y0,n.y1=n.y0+a;else{var h=(0,Yc.mean)(n.sourceLinks,Ac),p=(0,Yc.mean)(n.targetLinks,Sc),f=((h&&p?(h+p)/2:h||p)-Cc(n))*t;n.y0+=f,n.y1+=f}})})}function u(){s.forEach(function(o){var i,s,a,l=e.y0,c=o.length;for(o.sort(t||Fc),a=0;c>a;++a)(s=l-(i=o[a]).y0)>0&&(i.y0+=s,i.y1+=s),l=i.y1+r;if((s=l-r-e.y1)>0)for(l=i.y0-=s,i.y1-=s,a=c-2;a>=0;--a)(s=(i=o[a]).y1+n-l)>0&&(i.y0-=s,i.y1-=s),l=i.y0})}}function Zc(e){e.nodes.forEach(function(e){e.sourceLinks.sort(Nc),e.targetLinks.sort($c)}),e.nodes.forEach(function(e){var t=e.y0,o=t,r=e.y1,n=r;e.sourceLinks.forEach(function(e){e.circular?(e.y0=r-e.width/2,r-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=n-e.width/2,n-=e.width):(e.y1=o+e.width/2,o+=e.width)})})}function Jc(){var e=0,t=0,o=1,r=1,n=24,i=8,s=null,a=Vc,l=_c,c=void 0,u=32,d=2,h=Xc,p=Uc;function f(){var f={nodes:h.apply(null,arguments),links:p.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=o,h.y1=r,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var o=function(e,t){var o=new Map;return(0,Yc.group)(e,t).forEach(function(e,t){o.set(t,e[0])}),o}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var r=e.source,n=e.target;"object"!=typeof r&&(r=e.source=pc(o,r)),"object"!=typeof n&&(n=e.target=pc(o,n)),r.sourceLinks.push(e),n.targetLinks.push(e)})}(h,a),function(e,t){var o=0;if(null==t){for(var r=[],n=0;e.links.length>n;n++){var i=e.links[n],s=i.source.index,a=i.target.index;r[s]||(r[s]=[]),r[a]||(r[a]=[]),-1===r[s].indexOf(a)&&r[s].push(a)}var l=fc(r);l.sort(function(e,t){return e.length-t.length});var c={};for(n=0;l.length>n;n++){var u=l[n].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,r=e.source.index;t===r||c[r]&&c[r][t]?(e.circular=!0,e.circularLinkID=o++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=o++)})}(h,c),function(e,t){var o=0,r=0;e.links.forEach(function(n){n.circular&&(n.circularLinkType=n.source.circularLinkType||n.target.circularLinkType?n.source.circularLinkType?n.source.circularLinkType:n.target.circularLinkType:r>o?"top":"bottom","top"==n.circularLinkType?o++:r++,e.nodes.forEach(function(e){wc(e,t)!=wc(n.source,t)&&wc(e,t)!=wc(n.target,t)||(e.circularLinkType=n.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),mc(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,a),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max((0,Yc.sum)(e.sourceLinks,Mc),(0,Yc.sum)(e.targetLinks,Mc)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,o){var r,n,i;if(null!=t){e.nodes.sort(function(e,o){return t(e)<t(o)?-1:1});var s=0,a=t(e.nodes[0]);e.nodes.forEach(function(e){s=t(e)==a?s:s+1,a=t(e)==a?a:t(e),e.column=s})}for(r=e.nodes,n=[],i=0;r.length;++i,r=n,n=[])r.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>n.indexOf(e.target)&&!e.circular&&n.push(e.target)})});for(r=e.nodes,n=[],i=0;r.length;++i,r=n,n=[])r.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>n.indexOf(e.source)&&!e.circular&&n.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?o(e,i):e.column})}(h,c,l);var p=i;if(null!==s){var f=(0,Yc.groups)(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),g=(0,Yc.max)(f,function(e){return e.length});g>1&&(p=Math.max(1,(r-t)*s/(g-1)))}(function(e,t,o){var r=(0,Yc.groups)(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var n=(0,Yc.min)(r,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/(0,Yc.sum)(t,function(e){return e.value})});e.ky=n,e.links.forEach(function(t){t.width=t.value*e.ky});var i=(0,Yc.max)(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-o)/i),t.x1=t.x0+o}:function(t){t.x0=e.x0,t.x1=t.x0+o})})(h,p,n),Kc(h,c,a),Qc(h,c,a,p,p,u),Zc(h),Oc(h,a,d,10,8),Kc(h,c,a),Qc(h,c,a,p,p,u),Zc(h),Oc(h,a,d,10,8),function(e,t){let o=e;o.nodes.forEach(function(e){e.y+(e.y1-e.y0)>o.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-o.y1));var r=o.links.filter(function(o){return wc(o.source,t)==wc(e,t)}),n=r.length;n>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!Ec(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var o=vc(t,e);return e.y1-o}if(t.target.column>e.target.column)return vc(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;r.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),r.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;n>i;i++)s+=r[i].width;t.y0=e.y1-s-t.width/2}})})}(h,a),function(e,t){let o=e;o.nodes.forEach(function(e){var r=o.links.filter(function(o){return wc(o.target,t)==wc(e,t)}),n=r.length;n>1&&r.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!Ec(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var o=xc(t,e);return e.y0-o}if(t.source.column>e.source.column)return xc(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;r.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),r.forEach(function(t,o){if("bottom"==t.circularLinkType){for(var i=o+1,s=0;n>i;i++)s+=r[i].width;t.y1=e.y1-s-t.width/2}})})}(h,a),function(e){var t=e.nodes,o=e.links,r=!1,n=!1;if(o.forEach(function(e){"top"==e.circularLinkType?r=!0:"bottom"==e.circularLinkType&&(n=!0)}),0==r||0==n){let r=function(t){return(t-i)/(s-i)*(e.y1-e.y0)+e.y0};var i=(0,Yc.min)(t,function(e){return e.y0}),s=(0,Yc.max)(t,function(e){return e.y1}),a=(e.y1-e.y0)/(s-i);1>a?(t.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1)}),o.forEach(function(e){e.y0=r(e.y0),e.y1=r(e.y1),e.width=e.width*a})):t.forEach(function(e){var t=e.y1-e.y0,o=r(e.y0)-e.y0;e.y0=r(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+o}),e.targetLinks.forEach(function(e){e.y1=e.y1+o})})}}(h),Oc(h,a,d,10,8)}(f),f}return f.update=function(e){return Zc(e),Oc(e,a,d,10,8),e},f.nodeWidth=function(e){return arguments.length?(n=+e,f):n},f.nodePadding=function(e){return arguments.length?(i=+e,f):i},f.nodePaddingRatio=function(e){return arguments.length?(s=+e,f):s},f.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Gc(e),f):h},f.links=function(e){return arguments.length?(p="function"==typeof e?e:Gc(e),f):p},f.nodeId=function(e){return arguments.length?(a="function"==typeof e?e:Gc(e),f):a},f.nodeAlign=function(e){return arguments.length?(l="function"==typeof e?e:Gc(e),f):l},f.nodeSort=function(e){return arguments.length?(c=e,f):c},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.circularLinkGap=function(e){return arguments.length?(d=+e,f):d},f.extent=function(n){return arguments.length?(e=+n[0][0],t=+n[0][1],o=+n[1][0],r=+n[1][1],f):[[e,t],[o,r]]},f.size=function(n){return arguments.length?(e=t=0,o=+n[0],r=+n[1],f):[o-e,r-t]},f}var eu=require("d3-interpolate");function tu(e){const{sx:t,sTop:o,sBot:r,tx:n,tTop:i,tBot:s,cp1X:a,cp2X:l}=e,c=(o+r)/2,u=(i+s)/2;return{pathD:[`M${t},${o}`,`C${a},${o} ${l},${i} ${n},${i}`,`L${n},${s}`,`C${l},${s} ${a},${r} ${t},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:c},{x:a,y:c},{x:l,y:u},{x:n,y:u}],halfWidth:(r-o)/2}}}require("d3-shape");var ou=e=>{let t,o,r,n,i,s,a,l,c;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,o=e.y1-e.sankeyWidth/2,r=e.y1+e.sankeyWidth/2,n=e.y0+e.sankeyWidth/2,i=e.source.x1,s=e.target.x0,a=(0,eu.interpolateNumber)(i,s),l=a(.5),c=a(.5),`M${t},${i}C${t},${l} ${o},${c} ${o},${s}L${r},${s}C${r},${c} ${n},${l} ${n},${i}Z`;const u=e.sankeyWidth/2,d=(0,eu.interpolateNumber)(e.source.x1,e.target.x0),{pathD:h}=tu({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function ru(e){const t=e.sankeyWidth/2,o=(e._circularWidth??e.sankeyWidth)/2,r=e.circularPathData;if(!r)return null;if("down"===e.direction)return null;if(e._circularStub){const o=r.sourceX,n=r.sourceY,i=r.targetX,s=r.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const a=Math.max(15,Math.min(40,.33*(r.rightFullExtent-o))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${o},${n-t}L${o+a},${n-t}L${o+a},${n+t}L${o},${n+t}ZM${i},${s-t}L${i-l},${s-t}L${i-l},${s+t}L${i},${s+t}Z`}const n=r.sourceX,i=r.sourceY,s=r.targetX,a=r.targetY,l=r.rightFullExtent,c=r.leftFullExtent,u=r.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(o,15));return`M${n},${i-d*t}L${l},${i-d*t}L${l+o},${i-d*t+d*h}L${l+o},${u+d*o-d*h}L${l+o-h},${u+d*o}L${c-o+h},${u+d*o}L${c-o},${u+d*o-d*h}L${c-o},${a-d*t+d*h}L${c-o+h},${a-d*t}L${s},${a-d*t}L${s},${a+d*t}L${c+o},${a+d*t}L${c+o},${u-d*o}L${l-o},${u-d*o}L${l-o},${i+d*t}L${n},${i+d*t}Z`}var nu=new Set,iu=new WeakMap;function su(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let o=iu.get(e);if(o){const e=o.get(t);if(e)return e}else o=new Map,iu.set(e,o);const r=new Proxy(e,{get(e,o,r){if("string"==typeof o&&!(o in e)&&e.data&&o in e.data){const e=`${t}:${o}`;nu.has(e)||(nu.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,o,r)}});return o.set(t,r),r}var au={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(Pc))-1:0},justify:_c};function lu(e){return"string"==typeof e?e:e.id}var cu={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const n="vertical"===o.orientation?"down":"right",i=o.nodeAlign||"justify",s=o.nodeWidth??15,a=o.nodePaddingRatio??.05,l=o.iterations??100,c=e.map(e=>({...e})),u=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id,value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===n?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const h=Jc().extent(d).links(u).nodes(c).nodeAlign(au[i]||_c).nodeId(e=>e.id).nodeWidth(s).iterations(l);h.nodePaddingRatio&&h.nodePaddingRatio(a),h();{let e=1/0,t=-1/0,o=1/0,n=-1/0;for(const r of c)e>r.x0&&(e=r.x0),r.x1>t&&(t=r.x1),o>r.y0&&(o=r.y0),r.y1>n&&(n=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const i=r.circularPathData,s=(r._circularWidth??r.width??0)/2;e>i.leftFullExtent-s&&(e=i.leftFullExtent-s),i.rightFullExtent+s>t&&(t=i.rightFullExtent+s),o>i.verticalFullExtent-s&&(o=i.verticalFullExtent-s),i.verticalFullExtent+s>n&&(n=i.verticalFullExtent+s)}const i=t-e,s=n-o,a=r[0],l=r[1];if(i>0&&s>0&&(0>e||0>o||t>a||n>l)){const t=Math.min(a/i,l/s),r=-e*t+(a-i*t)/2,n=-o*t+(l-s*t)/2;for(const e of c)e.x0=e.x0*t+r,e.x1=e.x1*t+r,e.y0=e.y0*t+n,e.y1=e.y1*t+n;for(const e of u)if(e.y0=e.y0*t+n,e.y1=e.y1*t+n,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const o=e.circularPathData;o.sourceX=o.sourceX*t+r,o.targetX=o.targetX*t+r,o.sourceY=o.sourceY*t+n,o.targetY=o.targetY*t+n,o.rightFullExtent=o.rightFullExtent*t+r,o.leftFullExtent=o.leftFullExtent*t+r,o.verticalFullExtent=o.verticalFullExtent*t+n,o.rightInnerExtent=o.rightInnerExtent*t+r,o.leftInnerExtent=o.leftInnerExtent*t+r,o.verticalRightInnerExtent=o.verticalRightInnerExtent*t+n,o.verticalLeftInnerExtent=o.verticalLeftInnerExtent*t+n,o.rightSmallArcRadius*=t,o.rightLargeArcRadius*=t,o.leftSmallArcRadius*=t,o.leftLargeArcRadius*=t,o.sourceWidth*=t,o.rightNodeBuffer*=t,o.leftNodeBuffer*=t,o.arcRadius*=t}}}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of c){const t=p.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const f=new Map;for(const e of t)f.set(e._edgeKey?e._edgeKey:`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const e of u){const t=lu(e.source),o=lu(e.target),r=f.get(e._edgeKey?e._edgeKey:`${t}\0${o}`);if(r){r.y0=e.y0,r.y1=e.y1,r.sankeyWidth=e.width??0,r.circular=!!e.circular,r.circularPathData=e.circularPathData,r._circularWidth=e._circularWidth,r._circularStub=e._circularStub,r.path=e.path,r.circularLinkType=e.circularLinkType,r.direction=n;const i=p.get(t),s=p.get(o);i&&(r.source=i),s&&(r.target=s)}}},buildScene(e,t,o,r){const n="vertical"===o.orientation?"down":"right",i=o.nodeStyle,s=o.edgeStyle,a=o.edgeOpacity??.5,l=o.edgeColorBy||"source",c=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:ge,u=new Map;e.forEach((e,t)=>{u.set(e.id,c[t%c.length])});const d=[],h=[],p=[],f=new Map;for(const t of e){const e=t.x1-t.x0,o=t.y1-t.y0;if(0>=e||0>=o)continue;const r=i?i(su(t,"nodeStyle")):{},s={fill:r.fill||u.get(t.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};f.set(t.id,("string"==typeof s.fill?s.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===n?{type:"rect",x:t.y0,y:t.x0,w:o,h:e,style:s,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:o,style:s,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,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";n="function"==typeof l?l(e)||n:"target"===l?f.get(r.id)||u.get(r.id)||n:f.get(t.id)||u.get(t.id)||n;const i=s?s(su(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,o=e.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),s=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),l=i.fill||n;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-o}L${t.sourceX+r},${t.sourceY-o}L${t.sourceX+r},${t.sourceY+o}L${t.sourceX},${t.sourceY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+r}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-o}L${t.targetX-s},${t.targetY-o}L${t.targetX-s},${t.targetY+o}L${t.targetX},${t.targetY+o}Z`,style:{fill:l,fillOpacity:i.fillOpacity??a,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-s,x1:t.targetX}});continue}let c;(c=e.circular&&e.circularPathData?ru(e):ou(e),c)&&h.push({type:"bezier",pathD:c,bezierCache:e.bezier,style:{fill:i.fill||n,fillOpacity:i.fillOpacity??a,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==o.showLabels){const t=(m=o.nodeLabel)?"function"==typeof m?m:e=>e[m]||e.id:null;for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=t?t(o):o.id;if(!s)continue;let a,l,c;"down"===n?(a=o.y0+(o.y1-o.y0)/2,l=o.x1+14,c="start"):(r[0]/2>o.x0+e/2?(a=o.x0-6,c="end"):(a=o.x1+6,c="start"),l=o.y0+i/2),p.push({x:a,y:l,text:s+"",anchor:"down"===n?"middle":c,baseline:"middle",fontSize:11})}}var m;return{sceneNodes:d,sceneEdges:h,labels:p}}},uu=require("d3-force"),du=require("d3-scale");h();var hu={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const n=o.forceStrength??.1,i=r[0]/2,s=r[1]/2,a=o.__previousPositions;let l=0;const c=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=a?.get(t.id);e?l++:o?(t.x=o.x,t.y=o.y,l++):c.push(t)}const u=l>0&&.3>=(e.length>0?c.length/e.length:1);if(u){const o=new Map;for(const t of e)o.set(t.id,t);for(const e of c){const r=pu(e.id,t,o);if(r.length>0){let t=0,o=0;for(const e of r)t+=e.x,o+=e.y;const n=fu(e.id),i=n%360*(Math.PI/180),s=10+n%20;e.x=t/r.length+s*Math.cos(i),e.y=o/r.length+s*Math.sin(i)}else{const t=fu(e.id),o=t%360*(Math.PI/180),r=15+t%30;e.x=i+r*Math.cos(o),e.y=s+r*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const r=e[o];if(null==r.x||null==r.y||0===r.x&&0===r.y){const e=10*Math.sqrt(o+.5),n=o*t;r.x=i+e*Math.cos(n),r.y=s+e*Math.sin(n)}}}const d=o.__skipForceSimulation||0===o.iterations?0:u?40:o.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),h=gu(o.nodeSize,o.nodeSizeRange,e),p=e=>h(e);if(d>0){const o=new Map,r=new Map;for(const t of e)o.set(t.id,0),r.set(t.id,t);for(const e of t){const t="string"==typeof e.source?e.source:e.source.id,r="string"==typeof e.target?e.target:e.target.id;o.set(t,(o.get(t)??0)+1),o.set(r,(o.get(r)??0)+1)}const a=(0,uu.forceLink)().strength(e=>{const t=e.weight,r="string"==typeof e.target?e.target:e.target.id,i=Math.max(1,Math.min(o.get("string"==typeof e.source?e.source:e.source.id)??1,o.get(r)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*n/(.1*i))}).distance(e=>{const t="string"==typeof e.source?r.get(e.source):e.source,o="string"==typeof e.target?r.get(e.target):e.target,n=(t?p(t):0)+(o?p(o):0)+12;return Math.max(40,n)}).id(e=>e.id),l=(0,uu.forceSimulation)().force("charge",(0,uu.forceManyBody)().strength(e=>{const t=o.get(e.id)??0;return-15*p(e)*Math.sqrt(t+1)})).force("collide",(0,uu.forceCollide)(e=>p(e)+3).strength(.9).iterations(2)).force("center",(0,uu.forceCenter)(i,s).strength(.8)).force("x",(0,uu.forceX)(i).strength(.06)).force("y",(0,uu.forceY)(s).strength(.06));if(l.nodes(e),t.length>0){const e=t.map(e=>({...e,source:"string"==typeof e.source?e.source:e.source.id,target:"string"==typeof e.target?e.target:e.target.id}));a.links(e),l.force("link",a)}u?l.alpha(.3):.1>l.alpha()&&l.alpha(1),l.stop();for(let e=0;d>e;++e)l.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=p(t);t.x=Math.max(e,Math.min(r[0]-e,t.x)),t.y=Math.max(e,Math.min(r[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=f.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=f.get(e.target);t&&(e.target=t)}}},buildScene(e,t,o,r){const n=o.nodeStyle,i=o.edgeStyle,s=gu(o.nodeSize,o.nodeSizeRange,e),a=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:ge,l=new Map;e.forEach((e,t)=>{l.set(e.id,a[t%a.length])});const c=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=s(su(t,"nodeSize")),r=n?n(su(t,"nodeStyle")):{},i={fill:r.fill||l.get(t.id)||o.themeSemantic?.primary||"#007bff",stroke:r.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??2,opacity:r.opacity};c.push({type:"circle",cx:t.x,cy:t.y,r:e,style:i,datum:t,id:t.id,label:t.id})}const h=new Map;for(const t of e)h.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:h.get(e.source),r="object"==typeof e.target?e.target:h.get(e.target);if(!t||!r)continue;if(null==t.x||null==t.y)continue;if(null==r.x||null==r.y)continue;const n=i?i(su(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:n.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:n.strokeWidth??1,opacity:n.opacity??.6},datum:e})}if(!1!==o.showLabels){const t=(p=o.nodeLabel)?"function"==typeof p?p:e=>e[p]||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 r=s(su(o,"nodeSize"));d.push({x:o.x,y:o.y-r-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}var p;return{sceneNodes:c,sceneEdges:u,labels:d}}};function pu(e,t,o){const r=[];for(const n of t){const t="string"==typeof n.source?n.source:n.source.id,i="string"==typeof n.target?n.target:n.target.id;let s=null;if(t===e?s=i:i===e&&(s=t),s){const e=o.get(s);!e||0===e.x&&0===e.y||r.push({x:e.x,y:e.y})}}return r}function fu(e){let t=0;for(let o=0;e.length>o;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return Math.abs(t)}function gu(e,t,o){if(o.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const r=t||[5,20],n=[];for(const t of o){const o=t.data?.[e];"number"==typeof o&&n.push(o)}if(0===n.length)return()=>r[0];const[i,s]=u(n);if(i===s)return()=>(r[0]+r[1])/2;const a=(0,du.scaleLinear)().domain([i,s]).range(r).clamp(!0);return t=>{const o=t.data?.[e];return null==o||"number"!=typeof o?r[0]:a(o)}}var mu=require("d3-chord"),yu=require("d3-shape"),bu=ge,vu={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,o,r){if(0===e.length)return;const{padAngle:n=.01,groupWidth:i=20,sortGroups:s}=o,a=Math.min(r[0],r[1])/2,l=a-i,c=r[0]/2,u=r[1]/2,d=(h=o.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const p=new Map;for(let t=0;e.length>t;t++)p.set(e[t].id,t);const f=e.length,g=Array.from({length:f},()=>Array.from({length:f},()=>0));for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=p.get("string"==typeof e.source?e.source:e.source.id),r=p.get(t);if(void 0===o||void 0===r)continue;const n=d(e);g[o][r]=n}const m=(0,mu.chord)().padAngle(n);s&&m.sortGroups(s);const y=m(g),b=y.groups,v=(0,yu.arc)().innerRadius(l).outerRadius(a);for(const t of b){const o=e[t.index],r=v.centroid({innerRadius:l,outerRadius:a,startAngle:t.startAngle,endAngle:t.endAngle});o.x=r[0]+c,o.y=r[1]+u,o.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const x=new Map;for(const t of e)x.set(t.id,t);for(const e of t){const t="string"==typeof e.target?e.target:e.target.id,o=x.get("string"==typeof e.source?e.source:e.source.id),r=x.get(t);o&&(e.source=o),r&&(e.target=r)}const k=new Map;for(const e of t)k.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,e);for(const t of y){const o=e[t.source.index].id,r=e[t.target.index].id,n=k.get(`${o}\0${r}`)||k.get(`${r}\0${o}`);n&&(n.__chordData=t)}},buildScene(e,t,o,r){const{groupWidth:n=20,edgeOpacity:i=.5}=o,s=Math.min(r[0],r[1])/2,a=s-n,l=r[0]/2,c=r[1]/2,u=o.nodeStyle,d=o.edgeStyle,h=o.edgeColorBy||"source",p=Array.isArray(o.colorScheme)?o.colorScheme:o.themeCategorical&&o.themeCategorical.length>0?o.themeCategorical:bu,f=new Map;e.forEach((e,t)=>{f.set(e.id,p[t%p.length])});const g=(0,mu.ribbon)().radius(a),m=[],y=[],b=[];for(let t=0;e.length>t;t++){const o=e[t],r=o.__arcData;if(!r)continue;let n;n=u?u(su(o,"nodeStyle")).fill||f.get(o.id)||p[t%p.length]:f.get(o.id)||p[t%p.length];const i=u?u(su(o,"nodeStyle")):{};m.push({type:"arc",cx:l,cy:c,innerR:a,outerR:s,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:n,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:o,id:o.id,label:o.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const r=g(t);if(!r)continue;const n=xu(r,l,c);let s=o.themeSemantic?.border||o.themeSemantic?.secondary||"#999";if(d)s=d(su(e,"edgeStyle")).fill||s;else{const t="object"==typeof e.source?e.source:null,o="object"==typeof e.target?e.target:null;"target"===h&&o?s=f.get(o.id)||s:t&&(s=f.get(t.id)||s)}const a=d?d(su(e,"edgeStyle")):{};y.push({type:"ribbon",pathD:n,style:{fill:s,fillOpacity:a.fillOpacity??i,stroke:a.stroke||"none",strokeWidth:a.strokeWidth,opacity:a.opacity},datum:e})}if(!1!==o.showLabels){const t=(v=o.nodeLabel)?"function"==typeof v?v:e=>e[v]||e.id:null,r=s+12;for(const o of e){const e=o.__arcData;if(!e)continue;const n=t?t(o):o.id;if(!n)continue;const i=(e.startAngle+e.endAngle)/2,s=i-Math.PI/2;b.push({x:l+Math.cos(s)*r,y:c+Math.sin(s)*r,text:n+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var v;return{sceneNodes:m,sceneEdges:y,labels:b}}};function xu(e,t,o){const r=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return e;const n=[];let i=0;for(;r.length>i;){const e=r[i];if("M"===e||"L"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("C"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;3>e&&r.length>i&&!isNaN(Number(r[i]));e++)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("Q"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)for(let e=0;2>e&&r.length>i&&!isNaN(Number(r[i]));e++)n.push(Number(r[i])+t+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(n.push(Number(r[i])+o+""),i++);else if("A"===e)for(n.push(e),i++;r.length>i&&!isNaN(Number(r[i]));)n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&n.push(r[i++]),r.length>i&&(n.push(Number(r[i])+t+""),i++),r.length>i&&(n.push(Number(r[i])+o+""),i++);else"Z"===e||"z"===e?(n.push(e),i++):(n.push(r[i]),i++)}return n.join(" ")}var ku=require("d3-hierarchy"),wu=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Su(e){const[t,o,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*o+.114*r>150?"#222":"#fff"}function Au(e,t,o){const r=t.nodeIDAccessor;return"function"==typeof r?r(e.data)+"":"string"==typeof r&&void 0!==e.data[r]?e.data[r]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+o}function Cu(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function Mu(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:wu}function ju(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Pu(e,t,o,r,n){if("horizontal"===n){const n=(e+o)/2;return`M ${e},${t} C ${n},${t} ${n},${r} ${o},${r}`}if("radial"===n){const n=(e+o)/2;return`M ${e},${t} Q ${n},${t} ${n},${(t+r)/2} T ${o},${r}`}{const n=(t+r)/2;return`M ${e},${t} C ${e},${n} ${o},${n} ${o},${r}`}}var _u={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,o,r){const n=o.__hierarchyRoot;if(!n)return;const i=o.chartType,s=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(o.childrenAccessor),a=o.hierarchySum,l="function"==typeof a?a:"string"==typeof a?e=>Number(e[a])||0:e=>Number(e.value)||0,c=(0,ku.hierarchy)(n,s);c.sum(l),c.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=r;switch(i){case"tree":!function(e,t,o,r){const n=t.treeOrientation||"vertical",i=(0,ku.tree)();i.size("horizontal"===n?[r,o]:"radial"===n?[2*Math.PI,Math.min(o,r)/2*.8]:[o,r]),i(e)}(c,o,u,d);break;case"cluster":!function(e,t,o,r){const n=t.treeOrientation||"vertical",i=(0,ku.cluster)();i.size("horizontal"===n?[r,o]:"radial"===n?[2*Math.PI,Math.min(o,r)/2*.8]:[o,r]),i(e)}(c,o,u,d);break;case"treemap":!function(e,t,o,r){const n=t.padding??4,i=t.paddingTop??0,s=(0,ku.treemap)().size([o,r]).tile(ku.treemapBinary).padding(n);i>0&&s.paddingTop(i),s(e)}(c,o,u,d);break;case"circlepack":!function(e,t,o,r){const n=t.padding??4;(0,ku.pack)().size([o,r]).padding(n)(e)}(c,o,u,d);break;case"partition":!function(e,t,o,r){(0,ku.partition)().size([o,r]).padding(t.padding??1)(e)}(c,o,u,d)}const h=c.descendants();e.length=0,t.length=0;const p=new Map;for(let t=0;h.length>t;t++){const r=h[t],n={id:Au(r,o,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:r.value??0,depth:r.depth,data:r.data,createdByFrame:!0};"tree"===i||"cluster"===i?Lu(n,r,o):"treemap"===i||"partition"===i?Ru(n,r):"circlepack"===i&&Tu(n,r),n.__hierarchyNode=r,e.push(n),p.set(r,n)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const o=p.get(e.parent),r=p.get(e);o&&r&&t.push({source:o,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,o,r){const n=o.nodeStyle||(()=>({})),i=o.edgeStyle||(()=>({}));switch(o.chartType){case"tree":case"cluster":return function(e,t,o,r,n,i){const s=[],a=[],l=[],c=o.treeOrientation||"vertical",u="radial"===c,d=r[0]/2,h=r[1]/2,p="number"==typeof(f=o.nodeSize)?f:5;var f;for(const t of e){let e=t.x,r=t.y;u&&(e+=d,r+=h);const i=n(su(t,"nodeStyle"));let a=i.fill||ju(o);if(o.colorByDepth&&void 0!==t.depth){const e=Mu(o);a=e[t.depth%e.length]}s.push({type:"circle",cx:e,cy:r,r:p,style:{fill:a,stroke:i.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const g=o.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;if(!t||!r)continue;let n=t.x,s=t.y,l=r.x,p=r.y;u&&(n+=d,s+=h,l+=d,p+=h);const f=Pu(n,s,l,p,c),m=i(su(e,"edgeStyle"));a.push({type:"curved",pathD:f,style:{fill:"none",stroke:m.stroke||o.themeSemantic?.border||o.themeSemantic?.secondary||"#999",strokeWidth:m.strokeWidth??1.5,opacity:m.opacity??g},datum:e})}if(!1!==o.showLabels){const t=Cu(o.nodeLabel);for(const o of e){const e=t?t(o):o.id;if(!e)continue;let r,n,i,s=o.x,a=o.y;if(u&&(s+=d,a+=h),u){const e=s-d,t=a-h,o=Math.sqrt(e*e+t*t);o>0?(r=s+e/o*10,n=a+t/o*10,i=0>e?"end":"start"):(r=s,n=a-12,i="middle")}else"horizontal"===c?(o.data?.children&&0!==o.data.children.length?(r=s-p-6,i="end"):(r=s+p+6,i="start"),n=a):(r=s,n=a+p+14,i="middle");l.push({x:r,y:n,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:s,sceneEdges:a,labels:l}}(e,t,o,r,n,i);case"treemap":case"partition":return function(e,t,o,r){const n=[],i=[];for(const o of e){const e=o.x1-o.x0,i=o.y1-o.y0;if(0>=e||0>=i)continue;const s=r(su(o,"nodeStyle"));let a=s.fill||ju(t);if(t.colorByDepth&&void 0!==o.depth){const e=Mu(t);a=e[o.depth%e.length]}n.push({type:"rect",x:o.x0,y:o.y0,w:e,h:i,style:{fill:a,stroke:s.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:s.strokeWidth??1,opacity:s.opacity},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Cu(t.nodeLabel),n=t.labelMode||"leaf",s="partition"===t.chartType;for(const a of e){const e=a.x1-a.x0,l=a.y1-a.y0;if(0>=e||0>=l)continue;const c=!(a.data?.children&&a.data.children.length>0);if(!s){if("leaf"===n&&!c)continue;if("parent"===n&&c)continue}const u=o?o(a):a.id;if(!u)continue;if((c?30:40)>e||(c?16:14)>l)continue;let d=r(su(a,"nodeStyle")).fill||ju(t);if(t.colorByDepth&&void 0!==a.depth){const e=Mu(t);d=e[a.depth%e.length]}const h="string"==typeof d?Su(d):t.themeSemantic?.text??"#000";i.push(c?{x:a.x0+e/2,y:a.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,l)/6)),fill:h}:{x:a.x0+4,y:a.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:n,sceneEdges:[],labels:i}}(e,o,0,n);case"circlepack":return function(e,t,o,r){const n=[],i=[];for(const o of e){const e=o.__radius??5;if(0>=e)continue;const i=r(su(o,"nodeStyle"));let s=i.fill||ju(t);if(t.colorByDepth&&void 0!==o.depth){const e=Mu(t);s=e[o.depth%e.length]}n.push({type:"circle",cx:o.x,cy:o.y,r:e,style:{fill:s,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:o,id:o.id,label:o.id,depth:o.depth})}if(!1!==t.showLabels){const o=Cu(t.nodeLabel);for(const n of e){const e=n.__radius??5,s=o?o(n):n.id;if(!s)continue;if(15>e)continue;const a=!(n.data?.children&&n.data.children.length>0);let l=r(su(n,"nodeStyle")).fill||ju(t);if(t.colorByDepth&&void 0!==n.depth){const e=Mu(t);l=e[n.depth%e.length]}if(a){const o="string"==typeof l?Su(l):t.themeSemantic?.text??"#000";i.push({x:n.x,y:n.y,text:s+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:o})}else i.push({x:n.x,y:n.y-e+14,text:s+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:n,sceneEdges:[],labels:i}}(e,o,0,n);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Lu(e,t,o){const r=o.treeOrientation||"vertical";if("radial"===r){const o=t.x,r=t.y;e.x=r*Math.cos(o-Math.PI/2),e.y=r*Math.sin(o-Math.PI/2)}else"horizontal"===r?(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 Ru(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 Tu(e,t){const o=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-o,e.x1=t.x+o,e.y0=t.y-o,e.y1=t.y+o,e.width=2*o,e.height=2*o,e.__radius=o}var Iu=require("d3-shape");function $u(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var Nu={sankey:cu,force:hu,chord:vu,tree:_u,cluster:_u,treemap:_u,circlepack:_u,partition:_u,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,o,r){const n=o.__hierarchyRoot;n&&function(e,t,o,r,n){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(o.childrenAccessor),s=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(o.nodeIDAccessor),a=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(o.orbitMode),l=o.orbitSize??2.95,c=o.orbitEccentricity??1,u="number"==typeof l?()=>l:l,d="number"==typeof c?()=>c:c,h=$u(o);h.metaMap.clear(),r.length=0,n.length=0;const p=new Map;function f(e){const t=p.get(e)??0;return p.set(e,t+1),0===t?e:`${e}__${t}`}const g=t[0]/2,m=t[1]/2,y=Math.min(t[0],t[1])/2*.85,b=f(s(e));r.push({id:b,x:g,y:m,x0:g,x1:g,y0:m,y1:m,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(b,{ring:y,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,o,l,c,p,g,m){const y=i(t);if(!y?.length)return;const b=y.length;let v=0,x=0,k=0;for(;b>x;)x+=a[Math.min(k,a.length-1)],k++,v++;let w=0;for(let b=0;v>b;b++){const x=a[Math.min(b,a.length-1)],k=y.slice(w,w+x);if(!k.length)break;const S=(b+1)/v,A={id:o,depth:g,data:t,parentId:o},C=m?p/u(A)*S:p*S,M=(0,Iu.pie)().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(k),j=d(A);for(let t=0;k.length>t;t++){const i=(M[t].startAngle+M[t].endAngle)/2,a=k[t],u=f(s(a)),d=l+C*Math.sin(i),p=c+C*Math.cos(i)*j;r.push({id:u,x:d,y:p,x0:d,x1:d,y0:p,y1:p,width:0,height:0,value:0,depth:g,data:a}),h.metaMap.set(u,{ring:C,angle:i,depth:g,parentId:o,eccentricity:j}),n.push({source:o,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:o,target:u}}),e(a,u,d,p,C,g+1,!0)}w+=x}}(e,b,g,m,y,1,!1)}(n,r,o,e,t)},buildScene(e,t,o,r){const n=o.nodeStyle,i=o.nodeSize,s="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,a=[],l=[],c=[];if(!1!==o.orbitShowRings){const t=$u(o),r=new Map;for(const t of e)r.set(t.id,t);const n=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=r.get(e.parentId);if(!t)continue;const o=`${e.parentId}:${e.ring}`;n.has(o)||n.set(o,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,s={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:o,ecc:r}]of n)for(let n=0;i>n;n++){const a=n/i*Math.PI*2,c=(n+1)/i*Math.PI*2;l.push({type:"line",x1:e+o*Math.sin(a),y1:t+o*Math.cos(a)*r,x2:e+o*Math.sin(c),y2:t+o*Math.cos(c)*r,style:s,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=s(su(t,"nodeSize")),r=n?n(su(t,"nodeStyle")):{};a.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:r.fill||o.themeSemantic?.primary||"#6366f1",stroke:r.stroke||o.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),o="object"==typeof e.target?e.target:u.get(e.target);t&&o&&(null!=t.x&&null!=o.x&&l.push({type:"line",x1:t.x,y1:t.y,x2:o.x,y2:o.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(o.showLabels){const t=o.nodeLabel;for(const o of e){const e=s(su(o,"nodeSize"));if(4>=e)continue;const r="function"==typeof t?t(o):t?o.data?.[t]??o.id:o.id;c.push({x:o.x,y:o.y+e+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:a,sceneEdges:l,labels:c}},tick:(e,t,o,r,n)=>!1!==o.orbitAnimated&&(function(e,t){const o=$u(t),r=t.orbitSpeed??.25,n=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-o.startTime)/1e3,s=r*(Math.PI/6),a=new Map;for(const t of e)a.set(t.id,t);for(const t of e){const e=o.metaMap.get(t.id);if(!e||!e.parentId)continue;const r=a.get(e.parentId);if(!r)continue;const l=e.angle+i*s*n({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=r.x+e.ring*Math.sin(l),t.y=r.y+e.ring*Math.cos(l)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,o),!0)}};function Fu(e){return Nu[e]}var Bu=require("d3-quadtree");function Du(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 Eu(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!zu(e))return!1;return!0}return zu(t.points)}function zu(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}var Hu=require("d3-interpolate");var Ou="rgba(34, 197, 94, 0.7)",Wu=2e3,qu=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this._stylePaintPending=!1,this.config=e,this.tensionConfig={...lc,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new uc(2e3))}updateConfig(e){const t=this.config;t.__orbitState&&(e.__orbitState=t.__orbitState),t.__hierarchyRoot&&(e.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(e.layoutSelection=t.layoutSelection),this.config=e,this.tensionConfig={...lc,...e.tensionConfig},!e.showParticles||"sankey"!==e.chartType&&!e.customNetworkLayout||this.particlePool||(this.particlePool=new uc(2e3))}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null}ingestBounded(e,t,o,r){const{nodeIDAccessor:n="id",sourceAccessor:i="source",targetAccessor:s="target",valueAccessor:a="value"}=this.config,l="function"==typeof n?n:e=>e[n],c="function"==typeof i?i:e=>e[i],u="function"==typeof s?s:e=>e[s],d="function"==typeof a?a:e=>e[a]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=l(t)+"";this.nodes.set(e,{...Du(e),data:t})}for(let e=0;t.length>e;e++){const o=t[e],r=c(o)+"",n=u(o)+"",i=d(o),s=null==i?NaN:Number(i),a=Number.isFinite(s)?s:1;this.nodes.has(r)||this.nodes.set(r,{...Du(r),data:o}),this.nodes.has(n)||this.nodes.set(n,{...Du(n),data:o});const l=`${r}\0${n}\0${e}`,h={source:r,target:n,value:a,y0:0,y1:0,sankeyWidth:0,data:o,_edgeKey:l};o&&"object"==typeof o&&Eu(o.bezier)&&(h.bezier=o.bezier),this.edges.set(l,h)}r?.deferLayout||this.runLayout(o)}applyForceLayoutPositions(e,t){for(const[t,o]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=o.x,e.y=o.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:o,value:r}=e,n=0===this.nodes.size;let i=!1;const s=Ue();this.lastIngestTime=s,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Du(t)),this.nodeTimestamps.set(t,s),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(o)||(this.nodes.set(o,Du(o)),this.nodeTimestamps.set(o,s),this.tension+=this.tensionConfig.newNode,i=!0);const a=this.edgeKey(t,o),l=this.edges.get(a);let c=!1;return l?(l.value+=r,this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(a,{source:t,target:o,value:r,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(a,s),this.tension+=this.tensionConfig.newEdge,i=!0),n||i||c||this.tension>=this.tensionConfig.threshold}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=Fu(this.config.chartType);if(!t)return;let o=Array.from(this.nodes.values());const r=Array.from(this.edges.values());if(0===o.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of o)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,o]of this._lastPositionSnapshot)e.has(t)||e.set(t,o);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(o,r,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&o.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of o)this.nodes.set(e.id,e);for(let e=0;r.length>e;e++){const t=r[e],o=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=o,this.edges.set(o,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const o=e.get(t.id);o&&(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,o=Array.from(this.nodes.values())}this.finalizeLayout();const n=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||n.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=n,this.saveTargetPositions();const i=o.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),s=this.config.transition?.duration??this.tensionConfig.transitionDuration,a=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&a&&o.length>0&&s>0){const t=e[0]/2,o=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=o,e._prevY1=o;for(const e of this.edges.values())e._prevY0=o,e._prevY1=o,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:Ue(),duration:s}}else i&&s>0&&(this.restorePreviousPositions(),this.transition={startTime:Ue(),duration:s});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=Ue()),this.previousNodeIds=e,this.previousEdgeKeys=t}setLayoutSelection(e){this.config.layoutSelection=e}snapshotBaseStyles(){this._baseStyles=new WeakMap;for(const e of this.sceneNodes)this._baseStyles.set(e,e.style);for(const e of this.sceneEdges)this._baseStyles.set(e,e.style)}consumeStylePaintPending(){const e=this._stylePaintPending;return this._stylePaintPending=!1,e}restyleScene(e){if(this._customRestyle){const t=this._customRestyle;for(const o of this.sceneNodes){const r=this._baseStyles.get(o)??o.style,n=t(o,e);o.style=n?{...r,...n}:r}}if(this._customRestyleEdge){const t=this._customRestyleEdge;for(const o of this.sceneEdges){const r=this._baseStyles.get(o)??o.style,n=t(o,e);o.style=n?{...r,...n}:r}}this._stylePaintPending=!0}buildScene(e){if(this.config.customNetworkLayout){const t=Array.from(this.nodes.values()),o=Array.from(this.edges.values()),r=sl(this.config.colorScheme,this.config.themeCategorical,ge),n={nodes:t,edges:o,dimensions:{width:e[0],height:e[1],plot:{x:0,y:0,width:e[0],height:e[1]}},theme:{semantic:this.config.themeSemantic??{},categorical:[...r]},resolveColor:al(r,this.config.colorScheme),config:this.config.layoutConfig??{},selection:this.config.layoutSelection??null};let i;try{i=this.config.customNetworkLayout(n)}catch(e){const t=null!==this.lastCustomLayoutResult,o=Ft("network",e,t,this.layoutVersion);this.lastCustomLayoutFailure=o,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",e);try{this.config.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return void(t||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++))}return this.sceneNodes=i.sceneNodes??[],this.sceneEdges=i.sceneEdges??[],this.labels=i.labels??[],this.customLayoutOverlays=i.overlays??null,this.customLayoutHtmlMarks=i.htmlMarks??[],this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=i.restyle,this._customRestyleEdge=i.restyleEdge,this.hasCustomRestyle=!(!i.restyle&&!i.restyleEdge),this.hasCustomRestyle&&(this.snapshotBaseStyles(),this.restyleScene(this.config.layoutSelection??null)),void It({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=Fu(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const o=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,r=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:n,sceneEdges:i,labels:s}=t.buildScene(o,r,this.config,e);this.sceneNodes=n,this.sceneEdges=i,this.labels=s,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,o=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>o&&(o=e.r));if(this._maxNodeRadius=o,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const r=Array(t);let n=0;for(const e of this.sceneNodes)"circle"===e.type&&(r[n++]=e);this._nodeQuadtree=(0,Bu.quadtree)().x(e=>e.cx).y(e=>e.cy).addAll(r)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=Fu(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const o=Fu(this.config.chartType);if(!o?.tick)return!1;const r=o.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=o.hierarchical?Array.from(this.edges.values()):this.edgesArray;return o.tick(r,n,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=Ve(e,this.transition),o=Ge(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=Xe(e._prevX0,e._targetX0,o),e.x1=Xe(e._prevX1,e._targetX1,o),e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Xe(e._prevY0,e._targetY0,o),e.y1=Xe(e._prevY1,e._targetY1,o),e.sankeyWidth=Xe(e._prevSankeyWidth,e._targetSankeyWidth,o));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const o=e?.get(t.id);o&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=o.x0,t._prevX1=o.x1,t._prevY0=o.y0,t._prevY1=o.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const o=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(o){e._prevY0=o.y0,e._prevY1=o.y1,e._prevSankeyWidth=o.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}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),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,o=.5){const r="string"==typeof e.source?t.get(e.source):e.source,n="string"==typeof e.target?t.get(e.target):e.target;!r||!n||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,o=e.circularPathData;if(!o)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(o.rightFullExtent-o.sourceX))),r=Math.max(15,Math.min(40,.33*(o.targetX-o.leftFullExtent)));return{circular:!0,segments:[[{x:o.sourceX,y:o.sourceY},{x:o.sourceX+.33*e,y:o.sourceY},{x:o.sourceX+.66*e,y:o.sourceY},{x:o.sourceX+e,y:o.sourceY}],[{x:o.targetX-r,y:o.targetY},{x:o.targetX-.66*r,y:o.targetY},{x:o.targetX-.33*r,y:o.targetY},{x:o.targetX,y:o.targetY}]],halfWidth:t}}let r;r="down"===e.direction?[{x:o.sourceY,y:o.sourceX},{x:o.sourceY,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.rightFullExtent},{x:o.verticalFullExtent,y:o.leftFullExtent},{x:o.targetY,y:o.leftFullExtent},{x:o.targetY,y:o.targetX}]:[{x:o.sourceX,y:o.sourceY},{x:o.rightFullExtent,y:o.sourceY},{x:o.rightFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.verticalFullExtent},{x:o.leftFullExtent,y:o.targetY},{x:o.targetX,y:o.targetY}];const n=[];for(let e=0;r.length-1>e;e++){const t=r[e],o=r[e+1],i=o.x-t.x,s=o.y-t.y;n.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:n,halfWidth:t}}(e):function(e,t,o,r=.5){const n=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,s=o.x0,a=(0,Hu.interpolateNumber)(i,s);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:a(r)},{x:e.y1,y:a(1-r)},{x:e.y1,y:s}],halfWidth:n}}const i=t.x1,s=o.x0,a=(0,Hu.interpolateNumber)(i,s);return{circular:!1,points:[{x:i,y:e.y0},{x:a(r),y:e.y0},{x:a(1-r),y:e.y1},{x:s,y:e.y1}],halfWidth:n}}(e,r,n,o))}(e,this.nodes,.5)}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){const t=e.pulse;if(!t)return;const o=t.duration??500,r=t.color??"rgba(255,255,255,0.6)",n=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const s=t.id;if(!s)continue;const a=e.nodeTimestamps.get(s);if(!a)continue;const l=i-a;o>l&&(t._pulseIntensity=1-l/o,t._pulseColor=r,t._pulseGlowRadius=n)}for(const t of e.sceneEdges){const n=t.datum;if(!n)continue;const s="object"==typeof n.source?n.source?.id:n.source,a="object"==typeof n.target?n.target?.id:n.target;if(!s||!a)continue;const l=e.edgeTimestamps.get(`${s}\0${a}`);if(!l)continue;const c=i-l;o>c&&(t._pulseIntensity=1-c/o,t._pulseColor=r)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const o=e.nodeTimestamps.size;if(1>=o)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let o=0;e.cache.sortedNodes.length>o;o++)t.set(e.cache.sortedNodes[o][0],o);e.cache.ageMap=t}const r=e.cache.ageMap;for(const n of e.sceneNodes){const e=n.id;if(!e)continue;const i=r.get(e);if(void 0===i)continue;const s=nt(t,i,o);n.style={...n.style,opacity:(n.style?.opacity??1)*s}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===Ou&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=Wu)return;const o=1-t/Wu;for(const t of e.sceneNodes){const r=t.id;r&&e.addedNodes.has(r)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,o),t._pulseColor=Ou,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,o=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&Wu>o-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const o=t.warningColor??"#f59e0b",r=t.criticalColor??"#ef4444",n=!1!==t.pulse;for(const i of e.sceneNodes){const s=i.id;if(!s)continue;const a=e.nodes.get(s);if(!a)continue;const l=t.metric(a);let c=null;void 0===t.critical||t.critical>l?void 0===t.warning||t.warning>l||(c=o):c=r,c&&(i.style={...i.style,fill:c},n&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=c,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const o of e){const e=t.metric(o);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const o=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>o-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const o=this.nodes.get(e);if(!o)return null;const r=o.data?{...o.data}:{};return o.data=t(o.data??{}),this.layoutVersion++,this.lastIngestTime=Ue(),r}updateEdge(e,t,o){const r=this.config.valueAccessor,n="function"==typeof r?r:r?e=>e[r]:e=>e.value,i=[];for(const[,r]of this.edges)if(("string"==typeof r.source?r.source:r.source.id)===e&&("string"==typeof r.target?r.target:r.target.id)===t){i.push(r.data?{...r.data}:{}),r.data=o(r.data??{});const e=n(r.data);null!=e&&(r.value=Number(e))}return i.length>0&&(this.layoutVersion++,this.lastIngestTime=Ue()),i}removeNode(e){if(!this.nodes.has(e))return!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)!==e&&("string"==typeof o.target?o.target:o.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=Ue(),!0}removeEdge(e,t){const o=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const r="function"==typeof t?t:e=>e?.[t];for(const[t,n]of this.edges)n.data&&r(n.data)===e&&o.push(t)}else for(const[r,n]of this.edges)("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t&&o.push(r);for(const e of o)this.edges.delete(e),this.edgeTimestamps.delete(e);return o.length>0&&(this.layoutVersion++,this.lastIngestTime=Ue()),o.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear()}};qu.QUADTREE_THRESHOLD=500;var Yu=qu,Gu=c(require("react")),Vu=require("react/jsx-runtime");function Xu(e){const{width:t,height:o,totalWidth:r,totalHeight:n,margin:i,labels:s,title:a,legend:l,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:p="right",legendLayout:f,foregroundGraphics:g,sceneNodes:m,annotations:y,autoPlaceAnnotations:b,svgAnnotationRules:v}=e,x=Gu.useMemo(()=>{const e=(m||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,o=e.cy??e.y;if("number"!=typeof t||"number"!=typeof o)return null;const r=Io(e.glyph,e.size);return{x:t+r.centerDx,y:o+r.centerDy,r:Math.max(1,r.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),o=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof o?null:{x:t,y:o,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Lt(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),o=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:o,...t}]:[]});return{scales:null,width:t,height:o,frameType:"network",pointNodes:e,sceneNodes:m}},[o,m,t]),k=Gu.useMemo(()=>y&&b?Hn({annotations:y,context:x,..."object"==typeof b?b:{}}):y,[y,b,x]),w=Gu.useMemo(()=>wn(),[]),S=k?kn(k.filter(e=>"widget"!==e.type),w,v,x):null,A=!0===k?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return(0,Vu.jsxs)(Vu.Fragment,{children:[A&&(0,Vu.jsx)("style",{children:fn},"annotation-widget-disclosure-style"),(0,Vu.jsxs)("svg",{role:"img",width:r,height:n,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[(0,Vu.jsx)("title",{children:"string"==typeof a?a:"Network Chart"}),(0,Vu.jsx)("desc",{children:"string"==typeof a?a+" — network data visualization":"Network data visualization"}),(0,Vu.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[s.map((e,t)=>(0,Vu.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),S,g]}),a&&"string"==typeof a?(0,Vu.jsx)("text",{x:r/2,y:16,textAnchor:"middle",fontWeight:600,fill:"currentColor",className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?(0,Vu.jsx)("foreignObject",{x:0,y:0,width:r,height:i.top,children:a}):null,Hr({legend:l,totalWidth:r,totalHeight:n,margin:i,legendPosition:p,title:a,legendLayout:f,legendHoverBehavior:c,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),k?.filter(e=>"widget"===e.type&&e.nodeId&&m).map((e,t)=>{const o=!0===e._annotationDeferred,r=m.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!r)return null;const n=e.width??32,s=e.height??32;return(0,Vu.jsx)("div",{className:o?"annotation-deferred":void 0,"data-annotation-disclosure":o?"deferred":void 0,style:{position:"absolute",left:i.left+(r.cx??(null!=r.x&&null!=r.w?r.x+r.w/2:r.x??0))+(e.dx??0)-n/2,top:i.top+(r.cy??(null!=r.y&&null!=r.h?r.y+r.h/2:r.y??0))+(e.dy??-16)-s/2,width:n,height:s,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:e.content??(0,Vu.jsx)("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"})},"widget-"+t)})]})}Xu.displayName="NetworkSVGOverlay";var Uu=c(require("react")),Ku=require("react/jsx-runtime"),Qu={position:"absolute",top:0,left:0,pointerEvents:"none"};function Zu({marks:e,margin:t,selection:o=null,overscan:r=400}){const n=Uu.useRef(null),i=function(e,t,o){const[r,n]=Uu.useState(null);return Uu.useLayoutEffect(()=>{const e=t.current,o=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:o,overflowY:r}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${r} ${o}`))return t;t=t.parentElement}return null}(e);if(!e||!o)return void n(null);let r=0;const i=()=>{r=0;const t=o.getBoundingClientRect(),i=e.getBoundingClientRect();n(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},s=()=>{0===r&&(r=window.requestAnimationFrame(i))};i(),o.addEventListener("scroll",s,{passive:!0});const a=new ResizeObserver(s);return a.observe(o),()=>{0!==r&&window.cancelAnimationFrame(r),o.removeEventListener("scroll",s),a.disconnect()}},[t,e,o]),Uu.useMemo(()=>{if(!e||!r)return e;const{scroll:t,originX:n,originY:i}=r,s=t.left-o,a=t.right+o,l=t.top-o,c=t.bottom+o;return e.filter(e=>{const t=n+e.x,o=i+e.y;return!(s>t+e.width||t>a||l>o+e.height||o>c)})},[e,r,o])}(e,n,r);if(!e||0===e.length)return null;const s=(0,Ku.jsx)("div",{className:"semiotic-network-html-marks",ref:n,style:{...Qu,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>(0,Ku.jsx)("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=o?(0,Ku.jsx)(go,{value:o,children:s}):s}var Ju=c(require("react")),ed=require("react/jsx-runtime");function td({componentName:e,message:t,diagnosticHint:o,width:r,height:n}){return(0,ed.jsx)("div",{role:"alert",style:{width:r,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"},children:(0,ed.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,ed.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,ed.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),o&&(0,ed.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}var od=require("react/jsx-runtime"),rd=class extends Ju.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(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:(0,od.jsx)(td,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},nd=require("react/jsx-runtime"),id="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function sd({componentName:e,width:t,height:o,children:r}){return(0,nd.jsx)(rd,{fallback:r=>(0,nd.jsx)(td,{componentName:e,message:r.message,width:t,height:o}),children:r})}var ad={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},ld={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function cd(e,t,o,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,nd.jsx)("div",{style:{...ad,width:t,height:o},children:r||"No data available"}):null}function ud(e,t,o,r){if(!e)return null;if(!1===r)return null;if(null!=r)return(0,nd.jsx)("div",{style:{width:t,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const n=Math.min(5,Math.floor(o/40)),i=Math.max(8,Math.floor(o/(3*n))),s=Math.max(6,Math.floor(o/(2.5*n))),a=Math.floor((o-(n*(i+s)-s))/2);return(0,nd.jsx)("div",{style:{width:t,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:n},(e,o)=>(0,nd.jsx)("div",{className:"semiotic-loading-bar",style:{...ld,position:"absolute",top:a+o*(i+s),left:Math.floor(.1*t),width:30+(37*o+13)%50+"%",height:i,opacity:.5+o%2*.2}},o))})}function dd(e,t,o,r){if(!id)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const n=t[0];if(!n||"object"!=typeof n)return;if(r in n)return;const i=Object.keys(n).join(", ");console.warn(`[semiotic] ${e}: ${o} "${r}" not found in data. Available keys: ${i}`)}var hd={},pd=4e4;function fd(e,t,o,r,n=pd){return"sync"!==e&&("worker"===e||r*(t+o)>=n)}function gd(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}function md(){if("undefined"!=typeof DOMException)return new DOMException("Force layout aborted","AbortError");const e=Error("Force layout aborted");return e.name="AbortError",e}var yd=class{constructor(e=function(){const e="string"==typeof hd.url&&hd.url?new URL("./forceLayoutWorker.js",hd.url):function(e){if("undefined"!=typeof __filename){const t=__filename.replace(/\\/g,"/"),o=t.startsWith("/")?t:"/"+t;return new URL("./"+e,"file:"+o)}throw Error("Cannot resolve module worker asset: "+e)}("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.worker=e,this.worker.onmessage=e=>{const t=e.data,o=t.requestId,r=null!=o?this.pending.get(o):this.pending.values().next().value;if(r){if(null!=o?this.pending.delete(o):this.pending.clear(),r.cleanup(),t.error){const e=Error(t.error.message);return e.name=t.error.name??"Error",t.error.stack&&(e.stack=t.error.stack),void r.reject(e)}r.resolve({positions:t.positions??{}})}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||"Force layout worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error("Force layout worker session is closed"));if(t?.aborted)return Promise.reject(md());const o=this.nextRequestId;this.nextRequestId+=1;const r={requestId:o,request:e};return new Promise((e,n)=>{const i=()=>{this.pending.delete(o),t?.removeEventListener("abort",i),n(md())},s=()=>t?.removeEventListener("abort",i);this.pending.set(o,{cleanup:s,reject:n,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(r)}catch(e){this.pending.delete(o),s(),n(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error("Force layout worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}},bd=null;function vd(e,t){return gd()?t?.aborted?Promise.reject(md()):(bd&&!bd.isDead||(bd=new yd),bd).request(e,t):Promise.reject(Error("Web Workers are unavailable"))}var xd=require("react/jsx-runtime"),kd=/^(value|amount|total|count|weight|score)$/i;function wd({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsxs)("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const o=t.__hierarchyNode;if(o){const e=[];let r=o;for(;r;){const o=r.data?.name??r.data?.id??t.id;null!=o&&e.unshift(o+""),r=r.parent}e.length>1&&e.shift();const n=e.length-1;return(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsx)("div",{children:e.map((e,t)=>(0,xd.jsxs)("span",{children:[t>0&&(0,xd.jsx)("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===n?(0,xd.jsx)("strong",{children:e}):(0,xd.jsx)("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&(0,xd.jsx)("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const r=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),n=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=_s(t.data??t),s=null!=i.title?i.title+"":t.id,a=i.entries.some(e=>kd.test(e.key));return(0,xd.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[(0,xd.jsx)("div",{style:{fontWeight:600},children:s}),i.entries.map(e=>(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Fa(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),r>0&&(0,xd.jsxs)("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",r,n!==r&&` (weighted: ${n.toLocaleString()})`]})]})}function Sd(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Ad(e,t){if(!t.pathD)return;e.save();const o=Sd(t);if(t.style.fill&&"none"!==t.style.fill){const r=t._gradient;if(r){const o=e.createLinearGradient(r.x0,0,r.x1,0),n=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",s=Oo(e,i)||i;o.addColorStop(0,1===r.from?s:"transparent"),o.addColorStop(1,1===r.to?s:"transparent"),e.fillStyle=o,e.globalAlpha=n}else e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(o)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(o)),e.restore()}function Cd(e,t){e.save();const o=t.style.stroke||"#999";e.strokeStyle=Oo(e,o)||o,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Md(e,t){if(!t.pathD)return;e.save();const o=Sd(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(o)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(o)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(o)),e.restore()}function jd(e,t){if(!t.pathD)return;e.save();const o=Sd(t),r=t.style.stroke||"#999";e.strokeStyle=Oo(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(o),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.globalAlpha=t.style.fillOpacity??.1,e.fill(o)),e.restore()}wd.ownsChrome=!0;var Pd=new Map;function _d(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let o=Pd.get(t);return o||(o=new Path2D(_t(e.symbolType,e.size)),Pd.size>256&&Pd.clear(),Pd.set(t,o)),o}catch{return null}}function Ld(e){const{sceneNodes:t,nodes:o,nodeColorMap:r,colorScheme:n}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&r.set(e.id,e.style.fill);const i=Array.isArray(n)?n:De,s=Array.from(o);for(let e=0;s.length>e;e++){const t=s[e];r.has(t.id)||r.set(t.id,i[e%i.length])}return s.length}function Rd(e,t,o,r=30){switch(e.type){case"circle":return function(e,t,o,r=30){const n=t-e.cx,i=o-e.cy,s=Math.sqrt(n*n+i*i);return s>wo(e.r,r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,r);case"rect":return function(e,t,o){const r=ko(t,o,e);return r.hit?{type:"node",datum:e.datum,x:r.cx,y:r.cy,distance:0}:null}(e,t,o);case"arc":return function(e,t,o){const r=t-e.cx,n=o-e.cy,i=Math.sqrt(r*r+n*n);if(e.innerR-2>i||i>e.outerR+2)return null;const s=Co(Math.atan2(n,r)),a=Co(e.startAngle),l=Co(e.endAngle);if(a>l?s>=a||l>=s:s>=a&&l>=s){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);case"symbol":return function(e,t,o,r=30){const n=t-e.cx,i=o-e.cy,s=Math.sqrt(n*n+i*i);return s>wo(Lt(e.size),r)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:s}}(e,t,o,r);case"glyph":return function(e,t,o,r=30){if(null==e.datum)return null;const n=Io(e.glyph,e.size),i=e.cx+n.centerDx,s=e.cy+n.centerDy,a=t-i,l=o-s,c=Math.sqrt(a*a+l*l);return c>wo(n.radius,r)?null:{type:"node",datum:e.datum,x:i,y:s,distance:c}}(e,t,o,r);default:return null}}var Td=null,Id=null;function $d(){return Id||((Td=document.createElement("canvas")).width=1,Td.height=1,Id=Td.getContext("2d")),Id}function Nd(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function Fd(e,t,o){switch(e.type){case"bezier":return function(e,t,o){if(!e.pathD)return null;const r=Nd(e),n=$d();if(!r||!n)return null;try{if(n.isPointInPath(r,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=n.lineWidth;n.lineWidth=10;const s=n.isPointInStroke(r,t,o);if(n.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);case"line":return function(e,t,o){const r=e.x2-e.x1,n=e.y2-e.y1,i=r*r+n*n;if(0===i)return null;let s=((t-e.x1)*r+(o-e.y1)*n)/i;s=Math.max(0,Math.min(1,s));const a=e.x1+s*r,l=e.y1+s*n,c=Math.sqrt((t-a)**2+(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;const r=Nd(e),n=$d();if(!r||!n)return null;try{if(n.isPointInPath(r,t,o))return{type:"edge",datum:e.datum,x:t,y:o,distance:0};const i=n.lineWidth;n.lineWidth=10;const s=n.isPointInStroke(r,t,o);if(n.lineWidth=i,s)return{type:"edge",datum:e.datum,x:t,y:o,distance:4}}catch{}return null}(e,t,o);default:return null}}function Bd(e){const{clientX:t,clientY:o,canvasRect:r,margin:n,adjustedWidth:i,adjustedHeight:s,sceneNodes:a,sceneEdges:l,nodeQuadtree:c,maxNodeRadius:u,hitRadius:d=30}=e,h=t-r.left-n.left,p=o-r.top-n.top;if(0>h||h>i||0>p||p>s)return{kind:"miss-outside"};const f=function(e,t,o,r,n=30,i,s=0){let a=null,l=n,c=1/0;if(i){const e=No(i,o,r,n,s,e=>e.cx,e=>e.cy,e=>e.r);e&&(a={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},l=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=Rd(t,o,r,n);if(e)if("rect"===t.type){const o=t.w*t.h;c>o&&(a=e,c=o)}else l>e.distance&&(a=e,l=e.distance)}if(a)return a;for(const e of t){if(!1===e.interactive)continue;const t=Fd(e,o,r);t&&l>t.distance&&(a=t,l=t.distance)}return a}(a,l,h,p,d,c,u);return f?{kind:"hit",hover:Ss(f.datum||{},f.x,f.y,{nodeOrEdge:f.type})}:{kind:"miss"}}var Dd=require("react/jsx-runtime"),Ed={top:20,right:80,bottom:20,left:80},zd={top:40,right:40,bottom:40,left:40},Hd=new Set(["chord","force","circlepack","orbit"]),Od=[800,600],Wd=(0,ac.memo)((0,ac.forwardRef)(function(e,t){const{chartType:o,nodes:r,edges:n,data:i,initialEdges:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f="horizontal",nodeAlign:g="justify",nodePaddingRatio:m=.05,nodeWidth:y=15,iterations:b=300,forceStrength:v=.1,layoutExecution:x="auto",layoutLoadingContent:k,onLayoutStateChange:w,padAngle:S=.01,groupWidth:A=20,sortGroups:C,edgeSort:M,treeOrientation:j="vertical",edgeType:P="curve",padding:_,paddingTop:L,tensionConfig:R,showParticles:T=!1,particleStyle:I,nodeStyle:$,edgeStyle:N,colorBy:F,colorScheme:B="category10",edgeColorBy:D="source",edgeOpacity:E=.5,colorByDepth:H=!1,nodeSize:O=8,nodeSizeRange:W=[5,20],nodeLabel:q,showLabels:Y=!0,labelMode:V,size:X=Od,responsiveWidth:U,responsiveHeight:K,margin:Q,className:Z,background:J,enableHover:ee=!0,tooltipContent:te,customHoverBehavior:oe,customClickBehavior:re,onObservation:ne,chartId:ie,onTopologyChange:se,annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,title:ye,foregroundGraphics:be,backgroundGraphics:ve,decay:xe,pulse:ke,transition:we,animate:Se,staleness:Ae,thresholds:Ce,accessibleTable:Me=!0,description:je,summary:Pe,orbitMode:_e,orbitSize:Le,orbitSpeed:Re,orbitRevolution:Te,orbitRevolutionStyle:Ie,orbitEccentricity:$e,orbitShowRings:Ne,orbitAnimated:Fe,customNetworkLayout:Be,onLayoutError:Ee,layoutConfig:ze,layoutSelection:He}=e,Oe=Hd.has(o)?zd:Ed,We=(0,ac.useRef)(!0),qe=Us({sizeProp:X,responsiveWidth:U,responsiveHeight:K,userMargin:Q,marginDefault:Oe,foregroundGraphics:be,backgroundGraphics:ve,animate:Se,transitionProp:we,themeDirtyRef:We}),{reducedMotionRef:Ye,responsiveRef:Ge,size:Ve,margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,resolvedForeground:Qe,resolvedBackground:Ze,transition:Je,introEnabled:et,tableId:tt,rafRef:ot,renderFnRef:rt,scheduleRender:nt,cancelRender:it,currentTheme:st}=qe,at=Mi(),lt=Li(),ct=(0,ac.useMemo)(()=>z(r),[r]),ut=(0,ac.useMemo)(()=>Array.isArray(n)?z(n):n,[n]),dt=(0,ac.useMemo)(()=>({...lc,...R}),[R]),ht=(0,ac.useMemo)(()=>({...cc,...I}),[I]),pt=(0,ac.useMemo)(()=>{return{chartType:(e={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:g,nodePaddingRatio:m,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:j,edgeType:P,padding:_,paddingTop:L,tensionConfig:dt,showParticles:T,particleStyle:ht,nodeStyle:$,edgeStyle:N,nodeLabel:q,showLabels:Y,labelMode:V,colorBy:F,colorScheme:B,edgeColorBy:D,edgeOpacity:E,colorByDepth:H,nodeSize:O,nodeSizeRange:W,decay:xe,pulse:ke,transition:Je,introAnimation:et,staleness:Ae,thresholds:Ce,orbitMode:_e,orbitSize:Le,orbitSpeed:Re,orbitRevolution:Te,orbitRevolutionStyle:Ie,orbitEccentricity:$e,orbitShowRings:Ne,orbitAnimated:Fe,customNetworkLayout:Be,onLayoutError:Ee,layoutConfig:ze,currentTheme:st}).chartType,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:G(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[o,a,l,c,u,h,p,f,g,m,y,b,v,S,A,C,M,j,P,_,L,dt,T,ht,$,N,q,Y,V,F,B,D,E,H,O,W,xe,ke,Je?.duration,Je?.easing,et,Ae,Ce,_e,Le,Re,Te,Ie,$e,Ne,Fe,st,Be,Ee,ze]),ft=Ii(pt),gt=Ii({chartType:(mt={chartType:o,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,valueAccessor:u,edgeIdAccessor:d,childrenAccessor:h,hierarchySum:p,orientation:f,nodeAlign:g,nodePaddingRatio:m,nodeWidth:y,iterations:b,forceStrength:v,padAngle:S,groupWidth:A,sortGroups:C,edgeSort:M,treeOrientation:j,edgeType:P,padding:_,paddingTop:L,tensionConfig:dt,customNetworkLayout:Be,orbitMode:_e,orbitSize:Le,orbitEccentricity:$e}).chartType,nodeIDAccessor:mt.nodeIDAccessor,sourceAccessor:mt.sourceAccessor,targetAccessor:mt.targetAccessor,valueAccessor:mt.valueAccessor,edgeIdAccessor:mt.edgeIdAccessor,childrenAccessor:mt.childrenAccessor,hierarchySum:mt.hierarchySum,orientation:mt.orientation,nodeAlign:mt.nodeAlign,nodePaddingRatio:mt.nodePaddingRatio,nodeWidth:mt.nodeWidth,iterations:mt.iterations,forceStrength:mt.forceStrength,padAngle:mt.padAngle,groupWidth:mt.groupWidth,sortGroups:mt.sortGroups,edgeSort:mt.edgeSort,treeOrientation:mt.treeOrientation,edgeType:mt.edgeType,padding:mt.padding,paddingTop:mt.paddingTop,tensionConfig:mt.tensionConfig,customNetworkLayout:mt.customNetworkLayout,orbitMode:mt.orbitMode,orbitSize:mt.orbitSize,orbitEccentricity:mt.orbitEccentricity});var mt;const yt=(0,ac.useRef)(null),bt=(0,ac.useRef)(0),vt=(0,ac.useRef)(0),xt=(0,ac.useRef)(!1),kt=(0,ac.useRef)(null);kt.current||(kt.current=new Yu(ft));const[wt,St]=(0,ac.useState)(null),[At,Ct]=(0,ac.useState)(0),[Mt,jt]=(0,ac.useState)(0),[Pt,Lt]=(0,ac.useState)(!1),[Rt,Tt]=(0,ac.useState)(!1),It=(0,ac.useRef)(0),$t=(0,ac.useRef)(null),Nt=(0,ac.useRef)(!1),Ft=(0,ac.useRef)(w);Ft.current=w;const Bt=(0,ac.useRef)(ft);Bt.current=ft;const Dt=(0,ac.useRef)(null),Et=(0,ac.useRef)(new Map),zt=(0,ac.useRef)(0),Ht=(0,ac.useCallback)(e=>function(e){const{node:t,colorBy:o,colorScheme:r,nodeColorMap:n,colorIndexRef:i}=e;if("function"==typeof o)return o(t)+"";if("string"==typeof o&&t.data){const e=t.data[o];if(void 0!==e){if(!n.has(e+"")){const t=Array.isArray(r)?r:De;n.set(e+"",t[i.current++%t.length])}return n.get(e+"")}}if(n.has(t.id))return n.get(t.id);const s=Array.isArray(r)?r:De,a=o?s[i.current++%s.length]:s[0];return n.set(t.id,a),a}({node:e,colorBy:F,colorScheme:B,nodeColorMap:Et.current,colorIndexRef:zt}),[F,B]),Ot=(Wt=st,Wt?.colors?.border||Wt?.colors?.secondary||Wt?.colors?.primary||"#999");var Wt;const qt=(0,ac.useCallback)(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,kt.current?.nodes),[]),Yt=(0,ac.useCallback)(e=>function(e){const{edge:t,edgeColorBy:o,getNodeColor:r,resolveEndpoint:n,fallback:i}=e;if("function"==typeof o)return o(t);const s=n(t.source),a=n(t.target);return"target"===o&&a?r(a):s?r(s):i}({edge:e,edgeColorBy:D,getNodeColor:Ht,resolveEndpoint:qt,fallback:Ot}),[D,Ht,Ot,qt]),Gt=(0,ac.useCallback)(e=>function(e){const{edge:t,particleStyleColor:o,particleColorBy:r,hasExplicitParticleColorBy:n,getEdgeColor:i,getNodeColor:s,resolveEndpoint:a,fallback:l}=e;if("function"==typeof o){const e=a(t.source);return e?o(t,e):l}if(!n)return i(t);const c=r,u=a(t.source),d=a(t.target);return"target"===c&&d?s(d):u?s(u):l}({edge:e,particleStyleColor:ht.color,particleColorBy:ht.colorBy,hasExplicitParticleColorBy:!!I?.colorBy,getEdgeColor:Yt,getNodeColor:Ht,resolveEndpoint:qt,fallback:Ot}),[I?.colorBy,ht.color,ht.colorBy,Ht,Yt,Ot,qt]),Vt=("sankey"===o||!!Be)&&T||!!ke||(kt.current?.isAnimating??!1);vo(kt,ft,We,nt),xo(kt,He,We,nt),(0,ac.useEffect)(()=>{const e=kt.current;e&&(e.buildScene([Ue,Ke]),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),We.current=!0,nt())},[st,Ue,Ke,nt]);const Xt=(0,ac.useCallback)(()=>{const e=kt.current;if(e&&(e.runLayout([Ue,Ke]),e.buildScene([Ue,Ke]),We.current=!0,zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Ct(e.layoutVersion),se)){const{nodes:t,edges:o}=e.getLayoutData();se(t,o)}},[Ue,Ke,se,B]),Ut=(0,ac.useCallback)(e=>{if(null==e||"object"!=typeof e)return;const t=kt.current;t&&(t.ingestEdge(e)&&Xt(),nt())},[Xt,nt]),Kt=(0,ac.useCallback)(e=>{const t=kt.current;if(!t)return;let o=!1;for(const r of e)null!=r&&"object"==typeof r&&t.ingestEdge(r)&&(o=!0);o&&Xt(),nt()},[Xt,nt]),Qt=(0,ac.useCallback)(()=>{kt.current?.clear(),Et.current.clear(),zt.current=0,Ct(kt.current?.layoutVersion??0),St(null),Dt.current=null,We.current=!0,nt()},[nt]),Zt=(0,ac.useCallback)(()=>{const e=kt.current;e&&(e.tension+=999,Xt(),nt())},[Xt,nt]);(0,ac.useImperativeHandle)(t,()=>({push:Ut,pushMany:Kt,removeNode:e=>{const t=kt.current?.removeNode(e)??!1;if(t){const t=Dt.current?.data?"function"==typeof a?a(Dt.current.data):Dt.current.data[a]:void 0;Dt.current&&"node"===Dt.current.nodeOrEdge&&t===e&&(Dt.current=null,St(null)),Et.current.delete(e),Xt(),We.current=!0,nt()}return t},removeEdge:(e,t)=>{const o=kt.current?.removeEdge(e,t)??!1;if(o){if(Dt.current&&"edge"===Dt.current.nodeOrEdge){const o=Dt.current.data;let r;r=void 0!==t?("object"==typeof o?.source?o.source.id:o?.source)===e&&("object"==typeof o?.target?o.target.id:o?.target)===t:!d||!o||("function"==typeof d?d:e=>e?.[d])(o)===e,r&&(Dt.current=null,St(null))}Xt(),We.current=!0,nt()}return o},updateNode:(e,t)=>{const o=kt.current?.updateNode(e,t)??null;return o&&(We.current=!0,nt()),o},updateEdge:(e,t,o)=>{const r=kt.current?.updateEdge(e,t,o)??[];return r.length>0&&(Xt(),We.current=!0,nt()),r},clear:Qt,getTopology:()=>kt.current?.getLayoutData()??{nodes:[],edges:[]},getCustomLayout:()=>kt.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>kt.current?.lastCustomLayoutFailure??null,getTopologyDiff:()=>{const e=kt.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:Zt,getTension:()=>kt.current?.tension??0}),[Ut,Kt,Qt,Zt,Xt,nt]);const Jt=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),eo=Jt?i||(Array.isArray(n)?void 0:n):void 0;(0,ac.useEffect)(()=>{const e=kt.current;if(!e)return;const t=++It.current;if($t.current?.abort(),$t.current=null,Jt&&eo)e.ingestHierarchy(eo,[Ue,Ke]),e.buildScene([Ue,Ke]),Tt(!1),Ft.current?.("ready"),We.current=!0,nt();else{const i=ct,s=Array.isArray(ut)?ut:[];if(0===i.length&&0===s.length)return null==r&&null==n||0>=e.nodes.size&&0>=e.edges.size||Qt(),Tt(!1),void Ft.current?.("ready");const a=[Ue,Ke],l="force"===o&&!Be&&gd()&&fd(x,i.length,s.length,b);if(l&<&&!Nt.current&&e.sceneNodes.length>0)return Nt.current=!0,Tt(!1),Ft.current?.("ready"),We.current=!0,void nt();if(l){const o=new AbortController;$t.current=o;const r=e._lastPositionSnapshot;e.ingestBounded(i,s,a,{deferLayout:!0});const n=e.getLayoutData(),l=function(e,t,o,r,n){const i=gu(o.nodeSize,o.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=n?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,o="string"==typeof e.target?e.target:e.target.id,r=e.data?.weight,n="number"==typeof r&&Number.isFinite(r)?r:e.value;return{source:t,target:o,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:n}}),config:{chartType:"force",iterations:o.iterations,forceStrength:o.forceStrength},size:r}}(n.nodes,n.edges,Bt.current,a,r);return Tt(!0),Ft.current?.("pending"),vd(l,o.signal).then(({positions:o})=>{t===It.current&&(e.applyForceLayoutPositions(o,a),e.buildScene(a),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Tt(!1),Ft.current?.("ready"),Ct(e.layoutVersion),We.current=!0,nt())}).catch(o=>{"AbortError"!==o.name&&t===It.current&&(e.runLayout(a),e.buildScene(a),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),Tt(!1),Ft.current?.("error"),Ct(e.layoutVersion),We.current=!0,nt())}),()=>o.abort()}e.ingestBounded(i,s,a),e.buildScene(a),Tt(!1),Ft.current?.("ready"),zt.current=Ld({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Et.current,colorScheme:B}),We.current=!0,nt()}},[ct,ut,r,n,i,eo,Jt,Ue,Ke,gt,x,b,lt,o,Be,nt,Qt,B]),(0,ac.useEffect)(()=>{s&&s.length>0&&Kt(s)},[]);const to=(0,ac.useCallback)(e=>{if(oe&&oe(e),ne){const t=Date.now();ne(e?{type:"hover",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ie}:{type:"hover-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ie})}},[oe,ne,ie]),oo=(0,ac.useCallback)(e=>{if(re&&re(e),ne){const t=Date.now();ne(e?{type:"click",datum:e.data||{},x:e.x,y:e.y,timestamp:t,chartType:"StreamNetworkFrame",chartId:ie}:{type:"click-end",timestamp:t,chartType:"StreamNetworkFrame",chartId:ie})}},[re,ne,ie]),{hoverHandlerRef:ro,hoverLeaveRef:no,onPointerMove:io,onPointerLeave:so}=qe,ao=()=>!Be||(kt.current?.hasCustomRestyle??!1);ro.current=e=>{if(!ee)return;const t=ao(),o=yt.current;if(!o)return;const r=kt.current;if(!r)return;const n=Bd({clientX:e.clientX,clientY:e.clientY,canvasRect:o.getBoundingClientRect(),margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===n.kind?(Dt.current=n.hover,St(n.hover),to&&(to(n.hover),t&&(We.current=!0)),t&&nt()):Dt.current&&(Dt.current=null,St(null),to&&(to(null),t&&(We.current=!0)),t&&nt())},no.current=()=>{if(Dt.current){const e=ao();Dt.current=null,St(null),to&&(to(null),e&&(We.current=!0)),e&&nt()}};const lo=(0,ac.useRef)(()=>{});lo.current=e=>{if(!re&&!ne)return;const t=yt.current;if(!t)return;const o=kt.current;if(!o)return;const r=Bd({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,sceneNodes:o.sceneNodes,sceneEdges:o.sceneEdges,nodeQuadtree:o.nodeQuadtree,maxNodeRadius:o.maxNodeRadius});"hit"===r.kind?oo(r.hover):"miss"===r.kind&&oo(null)};const uo=(0,ac.useCallback)(e=>lo.current(e),[]),ho=(0,ac.useRef)(-1),po=(0,ac.useRef)(null),fo=(0,ac.useRef)(-1),go=(0,ac.useCallback)(e=>{const t=kt.current;if(!t)return;const o=function(e){const t=[];for(const o of e)if("circle"===o.type&&null!=o.cx){if(0>=o.r)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("rect"===o.type&&null!=o.x){if(0>=o.w||0>=o.h)continue;t.push({x:o.x+o.w/2,y:o.y+o.h/2,datum:o.datum,shape:"rect",w:o.w,h:o.h,group:o.datum?.id??"_default"})}else if("arc"===o.type&&null!=o.cx)t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"});else if("symbol"===o.type&&null!=o.cx){if(0>=o.size)continue;t.push({x:o.cx,y:o.cy,datum:o.datum,shape:"circle",group:o.datum?.id??"_default"})}else if("glyph"===o.type&&null!=o.cx){if(0>=o.size||null==o.datum)continue;const e=Io(o.glyph,o.size);t.push({x:o.cx+e.centerDx,y:o.cy+e.centerDy,datum:o.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:o.datum?.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}(t.sceneNodes);if(0===o.length)return;const r=ur(o),n=ho.current;if(0>n){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),ho.current=0,fo.current=-1;const t=r.flat[0];po.current={shape:t.shape,w:t.w,h:t.h};const o=Ss(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Dt.current=o,St(o),to&&(to(o),We.current=!0),void nt()}const i=dr(r,n),s=function(e,t,o,r,n){const i=o.flat[t.flatIndex];if(!i)return hr(e,t,o);const s=i.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(e,t,o){let r=null,n=1/0;for(let i=0;e.flat.length>i;i++){const s=e.flat[i];if(s===t)continue;const a=s.x-t.x,l=s.y-t.y;let c=!1;switch(o){case"right":c=a>0&&Math.abs(a)>=Math.abs(l);break;case"left":c=0>a&&Math.abs(a)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(a);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(a)}if(!c)continue;const u=a*a+l*l;n>u&&(n=u,r=i)}return r}(o,i,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return r!==t.flatIndex&&(n.current=-1),r}case"Enter":{if(null==s)return t.flatIndex;const e=function(e,t){const o=e+"",r=[];for(const e of t){const t=e.datum??e,n=fr(t.source),i=fr(t.target),s=null!=n,a=null!=i;s&&n+""===o&&a?r.push(i+""):a&&i+""===o&&s&&r.push(n+"")}return r}(s,r);if(0===e.length)return t.flatIndex;const i=o.idToIdx.get(e[(n.current+1)%e.length])??-1;return 0>i?t.flatIndex:(n.current=-1,i)}default:{const r=hr(e,t,o);return null!==r&&r!==t.flatIndex&&(n.current=-1),r}}}(e.key,i,r,t.sceneEdges??[],fo);if(null===s)return;if(e.preventDefault(),0>s)return ho.current=-1,po.current=null,fo.current=-1,Dt.current=null,St(null),to&&(to(null),We.current=!0),void nt();ho.current=s;const a=r.flat[s];po.current={shape:a.shape,w:a.w,h:a.h};const l={data:a.datum||{},x:a.x,y:a.y,__semioticHoverData:!0,nodeOrEdge:"node"};Dt.current=l,St(l),to&&(to(l),We.current=!0),nt()},[to,nt]),mo=(0,ac.useCallback)(e=>{ho.current=-1,po.current=null,io(e)},[io]);rt.current=()=>{ot.current=null;const e=yt.current;if(!e)return;const t=kt.current;t&&function(e){const{canvas:t,store:o,size:r,margin:n,adjustedWidth:i,adjustedHeight:s,background:a,dirtyRef:l,lastFrameTimeRef:c,reducedMotion:u,showParticles:d,isContinuous:h,animate:p,decay:f,pulse:g,thresholds:m,staleness:y,particleStyle:b,getParticleColor:v,pendingAnnotationFrameRef:x,lastAnnotationFrameTimeRef:k,setAnnotationFrame:w,scheduleNextFrame:S}=e,A=t.getContext("2d");if(!A)return;const C=performance.now(),M=c.current?Math.min((C-c.current)/1e3,.1):.016;c.current=C;const j=o.advanceTransition(u?C+1e6:C),P=!u&&j,_=!u&&o.tickAnimation([i,s],M),L=l.current;(j||L||_)&&o.buildScene([i,s]);const R=d&&!u&&!!o.particlePool,T=!!((I={dirtyOrRebuilt:L,transitioning:P,animationTicked:_,continuous:R||h,liveEncoding:!!f||!!g||!!m||!1!==p&&o.hasActiveTopologyDiff||o.hasActivePulses||o.hasActiveThresholds,forced:o.consumeStylePaintPending()}).dirtyOrRebuilt||I.transitioning||I.animationTicked||I.continuous||I.liveEncoding||I.forced);var I;const $=!!y&&o.lastIngestTime>0&&C-o.lastIngestTime>(y?.threshold??5e3);if(T){if(!Qs(t,r,n,Zs()))return;if(A.clearRect(-n.left,-n.top,r[0],r[1]),Bi(A,{background:a,width:i,height:s}),f&&o.applyDecay(),g&&o.applyPulse(C),m&&o.applyThresholds(C),!1!==p&&o.applyTopologyDiff(C),$&&(A.globalAlpha=y?.dimOpacity??.5),function(e,t){for(const o of t)switch(o.type){case"bezier":Ad(e,o);break;case"line":Cd(e,o);break;case"ribbon":Md(e,o);break;case"curved":jd(e,o)}}(A,o.sceneEdges),function(e,t){for(const o of t){if("rect"!==o.type)continue;const t=o;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.fill&&(e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fillRect(t.x,t.y,t.w,t.h)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.strokeRect(t.x,t.y,t.w,t.h)),pa(e,t),e.restore())}}(A,o.sceneNodes),function(e,t){for(const o of t){if("circle"!==o.type)continue;const t=o;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="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),fa(e,t),e.restore())}}(A,o.sceneNodes),function(e,t){for(const o of t){if("arc"!==o.type)continue;const t=o;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="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,void 0!==t.style.fillOpacity&&(e.globalAlpha=(t.style.opacity??1)*t.style.fillOpacity),e.fill()),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.globalAlpha=t.style.opacity??1,e.stroke()),e.restore()}}(A,o.sceneNodes),function(e,t){const o=e.globalAlpha;for(const r of t){if("symbol"!==r.type)continue;const t=r;if(0>=t.size)continue;const n=_d(t);if(!n)continue;e.save(),e.translate(t.cx,t.cy),t.rotation&&e.rotate(t.rotation);const i=t.style.opacity??1;t.style.fill&&(e.globalAlpha=o*i*(t.style.fillOpacity??1),e.fillStyle="string"==typeof t.style.fill&&Oo(e,t.style.fill)||t.style.fill,e.fill(n)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=o*i,e.strokeStyle=Oo(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??1,e.stroke(n)),e.restore()}}(A,o.sceneNodes),function(e,t){const o=e.globalAlpha;for(const r of t)"glyph"===r.type&&Sa(e,r,r.cx,r.cy,o);e.globalAlpha=o}(A,o.sceneNodes),R&&!$){const e=o.edgesArray;if(e.length>0){!function(e,t,o,r){const n=r.spawnRate??.1,i=r.maxPerEdge??50;for(let r=0;t.length>r;r++){const s=t[r];if(!s.bezier)continue;if(e.countForEdge(r)>=i)continue;const a=s.value*n*o*(s.bezier.circular?.3:1),l=Math.floor(a),c=a-l;let u=l;Math.random()<c&&u++;for(let t=0;u>t&&e.countForEdge(r)<i;t++)e.spawn(r)}}(o.particlePool,e,M,b);const t=.5*(b.speedMultiplier??1);let r;if(b.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}o.particlePool.step(M,t,e,r),function(e,t,o,r,n){const i=r.radius??3;e.globalAlpha=r.opacity??.7;for(let s=0;t.particles.length>s;s++){const a=t.particles[s];if(!a.active)continue;const l=o[a.edgeIndex];if(!l)continue;let c;c="string"==typeof r.color&&"inherit"!==r.color?r.color:n(l),e.fillStyle=Oo(e,c)||c,e.beginPath(),e.arc(a.x,a.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}(A,o.particlePool,e,b,v)}}$&&(A.globalAlpha=1)}l.current=!1,(L||P||_)&&t.setAttribute("aria-label",Zi(o.sceneNodes?.length??0,o.sceneEdges?.length??0,"Network chart"));const N=L||P||_||x.current;N&&C-k.current>=33?(w(e=>e+1),k.current=C,x.current=!1):x.current=!!N,(h||P||null!=o.transition||_||o.hasActivePulses||o.hasActiveThresholds||!1!==p&&o.hasActiveTopologyDiff||x.current)&&S()}({canvas:e,store:t,size:Ve,margin:Xe,adjustedWidth:Ue,adjustedHeight:Ke,background:J,dirtyRef:We,lastFrameTimeRef:bt,reducedMotion:!!Ye.current,showParticles:T,isContinuous:Vt,animate:Se,decay:xe,pulse:ke,thresholds:Ce,staleness:Ae,particleStyle:ht,getParticleColor:Gt,pendingAnnotationFrameRef:xt,lastAnnotationFrameTimeRef:vt,setAnnotationFrame:jt,scheduleNextFrame:()=>{nt()}})},Ri({hydrated:at,wasHydratingFromSSR:lt,storeRef:kt,dirtyRef:We,renderFnRef:rt,cancelRender:it}),(0,ac.useEffect)(()=>{We.current=!0,nt()},[o,Ue,Ke,J,nt]),xr(Ae,kt,We,nt,Pt,Lt);const bo=ee&&wt?(0,Dd.jsx)(Es,{x:wt.x,y:wt.y,containerWidth:Ue,containerHeight:Ke,margin:Xe,className:"stream-network-tooltip",zIndex:2,children:te?te(wt):(0,Dd.jsx)(wd,{data:wt})}):null;if(Si||!at&<){const e=kt.current;if(e){const t=["tree","cluster","treemap","circlepack","partition","orbit"].includes(o),r=t?i||(Array.isArray(n)?void 0:n):void 0;if(t&&r)e.ingestHierarchy(r,[Ue,Ke]),e.buildScene([Ue,Ke]);else{const t=ct,o=Array.isArray(ut)?ut:[];(t.length>0||o.length>0)&&(e.ingestBounded(t,o,[Ue,Ke]),e.buildScene([Ue,Ke]))}}const t=e?.sceneNodes??[],r=e?.sceneEdges??[],s=e?.labels??[];return(0,Dd.jsxs)("div",{ref:Ge,className:"stream-network-frame"+(Z?" "+Z:""),role:"img","aria-label":je||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:U?"100%":Ve[0],height:K?"100%":Ve[1]},children:[(0,Dd.jsx)(fs,{summary:Pe}),(0,Dd.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ve[0],height:Ve[1],style:{position:"absolute",left:0,top:0},children:[Ze&&(0,Dd.jsx)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze}),(0,Dd.jsxs)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:[J&&(0,Dd.jsx)("rect",{x:0,y:0,width:Ue,height:Ke,fill:J}),r.map((e,t)=>function(e,t){switch(e.type){case"line":return(0,yi.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"ribbon":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"#999"),fillOpacity:o.style.fillOpacity,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-edge-"+t)}case"curved":{const o=e;return(0,yi.jsx)("path",{d:o.pathD,fill:vi(o.style.fill,"none"),stroke:o.style.stroke||"#999",strokeWidth:o.style.strokeWidth||1,opacity:o.style.opacity},"net-edge-"+t)}default:return null}}(e,t)).filter(Boolean),t.map((e,t)=>function(e,t){switch(e.type){case"circle":{const o=e;return(0,yi.jsx)("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-circle-"+t)}case"rect":{const o=e;return(0,yi.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-rect-"+t)}case"arc":{const o=e,r=(0,di.arc)().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(bi)||"";return(0,yi.jsx)("path",{d:r,transform:`translate(${o.cx},${o.cy})`,fill:vi(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-arc-"+t)}case"symbol":{const o=e,r=_t(o.symbolType,o.size,o.path);return(0,yi.jsx)("path",{d:r,transform:o.rotation?`translate(${o.cx},${o.cy}) rotate(${180*o.rotation/Math.PI})`:`translate(${o.cx},${o.cy})`,fill:o.style.fill?vi(o.style.fill):"none",stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity},"net-symbol-"+t)}case"glyph":return ki(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}(e,t)).filter(Boolean),s.map((e,t)=>function(e,t){return(0,yi.jsx)("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}(e,t)).filter(Boolean)]})]}),(0,Dd.jsx)(Xu,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:s,sceneNodes:t,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,foregroundGraphics:co(Qe,yo(kt.current?.customLayoutOverlays,He??null)),annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:0}),(0,Dd.jsx)(Zu,{marks:e?.customLayoutHtmlMarks,margin:Xe,selection:He??null})]})}const ko=kt.current;return(0,Dd.jsxs)("div",{ref:Ge,className:"stream-network-frame"+(Z?" "+Z:""),role:"group","aria-label":je||("string"==typeof ye?ye:"Network chart"),tabIndex:0,"aria-busy":Rt||void 0,style:{position:"relative",width:U?"100%":Ve[0],height:K?"100%":Ve[1],overflow:"visible"},onKeyDown:go,children:[Me&&(0,Dd.jsx)(gs,{tableId:tt}),Me&&(0,Dd.jsx)(ps,{nodes:ko?.sceneNodes??[],edges:ko?.sceneEdges??[],chartType:"Network chart",tableId:tt,chartTitle:"string"==typeof ye?ye:void 0}),(0,Dd.jsx)(fs,{summary:Pe}),(0,Dd.jsx)(ms,{hoverPoint:wt}),(0,Dd.jsxs)("div",{role:"img","aria-label":je||("string"==typeof ye?ye:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:ee?mo:void 0,onMouseLeave:ee?so:void 0,onClick:re||ne?uo:void 0,children:[Rt&&!1!==k&&(0,Dd.jsx)("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:ud(!0,Ve[0],Ve[1],k)}),Ze&&(0,Dd.jsx)("svg",{overflow:"visible",style:{position:"absolute",top:0,left:0,width:Ve[0],height:Ve[1],pointerEvents:"none",overflow:"visible"},children:(0,Dd.jsx)("g",{transform:`translate(${Xe.left},${Xe.top})`,children:Ze})}),(0,Dd.jsx)("canvas",{ref:yt,"aria-label":Zi(ko?.sceneNodes?.length??0,ko?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),(0,Dd.jsx)(Xu,{width:Ue,height:Ke,totalWidth:Ve[0],totalHeight:Ve[1],margin:Xe,labels:ko?.labels||[],sceneNodes:ko?.sceneNodes,title:ye,legend:ue,legendPosition:de,legendLayout:he,legendHoverBehavior:pe,legendClickBehavior:fe,legendHighlightedCategory:ge,legendIsolatedCategories:me,foregroundGraphics:co(Qe,yo(kt.current?.customLayoutOverlays,He??null)),annotations:ae,autoPlaceAnnotations:le,svgAnnotationRules:ce,annotationFrame:Mt}),(0,Dd.jsx)(Zu,{marks:ko?.customLayoutHtmlMarks,margin:Xe,selection:He??null}),(0,Dd.jsx)(vs,{active:ho.current>=0,hoverPoint:wt,margin:Xe,size:Ve,shape:po.current?.shape,width:po.current?.w,height:po.current?.h}),bo,Ae?.showBadge&&(0,Dd.jsx)(wr,{isStale:Pt,position:Ae.badgePosition})]})]})}));Wd.displayName="StreamNetworkFrame";var qd=Wd;function Yd(e){const{title:t,description:o,summary:r,accessibleTable:n,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),o&&(c.description=o),r&&(c.summary=r),void 0!==n&&(c.accessibleTable=n),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Gd(e){const{linkedHover:t,selection:o,onObservation:r,onClick:n,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:d,linkedHoverInClickPredicate:h=!0}=e,p={},f=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||r||n||s)&&(p.customHoverBehavior=u),d&&(l||(h?r||n||t:r||n)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||o))&&(p.customClickBehavior=d),null!=f&&(p.hoverRadius=f),p}function Vd(e){const{tooltip:t,defaultTooltipContent:o}=e;return{tooltipContent:!1===t?()=>null:Bs(t)||o}}var Xd=c(require("react")),Ud=require("react"),Kd=require("react"),Qd=require("react"),Zd=require("react/jsx-runtime"),Jd=(0,Qd.createContext)(null);function eh({colors:e,categories:t,colorScheme:o="category10",children:r}){const n=(0,Qd.useMemo)(()=>{if(e)return e;if(t){if(o&&"object"==typeof o&&!Array.isArray(o)){const e=o,r={};let n=0;for(const o of t)r[o]=We(e,o)??De[n++%De.length];return r}const e=Array.isArray(o)?o:Be[o]||De,r={};for(let o=0;t.length>o;o++)r[t[o]]=e[o%e.length];return r}return{}},[e,t,o]);return(0,Zd.jsx)(Jd.Provider,{value:n,children:r})}function th(){return(0,Qd.useContext)(Jd)}eh.displayName="CategoryColorProvider";var oh=require("react");function rh(e){const t=[];for(const[o,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[o]));else{const[e,n]=r.range;t.push(t=>{const r=t[o];return r>=e&&n>=r})}return e=>t.every(t=>t(e))}function nh(e,t){const o=[];for(const[r,n]of e.clauses)"crossfilter"===e.resolution&&r===t||o.push(rh(n));return 0===o.length?()=>!0:"intersect"===e.resolution?e=>o.every(t=>t(e)):e=>o.some(t=>t(e))}function ih(e,t){let o=e.get(t);return o||(o={name:t,resolution:"union",clauses:new Map},e.set(t,o)),o}function sh(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const o of e.values)if(!t.values.has(o))return!1;return!0}return!1}var[ah,lh]=q(e=>({selections:new Map,setClause(t,o){e(e=>{const r=e.selections.get(t),n=r?.clauses.get(o.clientId);if(n&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const o=Object.entries(e.fields);if(o.length!==function(e){let t=0;for(const o in e)t++;return t}(t.fields))return!1;for(const[e,r]of o){const o=t.fields[e];if(!o||!sh(r,o))return!1}return!0}(n,o))return{};const i=new Map(e.selections),s=ih(i,t),a=new Map(s.clauses);return a.set(o.clientId,o),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,o){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(o))return{};const n=new Map(e.selections),i=new Map(r.clauses);return i.delete(o),n.set(t,{...r,clauses:i}),{selections:n}})},setResolution(t,o){e(e=>{const r=e.selections.get(t);if(r?.resolution===o)return{};const n=new Map(e.selections),i=ih(n,t);return n.set(t,{...i,resolution:o}),{selections:n}})},clearSelection(t){e(e=>{const o=e.selections.get(t);if(!o||0===o.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...o,clauses:new Map}),{selections:r}})}})),[ch,uh]=q(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const o=e.observations;return o.push(t),o.length>e.maxObservations&&o.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}})),dh=require("react");function hh(e){const t=(0,dh.useId)(),o=e.clientId||t,{name:r}=e,n=lh(e=>e.selections.get(r)),i=lh(e=>e.setClause),s=lh(e=>e.clearClause),a=(0,dh.useMemo)(()=>!!n&&n.clauses.size>0,[n]);return{predicate:(0,dh.useMemo)(()=>n&&0!==n.clauses.size?nh(n,o):()=>!0,[n,o]),isActive:a,selectPoints:(0,dh.useCallback)(e=>{const t={};let n=!1;for(const[o,r]of Object.entries(e))t[o]={type:"point",values:new Set(r)},n=!0;n&&i(r,{clientId:o,type:"point",fields:t})},[o,r,i]),selectInterval:(0,dh.useCallback)(e=>{const t={};let n=!1;for(const[o,r]of Object.entries(e))t[o]={type:"interval",range:r},n=!0;n&&i(r,{clientId:o,type:"interval",fields:t})},[o,r,i]),clear:(0,dh.useCallback)(()=>{s(r,o)},[s,r,o]),clientId:o}}function ph(e,t){const o=(0,dh.useId)(),r=t||o,n=lh(e=>e.setClause),i=lh(e=>e.clearClause);return{selectPoints:(0,dh.useCallback)(t=>{const o={};let i=!1;for(const[e,r]of Object.entries(t))o[e]={type:"point",values:new Set(r)},i=!0;i&&n(e,{clientId:r,type:"point",fields:o})},[e,r,n]),clear:(0,dh.useCallback)(()=>i(e,r),[e,r,i]),clientId:r}}function fh(e){const t=e.name||"hover",{fields:o}=e,{predicate:r,isActive:n,selectPoints:i,clear:s}=hh({name:t,fields:o});return{onHover:(0,dh.useCallback)(e=>{if(!e)return void s();const t={};for(const r of o){const o=e[r];void 0!==o&&(t[r]=[o])}yh(t)&&i(t)},[o,i,s,t]),predicate:r,isActive:n}}function gh(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function mh(e){const{name:t,xField:o,yField:r}=e,{predicate:n,isActive:i,selectInterval:s,clear:a}=hh({name:t,fields:[o,r].filter(Boolean)}),l=o&&r?"xyBrush":o?"xBrush":"yBrush",c=(0,dh.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&gh(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&gh(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),yh(t)&&s(t)},[l,o,r,s,a]);return{brushInteraction:(0,dh.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:n,isActive:i,clear:a}}function yh(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function bh(e,t,o){const r=lh(e=>e.selections.get(t));return(0,dh.useMemo)(()=>{if(!r||0===r.clauses.size)return e;const t=nh(r,o);return e.filter(t)},[e,r,o])}var vh=require("react");function xh(e={}){const{limit:t=50,types:o,chartId:r}=e,n=uh(e=>e.version),i=uh(e=>e.observations),s=uh(e=>e.clearObservations),a=(0,vh.useMemo)(()=>{let e=i;if(o&&o.length>0){const t=new Set(o);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[i,o,r,t,n]);return{observations:a,latest:a.length>0?a[a.length-1]:null,clear:s}}var kh=require("react/jsx-runtime"),wh=(0,oh.createContext)(!1),Sh=(0,oh.createContext)(!1);function Ah(){return(0,oh.useContext)(Sh)}var Ch=(0,oh.createContext)(null),Mh="undefined"==typeof window?oh.useEffect:oh.useLayoutEffect;function jh(e){const t=new Set,o=[];for(const r of e)t.has(r)||(t.add(r),o.push(r));return o}function Ph(e,t){if(e.length!==t.length)return!1;for(let o=0;e.length>o;o++)if(e[o]!==t[o])return!1;return!0}function _h(e){const t=(0,oh.useContext)(Ch),o=(0,oh.useId)(),r=jh(e),n=(0,oh.useRef)([]);Ph(n.current,r)||(n.current=r);const i=n.current;Mh(()=>{if(t)return()=>t.unregisterCategories(o)},[t,o]),Mh(()=>{t&&t.registerCategories(o,i)},[t,o,i])}var Lh="__linked-legend-isolate__",Rh="__linked-legend-highlight__";function Th({categoryColors:e,interaction:t,selectionName:o,field:r}){const n=Object.entries(e),i=n.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:n.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=hh({name:o,fields:[r],clientId:Lh}),{selectPoints:c,clear:u}=hh({name:o,fields:[r],clientId:Rh}),d=lh(e=>e.selections.get(o)),{isolatedCategories:h,highlightedCategory:p}=(0,oh.useMemo)(()=>{const e=new Set;let t=null;const o=d?.clauses.get(Lh)?.fields[r];if("point"===o?.type)for(const t of o.values)e.add(t+"");const n=d?.clauses.get(Rh)?.fields[r];if("point"===n?.type){const e=n.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,r]),f=(0,oh.useCallback)(e=>{"highlight"===t&&(e?c({[r]:[e.label]}):u())},[t,r,c,u]),g=(0,oh.useCallback)(e=>{if("isolate"!==t)return;const o=new Set(h);o.has(e.label)?o.delete(e.label):o.add(e.label),0===o.size||o.size===i.length?l():a({[r]:Array.from(o)})},[t,r,h,i.length,a,l]),[m,[y]]=Ys([0,0],!0,!1),b=(0,oh.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let o=0,r=1;for(const n of e){const e=26+7*n.length;o>0&&o+e>t&&(r++,o=0),o+=e}return r}(n.map(([e])=>e),y),[n,y]);return 0===n.length?null:(0,kh.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,kh.jsx)("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:(0,kh.jsx)(Dr,{legendGroups:s,title:!1,orientation:"horizontal",width:y,height:20,customHoverBehavior:"highlight"===t?f:void 0,customClickBehavior:"isolate"===t?g:void 0,highlightedCategory:p,isolatedCategories:h})})})}function Ih({children:e,selections:t,showLegend:o,legendPosition:r="top",legendInteraction:n="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,oh.useMemo)(()=>{if(!t)return;const e=new Map;for(const[o,r]of Object.entries(t))r.resolution&&e.set(o,{name:o,resolution:r.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=th(),[c,u]=(0,oh.useState)({}),d=(0,oh.useRef)({}),h=(0,oh.useMemo)(()=>({registerCategories:(e,t)=>{const o=jh(t);u(t=>Ph(t[e]??[],o)?t:{...t,[e]:o})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const o={...t};return delete o[e],o})}}),[]),p=(0,oh.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const o of t)e.push(o);return jh(e)},[c]),f=(0,oh.useMemo)(()=>{const e=l??{},t=d.current;let o=Object.keys(e).length+Object.keys(t).length;for(const r of p)e[r]||t[r]||(t[r]=De[o%De.length],o++);const r={...e};for(const o of p)r[o]=e[o]??t[o];return r},[l,p]),g=void 0===o||o,m=Object.keys(f).length>0;return(0,kh.jsx)(ah,{initialState:a,children:(0,kh.jsx)(ch,{children:(0,kh.jsx)(Sh.Provider,{value:!0,children:(0,kh.jsx)(Ch.Provider,{value:h,children:(0,kh.jsx)(eh,{colors:f,children:(0,kh.jsxs)(wh.Provider,{value:g&&m,children:[g&&"top"===r&&(0,kh.jsx)(Th,{categoryColors:f,interaction:n,selectionName:i,field:s}),e,g&&"bottom"===r&&(0,kh.jsx)(Th,{categoryColors:f,interaction:n,selectionName:i,field:s})]})})})})})})}function $h({data:e,colorBy:t,colorScale:o,getColor:r,strokeColor:n,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",o={fill:t,stroke:t};return void 0!==n&&(o.stroke=n),void 0!==i&&(o.strokeWidth=i),o},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((n,i)=>{const s=e.find("function"==typeof t?e=>t(e)===n:e=>e[t]===n),a=s?r(s,t,o):o?o(n):Ee[i%Ee.length];return{label:n+"",color:a}}),label:""}]}}function Nh(e){return e?"string"==typeof e?{name:e}:e:null}var Fh=.5;function Bh(e,t,o){return t?(r,...n)=>{const i={...e(r,...n)};if(t.isActive)if(t.predicate(r))o?.selectedStyle&&Object.assign(i,o.selectedStyle);else{const e=o?.unselectedOpacity??Fh;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,o?.unselectedStyle&&Object.assign(i,o.unselectedStyle)}return i}:e}var Dh=c(require("react"));function Eh(e,t=":root"){const o=[];return o.push(` --semiotic-bg: ${e.colors.background};`),o.push(` --semiotic-text: ${e.colors.text};`),o.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),o.push(` --semiotic-grid: ${e.colors.grid};`),o.push(` --semiotic-border: ${e.colors.border};`),o.push(` --semiotic-primary: ${e.colors.primary};`),o.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&o.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&o.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&o.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&o.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&o.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&o.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&o.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&o.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&o.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&o.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&o.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&o.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&o.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&o.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&o.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&o.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),o.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),o.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&o.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&o.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&o.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&o.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&o.push(` --semiotic-info: ${e.colors.info};`),`${t} {\n${o.join("\n")}\n}`}function zh(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var Hh=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],Oh={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},Wh={light:U,dark:K,"high-contrast":Q,pastels:{mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},"pastels-dark":{mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},"bi-tool":{mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},"bi-tool-dark":{mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},italian:{mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},"italian-dark":{mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},tufte:{mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},"tufte-dark":{mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},journalist:{mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},"journalist-dark":{mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},playful:{mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},"playful-dark":{mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},carbon:{mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},"carbon-dark":{mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"}};function qh(e){return Wh[e]}var Yh=require("react/jsx-runtime"),Gh=Dh.createContext(void 0),Vh="undefined"==typeof window?Dh.useEffect:Dh.useLayoutEffect;function Xh(e){if("string"!=typeof e)return e;if("light"===e||"dark"===e||"high-contrast"===e)return e;return qh(e)||(void 0!==console&&console.warn(`[ThemeProvider] Unknown theme preset "${e}". Falling back to light theme.`),"light")}function Uh({theme:e}){const t=ee(e=>e.setTheme),o=ee(e=>e.theme),r=Dh.useRef(o);r.current=o;const n=Dh.useRef(null);Dh.useEffect(()=>{if(void 0!==e)return;if("undefined"==typeof window||!window.matchMedia)return;const o=window.matchMedia("(forced-colors: active)");return o.matches&&(n.current=r.current===Q?U:r.current,t("high-contrast")),Ws(o,e=>{e.matches?(n.current=r.current===Q?n.current??U:r.current,t("high-contrast")):(function(e,t){e(t===U?"light":t===K?"dark":t===Q?"high-contrast":t)}(t,n.current??U),n.current=null)})},[e,t]);const i=Dh.useRef(!1);return Vh(()=>{i.current?void 0!==e&&t(Xh(e)):i.current=!0},[e,t]),null}function Kh({children:e}){const t=ee(e=>e.theme),o={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-cell-border":t.colors.cellBorder||t.colors.border,"--semiotic-primary":t.colors.primary,"--semiotic-font-family":t.typography.fontFamily,...t.colors.focus?{"--semiotic-focus":t.colors.focus}:{},...t.tooltip?.background?{"--semiotic-tooltip-bg":t.tooltip.background}:{},...t.tooltip?.text?{"--semiotic-tooltip-text":t.tooltip.text}:{},...t.tooltip?.borderRadius?{"--semiotic-tooltip-radius":t.tooltip.borderRadius}:{},...t.tooltip?.fontSize?{"--semiotic-tooltip-font-size":t.tooltip.fontSize}:{},...t.tooltip?.shadow?{"--semiotic-tooltip-shadow":t.tooltip.shadow}:{},...t.borderRadius?{"--semiotic-border-radius":t.borderRadius}:{},...t.colors.selection?{"--semiotic-selection-color":t.colors.selection}:{},...null!=t.colors.selectionOpacity?{"--semiotic-selection-opacity":t.colors.selectionOpacity+""}:{},...t.colors.diverging?{"--semiotic-diverging":t.colors.diverging}:{},...t.colors.annotation?{"--semiotic-annotation-color":t.colors.annotation}:{},...null!=t.typography.legendSize?{"--semiotic-legend-font-size":t.typography.legendSize+"px"}:{},...null!=t.typography.titleFontSize?{"--semiotic-title-font-size":t.typography.titleFontSize+"px"}:{},...null!=t.typography.tickFontFamily?{"--semiotic-tick-font-family":t.typography.tickFontFamily}:{},...null!=t.typography.tickSize?{"--semiotic-tick-font-size":t.typography.tickSize+"px"}:{},...null!=t.typography.labelSize?{"--semiotic-axis-label-font-size":t.typography.labelSize+"px"}:{},"--semiotic-secondary":t.colors.secondary||t.colors.primary,"--semiotic-surface":t.colors.surface||t.colors.background,...t.colors.success?{"--semiotic-success":t.colors.success}:{},...t.colors.danger?{"--semiotic-danger":t.colors.danger}:{},...t.colors.warning?{"--semiotic-warning":t.colors.warning}:{},...t.colors.error?{"--semiotic-error":t.colors.error}:{},...t.colors.info?{"--semiotic-info":t.colors.info}:{}},r=Dh.useContext(Gh),n={};return r&&(n["data-semiotic-theme"]=r),(0,Yh.jsx)("div",{style:o,...n,children:e})}function Qh({theme:e,children:t}){const o="string"==typeof e&&qh(e)?e:void 0,r=Dh.useMemo(()=>function(e){return void 0!==e?Z(U,Xh(e)):"undefined"!=typeof window&&window.matchMedia&&window.matchMedia("(forced-colors: active)").matches?Q:U}(e),[e]);return(0,Yh.jsx)(J,{initialState:{theme:r},children:(0,Yh.jsxs)(Gh.Provider,{value:o,children:[(0,Yh.jsx)(Uh,{theme:e}),(0,Yh.jsx)(Kh,{children:t})]})})}function Zh(){return ee(e=>e.theme)}function Jh(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function ep(e,t){const{when:o}=e,r=t.width,n=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof o.minWidth&&o.minWidth>r||"number"==typeof o.maxWidth&&r>o.maxWidth||"number"==typeof o.minHeight&&("number"!=typeof n||o.minHeight>n)||"number"==typeof o.maxHeight&&("number"!=typeof n||n>o.maxHeight)||"number"==typeof o.minAspectRatio&&("number"!=typeof i||o.minAspectRatio>i)||"number"==typeof o.maxAspectRatio&&("number"!=typeof i||i>o.maxAspectRatio)||o.orientation&&s!==o.orientation)}function tp(e,t,o=e.responsiveRules){if(!Array.isArray(o)||0===o.length)return{props:e,matches:[]};const r=o.map((e,t)=>({rule:e,index:t})).filter(e=>ep(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const o={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])Jh(e[r])&&Jh(t[r])&&(o[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(o.className=`${e.className} ${t.className}`),o}(e,t.rule.transform),e),matches:r}}var op="#007bff";function rp(e,t,o){const r=e.xValue??t?.[o];if(null==r)return null;const n=Number(r);return Number.isFinite(n)?n:null}function np(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function ip(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var sp=44,ap={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:sp,snap:"nearestDatum",brushHandleSize:sp,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function lp(e,t={}){const o=t.mobileSemantics?.interaction,r="number"==typeof o?.targetSize?o.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,n="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!o||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!n&&!i)return ap;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??sp,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??sp,standardControls:a.standardControls??!1}}function cp(){const e=Zh(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function up(e,t,o,r,n){if(e)return e;if(o&&"object"==typeof o&&!Array.isArray(o)){const e=We(o,r);if(e)return e}let i;if(Array.isArray(o))i=o;else if(t&&t.length>0)i=t;else if("string"==typeof o){const e=Be[o];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(n.has(r)||n.set(r,n.size),i[n.get(r)%i.length]):i[0]:op}function dp(e,t,o){const r=th(),n=cp();return(0,Kd.useMemo)(()=>{if(!t)return;const i=r??void 0,s=o??(n&&n.length>0?n:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const o=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&ip(i)){const e=qe(o.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return qe(o.map(e=>({_cat:e})),"_cat",s)}if(i&&ip(i)){const o=qe(e,t,s);return e=>i[e]||o(e)}return qe(e,t,s)}if(i&&ip(i)){const e=qe([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,o,r,n])}function hp(e,t,o){return(0,Kd.useMemo)(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const r=[...e],n="function"==typeof(i=o)?i:e=>e[i];var i;return r.sort("asc"===t?(e,t)=>n(e)-n(t):(e,t)=>n(t)-n(e))},[e,t,o])}function pp({selection:e,linkedHover:t,fallbackFields:o=[],unwrapData:r=!1,onObservation:n,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=(0,Kd.useId)(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,o),p="series"===h?.mode?[h.seriesField||c||o[0]].filter(e=>!!e):h?.fields||o||[],f=hh({name:e?.name||"__unused__",fields:p}),g=fh({name:h?.name||"hover",fields:p}),m=uh(e=>e.pushObservation),y=e?{isActive:f.isActive,predicate:f.predicate}:null,[b,v]=(0,Kd.useState)(null),x=(0,Kd.useRef)(!1),k=c||o[0],w=(0,Kd.useMemo)(()=>{if(!l||null==b||!k)return null;const e=b,t=k;return{isActive:!0,predicate:o=>("string"==typeof o[t]?o[t]:(o[t]??"")+"")===e}},[l,b,k]),S=(0,Kd.useCallback)(e=>{const o=!e&&x.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const o=rp(e,t,h.xField);null!=o&&function(e,t,o){const r=Wn.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===o||(Wn={positions:new Map(Wn.positions).set(e,{xValue:t,sourceId:o})},Yn())}(h.name||"hover",o,d)}"x-position"!==h?.mode&&g.onHover(t)}else"x-position"!==h?.mode||o||Gn(h.name||"hover",d),"x-position"===h?.mode||o||g.onHover(null);if(l&&k)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const o=t?.[k];v(null!=o?o+"":null)}else o||v(null);if(n||m){const t={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(e){const o=np(e),r={...t,type:"hover",datum:o||{},x:e.x??0,y:e.y??0};n&&n(r),m&&m(r)}else{const e={...t,type:"hover-end"};n&&n(e),m&&m(e)}}},[t,g,h,d,n,i,s,m,l,k,u]),A=(0,Kd.useCallback)((o=!0)=>{x.current=!1,t&&"x-position"!==h?.mode&&g.onHover(null),e&&u?.tapToSelect&&f.clear(),o&&l&&v(null),"x-position"===h?.mode&&(Vn(h.name||"hover",d),Gn(h.name||"hover",d))},[t,h,g,e,u,f,l,d]),C=(0,Kd.useCallback)(o=>{const r=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),c=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&o){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]);const t=rp(o,e,h.xField);null!=t&&function(e,t,o){const r=Wn.positions.get(e);if(r?.locked){const t=new Map(Wn.positions);return t.delete(e),Wn={positions:t},Yn(),!1}Wn={positions:new Map(Wn.positions).set(e,{xValue:t,sourceId:o,locked:!0})},Yn()}(h.name||"hover",t,d)}if(r)if(o){x.current=!0;const r=np(o);if(t&&"x-position"!==h?.mode&&g.onHover(r),e&&u?.tapToSelect&&p.length>0){const e={};for(const t of p){const o=r[t];void 0!==o&&(e[t]=[o])}ip(e)&&f.selectPoints(e)}if(l&&k){const e=r?.[k];v(null!=e?e+"":null)}}else c&&A();if(o||c){if(o&&a){let e=o.data||o.datum||o;Array.isArray(e)&&(e=e[0]),a(e,{x:o.x??0,y:o.y??0})}if(n||m){const e={timestamp:Date.now(),chartType:i||"unknown",chartId:s};if(o){const t=np(o),r={...e,type:"click",datum:t||{},x:o.x??0,y:o.y??0};n&&n(r),m&&m(r)}else{const t={...e,type:"click-end"};n&&n(t),m&&m(t)}}}},[a,n,m,i,s,h,d,u,t,g,e,f,p,l,k,A]);return(0,Kd.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&x.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),(0,Kd.useEffect)(()=>()=>{x.current&&A(!1)},[A]),(0,Kd.useEffect)(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{Vn(e,d),Gn(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:y,hoverSelectionHook:w,customHoverBehavior:S,customClickBehavior:C,crosshairSourceId:d}}function fp(e,t){const o="object"==typeof e&&null!==e?e:void 0;if("x-position"===o?.mode)return{linkedCrosshairName:o.name||"hover",linkedCrosshairSourceId:t}}function gp({data:e,colorBy:t,colorScale:o,showLegend:r,legendPosition:n="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,oh.useContext)(wh),c=null!==(0,oh.useContext)(Ch),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=(0,Kd.useMemo)(()=>{if(!d)return[];if(void 0!==a)return a;const o=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&o.add(e+"")}return Array.from(o)},[a,t,e,d]);_h(c&&t?h:[]);const p=(0,Kd.useMemo)(()=>{if(!u||!t)return;const r=$h({data:e,colorBy:t,colorScale:o,getColor:Oe,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,o,h]),f=(0,Kd.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const o=e[t];return"number"==typeof o?o:s[t]},o={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return p&&("right"===n&&!r("right")&&110>o.right?o.right=110:"left"===n&&!r("left")&&110>o.left?o.left=110:"top"===n&&!r("top")&&50>o.top?o.top=50:"bottom"===n&&!r("bottom")&&80>o.bottom&&(o.bottom=80)),o},[s,i,p,n]);return{legend:p,margin:f,legendPosition:n}}function mp(e,t,o){const[r,n]=(0,Kd.useState)(null),[i,s]=(0,Kd.useState)(new Set),a=(0,Kd.useMemo)(()=>new Set,[]),l=(0,Kd.useCallback)(t=>{"highlight"===e&&n(t?t.label:null)},[e]),c=(0,Kd.useCallback)(t=>{"isolate"===e&&s(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===o.length?new Set:r})},[e,o.length]),u=(0,Kd.useMemo)(()=>{if(!e||"none"===e||!t)return null;const o="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(o?e[o]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=o?e[o]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var yp={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function bp(e,t,o){const r=yp[e||"primary"],n=e&&"primary"!==e||!o?.width?r.width:o.width,i=e&&"primary"!==e||!o?.height?r.height:o.height,s=tp({...t,mode:e},{width:t.width??n,height:t.height??i}).props,a=s.mode||e,l=yp[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!o?.width?l.width:o.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!o?.height?l.height:o.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:vp(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:lp(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function vp(e,t,o){if(!1!==t)return e;const r={...e};return"horizontal"===o?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function xp(e,t){const o=e.length,r=t.length,n=Array(r+1);for(let e=0;r>=e;e++)n[e]=e;for(let i=1;o>=i;i++){let o=n[0];n[0]=i;for(let s=1;r>=s;s++){const r=n[s];n[s]=e[i-1]===t[s-1]?o:1+Math.min(o,n[s],n[s-1]),o=r}}return n[r]}function kp(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}function wp(e,t){if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(function(e,t,o=3){let r,n=o+1;for(const o of t){const t=xp(e.toLowerCase(),o.toLowerCase());n>t&&(n=t,r=o)}return n>o?void 0:r}(e,t,3)??null)}function Sp({componentName:e,data:t,accessors:o,requiredProps:r}){if(r)for(const[t,o]of Object.entries(r))if(null==o)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(o){const r=kp(t).find(e=>e&&"object"==typeof e);if(r){const t=Object.keys(r);for(const[n,i]of Object.entries(o))if(i&&"string"==typeof i&&!(i in r)){const o=wp(i,t),r=o?` Try ${n}="${o}".`:"";return`${e}: ${n} "${i}" not found in data. Available fields: ${t.join(", ")}.${r}`}}}return null}function Ap({componentName:e,data:t,dataLabel:o="data"}){return null==t?`${e}: No ${o} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(t)?`${e}: ${o} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function Cp({componentName:e,nodes:t,edges:o,nodesRequired:r=!1,edgesRequired:n=!0,accessors:i}){if(null==t&&null==o)return null;if(n&&(!o||!Array.isArray(o)||0===o.length))return e+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!t||!Array.isArray(t)||0===t.length))return e+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&t&&t.length>0){const o=kp(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,n]of Object.entries(i))if(n&&"string"==typeof n&&!(n in o)){const o=wp(n,t),i=o?` Try ${r}="${o}".`:"";return`${e}: ${r} "${n}" not found in node data. Available fields: ${t.join(", ")}.${i}`}}}return null}var Mp=require("react"),jp=require("react");function Pp(e){const t=ee(e=>e.theme.colors.selectionOpacity);return(0,jp.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function _p(e){const{data:t,rawData:o,colorBy:r,colorScheme:n,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:d,chartType:h,chartId:p,showLegend:f,userMargin:g,marginDefaults:m,onClick:y,hoverHighlight:b,mobileInteraction:v,mobileSemantics:x,loading:k,loadingContent:w,emptyContent:S,width:A,height:C}=e,M=void 0===o,j=(0,Mp.useMemo)(()=>z(t),[t]),[P,_]=(0,Mp.useState)([]),L=(0,Mp.useCallback)(e=>{_(t=>t.length===e.length&&t.every((t,o)=>t===e[o])?t:e)},[]),R="string"==typeof e.colorBy?e.colorBy:void 0,T=(0,Mp.useMemo)(()=>lp(v,{width:A,mobileSemantics:x}),[v,A,x]),{activeSelectionHook:I,hoverSelectionHook:$,customHoverBehavior:N,customClickBehavior:F,crosshairSourceId:B}=pp({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:d,chartType:h,chartId:p,onClick:y,hoverHighlight:b,colorByField:R,mobileInteraction:T}),D=fp(l,B),E=dp(j,r,n),H=(0,Mp.useMemo)(()=>{if(!r)return[];const e=new Set;for(const t of j){const o="function"==typeof r?r(t):t[r];null!=o&&e.add(o+"")}return Array.from(e)},[j,r]),O=(0,Mp.useMemo)(()=>M&&P.length>0?P:H,[M,P,H]),W=mp(i,r,O),q=(0,Mp.useMemo)(()=>$||(W.legendSelectionHook?W.legendSelectionHook:I),[$,W.legendSelectionHook,I]),Y=Pp(a),G=cp(),V=th(),X=(0,Mp.useMemo)(()=>{if(E)return E;if(!r||0===O.length)return;const e=Array.isArray(n)&&n.length>0||"string"==typeof n&&n.length>0?n:G&&G.length>0?G:Ee,t="__streamCat",o=qe(O.map(e=>({[t]:e})),t,e);return e=>V?.[e]||o(e)||"#999"},[E,r,O,n,G,V]),{legend:U,margin:K,legendPosition:Q}=gp({data:j,colorBy:r,colorScale:X,showLegend:f,legendPosition:s,userMargin:g,defaults:m,categories:O}),Z=(0,Mp.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=W.onLegendHover,e.legendClickBehavior=W.onLegendClick,e.legendHighlightedCategory=W.highlightedCategory,e.legendIsolatedCategories=W.isolatedCategories),M&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=L),e},[U,Q,i,W.onLegendHover,W.onLegendClick,W.highlightedCategory,W.isolatedCategories,M,r,L]),J=Array.isArray(o)?z(o):o,ee=ud(k,A,C,w),te=ee?null:cd(J,A,C,S);return{data:j,colorScale:E,allCategories:O,legendState:W,effectiveSelectionHook:q,activeSelectionHook:I,customHoverBehavior:N,customClickBehavior:F,mobileInteraction:T,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:Y}}var Lp=require("react");function Rp(e,t){const{variant:o,frameRef:r,overrides:n,deps:i}=t;(0,Lp.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,o)=>e.current?.update(t,o)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const o=Array.isArray(t)?t:[t],r=e.current?.getTopology()?.nodes??[],n=[];for(const t of o){const o=r.find(e=>e.id===t);o&&n.push({...o.data??{},id:t}),e.current?.removeNode(t)}return n},update:(t,o)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const r=e.current?.updateNode(t,o);return r?[{...r,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,o)=>{const r=e.current?.removePoint(t)??[];for(const t of r)e.current?.push(o(t));return r},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const o=t;return{push:e=>o.current?.pushLine(e),pushMany:e=>o.current?.pushManyLines(e),remove:e=>o.current?.removeLine(e)??[],update:(e,t)=>{const r=o.current?.removeLine(e)??[];for(const e of r)o.current?.pushLine(t(e));return r},clear:()=>o.current?.clear(),getData:()=>o.current?.getLines()??[],getCustomLayout:()=>o.current?.getCustomLayout?.()??null,getLayoutFailure:()=>o.current?.getLayoutFailure?.()??null}}(o,r);return{...e,...n}},i??[])}var Tp=require("react");function Ip(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??(()=>({}));const o={};return void 0!==t.stroke&&(o.stroke=t.stroke),void 0!==t.strokeWidth&&(o.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(o.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...o}):(...e)=>({...o})}function $p(e){const{colorBy:t,colorScale:o,color:r,pointRadius:n=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:p,colorDatumAccessor:f}=e,g=(0,Tp.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(o){const r=f?f(e):e;u.fill=Oe(r,t,o)}}else u.fill=a?a(e):r||op;return void 0===u.r&&(u.r=i?i(e):n),u},[t,o,r,n,i,s,a,l,f]),m=(0,Tp.useMemo)(()=>Ip(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return(0,Tp.useMemo)(()=>Bh(m,h??null,p),[m,h,p])}var Np=require("react");function Fp(e){const{accessor:t,data:o,isPushMode:r}=e,n=(0,Np.useRef)(null),[i,s]=(0,Np.useState)(0),a=(0,Np.useCallback)(e=>{if(!r||!t)return;let o=!1;for(const r of e){const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(n.current?(n.current[0]>i&&(n.current[0]=i,o=!0),i>n.current[1]&&(n.current[1]=i,o=!0)):(n.current=[i,i],o=!0))}o&&s(e=>e+1)},[r,t]),l=(0,Np.useCallback)(()=>{r&&(n.current=null,s(e=>e+1))},[r]);return{domain:(0,Np.useMemo)(()=>{if(r)return n.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const r="number"==typeof o?o:Number(o);Number.isFinite(r)&&(i>r&&(i=r),r>s&&(s=r))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[o,t,r,i]),trackPushed:a,reset:l}}function Bp(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Dp=require("react"),Ep="__forecastSegment",zp=null;async function Hp(){return zp||(zp=await Promise.resolve().then(()=>(C(),b))),zp}var Op="__semiotic_resolvedX",Wp="__semiotic_resolvedY";function qp(e){const{data:t,xAccessor:o,yAccessor:r,forecast:n,anomaly:i,groupBy:s}=e,a="string"==typeof o?o:Op,l="string"==typeof r?r:Wp,c=(0,Dp.useMemo)(()=>{if(!n&&!i)return t;const e="function"==typeof o,s="function"==typeof r;return e||s?t.map(t=>{const n={...t};return e&&(n[Op]=o(t)),s&&(n[Wp]=r(t)),n}):t},[t,n,i,o,r]),[u,d]=(0,Dp.useState)(null),[h,p]=(0,Dp.useState)([]),f=(0,Dp.useRef)(n),g=(0,Dp.useRef)(i);return(0,Dp.useEffect)(()=>{if(!n&&!i)return void((f.current||g.current)&&(d(null),p([]),f.current=n,g.current=i));let e=!1;const t=n!==f.current||i!==g.current;if(f.current=n,g.current=i,t&&(d(null),p([])),n){const t=s&&"string"==typeof s&&"object"==typeof n?{...n,_groupBy:s}:n;(async function(...e){return(await Hp()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(d(t),p(t.annotations))}).catch(()=>{e||(d(null),p([]))})}else i&&async function(...e){return(await Hp()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(d(null),p(t))}).catch(()=>{e||p([])});return()=>{e=!0}},[c,n,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:h,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var Yp=require("react/jsx-runtime"),Gp=(0,Ud.forwardRef)(function(e,t){const o=(0,Ud.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:d,yScaleType:h,colorBy:p,colorScheme:f,sizeBy:g,sizeRange:m=[3,15],symbolBy:y,symbolMap:b,pointRadius:v=5,pointOpacity:x=.8,tooltip:k,marginalGraphics:w,pointIdAccessor:S,annotations:A,regression:C,forecast:M,anomaly:j,xExtent:P,yExtent:_,frameProps:L={},selection:R,linkedHover:T,linkedBrush:I,onObservation:$,onClick:N,hoverHighlight:F,chartId:B,loading:D,loadingContent:E,emptyContent:H,legendInteraction:O,legendPosition:W,color:q,stroke:Y,strokeWidth:G,opacity:V}=e,{width:X,height:U,enableHover:K,showGrid:Q,showLegend:Z,title:J,description:ee,summary:te,accessibleTable:oe,xLabel:re,yLabel:ne}=r,ie=(0,Ud.useMemo)(()=>z(n),[n]),se=void 0===n,{domain:ae,trackPushed:le,reset:ce}=Fp({accessor:g,data:ie,isPushMode:se}),ue=(0,Ud.useCallback)(e=>{le([e]),o.current?.push(e)},[le]),de=(0,Ud.useCallback)(e=>{le(e),o.current?.pushMany(e)},[le]);Rp(t,{variant:"xy",frameRef:o,overrides:{push:ue,pushMany:de,clear:()=>{ce(),o.current?.clear()}},deps:[ue,de,ce]});const he=_p({data:ie,rawData:n,colorBy:p,colorScheme:f,legendInteraction:O,legendPosition:W,selection:R,linkedHover:T,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:$,onClick:N,hoverHighlight:F,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"Scatterplot",chartId:B,showLegend:Z,userMargin:i,marginDefaults:r.marginDefaults,loading:D,loadingContent:E,emptyContent:H,width:X,height:U}),pe=Nh(I),fe=mh({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),ge=pe?"xyBrush"===fe.brushInteraction.brush?"xy":"xBrush"===fe.brushInteraction.brush?"x":"y":void 0,me=Xd.useRef(fe.brushInteraction);me.current=fe.brushInteraction;const ye=(0,Ud.useCallback)(e=>{const t=me.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);dd("Scatterplot",ie,"xAccessor",c),dd("Scatterplot",ie,"yAccessor",u);const be=(0,Ud.useMemo)(()=>g?ae??[0,1]:void 0,[g,ae]),ve=(0,Ud.useMemo)(()=>g?e=>Ye(e,g,m,be):void 0,[g,m,be]),xe=$p({colorBy:p,colorScale:he.colorScale,color:q,pointRadius:v,fillOpacity:x,radiusFn:ve,stroke:Y,strokeWidth:G,opacity:V,effectiveSelectionHook:he.effectiveSelectionHook,resolvedSelection:he.resolvedSelection}),ke=(0,Ud.useMemo)(()=>za([{label:re||Na(c),accessor:c,role:"x",format:a},{label:ne||Na(u),accessor:u,role:"y",format:l},...p?[{label:Na(p),accessor:p,role:"color"}]:[],...g?[{label:Na(g),accessor:g,role:"size"}]:[]]),[c,u,re,ne,p,g,a,l]),{effectiveData:we,statisticalAnnotations:Se}=qp({data:ie,xAccessor:c,yAccessor:u,forecast:M,anomaly:j}),Ae=(0,Ud.useMemo)(()=>{const e=Bp(C);return e||0!==Se.length?[...e?[e]:[],...A||[],...Se]:A},[C,A,Se]);if(he.earlyReturn)return he.earlyReturn;const Ce=Sp({componentName:"Scatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}});if(Ce)return(0,Yp.jsx)(td,{componentName:"Scatterplot",message:Ce,width:X,height:U});const Me={chartType:"scatter",...null!=n&&{data:we},xAccessor:c,yAccessor:u,xScaleType:d,yScaleType:h,colorAccessor:p||void 0,sizeAccessor:g||void 0,...y&&{symbolAccessor:y},...b&&{symbolMap:b},sizeRange:m,pointStyle:xe,colorScheme:f,size:[X,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:r.showAxes,xLabel:re,yLabel:ne,xFormat:a,yFormat:l,enableHover:K,showGrid:Q,...he.legendBehaviorProps,...Yd({title:J,description:ee,summary:te,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:k,defaultTooltipContent:ke}),...Gd({linkedHover:T,selection:R,onObservation:$,onClick:N,hoverHighlight:F,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...w&&{marginalGraphics:w},...S&&{pointIdAccessor:S},...Ae&&Ae.length>0&&{annotations:Ae},...P&&{xExtent:P},..._&&{yExtent:_},...pe&&{brush:{dimension:ge},onBrush:ye},...he.crosshairProps,...L};return(0,Yp.jsx)(sd,{componentName:"Scatterplot",width:X,height:U,children:(0,Yp.jsx)(Ka,{ref:o,...Me})})});Gp.displayName="Scatterplot";var Vp=require("react"),Xp=require("react/jsx-runtime");function Up(e,t){return we(1===t?.5:e/(t-1))}var Kp=(0,Vp.forwardRef)(function(e,t){const o=(0,Vp.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:d,orderLabel:h,pointRadius:p=4,tooltip:f,pointIdAccessor:g,annotations:m,regression:y,forecast:b,anomaly:v,xExtent:x,yExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,stroke:I,strokeWidth:$,opacity:N}=e,{width:F,height:B,enableHover:D,showGrid:E,title:z,description:H,summary:O,accessibleTable:W,xLabel:q,yLabel:Y}=r,G=n||[],{safeData:V,orderMap:X}=(0,Vp.useMemo)(()=>{const e="function"==typeof c?c:e=>e[c],t="function"==typeof u?u:e=>e[u];let o=G;if(d&&G.length>0){const e="function"==typeof d?d:e=>e[d];o=[...G].sort((t,o)=>{const r=e(t),n=e(o);return(r instanceof Date?r.getTime():+r)-(n instanceof Date?n.getTime():+n)})}const r=new WeakMap;let n=0;for(const r of o){const o=e(r),i=t(r);null!=o&&null!=i&&isFinite(o)&&isFinite(i)&&n++}let i=0;for(const s of o){const o=e(s),a=t(s);null!=o&&null!=a&&isFinite(o)&&isFinite(a)&&r.set(s,{idx:i++,total:n})}return{safeData:o,orderMap:r}},[G,d,c,u]);dd("ConnectedScatterplot",V,"xAccessor",c),dd("ConnectedScatterplot",V,"yAccessor",u);const U=_p({data:V,rawData:n,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:A,fallbackFields:[],unwrapData:!1,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ConnectedScatterplot",chartId:P,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:_,loadingContent:L,emptyContent:R,width:F,height:B}),K=U.resolvedSelection?.unselectedOpacity??Fh,Q=(0,Vp.useMemo)(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const r=U.effectiveSelectionHook?.isActive,n=U.effectiveSelectionHook?.predicate,i=100>o.length,s=o.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=o[t],l=o[t+1],c=Up(t,s),u=!r||!n||n(a.datum??a)||n(l.datum??l),d=r?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,Vp.useMemo)(()=>[Q],[Q]),J=(0,Vp.useMemo)(()=>(e,t,o)=>{const r=e.filter(e=>"point"===e.type);if(2>r.length)return null;const n=r.length,i=100>n,s=[];for(let e=0;n-1>e;e++){const t=r[e],o=r[e+1],a=Up(e,n),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);i&&s.push((0,Xp.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Xp.jsx)("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Xp.jsx)(Xp.Fragment,{children:s})},[p]),ee=(0,Vp.useMemo)(()=>[J],[J]),te=$p({colorScale:void 0,baseStyleExtras:(0,Vp.useMemo)(()=>e=>{const t=X.get(e),o=t?.idx??0,r=t?.total??1;return{fill:r>0?Up(o,r):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),oe=h||("string"==typeof d?d:"Order"),re=(0,Vp.useMemo)(()=>za([{label:q||Na(c),accessor:c,role:"x",format:a},{label:Y||Na(u),accessor:u,role:"y",format:l},...d?[{label:oe,accessor:d,role:"group"}]:[]]),[c,u,q,Y,d,oe,a,l]),ne=Sp({componentName:"ConnectedScatterplot",data:n,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=qp({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=Bp(y),le=ae||se.length>0?[...ae?[ae]:[],...m||[],...se]:m,ce={chartType:"scatter",...null!=n&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[F,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:r.showAxes,xLabel:q,yLabel:Y,xFormat:a,yFormat:l,enableHover:D,showGrid:E,...Yd({title:z,description:H,summary:O,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:f,defaultTooltipContent:re}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...g&&{pointIdAccessor:g},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...x&&{xExtent:x},...k&&{yExtent:k},...U.crosshairProps,...w};return ne?(0,Xp.jsx)(td,{componentName:"ConnectedScatterplot",message:ne,width:F,height:B}):(0,Xp.jsx)(sd,{componentName:"ConnectedScatterplot",width:F,height:B,children:(0,Xp.jsx)(Ka,{ref:o,...ce})})});Kp.displayName="ConnectedScatterplot";var Qp=require("react"),Zp=require("react");function Jp(e){const{lineWidth:t=2,colorBy:o,colorScale:r,color:n,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h}=e,p=(0,Zp.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let d;return i?d=i(e,l):o?r&&(d=Oe(e,o,r)):d=n||op,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[t,o,r,n,i,s,a]),f=(0,Zp.useMemo)(()=>Ip(p,{stroke:l,strokeWidth:c,opacity:u}),[p,l,c,u]);return(0,Zp.useMemo)(()=>Bh(f,d??null,h),[f,d,h])}var ef=require("react/jsx-runtime"),tf="__lineObjectSeries",of=(0,Qp.forwardRef)(function(e,t){const o=(0,Qp.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:d="y",lineBy:h,lineDataAccessor:p="coordinates",colorBy:f,colorScheme:g,curve:m="linear",showPoints:y=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:x=.3,lineWidth:k=2,lineGradient:w,tooltip:S,pointIdAccessor:A,annotations:C,directLabel:M,gapStrategy:j="break",anomaly:P,forecast:_,band:L,xExtent:R,yExtent:T,frameProps:I={},selection:$,linkedHover:N,onObservation:F,onClick:B,hoverHighlight:D,hoverRadius:E,chartId:H,loading:O,loadingContent:W,emptyContent:q,legendInteraction:Y,legendPosition:G,xScaleType:V,yScaleType:X,color:U,stroke:K,strokeWidth:Q,opacity:Z}=e,{width:J,height:ee,enableHover:te,showGrid:oe,showLegend:re,title:ne,description:ie,summary:se,accessibleTable:ae,xLabel:le,yLabel:ce}=r,ue=(0,Qp.useMemo)(()=>z(n),[n]),de=Array.isArray(ue[0]?.[p])?ue[0][p]:ue;dd("LineChart",de,"xAccessor",u),dd("LineChart",de,"yAccessor",d);const{effectiveData:he,statisticalAnnotations:pe}=qp({data:ue,xAccessor:u,yAccessor:d,forecast:_,anomaly:P,groupBy:h}),fe="__compoundGroup",ge=!(!_||!h),me=ge?fe:_?Ep:h,ye=(0,Qp.useMemo)(()=>{if(!ge)return he;const e="function"==typeof h?h:e=>e[h];return he.map(t=>{const o={...t};return o[fe]=`${e(t)}__${t[Ep]||"observed"}`,o})},[he,ge,h]),be=ge?ye:he,ve=f||h,xe=(0,Qp.useMemo)(()=>{if(!_)return;const e=_.upperBounds,t=_.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,r="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let n=1/0,i=-1/0;const s=he;for(const e of s){const t="function"==typeof d?d(e):+e[d];if(isFinite(t)&&(n>t&&(n=t),t>i&&(i=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),n>t&&(n=t))}if(r){const t=r(e);null!=t&&isFinite(t)&&(n>t&&(n=t),t>i&&(i=t))}}return isFinite(n)&&isFinite(i)?[n,i]:void 0},[_,he,d]),ke=(0,Qp.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],o="function"==typeof d?d(e):e[d];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[u,d]),we=void 0!==be[0]?.[p],Se=we?tf:me,Ae=(0,Qp.useMemo)(()=>{if(we)return be.map((e,t)=>{const o="function"==typeof h?h(e):"string"==typeof h?e[h]:void 0,r=null==o?"line-"+t:o+"",n=Array.isArray(e[p])?e[p]:[];return{...e,[tf]:r,[p]:n.map(t=>({...t,[tf]:r,parentLine:e,..."string"==typeof h&&void 0!==e[h]?{[h]:e[h]}:{}}))}});if(me){const e=be.reduce((e,t)=>{const o="function"==typeof me?me(t):t[me];if(!e[o]){const r={[p]:[]};"string"==typeof me&&(r[me]=o),ge&&(r[Ep]=t[Ep],"string"==typeof h&&(r[h]=t[h])),e[o]=r}return e[o][p].push(t),e},{});return Object.values(e)}return[{[p]:be}]},[be,me,p,we,h]),{gapProcessedLineData:Ce,hasGaps:Me}=(0,Qp.useMemo)(()=>{if("interpolate"===j){let e=!1;const t=[];for(const o of Ae){const r=(o[p]||[]).filter(t=>!ke(t)||(e=!0,!1));r.length>0&&t.push({...o,[p]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===j){let e=!1;const t=[];for(const o of Ae){const r=o[p]||[];let n=[],i=0;const s=Se&&"string"==typeof Se?o[Se]:void 0;for(const a of r)if(ke(a))e=!0,n.length>0&&(t.push({...o,[p]:n}),n=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;n.push({...a,_gapSegment:e})}n.length>0&&t.push({...o,[p]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===j){let e=!1;const t="string"==typeof d?d:"y",o=[];for(const r of Ae){const n=r[p]||[],i=[];for(const o of n)ke(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...r,[p]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:Ae,hasGaps:!1}},[Ae,j,p,ke,Se,d]),je="object"==typeof M?M:{},Pe=je.position||"end",_e=je.fontSize||11,Le=(0,Qp.useMemo)(()=>{if(!M||!ve)return[];const e="function"==typeof ve?ve:e=>e[ve],t=new Set;for(const o of Ce){const r=o[p]||[];if(0===r.length)continue;const n=e("end"===Pe?r[r.length-1]:r[0])??e(o);if(null==n)continue;const i=n+"";""!==i&&t.add(i)}return Array.from(t)},[M,ve,Ce,p,Pe]),Re=(0,Qp.useMemo)(()=>{if(!M)return r.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*_e)),0)+10,t="end"===Pe?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[M,Le,_e,Pe,r.marginDefaults]),Te=_p({data:he,rawData:n,colorBy:ve,colorScheme:g,legendInteraction:Y,legendPosition:G,selection:$,linkedHover:N,fallbackFields:ve?["string"==typeof ve?ve:""]:[],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:D,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:H,showLegend:(!M||void 0!==re)&&re,userMargin:i,marginDefaults:Re,loading:O,loadingContent:W,emptyContent:q,width:J,height:ee}),Ie=Te.colorScale,$e=Te.effectiveSelectionHook,Ne=Te.resolvedSelection,Fe=Te.customHoverBehavior,Be=Te.customClickBehavior,De=Te.crosshairProps,Ee=Jp({lineWidth:k,colorBy:(0,Qp.useMemo)(()=>{if(ve)return we?e=>{const t=e.parentLine||e;return"function"==typeof ve?ve(t):t[ve]}:ve},[ve,we]),colorScale:Ie,color:U,fillArea:v,areaOpacity:x,stroke:K,strokeWidth:Q,opacity:Z,effectiveSelectionHook:$e,resolvedSelection:Ne}),[ze,He]=(0,Qp.useState)(null);(0,Qp.useEffect)(()=>{if(!_)return void He(null);let e=!1;return async function(...e){return(await Hp()).createSegmentLineStyle(...e)}(Ee,_).then(t=>{e||He(()=>t)}).catch(()=>{e||He(null)}),()=>{e=!0}},[Ee,_]);const We=ze||Ee,qe=(0,Qp.useMemo)(()=>{if(y)return e=>{const t={r:b,fillOpacity:1};return ve?Ie&&(t.fill=Oe(e.parentLine||e,ve,Ie)):t.fill=U||op,t}},[y,b,ve,Ie,U]),Ye=Array.isArray(v)?"mixed":v?"area":"line",Ge=(0,Qp.useMemo)(()=>{if(!M||!ve)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof d?d:e=>e[d],o="function"==typeof ve?ve:e=>e[ve],r=new Map;for(const e of Ce){const t=e[p]||[];if(0===t.length)continue;const n="end"===Pe?t[t.length-1]:t[0],i=o(n)??o(e);if(null==i)continue;const s=i+"";""===s||r.has(s)||r.set(s,n)}const n=Array.from(r.entries()).map(([o,r])=>({type:"text",label:o,["string"==typeof u?u:"x"]:e(r),["string"==typeof d?d:"y"]:t(r),dx:"end"===Pe?6:-6,dy:0,color:Ie?Ie(o):op,fontSize:_e}));n.sort((e,t)=>{const o="string"==typeof d?d:"y";return e[o]-t[o]});for(let e=1;n.length>e;e++){const t="string"==typeof d?d:"y",o=n[e-1],r=n[e];_e+2>Math.abs(r[t]+r.dy-(o[t]+o.dy))&&(r.dy+=_e+2)}return n},[M,ve,Ie,Ce,p,u,d,Pe,_e]),Ve=Te.margin,Xe=h||f,Ue=(0,Qp.useMemo)(()=>za([{label:le||Na(u),accessor:u,role:"x",format:a},{label:ce||Na(d),accessor:d,role:"y",format:l},...Xe?[{label:Na(Xe),accessor:Xe,role:"group"}]:[],...Ea(L,l)]),[u,d,le,ce,Xe,a,l,L]),Ke=Sp({componentName:"LineChart",data:we?he[0]?.[p]||[]:n,accessors:{xAccessor:u,yAccessor:d}}),Qe=(0,Qp.useMemo)(()=>we||Se||Me?Ce.flatMap(e=>{const t=e[p]||[];return Se&&"string"==typeof Se?t.map(t=>({...t,[Se]:t[Se]??e[Se]})):t}):be,[Ce,p,we,Se,be,Me]),Ze={chartType:Ye,...Array.isArray(v)&&{areaGroups:v},...w&&{lineGradient:w},...null!=n&&{data:Qe},xAccessor:u,yAccessor:d,xScaleType:V,yScaleType:X,...R&&{xExtent:R},...!T||null==T[0]&&null==T[1]?xe?{yExtent:xe}:{}:{yExtent:T},groupAccessor:"break"===j&&Me?"_gapSegment":Se||void 0,...L&&{band:L},curve:m,lineStyle:We,...y&&{pointStyle:qe},size:[J,ee],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ve,showAxes:r.showAxes,xLabel:le,yLabel:ce,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:te,showGrid:oe,...Te.legendBehaviorProps,...ne&&{title:ne},...ie&&{description:ie},...se&&{summary:se},...void 0!==ae&&{accessibleTable:ae},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?Fs():Bs(S)||Ue,..."multi"===S&&{tooltipMode:"multi"},...Gd({linkedHover:N,selection:$,onObservation:F,onClick:B,hoverRadius:E,hoverHighlight:D,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Fe,customClickBehavior:Be}),...A&&{pointIdAccessor:A},...(C?.length||pe.length||Ge.length)&&{annotations:[...C||[],...pe,...Ge]},...De,...I};return Te.earlyReturn?Te.earlyReturn:Ke?(0,ef.jsx)(td,{componentName:"LineChart",message:Ke,width:J,height:ee}):(0,ef.jsx)(sd,{componentName:"LineChart",width:J,height:ee,children:(0,ef.jsx)(Ka,{ref:o,...Ze})})});of.displayName="LineChart";var rf=require("react"),nf=require("react");function sf(e){const{safeData:t,data:o,areaBy:r,lineDataAccessor:n,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,areaOpacity:p,showLine:f,lineWidth:g,showPoints:m,pointRadius:y,xAccessor:b,yAccessor:v,xLabel:x,yLabel:k,xFormat:w,yFormat:S,groupField:A}=e,C=void 0!==t[0]?.[n],M=(0,nf.useMemo)(()=>{if(null==o)return[];if(!C&&!r)return t;let e;if(C)e=t;else{const o=r,i=t.reduce((e,t)=>{const r="function"==typeof o?o(t):t[o];if(!e[r]){const t={[n]:[]};"string"==typeof o&&(t[o]=r),e[r]=t}return e[r][n].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[n]||[];return r&&"string"==typeof r?t.map(t=>({...t,[r]:e[r]})):t})},[o,t,r,n,C]),j=(0,nf.useMemo)(()=>e=>{const t={};if(i){if(s){const o=Oe(e,i,s);t.fill=o,f?(t.stroke=o,t.strokeWidth=g):t.stroke="none"}}else{const e=a||op;t.fill=e,f?(t.stroke=e,t.strokeWidth=g):t.stroke="none"}return t.fillOpacity=p,t},[i,s,a,p,f,g]),P=(0,nf.useMemo)(()=>Ip(j,{stroke:l,strokeWidth:c,opacity:u}),[j,l,c,u]);return{flattenedData:M,lineStyle:(0,nf.useMemo)(()=>Bh(P,d??null,h),[P,d,h]),pointStyle:(0,nf.useMemo)(()=>{if(m)return e=>{const t={r:y,fillOpacity:1};return i?s&&(t.fill=Oe(e.parentLine||e,i,s)):t.fill=a||op,t}},[m,y,i,s,a]),defaultTooltipContent:(0,nf.useMemo)(()=>za([{label:x||Na(b),accessor:b,role:"x",format:w},{label:k||Na(v),accessor:v,role:"y",format:S},...A?[{label:Na(A),accessor:A,role:"group"}]:[],...Ea(e.band,S)]),[b,v,x,k,A,w,S,e.band])}}var af=require("react/jsx-runtime");function lf(e,t){if(null==t)return e;const o=e.trim(),r=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(r){const e=r[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),r=o.lastIndexOf(")");if(-1!==e&&r>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var cf=(0,rf.forwardRef)(function(e,t){const o=(0,rf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,y0Accessor:h,gradientFill:p=!1,semanticGradient:f,lineDataAccessor:g="coordinates",colorBy:m,colorScheme:y,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:x,showLine:k=!0,lineWidth:w=2,showPoints:S=!1,pointRadius:A=3,tooltip:C,annotations:M,forecast:j,anomaly:P,band:_,xExtent:L,yExtent:R,frameProps:T={},selection:I,linkedHover:$,onObservation:N,onClick:F,hoverHighlight:B,chartId:D,loading:E,loadingContent:H,emptyContent:O,legendInteraction:W,legendPosition:q,color:Y,stroke:G,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:oe,accessibleTable:re,xLabel:ne,yLabel:ie}=r,se=(0,rf.useMemo)(()=>z(n),[n]),ae=m||d,le=(0,rf.useMemo)(()=>{return f&&f.length>0?{colorStops:(e=f,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:lf(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[f,p]);dd("AreaChart",se,"xAccessor",c),dd("AreaChart",se,"yAccessor",u);const ce=_p({data:se,rawData:n,colorBy:ae,colorScheme:y,legendInteraction:W,legendPosition:q,selection:I,linkedHover:$,fallbackFields:ae?["string"==typeof ae?ae:""]:[],unwrapData:!1,onObservation:N,onClick:F,hoverHighlight:B,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:D,showLegend:J,userMargin:i,marginDefaults:r.marginDefaults,loading:E,loadingContent:H,emptyContent:O,width:U,height:K}),{effectiveData:ue,statisticalAnnotations:de}=qp({data:se,xAccessor:c,yAccessor:u,forecast:j,anomaly:P,groupBy:d}),{flattenedData:he,lineStyle:pe,pointStyle:fe,defaultTooltipContent:ge}=sf({safeData:ue,data:n,areaBy:d,lineDataAccessor:g,colorBy:ae,colorScale:ce.colorScale,color:Y,stroke:G,strokeWidth:V,opacity:X,effectiveSelectionHook:ce.effectiveSelectionHook,resolvedSelection:ce.resolvedSelection,areaOpacity:v,showLine:k,lineWidth:w,showPoints:S,pointRadius:A,xAccessor:c,yAccessor:u,xLabel:ne,yLabel:ie,xFormat:a,yFormat:l,groupField:d||m,band:_}),me=Sp({componentName:"AreaChart",data:n,accessors:{xAccessor:c,yAccessor:u}}),ye={chartType:"area",...null!=n&&{data:he},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,...h&&{y0Accessor:h},..._&&{band:_},...le&&{gradientFill:le},...x&&{lineGradient:x},curve:b,lineStyle:pe,...S&&fe&&{pointStyle:fe},size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ce.margin,showAxes:r.showAxes,xLabel:ne,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Z,...ce.legendBehaviorProps,...Yd({title:ee,description:te,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:Fs(),tooltipMode:"multi"}:Vd({tooltip:C,defaultTooltipContent:ge}),...Gd({linkedHover:$,selection:I,onObservation:N,onClick:F,hoverHighlight:B,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior}),...(M&&M.length>0||de.length>0)&&{annotations:[...M||[],...de]},...L&&{xExtent:L},...R&&{yExtent:R},...ce.crosshairProps,...T};return ce.earlyReturn?ce.earlyReturn:me?(0,af.jsx)(td,{componentName:"AreaChart",message:me,width:U,height:K}):(0,af.jsx)(sd,{componentName:"AreaChart",width:U,height:K,children:(0,af.jsx)(Ka,{ref:o,...ye})})});cf.displayName="AreaChart";var uf=require("react"),df=require("react/jsx-runtime");function hf(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var pf=(0,uf.forwardRef)(function(e,t){const o=(0,uf.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:d="b",seriesALabel:h="A",seriesBLabel:p="B",seriesAColor:f="var(--semiotic-danger, #dc2626)",seriesBColor:g="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:y=1.5,showPoints:b=!1,pointRadius:v=3,curve:x="linear",areaOpacity:k=.6,gradientFill:w,tooltip:S,annotations:A,xExtent:C,yExtent:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,pointIdAccessor:E,windowSize:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=r,J=(0,uf.useMemo)(()=>"function"==typeof c?e=>hf(c(e)):e=>hf(e[c]),[c]),ee=(0,uf.useMemo)(()=>"function"==typeof u?e=>hf(u(e)):e=>hf(e[u]),[u]),te=(0,uf.useMemo)(()=>"function"==typeof d?e=>hf(d(e)):e=>hf(e[d]),[d]),[oe,re]=(0,uf.useState)([]),ne=(0,uf.useRef)([]),ie=null==n,se=(0,uf.useMemo)(()=>z(ie?oe:n),[ie,oe,n]),ae=(0,uf.useMemo)(()=>function(e,t,o,r){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${s}-${e}`,h=e=>i.push(e),p=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;n.length>e;e++){const i=n[e],f=t(i),g=o(i),m=r(i);if(!Number.isFinite(f)||!Number.isFinite(g)||!Number.isFinite(m))continue;const y=u(g,m);if(null!==y)if(null!=a){if(l&&l.w!==y){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=g-l.a-(m-l.b);if(0!==o){const r=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+r*(f-l.x),t=l.a+r*(g-l.a)}else e=l.x,t=l.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=y,h({__x:e,__y:t,__y0:t,__diffSegment:d(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)p(c[e],a)}else for(const e of c)p(e,a);c=[],h({__x:f,__y:m>g?m:g,__y0:m>g?g:m,__diffSegment:d(a),__diffWinner:a,__valA:g,__valB:m,__sourceDatum:i}),l={x:f,a:g,b:m,w:y}}else{a=y;for(const e of c)p(e,a);c=[],h({__x:f,__y:m>g?m:g,__y0:m>g?g:m,__diffSegment:d(a),__diffWinner:a,__valA:g,__valB:m,__sourceDatum:i}),l={x:f,a:g,b:m,w:y}}else c.push({x:f,y:g,datum:i})}for(const e of c)p(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,uf.useMemo)(()=>m?function(e,t,o,r){if(!e.length)return[];const n=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),i=[];for(const e of n){const n=t(e),s=o(e),a=r(e);Number.isFinite(s)&&i.push({__x:n,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:n,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[m,se,J,ee,te]),ce=(0,uf.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,uf.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,uf.useImperativeHandle)(t,()=>{const e=e=>{const t=H&&e.length>H?e.slice(e.length-H):e;ne.current=t,re(t)},t=E?"function"==typeof E?E:e=>e[E]:null;return{push:t=>e([...ne.current,t]),pushMany:t=>e([...ne.current,...t]),remove:o=>{if(!t)return[];const r=Array.isArray(o)?o:[o],n=[],i=[];for(const e of ne.current)r.includes(t(e))?n.push(e):i.push(e);return e(i),n},update:(o,r)=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],s=ne.current.map(e=>{if(n.includes(t(e))){const t=r(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?ne.current:se,getScales:()=>o.current?.getScales()??null}},[ie,se,E,H]);const de=_p({data:se,rawData:n,colorBy:"__diffWinner",colorScheme:[f,g],legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"DifferenceChart",chartId:I,showLegend:G,userMargin:i,marginDefaults:r.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:O,height:W}),he=(0,uf.useMemo)(()=>{if(!1!==G)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:h,color:f},{label:p,color:g}]}]}},[G,h,p,f,g]),pe=(0,uf.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?f:g,stroke:"none",fillOpacity:k}},[f,g,k]),fe=(0,uf.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?f:g,strokeWidth:y,fill:"none"}),[f,g,y]),ge=(0,uf.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?f:g,r:v}),[f,g,v]),me=(0,uf.useCallback)(e=>{const t=e.data,o=e.allSeries,r=e.xValue??t?.__x;let n=t?.__valA,i=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(n=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=r&&(null==n||null==i)){const e=se.find(e=>J(e)===r);e&&(null==n&&(n=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=r?a(r):null!=r?r+"":"";return(0,df.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[l&&(0,df.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,df.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,df.jsx)("span",{style:{width:10,height:10,background:f,display:"inline-block",borderRadius:2}}),(0,df.jsxs)("span",{children:[h,": ",s(n)]})]}),(0,df.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,df.jsx)("span",{style:{width:10,height:10,background:g,display:"inline-block",borderRadius:2}}),(0,df.jsxs)("span",{children:[p,": ",s(i)]})]}),null!=n&&null!=i&&Number.isFinite(n)&&Number.isFinite(i)&&(0,df.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(n-i)]})]})},[se,J,ee,te,a,f,g,h,p]),ye="multi"===S,be=(0,uf.useMemo)(()=>!1===S?()=>null:ye?me:Bs(S)||me,[S,ye,me]);if(de.earlyReturn)return de.earlyReturn;const ve={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:x,areaStyle:pe,lineStyle:fe,...b&&{pointStyle:ge},size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:de.margin,showAxes:r.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:q,showGrid:Y,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...he&&{legend:he,legendPosition:de.legendPosition},...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:be,...ye&&{tooltipMode:"multi"},...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:de.mobileInteraction,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior}),...A&&A.length>0&&{annotations:A},...C&&{xExtent:C},...M&&{yExtent:M},...de.crosshairProps,...j};return(0,df.jsx)(sd,{componentName:"DifferenceChart",width:O,height:W,children:(0,df.jsx)(Ka,{ref:o,...ve})})});"function"==typeof pf&&(pf.displayName="DifferenceChart");var ff=require("react"),gf=require("react/jsx-runtime"),mf=(0,ff.forwardRef)(function(e,t){const o=(0,ff.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:d,lineDataAccessor:h="coordinates",colorBy:p,colorScheme:f,curve:g="monotoneX",areaOpacity:m=.7,showLine:y=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:x=3,normalize:k=!1,baseline:w="zero",stackOrder:S,tooltip:A,annotations:C,xExtent:M,yExtent:j,frameProps:P={},selection:_,linkedHover:L,onObservation:R,onClick:T,hoverHighlight:I,chartId:$,loading:N,loadingContent:F,emptyContent:B,legendInteraction:D,legendPosition:E,color:H,stroke:O,strokeWidth:W,opacity:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=r,oe=(0,ff.useMemo)(()=>z(n),[n]),re=p||d;Rp(t,{variant:"xy",frameRef:o});const ne=_p({data:oe,rawData:n,colorBy:re,colorScheme:f,legendInteraction:D,legendPosition:E,selection:_,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:R,onClick:T,hoverHighlight:I,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:$,showLegend:U,userMargin:i,marginDefaults:r.marginDefaults,loading:N,loadingContent:F,emptyContent:B,width:Y,height:G}),{flattenedData:ie,lineStyle:se,pointStyle:ae,defaultTooltipContent:le}=sf({safeData:oe,data:n,areaBy:d,lineDataAccessor:h,colorBy:re,colorScale:ne.colorScale,color:H,stroke:O,strokeWidth:W,opacity:q,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,areaOpacity:m,showLine:y,lineWidth:b,showPoints:v,pointRadius:x,xAccessor:c,yAccessor:u,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,groupField:d||p}),ce=Sp({componentName:"StackedAreaChart",data:n,accessors:{xAccessor:c,yAccessor:u}}),ue={chartType:"stackedarea",...null!=n&&{data:ie},xAccessor:c,yAccessor:u,groupAccessor:d||void 0,curve:g,normalize:k,baseline:k?"zero":w,stackOrder:S,lineStyle:se,...v&&ae&&{pointStyle:ae},size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:X,...ne.legendBehaviorProps,...Yd({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===A?{tooltipContent:Fs(),tooltipMode:"multi"}:Vd({tooltip:A,defaultTooltipContent:le}),...Gd({linkedHover:L,selection:_,onObservation:R,onClick:T,hoverHighlight:I,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...C&&C.length>0&&{annotations:C},...M&&{xExtent:M},...j&&{yExtent:j},...ne.crosshairProps,...P};return ne.earlyReturn?ne.earlyReturn:ce?(0,gf.jsx)(td,{componentName:"StackedAreaChart",message:ce,width:Y,height:G}):(0,gf.jsx)(sd,{componentName:"StackedAreaChart",width:Y,height:G,children:(0,gf.jsx)(Ka,{ref:o,...ue})})});mf.displayName="StackedAreaChart";var yf=require("react"),bf=require("d3-scale");h();var vf=require("react/jsx-runtime"),xf=(0,yf.forwardRef)(function(e,t){const o=(0,yf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:d,yFormat:h,colorScheme:p,customColorScale:f,showValues:g=!1,valueFormat:m,cellBorderColor:y="#fff",cellBorderWidth:b=1,tooltip:v,annotations:x,xExtent:k,yExtent:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:T,showLegend:I,legendPosition:$,legendInteraction:N}=e,{width:F,height:B,enableHover:D,title:E,description:H,summary:O,accessibleTable:W,xLabel:q,yLabel:Y}=r,G=ud(L,F,B,R),V=G?null:cd(n,F,B,T),X=(0,yf.useMemo)(()=>z(n),[n]),U=function(){const e=Zh();return e?.colors?.sequential||void 0}(),K=p??U??"blues",Q=I??!1,Z=$??"right",{margin:J}=gp({data:X,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:r.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:oe}=pp({selection:A,linkedHover:C,fallbackFields:[],onObservation:M,onClick:j,chartType:"Heatmap",chartId:_,hoverHighlight:P,colorByField:void 0,mobileInteraction:r.mobileInteraction});Pp(A);const re=fp(C,oe);mp(N,void 0,[]);const ne=(0,yf.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,yf.useMemo)(()=>u(X.map(ne)),[X,ne]),se=(0,yf.useMemo)(()=>{if("custom"===K&&f)return f;const e=_e(K);return(0,bf.scaleSequential)(e).domain(ie)},[K,f,ie]),ae=(0,yf.useMemo)(()=>za([{label:q||Na(a),accessor:a,role:"x",format:d},{label:Y||Na(l),accessor:l,role:"y",format:h},{label:Na(c),accessor:c,role:"value",format:m}]),[a,l,q,Y,c,d,h,m]),le=Sp({componentName:"Heatmap",data:n,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,yf.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:m}}},[Q,se,ie,c,m]),ue={chartType:"heatmap",...null!=n&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:g,heatmapValueFormat:m,size:[F,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:r.showAxes,xLabel:q,yLabel:Y,xFormat:d,yFormat:h,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...Yd({title:E,description:H,summary:O,accessibleTable:W,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:v,defaultTooltipContent:ae}),...Gd({linkedHover:C,selection:A,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...x&&x.length>0&&{annotations:x},...k&&{xExtent:k},...w&&{yExtent:w},...re,...S};return G||V||(le?(0,vf.jsx)(td,{componentName:"Heatmap",message:le,width:F,height:B}):(0,vf.jsx)(sd,{componentName:"Heatmap",width:F,height:B,children:(0,vf.jsx)(Ka,{ref:o,...ue})}))});xf.displayName="Heatmap";var kf=require("react"),wf=require("react/jsx-runtime"),Sf=(0,kf.forwardRef)(function(e,t){const o=(0,kf.useRef)(null),r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:d,sizeRange:h=[5,40],colorBy:p,colorScheme:f,bubbleOpacity:g=.6,bubbleStrokeWidth:m=1,bubbleStrokeColor:y="white",tooltip:b,marginalGraphics:v,pointIdAccessor:x,annotations:k,regression:w,xExtent:S,yExtent:A,frameProps:C={},selection:M,linkedHover:j,linkedBrush:P,onObservation:_,onClick:L,hoverHighlight:R,chartId:T,loading:I,loadingContent:$,emptyContent:N,legendInteraction:F,legendPosition:B,color:D,stroke:E,strokeWidth:H,opacity:O}=e,{width:W,height:q,enableHover:Y,showGrid:G,showLegend:V,title:X,description:U,summary:K,accessibleTable:Q,xLabel:Z,yLabel:J}=r,ee=(0,kf.useMemo)(()=>z(n),[n]),te=void 0===n,oe=_p({data:ee,rawData:n,colorBy:p,colorScheme:f,legendInteraction:F,legendPosition:B,selection:M,linkedHover:j,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:_,onClick:L,hoverHighlight:R,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:V,userMargin:i,marginDefaults:r.marginDefaults,loading:I,loadingContent:$,emptyContent:N,width:W,height:q}),{domain:re,trackPushed:ne,reset:ie}=Fp({accessor:d,data:ee,isPushMode:te}),se=(0,kf.useCallback)(e=>{ne([e]),o.current?.push(e)},[ne]),ae=(0,kf.useCallback)(e=>{ne(e),o.current?.pushMany(e)},[ne]);Rp(t,{variant:"xy",frameRef:o,overrides:{push:se,pushMany:ae,clear:()=>{ie(),o.current?.clear()}},deps:[se,ae,ie]});const le=Nh(P),ce=(mh({name:le?.name||"__unused_brush__",xField:le?.xField||("string"==typeof c?c:void 0),yField:le?.yField||("string"==typeof u?u:void 0)}),(0,kf.useMemo)(()=>({stroke:y,strokeWidth:m}),[y,m])),ue=(0,kf.useMemo)(()=>re??[0,1],[re]),de=(0,kf.useCallback)(e=>Ye(e,d,h,ue),[d,h,ue]),he=$p({colorBy:p,colorScale:oe.colorScale,color:D,fillOpacity:g,radiusFn:de,baseStyleExtras:ce,stroke:E,strokeWidth:H,opacity:O,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),pe=(0,kf.useMemo)(()=>za([{label:Z||Na(c),accessor:c,role:"x",format:a},{label:J||Na(u),accessor:u,role:"y",format:l},{label:Na(d),accessor:d,role:"size"},...p?[{label:Na(p),accessor:p,role:"color"}]:[]]),[c,u,Z,J,d,p,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const fe=Sp({componentName:"BubbleChart",data:n,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:d}});if(fe)return(0,wf.jsx)(td,{componentName:"BubbleChart",message:fe,width:W,height:q});const ge=Bp(w),me=ge?[ge,...k||[]]:k,ye={chartType:"bubble",...null!=n&&{data:ee},xAccessor:c,yAccessor:u,colorAccessor:p||void 0,sizeAccessor:d,sizeRange:h,pointStyle:he,colorScheme:f,size:[W,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:r.showAxes,xLabel:Z,yLabel:J,xFormat:a,yFormat:l,enableHover:Y,showGrid:G,...oe.legendBehaviorProps,...Yd({title:X,description:U,summary:K,accessibleTable:Q,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:pe}),...Gd({linkedHover:j,selection:M,onObservation:_,onClick:L,hoverHighlight:R,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...x&&{pointIdAccessor:x},...me&&me.length>0&&{annotations:me},...S&&{xExtent:S},...A&&{yExtent:A},...oe.crosshairProps,...C};return(0,wf.jsx)(sd,{componentName:"BubbleChart",width:W,height:q,children:(0,wf.jsx)(Ka,{ref:o,...ye})})});Sf.displayName="BubbleChart";var Af=c(require("react")),Cf=require("react"),Mf=require("d3-brush"),jf=require("d3-selection");h();var Pf=require("react/jsx-runtime"),_f="__splomIdx",Lf="splom-hover-source",Rf={top:4,bottom:4,left:4,right:4};function Tf({frameRef:e,cellSize:t,onBrush:o}){const r=(0,Cf.useRef)(null),n=t-Rf.left-Rf.right,i=t-Rf.top-Rf.bottom;return(0,Cf.useEffect)(()=>{if(!r.current)return;const t=(0,jf.select)(r.current).select(".brush-g"),s=(0,Mf.brush)().extent([[0,0],[n,i]]).on("brush end",t=>{const r=e.current?.getScales();if(!r)return;if(!t.selection)return void o(null);const[[n,i],[s,a]]=t.selection,l=[[r.x.invert(n),r.y.invert(i)],[r.x.invert(s),r.y.invert(a)]];o(l)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[n,i,e,o]),(0,Pf.jsx)("svg",{ref:r,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,Pf.jsx)("g",{className:"brush-g",transform:`translate(${Rf.left},${Rf.top})`})})}function If({data:e,xField:t,yField:o,cellSize:r,pointRadius:n,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:d,mode:h,onPointHover:p,onPointClick:f}){const g=(0,Cf.useRef)(null),m=hh({name:l,clientId:`splom-${t}-${o}`,fields:[t,o]}),y=mh({name:l,xField:t,yField:o}),b=hh({name:c,clientId:Lf,fields:[_f]}),v=b.selectPoints,x=(0,Cf.useCallback)(e=>{e?y.brushInteraction.during(e):y.brushInteraction.end(null)},[y.brushInteraction]),k=(0,Cf.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data,o=t?.[_f];void 0!==o&&(v({[_f]:[o]}),p?.(t,e.x+Rf.left,e.y+Rf.top))},[v,p]),w=(0,Cf.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data;t&&f?.(t,e.x+Rf.left,e.y+Rf.top)},[f]),S=(0,Cf.useCallback)(e=>{const t={opacity:i,r:n};return t.fill=s?Oe(e,s,a):op,"hover"===h?b.isActive&&b.predicate(e)?(t.opacity=1,t.r=2.5*n,t.stroke="#333",t.strokeWidth=1.5):b.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[s,a,i,n,h,m.isActive,m.predicate,b.isActive,b.predicate,u]);return(0,Pf.jsxs)("div",{style:{position:"relative",width:r,height:r},children:[(0,Pf.jsx)(Ka,{ref:g,chartType:"scatter",data:e,size:[r,r],xAccessor:t,yAccessor:o,pointStyle:S,margin:Rf,showAxes:!1,enableHover:"hover"===h,...Gd({forceHoverBehavior:"hover"===h,forceClickBehavior:!!f,mobileInteraction:d,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===h?()=>null:void 0}),"brush"===h&&(0,Pf.jsx)(Tf,{frameRef:g,cellSize:r,xField:t,yField:o,onBrush:x})]})}function $f({data:e,field:t,label:o,cellSize:r,bins:n,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const h=hh({name:a,clientId:"splom-diag-"+t,fields:[t]}),p=hh({name:l,clientId:`splom-diag-${t}-hover`,fields:[_f]}),f="hover"===c?p:h,g=f.isActive,m=f.predicate,y=(0,Cf.useMemo)(()=>{const o="string"==typeof i?i:null,s=[],a=new Set;for(const r of e){const e=r[t];if(null==e||isNaN(e)||s.push(Number(e)),o){const e=r[o];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=u(s),h=(c-l)/n||1,p=Array.from(a),f=new Map(p.map((e,t)=>[e,t])),y=Array(n).fill(0),b=Array(n).fill(0),v=Array.from({length:n},()=>Array(p.length).fill(0)),x=Array.from({length:n},()=>Array(p.length).fill(0));for(const r of e){const e=r[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/h),n-1);if(y[i]++,g&&!m(r)||b[i]++,o){const e=f.get(r[o]+"");void 0!==e&&(v[i][e]++,g&&!m(r)||x[i][e]++)}}const k=d(y,1),w=v.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(r-24),a={x:t/n*r,w:r/n-1,h:s,y0:o,category:p[i]};return o+=s,a})}),S=x.map((e,t)=>{let o=0;return e.map((e,i)=>{const s=e/k*(r-24),a={x:t/n*r,w:r/n-1,h:s,y0:o,category:p[i]};return o+=s,a})});return{bars:y.map((e,t)=>({x:t/n*r,w:r/n-1,h:e/k*(r-24),count:e})),selectedBars:b.map((e,t)=>({x:t/n*r,w:r/n-1,h:e/k*(r-24),count:e})),categoryBars:w,selectedCategoryBars:S,max:k,categories:p}},[e,t,n,r,g,m,i]);return(0,Pf.jsxs)("svg",{width:r,height:r,style:{overflow:"hidden"},children:[(0,Pf.jsx)("text",{x:r/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),y.categories.length>0?y.categoryBars.map((e,t)=>e.map((e,o)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):op,opacity:g?.3:.6},`bg-${t}-${o}`))):y.bars.map((e,t)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:op,opacity:g?.3:.6},"bg-"+t)),g&&(y.categories.length>0?y.selectedCategoryBars.map((e,t)=>e.map((e,o)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):op,opacity:.7},`sel-${t}-${o}`))):y.selectedBars.map((e,t)=>(0,Pf.jsx)("rect",{x:e.x,y:r-e.h,width:Math.max(e.w,1),height:e.h,fill:op,opacity:.7},"sel-"+t)))]})}function Nf({label:e,cellSize:t}){return(0,Pf.jsx)("svg",{width:t,height:t,children:(0,Pf.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Ff(e){const{data:t,fields:o,fieldLabels:r={},colorBy:n,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:d=20,brushMode:h="crossfilter",hoverMode:p=!0,unselectedOpacity:f=.1,showGrid:g=!1,tooltip:m,showLegend:y,idAccessor:b,width:v,className:x,onObservation:k,onClick:w,chartId:S}=e,A="splom",C="splom-hover",M=lp(e.mobileInteraction,{mode:e.mode,width:v??o.length*s,mobileSemantics:e.mobileSemantics}),j=p?"hover":h?"brush":"hover",P=lh(e=>e.clearSelection),[_,L]=(0,Cf.useState)(null),R=(0,Cf.useCallback)(()=>{P(C),L(null)},[P,C]),T=(0,Cf.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[_f]?e:{...e,[_f]:t}),[t]),I=dp(T,n,i),$=(0,Cf.useCallback)((e,t,o,r)=>[40+e*(s+a)+(o??0),t*(s+a)+(r??0)],[40,s,a]),N=void 0!==y?y:!!n,F=(0,Cf.useMemo)(()=>{if(!N||!n)return null;const e="string"==typeof n?n:null;return e?Array.from(new Set(T.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:I?I(e+""):op})):null},[N,n,T,I]),B=(0,Cf.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>s+"px").join(" "),gridTemplateRows:o.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[o,s,a,40]);return(0,Pf.jsxs)("div",{className:x,style:{position:"relative"},children:[F&&(0,Pf.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:F.map(e=>(0,Pf.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,Pf.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,Pf.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,Pf.jsxs)("div",{style:B,onMouseLeave:"hover"===j?R:void 0,children:[o.map((e,t)=>(0,Pf.jsxs)(Af.Fragment,{children:[(0,Pf.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:r[e]||e}),o.map((o,i)=>t===i?"label"===u?(0,Pf.jsx)(Nf,{label:r[e]||e,cellSize:s},"diag-"+e):(0,Pf.jsx)($f,{data:T,field:e,label:r[e]||e,cellSize:s,bins:d,colorBy:n,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,mode:j},"diag-"+e):(0,Pf.jsx)(If,{data:T,xField:o,yField:e,fieldLabels:r,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:n,colorScale:I,brushSelectionName:A,hoverSelectionName:C,unselectedOpacity:f,showGrid:g,tooltip:m,mobileInteraction:M,mode:j,onPointHover:"hover"===j?(r,n,s)=>{if(r){if(L({datum:r,xField:o,yField:e,colIndex:i,rowIndex:t,px:n??0,py:s??0}),k){const[e,o]=$(i,t,n,s);k({type:"hover",datum:r,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else L(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:w||k?(e,o,r)=>{if(!e)return;const[n,s]=$(i,t,o,r);w&&w(e,{x:n,y:s}),k&&k({type:"click",datum:e,x:n,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),(0,Pf.jsx)("div",{})," ",o.map(e=>(0,Pf.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:r[e]||e},"col-label-"+e))]}),_&&"hover"===j&&(()=>{const e=_.datum,t=r[_.xField]||_.xField,o=r[_.yField]||_.yField,i=n?"function"==typeof n?n(e):e[n]:null,l=b?"function"==typeof b?b(e):e[b]:"Row "+e[_f];return(0,Pf.jsxs)("div",{style:{position:"absolute",left:40+_.colIndex*(s+a)+_.px,top:_.rowIndex*(s+a)+_.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},children:[(0,Pf.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,Pf.jsxs)("div",{children:[t,": ",null!=e[_.xField]?Number(e[_.xField]).toFixed(1):"–"]}),(0,Pf.jsxs)("div",{children:[o,": ",null!=e[_.yField]?Number(e[_.yField]).toFixed(1):"–"]}),null!=i&&(0,Pf.jsxs)("div",{style:{opacity:.8},children:["string"==typeof n?n:"group",": ",i+""]})]})})()]})}function Bf(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,r={};return!o&&t&&(r.splom={resolution:t}),o&&(r["splom-hover"]={resolution:"union"}),(0,Pf.jsx)(Ih,{selections:r,children:(0,Pf.jsx)(Ff,{...e})})}Bf.displayName="ScatterplotMatrix";var Df=require("react"),Ef=require("d3-brush"),zf=require("d3-selection"),Hf=require("react/jsx-runtime");function Of({width:e,height:t,margin:o,scales:r,brushDirection:n,extent:i,onBrush:s}){const a=(0,Df.useRef)(null),l=(0,Df.useRef)(null),c=(0,Df.useRef)(!1),u=e+o.left+o.right,d=t+o.top+o.bottom;return(0,Df.useEffect)(()=>{if(!a.current||!r)return;const o=(0,zf.select)(a.current).select(".brush-group"),i="x"===n?(0,Ef.brushX)().extent([[0,0],[e,t]]):(0,Ef.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const o=("x"===n?r.x:r.y).invert;if(!o)return;const i=[o(t[0]),o(t[1])];s(i)}),o.call(i),l.current=i,o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{i.on("brush end",null)}},[r,e,t,n,s]),(0,Df.useEffect)(()=>{if(!l.current||!r||!a.current)return;const e=(0,zf.select)(a.current).select(".brush-group"),t="x"===n?r.x:r.y;if(c.current=!0,i){const o=[t(i[0]),t(i[1])];e.call(l.current.move,o)}else e.call(l.current.move,null);c.current=!1},[i,r,n]),(0,Hf.jsx)("svg",{ref:a,width:u,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,Hf.jsx)("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Wf(e){const{data:t,width:o=600,height:r=400,margin:n,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:d,yFormat:h,xAccessor:p="x",yAccessor:f="y",lineBy:g,lineDataAccessor:m="coordinates",colorBy:y,colorScheme:b,curve:v="linear",lineWidth:x=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:S=!1,pointRadius:A=3,enableHover:C=!0,showGrid:M=!1,showLegend:j,legendPosition:P,tooltip:_,minimap:L={},renderBefore:R=!1,onBrush:T,brushExtent:I,yExtent:$,frameProps:N={},loading:F,loadingContent:B,emptyContent:D}=e,E=ud(F,o,r,B),H=E?null:cd(t,o,r,D),O=(0,Df.useMemo)(()=>z(t),[t]),[W,q]=(0,Df.useState)(null),Y=I??W,G=(0,Df.useCallback)(e=>{I||q(e),T?.(e)},[I,T]),V=(0,Df.useRef)(null),[X,U]=(0,Df.useState)(null);(0,Df.useEffect)(()=>{let e=0,t=!1;const o=()=>{if(t)return;const r=V.current?.getScales?.();r?U(r):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==O[0]?.[m],Q=(0,Df.useMemo)(()=>{if(K)return O;if(g){const e=O.reduce((e,t)=>{const o="function"==typeof g?g(t):t[g];if(!e[o]){const t={[m]:[]};"string"==typeof g&&(t[g]=o),e[o]=t}return e[o][m].push(t),e},{});return Object.values(e)}return[{[m]:O}]},[O,g,m,K]),Z=(0,Df.useMemo)(()=>K||g?Q.flatMap(e=>{const t=e[m]||[];return g&&"string"==typeof g?t.map(t=>({...t,[g]:e[g]})):t}):O,[Q,m,K,g,O]),J=dp(O,y,b),ee=Jp({lineWidth:x,colorBy:y,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,Df.useMemo)(()=>{if(L.lineStyle)return L.lineStyle},[L.lineStyle]),oe=Jp({lineWidth:1,colorBy:y,colorScale:J}),re=te??oe,ne=(0,Df.useMemo)(()=>{if(S)return e=>{const t={r:A,fillOpacity:1};return t.fill=y?Oe(e.parentLine||e,y,J):op,t}},[S,A,y,J]),{legend:ie,margin:se,legendPosition:ae}=gp({data:Q,colorBy:y,colorScale:J,showLegend:j,legendPosition:P,userMargin:n}),le=L.height||60,ce=(0,Df.useMemo)(()=>({top:L.margin?.top??0,bottom:L.margin?.bottom??20,left:L.margin?.left??se.left,right:L.margin?.right??se.right}),[L.margin,se]),ue=L.brushDirection||"x",de=(0,Df.useMemo)(()=>za([{label:c||Na(p),accessor:p,role:"x",format:d},{label:u||Na(f),accessor:f,role:"y",format:h}]),[p,f,c,u,d,h]),he=Sp({componentName:"MinimapChart",data:t,accessors:{xAccessor:p,yAccessor:f}});if(he)return(0,Hf.jsx)(td,{componentName:"MinimapChart",message:he,width:o,height:r});const pe=k?"area":"line",fe={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:g||void 0,curve:v,lineStyle:ee,...S&&{pointStyle:ne},size:[o,r],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:d,yFormat:h,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===_?()=>null:Bs(_)||de,...Y&&{xExtent:Y},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...N},ge={chartType:pe,data:Z,xAccessor:p,yAccessor:f,groupAccessor:g||void 0,curve:v,lineStyle:re,size:[o,le+ce.top+ce.bottom],margin:ce,showAxes:L.showAxes??!1,background:L.background,enableHover:!1,...$&&{yExtent:$}},me=(0,Hf.jsxs)("div",{style:{position:"relative",width:o,overflow:"hidden"},children:[(0,Hf.jsx)(Ka,{ref:V,...ge}),(0,Hf.jsx)(Of,{width:o-ce.left-ce.right,height:le,margin:ce,scales:X,brushDirection:ue,extent:Y,onBrush:G})]},"minimap"),ye=(0,Hf.jsx)("div",{style:{overflow:"hidden"},children:(0,Hf.jsx)(Ka,{...fe})},"main");return E||H||(0,Hf.jsx)(sd,{componentName:"MinimapChart",width:o,height:r,children:(0,Hf.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[R?me:ye,R?ye:me]})})}Wf.displayName="MinimapChart";var qf=require("react"),Yf={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};h();var Gf=require("react/jsx-runtime");function Vf(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var Xf=(0,qf.forwardRef)(function(e,t){const o=(0,qf.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:d="y",xCenter:h,yCenter:p,quadrants:f,centerlineStyle:g={},showQuadrantLabels:m=!0,quadrantLabelSize:y=12,colorBy:b,colorScheme:v,sizeBy:x,sizeRange:k=[3,15],pointRadius:w=5,pointOpacity:S=.8,tooltip:A,pointIdAccessor:C,annotations:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,color:E,stroke:H,strokeWidth:O,opacity:W}=e,{width:q,height:Y,enableHover:G,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=r,te=(0,qf.useMemo)(()=>({topLeft:Vf(Yf.topLeft,f?.topLeft),topRight:Vf(Yf.topRight,f?.topRight),bottomLeft:Vf(Yf.bottomLeft,f?.bottomLeft),bottomRight:Vf(Yf.bottomRight,f?.bottomRight)}),[f]),oe=(0,qf.useMemo)(()=>z(n),[n]),re=_p({data:oe,rawData:n,colorBy:b,colorScheme:v,legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:"string"==typeof b?[b]:[],unwrapData:!1,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:I,showLegend:X,userMargin:i,marginDefaults:r.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:q,height:Y});dd("QuadrantChart",oe,"xAccessor",c),dd("QuadrantChart",oe,"yAccessor",d);const ne=(0,qf.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof d?d:e=>+e[d];let o=1/0,r=-1/0,n=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(o>a&&(o=a),a>r&&(r=a)),isFinite(l)&&(n>l&&(n=l),l>i&&(i=l))}if(null!=h&&isFinite(h)&&(o>h&&(o=h),h>r&&(r=h)),null!=p&&isFinite(p)&&(n>p&&(n=p),p>i&&(i=p)),o===1/0)return;const s=.1*(r-o)||1,a=.1*(i-n)||1;return{xExtent:[o-s,r+s],yExtent:[n-a,i+a]}},[oe,c,d,h,p]),ie=(0,qf.useMemo)(()=>{if(!x||0===oe.length)return;const e=oe.map(e=>"function"==typeof x?x(e):e[x]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?u(e):void 0},[oe,x]),se=(0,qf.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),ae=(0,qf.useMemo)(()=>"function"==typeof d?d:e=>+e[d],[d]),le=(0,qf.useMemo)(()=>e=>{const t=se(e),o=ae(e),r=null!=h?t>=h:void 0,n=null!=p?o>=p:void 0;return void 0===n||void 0===r?E||op:n&&r?te.topRight.color:n&&!r?te.topLeft.color:!n&&r?te.bottomRight.color:te.bottomLeft.color},[se,ae,h,p,te,E]),ce=(0,qf.useMemo)(()=>x?e=>Ye(e,x,k,ie):void 0,[x,k,ie]),ue=$p({colorBy:b,colorScale:re.colorScale,color:E,pointRadius:w,fillOpacity:S,radiusFn:ce,fallbackFill:le,stroke:H,strokeWidth:O,opacity:W,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),de=(0,qf.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof d&&e.add(d),"string"==typeof b&&e.add(b),"string"==typeof x&&e.add(x);const t=oe[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[oe,c,d,b,x]),he=(0,qf.useMemo)(()=>za([...de?[{label:de,accessor:de,role:"title"}]:[],{label:J||Na(c),accessor:c,role:"x",format:a},{label:ee||Na(d),accessor:d,role:"y",format:l},...b?[{label:Na(b),accessor:b,role:"color"}]:[],...x?[{label:Na(x),accessor:x,role:"size"}]:[]]),[de,c,d,J,ee,b,x,a,l]),pe=Sp({componentName:"QuadrantChart",data:n,accessors:{xAccessor:c,yAccessor:d}}),fe=(0,qf.useMemo)(()=>{const e={stroke:g.stroke||"#999",strokeWidth:g.strokeWidth??1,dashArray:g.strokeDasharray||[]};return[(t,o,r,n)=>{if(!r?.x||!r?.y)return;const i=n.width,s=n.height,a=null!=h?r.x(h):i/2,l=null!=p?r.y(p):s/2;if(null!=h&&!isFinite(a))return;if(null!=p&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),d=[{config:te.topLeft,x:0,y:0,w:c,h:u},{config:te.topRight,x:c,y:0,w:i-c,h:u},{config:te.bottomLeft,x:0,y:u,w:c,h:s-u},{config:te.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[h,p,te,g]),ge=(0,qf.useMemo)(()=>m?[...fe,(e,t,o,r)=>{if(!o?.x||!o?.y)return;const n=r.width,i=r.height,s=null!=h?o.x(h):n/2,a=null!=p?o.y(p):i/2;(null==h||isFinite(s))&&(null==p||isFinite(a))&&(e.font=`600 ${y}px sans-serif`,e.globalAlpha=.5,e.fillStyle=te.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(te.topLeft.label,8,8),e.fillStyle=te.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(te.topRight.label,n-8,8),e.fillStyle=te.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(te.bottomLeft.label,8,i-8),e.fillStyle=te.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(te.bottomRight.label,n-8,i-8),e.globalAlpha=1)}]:fe,[fe,m,y,te,h,p]),me=(0,qf.useMemo)(()=>{const e=j.canvasPreRenderers||[];return[...ge,...e]},[ge,j.canvasPreRenderers]),ye=(0,qf.useMemo)(()=>{const e={stroke:g.stroke||"#999",strokeWidth:g.strokeWidth??1,dashArray:g.strokeDasharray?Array.isArray(g.strokeDasharray)?g.strokeDasharray.join(","):g.strokeDasharray:void 0};return[(t,o,r)=>{if(!o?.x||!o?.y)return null;const n=r.width,i=r.height,s=null!=h?o.x(h):n/2,a=null!=p?o.y(p):i/2;if(null!=h&&!isFinite(s))return null;if(null!=p&&!isFinite(a))return null;const l=Math.max(0,Math.min(n,s)),c=Math.max(0,Math.min(i,a));return(0,Gf.jsxs)(Gf.Fragment,{children:[[{config:te.topLeft,x:0,y:0,w:l,h:c},{config:te.topRight,x:l,y:0,w:n-l,h:c},{config:te.bottomLeft,x:0,y:c,w:l,h:i-c},{config:te.bottomRight,x:l,y:c,w:n-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Gf.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Gf.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Gf.jsx)("line",{x1:0,y1:c,x2:n,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),m&&(0,Gf.jsxs)(Gf.Fragment,{children:[(0,Gf.jsx)("text",{x:8,y:8+y,fill:te.topLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.topLeft.label}),(0,Gf.jsx)("text",{x:n-8,y:8+y,fill:te.topRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:te.topRight.label}),(0,Gf.jsx)("text",{x:8,y:i-8,fill:te.bottomLeft.color,fontWeight:600,fontSize:y,opacity:.5,children:te.bottomLeft.label}),(0,Gf.jsx)("text",{x:n-8,y:i-8,fill:te.bottomRight.color,fontWeight:600,fontSize:y,opacity:.5,textAnchor:"end",children:te.bottomRight.label})]})]})}]},[h,p,te,g,m,y]);if(re.earlyReturn)return re.earlyReturn;const be={chartType:"scatter",...null!=n&&{data:oe},xAccessor:c,yAccessor:d,colorAccessor:b||void 0,sizeAccessor:x||void 0,sizeRange:k,pointStyle:ue,colorScheme:v,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:r.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:G,showGrid:V,...ne&&{xExtent:ne.xExtent,yExtent:ne.yExtent},...re.legendBehaviorProps,...U&&{title:U},...K&&{description:K},...Q&&{summary:Q},...void 0!==Z&&{accessibleTable:Z},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===A?()=>null:!0===A||void 0===A?he:Bs(A)||he,...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...C&&{pointIdAccessor:C},...M&&M.length>0&&{annotations:M},canvasPreRenderers:me,...re.crosshairProps,...j,...me.length>0&&{canvasPreRenderers:me},svgPreRenderers:ye};return pe?(0,Gf.jsx)(td,{componentName:"QuadrantChart",message:pe,width:q,height:Y}):(0,Gf.jsx)(sd,{componentName:"QuadrantChart",width:q,height:Y,children:(0,Gf.jsx)(Ka,{ref:o,...be})})});Xf.displayName="QuadrantChart";var Uf=c(require("react")),Kf=require("react"),Qf=require("react/jsx-runtime"),Zf="__ma_unitized",Jf="__ma_series";function eg(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function tg(e,t){return t[0]+e*(t[1]-t[0])}var og=(0,Kf.forwardRef)(function(e,t){const o=(0,Kf.useRef)(null),r=(0,Kf.useRef)([]),n=(0,Kf.useRef)(e.series);n.current=e.series,(0,Kf.useImperativeHandle)(t,()=>{const e=()=>(n.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!o.current)return;const n=e(),i=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],s=t.extent||r.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&o.current.push({...i,[Zf]:eg(a,s),[Jf]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!o.current)return;const n=e(),i=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const o=n[t],s=o.extent||r.current[t];if(!s)continue;const a=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Zf]:eg(a,s),[Jf]:o.label||"Series "+(t+1)})}o.current.pushMany(i)},remove:e=>o.current?.remove(e)??[],update:(e,t)=>o.current?.update(e,t)??[],clear:()=>o.current?.clear(),getData:()=>o.current?.getData()??[],getScales:()=>o.current?.getScales()??null}},[]);const i=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:d,colorScheme:h,curve:p="monotoneX",lineWidth:f=2,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,stroke:_,strokeWidth:L,opacity:R}=e,{width:T,height:I,enableHover:$,showGrid:N,showLegend:F=!0,title:B,description:D,summary:E,accessibleTable:H,xLabel:O}=i,W=(0,Kf.useMemo)(()=>z(s),[s]),q=(0,Kf.useMemo)(()=>z(d),[d]),Y=q,G=2===q.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||G||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const V=ud(A,T,I,C),X=V?null:cd(s,T,I,M),U=cp(),K=(0,Kf.useMemo)(()=>{let e;if(Array.isArray(h))e=h;else if(U&&U.length>0)e=U;else{const t=Be[h];e=Array.isArray(t)?t:De}return Y.map((t,o)=>t.color||e[o%e.length])},[Y,h,U]),Q=(0,Kf.useMemo)(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:Z,extents:J}=(0,Kf.useMemo)(()=>{if(0===W.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(r.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.map(e=>e.extent||function(e,t){let o=1/0,r=-1/0;const n="function"==typeof t?t:e=>e[t];for(const t of e){const e=n(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>r&&(r=e))}if(!isFinite(o)||!isFinite(r))return[0,1];if(o===r){const e=0===o?1:.1*Math.abs(o);return[o-e,r+e]}return[o,r]}(W,e.yAccessor));if(r.current=e,!G){const t=[];for(const e of W)for(let o=0;q.length>o;o++){const r=q[o],n=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(e);null!=n&&t.push({...e,[Zf]:n,[Jf]:Q[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of W)for(let r=0;2>r;r++){const n=q[r],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(o);null!=i&&t.push({...o,[Zf]:eg(i,e[r]),[Jf]:Q[r]})}return{unitizedData:t,extents:e}},[W,q,G,Q]),ee=(0,Kf.useMemo)(()=>{if(G&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:q[0].format||(e=>{const t=tg(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:q[1].format||(e=>{const t=tg(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[G,J,q,Q]),te=_p({data:(0,Kf.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Jf]:e})),[Z,Q]),rawData:s,colorBy:Jf,colorScheme:K,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:[Jf],unwrapData:!1,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:S,showLegend:F,userMargin:a,marginDefaults:G?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:T,height:I}),oe=(0,Kf.useMemo)(()=>{const e=new Map;return Q.forEach((t,o)=>e.set(t,K[o])),e},[Q,K]),re=Jp({lineWidth:f,resolveStroke:(0,Kf.useCallback)(e=>oe.get(e[Jf])||K[0],[oe,K]),stroke:_,strokeWidth:L,opacity:R,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),ne=(0,Kf.useMemo)(()=>{if(!1===g)return()=>null;return Bs(g)||(e=>{const t=e.data||e,o=t[Jf],r=Q.indexOf(o),n=t[Zf],i=G&&r>=0&&J[r]?tg(n,J[r]):n,s=r>=0&&q[r]?.format?q[r].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return Uf.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},Uf.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[r]||"inherit"}},o),Uf.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),Uf.createElement("div",null,`${o}: ${s(i)}`))})},[g,Q,K,J,G,q,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Sp({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=G?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Zf,groupAccessor:Jf,lineStyle:re,colorScheme:K,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:O,...G?{}:{yLabel:Q[0]},xFormat:c,...G&&se&&{yExtent:se},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:N,curve:p,...te.legendBehaviorProps,...B&&{title:B},...D&&{description:D},...E&&{summary:E},...void 0!==H&&{accessibleTable:H},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:ne,...m&&{annotations:m},...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...y};return V||X||(ie?(0,Qf.jsx)(td,{componentName:"MultiAxisLineChart",message:ie,width:T,height:I}):(0,Qf.jsx)(sd,{componentName:"MultiAxisLineChart",width:T,height:I,children:(0,Qf.jsx)(Ka,{ref:o,...ae})}))});og.displayName="MultiAxisLineChart";var rg=require("react");function ng(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var ig=require("react/jsx-runtime"),sg=(0,rg.forwardRef)(function(e,t){const o=(0,rg.useRef)(null);Rp(t,{variant:"xy",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:d="low",openAccessor:h,closeAccessor:p,candlestickStyle:f,tooltip:g,annotations:m,xExtent:y,yExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,chartId:A,loading:C,loadingContent:M,emptyContent:j}=e,{width:P,height:_,enableHover:L,showGrid:R,title:T,description:I,summary:$,accessibleTable:N,xLabel:F,yLabel:B}=r,D=ud(C,P,_,M),E=D?null:cd(n,P,_,j),H=(0,rg.useMemo)(()=>z(n),[n]),O=null==h||null==p;dd("CandlestickChart",H,"xAccessor",c),dd("CandlestickChart",H,"highAccessor",u),dd("CandlestickChart",H,"lowAccessor",d),O||(dd("CandlestickChart",H,"openAccessor",h),dd("CandlestickChart",H,"closeAccessor",p));const{customHoverBehavior:W,customClickBehavior:q,crosshairSourceId:Y}=pp({selection:x,linkedHover:k,onObservation:w,onClick:S,chartType:"CandlestickChart",chartId:A,mobileInteraction:r.mobileInteraction}),G=fp(k,Y),V=(0,rg.useMemo)(()=>{const t=r.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?o:{...o,...ng(i)}},[i,r.marginDefaults,e.mode]),X=(0,rg.useMemo)(()=>{const e=[{label:F||Na(c),accessor:c,role:"x",format:a}];return O?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:d,format:l})):(e.push({label:"Open",accessor:h,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:d,format:l}),e.push({label:"Close",accessor:p,format:l})),za(e)},[c,F,a,l,u,d,h,p,O]),U=Sp({componentName:"CandlestickChart",data:n,accessors:{xAccessor:c,highAccessor:u,lowAccessor:d,...!O&&{openAccessor:h,closeAccessor:p}}}),K={chartType:"candlestick",...null!=n&&{data:H},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:d,...!O&&{openAccessor:h,closeAccessor:p},...f&&{candlestickStyle:f},scalePadding:Math.max(2,Math.min(12,Math.round(P/40))),extentPadding:P>200?.1:.02,size:[P,_],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V,showAxes:r.showAxes,xLabel:F,yLabel:B,xFormat:a,yFormat:l,enableHover:L,showGrid:R,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Yd({title:T,description:I,summary:$,accessibleTable:N,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:X}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,mobileInteraction:r.mobileInteraction,customHoverBehavior:W,customClickBehavior:q}),...m&&m.length>0&&{annotations:m},...y&&{xExtent:y},...b&&{yExtent:b},...G,...v};return D||E||(U?(0,ig.jsx)(td,{componentName:"CandlestickChart",message:U,width:P,height:_}):(0,ig.jsx)(sd,{componentName:"CandlestickChart",width:P,height:_,children:(0,ig.jsx)(Ka,{ref:o,...K})}))});sg.displayName="CandlestickChart";var ag=require("react"),lg=require("react");function cg(e){const t=(0,lg.useRef)(null);return Rp(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,lg.useMemo)(()=>ng(e.margin),[e.margin])}}function ug(e){const t=cg(e),{resolved:o,normalizedMargin:r}=t,n=_p({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:o.showLegend,userMargin:r,marginDefaults:o.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:o.width,height:o.height});return{...t,safeData:n.data,setup:n,earlyReturn:n.earlyReturn}}var dg=require("react/jsx-runtime"),hg=(0,ag.forwardRef)(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:d,onObservation:h,onClick:p,selection:f,linkedHover:g,chartId:m,loading:y,loadingContent:b,emptyContent:v,colorBy:x,colorScheme:k,frameProps:w={}}=e,{frameRef:S,resolved:A,safeData:C,setup:M,earlyReturn:j}=ug({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:x,colorScheme:k,selection:f,linkedHover:g,onObservation:h,onClick:p,chartId:m,loading:y,loadingContent:b,emptyContent:v,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),P=M.effectiveSelectionHook,_=(0,ag.useMemo)(()=>P?.isActive?{isActive:!0,predicate:P.predicate}:null,[P?.isActive,P?.predicate]);if(j)return j;const{width:L,height:R,enableHover:T,showGrid:I,title:$,description:N,summary:F,accessibleTable:B,xLabel:D,yLabel:E}=A,z={chartType:"custom",...null!=o&&{data:C},customLayout:r,layoutConfig:n,onLayoutError:i,..._&&{layoutSelection:_},xExtent:s,yExtent:a,colorAccessor:x,colorScheme:k,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:D,yLabel:E,enableHover:T,showGrid:I,...M.legendBehaviorProps,...Yd({title:$,description:N,summary:F,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...Gd({linkedHover:g,selection:f,onObservation:h,onClick:p,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...d&&d.length>0&&{annotations:d},...M.crosshairProps,...w};return(0,dg.jsx)(sd,{componentName:"XYCustomChart",width:L,height:R,children:(0,dg.jsx)(Ka,{ref:S,...z})})});hg.displayName="XYCustomChart";var pg=require("react"),fg=require("react/jsx-runtime"),gg=(0,pg.forwardRef)(function(e,t){const{nodes:o,edges:r,layout:n,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:c="target",margin:u,className:d,colorBy:h,colorScheme:p,selection:f,linkedHover:g,onObservation:m,onClick:y,chartId:b,annotations:v,autoPlaceAnnotations:x,frameProps:k={}}=e,{frameRef:w,resolved:S,normalizedMargin:A}=cg({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),C=(0,pg.useMemo)(()=>z(o??[]),[o]),M=(0,pg.useMemo)(()=>z(r??[]),[r]),j=lp(e.mobileInteraction,{mode:e.mode,width:S.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:P,customClickBehavior:_,activeSelectionHook:L}=pp({selection:f,linkedHover:g,fallbackFields:"string"==typeof h?[h]:[],onObservation:m,onClick:y,chartType:"NetworkCustomChart",chartId:b,colorByField:"string"==typeof h?h:void 0,mobileInteraction:j}),R=(0,pg.useMemo)(()=>L?.isActive?{isActive:!0,predicate:L.predicate}:null,[L?.isActive,L?.predicate]),{width:T,height:I,enableHover:$,title:N,description:F,summary:B,accessibleTable:D}=S,E={chartType:"force",...null!=o&&{nodes:C},...null!=r&&{edges:M},customNetworkLayout:n,layoutConfig:i,onLayoutError:s,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,size:[T,I],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:A,className:d,title:N,description:F,summary:B,accessibleTable:D,enableHover:$,...Gd({linkedHover:g,selection:f,onObservation:m,onClick:y,mobileInteraction:j,customHoverBehavior:P,customClickBehavior:_,linkedHoverInClickPredicate:!1}),layoutSelection:R,...null!=v&&{annotations:v},...null!=x&&{autoPlaceAnnotations:x},...k};return(0,fg.jsx)(sd,{componentName:"NetworkCustomChart",width:T,height:I,children:(0,fg.jsx)(qd,{ref:w,...E})})});gg.displayName="NetworkCustomChart";var mg=require("react"),yg=require("react/jsx-runtime"),bg=(0,mg.forwardRef)(function(e,t){const{data:o,layout:r,layoutConfig:n,onLayoutError:i,categoryAccessor:s="category",valueAccessor:a="value",oExtent:l,rExtent:c,projection:u="vertical",margin:d,className:h,colorBy:p,colorScheme:f,showAxes:g=!1,annotations:m,onObservation:y,onClick:b,selection:v,linkedHover:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,frameProps:C={}}=e,{frameRef:M,resolved:j,safeData:P,setup:_,earlyReturn:L}=ug({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"OrdinalCustomChart",unwrapData:!0,data:o,colorBy:p,colorScheme:f,selection:v,linkedHover:x,onObservation:y,onClick:b,chartId:k,loading:w,loadingContent:S,emptyContent:A,margin:d,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),R=_.effectiveSelectionHook,T=(0,mg.useMemo)(()=>R?.isActive?{isActive:!0,predicate:R.predicate}:null,[R?.isActive,R?.predicate]);if(L)return L;const{width:I,height:$,enableHover:N,showGrid:F,title:B,description:D,summary:E,accessibleTable:z}=j,H={chartType:"custom",...null!=o&&{data:P},customLayout:r,layoutConfig:n,onLayoutError:i,...T&&{layoutSelection:T},oAccessor:s,rAccessor:a,oExtent:l,rExtent:c,projection:u,colorAccessor:p,colorScheme:f,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:_.margin,enableHover:N,showAxes:g,showGrid:F,annotations:m,...Yd({title:B,description:D,summary:E,accessibleTable:z,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Gd({linkedHover:x,selection:v,onObservation:y,onClick:b,hoverHighlight:!1,mobileInteraction:_.mobileInteraction,customHoverBehavior:_.customHoverBehavior,customClickBehavior:_.customClickBehavior}),...C};return(0,yg.jsx)(sd,{componentName:"OrdinalCustomChart",width:I,height:$,children:(0,yg.jsx)(sc,{ref:M,...H})})});bg.displayName="OrdinalCustomChart";var vg=require("react"),xg=require("react");function kg({ref:e,frameRef:t,setup:o}){return(0,xg.useImperativeHandle)(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,o)=>t.current?.update(e,o)??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t]),{effectiveLegendProps:o.legendBehaviorProps,effectiveMargin:o.margin}}var wg=require("react");function Sg(e){const{colorBy:t,colorScale:o,color:r,themeCategorical:n,colorScheme:i,categoryIndexMap:s,userPieceStyle:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:d,resolvedSelection:h,cycleByCategory:p=!1,baseStyleExtras:f,linkStrokeToFill:g=!1}=e,m=(0,wg.useMemo)(()=>(e,a)=>{const l="function"==typeof f?f(e,a):f,c=l?{...l}:{};if(void 0===c.fill)if(t){if(!o)return c;c.fill=Oe(e,t,o)}else c.fill=up(r,n,i,p?a:void 0,s);return g&&void 0===c.stroke&&void 0!==c.fill&&(c.stroke=c.fill),c},[t,o,r,n,i,s,p,f,g]),y=(0,wg.useMemo)(()=>Ip(a?"function"==typeof a?(e,t)=>({...m(e,t),...a(e,t)||{}}):(e,t)=>({...m(e,t),...a}):m,{stroke:l,strokeWidth:c,opacity:u}),[m,a,l,c,u]);return(0,wg.useMemo)(()=>Bh(y,d??null,h),[y,d,h])}var Ag=require("react/jsx-runtime"),Cg=(0,vg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,vg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,sort:p=!1,barPadding:f=40,roundedTop:g,gradientFill:m=!1,baselinePadding:y=!1,tooltip:b,annotations:v,regression:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:I,color:$,stroke:N,strokeWidth:F,opacity:B,showCategoryTicks:D,categoryFormat:E,dataIdAccessor:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=(0,vg.useMemo)(()=>z(n),[n]),ee=_p({data:J,rawData:n,colorBy:d,colorScheme:h,legendInteraction:T,legendPosition:I,selection:S,linkedHover:A,fallbackFields:d?["string"==typeof d?d:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BarChart",chartId:P,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:O,height:W}),{effectiveLegendProps:te,effectiveMargin:oe}=kg({ref:t,frameRef:r,setup:ee});dd("BarChart",J,"categoryAccessor",a),dd("BarChart",J,"valueAccessor",l);const re=hp(J,p,l),ne=cp(),ie=(0,vg.useMemo)(()=>new Map,[J]),se=Sg({colorBy:d,colorScale:ee.colorScale,color:$,themeCategorical:ne,colorScheme:h,categoryIndexMap:ie,userPieceStyle:w?.pieceStyle,stroke:N,strokeWidth:F,opacity:B,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection}),ae=(0,vg.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",valueFormat:u}),[a,l,d,u]);if(ee.earlyReturn)return ee.earlyReturn;const le=Sp({componentName:"BarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(le)return(0,Ag.jsx)(td,{componentName:"BarChart",message:le,width:O,height:W});const ce=Bp(x),ue=ce?[ce,...v||[]]:v,de={chartType:"bar",...null!=n&&{data:re},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:se,size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe,barPadding:f,...null!=g&&{roundedTop:g},...m&&{gradientFill:!0===m?{topOpacity:.8,bottomOpacity:.05}:m},...H&&{dataIdAccessor:H},baselinePadding:y,enableHover:q,showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:u,...E&&{oFormat:E},showGrid:Y,showCategoryTicks:D,oSort:p,...te,...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:ae}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...ue&&ue.length>0&&{annotations:ue},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return(0,Ag.jsx)(sd,{componentName:"BarChart",width:O,height:W,children:(0,Ag.jsx)(sc,{ref:r,...de})})});Cg.displayName="BarChart";var Mg=require("react"),jg=require("react/jsx-runtime"),Pg=(0,Mg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Mg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",stackBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,normalize:f=!1,sort:g=!1,barPadding:m=40,roundedTop:y,baselinePadding:b=!1,tooltip:v,annotations:x,valueExtent:k,frameProps:w={},selection:S,linkedHover:A,onObservation:C,onClick:M,hoverHighlight:j,chartId:P,loading:_,loadingContent:L,emptyContent:R,legendInteraction:T,legendPosition:I,color:$,stroke:N,strokeWidth:F,opacity:B,categoryFormat:D}=e,{width:E,height:H,enableHover:O,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=(0,Mg.useMemo)(()=>z(n),[n]),Z=h||l,J=_p({data:Q,rawData:n,colorBy:Z,colorScheme:p,legendInteraction:T,legendPosition:I,selection:S,linkedHover:A,fallbackFields:Z?["string"==typeof Z?Z:""]:[],unwrapData:!0,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedBarChart",chartId:P,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:_,loadingContent:L,emptyContent:R,width:E,height:H}),ee=cp(),te=(0,Mg.useMemo)(()=>new Map,[Q]),oe=Sg({colorBy:Z,colorScale:J.colorScale,color:$,themeCategorical:ee,colorScheme:p,categoryIndexMap:te,userPieceStyle:w?.pieceStyle,stroke:N,strokeWidth:F,opacity:B,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),re=(0,Mg.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),ne=Sp({componentName:"StackedBarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{stackBy:l}}),{effectiveLegendProps:ie,effectiveMargin:se}=kg({ref:t,frameRef:r,setup:J});if(J.earlyReturn)return J.earlyReturn;const ae={chartType:"bar",...null!=n&&{data:Q},oAccessor:a,rAccessor:c,stackBy:l,normalize:f,oSort:g,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:oe,size:[E,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,barPadding:m,...null!=y&&{roundedTop:y},baselinePadding:b,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...D&&{oFormat:D},showGrid:W,...ie,...Yd({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:v,defaultTooltipContent:re}),...Gd({linkedHover:A,selection:S,onObservation:C,onClick:M,hoverHighlight:j,mobileInteraction:J.mobileInteraction,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior}),...x&&x.length>0&&{annotations:x},...k&&{rExtent:k},...Object.fromEntries(Object.entries(w).filter(([e])=>"pieceStyle"!==e))};return ne?(0,jg.jsx)(td,{componentName:"StackedBarChart",message:ne,width:E,height:H}):(0,jg.jsx)(sd,{componentName:"StackedBarChart",width:E,height:H,children:(0,jg.jsx)(sc,{ref:r,...ae})})});Pg.displayName="StackedBarChart";var _g=c(require("react")),Lg=require("react"),Rg=require("react"),Tg=require("react"),Ig={RdBu:Le,PiYG:Re,PRGn:Te,BrBG:Ie,RdYlBu:$e,RdYlGn:Ne,Spectral:Fe},$g="__likert_neutral_neg",Ng="__likert_neutral_pos";function Fg(e,t){if("function"==typeof e)return e;const o=e||t;return e=>e[o]}function Bg(e,t,o,r,n,i){const s=new Map,a=new Set(t);for(const l of e){const e=o(l);s.has(e)||s.set(e,new Map);const c=s.get(e);if(r){const e=r(l);if(null==e||!Number.isFinite(e))continue;if(!Number.isInteger(e)){"production"!==process.env.NODE_ENV&&console.warn("[LikertChart] Ignoring non-integer Likert score:",e);continue}const o=e-1;if(0>o||o>=t.length)continue;const n=t[o];c.set(n,(c.get(n)||0)+1)}else if(n&&i){const e=n(l),t=i(l);if(!a.has(e))continue;c.set(e,(c.get(e)||0)+(Number.isFinite(t)?t:0))}}const l=[];for(const[e,o]of s){let r=0;for(const e of t)r+=o.get(e)||0;if(0!==r)for(let n=0;t.length>n;n++){const i=t[n],s=o.get(i)||0;l.push({__likertCategory:e,__likertLevel:i,__likertLevelLabel:i,__likertCount:s,__likertPct:s/r*100,__likertLevelIndex:n})}}return l}function Dg(e,t){const o=t.length,r=o%2!=0,n=Math.floor(o/2),i=[];for(const t of e){const e=t.__likertLevelIndex;if(r&&e===n){const e=t.__likertPct/2;i.push({...t,__likertLevel:$g,__likertPct:-e}),i.push({...t,__likertLevel:Ng,__likertPct:e})}else i.push(n>e?{...t,__likertPct:-t.__likertPct}:t)}return i}function Eg(e,t){const o=t.length,r=o%2!=0,n=Math.floor(o/2),i=new Map;for(const t of e){const e=i.get(t.__likertCategory)||[];e.push(t),i.set(t.__likertCategory,e)}const s=[];for(const[,e]of i){const t=new Map;let i,a;for(const o of e)o.__likertLevel===$g?i=o:o.__likertLevel===Ng?a=o:t.set(o.__likertLevelIndex,o);r&&i&&s.push(i);for(let e=n-1;e>=0;e--){const o=t.get(e);o&&s.push(o)}r&&a&&s.push(a);for(let e=r?n+1:n;o>e;e++){const o=t.get(e);o&&s.push(o)}}return s}var zg=["Very Low","Low","Neutral","High","Very High"],Hg=require("react/jsx-runtime"),Og=new Map,Wg=(0,Lg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Lg.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="question",valueAccessor:l,levelAccessor:c,countAccessor:u="count",levels:d=zg,orientation:h="horizontal",colorScheme:p,barPadding:f=20,tooltip:g,annotations:m,valueExtent:y,frameProps:b={},selection:v,linkedHover:x,onObservation:k,onClick:w,hoverHighlight:S,chartId:A,valueFormat:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,categoryFormat:R,stroke:T,strokeWidth:I,opacity:$}=e,{width:N,height:F,enableHover:B,showGrid:D,showLegend:E,title:z,description:H,summary:O,accessibleTable:W,categoryLabel:q,valueLabel:Y}=o,G="horizontal"===h,V=void 0===n,X=!c,U=function(){const e=Zh();return e?.colors?.diverging||void 0}(),K=(0,Lg.useMemo)(()=>p&&Array.isArray(p)&&p.length>=d.length?p:function(e,t){if(0>=e)return[];if(t){const o=Ig[t];if(o){if(1===e)return[o(.5)];const t=[];for(let r=0;e>r;r++)t.push(o(r/(e-1)));return t}}const o=["#da1e28","#ff8389","#ffb3b8"],r=["#a6c8ff","#4589ff","#0043ce"],n="#a8a8a8";if(1===e)return[n];const i=e%2!=0,s=Math.floor(e/2),a=[];for(let e=0;s>e;e++)a.push(o[Math.min(Math.floor(e*o.length/s),o.length-1)]);i&&a.push(n);for(let e=0;s>e;e++)a.push(r[Math.min(Math.floor(e*r.length/s),r.length-1)]);return a}(d.length,U),[p,d.length,U]),Q=(0,Lg.useMemo)(()=>{const e=new Map;for(let t=0;d.length>t;t++)e.set(d[t],K[t]||"#888");return e},[d,K]),{processedData:Z,reAggregate:J,accumulatorRef:ee}=function({data:e,levels:t,categoryAccessor:o,valueAccessor:r,levelAccessor:n,countAccessor:i,isDiverging:s,frameRef:a}){const l=!n,c=(0,Tg.useMemo)(()=>Fg(o,"question"),[o]),u=(0,Tg.useMemo)(()=>l?Fg(r,"score"):null,[l,r]),d=(0,Tg.useMemo)(()=>l?null:Fg(n,"level"),[l,n]),h=(0,Tg.useMemo)(()=>l?null:Fg(i,"count"),[l,i]),p=e||[],f=(0,Tg.useRef)([]);return{processedData:(0,Tg.useMemo)(()=>{if(0===p.length)return[];let e=Bg(p,t,c,u,d,h);return s&&(e=Dg(e,t),e=Eg(e,t)),e},[p,t,c,u,d,h,s]),reAggregate:(0,Tg.useCallback)(e=>{let o=Bg(e,t,c,u,d,h);s&&(o=Dg(o,t),o=Eg(o,t)),a.current?.replace(o)},[t,c,u,d,h,s,a]),accumulatorRef:f}}({data:n,levels:d,categoryAccessor:a,valueAccessor:l,levelAccessor:c,countAccessor:u,isDiverging:G,frameRef:r}),te="__likertLevelLabel",oe=function({isPushMode:e,colorBy:t,colorScheme:o,showLegend:r,legendPosition:n="right"}){const i=(0,Rg.useRef)(new Set),s=(0,Rg.useRef)([]),[a,l]=(0,Rg.useState)(0),c=th(),u=cp(),d=(0,Rg.useCallback)(e=>{if(!t)return null;const o="function"==typeof t?t(e):e[t];return null!=o?o+"":null},[t]),h=(0,Rg.useCallback)(o=>{if(!e||!t)return;let r=!1;for(const e of o){if(!e||"object"!=typeof e)continue;const t=d(e);null==t||i.current.has(t)||(i.current.add(t),s.current.push(t),r=!0)}r&&l(e=>e+1)},[e,t,d]),p=(0,Rg.useCallback)(o=>{if(!e||!t)return;const r=Array.from(new Set(o.map(String))),n=s.current;n.length===r.length&&n.every((e,t)=>e===r[t])||(i.current=new Set(r),s.current=r,l(e=>e+1))},[e,t]),f=(0,Rg.useCallback)(e=>t=>{h([t]),e(t)},[h]),g=(0,Rg.useCallback)(e=>t=>{h(t),e(t)},[h]),m=(0,Rg.useCallback)(()=>{i.current=new Set,s.current=[],l(e=>e+1)},[]);_h(e&&t?s.current:[]);const y=(0,Rg.useMemo)(()=>{if(!e||!t||!1===r)return;const n=s.current;if(0===n.length)return;const i=Array.isArray(o)&&o.length>0||"string"==typeof o&&o.length>0?o:u&&u.length>0?u:Ee,a="string"==typeof t?t:"__streamCat",l=n.map(e=>({[a]:e})),d=qe(l,a,i);return $h({data:l,colorBy:a,colorScale:e=>c?.[e]||d(e)||"#999",getColor:Oe})},[e,t,r,o,c,u,a]),b=(0,Rg.useMemo)(()=>{if(y)return"right"===n?{right:110}:"left"===n?{left:110}:"top"===n?{top:50}:"bottom"===n?{bottom:80}:{right:110}},[y,n]);return{wrapPush:f,wrapPushMany:g,resetCategories:m,categories:s.current,categoryDomainProps:e&&t?{legendCategoryAccessor:t,onCategoriesChange:p}:{},streamingLegend:y,streamingMarginAdjust:b}}({isPushMode:V,colorBy:te,colorScheme:K,showLegend:E,legendPosition:L}),re=(0,Lg.useCallback)(oe.wrapPush(e=>{ee.current.push(e),J(ee.current)}),[oe.wrapPush,J,ee]),ne=(0,Lg.useCallback)(oe.wrapPushMany(e=>{ee.current.push(...e),J(ee.current)}),[oe.wrapPushMany,J,ee]);(0,Lg.useImperativeHandle)(t,()=>({push:re,pushMany:ne,remove:e=>r.current?.remove(e)??[],update:(e,t)=>r.current?.update(e,t)??[],clear:()=>{ee.current=[],oe.resetCategories(),r.current?.clear()},getData:()=>r.current?.getData()??[],getScales:()=>r.current?.getScales()??null}),[re,ne,oe.resetCategories,ee]);const ie=_p({data:Z,rawData:n,colorBy:te,colorScheme:K,legendInteraction:_,legendPosition:L,selection:v,linkedHover:x,fallbackFields:["__likertLevelLabel"],unwrapData:!0,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LikertChart",chartId:A,showLegend:E,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:N,height:F}),se=(0,Lg.useMemo)(()=>{const e=d.length;return e%2!=0&&Q.get(d[Math.floor(e/2)])||"#888"},[d,Q]),ae=Sg({colorBy:void 0,colorScale:void 0,color:void 0,themeCategorical:void 0,colorScheme:void 0,categoryIndexMap:Og,userPieceStyle:b?.pieceStyle,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,baseStyleExtras:e=>{const t=e.__likertLevelLabel||e.data?.__likertLevelLabel,o=e.__likertLevel||e.data?.__likertLevel;if(o===$g||o===Ng)return{fill:se};const r=t||o;return r&&Q.has(r)?{fill:Q.get(r)}:{fill:"#888"}}}),le=(0,Lg.useMemo)(()=>{const e=d.length;return e%2!=0?d[Math.floor(e/2)]:""},[d]),ce=(0,Lg.useMemo)(()=>e=>{const t=e.data||e,o=t.__likertLevel||"Unknown",r=o===$g||o===Ng?le:o,n=t.__likertCategory||"",i=Math.abs(t.__likertPct||0),s=o===$g||o===Ng?2*i:i,a=t.__likertCount||0;return _g.createElement("div",{className:"semiotic-tooltip",style:Rs},_g.createElement("div",{style:{fontWeight:"bold"}},n),_g.createElement("div",{style:{marginTop:4}},`${r}: ${s.toFixed(1)}% (n=${a})`))},[le]),ue=(0,Lg.useMemo)(()=>{if(!d||2>d.length)return"LikertChart requires `levels` with at least 2 entries.";if(l&&c)return"LikertChart: provide either `valueAccessor` (raw responses) or `levelAccessor` + `countAccessor` (pre-aggregated), not both.";if(c&&!u)return"LikertChart: pre-aggregated mode requires both `levelAccessor` and `countAccessor`.";if(void 0!==n&&0===n.length)return null;const e={categoryAccessor:a};return X?l&&(e.valueAccessor=l):(c&&(e.levelAccessor=c),u&&(e.countAccessor=u)),Sp({componentName:"LikertChart",data:n,accessors:e,requiredProps:{levels:d}})},[n,a,l,c,u,d,X]),de=(0,Lg.useMemo)(()=>[{styleFn:e=>({fill:Q.get(e.label)||"#888"}),items:d.map(e=>({label:e})),label:""}],[d,Q]),he=(0,Lg.useMemo)(()=>!1!==E?{...ie.legendBehaviorProps,legend:{legendGroups:de},legendPosition:L||ie.legendPosition||"bottom"}:ie.legendBehaviorProps,[ie.legendBehaviorProps,ie.legendPosition,L,E,de]),pe=(0,Lg.useMemo)(()=>{const e={...ie.margin};if(V&&!1!==E){const t=L||"bottom";"bottom"===t&&80>e.bottom?e.bottom=80:"top"===t&&50>e.top?e.top=50:"right"===t&&110>e.right?e.right=110:"left"===t&&110>e.left&&(e.left=110)}else if(oe.streamingMarginAdjust)for(const[t,o]of Object.entries(oe.streamingMarginAdjust))o>e[t]&&(e[t]=o);return G&&100>e.left&&(e.left=100),e},[ie.margin,oe.streamingMarginAdjust,G,V,E,L]),fe=(0,Lg.useMemo)(()=>C||(G?e=>Math.abs(Number(e)).toFixed(0)+"%":e=>Number(e).toFixed(0)+"%"),[G,C]);if(ie.earlyReturn)return ie.earlyReturn;const ge={chartType:"bar",...null!=n&&{data:Z},oAccessor:"__likertCategory",rAccessor:"__likertPct",stackBy:"__likertLevel",normalize:!1,projection:G?"horizontal":"vertical",pieceStyle:ae,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:f,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:q,rLabel:Y||(G?void 0:"Percentage"),rFormat:fe,...R&&{oFormat:R},showGrid:D,...he,...z&&{title:z},...H&&{description:H},...O&&{summary:O},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===g?()=>null:!0===g?ce:Bs(g)||ce,...Gd({linkedHover:x,selection:v,onObservation:k,onClick:w,hoverHighlight:S,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...m&&m.length>0&&{annotations:m},...y&&{rExtent:y},...Object.fromEntries(Object.entries(b).filter(([e])=>"pieceStyle"!==e))};return ue?(0,Hg.jsx)(td,{componentName:"LikertChart",message:ue,width:N,height:F}):(0,Hg.jsx)(sd,{componentName:"LikertChart",width:N,height:F,children:(0,Hg.jsx)(sc,{ref:r,...ge})})});Wg.displayName="LikertChart";var qg=require("react"),Yg=require("react");function Gg({brushProp:e,onBrushProp:t,linkedBrush:o,valueAccessor:r}){const n=Nh("string"==typeof o?o:o?{name:o.name,xField:o.rField}:void 0),i="string"==typeof r?r:"value",s=mh({name:n?.name||"__unused_ordinal_brush__",xField:n?.xField||i}),a=(0,Yg.useRef)(s.brushInteraction);a.current=s.brushInteraction;const l=(0,Yg.useCallback)(e=>{if(n){a.current.end(e?e.r:null)}t?.(e)},[t,n]),c=!!(e||o||t);return{hasBrush:c,handleBrush:l,brushStreamProps:c?{brush:{dimension:"r"},onBrush:l}:{}}}h();var Vg=require("react/jsx-runtime"),Xg=(0,qg.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,qg.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:d,colorBy:h,colorScheme:p,sizeBy:f,sizeRange:g=[3,8],symbolBy:m,symbolMap:y,pointRadius:b=4,pointOpacity:v=.7,categoryPadding:x=20,tooltip:k,annotations:w,valueExtent:S,brush:A,onBrush:C,linkedBrush:M,frameProps:j={},selection:P,linkedHover:_,onObservation:L,onClick:R,hoverHighlight:T,chartId:I,loading:$,loadingContent:N,emptyContent:F,legendInteraction:B,legendPosition:D,color:E,stroke:H,strokeWidth:O,opacity:W,showCategoryTicks:q,categoryFormat:Y}=e,{width:G,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,categoryLabel:te,valueLabel:oe}=o,re=(0,qg.useMemo)(()=>z(n),[n]),ne=_p({data:re,rawData:n,colorBy:h,colorScheme:p,legendInteraction:B,legendPosition:D,selection:P,linkedHover:_,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwarmPlot",chartId:I,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:$,loadingContent:N,emptyContent:F,width:G,height:V}),ie=Gg({brushProp:A,onBrushProp:C,linkedBrush:M,valueAccessor:l}),se=(0,qg.useMemo)(()=>{if(f)return u(re.map(e=>"function"==typeof f?f(e):e[f]))},[re,f]),ae=cp(),le=(0,qg.useMemo)(()=>new Map,[re]),ce=Sg({colorBy:h,colorScale:ne.colorScale,color:E,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:j?.pieceStyle,stroke:H,strokeWidth:O,opacity:W,effectiveSelectionHook:ne.effectiveSelectionHook,resolvedSelection:ne.resolvedSelection,baseStyleExtras:e=>({fillOpacity:v,r:f?Ye(e,f,g,se):b})}),ue=(0,qg.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:h||void 0,valueFormat:d}),[a,l,h,d]);if(ne.earlyReturn)return ne.earlyReturn;const de=Sp({componentName:"SwarmPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(de)return(0,Vg.jsx)(td,{componentName:"SwarmPlot",message:de,width:G,height:V});const he={chartType:"swarm",...null!=n&&{data:re},oAccessor:a,rAccessor:l,...m&&{symbolAccessor:m},...y&&{symbolMap:y},projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ce,size:[G,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ne.margin,barPadding:x,enableHover:X,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:te,rLabel:oe,rFormat:d,...Y&&{oFormat:Y},showGrid:U,showCategoryTicks:q,...ne.legendBehaviorProps,...Yd({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:k,defaultTooltipContent:ue}),...Gd({linkedHover:_,selection:P,onObservation:L,onClick:R,hoverHighlight:T,mobileInteraction:ne.mobileInteraction,customHoverBehavior:ne.customHoverBehavior,customClickBehavior:ne.customClickBehavior}),...w&&w.length>0&&{annotations:w},...S&&{rExtent:S},...ie.brushStreamProps,...Object.fromEntries(Object.entries(j).filter(([e])=>"pieceStyle"!==e))};return(0,Vg.jsx)(sd,{componentName:"SwarmPlot",width:G,height:V,children:(0,Vg.jsx)(sc,{ref:r,...he})})});Xg.displayName="SwarmPlot";var Ug=require("react"),Kg=require("react/jsx-runtime");function Qg(e){return t=>{const o=t.category||t.data&&t.data[0]?.category||"",r=t.stats||(t.data||t).stats;if(r&&null!=r.median)return(0,Kg.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=r.n&&(0,Kg.jsxs)("div",{children:["n = ",r.n]}),null!=r.min&&(0,Kg.jsxs)("div",{children:["Min: ",r.min.toLocaleString()]}),null!=r.q1&&(0,Kg.jsxs)("div",{children:["Q1: ",r.q1.toLocaleString()]}),(0,Kg.jsxs)("div",{children:["Median: ",r.median.toLocaleString()]}),null!=r.q3&&(0,Kg.jsxs)("div",{children:["Q3: ",r.q3.toLocaleString()]}),null!=r.max&&(0,Kg.jsxs)("div",{children:["Max: ",r.max.toLocaleString()]}),null!=r.mean&&(0,Kg.jsxs)("div",{style:{opacity:.8},children:["Mean: ",r.mean.toLocaleString(void 0,{maximumFractionDigits:2})]})]});if(e?.valueAccessor){const r=e.valueAccessor,n=(Array.isArray(t.data)?t.data:[]).map(e=>Number("function"==typeof r?r(e):e[r])).filter(e=>Number.isFinite(e)).sort((e,t)=>e-t),i=n.length,s=i>0?i%2!=0?n[Math.floor(i/2)]:(n[i/2-1]+n[i/2])/2:null;return(0,Kg.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),i>0&&(0,Kg.jsxs)("div",{children:["n = ",i]}),null!=s&&(0,Kg.jsxs)("div",{children:["Median: ",s.toLocaleString()]})]})}return(0,Kg.jsx)("div",{className:"semiotic-tooltip",style:Rs,children:(0,Kg.jsx)("div",{style:{fontWeight:"bold"},children:o+""})})}}var Zg=require("react/jsx-runtime"),Jg=(0,Ug.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Ug.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",valueFormat:u,colorBy:d,colorScheme:h,showOutliers:p=!0,outlierRadius:f=3,categoryPadding:g=20,tooltip:m,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,color:R,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,Ug.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:_,legendPosition:L,selection:x,linkedHover:k,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BoxPlot",chartId:C,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:B,height:D}),Q=cp(),Z=(0,Ug.useMemo)(()=>new Map,[U]),J=Sg({colorBy:d,colorScale:K.colorScale,color:R,themeCategorical:Q,colorScheme:h,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ee=(0,Ug.useMemo)(()=>Qg(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Sp({componentName:"BoxPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,Zg.jsx)(td,{componentName:"BoxPlot",message:te,width:B,height:D});const oe={chartType:"boxplot",...null!=n&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,showOutliers:p,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...F&&{oFormat:F},showGrid:H,showCategoryTicks:N,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:ee}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,Zg.jsx)(sd,{componentName:"BoxPlot",width:B,height:D,children:(0,Zg.jsx)(sc,{ref:r,...oe})})});Jg.displayName="BoxPlot";var em=require("react"),tm=require("react/jsx-runtime"),om=e=>{const t=e?.category;return null==t?"All":t+""},rm=(0,em.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:"horizontal",mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,em.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a=om,valueAccessor:l="value",bins:c=25,relative:u=!1,valueFormat:d,colorBy:h,colorScheme:p,categoryPadding:f=20,tooltip:g,annotations:m,valueExtent:y,brush:b,onBrush:v,linkedBrush:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:j,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:F,showCategoryTicks:B,categoryFormat:D}=e,{width:E,height:H,enableHover:O,showGrid:W,showLegend:q,title:Y,description:G,summary:V,accessibleTable:X,categoryLabel:U,valueLabel:K}=o,Q=(0,em.useMemo)(()=>z(n),[n]),Z=_p({data:Q,rawData:n,colorBy:h,colorScheme:p,legendInteraction:R,legendPosition:T,selection:w,linkedHover:S,fallbackFields:h?["string"==typeof h?h:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Histogram",chartId:j,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:E,height:H}),J=Gg({brushProp:b,onBrushProp:v,linkedBrush:x,valueAccessor:l}),ee=(0,em.useMemo)(()=>{if(0===Q.length)return;const e="function"==typeof l?l:e=>e[l];let t=1/0,o=-1/0;for(const r of Q){const n=e(r);null!=n&&isFinite(n)&&(t>n&&(t=n),n>o&&(o=n))}return t>o?void 0:[t,o]},[Q,l]),te=cp(),oe=(0,em.useMemo)(()=>new Map,[Q]),re=Sg({colorBy:h,colorScale:Z.colorScale,color:I,themeCategorical:te,colorScheme:p,categoryIndexMap:oe,userPieceStyle:void 0,stroke:$,strokeWidth:N,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection,baseStyleExtras:{fillOpacity:.8},linkStrokeToFill:!0}),ne=(0,em.useMemo)(()=>e=>{const t=e.data||e,o=t.category||e.category||"",r=t.count,n=t.range;return(0,tm.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,tm.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),null!=r&&(0,tm.jsxs)("div",{children:["Count: ",r]}),n&&2===n.length&&(0,tm.jsxs)("div",{style:{opacity:.8},children:[Number(n[0]).toFixed(1)," – ",Number(n[1]).toFixed(1)]})]})},[]);if(Z.earlyReturn)return Z.earlyReturn;const ie=Sp({componentName:"Histogram",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(ie)return(0,tm.jsx)(td,{componentName:"Histogram",message:ie,width:E,height:H});const se={chartType:"histogram",...null!=n&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal",summaryStyle:re,bins:c,normalize:u,...y?{rExtent:y}:ee&&{rExtent:ee},size:[E,H],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z.margin,barPadding:f,enableHover:O,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:U,rLabel:K,rFormat:d,...D&&{oFormat:D},showGrid:W,showCategoryTicks:B,...Z.legendBehaviorProps,...Yd({title:Y,description:G,summary:V,accessibleTable:X,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:ne}),...Gd({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...m&&m.length>0&&{annotations:m},...J.brushStreamProps,...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return(0,tm.jsx)(sd,{componentName:"Histogram",width:E,height:H,children:(0,tm.jsx)(sc,{ref:r,...se})})});rm.displayName="Histogram";var nm=require("react"),im=require("react/jsx-runtime"),sm=(0,nm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,nm.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="vertical",bins:u=25,curve:d="catmullRom",showIQR:h=!0,valueFormat:p,colorBy:f,colorScheme:g,categoryPadding:m=20,tooltip:y,annotations:b,valueExtent:v,brush:x,onBrush:k,linkedBrush:w,frameProps:S={},selection:A,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:P,chartId:_,loading:L,loadingContent:R,emptyContent:T,legendInteraction:I,legendPosition:$,color:N,stroke:F,strokeWidth:B,opacity:D,showCategoryTicks:E,categoryFormat:H}=e,{width:O,height:W,enableHover:q,showGrid:Y,showLegend:G,title:V,description:X,summary:U,accessibleTable:K,categoryLabel:Q,valueLabel:Z}=o,J=(0,nm.useMemo)(()=>z(n),[n]),ee=_p({data:J,rawData:n,colorBy:f,colorScheme:g,legendInteraction:I,legendPosition:$,selection:A,linkedHover:C,fallbackFields:f?["string"==typeof f?f:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ViolinPlot",chartId:_,showLegend:G,userMargin:i,marginDefaults:o.marginDefaults,loading:L,loadingContent:R,emptyContent:T,width:O,height:W}),te=Gg({brushProp:x,onBrushProp:k,linkedBrush:w,valueAccessor:l}),oe=cp(),re=(0,nm.useMemo)(()=>new Map,[J]),ne=Sg({colorBy:f,colorScale:ee.colorScale,color:N,themeCategorical:oe,colorScheme:g,categoryIndexMap:re,userPieceStyle:void 0,stroke:F,strokeWidth:B,opacity:D,effectiveSelectionHook:ee.effectiveSelectionHook,resolvedSelection:ee.resolvedSelection,baseStyleExtras:{fillOpacity:.6},linkStrokeToFill:!0}),ie=(0,nm.useMemo)(()=>Qg({valueAccessor:l}),[l]);if(ee.earlyReturn)return ee.earlyReturn;const se=Sp({componentName:"ViolinPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(se)return(0,im.jsx)(td,{componentName:"ViolinPlot",message:se,width:O,height:W});const ae={chartType:"violin",...null!=n&&{data:J},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:ne,bins:u,showIQR:h,size:[O,W],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ee.margin,barPadding:m,enableHover:q,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:Q,rLabel:Z,rFormat:p,...H&&{oFormat:H},showGrid:Y,showCategoryTicks:E,...ee.legendBehaviorProps,...Yd({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:y,defaultTooltipContent:ie}),...Gd({linkedHover:C,selection:A,onObservation:M,onClick:j,hoverHighlight:P,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior}),...b&&b.length>0&&{annotations:b},...v&&{rExtent:v},...te.brushStreamProps,...Object.fromEntries(Object.entries(S).filter(([e])=>"pieceStyle"!==e))};return(0,im.jsx)(sd,{componentName:"ViolinPlot",width:O,height:W,children:(0,im.jsx)(sc,{ref:r,...ae})})});sm.displayName="ViolinPlot";var am=require("react"),lm=require("react/jsx-runtime"),cm=(0,am.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,am.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",bins:u=20,amplitude:d=1.5,valueFormat:h,colorBy:p,colorScheme:f,categoryPadding:g=5,tooltip:m,annotations:y,valueExtent:b,frameProps:v={},selection:x,linkedHover:k,onObservation:w,onClick:S,hoverHighlight:A,chartId:C,loading:M,loadingContent:j,emptyContent:P,legendInteraction:_,legendPosition:L,color:R,stroke:T,strokeWidth:I,opacity:$,showCategoryTicks:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,am.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:p,colorScheme:f,legendInteraction:_,legendPosition:L,selection:x,linkedHover:k,fallbackFields:p?["string"==typeof p?p:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"RidgelinePlot",chartId:C,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:M,loadingContent:j,emptyContent:P,width:B,height:D}),Q=cp(),Z=(0,am.useMemo)(()=>new Map,[U]),J=Sg({colorBy:p,colorScale:K.colorScale,color:R,themeCategorical:Q,colorScheme:f,categoryIndexMap:Z,userPieceStyle:void 0,stroke:T,strokeWidth:I,opacity:$,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{fillOpacity:.5},linkStrokeToFill:!0}),ee=(0,am.useMemo)(()=>Qg(),[]);if(K.earlyReturn)return K.earlyReturn;const te=Sp({componentName:"RidgelinePlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(te)return(0,lm.jsx)(td,{componentName:"RidgelinePlot",message:te,width:B,height:D});const oe={chartType:"ridgeline",...null!=n&&{data:U},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",summaryStyle:J,bins:u,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:h,...F&&{oFormat:F},showGrid:H,showCategoryTicks:N,oSort:!1,amplitude:d,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:ee}),...Gd({linkedHover:k,selection:x,onObservation:w,onClick:S,hoverHighlight:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...y&&y.length>0&&{annotations:y},...b&&{rExtent:b},...Object.fromEntries(Object.entries(v).filter(([e])=>"pieceStyle"!==e))};return(0,lm.jsx)(sd,{componentName:"RidgelinePlot",width:B,height:D,children:(0,lm.jsx)(sc,{ref:r,...oe})})});cm.displayName="RidgelinePlot";var um=require("react"),dm=require("react/jsx-runtime"),hm=(0,um.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:!1,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:!1,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,um.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,stepAccessor:a="step",valueAccessor:l="value",categoryAccessor:c,colorBy:u,colorScheme:d,orientation:h="horizontal",connectorOpacity:p=.3,showLabels:f=!0,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,color:_,stroke:L,strokeWidth:R,opacity:T,categoryFormat:I}=e,$="vertical"===h,{width:N,height:F,enableHover:B,showLegend:D,title:E,description:H,summary:O,accessibleTable:W}=o,q=$?{top:E?60:40,right:20,bottom:60,left:60}:{top:E?40:10,right:10,bottom:10,left:10},Y=(0,um.useMemo)(()=>z(n),[n]),G=u||c,V=!G,X=_p({data:Y,rawData:n,colorBy:G,colorScheme:d,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:G?["string"==typeof G?G:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"FunnelChart",chartId:S,showLegend:D,userMargin:i,marginDefaults:q,loading:A,loadingContent:C,emptyContent:M,width:N,height:F});dd("FunnelChart",Y,"stepAccessor",a),dd("FunnelChart",Y,"valueAccessor",l);const U=cp(),K=(0,um.useMemo)(()=>new Map,[Y]),Q=(0,um.useMemo)(()=>{if(V)return _||(U?.[0]?U[0]:Array.isArray(d)&&d[0]?d[0]:"#4e79a7")},[V,_,U,d]),Z=Sg({colorBy:Q?void 0:G,colorScale:X.colorScale,color:Q??_,themeCategorical:U,colorScheme:d,categoryIndexMap:K,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:R,opacity:T,effectiveSelectionHook:X.effectiveSelectionHook,resolvedSelection:X.resolvedSelection}),J=(0,um.useMemo)(()=>e=>{const t=e?.data||e,o=t?.__funnelStep||t?.__barFunnelStep||t?.step||"",r=t?.__funnelValue??t?.__barFunnelValue??t?.value??"",n=t?.__funnelPercent??t?.__barFunnelPercent,i=t?.__funnelIsFirstStep??t?.__barFunnelIsFirstStep,s=t?.__barFunnelIsDropoff,a=t?.__barFunnelCategory??t?.category,l=null==n||i?"":` (${.05>Math.abs(n-Math.round(n))?Math.round(n)+"%":n.toFixed(1)+"%"})`;return(0,dm.jsxs)("div",{className:"semiotic-tooltip",style:Rs,children:[o&&(0,dm.jsx)("div",{style:{fontWeight:"bold"},children:o+""}),a&&a!==o&&(0,dm.jsx)("div",{style:{marginTop:2,opacity:.8},children:a+""}),s&&(0,dm.jsx)("div",{style:{marginTop:2,fontStyle:"italic",opacity:.7},children:"Dropoff"}),(0,dm.jsxs)("div",{style:{marginTop:4},children:[r+"",l]})]})},[]);if(X.earlyReturn)return X.earlyReturn;const ee=Sp({componentName:"FunnelChart",data:n,accessors:{stepAccessor:a,valueAccessor:l}});if(ee)return(0,dm.jsx)(td,{componentName:"FunnelChart",message:ee,width:N,height:F});const te={chartType:$?"bar-funnel":"funnel",...null!=n&&{data:Y},oAccessor:a,rAccessor:l,...c&&{stackBy:c},projection:$?"vertical":"horizontal",barPadding:$?40:0,pieceStyle:Z,size:[N,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:X.margin,enableHover:B,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:$,showCategoryTicks:$,...I&&{oFormat:I},showGrid:$,...!$&&{connectorOpacity:p},showLabels:f,...X.legendBehaviorProps,...E&&{title:E},...H&&{description:H},...O&&{summary:O},...void 0!==W&&{accessibleTable:W},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===g?()=>null:!0===g||null==g?J:Bs(g)||J,...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:X.mobileInteraction,customHoverBehavior:X.customHoverBehavior,customClickBehavior:X.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return(0,dm.jsx)(sd,{componentName:"FunnelChart",width:N,height:F,children:(0,dm.jsx)(sc,{ref:r,...te})})});hm.displayName="FunnelChart";var pm=require("react"),fm=require("react/jsx-runtime"),gm=(0,pm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid??!0,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,pm.useRef)(null);Rp(t,{variant:"xy",frameRef:r});const{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",orientation:c="horizontal",valueFormat:u,colorBy:d,colorScheme:h,sort:p="auto",dotRadius:f=5,categoryPadding:g=10,tooltip:m,annotations:y,regression:b,valueExtent:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:F}=e,{width:B,height:D,enableHover:E,showGrid:H,showLegend:O,title:W,description:q,summary:Y,accessibleTable:G,categoryLabel:V,valueLabel:X}=o,U=(0,pm.useMemo)(()=>z(n),[n]),K=_p({data:U,rawData:n,colorBy:d,colorScheme:h,legendInteraction:L,legendPosition:R,selection:k,linkedHover:w,fallbackFields:d?["string"==typeof d?d:""]:["string"==typeof a?a:""],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DotPlot",chartId:M,showLegend:O,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:P,emptyContent:_,width:B,height:D}),Q=hp(U,p,l),Z=cp(),J=(0,pm.useMemo)(()=>new Map,[U]),ee=Sg({colorBy:d,colorScale:K.colorScale,color:T,themeCategorical:Z,colorScheme:h,categoryIndexMap:J,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:K.effectiveSelectionHook,resolvedSelection:K.resolvedSelection,baseStyleExtras:{r:f,fillOpacity:.8}}),te=(0,pm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,valueFormat:u}),[a,l,u]);if(K.earlyReturn)return K.earlyReturn;const oe=Sp({componentName:"DotPlot",data:n,accessors:{categoryAccessor:a,valueAccessor:l}});if(oe)return(0,fm.jsx)(td,{componentName:"DotPlot",message:oe,width:B,height:D});const re=Bp(b),ne=re?[re,...y||[]]:y,ie={chartType:"point",...null!=n&&{data:Q},oAccessor:a,rAccessor:l,projection:"horizontal"===c?"horizontal":"vertical",pieceStyle:ee,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,barPadding:g,enableHover:E,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:V,rLabel:X,rFormat:u,...F&&{oFormat:F},showGrid:H,oSort:p,...K.legendBehaviorProps,...Yd({title:W,description:q,summary:Y,accessibleTable:G,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:m,defaultTooltipContent:te}),...Gd({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior}),...ne&&ne.length>0&&{annotations:ne},...v&&{rExtent:v},...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return(0,fm.jsx)(sd,{componentName:"DotPlot",width:B,height:D,children:(0,fm.jsx)(sc,{ref:r,...ie})})});gm.displayName="DotPlot";var mm=require("react"),ym=require("react/jsx-runtime"),bm=(0,mm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width??400,height:e.height??400,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,mm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",colorBy:c,colorScheme:u,startAngle:d=0,cornerRadius:h,tooltip:p,annotations:f,frameProps:g={},selection:m,linkedHover:y,onObservation:b,onClick:v,hoverHighlight:x,chartId:k,loading:w,loadingContent:S,emptyContent:A,legendInteraction:C,legendPosition:M,color:j,stroke:P,strokeWidth:_,opacity:L}=e,{width:R,height:T,enableHover:I,showLegend:$,title:N,description:F,summary:B,accessibleTable:D}=o,E=(0,mm.useMemo)(()=>z(n),[n]),H=c||a,O=_p({data:E,rawData:n,colorBy:H,colorScheme:u,legendInteraction:C,legendPosition:M,selection:m,linkedHover:y,fallbackFields:H?["string"==typeof H?H:""]:[],unwrapData:!0,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"PieChart",chartId:k,showLegend:$,userMargin:i,marginDefaults:o.marginDefaults,loading:w,loadingContent:S,emptyContent:A,width:R,height:T}),W=cp(),q=(0,mm.useMemo)(()=>new Map,[E]),Y=Sg({colorBy:H,colorScale:O.colorScale,color:j,themeCategorical:W,colorScheme:u,categoryIndexMap:q,userPieceStyle:g?.pieceStyle,stroke:P,strokeWidth:_,opacity:L,effectiveSelectionHook:O.effectiveSelectionHook,resolvedSelection:O.resolvedSelection,cycleByCategory:!0}),G=(0,mm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:c&&c!==a?c:void 0,groupLabel:"string"==typeof c?c:"group",pieData:!0}),[a,l,c]),V=Sp({componentName:"PieChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:X,effectiveMargin:U}=kg({ref:t,frameRef:r,setup:O});if(O.earlyReturn)return O.earlyReturn;const K={chartType:"pie",...null!=n&&{data:E},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:Y,startAngle:d,...null!=h&&{cornerRadius:h},size:[R,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U,enableHover:I,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...X,...Yd({title:N,description:F,summary:B,accessibleTable:D,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:p,defaultTooltipContent:G}),...Gd({linkedHover:y,selection:m,onObservation:b,onClick:v,hoverHighlight:x,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior}),...f&&f.length>0&&{annotations:f},...Object.fromEntries(Object.entries(g).filter(([e])=>"pieceStyle"!==e))};return V?(0,ym.jsx)(td,{componentName:"PieChart",message:V,width:R,height:T}):(0,ym.jsx)(sd,{componentName:"PieChart",width:R,height:T,children:(0,ym.jsx)(sc,{ref:r,...K})})});bm.displayName="PieChart";var vm=require("react"),xm=require("react/jsx-runtime"),km=(0,vm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,showCategoryTicks:e.showCategoryTicks,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:400,height:400}),r=(0,vm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",valueAccessor:l="value",innerRadius:c,centerContent:u,colorBy:d,colorScheme:h,startAngle:p=0,cornerRadius:f,tooltip:g,annotations:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,hoverHighlight:w,chartId:S,loading:A,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:P,color:_,stroke:L,strokeWidth:R,opacity:T}=e,{width:I,height:$,enableHover:N,showLegend:F,title:B,description:D,summary:E,accessibleTable:H}=o,O=(0,vm.useMemo)(()=>z(n),[n]),W=d||a,q=_p({data:O,rawData:n,colorBy:W,colorScheme:h,legendInteraction:j,legendPosition:P,selection:b,linkedHover:v,fallbackFields:W?["string"==typeof W?W:""]:[],unwrapData:!0,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DonutChart",chartId:S,showLegend:F,userMargin:i,marginDefaults:o.marginDefaults,loading:A,loadingContent:C,emptyContent:M,width:I,height:$}),Y=c??Math.max(2,.15*Math.min(I,$)),G=cp(),V=(0,vm.useMemo)(()=>new Map,[O]),X=Sg({colorBy:W,colorScale:q.colorScale,color:_,themeCategorical:G,colorScheme:h,categoryIndexMap:V,userPieceStyle:y?.pieceStyle,stroke:L,strokeWidth:R,opacity:T,effectiveSelectionHook:q.effectiveSelectionHook,resolvedSelection:q.resolvedSelection,cycleByCategory:!0}),U=(0,vm.useMemo)(()=>Ha({categoryAccessor:a,valueAccessor:l,groupAccessor:d&&d!==a?d:void 0,groupLabel:"string"==typeof d?d:"group",pieData:!0}),[a,l,d]),K=Sp({componentName:"DonutChart",data:n,accessors:{categoryAccessor:a,valueAccessor:l}}),{effectiveLegendProps:Q,effectiveMargin:Z}=kg({ref:t,frameRef:r,setup:q});if(q.earlyReturn)return q.earlyReturn;const J={chartType:"donut",...null!=n&&{data:O},oAccessor:a,rAccessor:l,projection:"radial",pieceStyle:X,innerRadius:Y,startAngle:p,...null!=f&&{cornerRadius:f},centerContent:u,size:[I,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Z,enableHover:N,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:!1,...Q,...Yd({title:B,description:D,summary:E,accessibleTable:H,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:U}),...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,hoverHighlight:w,mobileInteraction:q.mobileInteraction,customHoverBehavior:q.customHoverBehavior,customClickBehavior:q.customClickBehavior}),...m&&m.length>0&&{annotations:m},...Object.fromEntries(Object.entries(y).filter(([e])=>"pieceStyle"!==e))};return K?(0,xm.jsx)(td,{componentName:"DonutChart",message:K,width:I,height:$}):(0,xm.jsx)(sd,{componentName:"DonutChart",width:I,height:$,children:(0,xm.jsx)(sc,{ref:r,...J})})});km.displayName="DonutChart";var wm=require("react");function Sm(e=240){const t=360-e,o=180+t/2,r=o*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:o,startAngleRad:r,offsetRad:-Math.PI/2+r}}function Am(e){return Math.max(0,Math.min(1,e))}function Cm(e){const t=e.trim();if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e.split("").map(e=>e+e).join("")),6===e.length&&/^[0-9a-f]{6}$/i.test(e))return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const o=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(o){const e=[Number(o[1]),Number(o[2]),Number(o[3])];if(e.every(Number.isFinite))return e}return null}function Mm(e,t,o){const r=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(o)}`}function jm(e,t){const o=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Am(e.offset),color:e.color})).sort((e,t)=>e.offset-t.offset);if(0===o.length)return"#999999";if(1===o.length)return o[0].color;const r=Am(t);if(o[0].offset>=r)return o[0].color;if(r>=o[o.length-1].offset)return o[o.length-1].color;for(let e=0;o.length-1>e;e++){const t=o[e],n=o[e+1];if(t.offset>r||r>n.offset)continue;const i=n.offset-t.offset,s=i>0?(r-t.offset)/i:0,a=Cm(t.color),l=Cm(n.color);if(!a||!l)return.5>s?t.color:n.color;const[c,u,d]=a,[h,p,f]=l;return Mm(c+(h-c)*s,u+(p-u)*s,d+(f-d)*s)}return o[o.length-1].color}function Pm(e,t,o){return null==o?`${e}-${t}`:`${e}-${t}-${o}`}h();var _m=require("react/jsx-runtime"),Lm=(0,wm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:!1,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:300,height:250}),r=(0,wm.useRef)(null),n="context"===e.mode,{compactMode:i}=o,{value:s,min:a=0,max:l=100,thresholds:c,gradientFill:d,color:h,backgroundColor:p="var(--semiotic-grid, #e0e0e0)",arcWidth:f=.3,cornerRadius:g,showNeedle:m=!0,needleColor:y="var(--semiotic-text, #333)",centerContent:b,valueFormat:v,showScaleLabels:x=!i,sweep:k=240,fillZones:w=!0,tooltip:S,annotations:A,frameProps:C={},className:M,stroke:j,strokeWidth:P,opacity:_}=e,{width:L,height:R,title:T,description:I,summary:$,accessibleTable:N}=o,F=d&&"object"==typeof d?d:void 0,B=Math.max(a,Math.min(l,s)),D=l-a||1,E=(B-a)/D,{gaugeData:z,pieceStyle:H,gaugeAnnotations:O}=(0,wm.useMemo)(()=>function(e){const{min:t,max:o,value:r,thresholds:n,fillColor:i,backgroundColor:s,fillZones:a,showScaleLabels:l,gradientFill:c,gradientSteps:u=240}=e,d=o-t||1,h=(Math.max(t,Math.min(o,r))-t)/d;let p=n&&n.length>0?[...n].sort((e,t)=>e.value-t.value):[{value:o,color:i||"#007bff"}];p=p.map(e=>({...e,value:Math.max(t,Math.min(o,e.value))})),o>p[p.length-1].value&&p.push({value:o,color:p[p.length-1].color});const f=!!c&&c.colorStops.length>=2,g=[],m=new Map,y=[];if(f){const e=a?h:1,t=Pm("bg",0);if(g.push({category:t,value:1,_zone:"Track",_isFill:!1,_pctStart:0,_pct:1,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0}),m.set(t,{fill:s,opacity:.4}),e>0){const t=Math.max(1,Math.floor(u)),o=Math.max(1,Math.min(t,Math.round(e*t))),r=[];for(let t=0;o>t;t++)r.push(jm(c.colorStops,e*(t+.5)/o));const n=Pm("fill",0);g.push({category:n,value:e,_zone:"Gradient",_isFill:!0,_pctStart:0,_pct:e,_roundedEnds:{start:!0,end:!0},_nonInteractive:!0,_gradientBand:{colors:r}}),m.set(n,{fill:r[0]||s})}}else{let e=t;for(let o=0;p.length>o;o++){const r=p[o],n=(r.value-e)/d,i=(e-t)/d,l=(r.value-t)/d,c=Math.max(0,(a?Math.min(h,l):l)-i),u=a?Math.max(0,n-c):0;if(c>0){const e=Pm("fill",o);g.push({category:e,value:c,_zone:r.label||"Zone "+(o+1),_isFill:!0}),m.set(e,{fill:r.color})}if(u>0){const e=Pm("bg",o);g.push({category:e,value:u,_zone:r.label||"Zone "+(o+1),_isFill:!1}),m.set(e,{fill:s,opacity:.4})}e=r.value}}if(l&&n&&n.length>0)for(const e of n)e.value>t&&o>e.value&&y.push({type:"gauge-label",value:e.value,label:e.label||e.value+""});return{gaugeData:g,pieceStyle:(e,t)=>m.get(t||e.category)||{fill:s},gaugeAnnotations:y}}({min:a,max:l,value:s,thresholds:c,fillColor:h,backgroundColor:p,fillZones:w,showScaleLabels:x,gradientFill:F}),[s,a,l,c,h,p,x,w,F]),W=(0,wm.useMemo)(()=>Ip(H,{stroke:j,strokeWidth:P,opacity:_}),[H,j,P,_]),{sweepRad:q,startAngleDeg:Y}=Sm(k),G=function(e=240){const{sweepRad:t,offsetRad:o}=Sm(e),r=[[Math.cos(o),Math.sin(o)],[Math.cos(o+t),Math.sin(o+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-o)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||r.push([Math.cos(e),Math.sin(e)]);const n=r.map(e=>e[0]),i=r.map(e=>e[1]),[s,a]=u(n),[l,c]=u(i);return{minX:s,maxX:a,minY:l,maxY:c,width:a-s,height:c-l,cx:(s+a)/2,cy:(l+c)/2}}(k),V=Math.min(10,Math.max(1,Math.min(L,R)/12)),X=G.cx,U=G.cy,K=Math.max(4,Math.min((L-2*V)/G.width,(R-2*V)/G.height)-2),Q=Math.max(0,Math.min(K-1.5,K*(1-f))),Z=L/2-X*K,J=R/2-U*K,ee=2*(K+4),te=(0,wm.useMemo)(()=>{if(i&&null==b)return null;if(null!=b)return"function"==typeof b?b(B,a,l):b;const e=v?v(B):Math.round(B)+"";return(0,_m.jsxs)("div",{style:{textAlign:"center",lineHeight:1.2},children:[(0,_m.jsx)("div",{style:{fontSize:Math.max(16,.3*K),fontWeight:700,color:"var(--semiotic-text, #333)"},children:e}),x&&(0,_m.jsxs)("div",{style:{fontSize:11,color:"var(--semiotic-text-secondary, #666)"},children:[a," – ",l]})]})},[b,B,a,l,v,x,K,i]),oe=(0,wm.useMemo)(()=>n&&null==b?{type:"gauge-value",text:v?v(B):Math.round(B)+""}:null,[n,b,B,v]),re=(0,wm.useMemo)(()=>{if(!m)return null;const e=-Math.PI/2+Y*Math.PI/180+E*q,t=Q>20?Q-8:K-1;return{type:"gauge-needle",tipX:Math.cos(e)*t,tipY:Math.sin(e)*t,color:y}},[m,E,Y,q,Q,y]),ne=(0,wm.useMemo)(()=>(e,t,o)=>{if("gauge-needle"===e.type){const r=(o.width||L)/2,n=(o.height||R)/2,i=Math.max(1,K-Q),s=Math.max(1,Math.min(2.5,.4*i)),a=Math.max(1,Math.min(5,.6*i));return(0,_m.jsxs)("g",{transform:`translate(${r},${n})`,children:[(0,_m.jsx)("line",{x1:0,y1:0,x2:e.tipX,y2:e.tipY,stroke:e.color,strokeWidth:s,strokeLinecap:"round"}),(0,_m.jsx)("circle",{cx:0,cy:0,r:a,fill:e.color})]},"gauge-needle-"+t)}if("gauge-label"===e.type){const r=-Math.PI/2+Y*Math.PI/180+(e.value-a)/D*q,n=(o.width||L)/2,i=(o.height||R)/2,s=Q-1,l=K+1,c=Math.cos(r)*s,u=Math.sin(r)*s,d=Math.cos(r)*l,h=Math.sin(r)*l,p=K+10,f=Math.cos(r)*p,g=Math.sin(r)*p,m=((r+Math.PI/2)/(2*Math.PI)*12+12)%12;let y,b;return m>=11||1>m?(y="middle",b="auto"):m>=1&&5>m?(y="start",b="middle"):m>=5&&7>m?(y="middle",b="hanging"):(y="end",b="middle"),(0,_m.jsxs)("g",{transform:`translate(${n},${i})`,children:[(0,_m.jsx)("line",{x1:c,y1:u,x2:d,y2:h,stroke:"var(--semiotic-border)",strokeWidth:2,strokeLinecap:"round"}),(0,_m.jsx)("text",{x:f,y:g,textAnchor:y,dominantBaseline:b,fill:"var(--semiotic-text-secondary, #666)",style:{userSelect:"none",fontSize:"var(--semiotic-gauge-label-font-size, 10px)"},children:e.label})]},"gauge-label-"+t)}return"gauge-value"===e.type?(0,_m.jsx)("text",{x:(o.width||L)/2,y:(o.height||R)/2-.2*Q,textAnchor:"middle",dominantBaseline:"middle",fontSize:Math.max(12,Math.min(22,.28*K)),fontWeight:700,fill:"var(--semiotic-text, #333)",style:{userSelect:"none"},children:e.text},"gauge-value-"+t):null},[L,R,a,D,Y,q,Q,K]),ie=(0,wm.useMemo)(()=>{const e=[...O,...A||[]];return re&&e.push(re),oe&&e.push(oe),e},[O,A,re,oe]),se=(0,wm.useMemo)(()=>e=>{const t=e?.data?.[0]||e?.data||e,o=t?._zone||"",r=t?._isFill;return(0,_m.jsxs)("div",{className:"semiotic-tooltip",style:{padding:"6px 10px",background:"var(--semiotic-tooltip-bg, white)",borderRadius:"var(--semiotic-tooltip-radius, 6px)",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0,0,0,0.15))"},children:[(0,_m.jsx)("div",{style:{fontWeight:600},children:o}),(0,_m.jsx)("div",{style:{fontSize:"0.85em",color:"var(--semiotic-text-secondary, #666)"},children:r?"Current: "+Math.round(B):"Remaining"})]})},[B]);if(0===z.length)return(0,_m.jsx)(td,{componentName:"GaugeChart",message:"No data to display",width:L,height:R});const ae={chartType:"donut",data:z,oAccessor:"category",rAccessor:"value",oSort:!1,projection:"radial",pieceStyle:W,innerRadius:Q,startAngle:Y,sweepAngle:k,...null!=g&&{cornerRadius:g},centerContent:te,size:[L,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:{top:J-ee/2,bottom:R-J-ee/2,left:Z-ee/2,right:L-Z-ee/2},enableHover:o.enableHover,showAxes:!1,showCategoryTicks:!1,tooltipContent:!1===S?()=>null:Bs(S)||se,svgAnnotationRules:ne,...ie.length>0&&{annotations:ie},...T&&{title:T},...I&&{description:I},...$&&{summary:$},...void 0!==N&&{accessibleTable:N},...M&&{className:M},...null!=e.animate&&{animate:e.animate},...C};return(0,_m.jsx)(sd,{componentName:"GaugeChart",width:L,height:R,children:(0,_m.jsx)(sc,{ref:r,...ae})})});Lm.displayName="GaugeChart";var Rm=require("react"),Tm=require("react/jsx-runtime"),Im=(0,Rm.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,Rm.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",groupBy:l,valueAccessor:c="value",orientation:u="vertical",valueFormat:d,colorBy:h,colorScheme:p,sort:f=!1,barPadding:g=60,roundedTop:m,baselinePadding:y=!1,tooltip:b,annotations:v,valueExtent:x,frameProps:k={},selection:w,linkedHover:S,onObservation:A,onClick:C,hoverHighlight:M,chartId:j,loading:P,loadingContent:_,emptyContent:L,legendInteraction:R,legendPosition:T,color:I,stroke:$,strokeWidth:N,opacity:F,categoryFormat:B}=e,{width:D,height:E,enableHover:H,showGrid:O,showLegend:W,title:q,description:Y,summary:G,accessibleTable:V,categoryLabel:X,valueLabel:U}=o,K=(0,Rm.useMemo)(()=>z(n),[n]),Q=h||l,Z=_p({data:K,rawData:n,colorBy:Q,colorScheme:p,legendInteraction:R,legendPosition:T,selection:w,linkedHover:S,fallbackFields:Q?["string"==typeof Q?Q:""]:[],unwrapData:!0,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"GroupedBarChart",chartId:j,showLegend:W,userMargin:i,marginDefaults:o.marginDefaults,loading:P,loadingContent:_,emptyContent:L,width:D,height:E}),J=cp(),ee=(0,Rm.useMemo)(()=>new Map,[K]),te=Sg({colorBy:Q,colorScale:Z.colorScale,color:I,themeCategorical:J,colorScheme:p,categoryIndexMap:ee,userPieceStyle:k.pieceStyle,stroke:$,strokeWidth:N,opacity:F,effectiveSelectionHook:Z.effectiveSelectionHook,resolvedSelection:Z.resolvedSelection}),oe=(0,Rm.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),re=Sp({componentName:"GroupedBarChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c},requiredProps:{groupBy:l}}),{effectiveLegendProps:ne,effectiveMargin:ie}=kg({ref:t,frameRef:r,setup:Z});if(Z.earlyReturn)return Z.earlyReturn;const se={chartType:"clusterbar",...null!=n&&{data:K},oAccessor:a,rAccessor:c,groupBy:l,oSort:f,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:te,size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie,barPadding:g,...null!=m&&{roundedTop:m},baselinePadding:y,enableHover:H,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:X,rLabel:U,rFormat:d,...B&&{oFormat:B},showGrid:O,...ne,...Yd({title:q,description:Y,summary:G,accessibleTable:V,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:b,defaultTooltipContent:oe}),...Gd({linkedHover:S,selection:w,onObservation:A,onClick:C,hoverHighlight:M,mobileInteraction:Z.mobileInteraction,customHoverBehavior:Z.customHoverBehavior,customClickBehavior:Z.customClickBehavior}),...v&&v.length>0&&{annotations:v},...x&&{rExtent:x},...Object.fromEntries(Object.entries(k).filter(([e])=>"pieceStyle"!==e))};return re?(0,Tm.jsx)(td,{componentName:"GroupedBarChart",message:re,width:D,height:E}):(0,Tm.jsx)(sd,{componentName:"GroupedBarChart",width:D,height:E,children:(0,Tm.jsx)(sc,{ref:r,...se})})});Im.displayName="GroupedBarChart";var $m=require("react"),Nm=require("react/jsx-runtime"),Fm=(0,$m.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,categoryLabel:e.categoryLabel,valueLabel:e.valueLabel,showCategoryTicks:e.showCategoryTicks,orientation:e.orientation,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),r=(0,$m.useRef)(null),{data:n,margin:i,className:s,categoryAccessor:a="category",subcategoryAccessor:l,valueAccessor:c="value",orientation:u="horizontal",valueFormat:d,colorBy:h,colorScheme:p,barPadding:f,tooltip:g,annotations:m,brush:y,onBrush:b,linkedBrush:v,frameProps:x={},selection:k,linkedHover:w,onObservation:S,onClick:A,hoverHighlight:C,chartId:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,legendPosition:R,color:T,stroke:I,strokeWidth:$,opacity:N,categoryFormat:F,rTickValues:B,tickLabelEdgeAlign:D,showCategoryTicks:E,gradientFill:H,trackFill:O,roundedTop:W,valueExtent:q}=e,{width:Y,height:G,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,categoryLabel:ee,valueLabel:te}=o,oe=(0,$m.useMemo)(()=>z(n),[n]),re=h||l,ne=(0,$m.useMemo)(()=>{if(null!=f)return f;if("sparkline"!==e.mode)return 40;const t=new Set(oe.map(e=>"function"==typeof a?a(e):e[a])),o=Math.max(1,t.size);return o>1?Math.max(0,Math.min(1,(("horizontal"===u?G:Y)-2*o)/(o-1))):1},[f,e.mode,oe,a,u,Y,G]),ie=_p({data:oe,rawData:n,colorBy:re,colorScheme:p,legendInteraction:L,legendPosition:R,selection:k,linkedHover:w,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!0,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"SwimlaneChart",chartId:M,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:j,loadingContent:P,emptyContent:_,width:Y,height:G}),se=Gg({brushProp:y,onBrushProp:b,linkedBrush:v,valueAccessor:c}),ae=cp(),le=(0,$m.useMemo)(()=>new Map,[oe]),ce=Sg({colorBy:re,colorScale:ie.colorScale,color:T,themeCategorical:ae,colorScheme:p,categoryIndexMap:le,userPieceStyle:x?.pieceStyle,stroke:I,strokeWidth:$,opacity:N,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,cycleByCategory:!0}),ue=(0,$m.useMemo)(()=>Ha({categoryAccessor:l,valueAccessor:c,groupAccessor:a,valueFormat:d}),[l,a,c,d]),de=Sp({componentName:"SwimlaneChart",data:n,accessors:{categoryAccessor:a,valueAccessor:c,subcategoryAccessor:l},requiredProps:{subcategoryAccessor:l}}),{effectiveLegendProps:he,effectiveMargin:pe}=kg({ref:t,frameRef:r,setup:ie});if(ie.earlyReturn)return ie.earlyReturn;const fe={chartType:"swimlane",...null!=n&&{data:oe},oAccessor:a,rAccessor:c,stackBy:l,projection:"horizontal"===u?"horizontal":"vertical",pieceStyle:ce,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:pe,barPadding:ne,enableHover:V,...e.dataIdAccessor&&{dataIdAccessor:e.dataIdAccessor},showAxes:o.showAxes,oLabel:!1===E?void 0:ee,rLabel:te,rFormat:d,...B&&{rTickValues:B},...null!=D&&{tickLabelEdgeAlign:D},...F&&{oFormat:F},...void 0!==E&&{showCategoryTicks:E},showGrid:X,...he,...Yd({title:K,description:Q,summary:Z,accessibleTable:J,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...Vd({tooltip:g,defaultTooltipContent:ue}),...Gd({linkedHover:w,selection:k,onObservation:S,onClick:A,hoverHighlight:C,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...m&&m.length>0&&{annotations:m},...H&&{gradientFill:!0===H?{topOpacity:.8,bottomOpacity:.05}:H},...null!=O&&{trackFill:O},...null!=W&&{roundedTop:W},...q&&{rExtent:q},...se.brushStreamProps,...Object.fromEntries(Object.entries(x).filter(([e])=>"pieceStyle"!==e))};return de?(0,Nm.jsx)(td,{componentName:"SwimlaneChart",message:de,width:Y,height:G}):(0,Nm.jsx)(sd,{componentName:"SwimlaneChart",width:Y,height:G,children:(0,Nm.jsx)(sc,{ref:r,...fe})})});Fm.displayName="SwimlaneChart";var Bm=require("react"),Dm=require("react");function Em(e,t){if(!e)return[];const o=[],r=e=>{o.push(e);const n="function"==typeof t?t(e):e[t];n&&Array.isArray(n)&&n.forEach(r)};return r(e),o}function zm(e,t,o,r){if(e&&e.length>0)return e;const n=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],i="function"==typeof r?r(e):e[r];n.add(t),n.add(i)}),Array.from(n).map(e=>({id:e}))}function Hm(e){return"function"==typeof e?e:t=>t[e]||1}function Om({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:r,edgeOpacity:n,baseStyle:i={}}){return s=>{const a={fillOpacity:n,...i};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=Oe(e.data||e,t,o):e&&(a.fill=r(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=Oe(e.data||e,t,o):e&&(a.fill=r(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*n);return a}}function Wm(e){const{nodes:t,edges:o,inferNodes:r=!0,sourceAccessor:n="source",targetAccessor:i="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:u,selection:d,linkedHover:h,onObservation:p,onClick:f,mobileInteraction:g,mobileSemantics:m,chartType:y,chartId:b,marginDefaults:v,userMargin:x,width:k,height:w,loading:S,loadingContent:A,emptyContent:C,emptyDataKey:M="edges"}=e,j=(0,Dm.useMemo)(()=>z(o),[o]),P=(0,Dm.useMemo)(()=>z(t),[t]),_=ud(S,k,w,A),L=_?null:cd("nodes"===M?void 0===t?void 0:P:void 0===o?void 0:j,k,w,C),R=(0,Dm.useMemo)(()=>r?zm(P,j,n,i):P,[r,P,j,n,i]),T=dp(R,s,a),I=cp(),$=(0,Dm.useMemo)(()=>{if(Array.isArray(a))return a;if(I&&I.length>0)return I;if("string"==typeof a){const e=Be[a];if(Array.isArray(e)&&e.length>0)return e}return De},[a,I]),N=(0,Dm.useMemo)(()=>{if(!s)return[];const e=new Set;for(const t of R){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[R,s]),F=mp(u,s,N),{legend:B,margin:D,legendPosition:E}=gp({data:R,colorBy:s,colorScale:T,showLegend:l,legendPosition:c,userMargin:x,defaults:v,categories:N}),H=(0,Dm.useMemo)(()=>lp(g,{width:k,mobileSemantics:m}),[g,k,m]),O=pp({selection:d,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:p,onClick:f,mobileInteraction:H,chartType:y,chartId:b}),{customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V}=O;return{safeNodes:R,safeEdges:j,colorScale:T,effectivePalette:$,themeCategorical:I,allCategories:N,legendState:F,legend:B,margin:D,legendPosition:E,mobileInteraction:H,customHoverBehavior:W,customClickBehavior:q,activeSelectionHook:Y,hoverSelectionHook:G,crosshairSourceId:V,loadingEl:_,emptyEl:L}}var qm=require("react/jsx-runtime"),Ym=(0,Bm.forwardRef)(function(e,t){const o=(0,Bm.useRef)(null);Rp(t,{variant:"network",frameRef:o});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLegend:e.showLegend,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:n,edges:i,margin:s,className:a,nodeIdAccessor:l,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:d="target",nodeLabel:h,colorBy:p,colorScheme:f,nodeSize:g=8,nodeSizeRange:m=[5,20],edgeWidth:y=1,edgeColor:b="#999",edgeOpacity:v=.6,iterations:x=300,forceStrength:k=.1,layoutExecution:w="auto",layoutLoadingContent:S,onLayoutStateChange:A,tooltip:C,frameProps:M={},onObservation:j,onClick:P,chartId:_,selection:L,linkedHover:R,loading:T,loadingContent:I,emptyContent:$,legendInteraction:N,legendPosition:F,stroke:B,strokeWidth:D,opacity:E}=e,z=l??c??"id",{width:H,height:O,enableHover:W,showLegend:q,showLabels:Y=!1,title:G,description:V,summary:X,accessibleTable:U}=r,K=Wm({nodes:n,edges:i,inferNodes:!1,nodeIdAccessor:z,sourceAccessor:u,targetAccessor:d,colorBy:p,colorScheme:f,showLegend:q,legendPosition:F,legendInteraction:N,selection:L,linkedHover:R,onObservation:j,onClick:P,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ForceDirectedGraph",chartId:_,marginDefaults:r.marginDefaults,userMargin:s,width:H,height:O,loading:T,loadingContent:I,emptyContent:$,emptyDataKey:"nodes"}),Q=(0,Bm.useMemo)(()=>new Map,[]),Z=(0,Bm.useMemo)(()=>e=>{const t={};return t.fill=p?Oe(e.data||e,p,K.colorScale):up(void 0,K.themeCategorical,f,void 0,Q),"number"==typeof g&&(t.r=g),t},[p,K.colorScale,g,K.themeCategorical,f,Q]),J=(0,Bm.useMemo)(()=>Ip(Z,{stroke:B,strokeWidth:D,opacity:E}),[Z,B,D,E]),ee=(0,Bm.useMemo)(()=>e=>{const t=e.data||e;let o;if("number"==typeof y)o=y;else if("function"==typeof y)o=y(t);else{const e=t[y],r="number"==typeof e?e:Number(e);o=Number.isFinite(r)&&r>0?r:1}return{stroke:b,strokeWidth:o,opacity:v}},[y,b,v]),te=(0,Bm.useMemo)(()=>Ip(ee,{stroke:B,strokeWidth:D,opacity:E}),[ee,B,D,E]),oe=(0,Bm.useMemo)(()=>{if(Y&&h)return"function"==typeof h?h:e=>e.data?.[h]??e[h]??e.id},[Y,h]),re=Cp({componentName:"ForceDirectedGraph",nodes:n,edges:i,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:z}});return re?(0,qm.jsx)(td,{componentName:"ForceDirectedGraph",message:re,width:H,height:O}):K.loadingEl?K.loadingEl:K.emptyEl?K.emptyEl:(0,qm.jsx)(sd,{componentName:"ForceDirectedGraph",width:H,height:O,children:(0,qm.jsx)(qd,{ref:o,chartType:"force",...null!=n&&{nodes:K.safeNodes},...null!=i&&{edges:K.safeEdges},size:[H,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:z,sourceAccessor:u,targetAccessor:d,iterations:x,forceStrength:k,layoutExecution:w,layoutLoadingContent:S,onLayoutStateChange:A,nodeStyle:J,edgeStyle:te,colorBy:p,colorScheme:K.effectivePalette,nodeSize:g,nodeSizeRange:m,nodeLabel:oe,showLabels:Y,enableHover:W,tooltipContent:!1===C?()=>null:Bs(C)||void 0,...Gd({linkedHover:R,selection:L,onObservation:j,onClick:P,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:K.legend,legendPosition:K.legendPosition,...N&&"none"!==N&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:G,description:V,summary:X,accessibleTable:U,...null!=e.animate&&{animate:e.animate},...M})})});Ym.displayName="ForceDirectedGraph";var Gm=require("react"),Vm=require("react/jsx-runtime"),Xm=(0,Gm.forwardRef)(function(e,t){const o=(0,Gm.useRef)(null);Rp(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{nodes:n,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",padAngle:g=.01,groupWidth:m=20,sortGroups:y,nodeLabel:b,edgeOpacity:v=.5,tooltip:x,frameProps:k={},onObservation:w,onClick:S,chartId:A,selection:C,linkedHover:M,loading:j,loadingContent:P,emptyContent:_,legendInteraction:L,stroke:R,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:F,showLabels:B=!0,title:D,description:E,summary:z,accessibleTable:H}=r,O=Wm({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:!1,legendInteraction:L,selection:C,linkedHover:M,onObservation:w,onClick:S,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"ChordDiagram",chartId:A,marginDefaults:r.marginDefaults,userMargin:s,width:$,height:N,loading:j,loadingContent:P,emptyContent:_}),W=(0,Gm.useMemo)(()=>new Map,[]),q=O.safeNodes.length>0,Y=(0,Gm.useMemo)(()=>{if(q)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(h)o.fill=Oe(e.data||e,h,O.colorScale);else{const r=Array.isArray(p)?p:Be[p]||De,n=Array.isArray(r)?r:De;o.fill=n[(e.index??t??0)%n.length]}return o}},[q,h,O.colorScale,p]),G=(0,Gm.useMemo)(()=>Y?Ip(Y,{stroke:R,strokeWidth:T,opacity:I}):void 0,[Y,R,T,I]),V=(0,Gm.useMemo)(()=>{if(q)return Om({edgeColorBy:f,colorBy:h,colorScale:O.colorScale,nodeStyleFn:G||(e=>({fill:up(void 0,O.themeCategorical,p,void 0,W)})),edgeOpacity:v,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:v}})},[q,f,h,O.colorScale,G,v,O.themeCategorical,p,W]),X=(0,Gm.useMemo)(()=>V?Ip(V,{stroke:R,strokeWidth:T,opacity:I}):void 0,[V,R,T,I]),U=(0,Gm.useMemo)(()=>{if(!B)return;const e=b||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[B,b,d]),K=Cp({componentName:"ChordDiagram",edges:i,edgesRequired:!0});return K?(0,Vm.jsx)(td,{componentName:"ChordDiagram",message:K,width:$,height:N}):O.loadingEl?O.loadingEl:O.emptyEl?O.emptyEl:(0,Vm.jsx)(sd,{componentName:"ChordDiagram",width:$,height:N,children:(0,Vm.jsx)(qd,{ref:o,chartType:"chord",...O.safeNodes.length>0&&{nodes:O.safeNodes},...null!=i&&{edges:O.safeEdges},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:O.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,padAngle:g,groupWidth:m,sortGroups:y,nodeStyle:G,edgeStyle:X,colorBy:h,colorScheme:O.effectivePalette,edgeColorBy:f,edgeOpacity:v,nodeLabel:U,showLabels:B,enableHover:F,tooltipContent:!1===x?()=>null:Bs(x)||void 0,...Gd({linkedHover:M,selection:C,onObservation:w,onClick:S,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...L&&"none"!==L&&{legendHoverBehavior:O.legendState.onLegendHover,legendClickBehavior:O.legendState.onLegendClick,legendHighlightedCategory:O.legendState.highlightedCategory,legendIsolatedCategories:O.legendState.isolatedCategories},className:a,title:D,description:E,summary:z,accessibleTable:H,...null!=e.animate&&{animate:e.animate},...k})})});Xm.displayName="ChordDiagram";var Um=require("react"),Km=require("react/jsx-runtime"),Qm=(0,Um.forwardRef)(function(e,t){const o=(0,Um.useRef)(null);Rp(t,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const r=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:600}),{nodes:n,edges:i,margin:s,className:a,sourceAccessor:l="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:d="id",colorBy:h,colorScheme:p,edgeColorBy:f="source",orientation:g="horizontal",nodeAlign:m="justify",nodePaddingRatio:y=.05,nodeWidth:b=15,nodeLabel:v,edgeOpacity:x=.5,edgeSort:k,tooltip:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:j,linkedHover:P,loading:_,loadingContent:L,emptyContent:R,showLegend:T,legendPosition:I,legendInteraction:$,stroke:N,strokeWidth:F,opacity:B}=e,{width:D,height:E,enableHover:z,showLabels:H=!0,title:O,description:W,summary:q,accessibleTable:Y}=r,G=Wm({nodes:n,edges:i,inferNodes:!0,nodeIdAccessor:d,sourceAccessor:l,targetAccessor:c,colorBy:h,colorScheme:p,showLegend:T,legendPosition:I,legendInteraction:$,selection:j,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"SankeyDiagram",chartId:M,marginDefaults:r.marginDefaults,userMargin:s,width:D,height:E,loading:_,loadingContent:L,emptyContent:R}),V=(0,Um.useMemo)(()=>new Map,[]),X=(0,Um.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?Oe(e.data||e,h,G.colorScale):up(void 0,G.themeCategorical,p,void 0,V),t},[h,G.colorScale,G.themeCategorical,p,V]),U=(0,Um.useMemo)(()=>Ip(X,{stroke:N,strokeWidth:F,opacity:B}),[X,N,F,B]),K=(0,Um.useMemo)(()=>Om({edgeColorBy:f,colorBy:h,colorScale:G.colorScale,nodeStyleFn:U,edgeOpacity:x,baseStyle:{stroke:"none",strokeWidth:0}}),[f,h,G.colorScale,U,x]),Q=(0,Um.useMemo)(()=>Ip(K,{stroke:N,strokeWidth:F,opacity:B}),[K,N,F,B]),Z=(0,Um.useMemo)(()=>{if(!H)return;const e=v||d;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[H,v,d]),J=Cp({componentName:"SankeyDiagram",edges:i,edgesRequired:!0});return J?(0,Km.jsx)(td,{componentName:"SankeyDiagram",message:J,width:D,height:E}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:(0,Km.jsx)(sd,{componentName:"SankeyDiagram",width:D,height:E,children:(0,Km.jsx)(qd,{ref:o,chartType:"sankey",...G.safeNodes.length>0&&{nodes:G.safeNodes},...null!=i&&{edges:G.safeEdges},size:[D,E],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:G.margin,nodeIDAccessor:d,sourceAccessor:l,targetAccessor:c,valueAccessor:u,orientation:g,nodeAlign:m,nodePaddingRatio:y,nodeWidth:b,nodeStyle:U,edgeStyle:Q,colorBy:h,colorScheme:G.effectivePalette,edgeColorBy:f,edgeOpacity:x,edgeSort:k,nodeLabel:Z,showLabels:H,enableHover:z,tooltipContent:!1===w?()=>null:Bs(w)||void 0,...Gd({linkedHover:P,selection:j,onObservation:A,onClick:C,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:G.legend,legendPosition:G.legendPosition,...$&&"none"!==$&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},className:a,title:O,description:W,summary:q,accessibleTable:Y,...null!=e.animate&&{animate:e.animate},...S})})});Qm.displayName="SankeyDiagram";var Zm=require("react"),Jm=require("d3-scale"),ey=require("react");function ty(e,t,o){const r=t.incoming[e.id],n=t.outgoing[e.id],i=[];for(const e of r)i.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of n)i.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{i.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},l=i.length?function(e,t=1/0){let o=t;for(const t of e)o>t&&(o=t);return o}(i.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,u=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,d=[...new Set(i.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;d.length>e;e++)h.set(d[e],d[e-1]);const p=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=u?u:e};a();const f=[];let g=0,m=0;for(const e of i)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?g:m);if(o>0){const t="top"===e.side?"bot":"top",r=Math.min(o,"top"===t?g:m);if(r>0){const n=p(e.time);f.push({time:n,delta:-r,kind:"transfer-out",side:t}),f.push({time:n,delta:+r,kind:"transfer-in",side:e.side}),"top"===t?g-=r:m-=r,"top"===e.side?g+=r:m+=r,o-=r}o>0&&null!==u&&(f.push({time:u,delta:+o,kind:"create",side:e.side}),"top"===e.side?g+=o:m+=o)}"top"===e.side?g-=t:m-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?g+=t:m+=t}i.push(...f),a();let y=0,b=0,v=0,x=0,k=0;const w=[],S=new Map;for(const e of i){if(w.push({t:e.time,topMass:y,botMass:b}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?y:b;S.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?y+=e.delta:b+=e.delta,y+b>v&&(v=y+b),y>x&&(x=y),b>k&&(k=b),w.push({t:e.time,topMass:y,botMass:b})}const A=[];let C=0;for(;w.length>C;){let e=C;for(;w.length>e+1&&w[e+1].t===w[C].t;)e++;A.push(w[C]);for(let t=C+1;e>=t;t++){const e=A[A.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||A.push(w[t])}C=e+1}const M=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let j=null;for(const e of n)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===j||j>e.systemInTime)&&(j=e.systemInTime);let P=null;for(const e of r)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===P||e.systemOutTime>P)&&(P=e.systemOutTime);if(A.length>0){const e=A[A.length-1],t=Math.max(null!=M?M:-1/0,null!=P?P:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&A.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=A[0],r=Math.min(null!=c?c:1/0,null!=j?j:1/0);Number.isFinite(r)&&o.t>r&&o.topMass+o.botMass>0&&A.unshift({t:r,topMass:o.topMass,botMass:o.botMass})}return{samples:A,peak:v,topPeak:x,botPeak:k,localAttachments:S}}function oy(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function ry(e,t){return e.map(e=>({t:oy(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function ny(e,t,o){const r=e.value*o;if("out"===e.kind){const n=e.sideMassBefore*o;if("top"===e.side){const e=t-n;return[e,e+r]}const i=t+n;return[i-r,i]}const n=e.sideMassAfter*o;if("top"===e.side){const e=t-n;return[e,e+r]}const i=t+n;return[i-r,i]}function iy(e,t){let o=0;for(let r=0;t.length>r;r++)for(let n=r+1;t.length>n;n++){const i=t[r],s=t[n];i.source!==s.source&&i.target!==s.target&&i.source!==s.target&&i.target!==s.source&&(Math.min(i.endTime,s.endTime)>Math.max(i.startTime,s.startTime)&&e[s.source]>e[i.source]!=e[s.target]>e[i.target]&&o++)}return o}function sy(e,t){let o=0;for(const r of t)o+=Math.abs(e[r.source]-e[r.target])*(r.value||1);return o}function ay(e,t){return 1e3*iy(e,t)+sy(e,t)}function ly(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function cy(e,t,o){e.length>8||o.length>40?(function(e,t,o,r=6){const n=e.length;if(1>=n)return;let i=ly(e,t),s=ay(t,o);for(let a=0;r>a;a++){const r=Array(n).fill(0),a=Array(n).fill(0);for(const e of o){const o=t[e.source],n=t[e.target];r[o]+=n*(e.value||1),a[o]+=e.value||1,r[n]+=o*(e.value||1),a[n]+=e.value||1}const l=Array.from({length:n},(e,t)=>t).sort((e,t)=>(a[e]>0?r[e]/a[e]:e)-(a[t]>0?r[t]/a[t]:t)),c=l.map(t=>e[t]),u=new Map;l.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t);const d=ay(t,o);if(s>d)s=d,i=ly(e,t);else if(d===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,i)}(e,t,o,6),function(e,t,o,r=6){const n=e.length;if(1>=n)return;let i=ay(t,o);for(let s=0;r>s;s++){let r=!1;for(let s=0;n-1>s;s++){const n=e[s];e[s]=e[s+1],e[s+1]=n;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=ay(t,o);if(i>a)i=a,r=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!r)break}}(e,t,o,6)):function(e,t,o){const r=e.length;if(1>=r)return;const n={...t},i=Object.keys(n),s=Array.from({length:r},(e,t)=>t),a=s.slice(),l={...n};let c=s.slice(),u=1/0;const d=()=>{for(const e of i)l[e]=a[n[e]];const e=ay(l,o);u>e&&(u=e,c=s.slice())},h=(e,t)=>{const o=s[e],r=s[t];s[e]=r,s[t]=o,a[o]=t,a[r]=e};d();const p=Array(r).fill(0);let f=0;for(;r>f;)f>p[f]?(h(f%2==0?0:p[f],f),d(),p[f]++,f=0):(p[f]=0,f++);const g=c.map(t=>e[t]),m=new Map;c.forEach((e,t)=>m.set(e,t));for(const e of Object.keys(t))t[e]=m.get(t[e]);e.length=0;for(const t of g)e.push(t)}(e,t,o)}function uy(e,t,o,r,n){const{plotH:i,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:u="full"}=n,d={},h={};for(const t of e)d[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const p="half"===u,f={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let n=null!=e&&Number.isFinite(e)?e:1/0,i=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of r.outgoing[t.id]){n>e.startTime&&(n=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&n>e.systemInTime&&(n=e.systemInTime);const t=p?(e.startTime+e.endTime)/2:e.endTime;t>i&&(i=t)}for(const e of r.incoming[t.id]){const t=p?(e.startTime+e.endTime)/2:e.startTime;n>t&&(n=t),e.endTime>i&&(i=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>i&&(i=e.systemOutTime)}f[t.id]={start:Number.isFinite(n)?n:null,end:Number.isFinite(i)?i:null}}const g={},m=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const n=new Map;for(const t of e)n.set(t.id,0);for(const e of t)n.set(e.target,(n.get(e.target)??0)+1);const i=[];for(const t of e)0===(n.get(t.id)??0)&&i.push(t.id);for(;i.length;){const e=i.shift();for(const t of r.outgoing[e]??[]){const r=(o.get(e)??0)+1;r>(o.get(t.target)??0)&&o.set(t.target,r),n.set(t.target,n.get(t.target)-1),0===n.get(t.target)&&i.push(t.target)}}const s=[...e].filter(e=>null!==f[e.id].start).sort((e,t)=>{const r=o.get(e.id)??0,n=o.get(t.id)??0;return r!==n?r-n:f[e.id].start-f[t.id].start}),a=e.filter(e=>null===f[e.id].start);for(const e of[...s,...a]){const t=f[e.id];let o=-1;for(let e=0;m.length>e;e++){const r=m[e].occupants[m[e].occupants.length-1];if(null===t.start||void 0===r||t.start>=r.end){o=e;break}}-1===o&&(m.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=m.length-1),m[o].occupants.push({id:e.id,end:t?.end??-1/0}),m[o].peak.topPeak=Math.max(m[o].peak.topPeak,d[e.id]),m[o].peak.botPeak=Math.max(m[o].peak.botPeak,h[e.id]),g[e.id]=o}}else e.forEach((e,t)=>{m.push({occupants:[{id:e.id,end:f[e.id]?.end??-1/0}],peak:{topPeak:d[e.id],botPeak:h[e.id]}}),g[e.id]=t});let y=null,b=null,v=null,x=null;const k=()=>{y=iy(g,t),v=sy(g,t)},w=()=>{b=iy(g,t),x=sy(g,t)};"crossing-min"===c?(k(),cy(m,g,t),w()):"inside-out"===c?(k(),function(e,t){const o=e.length;if(1>=o)return;const r=e=>e.peak.topPeak+e.peak.botPeak,n=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>r(t.slot)-r(e.slot)),i=Array(o),s=Math.floor((o-1)/2);i[s]=n[0].idx;let a=s-1,l=s+1;for(let e=1;n.length>e;e++)e%2==1&&o>l||0>a?i[l++]=n[e].idx:i[a--]=n[e].idx;const c=i.map(t=>e[t]),u=new Map;i.forEach((e,t)=>u.set(e,t));for(const e of Object.keys(t))t[e]=u.get(t[e]);e.length=0;for(const t of c)e.push(t)}(m,g),w()):"crossing-min+inside-out"===c&&(k(),cy(m,g,t),function(e,t,o){const r=e.length;if(1>=r)return;const n=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),i=Math.floor((r-1)/2);let s=ay(t,o);for(const{slot:a}of n){const n=e.indexOf(a);if(0>n)continue;const l=i;if(n===l)continue;const c=e[n];e.splice(n,1),e.splice(l,0,c);const u=new Map;for(let e=0;r>e;e++)u.set(e,e);if(l>n){for(let e=n+1;l>=e;e++)u.set(e,e-1);u.set(n,l)}else{for(let e=l;n>e;e++)u.set(e,e+1);u.set(n,l)}for(const e of Object.keys(t))t[e]=u.get(t[e]);const d=ay(t,o);if(d>s){const o=e[l];e.splice(l,1),e.splice(n,0,o);const i=new Map;for(let e=0;r>e;e++)i.set(e,e);if(n>l){for(let e=l+1;n>=e;e++)i.set(e,e-1);i.set(l,n)}else{for(let e=n;l>e;e++)i.set(e,e+1);i.set(l,n)}for(const e of Object.keys(t))t[e]=i.get(t[e])}else s=d}}(m,g,t),w());const S=m.map(e=>{const t=new Map;for(const r of e.occupants){const e=o[r.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),A=(e,t)=>{let o={top:0,bot:0};for(const[r,n]of e){if(r>t)break;o=n}return o},C=[];for(let e=0;m.length-1>e;e++){const t=S[e],o=S[e+1],r=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let n=0;for(const e of r){const r=A(t,e),i=A(o,e);r.bot+i.top>n&&(n=r.bot+i.top)}C.push(n)}const M=[];let j=s+(m[0]?.peak.topPeak??0)*a;m.length>0&&M.push(j);for(let e=1;m.length>e;e++)j+=C[e-1]*a+s,M.push(j);if(m.length>0&&(j+=m[m.length-1].peak.botPeak*a+s),j>i){const e=i/j;for(let t=0;M.length>t;t++)M[t]*=e}const P=0===m.length?0:m[0].peak.topPeak+C.reduce((e,t)=>e+t,0)+m[m.length-1].peak.botPeak,_={};for(const t of e)_[t.id]=M[g[t.id]];return{effectiveSlotsHeight:P,centerlines:_,laneLifetime:f,slots:m,slotByNode:g,slotCenter:M,crossingsBefore:y,crossingsAfter:b,lengthBefore:v,lengthAfter:x}}h();var dy=e=>{const{bands:t=[],ribbons:o=[],showLabels:r=!0}=e.config,n=[];for(const e of o)n.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}});for(const e of t)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];n.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of t)n.push({type:"bezier",pathD:e.pathD,style:{...e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86},stroke:e.stroke??e.fill,strokeWidth:e.strokeWidth??.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const i=r?t.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:n,labels:i}};function hy(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}var py=require("react/jsx-runtime");function fy(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function gy(e,t){return"function"==typeof e?e(t):t[e]}var my=(0,ey.forwardRef)(function(e,t){const{nodes:o,edges:r,domain:n,axisTicks:i=[],nodeIdAccessor:s="id",sourceAccessor:a="source",targetAccessor:l="target",valueAccessor:c="value",startTimeAccessor:u="startTime",endTimeAccessor:d="endTime",systemInTimeAccessor:h,systemOutTimeAccessor:p,xExtentAccessor:f="xExtent",edgeIdAccessor:g="id",colorBy:m,colorScheme:y,showLegend:b,legendPosition:v="right",pairing:x="temporal",packing:k="reuse",laneOrder:w="crossing-min",ribbonLane:S="both",lifetimeMode:A="half",showLaneRails:C=!1,showQualityReadout:M=!1,showLabels:j=!0,width:P=600,height:_=400,margin:L,title:R,description:T,summary:I,accessibleTable:$,responsiveWidth:N,responsiveHeight:F,loading:B,loadingContent:D,emptyContent:E,edgeOpacity:H=.35,timeFormat:O,valueFormat:W,tooltip:q,enableHover:Y=!0,onObservation:G,onClick:V,showParticles:X=!1,particleStyle:U,chartId:K,frameProps:Q={}}=e,[Z,J]=(0,Zm.useState)([]),[ee,te]=(0,Zm.useState)([]),oe=(0,Zm.useRef)(Z),re=(0,Zm.useRef)(ee);oe.current=Z,re.current=ee;const ne=(0,Zm.useCallback)(e=>{oe.current=e,J(e)},[]),ie=(0,Zm.useCallback)(e=>{re.current=e,te(e)},[]),se=void 0!==r,ae=z(se?r:Z),le=(0,Zm.useMemo)(()=>{const e=z(o??[]),t=ee;if(0===e.length&&0===t.length)return zm([],ae,a,l);const r=new Set,n=[];for(const t of e){const e=gy(s,t)+"";r.has(e)||(r.add(e),n.push(t))}for(const e of t){const t=gy(s,e)+"";r.has(t)||(r.add(t),n.push(e))}const i=zm([],ae,a,l);for(const e of i)r.has(e.id)||(r.add(e.id),n.push(e));return n},[o,ee,ae,s,a,l]),ce=(0,Zm.useRef)(null),ue=(0,Zm.useCallback)((e,t)=>{const o=gy(g,e);return null!=o?o+"":`${gy(a,e)}-${gy(l,e)}-${t}`},[g,a,l]),de=(0,Zm.useCallback)(e=>{if(null==e)return!1;const t=e;return null!=gy(a,t)&&null!=gy(l,t)},[a,l]);Rp(t,{variant:"network",frameRef:ce,overrides:{push(e){if(de(e)){if(se)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");ne([...oe.current,e])}else ie([...re.current,e])},pushMany(e){const t=[],o=[];for(const r of e)de(r)?t.push(r):o.push(r);t.length>0&&(se?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):ne([...oe.current,...t])),o.length>0&&ie([...re.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!se){const e=oe.current,r=[];for(let n=0;e.length>n;n++){const i=e[n];t.has(ue(i,n))?o.push(i):r.push(i)}r.length!==e.length&&ne(r)}const r=re.current,n=[];for(const e of r){const r=gy(s,e)+"";t.has(r)?o.push(e):n.push(e)}return n.length!==r.length&&ie(n),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),r=[];if(!se){let e=!1;const n=oe.current.map((n,i)=>o.has(ue(n,i))?(r.push(n),e=!0,t(n)):n);e&&ne(n)}let n=!1;const i=re.current.map(e=>{const i=gy(s,e)+"";return o.has(i)?(r.push(e),n=!0,t(e)):e});return n&&ie(i),r},clear(){se||ne([]),ie([]),ce.current?.clear()},getData:()=>ae??[],getScales:()=>null},deps:[se,de,ue,s,ae,ne,ie]});const he=ue,pe=(0,Zm.useCallback)(e=>gy(s,e)+"",[s]),{nodes:fe,edges:ge,domain:me,rawNodeById:ye,rawEdgeById:be}=(0,Zm.useMemo)(()=>{const e=(le??[]).map(e=>{const t={id:pe(e),__raw:e},o=f?gy(f,e):null;if(Array.isArray(o)&&2===o.length){const e=fy(o[0]),r=fy(o[1]);Number.isFinite(e)&&Number.isFinite(r)&&(t.xExtent=[e,r])}return t}),t=(ae??[]).map((e,t)=>{const o={id:he(e,t),source:gy(a,e)+"",target:gy(l,e)+"",value:Number(gy(c,e)),startTime:fy(gy(u,e)),endTime:fy(gy(d,e)),__raw:e};if(h){const t=fy(gy(h,e));Number.isFinite(t)&&(o.systemInTime=t)}if(p){const t=fy(gy(p,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[fy(n[0]),fy(n[1])],r=new Map;for(const t of e)null!=t.__raw&&r.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:r,rawEdgeById:i}},[le,ae,n,pe,he,f,a,l,c,u,d,h,p]),ve=Wm({nodes:le,edges:ae,inferNodes:!1,nodeIdAccessor:s,sourceAccessor:a,targetAccessor:l,colorBy:m,colorScheme:y,showLegend:!1,legendPosition:v,selection:void 0,linkedHover:void 0,onObservation:G,onClick:V,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:K,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:L,width:P,height:_,loading:B,loadingContent:D,emptyContent:E}),xe=(b??!!m)&&!!m,ke=(0,Zm.useCallback)(e=>null!=L&&("number"==typeof L||null!=L[e]),[L]),we=(0,Zm.useMemo)(()=>{const e={...ve.margin};return xe&&("right"===v&&!ke("right")&&140>e.right?e.right=140:"bottom"===v&&!ke("bottom")&&80>e.bottom&&(e.bottom=80)),e},[ve.margin,xe,v,ke]),Se=P-we.left-we.right,Ae=_-we.top-we.bottom,Ce=(0,Zm.useMemo)(()=>function(e,t,o){const r=[],n=new Set(e.map(e=>e.id)),i=Array.isArray(o)&&2===o.length,s=i&&Number.isFinite(o[0])&&Number.isFinite(o[1]);i&&s&&s&&o[1]>=o[0]||r.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||r.push({kind:"invalid-node-time",id:t.id}));for(const e of t)n.has(e.source)||r.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),n.has(e.target)||r.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||r.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||r.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):r.push({kind:"invalid-edge-time",id:e.id});return r}(fe,ge,me),[fe,ge,me]),Me=(0,Zm.useMemo)(()=>Ce.length>0?null:function(e,t,o){const{plotH:r,pairing:n="temporal",packing:i="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},r={};for(const t of e)o[t.id]=[],r[t.id]=[];for(const e of t)r[e.source]&&r[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:r}}(e,t),c=function(e,t,o,r="value"){const n="temporal"===r?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,i="temporal"===r?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const r of e){const e=r[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const n=o.get(e);n.edges.push(r),n.total+=r.value,n.earliestStart=Math.min(n.earliestStart,r.startTime),n.latestEnd=Math.max(n.latestEnd,r.endTime)}const s=[...o.values()];s.sort("temporal"===r?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?i:n);return s};for(const t of e){const e=o.outgoing[t.id],r=o.incoming[t.id];if(0===r.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(r,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(r,"source"),o=a(e,"target"),n=Math.max(t.length,o.length);for(let e=0;n>e;e++){const r=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=r;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=r}}}return s}(e,t,l,n);let u={};for(const t of e)u[t.id]=ty(t,l,c);const d=uy(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),h=new Set;for(const e of t){const t=d.slotByNode[e.source],o=d.slotByNode[e.target];if(void 0===t||void 0===o)continue;const r=c.get(e.id);t!==o?t>o?(r.sourceSide="top",r.targetSide="bot"):(r.sourceSide="bot",r.targetSide="top"):(h.add(e.id),r.sourceSide="bot",r.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],r=new Set(e.map(e=>c.get(e.id).sourceSide)),n=new Set(o.map(e=>c.get(e.id).targetSide));if(1===r.size&&o.length>0){const e=[...r][0];for(const t of o)d.slotByNode[t.source]===d.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===n.size&&e.length>0){const t=[...n][0];for(const o of e)d.slotByNode[o.source]===d.slotByNode[o.target]&&(c.get(o.id).sourceSide=t)}}for(const t of e){const e=l.incoming[t.id],o=l.outgoing[t.id];if(0===e.length||0===o.length)continue;const r=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===c.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===c.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},n=(e,t)=>{const n=r(),i="top"===e?n.outTop-n.inTop:n.outBot-n.inBot,s="top"===t?n.inTop-n.outTop:n.inBot-n.outBot;if(0>=i||0>=s)return!1;const a=Math.min(i,s),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let i=o.length+1;for(;i-- >0&&(n("top","bot")||n("bot","top")););}u={};for(const t of e)u[t.id]=ty(t,l,c);const p=uy(e,t,u,l,{plotH:r,padding:12,valueScale:1,packing:i,laneOrder:s,lifetimeMode:a}),f=p.effectiveSlotsHeight??p.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),g=Math.min(12,.35*r/Math.max(p.slots.length+1,1)),m=f>0?Math.max(0,(r-g*(p.slots.length+1))/f):1,y=uy(e,t,u,l,{plotH:r,padding:g,valueScale:m,packing:i,laneOrder:s,lifetimeMode:a});return{nodeData:u,sides:c,valueScale:m,padding:g,compressedPadding:12>g,centerlines:y.centerlines,laneLifetime:y.laneLifetime,slots:y.slots,slotByNode:y.slotByNode,crossingsBefore:y.crossingsBefore,crossingsAfter:y.crossingsAfter,lengthBefore:y.lengthBefore,lengthAfter:y.lengthAfter}}(fe,ge,{plotH:Ae,pairing:x,packing:k,laneOrder:w,lifetimeMode:A}),[Ce,fe,ge,Ae,x,k,w,A]),je=(0,Zm.useMemo)(()=>(0,Jm.scaleTime)().domain(me).range([0,Se]),[me,Se]),Pe=(0,Zm.useCallback)((e,t)=>{if(m&&le){const t=ye.get(e);if(t)return Oe(t,m,ve.colorScale)}return ve.effectivePalette[t%ve.effectivePalette.length]||"#475569"},[m,le,ye,ve.colorScale,ve.effectivePalette]),_e=(0,Zm.useMemo)(()=>{const e=new Map;return fe.forEach((t,o)=>e.set(t.id,o)),e},[fe]),Le=(0,Zm.useMemo)(()=>{if(!Me)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Me,r=[],n=[];return fe.forEach((n,i)=>{const s=t[n.id];if(!s||0===s.samples.length)return;const a=function(e,t,o,r,n){if(0===e.length)return null;const i=ry(e,n),s=e=>t-i[e].topMass*o,a=e=>t+i[e].botMass*o;let l=`M${r(i[0].t)},${s(0)}`;for(let e=1;i.length>e;e++)l+=` L${r(i[e].t)},${s(e)}`;l+=` L${r(i[i.length-1].t)},${a(i.length-1)}`;for(let e=i.length-2;e>=0;e--)l+=` L${r(i[e].t)},${a(e)}`;return l+" Z"}(s.samples,e[n.id],o,je,me);if(!a)return;const l=ry(s.samples,me),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=e[n.id]+(c.botMass-c.topMass)*o/2,d=Pe(n.id,i),h=ye.get(n.id)??n,p=function(e,t,o,r,n){const i=o.nodeData[e];if(!i||0===i.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=ry(i.samples,n),c=l.find(e=>e.topMass+e.botMass>0)||l[0],u=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],d=r(c.t),h=r(u.t),p=e=>r(oy(e,n)),f=[],g=(e,t,o,r)=>`M${e},${t} L${o},${t} L${o},${r} L${e},${r} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=i.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=p(o.systemInTime),r=p(o.startTime),n=t-20,i=Math.max(d,n);if(r>i){const[o,l]=ny(e,a,s);f.push({pathD:g(i,o,r,l),x0:n,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=i.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=p(o.systemOutTime),r=p(o.endTime),n=t+20,i=Math.min(h,n);if(i>r){const[o,l]=ny(e,a,s);f.push({pathD:g(r,o,i,l),x0:t,x1:n,from:1,to:0})}}}}return f}(n.id,ge,Me,je,me);r.push({id:n.id,pathD:a,fill:d,stroke:d,strokeWidth:.5,...p.length>0&&{gradientStubs:p},rawDatum:h,labelX:je(c.t)-4,labelY:u,labelText:n.id})}),ge.forEach(r=>{const i=t[r.source]?.localAttachments.get(r.id),s=t[r.target]?.localAttachments.get(r.id);if(!i||!s)return;const a=_e.get(r.source)??0,l=Pe(r.source,a),c=function(e,t,o,r,n,i,s,a){const l=n,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,u=i(c(e.time)),d=i(c(o.time)),h=e.value*l,p=o.value*l,f=e.sideMassBefore*l,g=o.sideMassAfter*l;let m,y,b,v;"top"===e.side?(m=t-f,y=m+h):(y=t+f,m=y-h),"top"===o.side?(b=r-g,v=b+p):(v=r+g,b=v-p);const x="source"===s?u+.85*(d-u):"target"===s?u+.15*(d-u):(u+d)/2;return{sx:u,sTop:m,sBot:y,tx:d,tTop:b,tBot:v,cp1X:x,cp2X:x}}(i,e[r.source],s,e[r.target],o,je,S,me),{pathD:u,bezier:d}=tu(c),h=be.get(r.id)??r;n.push({id:r.id,pathD:u,fill:l,opacity:H,rawDatum:h,bezier:d})}),{bands:r,ribbons:n}},[Me,fe,ge,je,me,Pe,ye,be,S,H,_e]),Re=(0,Zm.useMemo)(()=>({bands:Le.bands,ribbons:Le.ribbons,showLabels:j}),[Le,j]),Te=(0,Zm.useMemo)(()=>{if(!xe||!m)return;const e=new Map;(le??[]).forEach((t,o)=>{const r=gy(m,t),n=null==r?"":r+"";n&&!e.has(n)&&e.set(n,{label:n,color:Pe(pe(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[xe,m,le,Pe,pe]),Ie=(0,Zm.useMemo)(()=>!1!==q&&Y?void 0===q||!0===q?null:Bs(q)||null:null,[q,Y]),$e=(0,Zm.useCallback)(e=>O?O(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[O]),Ne=(0,Zm.useCallback)(e=>W?W(e):e+"",[W]),Fe=(0,Zm.useCallback)(e=>{if(!e||!e.data)return null;const t=e.data;if(!hy(t))return null;const o=t.data;if(Ie)return Ie(o);if("band"===t.__kind){const e=t.id,o=Me?function(e){if(!e)return[];const t=new Set,o=[];for(const r of e.samples){const e=r.topMass+r.botMass,n=`${r.t}:${e}`;t.has(n)||(t.add(n),o.push({t:r.t,total:e}))}return o}(Me.nodeData[e]):[],r=5,n=o.length>r?o.length:null,i=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),r=o.length-1,n=[{...o[0],mark:"min"},{...o[Math.floor(.25*r)],mark:"q25"},{...o[Math.floor(.5*r)],mark:"median"},{...o[Math.floor(.75*r)],mark:"q75"},{...o[r],mark:"max"}],i=new Set,s=[];for(const e of n)i.has(e.t)||(i.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,r);return(0,py.jsxs)("div",{style:{minWidth:160},children:[(0,py.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:e}),i.length>0&&(0,py.jsxs)("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[(0,py.jsx)("thead",{children:(0,py.jsxs)("tr",{style:{opacity:.6},children:[(0,py.jsx)("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),(0,py.jsx)("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=n&&(0,py.jsx)("th",{})]})}),(0,py.jsx)("tbody",{children:i.map((e,t)=>(0,py.jsxs)("tr",{children:[(0,py.jsx)("td",{style:{paddingRight:8},children:$e(e.t)}),(0,py.jsx)("td",{style:{textAlign:"right"},children:Ne(e.total)}),null!=n&&(0,py.jsx)("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=n&&(0,py.jsxs)("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",i.length," of ",n," samples"]})]})}const r=o,n=gy(a,r),i=gy(l,r),s=gy(c,r),h=gy(u,r),p=gy(d,r);return(0,py.jsxs)("div",{style:{minWidth:160},children:[(0,py.jsxs)("div",{style:{fontWeight:600,marginBottom:4},children:[n+""," → ",i+""]}),(0,py.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"value"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:Ne(Number(s))})]}),null!=h&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"start"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:$e(fy(h))})]}),null!=p&&(0,py.jsxs)(py.Fragment,{children:[(0,py.jsx)("span",{style:{opacity:.6},children:"end"}),(0,py.jsx)("span",{style:{textAlign:"right"},children:$e(fy(p))})]})]})]})},[Me,Ie,$e,Ne,a,l,c,u,d]),Be=(0,Zm.useMemo)(()=>{if(!Me)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:r,compressedPadding:n,crossingsBefore:s,crossingsAfter:a,lengthBefore:l,lengthAfter:c}=Me;let u=null,d=null;for(const e of fe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const r=je(o.start),n=je(o.end);(null===u||u>r)&&(u=r),(null===d||n>d)&&(d=n)}const h=e=>Math.max(0,Math.min(Se,e)),p=h(u??0),f=Math.max(p,h(d??Se));return(0,py.jsxs)("g",{children:[M&&null!==(a??null)&&(0,py.jsxs)("text",{x:Se,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",s," → ",a," ","edge length: ",Math.round(l)," → ",Math.round(c)]}),n&&(0,py.jsx)("text",{x:Se,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),i.map((e,t)=>{const o=je(fy(e.date));return p-.5>o||o>f+.5?null:(0,py.jsx)("line",{x1:o,y1:0,x2:o,y2:Ae,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),C&&fe.map((n,i)=>{const s=t[n.id];if(!s||null===s.start)return null;const a=o[n.id],l=a?{topPeak:a.topPeak,botPeak:a.botPeak}:{topPeak:0,botPeak:0},c=e[n.id]+(l.botPeak-l.topPeak)*r/2,u=je(s.start),d=je(s.end),h=Pe(n.id,i);return(0,py.jsxs)("g",{children:[(0,py.jsx)("line",{x1:u,y1:c,x2:d,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),(0,py.jsx)("line",{x1:u,y1:c-4,x2:u,y2:c+4,stroke:h,strokeOpacity:.5}),(0,py.jsx)("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+n.id)}),(0,py.jsx)("line",{x1:p,y1:Ae+4,x2:f,y2:Ae+4,stroke:"#94a3b8"}),i.map((e,t)=>{const o=fy(e.date),r=je(o);if(p-.5>r||r>f+.5)return null;const n=null!=e.label?e.label:O?O(new Date(o)):"";return(0,py.jsxs)("g",{transform:`translate(${r},${Ae+4})`,children:[(0,py.jsx)("line",{y2:6,stroke:"#94a3b8"}),(0,py.jsx)("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:n})]},t)})]})},[Me,i,je,Se,Ae,C,fe,Pe,M,O]),De=(0,Zm.useMemo)(()=>(le??[]).map(e=>({id:pe(e),data:e})),[le,pe]),Ee=(0,Zm.useMemo)(()=>{const e=new Map;for(const t of Le.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[Le]),ze=(0,Zm.useMemo)(()=>(ae??[]).map((e,t)=>{const o=he(e,t),r=Number(gy(c,e));return{id:o,source:gy(a,e)+"",target:gy(l,e)+"",value:Number.isFinite(r)?r:0,bezier:Ee.get(o),data:e}}),[ae,he,a,l,c,Ee]),He=ve.loadingEl,We=ve.emptyEl;return Ce.length>0?(0,py.jsxs)("svg",{width:P,height:_,role:"img","aria-label":R??"Process Sankey validation failed",children:[(0,py.jsx)("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ce.map((e,t)=>{return(0,py.jsx)("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+(o=e,"invalid-node-time"===o.kind?`node ${o.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===o.kind?`edge ${o.id} has an invalid startTime or endTime`:"invalid-domain"===o.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===o.kind?`edge ${o.id} must have a positive finite value`:"missing-node"===o.kind?`edge ${o.id} references missing ${o.endpoint} node "${o.nodeId}"`:"backward-edge"===o.kind?`edge ${o.id} (${o.source}->${o.target}) ends before it starts`:o.kind)},t);var o})]}):He||We||(0,py.jsx)(qd,{ref:ce,chartType:"force",nodes:De,edges:ze,customNetworkLayout:dy,layoutConfig:Re,size:[P,_],responsiveWidth:N,responsiveHeight:F,margin:we,title:R,description:T??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:I,accessibleTable:$,enableHover:Y,tooltipContent:!1===q?()=>null:Fe,backgroundGraphics:Be,showParticles:X,particleStyle:U,legend:Te,legendPosition:v,onObservation:G,...V&&{customClickBehavior:e=>{if(!e||!e.data||!V)return;const t=e.data;hy(t)&&V(t.data,{x:e.x,y:e.y})}},chartId:K,colorScheme:Array.isArray(y)?y:void 0,...Q})});my.displayName="ProcessSankey";var yy=require("react"),by=require("react/jsx-runtime");function vy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,layout:i="tree",orientation:s="vertical",childrenAccessor:a="children",valueAccessor:l="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:d,colorByDepth:h=!1,edgeStyle:p="curve",nodeLabel:f,nodeSize:g=5,tooltip:m,frameProps:y={},onObservation:b,onClick:v,chartId:x,selection:k,linkedHover:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:j,opacity:P}=e,{width:_,height:L,enableHover:R,showLabels:T=!0,title:I,description:$,summary:N,accessibleTable:F}=t,B=Wm({nodes:(0,yy.useMemo)(()=>Em(o??null,a),[o,a]),edges:void 0,inferNodes:!1,colorBy:h?void 0:u,colorScheme:d,showLegend:!1,legendInteraction:C,selection:k,linkedHover:w,onObservation:b,onClick:v,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:t.marginDefaults,userMargin:r,width:_,height:L,loading:S,loadingContent:A}),D=(0,yy.useMemo)(()=>new Map,[]),E=(0,yy.useMemo)(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=h?ze[(e.depth||0)%ze.length]:u?Oe(e.data||e,u,B.colorScale):up(void 0,B.themeCategorical,d,void 0,D),t},[u,h,B.colorScale,B.themeCategorical,d,D]),z=(0,yy.useMemo)(()=>Ip(E,{stroke:M,strokeWidth:j,opacity:P}),[E,M,j,P]),H=(0,yy.useMemo)(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),O=(0,yy.useMemo)(()=>Ip(H,{stroke:M,strokeWidth:j,opacity:P}),[H,M,j,P]),W=(0,yy.useMemo)(()=>{if("treemap"===i||"circlepack"===i||"partition"===i)return Hm(l)},[i,l]),q=Ap({componentName:"TreeDiagram",data:o});return q?(0,by.jsx)(td,{componentName:"TreeDiagram",message:q,width:_,height:L}):B.loadingEl?B.loadingEl:(0,by.jsx)(sd,{componentName:"TreeDiagram",width:_,height:L,children:(0,by.jsx)(qd,{chartType:i,...null!=o&&{data:o},size:[_,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:B.margin,nodeIDAccessor:c,childrenAccessor:a,hierarchySum:W,treeOrientation:s,edgeType:p,nodeStyle:z,edgeStyle:O,colorBy:u,colorScheme:B.effectivePalette,colorByDepth:h,nodeSize:g,nodeLabel:T?f||c:void 0,showLabels:T,enableHover:R,tooltipContent:!1===m?()=>null:Bs(m)||void 0,...Gd({linkedHover:w,selection:k,onObservation:b,onClick:v,mobileInteraction:B.mobileInteraction,customHoverBehavior:B.customHoverBehavior,customClickBehavior:B.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:B.legendState.onLegendHover,legendClickBehavior:B.legendState.onLegendClick,legendHighlightedCategory:B.legendState.highlightedCategory,legendIsolatedCategories:B.legendState.isolatedCategories},className:n,title:I,description:$,summary:N,accessibleTable:F,...null!=e.animate&&{animate:e.animate},...y})})}vy.displayName="TreeDiagram";var xy=require("react"),ky=require("react/jsx-runtime");function wy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,labelMode:d="leaf",nodeLabel:h,padding:p=4,paddingTop:f,nodeStyle:g,tooltip:m,frameProps:y={},selection:b,linkedHover:v,onObservation:x,onClick:k,chartId:w,loading:S,loadingContent:A,legendInteraction:C,stroke:M,strokeWidth:j,opacity:P}=e,{nodeStyle:_,...L}=y,{width:R,height:T,enableHover:I,showLabels:$=!0,title:N,description:F,summary:B,accessibleTable:D}=t,E=Wm({nodes:(0,xy.useMemo)(()=>Em(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:C,selection:b,linkedHover:v,onObservation:x,onClick:k,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"Treemap",chartId:w,marginDefaults:t.marginDefaults,userMargin:r,width:R,height:T,loading:S,loadingContent:A}),z=Pp(b),H=E.customHoverBehavior,O=(0,xy.useCallback)(e=>{if(!e)return H(null);const t=e.data||e;H({data:t?.data||t})},[H]),W=(0,xy.useMemo)(()=>new Map,[]),q=(0,xy.useMemo)(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=u?ze[(e.depth||0)%ze.length]:l?Oe(e.data||e,l,E.colorScale):up(void 0,E.themeCategorical,c,void 0,W),t},[l,u,E.colorScale,E.themeCategorical,c,W]),Y=(0,xy.useMemo)(()=>g||_?e=>({...q(e),..._?_(e)??{}:{},...g?g(e)??{}:{}}):q,[q,g,_]),G=(0,xy.useMemo)(()=>Ip(Y,{stroke:M,strokeWidth:j,opacity:P}),[Y,M,j,P]),V=(0,xy.useMemo)(()=>E.activeSelectionHook?e=>{const t={...G(e)};if(E.activeSelectionHook.isActive)if(E.activeSelectionHook.predicate(e.data||e))z?.selectedStyle&&Object.assign(t,z.selectedStyle);else{const e=z?.unselectedOpacity??Fh;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,z?.unselectedStyle&&Object.assign(t,z.unselectedStyle)}return t}:G,[G,E.activeSelectionHook,z]),X=(0,xy.useMemo)(()=>Hm(s),[s]),U=void 0!==f?f:!$||"parent"!==d&&"all"!==d?void 0:18,K=Ap({componentName:"Treemap",data:o});return K?(0,ky.jsx)(td,{componentName:"Treemap",message:K,width:R,height:T}):E.loadingEl?E.loadingEl:(0,ky.jsx)(sd,{componentName:"Treemap",width:R,height:T,children:(0,ky.jsx)(qd,{chartType:"treemap",...null!=o&&{data:o},size:[R,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:E.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:X,padding:p,paddingTop:U,nodeStyle:V,colorBy:l,colorScheme:E.effectivePalette,colorByDepth:u,nodeLabel:$?h||a:void 0,showLabels:$,labelMode:d,enableHover:I,tooltipContent:!1===m?()=>null:Bs(m)||void 0,...Gd({linkedHover:v,selection:b,onObservation:x,onClick:k,mobileInteraction:E.mobileInteraction,customHoverBehavior:O,customClickBehavior:E.customClickBehavior,linkedHoverInClickPredicate:!1}),...C&&"none"!==C&&{legendHoverBehavior:E.legendState.onLegendHover,legendClickBehavior:E.legendState.onLegendClick,legendHighlightedCategory:E.legendState.highlightedCategory,legendIsolatedCategories:E.legendState.isolatedCategories},className:n,title:N,description:F,summary:B,accessibleTable:D,...null!=e.animate&&{animate:e.animate},...L})})}wy.displayName="Treemap";var Sy=require("react"),Ay=require("react/jsx-runtime");function Cy(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",valueAccessor:s="value",nodeIdAccessor:a="name",colorBy:l,colorScheme:c,colorByDepth:u=!1,nodeLabel:d,circleOpacity:h=.7,padding:p=4,tooltip:f,frameProps:g={},onObservation:m,onClick:y,chartId:b,selection:v,linkedHover:x,loading:k,loadingContent:w,legendInteraction:S,stroke:A,strokeWidth:C,opacity:M}=e,{width:j,height:P,enableHover:_,showLabels:L=!0,title:R,description:T,summary:I,accessibleTable:$}=t,N=Wm({nodes:(0,Sy.useMemo)(()=>Em(o??null,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:u?void 0:l,colorScheme:c,showLegend:!1,legendInteraction:S,selection:v,linkedHover:x,onObservation:m,onClick:y,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"CirclePack",chartId:b,marginDefaults:t.marginDefaults,userMargin:r,width:j,height:P,loading:k,loadingContent:w}),F=(0,Sy.useMemo)(()=>new Map,[]),B=(0,Sy.useMemo)(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h};return t.fill=u?ze[(e.depth||0)%ze.length]:l?Oe(e.data||e,l,N.colorScale):up(void 0,N.themeCategorical,c,void 0,F),t},[l,u,N.colorScale,h,N.themeCategorical,c,F]),D=(0,Sy.useMemo)(()=>Ip(B,{stroke:A,strokeWidth:C,opacity:M}),[B,A,C,M]),E=(0,Sy.useMemo)(()=>Hm(s),[s]),z=Ap({componentName:"CirclePack",data:o});return z?(0,Ay.jsx)(td,{componentName:"CirclePack",message:z,width:j,height:P}):N.loadingEl?N.loadingEl:(0,Ay.jsx)(sd,{componentName:"CirclePack",width:j,height:P,children:(0,Ay.jsx)(qd,{chartType:"circlepack",...null!=o&&{data:o},size:[j,P],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:N.margin,nodeIDAccessor:a,childrenAccessor:i,hierarchySum:E,padding:p,nodeStyle:D,colorBy:l,colorScheme:N.effectivePalette,colorByDepth:u,nodeLabel:L?d||a:void 0,showLabels:L,enableHover:_,tooltipContent:!1===f?()=>null:Bs(f)||void 0,...Gd({linkedHover:x,selection:v,onObservation:m,onClick:y,mobileInteraction:N.mobileInteraction,customHoverBehavior:N.customHoverBehavior,customClickBehavior:N.customClickBehavior,linkedHoverInClickPredicate:!1}),...S&&"none"!==S&&{legendHoverBehavior:N.legendState.onLegendHover,legendClickBehavior:N.legendState.onLegendClick,legendHighlightedCategory:N.legendState.highlightedCategory,legendIsolatedCategories:N.legendState.isolatedCategories},className:n,title:R,description:T,summary:I,accessibleTable:$,...null!=e.animate&&{animate:e.animate},...g})})}Cy.displayName="CirclePack";var My=require("react"),jy=require("react/jsx-runtime"),Py=ze;function _y(e){const t=bp(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:o,margin:r,className:n,childrenAccessor:i="children",nodeIdAccessor:s="name",colorBy:a,colorScheme:l,colorByDepth:c=!1,orbitMode:u="flat",orbitSize:d=2.95,speed:h=.25,revolution:p,revolutionStyle:f,eccentricity:g=1,showRings:m=!0,nodeRadius:y=6,showLabels:b=!1,animated:v=!0,tooltip:x,foregroundGraphics:k,annotations:w,frameProps:S={},onObservation:A,onClick:C,chartId:M,selection:j,linkedHover:P,loading:_,loadingContent:L,stroke:R,strokeWidth:T,opacity:I}=e,{width:$,height:N,enableHover:F,title:B,description:D,summary:E,accessibleTable:z}=t,H=Wm({nodes:(0,My.useMemo)(()=>Em(o,i),[o,i]),edges:void 0,inferNodes:!1,colorBy:c?void 0:a,colorScheme:l,showLegend:!1,legendInteraction:void 0,selection:j,linkedHover:P,onObservation:A,onClick:C,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"OrbitDiagram",chartId:M,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:$,height:N,loading:_,loadingContent:L}),O=(0,My.useMemo)(()=>new Map,[]),{colorScale:W,customClickBehavior:q,customHoverBehavior:Y,themeCategorical:G}=H,V=(0,My.useMemo)(()=>{if(Array.isArray(l))return l;const e=Be[l];return Array.isArray(e)?e:De},[l]),X=(0,My.useMemo)(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=c?o?V[0]:Py[(e.depth||0)%Py.length]:a?Oe(e.data||e,a,W):up(void 0,G,l,void 0,O),t.opacity=o?1:.85,t},[a,c,W,V,G,l,O]),U=(0,My.useMemo)(()=>Ip(X,{stroke:R,strokeWidth:T,opacity:I}),[X,R,T,I]),K=(0,My.useMemo)(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),Q=(0,My.useMemo)(()=>e=>{Y(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[Y]),Z=(0,My.useMemo)(()=>e=>{q(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[q]),J=Ap({componentName:"OrbitDiagram",data:o});return J?(0,jy.jsx)(td,{componentName:"OrbitDiagram",message:J,width:$,height:N}):H.loadingEl?H.loadingEl:(0,jy.jsx)(sd,{componentName:"OrbitDiagram",width:$,height:N,children:(0,jy.jsx)(qd,{chartType:"orbit",...null!=o&&{data:o},size:[$,N],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:H.margin,nodeIDAccessor:s,childrenAccessor:i,nodeStyle:U,edgeStyle:K,colorBy:a,colorScheme:H.effectivePalette,colorByDepth:c,nodeSize:y,nodeLabel:b?s:void 0,showLabels:b,enableHover:!v&&F,tooltipContent:v?void 0:!1===x?()=>null:Bs(x)||void 0,...Gd({linkedHover:P,selection:j,onObservation:A,onClick:C,mobileInteraction:H.mobileInteraction,customHoverBehavior:Q,customClickBehavior:Z,linkedHoverInClickPredicate:!1}),foregroundGraphics:k,annotations:w,className:n,title:B,description:D,summary:E,orbitMode:u,orbitSize:d,orbitSpeed:h,orbitRevolution:p,orbitRevolutionStyle:f,orbitEccentricity:g,orbitShowRings:m,orbitAnimated:v,accessibleTable:z,...null!=e.animate&&{animate:e.animate},...S})})}_y.displayName="OrbitDiagram";var Ly=require("react"),Ry=require("react/jsx-runtime"),Ty={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},Iy={opacity:.7,marginRight:4};function $y(e,t,o){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:o]}function Ny(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function Fy(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,s=$y(i,t,"time"),a=$y(i,o,"value");return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[r,":"]}),Ny(s)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[n,":"]}),Ny(a)]})]})}}function By(e,t){return null!=e?e:Math.max(t?.length??0,200)}var Dy=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,o=e._mean-this._mean;this._mean+=o*e._count/t,this._m2+=e._m2+o*o*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},Ey=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const o=this.hop,r=Math.floor(e/o);for(let n=Math.floor((e-this.size)/o)+1;r>=n;n++)this.bump(n*o,t)}bump(e,t){let o=this.windows.get(e);o||(o=new Dy,this.windows.set(e,o)),o.push(t)}pushSession(e,t){const o=this.gap,r=new Dy;r.push(t);let n=e,i=e;const s=[],a={start:n,end:i,stats:r};for(const t of this.sessions)e-o>t.end||t.start>e+o?s.push(t):(a.stats.merge(t.stats),n>t.start&&(n=t.start),t.end>i&&(i=t.end));a.start=n,a.end=i,s.push(a),s.sort((e,t)=>e.start-t.start),this.sessions=s}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let o=0;t>o;o++)this.windows.delete(e[o])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,o]of this.windows){const r=t+this.size;e.push(this.row(t,r,o,r>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,o,r){return{start:e,end:t,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:r}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function zy(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}var Hy={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Oy=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function Wy(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;Oy.lastIndex=0;let o,r=0,n=0;for(;null!==(o=Oy.exec(t));){const e=parseFloat(o[1]),t=Hy[o[2]];if(null==t||!Number.isFinite(e))return null;r+=e*t,n+=o[0].length}return n!==t.length?null:r>0?r:null}var qy="time",Yy="value",Gy="__aggLower",Vy="__aggUpper",Xy="__aggPartial",Uy="count",Ky="__aggStart",Qy="__aggEnd";function Zy(e,t){const o=t.stat??"mean",r=t.band??"none",n=t.sigma??1;return e.emit().map(e=>{const t={[qy]:(e.start+e.end)/2,[Yy]:zy(e,o),[Uy]:e.count,[Xy]:e.partial,[Ky]:e.start,[Qy]:e.end},i=function(e,t,o,r=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const n=zy(e,o),i=e.stddev*r;return[n-i,n+i]}(e,r,o,n);return i&&(t[Gy]=i[0],t[Vy]=i[1]),t})}var Jy=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const o=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,o.push(e),"drop"===this.latePolicy?{released:[],late:o}:{released:[e],late:o}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:o})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],o=[];for(const r of this.held)this.getTime(r)>e?o.push(r):t.push(r);return this.held=o,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}},eb=require("react/jsx-runtime");function tb(e,t,o){const r="function"==typeof t?t(e):e[t??o];if(null==r)return null;if(r instanceof Date)return r.getTime();const n=Number(r);return Number.isFinite(n)?n:null}var ob=(0,Ly.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,stroke:g="#007bff",strokeWidth:m=2,strokeDasharray:y,opacity:b,background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,transition:R,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:F,loadingContent:B,emptyContent:D,emphasis:E,legendPosition:z,aggregate:H,eventTime:O}=e,W=o.showAxes,q=o.enableHover,Y=n??o.marginDefaults,G=r??[o.width,o.height],V=x??k??Fy({timeAccessor:u,valueAccessor:d}),X=(0,Ly.useRef)(null),{customHoverBehavior:U}=pp({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeLineChart",chartId:N}),K=(0,Ly.useCallback)(e=>{w&&w(e),U(e)},[w,U]),Q=null!=H,[Z,J]=(0,Ly.useState)([]),ee=(0,Ly.useRef)(null),te=(0,Ly.useRef)(H);te.current=H;const oe=(0,Ly.useRef)(Q);oe.current=Q;const re=(0,Ly.useRef)(Z);re.current=Z;const ne=(0,Ly.useRef)({timeAccessor:u,valueAccessor:d});ne.current={timeAccessor:u,valueAccessor:d},(0,Ly.useEffect)(()=>{if(!Q)return void(ee.current=null);const e=te.current,t=function(e){const t=e.window??"tumbling",o=Wy("session"===t?e.gap??e.size:e.size);if(null==o)return null;const r=null!=e.hop?Wy(e.hop):void 0,n=null!=e.gap?Wy(e.gap):void 0;return new Ey({window:t,size:o,hop:r??void 0,gap:n??void 0,retain:e.retain})}(e);if(ee.current=t,t&&c){const{timeAccessor:e,valueAccessor:o}=ne.current;for(const r of c){const n=tb(r,e,"time"),i=tb(r,o,"value");null!=n&&null!=i&&t.push(n,i)}}J(t?Zy(t,e):[])},[Q?[H.window??"tumbling",H.size,H.hop??"",H.gap??"",H.retain??""].join("|"):"",Q,c]),(0,Ly.useEffect)(()=>{Q&&ee.current&&J(Zy(ee.current,te.current))},[H?.stat,H?.band,H?.sigma]);const ie=(0,Ly.useCallback)(e=>{const t=ee.current,o=te.current;if(!t||!o)return;const{timeAccessor:r,valueAccessor:n}=ne.current;for(const o of e){const e=tb(o,r,"time"),i=tb(o,n,"value");null!=e&&null!=i&&t.push(e,i)}J(Zy(t,o))},[]),se=null!=O,ae=(0,Ly.useRef)(null),le=(0,Ly.useRef)(O);le.current=O;const ce=(0,Ly.useRef)(se);ce.current=se;const ue=(0,Ly.useRef)($);ue.current=$;const de=(0,Ly.useRef)(N);de.current=N,(0,Ly.useEffect)(()=>{ae.current=se?function(e){const t=Wy(e.lateness);return null==t?null:new Jy({lateness:t,getTime:e=>tb(e,ne.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(le.current):null},[se?`${O.lateness}|${O.latePolicy??"drop"}`:"",se]);const he=(0,Ly.useCallback)(e=>{0!==e.length&&(oe.current?ie(e):X.current?.pushMany(e))},[ie]),pe=(0,Ly.useCallback)(e=>{const t=ae.current;if(!ce.current||!t)return void he(e);const o=[];for(const r of e){const e=t.push(r);if(e.released.length&&o.push(...e.released),e.late.length){const o=ue.current;if(o){const{timeAccessor:r}=ne.current,n=le.current?.latePolicy??"drop";for(const i of e.late)o({type:"late-data",datum:i,eventTime:tb(i,r,"time")??NaN,watermark:t.watermark,policy:n,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:de.current})}}}he(o)},[he]);(0,Ly.useImperativeHandle)(t,()=>({push:e=>pe([e]),pushMany:e=>pe(e),remove:e=>oe.current?[]:X.current?.remove(e)??[],update:(e,t)=>oe.current?[]:X.current?.update(e,t)??[],clear:()=>{ae.current?.clear(),oe.current?(ee.current?.clear(),J([])):X.current?.clear()},getData:()=>oe.current?re.current:X.current?.getData()??[],getScales:()=>X.current?.getScales()??null}),[pe]);const fe=ud(F,G[0],G[1],B),ge=fe?null:cd(Q?void 0:c,G[0],G[1],D),me={stroke:g,strokeWidth:m,strokeDasharray:y};null!=b&&(me.opacity=b);const ye=By(l,c),be=Q?Z:c,ve=Q?qy:u,xe=Q?Yy:d,ke=Q&&H&&"none"!==(H.band??"none")?{y0Accessor:Gy,y1Accessor:Vy,perSeries:!1}:void 0;return fe||ge||(0,eb.jsx)(Ka,{ref:X,chartType:"line",runtimeMode:"streaming",size:G,margin:Y,className:E?`${i||""} semiotic-emphasis-${E}`.trim():i,arrowOfTime:s,windowMode:Q?"growing":a,windowSize:Q?Math.max(1,H?.retain??Math.max(Z.length,600)):ye,data:be,timeAccessor:ve,valueAccessor:xe,xExtent:h,yExtent:p,extentPadding:f,band:ke,lineStyle:me,showAxes:W,background:v,hoverAnnotation:q,tooltipContent:V,...Gd({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:K}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,transition:R,pointIdAccessor:e.pointIdAccessor,legendPosition:z})});ob.displayName="RealtimeLineChart";var rb=require("react"),nb=require("react/jsx-runtime");function ib(e,t,o){const r="function"==typeof t?t(e):e[t??o];if(null==r)return null;if(r instanceof Date)return r.getTime();if("string"==typeof r&&""===r.trim())return null;const n=Number(r);return Number.isFinite(n)?n:null}var sb=(0,rb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,enableHover:null!=e.enableHover?!!e.enableHover:void 0,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{binSize:r,size:n,margin:i,className:s,arrowOfTime:a="right",windowMode:l="sliding",windowSize:c,data:u,timeAccessor:d,valueAccessor:h,direction:p="up",timeExtent:f,valueExtent:g,extentPadding:m,categoryAccessor:y,colors:b,fill:v,stroke:x,strokeWidth:k,opacity:w,gap:S,background:A,tooltipContent:C,tooltip:M,onHover:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,linkedHover:I,selection:$,decay:N,pulse:F,staleness:B,transition:D,onObservation:E,chartId:z,loading:H,loadingContent:O,emptyContent:W,emphasis:q,legendPosition:Y,brush:G,onBrush:V,linkedBrush:X}=e,U=o.showAxes,K=o.enableHover,Q=i??o.marginDefaults,Z=n??[o.width,o.height],J=C??M??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const r=e?.data??null;if(null==r?.binStart||null==r?.binEnd){const e=$y(r,t,"time"),n=$y(r,o,"value");return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"x:"}),Ny(e)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"y:"}),Ny(n)]})]})}return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"range:"}),Ny(r.binStart),"–",Ny(r.binEnd)]}),null!=r.total&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"count:"}),Ny(r.total)]}),null!=r.category&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"category:"}),Ny(r.category)]})]})}}({timeAccessor:d,valueAccessor:h}),ee=(0,rb.useRef)(null),{customHoverBehavior:te}=pp({selection:$,linkedHover:I,unwrapData:!0,onObservation:E,chartType:"RealtimeHistogram",chartId:z}),oe=(0,rb.useCallback)(e=>{j&&j(e),te(e)},[j,te]),re=!0===G?{dimension:"x",snap:"bin"}:"x"===G?{dimension:"x"}:"object"==typeof G?G:void 0,ne=Nh(X),ie="string"==typeof d?d:"time",se=mh({name:ne?.name||"__unused_hist_brush__",xField:ne?.xField||ie,...ne?.yField?{yField:ne.yField}:{}}),ae=(0,rb.useRef)(se.brushInteraction);ae.current=se.brushInteraction;const le=(0,rb.useCallback)(e=>{if(V&&V(e),E&&E(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:z}),ne){const t=ae.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[V,E,z,ne]);(0,rb.useImperativeHandle)(t,()=>({push:e=>ee.current?.push(e),pushMany:e=>ee.current?.pushMany(e),remove:e=>ee.current?.remove(e)??[],update:(e,t)=>ee.current?.update(e,t)??[],clear:()=>ee.current?.clear(),getData:()=>ee.current?.getData()??[],getScales:()=>ee.current?.getScales()??null}),[]);const ce=ud(H,Z[0],Z[1],O),ue=ce?null:cd(u,Z[0],Z[1],W),de={};null!=v&&(de.fill=v),null!=x&&(de.stroke=x),null!=k&&(de.strokeWidth=k),null!=w&&(de.opacity=w),null!=S&&(de.gap=S);const he=q?`${s||""} semiotic-emphasis-${q}`.trim():s,pe=By(c,u),fe=(0,rb.useMemo)(()=>"down"!==p?g:function({data:e,valueAccessor:t,timeAccessor:o,binSize:r,valueExtent:n,extentPadding:i}){if(n)return[n[1],n[0]];if(!e||0===e.length)return;const s=new Map;for(const n of e){const e=ib(n,o,"time"),i=ib(n,t,"value");if(null==e||null==i)continue;const a=Math.floor(e/r)*r;s.set(a,(s.get(a)??0)+i)}let a=0;for(const e of s.values())e>a&&(a=e);return[a>0?a+a*(i??.1):1,0]}({data:u,valueAccessor:h,timeAccessor:d,binSize:r,valueExtent:g,extentPadding:m}),[p,u,h,d,r,g,m]);return ce||ue||(0,nb.jsx)(Ka,{ref:ee,chartType:"bar",runtimeMode:"streaming",size:Z,margin:Q,className:he,arrowOfTime:a,windowMode:l,windowSize:pe,data:u,timeAccessor:d,valueAccessor:h,xExtent:f,yExtent:fe,extentPadding:m,binSize:r,categoryAccessor:y,barColors:b,barStyle:de,showAxes:U,background:A,hoverAnnotation:K,tooltipContent:J,...Gd({linkedHover:I,selection:$,onObservation:E,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:oe}),annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,decay:N,pulse:F,staleness:B,transition:D,pointIdAccessor:e.pointIdAccessor,legendPosition:Y,brush:re||(X?{dimension:"x"}:void 0),onBrush:re||X?le:void 0})});function ab(e){return(0,nb.jsx)(sb,{...e,windowMode:"growing"})}sb.displayName="RealtimeHistogram",ab.displayName="TemporalHistogram";var lb=sb,cb=require("react"),ub=require("react/jsx-runtime"),db=(0,cb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,yScaleType:f,extentPadding:g,categoryAccessor:m,colors:y,radius:b,fill:v,opacity:x,stroke:k,strokeWidth:w,pointStyle:S,background:A,tooltipContent:C,tooltip:M,onHover:j,annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,linkedHover:I,selection:$,onObservation:N,chartId:F,loading:B,loadingContent:D,emptyContent:E,emphasis:z,legendPosition:H}=e,O=o.showAxes,W=o.enableHover,q=n??o.marginDefaults,Y=r??[o.width,o.height],G=C??M??Fy({timeAccessor:u,valueAccessor:d}),V=(0,cb.useRef)(null),{customHoverBehavior:X}=pp({selection:$,linkedHover:I,unwrapData:!0,onObservation:N,chartType:"RealtimeSwarmChart",chartId:F}),U=(0,cb.useCallback)(e=>{j&&j(e),X(e)},[j,X]);(0,cb.useImperativeHandle)(t,()=>({push:e=>V.current?.push(e),pushMany:e=>V.current?.pushMany(e),remove:e=>V.current?.remove(e)??[],update:(e,t)=>V.current?.update(e,t)??[],clear:()=>V.current?.clear(),getData:()=>V.current?.getData()??[],getScales:()=>V.current?.getScales()??null}),[]);const K=ud(B,Y[0],Y[1],D),Q=K?null:cd(c,Y[0],Y[1],E),Z={};null!=b&&(Z.radius=b),null!=v&&(Z.fill=v),null!=x&&(Z.opacity=x),null!=k&&(Z.stroke=k),null!=w&&(Z.strokeWidth=w);const J=S,ee=z?`${i||""} semiotic-emphasis-${z}`.trim():i,te=By(l,c);return K||Q||(0,ub.jsx)(Ka,{ref:V,chartType:"swarm",runtimeMode:"streaming",size:Y,margin:q,className:ee,arrowOfTime:s,windowMode:a,windowSize:te,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,yScaleType:f,extentPadding:g,categoryAccessor:m,barColors:y,swarmStyle:Z,pointStyle:J,showAxes:O,background:A,hoverAnnotation:W,tooltipContent:G,...Gd({linkedHover:I,selection:$,onObservation:N,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:U}),annotations:P,autoPlaceAnnotations:_,svgAnnotationRules:L,tickFormatTime:R,tickFormatValue:T,legendPosition:H,pointIdAccessor:e.pointIdAccessor})});db.displayName="RealtimeSwarmChart";var hb=require("react"),pb=require("react/jsx-runtime"),fb=(0,hb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,timeExtent:h,valueExtent:p,extentPadding:f,positiveColor:g,negativeColor:m,connectorStroke:y,connectorWidth:b,gap:v,stroke:x,strokeWidth:k,opacity:w,background:S,tooltipContent:A,tooltip:C,onHover:M,annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:R,linkedHover:T,selection:I,onObservation:$,chartId:N,loading:F,loadingContent:B,emptyContent:D,emphasis:E,legendPosition:z}=e,H=o.showAxes,O=o.enableHover,W=n??o.marginDefaults,q=r??[o.width,o.height],Y=A??C??function(e={}){const{timeAccessor:t,valueAccessor:o}=e;return e=>{const r=e?.data??null,n=$y(r,t,"time"),i=r?.delta??$y(r,o,"value"),s=r?.cumEnd,a="number"==typeof i?0>i?Ny(i):"+"+Ny(i):Ny(i);return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"x:"}),Ny(n)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"Δ:"}),a]}),null!=s&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"total:"}),Ny(s)]})]})}}({timeAccessor:u,valueAccessor:d}),G=(0,hb.useRef)(null),{customHoverBehavior:V}=pp({selection:I,linkedHover:T,unwrapData:!0,onObservation:$,chartType:"RealtimeWaterfallChart",chartId:N}),X=(0,hb.useCallback)(e=>{M&&M(e),V(e)},[M,V]);(0,hb.useImperativeHandle)(t,()=>({push:e=>G.current?.push(e),pushMany:e=>G.current?.pushMany(e),remove:e=>G.current?.remove(e)??[],update:(e,t)=>G.current?.update(e,t)??[],clear:()=>G.current?.clear(),getData:()=>G.current?.getData()??[],getScales:()=>G.current?.getScales()??null}),[]);const U=ud(F,q[0],q[1],B),K=U?null:cd(c,q[0],q[1],D),Q={};null!=g&&(Q.positiveColor=g),null!=m&&(Q.negativeColor=m),null!=y&&(Q.connectorStroke=y),null!=b&&(Q.connectorWidth=b),null!=v&&(Q.gap=v),null!=x&&(Q.stroke=x),null!=k&&(Q.strokeWidth=k),null!=w&&(Q.opacity=w);const Z=E?`${i||""} semiotic-emphasis-${E}`.trim():i,J=By(l,c);return U||K||(0,pb.jsx)(Ka,{ref:G,chartType:"waterfall",runtimeMode:"streaming",size:q,margin:W,className:Z,arrowOfTime:s,windowMode:a,windowSize:J,data:c,timeAccessor:u,valueAccessor:d,xExtent:h,yExtent:p,extentPadding:f,waterfallStyle:Q,showAxes:H,background:S,hoverAnnotation:O,tooltipContent:Y,...Gd({linkedHover:T,selection:I,onObservation:$,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:X}),annotations:j,autoPlaceAnnotations:P,svgAnnotationRules:_,tickFormatTime:L,tickFormatValue:R,legendPosition:z,pointIdAccessor:e.pointIdAccessor})});fb.displayName="RealtimeWaterfallChart";var gb=require("react"),mb=require("react/jsx-runtime"),yb=(0,gb.forwardRef)(function(e,t){const o=bp(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,enableHover:null!=e.enableHover?!!e.enableHover:void 0,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{size:r,margin:n,className:i,arrowOfTime:s="right",windowMode:a="sliding",windowSize:l,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,timeExtent:p,valueExtent:f,extentPadding:g,heatmapXBins:m=20,heatmapYBins:y=20,aggregation:b="count",background:v,tooltipContent:x,tooltip:k,onHover:w,annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,linkedHover:R,selection:T,onObservation:I,chartId:$,loading:N,loadingContent:F,emptyContent:B,emphasis:D,legendPosition:E}=e,z=o.showAxes,H=o.enableHover,O=n??o.marginDefaults,W=r??[o.width,o.height],q=x??k??function(e={}){const{timeAccessor:t,valueAccessor:o,xLabel:r="x",yLabel:n="y"}=e;return e=>{const i=e?.data??null,s=i?.xCenter??$y(i,t,"time"),a=i?.yCenter??$y(i,o,"value"),l=i?.count,c=i?.sum,u=i?.value,d=i?.agg??"count";return(0,Ry.jsxs)("div",{className:"semiotic-tooltip",style:Ty,children:[(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[r,":"]}),Ny(s)]}),(0,Ry.jsxs)("div",{children:[(0,Ry.jsxs)("span",{style:Iy,children:[n,":"]}),Ny(a)]}),null!=l&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"count:"}),Ny(l)]}),"sum"===d&&null!=c&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"sum:"}),Ny(c)]}),"mean"===d&&null!=u&&(0,Ry.jsxs)("div",{children:[(0,Ry.jsx)("span",{style:Iy,children:"mean:"}),Ny(u)]})]})}}({timeAccessor:u,valueAccessor:d}),Y=(0,gb.useRef)(null),{customHoverBehavior:G}=pp({selection:T,linkedHover:R,unwrapData:!0,onObservation:I,chartType:"RealtimeHeatmap",chartId:$}),V=(0,gb.useCallback)(e=>{w&&w(e),G(e)},[w,G]);(0,gb.useImperativeHandle)(t,()=>({push:e=>Y.current?.push(e),pushMany:e=>Y.current?.pushMany(e),remove:e=>Y.current?.remove(e)??[],update:(e,t)=>Y.current?.update(e,t)??[],clear:()=>Y.current?.clear(),getData:()=>Y.current?.getData()??[],getScales:()=>Y.current?.getScales()??null}),[]);const X=ud(N,W[0],W[1],F),U=X?null:cd(c,W[0],W[1],B),K=D?`${i||""} semiotic-emphasis-${D}`.trim():i,Q=By(l,c);return X||U||(0,mb.jsx)(Ka,{ref:Y,chartType:"heatmap",runtimeMode:"streaming",size:W,margin:O,className:K,arrowOfTime:s,windowMode:a,windowSize:Q,data:c,timeAccessor:u,valueAccessor:d,categoryAccessor:h,xExtent:p,yExtent:f,extentPadding:g,heatmapXBins:m,heatmapYBins:y,heatmapAggregation:b,showAxes:z,background:v,hoverAnnotation:H,tooltipContent:q,...Gd({linkedHover:R,selection:T,onObservation:I,forceHoverBehavior:!0,mobileInteraction:o.mobileInteraction,customHoverBehavior:V}),annotations:S,autoPlaceAnnotations:A,svgAnnotationRules:C,tickFormatTime:M,tickFormatValue:j,decay:P,pulse:_,staleness:L,legendPosition:E,pointIdAccessor:e.pointIdAccessor})});function bb(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"}yb.displayName="RealtimeHeatmap",c(require("react"));var vb=6e4,xb=60*vb,kb=24*xb;function wb(e){return 10>e?"0"+e:e+""}var Sb=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ab(e){let t,o=e;return(r,n,i)=>{const s=r instanceof Date?r:new Date(r);e||!i||2>i.length||i===t||(t=i,o=function(e){if(2>e.length)return"days";const t=[];for(let o=1;e.length>o;o++)t.push(e[o]-e[o-1]);t.sort((e,t)=>e-t);const o=t[Math.floor(t.length/2)];return 2*vb>o?"seconds":2*xb>o?"minutes":2*kb>o?"hours":60*kb>o?"days":400*kb>o?"months":"years"}(i));const a=o||"days";return null!=n&&0!==n&&i&&0!==i.length?function(e,t,o){const r=e.getUTCFullYear()!==t.getUTCFullYear(),n=r||e.getUTCMonth()!==t.getUTCMonth(),i=n||e.getUTCDate()!==t.getUTCDate(),s=i||e.getUTCHours()!==t.getUTCHours(),a=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=Sb[e.getUTCMonth()],c=e.getUTCDate(),u=e.getUTCFullYear(),d=wb(e.getUTCHours()),h=wb(e.getUTCMinutes()),p=wb(e.getUTCSeconds());switch(o){case"seconds":return r?`${l} ${c}, ${u} ${d}:${h}:${p}`:i?`${l} ${c} ${d}:${h}:${p}`:s?`${d}:${h}:${p}`:a?`${h}:${p}`:":"+p;case"minutes":return r?`${l} ${c}, ${u} ${d}:${h}`:i?`${l} ${c} ${d}:${h}`:s?`${d}:${h}`:":"+h;case"hours":return r?`${l} ${c}, ${u} ${d}:00`:n?`${l} ${c} ${d}:${h}`:i?`${l} ${c} ${d}:00`:d+":00";case"days":return r?`${l} ${c}, ${u}`:n?`${l} ${c}`:""+c;case"months":return r?`${l} ${u}`:""+l;case"years":return""+u}}(s,new Date(i[n-1]),a):function(e,t){const o=Sb[e.getUTCMonth()],r=e.getUTCDate(),n=e.getUTCFullYear(),i=wb(e.getUTCHours()),s=wb(e.getUTCMinutes()),a=wb(e.getUTCSeconds());switch(t){case"seconds":return`${o} ${r}, ${n} ${i}:${s}:${a}`;case"minutes":case"hours":return`${o} ${r}, ${n} ${i}:${s}`;case"days":return`${o} ${r}, ${n}`;case"months":return`${o} ${n}`;case"years":return""+n}}(s,a)}}async function Cb(e,t){const{format:o="png",filename:r="chart",scale:n=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"),Mb(s,a),"svg"===o){const e=(new XMLSerializer).serializeToString(a);jb(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),r+".svg")}else{const t=l.width*n,o=l.height*n,s=document.createElement("canvas");s.width=t,s.height=o;const c=s.getContext("2d");c.fillStyle=i,c.fillRect(0,0,t,o),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(a),h=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),p=URL.createObjectURL(h),f=new Image;f.width=l.width,f.height=l.height,await new Promise((e,t)=>{f.onload=()=>{c.drawImage(f,0,0),s.toBlob(o=>{o?(jb(o,r+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(p)},f.onerror=()=>{URL.revokeObjectURL(p),t(Error("Failed to load SVG image"))},f.src=p})}}function Mb(e,t){const o=e.children,r=t.children,n=window.getComputedStyle(e),i=["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 i){const o=n.getPropertyValue(e);o&&"none"!==o&&""!==o&&t.style?.setProperty(e,o)}for(let e=0;Math.min(o.length,r.length)>e;e++)Mb(o[e],r[e])}function jb(e,t){const o=URL.createObjectURL(e),r=document.createElement("a");r.href=o,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(o)}var Pb={common:{width:{type:"number",default:600},height:{type:"number",default:400},margin:{type:"object",description:'Object margin. A side value of "auto" or null leaves that side available for auto-reservation.'},className:{type:"string"},title:{type:"string"},enableHover:{type:"boolean",default:!0},showLegend:{type:"boolean"},showGrid:{type:"boolean",default:!1},colorBy:{type:["string","function"]},colorScheme:{type:["string","array"],default:"category10"},tooltip:{type:["boolean","function","object"]},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],default:!1,description:"Opt-in annotation placement pass. Chooses dx/dy for note-like annotations without manual offsets and avoids note/mark/edge overlaps where possible."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},axisExtent:{type:"string",enum:["nice","exact"],default:"nice",description:'Tick endpoint mode. "nice" rounds endpoints to readable values; "exact" pins the first and last tick to the actual data min and max with equidistant intermediates. Affects XY x/y axes and ordinal value axis only.'},frameProps:{type:"object",omitFromSchema:!0},onClick:{type:"function",omitFromSchema:!0}},xyAxis:{xLabel:{type:"string"},yLabel:{type:"string"},xFormat:{type:"function",omitFromSchema:!0},yFormat:{type:"function",omitFromSchema:!0},xScaleType:{type:"string",enum:["linear","log","time"],description:'x scale type. "time" builds a scaleTime (required for landmark ticks on timestamps).'},yScaleType:{type:"string",enum:["linear","log","time"],description:"y scale type."}},ordinalAxis:{categoryLabel:{type:"string"},valueLabel:{type:"string"},valueFormat:{type:"function"},categoryFormat:{type:"function",omitFromSchema:!0}},realtime:{size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},margin:{type:"object"},className:{type:"string"},timeAccessor:{type:["string","function"],description:"Key for time/x values"},valueAccessor:{type:["string","function"],description:"Key for y values"},windowSize:{type:"number",description:"Number of data points visible"},windowMode:{type:"string",enum:["sliding","stepping"]},arrowOfTime:{type:"string",enum:["left","right"]},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltip:{type:["function","object"],description:"Tooltip content function or config"},tooltipContent:{type:"function",omitFromSchema:!0},onHover:{type:"function",omitFromSchema:!0},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],description:"Opt-in annotation placement pass for note-like annotations without manual offsets."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},svgAnnotationRules:{type:"function",omitFromSchema:!0},tickFormatTime:{type:"function",omitFromSchema:!0},tickFormatValue:{type:"function",omitFromSchema:!0},decay:{type:"object",description:"Decay config: { type, halfLife, minOpacity }"},pulse:{type:"object",description:"Pulse config: { duration, color, glowRadius }"},staleness:{type:"object",description:"Staleness config: { threshold, dimOpacity, showBadge }"}},physics:{data:{type:"array",description:"Array of source records. Each record becomes one or more simulated bodies."},size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},className:{type:"string"},title:{type:"string"},responsiveWidth:{type:"boolean"},responsiveHeight:{type:"boolean"},colorBy:{type:["string","function"],description:"Categorical field or accessor used to color simulated bodies."},seed:{type:"number",default:1,description:"Deterministic simulation seed."},ballRadius:{type:"number",description:"Radius of each simulated circular body in pixels."},hoverRadius:{type:"number",description:"Pixel hit radius for body hover tooltips."},paused:{type:"boolean",description:"Pause the simulation at mount or on prop update."},tooltip:{type:["boolean","function","object"],description:"Tooltip content function/config, true for the default body tooltip, or false to disable hover tooltips."},frameProps:{type:"object",omitFromSchema:!0}}},_b=["vertical","horizontal"],Lb=["horizontal","vertical"],Rb=["right","left","top","bottom"],Tb=["linear","monotoneX","monotoneY","step","stepAfter","stepBefore","basis","cardinal","catmullRom"];function Ib(e){const t={type:e.type};return e.enum&&(t.enum=[...e.enum]),t}function $b(e){const t={};for(const[o,r]of Object.entries(function(e){const t={};for(const o of e.propBags)Object.assign(t,Pb[o]);return Object.assign(t,e.ownProps),t}(e)))t[o]=Ib(r);return{required:[...e.required],dataShape:e.dataShape,dataAccessors:[...e.dataAccessors],props:t}}var Nb=Object.fromEntries(Object.entries({BarChart:{name:"BarChart",category:"ordinal",description:"Vertical or horizontal bars for categorical comparisons.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category",description:"Key for category labels"},valueAccessor:{type:["string","function"],default:"value",description:"Key for bar values"},orientation:{type:"string",enum:_b,default:"vertical"},sort:{type:["boolean","string","function"],default:!1,description:"Sort bars: false, true, 'asc', 'desc', or comparator function"},barPadding:{type:"number",default:40},roundedTop:{type:"number",omitFromSchema:!0},valueExtent:{type:"array",omitFromSchema:!0},regression:{type:["boolean","string","object"],description:"Overlay a regression line through the bar tops. Accepts true (linear), a method ('linear' | 'polynomial' | 'loess'), or a full RegressionConfig. Pixels resolve through the band scale."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay"]}},StackedBarChart:{name:"StackedBarChart",category:"ordinal",description:"Stacked bars for part-to-whole comparisons across categories. Requires stackBy to define the stacking dimension.",required:["data","stackBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},stackBy:{type:["string","function"],description:"Key to define the stacking dimension (required)"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},normalize:{type:"boolean",default:!1,description:"Normalize stacks to 100%"},sort:{type:["boolean","string","function"],omitFromSchema:!0},barPadding:{type:"number",default:40},roundedTop:{type:"number",omitFromSchema:!0},showLegend:{type:"boolean",default:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["stack"]}},GroupedBarChart:{name:"GroupedBarChart",category:"ordinal",description:"Side-by-side bars for comparing sub-categories within categories. Requires groupBy to define grouping.",required:["data","groupBy"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},groupBy:{type:["string","function"],description:"Key to define the grouping dimension (required)"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},sort:{type:["boolean","string","function"],omitFromSchema:!0},barPadding:{type:"number",default:60},roundedTop:{type:"number",omitFromSchema:!0},showLegend:{type:"boolean",default:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},SwarmPlot:{name:"SwarmPlot",category:"ordinal",description:"Beeswarm/jittered dot plot showing individual data points within categories. Good for distributions.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,8]},symbolBy:{type:["string","function"],description:"Categorical field → glyph shape; each point renders as a d3-shape glyph instead of a circle."},symbolMap:{type:"object",description:"Explicit {category → shape} map for symbolBy; unmapped categories auto-assign."},pointRadius:{type:"number",default:4},pointOpacity:{type:"number",default:.7},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},BoxPlot:{name:"BoxPlot",category:"ordinal",description:"Box-and-whisker plots showing statistical distribution (median, quartiles, outliers) per category.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},showOutliers:{type:"boolean",default:!0,description:"Show outlier points"},outlierRadius:{type:"number",default:3},categoryPadding:{type:"number",default:20}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["statistical"]}},Histogram:{name:"Histogram",category:"ordinal",description:"Binned frequency distribution chart. Shows how data values are distributed across bins within categories.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},bins:{type:"number",default:25,description:"Number of bins for the histogram"},relative:{type:"boolean",default:!1,description:"Normalize counts per category to show relative frequency"},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},ViolinPlot:{name:"ViolinPlot",category:"ordinal",description:"Violin plots showing the full distribution shape (kernel density) per category. Combines density estimation with optional IQR lines.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"vertical"},bins:{type:"number",default:25,description:"Number of bins for density estimation"},curve:{type:"string",default:"catmullRom",description:"Interpolation curve for the violin shape"},showIQR:{type:"boolean",default:!0,description:"Show interquartile range lines"},categoryPadding:{type:"number",default:20},brush:{type:"boolean",omitFromSchema:!0},onBrush:{type:"function",omitFromSchema:!0},linkedBrush:{type:["string","object"],omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["statistical"]}},RidgelinePlot:{name:"RidgelinePlot",category:"ordinal",description:"Overlapping density distributions for comparing distributions across categories. Each category gets a density curve that can overlap with adjacent rows.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},valueAccessor:{type:["string","function"],description:"Key for numeric values to build distributions from"},bins:{type:"number",description:"Number of bins for density estimation"},amplitude:{type:"number",default:1.5,description:"Unitless multiplier of row height (>1 creates overlap)"},categoryPadding:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},DotPlot:{name:"DotPlot",category:"ordinal",description:"Cleveland-style dot plot for comparing values across categories. Sorted by default.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},orientation:{type:"string",enum:_b,default:"horizontal"},sort:{type:["boolean","string","function"],default:!0,description:"Sort dots: true, false, 'asc', 'desc'"},dotRadius:{type:"number",default:5},categoryPadding:{type:"number",default:10},showGrid:{type:"boolean",default:!0},regression:{type:["boolean","string","object"],description:"Overlay a regression line through the dots. Same shape as Scatterplot's regression prop."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay"]}},PieChart:{name:"PieChart",category:"ordinal",description:"Proportional slices in a circle for part-to-whole relationships.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},startAngle:{type:"number",default:0,description:"Starting angle in radians"},cornerRadius:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},DonutChart:{name:"DonutChart",category:"ordinal",description:"Pie chart with a hole in the center. Supports center content like summary statistics.",required:["data"],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["common"],ownProps:{data:{type:"array",description:"Array of data objects"},categoryAccessor:{type:["string","function"],default:"category"},valueAccessor:{type:["string","function"],default:"value"},innerRadius:{type:"number",default:60,description:"Inner radius of the donut hole in pixels"},centerContent:{type:["object","string","number"],description:"React node to render in the center of the donut (accepts string key or JSX)"},startAngle:{type:"number",default:0},cornerRadius:{type:"number",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},GaugeChart:{name:"GaugeChart",category:"ordinal",description:"Single-value gauge with threshold zones, needle indicator, and configurable sweep angle. Built on StreamOrdinalFrame radial projection.",required:["value"],dataShape:"none",dataAccessors:[],propBags:["common"],ownProps:{value:{type:"number",description:"Current gauge value"},min:{type:"number",default:0},max:{type:"number",default:100},thresholds:{type:"array",description:"Array of { value, color, label? } defining threshold zones. Last value should equal max."},gradientFill:{type:"object",description:"Arc-length gradient for the gauge band. Color stops are sampled along the sweep from start to end."},arcWidth:{type:"number",default:.3,description:"Arc thickness as fraction of radius (0-1)"},cornerRadius:{type:"number",description:"Pixel radius for rounded segment ends. Same semantics as DonutChart's cornerRadius. Omit for sharp corners."},sweep:{type:"number",default:240,description:"Arc sweep angle in degrees (gap centered at bottom)"},fillZones:{type:"boolean",default:!0,description:"When true, the arc fills up to the current value; when false, the full arc is shown."},showNeedle:{type:"boolean",default:!0},needleColor:{type:"string"},color:{type:"string",description:"Fallback fill color used when no thresholds are defined"},valueFormat:{type:"function"},centerContent:{type:["object","string","number","function"],omitFromSchema:!0},showScaleLabels:{type:"boolean",default:!0},backgroundColor:{type:"string",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!0,colorModel:"threshold",layoutMode:"synthetic",specialFeatures:["threshold-zones","value-only","controlled-prop-streaming"]}},FunnelChart:{name:"FunnelChart",category:"ordinal",description:"Funnel visualization with two orientations. Horizontal (default): steps top-to-bottom with centered bars and trapezoid connectors; multi-category mirrors around center axis. Vertical: steps on x-axis as vertical bars with hatched dropoff stacking (solid = retained, hatched = dropoff from previous step); multi-category renders grouped bars.",required:["data"],dataShape:"array",dataAccessors:["stepAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects with step and value fields"},stepAccessor:{type:["string","function"],default:"step",description:"Key for funnel step/stage name"},valueAccessor:{type:["string","function"],default:"value",description:"Key for numeric value per step"},categoryAccessor:{type:["string","function"],description:"Key to split each step into mirrored categories (optional)"},orientation:{type:"string",enum:Lb,default:"horizontal",description:"Horizontal (default): centered bars top-to-bottom with trapezoid connectors. Vertical: vertical bars with hatched dropoff stacking — solid = retained, hatched = dropoff from previous step. Multi-category renders grouped bars in vertical mode."},connectorOpacity:{type:"number",default:.3,description:"Opacity of trapezoid connectors between steps (0-1). Horizontal orientation only."},showCategoryTicks:{type:"boolean",default:!1,description:"Show category tick labels on ordinal axis"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:Rb}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},SwimlaneChart:{name:"SwimlaneChart",category:"ordinal",description:"Categorical lanes with sequentially stacked items colored by subcategory. Unlike StackedBarChart, the same subcategory can appear multiple times in the same lane — items stack left-to-right (horizontal) or bottom-to-top (vertical) in data order. Supports brush for value-axis selection and push API for streaming.",required:["subcategoryAccessor"],dataShape:"array",dataAccessors:["categoryAccessor","subcategoryAccessor","valueAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of data objects. Omit for push API mode."},categoryAccessor:{type:["string","function"],default:"category",description:"Key for lane categories (swim lanes)"},subcategoryAccessor:{type:["string","function"],description:"Key for item subcategory (color grouping within lanes). Required. Duplicate subcategories in the same lane stack sequentially."},valueAccessor:{type:["string","function"],default:"value",description:"Key for item size/duration along the value axis"},orientation:{type:"string",enum:Lb,default:"horizontal",description:"Horizontal renders lanes as rows; vertical as columns."},barPadding:{type:"number",default:40,description:"Padding between lanes in pixels"},roundedTop:{type:"number",description:"Rounded corner radius (px) applied to the outermost ends of each lane — left+right for horizontal, top+bottom for vertical. Middle segments stay square; single-segment lanes round all four corners."},brush:{type:"boolean",description:"Enable value-axis brush selection"},onBrush:{type:"function",description:"Callback with { r: [min, max] } or null when brush clears"},linkedBrush:{type:["string","object"],description:"LinkedCharts brush integration name"},showCategoryTicks:{type:"boolean",description:"Show lane labels on the category axis"},responsiveWidth:{type:"boolean"},legendPosition:{type:"string",enum:Rb}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush"]}},LikertChart:{name:"LikertChart",category:"ordinal",description:"Visualize Likert scale survey responses. Horizontal (default): diverging bar chart centered at 0% — negative levels extend left, positive right, neutral (if odd count) split 50/50 across centerline. Vertical: stacked 100% bar chart. Supports raw integer scores (1-based, aggregated automatically) or pre-aggregated (question, level, count) data. The levels array defines polarity: first half = negative, second half = positive, center = neutral (if odd). Works with any scale size (3-point to 7-point+). Supports push API for streaming — accumulates raw data and re-aggregates on each push.",required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor","levelAccessor","countAccessor"],propBags:["common","ordinalAxis"],ownProps:{data:{type:"array",description:"Array of raw response or pre-aggregated data objects"},levels:{type:"array",default:zg,description:"Ordered response labels, most negative to most positive. Defaults to a 5-point Very Low to Very High scale. Odd count = center is neutral."},categoryAccessor:{type:["string","function"],default:"question",description:"Question/item field (ordinal axis)"},valueAccessor:{type:["string","function"],default:"score",description:"Integer score field for raw response mode (1-based: score 1 → levels[0])"},levelAccessor:{type:["string","function"],description:"Level name field for pre-aggregated mode. Each value must match an entry in levels."},countAccessor:{type:["string","function"],default:"count",description:"Count/frequency field for pre-aggregated mode"},orientation:{type:"string",enum:_b,default:"horizontal"},barPadding:{type:"number",default:20}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},LineChart:{name:"LineChart",category:"xy",description:"Line traces with curve interpolation, area fill, and point markers. Use for time series, trends, and continuous data.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key or accessor function for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key or accessor function for y-axis values"},lineBy:{type:["string","function"],description:"Key to group data into separate lines"},lineDataAccessor:{type:"string",default:"coordinates",description:"Key for the coordinates array within each line object"},curve:{type:"string",enum:Tb,default:"linear",description:"Curve interpolation method"},lineWidth:{type:"number",default:2,description:"Stroke width of the line"},showPoints:{type:"boolean",default:!1,description:"Show data point markers on the line"},pointRadius:{type:"number",default:3,description:"Radius of point markers when showPoints is true"},fillArea:{type:"boolean",default:!1,description:"Fill the area under the line"},areaOpacity:{type:"number",default:.3,description:"Opacity of the filled area (0-1)"},forecast:{type:"object",description:"Forecast overlay config — tagged training/observed/forecast region with optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."},band:{type:["object","array"],description:"Asymmetric min/max envelope drawn under the line. `{ y0Accessor, y1Accessor, style?, perSeries?, interactive? }` or an array of those for percentile fans. Distinct from `forecast`/`anomaly` (computed) — band is pure data passthrough. Hovered datum is enriched with `band: { y0, y1 }` and `bands: [...]`."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["forecast","anomaly","band","series-features","gap-handling","direct-labels","endpoint-labels"]}},AreaChart:{name:"AreaChart",category:"xy",description:"Filled area chart with optional stroke line. Use for showing volume or magnitude over time.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key for y-axis values"},areaBy:{type:["string","function"],description:"Key to group data into separate areas"},lineDataAccessor:{type:"string",default:"coordinates",description:"Key for the coordinates array within each area object"},curve:{type:"string",enum:Tb,default:"monotoneX"},gradientFill:{type:["boolean","object"],description:"Renderer-space area gradient. true uses default opacity; object supports opacity or colorStops."},semanticGradient:{type:"array",description:"User-facing gradient stops: [{ at: 0-100, color, opacity? }], where 0 is baseline and 100 is line/top. Takes precedence over gradientFill."},areaOpacity:{type:"number",default:.7,description:"Area fill opacity (0-1)"},showLine:{type:"boolean",default:!0,description:"Show stroke line on top of area"},lineWidth:{type:"number",default:2},forecast:{type:"object",description:"Forecast overlay config — tagged training/observed/forecast region with optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."},band:{type:["object","array"],description:"Asymmetric min/max envelope drawn under the area. See LineChart.band — same shape, same enrichment."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["forecast","anomaly","band","series-features"]}},DifferenceChart:{name:"DifferenceChart",category:"xy",description:"Two-series difference chart: fills the area between series A and series B with a color that switches at each crossover — A's color where A > B, B's color where B > A. Crossovers are linearly interpolated so segments meet at zero-width vertices. Both series can be drawn as overlay lines on top of the fill. Classic uses: temperature anomaly (actual vs. normal), forecast accuracy (actual vs. predicted), budget variance.",required:[],dataShape:"array",dataAccessors:["xAccessor","seriesAAccessor","seriesBAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of `{x, a, b}` objects. Omit for push API mode."},xAccessor:{type:["string","function"],default:"x",description:"Key for x values"},seriesAAccessor:{type:["string","function"],default:"a",description:"Key for series A values"},seriesBAccessor:{type:["string","function"],default:"b",description:"Key for series B values"},seriesALabel:{type:"string",default:"A",description:"Display label for series A in legend + tooltip"},seriesBLabel:{type:"string",default:"B",description:"Display label for series B"},seriesAColor:{type:"string",description:"Fill color when series A is higher. Defaults to var(--semiotic-danger)."},seriesBColor:{type:"string",description:"Fill color when series B is higher. Defaults to var(--semiotic-info)."},showLines:{type:"boolean",default:!0,description:"Draw the two series as overlay lines on top of the fill"},lineWidth:{type:"number",default:1.5},showPoints:{type:"boolean",default:!1,description:"Show points at each data vertex on the overlay lines"},pointRadius:{type:"number",default:3},curve:{type:"string",enum:Tb,default:"linear"},areaOpacity:{type:"number",default:.6,description:"Difference fill opacity (0-1)"},gradientFill:{type:["boolean","object"],description:"Tip→base gradient across each segment; same shape as AreaChart.gradientFill"},xExtent:{type:"array",description:"Fixed x domain `[min, max]`. Either bound may be `undefined`."},yExtent:{type:"array",description:"Fixed y domain `[min, max]`. Either bound may be `undefined`."},pointIdAccessor:{type:["string","function"],description:"Stable ID for push-mode remove()/update()"},windowSize:{type:"number",description:"Max raw rows in the push buffer; older rows evict FIFO. Recommended for long-running streams."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["crossover-segmentation"]}},StackedAreaChart:{name:"StackedAreaChart",category:"xy",description:"Stacked area chart with optional normalization to 100%. Use for part-to-whole trends over time.",required:["data","areaBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},areaBy:{type:["string","function"],description:"Key to group data into stacked areas"},lineDataAccessor:{type:"string",default:"coordinates"},curve:{type:"string",enum:Tb,default:"monotoneX"},areaOpacity:{type:"number",default:.7},showLine:{type:"boolean",default:!0},lineWidth:{type:"number",default:2},normalize:{type:"boolean",default:!1,description:"Normalize stacks to 100%"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["stack","streamgraph"]}},Scatterplot:{name:"Scatterplot",category:"xy",description:"Individual data points plotted by x/y position with optional size and color encoding.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,15],description:"Min and max radius for sizeBy scaling"},symbolBy:{type:["string","function"],description:"Categorical field → glyph shape; each mark renders as a d3-shape glyph (circle/square/triangle/diamond/star/cross/wye/chevron) instead of a circle."},symbolMap:{type:"object",description:"Explicit {category → shape} map for symbolBy; unmapped categories auto-assign."},pointRadius:{type:"number",default:5,description:"Fixed point radius"},pointOpacity:{type:"number",default:.8},regression:{type:["boolean","string","object"],description:"Overlay a regression line. true = linear, 'linear' | 'polynomial' | 'loess' = method, or full RegressionConfig object. Sugar over the trend annotation."},forecast:{type:"object",description:"Forecast overlay config — tagged future points + optional envelope. See ForecastConfig."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations. See AnomalyConfig."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay","forecast","anomaly","series-features"]}},BubbleChart:{name:"BubbleChart",category:"xy",description:"Scatterplot with required size dimension for three-variable comparison. Bubble area encodes a numeric value.",required:["data","sizeBy"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},sizeBy:{type:["string","function"],description:"Key for bubble size (required)"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},sizeRange:{type:"array",default:[5,40]},bubbleOpacity:{type:"number",default:.6},bubbleStrokeWidth:{type:"number",default:1},bubbleStrokeColor:{type:"string",default:"white"},regression:{type:["boolean","string","object"],description:"Overlay a regression line on the bubbles. Same shape as Scatterplot's regression prop."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["size-encoding","streaming-domain","regression-overlay"]}},Heatmap:{name:"Heatmap",category:"xy",description:"Grid/matrix visualization with color-encoded cell values. Use for correlation matrices, time-frequency analysis.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor","valueAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects with x, y, and value"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},valueAccessor:{type:["string","function"],default:"value",description:"Key for the cell value"},colorScheme:{type:"string",enum:["blues","reds","greens","viridis","custom"]},customColorScale:{type:["object","function"],omitFromSchema:!0},showValues:{type:"boolean",default:!1,description:"Display numeric values in cells"},valueFormat:{type:"function"},cellBorderColor:{type:"string",default:"#fff"},cellBorderWidth:{type:"number",default:1},legendPosition:{type:"string",enum:Rb,default:"right",description:"Position of the gradient legend"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:[]}},QuadrantChart:{name:"QuadrantChart",category:"xy",description:"Scatterplot divided into four labeled, colored quadrants by center lines. Use for BCG matrices, priority matrices, and any 2x2 strategic framework.",required:[],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x"},yAccessor:{type:["string","function"],default:"y"},xCenter:{type:"number",description:"X-coordinate of the vertical center line. Defaults to midpoint of x domain."},yCenter:{type:"number",description:"Y-coordinate of the horizontal center line. Defaults to midpoint of y domain."},quadrants:{type:"object",default:Yf,description:"Optional configuration overrides for the four quadrants: { topRight, topLeft, bottomRight, bottomLeft }, each with partial { label, color, opacity }. Omitted quadrants and fields use built-in defaults."},centerlineStyle:{type:"object",omitFromSchema:!0},showQuadrantLabels:{type:"boolean",default:!0},quadrantLabelSize:{type:"number",default:12},sizeBy:{type:["string","function"],description:"Key for variable point sizing"},sizeRange:{type:"array",default:[3,15]},pointRadius:{type:"number",default:5},pointOpacity:{type:"number",default:.8}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["quadrants"]}},MultiAxisLineChart:{name:"MultiAxisLineChart",category:"xy",description:"Dual Y-axis line chart for comparing two series with different scales on the same x axis. Data is unitized (normalized to [0,1]) internally; left axis shows series[0] values and right axis shows series[1] values in original units. Falls back to standard multi-line if not exactly 2 series.",required:["series"],dataShape:"array",dataAccessors:["xAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects shared by both series"},xAccessor:{type:["string","function"],default:"x",description:"Key for x values"},series:{type:"array",description:"Exactly 2 series configs for dual-axis mode. Each: { yAccessor, label?, color?, format?, extent? }"},colorScheme:{type:["string","array"]},curve:{type:"string",default:"monotoneX"},lineWidth:{type:"number",default:2}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["dual-axis","hoc-ssr-only"]}},CandlestickChart:{name:"CandlestickChart",category:"xy",description:"OHLC candlestick bars, or a range chart when open/close are omitted. Honors mode (primary/context/sparkline). Range variant degrades cleanly: endpoint dots + wick, sized against canvas height so sparkline rows don't render marble-sized dots.",required:["highAccessor","lowAccessor"],dataShape:"array",dataAccessors:["xAccessor","highAccessor","lowAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array"},xAccessor:{type:["string","function"],default:"x"},highAccessor:{type:["string","function"],default:"high",description:"Required. Upper bound (candlestick high or range top)."},lowAccessor:{type:["string","function"],default:"low",description:"Required. Lower bound (candlestick low or range bottom)."},openAccessor:{type:["string","function"],description:"Optional. Pair with closeAccessor for OHLC; omit both to render a range chart."},closeAccessor:{type:["string","function"],description:"Optional. See openAccessor."},candlestickStyle:{type:"object",description:"Style overrides."},mode:{type:"string",enum:["primary","context","sparkline"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["ohlc"]}},ConnectedScatterplot:{name:"ConnectedScatterplot",category:"xy",description:"Scatterplot where points are connected in order, showing trajectories through 2D space. Viridis-colored start→end, white halo under lines.",required:["data"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common","xyAxis"],ownProps:{data:{type:"array",description:"Array of data objects"},xAccessor:{type:["string","function"],default:"x",description:"Key for x-axis values"},yAccessor:{type:["string","function"],default:"y",description:"Key for y-axis values"},orderAccessor:{type:["string","function"],description:"Key for point ordering (number or Date field)"},orderLabel:{type:"string",description:"Label for the ordering metric in tooltips"},pointRadius:{type:"number",default:4,description:"Point radius"},pointIdAccessor:{type:["string","function"],description:"Accessor for unique point IDs, used by point-anchored annotations"},regression:{type:["boolean","string","object"],description:"Overlay a regression line under the connected path. Same shape as Scatterplot's regression prop."},forecast:{type:"object",description:"Forecast overlay config — same shape as LineChart's forecast prop."},anomaly:{type:"object",description:"Anomaly overlay config — ±σ band + anomaly dot annotations."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["regression-overlay","forecast","anomaly","series-features"]}},ScatterplotMatrix:{name:"ScatterplotMatrix",category:"xy",description:"Multi-panel scatterplot grid with crossfilter brushing. Requires data array with numeric fields.",required:["data","fields"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"array"},fields:{type:"array"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["matrix","brush","composite-delegates-interaction","hoc-ssr-only"]}},MinimapChart:{name:"MinimapChart",category:"xy",description:"Overview + detail chart with linked zoom. Wraps an XY chart with a minimap navigation pane.",required:["data"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"array"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush","overview-detail","composite-delegates-interaction","hoc-ssr-only"]}},ForceDirectedGraph:{name:"ForceDirectedGraph",category:"network",description:"Physics-based node-link diagram. Use for relationships, social networks, knowledge graphs.",required:["nodes","edges"],dataShape:"network",dataAccessors:["nodeIDAccessor","sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{nodes:{type:"array",description:"Array of node objects"},edges:{type:"array",description:"Array of edge objects with source and target"},nodeIDAccessor:{type:["string","function"],default:"id",description:"Key for node unique identifier"},sourceAccessor:{type:["string","function"],default:"source",description:"Key for edge source node ID"},targetAccessor:{type:["string","function"],default:"target",description:"Key for edge target node ID"},nodeLabel:{type:["string","function"],description:"Key or accessor for node labels"},nodeSize:{type:["number","string","function"],default:8,description:"Fixed node radius or key for variable sizing"},nodeSizeRange:{type:"array",default:[5,20]},edgeWidth:{type:["number","string","function"],default:1,description:"Fixed edge width or key for variable width"},edgeColor:{type:"string",default:"#999"},edgeOpacity:{type:"number",default:.6},iterations:{type:"number",default:300,description:"Force simulation iterations"},forceStrength:{type:"number",default:.1},layoutExecution:{type:"string",enum:["auto","worker","sync"],default:"auto",description:"Force layout execution: auto, worker, or sync"},showLabels:{type:"boolean",default:!1}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["force-simulation"]}},SankeyDiagram:{name:"SankeyDiagram",category:"network",description:"Flow diagram showing weighted connections between nodes. Use for flows, budgets, process mapping.",required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of edge objects with source, target, and value"},nodes:{type:"array",description:"Optional array of node objects (auto-derived from edges if omitted)"},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value",description:"Key for edge flow value"},nodeIdAccessor:{type:["string","function"],default:"id"},edgeColorBy:{type:["string","function"],enum:["source","target","gradient"],default:"source",description:"How to color edges"},orientation:{type:"string",enum:_b,default:"horizontal"},nodeAlign:{type:"string",enum:["justify","left","right","center"],default:"justify"},nodePaddingRatio:{type:"number",default:.05},nodeWidth:{type:"number",default:15},nodeLabel:{type:["string","function"],description:"Key for node labels"},showLabels:{type:"boolean",default:!0},edgeOpacity:{type:"number",default:.5},edgeSort:{type:"function",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},ProcessSankey:{name:"ProcessSankey",category:"network",description:"Temporal sankey with a real time x-axis. Edges carry startTime/endTime; nodes can declare an explicit xExtent lifetime. Use for timestamped flow events (PR commits, campaign-finance contributions, supply-chain shipments).",required:["domain"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of timed edge records with source, target, value, startTime, endTime. Omit for push-mode."},nodes:{type:"array",description:"Optional array of node objects. Nodes may carry an `xExtent: [start, end]` to bound the lane explicitly."},domain:{type:"array",description:"[tStart, tEnd] of the chart's x-axis (required)."},axisTicks:{type:"array",description:"Optional [{ date, label }] tick array for the time axis."},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"id"},startTimeAccessor:{type:["string","function"],default:"startTime"},endTimeAccessor:{type:["string","function"],default:"endTime"},xExtentAccessor:{type:["string","function"],default:"xExtent"},edgeIdAccessor:{type:["string","function"],default:"id"},legendPosition:{type:"string",enum:["right","left","top","bottom"],default:"right"},pairing:{type:"string",enum:["value","temporal"],default:"temporal",description:"Edge-side pairing strategy at transit nodes."},packing:{type:"string",enum:["off","reuse"],default:"reuse",description:"Lane reuse — pack lifetime-disjoint nodes into the same row."},laneOrder:{type:"string",enum:["insertion","crossing-min","inside-out","crossing-min+inside-out"],default:"crossing-min"},ribbonLane:{type:"string",enum:["source","target","both"],default:"both"},lifetimeMode:{type:"string",enum:["full","half"],default:"half"},showLaneRails:{type:"boolean",default:!1},showQualityReadout:{type:"boolean",default:!1},edgeOpacity:{type:"number",default:.35},timeFormat:{type:"function",omitFromSchema:!0},valueFormat:{type:"function",omitFromSchema:!0},showParticles:{type:"boolean",default:!1},particleStyle:{type:"object",description:"ParticleStyle config — same shape as SankeyDiagram. Defaults from DEFAULT_PARTICLE_STYLE (radius 3, opacity 0.7, spawnRate 0.1, maxPerEdge 50)."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"custom",specialFeatures:["temporal","particles","lane-reuse"]}},ChordDiagram:{name:"ChordDiagram",category:"network",description:"Circular diagram showing inter-relationships and flow volumes between groups.",required:["edges"],dataShape:"network",dataAccessors:["sourceAccessor","targetAccessor"],propBags:["common"],ownProps:{edges:{type:"array",description:"Array of edge objects with source, target, and value"},nodes:{type:"array",description:"Optional array of node objects"},sourceAccessor:{type:["string","function"],default:"source"},targetAccessor:{type:["string","function"],default:"target"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"id"},edgeColorBy:{type:["string","function"],enum:["source","target"],default:"source"},padAngle:{type:"number",default:.01},groupWidth:{type:"number",default:20},sortGroups:{type:"function",omitFromSchema:!0},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean",default:!0},edgeOpacity:{type:"number",default:.5}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:[]}},TreeDiagram:{name:"TreeDiagram",category:"network",description:"Hierarchical tree layout. Supports tree, cluster, partition, and radial orientations. Data is a single root node with children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},layout:{type:"string",enum:["tree","cluster","partition","treemap","circlepack"],default:"tree"},orientation:{type:"string",enum:["vertical","horizontal","radial"],default:"vertical"},childrenAccessor:{type:["string","function"],default:"children",description:"Key for the children array in each node"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1,description:"Color nodes by their depth in the hierarchy"},edgeStyle:{type:"string",enum:["line","curve"],default:"curve"},nodeLabel:{type:["string","function"]},showLabels:{type:"boolean",default:!0},nodeSize:{type:"number",default:5}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},Treemap:{name:"Treemap",category:"network",description:"Space-filling rectangular hierarchy visualization. Data is a single root node with nested children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},childrenAccessor:{type:["string","function"],default:"children"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1},showLabels:{type:"boolean",default:!0},nodeLabel:{type:["string","function"]},nodeStyle:{type:"function",omitFromSchema:!0,description:"Per-node style overlay merged on top of Treemap's built-in color encoding"}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},CirclePack:{name:"CirclePack",category:"network",description:"Nested circles representing hierarchical data. Data is a single root node with nested children.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Root node object with nested children"},childrenAccessor:{type:["string","function"],default:"children"},valueAccessor:{type:["string","function"],default:"value"},nodeIdAccessor:{type:["string","function"],default:"name"},colorByDepth:{type:"boolean",default:!1},showLabels:{type:"boolean",default:!0},nodeLabel:{type:["string","function"]},circleOpacity:{type:"number",default:.7}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy"]}},OrbitDiagram:{name:"OrbitDiagram",category:"network",description:"Animated orbital diagram showing hierarchical data as nodes orbiting a center. Supports flat, solar, atomic, and custom ring arrangements.",required:["data"],dataShape:"object",dataAccessors:[],propBags:["common"],ownProps:{data:{type:"object",description:"Hierarchical root object with children: { name: 'root', children: [...] }"},childrenAccessor:{type:["string","function"],default:"children",description:"Key to access children from each datum"},nodeIdAccessor:{type:["string","function"],default:"name",description:"Key to identify each node"},colorByDepth:{type:"boolean",default:!1,description:"Color by hierarchy depth"},orbitMode:{type:["string","array"],default:"flat",description:"Ring arrangement: 'flat', 'solar', 'atomic', or number[]"},orbitSize:{type:["number","function"],default:2.95,description:"Ring size divisor per depth"},speed:{type:"number",default:.25,description:"Orbit speed in degrees per frame"},eccentricity:{type:["number","function"],default:1,description:"Vertical squash for elliptical orbits (1 = circle)"},showRings:{type:"boolean",default:!0,description:"Show orbital ring paths"},nodeRadius:{type:["number","function"],default:6,description:"Node radius"},showLabels:{type:"boolean",default:!1,description:"Show node labels"},animated:{type:"boolean",default:!0,description:"Enable animation"},revolution:{type:"function",omitFromSchema:!0},foregroundGraphics:{type:"object",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["hierarchy","animated","hoc-ssr-only"]}},ChoroplethMap:{name:"ChoroplethMap",category:"geo",description:"Geographic choropleth map with colored regions based on data values.",required:["areas"],dataShape:"array",dataAccessors:["valueAccessor"],propBags:["common"],ownProps:{areas:{type:["array","string"],description:"GeoJSON features or reference geography name"},valueAccessor:{type:["string","function"]},colorScheme:{type:["string","array"]},projection:{type:"string",default:"equalEarth"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:["controlled-prop-streaming"]}},ProportionalSymbolMap:{name:"ProportionalSymbolMap",category:"geo",description:"Geographic map with sized symbols at point locations.",required:["points"],dataShape:"array",dataAccessors:["xAccessor","yAccessor"],propBags:["common"],ownProps:{points:{type:"array"},xAccessor:{type:["string","function"],default:"lon"},yAccessor:{type:["string","function"],default:"lat"},sizeBy:{type:["string","function"]},areas:{type:["array","string"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"sequential",layoutMode:"plugin",specialFeatures:[]}},FlowMap:{name:"FlowMap",category:"geo",description:"Geographic flow map showing movement between locations with animated particles.",required:["flows"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{flows:{type:"array"},nodes:{type:"array"},valueAccessor:{type:["string","function"]},lineIdAccessor:{type:["string","function"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["particles"]}},DistanceCartogram:{name:"DistanceCartogram",category:"geo",description:"Cartogram distorting geographic positions based on travel time or cost from a center point.",required:["points"],dataShape:"array",dataAccessors:[],propBags:["common"],ownProps:{points:{type:"array"},center:{type:"array"},costAccessor:{type:["string","function"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["distortion","hoc-ssr-only"]}},RealtimeLineChart:{name:"RealtimeLineChart",category:"realtime",description:"Streaming line chart rendered on canvas. Uses ref-based push API for high-frequency data.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{stroke:{type:"string"},strokeWidth:{type:"number"},strokeDasharray:{type:"string"},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeHistogram:{name:"RealtimeHistogram",category:"realtime",description:"Streaming bar chart with binned aggregation. Uses ref-based push API.",required:["binSize"],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{binSize:{type:"number",description:"Time bin size in milliseconds (required)"},direction:{type:"string",enum:["up","down"],default:"up",description:'Bar growth direction. Use "down" for mirrored histograms; explicit valueExtent is reversed.'},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},colors:{type:"object",description:"Map of category to color string"},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},brush:{type:["boolean","string","object"],description:'Enable brush selection. true defaults to { dimension: "x", snap: "bin" }. String: "x". Object: { dimension, snap: "continuous"|"bin", snapDuring }.'},onBrush:{type:"function",description:"Callback when brush extent changes: (extent | null) => void"},linkedBrush:{type:["string","object"],description:"Cross-chart brush coordination via LinkedCharts. String: selection name. Object: { name, xField, yField }."},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream","brush"]}},TemporalHistogram:{name:"TemporalHistogram",category:"realtime",description:"Static-data temporal histogram with binned aggregation. Use when data is a bounded array rather than a push stream.",required:["data","binSize"],dataShape:"array",dataAccessors:["timeAccessor","valueAccessor","categoryAccessor"],propBags:[],ownProps:{data:{type:"array",description:"Array of temporal observations"},binSize:{type:"number",description:"Time bin size in milliseconds (required)"},size:{type:"array",description:"[width, height] in pixels"},width:{type:"number",description:"Alias for size[0]"},height:{type:"number",description:"Alias for size[1]"},margin:{type:"object",description:'Object margin. A side value of "auto" or null leaves that side available for auto-reservation.'},className:{type:"string"},timeAccessor:{type:["string","function"],description:"Key for time/x values"},valueAccessor:{type:["string","function"],description:"Key for y values"},direction:{type:"string",enum:["up","down"],default:"up",description:'Bar growth direction. Use "down" for mirrored histograms; explicit valueExtent is reversed.'},categoryAccessor:{type:["string","function"],description:"Key for category grouping"},colors:{type:"object",description:"Map of category to color string"},timeExtent:{type:"array"},valueExtent:{type:"array"},extentPadding:{type:"number"},showAxes:{type:"boolean"},background:{type:"string"},enableHover:{type:["boolean","object"]},tooltip:{type:["function","object"],description:"Tooltip content function or config"},tooltipContent:{type:"function",omitFromSchema:!0},onHover:{type:"function",omitFromSchema:!0},annotations:{type:"array"},autoPlaceAnnotations:{type:["boolean","object"],description:"Opt-in annotation placement pass for note-like annotations without manual offsets."},responsiveRules:{type:"array",description:"Semantic responsive transforms applied before chart-mode defaults."},mobileSemantics:{type:"object",description:"Phone/mobile contract consumed by audits, recipes, adapters, and agents."},mobileInteraction:{type:["boolean","object"],description:"Touch-first interaction policy for phone-sized chart slots."},svgAnnotationRules:{type:"function",omitFromSchema:!0},tickFormatTime:{type:"function",omitFromSchema:!0},tickFormatValue:{type:"function",omitFromSchema:!0},fill:{type:"string"},stroke:{type:"string"},strokeWidth:{type:"number"},gap:{type:"number"},linkedHover:{type:["boolean","string","object"]},linkedBrush:{type:["string","object"],description:"Cross-chart brush coordination via LinkedCharts. String: selection name. Object: { name, xField, yField }."},brush:{type:["boolean","string","object"],description:'Enable brush selection. true defaults to { dimension: "x", snap: "bin" }. String: "x". Object: { dimension, snap: "continuous"|"bin", snapDuring }.'},onBrush:{type:"function",description:"Callback when brush extent changes: (extent | null) => void",omitFromSchema:!0}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!1,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["brush"]}},RealtimeSwarmChart:{name:"RealtimeSwarmChart",category:"realtime",description:"Streaming swarm/scatter chart showing individual data points over time.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{categoryAccessor:{type:["string","function"]},colors:{type:"object"},radius:{type:"number"},fill:{type:"string"},opacity:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},pointStyle:{type:"function",description:"Per-datum style callback. Overrides fill, stroke, strokeWidth, opacity, and radius via r.",omitFromSchema:!0},yScaleType:{type:"string",enum:["linear","log","symlog"],description:"Value-axis scale. symlog preserves zero and negative values while compressing large magnitudes."},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeWaterfallChart:{name:"RealtimeWaterfallChart",category:"realtime",description:"Streaming waterfall chart with positive/negative bars and connectors.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{positiveColor:{type:"string"},negativeColor:{type:"string"},connectorStroke:{type:"string"},connectorWidth:{type:"number"},gap:{type:"number"},stroke:{type:"string"},strokeWidth:{type:"number"},transition:{type:"object",description:"Transition config: { duration, easing }"}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"categorical",layoutMode:"plugin",specialFeatures:["live-stream"]}},RealtimeHeatmap:{name:"RealtimeHeatmap",category:"realtime",description:"Streaming 2D heatmap with binned time and value aggregation.",required:[],dataShape:"realtime",dataAccessors:[],propBags:["realtime"],ownProps:{heatmapXBins:{type:"number"},heatmapYBins:{type:"number"},aggregation:{type:"string",enum:["count","sum","mean"]}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!0,supportsLinkedHover:!0,supportsPush:!0,supportsSSR:!1,colorModel:"sequential",layoutMode:"plugin",specialFeatures:["live-stream"]}},GaltonBoardChart:{name:"GaltonBoardChart",category:"physics",description:"Physics-backed Galton board / Plinko-style dot distribution. Values enter deterministic bins and settle into a readable histogram-like projection; mechanical mode can generate a seeded no-data demonstration.",required:[],dataShape:"array",dataAccessors:["valueAccessor"],propBags:["physics"],ownProps:{valueAccessor:{type:["string","function"],default:"value",description:"Numeric field used to assign bodies to Galton bins."},valueExtent:{type:"array",description:"Stable numeric [min, max] domain for binning and reference-line placement."},bins:{type:"number",default:21,description:"Number of landing bins / histogram columns."},mode:{type:"string",enum:["sample","mechanical"],default:"sample",description:"sample uses data values; mechanical emits a deterministic demonstration when no data is supplied."},pegRows:{type:"number",description:"Number of Bernoulli branch rows used by mechanical mode."},mechanicalCount:{type:"number",description:"Number of generated bodies in mechanical mode."},branchProbability:{type:"number",default:.5,description:"Probability that each mechanical sample branches right at a peg."},referenceLines:{type:["object","array"],description:"One or more value markers drawn over the board: { value, label, color, strokeWidth, strokeDasharray, labelPosition }."},showProjection:{type:"boolean",description:"Whether companion docs or wrappers should show the settled projection."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","settled-projection","deterministic-seed"]}},EventDropChart:{name:"EventDropChart",category:"physics",description:"Physics-backed event-time drop chart for arrival replay, window barriers, and late/watermark handling.",required:["data"],dataShape:"array",dataAccessors:["timeAccessor","arrivalAccessor"],propBags:["physics"],ownProps:{timeAccessor:{type:["string","function"],default:"time",description:"Event-time field used to assign drops to windows."},arrivalAccessor:{type:["string","function"],default:"arrivalTime",description:"Arrival-time field used to pace event ingestion."},windows:{type:"object",description:"Windowing config, currently { size, gapPolicy? }."},watermark:{type:["object","function"],description:"Watermark config: { delay }, { value }, or a function of latest event time."},timeExtent:{type:"array",description:"Optional stable event-time extent [min, max] for the window layout."},timeScale:{type:"number",default:1,description:"Playback speed for event-arrival pacing; higher is faster (1 = real event-time)."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","event-time","watermark","arrival-pacing","settled-projection"]}},PhysicsPileChart:{name:"PhysicsPileChart",category:"physics",description:"Physics-backed unit pile chart. Numeric values are unitized into repeated bodies that settle into category piles.",required:[],dataShape:"array",dataAccessors:["categoryAccessor","valueAccessor"],propBags:["physics"],ownProps:{categoryAccessor:{type:["string","function"],default:"category",description:"Categorical field that chooses the pile / bin."},valueAccessor:{type:["string","function"],default:"value",description:"Numeric field converted into repeated unit bodies."},mode:{type:"string",enum:["sample","mechanical"],default:"sample",description:"sample uses data values; mechanical emits a deterministic no-data unit pile for design sketches."},mechanicalCount:{type:"number",description:"Number of generated unit bodies in mechanical mode."},mechanicalCategories:{type:"array",description:"Category labels generated by mechanical mode."},unitValue:{type:"number",default:1,description:"Value represented by one simulated body."},showProjection:{type:"boolean",default:!0,description:"Draw an exact settled-projection overlay behind the moving units so category totals remain readable."},sediment:{type:"boolean",description:"Reserved for future sediment/aggregation mode."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","unitized","settled-projection"]}},CollisionSwarmChart:{name:"CollisionSwarmChart",category:"physics",description:"Physics-backed swarm / dot-strip chart. Quantitative records spring toward an x-position while collisions separate overlapping dots into a readable distribution.",required:[],dataShape:"array",dataAccessors:["xAccessor","groupAccessor","radiusAccessor"],propBags:["physics"],ownProps:{xAccessor:{type:["string","function"],default:"x",description:"Quantitative field that anchors each body along the x-axis."},groupAccessor:{type:["string","function"],description:"Optional categorical field that creates separate swarm lanes."},radiusAccessor:{type:["string","function"],description:"Optional numeric field used as per-body radius in pixels."},pointRadius:{type:"number",default:5,description:"Fallback radius for each simulated body."},xExtent:{type:"array",description:"Optional [min, max] domain for the quantitative axis."},collisionIterations:{type:"number",default:6,description:"Collision solver iterations per fixed physics step."},settle:{type:"boolean",description:"Start bodies near their target positions for a calmer first paint or reduced-motion demo."},showProjection:{type:"boolean",default:!0,description:"Draw x-axis and group-lane guides behind the moving bodies."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","collision-layout","settled-projection"]}},GauntletChart:{name:"GauntletChart",category:"physics",description:"Physics-backed compound-plan gauntlet. A project core carries tethered positive/negative property bodies through timed gate events; settled projection is viability and outcome, not trajectories.",required:["negativeProperties"],dataShape:"array",dataAccessors:["idAccessor","positiveAccessor","negativeAccessor","metricsAccessor","startTimeAccessor"],propBags:["physics"],ownProps:{positiveProperties:{type:"array",default:[],description:"Optional lift/value property definitions attached to each project core. Omit or pass an empty array for negative-only compound bodies."},negativeProperties:{type:"array",description:"Drag/cost property definitions attached to each project core."},gates:{type:"array",description:"Named process gates along the route, with optional shared FIFO capacity."},events:{type:["array","function"],description:"Timed gate effects that add/pop properties and set outcomes."},startTimeAccessor:{type:["string","function"],description:"Optional per-project simulation second used as the local event-timeline origin."},onCapacityChange:{type:"function",description:"Receives visit-aware queue work, wait, overflow, throughput, utilization, and pressure snapshots."},crashDetection:{type:"boolean",default:!0,description:"Treat the crash line as a live failure trigger."},showChrome:{type:"boolean",default:!0,description:"Draw route, socket, and graveyard chrome."},showProjection:{type:"boolean",default:!0,description:"Draw settled viability/outcome strip."},showTethers:{type:"boolean",default:!0,description:"Draw tethers between cores and property bodies."},coreForceMode:{type:"string",enum:["route","net"],default:"route",description:"Core-body vertical force model: authored route guidance or net lift/drag drift."},terminalBehavior:{type:"string",enum:["outcome","hold-last"],default:"outcome"}},capabilities:{renderModes:["hybrid"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","process-gauntlet","settled-projection"]}},ProcessFlowChart:{name:"ProcessFlowChart",category:"physics",description:"Physics-backed multi-body process flow. Work items move through ordered stages with optional capacity, pressure, portals, absorb sinks, and feature groups that complete only when every member is absorbed.",required:["stages"],dataShape:"array",dataAccessors:["idAccessor","stageAccessor","groupBy","workAccessor","radiusAccessor"],propBags:["physics"],ownProps:{stages:{type:"array",description:"Ordered process stages: { id, label?, force?, damping?, capacity?, pressure?, portal?, absorb? }."},stageAccessor:{type:["string","function"],default:"stage",description:"Field or accessor for each work item's current stage id."},idAccessor:{type:["string","function"],description:"Stable work-item id."},groupBy:{type:["string","function"],description:"Optional feature/group key. Groups complete when all members reach an absorb stage."},groupLabelAccessor:{type:["string","function"],description:"Display label for group anchors."},workAccessor:{type:["string","function"],description:"Work-units field stamped for capacity metadata."},radiusAccessor:{type:["string","function"],description:"Optional per-body radius in pixels."},ballRadius:{type:"number",default:6,description:"Fallback body radius."},groupCompletion:{type:"string",enum:["allAbsorbed","none"],default:"allAbsorbed when groupBy is set",description:"How feature groups report completion."},groupAnchorAlong:{type:"number",description:"0–1 position along the lane for group anchors."},showProjection:{type:"boolean",default:!0,description:"Draw settled stage-count bars."},showChrome:{type:"boolean",default:!0,description:"Draw stage labels, capacity notes, and group anchors."},settle:{type:"boolean",description:"Start bodies at stage targets for a calmer first paint."},seed:{type:"number",default:1,description:"Deterministic seed for placement jitter."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","process-flow","capacitated-stages","group-completion","settled-projection"]}},PhysicalFlowChart:{name:"PhysicalFlowChart",category:"physics",description:"Experimental physics-backed flow chart. Packets move along authored node coordinates or link paths while a static throughput layer keeps the route quantities readable.",required:[],dataShape:"network",dataAccessors:["nodeIdAccessor","nodeXAccessor","nodeYAccessor","sourceAccessor","targetAccessor","throughputAccessor","pathAccessor"],propBags:["common"],ownProps:{size:{type:"array",description:"[width, height] in pixels"},nodes:{type:"array",description:"Route nodes with explicit x/y geometry. x/y may be normalized 0-1 coordinates or chart pixels."},links:{type:"array",description:"Flow links with source, target, throughput, and optional path geometry."},edges:{type:"array",description:"Alias for links, for network-shaped inputs."},data:{type:"array",description:"Alias for links when using chart-generator style data props."},nodeIdAccessor:{type:["string","function"],default:"id",description:"Key for node unique identifier."},nodeXAccessor:{type:["string","function"],default:"x",description:"Node x-coordinate. Use 0-1 normalized values by default."},nodeYAccessor:{type:["string","function"],default:"y",description:"Node y-coordinate. Use 0-1 normalized values by default."},sourceAccessor:{type:["string","function"],default:"source",description:"Link source node id."},targetAccessor:{type:["string","function"],default:"target",description:"Link target node id."},throughputAccessor:{type:["string","function"],default:"value",description:"Numeric throughput field that controls pipe width and packet count."},pathAccessor:{type:["string","function"],default:"path",description:"Optional link path as [{x,y}, ...] or [[x,y], ...]."},coordinateMode:{type:"string",enum:["auto","normalized","pixels"],default:"auto",description:"How node and path coordinates are mapped into the plot area."},particleRate:{type:"number",default:.16,description:"Packets generated per throughput unit before maxParticles downsampling."},maxParticles:{type:"number",default:180,description:"Maximum live packets generated for the initial flow scene."},particleRadius:{type:"number",default:4,description:"Packet body radius in pixels."},flowSpeed:{type:"number",default:90,description:"Initial packet velocity along each authored route."},pathConstraint:{type:"string",enum:["path","none"],default:"path",description:"Whether live packets are steered along authored route paths."},reducedMotion:{type:"boolean",default:!1,description:"Start packets on their route positions and pause the simulation."},showStaticFlow:{type:"boolean",default:!0,description:"Draw the route/pipe throughput layer behind animated packets."},showNodeLabels:{type:"boolean",default:!0},showSensors:{type:"boolean",default:!1,description:"Draw destination/node proximity sensors used for observation events."},paused:{type:"boolean",default:!1,description:"Pause the physics simulation."},seed:{type:"number",default:1,description:"Deterministic seed for packet jitter and initial flow."}},capabilities:{renderModes:["hybrid"],supportsLegend:!0,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!0,colorModel:"categorical",layoutMode:"synthetic",specialFeatures:["physics-simulation","path-constrained-flow","static-flow","proximity-sensors","settled-projection"]}},BigNumber:{name:"BigNumber",category:"value",description:"Focal-value display: one number, optionally with comparison / target / threshold zones (mapped to semantic theme roles) / four layout modes (tile / presentation / inline / thumbnail). Ships with NO chart-family dependency — embed your own Semiotic chart via two slots: `trendSlot` for wide / rectangular charts (LineChart, AreaChart) under the value, and `chartSlot` for square charts (DonutChart, PieChart, Scatterplot, Treemap) beside the value. The slot context exposes the resolved threshold colour + sentiment + push buffer so embedded charts can theme-link. Forward-looking POC for a future SingleValueFrame.",required:[],dataShape:"none",dataAccessors:[],propBags:[],ownProps:{width:{type:["number","string"],default:280,description:"Reserved width in pixels (or any CSS length). Mode-keyed defaults: 280 (tile) / 540 (presentation) / unset (inline / thumbnail)."},height:{type:["number","string"],default:184,description:"Reserved height in pixels (or any CSS length). Mode-keyed defaults: 184 (tile) / 320 (presentation) / unset (inline / thumbnail)."},className:{type:"string",description:"Composed with the BEM root class on the outer container."},value:{type:"number",description:"The focal number this card exists to display"},label:{type:"string",description:"Top-line descriptor rendered above the value"},caption:{type:"string",description:"Secondary descriptor, smaller, below the label"},format:{type:["string","function"],enum:["number","currency","percent","compact","duration"],default:"number",description:"Number-format shortcut or custom (value) => string"},locale:{type:"string",default:"en-US",description:"BCP-47 locale for Intl.NumberFormat"},currency:{type:"string",default:"USD",description:'ISO 4217 code for format: "currency"'},precision:{type:"number",description:"maximumFractionDigits passed to Intl.NumberFormat"},prefix:{type:"string",description:"Prepend to formatted value"},suffix:{type:"string",description:"Append to formatted value"},unit:{type:"string",description:'Unit label rendered after the value as small text (e.g. "USD", "req/s")'},comparison:{type:"object",description:"Comparison value: { value, label?, format?, direction? }. Drives the delta when explicit delta is not set."},target:{type:"object",description:'Target value: { value, label?, format?, direction? }. Renders "X% of target" next to the comparison row.'},delta:{type:"number",description:"Explicit delta override; bypasses comparison-derived subtraction"},deltaFormat:{type:["string","function"],enum:["number","currency","percent","compact","duration"],description:"Format the delta; defaults to format"},showDeltaPercent:{type:"boolean",default:!0,description:"Render percent change next to absolute delta when a comparison is present"},direction:{type:"string",enum:["higher-is-better","lower-is-better","neutral"],default:"higher-is-better",description:"Default direction used to infer sentiment from the sign of the delta"},sentiment:{type:"string",enum:["auto","positive","negative","neutral"],default:"auto",description:'Force sentiment; "auto" infers from direction + delta sign'},thresholds:{type:"array",description:"Threshold zones: [{ at, level, color?, label? }] ordered ascending by `at`. Resolved by highest `at` ≤ value. `level` maps to a semantic CSS variable (--semiotic-{success|warning|danger|info})."},chartSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Square chart to render beside the value — e.g. a DonutChart / PieChart / Scatterplot / Treemap. ReactNode or (ctx) => ReactNode; the function form receives the resolved level / color / sentiment / pushBuffer."},chartSize:{type:"number",description:"Pixel size reserved for chartSlot (rendered as a square). Mode-keyed defaults: 44 (tile) / 80 (presentation) — sparkline scale; pass a larger value for a hero anchor."},windowSize:{type:"number",default:60,description:"Cap on the trend buffer when fed via push API"},mode:{type:"string",enum:["tile","presentation","inline","thumbnail"],default:"tile",description:"Layout mode — chrome envelope around the value"},align:{type:"string",enum:["start","center","end"],description:"Horizontal alignment within the card"},padding:{type:["number","object"],description:"Inner padding: number for uniform, or { top, right, bottom, left }"},emphasis:{type:"string",enum:["primary","secondary"],description:'Visual emphasis hint; "primary" spans two ChartGrid columns'},color:{type:"string",description:"Override the value text colour. CSS variables work."},background:{type:"string",description:"Card background. CSS variables work."},borderColor:{type:"string"},borderRadius:{type:["number","string"]},animate:{type:["boolean","object"],description:'Tween between value changes. true = 300ms ease-out + intro. Object: { duration?, easing?: "linear"|"ease-out", intro? }'},stalenessThreshold:{type:"number",description:"Mark stale (dimmed) when no push occurs for this many ms"},staleLabel:{type:"string",default:"stale"},headerSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the entire header (label + caption) slot"},valueSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the focal value slot"},deltaSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Replace the delta / comparison / target row"},trendSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:'Wide / rectangular chart embedded beneath the value — e.g. a LineChart / AreaChart in mode="sparkline". ReactNode or (ctx) => ReactNode; the function form receives the resolved level / color / sentiment / pushBuffer.'},footerSlot:{type:["string","number","array","object","function"],omitFromSchema:!0,description:"Free-form footer below the trend"},onClick:{type:"function",omitFromSchema:!0},onObservation:{type:"function",omitFromSchema:!0}},capabilities:{renderModes:["svg"],supportsLegend:!1,supportsSelection:!1,supportsLinkedHover:!1,supportsPush:!0,supportsSSR:!1,colorModel:"threshold",layoutMode:"synthetic",specialFeatures:["threshold-zones","value-only","comparison","target","staleness","intl-format","chart-slot","trend-slot","hoc-ssr-only"]}}}).map(([e,t])=>[e,$b(t)])),Fb=["value","threshold","partition-boundary","time-window","range-boundary"];function Bb({controlType:e,controlId:t,chartId:o,chartType:r="VisualizationControl",onObservation:n}){return(i,s,a)=>{n?.({type:i,controlType:e,value:s,chartType:r,timestamp:Date.now(),...t?{controlId:t}:{},...o?{chartId:o}:{},...a?{source:a}:{}})}}function Db(e,t,o,r,n){return{id:e,...t?{controlId:t}:{},status:o,message:r,...n?{remediation:n}:{}}}function Eb({controls:e=[],minimumTargetSize:t=24}){const o=[],r=new Set;for(const n of e){const e=n?.id,i="controls."+(e||"unknown"),s=n?.domain,a=Array.isArray(s)&&2===s.length&&Number.isFinite(s[0])&&Number.isFinite(s[1])&&s[1]>s[0],l=Fb.includes(n?.type),c="string"==typeof n?.target&&n.target.trim().length>0,u=["slider","buttons","native-range"].includes(n?.keyboard??""),d=n?.minimumTargetSize;o.push(Db(i+".semantic-type",e,l?"pass":"fail",l?`Control uses the semantic type "${n.type}".`:"Control has no recognized semantic type.","Use one of VISUALIZATION_CONTROL_TYPES.")),o.push(Db(i+".state-binding",e,c?"pass":"fail",c?`Control is bound to "${n.target}".`:"Control has no declarative state binding.","Declare the controlled state key with target.")),o.push(Db(i+".domain",e,a?"pass":"fail",a?"Control has a finite ordered value domain.":"Control has no finite ordered value domain.","Declare domain as [minimum, maximum].")),o.push(Db(i+".keyboard",e,u?"pass":"fail",u?`Control declares a ${n.keyboard} keyboard path.`:"Control does not declare a keyboard path.","Declare slider, buttons, or native-range keyboard interaction.")),o.push(Db(i+".value-text",e,"string"==typeof n?.valueText&&n.valueText.trim().length>0?"pass":"fail","string"==typeof n?.valueText&&n.valueText.trim().length>0?"Control declares human-readable value text.":"Control does not declare human-readable value text.","Provide valueText, typically with a {value} placeholder.")),o.push(Db(i+".target-size",e,"number"!=typeof d||t>d?"fail":"pass","number"!=typeof d||t>d?`Control target is below the ${t}px minimum or undeclared.`:`Control declares a ${d}px target.`,`Declare minimumTargetSize of at least ${t}.`)),null!=n?.step&&o.push(Db(i+".step",e,Number.isFinite(n.step)&&n.step>0?"pass":"fail",Number.isFinite(n.step)&&n.step>0?"Control has a positive quantization step.":"Control step must be a positive finite number.","Use a positive finite step.")),n?.observations?.length&&o.push(Db(i+".observations",e,n.observations.includes("control-change")?"pass":"warn",n.observations.includes("control-change")?"Control declares control-change observation coverage.":"Control declares observations but omits control-change.","Include control-change so observable state changes are represented.")),e&&!r.has(e)||o.push(Db(i+".identity",e,"fail",e?"Control id is duplicated.":"Control id is missing.","Use a unique stable control id.")),e&&r.add(e)}return{ok:o.every(e=>"fail"!==e.status),findings:o}}function zb(e,t=new Set){if(null===e)return!0;const o=typeof e;if("string"===o||"boolean"===o)return!0;if("number"===o)return Number.isFinite(e);if("object"!==o)return!1;if(t.has(e))return!1;t.add(e);const r=Array.isArray(e)?e.every(e=>zb(e,t)):Object.entries(e).every(([,e])=>zb(e,t));return t.delete(e),r}var Hb=Symbol.for("semiotic.chartRecipeRegistry");function Ob(e){return function(){const e=globalThis;return e[Hb]||(e[Hb]={recipes:new Map,capabilities:new Map,layouts:new Map}),e[Hb]}().recipes.get(e)}function Wb(e){return"string"==typeof e?Ob(e):e&&"object"==typeof e&&"string"==typeof e.id?e:void 0}function qb(e){return"string"==typeof e?e:e.id??e.name}function Yb(e){return e.layoutConfig&&"object"==typeof e.layoutConfig?e.layoutConfig:{}}function Gb(e){return Array.isArray(e.data)?e.data:Array.isArray(e.nodes)?e.nodes:Array.isArray(e.points)?e.points:Array.isArray(e.areas)?e.areas:[]}function Vb(e,t,o){return o??Wb(t.recipe)??Wb(t.recipeId)??Ob(e)}function Xb(e,t,o=[]){const r=e.accessor?t[e.accessor]:void 0;if("string"==typeof r&&r)return r;if(e.field)return e.field;const n=o.find(e=>e&&"object"==typeof e);if(!n)return;const i=Object.entries(n).filter(([e,t])=>!e.startsWith("_")&&null!=t);return"quantitative"===e.semanticType?i.find(([,e])=>"number"==typeof e)?.[0]:"identifier"===e.semanticType?["id","key","name"].find(e=>e in n):i.find(([,e])=>"string"==typeof e)?.[0]}function Ub(e,t){return e.dataRoles.find(e=>e.role===t)}function Kb(e,t){return e.dataRoles.find(e=>t.includes(e.semanticType))}function Qb(e,t,o,r,n,i={}){const s={...i};if(t)for(const[e,o]of Object.entries(t))s[e]=o;for(const e of o.dataRoles){const o=Xb(e,r,n),i=t&&o?t[o]:o;void 0!==i&&(s[e.role]=i)}return e.replace(/\{([^}]+)\}/g,(e,t)=>{const o=s[t];return null==o?`{${t}}`:o+""})}var Zb="1",Jb=new Set(["tooltip","onObservation","xFormat","yFormat","valueFormat","svgAnnotationRules","tooltipContent","onHover","tickFormatTime","tickFormatValue","edgeSort","sortGroups","centerContent","frameProps","controls","oFormat","rFormat","oSort","pieceStyle","summaryStyle","nodeStyle","edgeStyle","customHoverBehavior","customClickBehavior","customDoubleClickBehavior","onBrush","onTopologyChange","backgroundGraphics","foregroundGraphics","legend","recipe","layout"]),ev=new Set(["data","nodes","edges","points","areas","lines","flows"]);function tv(e,t){return!!ev.has(e)&&("areas"!==e||"string"!=typeof t)}var ov="function"==typeof structuredClone?structuredClone:e=>JSON.parse(JSON.stringify(e));function rv(e,t,o){const r=Ob(e)??Wb(t.recipe)??Wb(t.recipeId);if(r)return function(e,t,o){const r=function(e,t,o){const r={};for(const[n,i]of Object.entries(e))if(null!=i&&!Jb.has(n)&&"recipeId"!==n&&(t||!tv(n,i)))if("function"==typeof i||i?.$$typeof){if(o)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`)}else if(zb(i))r[n]=ov(i);else if(o)throw Error(`Portable recipe prop "${n}" is not JSON-safe.`);return r}(t,!1!==o?.includeData,"portable"===e.portability),n=e.intents.map(qb).filter(e=>!!e),i={name:e.name,intents:n,...e.audience?.primary?{audience:[e.audience.primary]}:{},frameFamily:e.frameFamily};if("portable"===e.portability){if(!zb(r))throw Error(`Portable recipe "${e.id}" contains non-JSON-safe props or layoutConfig.`);return{component:"ChartRecipe",recipeId:e.id,portable:!0,props:r,manifest:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}return{component:"ChartRecipe",recipeId:e.id,portable:!1,reason:"Recipe contains or may depend on non-serializable local layout callbacks.",warnings:["This config is inspectable but cannot be rendered remotely by CLI or MCP."],props:r,manifest:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}(r,t,o);if(!Nb[e])throw Error(`Unknown component "${e}". Known components: ${Object.keys(Nb).join(", ")}`);const n=!1!==o?.includeData,i={};for(const[e,o]of Object.entries(t))null!=o&&(Jb.has(e)||!n&&tv(e,o)||"function"!=typeof o&&(o?.$$typeof||(i[e]=ov(o))));return{component:e,props:i,version:Zb,createdAt:(new Date).toISOString(),...o?.selections?{selections:o.selections}:{}}}function nv(e){if(!e.component||!e.props)throw Error("Invalid chart config: missing component or props");if("ChartRecipe"===e.component||"LocalChartRecipe"===e.component){if(!e.recipeId)throw Error("Invalid chart recipe config: missing recipeId");const t=Ob(e.recipeId);if(!t)throw Error(`Unknown chart recipe "${e.recipeId}". Register it before deserializing this config.`);if("LocalChartRecipe"!==e.component&&!1!==e.portable&&"portable"!==t.portability)throw Error(`Chart recipe "${e.recipeId}" is registered as local, not portable.`);return{componentName:"ChartRecipe",props:{...ov(e.props),recipeId:e.recipeId}}}if(!Nb[e.component])throw Error(`Unknown component "${e.component}". This config may require a newer version of semiotic.`);return{componentName:e.component,props:ov(e.props)}}function iv(e){const t=JSON.stringify(e);return"sc="+btoa(unescape(encodeURIComponent(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function sv(e){const t=new URLSearchParams(e.includes("?")?e.split("?")[1]:e).get("sc");if(!t)throw Error("No chart config found in URL (missing 'sc' parameter)");const o=t.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(escape(atob(o)));return JSON.parse(r)}async function av(e,t="json"){const o="jsx"===t?lv(e):JSON.stringify(e,null,2);if("undefined"==typeof navigator||!navigator.clipboard)throw Error("Clipboard API not available. copyConfig requires a browser environment.");await navigator.clipboard.writeText(o)}function lv(e){const{props:t}=e,o=["<"+("LocalChartRecipe"===e.component?"ChartRecipe":e.component)];e.recipeId&&o.push(` recipeId="${e.recipeId}"`);for(const[e,r]of Object.entries(t))if("string"==typeof r)o.push(` ${e}="${r}"`);else if("boolean"==typeof r&&!0===r)o.push(" "+e);else if("boolean"==typeof r&&!1===r)o.push(` ${e}={false}`);else if("number"==typeof r)o.push(` ${e}={${r}}`);else{const t=JSON.stringify(r);o.push(80>t.length?` ${e}={${t}}`:` ${e}={${JSON.stringify(r,null,2)}}`)}return o.push("/>"),o.join("\n")}function cv(e){const t={};for(const[o,r]of e){const e=[];for(const[,t]of r.clauses){const o={};for(const[e,r]of Object.entries(t.fields))o[e]="point"===r.type?{type:"point",values:Array.from(r.values)}:{type:"interval",range:r.range};e.push({clientId:t.clientId,type:t.type,fields:o})}t[o]={name:r.name,resolution:r.resolution,clauses:e}}return t}function uv(e){const t=new Map;for(const[o,r]of Object.entries(e)){const e=new Map;for(const t of r.clauses){const o={};for(const[e,r]of Object.entries(t.fields))o[e]="point"===r.type?{type:"point",values:new Set(r.values)}:{type:"interval",range:r.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:o})}t.set(o,{name:r.name,resolution:r.resolution,clauses:e})}return t}function dv(e){return"nominal"===e||"ordinal"===e}function hv(e){return"quantitative"===e||"temporal"===e}function pv(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}h();var fv={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},gv={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},mv={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function yv(e){e=function(e){const t=e;if(!function(e){const t=e.usermeta;if(pv(t)&&pv(t.idid))return t.idid}(e)||!Array.isArray(t.layer))return e;const o=t.layer.filter(e=>pv(e)&&!function(e){return!!(pv(e)&&pv(e.usermeta)&&pv(e.usermeta.idid))&&"annotation-layer"===e.usermeta.idid.role}(e));if(1!==o.length||void 0===o[0].mark)return e;const{layer:r,...n}=t,{usermeta:i,...s}=o[0];return{...n,...s}}(e);const t=[],{type:o,markProps:r}=function(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...o}=e;return{type:t,markProps:o}}(e.mark),n=e.encoding||{},i=n.x,s=n.y,a=n.color,l=n.size,c=n.theta,d=n.opacity;let h;e.data?.values?h=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||n.facet||n.row||n.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const p={};e.width&&(p.width=e.width),e.height&&(p.height=e.height);const f=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(f&&(p.title=f),a?.field&&(p.colorBy=a.field,a.scale?.scheme)){const e=fv[a.scale.scheme];e&&(p.colorScheme=e)}void 0!==d?.value&&(p.pointOpacity=d.value);const g=i?.aggregate,m=s?.aggregate;if(h&&(g||m)){const e=m?s:i,t=m?i:s,o=mv[e.aggregate];if(o&&t?.field&&e.field)h=function(e,t){const{groupBy:o,value:r,agg:n="sum"}=t,i=new Map;for(const t of e){const e=t[o]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[r]))}const s=[];for(const[e,t]of i){let r;switch(n){case"count":r=t.length;break;case"mean":r=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":r=u(t)[0];break;case"max":r=u(t)[1];break;default:r=t.reduce((e,t)=>e+t,0)}s.push({[o]:e,value:r})}return s}(h,{groupBy:t.field,value:e.field,agg:o});else if(("count"===o||"count"===e.aggregate)&&t?.field&&h){const e=new Map;for(const o of h){const r=o[t.field]+"";e.set(r,(e.get(r)||0)+1)}h=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if(i?.bin||s?.bin){const e="Histogram";h&&(p.data=h),i?.bin?(p.valueAccessor=i.field,s?.field&&(p.categoryAccessor=s.field),i.axis?.title&&(p.valueLabel=i.axis.title)):s?.bin&&(p.valueAccessor=s.field,i?.field&&(p.categoryAccessor=i.field),s.axis?.title&&(p.valueLabel=s.axis.title));const o=i?.bin||s?.bin,r="object"==typeof o?o.maxbins:void 0;return r&&(p.bins=r),vv(e,p,t)}let y;switch(o){case"bar":y=function(e,t,o,r,n,i,s){let a;return o?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(a="StackedBarChart",r.stackBy=o.field):a="BarChart",dv(e?.type)&&hv(t?.type)?(r.categoryAccessor=e.field,r.valueAccessor=s?"value":t.field,e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)):hv(e?.type)&&dv(t?.type)?(r.categoryAccessor=t.field,r.valueAccessor=i?"value":e.field,r.orientation="horizontal",t?.axis?.title&&(r.categoryLabel=t.axis.title),e?.axis?.title&&(r.valueLabel=e.axis.title)):(e?.field&&(r.categoryAccessor=e.field),t?.field&&(r.valueAccessor=s?"value":t.field),e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)),n&&(r.data=n),a}(i,s,a,p,h,g,m);break;case"line":if(y="LineChart",bv(i,s,p,g,m),a?.field&&(p.lineBy=a.field),r.interpolate){const e=gv[r.interpolate];e&&(p.curve=e)}!0===r.point&&(p.showPoints=!0),h&&(p.data=h);break;case"area":if(a?.field?(y="StackedAreaChart",p.areaBy=a.field):y="AreaChart",bv(i,s,p,g,m),r.interpolate){const e=gv[r.interpolate];e&&(p.curve=e)}void 0!==r.opacity&&(p.areaOpacity=r.opacity),h&&(p.data=h);break;case"point":case"circle":case"square":l?.field?(y="BubbleChart",p.sizeBy=l.field,l.scale?.range&&(p.sizeRange=l.scale.range)):y="Scatterplot",bv(i,s,p,g,m),h&&(p.data=h);break;case"rect":y="Heatmap",i?.field&&(p.xAccessor=i.field),s?.field&&(p.yAccessor=s.field),a?.field&&(p.valueAccessor=a.field,delete p.colorBy),i?.axis?.title&&(p.xLabel=i.axis.title),s?.axis?.title&&(p.yLabel=s.axis.title),h&&(p.data=h);break;case"arc":r.innerRadius&&r.innerRadius>0?(y="DonutChart",p.innerRadius=r.innerRadius):y="PieChart",c?.field?p.valueAccessor=c.field:s?.field&&(p.valueAccessor=m?"value":s.field),a?.field&&(p.categoryAccessor=a.field),i?.field&&!c?.field&&(p.categoryAccessor=i.field),h&&(p.data=h);break;case"tick":y="DotPlot",dv(i?.type)?(p.categoryAccessor=i.field,s?.field&&(p.valueAccessor=m?"value":s.field),i?.axis?.title&&(p.categoryLabel=i.axis.title),s?.axis?.title&&(p.valueLabel=s.axis.title)):dv(s?.type)?(p.categoryAccessor=s.field,i?.field&&(p.valueAccessor=g?"value":i.field),p.orientation="horizontal",s?.axis?.title&&(p.categoryLabel=s.axis.title),i?.axis?.title&&(p.valueLabel=i.axis.title)):(i?.field&&(p.categoryAccessor=i.field),s?.field&&(p.valueAccessor=m?"value":s.field)),h&&(p.data=h);break;default:t.push(`Unsupported mark type "${o}". Defaulting to Scatterplot.`),y="Scatterplot",bv(i,s,p,g,m),h&&(p.data=h)}return vv(y,p,t)}function bv(e,t,o,r,n){e?.field&&(o.xAccessor=r?"value":e.field),t?.field&&(o.yAccessor=n?"value":t.field),e?.axis?.title&&(o.xLabel=e.axis.title),t?.axis?.title&&(o.yLabel=t.axis.title)}function vv(e,t,o){const r={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){r.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return r}var xv=c(require("react")),kv=new Set(["LineChart","AreaChart","StackedAreaChart","DifferenceChart","Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","MultiAxisLineChart","MinimapChart"]),wv=new Set(["BarChart","StackedBarChart","GroupedBarChart","DotPlot"]),Sv=new Set(["PieChart","DonutChart","FunnelChart"]),Av=new Set(["Histogram","BoxPlot","ViolinPlot","RidgelinePlot","SwarmPlot"]);function Cv(e,t){return wv.has(e)||Sv.has(e)||"SwimlaneChart"===e||"GaugeChart"===e?{measure:t.valueAccessor,measureFallback:"value",dimension:t.categoryAccessor??t.stepAccessor,dimensionFallback:"category"}:{measure:t.yAccessor??t.valueAccessor,measureFallback:"y",dimension:t.xAccessor,dimensionFallback:"x"}}function Mv(e){for(const t of["lineBy","areaBy","stackBy","groupBy","colorBy"]){const o=e[t];if("string"==typeof o&&o)return o}}function jv(e,t){return null==e?"—":e instanceof Date?e.toISOString().slice(0,10):"number"==typeof e?t(e):e+""}function Pv(e,t={}){const o=!0===t.showRetractedAnnotations,r=!0===t.showSupersededAnnotations,n=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&n.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!o)return!1;const t=e?.provenance?.stableId;return!(t&&n.has(t)&&!r)})}var _v={LineChart:"line chart",AreaChart:"area chart",StackedAreaChart:"stacked area chart",DifferenceChart:"difference chart",Scatterplot:"scatter plot",BubbleChart:"bubble chart",ConnectedScatterplot:"connected scatter plot",QuadrantChart:"quadrant chart",MultiAxisLineChart:"dual-axis line chart",CandlestickChart:"candlestick chart",Heatmap:"heatmap",MinimapChart:"line chart",BarChart:"bar chart",StackedBarChart:"stacked bar chart",GroupedBarChart:"grouped bar chart",DotPlot:"dot plot",Histogram:"histogram",BoxPlot:"box plot",ViolinPlot:"violin plot",RidgelinePlot:"ridgeline plot",SwarmPlot:"swarm plot",PieChart:"pie chart",DonutChart:"donut chart",FunnelChart:"funnel chart",GaugeChart:"gauge",LikertChart:"Likert chart",SwimlaneChart:"swimlane chart",ForceDirectedGraph:"network graph",SankeyDiagram:"Sankey diagram",ProcessSankey:"temporal Sankey diagram",ChordDiagram:"chord diagram",TreeDiagram:"tree diagram",Treemap:"treemap",CirclePack:"circle-packing chart",OrbitDiagram:"orbit diagram",ChoroplethMap:"choropleth map",ProportionalSymbolMap:"proportional-symbol map",FlowMap:"flow map",DistanceCartogram:"distance cartogram",BigNumber:"single value",StreamPhysicsFrame:"physics stream frame",EventDropChart:"event-drop physics chart",GaltonBoardChart:"Galton board chart",PhysicsPileChart:"physics pile chart",CollisionSwarmChart:"collision swarm chart",PhysicalFlowChart:"physical flow chart",ProcessFlowChart:"process flow physics chart",PhysicsCustomChart:"custom physics chart"},Lv=new Set(["ForceDirectedGraph","SankeyDiagram","ProcessSankey","ChordDiagram"]),Rv=new Set(["StreamPhysicsFrame","EventDropChart","GaltonBoardChart","PhysicsPileChart","CollisionSwarmChart","PhysicalFlowChart","ProcessFlowChart","GauntletChart","PhysicsCustomChart"]);function Tv(e){return _v[e]||e.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase()+" chart"}function Iv(e){const t="number"==typeof e?e:"string"==typeof e?Number(e):NaN;return Number.isFinite(t)?t:void 0}var $v=new Set(["Scatterplot","BubbleChart","ConnectedScatterplot","QuadrantChart","ScatterplotMatrix"]),Nv={"outlier-detection":"alerting","change-detection":"alerting",trend:"tracking","composition-over-time":"apportioning","compare-series":"comparing","compare-categories":"comparing",rank:"ranking","part-to-whole":"apportioning",distribution:"characterizing",correlation:"relating",flow:"tracing",hierarchy:"nesting",geo:"locating"},Fv={"time-series":"tracking",categorical:"comparing",distribution:"characterizing",relationship:"relating",flow:"tracing",network:"tracing",hierarchy:"nesting",geo:"locating",realtime:"tracking",value:"presenting",custom:"presenting"},Bv=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","composition-over-time","change-detection","outlier-detection"],Dv={alerting:"alerting",tracking:"trend",comparing:"comparison",ranking:"ranking",apportioning:"composition",characterizing:"distribution",relating:"correlation",tracing:"flow",nesting:"hierarchy",locating:"locator",presenting:"single-value"};var Ev=new Set(["y-threshold","x-threshold","band","x-band","callout","label"]),zv=new Set(["system","agent","watcher"]),Hv=new Set(["ai","agent","system","computed","dbt","great-expectations"]),Ov=new Set(["rule","statistical-test","llm-inference","computed"]);function Wv(e){const t=e.annotations;return!!Array.isArray(t)&&t.some(e=>{if(!e||"object"!=typeof e)return!1;const t=e;if("string"!=typeof t.type||!Ev.has(t.type))return!1;const o=t.provenance;return!(!o||"object"!=typeof o)&&(zv.has(o.authorKind)||Hv.has(o.source)||Ov.has(o.basis))})}function qv(e="en"){let t,o;try{t=new Intl.NumberFormat(e,{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat(e,{maximumFractionDigits:2})}catch{t=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),o=new Intl.NumberFormat("en",{maximumFractionDigits:2})}return e=>Number.isFinite(e)?1e4>Math.abs(e)?o.format(e):t.format(e):e+""}var Yv={"y-threshold":"a threshold line","x-threshold":"a threshold line",band:"a highlighted band","x-band":"a highlighted band",label:"a label",callout:"a callout","callout-circle":"a callout","callout-rect":"a callout",text:"a text note",bracket:"a bracket",enclose:"an enclosure","rect-enclose":"an enclosure",highlight:"a highlight",widget:"a widget",trend:"a trend line",envelope:"an envelope","anomaly-band":"an anomaly band",forecast:"a forecast","category-highlight":"a category highlight"};function Gv(e){const t=Yv["string"==typeof e.type?e.type:"annotation"]||"an annotation",o=function(e){const t=e.provenance&&"object"==typeof e.provenance?e.provenance:null,o=t?.authorKind??t?.source??t?.basis;return"watcher"===o?"a watcher-flagged ":"agent"===o||"ai"===o||"llm-inference"===o?"an AI-suggested ":""}(e),r=o?o+t.replace(/^an? /,""):t,n="string"==typeof e.label?e.label:"string"==typeof e.title?e.title:void 0;return n?`${r} labeled "${n}"`:r}function Vv(e){const t=Array.isArray(e.annotations)?e.annotations:null;if(!t||0===t.length)return;const o=Pv(t.filter(e=>!!e&&"object"==typeof e));if(0===o.length)return;const r=o.map(Gv),n=r.slice(0,5),i=r.length-n.length,s=function(e){return e.length>1?2===e.length?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e[e.length-1]}`:e[0]??""}(n)+(i>0?`, and ${i} more`:""),a=o.length;return`The author has marked ${1===a?"one feature":a+" features"} on this chart: ${s}.`}function Xv(e,t,o={}){const r=void 0!==o.levels,n=new Set(o.levels??["l1","l2","l3"]);r||!o.capability&&!Wv(t)||n.add("l4");const i=Vb(e,t,o.recipe);if(i){const e=["l1","l2","l3","l4"].filter(e=>n.has(e));r||e.includes("l4")||e.push("l4");const s=function(e,t,o={}){const r=Gb(t),n=Yb(t),i=o.locale??"en",s="function"==typeof e.description?e.description({data:r,config:n,locale:i}):void 0,a=s?.levels??function(e,t,o,r){const n=Kb(e,["nominal","ordinal"]),i=Kb(e,["quantitative"]),s=n?Xb(n,o,t):void 0,a=i?Xb(i,o,t):void 0,l=n?.role??s??"category",c=i?.role??a??"value",u=e.encodings??[],d=u.length?u.slice(0,3).map(e=>e.meaning.replace(/\.$/,"")).join("; "):`${l} and ${c} are mapped through the recipe's declared visual semantics`,{number:h,percent:p}=function(e){try{return{number:new Intl.NumberFormat(e,{maximumFractionDigits:2}),percent:new Intl.NumberFormat(e,{style:"percent",maximumFractionDigits:1})}}catch{return{number:new Intl.NumberFormat("en",{maximumFractionDigits:2}),percent:new Intl.NumberFormat("en",{style:"percent",maximumFractionDigits:1})}}}(r),f=new Map;if(s&&a)for(const e of t){const t=(e[s]??"Uncategorized")+"",o=Number(e[a]);Number.isFinite(o)&&f.set(t,(f.get(t)??0)+o)}const g=[...f].sort((e,t)=>t[1]-e[1]),m=g.reduce((e,[,t])=>e+t,0),y=g[0],b=g[1],v=m>0?((y?.[1]??0)+(b?.[1]??0))/m:0,x=e.intents.map(e=>({id:qb(e),strength:"string"==typeof e?void 0:e.strength})).sort((e,t)=>"primary"===e.strength?-1:"primary"===t.strength?1:0)[0]?.id,k=e.audience?.primary??e.audienceFit?.find(e=>"strong"===e.fit)?.audience;return{l1:`A ${e.name.toLowerCase()} encodes ${l} and ${c}. ${w=d,w?w.charAt(0).toUpperCase()+w.slice(1):w}.`,l2:g.length>0?`${g.length} categories total ${h.format(m)}. ${y[0]} accounts for ${h.format(y[1])}${m>0?` (${p.format(y[1]/m)})`:""}${b?`, followed by ${b[0]} at ${h.format(b[1])}`:""}.`:`${t.length} data ${1===t.length?"item is":"items are"} represented.`,l3:2>g.length?y?y[0]+" is the only represented category.":"No quantitative pattern can be derived from the available data.":.5>v?`The total is distributed across ${g.length} categories without the first two forming a majority.`:`Most of the total is concentrated in ${y[0]} and ${b[0]}, which together account for ${p.format(v)}.`,l4:`The chart is intended for ${x??"explanation"}${k?` with a ${k} audience`:""}: ${e.designContract.whyCustom}`};var w}(e,r,n,i),l=o.levels??["l1","l2","l3","l4"],c={};for(const e of l)a[e]&&(c[e]=a[e]);const u=["l1","l2","l3","l4"].map(e=>c[e]).filter(e=>!!e).join(" "),d=o.includeCaveats?[...e.reception?.risks??[],...e.caveats??[],...(e.designContract.misuse??[]).map(e=>"Misuse: "+e)]:void 0;return{text:u,levels:c,...d?.length?{caveats:d}:{}}}(i,t,{levels:e,locale:o.locale,audience:o.audience,includeCaveats:o.includeCaveats}),a=Vv(t);return{...s,text:a?`${a} ${s.text}`.trim():s.text,...a?{annotations:a}:{}}}const s=qv(o.locale??"en"),a=Tv(e),l=Array.isArray(t.data)?t.data:null,c=Mv(t),u=Rv.has(e)?function(e,t){const o=e.physics&&"object"==typeof e.physics?e.physics:null,r=e.settledProjection&&"object"==typeof e.settledProjection?e.settledProjection:null,n=[e.settledProjectionRows,e.projectionRows,r?.rows,o?.settledProjectionRows,o?.projectionRows,o?.settledProjection&&"object"==typeof o.settledProjection?o.settledProjection.rows:void 0].find(e=>Array.isArray(e));return Array.isArray(n)?n.map((e,o)=>{if(!e||"object"!=typeof e)return null;const r=e,n=Iv(r.count??r.value??r.total??r.bodies??r.events);if(null==n)return null;const i=r.label??r.id??r.name??"container "+(o+1),s=Iv(r.secondary??r.secondaryCount),a=Iv(r.observed??r.observedCount);return{label:jv(i,t),count:n,...null!=s?{secondary:s}:{},..."string"==typeof r.secondaryLabel&&r.secondaryLabel?{secondaryLabel:r.secondaryLabel}:{},...null!=a?{observed:a}:{}}}).filter(e=>null!=e):null}(t,s):null,{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=Cv(e,t),g="string"==typeof d&&d?d:h,m="string"==typeof p&&p?p:f,y={};if(Rv.has(e)&&function(e,t,o,r,n,i){const s=function(e){return"EventDropChart"===e?"time window":"GaltonBoardChart"===e?"bin":"CollisionSwarmChart"===e?"group lane":"PhysicalFlowChart"===e?"flow node":"container"}(e),a=function(e){return"EventDropChart"===e?"event":"GaltonBoardChart"===e?"sample":"CollisionSwarmChart"===e?"point":"PhysicalFlowChart"===e?"packet":"body"}(e);if(n.has("l1")&&(r.l1=function(e,t){return"EventDropChart"===e?"An event-drop physics chart that collapses moving events into a settled projection by event-time window.":"GaltonBoardChart"===e?"A Galton board chart that collapses falling samples into a settled histogram projection.":"PhysicsPileChart"===e?"A physics pile chart that collapses moving bodies into a settled bar-style projection by container.":"CollisionSwarmChart"===e?"A collision swarm chart that separates overlapping points while preserving their quantitative axis position.":"PhysicalFlowChart"===e?"A physical flow chart that keeps authored routes visible while packet bodies show throughput and proximity events.":`A ${t} whose accessible reading is the settled projection rather than individual trajectories.`}(e,t)),!n.has("l2")&&!n.has("l3"))return;if(!o||0===o.length)return void(n.has("l2")&&(r.l2="No settled projection is loaded yet."));const l=o.reduce((e,t)=>e+t.count,0),c=o.filter(e=>e.count>0).sort((e,t)=>t.count-e.count),u=c[0]??o.slice().sort((e,t)=>t.count-e.count)[0];if(!u)return;const d=o.reduce((e,t)=>e+(t.secondary??0),0),h=o.find(e=>e.secondaryLabel)?.secondaryLabel??"secondary";if(n.has("l2"))if(0===c.length)r.l2=`The settled projection contains ${i(l)} ${Kv(l,a)} across ${o.length} ${Kv(o.length,s)}; no ${Kv(2,s)} are non-empty yet.`;else{const e=d>0?` ${i(d)} ${Kv(d,a)} ${1===d?"is":"are"} marked ${h}.`:"";r.l2=`The settled projection contains ${i(l)} ${Kv(l,a)} across ${o.length} ${Kv(o.length,s)}; ${c.length} ${Kv(c.length,s)} ${1===c.length?"is":"are"} non-empty. The largest ${s} is ${u.label} with ${i(u.count)} ${Kv(u.count,a)}.${e}`}if(n.has("l3")&&l>0&&c.length>0){const e=c.find(e=>e!==u),t=function(e,t){if(0>=t)return"0%";const o=e/t*100;return(10>o?Math.round(10*o)/10:Math.round(o))+"%"}(u.count,l);r.l3=e?`The settled projection is most concentrated in ${u.label}, which holds ${i(u.count)} ${Kv(u.count,a)} (${t}); ${e.label} follows with ${i(e.count)} ${Kv(e.count,a)}.`:`The settled projection is concentrated in ${u.label}, which holds all ${i(u.count)} ${Kv(u.count,a)}.`}}(e,a,u,y,n,s),n.has("l1")&&!Rv.has(e))if(kv.has(e)||wv.has(e))y.l1=`A ${a} of ${g} by ${m}`+(c?`, split by ${c}.`:".");else if(Sv.has(e))y.l1=`A ${a} showing ${g} across ${m} categories.`;else if(Av.has(e))y.l1=`A ${a} of the distribution of ${g}`+(c?` by ${c}.`:".");else if(Lv.has(e)){const e=Array.isArray(t.nodes)?t.nodes.length:void 0,o=Array.isArray(t.edges)?t.edges.length:void 0,r=[null!=e?`${e} ${Kv(e,"node")}`:null,null!=o?`${o} ${Kv(o,"edge")}`:null].filter(Boolean);y.l1=`A ${a}${r.length?" with "+r.join(" and "):""}.`}else if("BigNumber"===e){const e="string"==typeof t.label?t.label:g;y.l1=`A single value${e?" for "+e:""}.`}else y.l1=`A ${a}.`;const b=kv.has(e)||wv.has(e)||Sv.has(e)||Av.has(e);let v=null;if((n.has("l2")||n.has("l3")||n.has("l4"))&&b&&l&&l.length>0&&(v=function(e,t,o,r){let n=0,i=0,s=1/0,a=-1/0,l=null,c=null,u=0,d=0,h=null,p=null,f=NaN,g=NaN;for(const o of e){const e=t(o);Number.isFinite(e)&&(0===n&&(f=e,h=o),g=e,p=o,s>e&&(s=e,l=o,u=n),e>a&&(a=e,c=o,d=n),n++,i+=e)}return 0===n?null:{count:n,min:s,max:a,mean:i/n,minLabel:jv(null!=l?o(l):null,r),maxLabel:jv(null!=c?o(c):null,r),first:f,last:g,firstLabel:jv(null!=h?o(h):null,r),lastLabel:jv(null!=p?o(p):null,r),minIndex:u,maxIndex:d}}(l,ne(d,h),ie(p,f),s)),n.has("l2")&&b&&(l&&0!==l.length?v&&(y.l2=Sv.has(e)?`${v.count} segments totaling ${s(function(e){return e.mean*e.count}(v))}. Largest is ${v.maxLabel} at ${s(v.max)}; smallest is ${v.minLabel} at ${s(v.min)}.`:`${g} ranges from ${s(v.min)} (${v.minLabel}) to ${s(v.max)} (${v.maxLabel}), with a mean of ${s(v.mean)} across ${v.count} points.`):y.l2="No data is loaded yet."),n.has("l3")&&v&&!c&&kv.has(e)?y.l3=function(e,t,o){const{first:r,last:n,min:i,max:s,maxLabel:a,minLabel:l,firstLabel:c,lastLabel:u,minIndex:d,maxIndex:h,count:p}=e,f=s-i,g=n-r;if(0===f)return`${Uv(t)} is constant at ${o(r)} across the series.`;if(.04>f/(Math.abs(e.mean)||1))return`${Uv(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(s)}.`;const m=h>0&&p-1>h,y=d>0&&p-1>d,b=(s-Math.max(r,n))/f,v=(Math.min(r,n)-i)/f;return m&&b>.15?`Overall ${t} climbs to a peak of ${o(s)} (${a}), then falls to ${o(n)} (${u}).`:y&&v>.15?`Overall ${t} drops to a low of ${o(i)} (${l}), then recovers to ${o(n)} (${u}).`:.05>Math.abs(g)/f?`${Uv(t)} ends roughly where it started (${o(r)} at ${c} to ${o(n)} at ${u}), ranging between ${o(i)} and ${o(s)}.`:g>0?h===p-1?`Overall ${t} rises from ${o(r)} (${c}) to a peak of ${o(n)} (${u}).`:`Overall ${t} rises from ${o(r)} (${c}) to ${o(n)} (${u}), after peaking at ${o(s)} (${a}).`:d===p-1?`Overall ${t} falls from ${o(r)} (${c}) to a low of ${o(n)} (${u}).`:`Overall ${t} falls from ${o(r)} (${c}) to ${o(n)} (${u}), after dipping to ${o(i)} (${l}).`}(v,g,s):n.has("l3")&&v&&!c&&wv.has(e)&&(y.l3=`The highest ${m} is ${v.maxLabel} and the lowest is ${v.minLabel}.`),n.has("l4")){const r=Wv(t)?"alerting":function(e,t){const o=function(e){if(e){if("fits"in e||"buildProps"in e){const t=e,o={};for(const[e,r]of Object.entries(t.intentScores))"number"==typeof r&&Number.isFinite(r)&&(o[e]=r);return{family:t.family,intentScores:Object.keys(o).length?o:void 0}}return e}}(t);if(o?.act)return o.act;if(o?.intentScores){const e=function(e){let t,o=0;for(const[r,n]of Object.entries(e))if("number"==typeof n&&n>0)if(n>o)t=r,o=n;else if(n===o&&void 0!==t){const e=Bv.indexOf(r),o=Bv.indexOf(t);-1===e||-1!==o&&e>=o||(t=r)}return t}(o.intentScores);if(e&&Nv[e]&&(o.intentScores[e]??0)>=3)return Nv[e]}return o?.family?Fv[o.family]:function(e){return Sv.has(e)||"StackedAreaChart"===e?"apportioning":$v.has(e)?"relating":wv.has(e)?"comparing":Av.has(e)?"characterizing":kv.has(e)?"tracking":Lv.has(e)?"tracing":"BigNumber"===e?"presenting":void 0}(e)}(e,o.capability);r&&(y.l4=function(e,t,o,r,n,i,s,a){const l=Dv[e],c=/^[aeiou]/i.test(l)?"an":"a";let u,d;switch(e){case"locating":u="This is a map",d="read values by location";break;case"presenting":u="This is a single-value display",d=`read ${"string"==typeof o.label&&o.label?o.label:n} as the headline number`;break;case"tracing":u=`This is ${c} ${l} chart`,d="follow the movement between states";break;case"nesting":u=`This is ${c} ${l} chart`,d="read it for nested structure and how children sum into their parents";break;case"relating":u=`This is ${c} ${l} chart`,d=`read it for whether ${i} and ${n} move together`;break;default:u=`This is ${c} ${l} chart`,d=function(e,t,o,r,n,i){if(!t)switch(e){case"alerting":return"watch for points that break from the rest";case"tracking":return"read it for the overall direction of "+o;case"comparing":return`compare ${o} across ${r}`;case"ranking":return"read it top to bottom by "+o;case"apportioning":return`read each ${r}'s share of the whole`;case"characterizing":return"read it for the spread and shape of "+o;default:return"read the highlighted features"}switch(e){case"alerting":return function(e,t,o){if(wv.has(o)||Sv.has(o))return`${e.maxLabel} stands out at ${t(e.max)} — check it first`;const{first:r,last:n,min:i,max:s,minLabel:a,maxLabel:l,lastLabel:c,minIndex:u,maxIndex:d,count:h}=e,p=s-i;if(p>0){const e=d>0&&h-1>d,o=u>0&&h-1>u,f=(s-Math.max(r,n))/p,g=(Math.min(r,n)-i)/p;if(e&&f>.15)return`the peak of ${t(s)} at ${l} is the point to investigate`;if(o&&g>.15)return`the dip to ${t(i)} at ${a} is the point to investigate`;if(n>=s)return`the climb to ${t(n)} at ${c} warrants a closer look`;if(i>=n)return`the drop to ${t(n)} at ${c} warrants a closer look`}return`the extremes — ${l} (${t(s)}) and ${a} (${t(i)}) — are the points to check`}(t,n,i);case"tracking":return`read it for the trajectory of ${o}, which ${function(e){const t=e.max-e.min,o=e.last-e.first;return 0===t||.05>Math.abs(o)/t?"holds roughly steady":o>0?"rises":"falls"}(t)} from ${n(t.first)} (${t.firstLabel}) to ${n(t.last)} (${t.lastLabel})`;case"comparing":return`compare ${o} across ${r}; ${t.maxLabel} leads at ${n(t.max)}`;case"ranking":return`read it top to bottom by ${o}; ${t.maxLabel} ranks highest at ${n(t.max)}`;case"apportioning":{const e=t.mean*t.count,o=e>0?Math.round(t.max/e*100):null;return`read each ${r}'s share of the ${n(e)} total; ${t.maxLabel} is the largest at ${n(t.max)}${null!=o?` (${o}%)`:""}`}case"characterizing":return`read it for the spread of ${o}, from ${n(t.min)} to ${n(t.max)}`;default:return"read the highlighted features"}}(e,r,n,i,s,t)}return`${u}; ${d}.${function(e,t){if(!t)return"";const o=t.familiarity?.[e];return"number"!=typeof o||o>2?"":` This ${Tv(e)} may be unfamiliar${t.name?` to ${t.name.toLowerCase()} readers`:""} — lean on this description.`}(t,a)}`}(r,e,t,c?null:v,g,m,s,o.audience))}const x=["l1","l2","l3","l4"].filter(e=>n.has(e)&&y[e]).map(e=>y[e]).join(" "),k=Vv(t);return{text:k?`${k} ${x}`.trim():x,levels:y,...k?{annotations:k}:{}}}function Uv(e){return e.length?e[0].toUpperCase()+e.slice(1):e}function Kv(e,t){return 1!==e&&"body"===t?"bodies":1===e?t:t+"s"}function Qv(e){return((e??"unknown")+"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"unknown"}function Zv(e,t,o={}){const r=o.locale??"en",n=Math.max(1,o.maxLeaves??200),i=qv(r),s=Vb(e,t,o.recipe);if(s)return function(e,t,o={}){const r=Gb(t),n=Yb(t),i=Math.max(1,o.maxLeaves??200);if("function"==typeof e.navigation)return e.navigation({data:r,config:n,locale:o.locale??"en"});const s=(a=e.navigation)&&"object"==typeof a?e.navigation:void 0;var a;const l=(s?.groupByRole?Ub(e,s.groupByRole):void 0)??(s?.groupBy?.[0]?Ub(e,s.groupBy[0])??e.dataRoles.find(e=>e.field===s.groupBy?.[0]):void 0)??Kb(e,["nominal","ordinal"]),c=l?Xb(l,n,r):void 0,u=(s?.idRole?Ub(e,s.idRole):void 0)??Kb(e,["identifier"]),d=u?Xb(u,n,r):void 0,h={id:"root",role:"chart",label:s?.summaryTemplate?Qb(s.summaryTemplate,void 0,e,n,r,{count:r.length}):`${e.name}: ${r.length} ${1===r.length?"item":"items"} represented.`,level:1,children:[]};let p=0;const f=(t,o,i)=>{const a=d?t[d]:void 0,l=s?.itemLabelTemplate?Qb(s.itemLabelTemplate,t,e,n,r,{count:r.length}):function(e,t,o,r){const n=Kb(t,["nominal","ordinal"]),i=t.dataRoles.filter(e=>"quantitative"===e.semanticType),s=n?Xb(n,o,r):void 0,a=[];s&&null!=e[s]&&a.push(e[s]+"");for(const t of i){const n=Xb(t,o,r);n&&null!=e[n]&&a.push(`${t.role}: ${e[n]+""}`)}return a.length>0?a.join(", "):"Data item"}(t,e,n,r);return{id:"datum-"+Qv(a??o),role:"datum",label:l,level:i,datum:t}};if(c){const e=new Map;for(const t of r){const o=(t[c]??"Uncategorized")+"",r=e.get(o);r?r.push(t):e.set(o,[t])}h.children=[...e].map(([e,t],o)=>{const r=t.slice(0,Math.max(0,i-p));p+=r.length;const n=r.map((e,t)=>f(e,1e5*o+t,3));return t.length>r.length&&n.push({id:"more-"+Qv(e),role:"datum",label:`…and ${t.length-r.length} more items`,level:3}),{id:"group-"+Qv(e),role:"series",label:`${e}: ${t.length} ${1===t.length?"item":"items"}.`,level:2,children:n}})}else{const e=r.slice(0,i);h.children=e.map((e,t)=>f(e,t,2)),r.length>e.length&&h.children.push({id:"more",role:"datum",label:`…and ${r.length-e.length} more items`,level:2})}return h}(s,t,{maxLeaves:n,locale:r});const a={id:"root",role:"chart",label:Xv(e,t,{locale:r}).text||"Chart.",level:1,children:[]},l=function(e,t){const o=Array.isArray(e.annotations)?e.annotations:null;if(!o)return null;const r=Pv(o.filter(e=>!!e&&"object"==typeof e));if(0===r.length)return null;let n=0;const i=r.slice(0,t).map(e=>{const t=e.lifecycle?.status,o=t&&"accepted"!==t?` (${t})`:"";return{id:"annotation-"+n++,role:"annotation",level:3,label:`${r=Gv(e),r?r.charAt(0).toUpperCase()+r.slice(1):r}${o}.`,datum:e};var r});r.length>t&&i.push({id:"annotation-"+n++,role:"annotation",level:3,label:`…and ${r.length-t} more annotations.`});const s=r.length;return{id:"annotations",role:"annotation",level:2,label:`Annotations: ${1===s?"one marked feature":s+" marked features"}.`,children:i}}(t,n),c=Array.isArray(t.data)?t.data:null,u=kv.has(e)||wv.has(e)||Sv.has(e)||Av.has(e);if(!c||0===c.length||!u)return l&&(a.children=[l]),a;const{measure:d,measureFallback:h,dimension:p,dimensionFallback:f}=Cv(e,t),g=ne(d,h),m=ie(p,f),y="string"==typeof d&&d?d:h,b="string"==typeof p&&p?p:f,v=Mv(t);let x=0;const k=e=>`${e}-${x++}`,w=(e,t)=>{const o=e.slice(0,n).map(e=>((e,t)=>{const o=g(e),r=jv(m(e),i);return{id:k("datum"),role:"datum",level:t,label:`${r}: ${Number.isFinite(o)?i(o):"—"}`,value:Number.isFinite(o)?o:void 0,datum:e}})(e,t));return e.length>n&&o.push({id:k("more"),role:"datum",level:t,label:`…and ${e.length-n} more points`}),o},S=[];if(kv.has(e)||wv.has(e)){let t=1/0,o=-1/0,r=1/0,n=-1/0;const s=[];let a=!0;for(const e of c){const i=g(e);Number.isFinite(i)&&(t>i&&(t=i),i>o&&(o=i));const l=m(e);s.push(l),"number"==typeof l&&Number.isFinite(l)?(r>l&&(r=l),l>n&&(n=l)):a=!1}const l=new Set,u=[];for(const e of s){const t=e+"";l.has(t)||(l.add(t),u.push(e))}const d=a?`${i(r)} to ${i(n)}`:`${jv(u[0],i)} to ${jv(u[u.length-1],i)} (${wv.has(e)?u.length+" categories":c.length+" points"})`;S.push({id:k("axis"),role:"axis",level:2,label:`${wv.has(e)?"Category axis":"X axis"}: ${b}, ${d}.`}),t>o||S.push({id:k("axis"),role:"axis",level:2,label:`Value axis: ${y}, ${i(t)} to ${i(o)}.`})}if(v){const o=ie(v,v),n=new Map;for(const e of c){const t=(o(e)??"—")+"",r=n.get(t);r?r.push(e):n.set(t,[e])}const i=[];for(const[o,s]of n){const n=Xv(e,{...t,data:s},{levels:["l2","l3"],locale:r}).text;i.push({id:k("series"),role:"series",level:2,label:`Series ${o}: ${n}`,children:w(s,3)})}a.children=[...S,...i]}else a.children=[...S,...w(c,2)];return l&&a.children.push(l),a}var Jv=c(require("react")),ex=null,tx=new Set,ox=new Set;function rx(e,t){void 0!==console&&console.warn(`[conversationArc] ${e} failed:`,t)}function nx(e,t){try{const o=t();o&&"function"==typeof o.then&&Promise.resolve(o).catch(t=>rx(e,t))}catch(t){rx(e,t)}}var ix=Object.freeze([]),sx=ix,ax=!1;function lx(){ax=!0}var cx=new Set;function ux(){for(const e of cx)try{e()}catch(e){void 0!==console&&console.warn("[conversationArc] change subscriber threw:",e)}}function dx(){return ex}var hx={get enabled(){return ex?.enabled??!1},get sessionId(){return ex?.sessionId??null},get capacity(){return ex?.capacity??0},record(e){const t=dx();if(!t||!t.enabled)return null;const o={...e,timestamp:e.timestamp??Date.now(),sessionId:e.sessionId??t.sessionId};for(t.buffer.push(o);t.buffer.length>t.capacity;)t.buffer.shift();lx(),ux();for(const e of tx)try{e(o)}catch(e){void 0!==console&&console.warn("[conversationArc] subscriber threw:",e)}return function(e){for(const t of ox)t.record&&nx("sink record",()=>t.record?.(e))}(o),o},flush(){const e=dx();if(!e)return[];const t=e.buffer.slice();return e.buffer=[],lx(),ux(),function(e){for(const t of ox)t.flush&&nx("sink flush",()=>t.flush?.(e))}(t),t},getEvents:()=>ax?(sx=ex?Object.freeze(ex.buffer.slice()):ix,ax=!1,sx):sx,subscribe:e=>(tx.add(e),()=>{tx.delete(e)}),clear(){const e=dx();e&&(e.buffer=[],lx(),ux()),function(){for(const e of ox)e.clear&&nx("sink clear",()=>e.clear?.())}()},reset(){if(tx.clear(),ox.clear(),sx=ix,ax=!1,!ex)return ux(),void cx.clear();ex.buffer=[],ex.enabled=!1,ex=null,ux(),cx.clear()}},px=require("react/jsx-runtime"),fx={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function gx({tree:e,label:t,visible:o=!1,className:r,onActiveChange:n,activeId:i,chartId:s}){const[a,l]=Jv.useState(()=>new Set([e.id])),[c,u]=Jv.useState(e.id),d=void 0!==i,h=d?i:c,p=Jv.useRef(null),f=Jv.useRef(new Map),g=Jv.useMemo(()=>function(e){const t=new Map,o=e=>{for(const r of e.children??[])t.set(r.id,e),o(r)};return o(e),t}(e),[e]),m=Jv.useMemo(()=>function(e,t){const o=[],r=e=>{if(o.push(e),e.children&&e.children.length>0&&t.has(e.id))for(const t of e.children)r(t)};return r(e),o}(e,a),[e,a]);Jv.useEffect(()=>{d||m.some(e=>e.id===c)||u(e.id)},[m,c,e.id,d]),Jv.useEffect(()=>{const e=[];let t=g.get(h);for(;t;)e.push(t.id),t=g.get(t.id);e.length>0&&l(t=>{if(e.every(e=>t.has(e)))return t;const o=new Set(t);for(const t of e)o.add(t);return o})},[h,g]),Jv.useEffect(()=>{p.current?.contains(document.activeElement)&&f.current.get(h)?.focus()},[h]);const y=Jv.useCallback((e,t,o)=>{hx.enabled&&hx.record("focus"===t?{type:"nav-node-focused",chartId:s,nodeId:e.id,role:e.role,level:e.level,label:e.label.length>200?e.label.slice(0,200):e.label}:{type:"nav-branch-expanded",chartId:s,nodeId:e.id,role:e.role,level:e.level,expanded:!!o})},[s]),b=Jv.useCallback(e=>{e.id!==h&&(d||u(e.id),n?.(e),y(e,"focus"))},[n,d,y,h]),v=e=>{l(t=>new Set(t).add(e.id)),y(e,"toggle",!0)},x=e=>{l(t=>{const o=new Set(t);return o.delete(e.id),o}),y(e,"toggle",!1)},k=(e,t,r)=>{const n=!!e.children&&e.children.length>0,i=a.has(e.id);return(0,px.jsxs)("li",{role:"treeitem","aria-label":e.label,"aria-level":e.level,"aria-posinset":t,"aria-setsize":r,"aria-expanded":n?i:void 0,"aria-selected":e.id===h,tabIndex:e.id===h?0:-1,ref:t=>{f.current.set(e.id,t)},onClick:t=>{t.stopPropagation(),b(e),n&&(i?x:v)(e)},style:o?{listStyle:"none",padding:"2px 6px",paddingLeft:6+16*(e.level-1),cursor:n?"pointer":"default",fontSize:13,color:"var(--semiotic-text, currentColor)",background:e.id===h?"var(--semiotic-surface, var(--semiotic-grid, var(--semiotic-bg, #f0f4f8)))":"transparent",outline:"none"}:void 0,children:[(0,px.jsxs)("span",{className:"semiotic-nav-tree-label semiotic-nav-tree-"+e.role,children:[o&&n?i?"▾ ":"▸ ":"",e.label]}),n&&i&&(0,px.jsx)("ul",{role:"group",style:o?{margin:0,padding:0}:void 0,children:e.children.map((t,o)=>k(t,o+1,e.children.length))})]},e.id)};return(0,px.jsx)("div",{ref:p,className:"semiotic-nav-tree"+(r?" "+r:""),style:o?void 0:fx,onKeyDown:e=>{const t=m.findIndex(e=>e.id===h);if(-1===t)return;const o=m[t],r=!!o.children&&o.children.length>0,n=a.has(o.id);let i=!0;switch(e.key){case"ArrowDown":b(m[Math.min(t+1,m.length-1)]);break;case"ArrowUp":b(m[Math.max(t-1,0)]);break;case"Home":b(m[0]);break;case"End":b(m[m.length-1]);break;case"ArrowRight":r&&!n?v(o):r&&n?b(o.children[0]):i=!1;break;case"ArrowLeft":if(r&&n)x(o);else{const e=g.get(o.id);e?b(e):i=!1}break;case"Enter":case" ":r?(n?x:v)(o):i=!1;break;default:i=!1}i&&(e.preventDefault(),e.stopPropagation())},children:(0,px.jsx)("ul",{role:"tree","aria-label":t||"Chart navigation",style:o?{margin:0,padding:0}:void 0,children:k(e,1,1)})})}var mx=c(require("react")),yx=require("react/jsx-runtime");function bx(e,t,o=0){const r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),i=Math.max(r,Math.min(n,e[0])),s=Math.max(r,Math.min(n,e[1])),a=i>s?[s,i]:[i,s];if(a[1]-a[0]>=o)return a;const l=(a[0]+a[1])/2,c=o/2;return[Math.max(r,Math.min(n-o,l-c)),Math.min(n,Math.max(r+o,l+c))]}function vx(e,t,o,r=1,n=r){const i="in"===o?r:-r;return bx([e[0]+i,e[1]-i],t,n)}function xx(e){const{domain:t,initialValue:o=t,step:r=1,minSpan:n=r,label:i,formatValue:s,onChange:a}=e,[l,c]=mx.useState(()=>bx(o,t,n)),u=bx(l,t,n),d=mx.useCallback(e=>{const o=bx(e,t,n);c(o),a?.(o)},[t,n,a]),h=mx.useMemo(()=>({label:i,domain:t,value:u,step:r,formatValue:s,onChange:d,onClear:()=>d(t)}),[t,s,i,d,r,u]),p=mx.useMemo(()=>({onZoomIn:()=>d(vx(u,t,"in",r,n)),onZoomOut:()=>d(vx(u,t,"out",r,n)),onReset:()=>d(t)}),[t,n,d,r,u]);return{value:u,setValue:d,xExtent:u,brush:h,zoom:p}}var kx={display:"grid",gap:8,padding:"10px 12px",border:"1px solid var(--semiotic-border, #d8dee4)",borderRadius:12,background:"var(--semiotic-surface, var(--semiotic-bg, rgba(255,255,255,0.92)))"},wx={fontSize:11,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #57606a)"};function Sx(e,t){return{minWidth:e,minHeight:e,padding:"0 12px",borderRadius:999,border:"1px solid var(--semiotic-border, #d8dee4)",background:t?"var(--semiotic-primary, #0969da)":"var(--semiotic-bg, #fff)",color:t?"var(--semiotic-on-primary, #fff)":"var(--semiotic-text, #24292f)",fontSize:13,fontWeight:650,touchAction:"manipulation"}}function Ax(e){return"function"==typeof e}function Cx({brush:e,targetSize:t}){const o=e?.value,r=e?.domain,n=!!o&&!!r,i=!0===e?.disabled,s=e?.formatValue??(e=>e),a=!!e?.onChange&&n&&!i,l=r?.[0]??0,c=r?.[1]??1,u=o?.[0]??l,d=o?.[1]??c,h=e?.step??((c-l)/100||1);return(0,yx.jsxs)("section",{style:kx,"aria-label":"Brush controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Filter range"}),n?(0,yx.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,yx.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,yx.jsxs)("span",{children:["Start: ",s(u)]}),(0,yx.jsx)("input",{type:"range",min:l,max:c,step:h,value:u,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([Math.min(o,d),d])}})]}),(0,yx.jsxs)("label",{style:{display:"grid",gap:4,fontSize:12},children:[(0,yx.jsxs)("span",{children:["End: ",s(d)]}),(0,yx.jsx)("input",{type:"range",min:l,max:c,step:h,value:d,disabled:!a,style:{minHeight:t},onChange:t=>{const o=Number(t.currentTarget.value);e?.onChange?.([u,Math.max(o,u)])}})]})]}):(0,yx.jsx)("div",{style:{fontSize:12,color:"var(--semiotic-text-secondary, #57606a)"},children:"Provide a brush domain and value to expose range inputs beside the drag gesture."}),(0,yx.jsx)("button",{type:"button",disabled:i||!Ax(e?.onClear),onClick:e?.onClear,style:Sx(t),children:"Clear range"})]})}function Mx({zoom:e,targetSize:t}){const o=!0===e?.disabled;return(0,yx.jsxs)("section",{style:kx,"aria-label":"Zoom controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Zoom"}),(0,yx.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,yx.jsx)("button",{type:"button","aria-label":"Zoom out",disabled:o||!Ax(e?.onZoomOut),onClick:e?.onZoomOut,style:Sx(t),children:"-"}),(0,yx.jsx)("button",{type:"button","aria-label":"Reset zoom",disabled:o||!Ax(e?.onReset),onClick:e?.onReset,style:Sx(t),children:"Reset"}),(0,yx.jsx)("button",{type:"button","aria-label":"Zoom in",disabled:o||!Ax(e?.onZoomIn),onClick:e?.onZoomIn,style:Sx(t),children:"+"})]})]})}function jx({legend:e,targetSize:t}){const o=!0===e?.disabled,r=e?.items??[];return(0,yx.jsxs)("section",{style:kx,"aria-label":"Legend controls",children:[(0,yx.jsx)("div",{style:wx,children:e?.label??"Series"}),r.length>0&&(0,yx.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:r.map(r=>{const n=!1!==r.active;return(0,yx.jsxs)("button",{type:"button",disabled:o||r.disabled||!e?.onToggle,onClick:()=>e?.onToggle?.(r.id,!n),style:Sx(t,n),"aria-pressed":n,children:[r.color&&(0,yx.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:9,height:9,marginRight:6,borderRadius:999,background:r.color}}),r.label??r.id]},r.id)})}),(0,yx.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,yx.jsx)("button",{type:"button",disabled:o||!Ax(e?.onShowAll),onClick:e?.onShowAll,style:Sx(t),children:"Show all"}),(0,yx.jsx)("button",{type:"button",disabled:o||!Ax(e?.onHideAll),onClick:e?.onHideAll,style:Sx(t),children:"Hide all"})]})]})}function Px({controls:e,targetSize:t=44,compact:o=!1,className:r,style:n,ariaLabel:i="Mobile chart controls",brush:s,zoom:a,legend:l}){const c=function(e,t){if(!1===e)return[];if(!0===e||"all"===e)return["brush","zoom","legend"];if(Array.isArray(e))return e;if(e)return[e];const o=[];return t.brush&&o.push("brush"),t.zoom&&o.push("zoom"),t.legend&&o.push("legend"),o}(e,{brush:s,zoom:a,legend:l});return 0===c.length?null:(0,yx.jsxs)("div",{className:r,role:"group","aria-label":i,style:{display:"grid",gridTemplateColumns:o?"1fr":"repeat(auto-fit, minmax(180px, 1fr))",gap:10,...n},children:[c.includes("brush")&&(0,yx.jsx)(Cx,{brush:s,targetSize:t}),c.includes("zoom")&&(0,yx.jsx)(Mx,{zoom:a,targetSize:t}),c.includes("legend")&&(0,yx.jsx)(jx,{legend:l,targetSize:t})]})}var _x=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),Lx=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),Rx={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function Tx(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function Ix(e){return"string"==typeof e&&e.trim().length>0}function $x(e){const t=Tx(e.capability)?e.capability:null,o=Tx(e.recipe)?e.recipe:null,r=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,o?.mobile];for(const e of r)if(Tx(e))return e;return null}function Nx(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function Fx(e){return Nx(e.size)||Nx(Tx(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function Bx(e,t){e.push({...t,status:"pass"})}function Dx(e,t){e.push({...t,status:"warn"})}function Ex(e,t){e.push({...t,status:"manual"})}function zx(e,t={},o={}){const r=o.viewportWidth??390,n=o.targetSize??44,i=Fx(t),s=tp(t,{width:r,height:i?.[1]}),a=[],l=Fx(t=s.props),c=$x(t),u=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),d=function(e){const t=$x(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),h=!0===o.inChartContainer,p=Ix(t.title)||Ix(t.summary)||Ix(t.description)||!0===c?.summary||Ix(c?.summary);if(s.matches.length>0&&Bx(a,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${s.matches.length} responsive rule(s) applied for the ${r}px mobile audit.`}),l){const[t,o]=l;t>r&&!d?Dx(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${r}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):Bx(a,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof c?.minViewportWidth&&c.minViewportWidth>r&&Dx(a,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${c.minViewportWidth}px minimum, wider than the audited ${r}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,o);430>=r&&n>2.4&&"BigNumber"!==e&&Dx(a,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>o&&"BigNumber"!==e&&Dx(a,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${o}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else Ex(a,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const f=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,Tx(e.frameProps)?e.frameProps.data:void 0];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o}(t);f>0&&(f>("number"==typeof c?.maxMarks?c.maxMarks:_x.has(e)?1.25*r:Lx.has(e)?Math.max(8,Math.floor(r/34)):r)?Dx(a,{id:"density.mark-budget",category:"density",impact:_x.has(e)?"medium":"high",message:`${f} data item(s) exceed the rough mobile density budget for ${e} at ${r}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):Bx(a,{id:"density.mark-budget",category:"density",impact:"medium",message:f+" data item(s) are within the rough mobile density budget for this component."}));const g=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let o=0;for(const e of t)Array.isArray(e)&&(o+=e.length);return o>0?o:null}(t),m=!1!==t.showAxes&&!1!==t.axis;if(m&&null!=g){const e=Math.max(3,Math.floor(r/58));g>e&&Dx(a,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${g} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${r}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else m&&(_x.has(e)||Lx.has(e))&&Ex(a,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=Tx(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=$x(e),o=Tx(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===o?.tapToSelect||!0===o?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||Ix(t?.interaction?.hoverFallback)}(e)}(t)?Bx(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):Dx(a,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const y=function(e,t){const o=Rx[e];if(!o)return null;let r=o.includes("hoverRadius")?30:null;for(const e of o){const o=t[e];"number"==typeof o&&Number.isFinite(o)&&o>0&&(r=null==r?o:Math.max(r,o))}return null==r?null:2*r}(e,t),b=Tx(t.mobileInteraction)?t.mobileInteraction:null,v=y??("number"==typeof b?.targetSize?b.targetSize:!0===t.mobileInteraction?44:"number"==typeof c?.minimumHitTarget?c.minimumHitTarget:"number"==typeof c?.interaction?.targetSize?c.interaction.targetSize:null);null!=v&&(24>v?Dx(a,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${v}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>v?Dx(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):Bx(a,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${v}px, meeting the configured ${n}px target.`}));const x=[];null==t.brush&&null==t.onBrush||x.push("brush"),!0===t.zoomable&&x.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||x.push("legend filtering"),x.length>0&&!function(e,t){const o=$x(e),r=Tx(e.mobileInteraction)?e.mobileInteraction:null,n=r?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(o?.interaction?.alternatives)&&o.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,x)&&Dx(a,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${x.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===c?.labels?.strategy||"inline"===c?.labels?.strategy||"external"===c?.labels?.strategy||r>430||Dx(a,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const k=Array.isArray(t.annotations)?t.annotations.filter(e=>Tx(e)):[];if(k.length>("number"==typeof c?.maxAnnotations?c.maxAnnotations:3)&&430>=r&&Dx(a,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:k.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),k.length>0){const e=k.filter(e=>!Ix(e.mobileText)&&!Ix(e.shortText)&&!Ix(e.label));e.length>0&&Ex(a,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}d||"BigNumber"===e||Ex(a,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),u&&(c?(Bx(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===c.custom?.dataBearingSceneNodes?Dx(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==c.custom?.dataBearingSceneNodes&&Ex(a,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):Ex(a,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),p||h||Dx(a,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const w=a.filter(e=>"warn"===e.status),S={highRisk:w.filter(e=>"high"===e.impact).length,warnings:w.length,manual:a.filter(e=>"manual"===e.status).length,passes:a.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:r,ok:0===S.highRisk,summary:S,findings:a,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var Hx=require("react/jsx-runtime"),Ox={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0,padding:0,margin:-1};function Wx(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function qx(e){return e&&"object"==typeof e&&"number"==typeof e.targetSize?e.targetSize:void 0}function Yx(e){return Array.isArray(e)?e.length>0:!!e}function Gx(){const e=function(){const e=Hi.useContext(Wi);return e?e.toggle:null}();return e?(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:e,title:"Data summary","aria-label":"Toggle data summary",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("rect",{x:"1",y:"1",width:"12",height:"3",rx:"0.5"}),(0,Hx.jsx)("rect",{x:"1",y:"6",width:"8",height:"3",rx:"0.5"}),(0,Hx.jsx)("rect",{x:"1",y:"11",width:"5",height:"2",rx:"0.5"})]})}):null}var Vx={info:"var(--semiotic-info, #2563eb)",success:"var(--semiotic-success, #16a34a)",warning:"var(--semiotic-warning, #d97706)",error:"var(--semiotic-error, var(--semiotic-danger, #dc2626))",neutral:"var(--semiotic-text-secondary, #6b7280)"},Xx={error:4,warning:3,info:2,success:1,neutral:0};function Ux({level:e}){const t={width:15,height:15,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};switch(e){case"error":case"warning":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("path",{d:"M8 1.8 15 14H1L8 1.8Z"}),(0,Hx.jsx)("path",{d:"M8 6.4v3.4"}),(0,Hx.jsx)("circle",{cx:"8",cy:"11.8",r:"0.5",fill:"currentColor",stroke:"none"})]});case"success":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hx.jsx)("path",{d:"M5 8.2 7 10.2 11 5.8"})]});case"info":return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("circle",{cx:"8",cy:"8",r:"6.4"}),(0,Hx.jsx)("path",{d:"M8 7.4V11"}),(0,Hx.jsx)("circle",{cx:"8",cy:"5",r:"0.5",fill:"currentColor",stroke:"none"})]});default:return(0,Hx.jsxs)("svg",{...t,children:[(0,Hx.jsx)("path",{d:"M8 2a3.5 3.5 0 0 0-3.5 3.5c0 4-1.5 5-1.5 5h10s-1.5-1-1.5-5A3.5 3.5 0 0 0 8 2Z"}),(0,Hx.jsx)("path",{d:"M6.5 13a1.5 1.5 0 0 0 3 0"})]})}}function Kx({notification:e,level:t,onDismiss:o}){const r=Vx[t]??Vx.info,n=!1!==e.dismissible;return(0,Hx.jsxs)("div",{className:"semiotic-chart-notification semiotic-chart-notification--"+t,style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 10px",borderRadius:4,borderLeft:"3px solid "+r,background:"var(--semiotic-surface, rgba(127, 127, 127, 0.08))"},children:[(0,Hx.jsxs)("div",{style:{flex:1,minWidth:0},children:[e.source&&(0,Hx.jsx)("div",{className:"semiotic-chart-notification-source",style:{fontSize:9,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--semiotic-text-secondary, #666)"},children:e.source}),e.title&&(0,Hx.jsx)("div",{className:"semiotic-chart-notification-title",style:{fontSize:12,fontWeight:600,color:r},children:e.title}),(0,Hx.jsx)("div",{className:"semiotic-chart-notification-message",style:{fontSize:12,lineHeight:1.45,color:"var(--semiotic-text, #333)"},children:e.message})]}),n&&(0,Hx.jsx)("button",{className:"semiotic-chart-notification-dismiss","aria-label":e.title?"Dismiss notification: "+e.title:"Dismiss notification",title:"Dismiss",onClick:o,style:{...ok,width:18,height:18,fontSize:13,lineHeight:1,flex:"none"},children:"×"})]})}function Qx({visible:e,onDismiss:t}){const[o,r]=xv.useState(!1),n=xv.useRef(null),i=xv.useRef(null);if(xv.useEffect(()=>{0===e.length&&o&&r(!1)},[e.length,o]),xv.useEffect(()=>{if(!o)return;const e=e=>{n.current&&!n.current.contains(e.target)&&r(!1)},t=e=>{"Escape"===e.key&&(r(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),0===e.length)return null;const s=e.reduce((e,t)=>Xx[t.level]>Xx[e]?t.level:e,e[0].level),a=Vx[s]??Vx.info,l=e.length,c=`${l} chart notification${1===l?"":"s"}, most severe: ${s}`;return(0,Hx.jsxs)("div",{ref:n,className:"semiotic-chart-notifications",style:{position:"relative",display:"inline-flex"},children:[(0,Hx.jsx)("span",{style:Ox,role:"status","aria-live":"polite",children:c}),(0,Hx.jsxs)("button",{ref:i,className:"semiotic-chart-action semiotic-chart-notifications-toggle","aria-haspopup":"dialog","aria-expanded":o,"aria-label":`${c}. ${o?"Hide":"Show"} notifications`,title:c,onClick:()=>r(e=>!e),style:{...ok,color:a,position:"relative"},children:[(0,Hx.jsx)(Ux,{level:s}),(0,Hx.jsx)("span",{className:"semiotic-chart-notifications-badge","aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,minWidth:15,height:15,padding:"0 3px",boxSizing:"border-box",borderRadius:8,background:a,color:"#fff",fontSize:9,fontWeight:700,lineHeight:"15px",textAlign:"center"},children:l>99?"99+":l})]}),o&&(0,Hx.jsx)("div",{className:"semiotic-chart-notifications-popover",role:"dialog","aria-label":"Chart notifications",style:{position:"absolute",top:"calc(100% + 6px)",right:0,zIndex:20,width:320,maxWidth:"min(360px, 90vw)",maxHeight:320,overflowY:"auto",display:"flex",flexDirection:"column",gap:6,padding:10,textAlign:"left",background:"var(--semiotic-bg, #fff)",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:6,boxShadow:"0 6px 24px rgba(0, 0, 0, 0.16)"},children:e.map(e=>(0,Hx.jsx)(Kx,{notification:e.notification,level:e.level,onDismiss:()=>t(e)},e.key))})]})}var Zx={live:{bg:"#22c55e",color:"#fff"},stale:{bg:"#ef4444",color:"#fff"},paused:{bg:"#eab308",color:"#000"},error:{bg:"#ef4444",color:"#fff"},static:{bg:"#6b7280",color:"#fff"}};function Jx({height:e}){return(0,Hx.jsx)("div",{role:"status","aria-busy":"true","aria-label":"Loading chart",style:{width:"100%",height:e,background:"linear-gradient(90deg, var(--semiotic-border, #e0e0e0) 25%, var(--semiotic-bg, #f5f5f5) 50%, var(--semiotic-border, #e0e0e0) 75%)",backgroundSize:"200% 100%",animation:"semiotic-skeleton-pulse 1.5s ease-in-out infinite",borderRadius:4}})}function ek({error:e}){return(0,Hx.jsx)("div",{role:"alert",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"100%",minHeight:120,padding:24,boxSizing:"border-box"},children:(0,Hx.jsx)("div",{style:{textAlign:"center",maxWidth:400,fontSize:14,color:"var(--semiotic-text-secondary, #666)",lineHeight:1.5},children:e})})}var tk=xv.forwardRef(function({title:e,subtitle:t,children:o,width:r="100%",height:n=400,actions:i,chartConfig:s,describe:a,navigable:l,controls:c,banner:u,notifications:d,onNotificationDismiss:h,loading:p=!1,error:f,errorBoundary:g=!1,status:m,detailsPanel:y,mobile:b,mobileAudit:v,className:x,style:k},w){const S=xv.useRef(null),A=xv.useRef(null),[C,M]=xv.useState(!1),[j,P]=xv.useState(()=>new Set);xv.useEffect(()=>{P(e=>{if(0===e.size)return e;const t=new Set((d??[]).map((e,t)=>e.id??t+""));let o=!1;const r=new Set;for(const n of e)t.has(n)?r.add(n):o=!0;return o?r:e})},[d]);const _=xv.useMemo(()=>d?d.map((e,t)=>({notification:e,index:t,key:e.id??t+"",level:e.level??"info"})).filter(({key:e})=>!j.has(e)):[],[d,j]),L=xv.useCallback(e=>{P(t=>new Set(t).add(e.key)),h?.(e.notification,e.index)},[h]),R=!1!==i?.export&&void 0!==i?.export,T=!1!==i?.fullscreen&&void 0!==i?.fullscreen,I=!1!==i?.copyConfig&&void 0!==i?.copyConfig&&s,$=!0===i?.dataSummary,N=xv.useMemo(()=>{if(!a||!s?.component||!s?.props)return"";const e="object"==typeof a?a.levels:void 0;try{return Xv(s.component,s.props,e?{levels:e}:{}).text}catch{return""}},[a,s]),F="object"==typeof a&&!0===a.visible,B=xv.useMemo(()=>{if(!l||!s?.component||!s?.props)return null;const e="object"==typeof l?l.maxLeaves:void 0;try{return Zv(s.component,s.props,e?{maxLeaves:e}:{})}catch{return null}},[l,s]),D="object"==typeof l&&!0===l.visible,E=xv.useMemo(()=>"object"==typeof i?.export?i.export:{},[i?.export]),z="object"==typeof i?.copyConfig?i.copyConfig.format:"json",H=xv.useCallback(async e=>{A.current&&await Cb(A.current,{...E,...e})},[E]),O=xv.useCallback(()=>{S.current&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):S.current.requestFullscreen().catch(()=>{}))},[]),W=xv.useCallback(async e=>{s&&await av({...s,version:s.version??"1",createdAt:s.createdAt??(new Date).toISOString()},e||z||"json")},[s,z]);xv.useEffect(()=>{const e=()=>{M(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),xv.useImperativeHandle(w,()=>({export:H,toggleFullscreen:O,copyConfig:W,element:S.current}),[H,O,W]);const q=!0===b?{}:b&&"object"==typeof b?b:null,Y=!!b,G=q?.breakpoint??480,V=void 0===q?.chartMode?"mobile":q.chartMode,X=q?.semantics,U=q?.mobileInteraction??(!!Y||void 0),K=q?.standardControls,Q=Wx(K)?K:null,Z=Q?.controls??(Wx(K)?void 0:K)??function(e){return e&&"object"==typeof e?e.standardControls:void 0}(U),J=Yx(Z)?U&&"object"==typeof U?{...U,standardControls:Z}:!1===U||null==U?U:{standardControls:Z}:U,ee=Y&&Yx(Z)?(0,Hx.jsx)(Px,{controls:Z,targetSize:Q?.targetSize??qx(U)??44,compact:Q?.compact??!0,className:Q?.className,style:Q?.style,ariaLabel:Q?.ariaLabel,brush:Q?.brush,zoom:Q?.zoom,legend:Q?.legend}):null,te=q?.summary,oe=!0===q?.allowHorizontalScroll,re=!0===q?.hideToolbar,ne=xv.useMemo(()=>{if(!v||!s?.component||!s?.props)return null;const e="object"==typeof v?v:{},t=s.props;try{return zx(s.component,{...t,mobileSemantics:t.mobileSemantics??X,mobileInteraction:t.mobileInteraction??J},{viewportWidth:e.viewportWidth??390,targetSize:e.targetSize??44,inChartContainer:!0})}catch{return null}},[v,s,X,J]);xv.useEffect(()=>{if(!ne||ne.ok)return;const e=ne.findings.filter(e=>"pass"!==e.status).slice(0,5);console.warn(`[Semiotic mobile audit] ${s?.component}: ${ne.summary.highRisk} high-risk mobile finding(s), ${ne.summary.warnings} warning(s).`,e)},[ne,s?.component]);const ie=ne&&!ne.ok&&"object"==typeof v&&!0===v.visible?(0,Hx.jsxs)("div",{className:"semiotic-chart-mobile-audit",role:"status",style:{padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-warning, #6b3f00)",background:"color-mix(in srgb, var(--semiotic-warning, #d97706) 14%, var(--semiotic-bg, #fff))",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:["Mobile audit: ",ne.summary.highRisk," high-risk finding",1===ne.summary.highRisk?"":"s"," and"," ",ne.summary.warnings," warning",1===ne.summary.warnings?"":"s"," at"," ",("object"==typeof v?v.viewportWidth:void 0)??390,"px."]}):null,se=_.length>0,ae=e||t||c||R||T||I||$||m||se,le=xv.useMemo(()=>{if(!Y||!xv.isValidElement(o))return o;const e=o.props,t={};return V&&null==e.mode&&(t.mode=V),X&&null==e.mobileSemantics&&(t.mobileSemantics=X),void 0!==J&&null==e.mobileInteraction&&(t.mobileInteraction=J),Object.keys(t).length>0?xv.cloneElement(o,t):o},[o,Y,V,X,J]),ce=p?(0,Hx.jsx)(Jx,{height:n}):f?(0,Hx.jsx)(ek,{error:f}):g?(0,Hx.jsx)(rd,{children:le}):le;return ue=(0,Hx.jsxs)(Hx.Fragment,{children:[(0,Hx.jsx)("style",{dangerouslySetInnerHTML:{__html:`@keyframes semiotic-skeleton-pulse {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n@media (max-width: ${G}px) {\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-header {\n padding: 10px 12px !important;\n gap: 10px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-title-area {\n flex-basis: 100% !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-toolbar {\n width: 100% !important;\n margin-left: 0 !important;\n justify-content: flex-start !important;\n overflow-x: auto !important;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-hide-toolbar="true"] .semiotic-chart-toolbar {\n display: none !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-action {\n min-width: 32px !important;\n min-height: 32px !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-summary {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"] .semiotic-chart-mobile-standard-controls {\n display: block !important;\n }\n .semiotic-chart-container[data-semiotic-mobile="true"][data-semiotic-mobile-scroll="true"] .semiotic-chart-body {\n overflow-x: auto !important;\n justify-content: flex-start !important;\n -webkit-overflow-scrolling: touch;\n }\n}`}}),(0,Hx.jsxs)("div",{ref:S,className:"semiotic-chart-container"+(x?" "+x:""),"data-semiotic-mobile":Y?"true":void 0,"data-semiotic-mobile-scroll":oe?"true":void 0,"data-semiotic-mobile-hide-toolbar":re?"true":void 0,style:{width:r,border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:"var(--semiotic-border-radius, 8px)",overflow:"hidden",background:"var(--semiotic-bg, #fff)",fontFamily:"var(--semiotic-font-family, sans-serif)",position:"relative",...C?{display:"flex",flexDirection:"column",width:"100%",height:"100%"}:{},...k},children:[ae&&(0,Hx.jsxs)("div",{className:"semiotic-chart-header",style:{padding:"12px 16px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:8,borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:[(0,Hx.jsxs)("div",{className:"semiotic-chart-title-area",style:{minWidth:0,flex:"1 1 200px"},children:[e&&(0,Hx.jsx)("div",{className:"semiotic-chart-title",style:{fontSize:14,fontWeight:600,color:"var(--semiotic-text, #333)"},children:e}),t&&(0,Hx.jsx)("div",{className:"semiotic-chart-subtitle",style:{fontSize:12,color:"var(--semiotic-text-secondary, #666)",marginTop:e?2:0},children:t})]}),(0,Hx.jsxs)("div",{className:"semiotic-chart-toolbar",style:{display:"flex",alignItems:"center",gap:4,marginLeft:"auto"},children:[c,se&&(0,Hx.jsx)(Qx,{visible:_,onDismiss:L}),R&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:()=>H(),title:"Export chart","aria-label":"Export chart",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("path",{d:"M7 2v8M3.5 7L7 10.5 10.5 7"}),(0,Hx.jsx)("path",{d:"M2 12h10"})]})}),$&&(0,Hx.jsx)(Gx,{}),T&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:O,title:C?"Exit fullscreen":"Fullscreen","aria-label":C?"Exit fullscreen":"Enter fullscreen",style:ok,children:(0,Hx.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Hx.jsxs)(Hx.Fragment,C?{children:[(0,Hx.jsx)("path",{d:"M9 1v4h4"}),(0,Hx.jsx)("path",{d:"M5 13V9H1"}),(0,Hx.jsx)("path",{d:"M13 5H9V1"}),(0,Hx.jsx)("path",{d:"M1 9h4v4"})]}:{children:[(0,Hx.jsx)("path",{d:"M1 5V1h4"}),(0,Hx.jsx)("path",{d:"M13 9v4H9"}),(0,Hx.jsx)("path",{d:"M9 1h4v4"}),(0,Hx.jsx)("path",{d:"M5 13H1V9"})]})})}),I&&(0,Hx.jsx)("button",{className:"semiotic-chart-action",onClick:()=>W(),title:"Copy config","aria-label":"Copy chart configuration",style:ok,children:(0,Hx.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Hx.jsx)("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"}),(0,Hx.jsx)("path",{d:"M9 5V2a1 1 0 00-1-1H2a1 1 0 00-1 1v6a1 1 0 001 1h3"})]})}),m&&(0,Hx.jsx)("div",{className:"semiotic-chart-status","aria-live":"polite","aria-atomic":"true",style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",background:Zx[m].bg,color:Zx[m].color,lineHeight:"18px"},children:m})]})]}),u&&(0,Hx.jsx)("div",{className:"semiotic-chart-banner",children:u}),ie,te&&(0,Hx.jsx)("div",{className:"semiotic-chart-mobile-summary",style:{display:"none",padding:"8px 12px",fontSize:12,lineHeight:1.45,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"},children:te}),ee&&(0,Hx.jsx)("div",{className:"semiotic-chart-mobile-standard-controls",style:{display:"none",padding:"10px 12px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",background:"var(--semiotic-surface, var(--semiotic-bg, #f6f8fa))"},children:ee}),N&&(0,Hx.jsx)("div",{className:"semiotic-chart-description",role:"note",style:F?{padding:"8px 16px",fontSize:12,lineHeight:1.5,color:"var(--semiotic-text-secondary, #666)",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)"}:Ox,children:N}),B&&(0,Hx.jsx)("div",{className:"semiotic-chart-nav",style:D?{padding:"8px 8px",borderBottom:"1px solid var(--semiotic-border, #e0e0e0)",maxHeight:240,overflow:"auto"}:void 0,children:(0,Hx.jsx)(gx,{tree:B,label:"string"==typeof e&&e?e+" — navigable structure":"Chart navigable structure",visible:D,chartId:"string"==typeof s?.props?.chartId?s.props.chartId:void 0})}),(0,Hx.jsxs)("div",{className:"semiotic-chart-body",ref:A,style:{position:"relative",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",...C?{flex:1}:{height:n}},children:[ce,y]})]})]}),$?(0,Hx.jsx)(qi,{children:ue}):ue;var ue}),ok={width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0},rk=c(require("react")),nk=require("react/jsx-runtime");function ik({children:e,controls:t,mobile:o,breakpoint:r=480,chartMode:n="mobile",mobileInteraction:i=!0,mobileSemantics:s,mobileSummary:a,chips:l=[],activeChip:c,onChipChange:u,detail:d,detailTitle:h="Details",detailMode:p="sheet",initialDetailOpen:f=!1,allowHorizontalScroll:g=!1,hideToolbar:m=!1,chartDefaults:y,...b}){const[v,x]=rk.useState(()=>c??l.find(e=>!e.disabled)?.id),[k,w]=rk.useState(f);rk.useEffect(()=>{void 0===c&&(l.length?l.some(e=>e.id===v&&!e.disabled)||x(l.find(e=>!e.disabled)?.id):x(void 0))},[c,l,v]);const S=c??v,A=rk.useCallback(e=>{e.disabled||(void 0===c&&x(e.id),u?.(e))},[c,u]),C=l.length?(0,nk.jsx)("div",{className:"semiotic-mobile-chip-row",role:"list","aria-label":"Mobile chart controls",children:l.map(e=>(0,nk.jsxs)("button",{type:"button",className:"semiotic-mobile-chip","aria-pressed":e.id===S,disabled:e.disabled,onClick:()=>A(e),title:"string"==typeof e.description?e.description:void 0,children:[(0,nk.jsx)("span",{children:e.label}),e.description&&(0,nk.jsx)("small",{className:"semiotic-mobile-chip-description",children:e.description})]},e.id))}):null,M=a||C?(0,nk.jsxs)("div",{className:"semiotic-mobile-summary-card",children:[a&&(0,nk.jsx)("div",{className:"semiotic-mobile-summary-copy",children:a}),C]}):o?.summary,j={breakpoint:r,chartMode:n,mobileInteraction:i,semantics:s,allowHorizontalScroll:g,hideToolbar:m,...o,summary:M},P=rk.useMemo(()=>{if(!y||!rk.isValidElement(e))return e;const t=e.props,o={};for(const[e,r]of Object.entries(y))null==t[e]&&(o[e]=r);return Object.keys(o).length>0?rk.cloneElement(e,o):e},[e,y]),_=!!d&&"sheet"===p,L=!!d&&"inline"===p||_&&k,R=_?(0,nk.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle","aria-expanded":k,onClick:()=>w(e=>!e),children:k?"Hide details":"Show details"}):null,T=t||R?(0,nk.jsxs)("div",{className:"semiotic-mobile-control-stack",children:[t,R]}):void 0;return(0,nk.jsxs)("div",{className:"semiotic-mobile-chart-shell",children:[(0,nk.jsx)("style",{children:`\n .semiotic-mobile-chart-shell {\n display: grid;\n gap: 10px;\n width: 100%;\n }\n .semiotic-mobile-summary-card {\n display: grid;\n gap: 10px;\n }\n .semiotic-mobile-summary-copy {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-chip-row {\n display: flex;\n gap: 8px;\n overflow-x: auto;\n padding-bottom: 2px;\n -webkit-overflow-scrolling: touch;\n }\n .semiotic-mobile-chip {\n display: inline-flex;\n flex: 0 0 auto;\n flex-direction: column;\n align-items: flex-start;\n justify-content: center;\n min-height: 40px;\n min-width: 44px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 7px 12px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-chip[aria-pressed="true"] {\n border-color: var(--semiotic-accent, #1f7a6d);\n background: color-mix(in srgb, var(--semiotic-accent, #1f7a6d) 14%, transparent);\n }\n .semiotic-mobile-chip:disabled {\n cursor: not-allowed;\n opacity: 0.45;\n }\n .semiotic-mobile-chip-description {\n display: block;\n max-width: 160px;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 10px;\n font-weight: 500;\n line-height: 1.2;\n }\n .semiotic-mobile-control-stack {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n }\n .semiotic-mobile-detail-toggle {\n min-height: 32px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 999px;\n padding: 5px 10px;\n background: transparent;\n color: var(--semiotic-text, #222);\n font: inherit;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n }\n .semiotic-mobile-detail-panel {\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);\n overflow: hidden;\n }\n .semiotic-mobile-detail-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 10px 12px;\n border-bottom: 1px solid var(--semiotic-border, #d8d8d8);\n font-size: 13px;\n font-weight: 800;\n }\n .semiotic-mobile-detail-body {\n padding: 12px;\n font-size: 13px;\n line-height: 1.5;\n }\n @media (max-width: ${r}px) {\n .semiotic-mobile-detail-panel[data-mode="sheet"] {\n position: sticky;\n bottom: 8px;\n z-index: 2;\n max-height: min(55vh, 420px);\n overflow: auto;\n }\n }\n `}),(0,nk.jsx)(tk,{...b,controls:T,mobile:j,children:P}),L&&(0,nk.jsxs)("section",{className:"semiotic-mobile-detail-panel","data-mode":p,"aria-label":"string"==typeof h?h:"Chart details",children:[(0,nk.jsxs)("div",{className:"semiotic-mobile-detail-header",children:[(0,nk.jsx)("span",{children:h}),_&&(0,nk.jsx)("button",{type:"button",className:"semiotic-mobile-detail-toggle",onClick:()=>w(!1),children:"Close"})]}),(0,nk.jsx)("div",{className:"semiotic-mobile-detail-body",children:d})]})]})}var sk=c(require("react")),ak=require("react/jsx-runtime");function lk(e,t){if(t)return"function"==typeof t?t(e):e?.[t]}function ck(e,t){const o="function"==typeof t?t(e):e[t];return Array.isArray(o)?o:[]}function uk(e){return{strategy:"small-multiples",responsive:!0,supportsResponsiveLayout:!0,summary:`${e} vertically stacked small multiple panel${1===e?"":"s"} with shared scale guidance.`,interaction:{primary:"tap",alternatives:["panel summary","linked selection"],hoverFallback:"tap-to-lock",targetSize:44},labels:{strategy:"external",minFontSize:12}}}function dk(e,t){if(!sk.isValidElement(e))return e;const o=e.props,r={};for(const[e,n]of Object.entries(t))void 0!==n&&null==o[e]&&(r[e]=n);return Object.keys(r).length>0?sk.cloneElement(e,r):e}function hk({items:e,children:t,columns:o=3,tabletColumns:r=2,mobileColumns:n=1,mobileBreakpoint:i=480,tabletBreakpoint:s=860,gap:a=12,mode:l="mobile",chartHeight:c=220,sharedExtent:u=!0,valueAccessor:d,dataAccessor:h="data",extentProps:p=["yExtent","valueExtent"],linkedHover:f,selection:g,linkedBy:m,linkProvider:y="auto",selections:b,showLegend:v=!1,legendPosition:x,legendInteraction:k,legendSelectionName:w,legendField:S,mobileInteraction:A=!0,mobileSemantics:C,labelMode:M="panel",chartDefaults:j,className:P,style:_}){const L=Ah(),R=e||"function"==typeof t?[]:sk.Children.toArray(t),T=e??R.map((e,t)=>({id:"panel-"+(t+1)})),I=T.length,$=sk.useMemo(()=>function(e,t,o,r){if(t&&"object"==typeof t)return t;if(!1===t)return{};const n=[],i=[];for(const t of e)if(t.extent&&n.push(t.extent[0],t.extent[1]),r)for(const e of ck(t,o))i.push(lk(e,r));const s=function(e){let t=1/0,o=-1/0;for(const r of e){const e=Number(r);Number.isFinite(e)&&(t>e&&(t=e),e>o&&(o=e))}if(Number.isFinite(t)&&Number.isFinite(o))return t===o?[t-1,o+1]:[t,o]}(i.length?i:n);return s?{yExtent:s,valueExtent:s}:{}}(T,u,h,d),[T,u,h,d]),N=sk.useMemo(()=>{if(!m)return{name:void 0,fields:void 0,linkedHover:f,selection:g};const e=Array.isArray(m)?"small-multiples":m.name||"small-multiples",t=Array.isArray(m)?m:m.fields||[];return{name:e,fields:t,linkedHover:f??{name:e,fields:t},selection:g??{name:e}}},[m,f,g]),F=sk.useMemo(()=>({linkedHover:N.linkedHover,selection:N.selection}),[N.linkedHover,N.selection]),B=sk.useMemo(()=>{const e={mode:l,height:c,responsiveWidth:!0,mobileInteraction:A,mobileSemantics:C??uk(I),...F,...j};"legend"!==M&&(e.showLegend=!1),"direct"===M&&(e.directLabel=!0);for(const t of p)t in $&&(e[t]=$[t]);return e},[l,c,A,C,I,F,j,M,p,$]),D=(0,ak.jsxs)("section",{className:["semiotic-small-multiple-chart",P].filter(Boolean).join(" "),style:_,"data-semiotic-small-multiple":"true",children:[(0,ak.jsx)("style",{children:`\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${o};\n --semiotic-small-multiple-gap: ${a}px;\n display: grid;\n grid-template-columns: repeat(var(--semiotic-small-multiple-columns), minmax(0, 1fr));\n gap: var(--semiotic-small-multiple-gap);\n width: 100%;\n }\n .semiotic-small-multiple-panel {\n min-width: 0;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 16px;\n background: var(--semiotic-bg, #fff);\n overflow: hidden;\n }\n .semiotic-small-multiple-heading {\n display: grid;\n gap: 3px;\n padding: 10px 12px 0;\n }\n .semiotic-small-multiple-title {\n margin: 0;\n color: var(--semiotic-text, #222);\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-small-multiple-subtitle,\n .semiotic-small-multiple-summary {\n margin: 0;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.35;\n }\n .semiotic-small-multiple-plot {\n min-width: 0;\n padding: 4px 6px 8px;\n overflow: hidden;\n }\n @media (max-width: ${s}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${r};\n }\n }\n @media (max-width: ${i}px) {\n .semiotic-small-multiple-chart {\n --semiotic-small-multiple-columns: ${n};\n }\n .semiotic-small-multiple-panel {\n border-radius: 14px;\n }\n .semiotic-small-multiple-heading {\n padding: 9px 10px 0;\n }\n }\n `}),T.map((e,o)=>{const r={...B},n="function"==typeof t?t(e,{item:e,index:o,count:I,chartProps:r,sharedExtent:$}):R[o];return(0,ak.jsxs)("article",{className:"semiotic-small-multiple-panel","aria-label":"string"==typeof e.title?e.title:void 0,children:[(e.title||e.subtitle||e.summary)&&(0,ak.jsxs)("header",{className:"semiotic-small-multiple-heading",children:[e.title&&(0,ak.jsx)("h3",{className:"semiotic-small-multiple-title",children:e.title}),e.subtitle&&(0,ak.jsx)("p",{className:"semiotic-small-multiple-subtitle",children:e.subtitle}),e.summary&&(0,ak.jsx)("p",{className:"semiotic-small-multiple-summary",children:e.summary})]}),(0,ak.jsx)("div",{className:"semiotic-small-multiple-plot",children:dk(n,r)})]},e.id??o)})]});return!0===y||"auto"===y&&(m||f||g||b||!0===v)&&!L?(0,ak.jsx)(Ih,{selections:b,showLegend:v,legendPosition:x,legendInteraction:k,legendSelectionName:w??N.name??"small-multiples",legendField:S??N.fields?.[0]??"category",children:D}):D}var pk=c(require("react")),fk=require("react/jsx-runtime");function gk({children:e,columns:t="auto",minCellWidth:o=300,gap:r=16,tabletColumns:n,mobileColumns:i=1,mobileBreakpoint:s=480,tabletBreakpoint:a=860,chartDefaults:l,className:c,style:u}){const d="semiotic-chart-grid-"+pk.useId().replace(/[^a-zA-Z0-9_-]/g,""),h="number"==typeof t?t:void 0,p="auto"===t?`repeat(auto-fill, minmax(${o}px, 1fr))`:`repeat(${t}, 1fr)`,f=["semiotic-chart-grid",d,c].filter(Boolean).join(" ");return(0,fk.jsxs)(fk.Fragment,{children:[(0,fk.jsx)("style",{children:`\n ${n?`\n @media (max-width: ${a}px) {\n .${d} {\n grid-template-columns: repeat(${n}, minmax(0, 1fr)) !important;\n }\n }`:""}\n @media (max-width: ${s}px) {\n .${d} {\n grid-template-columns: repeat(${i}, minmax(0, 1fr)) !important;\n }\n .${d} > [data-semiotic-chart-grid-primary="true"] {\n grid-column: span ${i} !important;\n }\n }\n `}),(0,fk.jsx)("div",{className:f,style:{display:"grid",gridTemplateColumns:p,gap:r,width:"100%",...u},children:pk.Children.map(e,e=>{if(!pk.isValidElement(e))return e;const t=e.props,o={};if(l)for(const[e,r]of Object.entries(l))null==t[e]&&(o[e]=r);const r=Object.keys(o).length>0?pk.cloneElement(e,o):e;return"primary"!==e.props.emphasis||void 0!==h&&2>h?r:(0,fk.jsx)("div",{"data-semiotic-chart-grid-primary":"true",style:{gridColumn:"span 2",minWidth:0},children:r})})})]})}gk.displayName="ChartGrid";var mk=c(require("react")),yk=require("react/jsx-runtime");function bk({children:e,context:t,position:o="right",contextSize:r=250,mobilePosition:n="bottom",mobileBreakpoint:i=480,gap:s=12,className:a,style:l}){const c="semiotic-context-layout-"+mk.useId().replace(/[^a-zA-Z0-9_-]/g,""),u="left"===o||"right"===o,d="left"===o||"top"===o,h={display:"flex",flexDirection:u?d?"row-reverse":"row":d?"column-reverse":"column",gap:s,width:"100%",...l},p=u?{flex:`0 0 ${r}px`,width:r,minHeight:0}:{flex:`0 0 ${r}px`,height:r,minWidth:0};return(0,yk.jsxs)(yk.Fragment,{children:[(0,yk.jsx)("style",{children:`\n @media (max-width: ${i}px) {\n .${c}[data-mobile-position="bottom"] {\n flex-direction: column !important;\n }\n .${c}[data-mobile-position="top"] {\n flex-direction: column-reverse !important;\n }\n .${c}[data-mobile-position="bottom"] > .semiotic-context-panel,\n .${c}[data-mobile-position="top"] > .semiotic-context-panel {\n flex: 0 0 auto !important;\n width: 100% !important;\n height: auto !important;\n }\n }\n `}),(0,yk.jsxs)("div",{className:["semiotic-context-layout",c,a].filter(Boolean).join(" "),"data-mobile-position":n,style:h,children:[(0,yk.jsx)("div",{className:"semiotic-context-primary",style:{flex:"1 1 0%",minWidth:0,minHeight:0},children:e}),(0,yk.jsx)("div",{className:"semiotic-context-panel",style:p,children:t})]})]})}bk.displayName="ContextLayout";var vk=require("react"),xk=2*Math.PI;function kk(e,t,o){const r=o?.center?.x??0,n=o?.center?.y??0;return{x:r+Math.sin(e)*t,y:n-Math.cos(e)*t}}function wk(e,t,o,r,n){const i=n?.center,s=(e,t)=>{const{x:o,y:r}=kk(e,t,{center:i});return`${Sk(o)},${Sk(r)}`},a=Math.max(0,o),l=Math.max(a,r),c=Math.abs(t-e),u=e>t?0:1;if(c>=xk-1e-6){const e=i?.x??0,t=i?.y??0,o=`${Sk(e)},${Sk(t-l)}`,r=`${Sk(e)},${Sk(t+l)}`;let n=`M${o} A${Sk(l)},${Sk(l)} 0 1 1 ${r} A${Sk(l)},${Sk(l)} 0 1 1 ${o} Z`;if(a>0){const o=`${Sk(e)},${Sk(t-a)}`,r=`${Sk(e)},${Sk(t+a)}`;n+=` M${o} A${Sk(a)},${Sk(a)} 0 1 0 ${r} A${Sk(a)},${Sk(a)} 0 1 0 ${o} Z`}return n}const d=c>Math.PI?1:0,h=s(e,l),p=s(t,l);if(0>=a){const e=i?.x??0,t=i?.y??0;return`M${Sk(e)},${Sk(t)} L${h} A${Sk(l)},${Sk(l)} 0 ${d} ${u} ${p} Z`}const f=s(t,a),g=s(e,a);return`M${h} A${Sk(l)},${Sk(l)} 0 ${d} ${u} ${p} L${f} A${Sk(a)},${Sk(a)} 0 ${d} ${1===u?0:1} ${g} Z`}function Sk(e){return Math.round(1e3*e)/1e3}function Ak(e,t,o=0){return t>0?((e-o)%t+t)%t+o:e}var Ck=require("react/jsx-runtime");function Mk({value:e,onChange:t,period:o=365,radius:r=180,innerRadius:n=14,width:i,height:s,step:a=1,largeStep:l=7,label:c="Range",formatValue:u,arcFill:d="var(--semiotic-primary, #4e79a7)",stroke:h="var(--semiotic-bg, #ffffff)",className:p,style:f}){const g=i??2*r+40,m=s??2*r+40,y=g/2,b=m/2,v=function(e){const[t,o]=e,r=o-t||1,n=xk;return e=>0+(e-t)/r*(n-0)}([0,o]),x=(0,vk.useRef)(null),k=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,r=t.getBoundingClientRect(),n=t.viewBox?.baseVal;return Math.round((Math.atan2((n?.width||g)/(r.width||1)*(e.clientX-r.left)-y-0,-((n?.height||m)/(r.height||1)*(e.clientY-r.top)-b-0))+xk)%xk/xk*o)%o},w=(e,t)=>{e.preventDefault(),e.stopPropagation();const o=e.currentTarget.ownerSVGElement;o?.setPointerCapture?.(e.pointerId),x.current={mode:t,lastValue:k(e)}},S=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),x.current=null},A=(e,r)=>{t("range"===e?e=>({start:Ak(e.start+r,o),end:Ak(e.end+r,o)}):t=>({...t,[e]:Ak(t[e]+r,o)}))},C=e=>t=>{const o=t.shiftKey?l:a;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),A(e,o)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),A(e,-o))},M=e.start>e.end?[[e.start,o],[0,e.end]]:[[e.start,e.end]],j=e=>u?u(e):e+"";return(0,Ck.jsx)("svg",{viewBox:`0 0 ${g} ${m}`,width:g,height:m,className:p,onPointerMove:e=>{const r=x.current;if(!r)return;const n=k(e);if("range"===r.mode){const e=function(e,t,o){if(0>=o)return t-e;let r=(t-e)%o;return r>o/2?r-=o:-o/2>r&&(r+=o),r}(r.lastValue,n,o);if(0===e)return;return r.lastValue=n,void t(t=>({start:Ak(t.start+e,o),end:Ak(t.end+e,o)}))}t(e=>({...e,[r.mode]:n}))},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,style:{touchAction:"none",...f},"aria-label":c+" brush",children:(0,Ck.jsxs)("g",{transform:`translate(${y},${b})`,children:[(0,Ck.jsx)("g",{role:"slider",tabIndex:0,"aria-label":c+" (move both ends)","aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":e.start,"aria-valuetext":`${j(e.start)} to ${j(e.end)}`,onPointerDown:e=>w(e,"range"),onKeyDown:C("range"),style:{cursor:"grab"},children:M.map(([e,t],o)=>(0,Ck.jsx)("path",{d:wk(v(e),v(t),n,r),fill:d,fillOpacity:.35,stroke:h,strokeWidth:1},o))}),["start","end"].map(t=>{const i=e[t],s=(e=>kk(v(e),n))(i),a=(e=>kk(v(e),r+8))(i);return(0,Ck.jsxs)("g",{role:"slider",tabIndex:0,"aria-label":`${c} ${t}`,"aria-valuemin":0,"aria-valuemax":o-1,"aria-valuenow":i,"aria-valuetext":j(i),onPointerDown:e=>w(e,t),onKeyDown:C(t),style:{cursor:"grab"},children:[(0,Ck.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:"transparent",strokeWidth:20}),(0,Ck.jsx)("line",{x1:s.x,y1:s.y,x2:a.x,y2:a.y,stroke:h,strokeWidth:1.5}),(0,Ck.jsx)("circle",{cx:a.x,cy:a.y,r:4.5,fill:h,stroke:d,strokeWidth:1})]},t)})]})})}var jk=c(require("react")),Pk=require("react"),_k=require("react/jsx-runtime");function Lk(e,t,o,r){return Math.min(o,Math.max(t,Number((t+Math.round((Math.min(o,Math.max(t,e))-t)/r)*r).toFixed(12))))}function Rk({value:e,onChange:t,pointerToValue:o,min:r,max:n,step:i=1,largeStep:s=5*i,x:a,y:l,controlType:c="value",controlId:u,label:d,valueText:h,radius:p=12,fill:f="var(--semiotic-bg, #ffffff)",stroke:g="var(--semiotic-primary, #4e79a7)",strokeWidth:m=4,labelText:y,labelDx:b=16,labelDy:v=-16,labelClassName:x,className:k,disabled:w=!1,onChangeStart:S,onChangeEnd:A,onObservation:C,chartId:M,chartType:j}){const P=(0,Pk.useRef)(null),_=(0,Pk.useRef)(e);_.current=e;const L=jk.useMemo(()=>Bb({controlType:c,controlId:u,chartId:M,chartType:j,onObservation:C}),[M,j,u,c,C]),R=e=>{if(w)return;const s=o(e);if(null==s||!Number.isFinite(s))return;const a=Lk(s,r,n,i);_.current=a,t(a),L("control-change",a,"pointer")},T=e=>{e.stopPropagation(),P.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),P.current=null,A?.(_.current),L("control-end",_.current,"pointer"))},I=["semiotic-direct-manipulation-control",k].filter(Boolean).join(" ");return(0,_k.jsxs)("g",{className:I,role:"slider",tabIndex:w?-1:0,"aria-disabled":w||void 0,"aria-label":d,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":h??`${d}: ${e}`,"aria-roledescription":"visualization control","data-viz-control":c,"data-viz-control-id":u,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{w||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),P.current=e.pointerId,S?.(_.current),L("control-start",_.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),P.current===e.pointerId&&R(e)},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:e=>{if(w)return;const o=e.shiftKey?s:i,a=_.current;let l=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(l=a-o),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(l=a+o),"Home"===e.key&&(l=r),"End"===e.key&&(l=n),null===l)return;e.preventDefault();const c=Lk(l,r,n,i);_.current=c,t(c),L("control-change",c,"keyboard")},style:{cursor:w?"default":"grab",touchAction:"none"},children:[(0,_k.jsx)("circle",{className:"semiotic-direct-manipulation-control__hit",cx:a,cy:l,r:p+10,fill:"transparent"}),(0,_k.jsx)("circle",{className:"semiotic-direct-manipulation-control__handle",cx:a,cy:l,r:p,fill:f,stroke:g,strokeWidth:m}),y?(0,_k.jsx)("text",{className:x,x:a+b,y:l+v,fill:g,children:y}):null]})}var Tk=require("react"),Ik=require("react/jsx-runtime"),$k=200;function Nk({children:e,position:t="right",size:o=300,trigger:r="click",chartId:n,observation:i,dismissOnEmpty:s=!0,showClose:a=!0,onToggle:l,className:c,style:u}){const[d,h]=(0,Tk.useState)(null),[p,f]=(0,Tk.useState)(null),[g,m]=(0,Tk.useState)(!1),[y,b]=(0,Tk.useState)(!1),v=(0,Tk.useRef)(null),x=(0,Tk.useRef)(void 0),k="click"===r?["click","click-end"]:["hover","hover-end"],{latest:w}=xh({types:k,chartId:n,limit:1}),S=void 0!==i?i:w,A=(0,Tk.useCallback)(()=>{b(!0),m(!1),clearTimeout(x.current),x.current=setTimeout(()=>{b(!1),h(null),f(null)},$k)},[]);if((0,Tk.useEffect)(()=>{if(S)if("click"===S.type||"hover"===S.type){const e=S;h(e.datum),f(e),m(e=>(e||(b(!0),clearTimeout(x.current),x.current=setTimeout(()=>b(!1),$k)),!0))}else!s||"click-end"!==S.type&&"hover-end"!==S.type||A()},[s,A,S]),(0,Tk.useEffect)(()=>{l?.(g)},[g,l]),(0,Tk.useEffect)(()=>()=>clearTimeout(x.current),[]),!d&&!y)return null;const C=d&&p?e(d,p):null;if(null===C&&!y)return null;const M=function(e,t,o,r){const n={position:"absolute",background:"var(--semiotic-bg, #fff)",borderColor:"var(--semiotic-border, #e0e0e0)",borderStyle:"solid",borderWidth:0,boxSizing:"border-box",zIndex:10,display:"flex",flexDirection:"column",transition:r?`transform ${$k}ms ease-out, opacity ${$k}ms ease-out`:void 0};return"right"===e?{...n,top:0,right:0,width:t,height:"100%",borderLeftWidth:1,padding:"12px 16px",transform:o?"translateX(0)":`translateX(${t}px)`,opacity:o?1:0}:"bottom"===e?{...n,bottom:0,left:0,width:"100%",height:t,borderTopWidth:1,padding:"12px 16px",transform:o?"translateY(0)":`translateY(${t}px)`,opacity:o?1:0}:{...n,top:"50%",left:"50%",transform:o?"translate(-50%, -50%) scale(1)":"translate(-50%, -50%) scale(0.95)",opacity:o?1:0,width:Math.min(t,400),maxHeight:"80%",borderWidth:1,borderRadius:8,padding:"16px 20px",boxShadow:"0 8px 32px rgba(0,0,0,0.12)"}}(t,o,g,y);return(0,Ik.jsxs)("div",{ref:v,className:`semiotic-details-panel semiotic-details-${t}${c?" "+c:""}`,style:{...M,...u},children:[a&&(0,Ik.jsx)("button",{className:"semiotic-details-close",onClick:A,"aria-label":"Close details",style:Fk,children:(0,Ik.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:(0,Ik.jsx)("path",{d:"M2 2l8 8M10 2l-8 8"})})}),(0,Ik.jsx)("div",{className:"semiotic-details-content",style:{overflow:"auto",flex:1},children:C})]})}var Fk={position:"absolute",top:8,right:8,width:20,height:20,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",borderRadius:4,color:"var(--semiotic-text-secondary, #666)",padding:0,zIndex:1};Nk.displayName="DetailsPanel";var Bk=require("react"),Dk=require("d3-force"),Ek=1e3;function zk(e,t,o={}){const r=o.iterations??260,n=o.repulsion??5200,i=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,u=o.nodePadding??3,d=o.inset??.06,h=function(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(o.seed??1),p=new Map;for(const t of e)p.set(t.id,0);for(const e of t)p.set(e.source,(p.get(e.source)??0)+1),p.set(e.target,(p.get(e.target)??0)+1);const f=Ek/2,g=e.map(e=>({id:e.id,data:e,x:200+600*h(),y:200+600*h()})),m=new Set(e.map(e=>e.id)),y=t.filter(e=>m.has(e.source)&&m.has(e.target)).map(e=>({source:e.source,target:e.target}));if(r>0){const e=(0,Dk.forceSimulation)(g).randomSource(h).alphaDecay(1-Math.pow(.001,1/r)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",(0,Dk.forceManyBody)().strength(e=>{const t=p.get(e.id)??0;return 2.5*-Math.sqrt(n)*Math.sqrt(t+1)})).force("collide",(0,Dk.forceCollide)(e=>(e=>"function"==typeof c?c(e.data):c)(e)+u).strength(.9).iterations(2)).force("center",(0,Dk.forceCenter)(f,f).strength(.8)).force("x",(0,Dk.forceX)(f).strength(a)).force("y",(0,Dk.forceY)(f).strength(a));y.length>0&&e.force("link",(0,Dk.forceLink)(y).id(e=>e.id).distance(i).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(p.get("string"==typeof e.source?e.source:e.source.id)??1,p.get(t)??1));return s/.045/o})),e.stop();for(let t=0;r>t;t+=1)e.tick()}let b=1/0,v=1/0,x=-1/0,k=-1/0;for(const e of g){const t=e.x??f,o=e.y??f;b>t&&(b=t),v>o&&(v=o),t>x&&(x=t),o>k&&(k=o)}const w=x-b,S=k-v,A={};for(const e of g)A[e.id]={x:0===w?.5:d+((e.x??f)-b)/w*(1-2*d),y:0===S?.5:d+((e.y??f)-v)/S*(1-2*d)};return A}var Hk=16,Ok=new WeakMap;function Wk(e){const t=[];for(const o of Object.keys(e).sort()){const r=e[o];if(void 0!==r){if("function"==typeof r)return null;t.push(`${o}:${r+""}`)}}return t.join("|")}function qk(e,t,o){return null==o?null:Ok.get(e)?.get(t)?.get(o)??null}function Yk(e,t,o,r){if(null==o)return;let n=Ok.get(e);n||(n=new WeakMap,Ok.set(e,n));let i=n.get(t);if(i||(i=new Map,n.set(t,i)),!i.has(o)&&i.size>=Hk){const e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(o,r)}function Gk(e,t,o={}){const r=Li(),{seed:n,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:g}=o,m=(0,Bk.useMemo)(()=>({seed:n,iterations:i,repulsion:s,linkDistance:a,linkStrength:l,centerStrength:c,damping:u,nodeRadius:d,nodePadding:h,inset:p,execution:f,workerThreshold:g}),[n,i,s,a,l,c,u,d,h,p,f,g]),y=(0,Bk.useRef)(r),[b,v]=(0,Bk.useState)(()=>{if("undefined"==typeof window||r){const o=zk(e,t,m);return Yk(e,t,Wk(m),o),{positions:o,status:"ready",error:null}}const o=qk(e,t,Wk(m));return o?{positions:o,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return(0,Bk.useEffect)(()=>{if(y.current)return void(y.current=!1);const o=Wk(m),r=qk(e,t,o);if(r)return void v(e=>"ready"===e.status&&e.positions===r?e:{positions:r,status:"ready",error:null});const n=new AbortController;return v(e=>({positions:e.positions,status:"pending",error:null})),async function(e,t,o={}){const{execution:r="auto",signal:n,workerThreshold:i,nodeRadius:s,...a}=o,l=a.iterations??260;if(!gd()||!fd(r,e.length,t.length,l,i))return zk(e,t,{...a,nodeRadius:s});const c={kind:"normalized",nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),options:a,nodeRadii:"function"==typeof s?Object.fromEntries(e.map(e=>[e.id,s(e)])):null==s?void 0:Object.fromEntries(e.map(e=>[e.id,s]))};try{return(await vd(c,n)).positions}catch(o){if("AbortError"===o?.name)throw o;return zk(e,t,{...a,nodeRadius:s})}}(e,t,{...m,signal:n.signal}).then(r=>{Yk(e,t,o,r),v({positions:r,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&v(t=>({positions:t.positions,status:"error",error:e}))}),()=>n.abort()},[e,t,m]),b}var Vk=c(require("react"));function Xk(e){const t=e.designContract?.chartFamily??e.title??"chart",o=e.audience?.primary?" for "+e.audience.primary:"",r=e.designContract?.whyThisForm;return`${t}: ${e.intent.primary}${o}${r?". "+r:""}`}function Uk(e,t){const o=e.intents.map(e=>"string"==typeof e?e:e.id??e.name).filter(e=>!!e),r=e.intents.find(e=>"string"!=typeof e&&"primary"===e.strength),n=("object"==typeof r?r.id??r.name:void 0)??o[0]??"explanation";return{ididVersion:"0.1",chartId:t.chartId,title:t.title??e.name,intent:{primary:n,secondary:o.filter(e=>e!==n)},audience:{primary:e.audience?.primary,familiarityAssumptions:Object.fromEntries(Object.entries(e.audience?.familiarity??{}).map(([e,t])=>[e,t+""])),literacyTargets:e.audience?.literacyTargets?.map(e=>({feature:e.concept,rationale:e.rationale}))},reception:e.reception?{channels:e.reception.channels,strengths:e.reception.strengths,risks:e.reception.risks,scaffolds:e.reception.scaffolds,memorableForm:e.reception.memorableForm}:void 0,designContract:{chartFamily:e.frameFamily,whyThisForm:e.designContract.whyThisForm??e.designContract.whyCustom,whyNotDefault:e.designContract.whyNotDefault,risks:e.reception?.risks,misuse:e.designContract.misuse},accessibility:{description:t.description,navigation:"required"===e.accessibility.keyboardNavigation||null!=e.navigation,dataFallback:!0===e.accessibility.fallbackTable||"required"===e.accessibility.accessibleTable||!0===e.accessibility.requiresAccessibleTable,manualChecks:["real screen-reader behavior","keyboard order quality","custom metaphor comprehension","animation distraction"]},provenance:t.dataSources||t.reviewStatus?{dataSources:t.dataSources,reviewStatus:t.reviewStatus,generatedBy:"Semiotic recipe intelligence"}:void 0}}var Kk=require("react/jsx-runtime");function Qk({manifest:e,label:t="Intent Mark",className:o,showSummary:r=!0}){const[n,i]=Vk.useState(!1),s=Vk.useMemo(()=>JSON.stringify(e,null,2),[e]),a=Vk.useCallback(async()=>{"undefined"!=typeof navigator&&navigator.clipboard&&(await navigator.clipboard.writeText(s),i(!0),window.setTimeout(()=>i(!1),1200))},[s]);return(0,Kk.jsxs)("details",{className:o?"semiotic-intent-mark "+o:"semiotic-intent-mark",style:{border:"1px solid var(--semiotic-border, #c8c8c8)",borderRadius:6,background:"var(--semiotic-surface, #fff)",color:"var(--semiotic-text, #222)",fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Kk.jsxs)("summary",{style:{cursor:"pointer",padding:"7px 10px",fontSize:12,fontWeight:700,letterSpacing:"0.04em",textTransform:"uppercase"},children:[t," · ",e.intent.primary]}),(0,Kk.jsxs)("div",{style:{padding:"0 10px 10px"},children:[r&&(0,Kk.jsx)("p",{style:{margin:"4px 0 10px",fontSize:13,lineHeight:1.45},children:Xk(e)}),(0,Kk.jsx)("button",{type:"button",onClick:a,style:{border:"1px solid currentColor",borderRadius:4,background:"transparent",color:"inherit",padding:"4px 8px",font:"inherit",fontSize:12,cursor:"pointer"},children:n?"Copied":"Copy manifest"}),(0,Kk.jsx)("pre",{style:{maxHeight:280,overflow:"auto",margin:"10px 0 0",padding:10,background:"var(--semiotic-background, #f5f5f5)",fontSize:11,lineHeight:1.45,whiteSpace:"pre-wrap"},children:s})]})]})}var Zk=require("react"),Jk="";function ew(e){if("datum"===e.role&&e.datum)return e.datum;for(const t of e.children??[]){const e=ew(t);if(e)return e}return null}function tw(e,t){return e?t.map(t=>e[t]+"").join(Jk):""}function ow(e){const{tree:t,chartId:o,observe:r=["hover","click"]}=e,n=e.selectionName??"__semiotic-nav-sync"+(o?":"+o:""),i=(0,Zk.useMemo)(()=>{if(e.matchFields)return e.matchFields;const o=ew(t);return o?Object.keys(o).filter(e=>{return!e.startsWith("_")&&(null==(t=o[e])||"string"==typeof t||"number"==typeof t||"boolean"==typeof t);var t}):[]},[e.matchFields,t]),s=(0,Zk.useMemo)(()=>{const e=new Map,o=t=>{if("datum"===t.role&&t.datum){const o=tw(t.datum,i);e.has(o)||e.set(o,t.id)}for(const e of t.children??[])o(e)};return o(t),e},[t,i]),{selectPoints:a,clear:l}=hh({name:n,fields:i}),{latest:c}=xh({chartId:o,types:[...r,"hover-end"],limit:1}),[u,d]=(0,Zk.useState)(t.id);(0,Zk.useEffect)(()=>{d(t.id),l()},[t,l]);const h=(0,Zk.useCallback)(e=>{if(d(e.id),"datum"===e.role&&e.datum&&i.length>0){const t={};for(const o of i)t[o]=[e.datum[o]];a(t)}else l()},[i,a,l]),p=e.annotations,f=(0,Zk.useMemo)(()=>{const e=new Set;if(0===i.length||!p)return e;for(const t of p){const o=s.get(tw(t,i));o&&e.add(o)}return e},[p,s,i]),g=(0,Zk.useCallback)(e=>{const t="number"==typeof e?p?.[e]:e;if(!t||0===i.length)return!1;const o=s.get(tw(t,i));if(!o)return!1;d(o);const r={};for(const e of i)r[e]=[t[e]];return a(r),!0},[p,s,i,a]),m=(0,Zk.useRef)(null);return(0,Zk.useEffect)(()=>{if(!c||c===m.current)return;if(m.current=c,"hover-end"===c.type)return;const e=c.datum;if(!e||0===i.length)return;const t=s.get(tw(e,i));t&&t!==u&&d(t)},[c,s,i,u]),{activeId:u,onActiveChange:h,selection:{name:n},annotatedIds:f,focusAnnotation:g}}y();var rw=require("react");function nw(e,t,o,r){const n=new Map;o.forEach((e,t)=>{n.set(r?r(e,t):t+"",e)});const i=[];t.forEach((e,t)=>{n.has(t)||i.push(t)}),i.length>0&&e.remove?.(i);const s=[];if(n.forEach((o,r)=>{const n=t.get(r);void 0===n?s.push(o):n!==o&&(e.update?e.update(r,()=>o):(e.remove?.(r),s.push(o)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(const t of s)e.push(t);return n}function iw(e,t,o={}){const{id:r,resetKey:n}=o,i=(0,rw.useMemo)(()=>function(e){return null==e?null:"function"==typeof e?(t,o)=>{const r=e(t,o);return null==r?o+"":r+""}:(t,o)=>{const r=t[e];return null==r?o+"":r+""}}(r),[r]),s=(0,rw.useRef)({map:new Map,handle:null,resetKey:void 0});(0,rw.useEffect)(()=>{const o=e.current;if(!o)return;const r=s.current;r.handle===o&&r.resetKey===n||(o.clear?.(),r.map=new Map,r.handle=o,r.resetKey=n),r.map=nw(o,r.map,t,i)},[e,t,i,n])}var sw=require("react/jsx-runtime");function aw({items:e,title:t="Additional notes",empty:o=null,ordered:r=!0,renderItem:n,className:i,style:s}){if(!e.length)return o?(0,sw.jsx)(sw.Fragment,{children:o}):null;const a=r?"ol":"ul";return(0,sw.jsxs)("section",{className:["semiotic-mobile-annotation-callouts",i].filter(Boolean).join(" "),style:s,children:[(0,sw.jsx)("style",{children:"\n .semiotic-mobile-annotation-callouts {\n display: grid;\n gap: 8px;\n padding: 10px 12px;\n border: 1px solid var(--semiotic-border, #d8d8d8);\n border-radius: 14px;\n background: var(--semiotic-bg, #fff);\n color: var(--semiotic-text, #222);\n }\n .semiotic-mobile-annotation-callouts h3 {\n margin: 0;\n font-size: 13px;\n font-weight: 800;\n line-height: 1.25;\n }\n .semiotic-mobile-annotation-callouts ol,\n .semiotic-mobile-annotation-callouts ul {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 18px;\n }\n .semiotic-mobile-annotation-callouts li {\n font-size: 13px;\n line-height: 1.45;\n }\n .semiotic-mobile-annotation-callouts small {\n display: block;\n margin-top: 2px;\n color: var(--semiotic-text-secondary, #666);\n font-size: 11px;\n line-height: 1.3;\n }\n "}),t&&(0,sw.jsx)("h3",{children:t}),(0,sw.jsx)(a,{children:e.map((e,t)=>(0,sw.jsx)("li",{children:n?n(e,t):(0,sw.jsxs)(sw.Fragment,{children:[(0,sw.jsx)("span",{children:e.label}),(e.source||e.emphasis)&&(0,sw.jsx)("small",{children:[e.emphasis,e.source].filter(Boolean).join(" - ")})]})},e.id))})]})}
|